/*! * filename: ej2-spreadsheet.min.js * version : 19.1.64 * Copyright Syncfusion Inc. 2001 - 2020. All rights reserved. * Use of this code is subject to the terms of our license. * A copy of the current license can be obtained at any time by e-mailing * licensing@syncfusion.com. Any infringement will be prosecuted under * applicable laws. */ this.ej=this.ej||{},this.ej.spreadsheet=function(e,t,r,n,i,a,o,s,l,h,d,p){"use strict";function c(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=u(e),r.push(t[0]),r.push(t[1])}),r}function u(e){return[parseInt(e.match(/\d+/)[0],10)-1,f(e.match(/[A-Z]+/i)[0].toUpperCase())]}function f(e){for(var t=0,r=(e=e.split("").reverse().join("")).length-1;r>=0;r--)t+=(e[r].charCodeAt(0)-64)*Math.pow(26,r);return t-1}function g(e,t){return v(t+1)+(e+1)}function m(e){return g(e[0],e[1])+":"+(t.isNullOrUndefined(e[2])?g(e[0],e[1]):g(e[2],e[3]))}function v(e){return e/26>1?v(e%26==0?e/26-1:Math.floor(e/26))+String.fromCharCode(e%26==0?"Z".charCodeAt(0):64+e%26):String.fromCharCode(64+e)}function y(e){return c(C(e))}function C(e){return e.split("!")[1]||e}function b(e){return e.name+"!"+e.selectedRange}function S(e,t){var r;return r=t.indexOf("!")>-1?ae(e,se(t)):e.activeSheetIndex,{sheetIndex:r,indices:y(t)}}function x(e){var t=e.slice();return e[0]>e[2]&&w(t,0,2),e[1]>e[3]&&w(t,1,3),t}function w(e,t,r){var n=e[t];e[t]=e[r],e[r]=n}function I(e){return e[0]===e[2]&&e[1]===e[3]}function E(e,t,r,n,i){return new St(e,t,r,n,i)}function R(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),t?k(t,e%t):e}function A(e){(e=(e=Number(e))>0&&e<1?1+e:0===e?1:e)>60&&(e-=1);var t=new Date("01/01/1900"),r=Date.UTC(t.getFullYear(),t.getMonth(),t.getDate(),t.getHours(),t.getMinutes(),t.getSeconds(),t.getMilliseconds());return new Date(new Date(864e5*(e-1)+r).toUTCString().replace(" GMT",""))}function T(e,t,r){var n=new Date("01/01/1900"),i=F(e)?e:new Date(e),a=Date.UTC(n.getFullYear(),n.getMonth(),n.getDate(),n.getHours(),n.getMinutes(),n.getSeconds(),n.getMilliseconds()),o=(Date.UTC(i.getFullYear(),i.getMonth(),i.getDate(),i.getHours(),i.getMinutes(),i.getSeconds(),i.getMilliseconds())-a)/864e5;return(t?o:parseInt(o.toString(),10))+(r?0:o>60?2:1)}function F(e){return"[object Date]"===Object.prototype.toString.call(e)&&!isNaN(e.valueOf())}function L(e){return e-parseFloat(e)>=0}function N(e,r,n){var i=t.getDefaultDateObject(),a=i.dateTimeFormats.availableFormats,o={dateObj:null,isCustom:!1,type:""};if("string"==typeof e&&(e=e.toUpperCase()),n&&(o.dateObj=r.parseDate(e,{format:n}),o.dateObj&&(o.type=e.toString().indexOf(":")>-1?"time":"datetime",o.isCustom=!0)),t.isNullOrUndefined(o.dateObj)){for(var s=0,l=Object.keys(i.dateFormats);s-1?"time":"datetime","time"===o.type){f=o.dateObj.toLocaleTimeString();o.dateObj=new Date("01/01/1900 "+f)}o.isCustom=!0;break}}if(t.isNullOrUndefined(o.dateObj))for(var p=0,c=Object.keys(i.timeFormats);p-1&&(t=e.indexOf("* ")>-1?"Accounting":"Currency")}return t}function B(e){return void 0===e}function M(e){switch(e){case"dd-MMM-yyyy":case"dd MMM yyyy":e="medium";break;case"MMM-yyyy":case"MMM yyyy":e="yMMM";break;case"MM-dd-yyyy":case"dd-MM-yyyy":case"dd-MM-yy":case"MM/dd/yyyy":case"dd/MM/yyyy":case"dd/MM/yy":e="short";break;case"dddd MMMM dd yyyy":case"dd MMMM yyyy":e="long";break;case"d MMMM yyyy":e="yMMMd";break;case"yyyy":e="y";break;case"h:mm":e="Hm";break;case"h:mm tt":e="hm";break;case"h":e="H";break;case"h tt":e="h";break;case"dddd":e="E";break;case"h:mm:ss tt":e="hms";break;case"h:mm:ss":e="Hms";break;case"d":e="d";break;case"d dddd":e="Ed";break;case"M":e="M";break;case"Md":e="Md";break;case"MMM":e="MMM";break;case"ddd MMM d":e="MMMEd";break;case"MMM d":e="MMMd";break;case"M/yyyy":e="yM";break;default:e=""}return e}function P(e){var t=[];return e.includeBasicFormulas&&t.push({member:"basic-formulas",args:[e]}),t}function _(e,r){for(var n=r,i=e.replace(/\[/g,".").replace(/\]/g,"").split("."),a=0;a0&&r<9;){e--;var n="A".charCodeAt(0);t[r]=String.fromCharCode(e%26+n),e=parseInt((e/26).toString(),10),r++}for(var i=[],a=0;a-1){var r=t.split(":");if(K(r[0])&&K(r[1]))return!0}else if(t.indexOf(":")<0&&K(t))return!0;return!1}function W(e){return e.charCodeAt(0)>=65&&e.charCodeAt(0)<=90||e.charCodeAt(0)>=97&&e.charCodeAt(0)<=122}function G(e,t,r){return e&&t>=e[0]&&t<=e[2]&&r>=e[1]&&r<=e[3]}function Y(e,t,r){var n=e[0]<=t[0]&&e[2]>=t[2]&&e[1]<=t[1]&&e[3]>=t[3];if(n)return!0;if(r){if(t[0]e[2]&&t[2]>e[2])return!1;if(t[0]e[0]&&(t[0]=e[0],n=!0),t[2]>e[2]&&(t[2]=e[2],n=!0),t[1]e[3]&&t[3]>e[3])return!1;t[1]e[1]&&(t[1]=e[1],n=!0),t[3]>e[3]&&(t[3]=e[3],n=!0)}return n}function X(e,t){return e||(e={}),!!e.isLocked||!1!==e.isLocked&&(!(!t||!t.isLocked)||!(e.isLocked||!t||!1===t.isLocked))}function K(e){for(var t=e,r=0,n=0,i=[89,71,69],a="",o=t.length,s=0;s0)break;return!1}n++}var h=parseFloat(t.substring(r,o));if(h>0&&h<1048577)return!0}return!1}function $(e,t,r,n,i){var a=ye(r,e);if(!a||!a.cells){if(!n)return i?{}:null;a?r.rows[e].cells=[]:r.rows[e]={cells:[]}}return r.rows[e].cells[t]||(i?{}:null)}function Z(e,r,n,i,a){n.rows[e]?n.rows[e].cells||(n.rows[e].cells=[]):n.rows[e]={cells:[]},a&&n.rows[e].cells[r]?t.extend(n.rows[e].cells[r],i,null,!0):n.rows[e].cells[r]=i}function J(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 Q(e,t,r){void 0===t&&(t=!0);for(var n=r.getAddressInfo(e),i=n.indices,a=ce(r,n.sheetIndex),o=i[0];o<=i[2];o++)for(var s=i[1];s<=i[3];s++)Z(o,s,a,{wrap:t},!0);r.setProperties({sheets:r.sheets},!0),n.sheetIndex===r.activeSheetIndex&&r.notify(At,{range:i,wrap:t,sheet:a})}function ee(e,t,r,n,i,a,o,s){return new Promise(function(l,h){l(function(){var l,h,d=new Map,p=t.indexOf("!")>-1?ae(e,se(t)):e.activeSheetIndex,c=ce(e,p),u=y(t),f=u[0],m=0,C={sheet:c,indexes:u,formulaCellRef:o,sheetIndex:s,promise:new Promise(function(e,t){e(void 0)})};return e.notify(xt,C),C.promise.then(function(){for(var t=e.frozenRowCount(c),o=e.frozenColCount(c);f<=u[2];){var s={};for(h=ye(c,f),l=u[1];l<=u[3];){if(r){if(be(c,f)&&!a){f++;continue}d instanceof Map&&(d=[]);var y=v(l+1);s[y]=n?h?te(e,f,l,p,c):"":h?$(f,l,c):null,u[3]1&&C.rowSpan>1)for(var b=void 0,S=f,x=f+C.rowSpan;S1)for(var S=l+1,x=l+C.colSpan;S1)for(var S=f+1,x=f+C.rowSpan;S=t&&f=o&&l0){for(e.forEach(function(e,t){e&&e.index&&(a=e.index,i=1),e&&!e.index&&0!==t&&(e.index=a+i),i++});n--;)e.splice(o,0,null);o+=n}}else e?e[o]=null:e=[];return e[r]}function ne(e,r,n){for(var i,a,o,s=0,l=e.length,h=0;h0){for(i=0;s--;)r?(n.createSheet(h+i),i++):e.splice(h,0,null);h+=a,l+=a}if(r){e[h].id<1&&(e[h].id=fe(n.sheets),e[h].properties&&(e[h].properties.id=e[h].id)),e[h].name||n.setSheetPropertyOnMute(e[h],"name","Sheet"+ue(n));var d=0;e[h].rows.forEach(function(e){d=Math.max(d,e&&e.cells&&e.cells.length-1||0)}),n.setSheetPropertyOnMute(e[h],"usedRange",{rowIndex:e[h].rows.length?e[h].rows.length-1:0,colIndex:d})}o=h}(h),h=o}function ie(e,r,n,i){var a,o,s=ce(e,n),l=y(r),h=l[0],d=l[2];for(h;h<=d;h++)for(a=l[1],o=l[3],a;a<=o;a++){var p=$(h,a,s);e.notify(Pt,{rowIdx:h,colIdx:a}),!t.isNullOrUndefined(p)&&i&&(delete p.value,t.isNullOrUndefined(p.formula)||delete p.formula,t.isNullOrUndefined(p.hyperlink)||delete p.hyperlink)}}function ae(e,t){for(var r,n=0;n-1))return e.sheetNameCount++;e.sheetNameCount++}return e.sheetNameCount++}function fe(e){var t=0;return e.forEach(function(e){t=Math.max(e.id,t)}),t+1}function ge(e,r){var n=r||e.sheets;n.forEach(function(r){if(r.id=r.id||0,r.name=r.name||"",r.rowCount=t.isUndefined(r.rowCount)?100:r.rowCount,r.colCount=t.isUndefined(r.colCount)?100:r.colCount,r.topLeftCell=r.topLeftCell||"A1",r.activeCell=r.activeCell||"A1",r.selectedRange=r.selectedRange||"A1:A1",r.usedRange=r.usedRange||{rowIndex:0,colIndex:0},e.setSheetPropertyOnMute(r,"ranges",r.ranges?r.ranges:[]),e.setSheetPropertyOnMute(r,"rows",r.rows&&t.extend([],r.rows,null,!0)||[]),e.setSheetPropertyOnMute(r,"columns",r.columns||[]),r.showHeaders=!!t.isUndefined(r.showHeaders)||r.showHeaders,r.showGridLines=!!t.isUndefined(r.showGridLines)||r.showGridLines,r.state=r.state||"Visible",r.maxHgts=[],r.protectSettings=r.protectSettings||{selectCells:!1,formatCells:!1,formatRows:!1,formatColumns:!1,insertLink:!1},r.isProtected=r.isProtected||!1,!r.paneTopLeftCell||"A1"===r.paneTopLeftCell){r.frozenRows=r.frozenRows?r.frozenRows:0,r.frozenColumns=r.frozenColumns?r.frozenColumns:0;var n=u(r.topLeftCell);e.setSheetPropertyOnMute(r,"paneTopLeftCell",g(r.frozenRows?n[0]+r.frozenRows:n[0],r.frozenColumns?n[1]+r.frozenColumns:n[1]))}ne(r.columns),me(r.rows)}),ne(n,!0,e)}function me(e){e.forEach(function(e){e&&e.cells&&ne(e.cells)}),ne(e)}function ve(e,t){return void 0===t&&(t=e.activeSheetIndex),ce(e,t).name}function ye(e,t){return e.rows[t]}function Ce(e,t,r){e.rows[t]||(e.rows[t]={}),Object.keys(r).forEach(function(n){e.rows[t][n]=r[n]})}function be(e,t){return e.rows[t]&&e.rows[t].hidden}function Se(e,t,r){var n;if(e&&e.rows&&e.rows[t]){if(e.rows[t].hidden)return 0;n=void 0===e.rows[t].height?20:e.rows[t].height}else n=20;if(r&&window.devicePixelRatio%1>0){var i=n*window.devicePixelRatio%1;return n+(i?(i>.5?1-i:-1*i)/window.devicePixelRatio:0)}return n}function xe(e,t,r){e&&e.rows&&(e.rows[t]||(e.rows[t]={}),e.rows[t].height=r)}function we(e,t,r,n){void 0===r&&(r=t);var i,a=0;t>r&&(i=t,t=r,r=i);for(var o=t;o<=r;o++)a+=Se(e,o,n);return a}function Ie(e,t){return e.columns?e.columns[t]||(e.columns[t]={}):(e.columns=[],e.columns[t]={}),e.columns[t]}function Ee(e,t,r){var n=Ie(e,t);Object.keys(r).forEach(function(e){n[e]=r[e]})}function Re(e,t,r,n){var i;if(e&&e.columns&&e.columns[t]){if(!r&&e.columns[t].hidden)return 0;i=e.columns[t].width||e.columns[t].customWidth?e.columns[t].width:64}else i=64;if(n&&window.devicePixelRatio%1>0){var a=i*window.devicePixelRatio%1;return i+(a?(a>.5?1-a:-1*a)/window.devicePixelRatio:0)}return i}function ke(e,t,r,n){void 0===r&&(r=t);var i=0;if(t>r){var a=t;t=r,r=a}for(var o=t;o<=r;o++)i+=Re(e,o,null,n);return i}function Ae(e,t){return e.columns[t]&&e.columns[t].hidden}function Te(e){var t=[];return Fe(e,t),z(e,t),t}function Fe(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.allowChart&&t.push({member:"spreadsheetChart",args:[e]})}function Le(e){requestAnimationFrame(function(){e()})}function Ne(e){for(;e.firstChild;)e.removeChild(e.firstChild)}function De(e){var t=30;return e.toString().length>3&&(t=10*e.toString().length),t}function Oe(){if(null!==Ln)return Ln;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),Ln=t}function He(e,t){return void 0===t&&(t=Nn),Be(e,"previous",t)+Be(e,"next",t)}function Be(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 Me(e,t,r){if(e.scrollSettings.enableVirtualization){var n=e.viewport.topIndex,i=e.viewport.leftIndex,a=n+e.viewport.rowCount+2*e.getThreshold("row"),o=i+e.viewport.colCount+2*e.getThreshold("col"),s=n<=t[0]&&a>=t[2]&&i<=t[1]&&o>=t[3];if(s)return!0;if(r){if(t[0]a&&t[2]>a)return!1;if(t[0]n&&(t[0]=n,s=!0),t[2]>a&&(t[2]=a,s=!0),t[1]o&&t[3]>o)return!1;t[1]i&&(t[1]=i,s=!0),t[3]>o&&(t[3]=o,s=!0)}return s}return!0}function Pe(e,t,r,n,i,a,o){var s,l={left:{idx:0,size:0},top:{idx:0,size:0}},h=l.top.size,d=l.left.size;for(s=l.top.idx;ss-1?d[3]=a?1:0)+"px"};g[n?"right":"left"]=(d[1]===c[1]?p.left:p.left-1)+"px",e&&ze([{element:e,attrs:g}])}function ze(e){requestAnimationFrame(function(){e.forEach(function(e){t.setStyleAttribute(e.element,e.attrs)})})}function qe(){return t.Browser.isPointer?"pointerdown":"mousedown touchstart"}function je(){return t.Browser.isPointer?"pointermove":"mousemove touchmove"}function We(){return t.Browser.isPointer?"pointerup":"mouseup touchend"}function Ge(e){return"touchstart"===e.type||"pointerdown"===e.type&&"touch"===e.pointerType}function Ye(e){return"touchmove"===e.type||"pointermove"===e.type&&"touch"===e.pointerType}function Xe(e){return"touchend"===e.type||"pointerup"===e.type&&"touch"===e.pointerType}function Ke(e){return e&&("mousedown"===e.type||"pointerdown"===e.type)}function $e(e){return e&&("mousemove"===e.type||"pointermove"===e.type)}function Ze(e){return e&&("mouseup"===e.type||"pointerup"===e.type)}function Je(e){return e.changedTouches?e.changedTouches[0].clientX:e.clientX}function Qe(e){return e.changedTouches?e.changedTouches[0].clientY:e.clientY}function et(e,t){if(window.devicePixelRatio%1>0){var r=e*window.devicePixelRatio%1;return e+(r?(r>.5||t?1-r:-1*r)/window.devicePixelRatio:0)}return e}function tt(e,t){Object.keys(t).forEach(function(r){e&&e.setAttribute(Dn[r],t[r])})}function rt(e,r){if(e){var n=t.getComponent(e,r);n&&n.destroy()}}function nt(e,t,r,n,i){var a,o,s,l,h,d,p,c,u,f=i.getActiveSheet(),g=i.frozenRowCount(f),m=i.frozenColCount(f);if(n){var v=e0?et(parseInt(r,10))+"px":"2px",(s=i.getRow(e,null,m)).style.height=parseInt(r,10)>0?et(parseInt(r,10))+"px":"0px";var y=void 0;if(f.showHeaders){var C=i.getRowHeaderContent().getElementsByClassName("e-row"),b=[];b[0]=C[t].getElementsByTagName("td")[0].cloneNode(!0),y=at(i.getRowHeaderTable(),b,!1,i)+1}for(var S=i.getMainContent().getElementsByClassName("e-row"),x=[],w=0;w=I?y:I;parseInt(s.style.height,10)=4?parseInt(r,10)-4+"px":parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"),s.style.lineHeight=parseInt(r,10)>0?parseInt(r,10)-1+"px":"0px"):(o&&o.style.removeProperty("line-height"),s.style.removeProperty("line-height"),a&&a.classList.contains("e-reach-fntsize")&&a.classList.remove("e-reach-fntsize"))}if(d=s.previousElementSibling,u=s.nextElementSibling,d&&(f.showHeaders&&(l=a.previousElementSibling,h=o.previousElementSibling),d=s.previousElementSibling),u&&(f.showHeaders&&(p=a.nextElementSibling,c=o.nextElementSibling),u=s.nextElementSibling),parseInt(r,10)<=0&&!s.classList.contains("e-zero")&&!s.classList.contains("e-zero-start")){if(d&&u)if(n?(f.showHeaders&&(o.style.width="2px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="2px"),s.style.height="0px"),d.classList.contains("e-zero-start")?(f.showHeaders&&a.classList.add("e-zero-start"),s.classList.add("e-zero-start")):(f.showHeaders&&a.classList.add("e-zero"),s.classList.add("e-zero")),!p||p.classList.contains("e-zero")||p.classList.contains("e-zero-last")||(f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),d.classList.contains("e-zero-last")&&(f.showHeaders&&l.classList.remove("e-zero-last"),d.classList.remove("e-zero-last")),f.showHeaders&&l.classList.contains("e-zero")?(a.classList.contains("e-zero-end"),it(h,-2,n)):f.showHeaders&&it(h,-1,n),f.showHeaders&&l.classList.contains("e-zero-start")&&it(o,-1,n),f.showHeaders&&p.classList.contains("e-zero"))if(a.classList.contains("e-zero-start"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.height,10)&&!n||0!==parseInt(c.style.width,10)&&n){n?(o.style.width=parseInt(o.style.width,10)-1+"px",c.style.width=parseInt(c.style.width,10)-1+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",c.style.height=parseInt(c.style.height,10)-1+"px"),p.classList.remove("e-zero"),p.classList.add("e-zero-start");break}R=void 0;p.classList.remove("e-zero"),p.classList.add("e-zero-start"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,p=i.getColHeaderTable().getElementsByTagName("th")[R+1],c=i.getColHeaderTable().getElementsByTagName("col")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else it(o,-2,n);else f.showHeaders&&(p.classList.contains("e-zero-end")?n?o.style.width="0px":o.style.height="0px":it(c,-1,n));else if(d)n?(f.showHeaders&&(o.style.width="1px"),s.style.width="0px"):(f.showHeaders&&(o.style.height="1px"),s.style.height="0px"),f.showHeaders&&a.classList.add("e-zero-end"),s.classList.add("e-zero-end"),f.showHeaders&&a.classList.add("e-zero-last"),s.classList.add("e-zero-last"),f.showHeaders&&l.classList.contains("e-zero")?it(h,-2,n):it(h,-1,n);else if(p)if(a.classList.add("e-zero-start"),s.classList.add("e-zero-start"),p.classList.contains("e-zero")||(a.classList.add("e-zero-last"),s.classList.add("e-zero-last")),n?(o.style.width="1px",s.style.width="0px"):(o.style.height="1px",s.style.height="0px"),f.showHeaders&&p.classList.contains("e-zero"))for(;p;){if(p.classList.contains("e-zero")&&0!==parseInt(c.style.width,10)&&n||0!==parseInt(c.style.height,10)&&!n){n?(c.style.width=parseInt(c.style.width,10)-1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(c.style.height=parseInt(c.style.height,10)-1+"px",o.style.height=parseInt(o.style.height,10)-1+"px"),p.classList.add("e-zero-start"),p.classList.remove("e-zero");break}var R=void 0;p.classList.add("e-zero-start"),p.classList.remove("e-zero"),n?(R=parseInt(p.getAttribute("aria-colindex"),10)-1,c=i.getColHeaderTable().getElementsByTagName("col")[R+1],p=i.getColHeaderTable().getElementsByTagName("th")[R+1]):(R=parseInt(p.getAttribute("aria-rowindex"),10)-1,c=i.getRowHeaderTable().getElementsByTagName("tr")[R+1],p=i.getRowHeaderTable().getElementsByTagName("tr")[R+1])}else f.showHeaders&&it(c,-1,n)}else if(parseInt(r,10)>0){var k=et(parseInt(r,10))+"px";n?(o.style.width=k,s.style.width=k):(o.style.height=k,s.style.height=k),f.showHeaders&&l&&p?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(h.style.width=parseInt(h.style.width,10)+2+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+2+"px",o.style.height=parseInt(o.style.height,10)-1+"px"):it(o,-1,n):a.classList.contains("e-zero")?it(h,1,n):a.classList.contains("e-zero-start")&&(n?(h.style.width=parseInt(h.style.width,10)+1+"px",o.style.width=parseInt(o.style.width,10)-1+"px"):(h.style.height=parseInt(h.style.height,10)+1+"px",o.style.height=parseInt(o.style.height,10)-1+"px")),p.classList.contains("e-zero")?it(o,-1,n):(a.classList.contains("e-zero")||a.classList.contains("e-zero-start"))&&it(c,1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"),a.classList.contains("e-zero-last")&&a.classList.remove("e-zero-last"),s.classList.contains("e-zero-last")&&s.classList.remove("e-zero-last"),(l.classList.contains("e-zero")||l.classList.contains("e-zero-start"))&&(l.classList.add("e-zero-last"),d.classList.add("e-zero-last"))):f.showHeaders&&l?(l.classList.contains("e-zero")?a.classList.contains("e-zero")?n?(o.style.width=parseInt(o.style.width,10)-1+"px",h.style.width=parseInt(h.style.width,10)+2+"px"):(o.style.height=parseInt(o.style.height,10)-1+"px",h.style.height=parseInt(h.style.height,10)+2+"px"):it(o,-1,n):a.classList.contains("e-zero")?it(h,1,n):it(o,-1,n),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),a.classList.contains("e-zero-end")&&a.classList.remove("e-zero-end"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),s.classList.contains("e-zero-end")&&s.classList.remove("e-zero-end")):f.showHeaders&&p&&(p.classList.contains("e-zero")?it(o,-1,n):a.classList.contains("e-zero-start")&&(it(c,1,n),a.classList.remove("e-zero-start")),a.classList.contains("e-zero")&&a.classList.remove("e-zero"),s.classList.contains("e-zero")&&s.classList.remove("e-zero"),a.classList.contains("e-zero-start")&&a.classList.remove("e-zero-start"),s.classList.contains("e-zero-start")&&s.classList.remove("e-zero-start"))}}function it(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 at(e,t,r,n,i,a){var o=n.createElement("div",{className:n.element.className,styles:"display: block"}),s=n.createElement("table",{className:e.className+"e-resizetable",styles:"width: auto;height: auto"}),l=n.createElement("tr");r?t.forEach(function(e){var t=l.cloneNode();t.appendChild(e),s.appendChild(t)}):(t.forEach(function(e){l.appendChild(e.cloneNode(!0))}),s.appendChild(l)),o.appendChild(s),document.body.appendChild(o);var h,d,p=s.getBoundingClientRect().width,c=s.getBoundingClientRect().height;return a?(h=r&&parseInt(i,10)>p?p:parseInt(i,10),d=!r&&parseInt(i,10)>c?c:parseInt(i,10)):(d=c,h=p),document.body.removeChild(o),r?Math.ceil(h):Math.ceil(d)}function ot(e,r,n){var i,a,o,s,l,h,d=e.eventArgs;switch(e.action){case"sorting":o={args:{range:e.eventArgs.range,sortOptions:e.eventArgs.sortOptions,cancel:!1},promise:new Promise(function(e,t){e(void 0)})},r.notify(kt,o),o.promise.then(function(e){r.serviceLocator.getService("cell").refreshRange(y(e.range))});break;case"cellSave":s=e.eventArgs,l=d.formula?n?{value:s.formula}:{formula:s.formula}:{value:s.value},r.updateCell(l,s.address);break;case"cellDelete":r.clearRange(e.eventArgs.address,null,!0),r.serviceLocator.getService("cell").refreshRange(c(e.eventArgs.address));break;case"format":if("CellFormat"===d.requestType)if(d.style&&d.style.border&&!t.isNullOrUndefined(d.borderType)){var p={};Object.assign(p,d.style,null,!0),d.style.border=void 0,r.cellFormat(d.style,d.range),d.style.border=p.border,r.setBorder(d.style,d.range,d.borderType),d.style=p}else r.cellFormat(d.style,d.range);else r.numberFormat(d.format,d.range);break;case"clipboard":if(d.copiedInfo.isCut&&!n)return;(d.copiedInfo.isCut?r.cut(d.copiedRange):r.copy(d.copiedRange)).then(function(){r.paste(d.pastedRange,d.type)});break;case"gridLines":r.setSheetPropertyOnMute(r.sheets[d.sheetIdx],"showGridLines",d.isShow);break;case"headers":r.setSheetPropertyOnMute(r.sheets[d.sheetIdx],"showHeaders",d.isShow);break;case"resize":case"resizeToFit":d.isCol?void 0===d.hide?r.setColWidth(d.width,d.index,d.sheetIdx):r.hideColumn(d.index,d.index,d.hide):void 0===d.hide?r.setRowHeight(d.height,d.index,d.sheetIdx+1):r.hideRow(d.index,d.index,d.hide);break;case"renameSheet":r.setSheetPropertyOnMute(r.sheets[d.index-1],"name",d.value);break;case"removeSheet":r.notify($t,{index:d.index,isAction:!0,count:d.sheetCount,clicked:!0});break;case"wrap":Q(e.eventArgs.address,e.eventArgs.wrap,r);break;case"hideShow":d.isCol?r.hideColumn(d.startIndex,d.endIndex,d.hide):r.hideRow(d.startIndex,d.endIndex,d.hide);break;case"replace":r.updateCell({value:d.compareVal},d.address);break;case"filter":r.notify(rr,{predicates:null,range:d.range,sIdx:d.index,isCut:!0});break;case"insert":!1===n?r.delete(e.eventArgs.index,e.eventArgs.index+(e.eventArgs.model.length-1),e.eventArgs.modelType):r.notify(Tt,{model:"Sheet"===e.eventArgs.modelType?r:r.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===n?r.notify(Tt,{model:"Sheet"===e.eventArgs.modelType?r:r.getActiveSheet(),start:e.eventArgs.deletedModel,modelType:e.eventArgs.modelType,isAction:!1,columnCellsModel:e.eventArgs.deletedCellsModel}):r.delete(e.eventArgs.startIndex,e.eventArgs.endIndex,e.eventArgs.modelType);break;case"validation":if(n){var u={type:d.type,operator:d.operator,value1:d.value1,value2:d.value2,ignoreBlank:d.ignoreBlank,inCellDropDown:d.inCellDropDown};r.notify(Ft,{rules:u,range:d.range})}else r.notify(Dt,{range:d.range});break;case"merge":e.eventArgs.isAction=!1,h=[];for(var f=0,g=d.model.length;f=t&&i[3]>=r)return!0;return!1}function lt(e,t,r,n,i,a,o){void 0===o&&(o=!0);var s=Se(t,n,!0),l=e.frozenColCount(t),h=et(r);(i=i||(t.frozenRows?e.getRow(n,null,l):e.getRow(n)))&&(i.style.height=h+"px"),(a=a||(t.frozenColumns?e.getRow(n,null,l-1):e.getRow(n,e.getRowHeaderTable())))&&(a.style.height=h+"px"),xe(t,n,r),e.setProperties({sheets:e.sheets},!0),o&&e.notify(Qt,{rowIdx:n,threshold:h-s})}function ht(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))*(t&&"Arial Black"===t.fontFamily?1.44:1.24)*r;return Math.ceil(i%1>.9?i+1:i)}function dt(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),et(n.measureText(e).width,!0)}function pt(e,t,r,n){var i,a,o=0,s=e.toString().split(" "),l=dt(" ",r,n),h=0;return s.forEach(function(e){var d=0,p=0;i=dt(e,r,n),s[s.length-1]!==e&&(i+=l),(a=(o+i)/t)>=1?(o&&h++,i/t>=1?(e.split("").forEach(function(e){p=dt(e,r,n),(d+=p)>t&&(h++,d=p)}),o=d+l):o=i):o+=i}),o&&(h+=Math.ceil((o-l)/t)),h}function ct(e,t,r){var n=0,i=$(e,t,r,null,!0),a=$(e,t+1,r,null,!0);return i.style&&(i.style.border?n=(0===t?2:1)*parseFloat(i.style.border.split("px")[0]):(0===t&&i.style.borderLeft&&(n=parseFloat(i.style.borderLeft.split("px")[0])),i.style.borderRight&&(n+=parseFloat(i.style.borderRight.split("px")[0])))),i.style&&(i.style.border||i.style.borderRight)||!a.style||!a.style.borderLeft||(n+=parseFloat(a.style.borderLeft.split("px")[0])),n}function ut(e,t,r){var n=0,i=$(e,t,r,null,!0),a=$(e+1,t,r,null,!0);return i.style&&(i.style.border?n=(0===e?2:1)*parseFloat(i.style.border.split("px")[0]):(0===e&&i.style.borderTop&&(n=parseFloat(i.style.borderTop.split("px")[0])),i.style.borderBottom&&(n+=parseFloat(i.style.borderBottom.split("px")[0])))),i.style&&(i.style.border||i.style.borderBottom)||!a.style||!a.style.borderTop||(n+=parseFloat(a.style.borderTop.split("px")[0])),n}function ft(e,t,r,n){return void 0===n&&(n=r),ke(e,r,n,!0)-et(4+ct(t,r,e))}function gt(e,t,r,n,i,a){return ht(e,i,a)+(ut(t,r,n)||1)}function mt(e,t,r,n){e.maxHgts[t]||(e.maxHgts[t]={}),e.maxHgts[t][r]=n}function vt(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 yt(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=yt(e,t,r,n)),t}function Ct(e){if(!document.activeElement.classList.contains("e-text-findNext-short"))if(t.Browser.isIE){var r=window.scrollX,n=window.scrollY;e.focus(),window.scrollTo(r,n)}else e.focus({preventScroll:!0})}function bt(e,r){for(var n,i=e.getActiveSheet(),a=t.isNullOrUndefined(r)?x(c(i.selectedRange)):r,o=a[0];o<=a[2];o++)for(var s=a[1];s<=a[3];s++)if(X($(o,s,i),Ie(i,s))){n=!0;break}return n}var St=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-1&&(t=ae(this.parent,e.range.split("!")[0]));for(var r,n=this.parent.sheets[t],i=c(e.range?e.range.indexOf("!")>-1?e.range.split("!")[1]:e.range:n.selectedRange),a=i[0];a<=i[2];a++)for(var o=i[1];o<=i[3];o++)Z(a,o,n,{format:e.format},!0),r=$(a,o,n,!0),this.getFormattedCell({type:H(r.format),value:r.value,format:r.format,rowIndex:a,colIndex:o,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=c(n.activeCell),a=Number(e.sheetIndex)?Number(e.sheetIndex):this.parent.activeSheetIndex,o=e.cell?e.cell:$(i[0],i[1],n),s=e.cell&&!t.isNullOrUndefined(e.rowIdx)?e.rowIdx:i[0],l=e.cell&&!t.isNullOrUndefined(e.colIdx)?e.colIdx:i[1],h=!1,d={},p=new t.Internationalization;p.getNumberFormat(d);var u=t.getNumberDependable(this.parent.locale,d.currency);if(""===e.format||"General"===e.format){o=o||{};var f={value:e.value,rowIndex:s,colIndex:l,sheetIndex:this.parent.activeSheetIndex,updatedVal:e.value,isDate:!1,isTime:!1};this.checkDateFormat(f),f.isDate?(h=!0,o.value=e.value=f.updatedVal,o.format=e.format=O("ShortDate")):f.isTime&&(h=!0,o.value=e.value=f.updatedVal,o.format=e.format=O("Time"))}e.type=e.format?H(e.format):"General";var g=this.processFormats(e,r,h,o,p,u,d.currency);return this.parent.getActiveSheet().id-1===a&&this.parent.notify("refreshCellElem",{isRightAlign:g.rightAlign,result:g.fResult||e.value,rowIndex:e.rowIndex,colIndex:e.colIndex,sheetIndex:e.sheetIndex,type:e.type,curSymbol:u,value:e.value||""}),!e.onLoad&&(e.rowIndex>n.usedRange.rowIndex||e.colIndex>n.usedRange.colIndex)&&this.parent.setUsedRange(e.rowIndex,e.colIndex),e.formattedText=g.fResult||e.value,e.isRightAlign=g.rightAlign,e.curSymbol=u,e.formattedText},e.prototype.processFormats=function(e,t,r,n,i,a,o){var s;if(e.format=e.format?e.format:"General",""!==t)switch(e.type){case"General":t=(s=this.autoDetectGeneralFormat({args:e,currencySymbol:a,fResult:t,intl:i,isRightAlign:r,curCode:o,cell:n,rowIdx:Number(e.rowIdx),colIdx:Number(e.colIdx)})).fResult,r=s.isRightAlign;break;case"Number":L(t)&&(t=this.applyNumberFormat(e,i),r=!0);break;case"Currency":L(t)&&(t=this.currencyFormat(e,i,o),r=!0);break;case"Percentage":L(t)&&(t=this.percentageFormat(e,i),r=!0);break;case"Accounting":L(t)&&(t=this.accountingFormat(e,i,a,o),r=!0);break;case"ShortDate":r=!!(t=this.shortDateFormat(e,i));break;case"LongDate":r=!!(t=this.longDateFormat(e,i));break;case"Time":r=!!(t=this.timeFormat(e,i));break;case"Fraction":L(t)&&(t=this.fractionFormat(e),r=!0);break;case"Scientific":L(t)&&(t=this.scientificFormat(e),r=!0);break;case"Text":r=!1}return{fResult:t,rightAlign:r}},e.prototype.autoDetectGeneralFormat=function(e){if(L(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.curCode):e.fResult=this.applyNumberFormat(e.args,e.intl)),"General"===e.args.format&&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(""))/100,e.cell.format=e.args.format=this.getPercentageFormat(r),e.fResult=this.percentageFormat(e.args,e.intl),e.cell.value=e.args.value.toString(),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()&&!this.parent.isEdit&&(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.curCode),e.cell.value=e.args.value.toString(),Z(e.rowIdx,e.colIdx,this.parent.getActiveSheet(),e.cell,!0),e.isRightAlign=!0)}return{isRightAlign:e.isRightAlign,fResult:e.fResult}},e.prototype.getPercentageFormat=function(e){return e.indexOf(this.decimalSep)>-1?O("Percentage"):"0%"},e.prototype.findSuffix=function(e,t){var r=e.length-t.length;return e.substr(0,r<0?0:r)+t},e.prototype.applyNumberFormat=function(e,r){e.format=this.isCustomFormat(e.format.toString());var n=e.format.toString().split(";");if(Number(e.value)>0)e.format=n[0];else if(0===Number(e.value)){if(e.format=n[2]?n[2]:n[0],e.format.indexOf('"')>-1&&-1===e.format.indexOf("#"))return e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" ").split('"').join(""),e.format}else if(Number(e.value)<0)e.format=t.isNullOrUndefined(n[1])?n[0]:n[1].split("*").join(" "),e.format.indexOf("-")>-1&&(e.value=e.value.toString().split("-").join(""));else if(e.format=n[3]?n[3]:n[0],e.format=e.format.split("_").join(" ").split("*").join(" ").split("?").join(" "),e.format.indexOf("@")>-1)return e.format.split("@").join(e.value.toString());if(e.format=e.format.split("_").join(" ").split("*").join(" ").split('"').join(""),e.format.indexOf("?")>-1&&e.format.indexOf(this.decimalSep)>-1){var i=e.format.split(this.decimalSep)[1].length,a="";Number(e.value)%1&&(a=i>e.value.toString().split(".")[1].length?" ":"0"),e.format=e.format.split("?").join(a)}else e.format=e.format.split("?").join(" ");return Number(e.value)<0&&e.cell&&(e.format=e.cell.format),r.formatNumber(Number(e.value),{format:e.format})},e.prototype.isCustomFormat=function(e){return'_-* #,##0.00_-;-* #,##0.00_-;_-* "-"_-;_-@_-'!==e&&'_-* #,##0_-;-* #,##0_-;_-* "-"_-;_-@_-'!==e||(e=""),e=""===e?O("Number"):e,e=e.toString().split("_)").join(" ").split("_(").join(" ").split("[Red]").join("")},e.prototype.currencyFormat=function(e,r,n){e.format=""===e.format?O("Currency"):e.format,e.format=e.format.toString().split("_(").join(" ").split("_)").join(" ").split("[Red]").join("");var i=e.format.toString().split(";");return Number(e.value)>=0?e.format=i[0]:e.format=t.isNullOrUndefined(i[1])?i[0]:i[1].split("*").join(" "),e.format=this.getFormatForOtherCurrency(e.format),r.formatNumber(Number(e.value),{format:e.format,currency:n})},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,t,r,n){e.format=""===e.format?O("Accounting"):e.format,e.format=e.format.split("_(").join(" ").split("_)").join(" ").split("[Red]").join("").split("_").join("");var i=e.format.split(";");return Number(e.value)>=0?e.format=i[0]:e.format=i[1].split("*").join(" "),e.format=this.getFormatForOtherCurrency(e.format),0===Number(e.value)?r+"- ":t.formatNumber(Number(e.value),{format:e.format,currency:n}).split("-").join("")},e.prototype.getFormatForOtherCurrency=function(e){if(e.indexOf("[$")>-1){var t=e.split("]")[0].split("[$")[1].split("-")[0];e=e.indexOf("0")>e.indexOf("[$")?t+e.slice(e.indexOf("]")+1,e.length):e.slice(0,e.indexOf("[$"))+t}return e},e.prototype.shortDateFormat=function(e,t){var r,n=A(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=A(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.toString().split(this.decimalSep)[1])||e.value);var n=A(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&&L(e.value)?(r=e.value.toString().split(this.decimalSep)[0],t=R(Number(e.value)),0===Number(r)?" "+t:r+" "+t):r},e.prototype.findDecimalPlaces=function(e,t){var r,n;switch(t){case"Scientific":if(r=e.toUpperCase().indexOf("E"),n=e.indexOf(this.decimalSep),r>-1)return e.substring(n+1,r).length}return 2},e.prototype.checkDateFormat=function(e){var r,n=new t.Internationalization,i=t.isNullOrUndefined(e.value)?"":e.value.toString(),a=$(e.rowIndex,e.colIndex,ce(this.parent,t.isNullOrUndefined(e.sheetIndex)?this.parent.activeSheetIndex:e.sheetIndex)),o=this.checkCustomDateFormat(i);i&&(i.indexOf("/")>-1||i.indexOf("-")>0||i.indexOf(":")>-1)&&"Invalid"!==o&&(((i=o)&&i.indexOf("/")>-1||i.indexOf("-")>0||i.indexOf(":")>-1)&&(r=N(i,n,a&&a.format),t.isNullOrUndefined(r.dateObj)||"Invalid Date"===r.dateObj.toString()||(a=a||{},i=T(r.dateObj,i.indexOf(":")>-1,r.type&&"time"===r.type).toString(),a.format&&""!==a.format||("time"===r.type?a.format=O("Time"):a.format=O("ShortDate")),e.isDate="date"===r.type||"datetime"===r.type,e.isTime="time"===r.type,e.dateObj=r.dateObj)),e.updatedVal=i)},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=H(e.cell?e.cell.format:""),n=new t.Internationalization,i=e.value,a="ShortDate"===r&&e.cell&&e.cell.format?e.cell.format:O("ShortDate"),o=O("Time");switch(r){case"ShortDate":case"LongDate":e.value=this.shortDateFormat({type:r,value:e.value,format:a},n);break;case"Time":e.value=this.shortDateFormat({type:r,value:e.value,format:a},n)+" "+this.timeFormat({type:r,value:e.value,format:o},n)}(!e.value||e.value&&e.value.toString().indexOf("null")>-1)&&(e.value=i)},e.prototype.addEventListener=function(){this.parent.on("applyNumber",this.numberFormatting,this),this.parent.on("getFormattedCell",this.getFormattedCell,this),this.parent.on(Rt,this.checkDateFormat,this),this.parent.on("getFormattedBarText",this.formattedBarText,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyNumber",this.numberFormatting),this.parent.off("getFormattedCell",this.getFormattedCell),this.parent.off(Rt,this.checkDateFormat),this.parent.off("getFormattedBarText",this.formattedBarText))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookNumberFormat"},e}(),qt=function(){function e(e){this.parent=e,this.requestedInfo=[],this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(xt,this.updateSheetFromDataSourceHandler,this),this.parent.on("dataSourceChanged",this.dataSourceChangedHandler,this),this.parent.on("dataChanged",this.dataChangedHandler,this),this.parent.on("triggerDataChange",this.triggerDataChangeHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(xt,this.updateSheetFromDataSourceHandler),this.parent.off("dataSourceChanged",this.dataSourceChangedHandler),this.parent.off("dataChanged",this.dataChangedHandler))},e.prototype.updateSheetFromDataSourceHandler=function(e){var t,n,i,a,o,s,l,h,d,p,u=this,f=[],g=[],m=new r.Deferred;if(e.promise=m.promise,e.sheet&&e.sheet.ranges.length)for(var v=this,y=e.sheet.ranges.length-1;y>=0;y--)!function(y){var C=e.indexes[0],b=e.indexes[2],S=e.sheet.ranges[y];h=c(S.startCell)[0],s=S.dataSource instanceof r.DataManager?S.dataSource:S.dataSource?new r.DataManager(S.dataSource):new r.DataManager,o=o||s.dataSource.url,e.sheet.isLocalData=!s.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;v.initRangeInfo(S);var I=v.getMaxCount(S);if(p=v.getLoadedInfo(C,b,S),C=p.unloadedRange[0],b=p.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),v.requestedInfo.push({deferred:m,indexes:e.indexes,isNotLoaded:p.isNotLoaded}),C>=0&&p.isNotLoaded&&!x){g[y]=C,f[y]=!1;var E=(S.query?S.query:new r.Query).clone();s.executeQuery(E.range(C,b>=I?b:b+1).requiresCount()).then(function(r){if(u.parent&&!u.parent.isDestroyed){if(a=r.result&&r.result.result?r.result.result:r.result,i=c(S.startCell),h=i[0],d=i[1],a&&a.length){if(S.info.count||(I=r.count,S.info.count=r.count),n=Object.keys(a[0]),S.info.fldLen||(S.info.fldLen=n.length,S.info.flds=n),S.info.insertColumnRange){var o=0;S.info.insertColumnRange.forEach(function(e){for(var t=e[0];t<=e[1];t++)t<=d?n.splice(0,0,"emptyCell"+o):n.splice(t-d,0,"emptyCell"+o),o++})}0===g[y]&&S.showFieldAsHeader&&(l=h+g[y]+w,n.forEach(function(r,n){(t=$(l,d+n,e.sheet,!0))?t.value||r.includes("emptyCell")||(t.value=r):e.sheet.rows[h+g[y]].cells[d+n]=r.includes("emptyCell")?{}:{value:r}})),a.forEach(function(r,i){l=h+g[y]+i+(S.showFieldAsHeader?1:0)+w;for(var a=0;aI&&(p.isNotLoaded=!1),p.isNotLoaded&&(b>I&&(b=I),S.info.loadedRange.push([C,b]))):S.info.loadedRange.push([C,b]),f[y]=!0,-1===f.indexOf(!1)){if(b+h=e.index,l=[e.index],a?(C=!0,v.info.count+=e.model.length):n[2]+1===e.index&&"below"===e.insertType?(C=!0,v.info.count+=e.model.length):n[0]>=e.index&&(v.startCell=g(i[0]+e.model.length,i[1]))):(a=n[0]<=e.startIndex&&n[2]>=e.startIndex,t="delete");else{l=c("paste"===e.requestType?e.pastedRange.split("!")[1]:e.sheetIdx>-1?e.address:(e.address||e.range).split("!")[1]);var b=[v.showFieldAsHeader?n[0]+1:n[0]].concat(n.slice(1,4));a=Y(b,l,!0),"paste"===e.requestType&&e.copiedInfo.isCut&&(h=[].slice.call(e.copiedInfo.range),o=Y(b,h,!0))}if(a||C||o){if("Row"!==e.modelType||e.insertType){t=C?"add":"edit";var S=0;if(o){S=h[2]-h[0]+1;for(x=0;xs.index&&(v.startCell=g(i[0]-s.count,i[1]))}})},e.prototype.triggerDataChangeHandler=function(e){var t=["insert","delete","edit","cellDelete","cellSave","clipboard","clear"],r=!0;("delete"===e.action||"insert"===e.action)&&["Column","Sheet"].indexOf(e.eventArgs.modelType)>-1?r=!1:"clear"===e.action&&["Clear Formats","Clear Hyperlinks"].indexOf(e.eventArgs.type)>-1?r=!1:"clipboard"===e.action&&"Formats"===e.eventArgs.requestType&&(r=!1),!e.isUndo||"delete"!==e.action&&"insert"!==e.action||("delete"===e.action?(e.eventArgs.index=e.eventArgs.startIndex,e.eventArgs.model=e.eventArgs.deletedModel,e.eventArgs.insertType="below"):(e.eventArgs.startIndex=e.eventArgs.index,e.eventArgs.endIndex=e.eventArgs.index+e.eventArgs.model.length-1,e.eventArgs.deletedModel=e.eventArgs.model,delete e.eventArgs.insertType)),r&&t.indexOf(e.action)>-1&&this.parent.notify("dataChanged",e.eventArgs)},e.prototype.getModuleName=function(){return"dataBind"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.requestedInfo=[]},e}(),jt="initialLoad",Wt="editOperation",Gt="click",Yt="keyUp",Xt="keyDown",Kt="contextmenuBeforeOpen",$t="removeSheetTab",Zt="cut",Jt="paste",Qt="rowHeightChanged",er="hideShow",tr="autoFitRowsColumns",rr="initiateFilterUI",nr="actionComplete",ir="actionBegin",ar="renderGotoDlgt",or="renderFindDlg",sr="replaceHandler",lr="clearViewer",hr="refreshImgCellObj",dr="createImageElement",pr="deleteImage",cr="deleteChart",ur=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)return void this.fetchSuccess(e.jsonObject,null);var r=new FormData;if(!e.file)return void(this.parent.isOpen=!1);r.append("file",e.file);var n={passWord:""};e.password&&e.password.length&&(n.passWord=e.password),n.passWord&&n.passWord.length&&(e.password=n.passWord),e.password&&r.append("password",e.password);var i={file:e.file||null,cancel:!1,requestData:{method:"POST",body:r},password:n.passWord};this.parent.trigger("beforeOpen",i),this.parent.notify(ir,{eventArgs:i,action:"beforeOpen"}),i.cancel||fetch(this.parent.openUrl,i.requestData).then(function(e){return e.ok?e.json():Promise.reject({status:e.status,statusText:e.statusText,url:e.url})}).then(function(e){return t.fetchSuccess(e,i)}).catch(function(e){return t.fetchFailure(e)})}},e.prototype.fetchFailure=function(e){t.isUndefined(e.status)&&t.isUndefined(e.statusText)&&(e.statusText="Improper response"),this.parent.notify("openFailure",e),this.parent.isOpen=!1},e.prototype.fetchSuccess=function(e,t){var r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword"],n=e,i=(n="string"==typeof e?JSON.parse(e):e).Workbook;if(r.indexOf(i)>-1)return void this.parent.notify("openSuccess",{context:this,data:i,eventArgs:t});this.updateModel(i),this.parent.notify("openSuccess",{context:this,data:i}),this.parent.isOpen=!1,t&&t.password&&t.password.length>0&&(this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.parent.password="")},e.prototype.updateModel=function(e){this.parent.notify(Et,{action:"unRegisterSheet"}),this.parent.sheetNameCount=1,this.parent.sheets=[],this.parent.notify("sheetsDestroyed",{}),e.activeSheetIndex=e.activeSheetIndex||0,this.setSelectAllRange(e.sheets),this.parent.setProperties({sheets:e.sheets,activeSheetIndex:e.activeSheetIndex,definedNames:e.definedNames||[],filterCollection:e.filterCollection||[],sortCollection:e.sortCollection||[]},!0),ge(this.parent),this.parent.notify("sheetCreated",null),this.parent.notify(Et,{action:"registerSheet",isImport:!0}),this.parent.notify(Et,{action:"initiateDefinedNames"}),this.parent.notify("protectSheet",null),this.parent.notify("updateFilter",{isOpen:!0})},e.prototype.setSelectAllRange=function(e){e.forEach(function(e){if(e.selectedRange){var r=c(e.selectedRange),n=(t.isUndefined(e.rowCount)?100:e.rowCount)-1,i=(t.isUndefined(e.colCount)?100:e.colCount)-1;65535===r[2]&&(r[2]=n),255===r[3]&&(r[3]=i),65535===r[0]&&(r[0]=n),255===r[1]&&(r[1]=i),e.selectedRange=m(r)}})},e.prototype.addEventListener=function(){this.parent.on("workbookOpen",this.open.bind(this))},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("workbookOpen",this.open.bind(this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookOpen"},e}(),fr=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,a=Object.keys(t);for(i.append("JSONData",JSON.stringify(e)),n=0;n-1||n.indexOf("data:text/html;base64,")>-1||n.indexOf("data:application/json;base64,")>-1){var i=void 0;if(n=n.replace("data:text/plain;base64,",""),n=n.replace("data:text/html;base64,",""),n.indexOf("data:application/json;base64,")>-1?(n=n.replace("data:application/json;base64,",""),i=atob(n).split(".")):i=atob(n).split(/(\r\n|\n|\r)/gm),i.length){var a=i[0].length>1&&'"'===i[0][0]?i[0].split('"')[1]+".":i[0];postMessage({dialog:a})}}else postMessage(e);t(r.result)},r.readAsDataURL(e)})}).catch(function(e){postMessage({error:e.message})})},e}(),gr=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)}}(),mr=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 gr(r,e),r.prototype.getModuleName=function(){return"workbookSave"},r.prototype.destroy=function(){this.removeEventListener(),this.parent=null},r.prototype.addEventListener=function(){this.parent.on("beginSave",this.initiateSave,this)},r.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("beginSave",this.initiateSave)},r.prototype.initiateSave=function(e){var t=e.saveSettings;this.parent.notify("getFilteredCollection",null),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","dataSourceChanged"]),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,r=["dataSource","startCell","query","showFieldAsHeader"];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}(fr),vr=function(){function e(e){this.parent=e}return e.prototype.getModuleName=function(){return"calc-common"},e}(),yr=function(){function e(e){this.loadedModules=[],this.parent=e}return e.prototype.inject=function(e,t){var r=e.length;if(0===r)return void this.clean();this.loadedModules.length&&this.clearUnusedModule(e);for(var n=0;n-1&&this.parent.isCellReference(h))for(var d=this.parent.getCellCollection(h.split(this.parent.tic).join("")),p=0;p-1)return i;t.isNullOrUndefined(i[0])||isNaN(this.parent.parseFloat(i))||(o+=this.parent.parseFloat(i))}else{if(s[l].split(this.parent.tic).join("")===this.parent.trueValue&&(s[l]="1"),s[l].split(this.parent.tic).join("")===this.parent.falseValue&&(s[l]="0"),a=this.parent.getValueFromArg(s[l].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(t.isNullOrUndefined(a)||isNaN(this.parent.parseFloat(a)))continue;a.length>0&&(o+=this.parent.parseFloat(a+""))}}return o},n.prototype.ComputeINT=function(){for(var r=[],n=0;n-1?i.replace('"',""):i).indexOf('"')>-1?i.replace('"',""):i,i="TRUE"===(i=this.parent.getValueFromArg(i)).toUpperCase()?"1":"FALSE"===i?"0":i,a=this.parent.parseFloat(i),a=Math.floor(a)),isNaN(a)&&(i=o>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]),a||i},n.prototype.ComputeTODAY=function(){for(var t=[],r=0;r-1?d:n>-1?0:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]}var p=h.indexOf(":"),c=this.parent.rowIndex(h.substr(0,p)),u=this.parent.rowIndex(h.substr(p+1));if(!(-1!==c||-1===u)==(-1===c||-1!==u))return this.parent.getErrorStrings()[e.CommonErrors.name];var f=this.parent.colIndex(h.substr(0,p)),g=this.parent.colIndex(h.substr(p+1));if(null===o)for(a=(u-c+1)*(g-f+1),o=[],p=0;p2&&(i=this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments]),1===h&&""!==r[0])l=r[0].indexOf('"'),o="TRUE"===(o=(o=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?o.replace('"',""):o).toUpperCase()?"1":"FALSE"===o?"0":o,o=this.parent.getValueFromArg(o),(a=this.parent.parseFloat(o))>0?a+=.4999999999:a<0&&(a-=.4999999999),i=(a=this.parent.parseFloat(a.toFixed(0))).toString();else if(2===h&&""!==r[0]&&""!==r[1]){l=r[0].indexOf('"')>-1?r[0].indexOf('"'):r[1].indexOf('"')>-1?r[1].indexOf('"'):-1,o=(o=r[0].indexOf('"')>-1?r[0].replace('"',""):r[0]).indexOf('"')>-1?o.replace('"',""):o,s=(s=r[1].indexOf('"')>-1?r[1].replace('"',""):r[1]).indexOf('"')>-1?s.replace('"',""):s,o="TRUE"===o.toUpperCase()?"1":"FALSE"===o?"0":o,s="TRUE"===s.toUpperCase()?"1":"FALSE"===s?"0":s,o=this.parent.getValueFromArg(o),s=this.parent.getValueFromArg(s);var d=Math.ceil(this.parent.parseFloat(s));a=this.parent.parseFloat(o),d>0?(a>0?a+=.4999999999/Math.pow(10,d):a<0&&(a-=.4999999999/Math.pow(10,d)),i=(a=this.parent.parseFloat(a.toFixed(d))).toFixed(d),isNaN(a)&&(i=d.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name])):(a>0?a=a/Math.pow(10,-d)+.49999:a<0&&(a=a/Math.pow(10,-d)-.49999),i=(a=this.parent.parseFloat(a.toFixed(0))*Math.pow(10,-d)).toString(),isNaN(a)&&(i=d.toString().indexOf('"')>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:i=this.parent.getErrorStrings()[e.CommonErrors.name]))}else i=l>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_arguments];return i},n.prototype.ComputeCOUNT=function(){for(var r=[],n=0;n-1&&this.parent.isCellReference(i)){a=this.parent.getCellCollection(i.split(this.parent.tic).join(""));for(var d=0;d0&&""!==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},n.prototype.ComputeDATE=function(){for(var r=[],n=0;n12;)s-=12,o++;if(0===(h=this.parent.getSerialDateFromDate(o,s,l)))return this.parent.getErrorStrings()[e.CommonErrors.num].toString();var d=this.parent.fromOADate(h);return"Invalid Date"!==d.toString()?d.getFullYear()+"/"+this.parent.calculateDate((d.getMonth()+1).toString())+"/"+this.parent.calculateDate(d.getDate().toString()):h.toString()},n.prototype.ComputeFLOOR=function(){for(var r=[],n=0;n0&&a<0)return this.parent.getErrorStrings()[e.CommonErrors.num];if(i>0&&0===a)return this.parent.getErrorStrings()[e.CommonErrors.divzero];for(var d=0;d-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:Math.floor(i/a)*a},n.prototype.ComputeCEILING=function(){for(var r=[],n=0;n0&&a<0)return this.parent.getErrorStrings()[e.CommonErrors.num];for(var d=0;d-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return isNaN(i)?this.parent.getErrorStrings()[e.CommonErrors.name]:0===a?0:Math.ceil(i/a)*a},n.prototype.ComputeDAY=function(){for(var r=[],n=0;n1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var o=this.parent.getValueFromArg(a[0].split(this.parent.tic).join(""));return isNaN(this.parent.parseFloat(o))?(i=this.parent.parseDate(o),"[object Date]"===Object.prototype.toString.call(i)&&(i=i.getDate()),i):this.parent.getErrorStrings()[e.CommonErrors.name]},n.prototype.ComputeIF=function(){for(var r=[],n=0;n0)return r[0];var i,a,o=r;if(o.length>3||1===o.length)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(o.length<=3){if(i=this.parent.getValueFromArg(o[0]),this.parent.getErrorStrings().indexOf(i)>-1)return i;if(i===this.parent.trueValue||this.parent.parseFloat(i)>0||this.parent.parseFloat(i)<0)a=this.parent.getValueFromArg(o[1]);else{if(i!==this.parent.falseValue&&0!==this.parent.parseFloat(i))return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.requires_3_args];if(t.isNullOrUndefined(o[2]))return this.parent.falseValue;a=this.parent.getValueFromArg(o[2])}}return a.indexOf(this.parent.tic)>-1?a.split(this.parent.tic).join(""):a},n.prototype.ComputeIFERROR=function(){for(var r=[],n=0;n-1||this.parent.getErrorStrings().indexOf(i)>-1?this.parent.getValueFromArg(a[1]).split(this.parent.tic).join(""):i)},n.prototype.ComputePRODUCT=function(){for(var r=[],n=0;n-1&&this.parent.isCellReference(p))for(var c=this.parent.getCellCollection(p),u=0;u-1)return i;i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i,o=this.parent.parseFloat(i),isNaN(o)||i.length>0&&(s*=o,l=!1)}else{if(a=this.parent.getValueFromArg(h[d].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;if(a="TRUE"===a.split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,o=this.parent.parseFloat(a),isNaN(o)||a.length>0&&(s*=o,l=!1),this.parent.getErrorStrings().indexOf(a)>-1)return a}}return l?"0":s.toString()},n.prototype.ComputeDAYS=function(){for(var r=[],n=0;n-1&&this.parent.isCellReference(i[0])){if(1!==(l=this.parent.getCellCollection(i[0])).length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}var a=this.parent.getValueFromArg(i[0]);if(this.parent.getErrorStrings().indexOf(a)>-1)return a;var o=this.parent.parseFloat(this.parent.getValueFromArg(i[0].split(this.parent.tic).join("")));if(o<1)return this.parent.getErrorStrings()[e.CommonErrors.value];o=Math.floor(o);var s;if(t.isNullOrUndefined(i[o]))return this.parent.getErrorStrings()[e.CommonErrors.value];if(""===(s=i[o])&&(s="0"),s.indexOf(":")>-1&&this.parent.isCellReference(s)){var l=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));if(1!==l.length)return this.parent.getErrorStrings()[e.CommonErrors.value];i[0]=l[0]}return this.parent.getValueFromArg(s).split(this.parent.tic).join("")},n.prototype.ComputeSUMIF=function(){for(var t=[],r=0;r3||n.length<2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.computeSumIfAndAvgIf(t);return"string"==typeof i&&(this.parent.formulaErrorStrings.indexOf(i)||this.parent.getErrorStrings().indexOf(i))?i:i[0]},n.prototype.ComputeABS=function(){for(var t=[],r=0;r1)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(""===(a=this.parent.getValueFromArg(i[0])))return this.parent.getErrorStrings()[e.CommonErrors.name];if(n=this.parent.parseFloat(a),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)},n.prototype.ComputeAVERAGE=function(){for(var r=[],n=0;n-1&&i[a].indexOf(this.parent.tic)>-1)return this.parent.getErrorStrings()[e.CommonErrors.value];return this.parent.calculateAvg(i)},n.prototype.ComputeAVERAGEIF=function(){for(var t=[],r=0;r-1&&this.parent.isCellReference(i[s])){if(!this.isConcat)return this.parent.getErrorStrings()[e.CommonErrors.value];for(var l=this.parent.getCellCollection(i[s]),h=0;h-1)return o}return a.split(this.parent.tic).join("")},n.prototype.ComputeCONCAT=function(){for(var e=[],t=0;t0?this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments]:Math.random().toString()},n.prototype.ComputeAND=function(){for(var e=[],t=0;t3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a=this.parent.removeTics(this.parent.getValueFromArg(i[0])),o=this.parent.removeTics(this.parent.getValueFromArg(i[1]));if(this.parent.getErrorStrings().indexOf(a)>-1||this.parent.getErrorStrings().indexOf(o)>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];var s=1;if(3===i.length){if(s=this.parent.removeTics(this.parent.getValueFromArg(i[2])),this.parent.getErrorStrings().indexOf(s)>-1)return s;s=this.parent.parseFloat(s),isNaN(s)&&(s=1)}if(s<=0||s>o.length)return this.parent.getErrorStrings()[e.CommonErrors.value];var l=o.indexOf(a,s-1);return l<0?this.parent.getErrorStrings()[e.CommonErrors.value]:(Number(l)+Number(1)).toString()},n.prototype.ComputeINDEX=function(){for(var r=[],n=0;n3)return this.parent.getErrorStrings()[e.CommonErrors.ref];var o="",s=[];if(a>2)for(var l=0;l-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 d=parseFloat(i[2]?i[2]:"1");if(d=isNaN(d)?-1:d,-1===h||-1===d)return this.parent.getErrorStrings()[e.CommonErrors.value];var p=i[0].indexOf(":"),c=this.parent.rowIndex(o.substring(0,p)),u=this.parent.rowIndex(o.substring(p+1)),f=this.parent.colIndex(o.substring(0,p)),g=this.parent.colIndex(o.substring(p+1));if(h>u-c+1||d>g-f+1)return this.parent.getErrorStrings()[e.CommonErrors.ref];h=c+h-1,d=f+d-1;var m=this.getSheetReference(o)+this.parent.convertAlpha(d)+h,v=this.parent.getValueFromArg(m);return""===v?0:v},n.prototype.getSheetReference=function(e){return 0===e.indexOf(this.parent.sheetToken)&&e.lastIndexOf(this.parent.sheetToken)>e.indexOf(this.parent.sheetToken)?e.substring(0,e.lastIndexOf(this.parent.sheetToken)+1):""},n.prototype.ComputeIFS=function(){for(var r=[],n=0;n-1?this.parent.trueValue:(o=this.parent.isCellReference(i[s+1].split(this.parent.tic).join(""))?this.parent.getValueFromArg(i[s+1]):i[s+1].indexOf(this.parent.tic)>-1?i[s+1].split(this.parent.tic).join(""):this.parent.getErrorStrings()[e.CommonErrors.name],s+=1,o);a===this.parent.falseValue&&(s+=1)}return this.parent.getErrorStrings()[e.CommonErrors.na]},n.prototype.ComputeCOUNTA=function(){for(var r=[],n=0;n-1&&this.parent.isCellReference(a[s])){i=this.parent.getCellCollection(a[s].split(this.parent.tic).join(""));for(var l=0;l0&&o++}else this.parent.getValueFromArg(a[s].split(this.parent.tic).join("")).length>0&&o++;return o},n.prototype.ComputeAVERAGEA=function(){for(var r=[],n=0;n-1&&this.parent.isCellReference(s[d])){i=this.parent.getCellCollection(s[d].split(this.parent.tic).join(""));for(var p=0;p-1)return a;a.length>0&&(o=parseFloat(a),l+=a=isNaN(o)?0:o,h+=1)}h=i.length}else{if(s[d]===this.parent.trueValue&&(s[d]="1"),s[d]!==this.parent.falseValue&&""!==s[d]||(s[d]="0"),a=this.parent.getValueFromArg(s[d].split(this.parent.tic).join("")),this.parent.getErrorStrings().indexOf(a)>-1)return a;a.length>0&&(o=parseFloat(a),l+=a=isNaN(o)?0:o,h+=1)}if(0===h)return this.parent.getErrorStrings()[e.CommonErrors.divzero]}return l/h},n.prototype.ComputeSORT=function(){for(var n=[],i=0;i4)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];o[1]=o[1]?o[1]:"1",o[2]=o[2]?o[2]:"1";var s="1"===o[2]?"Ascending":"Descending";o[3]=o[3]?o[3].toUpperCase():"FALSE",o[0]=o[0].split("$").join("");var l,h=[];if(o[0].indexOf(":")>-1){var d=o[0].split(":");if(this.parent.isCellReference(d[0])&&this.parent.isCellReference(d[1])){var p=o[0].indexOf(":"),c=void 0,u=this.parent.rowIndex(this.parent.substring(o[0],0,p)),f=this.parent.colIndex(this.parent.substring(o[0],0,p)),g=this.parent.rowIndex(this.parent.substring(o[0],p+1,p+o[0].length-p-1)),m=this.parent.colIndex(this.parent.substring(o[0],p+1,p+o[0].length-p-1));if(u>g&&(c=g,g=u,u=c),f>m&&(c=m,m=f,f=c),o[2]=this.parent.getValueFromArg(o[2]),"1"!==o[2]&&"-1"!==o[2])return this.parent.getErrorStrings()[e.CommonErrors.value];if(!isNaN(this.parseDouble(o[1]))&&this.parseDouble(o[1])<1)return this.parent.getErrorStrings()[e.CommonErrors.value];if(o[3].toUpperCase()!==this.parent.trueValue&&o[3].toUpperCase()!==this.parent.falseValue)return this.parent.getErrorStrings()[e.CommonErrors.value];var v="";0===o[0].indexOf("!")&&(v=(v=(v=o[0]).replace("!","")).indexOf("!"),v=o[0].substring(0,v+2)),o[0]=v+V(f)+u+":"+V(m)+g,l=this.parent.getCellCollection(o[0]);for(b=0;b=")?(h="greaterEq",d=d.substring(2)):d.startsWith("<>")?(h="notEq",d=d.substring(2)):d.startsWith("<")?(h="less",d=d.substring(1)):d.startsWith(">")?(h="greater",d=d.substring(1)):d.startsWith("=")&&(h="equal",d=d.substring(1)),i[0].indexOf(":")>-1&&this.parent.isCellReference(i[0])){a=this.parent.getCellCollection(i[0].split(this.parent.tic).join(""));for(var p=0;p-1||d.indexOf("?")>-1)&&(o=this.parent.findWildCardValue(d,o)),l.push(o),l.push(d),this.parent.processLogical(l,h)===this.parent.trueValue&&s++}return s},n.prototype.ComputeSUMIFS=function(){for(var e=[],t=0;t-1&&d!==h.length-1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var p=l,c=h.slice(0,h.length-1),u=new Date(1900,0,1,0,0,0),f=p+","+c,g=new t.Internationalization;if(this.parent.getErrorStrings().indexOf(f)>-1)return f;if(p=this.parent.getValueFromArg(p),""===(c=c.split(this.parent.tic).join("")))return"";""===p&&(c.length>0&&(c.toUpperCase().indexOf("M")>-1||c.toUpperCase().indexOf("D")>-1||c.toUpperCase().indexOf("Y")>-1||c.toUpperCase().indexOf("S")>-1||c.toUpperCase().indexOf("T")>-1)||c.toUpperCase().indexOf("H")>-1)&&(p=u.toString());var m=this.parseDouble(p);if(isNaN(m)&&null!==this.parent.isDate(new Date(p))&&(m=this.parent.toOADate(new Date(p))),u=Date.parse(p.split(this.parent.tic).join("")),!isNaN(m)||!isNaN(u)){if("["===c[0])return this.parent.tic+p+this.parent.tic;if(c.length>0&&(c.toUpperCase().indexOf("M")>-1||c.toUpperCase().indexOf("D")>-1||c.toUpperCase().indexOf("Y")>-1||c.toUpperCase().indexOf("S")>-1||c.toUpperCase().indexOf("T")>-1)||c.toUpperCase().indexOf("H")>-1){var v=(c=(c=c.split("Y").join("y").split("D").join("d").split("H").join("h")).split("S").join("s").split("m").join("M").split("AM/PM").join("tt")).split(""),y=!1,C=!1,o=0,b=0,S=0;for(o=0;o1&&S++,"M"===x&&y&&(v[o]="m",C=!0),"h"===x?y=!0:this.parent.isChar(x)&&"M"!==x&&"h"!==x&&!C&&(y=!1,C=!1),o++}c=(c=String(v)).split(",").join("").split("\n").join(" ");var w=this.parent.fromOADate(m);0===m&&(w=u);var I=M(c);if(""===I)return this.parent.getErrorStrings()[e.CommonErrors.name];p=g.getDateFormat({skeleton:I,type:"date"})(new Date(w.toString()))}else p=g.formatNumber(m,{format:c})}return p},n.prototype.ComputeCOUNTIFS=function(){for(var e=[],t=0;t3)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var a,o=[],s=i[0].split(this.parent.tic).join("");this.parent.isCellReference(s)&&(s=this.parent.getValueFromArg(s)),i[2]=t.isNullOrUndefined(i[2])?"1":i[2].split(this.parent.tic).join(""),i[2].split(this.parent.tic).join("")===this.parent.trueValue&&(i[2]="1"),i[2].split(this.parent.tic).join("")===this.parent.falseValue&&(i[2]="0");var l=parseFloat(i[2]);if(-1!==l&&0!==l&&1!==l)return this.parent.getErrorStrings()[e.CommonErrors.na];var h=0,d="";if(i[1].indexOf(":")>-1||this.parent.isCellReference(i[1])){a=this.parent.getCellCollection(i[1].split(this.parent.tic).join(""));for(var p=0;po[c]&&(d?o[c]>d&&(h=c+1,d=o[c]):(h=c+1,d=o[c]))}else if(0===l){if((s.indexOf("*")>-1||s.indexOf("?")>-1)&&(o[c]=this.parent.findWildCardValue(s,o[c])),s===o[c])return c+1;if(this.parent.parseFloat(s)===this.parent.parseFloat(o[c]))return c+1}else if(-1===l){if(s===o[c])return c+1;s1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n[0].indexOf(":")>-1||""===n[0].split(this.parent.tic).join(""))return this.parent.getErrorStrings()[e.CommonErrors.value];var i=n[0].split(this.parent.tic).join("");n[0]=isNaN(this.parent.parseFloat(i))?n[0]:i;var a=this.parent.getValueFromArg(n[0]),o=this.parent.parseFloat(a);return isNaN(o)?a.indexOf(this.parent.tic)>-1?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.PI*o/180},n.prototype.ComputeRANDBETWEEN=function(){for(var t=[],r=0;r-1){if(isNaN(parseFloat(t[s].split(this.parent.tic).join(""))))return this.parent.getErrorStrings()[e.CommonErrors.value];t[s]=t[s].split(this.parent.tic).join("")}if(a=parseFloat(this.parent.getValueFromArg(t[s])),this.parent.isCellReference(t[s])){if(a=""===this.parent.getValueFromArg(t[s])?0:a,0===s?n=a:i=a,0===n&&0===i)return"0";if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(isNaN(a))return this.parent.getErrorStrings()[e.CommonErrors.name];0===s?n=a:i=a}}return i-1||o.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,d=0,p=0,c=0,u=s.length;c-1||s.indexOf("#NAME?")>-1)return this.parent.getErrorStrings()[e.CommonErrors.name];for(var l=0,h=0,d=0,p=o.length;d1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(this.parent.isCellReference(a[0])){if(o=this.parent.getValueFromArg(a[0]),(n=this.parent.parseFloat(o))<=0||""===o)return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}else{if(i=this.parent.getValueFromArg(a[0].split(this.parent.tic).join("")),(n=this.parent.parseFloat(i))<=0||""===n.toString())return this.parent.getErrorStrings()[e.CommonErrors.num];if(isNaN(n))return this.parent.getErrorStrings()[e.CommonErrors.value]}return Math.log(n)},n.prototype.ComputeISNUMBER=function(){for(var t=[],r=0;r1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];var i=this.parent.isCellReference(n[0])?this.parent.getValueFromArg(n[0]):this.parent.getValueFromArg(n[0].split(this.parent.tic).join(""));if(""===i.toString())return!1;var a=this.parent.parseFloat(i);return!isNaN(a)},n.prototype.ComputeROUND=function(){for(var t=[],r=0;r2?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()):(a=this.parent.getValueFromArg(l[0]),o=""===l[1].split(this.parent.tic).join("")?"0":this.parent.getValueFromArg(l[1].split(this.parent.tic).join("")),a="TRUE"===a.split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,o="TRUE"===o.split(this.parent.tic).join("")?"1":"FALSE"===o.split(this.parent.tic).join("")?"0":o,""!==a&&""!==o&&(h=this.parent.parseFloat(a),d=this.parent.parseFloat(o),!isNaN(d)&&!isNaN(h)&&d>0?i=h.toFixed(d):(s=Math.pow(10,-d),i=Math.round(h/s)*s)),i.toString())},n.prototype.ComputePOWER=function(){for(var t=[],r=0;r2)return 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;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:0===o&&s<0?this.parent.getErrorStrings()[e.CommonErrors.divzero]:0===o&&0===s?this.parent.getErrorStrings()[e.CommonErrors.num]:Math.pow(o,s).toString()},n.prototype.ComputeLOG=function(){for(var t=[],r=0;r2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];if(n=this.parent.getValueFromArg(a[0]),i=2===t.length?this.parent.getValueFromArg(a[1]):"10",""===n||null===n||""===i||null===i)return this.parent.getErrorStrings()[e.CommonErrors.num];n="TRUE"===n.split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n,i="TRUE"===i.split(this.parent.tic).join("")?"1":"FALSE"===i.split(this.parent.tic).join("")?"0":i;var o=this.parent.parseFloat(n),s=this.parent.parseFloat(i);return o<=0||s<=0?this.parent.getErrorStrings()[e.CommonErrors.num]:1===s?this.parent.getErrorStrings()[e.CommonErrors.divzero]:isNaN(o)||isNaN(s)?this.parent.getErrorStrings()[e.CommonErrors.value]:(Math.log(o)/Math.LN10/(Math.log(s)/Math.LN10)).toString()},n.prototype.ComputeTRUNC=function(){for(var t=[],r=0;r2)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];2===t.length&&(a="TRUE"===(a=this.parent.getValueFromArg(i[1])).split(this.parent.tic).join("")?"1":"FALSE"===a.split(this.parent.tic).join("")?"0":a,a=this.parent.parseFloat(a)),n="TRUE"===(n=this.parent.getValueFromArg(i[0])).split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n;var o=this.parent.parseFloat(n.split(this.parent.tic).join(""));if(isNaN(o)||isNaN(a))return i[0]===this.parent.tic||this.parent.isCellReference(i[0])||i[1]===this.parent.tic||this.parent.isCellReference(i[1])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name];var s=Math.pow(10,a);return((o<0?-1:1)*Math.floor(s*Math.abs(o))/s).toString()},n.prototype.ComputeEXP=function(){for(var t=[],r=0;r1)return this.parent.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];""===(n="TRUE"===(n=this.parent.getValueFromArg(i[0])).split(this.parent.tic).join("")?"1":"FALSE"===n.split(this.parent.tic).join("")?"0":n)&&(n="0");var a=this.parent.parseFloat(n);return a>709?this.parent.getErrorStrings()[e.CommonErrors.num]:isNaN(a)?i[0]===this.parent.tic||this.parent.isCellReference(i[0])?this.parent.getErrorStrings()[e.CommonErrors.value]:this.parent.getErrorStrings()[e.CommonErrors.name]:Math.exp(a).toString()},n.prototype.ComputeGEOMEAN=function(){for(var t=[],r=0;r-1){if(s[0]===this.parent.tic)return this.parent.getErrorStrings()[e.CommonErrors.value];for(o=this.parent.getCellCollection(s[i].split(this.parent.tic).join("")),a=0;a0){if(d="TRUE"===d.split(this.parent.tic).join("")?"1":"FALSE"===d.split(this.parent.tic).join("")?"0":d,!this.parent.isCellReference(s[i])&&isNaN(this.parent.parseFloat(d)))return this.parent.getErrorStrings()[e.CommonErrors.name];if((n=this.parent.parseFloat(d))<=0)return this.parent.getErrorStrings()[e.CommonErrors.num];isNaN(n)||(h++,l*=n)}return h>0&&(l=Math.pow(l,1/h)),l.toString()},n.prototype.getDataCollection=function(e){for(var t=[],r=0,n=e.length;r",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 a=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 o=this.parent.getSheetFamilyItem(this.parent.grid);if(null!=o.sheetNameToParentObject&&o.sheetNameToParentObject.size>0){r[0]!==this.sheetToken.toString()&&(r=this.parent.setTokensForSheets(r));var s=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(s)&&""!==s&&this.parent.namedRanges.size>0&&""!==l&&(r=l)}}r=this.markLibraryFormulas(r);try{r=this.formulaAutoCorrection(r)}catch(t){if(!(p={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",p),this.isFailureTriggered=!0),!p.isForceCalculable||!p.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression];r=this.formulaAutoCorrection(r,p),this.parent.storedData.get(n).formulaText="="+r}if(!this.ignoreBracet)for(a=r.indexOf(")");a>-1;){var h=r.substring(0,a).lastIndexOf("(");if(-1===h)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);if(h===a-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.empty_expression]);var d=this.emptyStr;d=this.ignoreBracet?this.parent.substring(r,h,a-h+1):this.parent.substring(r,h+1,a-h-1);try{r=r.substring(0,h)+this.parseSimple(d)+r.substring(a+1)}catch(e){var p=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",p),this.isFailureTriggered=!0);var c="string"==typeof p.exception?p.exception:p.message;return(this.parent.getErrorLine(e)?"":"#"+this.parent.getErrorLine(e)+": ")+c}a=r.indexOf(")")}if(!this.ignoreBracet&&r.indexOf("(")>-1)throw new Ir(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=["*","+","-","/","^","&"],a=[">","=","<"],o=0,s="",l="",h="",d="",p="",c="",u="",f=0;if(this.parent.formulaErrorStrings.indexOf(r)>-1)return r;if(this.indexOfAny(r,this.specialSym)>-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!1);for(;o-1||r.indexOf("/-")>-1)&&(r="-"+r.split("*-").join("*").split("/-").join("/")),this.parent.isDigit(r[o])&&r.length>o+1&&this.indexOfAny(r[o+1],i)>-1&&r.length>o+2&&!t.isNullOrUndefined(r[o+2])&&this.indexOfAny(r[o+2],i)>-1){if(t.isNullOrUndefined(n))throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.invalid_expression],!0);if(!n.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];this.parent.isDigit(r[o])?(f<1?(c=r[o],h=r[o+1],t.isNullOrUndefined(h)&&(h=this.emptyStr),f+=1,s=s+c+(h="&"===h?"":h)):f<2&&(u=r[o],d=r[o-1],p=r[o+1],f=0,s="-"===d?s+d+u+(p="&"===(p=t.isNullOrUndefined(p)?this.emptyStr:p)?"":p):s+u+(p=t.isNullOrUndefined(p)?this.emptyStr:p)),o+=2):(s="-"===r[o]?s+r[o]:s,o+=1)}else if((this.parent.isDigit(r[o])||r[o]===this.parent.rightBracket||this.parent.storedData.has(r[o].toUpperCase()))&&(t.isNullOrUndefined(r[o+1])||this.indexOfAny(r[o+1],i))>-1)l="&"===(l=t.isNullOrUndefined(r[o+1])?this.emptyStr:r[o+1])?"":l,s="-"===r[o-1]?s+r[o-1]+r[o]+l:s+r[o]+l,o+=2;else if(this.indexOfAny(r[o],a)>-1&&!t.isNullOrUndefined(r[o-1])&&!t.isNullOrUndefined(r[o+1]))s+=r[o],o+=1;else if("q"===r[o])for(;r[o]!==this.parent.leftBracket;)s+=r[o],o+=1;else r[o]===this.parent.leftBracket||r[o]===this.parent.rightBracket||"{"===r[o]||"}"===r[o]||"("===r[o]||")"===r[o]?(s+=r[o],o+=1):this.parent.isUpperChar(r[o])||r[o].indexOf(":")>-1||r[o]===this.parent.getParseArgumentSeparator()||"%"===r[o]&&this.parent.isDigit(r[o-1])?(s+=r[o],o+=1):r[o]===this.parent.tic||" "===r[o]||"."===r[o]||r[o]===this.sheetToken||"$"===r[o]?(s+=r[o],o+=1):(this.parent.isDigit(r[o])&&(s="-"===r[o-1]?s+r[o-1]+r[o]:s+r[o]),"-"!==r[o]&&"+"!==r[o]||(s=(s+=r[o]).split("++").join("+").split("+-").join("-").split("-+").join("-")),"/"!==r[o]&&"*"!==r[o]||(s+=r[o]),o+=1);return s=s===this.emptyStr?r:s,this.indexOfAny(s[s.length-1],i)>-1&&(s=s.substring(0,s.length-1)),s=s.split("--").join("-").split("-+").join("-").split("+-").join("-")},r.prototype.checkScopedRange=function(e){var r=this,n=this.emptyStr,i="NaN",a=this.parent.getSheetID(this.parent.grid),o=this.parent.getSheetFamilyItem(this.parent.grid);if(e[0]===this.sheetToken.toString()){var s=e.indexOf(this.sheetToken,1),l=parseInt(e.substr(1,s-1),10);s>1&&!this.parent.isNaN(l)&&(e=e.substring(s+1),a=l)}var h="!"+a.toString()+"!";return null===o||null==o.sheetNameToToken?i:(o.sheetNameToToken.forEach(function(a,s){if(o.sheetNameToToken.get(s).toString()===h){var l=r.emptyStr;r.parent.namedRanges.forEach(function(a,s){l=t.isNullOrUndefined(r.parent.parentObject)?o.sheetNameToToken.get(s).toUpperCase():(r.parent.parentObject.getActiveSheet().name+r.sheetToken+e).toUpperCase(),r.parent.getNamedRanges().has(l)&&(n=r.parent.getNamedRanges().get(l).toUpperCase(),i=n)})}}),i)},r.prototype.storeStrings=function(t){var r,n=0,i=0,a=0,o="",s=null;if(t.indexOf(this.parent.tic)>-1)for(n=t.indexOf(this.parent.tic);n>-1&&t.length>0;){if(null===s&&(s=this.stringsColl),-1===(i=n+10&&"+"===t[0]&&(t=t.substring(1)),"#DIV/0!"===t)return"#DIV/0!";if("#NAME?"===t)return"#NAME?";if(""===t)return t;if(this.parent.formulaErrorStrings.indexOf(t)>-1)return t;t=(t=(t=(t=(t=(t=t.split(this.stringLessEq).join(this.charLessEq)).split(this.stringGreaterEq).join(this.charGreaterEq)).split(this.stringNoEqual).join(this.charNoEqual)).split(this.stringAnd).join(this.charAnd)).split(this.stringOr).join(this.charOr)).split(this.fixedReference).join(this.emptyStr);var r=[this.tokenEp,this.tokenEm],n=[this.tokenMultiply,this.tokenDivide],i=[this.tokenAdd,this.tokenSubtract],a=[this.charMultiply,this.charDivide],o=[this.charAdd,this.charSubtract],s=[this.tokenLess,this.tokenGreater,this.tokenEqual,this.tokenLessEq,this.tokenGreaterEq,this.tokenNotEqual],l=[this.charLess,this.charGreater,this.charEqual,this.charLessEq,this.charGreaterEq,this.charNoEqual],h=[this.charEp,this.charEm],d=[this.tokenAnd],p=[this.charAnd],c=[this.charOr],u=[this.tokenOr];return t=this.parseSimpleOperators(t,r,h),t=this.parseSimpleOperators(t,u,c),t=this.parseSimpleOperators(t,n,a),t=this.parseSimpleOperators(t,i,o),t=this.parseSimpleOperators(t,s,l),t=this.parseSimpleOperators(t,d,p)},r.prototype.parseSimpleOperators=function(t,r,n){if(this.parent.getErrorStrings().indexOf(t)>-1)return t;for(var i=t,a=0,o="",s=0;s+").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(a=this.indexOfAny(i,n);a>-1;){var l="",h="",d=0,p=0,c=0;if(i[a]===this.charNOTop)d=a;else if(c=a-1,i[c]===this.parent.arithMarker){if((f=this.findLeftMarker(i.substring(0,c-1)))<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f+1,c-f-1),d=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 Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,f,c-f+1),d=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 Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);l=this.parent.substring(i,g,c-g+1),d=g}else{for(v=!1;c>-1&&(this.parent.isDigit(i[c])||!v&&i[c]===this.parent.getParseDecimalSeparator());)i[c]===this.parent.getParseDecimalSeparator()&&(v=!0),c-=1;if(c>-1&&v&&i[c]===this.parent.getParseDecimalSeparator())throw new Ir(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,a-c),d=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)}if(c>-1&&":"===i[c]){for(c-=1;c>-1&&this.parent.isDigit(i[c]);)c-=1;for(;c>-1&&this.parent.isUpperChar(i[c]);)c-=1;if(c>-1&&i[c]===this.sheetToken){for(c--;c>-1&&i[c]!==this.sheetToken;)c--;c>-1&&i[c]===this.sheetToken&&c--}c+=1,l=this.parent.substring(i,c,a-c),l=this.parent.getCellFrom(l)}else c+=1,l=this.parent.substring(i,c,a-c);this.parent.updateDependentCell(l),d=c}(this.parent.namedRanges.size>0&&this.parent.namedRanges.has(l.toUpperCase())||this.parent.storedData.has(l.toUpperCase()))&&(l="n"+this.checkForNamedRangeAndKeyValue(l))}if(a===i.length-1)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.expression_cannot_end_with_an_operator]);var m="u"===i[c=a+1];if(m&&(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),p=f+c+2}else if(i[c]===this.parent.arithMarker){if((f=this.findRightMarker(i.substring(c+1)))<0)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.cannot_parse]);h=this.parent.substring(i,c+1,f),p=f+c+2}else if("q"===i[c]){for(var u=0,f=c+1;f1){for(;c0&&this.parent.namedRanges.has(h.toUpperCase())||this.parent.storedData.has(h.toUpperCase()))&&(h="n"+this.checkForNamedRangeAndKeyValue(h)),p=c+1}var S=o.indexOf(i[a]),x=this.parent.arithMarker+l+h+r[S]+this.parent.arithMarker;d>0&&(x=i.substring(0,d)+x),p0&&(this.parent.isUpperChar(i[0])||i[0]===this.sheetToken)){for(var w=!0,I=!0,E=!1,R=i.length,f=0;f0&&!E)throw this.parent.getErrorStrings()[e.CommonErrors.ref];for(E=!0,f++;f-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;n0&&r[0]===this.parent.getFormulaCharacter()&&(r=r.substring(1)),r.indexOf("#REF!")>-1)return this.parent.getErrorStrings()[e.CommonErrors.ref];r.length>0&&"+"===r[0]&&(r=r.substring(1));try{this.isFailureTriggered=!1,this.isError=!1,r=this.parse(r.trim(),n),this.isFormulaParsed=!0}catch(e){var i=this.exceptionArgs(e);this.isFailureTriggered||(this.parent.trigger("onFailure",i),this.isFailureTriggered=!0);var a="string"==typeof i.exception?i.exception:i.message;r=(t.isNullOrUndefined(this.parent.getErrorLine(e))?"":"#"+this.parent.getErrorLine(e)+": ")+a,this.isError=!0}return r},r.prototype.markLibraryFormulas=function(r){var n=0,i=r.indexOf(")");if(-1===i)r=this.markNamedRanges(r);else for(;i>-1;){for(var a=0,o=i-1;o>-1&&("("!==r[o]||0!==a);)")"===r[o]&&a++,o--;if(-1===o)throw new Ir(this.parent.formulaErrorStrings[e.FormulasErrorsStrings.mismatched_parentheses]);for(var s=o-1;s>-1&&this.parent.isChar(r[s]);)s--;var l=o-s-1,h=this.parent.substring(r,s+1,l);if(l>0&&!t.isNullOrUndefined(this.parent.getFunction(h))){"AREAS"===this.parent.substring(r,s+1,l)?this.ignoreBracet=!0:this.ignoreBracet=!1;var d=this.parent.substring(r,o,i-o+1);try{var p=void 0;d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,p)+")"}catch(t){if(!(p={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",p),this.isFailureTriggered=!0,n+=1),p.computeForceCalculate=n>0||p.computeForceCalculate,!p.isForceCalculable)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];if(!p.computeForceCalculate)throw this.parent.formulaErrorStrings[e.FormulasErrorsStrings.improper_formula];d=d.split("(").join("").split(")").join(""),d="("+this.formulaAutoCorrection(d,p)+")"}d=this.markNamedRanges(d),d=this.swapInnerParens(d),-1===(d=this.addParensToArgs(d)).lastIndexOf(this.parent.getParseArgumentSeparator())&&d.length>2&&"("===d[0]&&")"===d[d.length-1]&&"{"!==d[1]&&"("!==d[1]&&(d=(d=d.substring(0,d.length-1)+"}"+d.substring(d.length-1))[0]+"{"+d.substring(1)),r=r.substring(0,s+1)+"q"+this.parent.substring(r,s+1,l)+d.split("(").join(this.parent.leftBracket).split(")").join(this.parent.rightBracket)+r.substring(i+1)}else{if(l>0)return this.parent.getErrorStrings()[e.CommonErrors.name];var c=this.emptyStr;o>0&&(c=r.substring(0,o)),c=c+"{"+this.parent.substring(r,o+1,i-o-1)+"}",i2&&(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{var i=["+","-","*","/"];r=this.lastIndexOfAny(e,i),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 a=!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()),a&&-1===r&&"("===e[0]&&(r=0,a=!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-1?o=this.getTableRange(this.parent.substring(e,n,i)):this.parent.storedData.has(this.parent.substring(e,n,i))?o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i)):this.parent.namedRanges.has(this.parent.substring(e,n,i))&&(o=this.checkForNamedRangeAndKeyValue(this.parent.substring(e,n,i))),t.isNullOrUndefined(o)&&("NaN"!==(a=this.checkScopedRange(this.parent.substring(e,n,i)))?(this.findNamedRange=!0,o=a):this.parent.substring(e,n,i).startsWith(this.sheetToken.toString()),!t.isNullOrUndefined(o)&&this.findNamedRange&&o.indexOf(this.fixedReference)>-1&&(o=o.split(this.fixedReference).join(this.emptyStr))),t.isNullOrUndefined(o)||(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),o=this.markLibraryFormulas(o)),t.isNullOrUndefined(o)||o===this.emptyStr)for(n+=i+1;n-1)&&n-1?this.getTableRange(e.substring(n)):this.parent.storedData.has(e.substring(n))?this.parent.storedData.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o:this.parent.namedRanges.size>0?this.checkForNamedRangeAndKeyValue(e.substring(n)):o,t.isNullOrUndefined(o)&&"NaN"!==(a=this.checkScopedRange(e.substring(n)))&&(o=a),!t.isNullOrUndefined(o)&&o!==this.emptyStr&&(o=o.toUpperCase(),o=this.parent.setTokensForSheets(o),null!=(o=this.markLibraryFormulas(o)))){var s=e.substring(n);e=")"===s[s.length-1]?e.substring(0,n)+o+")":e.substring(0,n)+o,n+=o.toString().length+1}i=n-1&&(e=e.split("#N~A").join("#N/A")),e.indexOf("#DIV~0!")>-1&&(e=e.split("#DIV~0!").join("#DIV/0!")),e},r.prototype.checkForNamedRangeAndKeyValue=function(e){var r=this.emptyStr;if(e.indexOf("[")>-1){var n=this.getTableRange(e);t.isNullOrUndefined(n)||(this.findNamedRange=!0,e=n)}if("NaN"!==(r=this.checkScopedRange(e)))this.findNamedRange=!0,e=r;else{if(e.indexOf(this.sheetToken)>-1){var i=this.parent.getSheetFamilyItem(this.parent.grid),a=e.split('"').join(this.emptyStr);if(a=a.substr(0,a.indexOf(this.sheetToken)),i.sheetNameToToken.has(a.toUpperCase()))parseInt(i.sheetNameToToken.get(a.toUpperCase()).split(this.sheetToken).join(this.emptyStr))}this.parent.storedData.size>0&&this.parent.storedData.has(e)&&(e="A"+this.parent.colIndex(e)),this.parent.namedRanges.size>0&&this.parent.namedRanges.has(e.toUpperCase())&&(t.isNullOrUndefined(this.parent.parentObject)?(e=this.parse(this.parent.namedRanges.get(e.toUpperCase())),(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&e.split(this.fixedReference).join(this.emptyStr),this.findNamedRange=!0):e=this.parse(this.parent.namedRanges.get(e.toUpperCase()))),this.findNamedRange&&"!"!==e[0]&&"q"!==e[0]&&"bq"!==e[0]&&(e=this.parent.setTokensForSheets(e)).indexOf(this.fixedReference)>-1&&(e=e.split(this.fixedReference).join(this.emptyStr))}return e},r.prototype.getTableRange=function(e){var t=(e=e.replace(" ",this.emptyStr).toUpperCase()).replace("]",this.emptyStr).replace("#DATA",this.emptyStr);t.indexOf(this.parent.getParseArgumentSeparator())>-1&&(t.substring(0,t.indexOf(this.parent.getParseArgumentSeparator())).replace("[",this.emptyStr),t=t.replace("[",this.emptyStr).replace(this.parent.getParseArgumentSeparator(),"_"));this.emptyStr;return t.toUpperCase()},r.prototype.findNextEndIndex=function(e,t){for(var r=0,n=t,i=!1;!i&&t=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},wr=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 a=new yr(n);return n.includeBasicFormulas&&i.Inject(Cr),n.injectedModules&&n.injectedModules.length&&a.inject(n.requiredModules(),n.injectedModules),n.parentObject=t.isNullOrUndefined(e)?n:e,n.grid=n.parentObject,n.parser=new br(n),n}Sr(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 P(this)},n.Inject=function(){for(var e=[],t=0;t64&&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);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(r0){var r=t.parentObjectToToken.get(e);if(r){r=r.split(this.sheetToken).join(this.emptyString);var n=this.parseFloat(r);if(!this.isNaN(n))return n}}return-1},n.prototype.parseFloat=function(e){return Number(e)},n.prototype.rowIndex=function(t){var r=0,n=!1;if(r=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 Rr),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 Rr),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 Er),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,a=t.getDependentCells().get(i);t.arrayRemove(a,e),0===a.length&&t.getDependentCells().delete(i)}),this.getDependentFormulaCells().delete(e))},n.prototype.arrayRemove=function(e,t){var r=e.indexOf(t);return-1!==r&&e.splice(r,1),e},n.prototype.getKeyValue=function(e){if(e=e.toUpperCase(),null!==this.storedData.has(e)){var r=this.storedData.get(e),n=r.getFormulaText();if(n.length>0&&n[0]===this.getFormulaCharacter()){this.cell=this.cellPrefix+this.keyToRowsMap.get(e).toString(),n=n.substring(1);try{r.setParsedFormula(this.parser.parseFormula(n,e))}catch(t){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){var i={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",i);var a="string"==typeof i.exception?i.exception:i.message;return(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+a}}return this.storedData.get(e).getFormulaValue()}return this.emptyString},n.prototype.getNamedRanges=function(){return this.namedRanges},n.prototype.addNamedRange=function(e,t){var r=e.split(this.sheetToken);if(r.length>1){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++}for(var i=[],a=0;a-1)for(var n=r+1;n0&&this.isChar(e[l-1]))for(var h=l-2;h>=0&&this.isDigit(e[h]);)h--;i=this.rowIndex(this.substring(e,0,l)),a=this.rowIndex(this.substring(e,l+1,l+e.length-l-1)),o=this.colIndex(this.substring(e,0,l)),s=this.colIndex(this.substring(e,l+1,l+e.length-l-1)),i>a&&(l=a,a=i,i=l),o>s&&(l=s,s=o,o=l);var d,p=[],c=0;for(l=i;l<=a;l++)for(d=o;d<=s;d++)p[c]=t+this.emptyString+this.convertAlpha(d)+l.toString(),c++;return p},n.prototype.computeFormula=function(r){var n,i,a,o,s=!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&&(s=!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),d=h.split(this.leftBracket)[0].split("q").join(this.emptyString),p=void 0;if(this.getLibraryFormulas().get(d.toUpperCase()).isCustom){p=h.substring(h.indexOf(this.leftBracket)+1,h.indexOf(this.rightBracket)).split(this.getParseArgumentSeparator());var c=0,u=[];for(c=0;c-1?a=n:n!==this.emptyString&&-1===i&&(a=this.computeValue(n))}catch(e){p={message:e.message,exception:e,isForceCalculable:!1,computeForceCalculate:!1};this.trigger("onFailure",p);var v="string"==typeof p.exception?p.exception:p.message;a=(t.isNullOrUndefined(this.getErrorLine(e))?"":"#"+this.getErrorLine(e)+": ")+v}return a},n.prototype.computeSumIfAndAvgIf=function(r){if(t.isNullOrUndefined(r)||r[0]===this.emptyString||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var n=r,i=0;i255)return this.getErrorStrings()[e.CommonErrors.value];var h=l.includes("*"),d=h?l.replace(/\*/g,"").trim():l;d=this.isCellReference(d)?this.getValueFromArg(d):l,h&&("*"===l[0]&&(d="*"+d),"*"===l[l.length-1]&&(d+="*")),l=d;var p=this.parser.tokenEqual;l.startsWith("<=")?(p=this.parser.tokenLessEq,l=l.substring(2)):l.startsWith(">=")?(p=this.parser.tokenGreaterEq,l=l.substring(2)):l.startsWith("<>")?(p=this.parser.tokenNotEqual,l=l.substring(2)):l.startsWith("<")?(p=this.parser.tokenLess,l=l.substring(1)):l.startsWith(">")?(p=this.parser.tokenGreater,l=l.substring(1)):l.startsWith("=")&&(p=this.parser.tokenEqual,l=l.substring(1));var c=this.parseFloat(l),u=n[0],f=this.getCellCollection(o>2?n[2]:s),g=this.getCellCollection(u),m=this.getComputeSumIfValue(g,f,l,c,p,h);return[m[0],m[1]]},n.prototype.findWildCardValue=function(e,t){var r="";if(e.indexOf("?")>-1){var n=e[(o=e.indexOf("?"))-1],i=e[o+1];if(t.indexOf(n)>-1&&t.indexOf(i)>-1){var a=t.indexOf(n);r=t[a]===n&&t[a+2]===i?e:t}else r=t}else if(e.indexOf("*")>-1){for(var o=e.indexOf("*"),s="",l="",h=this.falseValue,d=this.falseValue,p=o-1;p>=0;p--)s+=e[p],d=this.trueValue;for(p=o+1;p-1||u>-1?d===this.trueValue?r=s.split("").reverse().join("")===t.substr(0,s.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,a){var o=0,s=0;a&&r&&r[0];switch(i){case this.parser.tokenEqual:for(var l=a?r.replace(/\*/g,""):r,h=0;hn){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenLessEq:for(h=0;h=n){c=this.getValueFromArg(t[h].split(this.tic).join(""));o+=u=this.parseFloat(c),s+=1}}break;case this.parser.tokenNotEqual:for(h=0;h-1&&this.isCellReference(l[h]))for(var d=this.getCellCollection(l[h]),p=0;p-1)return d[p];if(d[p][0]===this.tic)return this.getErrorStrings()[e.CommonErrors.name];if(""===(n=this.getValueFromArg(d[p]))&&(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 a=!0;i=this.parseFloat(n)}a="and"===r?a&&(n===this.trueValue||!isNaN(i)):a||n===this.trueValue||!isNaN(i)}return a?this.trueValue:this.falseValue},n.prototype.removeTics=function(e){return e.length>1&&e[0]===this.tic[0]&&e[e.length-1]===this.tic[0]&&(e=this.substring(e,1,e.length-2)),e},n.prototype.getCellFrom=function(e){var t,r="",n=e.indexOf(":")>-1?e.split(":"):[e],i=n.length-1,a=this.rowIndex(n[0]);if(a===this.rowIndex(n[i])){var o=this.colIndex(n[0]),s=this.colIndex(n[i]),l=this.colIndex(this.cell);l>=o&&l<=s&&(r=V(l).toString()+a.toString())}else if(this.colIndex(n[0])===this.colIndex(n[i])){t=this.colIndex(n[0]);var h=this.rowIndex(n[i]),d=this.rowIndex(this.cell);d>=a&&d<=h&&(r=V(t).toString()+d.toString())}return r},n.prototype.computeValue=function(t){try{var r=[],n=0,i="";for(r.length=0;n-1)return s;r.push(s)}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]){o=t[n].toString();for(n+=1;n0){var d=r[0],p=this.parseFloat(d);this.isNaN(p)||(r.pop(),r.push((p/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]){o=t[n].toString();for(n++;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;o="";if(0===t.substring(n).indexOf("Infinity"))n+=(o="Infinity").length;else{for(("u"===t[n]||a)&&(o="-",a?a=!1:n+=1);n0){var d=r[0],p=this.parseFloat(d);this.isNaN(p)||(r.pop(),r.push((p/100).toString()))}}else o=(this.parseFloat(o)/100).toString()}r.push(o);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;for(var o=this.emptyString,u=r.length;u>0;){if((o=r.pop()+o)===this.emptyString&&this.isCellReference(t)&&this.getTreatEmptyStringAsZero())return"0";u--}return o}catch(t){if(this.getErrorStrings().indexOf(t)>-1||this.formulaErrorStrings.indexOf(t)>-1)throw t;throw new Ir(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 n===this.getErrorStrings()[e.CommonErrors.divzero]?this.getErrorStrings()[e.CommonErrors.divzero]:this.getErrorStrings()[e.CommonErrors.value];var a=t.pop();if(a=a===this.emptyString?t.length?t.pop():"0":a,i=Number(a),isNaN(i))throw n===this.getErrorStrings()[e.CommonErrors.divzero]?this.getErrorStrings()[e.CommonErrors.divzero]:this.getErrorStrings()[e.CommonErrors.value];"add"===r&&t.push((Number(a)+Number(n)).toString()),"sub"===r&&t.push((Number(a)-Number(n)).toString()),"mul"===r&&t.push((Number(a)*Number(n)).toString()),"div"===r&&(this.isNaN(this.parseFloat(n))||this.isNaN(this.parseFloat(a))?t.push(this.getErrorStrings()[e.CommonErrors.value]):0===this.parseFloat(n)?t.push(this.getErrorStrings()[e.CommonErrors.divzero]):t.push((Number(a)/Number(n)).toString()))},n.prototype.processLogical=function(e,t){var r,n,i,a;"and"!==t&&"equal"!==t&&(r=e.pop(),n=e.pop(),i=r.indexOf(this.tic)>-1?r:this.parseFloat(r),a=n.indexOf(this.tic)>-1?n:this.parseFloat(n));var o;return"less"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<0?this.trueValue:this.falseValue:a0?this.trueValue:this.falseValue:a>i?this.trueValue:this.falseValue),"lessEq"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))<=0?this.trueValue:this.falseValue:a<=i?this.trueValue:this.falseValue),"greaterEq"===t&&(o=this.isNaN(i)||this.isNaN(a)?n.toUpperCase().split(this.tic).join("").localeCompare(r.toUpperCase().split(this.tic).join(""))>=0?this.trueValue:this.falseValue:a>=i?this.trueValue:this.falseValue),"notEq"===t&&(o=n!==r?this.trueValue:this.falseValue),"and"===t&&(r=e.pop().toString(),n="",e.length>0&&(n=e.pop().toString()),o=(o=this.emptyString+n+r+this.emptyString).split(this.tic).join("")),"equal"===t&&(r=e.pop().toString(),""===(n=e.pop().toString())&&""!==r&&(n="0"),o=r===n?this.trueValue:this.falseValue),"or"===t&&(o=Math.pow(this.parseFloat(a),this.parseFloat(i)).toString()),e.push(o),o},n.prototype.computeStoreCells=function(e){for(var t=e.cellValue,r=e.cellRange,n=e.criteria,i=e.argArray,a=e.isCriteria,o=e.storedCells,s=e.isCountIfS,l=e.countVal,h=a===this.trueValue?o:t,d=[],p=0;p-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=o[p].split(b).join(S),u=this.getValueFromArg(g),f=s===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&&(a===this.falseValue?d.push(t[p]):d.push(g))}return o=d,d=[],o},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 a=r,o=a.length;if(o<2||o>127)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=[],l=[],h=[],d=0,p=0;p-1&&this.isCellReference(a[p])?s.push(a[p]):l.push(a[p]);s=(s=s.toString().split(",,").join(",")).split(this.getParseArgumentSeparator());for(var c=[],p=0;p-1){var x=s[0].indexOf(":");for(C=this.substring(s[0],x);!this.isDigit(C[S]);)S+=1}var w=this.substring(y,b),I=this.substring(C,S);if(u=h[v].split(w).join(I),n===this.trueValue)d+=1;else{m++;var E=this.getValueFromArg(u);d+=parseFloat(""===E?"0":E)}}return i===this.trueValue&&(d/=m),d},n.prototype.processNestedFormula=function(e,t,r){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 a=new Date(e,t,1,-1).getDate();r>a;)a=new Date(e,t,1,-1).getDate(),t++,r-=a,i=!1;r<1&&(t--,r=(a=new Date(e,t,1,-1).getDate())-r)}var o=Date.parse(e.toString()+this.getParseDateTimeSeparator()+t.toString()+this.getParseDateTimeSeparator()+r.toString());return this.isNaN(o)||(n=this.toOADate(new Date(o))),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,a=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)).indexOf('"n')>-1&&(n=n.replace('"n','"')),n;var o=["+","-","/","*",")",")","{"];if(-1===this.parser.indexOfAny(n,o)&&this.isUpperChar(n[0])||n[0]===this.sheetToken){if(n!==this.trueValue&&n!==this.falseValue&&this.isCellReference(n)){var s=this.getSheetFamilyItem(this.grid);null!==s.sheetNameToParentObject&&s.sheetNameToParentObject.size>0&&-1===n.indexOf(this.sheetToken)&&(n=s.parentObjectToToken.get(this.grid)+n)}if(n===this.cell){var l=this.getDependentCells().get(n);throw null!=l&&l.indexOf(n)>-1&&this.arrayRemove(l,n),this.getDependentFormulaCells().has(this.cell)||this.clearFormulaDependentCells(this.cell),this.formulaErrorStrings[e.FormulasErrorsStrings.circular_reference]+n}return a=this.getParentObjectCellValue(n),this.updateDependentCell(n),a.toString()}return this.getErrorStrings().indexOf(r)>-1?r:this.computeValue(a.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],a=this.emptyString;if(this.namedRanges.has(e))return!1;for(var o=0;o0)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 a=e.split("").join(this.getParseArgumentSeparator()).split(this.getParseArgumentSeparator()),o=0;o-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-1){var o=(e=e.replace("!!","!")).split("");o[1]=(parseInt(o[1],10)+1).toString(),e=o.join("")}return e},n.prototype.getParentObjectCellValue=function(t){if(t===this.trueValue||t===this.falseValue)return t;var r=t.lastIndexOf(this.sheetToken),n=0,i=0,a=this.grid,o=this.getSheetFamilyItem(a);if(r>-1&&null!==o.tokenToParentObject)this.grid=o.tokenToParentObject.get(t.substring(0,r+1)),n=this.rowIndex(t),i=this.colIndex(t);else if(-1===r){for(var s=0;s1){var a=this.parseFloat(i.substring(0,i.length-1));this.isNaN(a)&&(i=(Number(a)/100).toString())}return i},n.prototype.defineFunction=function(e,r){"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,i){var a=e;this.spreadSheetUsedRange=i,this.grid=e;var o=!0,s=!0,l=this.getSheetFamilyItem(a),h=V(r.getColIndex())+r.getRowIndex().toString();this.actCell=h,null!==l.sheetNameToParentObject&&l.sheetNameToParentObject.size>0&&(h=l.parentObjectToToken.get(a)+h);var d=r.getValue().toUpperCase();if(d.indexOf("=RAND()")>-1||d.indexOf("RAND()")>-1||d.indexOf("=RANDBETWEEN(")>-1||d.indexOf("RANDBETWEEN(")>-1||this.randomValues.has(h)){var p=this.randCollection.toString();this.randomValues.has(h)?this.randomValues.has(h)&&(d.indexOf("=RAND()")>-1||d.indexOf("RAND()")>-1||d.indexOf("=RANDBETWEEN(")>-1||d.indexOf("RANDBETWEEN(")>-1?this.randomValues.set(h,r.getValue()):r.getValue().toUpperCase()!==this.randomValues.get(h.toUpperCase())&&(this.randomValues.delete(h),p=p.split(h+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+h).join("").split(h).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(h,r.getValue()),this.randCollection.push(h),this.isRandomVal=!0)}if(r.getValue()&&r.getValue()[0]===this.getFormulaCharacter()){this.cell=h;var c=void 0;if(t.isNullOrUndefined(s)||(s=n),this.getFormulaInfoTable().has(h)){if(c=this.getFormulaInfoTable().get(h),r.getValue()!==c.getFormulaText()||null==c.getParsedFormula()){c.setFormulaText(r.getValue()),this.getDependentFormulaCells().has(this.cell)&&this.clearFormulaDependentCells(this.cell);try{c.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){c.setFormulaValue(e),s=!1}}if(s){this.parser.isFormulaParsed=!0;var u=this.computeFormula(c.getParsedFormula());o=u!==c.getFormulaValue(),c.setFormulaValue(u)}}else{(c=new Er).setFormulaText(r.getValue()),this.getDependentFormulaCells().has(h)||this.getDependentFormulaCells().set(h,new Map);try{c.setParsedFormula(this.parser.parseFormula(r.getValue()))}catch(e){c.setFormulaValue(e),s=!1}s&&c.setFormulaValue(this.computeFormula(c.getParsedFormula())),this.getFormulaInfoTable().has(h),this.getFormulaInfoTable().set(h,c)}s&&(void 0===this.parentObject.setValueRowCol?this.setValueRowCol(this.getSheetID(a)+1,c.getFormulaValue(),r.getRowIndex(),r.getColIndex()):this.parentObject.setValueRowCol(this.getSheetID(a)+1,c.getFormulaValue(),r.getRowIndex(),r.getColIndex()))}else this.getFormulaInfoTable().has(h)&&(this.getFormulaInfoTable().delete(h),this.getDependentFormulaCells().has(h)&&this.clearFormulaDependentCells(h));s&&o&&this.getDependentCells().has(h)&&this.getDependentCells().get(h).toString()!==h&&(this.getComputedValue().clear(),this.refresh(h))},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(),this.sortedSheetNames.length>9&&this.sortedSheetNames[0].includes("1")&&this.sortedSheetNames[1].includes("10")&&(this.sortedSheetNames.splice(this.sortedSheetNames.indexOf("2"),0,this.sortedSheetNames[0]),this.sortedSheetNames.splice(0,1))}return this.sortedSheetNames},n.prototype.getErrorLine=function(e){var t=e.stack?e.stack.split("\n")[1].split(":"):null;return t?t[t.length-2]:null},n.prototype.createSheetFamilyID=function(){return this.sheetFamilyID===Number.MAX_SAFE_INTEGER&&(this.sheetFamilyID=Number.MIN_SAFE_INTEGER),this.sheetFamilyID++},n.prototype.computeMinMax=function(r,n){var i,a,o=0;if(t.isNullOrUndefined(r)||0===r.length)return this.formulaErrorStrings[e.FormulasErrorsStrings.wrong_number_arguments];for(var s=0,l=r.length;s255)return this.getErrorStrings()[e.CommonErrors.value];for(var d=0;d-1&&this.isCellReference(h[d]))for(var p=this.getCellCollection(h[d]),c=0;c-1)return a;f=this.parseFloat(a);""===a||this.isNaN(this.parseFloat(f))?(o+=1)===p.length&&(i=0):i="max"===n?Math.max(i,f):Math.min(i,f)}else{var u=this.getValueFromArg(h[d]);if(this.getErrorStrings().indexOf(u)>-1)return u;var f=this.parseFloat(u);if(""===u||this.isNaN(this.parseFloat(f))){(o+=1)===a.length&&(i=0);continue}i="max"===n?Math.max(i,f):Math.min(i,f)}return i.toString()},n.prototype.calculateAvg=function(r){for(var n=0,i=r,a=[],o=0,s=0,l=0;l-1&&this.isCellReference(i[l])){s=0,a=this.getCellCollection(i[l]),o=0;for(var h=0;h-1&&isNaN(parseFloat(i[l].split(this.tic).join(""))))return this.getErrorStrings()[e.CommonErrors.value];0===i[l].length&&(i[l]="1");var d=this.getValueFromArg(i[l].split(this.tic).join(""));if(t.isNullOrUndefined(d)||isNaN(this.parseFloat(d)))return this.getErrorStrings()[e.CommonErrors.name];n+=this.parseFloat(d)}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 a=e.toUpperCase();if(0===i.parentObjectToToken.size&&(i.parentObjectToToken=new Map),0===i.sheetNameToParentObject.size&&(i.sheetNameToParentObject=new Map),0===i.sheetNameToToken.size&&(i.sheetNameToToken=new Map),0===i.tokenToParentObject.size&&(i.tokenToParentObject=new Map),t.isUndefined(i.sheetNameToParentObject.get(a))){o=this.sheetToken+this.tokenCount.toString()+this.sheetToken;this.tokenCount++,i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o),i.sheetNameToToken.set(a,o),i.sheetNameToParentObject.set(a,r)}else{var o=i.sheetNameToToken.get(a);i.tokenToParentObject.set(o,r),i.parentObjectToToken.set(r,o)}return e},n.prototype.unregisterGridAsSheet=function(e,r,n){var i=this,a=[r];n&&(a=[],t.isNullOrUndefined(this.modelToSheetID)||this.modelToSheetID.forEach(function(e,t){a.push(t)})),a.forEach(function(t){var r=i.getSheetFamilyItem(t),a=(n?t:e).toUpperCase();if(null!=r.sheetNameToParentObject&&r.sheetNameToParentObject.has(a)){r.sheetNameToParentObject.delete(a);var o=r.sheetNameToToken.get(a);r.sheetNameToToken.delete(a),r.tokenToParentObject.delete(o),r.parentObjectToToken.delete(t),n&&(r.sheetDependentCells=new Map)}})},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,a="",o=this.randCollection.toString();this.randomValues.has(e)&&(this.randomValues.delete(e),o=o.split(e+this.parseArgumentSeparator).join("").split(this.parseArgumentSeparator+e).join("").split(e).join(""),0===this.randomValues.size&&""===o?(this.randomValues.clear(),this.randCollection=[]):this.randCollection=o.split(this.parseArgumentSeparator));for(var s=0;s-1&&(l=s.formulaText).toUpperCase().indexOf(e.toUpperCase())>-1&&(l=l.toUpperCase().split(e.toUpperCase()+this.calculateInstance.sheetToken).join(this.referenceError()),i=this.calculateInstance.rowIndex(d[p]),a=this.calculateInstance.colIndex(d[p]),this.updateDataContainer([i-1,a-1],{value:l,sheetId:r,visible:!1}),this.calculateInstance.refresh(s.getParsedFormula())),e.split("Sheet")[1]===o[h].split("!")[1]&&(this.calculateInstance.getFormulaInfoTable().delete(o[h]),this.calculateInstance.clearFormulaDependentCells(o[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,a=[],o="",s=[],l=!1;this.calculateInstance.getDependentCells().forEach(function(e,t){a.push(t)});for(d=0;d-1&&(o=o.toUpperCase().split(f).join(u+"/"),s.push(u),l=!0)}if(l){for(var g=0;g-1&&(sd[n].visibleName.length)&&(t=o,l=c);e=e.replace(t,l+"/"),a.push(l)}for(n=0;n1&&this.calculateInstance.randomValues.size===h.length)for(var f=0;f/g),s=e.match(/=/g);if(a){for(var l="",h=0;h")}if(s){for(var c="",u=0;u-1||n.indexOf("https:")>-1;if(i=i.split("$").join(""),(i=i.split("=").join("")).indexOf(":")>-1){var s=i.split(":");j(s[0])&&j(s[1])&&(a=!0)}else i.indexOf(":")<0&&j(i)&&(a=!0);o&&(a=!1),a?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 a=ve(this.parent);a=-1!==a.indexOf(" ")?"'"+a+"'":a,e.refersTo=a+"!"+(e.refersTo.indexOf("=")<0?e.refersTo:e.refersTo.split("=")[1])}var o=e.refersTo,s=this.parseSheetRef(e.refersTo);return e.scope?(r=ae(this.parent,e.scope))>-1&&(i=ve(this.parent,r)+"!"+i):e.scope="",e.comment||(e.comment=""),!t&&this.checkIsNameExist(e.name,e.scope)?n=!1:(this.calculateInstance.addNamedRange(i,"="===s[0]?s.substr(1):s),"="!==s[0]&&(e.refersTo="="+o),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 a=ae(this.parent,t);a&&(i=ve(this.parent,a)+"!"+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=pe(n),a=c(i.split(":")[1]),o=["SUM","AVERAGE","MIN","MAX"],s=[];a[0]+1===n.rowCount&&a[1]+1===n.colCount&&(i="A1:"+g(n.usedRange.rowIndex,n.usedRange.colIndex));var l,h=c(n.activeCell),d=n.rows[h[0]]&&n.rows[h[0]].cells?n.rows[h[0]].cells[h[1]]:{},p=d?d.format:"",u=this.calculateInstance.getCellCollection(i);for(t=0;t=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+"!"+V(-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,a){var o,s,l,h,d,p,u,f=e,g=[],v=this.parent.getActiveSheet(),y=[],C=[];if(q(f)){if("delete"===r)for(h=1;h<=t;h++)y.push(i+h);for(C=this.parseFormula(f),h=0;hg[1]?g[1]:s:i>g[0]?g[0]:s,o="Column"===n?i>g[3]?g[3]:o:i>g[2]?g[2]:o,l=s>-1?"Column"===n?m([g[0],s,g[2],o]).split(":")[0]:m([s,g[1],o,g[3]]).split(":")[0]:"#REF!","delete"===r&&(p=parseInt("Row"===n?d.replace(/[A-Z]/g,""):d.replace(/[0-9]/g,""),10),y.indexOf(p)>-1&&(l="#REF!")),C[h]=l}f="="+C.join("")}return f},r.prototype.refreshInsDelFormula=function(e){var t,r,n,i,a,o,s=this.parent.sheets.length;for(a=0;a=n[0];l--)for(var h=n[1];h<=n[3];h++)(i=$(l,h,r))&&i.formula&&q(i.formula)&&(this.clearFormula({rowIdx:l,colIdx:h,sheetIdx:a,count:t,status:e.name,type:e.modelType,startIdx:e.startIndex}),o=this.refreshFormula(i.formula,t,e.name,e.modelType,e.startIndex,a),this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:[l,h,l,h],value:o,sheetIndex:a}))}},r.prototype.parseFormula=function(e){for(var t,r,n=0,i=[],a=[],o=(a=(a=this.markSpecialChar(e.replace("=",""))).split(/\(|\)|=|\^|>|<|,|:|\+|-|\*|\/|%|&/g)).length;n0?(this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1)),r=t.indexOf("!")+1,i.push(t.substr(0,r)),i.push(t.substr(r))):this.isUniqueChar(r)?(i.push(this.getUniqueCharVal(r)),i.push(t.substr(1))):i.push(t)),n++):n++;return i},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(/=o||n[0]>=a&&n[2]>=o?(s=[n[0]+i,n[1],n[2]+i,n[3]],d=!0):(n[0]<=a&&n[2]>=a||n[2]>=o)&&(s=[n[0],n[1],n[2]+i,n[3]],d=!0):"Column"===e.modelType&&(n[1]>=o||n[1]>=a&&n[3]>=o?(s=[n[0],n[1]+i,n[2],n[3]+i],d=!0):(n[1]<=a&&n[3]>=a||n[3]>=o)&&(s=[n[0],n[1],n[2],n[3]+i],d=!0))):(i=e.deletedModel.length,a=e.startIndex,o=e.endIndex,"Row"===e.modelType?n[0]>=o||n[0]>=a&&n[2]>=o?(s=[n[0]-i,n[1],n[2]-i,n[3]],d=!0):(n[0]<=a&&n[2]>=a||n[2]>=o)&&(s=[n[0],n[1],n[2]-i,n[3]],d=!0):"Column"===e.modelType&&(n[1]>=o||n[1]>=a&&n[3]>=o?(s=[n[0],n[1]-i,n[2],n[3]-i],d=!0):(n[1]<=a&&n[3]>=a||n[3]>=o)&&(s=[n[0],n[1],n[2],n[3]-i],d=!0))),d)){l=m(s),t.refersTo=h+"!"+l,this.parent.removeDefinedName(t.name,t.scope);var v={action:"addDefinedName",definedName:t,isAdded:!1};this.parent.notify(Et,v)}p=u}},r}(),Tr=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.initiateSortHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(kt,this.initiateSortHandler)},e.prototype.initiateSortHandler=function(e){var n=this,i=e.args,a=new r.Deferred,o=this.parent.getActiveSheet(),s=x(y(i.range)),l=i.sortOptions||{sortDescriptors:{},containsHeader:!0},h=!1;if(e.promise=a.promise,s[0]>o.usedRange.rowIndex||s[1]>o.usedRange.colIndex)return void a.reject(this.parent.serviceLocator.getService(dn).getConstant("SortOutOfRangeError"));var d=l.containsHeader;s[0]===s[2]&&(s=this.getSortDataRange(s[0],s[1],o),h=!0,t.isNullOrUndefined(l.containsHeader)&&(d=typeof $(s[0],s[1],o,null,!0).value!=typeof $(s[0]+1,s[1],o,null,!0).value||!this.isSameStyle($(s[0],s[1],o,null,!0).style,$(s[0]+1,s[1],o,null,!0).style))),!t.isNullOrUndefined(i.sortOptions)&&!t.isNullOrUndefined(i.sortOptions.containsHeader)||h||t.isNullOrUndefined($(s[0],s[1],o))||t.isNullOrUndefined($(s[0]+1,s[1],o))||(d=typeof $(s[0],s[1],o).value!=typeof $(s[0]+1,s[1],o).value);var p,c,f=s[0]=d?s[0]+1:s[0],g=v(u(o.activeCell)[1]+1),C=l.sortDescriptors,b=m(s);ee(this.parent,o.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:g}]);for(var d=C.length,u=d-1;u>-1;u--)if(C[d-1].field||(C[d-1].field=g),C[u].field){m=C[u].sortComparer||n.sortComparer.bind(n,C[u],l.caseSensitive);h.sortBy(C[u].field,m)}}else{C||(C={field:g}),C.field||(C.field=g);var m=C.sortComparer||n.sortComparer.bind(n,C,l.caseSensitive);h.sortBy(C.field,m)}t.executeQuery(h).then(function(t){var r,n={};Array.prototype.forEach.call(t.result,function(t,i){if(t)for(p=s[1],c=s[3],f=parseInt(e[i].__rowIndex,10)-1,p;p<=c;p++)r=v(p+1),n=t[r],Z(f,p,o,n)});var l={range:o.name+"!"+b,sortOptions:i.sortOptions};a.resolve(l)})})},e.prototype.isSameStyle=function(e,t){void 0===e&&(e={}),void 0===t&&(t={});for(var r=!0,n=Object.keys(e),i=0;ia.usedRange.rowIndex||l[1]>a.usedRange.colIndex)return void i.reject("Select a cell or range inside the used range and try again.");l[0]===l[2]&&l[2]-l[0]==0&&(l[0]=0,l[1]=0,l[3]=a.usedRange.colIndex),l[2]=a.usedRange.rowIndex,l[0]=l[0]+1;var h=m(l);ee(this.parent,a.name+"!"+h,!0,!0).then(function(e){var n=new r.DataManager(e);t.setFilter(n,o.predicates);var a={range:h,filterOptions:o};i.resolve(a)})}},e.prototype.setFilter=function(e,n){var i=this;if(e&&n){var a=e.dataSource.json,o=new r.Query;n.length&&o.where(r.Predicate.and(n));var s=e.executeLocal(o);a.forEach(function(e){if(e){var r=parseInt(e.__rowIndex,10);i.parent.hideRow(r-1,void 0,s.indexOf(e)<0),t.isNullOrUndefined(i.parent.filteredRows)&&(i.parent.filteredRows={},i.parent.filteredRows.rowIdxColl=[],i.parent.filteredRows.sheetIdxColl=[]);var n=i.parent.filteredRows.rowIdxColl,a=i.parent.filteredRows.sheetIdxColl;if(s.indexOf(e)<0){if(n&&a)for(var o=0,l=a.length;o0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,n=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,i=c(r),a=n?this.parent.sheets[n]:this.parent.getActiveSheet(),o=$(i[0],i[1],a),s=e.options;if(o&&o.image){t=o.image;for(var l=0;l0)for(;r0?ae(this.parent,n[r].range.split("!")[0]):this.parent.activeSheetIndex,o=c(e.isPaste?e.range:n[r].range),s=a?this.parent.sheets[a]:this.parent.getActiveSheet(),l=$(o[0],o[1],s);l&&l.chart?l.chart.push(n[r]):Z(o[0],o[1],s,{chart:[n[r]]},!0)}r++}},e.prototype.refreshChartData=function(e){for(var t,r=1,n=this.parent.sheets.length+1;r-1?ae(this.parent,se(a.range)):this.parent.activeSheetIndex;o&&s===this.parent.activeSheetIndex&&this.parent.notify("updateChart",{chart:a})}r++}},e.prototype.refreshChartSize=function(e){for(var r,n=1,i=this.parent.sheets.length+1;n-1?(r=r.split("!")[1],t=this.parent.sheets[ae(this.parent,e.range.split("!")[0])]):t=this.parent.getActiveSheet(),void 0===r&&(r=t.selectedRange);var n="object"!=typeof r&&e.onActionUpdate,i={range:r,style:Object.assign({},e.style),requestType:"CellFormat"};e.borderType&&(i.borderType=e.borderType);var a={};if(Object.assign(a,i.style,null,!0),n&&(this.parent.trigger("beforeCellFormat",i),this.parent.notify("actionBegin",{eventArgs:i,action:"format"}),i.cancel))return void(e.cancel=!0);var o="object"==typeof i.range?i.range:x(c(i.range));if(e.borderType&&(this.setTypedBorder(t,e.style.border,o,e.borderType,e.onActionUpdate),delete e.style.border),void 0!==i.style.borderTop){for(h=o[1];h<=o[3];h++)this.checkAdjustantBorder(t,"borderBottom",o[0]-1,h),this.checkFullBorder(t,"borderBottom",o[0]-1,h),this.checkFullBorder(t,"borderTop",o[0],h),this.setCellBorder(t,{borderTop:i.style.borderTop},o[0],h,e.onActionUpdate,h===o[3]);delete i.style.borderTop}if(void 0!==i.style.borderBottom){for(h=o[1];h<=o[3];h++)this.checkAdjustantBorder(t,"borderTop",o[2]+1,h),this.checkFullBorder(t,"borderTop",o[2]+1,h),this.checkFullBorder(t,"borderBottom",o[2],h),this.setCellBorder(t,{borderBottom:i.style.borderBottom},o[2],h,e.onActionUpdate,h===o[3]),this.setBottomBorderPriority(t,o[2],h);delete i.style.borderBottom}if(void 0!==i.style.borderLeft){for(h=o[0];h<=o[2];h++)this.checkAdjustantBorder(t,"borderRight",h,o[1]-1),this.checkFullBorder(t,"borderRight",h,o[1]-1),this.checkFullBorder(t,"borderLeft",h,o[1]),this.setCellBorder(t,{borderLeft:i.style.borderLeft},h,o[1],e.onActionUpdate);delete i.style.borderLeft}if(void 0!==i.style.borderRight){for(h=o[0];h<=o[2];h++)this.checkAdjustantBorder(t,"borderLeft",h,o[3]-1),this.checkFullBorder(t,"borderLeft",h,o[3]-1),this.checkFullBorder(t,"borderRight",h,o[3]),this.setCellBorder(t,{borderRight:i.style.borderRight},h,o[3],e.onActionUpdate);delete i.style.borderRight}var s,l;if(Object.keys(e.style).length)for(var h=o[0];h<=o[2];h++)for(var d=o[1];d<=o[3];d++)void 0===l&&(void 0!==i.style.border?(s=i.style.border,i.style.border=void 0,l=!0):l=!1),l&&this.setFullBorder(t,s,o,h,d,e.onActionUpdate),this.setCellStyle(t,h,d,i.style),this.parent.getActiveSheet().id===t.id&&this.parent.notify(It,{style:i.style,rowIdx:h,colIdx:d,lastCell:d===o[3],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:e.onActionUpdate});l&&(i.style.border=s),this.parent.setUsedRange(o[2],o[3]),e.refreshRibbon&&this.parent.notify("activeCellChanged",null),n&&(i.style=a,i.range=t.name+"!"+r,this.parent.notify("actionComplete",{eventArgs:i,action:"format"}))},e.prototype.setBottomBorderPriority=function(e,t,r){if(be(e,t+1)){var n=this.skipHiddenRows(e,t+1);""!==this.parent.getCellStyleValue(["borderTop"],[n,r]).borderTop&&(e.rows[t].cells[r].style.bottomPriority=!0)}},e.prototype.setFullBorder=function(e,t,r,n,i,a){var o={};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),o.borderRight=t,o.borderTop=t,o.borderLeft=t,o.borderBottom=t,this.setCellBorder(e,o,n,i,a,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 a={border:void 0};["borderBottom","borderTop","borderLeft","borderRight"].forEach(function(e){e!==t&&(a[e]=i)}),this.setCellStyle(e,r,n,a)}},e.prototype.textDecorationActionUpdate=function(e){var t=this.parent.getActiveSheet(),r={range:t.selectedRange,style:e.style,requestType:"CellFormat"};if(this.parent.trigger("beforeCellFormat",r),this.parent.notify("actionBegin",{eventArgs:r,action:"format"}),r.cancel)return void(e.cancel=!0);var n,i=x(c(t.selectedRange)),a=e.style.textDecoration,o=a,s=c(t.activeCell),l=this.parent.getCellStyleValue(["textDecoration"],s).textDecoration,h=!1;"underline"===l?o="underline"===a?"none":"underline line-through":"line-through"===l?o="line-through"===a?"none":"underline line-through":"underline line-through"===l&&(o="underline"===a?"line-through":"underline",h=!0),"none"===o&&(h=!0),this.format({style:{textDecoration:o},range:s,refreshRibbon:e.refreshRibbon,onActionUpdate:!0});for(var d=i[0];d<=i[2];d++)for(var p=i[1];p<=i[3];p++)if(d!==s[0]||p!==s[1]){if(n={},"none"===(l=this.parent.getCellStyleValue(["textDecoration"],[d,p]).textDecoration)){if(h)continue;n.textDecoration=a}else if("underline"===l||"line-through"===l)if(h){if(a!==l)continue;n.textDecoration="none"}else n.textDecoration=a!==l?"underline line-through":a;else if("underline line-through"===l){if(!h)continue;n.textDecoration="underline"===a?"line-through":"underline"}this.format({style:n,range:[d,p,d,p],refreshRibbon:e.refreshRibbon,onActionUpdate:!0})}r.range=t.name+"!"+r.range,this.parent.notify("actionComplete",{eventArgs:r,action:"format"})},e.prototype.setTypedBorder=function(e,t,r,n,i){var a;if("Outer"===n){for(var o=r[1];o<=r[3];o++)this.checkAdjustantBorder(e,"borderBottom",r[0]-1,o),this.checkFullBorder(e,"borderBottom",r[0]-1,o),this.setCellBorder(e,{borderTop:t},r[0],o,i,o===r[3]),this.checkAdjustantBorder(e,"borderTop",r[2]+1,o),this.checkFullBorder(e,"borderTop",r[2]+1,o),this.setCellBorder(e,{borderBottom:t},r[2],o,i,o===r[3]),this.setBottomBorderPriority(e,r[2],o);for(var s=r[0];s<=r[2];s++)this.checkAdjustantBorder(e,"borderRight",s,r[1]-1),this.checkFullBorder(e,"borderRight",s,r[1]-1),this.setCellBorder(e,{borderLeft:t},s,r[1],i),this.checkAdjustantBorder(e,"borderLeft",s,r[3]+1),this.checkFullBorder(e,"borderLeft",s,r[3]+1),this.setCellBorder(e,{borderRight:t},s,r[3],i)}else if("Inner"===n)for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={};""!==(a=this.parent.getCellStyleValue(["border"],[l,h]).border)&&(d.border=void 0,h!==r[3]&&h!==r[1]&&l!==r[0]&&l!==r[2]||(l===r[0]&&(d.borderTop=a),l===r[2]&&(d.borderBottom=a),h===r[3]&&(d.borderRight=a),h===r[1]&&(d.borderLeft=a))),h!==r[3]&&(d.borderRight=t),l!==r[0]&&(d.borderTop=t),l!==r[2]&&(d.borderBottom=t),h!==r[1]&&(d.borderLeft=t),this.setCellBorder(e,d,l,h,i,h===r[3])}else if("Vertical"===n)for(l=r[0];l<=r[2];l++)for(h=r[1];h<=r[3];h++){d={borderRight:t,borderLeft:t};h===r[1]&&(this.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,d,l,h,i)}else for(var l=r[0];l<=r[2];l++)for(var h=r[1];h<=r[3];h++){var d={borderTop:t,borderBottom:t};l===r[0]&&(this.checkAdjustantBorder(e,"borderBottom",l-1,h),this.checkFullBorder(e,"borderBottom",l-1,h)),this.setCellBorder(e,d,l,h,i,h===r[3]),l===r[2]&&(this.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,a){this.setCellStyle(e,r,n,t),this.parent.getActiveSheet().id===e.id&&this.parent.notify(It,{style:t,rowIdx:r,colIdx:n,onActionUpdate:i,first:"",lastCell:a,isHeightCheckNeeded:!0,manualUpdate:!0})},e.prototype.setCellStyle=function(e,t,r,n){e.rows[t]?e.rows[t].cells||(e.rows[t].cells=[]):e.rows[t]={cells:[]},e.rows[t].cells[r]||(e.rows[t].cells[r]={}),e.rows[t].cells[r].style||(e.rows[t].cells[r].style={}),Object.assign(e.rows[t].cells[r].style,n,null,!0)},e.prototype.skipHiddenRows=function(e,t){return t++,be(e,t)&&(t=this.skipHiddenRows(e,t)),t},e.prototype.addEventListener=function(){this.parent.on(wt,this.format,this),this.parent.on("textDecorationUpdate",this.textDecorationActionUpdate,this),this.parent.on("clear",this.clearCellObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(wt,this.format),this.parent.off("textDecorationUpdate",this.textDecorationActionUpdate),this.parent.off("clear",this.clearCellObj))},e.prototype.clearCellObj=function(e){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?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,a=ce(this.parent,i),o=y(n),s=o[0],l=o[2];for(s;s<=l;s++)for(t=o[1],r=o[3],t;t<=r;t++){var h=$(s,t,a);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":Z(s,t,a,{},!1)}}},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"workbookcellformat"},e}(),Or=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("workbookEditOperation",this.performEditOperation,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("workbookEditOperation",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 a;a="string"==typeof e?c(e):e;var o=ce(this.parent,n),s=$(a[0],a[1],o,!0);if(s||(s=o.rows[a[0]].cells[a[1]]={}),i)r&&r.toString().indexOf(this.decimalSep)>-1&&(r=this.checkDecimalPoint(r)),s.value=r;else{var l=q(r);l||(s.formula="",s.value=D(r));var h={action:"refreshCalculate",value:r,rowIndex:a[0],colIndex:a[1],sheetIndex:n,isFormula:l};if("Text"!==H(s.format)){var d={value:r,rowIndex:a[0],colIndex:a[1],sheetIndex:n,updatedVal:""};this.parent.notify(Rt,d),!t.isNullOrUndefined(d.updatedVal)&&d.updatedVal.length>0&&(s.value=d.updatedVal)}this.parent.notify(Et,h),l&&(s.formula=h.value,r=s.value)}this.parent.setUsedRange(a[0],a[1],o),this.parent.allowChart&&this.parent.notify("refreshChart",{cell:s,rIdx:a[0],cIdx:a[1],sheetIdx:n})},e}(),Hr=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("setLinkModel",this.setLinkHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("setLinkModel",this.setLinkHandler)},e.prototype.setLinkHandler=function(e){var r,n,i,a=e.hyperlink,o=e.cell,s=this.parent.getActiveSheet();if(o&&-1!==o.indexOf("!")){r=o.split("!");for(var l=this.parent.sheets,h=0;he.end&&(a=e.end,e.end=e.start);for(p=a;p<=e.end;p++)l.push({})}else e.start?(a=e.start[0].index||0,l=e.start,s=!0):(a=0,l.push({}));var h;if("Row"===e.modelType){if(e.model=e.model,e.model.rows||(e.model.rows=[]),s&&e.model.usedRange.rowIndex>-1&&a>e.model.usedRange.rowIndex)for(p=e.model.usedRange.rowIndex;pe.model.usedRange.rowIndex?this.parent.setUsedRange(a+(l.length-1),e.model.usedRange.colIndex,e.model):this.parent.setUsedRange(e.model.usedRange.rowIndex+l.length,e.model.usedRange.colIndex,e.model);for(var d=a+l.length,p=0;p<=e.model.usedRange.colIndex;p++)e.model.rows[d]&&e.model.rows[d].cells&&e.model.rows[d].cells[p]&&void 0!==e.model.rows[d].cells[p].rowSpan&&e.model.rows[d].cells[p].rowSpan<0&&void 0===e.model.rows[d].cells[p].colSpan&&this.parent.notify("insertMerge",{range:[d,p,d,p],insertCount:l.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,[a,0].concat(l)),ae.model.usedRange.colIndex?this.parent.setUsedRange(e.model.usedRange.rowIndex,a+(l.length-1),e.model):this.parent.setUsedRange(e.model.usedRange.rowIndex,e.model.usedRange.colIndex+l.length,e.model),e.model.rows||(e.model.rows=[]);var c=[];e.columnCellsModel||(e.columnCellsModel=[]);for(p=0;pe.end){var i=e.start;e.start=e.end,e.end=i}var a,o,s,l=[],h=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),e.model!==this.parent.getActiveSheet()&&this.parent.notify("updateUsedRange",{index:e.model.usedRange.rowIndex,update:"row"});var d=this.parent.frozenRowCount(e.model);e.start1&&(o.rowSpan-(u.range[2]-e.start+1)>1?Z(u.range[0],g,e.model,{colSpan:o.rowSpan-(u.range[2]-e.start+1)},!0):delete e.model.rows[u.range[0]].cells[g].rowSpan),u=null)),e.model.rows[p]&&e.model.rows[p].cells&&e.model.rows[p].cells[g]&&void 0!==e.model.rows[p].cells[g].rowSpan&&e.model.rows[p].cells[g].rowSpan<0&&void 0===e.model.rows[p].cells[g].colSpan&&(u||(u={range:[p,g,p,g]},this.parent.notify("activeCellMergedRange",u)),c=new Object,u.range=u.range,Object.assign(c,$(u.range[0],u.range[1],e.model)),c&&c.rowSpan&&(c.rowSpan>1||c.colSpan>1)&&((v=[])[1]=g,v[3]=c.colSpan>1?g+(c.colSpan-1):g,u.range=u.range,u.range[0]1&&(v[2]+=c.rowSpan-h-1)):(v[0]=v[2]=e.start,c.rowSpan-(e.end-u.range[0]+1)>1&&(v[2]+=c.rowSpan-(e.end-u.range[0]+1)-1)),l.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0}))),u=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-=h,e.model.usedRange.colIndex<0&&(e.model.usedRange.colIndex=0),e.model!==this.parent.getActiveSheet()&&this.parent.notify("updateUsedRange",{index:e.model.usedRange.colIndex,update:"col"});var f=this.parent.frozenColCount(e.model);e.start1&&(m.colSpan-(u.range[3]-e.start+1)>1?Z(g,u.range[1],e.model,{colSpan:m.colSpan-(u.range[3]-e.start+1)},!0):delete e.model.rows[g].cells[u.range[1]].colSpan),u=null}if(e.model.rows[g].cells[p]&&void 0!==e.model.rows[g].cells[p].colSpan&&e.model.rows[g].cells[p].colSpan<0&&void 0===e.model.rows[g].cells[p].rowSpan&&(u||(u={range:[g,p,g,p]},this.parent.notify("activeCellMergedRange",u)),c=new Object,u.range=u.range,Object.assign(c,$(u.range[0],u.range[1],e.model)),c&&c.colSpan&&(c.colSpan>1||c.rowSpan>1))){var v=[];v[0]=g,v[2]=c.rowSpan>1?g+(c.rowSpan-1):g,u.range=u.range,u.range[1]1&&(v[3]+=c.colSpan-h-1)):(v[1]=v[3]=e.start,c.colSpan-(e.end-u.range[1]+1)>1&&(v[3]+=c.colSpan-(e.end-u.range[1]+1)-1)),l.push({range:v,isAction:!1,preventRefresh:!0,merge:!0,type:"All",skipChecking:!0})}a[g].cells=e.model.rows[g].cells.splice(e.start,h),u=null}}else if(e.end-e.start==this.parent.sheets.length-1)return;for(var y=[],g=e.start;g<=e.end;g++)this.parent.notify(Et,{action:"deleteSheetTab",sheetName:"",index:g+1}),e.model[n][e.start]?(y.push(e.model[n][e.start]),e.model[n].splice(e.start,1)):y.push({}),g===e.start&&(y[0].index=e.start);l.forEach(function(e){t.parent.notify(Ht,e)});var C={action:"refreshNamedRange",insertArgs:{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:y,deletedCellsModel:a,activeSheetIndex:this.parent.activeSheetIndex,name:"delete"}};this.parent.notify(Et,C),"Sheet"!==e.modelType&&e.model!==this.parent.getActiveSheet()||this.parent.notify("delete",{startIndex:e.start,endIndex:e.end,modelType:e.modelType,isAction:e.isAction,deletedModel:y,deletedCellsModel:a,activeSheetIndex:this.parent.activeSheetIndex,freezePane:s})}},e.prototype.setDeleteInfo=function(e,t,r,n){void 0===n&&(n="Row");var i=t-e+1,a=[];this.parent.getActiveSheet().ranges.forEach(function(o){o.info&&e-1&&(a=r.split("!")[1],o=r.split("!")[0]);var s=ce(this.parent,this.parent.getAddressInfo(o+"A1:A1").sheetIndex),l=!1,h=s.rowCount,d=a.split(":");a.match(/\D/g)&&!a.match(/[0-9]/g)?(d[0]+=1,d[1]+=h,a=d[0]+":"+d[1],l=!0):!a.match(/\D/g)&&a.match(/[0-9]/g)&&(d[0]="A"+d[0],d[1]=g(0,s.colCount-1).replace(/[0-9]/g,"")+d[1],a=d[0]+":"+d[1]),t.isNullOrUndefined(o)||(r=o+a);var p=c(r=r||s.selectedRange);if(l)for(m=p[1];m<=p[3];m++){var u=Ie(s,m);n&&u&&u.validation?delete s.columns[m].validation:(t.isNullOrUndefined(u)&&(s.columns[m]=Ie(s,m)),s.columns[m].validation={operator:e.operator,type:e.type,value1:"List"===e.type&&e.value1.length>256?e.value1.substring(0,255):e.value1,value2:e.value2,inCellDropDown:e.inCellDropDown,ignoreBlank:e.ignoreBlank})}else for(var f=p[0];f<=p[2];f++){s.rows[f]||Ce(s,f,{});for(var m=p[1];m<=p[3];m++)if(s.rows[f].cells&&s.rows[f].cells[m]||Z(f,m,s,{}),i=s.rows[f].cells[m],n){if(i.validation){delete i.validation;var v=this.parent.getCellStyleValue(["backgroundColor","color"],[f,m]);this.parent.notify(It,{style:v,rowIdx:f,colIdx:m})}}else i.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.td)},e.prototype.removeHighlightHandler=function(e){this.InvalidDataHandler(e.range,!0)},e.prototype.getRange=function(e){var t=c(e),r=this.parent.getActiveSheet(),n=r.colCount,i=r.rowCount;return t[2]===i-1&&0===t[0]?e=e.replace(/[0-9]/g,""):t[3]===n-1&&0===t[2]&&(e=e.replace(/\D/g,"")),e},e.prototype.InvalidDataHandler=function(e,t,r){var n,i,a,o=this.parent.getActiveSheet(),s=(e=e||o.selectedRange)?c(e):[],l=!1;(e=this.getRange(e)).match(/\D/g)&&!e.match(/[0-9]/g)&&(l=!0);var h=e?s[0]:0,d=e?s[2]:o.rows.length;for(h;h<=d;h++)if(o.rows[h]){var p=e?s[1]:0,u=e?s[3]:o.rows[h].cells.length;for(p;p<=u;p++)if(o.rows[h].cells[p]){var f=Ie(o,p);(n=o.rows[h].cells[p])&&n.validation?(i=n.validation,t?i.isHighlighted&&(n.validation.isHighlighted=!1):n.validation.isHighlighted=!0):f&&f.validation&&(i=f.validation,t&&l?i.isHighlighted&&(f.validation.isHighlighted=!1):l&&(f.validation.isHighlighted=!0)),a=n.value?n.value:"";var g=[h,p],m=this.parent.activeSheetIndex;if(i&&this.parent.allowDataValidation){this.parent.notify("isValidation",{value:a,range:g,sheetIdx:m,isCell:!1});var v=this.parent.allowDataValidation;this.parent.allowDataValidation=!0,v||this.parent.notify("validationHighlight",{isRemoveHighlightedData:t,rowIdx:h,colIdx:p,td:r})}}}},e.prototype.getModuleName=function(){return"workbookDataValidation"},e}(),_r=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("findNext",this.findNext,this),this.parent.on("findPrevious",this.findPrevious,this),this.parent.on("replace",this.replace,this),this.parent.on("replaceAll",this.replaceAll,this),this.parent.on("count",this.totalCount,this),this.parent.on("findAllValues",this.findAllValues,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("findNext",this.findNext),this.parent.off("findPrevious",this.findPrevious),this.parent.off("replace",this.replace),this.parent.off("replaceAll",this.replaceAll),this.parent.off("count",this.totalCount),this.parent.off("findAllValues",this.findAllValues))},e.prototype.findNext=function(e){var t,r,n,i=this.parent.sheets,a=i[this.parent.activeSheetIndex],o=u(a.activeCell),s=a.usedRange,l=s.colIndex,h=e.value.toString(),d=0,p=s.rowIndex,c=t=o[1],f=r=o[0];if(a.rows[r]&&a.rows[r].cells&&a.rows[r].cells[t]&&(a.rows[r].cells[t].format?n=this.parent.getDisplayText(a.rows[r].cells[t]).toString():a.rows[r].cells[t].value&&(n=a.rows[r].cells[t].value.toString())),n){var g=n.toLowerCase(),m=n.indexOf(e.value)>-1,v=g.indexOf(e.value.toString().toLowerCase())>-1;(h===n||h===g||m||v)&&("By Column"===e.searchBy?r++:t++,d++)}(o[0]>a.usedRange.rowIndex||o[1]>a.usedRange.colIndex)&&(o[0]>a.usedRange.rowIndex&&o[1]<=a.usedRange.colIndex?(r=0,t=o[1]):o[0]<=a.usedRange.rowIndex&&o[1]>a.usedRange.colIndex?(r=o[0],t=0):(r=0,t=0));var y={rowIndex:r,colIndex:t,usedRange:s,endRow:p,endColumn:l,startRow:f,mode:e.mode,loopCount:0,count:d,args:e,val:void 0,stringValue:h,sheetIndex:this.parent.activeSheetIndex,startColumn:c,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;t=r.usedRange;var i=u(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 a=this.parent.activeSheetIndex;if(e.sheetIndex++,n===e.sheetIndex&&(e.sheetIndex=0),a===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,i=u(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]){if(0===e.count)return void this.parent.notify(Nt,null)}else(0!==i[0]&&0!==i[1]||0!==i[0]||0!==i[1])&&(e.startColumn=0,e.startRow=0,e.endColumn=t.colIndex,e.endRow=i[0],e.rowIndex=e.startRow,e.colIndex=e.startColumn,e.loopCount++)}if(e.count>0&&t.rowIndexe.endColumn&&(e.colIndex=0),e.loopCount>0&&i[0]===e.rowIndex)return void this.parent.notify(Nt,null)}}if(0===e.count)return void this.parent.notify(Nt,null)},e.prototype.findNxtCol=function(e){var t,r=e.sheets[e.sheetIndex],n=u(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(Nt,null);r=e.sheets[e.sheetIndex],e.usedRange=r.usedRange,n=u(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(Nt,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.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&&r.rows[e.rowIndex].cells[e.colIndex]&&this.nextCommon(e))return;if(e.loopCount>0&&n[1]===e.colIndex)return void this.parent.notify(Nt,null)}}if(0===e.count)return void this.parent.notify(Nt,null)},e.prototype.nextCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r&&r.value){var n=t.rows[e.rowIndex].cells[e.colIndex];if(n){var i=void 0;if(i=n.format?this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex]):t.rows[e.rowIndex].cells[e.colIndex].value.toString(),e.args.isCSen&&e.args.isEMatch){if(i===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){a=i.indexOf(e.args.value)>-1;if(i===e.stringValue||a){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=i.toString().toLowerCase(),e.val===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=i.toString().toLowerCase();var a=e.val.indexOf(e.args.value.toString().toLowerCase())>-1,o=e.val.indexOf(e.args.value)>-1;if(e.val===e.stringValue||i===e.stringValue||a||i===e.stringValue||o){var s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}}}}return!1},e.prototype.findPrevious=function(e){var t,r=this.parent.sheets,n=e.sheetIndex,i=r[n],a=u(i.activeCell),o=0,s=i.usedRange.rowIndex,l=i.usedRange.colIndex,h=e.value.toString(),d=a[1],p=a[0],c=d,f=p;if(i.rows[p]&&i.rows[p].cells[d]&&(i.rows[p].cells[d].format?t=this.parent.getDisplayText(i.rows[p].cells[d]).toString():i.rows[p].cells[d].value&&(t=i.rows[p].cells[d].value.toString())),t){var g=t.toLowerCase(),m=t.indexOf(e.value)>-1,v=g.indexOf(e.value.toString().toLowerCase())>-1;(h===t||h===g||m||v)&&("By Row"===e.searchBy&&d--,"By Column"===e.searchBy&&p--,o++)}(a[0]>i.usedRange.rowIndex||a[1]>i.usedRange.colIndex)&&(a[0]>i.usedRange.rowIndex&&a[1]<=i.usedRange.colIndex?(p=i.usedRange.rowIndex,d=a[1]):a[0]<=i.usedRange.rowIndex&&a[1]>i.usedRange.colIndex?(p=a[0],d=i.usedRange.colIndex):(p=i.usedRange.rowIndex,d=i.usedRange.colIndex));var y={rowIndex:p,colIndex:d,endRow:s,endColumn:l,startRow:f,loopCount:0,count:o,args:e,val:void 0,stringValue:h,sheets:r,sheetIndex:n,startColumn:c};"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,a=u(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 o=this.parent.activeSheetIndex;if(-1===--e.sheetIndex&&(e.sheetIndex=n-1),o===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,a=u(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,a)}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);var s=r.rows[e.rowIndex];if(s){for(-1===e.colIndex&&(e.colIndex=r.usedRange.colIndex),e.colIndex;e.colIndex>=0;e.colIndex--)if(s&&s.cells&&s.cells[e.colIndex]&&this.prevCommon(e))return;if(e.loopCount>0&&a[0]===e.rowIndex)return void this.parent.notify(Nt,null)}}}if(!i&&0===e.count)return void this.parent.notify(Nt,null)},e.prototype.findPreCol=function(e){var t,r=e.sheets[e.sheetIndex],n=this.parent.sheets.length,i=!1,a=u(r.activeCell);for(e.colIndex;e.colIndex>=-1;e.colIndex--){if(e.rowIndex<0&&e.colIndex<=0){if("Workbook"===e.args.mode){var o=this.parent.activeSheetIndex;if(-1===--e.sheetIndex&&(e.sheetIndex=n-1),o===e.sheetIndex&&0===e.count)return void this.parent.notify(Nt,null);t=(r=e.sheets[e.sheetIndex]).usedRange,a=u(r.activeCell),e.rowIndex=t.rowIndex,e.colIndex=t.colIndex,e.endColumn=0,e.endRow=0}i=this.commonCondition(e,a)}if(!i){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--);var s=r.rows[e.rowIndex];for(s&&r.rows[e.rowIndex].cells[e.colIndex]&&-1===e.rowIndex&&(e.rowIndex=r.usedRange.rowIndex),e.rowIndex;e.rowIndex>=0;e.rowIndex--){if(s&&s.cells&&s.cells[e.colIndex]&&this.prevCommon(e))return;if(e.loopCount>0&&a[1]===e.colIndex)return void this.parent.notify(Nt,null)}}}if(!i&&0===e.count)return void this.parent.notify(Nt,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)&&0!==t[0]&&0!==t[1]&&(this.parent.notify(Nt,null),r=!0),r},e.prototype.prevCommon=function(e){var t=e.sheets[e.sheetIndex];if(t.rows[e.rowIndex]){var r=t.rows[e.rowIndex].cells[e.colIndex];if(r&&r.value){var n=t.rows[e.rowIndex].cells[e.colIndex];if(n){var i=void 0;if(i=n.format?this.parent.getDisplayText(t.rows[e.rowIndex].cells[e.colIndex]):t.rows[e.rowIndex].cells[e.colIndex].value.toString(),e.args.isCSen&&e.args.isEMatch){if(i===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(e.args.isCSen&&!e.args.isEMatch){a=i.indexOf(e.args.value)>-1;if(i===e.stringValue||a){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&e.args.isEMatch){if(e.val=i.toString().toLowerCase(),e.val===e.stringValue){s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}else if(!e.args.isCSen&&!e.args.isEMatch){e.val=i.toString().toLowerCase();var a=e.val.indexOf(e.args.value.toString().toLowerCase())>-1,o=e.val.indexOf(e.args.value)>-1;if(i===e.stringValue||i===e.stringValue||a||e.val===e.stringValue||o){var s=t.name+"!"+g(e.rowIndex,e.colIndex);return this.parent.notify(Lt,{address:s}),e.count++,!0}}}}}return!1},e.prototype.replace=function(e){if(this.parent.getActiveSheet().isProtected)return void this.parent.notify("editAlert",null);var t=this.parent.getActiveSheet(),r=u(t.activeCell),n=t.rows[r[0]].cells[r[1]].value.toString(),i=n.indexOf(e.value)>-1,a=n.toLowerCase().indexOf(e.value.toString().toLowerCase())>-1,o=n.toString().toLowerCase();n===e.value||i||o===e.value||a||(e.findOpt="next",this.findNext(e)),this.parent.getActiveSheet();var s,l=u(t.activeCell),h=t.activeCell,d=t.rows[l[0]].cells[l[1]],p=t.rows[l[0]].cells[l[1]].format,c=t.name+"!"+g(l[0],l[1]),f={undoRedoOpt:"before",address:c,compareVal:s=p?this.parent.getDisplayText(t.rows[l[0]].cells[l[1]]).toString():t.rows[l[0]].cells[l[1]].value.toString()};this.parent.notify("findUndoRedo",f);var m=s.toLowerCase(),v=s.indexOf(e.value)>-1,y=m.indexOf(e.value)>-1;if(e.value===s||e.value===m){t.rows[l[0]].cells[l[1]].value=e.replaceValue,this.parent.updateCell(d,h);var C={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",C)}else if(v){var b=s.replace(e.value,e.replaceValue);t.rows[l[0]].cells[l[1]].value=b,this.parent.updateCell(d,h);var S={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",S)}else if(y){var x=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),w=s.replace(x,e.replaceValue);t.rows[l[0]].cells[l[1]].value=w,this.parent.updateCell(d,h);var I={address:c,compareVal:e.replaceValue,undoRedoOpt:"after"};this.parent.notify("findUndoRedo",I)}},e.prototype.replaceAll=function(e){var t,r=0,n=this.parent.sheets[r],i=n.usedRange.rowIndex,a=0,o=0,s=n.usedRange.colIndex,l=0,h=[];for(o;o<=i;o++)if(l>s&&o===i&&"Workbook"===e.mode&&(r++,(n=this.parent.sheets[r])&&(l=0,o=0,s=n.usedRange.colIndex,i=n.usedRange.rowIndex)),n&&n.rows[o]){var d=n.rows[o];for(l===s+1&&(l=0),l;l<=s;l++){var p=n.rows[o].cells[l];if(d&&d.cells&&d.cells[l]&&d.cells[l].value){var c=n.rows[o].cells[l];if(c){var u=void 0;if(u=c.format?this.parent.getDisplayText(n.rows[o].cells[l]).toString():n.rows[o].cells[l].value.toString(),e.isCSen&&e.isEMatch)u===e.value&&(n.rows[o].cells[l].value=e.replaceValue,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++);else if(e.isCSen&&!e.isEMatch){m=u.indexOf(e.value)>-1;if(u===e.value||m){C=u.replace(e.value,e.replaceValue);n.rows[o].cells[l].value=C,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++}}else if(!e.isCSen&&e.isEMatch)(f=u.toString().toLowerCase())===e.value&&(n.rows[o].cells[l].value=e.replaceValue,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++);else if(!e.isCSen&&!e.isEMatch){var f=u.toString().toLowerCase(),m=f.indexOf(e.value.toString().toLowerCase())>-1,v=f.indexOf(e.value)>-1;if(u===e.value||m||f===e.value||u===e.value||v){var y=new RegExp(e.value.toString().replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"ig"),C=u.replace(y,e.replaceValue);n.rows[o].cells[l].value=C,t=n.name+"!"+g(o,l),this.parent.updateCell(p,t),h.push(t),a++}}}}}}var b={undoRedoOpt:"beforeReplaceAll",Collection:h,replaceValue:e.value};this.parent.notify("findUndoRedo",b),b={undoRedoOpt:"afterReplaceAll",Collection:h,replaceValue:e.replaceValue},this.parent.notify("findUndoRedo",b);var S=a;this.parent.notify("replaceAllDialog",{count:S,replaceValue:e.replaceValue})},e.prototype.totalCount=function(e){var t=this.parent.sheets[e.sheetIndex],r=t.usedRange.rowIndex,n=0,i=0,a=t.usedRange.colIndex,o=0;for(i;i<=r;i++)if(t.rows[i]){var s=t.rows[i];for(o===a+1&&(o=0),o;o<=a;o++)if(s&&s.cells&&s.cells[o]&&s.cells[o].value){var l=t.rows[i].cells[o];if(l){var h=void 0;if(h=l.format?this.parent.getDisplayText(t.rows[i].cells[o]).toString():l.value.toString(),e.isCSen&&e.isEMatch)h===e.value&&n++;else if(e.isCSen&&!e.isEMatch){d=h.indexOf(e.value)>-1;(h===e.value||d)&&n++}else if(!e.isCSen&&e.isEMatch)(g=h.toString().toLowerCase())===e.value&&n++;else if(!e.isCSen&&!e.isEMatch){var d=(g=h.toString().toLowerCase()).indexOf(e.value.toString().toLowerCase())>-1,p=g.indexOf(e.value)>-1;(g===e.value||h===e.value||d||h===e.value||p)&&n++}}}}var c=n;if((n=c-(this.requiredCount(e)-1))>c&&(n=c),0!==n){var f=u(t.activeCell),g=t.rows[f[0]]?this.parent.getDisplayText(t.rows[f[0]].cells[f[1]]).toString().toLowerCase():null;g&&-1===g.indexOf(e.value.toString().toLowerCase())&&(n-=1)}e.findCount=n+" of "+c},e.prototype.requiredCount=function(e){var t=this.parent.activeSheetIndex,r=this.parent.sheets[t],n=u(r.activeCell),i=r.usedRange.rowIndex,a=0,o=n[0],s=r.usedRange.colIndex,l=n[1];for(o;o<=i;o++)if(r.rows[o]){var h=r.rows[o];for(l===s+1&&(l=0),l;l<=s;l++)if(h&&h.cells&&h.cells[l]&&h.cells[l].value&&r.rows[o].cells[l]){var d=void 0;if(d=r.rows[o].cells[l].format?this.parent.getDisplayText(r.rows[o].cells[l]).toString():r.rows[o].cells[l].value.toString(),e.isCSen&&!e.isEMatch){f=d.indexOf(e.value)>-1;(d===e.value||f)&&a++}else if(e.isCSen&&e.isEMatch)d===e.value&&a++;else if(!e.isCSen&&e.isEMatch)(p=d.toString().toLowerCase())===e.value&&a++;else if(!e.isCSen&&!e.isEMatch){var p=d.toString().toLowerCase(),c=e.value.toString().toLowerCase(),f=p.indexOf(c)>-1,g=p.indexOf(e.value)>-1;(d===e.value||p===c||f||p===e.value||g)&&a++}}}return a},e.prototype.findAllValues=function(e){var r,n=e.sheetIndex,i=this.parent.sheets[n-1],a=i.usedRange.rowIndex,o=0,s=0,l=i.usedRange.colIndex,h=0,d=this.parent.sheets.length,p=e.sheetIndex;for(o;o<=a+1;o++){if(1!==p&&e.sheetIndex===d&&(n=1),o>a&&h>l&&"Workbook"===e.mode){if(n++,p===n)return void 0;n>d-1&&(n=0),(i=this.parent.sheets[n])&&(o=0,h=0,l=i.usedRange.colIndex,a=i.usedRange.rowIndex)}if(!t.isNullOrUndefined(i)&&i.rows[o]){var c=i.rows[o];for(h===l+2&&(h=0),h;h<=l+1;h++)if(c&&c.cells&&c.cells[h]){var u=i.rows[o].cells[h];if(u){var f=void 0;if(f=u.format?this.parent.getDisplayText(i.rows[o].cells[h]).toString():u.value.toString(),e.isCSen&&e.isEMatch)f===e.value&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++);else if(e.isCSen&&!e.isEMatch){v=f.indexOf(e.value)>-1;(f===e.value||v)&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++)}else if(!e.isCSen&&e.isEMatch)(m=f.toString().toLowerCase())===e.value&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++);else if(!e.isCSen&&!e.isEMatch){var m=f.toString().toLowerCase(),v=m.indexOf(e.value.toLowerCase())>-1;(m===e.value||f===e.value||v||f===e.value)&&(r=i.name+"!"+g(o,h),e.findCollection.push(r),s++)}}}}}},e.prototype.getModuleName=function(){return"workbookfindAndReplace"},e}(),Ur=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.protectsheetHandler=function(e){var r=this.parent.getActiveSheet();this.parent.setSheetPropertyOnMute(r,"protectSettings",{selectCells:e.selectCells,formatCells:e.formatCells,formatColumns:e.formatColumns,formatRows:e.formatRows,insertLink:e.insertLink}),this.parent.notify("protectSheet",r.protectSettings),this.parent.notify("updateToggleItem",{props:"Protect"}),r.columns.forEach(function(e){e&&t.isUndefined(e.isLocked)&&(e.isLocked=!0)})},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,this.parent.setSheetPropertyOnMute(t,"isProtected",!1),this.parent.notify("protectSheet",t.protectSettings),this.parent.notify("updateToggleItem",{props:"Protect"})},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("protectsheetHandler",this.protectsheetHandler,this),this.parent.on("unprotectsheetHandler",this.unprotectsheetHandler,this),this.parent.on("setLockCells",this.lockCells,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("protectsheetHandler",this.protectsheetHandler),this.parent.off("setLockCells",this.lockCells),this.parent.off("protectsheetHandler",this.unprotectsheetHandler))},e.prototype.lockCells=function(e){var t,r=this.parent.getActiveSheet(),n="object"==typeof(t=e?e.range:r.selectedRange)?t:x(c(t));if(0===n[0]&&n[2]===r.rowCount-1)for(i=n[1];i<=n[3];i++)Ee(r,i,{isLocked:e.isLocked});for(var i=n[0];i<=n[2];i++)for(var a=n[1];a<=n[3];a++)this.parent.getActiveSheet().id===r.id&&this.parent.notify("applyLockCells",{rowIdx:i,colIdx:a,isLocked:e.isLocked})},e.prototype.getModuleName=function(){return"workbookProtectSheet"},e}(),Vr=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=c(e.range)),e.range=x(e.range);var t=e.sheet||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("activeCellChanged",null)),this.parent.setUsedRange(e.range[2],e.range[3]),e.isAction&&this.parent.notify("actionComplete",{eventArgs:e,action:"merge"}),this.parent.sheets.indexOf(t)===this.parent.activeSheetIndex&&this.parent.notify("selectRange",{address:t.selectedRange,skipChecking:!0})},e.prototype.mergeAll=function(e){var r,n=0;e.range=e.range;var i,a,o,s=e.sheet||this.parent.getActiveSheet(),l=$(e.range[0],e.range[1],s),h=l&&l.style?l.style.borderLeft:null;"none"===h&&(h="none"!==l.style.borderRight?l.style.borderRight:l.style.borderTop?l.style.borderTop:null),"none"===h&&(h="none"!==l.style.borderBottom?l.style.borderBottom:null),t.isNullOrUndefined(l)||t.isNullOrUndefined(h)||(l.style.borderBottom="",l.style.borderLeft="",l.style.borderTop="",l.style.borderRight="");for(var d=e.range[0];d<=e.range[2];d++){i=0,e.isAction&&e.model.push({cells:[]});for(var p=e.range[1];p<=e.range[3];p++){if((r=$(d,p,s))&&(r.value||r.formula)&&!a&&(a=r.formula||r.value),e.isAction&&e.merge&&(e.model[d-e.range[0]].cells[p-e.range[1]]={},Object.assign(e.model[d-e.range[0]].cells[p-e.range[1]],r)),s.rows[d]&&s.rows[d].cells&&s.rows[d].cells[p]&&(delete s.rows[d].cells[p].rowSpan,delete s.rows[d].cells[p].colSpan,!e.merge&&!e.isAction&&e.model&&e.model[d-e.range[0]]&&e.model[d-e.range[0]].cells[p-e.range[1]]&&e.model[d-e.range[0]].cells[p-e.range[1]]!=={}&&Z(d,p,s,e.model[d-e.range[0]].cells[p-e.range[1]])),e.merge){if(r=new Object,d===e.range[0]&&p===e.range[1]){e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),Z(e.range[0],e.range[1],s,r,!0);continue}d!==e.range[0]&&(r.rowSpan=-n),p!==e.range[1]&&(i++,r.colSpan=-i),s.rows[d]&&s.rows[d].cells&&s.rows[d].cells[p]&&(delete s.rows[d].cells[p].value,delete s.rows[d].cells[p].formula),o=$(d,p,s)||{},Z(d,p,s,Object.assign(r,o))}e.preventRefresh||this.parent.notify("applyMerge",{rowIdx:d,colIdx:p})}n++}e.merge&&(r=this.getCellValue(e.range[0],e.range[1],a,s),Z(e.range[0],e.range[1],s,r,!0),e.preventRefresh||this.parent.notify("applyMerge",{rowIdx:e.range[0],colIdx:e.range[1]})),t.isNullOrUndefined(h)||this.parent.notify(wt,{style:{border:h},range:e.range,onActionUpdate:!0})},e.prototype.mergeHorizontally=function(e){var t;e.range=e.range;for(var r,n,i,a,o=e.sheet||this.parent.getActiveSheet(),s=e.range[0];s<=e.range[2];s++){t=0,e.isAction&&e.model.push({cells:[]});for(var l=e.range[1];l<=e.range[3];l++){if(a=$(s,l,o),r=new Object,e.isAction&&(e.model[s-e.range[0]].cells[l-e.range[1]]={},Object.assign(e.model[s-e.range[0]].cells[l-e.range[1]],a)),l===e.range[1]){if(s===e.range[0])continue;i=s-1,o.rows[i]&&o.rows[i].cells&&o.rows[i].cells[l]&&delete o.rows[i].cells[l].rowSpan,r=this.getCellValue(i,l,n,o),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),n=null,Z(i,l,o,r,!0)}else a&&(a.value||a.formula)&&!n&&(n=a.formula||a.value),i=s,o.rows[i]&&o.rows[i].cells&&o.rows[i].cells[l]&&(delete o.rows[i].cells[l].rowSpan,delete o.rows[i].cells[l].value,delete o.rows[i].cells[l].formula),t++,r.colSpan=-t,Z(i,l,o,r,!0);this.parent.notify("applyMerge",{rowIdx:i,colIdx:l})}}o.rows[e.range[2]]&&o.rows[e.range[2]].cells&&o.rows[e.range[2]].cells[e.range[1]]&&delete o.rows[e.range[2]].cells[e.range[1]].rowSpan,r=this.getCellValue(e.range[2],e.range[1],n,o),e.range[3]-e.range[1]>0&&(r.colSpan=e.range[3]-e.range[1]+1),Z(e.range[2],e.range[1],o,r,!0),this.parent.notify("applyMerge",{rowIdx:e.range[2],colIdx:e.range[1]})},e.prototype.getCellValue=function(e,t,r,n){var i=new Object,a=$(e,t,n);return!r||a&&(a.value||a.formula)||(q(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,a,o=e.sheet||this.parent.getActiveSheet(),s=e.range[1];s<=e.range[3];s++)for(var l=e.range[0];l<=e.range[2];l++){if(a=$(l,s,o),e.isAction&&(void 0===e.model[l-e.range[0]]&&(e.model[l-e.range[0]]={cells:[]}),e.model[l-e.range[0]].cells[s-e.range[1]]={},Object.assign(e.model[l-e.range[0]].cells[s-e.range[1]],a)),l===e.range[0]){if(t=0,s===e.range[1])continue;i=s-1,o.rows[l]&&o.rows[l].cells&&o.rows[l].cells[i]&&delete o.rows[l].cells[i].colSpan,r=this.getCellValue(l,i,n,o),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),n=null,Z(l,i,o,r,!0)}else r=new Object,a&&(a.value||a.formula)&&!n&&(n=a.formula||a.value),t++,i=s,o.rows[l]&&o.rows[l].cells&&o.rows[l].cells[i]&&(delete o.rows[l].cells[i].colSpan,delete o.rows[l].cells[i].value,delete o.rows[l].cells[i].formula),r.rowSpan=-t,Z(l,i,o,r,!0);this.parent.notify("applyMerge",{rowIdx:l,colIdx:i})}o.rows[e.range[0]]&&o.rows[e.range[0]].cells&&o.rows[e.range[0]].cells[e.range[3]]&&delete o.rows[e.range[0]].cells[e.range[3]].colSpan,r=this.getCellValue(e.range[0],e.range[1],n,o),e.range[2]-e.range[0]>0&&(r.rowSpan=e.range[2]-e.range[0]+1),Z(e.range[0],e.range[3],o,r,!0),this.parent.notify("applyMerge",{rowIdx:e.range[0],colIdx:e.range[3]})},e.prototype.activeCellRange=function(e){e.range=e.range;var r=this.parent.getActiveSheet(),n=$(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=$(e.range[0],e.range[1],r))&&(n.rowSpan>1&&(e.range[0]+(n.rowSpan-1)>=e.range[2]||e.insertCount)&&(e.range[2]=e.range[0]+(n.rowSpan-1)),n.colSpan>1&&(e.range[1]+(n.colSpan-1)>=e.range[3]||e.insertCount)&&(e.range[3]=e.range[1]+(n.colSpan-1))))},e.prototype.mergedRange=function(e){"string"==typeof e.range&&(e.range=c(e.range)),e.range[0]<=e.range[2]&&e.range[1]<=e.range[3]?this.forward(e):e.range[0]>=e.range[2]&&e.range[1]>=e.range[3]?this.reverse(e):e.range[0]e.range[3]?this.forwardReverse(e):e.range[0]>e.range[2]&&e.range[1]1&&(r+=a.rowSpan-1,o+(a.rowSpan-1)>=e.range[2]&&(e.range[2]=e.range[0],e.range[2]=o+(a.rowSpan-1))),a.colSpan>1&&(n+=a.colSpan-1,s+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=s+(a.colSpan-1))))),e.range[0]=o,e.range[1]=s,e.range[0]===o&&e.range[1]===s&&e.range[2]===r&&e.range[3]===n&&(e.isActiveCell=!0),!e.skipChecking){for(d=e.range[1];d<=e.range[3];d++)(a=$(e.range[2],d,i))&&(o=e.range[2],s=d,!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(s+=a.colSpan)1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1))));for(var l,h,d=e.range[1];d<=e.range[3];d++)(a=$(e.range[0],d,i))&&(h=d,l=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(h+=a.colSpan)1&&o+(a.rowSpan-1)>e.range[2]&&(e.range[2]=o,e.range[2]=o+(a.rowSpan-1)),a.colSpan>1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s,e.range[3]=s+(a.colSpan-1))))}},e.prototype.forwardReverse=function(e){var r=this.parent.getActiveSheet();e.range=e.range;var n=e.range[1],i=$(e.range[0],e.range[1],r),a=e.range[0];if(i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(n+=i.colSpan,e.range[3]>=n&&(e.range[3]=n)),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)1&&a+(i.rowSpan-1)>=e.range[2]&&(e.range[2]=a+(i.rowSpan-1)),i.colSpan>1&&n+(i.colSpan-1)>=e.range[1]&&(e.range[1]=n+(i.colSpan-1)))),e.range[0]=a,!e.skipChecking){for(var o,s,l=e.range[3];l<=e.range[1];l++)(i=$(e.range[2],l,r))&&(s=l,o=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(o+=i.rowSpan)1&&o+(i.rowSpan-1)>e.range[2]&&(e.range[2]=o+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s+(i.colSpan-1))));for(var h,l=e.range[3];l<=e.range[1];l++)(i=$(e.range[0],l,r))&&(s=l,h=e.range[0],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))));for(var d,l=e.range[0];l<=e.range[2];l++)(i=$(l,e.range[3],r))&&(h=l,d=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(h+=i.rowSpan)1&&h+(i.rowSpan-1)>e.range[2]&&(e.range[2]=h,e.range[2]=h+(i.rowSpan-1)),i.colSpan>1&&d+(i.colSpan-1)>e.range[1]&&(e.range[1]=d,e.range[1]=d+(i.colSpan-1))))}},e.prototype.reverse=function(e){e.range=e.range;var r=e.range[1],n=e.sheet||this.parent.getActiveSheet(),i=$(e.range[0],e.range[1],n),a=e.range[0];i&&(!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(r+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),e.range[2]>=a&&(e.range[2]=a,e.isActiveCell=!0),e.range[3]>=r?(e.range[3]=r,e.range[2]===a&&(e.isActiveCell=!0)):e.isActiveCell&&(e.isActiveCell=!1),(i=$(a,r,n))&&(i.rowSpan>1&&a+(i.rowSpan-1)>=e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&r+(i.colSpan-1)>=e.range[1]&&(e.range[1]=r,e.range[1]=r+(i.colSpan-1))));var o=e.range[3];if(!e.skipChecking){for(h=e.range[3];h<=e.range[1];h++)(i=$(e.range[2],h,n))&&(o=h,a=e.range[2],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan)1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1)),i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1))));o=e.range[3];for(h=e.range[3];h<=e.range[1];h++)(i=$(e.range[0],h,n))&&(o=h,a=e.range[0],!t.isNullOrUndefined(i.colSpan)&&i.colSpan<0&&(o+=i.colSpan),!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(a+=i.rowSpan),(i=$(a,o,n))&&(i.colSpan>1&&o+(i.colSpan-1)>e.range[1]&&(e.range[1]=o,e.range[1]=o+(i.colSpan-1)),i.rowSpan>1&&a+(i.rowSpan-1)>e.range[0]&&(e.range[0]=a,e.range[0]=a+(i.rowSpan-1))));for(var s,l,h=e.range[2];h<=e.range[0];h++)(i=$(h,e.range[3],n))&&(l=h,s=e.range[3],!t.isNullOrUndefined(i.rowSpan)&&i.rowSpan<0&&(l+=i.rowSpan)1&&l+(i.rowSpan-1)>e.range[0]&&(e.range[0]=l,e.range[0]=l+(i.rowSpan-1)),i.colSpan>1&&s+(i.colSpan-1)>e.range[1]&&(e.range[1]=s,e.range[1]=s+(i.colSpan-1))))}},e.prototype.reverseForward=function(e){e.range=e.range;var r=e.sheet||this.parent.getActiveSheet(),n=e.range[0],i=e.range[1],a=$(e.range[0],e.range[1],r);if(a&&(!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(n+=a.rowSpan,e.range[2]>=n&&(e.range[2]=n)),!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(i+=a.colSpan),(a=$(n,i,r))&&(a.rowSpan>1&&n+(a.rowSpan-1)>=e.range[0]&&(e.range[0]=n,e.range[0]=n+(a.rowSpan-1)),a.colSpan>1&&i+(a.colSpan-1)>=e.range[3]&&(e.range[3]=e.range[1],e.range[3]=i+(a.colSpan-1)))),!e.skipChecking){for(var o,s=e.range[3],l=e.range[1];l<=e.range[3];l++)(a=$(e.range[2],l,r))&&(o=e.range[2],s=l,!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)1&&s+(a.colSpan-1)>e.range[3]&&(e.range[3]=s+(a.colSpan-1)),a.rowSpan>1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o)));for(var h,d,l=e.range[1];l<=e.range[3];l++)(a=$(e.range[0],l,r))&&(d=l,h=e.range[0],!t.isNullOrUndefined(a.colSpan)&&a.colSpan<0&&(d+=a.colSpan)1&&h+(a.rowSpan-1)>e.range[0]&&(e.range[0]=h+(a.rowSpan-1)));for(var p,l=e.range[2];l<=e.range[0];l++)(a=$(l,e.range[3],r))&&(o=l,p=e.range[3],!t.isNullOrUndefined(a.rowSpan)&&a.rowSpan<0&&(o+=a.rowSpan)1&&a.rowSpan-1+o>e.range[0]&&(e.range[0]=a.rowSpan-1+o),a.colSpan>1&&a.colSpan-1+p>e.range[3]&&(e.range[3]=p,e.range[3]=a.colSpan-1+p)))}},e.prototype.insertHandler=function(e){this.activeCellRange(e),e.range=e.range,"Row"===e.insertModel?e.range[2]+=e.insertCount:e.range[3]+=e.insertCount,e.preventRefresh=!0,e.merge=!0,this.mergeAll(e)},e.prototype.pasteHandler=function(e){for(var t,r,n,i=this.parent.getActiveSheet(),a=u(i.activeCell),o=e.range[0],s=0;o<=e.range[2];o++,s++)for(var l=e.range[1],h=0;l<=e.range[3];l++,h++){if((t=$(o,l,e.prevSheet)||{}).rowSpan>1&&(n=$(a[0]+(t.rowSpan-1),a[1],i)||{},r=$(a[0]+1,a[1],i)||{},void 0!==n.colSpan&&n.colSpan<0||void 0!==r.colSpan&&r.colSpan<0))return e.cancel=!0,void this.parent.notify("applyMerge",{showDialog:!0});if(t.colSpan>1&&(n=$(a[0],a[1]+(t.colSpan-1),i)||{},r=$(a[0],a[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("applyMerge",{showDialog:!0})}},e.prototype.addEventListener=function(){this.parent.on(Ht,this.merge,this),this.parent.on("mergedRange",this.mergedRange,this),this.parent.on("activeCellMergedRange",this.activeCellRange,this),this.parent.on("insertMerge",this.insertHandler,this),this.parent.on("pasteMerge",this.pasteHandler,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Ht,this.merge),this.parent.off("mergedRange",this.mergedRange),this.parent.off("activeCellMergedRange",this.activeCellRange),this.parent.off("insertMerge",this.insertHandler),this.parent.off("pasteMerge",this.pasteHandler))},e.prototype.getModuleName=function(){return"workbookmerge"},e}(),zr=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.setCFrulHandler,this),this.parent.on(Mt,this.clearRules,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(Bt,this.setCFrulHandler),this.parent.off(Mt,this.clearRules))},e.prototype.setCFrulHandler=function(e){var t=e.conditionalFormat,r=t.range,n=this.parent.getAddressInfo(r).sheetIndex,i=ce(this.parent,n),a=x(c(r=r||i.selectedRange));t.range=m(a),i.conditionalFormats||this.parent.setSheetPropertyOnMute(i,"conditionalFormats",[]);var o=i.conditionalFormats.length;i.conditionalFormats[o]=t;for(var s=a[0];s<=a[2];s++){i.rows[s]||Ce(i,s,{});for(var l=a[1];l<=a[3];l++)if(i.rows[s].cells&&i.rows[s].cells[l]||Z(s,l,i,{}),n===this.parent.activeSheetIndex){var h=i.rows[s].cells[l];this.parent.notify("cFInitialCheck",{rowIdx:s,colIdx:l,cell:h,conditionalFormat:t})}}},e.prototype.clearRules=function(e){var r,n,i,a,o,s,l,h,d=!!t.isNullOrUndefined(e.isPublic),p=[],u=[],f=!0,g=e.range,v=this.parent.getAddressInfo(g).sheetIndex,y=ce(this.parent,v),C=y.conditionalFormats,b=c(g);if(v===this.parent.activeSheetIndex)for(var S=b[0];S<=b[2];S++)for(var x=b[1];x<=b[3];x++)this.parent.notify("clearCF",{rIdx:S,cIdx:x});if(C){for(var w=C.length-1;w>=0;w--){var I=!1,E="",R=C[w],k=R.range.split(",");if(v===this.parent.activeSheetIndex)for(var A=0;A=b[0]&&F[2]<=b[2]&&F[1]>=b[1]&&F[3]<=b[3]&&(T=!0);for(var L=F[0];L<=F[2];L++){for(var N=0,D=F[1];D<=F[3];D++)for(var O=b[0];O<=b[2];O++)for(var H=b[1];H<=b[3];H++)if(O===L&&H===D){var B=this.parent.getCellStyleValue(["backgroundColor","color"],[O,H]);this.parent.notify(It,{style:B,rowIdx:O,colIdx:H,lastCell:!0,isHeightCheckNeeded:!0,manualUpdate:!0}),N+=1,I=!0,O===F[0]?H===F[3]?o===F[1]?s===H?s=H:o=H-1:o!==F[1]&&s+1===H?(s=F[1],o-=1):o!==F[1]&&s===F[1]&&(o=b[1]-1):H===F[1]?s===F[1]&&(s=H+1):o===F[1]&&s===F[1]?(o=H,s=H):s=o===F[1]&&s!==F[1]?H+1:H:H===F[1]?s===F[1]&&F[1]!==F[3]&&(s=H+1):H===F[3]?o===F[1]?s===H?s=H:o=H-1:o!==F[1]&&s===F[1]?o=b[1]-1:o!==F[1]&&s+1===H?(s=F[1],o=b[1]-1):h=O:o===F[1]&&s===F[1]?(o=H,s=H):s!==F[1]&&o!==F[1]?s=H:o!==F[1]&&s===F[1]?o=H:s=H+1}N>0&&!T?(f&&(r=l,n=h,i=o,a=s),o===F[1]&&s!==F[1]?s===F[3]?(l!==L&&(E=E+" "+m([l,i,n,F[3]])),o===F[1]&&s===F[3]&&(L===F[2]?F[1]===b[3]&&(E=E+" "+m([L,s,L,F[3]])):(b[2]===F[0]&&s!==F[3]&&(E=E+" "+m([L,s,L,F[3]])),l=L+1,h=L+1,s=F[1]))):a!==s?(E=E+" "+m([l,a,L-1,F[3]]),s===F[3]&&o===F[1]?(l=L+1,h=L+1,s=F[1]):(l=L,h=L),s===F[3]&&o!==F[1]&&(o=F[1])):i!==o?(E=E+" "+m([l,F[1],L-1,i]),l=L+1,h=L+1,o=F[1],s=F[1]):L===F[2]?E=E+" "+m([l,s,L,F[3]]):(h=b[2]&&L>b[2]&&(E=E+" "+m([l,o,h,F[3]])),F[1]===F[3]&&L<=F[2]&&r!==F[2]&&L!==r&&(E=E+" "+m([l,o,h,F[3]])),F[1]===F[3]&&(l=L+1,h=L+1)):((L===F[2]||L===F[0]&&F[1]!==F[3])&&(E=E+" "+m([l,o,h,s])),l=L+1,h=L+1),L===F[2]&&F[0]!==F[2]&&F[1]!==F[3]&&(E=E+" "+m([L,o,L,s]))),f||(r=l,n=h<=F[2]?h:F[2],i=o,a=s<=F[3]?s:F[3]),f=!1):T||(f&&(r=l,n=h,i=o,a=s),o===F[1]&&s===F[1]&&(L===F[2]&&(E=E+" "+m([l,o,L,F[3]])),h=L),s!==F[1]&&o!==F[1]&&(E=(E=E+" "+m([l,F[1],L-1,o-1]))+" "+m([l,s+1,L-1,F[3]]),l=L,h=L,o=F[1],s=F[1]),s!==F[1]&&o===F[1]&&(E=E+" "+m([l,s,L-1,F[3]]),l=L,h=L,o=F[1],s=F[1]),o!==F[1]&&s===F[1]&&(E=E+" "+m([l,s,L-1,o]),l=L,h=L,o=F[1],s=F[1]),f||(r=l,n=h<=F[2]?h:F[2],i=o,a=s<=F[3]?s:F[3]),f=!1)}}""===E?(u.push(y.conditionalFormats[w].range),y.conditionalFormats.splice(w,1)):(u.push(y.conditionalFormats[w].range),y.conditionalFormats[w].range=E.trim().replace(" ",",")),I&&!d&&(R.range=E.trim().replace(" ",","),p.push(R))}if(!d){var M={cFormats:p,oldRange:u,selectedRange:g};this.parent.notify(nr,{eventArgs:M,action:"clearCF"})}}},e.prototype.getModuleName=function(){return"workbookConditionalFormatting"},e}(),qr=function(){function e(){In.Inject(qt,mr,ur,zt,Dr,Or,Ar,Tr,Hr,Fr,Br,Mr,_r,Ur,Pr,Vr,zr,Lr,Nr)}return e.prototype.getModuleName=function(){return"workbookBasic"},e.prototype.destroy=function(){},e}(),jr=function(){function e(){In.Inject(qt,mr,zt,Dr,Or,Ar,ur,Tr,Hr,Fr,Br,Mr,_r,Ur,Pr,Vr,zr,Lr,Nr)}return e.prototype.getModuleName=function(){return"workbook-all"},e.prototype.destroy=function(){},e}(),Wr=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)}}(),Gr=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Yr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("Calibri")],r.prototype,"fontFamily",void 0),Gr([t.Property("bottom")],r.prototype,"verticalAlign",void 0),Gr([t.Property("left")],r.prototype,"textAlign",void 0),Gr([t.Property("0pt")],r.prototype,"textIndent",void 0),Gr([t.Property("#000000")],r.prototype,"color",void 0),Gr([t.Property("#ffffff")],r.prototype,"backgroundColor",void 0),Gr([t.Property("normal")],r.prototype,"fontWeight",void 0),Gr([t.Property("normal")],r.prototype,"fontStyle",void 0),Gr([t.Property("11pt")],r.prototype,"fontSize",void 0),Gr([t.Property("none")],r.prototype,"textDecoration",void 0),Gr([t.Property("")],r.prototype,"border",void 0),Gr([t.Property("")],r.prototype,"borderTop",void 0),Gr([t.Property("")],r.prototype,"borderBottom",void 0),Gr([t.Property("")],r.prototype,"borderLeft",void 0),Gr([t.Property("")],r.prototype,"borderRight",void 0),r}(t.ChildProperty),Xr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property()],r.prototype,"sheetIndex",void 0),Gr([t.Property()],r.prototype,"filterRange",void 0),Gr([t.Property(!1)],r.prototype,"hasFilter",void 0),Gr([t.Property()],r.prototype,"column",void 0),Gr([t.Property()],r.prototype,"criteria",void 0),Gr([t.Property()],r.prototype,"value",void 0),Gr([t.Property()],r.prototype,"dataType",void 0),Gr([t.Property()],r.prototype,"predicates",void 0),r}(t.ChildProperty),Kr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property()],r.prototype,"sortRange",void 0),Gr([t.Property()],r.prototype,"columnIndex",void 0),Gr([t.Property()],r.prototype,"order",void 0),Gr([t.Property()],r.prototype,"sheetIndex",void 0),r}(t.ChildProperty),$r=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"name",void 0),Gr([t.Property("")],r.prototype,"scope",void 0),Gr([t.Property("")],r.prototype,"comment",void 0),Gr([t.Property("")],r.prototype,"refersTo",void 0),r}(t.ChildProperty),Zr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!1)],r.prototype,"selectCells",void 0),Gr([t.Property(!1)],r.prototype,"formatCells",void 0),Gr([t.Property(!1)],r.prototype,"formatRows",void 0),Gr([t.Property(!1)],r.prototype,"formatColumns",void 0),Gr([t.Property(!1)],r.prototype,"insertLink",void 0),r}(t.ChildProperty),Jr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"address",void 0),r}(t.ChildProperty),Qr=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("WholeNumber")],r.prototype,"type",void 0),Gr([t.Property("Between")],r.prototype,"operator",void 0),Gr([t.Property("0")],r.prototype,"value1",void 0),Gr([t.Property("0")],r.prototype,"value2",void 0),Gr([t.Property(!0)],r.prototype,"ignoreBlank",void 0),Gr([t.Property(!0)],r.prototype,"inCellDropDown",void 0),Gr([t.Property(!1)],r.prototype,"isHighlighted",void 0),r}(t.ChildProperty),en=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("General")],r.prototype,"format",void 0),Gr([t.Complex({},Yr)],r.prototype,"style",void 0),Gr([t.Property(!0)],r.prototype,"isLocked",void 0),r}(t.ChildProperty),tn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("GreaterThan")],r.prototype,"type",void 0),Gr([t.Complex({},en)],r.prototype,"format",void 0),Gr([t.Property("RedFT")],r.prototype,"cFColor",void 0),Gr([t.Property("")],r.prototype,"value",void 0),Gr([t.Property("")],r.prototype,"range",void 0),r}(t.ChildProperty),rn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!0)],r.prototype,"visible",void 0),Gr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),nn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(!1)],r.prototype,"visible",void 0),Gr([t.Property("Auto")],r.prototype,"position",void 0),r}(t.ChildProperty),an=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),on=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property(0)],r.prototype,"width",void 0),r}(t.ChildProperty),sn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"title",void 0),Gr([t.Complex({},an)],r.prototype,"majorGridLines",void 0),Gr([t.Complex({},on)],r.prototype,"minorGridLines",void 0),Gr([t.Property(!0)],r.prototype,"visible",void 0),r}(t.ChildProperty),ln=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("Line")],r.prototype,"type",void 0),Gr([t.Property("Material")],r.prototype,"theme",void 0),Gr([t.Property(!1)],r.prototype,"isSeriesInRows",void 0),Gr([t.Property("")],r.prototype,"range",void 0),Gr([t.Property("")],r.prototype,"id",void 0),Gr([t.Property("")],r.prototype,"title",void 0),Gr([t.Property(290)],r.prototype,"height",void 0),Gr([t.Property(480)],r.prototype,"width",void 0),Gr([t.Property(0)],r.prototype,"top",void 0),Gr([t.Property(0)],r.prototype,"left",void 0),Gr([t.Complex({},rn)],r.prototype,"legendSettings",void 0),Gr([t.Complex({},sn)],r.prototype,"primaryXAxis",void 0),Gr([t.Complex({},sn)],r.prototype,"primaryYAxis",void 0),Gr([t.Complex({},nn)],r.prototype,"dataLabelSettings",void 0),r}(t.ChildProperty),hn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return Wr(r,e),Gr([t.Property("")],r.prototype,"src",void 0),Gr([t.Property("")],r.prototype,"id",void 0),Gr([t.Property(300)],r.prototype,"height",void 0),Gr([t.Property(400)],r.prototype,"width",void 0),Gr([t.Property(0)],r.prototype,"top",void 0),Gr([t.Property(0)],r.prototype,"left",void 0),r}(t.ChildProperty),dn="spreadsheetLocale",pn={SortOutOfRangeError:"Select a cell or range inside the used range and try again."},cn=function(){var e=function(t,r){return(e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,t){e.__proto__=t}||function(e,t){for(var r in t)t.hasOwnProperty(r)&&(e[r]=t[r])})(t,r)};return function(t,r){function n(){this.constructor=t}e(t,r),t.prototype=null===r?Object.create(r):(n.prototype=r.prototype,new n)}}(),un=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},fn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return cn(r,e),un([t.Collection([],hn)],r.prototype,"image",void 0),un([t.Collection([],ln)],r.prototype,"chart",void 0),un([t.Property("")],r.prototype,"value",void 0),un([t.Property("")],r.prototype,"formula",void 0),un([t.Property(0)],r.prototype,"index",void 0),un([t.Property("General")],r.prototype,"format",void 0),un([t.Complex({},Yr)],r.prototype,"style",void 0),un([t.Property("")],r.prototype,"hyperlink",void 0),un([t.Property(!1)],r.prototype,"wrap",void 0),un([t.Property(!0)],r.prototype,"isLocked",void 0),un([t.Property("")],r.prototype,"validation",void 0),un([t.Property(1)],r.prototype,"colSpan",void 0),un([t.Property(1)],r.prototype,"rowSpan",void 0),r}(t.ChildProperty),gn=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)}}(),mn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},vn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return gn(r,e),r.prototype.setProperties=function(t,r){var n=this;if(this.parentObj.isComplexArraySetter&&this.controlParent&&this.controlParent.isAngular)if(Object.keys(t).length){void 0===this.parentObj.currRangeIdx?this.parentObj.currRangeIdx=0:this.parentObj.currRangeIdx+=1;var i=this.parentObj.ranges[this.parentObj.currRangeIdx];i&&i.info&&(this.info=i.info),setTimeout(function(){void 0!==n.parentObj.currRangeIdx&&delete n.parentObj.currRangeIdx})}else if(this.controlParent.tagObjects[0].instance&&this.controlParent.tagObjects[0].instance.hasChanges&&!this.controlParent.tagObjects[0].instance.isInitChanges){var a=this.controlParent.sheets.indexOf(this.parentObj);if(void 0===this.parentObj.changedRangeIdx){for(var o,s=this.controlParent.tagObjects[0].instance.list[a].tagObjects,l=0;l=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},In=function(e){function r(t){var r=e.call(this,t)||this;return r.isEdit=!1,r.sheetNameCount=1,r.isOpen=!1,r.chartColl=[],r.chartCount=1,n.Inject(qt,mr,ur,zt,Dr,Or,Ar,Tr,Hr,Fr,Br,_r,Pr,Ur,Vr,zr,Lr,Nr),r.commonCellStyle={},t&&t.cellStyle&&(r.commonCellStyle=t.cellStyle),"workbook"===r.getModuleName()&&(r.serviceLocator=new bn,r.initWorkbookServices(),r.dataBind(),r.initEmptySheet()),r}Sn(r,e),n=r,r.prototype.preRender=function(){Object.keys(this.commonCellStyle).length||(this.commonCellStyle=J(this.cellStyle,!0)),"spreadsheet"!==this.getModuleName()||this.refreshing||this.initEmptySheet()},r.prototype.initWorkbookServices=function(){this.serviceLocator.register(dn,new t.L10n(this.getModuleName(),pn,this.locale))},r.prototype.render=function(){},r.prototype.requiredModules=function(){return z(this)},r.prototype.getPersistData=function(){return this.addOnPersist([])},r.prototype.cellFormat=function(e,t){var r=this.getActiveSheet();t=t||r.selectedRange,this.notify(wt,{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("setLockCells",{range:e,isLocked:t})},r.prototype.getCellStyleValue=function(e,t){var r=this,n=$(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("applyNumber",{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)),ge(this,t),this.notify("sheetCreated",{sheetIndex:e||0,sheets:t}),this.notify(Et,{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("workbookDestroyed",null),e.prototype.destroy.call(this)},r.prototype.onPropertyChanged=function(e,r){for(var n=0,i=Object.keys(e);n=this.sheets.length?null:this.sheets[r]},r.prototype.merge=function(e,t){var r,n;e?n=ce(this,r=this.getAddressInfo(e).sheetIndex):e=(n=this.getActiveSheet()).selectedRange,this.notify(Ht,{merge:!0,range:e,type:t||"All",sheet:n,refreshRibbon:e.indexOf(n.activeCell)>-1,preventRefresh:this.activeSheetIndex!==r})},r.prototype.computeExpression=function(e){var t={action:"computeExpression",formula:e};return this.notify(Et,t),t.calcValue},r.prototype.initEmptySheet=function(){this.sheets.length?ge(this):this.createSheet()},r.prototype.getActiveSheet=function(){return this.sheets[this.activeSheetIndex]},r.prototype.skipHiddenSheets=function(e,t,r){return void 0===r&&(r=0),this.sheets[e]&&"Visible"!==this.sheets[e].state&&(void 0===t&&(t=e),e=e&&e+1===this.sheets.length?t-1:er.usedRange.rowIndex&&(r.usedRange.rowIndex=e,r===this.getActiveSheet()&&this.notify("updateUsedRange",{index:e,update:"row"})),t>r.usedRange.colIndex&&(r.usedRange.colIndex=t,r===this.getActiveSheet()&&this.notify("updateUsedRange",{index:t,update:"col"}))},r.prototype.getData=function(e){return ee(this,e)},r.prototype.getModuleName=function(){return"workbook"},r.prototype.getValueRowCol=function(e,r,n,i){var a={action:"getSheetInfo",sheetInfo:[]};if(this.notify(Et,a),-1===le(this,"Sheet"+(e+1),a.sheetInfo)){var o={action:"getReferenceError",refError:""};return this.notify(Et,o),o.refError}var s=ce(this,e=oe(this,e+1)),l=$(r-1,n-1,s);if(i&&i.includes("!")&&!l&&s.ranges&&s.ranges.length){var h;if(this.formulaRefCell&&this.formulaRefCell===i)return l&&l.value;if(s.ranges.forEach(function(e){if(!e.info||!e.info.loadedRange||!e.info.loadedRange.length)return void(h=!0)}),h){if(this.formulaRefCell=i,e=oe(this,Number(i[i.length-1])+1),t.isNullOrUndefined(e))return l&&l.value;i=i.substring(i.lastIndexOf("!")+1,i.length-1),ee(this,s.name+"!A1:"+g(r-1,n-1),null,null,null,null,i,e)}}else l&&l.formula&&t.isNullOrUndefined(l.value)&&this.notify("calculateFormula",{cell:l,rowIdx:r-1,colIdx:n-1,sheetIndex:e});return l&&l.value},r.prototype.setValueRowCol=function(e,t,r,n){e=oe(this,e),this.notify("workbookEditOperation",{action:"updateCellValue",address:[r-1,n-1],value:t,sheetIndex:e,isValueOnly:!0})},r.prototype.open=function(e){this.notify("workbookOpen",e)},r.prototype.openFromJson=function(e){this.isOpen=!0;var t="object"==typeof e.file?JSON.stringify(e.file):e.file;this.notify("workbookOpen",{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=xn({},t,e,{customParams:{},isFullPost:!0,needBlobData:!1,cancel:!1});this.trigger("beforeSave",r),this.notify(ir,{eventArgs:r,action:"beforeSave"}),r.cancel||this.notify("beginSave",{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("onSave",function(r){r.cancel=!0,e.off("onSave"),t({jsonObject:{Workbook:r.jsonObject}}),e.notify("saveCompleted",r)}),e.save()})},r.prototype.addHyperlink=function(e,t){var r={hyperlink:e,cell:t};this.notify("setLinkModel",r)},r.prototype.findHandler=function(e){"next"===e.findOpt?this.notify("findNext",e):"prev"===e.findOpt&&this.notify("findPrevious",e)},r.prototype.replaceHandler=function(e){"replace"===e.replaceBy?this.notify("replace",e):this.notify("replaceAll",e)},r.prototype.protectSheet=function(e,t){this.notify("protectsheetHandler",t)},r.prototype.unprotectSheet=function(e){var t={sheet:e};this.notify("unprotectsheetHandler",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(kt,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(ir,{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(Ft,{rules:e,range:t}),delete r.cancel,this.notify(nr,{eventArgs:r,action:"validation"}))},r.prototype.removeDataValidation=function(e){this.notify(Dt,{range:e})},r.prototype.addInvalidHighlight=function(e){this.notify("addHighlight",{range:e})},r.prototype.removeInvalidHighlight=function(e){this.notify("removeHighlight",{range:e})},r.prototype.conditionalFormat=function(e){e.range=e.range||this.getActiveSheet().selectedRange,this.notify(Bt,{conditionalFormat:e})},r.prototype.clearConditionalFormat=function(e){e=e||this.getActiveSheet().selectedRange,this.notify(Mt,{range:e})},r.prototype.updateCell=function(e,t){var r,n=y(t);t.includes("!")?void 0===(r=ae(this,t.split("!")[0]))&&(r=this.activeSheetIndex):r=this.activeSheetIndex,Z(n[0],n[1],this.sheets[r],e,!0),e.value&&this.notify("workbookEditOperation",{action:"updateCellValue",address:n,value:e.value,sheetIndex:r})},r.prototype.wrap=function(e,t){void 0===t&&(t=!0),Q(e,t,this)},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify(Et,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(Et,r),r.isRemoved},r.prototype.clearRange=function(e,r,n){void 0===n&&(n=!0),ie(this,e||this.getActiveSheet().selectedRange,t.isNullOrUndefined(r)?this.activeSheetIndex:r,n)},r.prototype.insertImage=function(e,t){this.notify("setImage",{options:e,range:t||this.getActiveSheet().selectedRange})},r.prototype.insertChart=function(e){this.notify(Ut,{chart:e})},r.prototype.deleteChart=function(e){this.notify(cr,{id:e})},r.prototype.filter=function(e,t){if(!this.allowFiltering)return Promise.reject();var r={args:{range:t||this.getActiveSheet().selectedRange,filterOptions:e,cancel:!1},promise:new Promise(function(e,t){e(void 0)})};return this.notify("initiateFilter",r),r.promise},r.prototype.clearFilter=function(){this.notify("clearAllFilter",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(Et,r)},r.prototype.clear=function(e){this.notify("clear",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("getFormattedCell",t),t.formattedText}return!e.value&&e.hyperlink?"string"==typeof e.hyperlink?e.hyperlink:e.hyperlink.address:e.value?e.value.toString():""},r.prototype.freezePanes=function(e,t,r){void 0===e&&(e=1),void 0===t&&(t=1);var n=this.getSheetModel(r);n.frozenRows===e&&n.frozenColumns===t||(this.setSheetPropertyOnMute(n,"frozenRows",e),this.setSheetPropertyOnMute(n,"frozenColumns",t),this.updateTopLeftCell(),n.name===this.getActiveSheet().name&&this.notify("dataRefresh",null))},r.prototype.Unfreeze=function(e){this.freezePanes(0,0,e)},r.prototype.updateTopLeftCell=function(e,r,n,i){i||(i=this.getActiveSheet());var a=u(i.topLeftCell);i.frozenRows||i.frozenColumns?(t.isNullOrUndefined(e)&&(e=i.frozenRows?0:a[0]),t.isNullOrUndefined(r)&&(r=i.frozenColumns?0:a[1]),e+=this.frozenRowCount(i),r+=this.frozenColCount(i),n&&("row"===n?e=u(i.paneTopLeftCell)[0]:r=u(i.paneTopLeftCell)[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r)),i.frozenRows&&(e=a[0]),i.frozenColumns&&(r=a[1])):(t.isNullOrUndefined(e)&&(e=a[0]),t.isNullOrUndefined(r)&&(r=a[1]),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(e,r))),this.setSheetPropertyOnMute(i,"topLeftCell",g(e,r))},r.prototype.getAddressInfo=function(e){return S(this,e)},r.prototype.setSheetPropertyOnMute=function(e,t,r){this.isProtectedOnChange=!0,e[t]=r,this.isProtectedOnChange=!1},r.prototype.frozenRowCount=function(e){return e.frozenRows?"A1"===e.topLeftCell?e.frozenRows:u(e.topLeftCell)[0]+e.frozenRows:0},r.prototype.frozenColCount=function(e){return e.frozenColumns?"A1"===e.topLeftCell?e.frozenColumns:u(e.topLeftCell)[1]+e.frozenColumns:0};var n;return wn([t.Collection([],Cn)],r.prototype,"sheets",void 0),wn([t.Property(0)],r.prototype,"activeSheetIndex",void 0),wn([t.Property("100%")],r.prototype,"height",void 0),wn([t.Property(!0)],r.prototype,"allowFindAndReplace",void 0),wn([t.Property()],r.prototype,"filterCollection",void 0),wn([t.Property()],r.prototype,"sortCollection",void 0),wn([t.Property("100%")],r.prototype,"width",void 0),wn([t.Property(!0)],r.prototype,"showRibbon",void 0),wn([t.Property(!0)],r.prototype,"showFormulaBar",void 0),wn([t.Property(!0)],r.prototype,"showSheetTabs",void 0),wn([t.Property(!0)],r.prototype,"allowEditing",void 0),wn([t.Property(!0)],r.prototype,"allowOpen",void 0),wn([t.Property(!0)],r.prototype,"allowSave",void 0),wn([t.Property(!0)],r.prototype,"allowSorting",void 0),wn([t.Property(!0)],r.prototype,"allowFiltering",void 0),wn([t.Property(!0)],r.prototype,"allowNumberFormatting",void 0),wn([t.Property(!0)],r.prototype,"allowCellFormatting",void 0),wn([t.Property(!0)],r.prototype,"allowHyperlink",void 0),wn([t.Property(!0)],r.prototype,"allowInsert",void 0),wn([t.Property(!0)],r.prototype,"allowDelete",void 0),wn([t.Property(!0)],r.prototype,"allowMerge",void 0),wn([t.Property(!0)],r.prototype,"allowDataValidation",void 0),wn([t.Property(!0)],r.prototype,"allowImage",void 0),wn([t.Property(!0)],r.prototype,"allowChart",void 0),wn([t.Property(!0)],r.prototype,"allowConditionalFormat",void 0),wn([t.Complex({},Yr)],r.prototype,"cellStyle",void 0),wn([t.Property("")],r.prototype,"openUrl",void 0),wn([t.Property("")],r.prototype,"saveUrl",void 0),wn([t.Property("")],r.prototype,"password",void 0),wn([t.Property(!1)],r.prototype,"isProtected",void 0),wn([t.Collection([],$r)],r.prototype,"definedNames",void 0),wn([t.Event()],r.prototype,"beforeOpen",void 0),wn([t.Event()],r.prototype,"openFailure",void 0),wn([t.Event()],r.prototype,"beforeSave",void 0),wn([t.Event()],r.prototype,"saveComplete",void 0),wn([t.Event()],r.prototype,"beforeCellFormat",void 0),wn([t.Event()],r.prototype,"queryCellInfo",void 0),r=n=wn([t.NotifyPropertyChanges],r)}(t.Component),En=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)}}(),Rn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},kn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return En(r,e),Rn([t.Collection([],fn)],r.prototype,"cells",void 0),Rn([t.Property(0)],r.prototype,"index",void 0),Rn([t.Property(20)],r.prototype,"height",void 0),Rn([t.Property(!1)],r.prototype,"customHeight",void 0),Rn([t.Property(!1)],r.prototype,"hidden",void 0),Rn([t.Complex({},en)],r.prototype,"format",void 0),r}(t.ChildProperty),An=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)}}(),Tn=function(e,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},Fn=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return An(r,e),Tn([t.Property(0)],r.prototype,"index",void 0),Tn([t.Property(64)],r.prototype,"width",void 0),Tn([t.Property(!1)],r.prototype,"customWidth",void 0),Tn([t.Property(!1)],r.prototype,"hidden",void 0),Tn([t.Complex({},en)],r.prototype,"format",void 0),Tn([t.Property(!0)],r.prototype,"isLocked",void 0),Tn([t.Property("")],r.prototype,"validation",void 0),r}(t.ChildProperty),Ln=null,Nn=["e-ribbon","e-formula-bar-panel","e-sheet-tab-panel","e-header-toolbar"],Dn={role:"role",selected:"aria-selected",multiselectable:"aria-multiselectable",busy:"aria-busy",colcount:"aria-colcount"},On=function(){function e(e){this.externalMerge=!1,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(Zt,this.cut,this),this.parent.on("copy",this.copy,this),this.parent.on(Jt,this.paste,this),this.parent.on("clearCopy",this.clearCopiedInfo,this),this.parent.on("tabSwitch",this.tabSwitchHandler,this),this.parent.on(Kt,this.cMenuBeforeOpenHandler,this),this.parent.on("ribboClick",this.ribbonClickHandler,this),this.parent.on("contentLoaded",this.initCopyIndicator,this),this.parent.on(Qt,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(Zt,this.cut),this.parent.off("copy",this.copy),this.parent.off(Jt,this.paste),this.parent.off("clearCopy",this.clearCopiedInfo),this.parent.off("tabSwitch",this.tabSwitchHandler),this.parent.off(Kt,this.cMenuBeforeOpenHandler),this.parent.off("ribboClick",this.ribbonClickHandler),this.parent.off("contentLoaded",this.initCopyIndicator),this.parent.off(Qt,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})}Ct(this.parent.element)},e.prototype.tabSwitchHandler=function(e){0!==e.activeTab||this.copiedInfo||this.copiedShapeInfo||this.hidePaste()},e.prototype.cMenuBeforeOpenHandler=function(e){var t=this.parent.getActiveSheet(),r=this.parent.serviceLocator.getService(ki),n=[],i=[],a=[],o=[],s=u(t.activeCell),l=$(s[0],s[1],t),h=t.isProtected&&X(l,Ie(t,s[1]));"Content"!==e.target&&"RowHeader"!==e.target&&"ColumnHeader"!==e.target||(this.parent.enableContextMenuItems([r.getConstant("Paste"),r.getConstant("PasteSpecial")],!!(this.copiedInfo||this.copiedShapeInfo&&!h)),this.parent.enableContextMenuItems([r.getConstant("Cut")],!h)),"Content"===e.target&&h&&this.parent.enableContextMenuItems([r.getConstant("Cut"),r.getConstant("Filter"),r.getConstant("Sort")],!1),"Content"===e.target&&h&&!t.protectSettings.insertLink&&this.parent.enableContextMenuItems([r.getConstant("Hyperlink")],!1),"ColumnHeader"===e.target&&t.isProtected&&(a=[r.getConstant("DeleteColumn"),r.getConstant("DeleteColumns"),r.getConstant("InsertColumn"),r.getConstant("InsertColumns")],o=[r.getConstant("HideColumn"),r.getConstant("HideColumns"),r.getConstant("UnHideColumns")],this.parent.enableContextMenuItems(a,!1),this.parent.enableContextMenuItems(o,!!t.protectSettings.formatColumns)),"RowHeader"===e.target&&t.isProtected&&(n=[r.getConstant("DeleteRow"),r.getConstant("DeleteRows"),r.getConstant("InsertRow"),r.getConstant("InsertRows")],i=[r.getConstant("HideRow"),r.getConstant("HideRows"),r.getConstant("UnHideRows")],this.parent.enableContextMenuItems(n,!1),this.parent.enableContextMenuItems(i,!!t.protectSettings.formatRows))},e.prototype.rowHeightChanged=function(e){if(this.copiedInfo&&this.copiedInfo.range[0]>e.rowIdx){var t=this.parent.element.getElementsByClassName("e-copy-indicator")[0];t&&(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.copiedSheet=this.parent.getActiveSheet(),this.setCopiedInfo(e,!1)},e.prototype.paste=function(e){if(!(this.parent.isEdit||this.parent.element.getElementsByClassName("e-dialog").length>0)){var r;e.isAction=!0;var n,i=e&&e.clipboardData||window.clipboardData,a=this.getCopiedIdx(),o=Object.assign({},this.copiedInfo);if(i||this.copiedShapeInfo||e.isInternal&&this.copiedInfo){var s=e&&e.sIdx>-1?e.sIdx:this.parent.activeSheetIndex,l=ce(this.parent,s),h=x(e&&e.range||c(l.selectedRange)),d=i&&this.getExternalCells(e);if(!e.isInternal&&d&&d.internal&&(i=!1,!this.copiedInfo))return;if(i&&!d.length)return;var p=0;if(d)for(H=0;Hp?d[H].cells.length:p;var u=h[0],f=i?[0,0,d.length-1,p-1]:x(this.copiedShapeInfo?c(l.selectedRange):this.copiedInfo.range),v=(h[2]-h[0]+1)%(f[2]-f[0]+1)==0&&(h[3]-h[1]+1)%(f[3]-f[1]+1)==0;r=v?h:[h[0],h[1]].concat([h[0]+f[2]-f[0],h[1]+f[3]-f[1]||h[1]]);var y={requestType:"paste",copiedInfo:this.copiedInfo,copiedRange:m(f),pastedRange:m(r),type:e&&e.type||"All",cancel:!1};if(e.isAction&&!this.copiedShapeInfo&&this.copiedInfo&&this.parent.notify(ir,{eventArgs:y,action:"clipboard"}),y.cancel)return;var C=void 0,b=void 0,S=void 0,w=[],E=ce(this.parent,i?s:a),R=I(f)&&this.isRangeMerged(h,l);u=(h=c(y.pastedRange))[0];var k={range:f=i?[0,0,d.length-1,p-1]:x(this.copiedShapeInfo?c(l.selectedRange):this.copiedInfo.range),prevSheet:E,cancel:!1};if(r=(v=(h[2]-h[0]+1)%(f[2]-f[0]+1)==0&&(h[3]-h[1]+1)%(f[3]-f[1]+1)==0&&!R)?h:[h[0],h[1]].concat([h[0]+f[2]-f[0],h[1]+f[3]-f[1]||h[1]]),this.parent.getActiveSheet().isProtected&&bt(this.parent,r))return void this.parent.notify("editAlert",null);if(this.copiedShapeInfo&&!this.copiedInfo){var A=this.copiedShapeInfo.pictureElem;A.classList.contains("e-datavisualization-chart")?(this.copiedShapeInfo.chartInfo.top=null,this.copiedShapeInfo.chartInfo.left=null,this.parent.notify(Ut,{chart:[this.copiedShapeInfo.chartInfo],isInitCell:!0,isUndoRedo:!0,isPaste:!0,dataSheetIdx:this.copiedShapeInfo.sheetIdx,isCut:this.copiedShapeInfo.isCut,range:e.range||l.selectedRange,isIdAvailabe:!1})):this.parent.notify(dr,{options:{src:A.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:this.copiedShapeInfo.height,width:this.copiedShapeInfo.width,imageId:this.copiedShapeInfo.isCut?A.id:""},range:m([u,h[1],u,h[1]]),isPublic:!1,isUndoRedo:!0});var T=$(u,h[1],l);if(T&&!t.isNullOrUndefined(T.image)){var F=T.image?T.image.length-1:0,L={requestType:"imagePaste",copiedShapeInfo:this.copiedShapeInfo,pasteSheetIndex:this.parent.activeSheetIndex,pastedRange:ve(this.parent)+"!"+m([u,h[1],u,h[1]]),pastedPictureElement:document.getElementById(T.image[F].id)};this.parent.notify(nr,{eventArgs:L,action:"clipboard"})}}else{if(this.parent.notify("pasteMerge",k),k.cancel)return;for(var N=y.type?y.type:e.type,D=[],O=this.isInRange(f,h,a),H=f[0],B=0;H<=f[2];H++,B++)if(O&&(D[h[0]+B]={cells:[]}),be(this.parent.getActiveSheet(),H))h[2]=h[2]-1,B-=1;else{for(var M=f[1],P=0;M<=f[3];M++,P++){if(O&&(D[h[0]+B].cells[h[1]+P]=$(h[0]+B,h[1]+P,E)),C=i?d[H].cells[M]:Object.assign({},O&&D[H]&&D[H].cells[M]?D[H].cells[M]:$(H,M,E)),this.copiedCell=[H,M],C&&e&&e.type||N){switch(N){case"Formats":C={format:C.format,style:C.style};break;case"Values":(C={value:C.value}).value&&C.value.toString().indexOf("\n")>-1&&this.parent.getCell(h[0],h[1]).classList.add("e-alt-unwrap")}b=["Formats","Values"].indexOf(e.type)>-1}if(!this.parent.scrollSettings.isFinite&&(f[2]-f[0]>1048575-h[0]||f[3]-f[1]>16383-h[1])||this.parent.scrollSettings.isFinite&&(f[2]-f[0]>l.rowCount-1-h[0]||f[3]-f[1]>l.colCount-1-h[1]))return void this.showDialog();if(v)for(var _=h[0];_<=h[2];_+=f[2]-f[0]+1)for(var U=h[1];U<=h[3];U+=f[3]-f[1]+1){if(S=$(_+B,U+P,l)||{},!this.externalMerge&&void 0!==S.colSpan||void 0!==S.rowSpan){var V={range:(k={range:[_+B,U+P,_+B,U+P]}).range,merge:!1,isAction:!1,type:"All"};w.push(V),this.parent.activeSheetIndex===l.index&&this.parent.notify(Ht,V)}var z=U+P;if(this.externalMerge&&this.externalMergeRow===_+B?z+=1:this.externalMerge=!1,!b){var q=this.isFormula([_+B,z]);t.isNullOrUndefined(q)||(C.formula=q)}var j=!1;if(this.parent.filteredRows&&this.parent.filteredRows.rowIdxColl&&this.parent.filteredRows.sheetIdxColl)for(var W=0,Y=this.parent.filteredRows.sheetIdxColl.length;W1||r.rowSpan>1)){var n={range:e.slice(2,4).concat(e.slice(2,4))};return this.parent.notify("activeCellMergedRange",n),n.range[0]===e[0]&&n.range[1]===e[1]&&n.range[2]===e[2]&&n.range[3]===e[3]}return!1},e.prototype.updateFilter=function(e,t){var r,n;this.parent.notify("getFilteredCollection",null);for(var i=0;i-1&&o>-1&&(r=r.slice(a+1,o));for(var s=[],l=["+","-","*","/"],h=void 0,d=r,p=0;pd&<(this.parent,r,p,e)}},e.prototype.getCopiedIdx=function(){if(this.copiedInfo){for(var e=0;e0){var r={clientY:d[0].offsetTop,isImage:!0};i.parent.notify("getRowIdxFromClientY",r);var l={clientX:d[0].offsetLeft,isImage:!0};i.parent.notify("getColIdxFromClientX",l),i.copiedShapeInfo={sId:e&&e.sId?e.sId:s.id,sheetIdx:s.index,isCut:n,pictureElem:d[0],copiedRange:m([r.clientY,l.clientX,r.clientY,l.clientX]),height:d[0].offsetHeight,width:d[0].offsetWidth,chartInfo:i.getChartElemInfo(d[0])},i.hidePaste(!0),n&&(d[0].classList.contains("e-datavisualization-chart")?i.parent.deleteChart(i.copiedShapeInfo.chartInfo.id):i.parent.notify(pr,{id:i.copiedShapeInfo.pictureElem.id,sheetIdx:i.copiedShapeInfo.sId,range:i.copiedShapeInfo.copiedRange}))}else e&&e.clipboardData||(i.copiedInfo&&i.clearCopiedInfo(),i.copiedInfo={range:o,sId:e&&e.sId?e.sId:s.id,isCut:n},i.hidePaste(!0),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),a.resolve()}),e&&e.clipboardData&&(this.setExternalCells(e),Ct(this.parent.element))}},e.prototype.getChartElemInfo=function(e){var t=this.parent.chartColl;if(e.classList.contains("e-datavisualization-chart"))for(var r=e.getElementsByClassName("e-control")[0].id,n=0;n',s=i[0];s<=i[2];s++){o+="";for(var l=i[1];l<=i[3];l++){if(r=$(s,l,a),o+='",n+=l===i[3]?"":"\t"}o+="",n+=s===i[2]?"":"\n"}o+="
',r&&r.value){var h={formattedText:r.value,value:r.value,format:r.format,onLoad:!0};r.format&&this.parent.notify("getFormattedCell",h),o+=h.formattedText,n+=h.formattedText}o+="
",t.Browser.isIE?window.clipboardData.setData("text",n):(e.clipboardData.setData("text/html",o),e.clipboardData.setData("text/plain",n),e.preventDefault())},e.prototype.getExternalCells=function(e){var r,n,i,a=this,o=[],s=[],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.querySelector(".e-spreadsheet")&&this.copiedInfo?o={internal:!0}:l.querySelectorAll("tr").forEach(function(e){e.querySelectorAll("td").forEach(function(e,t){i=a.getStyle(e,l),e.textContent=e.textContent.replace(/(\r\n|\n|\r)/gm,"");var r,n=isNaN(parseInt(e.getAttribute("colspan"),10))?1:parseInt(e.getAttribute("colspan"),10),o=isNaN(parseInt(e.getAttribute("rowspan"),10))?1:parseInt(e.getAttribute("rowspan"),10);i.whiteSpace&&(r=!0,delete i.whiteSpace),s[t]={value:e.textContent?D(e.textContent.trim()):null,style:i,colSpan:n,rowSpan:o,wrap:r}}),o.push({cells:s}),s=[]}):n&&(r&&[].slice.call(l.children).forEach(function(e){e.getAttribute("style")&&(i=a.getStyle(e,l))}),n.trim().split("\n").forEach(function(e){e.split("\t").forEach(function(e,t){if(e){var r=void 0;i&&i.whiteSpace&&(r=!0,delete i.whiteSpace),s[t]={style:i,wrap:r},q(e)?s[t].formula=e:s[t].value=D(e.trim())}}),o.push({cells:s}),s=[]})),setTimeout(function(){a.getClipboardEle().innerHTML=""},0),o},e.prototype.getStyle=function(e,t){var r=[],n={},i=Object.keys(this.parent.commonCellStyle);if(e.classList.length||e.getAttribute("style")||i.length){if(t.querySelector("style")&&e.classList.length&&t.querySelector("style").innerHTML.indexOf(e.classList[0])>-1&&r.push(t.querySelector("style").innerHTML.split(e.classList[0])[1].split("{")[1].split("}")[0]),e.getAttribute("style")&&(r.push(e.getAttribute("style")),e.children&&e.children.length))for(var a=0,o=e.children.length;a-1&&(n[i[a]]=h.split(d+":")[1].split(";")[0])}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","border-bottom","border-top","border-right","border-left","border","white-space"].indexOf(t)>-1){var r=(t="background"===t?"backgroundColor":t).match(/-[a-z]/),i=e.split(":")[1];n[r?t.replace(r[0],r[0].charAt(1).toUpperCase()):t]="font-weight"===t&&-1===["bold","normal"].indexOf(i)?i>"599"?"bold":"normal":i}})})}return e.innerHTML.indexOf("")>-1&&(n.textDecoration="line-through"),this.defaultCellStyle(n)},e.prototype.defaultCellStyle=function(e){var t=["underline","line-through","underline line-through","none"],r=["left","center","right"],n=["bottom","middle","top"],i=e.fontSize?e.fontSize.trim():null;return e.textDecoration&&t.indexOf(e.textDecoration.trim())<0&&(e.textDecoration="none"),e.textAlign&&r.indexOf(e.textAlign.trim())<0&&(e.textAlign="left"),e.verticalAlign&&n.indexOf(e.verticalAlign.trim())<0&&(e.verticalAlign="bottom"),i&&(i=i.indexOf("px")>-1?.75*parseFloat(i)+"pt":i,e.fontSize=Math.round(parseFloat(i))+"pt"),e},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}(),Hn=function(){function e(e){this.editorElem=null,this.editCellData={},this.isEdit=!1,this.isCellEdit=!0,this.isNewValueEdit=!0,this.isAltEnter=!1,this.validCharacters=["+","-","*","/",",","(","=","&"],this.formulaBarCurStartPos=null,this.curEndPos=null,this.curStartPos=null,this.selectionStart=null,this.selectionEnd=null,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.addEventListener()}return 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("mouseDown",this.mouseDownHandler,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on(Xt,this.keyDownHandler,this),this.parent.on(Wt,this.performEditOperation,this),this.parent.on("initiateCur",this.initiateCurPosition,this),this.parent.on("editValue",this.updateFormulaBarValue,this),this.parent.on("addressHandle",this.addressHandler,this),this.parent.on("initiateEdit",this.initiateRefSelection,this),this.parent.on("forRefSelRender",this.refSelectionRender,this)},e.prototype.removeEventListener=function(){t.EventHandler.remove(this.parent.element,"dblclick",this.dblClickHandler),this.parent.isDestroyed||(this.parent.off("mouseDown",this.mouseDownHandler),this.parent.off(Yt,this.keyUpHandler),this.parent.off(Xt,this.keyDownHandler),this.parent.off(Wt,this.performEditOperation),this.parent.off("initiateCur",this.initiateCurPosition),this.parent.off("editValue",this.updateFormulaBarValue),this.parent.off("addressHandle",this.addressHandler),this.parent.off("initiateEdit",this.initiateRefSelection),this.parent.off("forRefSelRender",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":if(this.isEdit){var t={isEdit:!1};this.parent.notify("isFormulaBarEdit",t),t.isEdit&&(this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos))}else this.isNewValueEdit=e.isNewValueEdit,this.startEdit(e.address,e.value,e.refreshCurPos);break;case"endEdit":this.isEdit&&this.endEdit(e.refreshFormulaBar);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"getElement":e.element=this.getEditElement(this.parent.getActiveSheet());break;case"focusEditorElem":this.editorElem.focus();break;case"getCurrentEditSheetIdx":e.sheetIndex=this.editCellData.sheetIndex}},e.prototype.keyUpHandler=function(e){if(this.isEdit){var t=this.getEditElement(this.parent.getActiveSheet());if(e.altKey&&13===e.keyCode?(t.focus(),this.altEnter(),this.isAltEnter=!0):this.isCellEdit&&this.editCellData.value!==t.textContent&&16!==e.keyCode&&this.refreshEditor(t.textContent,this.isCellEdit),(q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("="))&&16!==e.keyCode){var r=this.parent.element.querySelector(".e-formularef-indicator");r&&r.parentElement.removeChild(r),this.editCellData.value!==t.textContent&&this.refreshEditor(t.textContent,!0);var n=this.editCellData.sheetIndex,i=this.editCellData.value;this.parent.notify("initiateFormulaReference",{range:i,formulaSheetIdx:n})}}},e.prototype.keyDownHandler=function(e){var r=e.target,n=e.keyCode,i=this.parent.getActiveSheet(),a=u(i.activeCell),o=$(a[0],a[1],i)||{};if(!t.closest(e.target,".e-findtool-dlg")&&!t.closest(e.target,".e-validationerror-dlg")&&!t.closest(e.target,".e-hyperlink-dlg"))if(i.isProtected&&!t.closest(e.target,".e-sheet-rename")&&X(o,Ie(i,a[1]))){if((n>=this.keyCodes.FIRSTALPHABET&&n<=this.keyCodes.LASTALPHABET||n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER||n===this.keyCodes.DELETE||n===this.keyCodes.BACKSPACE||n===this.keyCodes.SPACE||n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD||n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND||n>=219&&n<=222||!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2)&&67!==n&&89!==n&&90!==n){if(i.protectSettings.insertLink&&75===n)return;this.parent.element.querySelector(".e-editAlert-dlg")||e.ctrlKey||70===e.keyCode||r.parentElement.classList.contains("e-unprotectpwd-content")||r.parentElement.classList.contains("e-password-content")||this.parent.notify("editAlert",null)}}else if(this.isEdit){var s=this.getEditElement(i),l=q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=");if((this.isCellEdit||l&&this.editCellData.value!==s.textContent&&16!==e.keyCode)&&(a[1]=this.parent.frozenRowCount(i))&&s&&"auto"!==s.style.height&&dt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)&&(s.style.height="auto"),dt(s.textContent,o.style,this.parent.cellStyle)>parseInt(s.style.maxWidth,10)-5&&(s.style.height="auto"),a[0]parseInt(s.style.maxWidth,10)&&(s.style.overflow="auto"),this.refreshEditor(s.textContent,this.isCellEdit)),!e.altKey)switch(n){case this.keyCodes.ENTER:if(t.Browser.isWindows&&e.preventDefault(),this.isAltEnter){var h=s.textContent;h&&h.indexOf("\n")>-1&&(Q(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(s.textContent,this.isCellEdit),this.isAltEnter=!1)}if(l){var d=this.parent.element.querySelector(".e-formularef-indicator");d&&d.parentElement.removeChild(d),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,c=n>=this.keyCodes.FIRSTNUMBER&&n<=this.keyCodes.LASTNUMBER,f=n>=this.keyCodes.FIRSTNUMPAD&&n<=this.keyCodes.LASTNUMPAD,g=n>=this.keyCodes.SYMBOLSETONESTART&&n<=this.keyCodes.SYMBOLSETONEEND;g||(g=n>=this.keyCodes.SYMBOLSETTWOSTART&&n<=this.keyCodes.SYMBOLSETTWOEND);var m=n===this.keyCodes.FIREFOXEQUALPLUS||n===this.keyCodes.FIREFOXMINUS,v=!e.shiftKey&&!e.ctrlKey&&!e.metaKey&&n===this.keyCodes.F2,y=n===this.keyCodes.BACKSPACE;if(!e.ctrlKey&&!e.metaKey&&!e.altKey&&(!e.shiftKey&&n===this.keyCodes.SPACE||p||c||f||g||"mozilla"===t.Browser.info.name&&m)||v||y){v&&(this.isNewValueEdit=!1);var C=document.getElementsByClassName("e-ss-overlay-active");C.length>0?n===this.keyCodes.DELETE&&this.parent.notify(pr,{id:C[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.startEdit(null,null,!0,!0)}n===this.keyCodes.DELETE&&(i.isProtected&&bt(this.parent)?this.parent.notify("editAlert",null):(this.editingHandler("delete"),this.parent.notify("activeCellChanged",null)))}},e.prototype.renderEditor=function(){if(!this.editorElem||!t.select("#"+this.parent.element.id+"_edit",this.parent.element)){var e=this.parent.createElement("div",{id:this.parent.element.id+"_edit",className:"e-spreadsheet-edit"});e.contentEditable="true",e.spellcheck=!1,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(e),this.editorElem=e}this.parent.notify("formulaOperation",{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;var a=this.getEditElement(this.parent.getActiveSheet());r&&(a.textContent=e),t&&this.parent.notify("formulaBarOperation",{action:"refreshFormulabar",value:e}),i&&this.editCellData.value===a.textContent&&this.triggerEvent("cellEditing")&&this.cancelEdit()},e.prototype.startEdit=function(e,t,r,n){void 0===r&&(r=!0),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true");var i=this.parent.getActiveSheet(),a=u(i.activeCell),o=$(a[0],a[1],i,!1,!0);if(st(this.parent,a[0],a[1],this.parent.activeSheetIndex)){var s=this.parent.getCell(a[0],a[1]),l=!1,h=s.innerHTML;if(s&&h.indexOf("<")>-1&&h.indexOf(">")>-1&&h.indexOf("input")>-1&&(l=!0),l)return}this.updateEditCellDetail(e,t),this.initiateEditor(r),this.positionEditor(),this.parent.isEdit=this.isEdit=!0,this.parent.notify("clearCopy",null),this.parent.notify("enableToolbarItems",[{enable:!1}]),o.formula&&!n&&this.parent.notify("initiateFormulaReference",{range:o.formula,formulaSheetIdx:this.editCellData.sheetIndex})},e.prototype.setCursorPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet()),t=e.textContent.length;if(t){var r=document.getSelection(),n=document.createRange();n.setStart(e.firstChild,t),n.collapse(!0),r.removeAllRanges(),r.addRange(n)}e.focus()},e.prototype.hasFormulaSuggSelected=function(){var e=document.getElementById(this.parent.element.id+"_ac_popup");return e&&"visible"===e.style.visibility&&e.querySelectorAll(".e-item-focus").length>0},e.prototype.editingHandler=function(e){var t=document.getElementsByClassName("e-ss-overlay-active"),r=t.length;switch(e){case"delete":if(r>0)t[0].classList.contains("e-datavisualization-chart")?this.parent.notify(cr,{id:t[0].id,sheetIdx:this.parent.activeSheetIndex+1}):this.parent.notify(pr,{id:t[0].id,sheetIdx:this.parent.activeSheetIndex+1});else{var n=this.parent.getActiveSheet(),i=n.selectedRange;this.parent.notify(ir,{action:"cellDelete",eventArgs:{address:n.name+"!"+i}});var a=y(i);i=m(a=a[0]>a[2]?x(a):a),this.parent.clearRange(i,null,!0),this.parent.serviceLocator.getService("cell").refreshRange(a),this.parent.notify("selectionComplete",{}),this.parent.notify(nr,{action:"cellDelete",eventArgs:{address:n.name+"!"+i}})}}},e.prototype.mouseDownHandler=function(e){if(!t.closest(e.target,".e-findtool-dlg")&&this.isEdit){var r=window.getSelection();if(this.editorElem.textContent===this.editCellData.value){if(this.selectionStart=r.anchorOffset,this.selectionEnd=r.focusOffset,this.selectionStart>this.selectionEnd){var n=this.selectionStart;this.selectionStart=this.selectionEnd,this.selectionEnd=n}this.curStartPos=this.selectionStart,this.curEndPos=this.selectionEnd}if(r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")&&this.editorElem.textContent===this.editCellData.value){var i=r.focusNode.getElementsByClassName("e-formula-bar e-css")[0];this.selectionStart=i.selectionStart,this.selectionEnd=i.selectionEnd,this.curStartPos=this.selectionStart,this.curEndPos=this.selectionEnd}var a=e.target,o=this.parent.getActiveSheet(),s=this.parent.element.querySelector(".e-formularef-indicator");this.isCellEdit=a.classList.contains("e-spreadsheet-edit");var l=q(this.editCellData.value)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("="),h=this.getEditElement(o);if(a.classList.contains("e-cell")||a.classList.contains("e-header-cell")||a.classList.contains("e-selectall")||t.closest(a,".e-toolbar-item.e-active")||t.closest(a,".e-table")){if(this.isAltEnter){var d=h.textContent;d&&d.indexOf("\n")>-1&&(this.isAltEnter=!1,Q(this.parent.getActiveSheet().selectedRange,!0,this.parent),this.refreshEditor(h.textContent,this.isCellEdit))}if(l){var p=this.selectionEnd,c=u(o.activeCell),f=$(c[0],c[1],o);if(this.selectionStart!==this.selectionEnd&&this.editCellData.value===h.textContent&&-1!==this.validCharacters.indexOf(h.textContent.substring(this.selectionStart-1,this.selectionStart))&&j(h.textContent.substring(this.selectionStart,this.selectionEnd))&&h.textContent.indexOf(":")!==this.selectionEnd&&(this.editCellData.value=h.textContent.substring(0,this.selectionStart)+h.textContent.substring(this.selectionEnd,h.textContent.length)),this.editCellData.value===h.textContent&&h.textContent.indexOf("(")!==h.textContent.length-1&&-1!==h.textContent.indexOf("(")&&this.selectionStart===this.selectionEnd)if(this.editCellData.sheetIndex!==o.id-1){var g=this.parent.element.querySelector(".e-formula-bar");if(","!==h.textContent.substring(g.selectionEnd-1,g.selectionEnd)&&!e.shiftKey)return s&&s.parentElement.removeChild(s),this.parent.goTo(this.editCellData.fullAddr),void this.endEdit(!1,e)}else if(-1===this.validCharacters.indexOf(h.textContent.substring(p-1,p)))return s&&s.parentElement.removeChild(s),void this.endEdit(!1,e);if(!f)return;if((l=!!f.formula&&(q($(c[0],c[1],o).formula)||this.editCellData.value&&0===this.editCellData.value.toString().indexOf("=")))&&this.parent.isEdit){var m=this.selectionEnd;this.editCellData.value.length===m?(")"===this.editCellData.value.substring(this.editCellData.value.length-1)||L(this.editCellData.value.substring(this.editCellData.value.length-1)))&&(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)):this.editCellData.value===h.textContent&&(-1===this.validCharacters.indexOf((this.editCellData.value+o.selectedRange).substring(m-1,m))?(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)):(-1===this.validCharacters.indexOf(h.textContent.substring(m-1,m))||")"!==h.textContent.substring(m,m+1)&&-1===this.validCharacters.indexOf(h.textContent.substring(m,m+1)))&&(s&&s.parentElement.removeChild(s),this.endEdit(!1,e)))}}else this.endEdit(!1,e)}else if(l&&this.editCellData.value===h.textContent&&h.textContent.indexOf("(")!==h.textContent.length-1&&!this.isCellEdit&&-1===this.validCharacters.indexOf(this.editCellData.value.substring(this.selectionStart-1,this.selectionStart))&&this.editCellData.sheetIndex===o.id-1){p=window.getSelection().focusOffset;if(-1===this.validCharacters.indexOf(h.textContent.substring(p-1,p)))return s&&s.parentElement.removeChild(s),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=u(n.activeCell),a=$(i[0],i[1],n)||{};if(!t.closest(r,".e-datavisualization-chart"))if(n.isProtected&&X(a,Ie(n,i[1])))(r.classList.contains("e-active-cell")||r.classList.contains("e-cell"))&&this.parent.notify("editAlert",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")||r.classList.contains("e-table")))if(this.isEdit)if(q(this.editCellData.value)){var o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name===o&&this.endEdit()}else this.endEdit();else this.isNewValueEdit=!1,this.startEdit()},e.prototype.updateEditCellDetail=function(e,t){var r,n;if(this.editCellData.sheetIndex||(r=e&&e.split("!").length>1?ae(this.parent,se(e)):this.parent.activeSheetIndex),this.editCellData.addr?q(this.editCellData.value)&&(n=ce(this.parent,r),this.isNewValueEdit=!1):(n=ce(this.parent,r),e=e?C(e):n.activeCell),e){var i=c(e),a=i[0],o=i[1],s=this.parent.getCell(a,o),l=Pe(n,i,this.parent.frozenRowCount(n),this.parent.frozenColCount(n),this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);this.editCellData={addr:e,fullAddr:ve(this.parent,r)+"!"+e,rowIndex:a,colIndex:o,sheetIndex:r,element:s,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){var i={cell:n,value:n?n.value:""};r.parent.notify("getFormattedBarText",i);var a=n?i.value:"";n&&n.formula&&(a=n.formula),r.editCellData.oldValue=a,r.editCellData.value?a=r.editCellData.value:r.editCellData.value=a,r.isNewValueEdit?a="":r.isNewValueEdit=!0,t.isUndefined(a)||r.refreshEditor(a,!1,!0,!1,!1),e&&r.setCursorPosition(),r.triggerEvent("cellEdit")&&r.cancelEdit(!0,!1)})})},e.prototype.positionEditor=function(e){var r,n=this.editCellData.element,i={isEdit:!1};if(this.parent.notify("isFormulaBarEdit",i),i.isEdit&&t.isNullOrUndefined(n)&&(n=r=this.parent.getCell(this.editCellData.rowIndex,this.editCellData.colIndex),this.editCellData.element=r),n){n.classList.add("e-ss-edited");var a=this.parent.getActiveSheet(),o=$(this.editCellData.rowIndex,this.editCellData.colIndex,a,!1,!0),s=this.editCellData.position.left+1,l=this.editCellData.position.top+1,h={range:[this.editCellData.rowIndex,this.editCellData.colIndex,this.editCellData.rowIndex,this.editCellData.colIndex]};this.parent.notify("activeCellMergedRange",h);var d=we(a,h.range[0],h.range[2])-3,p=ke(a,h.range[1],h.range[3])-3,c=this.parent.element.getElementsByClassName("e-main-panel")[0],u=void 0,f=this.parent.frozenColCount(a),g=void 0,m=void 0,v=this.parent.frozenRowCount(a),y=void 0;this.editCellData.colIndexu&&(y=!0)):u=c.offsetWidth-s-28-this.parent.sheetModule.getRowHeaderWidth(a),this.editCellData.rowIndexu||n&&e)?"overflow: auto;":"");b+=n.style.cssText;var S=this.getEditElement(a,!0);S.setAttribute("style",b),dt(S.textContent,o.style,this.parent.cellStyle)>u&&(S.style.height="auto"),this.parent.element.querySelector(".e-active-cell").style.height=d+4+"px",n.classList.contains("e-right-align")?S.classList.add("e-right-align"):n.classList.contains("e-center-align")&&S.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,a=c(this.parent.getActiveSheet().activeCell),o=this.parent.getActiveSheet(),s=$(a[0],a[1],o),l=Ie(o,a[1]);if(this.parent.notify("setActionData",{args:{action:"beforeCellSave",eventArgs:{address:this.editCellData.addr}}}),this.parent.allowDataValidation&&(s&&s.validation||l&&l.validation)){var h=this.getEditElement(o).innerText,d=this.parent.activeSheetIndex,p=void 0;p="string"==typeof i?c(i):i,this.parent.notify("isValidation",{value:h,range:p,sheetIdx:d,isCell:!0}),n=this.parent.allowDataValidation,this.editCellData.value=n?h: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 u=this.parent.getActiveSheet(),f=c(u.activeCell);this.parent.notify("workbookEditOperation",{action:"updateCellValue",address:this.editCellData.addr,value:this.editCellData.value});var g=$(f[0],f[1],u,!0),m=this.getRefreshNodeArgs(g);this.editCellData.value=m.value,g&&g.formula&&(this.editCellData.formula=g.formula),g&&g.wrap&&this.parent.notify(At,{range:f,wrap:!0,sheet:u}),e&&this.parent.refreshNode(this.editCellData.element,m)}return this.parent.allowConditionalFormat&&this.parent.notify("checkConditionalFormat",{rowIdx:a[0],colIdx:a[1],cell:s}),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=$(e,t,ce(this.parent,r)),a=this.getRefreshNodeArgs(i);this.parent.refreshNode(n,a)}}},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("getFormattedCell",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){void 0===e&&(e=!1);var r=u(this.parent.getActiveSheet().activeCell),n=this.parent.getCell(r[0],r[1]),i="";if(this.editCellData.element&&this.editCellData.element.children[0]&&"e-cf-databar"===this.editCellData.element.children[0].className&&(i=n.children[0].querySelector(".e-databar-value").style.fontSize),e&&this.refreshEditor(this.editCellData.oldValue,!1,!0,!1,!1),this.triggerEvent("beforeCellSave"))return void t.preventDefault();this.updateEditedValue()?(this.triggerEvent("cellSave",t),this.resetEditState(),this.focusElement()):t&&t.preventDefault(),""!==i&&(n.children[0].querySelector(".e-databar-value").style.fontSize=i),this.parent.showSheetTabs&&!this.parent.isProtected&&this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled")},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(){Ct(this.parent.element),this.parent.notify("enableToolbarItems",[{enable:!0}])},e.prototype.triggerEvent=function(e,t){var r=$(this.editCellData.rowIndex,this.editCellData.colIndex,this.parent.getActiveSheet()),n={element:this.editCellData.element,value:this.editCellData.value,oldValue:this.editCellData.oldValue,address:this.editCellData.fullAddr,displayText:this.parent.getDisplayText(r)};return n.value!==n.oldValue&&("cellSave"===e&&(this.editCellData.formula&&(n.formula=this.editCellData.formula),n.originalEvent=t,this.parent.notify(nr,{eventArgs:n,action:"cellSave"})),"cellSave"!==e&&(n.cancel=!1)),this.parent.trigger(e,n),n.cancel},e.prototype.altEnter=function(){this.positionEditor(!0);var e,t=window.getSelection(),r=t.anchorNode,n=document.createRange();0===(e=3===r.nodeType?t.anchorOffset:r.textContent.length)&&r.textContent.length>0&&(e=r.textContent.length);var i=r.textContent,a=i.slice(0,e),o=i.slice(e)||" ";r.textContent=a+"\n"+o,n=document.createRange(),3===r.nodeType?(n.setStart(r,e+1),n.setEnd(r,e+1)):1===r.nodeType&&(n.setStart(r.firstChild,e+1),n.setEnd(r.firstChild,e+1)),t.removeAllRanges(),t.addRange(n)},e.prototype.resetEditState=function(e){if(void 0===e&&(e=!0),e){var r=this.getEditElement(this.parent.getActiveSheet());q(r.textContent)&&this.parent.notify("clearCellRef",null),this.editCellData.element&&(this.editCellData.element.classList.remove("e-ss-edited"),this.editorElem.textContent="",r===this.editorElem?(this.editorElem.removeAttribute("style"),this.editorElem.classList.remove("e-right-align")):t.detach(r))}this.editCellData={},this.parent.isEdit=this.isEdit=!1,this.isCellEdit=!0,this.parent.notify("formulaOperation",{action:"endEdit"})},e.prototype.refSelectionRender=function(){var e=this.getEditElement(this.parent.getActiveSheet());e&&q(e.textContent)&&this.parent.notify("initiateFormulaReference",{range:e.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&&q(this.editCellData.value)?(this.startEdit(this.editCellData.addr,t,!1),this.parent.notify("initiateFormulaReference",{range:this.editCellData.value,formulaSheetIdx:this.editCellData.sheetIndex}),this.getEditElement(this.parent.getActiveSheet()).innerHTML=t,this.initiateCurPosition()):this.initiateCurPosition()},e.prototype.addressHandler=function(e){var t=window.getSelection();if(this.selectionStart=t.anchorOffset,this.selectionEnd=t.focusOffset,this.selectionStart>this.selectionEnd){var r=this.selectionStart;this.selectionStart=this.selectionEnd,this.selectionEnd=r}if(t&&t.focusNode&&t.focusNode.classList&&t.focusNode.classList.contains("e-formula-bar-panel")){var n=t.focusNode.getElementsByClassName("e-formula-bar e-css")[0];this.selectionStart=n.selectionStart,this.selectionEnd=n.selectionEnd}var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,i);var a=e.range,o=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!")),s=this.editCellData.sheetIndex,l=this.getEditElement(this.parent.getActiveSheet());if(this.parent.getActiveSheet().name!==o&&(a="'"+this.parent.getActiveSheet().name+"'!"+a),e.isSelect)this.parent.notify("initiateFormulaReference",{range:i.editedValue+a,formulaSheetIdx:s});else{var h=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));if(this.parent.getActiveSheet().name===h){var d=i.editedValue;this.selectionStart!==this.selectionEnd?(this.formulaBarCurStartPos=this.selectionStart,this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+a.length,l.textContent=d.substring(0,this.selectionStart)+a+d.substring(this.selectionStart)):d.indexOf(")")===d.length-1&&this.selectionEnd===d.length?(l.textContent=d.substring(0,d.length-1)+a+d.substring(d.length-1),this.curEndPos=l.textContent.length-1):d.indexOf(")")!==d.length-1?(l.textContent=d+a,this.curEndPos=l.textContent.length):l.textContent!==d?(l.textContent=d.substring(0,this.curStartPos)+a+d.substring(this.curStartPos),this.curEndPos=this.curStartPos+a.length):this.selectionStart!==this.selectionEnd||-1===this.validCharacters.indexOf(d.substring(this.selectionStart-1,this.selectionEnd))||-1===this.validCharacters.indexOf(d.substring(this.selectionStart,this.selectionEnd+1))&&")"!==d.substring(this.selectionStart,this.selectionEnd+1)||(l.textContent=d.substring(0,this.selectionStart)+a+d.substring(this.selectionEnd),this.curStartPos=this.selectionStart,this.curEndPos=this.selectionStart+a.length,this.formulaBarCurStartPos=this.curStartPos)}}},e.prototype.updateFormulaBarValue=function(){var e=window.getSelection(),r=this.editCellData.value,n=this.parent.getActiveSheet().selectedRange;n=I(y(n))?n.split(":")[0]:n;var i=this.parent.element.querySelector(".e-formula-bar");if(r&&q(r)){var a=this.editCellData.fullAddr.substring(0,this.editCellData.fullAddr.indexOf("!"));this.parent.getActiveSheet().name!==a&&(n="'"+this.parent.getActiveSheet().name+"'!"+n),t.isNullOrUndefined(this.formulaBarCurStartPos)?r.indexOf(")")===r.length-1&&e.focusOffset===r.length?i.value=r.substring(0,r.length-1)+n+r.substring(r.length-1):r.indexOf(")")!==r.length-1?i.value=r+n:i.value!==r&&(i.value=r.substring(0,this.curStartPos)+n+r.substring(this.curStartPos)):i.value=r.substring(0,this.formulaBarCurStartPos)+n+r.substring(this.formulaBarCurStartPos),this.curEndPos=this.curStartPos+n.length}},e.prototype.setFormulaBarCurPosition=function(e,t,r){e.setSelectionRange&&(e.focus(),e.selectionStart=t,e.selectionEnd=t,e.setSelectionRange(t,r))},e.prototype.initiateCurPosition=function(){var e=this.getEditElement(this.parent.getActiveSheet(),!0),t=e.innerText,r=window.getSelection();if(r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")){var n=this.parent.element.querySelector(".e-formula-bar");return void this.setFormulaBarCurPosition(n,this.curEndPos,this.curEndPos)}if(t){var i=document.createRange();t.indexOf(")"),t.length,i.setStart(e.childNodes[0],this.curEndPos),i.setEnd(e.childNodes[0],this.curEndPos),r.removeAllRanges(),r.addRange(i)}if(this.editCellData.sheetIndex!==this.parent.getActiveSheet().id-1){var a=this.parent.element.querySelector(".e-formula-bar");if(a.value){var o=a.value.length;a.value.indexOf(")")===o-1?this.setFormulaBarCurPosition(a,o-1,o-1):this.setFormulaBarCurPosition(a,o,o)}}},e.prototype.getEditElement=function(e,t){if((this.isEdit||t)&&(e.frozenRows||e.frozenColumns)){var r=this.parent.frozenRowCount(e),n=this.parent.frozenColCount(e),i=u(e.activeCell),a=void 0;if(i[0]e.rowIdx&&(r.style.top=parseFloat(r.style.top)+e.threshold+"px")}if(r=t.getSelectionElement()){var o=c(n.selectedRange),s=x(o),l={range:s,isActiveCell:!1,skipChecking:!0};if(t.parent.notify("mergedRange",l),l.isActiveCell||s[0]===s[2]&&s[1]===s[3])return;if(n.frozenRows||n.frozenColumns)return void _e(t.parent,r,o);var h=s[0],d=s[2];h<=e.rowIdx&&d>=e.rowIdx&&r?r.style.height=parseFloat(r.style.height)+e.threshold+"px":h>e.rowIdx&&r&&(r.style.top=parseFloat(r.style.top)+e.threshold+"px")}})},e.prototype.colWidthChanged=function(e){var t=this;Le(function(){var r=t.parent.getActiveSheet(),n=t.getActiveCell();if(n){var i=u(t.parent.getActiveSheet().activeCell);if(r.frozenRows||r.frozenColumns){var a={range:[i[0],i[1],i[0],i[1]]};t.parent.notify("activeCellMergedRange",a),_e(t.parent,n,a.range,"e-active-cell")}else i[1]===e.colIdx?n.style.width=parseFloat(n.style.width)+e.threshold+"px":i[1]>e.colIdx&&(n.style.left=parseFloat(n.style.left)+e.threshold+"px")}n=t.getSelectionElement();var o=c(t.parent.getActiveSheet().selectedRange),s=x(o),l={range:s,isActiveCell:!1,skipChecking:!0};if(t.parent.notify("mergedRange",l),!(l.isActiveCell||s[0]===s[2]&&s[1]===s[3])){if(r.frozenRows||r.frozenColumns)return void _e(t.parent,n,o);var h=s[1],d=s[3];h<=e.colIdx&&d>=e.colIdx&&n?n.style.width=parseFloat(n.style.width)+e.threshold+"px":h>e.colIdx&&n&&(n.style.left=parseFloat(n.style.left)+e.threshold+"px")}})},e.prototype.selectRange=function(e){e.address="Single"===this.parent.selectionSettings.mode?m(u(e.address)):e.address,this.selectMultiRange(e.address,null,null,e.skipChecking)},e.prototype.init=function(){this.createSelectionElement();var e=this.parent.getActiveSheet(),t=x(c(e.selectedRange)),r=u(e.activeCell),n=t[0]<=r[0]&&t[2]>=r[0]&&t[1]<=r[1]&&t[3]>=r[1];this.selectMultiRange(e.selectedRange,!0,n)},e.prototype.selectMultiRange=function(e,t,r,n){var i=this,a=this.parent.activeSheetIndex;e.indexOf("!")>-1&&(a=ae(this.parent,se(e)),e=e.split("!")[1]),this.parent.activeSheetIndex===a?e.split(" ").forEach(function(e,a){i.selectRangeByIdx(c(e),{type:"mousedown",ctrlKey:0!==a},null,r,t,n)}):he(this.parent,e,this.parent.sheets[a])},e.prototype.createSelectionElement=function(){var e=this.parent.getMainContent(),t=this.parent.createElement("div",{className:"e-selection"});e.appendChild(t),t=this.parent.createElement("div",{className:"e-active-cell"}),e.appendChild(t)},e.prototype.mouseDownHandler=function(e){if(!(t.closest(e.target,".e-scrollbar")||e.target.classList.contains("e-main-panel")||e.target.classList.contains("e-sheet"))){var r={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,r);var n=r.editedValue&&0===r.editedValue.toString().indexOf("=")||q(r.editedValue);if(!this.parent.isEdit||n){var i=document.getElementById(this.parent.element.id+"_overlay");if("string"==typeof e.target.className){if(e.target.className.indexOf("e-ss-overlay")>-1)return}else i&&i.classList.remove("e-ss-overlay-active");if(t.closest(e.target,".e-datavisualization-chart"))return;if(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 a=this.parent.getActiveSheet(),o=this.parent.selectionSettings.mode,s=this.getRowIdxFromClientY({clientY:Qe(e),target:e.target}),l=this.getColIdxFromClientX({clientX:Je(e),target:e.target}),h=u(a.activeCell),d=void 0,p=void 0;if(a.showHeaders){var f=e.target;if(a.frozenColumns||a.frozenRows){var g=this.parent.getSelectAllContent().querySelector("thead");p=g?(this.parent.getColumnHeaderContent().contains(f)||g.contains(f))&&f.classList.contains("e-header-cell"):this.parent.getColumnHeaderContent().contains(f)&&f.classList.contains("e-header-cell"),d=(g=this.parent.getSelectAllContent().querySelector("tbody"))?(this.parent.getRowHeaderContent().contains(f)||g.contains(f))&&f.classList.contains("e-header-cell"):this.parent.getRowHeaderContent().contains(f)&&f.classList.contains("e-header-cell")}else d=this.parent.getRowHeaderContent().contains(e.target),p=this.parent.getColumnHeaderContent().contains(e.target)}if(3===e.which&&this.isSelected(s,l))return;if("Multiple"===o&&(!Xe(e)&&(!Ge(e)||Ge(e)&&h[0]===s&&h[1]===l)||p||d)?(document.addEventListener(je().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.addEventListener(je().split(" ")[1],this.mouseMoveEvt,{passive:!1}),this.touchSelectionStarted=!0):this.touchSelectionStarted=!1,Xe(e)||t.EventHandler.add(document,We(),this.mouseUpHandler,this),Ge(e)&&!p&&!d)return void(this.touchEvt=e);var m=c(a.topLeftCell);d?(this.isRowSelected=!0,e.shiftKey&&"Single"!==o||(this.startCell=[s,0]),this.selectRangeByIdx([this.startCell[0],a.frozenColumns?m[1]:0,s,a.colCount-1],e)):p?(this.isColSelected=!0,e.shiftKey&&"Single"!==o||(this.startCell=[0,l]),this.selectRangeByIdx([a.frozenRows?m[0]:0,this.startCell[1],a.rowCount-1,l],e)):t.closest(e.target,".e-select-all-cell")?(this.startCell=[a.frozenRows?m[0]:0,a.frozenColumns?m[1]:0],this.selectRangeByIdx([].concat(this.startCell,[a.rowCount-1,a.colCount-1]),e)):e.target.classList.contains("e-sheet-content")||(e.shiftKey&&"Single"!==o||(this.startCell=[s,l]),this.selectRangeByIdx([].concat(this.startCell?this.startCell:u(a.activeCell),[s,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 v=this.parent.getActiveSheet().selectedRange;v=I(y(v))?v.split(":")[0]:v,this.parent.notify("addressHandle",{range:v,isSelect:!1})}}},e.prototype.mouseMoveHandler=function(e){var t=this,r=this.parent.getActiveSheet();Ye(e)&&e.preventDefault();var n={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,n);var i=q(n.editedValue)||n.editedValue&&0===n.editedValue.toString().indexOf("="),a=this.parent.getMainContent().parentElement,o=this.parent.element.getElementsByClassName("e-scroller")[0],s=a.getBoundingClientRect(),l=this.parent.frozenColCount(r),h=s.left+this.parent.sheetModule.getRowHeaderWidth(r),d=s.top,p=s.right,f=s.bottom,g=Je(e),m=Qe(e),v=this.isRowSelected?r.colCount-1:this.getColIdxFromClientX({clientX:Math.min(g,p),target:e.target}),y=this.isColSelected?r.rowCount-1:this.getRowIdxFromClientY({clientY:Math.min(m,f),target:e.target}),C=c(r.selectedRange),b={range:[y,v,y,v]};if(this.parent.notify("activeCellMergedRange",b),b.range[2]!==C[2]||b.range[3]!==C[3]){var S=this.parent.frozenRowCount(r),x=m>f&&y=0&&!this.isColSelected&&!!a.scrollTop,I=g>p&&v=0&&!this.isRowSelected&&!!o.scrollLeft;this.clearInterval();var R,k;if(i||this.isColSelected||this.isRowSelected||(C=u(r.activeCell)),x||w||I||E)(w||E)&&(R=y,k=v),this.scrollInterval=setInterval(function(){if((x||w)&&!t.isColSelected){if((y=t.getRowIdxFromClientY({clientY:x?f:d}))>=r.rowCount)return void t.clearInterval();a.scrollTop+=(x?1:-1)*Se(r,y)}if((I||E)&&!t.isRowSelected){if((v=t.getColIdxFromClientX({clientX:I?p:h}))>=r.colCount)return void t.clearInterval();o.scrollLeft+=(I?1:-1)*Re(r,v)}if(w&&!a.scrollTop||E&&!o.scrollLeft)return t.selectRangeByIdx([].concat(C[0],C[1],[R,k]),e),void t.clearInterval();t.selectRangeByIdx([].concat(C[0],C[1],[y,v]),e)},100);else{var A=[].concat(C[0],C[1],[y,v]);S&&A[0]=S&&a.scrollTop&&(a.scrollTop=0,A[2]=S),l&&A[1]=l&&o.scrollLeft&&(o.scrollLeft=0,A[3]=l),this.selectRangeByIdx(A,e)}if(i&&this.parent.isEdit){var T=this.parent.getActiveSheet().selectedRange;this.parent.notify("addressHandle",{range:T,isSelect:!1})}}},e.prototype.mouseUpHandler=function(e){var r=this.getRowIdxFromClientY({clientY:Qe(e),target:e.target}),n=this.getColIdxFromClientX({clientX:Je(e),target:e.target});this.clearInterval(),!Xe(e)||this.isColSelected||this.isRowSelected||this.getRowIdxFromClientY({clientY:Qe(this.touchEvt),target:e.target})!==r||this.getColIdxFromClientX({clientX:Je(this.touchEvt),target:e.target})!==n||this.mouseDownHandler(e),this.parent.trigger("select",{range:this.parent.getActiveSheet().selectedRange}),document.removeEventListener(je().split(" ")[0],this.mouseMoveEvt),t.Browser.isPointer||document.removeEventListener(je().split(" ")[1],this.mouseMoveEvt),t.EventHandler.remove(document,We(),this.mouseUpHandler),this.parent.notify("mouseUpAfterSelection",e);var i={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,i),(q(i.editedValue)||i.editedValue&&0===i.editedValue.toString().indexOf("="))&&this.parent.isEdit&&!e.target.classList.contains("e-spreadsheet-edit")&&this.parent.notify("initiateCur",{})},e.prototype.isSelected=function(e,t){var r=x(c(this.parent.getActiveSheet().selectedRange));return r[0]<=e&&e<=r[2]&&r[1]<=t&&t<=r[3]},e.prototype.virtualContentLoadedHandler=function(e){var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.selectedRange);i.selectedRange.split(" ").forEach(function(o,s){a=c(o),r=0===a[1]&&a[3]===e.prevRowColCnt.colCount-1,(t=0===a[0]&&a[2]===e.prevRowColCnt.rowCount-1)&&r?n.selectRangeByIdx([0,0,i.rowCount-1,i.colCount-1],null,!0,null,null,null,s):t?n.selectRangeByIdx([0,a[1],i.rowCount-1,a[3]],null,!0,null,null,null,s):r?n.selectRangeByIdx([a[0],0,a[2],i.colCount-1],null,!0,null,null,null,s):(a=c(o),n.highlightHdr(a,0!==s,a[0]>=n.parent.viewport.topIndex||a[2]>=n.parent.viewport.topIndex,a[1]>=n.parent.viewport.leftIndex||a[3]>=n.parent.viewport.leftIndex))})},e.prototype.clearInterval=function(){clearInterval(this.scrollInterval),this.scrollInterval=null},e.prototype.getScrollLeft=function(){return this.parent.scrollModule?this.parent.scrollModule.prevScroll.scrollLeft:0},e.prototype.cellNavigateHandler=function(e){var t=this.parent.getActiveSheet();t.isProtected&&!t.protectSettings.selectCells||this.selectRangeByIdx(e.range.concat(e.range))},e.prototype.getColIdxFromClientX=function(e){var r=0,n=this.parent.getActiveSheet(),i=0;if(e.isImage)i=e.clientX;else{var a=document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect();i=this.parent.enableRtl?a.right-this.parent.sheetModule.getRowHeaderWidth(n,!0)-1-e.clientX:e.clientX-(a.left+this.parent.sheetModule.getRowHeaderWidth(n,!0)+1),i+=this.parent.viewport.beforeFreezeWidth,e.target&&(!e.target||t.closest(e.target,".e-row-header")||t.closest(e.target,".e-selectall-container"))||(i+=this.getScrollLeft())}for(var o=0;;o++)if(r+=Re(n,o,null,!0),i-1){var w=f.selectedRange.split(" ");w[s]=x,x=w.join(" ")}d?a||he(this.parent,x,f,p):he(this.parent,x,f,p),this.UpdateRowColSelected(e),this.highlightHdr(e,r&&r.ctrlKey),n||r&&("mousemove"===r.type||Ye(r))||(d?S.sheetIndex===this.parent.getActiveSheet().id-1&&a?(i=!0,this.updateActiveCell(i?c(f.activeCell):e,a)):this.parent.isEdit||this.updateActiveCell(i?c(f.activeCell):e,a):this.updateActiveCell(i?c(f.activeCell):e,a)),t.isNullOrUndefined(r)&&(r={type:"mousedown"}),d?a||this.parent.notify("selectionComplete",r):this.parent.notify("selectionComplete",r),this.parent.notify("showAggregate",{}),this.parent.notify("refreshImgElem",{}),y&&this.parent.notify("removeDesignChart",{}),this.parent.notify("clearChartBorder",{})}},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,a=this.parent.getActiveSheet(),o=c(a.topLeftCell);this.isColSelected?(r=o[0],n=e[1],this.isRowSelected&&(n=o[1])):(r=e[0],n=e[1],this.isRowSelected&&(n=o[1]));var s={range:[r,n].concat([r,n])};if(this.parent.notify("activeCellMergedRange",s),e!==s.range&&(i=!0),e=s.range,a.activeCell!==g(e[0],e[1])||t){if(this.parent.setSheetPropertyOnMute(a,"activeCell",g(e[0],e[1])),this.getActiveCell()){var l=this.getOffset(e[2],e[3]);i&&(l.left={idx:0,size:0}),_e(this.parent,this.getActiveCell(),e,"e-active-cell")}this.parent.notify("activeCellChanged",null)}else _e(this.parent,this.getActiveCell(),e,"e-active-cell")},e.prototype.getOffset=function(e,t){var r={left:{idx:0,size:0},top:{idx:0,size:0}};return this.parent.scrollModule&&(t>=this.parent.scrollModule.offset.left.idx&&(r.left=this.parent.scrollModule.offset.left),e>=this.parent.scrollModule.offset.top.idx&&(r.top=this.parent.scrollModule.offset.top)),r},e.prototype.getSelectionElement=function(e,r){if(e&&e.ctrlKey){if(Ze(e)||$e(e))return this.parent.getMainContent().querySelector(".e-selection:last-child");var n=this.parent.element.getElementsByClassName("e-selection")[0];n.classList.remove("e-hide");var i=n.cloneNode();return i.classList.add("e-multi-range"),this.parent.getMainContent().appendChild(i)}return r>-1?this.parent.getMainContent().getElementsByClassName("e-selection")[r]:([].slice.call(this.parent.element.getElementsByClassName("e-multi-range")).forEach(function(e){t.remove(e)}),this.parent.getMainContent().getElementsByClassName("e-selection")[0])},e.prototype.getActiveCell=function(){return this.parent.getMainContent().getElementsByClassName("e-active-cell")[0]},e.prototype.getSheetElement=function(){return document.getElementById(this.parent.element.id+"_sheet")},e.prototype.highlightHdr=function(e,r,n,i){if(void 0===n&&(n=!0),void 0===i&&(i=!0),this.parent.getActiveSheet().showHeaders){var a=this.parent.getActiveSheet(),o=[],s=[],l=x(e);l=this.getHdrIndexes(l);var h=this.parent.element.getElementsByClassName("e-select-all-cell")[0];if(r||(t.removeClass(this.getSheetElement().querySelectorAll(".e-highlight"),"e-highlight"),t.removeClass(this.getSheetElement().querySelectorAll(".e-prev-highlight"),"e-prev-highlight")),h&&t.removeClass([h],["e-prev-highlight-right","e-prev-highlight-bottom"]),n){var d,p=this.parent.frozenRowCount(a),c=void 0;(C=this.parent.getSelectAllContent().querySelector("tbody"))&&(d=[].slice.call(C.querySelectorAll(".e-header-cell")));for(var f=[].slice.call(this.parent.getRowHeaderContent().querySelectorAll(".e-header-cell")),g=u(a.topLeftCell)[0],m=l[0];m=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=t,i=0,a=this.parseFormula(e),o=a.length,s=0,l=[["e-vborderright","e-vborderbottom"],["e-pborderright","e-pborderbottom"],["e-cborderright","e-cborderbottom"],["e-gborderright","e-gborderbottom"],["e-oborderright","e-oborderbottom"],["e-bborderright","e-bborderbottom"]];this.clearBorder();for(var h=this.parent.getActiveSheet().id-1;i-1));){if(j(r.toUpperCase())){if(r=r.replace(/\$/g,""),i>0&&a[i-1].indexOf("!")===a[i-1].length-1){var d=a[i-1].split("!");n=ae(this.parent,d[0].substring(1,d[0].length-1))}":"===a[i+1]&&a[++i+1]&&j(a[i+1].toUpperCase())&&(r=r+":"+a[i+1],i++),h===n&&this.updateFormulaEditRange(r,s,l),n=t,s++}i++}},e.prototype.updateFormulaEditRange=function(e,t,r){var n=c(e);this.formulaRange[t]=e,this.dStartCell={rowIndex:n[0],colIndex:n[1]},this.dEndCell={rowIndex:n[2],colIndex:n[3]},this.focusBorder(this.dStartCell,this.dEndCell,r[t%6])},e.prototype.chartBorderHandler=function(e){this.focusBorder(e.startcell,e.endcell,e.classes,!0)},e.prototype.focusBorder=function(e,r,n,i){i=!t.isNullOrUndefined(i)&&i;var a=x([e.rowIndex,e.colIndex,r.rowIndex,r.colIndex]),o=this.parent.getActiveSheet();if(o.frozenRows||o.frozenColumns){var s=this.parent.createElement("div",{className:i?"e-range-indicator e-chart-range":"e-range-indicator e-formuala-range"});return s.appendChild(this.parent.createElement("div",{className:"e-top"})),s.appendChild(this.parent.createElement("div",{className:"e-bottom"})),s.appendChild(this.parent.createElement("div",{className:"e-left"})),s.appendChild(this.parent.createElement("div",{className:"e-right"})),void _e(this.parent,s,a,"e-range-indicator")}var l=a[0],h=a[1],d=a[2],p=a[3];l&&this.getEleFromRange([l-1,h,l-1,p]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([l,p,d,p]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))}),this.getEleFromRange([d,h,d,p]).forEach(function(e){e&&(e.classList.add(n[1]),i||e.classList.add("e-formularef-selection"))}),h&&this.getEleFromRange([l,h-1,d,h-1]).forEach(function(e){e&&(e.classList.add(n[0]),i||e.classList.add("e-formularef-selection"))})},e.prototype.getEleFromRange=function(e){var t,r,n,i,a=e[0],o=e[1],s=e[2],l=e[3],h=[],d=[];if(a>s&&(n=a,a=s,s=n),o>l&&(n=o,o=l,l=n),this.parent.scrollSettings.enableVirtualization)for(t=a;t<=s;t++)if((r=t)>-1){var p=this.parent.getRow(r,null);p&&(i=p.getElementsByClassName("e-cell"),h=l===o?[i[l]]:this.getRowCells(i,o,l+1),this.merge(d,h))}return d},e.prototype.getRowCells=function(e,t,r){var n=[];for(t;t|<|,|:|\+|-|\*|\/|%|&/g),o=a.length;n0){this.isUniqueChar(r)&&(i.push(this.getUniqueCharVal(r)),t=t.substr(1));var s=t.indexOf("!")+1;i.push(t.substr(0,s)),i.push(t.substr(s))}else this.isUniqueChar(r)?(i.push(this.getUniqueCharVal(r)),i.push(t.substr(1))):i.push(t);n++}else n++;return i},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(/this.prevScroll.scrollLeft;n=this.offset.left.size,this.offset.left=this.getColOffset(s,l,e.skipHidden),e.preventScroll||(this.parent.getColumnHeaderContent().scrollLeft=a,this.parent.getMainContent().scrollLeft=a,e.scrollLeft=a),r={cur:this.offset.left,prev:{idx:this.leftIndex,size:n},increase:l,preventScroll:e.preventScroll},this.updateTopLeftCell(l),this.parent.notify("horizontalScroll",r),this.parent.scrollSettings.enableVirtualization||!l||this.parent.scrollSettings.isFinite||this.updateNonVirtualCols(),this.leftIndex=r.prev.idx,this.prevScroll.scrollLeft=s}if(this.prevScroll.scrollTop!==o){var h=o>this.prevScroll.scrollTop;n=this.offset.top.size,this.offset.top=this.getRowOffset(o,h),r={cur:this.offset.top,prev:{idx:this.topIndex,size:n},increase:h,preventScroll:e.preventScroll},this.updateTopLeftCell(h),this.parent.notify("verticalScroll",r),this.parent.scrollSettings.enableVirtualization||!h||this.parent.scrollSettings.isFinite||this.updateNonVirtualRows(),this.topIndex=r.prev.idx,this.prevScroll.scrollTop=o}var d={isEdit:!1};this.parent.notify("isFormulaBarEdit",d),d.isEdit&&this.parent.element.querySelector(".e-formula-bar").focus()},e.prototype.updateNonVirtualRows=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("row");this.offset.top.idx>e.rowCount-(this.parent.viewport.rowCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:e.rowCount,colIndex:0,direction:"first",refresh:"RowPart"},g(e.rowCount,0)+":"+g(e.rowCount+t-1,e.colCount-1)),this.parent.setSheetPropertyOnMute(e,"rowCount",e.rowCount+t),this.parent.viewport.bottomIndex=e.rowCount-1)},e.prototype.updateNonVirtualCols=function(){var e=this.parent.getActiveSheet(),t=this.parent.getThreshold("col");this.offset.left.idx>e.colCount-(this.parent.viewport.colCount+t)&&(this.parent.renderModule.refreshUI({rowIndex:0,colIndex:e.colCount,direction:"first",refresh:"ColumnPart"},g(0,e.colCount)+":"+g(e.rowCount-1,e.colCount+t-1)),this.parent.setSheetPropertyOnMute(e,"colCount",e.colCount+t),this.parent.viewport.rightIndex=e.colCount-1)},e.prototype.updateTopLeftCell=function(e){var t=this.parent.getActiveSheet(),r=this.offset.top.idx,n=this.offset.left.idx;e||(r=yt(t,r,!0),n=yt(t,n,!0,"columns")),this.parent.updateTopLeftCell(r,n)},e.prototype.getRowOffset=function(e,t){var r,n=this.offset.top.size,i=this.parent.getActiveSheet(),a=t?this.offset.top.idx+1:this.offset.top.idx?this.offset.top.idx-1:0,o=this.parent.frozenRowCount(i);if(this.parent.scrollSettings.isFinite){if(r=i.rowCount,t&&a+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(e=Math.round(e);ae)return{idx:a-1,size:n-Se(i,a-1+o,!0)};a++}else{if(0===n)return{idx:0,size:0};if((n-=Se(i,a+o,!0))<0&&(n=0),Math.abs(Math.round(n)-e)<=1)return{idx:a,size:n};if(Math.round(n)e?{idx:a,size:n-Se(i,a+o,!0)<0?0:n-Se(i,a+o,!0)}:{idx:a+1,size:n};a--}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,a=this.parent.getActiveSheet(),o=t?this.offset.left.idx+1:this.offset.left.idx-1,s=this.parent.frozenColCount(a);if(this.parent.scrollSettings.isFinite){if(n=a.colCount,t&&o+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(e=Math.round(e);oe)return{idx:o-1,size:i-Re(a,o-1+s,r,!0)};o++}else{if(0===i)return{idx:0,size:0};if(i-=Re(a,o+s,r,!0),Math.round(i)===e)return{idx:o,size:i};if(Math.round(i)e?{idx:o,size:i-Re(a,o+s,r,!0)}:{idx:o+1,size:i};o--}return{idx:this.offset.left.idx,size:this.offset.left.size}},e.prototype.contentLoaded=function(){if(this.setScrollEvent(),this.parent.enableRtl&&(this.initScrollValue=this.parent.getScrollElement().scrollLeft),!this.parent.scrollSettings.enableVirtualization){var e=this.parent.createElement("div",{className:"e-virtualtrack"});this.updateNonVirualScrollWidth({scrollTrack:e}),this.parent.getScrollElement().appendChild(e)}},e.prototype.updateNonVirualScrollWidth=function(e){e.scrollTrack||(e.scrollTrack=this.parent.getScrollElement().getElementsByClassName("e-virtualtrack")[0]),e.scrollTrack.style.width=Math.abs(this.parent.getContentTable().getBoundingClientRect().width)+"px"},e.prototype.onWheel=function(e){e.preventDefault(),this.parent.getMainContent().parentElement.scrollTop+=e.deltaY},e.prototype.scrollHandler=function(e){this.onContentScroll({scrollLeft:e.target.scrollLeft})},e.prototype.mouseDownHandler=function(e){if("mousedown"!==e.type){var r={touchSelectionStarted:!1};if(this.parent.notify("selectionStatus",r),!r.touchSelectionStarted){var n=document.getElementById(this.parent.element.id+"_sheet");this.clientX=e.changedTouches[0].clientX,t.EventHandler.add(n,"touchmove",this.mouseMoveHandler,this),t.EventHandler.add(n,"touchend",this.mouseUpHandler,this)}}},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-scroller")[0],r=this.clientX-e.changedTouches[0].clientX;(r>10||r<-10)&&(e.preventDefault(),t.scrollLeft+=r,this.clientX=e.changedTouches[0].clientX)},e.prototype.mouseUpHandler=function(){var e=document.getElementById(this.parent.element.id+"_sheet");t.EventHandler.remove(e,"touchmove",this.mouseMoveHandler),t.EventHandler.remove(e,"touchend",this.mouseUpHandler)},e.prototype.setScrollEvent=function(e){void 0===e&&(e={set:!0}),e.set?(t.EventHandler.add(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll,this),t.EventHandler.add(this.parent.getColumnHeaderContent(),"wheel",this.onWheel,this),t.EventHandler.add(this.parent.getSelectAllContent(),"wheel",this.onWheel,this),t.EventHandler.add(this.parent.getScrollElement(),"scroll",this.scrollHandler,this)):(t.EventHandler.remove(this.parent.sheetModule.contentPanel,"scroll",this.onContentScroll),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"wheel",this.onWheel),t.EventHandler.remove(this.parent.getSelectAllContent(),"wheel",this.onWheel),t.EventHandler.remove(this.parent.getScrollElement(),"scroll",this.scrollHandler))},e.prototype.initProps=function(){this.topIndex=0,this.leftIndex=0,this.prevScroll={scrollLeft:0,scrollTop:0},this.offset={left:{idx:0,size:0},top:{idx:0,size:0}}},e.prototype.setPadding=function(){this.parent.sheetModule.contentPanel.style.overflowY="scroll";var e=Oe();if(e>0){var t=this.parent.getColumnHeaderContent(),r=this.parent.enableRtl?{margin:"marginLeft",border:"borderLeftWidth"}:{margin:"marginRight",border:"borderRightWidth"};t.parentElement.style[r.margin]=e+"px",t.style[r.border]="1px"}},e.prototype.addEventListener=function(){this.parent.on("contentLoaded",this.contentLoaded,this),this.parent.on("onContentScroll",this.onContentScroll,this),this.parent.on("deInitProperties",this.initProps,this),this.parent.on("spreadsheetDestroyed",this.destroy,this),this.parent.on("setScrollEvent",this.setScrollEvent,this),this.parent.on("mouseDown",this.mouseDownHandler,this),this.parent.scrollSettings.enableVirtualization||(this.parent.on("virtualContentLoaded",this.updateNonVirualScrollWidth,this),this.parent.on("colWidthChanged",this.updateNonVirualScrollWidth,this))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off("contentLoaded",this.contentLoaded),this.parent.off("onContentScroll",this.onContentScroll),this.parent.off("deInitProperties",this.initProps),this.parent.off("spreadsheetDestroyed",this.destroy),this.parent.off("setScrollEvent",this.setScrollEvent),this.parent.off("mouseDown",this.mouseDownHandler),this.parent.scrollSettings.enableVirtualization||(this.parent.off("virtualContentLoaded",this.updateNonVirualScrollWidth),this.parent.off("colWidthChanged",this.updateNonVirualScrollWidth))},e}(),Pn=function(){function e(e){this.scroll=[],this.parent=e,this.addEventListener()}return e.prototype.createVirtualElement=function(e){var r=this.parent.getActiveSheet(),n=this.parent.getMainContent();this.content=this.parent.createElement("div",{className:"e-virtualable"}),this.content.appendChild(n.querySelector(".e-table")),n.appendChild(this.content);var i,a=n.appendChild(this.parent.createElement("div",{className:"e-virtualtrack"})),o=0;this.parent.sheets.length>this.scroll.length&&this.initScroll();var s=this.parent.viewport.bottomIndex;r.rowCount>s+1||r.usedRange.rowIndex>s?(!this.parent.scrollSettings.isFinite&&r.rowCount<=r.usedRange.rowIndex&&this.parent.setSheetPropertyOnMute(r,"rowCount",r.usedRange.rowIndex+1),this.setScrollCount(r.rowCount,"row")):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"rowCount",s+1),this.scroll[this.parent.activeSheetIndex].rowCount=r.rowCount);var l=this.parent.frozenRowCount(r),h=u(r.topLeftCell);e.top&&(o=e.top,r.frozenRows&&(o+=we(r,h[0],l-1,!0)),l=u(r.paneTopLeftCell)[0]),o+=we(r,l,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),s=this.parent.viewport.rightIndex;var d=0,p=this.parent.frozenColCount(r);e.left?(d=e.left,p&&(d+=ke(r,h[1],p-1,!0)),l=u(r.paneTopLeftCell)[1]):l=p,r.colCount>s+1||r.usedRange.colIndex>s?(!this.parent.scrollSettings.isFinite&&r.colCount<=r.usedRange.colIndex&&this.parent.setSheetPropertyOnMute(r,"colCount",r.usedRange.colIndex+1),d+=ke(r,l,s,!0),this.setScrollCount(r.colCount,"col"),i=d+ke(r,s+1,this.scroll[this.parent.activeSheetIndex].colCount-1,!0)):(this.parent.scrollSettings.isFinite||this.parent.setSheetPropertyOnMute(r,"colCount",s+1),d+=ke(r,l,r.colCount-1,!0),this.scroll[this.parent.activeSheetIndex].colCount=r.colCount,i=d),t.isNullOrUndefined(this.parent.viewport.leftIndex)&&(this.parent.viewport.leftIndex=0),t.isNullOrUndefined(this.parent.viewport.topIndex)&&(this.parent.viewport.topIndex=0),e.left&&(d=ke(r,this.parent.viewport.leftIndex+p,s,!0)),t.isNullOrUndefined(this.translateX)&&(this.translateX=0),t.isNullOrUndefined(this.translateY)&&(this.translateY=0),n=this.parent.getRowHeaderContent(),this.rowHeader=this.content.cloneNode(),this.rowHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.rowHeader);var c=n.appendChild(a.cloneNode());this.rowHeader.style.transform="translate(0px, "+this.translateY+"px)",n=this.parent.getColumnHeaderContent(),this.colHeader=this.content.cloneNode(),this.colHeader.appendChild(n.querySelector(".e-table")),n.appendChild(this.colHeader);var f=n.appendChild(a.cloneNode());this.colHeader.style.width=d+"px",c.style.height=o+"px",f.style.width=i+"px",this.colHeader.style.transform="translate("+this.translateX+"px, 0px)",this.content.style.transform="translate("+this.translateX+"px, "+this.translateY+"px)",this.content.style.width=d+"px",a.style.height=o+"px",a.style.width=i+"px",this.parent.allowScrolling&&this.parent.getScrollElement().appendChild(f.cloneNode(!0))},e.prototype.initScroll=function(){for(var e=0;eMath.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateY&&n>a){this.translateY=0;var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(this.parent.viewport.topIndex=n-(a-p),!e.preventScroll){var c=d?u(h.topLeftCell)[1]:this.parent.viewport.leftIndex,f=d?[p,this.parent.viewport.leftIndex+d]:[];if(ia){if(l=this.parent.viewport.topIndex,this.parent.viewport.topIndex=t-a,e.increase&&l>this.parent.viewport.topIndex)return void(this.parent.viewport.topIndex=l);p=this.parent.frozenRowCount(h);if(this.translateY=r-this.getThresholdHeight(this.parent.viewport.topIndex+p,a),!e.preventScroll){var c=(d=this.parent.frozenColCount(h))?u(h.topLeftCell)[1]:this.parent.viewport.leftIndex,y=[];if(h.frozenColumns&&(y=[p,this.parent.viewport.leftIndex+d]),ir&&(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),a=this.parent.getThreshold("col");if(i>Math.round(a/2)){var o=void 0,s=void 0,l=void 0,h=this.parent.getActiveSheet();if(t<=a&&!e.increase){if(this.translateX&&n>a){var d=this.parent.frozenColCount(h),p=this.parent.frozenRowCount(h);if(this.translateX=0,this.parent.viewport.leftIndex=n-(a-d),!e.preventScroll){var c=p?u(h.topLeftCell)[0]:this.parent.viewport.topIndex,f=p?[this.parent.viewport.topIndex+p,d]:[];if(ia){if(l=this.parent.viewport.leftIndex,this.parent.viewport.leftIndex=t-a,e.increase&&l>this.parent.viewport.leftIndex)return void(this.parent.viewport.leftIndex=l);d=this.parent.frozenColCount(h);if(this.translateX=r-this.getThresholdWidth(this.parent.viewport.leftIndex+d,a),!e.preventScroll){var c=(p=this.parent.frozenRowCount(h))?u(h.topLeftCell)[0]:this.parent.viewport.topIndex,y=[];if(p&&(y=[p+this.parent.viewport.topIndex,d]),ii){o=a-i;n.style.width=i+o+"px"}else{var o=i-a,s=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];i-ol){o=h-l;s.style.height=l+o+"px"}else{var o=l-h,d=this.parent.getRowHeaderContent().getElementsByClassName("e-virtualtrack")[0];l-o=this.scroll[this.parent.activeSheetIndex].rowCount?n+=we(t,this.scroll[this.parent.activeSheetIndex].rowCount,e.index,!0):n-=we(t,e.index+1,this.scroll[this.parent.activeSheetIndex].rowCount-1,!0),nt.rowCount&&this.parent.setSheetPropertyOnMute(t,"rowCount",this.scroll[this.parent.activeSheetIndex].rowCount)}}else if(e.index>this.scroll[this.parent.activeSheetIndex].colCount){var i=this.getVTrackHeight("width");i+=ke(t,this.scroll[this.parent.activeSheetIndex].colCount,e.index,!0),this.scroll[this.parent.activeSheetIndex].colCount=e.index+1,this.updateVTrack(this.colHeader,i,"width"),this.scroll[this.parent.activeSheetIndex].colCount>t.colCount&&this.parent.setSheetPropertyOnMute(t,"colCount",this.scroll[this.parent.activeSheetIndex].colCount)}}},e.prototype.getVTrackHeight=function(e){var t=this.content.nextElementSibling.style[e];if(t.includes("e+")){var r=(t=t.split("px")[0]).split("e+");return Number(r[0])*Math.pow(10,Number(r[1]))}return parseFloat(t)},e.prototype.updateVTrackHeight=function(e){var t=this.parent.viewport.rowCount+1+2*this.parent.getThreshold("row");e.rowIdx>=t&&e.rowIdx=this.parent.viewport.leftIndex&&e.colIdx<=this.parent.viewport.rightIndex){var t=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualtrack")[0];t.style.width=parseFloat(t.style.width)+e.threshold+"px";var r=this.parent.getMainContent().getElementsByClassName("e-virtualtrack")[0];r.style.width=parseFloat(r.style.width)+e.threshold+"px";var n=this.parent.getColumnHeaderContent().getElementsByClassName("e-virtualable")[0];n.style.width=parseFloat(n.style.width)+e.threshold+"px";var i=this.parent.getMainContent().getElementsByClassName("e-virtualable")[0];i.style.width=parseFloat(i.style.width)+e.threshold+"px"}},e.prototype.updateVTrack=function(e,t,r){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("beforeContentLoaded",this.createVirtualElement,this),this.parent.on("beforeVirtualContentLoaded",this.translate,this),this.parent.on("virtualContentLoaded",this.updateColumnWidth,this),this.parent.on("updateTableWidth",this.updateColumnWidth,this),this.parent.on("verticalScroll",this.onVerticalScroll,this),this.parent.on("horizontalScroll",this.onHorizontalScroll,this),this.parent.on("updateUsedRange",this.updateUsedRange,this),this.parent.on(Qt,this.updateVTrackHeight,this),this.parent.on("colWidthChanged",this.updateVTrackWidth,this),this.parent.on("deInitProperties",this.deInitProps,this),this.parent.on("sheetsDestroyed",this.sliceScrollProps,this),this.parent.on("sheetCreated",this.updateScrollProps,this),this.parent.on("spreadsheetDestroyed",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("beforeContentLoaded",this.createVirtualElement),this.parent.off("beforeVirtualContentLoaded",this.translate),this.parent.off("virtualContentLoaded",this.updateColumnWidth),this.parent.off("updateTableWidth",this.updateColumnWidth),this.parent.off("verticalScroll",this.onVerticalScroll),this.parent.off("horizontalScroll",this.onHorizontalScroll),this.parent.off("updateUsedRange",this.updateUsedRange),this.parent.off(Qt,this.updateVTrackHeight),this.parent.off("colWidthChanged",this.updateVTrackWidth),this.parent.off("sheetsDestroyed",this.sliceScrollProps),this.parent.off("sheetCreated",this.updateScrollProps),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),_n=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Xt,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Xt,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(),a={e:e,isFilterCell:!1},o=u(this.parent.getActiveSheet().activeCell);if([9,37,38,39,40].indexOf(e.keyCode)>-1&&e.preventDefault(),e.shiftKey&&this.shiftSelection(e),e.shiftKey||!e.altKey||38!==e.keyCode&&40!==e.keyCode||this.parent.notify("filterCellKeyDown",a),!e.shiftKey&&(!n&&37===e.keyCode||n&&39===e.keyCode)||e.shiftKey&&9===e.keyCode)if(o[1]>0)o[1]-=1,r=!0;else{l=this.parent.getMainContent();0===o[1]&&l.scrollLeft&&!n&&(l.scrollLeft=0)}else if(e.shiftKey&&13===e.keyCode){if(!this.parent.element.querySelector(".e-find-toolbar"))if(o[0]>0)o[0]-=1,r=!0;else{l=this.parent.getMainContent().parentElement;0===o[0]&&l.scrollTop&&(l.scrollTop=0)}}else if(a.isFilterCell||e.shiftKey||38!==e.keyCode){if(!e.shiftKey&&(!n&&39===e.keyCode||n&&37===e.keyCode)||9===e.keyCode)(s=$(o[0],o[1],i))&&s.colSpan>1&&(o[1]+=s.colSpan-1),o[1]1&&(o[0]+=s.rowSpan-1),o[0]0)o[0]-=1,r=!0;else{var l=this.parent.getMainContent().parentElement;0===o[0]&&l.scrollTop&&(l.scrollTop=0)}if(r){for(;be(this.parent.getActiveSheet(),o[0]);)40===e.keyCode&&(o[0]=o[0]+1),38===e.keyCode&&(o[0]=o[0]-1);this.scrollNavigation(o,!1),this.parent.setSheetPropertyOnMute(i,"activeCell",m(o)),this.parent.notify("cellNavigate",{range:o})}}e.target.classList.contains("e-sheet-rename")&&(32===e.keyCode?e.stopPropagation():13!==e.keyCode&&27!==e.keyCode||this.parent.notify("renameSheet",e))},e.prototype.shiftSelection=function(e){var r=this.parent.getActiveSheet(),n=c(r.selectedRange),i=x(n),a=!0;if(38===e.keyCode){for(o=i[1];o<=i[3];o++){s=$(n[2],o,this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan<0){n[2]=n[2]-(Math.abs(s.rowSpan)+1),a=!1;break}}a&&(n[2]=n[2]-1),n[2]<0&&(n[2]=0)}if(40===e.keyCode){for(o=i[1];o<=i[3];o++){s=$(n[2],o,this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.rowSpan&&s.rowSpan>0){n[2]=n[2]+Math.abs(s.rowSpan),a=!1;break}}a&&(n[2]=n[2]+1)}if(39===e.keyCode){for(o=i[0];o<=i[2];o++){s=$(o,n[3],this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan>0){n[3]=n[3]+Math.abs(s.colSpan),a=!1;break}}a&&(n[3]=n[3]+1)}if(37===e.keyCode){for(var o=i[0];o<=i[2];o++){var s=$(o,n[3],this.parent.getActiveSheet());if(!t.isNullOrUndefined(s)&&s.colSpan&&s.colSpan<0){n[3]=n[3]-(Math.abs(s.colSpan)+1),a=!1;break}}a&&(n[3]=n[3]-1),n[3]<0&&(n[3]=0)}if(e.shiftKey&&e.ctrlKey&&!this.parent.scrollSettings.enableVirtualization){var l=[r.usedRange.rowIndex,r.usedRange.colIndex];37===e.keyCode&&(n[3]<=l[1]?n[3]=0:n[3]=l[1]),38===e.keyCode&&(n[2]<=l[0]?n[2]=0:n[2]=l[0]),39===e.keyCode&&(n[3]<=l[1]?n[3]=l[1]:n[3]=this.parent.getActiveSheet().colCount),40===e.keyCode&&(n[2]<=l[0]?n[2]=l[0]:n[2]=this.parent.getActiveSheet().rowCount)}if(37===e.keyCode||39===e.keyCode||38===e.keyCode||40===e.keyCode){for(;be(this.parent.getActiveSheet(),n[2]);)40===e.keyCode&&(n[2]=n[2]+1),38===e.keyCode&&(n[2]=n[2]-1);this.parent.selectRange(m(n)),this.scrollNavigation([n[2],n[3]],!1)}},e.prototype.scrollNavigation=function(e,t){if(this.parent.allowScrolling){var r=this.parent.enableRtl?-1:1,n=this.parent.getMainContent().parentElement,i=this.parent.getScrollElement(),a=this.parent.getActiveSheet(),o=x(c(a.selectedRange)),s=u(a.topLeftCell),l=this.parent.frozenRowCount(a),h=this.parent.frozenColCount(a),d=u(a.paneTopLeftCell),p=e[0]e[0]&&(n.scrollTop=m-Math.ceil(Se(a,e[0],!0))),this.getRightIdx(f)<=e[1]||t?i.scrollLeft=g+Re(a,d[1],null,!0)*r:f>e[1]&&(i.scrollLeft=g-Re(a,e[1],null,!0)*r)}},e.prototype.getBottomIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=(r.frozenRows?this.parent.viewport.height-this.parent.sheetModule.getColHeaderHeight(r,!0):this.parent.viewport.height)-17||20,i=e;;i++)if((t+=Se(r,i,!0))>=n)return i},e.prototype.getRightIdx=function(e){for(var t=0,r=this.parent.getActiveSheet(),n=this.parent.getMainContent().parentElement.offsetWidth-this.parent.sheetModule.getRowHeaderWidth(r),i=e;;i++)if((t+=Re(r,i,null,!0))>=n-17)return i},e.prototype.getModuleName=function(){return"keyboardNavigation"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Un=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(Xt,this.keyDownHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off(Xt,this.keyDownHandler)},e.prototype.keyDownHandler=function(e){if(e.ctrlKey||e.metaKey){if(t.closest(e.target,".e-find-dlg")||[79,83,65].indexOf(e.keyCode)>-1&&e.preventDefault(),79===e.keyCode)t.select("#"+this.parent.element.id+"_fileUpload",this.parent.element).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=u(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)&&Z(r[0],r[1],this.parent.getActiveSheet(),i,!1),i&&i.hyperlink?this.parent.notify("editHyperlink",null):this.parent.notify("initiateHyperlink",null)}else 90===e.keyCode?this.parent.isEdit||(e.preventDefault(),this.parent.notify("performUndoRedo",{isUndo:!0})):89===e.keyCode&&(this.parent.isEdit||(e.preventDefault(),this.parent.notify("performUndoRedo",{isUndo:!1})));var a=this.parent.sheets[this.parent.getActiveSheet().id-1],o=void 0;if(a){var s=u(a.activeCell),l=$(s[0],s[1],a);o=a.isProtected&&X(l,Ie(a,s[1]))}if(70===e.keyCode&&(e.preventDefault(),this.parent.notify("ribbonFind",null)),!(o&&a.isProtected||70===e.keyCode)){if(71===e.keyCode)e.preventDefault(),this.parent.notify(ar,null);else if(72===e.keyCode)e.preventDefault(),this.parent.notify(or,null);else if(88===e.keyCode)this.parent.notify(Zt,{promise:Promise});else if(86===e.keyCode)o||this.parent.notify(Jt,{isAction:!0});else if(66===e.keyCode)e.preventDefault(),h="bold"===(h=this.parent.getCellStyleValue(["fontWeight"],u(this.parent.getActiveSheet().activeCell)).fontWeight)?"normal":"bold",this.parent.notify(wt,{style:{fontWeight:h},onActionUpdate:!0,refreshRibbon:!0});else if(73===e.keyCode){e.preventDefault();var h=this.parent.getCellStyleValue(["fontStyle"],u(this.parent.getActiveSheet().activeCell)).fontStyle;h="italic"===h?"normal":"italic",this.parent.notify(wt,{style:{fontStyle:h},onActionUpdate:!0,refreshRibbon:!0})}else 85===e.keyCode?(e.preventDefault(),this.parent.notify("textDecorationUpdate",{style:{textDecoration:"underline"},refreshRibbon:!0})):53===e.keyCode&&(e.preventDefault(),this.parent.notify("textDecorationUpdate",{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("clearCopy",null)},e.prototype.getModuleName=function(){return"keyboardShortcut"},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Vn=function(){function e(e){this.checkHeight=!1,this.parent=e,this.row=e.createElement("tr",{className:"e-row"}),this.parent.on(jt,this.addEventListener,this)}return e.prototype.applyCellFormat=function(e){var t=Object.keys(e.style),r=this.parent.getActiveSheet();if(!(e.lastCell&&vt(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);var a=$(e.rowIdx,e.colIdx,r);a&&(a.rowSpan||a.colSpan)&&n.offsetHeight>0&&(s=ht(this.parent,a.style||this.parent.cellStyle))>n.offsetHeight&<(this.parent,r,n.offsetHeight,e.rowIdx)}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)),n&&n.children[0]&&"e-cf-databar"===n.children[0].className&&e.style.fontSize&&(n.children[0].querySelector(".e-databar-value").style.fontSize=e.style.fontSize),this.updateRowHeight(e.rowIdx,e.colIdx,e.lastCell,e.onActionUpdate);else{var o=$(e.rowIdx,e.colIdx,r);if(o&&o.wrap||!this.isHeightCheckNeeded(e.style)||mt(r,e.rowIdx,e.colIdx,gt(this.parent,e.rowIdx,e.colIdx,r,e.style)),e.lastCell){var s=vt(r,e.rowIdx);s>20&&s>Se(r,e.rowIdx)&<(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){if(this.checkHeight){var a=0,o=void 0,s=this.parent.getActiveSheet(),l=$(e,r,s,null,!0),h=this.parent.getCell(e,r);if(l&&!l.rowSpan&&!l.colSpan){if(a=gt(this.parent,e,r,s,l.style||this.parent.cellStyle,l.wrap?pt(this.parent.getDisplayText(l),ft(s,e,r),l.style,this.parent.cellStyle):1),!t.isNullOrUndefined(l.value)&&l.value.toString().indexOf("\n")>-1){var d=void 0,p=l.value.split("\n"),c=0,u=p.length;for(d=0;dm)&<(this.parent,s,o,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||r.indexOf("borderTop")>-1||r.indexOf("borderBottom")>-1},e.prototype.setLeftBorder=function(e,t,r,n,i,a,o){if(!o||!o.includes("Column"))for(var s=0;s2&&(!d.rows[t]||!d.rows[t].customHeight))if(l)this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o);else{var p=Se(d,t),c=Math.ceil(this.parent.calculateHeight(this.parent.getCellStyleValue(["fontFamily","fontSize"],[t,r]),1,3));c>p&&(lt(this.parent,d,c,t,i,a,!1),this.parent.notify(Qt,{rowIdx:t,threshold:c-20}))}!o||!s&&this.checkHeight||!(h<3)||d.rows[t]&&d.rows[t].customHeight||(this.checkHeight||(this.checkHeight=!0),this.updateRowHeight(t,r,s,o))},e.prototype.getBorderSize=function(e){var t=e.split(" ")[0];return"thin"===t?1:"medium"===t?2:"thick"===t?3:parseInt(t,10)?parseInt(t,10):1},e.prototype.clearObj=function(e){var r,n,i=e.options,a=i.range?i.range.indexOf("!")>0?i.range.split("!")[1]:i.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,o=i.range&&i.range.indexOf("!")>0?ae(this.parent,i.range.split("!")[0]):this.parent.activeSheetIndex,s=c(a),l=this.parent.sheets[o],h=s[0],d=s[2],p={range:a,type:i.type,requestType:"clear",sheetIndex:o};if(e.isPublic||this.parent.notify(ir,{action:"beforeClear",eventArgs:p}),"Clear Formats"===i.type||"Clear All"===i.type)for(this.parent.notify(Mt,{range:a,isPublic:!1}),h;h<=d;h++)for(r=s[1],n=s[3],r;r<=n;r++){var u=$(h,r,l),f=this.parent.getCell(h,r);u&&(u.wrap&&this.parent.notify(At,{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(m([h,r,h,r]))))}if("Clear Hyperlinks"===i.type)return void this.parent.removeHyperlink(a);this.parent.notify("clear",{range:l.name+"!"+a,type:i.type}),this.parent.serviceLocator.getService("cell").refreshRange(c(a)),e.isPublic||(p={range:l.name+"!"+a,type:i.type,sheetIndex:o},this.parent.notify("actionComplete",{eventArgs:p,action:"clear"})),this.parent.notify("selectRange",{address:a})},e.prototype.addEventListener=function(){this.parent.on(It,this.applyCellFormat,this),this.parent.on(lr,this.clearObj,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(jt,this.addEventListener),this.parent.off(It,this.applyCellFormat),this.parent.off(lr,this.clearObj))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null,this.row=null,this.checkHeight=null},e.prototype.getModuleName=function(){return"cellformat"},e}(),zn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on("contentLoaded",this.wireEvents,this),this.parent.on(tr,this.autoFit,this),this.parent.on("setAutoFit",this.setAutoFitHandler,this)},e.prototype.autoFit=function(e){for(var t=e.isRow?this.parent.getRowHeaderTable():this.parent.getColHeaderTable().rows[0],r=e.startIndex;r<=e.endIndex;r++)this.trgtEle=e.isRow?this.parent.getRow(r,t):this.parent.getCell(null,r,t),this.setAutofit(r,!e.isRow)},e.prototype.wireEvents=function(){var e=this.parent.getRowHeaderContent(),r=this.parent.element.getElementsByClassName("e-header-panel")[0];t.EventHandler.add(r,"dblclick",this.dblClickHandler,this),t.EventHandler.add(e,"dblclick",this.dblClickHandler,this),t.EventHandler.add(r,"mousedown",this.mouseDownHandler,this),t.EventHandler.add(e,"mousedown",this.mouseDownHandler,this),this.wireResizeCursorEvent(e,r)},e.prototype.wireResizeCursorEvent=function(e,r){t.EventHandler.add(e,"mousemove",this.setTarget,this),t.EventHandler.add(r,"mousemove",this.setTarget,this)},e.prototype.unWireResizeCursorEvent=function(){t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousemove",this.setTarget),t.EventHandler.remove(this.parent.element.getElementsByClassName("e-header-panel")[0],"mousemove",this.setTarget)},e.prototype.unwireEvents=function(){t.EventHandler.remove(this.parent.getColumnHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"dblclick",this.dblClickHandler),t.EventHandler.remove(this.parent.getColumnHeaderContent(),"mousedown",this.mouseDownHandler),t.EventHandler.remove(this.parent.getRowHeaderContent(),"mousedown",this.mouseDownHandler),this.unWireResizeCursorEvent()},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("contentLoaded",this.wireEvents),this.parent.off(tr,this.autoFit),this.parent.off("setAutoFit",this.setAutoFitHandler))},e.prototype.mouseMoveHandler=function(e){var t=this.parent.element.getElementsByClassName("e-colresize-handler")[0],r=this.parent.element.getElementsByClassName("e-rowresize-handler")[0];(t||r)&&(this.isMouseMoved=!0,t?e.x>this.trgtEle.parentElement.firstChild.getBoundingClientRect().left&&(t.style.left=e.clientX-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().left+"px"):r&&e.y>=this.trgtEle.parentElement.parentElement.firstChild.getBoundingClientRect().top&&(r.style.top=e.clientY-document.getElementById(this.parent.element.id+"_sheet").getBoundingClientRect().top+"px"))},e.prototype.mouseDownHandler=function(e){if(t.closest(e.target,".e-header-cell")){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&&n1&&(i=r);else if(t.closest(r,".e-row")){o=e.offsetY,a=r.offsetHeight,s="e-rowresize";var l=this.getRowPrevSibling(r);l?i=l.firstElementChild:Number(r.parentElement.getAttribute("aria-rowindex"))>1&&(i=r)}if(a-2<8&&o!==Math.ceil((a-2)/2))oMath.ceil((a-2)/2)&&r.classList.add(s);else if(a-5=10)r.classList.add(s);else if(o<5&&i&&a>=10)r.classList.add(s),i.classList.add(s);else for(var h=this.parent.element.getElementsByClassName(s),d=0;d=10&&r.classList.contains("e-colresize")){var n=this.parent.getActiveSheet(),i=Number(this.trgtEle.getAttribute("aria-colindex"))-2;(a=this.getColPrevSibling(r))&&!Ae(n,i)?this.trgtEle=a:i>-1&&this.trgtEle.classList.add("e-unhide-column")}}else if(r.offsetHeight<10&&e.offsetY=10&&r.classList.contains("e-rowresize")){var n=this.parent.getActiveSheet(),i=Number(r.parentElement.getAttribute("aria-rowindex"))-2,a=this.getRowPrevSibling(r);if(a||be(n,i))if("dblclick"===e.type&&be(n,i)){var o=x(c(n.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(er,s)}else be(n,i)||(this.trgtEle=a.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(),a=this.parent.getMainContent(),o=t?Re(this.parent.getActiveSheet(),e)+"px":Se(this.parent.getActiveSheet(),e)+"px",s=[],l=a.getElementsByClassName("e-content-table")[0];this.parent.getActiveSheet().showHeaders&&(t?this.parent.getColHeaderTable():this.parent.getRowHeaderTable()).getElementsByTagName("tr");var h=!1,d=0;if(t)for(var p=i.rows.length,c=0;cy?-(parseInt(o,10)-y):y-parseInt(o,10);if(t)if(e>=this.parent.viewport.leftIndex&&e<=this.parent.viewport.rightIndex)Ie(i,e).width=y>0?y:0,this.resizeStart(e,this.parent.getViewportIndex(e,!0),y+"px",t,!0,r),this.parent.notify("colWidthChanged",{threshold:C,colIdx:e});else{var b,S=Re(i,e);b=y>0?-(S-y):-S,this.parent.notify("colWidthChanged",{threshold:b,colIdx:e}),Ie(i,e).width=y>0?y:0}else if(!t)if(e>=this.parent.viewport.topIndex&&e<=this.parent.viewport.bottomIndex)xe(i,e,(y=y>20?y:20)>0?y:0),this.resizeStart(e,this.parent.getViewportIndex(e),y+"px",t,!0,r),this.parent.notify(Qt,{threshold:C,rowIdx:e});else{var x,w=Se(i,e);x=y>0?-(w-y):-w,this.parent.notify(Qt,{threshold:x,rowIdx:e}),xe(i,e,y>0?y:0)}}},e.prototype.createResizeHandler=function(e,t){var r=this.parent.createElement("div",{className:t}),n=document.getElementById(this.parent.element.id+"_sheet");e.classList.contains("e-colresize")?(r.style.height=this.parent.getMainContent().parentElement.clientHeight+this.parent.getColumnHeaderContent().offsetHeight+"px",r.style.left=this.event.clientX-n.getBoundingClientRect().left+"px",r.style.top="0px"):e.classList.contains("e-rowresize")&&(r.style.width=this.parent.getMainContent().parentElement.clientWidth+"px",r.style.left="0px",r.style.top=this.event.clientY-n.getBoundingClientRect().top+"px"),n.appendChild(r),this.updateCursor()},e.prototype.setColWidth=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=et(r)-n;if(a<0&&n<-a&&(a=-n),r>0){if(this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column"))return this.showHiddenColumns(e,r),void this.parent.notify(nr,{eventArgs:{index:e,width:"0px",isCol:!0,sheetIdx:this.parent.activeSheetIndex,oldWidth:n+"px",hide:!1},action:"resize"});this.resizeStart(e,t,r+"px",!0,!1,n+"px"),Ee(i,e,{width:r,customWidth:!0}),this.parent.notify("colWidthChanged",{threshold:a,colIdx:e})}else this.isMouseMoved&&(this.parent.hideColumn(e),this.parent.notify(nr,{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,a=this.parent.getActiveSheet(),o=c(a.selectedRange);if(e>=o[1]&&e<=o[3]&&o[2]===a.rowCount-1&&u(a.activeCell)[0]===u(a.topLeftCell)[0]?(r=o[1],n=o[3],i=this.parent.getMainContent().querySelector("colgroup")):r=n=e,void 0!==t)for(var s=r;s<=n;s++)Ee(a,s,{width:t,customWidth:!0}),s>=this.parent.viewport.leftIndex&&s<=this.parent.viewport.rightIndex&&!Ae(a,s)&&(i.children[this.parent.getViewportIndex(s,!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(),a=this.parent.frozenColCount(i),o=parseInt(this.parent.getRow(e,null,a).style.height,10),s=r,l=et(parseInt(s,10))-o;l<0&&o<-l&&(l=-o),this.resizeStart(e,t,s,!1,!1,n),Ce(i,e,{height:parseInt(s,10)>0?parseInt(s,10):0,customHeight:!0}),this.parent.notify(Qt,{threshold:l,rowIdx:e,isCustomHgt:!0})},e.prototype.resizeOn=function(e){var t,r,n=this,i=this.parent.getActiveSheet(),a=c(i.activeCell),o=$(a[0],a[1],i);if(this.trgtEle.classList.contains("e-rowresize")){var s=Number(this.trgtEle.parentElement.getAttribute("aria-rowindex"))-2;if(this.isMouseMoved&&be(i,s)&&this.trgtEle.classList.contains("e-skip-resize")&&e.clientY>this.trgtEle.getBoundingClientRect().top){this.trgtEle.classList.remove("e-skip-resize");var l={startIndex:s,endIndex:s,hide:!1,skipAppend:!0};this.parent.notify(er,l);var h=this.parent.getRowHeaderTable().tBodies[0],d=this.parent.getContentTable().tBodies[0];l.hdrRow.style.display="none",l.row.style.display="none",h.insertBefore(l.hdrRow,h.children[l.insertIdx]),d.insertBefore(l.row,d.children[l.insertIdx]),this.trgtEle=l.hdrRow.firstElementChild,l.hdrRow.nextElementSibling.classList.remove("e-hide-end"),l.mergeCollection.forEach(function(e){n.parent.notify(Ht,e)})}else if(this.trgtEle.classList.contains("e-skip-resize")){if(this.trgtEle.classList.remove("e-skip-resize"),!this.isMouseMoved&&be(i,s)||!this.trgtEle.parentElement.previousElementSibling)return;this.trgtEle=this.trgtEle.parentElement.previousElementSibling.getElementsByClassName("e-header-cell")[0]}r=t=parseInt(this.trgtEle.parentElement.getAttribute("aria-rowindex"),10)-1,t=this.parent.getViewportIndex(r);var p=this.parent.frozenColCount(i),u=this.parent.getRow(r,null,p).style.height,f=e.clientY-this.event.clientY+parseInt(u,10);if(f<=0)return this.parent.hideRow(r),Ce(i,r,{height:0,customHeight:!0}),void this.parent.notify(nr,{eventArgs:{index:r,height:"0px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:u},action:"resize"});if(this.setRowHeight(r,t,f+"px",u),o&&o.rowSpan){b=this.parent.getCell(a[0],a[1]);this.parent.element.querySelector(".e-active-cell").style.height=b.offsetHeight+"px"}if("none"===this.trgtEle.parentElement.style.display){var g=this.parent.getActiveSheet(),m=x(c(g.selectedRange));if(r<=m[2]&&r>m[0]){f=Se(g,r);for(var v=void 0,y=m[0];y<=m[2];y++)y!==r&&(u=Se(g,y)+"px",Ce(g,y,{customHeight:!0,height:f}),be(g,y)?v||(v=y):(this.parent.getRow(y).style.height=f+"px",g.showHeaders&&(this.parent.getRow(y,this.parent.getRowHeaderTable()).style.height=f+"px")),this.parent.notify(nr,{eventArgs:{index:y,height:f+"px",isCol:!1,sheetIdx:this.parent.activeSheetIndex,oldHeight:u},action:"resize"}));this.parent.hideRow(m[0],r-1,!1),t+=Math.abs(r-v)}else 0===t||be(g,r-1)?0!==t&&this.trgtEle.parentElement.classList.add("e-hide-end"):this.trgtEle.parentElement.previousElementSibling.classList.remove("e-hide-start"),this.parent.selectRange(g.selectedRange);this.trgtEle.parentElement.style.display="",this.parent.getContentTable().rows[t].style.display=""}}else if(this.trgtEle.classList.contains("e-colresize")){this.isMouseMoved&&this.trgtEle.classList.contains("e-unhide-column")&&e.clientX=t&&(r=e+22),r},e.prototype.destroy=function(){this.unwireEvents(),this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"resize"},e}(),qn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.refreshClients=function(e){ot(e,this.parent)},e.prototype.addEventListener=function(){this.parent.on("collaborativeUpdate",this.refreshClients,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("collaborativeUpdate",this.refreshClients)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"collaborativeEditing"},e}(),jn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.hideShow=function(e){var t=this.parent.getActiveSheet();if(!t.frozenRows&&!t.frozenColumns){if(e.startIndex>e.endIndex){var r=e.startIndex;e.startIndex=e.endIndex,e.endIndex=r}e.actionUpdate&&this.parent.notify(ir,{eventArgs:e,action:"hideShow"}),e.isCol?this.hideCol(e):this.hideRow(e),e.actionUpdate&&this.parent.notify(nr,{eventArgs:e,action:"hideShow"})}},e.prototype.hideRow=function(e){var r,n,i,a,o=this,s=this.parent.getActiveSheet(),l=0;if(e.hide){for(var h=void 0,d=void 0,p=void 0,c=e.startIndex;c<=e.endIndex;c++)if(!be(s,c))if(void 0===n&&(s.showHeaders&&(d=this.parent.getRowHeaderTable()),h=this.parent.getContentTable(),n=this.parent.getViewportIndex(c),l=0),Ce(s,c,{hidden:!0}),p=h&&h.rows[n]){if(!a)for(m=0;m<=s.usedRange.colIndex;m++)if(((r=$(c,m,s)||{}).colSpan||r.rowSpan)&&(e.startIndex>=this.parent.viewport.topIndex||this.parent.scrollSettings.enableVirtualization)){a=!0;break}if(a)continue;if(s.showHeaders&&t.detach(d.rows[n]),t.detach(p),l++,(p=h.rows[n])&&c===e.endIndex)for(var u=void 0,f=(i=yt(s,c+1,!0))!==yt(s,0,!0)&&i===(this.parent.viewport.topIndex>=e.startIndex?e.endIndex+1:this.parent.viewport.topIndex)?"Row":"",m=this.parent.viewport.leftIndex;m<=this.parent.viewport.rightIndex;m++)""!==(F=this.parent.getCellStyleValue(["borderTop"],[i,m]).borderTop)&&(u=p.cells[m],this.parent.notify(It,{onActionUpdate:!1,rowIdx:i,colIdx:m,style:{borderTop:F},row:p,pRow:p.previousElementSibling,first:f,cell:u}))}else c<=this.parent.viewport.bottomIndex?l++:l--;if(a&&(e.startIndex>=this.parent.viewport.topIndex||!this.parent.scrollSettings.enableVirtualization))return this.parent.selectRange(s.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(s.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"},g(e.startIndex,this.parent.viewport.leftIndex)+":"+g(e.endIndex,this.parent.viewport.leftIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col")))}s.showHeaders&&(0===n?d.rows[0]&&d.rows[0].classList.add("e-hide-end"):(d&&d.rows[n-1]&&d.rows[n-1].classList.add("e-hide-start"),d&&d.rows[n]&&d.rows[n].classList.add("e-hide-end")))}else{for(var y=void 0,C=void 0,b=void 0,p=void 0,S=void 0,x=void 0,w=void 0,I=void 0,E=e.startIndex-1,R=void 0,k=[],c=e.startIndex,A=e.endIndex;c<=A;c++)if(be(s,c))if(void 0===R)if(c>this.parent.viewport.bottomIndex){if(Ce(s,c,{hidden:!1}),void 0===I)return}else{void 0===I&&(I=c),Ce(s,c,{hidden:!1}),void 0===n&&(y=document.createDocumentFragment(),C=document.createDocumentFragment(),S=this.parent.serviceLocator.getService("row"),s.showHeaders&&this.parent.getRowHeaderTable()&&(x=this.parent.getRowHeaderTable().tBodies[0]),w=this.parent.getContentTable()?this.parent.getContentTable().tBodies[0]:this.parent.getContentTable(),c-1?!w.children[n-1]||this.parent.getCellStyleValue(["borderBottom"],[L,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;s.showHeaders&&x&&x.insertBefore(y,x.children[n]),w&&w.insertBefore(C,w.children[n]),this.parent.selectRange(s.selectedRange),e.autoFit&&s.showHeaders&&this.parent.notify(tr,{startIndex:e.startIndex,endIndex:e.endIndex,isRow:!0}),k.forEach(function(e){o.parent.notify(Ht,e)}),void 0!==R&&R!==e.endIndex&&(e.startIndex=R,this.hideRow(e))}},e.prototype.hideCol=function(e){for(var t,r=this,n=this.parent.getActiveSheet(),i=[],a=[],o=u(n.topLeftCell),s=e.startIndex;s<=e.endIndex;s++)(e.hide?!Ae(n,s):Ae(n,s))&&(Ee(n,s,{hidden:e.hide}),this.parent.scrollSettings.enableVirtualization&&(sthis.parent.viewport.rightIndex)?s=d){var f=yt(n,p-(c+i.length-d),!1,"columns");return f>-1&&(this.parent.viewport.leftIndex=f,this.parent.viewport.leftIndex-=this.parent.hiddenCount(c,d)),this.parent.viewport.rightIndex=d,p!==this.parent.viewport.leftIndex||c!==this.parent.viewport.rightIndex?this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"}):this.parent.notify("updateTableWidth",{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"},""+m([this.parent.viewport.topIndex,v[0],this.parent.viewport.bottomIndex,v[1]]))}else this.parent.renderModule.refreshUI({skipUpdateOnFirst:this.parent.viewport.leftIndex===yt(n,0,!0,"columns"),rowIndex:this.parent.viewport.topIndex,colIndex:this.parent.viewport.leftIndex,refresh:"Column"})}this.parent.selectRange(n.selectedRange)}else{if(a.length){if(a.sort(function(e,t){return e-t}),this.parent.scrollSettings.enableVirtualization&&a[0]1)&&h.parent.notify("hiddenMerge",{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m]}),u===m){c=yt(e,i+1,!0,"columns");var g=h.parent.getCellStyleValue(["borderLeft"],[d,c]).borderLeft;""!==g&&h.parent.notify(It,{onActionUpdate:!1,rowIdx:d,colIdx:c,style:{borderLeft:g},row:o,first:""}),void 0!==(l=$(n,i,e)||{}).colSpan&&(void 0===l.rowSpan||l.colSpan>1)&&h.parent.notify("hiddenMerge",{rowIdx:n,colIdx:i,model:"col",start:r[0],end:r[m],isEnd:!0})}}),n++,d++);p-1>-1&&e.showHeaders&&a.cells[p-1]&&a.cells[p-1].classList.add("e-hide-start"),a.cells[p]&&a.cells[p].classList.add("e-hide-end")},e.prototype.appendCell=function(e,r){var n,i,a,o,s,l,h=this,d=0;this.parent.scrollSettings.enableVirtualization?(n=this.parent.viewport.topIndex,i=this.parent.viewport.bottomIndex):(n=0,i=e.rowCount-1);var p=this.parent.getContentTable(),c=this.parent.getColHeaderTable(),u=p.getElementsByTagName("colgroup")[0];e.showHeaders&&(s=c.getElementsByTagName("colgroup")[0],a=c.rows[0]);var f=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;)be(e,n)?n++:(o=p.rows[d],r.forEach(function(i,p){if(0===d&&(b[p]=h.parent.getViewportIndex(i,!0),u.children[b[p]]?(u.insertBefore(h.parent.sheetModule.updateCol(e,i),u.children[b[p]]),e.showHeaders&&(y=a.cells[b[p]],0===p&&r[p]&&!Ae(e,r[p]-1)&&y.previousElementSibling.classList.remove("e-hide-start"),a.insertBefore(f.renderColHeader(i),y),p===S&&y.classList.remove("e-hide-end"))):(u.appendChild(h.parent.sheetModule.updateCol(e,i)),e.showHeaders&&a.appendChild(f.renderColHeader(i))),t.detach(u.lastChild),e.showHeaders&&(t.detach(a.lastChild),p===S&&(t.detach(s),c.insertBefore(u.cloneNode(!0),c.tHead[0])))),t.detach(o.lastChild),y=o.cells[b[p]],v=f.render({rowIdx:n,colIdx:i,cell:$(n,i,e),address:g(n,i),lastCell:i===S,isHeightCheckNeeded:!0,first:i!==yt(e,0,!0,"columns")&&i===h.parent.viewport.leftIndex?"Column":"",checkNextBorder:p===S?"Column":""}),y?o.insertBefore(v,y):o.appendChild(v),0===p&&v.previousSibling&&""!==h.parent.getCellStyleValue(["borderLeft"],[d,yt(e,r[r.length-1]+1,!0,"columns")]).borderLeft&&(l=yt(e,r[0]-1,!1,"columns"))>-1&&!h.parent.getCellStyleValue(["borderRight"],[d,l]).borderRight&&!h.parent.getCellStyleValue(["borderLeft"],[d,r[0]]).borderLeft&&(v.previousSibling.style.borderRight=""),void 0!==(m=$(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};h.parent.notify("activeCellMergedRange",x),C.length&&x.range[1]===C[C.length-1].range[1]||C.push(x)}}),n++,d++);C.forEach(function(e){h.parent.notify(Ht,e)}),this.parent.viewport.rightIndex=yt(e,this.parent.viewport.rightIndex-r.length,!1,"columns")},e.prototype.addEventListener=function(){this.parent.on(er,this.hideShow,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.off(er,this.hideShow),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),Wn=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("initiateHyperlink",this.initiateHyperlinkHandler,this),this.parent.on("editHyperlink",this.editHyperlinkHandler,this),this.parent.on("openHyperlink",this.openHyperlinkHandler,this),this.parent.on(Gt,this.hyperlinkClickHandler,this),this.parent.on("createHyperlinkElement",this.createHyperlinkElementHandler,this),this.parent.on(Yt,this.keyUpHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("initiateHyperlink",this.initiateHyperlinkHandler),this.parent.off("editHyperlink",this.editHyperlinkHandler),this.parent.off("openHyperlink",this.openHyperlinkHandler),this.parent.off(Gt,this.hyperlinkClickHandler),this.parent.off("createHyperlinkElement",this.createHyperlinkElementHandler),this.parent.off(Yt,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"),a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;n&&n.value&&(j(n.value.toUpperCase())?i&&(i.remove(),a.removeAttribute("disabled")):(this.showDialog(),a.setAttribute("disabled","true")))}if(r.classList.contains("e-text")&&t.closest(r,".e-cont")&&t.closest(r,".e-webpage")&&t.closest(r,".e-webpage").getElementsByClassName("e-cont")[1]===r.parentElement){a=(t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):!!t.closest(r,".e-link-dialog").querySelector(".e-webpage").querySelectorAll(".e-cont")[1].querySelector(".e-text").value||a.setAttribute("disabled","true")}},e.prototype.initiateHyperlinkHandler=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.getActiveSheet();if(r.isProtected&&!r.protectSettings.insertLink)return void this.parent.notify("editAlert",null);if(!this.parent.element.querySelector(".e-hyperlink-dlg")){var n=this.parent.serviceLocator.getService(Ai);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(),Ct(e.parent.element)},open:function(){setTimeout(function(){Ct(n.dialogInstance.element.querySelectorAll(".e-webpage input")[1])})},buttons:[{buttonModel:{content:t.getConstant("Insert"),isPrimary:!0,disabled:!0},click:function(){e.dlgClickHandler(),n.hide()}}]})}},e.prototype.dlgClickHandler=function(){var e,t,r=this.parent.element.querySelector(".e-link-dialog").getElementsByClassName("e-content")[0].querySelector(".e-item.e-active");if(r)if(r.querySelector(".e-webpage")){e=r.getElementsByClassName("e-cont")[0].querySelector(".e-text").value;o={address:t=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,e,!1)}else{e=r.getElementsByClassName("e-cont")[0].querySelector(".e-text").value,t=r.getElementsByClassName("e-cont")[1].querySelector(".e-text").value;var n=r.getElementsByClassName("e-cont")[2];if(n.getElementsByClassName("e-list-item")[0].querySelector(".e-active")){o={address:t=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent+"!"+t.toUpperCase()};this.parent.insertHyperlink(o,this.parent.getActiveSheet().activeCell,e,!1)}else if(n.querySelector(".e-active"))for(var i=r.getElementsByClassName("e-cont")[2].querySelector(".e-active").textContent,a=0;a=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(o)){var w=m(i);if(o===this.parent.getActiveSheet())Le(function(){r.parent.goTo(w)});else{if(w.indexOf(":")>=0){var I=w.split(":");w=I[0]===I[1]?I[0]:w}Le(function(){r.parent.goTo(r.parent.sheets[g].name+"!"+w)})}}}else this.showInvalidHyperlinkDialog()}}else this.isValidUrl(d)?window.open(d,p.target):this.showInvalidHyperlinkDialog();this.parent.trigger("afterHyperlinkClick",u)}},e.prototype.isValidUrl=function(e){return/(ftp|http|https):\/\/(\w+:{0,1}\w*@)?(\S+)(:[0-9]+)?(\/|\/([\w#!:.?+=&%@!\-\/]))?/.test(e)},e.prototype.showInvalidHyperlinkDialog=function(){var e=this.parent.serviceLocator.getService(Ai),t=this.parent.serviceLocator.getService(ki);e.show({width:323,isModal:!0,showCloseIcon:!0,header:t.getConstant("Hyperlink"),content:t.getConstant("InvalidHyperlinkAlert"),buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.hide()}}]},!1)},e.prototype.hyperlinkClickHandler=function(e){var r=e.target;if(t.closest(r,".e-link-dialog")&&t.closest(r,".e-toolbar-item")){var n=(c=(p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg")).getElementsByClassName("e-footer-content")[0]).firstChild,i=p.querySelector(".e-document"),a=p.querySelector(".e-webpage"),o=a?a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value,s=i?i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value:o;if(t.closest(r,".e-toolbar-items").getElementsByClassName("e-toolbar-item")[1].classList.contains("e-active")){var l=i.querySelectorAll(".e-cont")[2].querySelector(".e-active");i.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=o,t.closest(l,".e-list-item").classList.contains("e-level-2")&&n.hasAttribute("disabled")?n.removeAttribute("disabled"):t.closest(l,".e-list-item").classList.contains("e-level-1")&&!n.hasAttribute("disabled")&&n.setAttribute("disabled","true")}else{var h=!a.querySelectorAll(".e-cont")[1].querySelector(".e-text").value;a.querySelectorAll(".e-cont")[0].querySelector(".e-text").value=s,h&&!n.hasAttribute("disabled")?n.setAttribute("disabled","true"):!h&&n.hasAttribute("disabled")&&n.removeAttribute("disabled")}}if(t.closest(r,".e-list-item")&&r.classList.contains("e-fullrow")){var d=this.parent.element.getElementsByClassName("e-link-dialog")[0].getElementsByClassName("e-content")[0].getElementsByClassName("e-active")[0].getElementsByClassName("e-cont")[1].getElementsByClassName("e-text")[0],p=t.closest(r,".e-hyperlink-dlg")||t.closest(r,".e-edithyperlink-dlg"),c=p.getElementsByClassName("e-footer-content")[0],n=c.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=this.parent.createElement("a",{className:"e-hyperlink e-hyperlink-style"});if(i.style.color="#00e",t.isNullOrUndefined(r.hyperlink))n.querySelector("a")&&r.hyperlink&&"string"==typeof r.hyperlink&&n.querySelector("a").setAttribute("href",r.hyperlink);else{var a=r.hyperlink;"string"==typeof a?(-1===a.indexOf("http://")&&-1===a.indexOf("https://")&&-1===a.indexOf("ftp://")&&-1!==a.indexOf("www.")&&(a="http://"+a),0===a.indexOf("http://")||0===a.indexOf("https://")||0===a.indexOf("ftp://")?(i.setAttribute("href",a),i.setAttribute("target","_blank")):(a.includes("=")||a.includes("!"))&&i.setAttribute("ref",a),i.innerText=""!==n.innerText?n.innerText:a,n.textContent="",n.innerText="",n.appendChild(i)):"object"==typeof a&&(0===a.address.indexOf("http://")||0===a.address.indexOf("https://")||0===a.address.indexOf("ftp://")?(i.setAttribute("href",a.address),i.setAttribute("target","_blank")):(a.address.includes("=")||a.address.includes("!"))&&i.setAttribute("ref",a.address),"Accounting"===H(r.format)?i.innerHTML=n.innerHTML:i.innerText=""!==n.innerText?n.innerText:a.address,n.textContent="",n.innerText="",n.appendChild(i))}},e.prototype.hyperEditContent=function(){var e=!0,t=this.hyperlinkContent(),r=c(this.parent.getActiveSheet().activeCell),n=this.parent.sheets[this.parent.getActiveSheet().id-1].rows[r[0]].cells[r[1]];this.parent.scrollSettings.enableVirtualization&&(r[0]=r[0]-this.parent.viewport.topIndex,r[1]=r[1]-this.parent.viewport.leftIndex);var i,a=this.parent.getDisplayText(n),o=n.hyperlink;"string"==typeof o?(i=o,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1)):"object"==typeof o&&(i=o.address,a=a||i,-1===i.indexOf("http://")&&-1===i.indexOf("https://")&&-1===i.indexOf("ftp://")&&(e=!1));for(var s=0,l=0,h=this.parent.definedNames,d=this.parent.sheets,p=0,u=h.length;pthis.undoRedoStep&&this.undoCollection.splice(0,1),this.redoCollection.length>this.undoRedoStep&&this.redoCollection.splice(0,1),this.updateUndoRedoIcons();var n=Object.assign({},r.eventArgs);n.requestType=e.isUndo?"undo":"redo",delete n.beforeActionData,e.isPublic||(this.parent.notify("triggerDataChange",t.extend({isUndo:e.isUndo},r,null,!0)),this.parent.notify(nr,{eventArgs:n,action:"undoRedo"})),this.parent.notify("refreshRibbonIcons",null)}},e.prototype.updateUndoRedoCollection=function(e){var t=["clipboard","format","sorting","cellSave","resize","resizeToFit","wrap","hideShow","replace","validation","merge","clear","conditionalFormat","clearCF","insertImage","imageRefresh","insertChart","deleteChart","chartRefresh","filter","cellDelete"];"insert"!==e.args.action&&"delete"!==e.args.action||"Sheet"===e.args.eventArgs.modelType||t.push(e.args.action);var r=e.args.action;if(-1!==t.indexOf(r)||e.isPublic){var n=e.args.eventArgs;if("clipboard"===r||"sorting"===r||"format"===r||"cellSave"===r||"wrap"===r||"replace"===r||"validation"===r||"clear"===r||"conditionalFormat"===r||"clearCF"===r||"insertImage"===r||"imageRefresh"===r||"insertChart"===r||"chartRefresh"===r||"filter"===r||"cellDelete"===r){var i={beforeDetails:{cellDetails:[]}};this.parent.notify("getBeforeActionData",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(ki);this.parent.notify("enableToolbarItems",[{tab:e.getConstant("Home"),items:[this.parent.element.id+"_undo"],enable:this.undoCollection.length>0}]),this.parent.notify("enableToolbarItems",[{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("!"),a=c(i[1]),o=ae(this.parent,i[0]),s=ce(this.parent,o),l=n.copiedInfo,h=n.beforeActionData,d=this.checkRefreshNeeded(o);if("imagePaste"===e.eventArgs.requestType){var p=n.copiedShapeInfo;this.isUndo?(t=p.pictureElem,p.isCut?(this.parent.notify(pr,{id:t.id,sheetIdx:n.pasteSheetIndex+1}),this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:p.height,width:p.width,imageId:t.id},range:p.copiedRange,isPublic:!1,isUndoRedo:!0})):this.parent.notify(pr,{id:n.pastedPictureElement.id,sheetIdx:n.pasteSheetIndex+1})):p.isCut?(t=p.pictureElem,this.parent.notify(pr,{id:t.id,sheetIdx:p.sId}),this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:p.height,width:p.width,imageId:t.id},range:p.pastedRange,isPublic:!1,isUndoRedo:!0})):(t=n.pastedPictureElement,this.parent.notify(dr,{options:{src:t.style.backgroundImage.replace(/url\((['"])?(.*?)\1\)/gi,"$2"),height:t.offsetHeight,width:t.offsetWidth,imageId:t.id},range:p.pastedRange,isPublic:!1,isUndoRedo:!0}))}else{if(this.isUndo){if(l.isCut){var u=h.cutCellDetails;this.updateCellDetails(u,ce(this.parent,oe(this.parent,l.sId)),x(l.range),d),this.parent.notify("getFilteredCollection",null);for(var f=0;f=C[0]&&y[2]<=C[2]){this.parent.notify(rr,{predicates:null,range:v.filterRange,sIdx:n.pasteSheetIndex,isCut:!0});var b=[Math.abs(C[0]-y[0]),Math.abs(C[1]-y[1]),Math.abs(C[2]-y[2]),Math.abs(C[3]-y[3])],S=x(l.range);b=[S[0]+b[0],S[1]+b[1],Math.abs(S[2]-b[2]),Math.abs(S[3]-b[3])],this.parent.notify(rr,{predicates:null,range:m(b),sIdx:g,isCut:!0})}}}}h&&this.updateCellDetails(h.cellDetails,s,a,d),mt(s,a[0],a[1],20);var w=vt(s,a[0]);lt(this.parent,s,w,a[0]),n.mergeCollection.forEach(function(e){e.merge=!e.merge,r.parent.notify(Ht,e),e.merge=!e.merge})}else ot(e,this.parent,l.isCut);d&&this.parent.notify("selectRange",{address:i[1]})}return e},e.prototype.undoForResize=function(e){var t=e.eventArgs;if(void 0===t.hide)if(t.isCol){r=t.oldWidth;t.oldWidth=t.width,t.width=r}else{var r=t.oldHeight;t.oldHeight=t.height,t.height=r}else t.hide=!t.hide;ot(e,this.parent);var n=this.parent.getActiveSheet(),i=c(n.activeCell),a=$(i[0],i[1],n);if(a&&a.rowSpan){o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.height=o.offsetHeight+"px"}else if(a&&a.colSpan){var o=this.parent.getCell(i[0],i[1]);this.parent.element.querySelector(".e-active-cell").style.width=o.offsetWidth+"px"}return e},e.prototype.performOperation=function(e){var t=e.eventArgs,r="cellSave"===e.action||"wrap"===e.action||"replace"===e.action||"cellDelete"===e.action?t.address.split("!"):t.range.split("!"),n=c(r[1]),i=n,a=ae(this.parent,r[0]),o=ce(this.parent,a),s=t.beforeActionData,l=this.checkRefreshNeeded(a);if(this.isUndo)this.updateCellDetails(s.cellDetails,o,n,l,e);else{var h=e.eventArgs,d=c(o.activeCell),p=this.parent.getCellStyleValue(["textDecoration"],d).textDecoration;if(h&&h.style&&h.style.textDecoration){var u=h.style.textDecoration,f=u,g=void 0,m=!1;"underline"===p?f="underline"===u?"none":"underline line-through":"line-through"===p?f="line-through"===u?"none":"underline line-through":"underline line-through"===p&&(f="underline"===u?"line-through":"underline",m=!0),"none"===f&&(m=!0),h.style.textDecoration=f,e.eventArgs=h,this.parent.notify(wt,{style:{textDecoration:f},range:d,refreshRibbon:!0,onActionUpdate:!0});for(var v=i[0];v<=i[2];v++)for(var y=i[1];y<=i[3];y++)if(v!==d[0]||y!==d[1]){if(g={},"none"===(p=this.parent.getCellStyleValue(["textDecoration"],[v,y]).textDecoration)){if(m)continue;g.textDecoration=u}else if("underline"===p||"line-through"===p)if(m){if(u!==p)continue;g.textDecoration="none"}else g.textDecoration=u!==p?"underline line-through":u;else if("underline line-through"===p){if(!m)continue;g.textDecoration="underline"===u?"line-through":"underline"}this.parent.notify(wt,{style:{textDecoration:g.textDecoration},range:[v,y,v,y],refreshRibbon:!0,onActionUpdate:!0})}h.style.textDecoration=u,e.eventArgs=h}else ot(e,this.parent,!0)}return l&&this.parent.notify("selectRange",{address:r[1]}),e},e.prototype.getCellDetails=function(e,t){for(var r,n=[],i=(e=x(e))[0];i<=e[2];i++)for(var a=e[1];a<=e[3];a++)r=$(i,a,t),n.push({rowIndex:i,colIndex:a,format:r?r.format:null,isLocked:r?r.isLocked:null,style:r&&r.style?Object.assign({},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&&r.chart});return n},e.prototype.updateCellDetails=function(e,r,n,i,a){for(var o,s=e.length,l=0;l1?h+n.colSpan-1:h);var d=this.parent.getDisplayText(n);if(d.indexOf("\n")<0){var p=this.parent.element.querySelector(".e-spreadsheet-edit");p&&p.textContent.indexOf("\n")>-1&&(d=p.textContent)}if(d)if(e.wrap){r&&r.classList.contains("e-alt-unwrap")&&r.classList.remove("e-alt-unwrap");var c=void 0,u=0,f=void 0;if(d.indexOf("\n")>-1){var g=d.split("\n"),m=g.length;for(f=0;f1){var v=we(e.sheet,l,l+(n.rowSpan-1));if(v>=o)return;s=o=Se(e.sheet,l)+(o-v)}mt(e.sheet,l,h,s)}else d.indexOf("\n")>-1&&r.classList.add("e-alt-unwrap"),s=gt(this.parent,l,h,e.sheet,n.style||this.parent.cellStyle,1),mt(e.sheet,l,h,s),o=Math.max(vt(e.sheet,l),20);else e.wrap||(mt(e.sheet,l,h,20),o=20);h===e.range[3]&&(e.wrap&&o>20&&vt(e.sheet,l)<=o||!e.wrap&&vt(e.sheet,l)20)&<(this.parent,e.sheet,o,l,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=b(this.parent.getActiveSheet()),a={address:i,wrap:n,cancel:!1};this.parent.notify(ir,{action:"beforeWrap",eventArgs:a}),a.cancel||(Q(this.parent.getActiveSheet().selectedRange,n,this.parent),this.parent.notify(nr,{action:"wrap",eventArgs:{address:i,wrap:n}}))}},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;i0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify("refreshImagePosition",{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"insert"})},e.prototype.addEventListener=function(){this.parent.on("insert",this.insert,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("insert",this.insert)},e.prototype.getModuleName=function(){return"insert"},e}(),Kn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.delete=function(e){var t;if(e.isAction&&(t=!0,delete e.isAction),t&&this.parent.notify(ir,{eventArgs:e,action:"delete"}),"Sheet"===e.modelType){var r=e.activeSheetIndex>=e.startIndex&&e.activeSheetIndex<=e.endIndex;r&&this.parent.setProperties({activeSheetIndex:this.parent.skipHiddenSheets(e.startIndex0&&("Row"===r&&s>=n||"Column"===r&&l>=n)&&this.parent.notify("refreshImagePosition",{rowIdx:s,colIdx:l,sheetIdx:t,type:r,count:e,status:"delete"})},e.prototype.addEventListener=function(){this.parent.on("delete",this.delete,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("delete",this.delete)},e.prototype.getModuleName=function(){return"delete"},e}(),$n=function(){function e(e){this.data=[],this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener();var e=t.select("#"+this.parent.element.id+"_datavalidation-popup");e&&e.remove(),this.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("initiatedatavalidation",this.initiateDataValidationHandler,this),this.parent.on("invalidData",this.invalidDataHandler,this),this.parent.on("isValidation",this.checkDataValidation,this),this.parent.on("activeCellChanged",this.listHandler,this),this.parent.on(Yt,this.keyUpHandler,this),this.parent.on("removeDataValidation",this.removeValidationHandler,this),this.parent.on("validationHighlight",this.InvalidElementHandler,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("initiatedatavalidation",this.initiateDataValidationHandler),this.parent.off("invalidData",this.invalidDataHandler),this.parent.off("isValidation",this.checkDataValidation),this.parent.off("activeCellChanged",this.listHandler),this.parent.off(Yt,this.keyUpHandler),this.parent.off("removeDataValidation",this.removeValidationHandler),this.parent.off("validationHighlight",this.InvalidElementHandler))},e.prototype.removeValidationHandler=function(e){var t=this.getRange(this.parent.getActiveSheet().selectedRange);this.parent.removeDataValidation(t)},e.prototype.mouseDownHandler=function(e){var r=e.target,n=t.closest(r,".e-ddl");n&&n.getAttribute("id")===this.parent.element.id+"listValid_popup"&&this.parent.notify("formulaBarOperation",{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"),a=i.querySelector(".e-dlg-error"),o=n.querySelector(".e-footer-content").querySelector(".e-primary");o.hasAttribute("disabled")&&o.removeAttribute("disabled"),a&&i.removeChild(a)}},e.prototype.listOpen=function(e){var t=e.target;this.listObj&&t.classList.contains("e-cell")&&t.querySelector(".e-validation-list")&&this.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=this.parent.getActiveSheet(),n=u(r.activeCell),i=$(n[0],n[1],r),a=Ie(r,n[1]),s=this.parent.getCell(n[0],n[1]),l=void 0;if(!s)return;if(document.getElementsByClassName("e-validation-list")[0]&&(t.remove(document.getElementsByClassName("e-validation-list")[0]),this.data=[]),i&&i.validation?l=i.validation:a&&a.validation&&(l=a.validation),l&&"List"===l.type&&(l.ignoreBlank=!!t.isNullOrUndefined(l.ignoreBlank)||l.ignoreBlank,l.inCellDropDown=!!t.isNullOrUndefined(l.inCellDropDown)||l.inCellDropDown,l.inCellDropDown)){var h=this.parent.createElement("div",{className:"e-validation-list"}),d=this.parent.createElement("input",{id:this.parent.element.id+"listValid"});h.appendChild(d),l.inCellDropDown||(h.style.display="none"),s.insertBefore(h,s.firstChild);var p=this.updateDataSource(i,l);this.listObj=new o.DropDownList({index:this.setDropDownListIndex(p,i,l),dataSource:p,fields:{text:"text",value:"id"},width:"0px",popupWidth:s.offsetWidth-1,popupHeight:"200px",change:function(){e.listValueChange(e.listObj.text)},open:function(e){e.popup.offsetX=4-(s.offsetWidth-20),e.popup.offsetY=-13}}),this.listObj.appendTo("#"+this.parent.element.id+"listValid")}i&&i.validation&&(i.validation=l)}},e.prototype.setDropDownListIndex=function(e,t,r){if(t&&t.value)for(var n=0,i=e.length;n-1?ce(this.parent,ae(this.parent,n.split("=")[1].split("!")[0])):this.parent.getActiveSheet(),a=n.indexOf("!")>-1?n.split("!")[1]:n.split("=")[1],o=void 0,s=a.split(":");if(s[0].match(/[a-z]+$/gi)&&s[1].match(/[a-z]+$/gi)||s[0].match(/^[0-9]/g)&&s[1].match(/^[0-9]/g)){var l=this.parent.getIndexes(a);o=l.isCol?[0,l.startIdx,i.usedRange.rowIndex,l.startIdx]:[l.startIdx,0,l.startIdx,i.usedRange.colIndex]}else o=c(a);for(var h=o[0];h<=o[2];h++){i.rows[h]||Ce(i,h,{});for(var d=o[1];d<=o[3];d++){i.rows[h].cells||Z(h,d,i,{}),r+=1,e=i.rows[h].cells[d];var p=this.parent.getDisplayText(e)?this.parent.getDisplayText(e):"";this.data.push({text:p,id:"list-"+r})}}}else for(var u=n.split(","),f=0;f-1?c.split("!")[1]:c.split("=")[1],x=!(c.indexOf("!")>-1)||ae(this.parent,c.split("=")[1].split("!")[0])>-1;C=S.split(":");var w=!!S.match(/[a-z]/gi)&&C[0].replace(/[0-9]/g,"")===C[1].replace(/[0-9]/g,""),I=!!S.match(/\d/g)&&C[0].replace(/\D/g,"")===C[1].replace(/\D/g,"");(i=!!x&&(!!w||!!I))||(t=n.getConstant("DialogError"))}}else c.length>256&&(i=!1,t=n.getConstant("ListLengthError"));if("List"!==y||i){var E=this.parent.getActiveSheet(),R=y,k=this.isDialogValidator(b,R,r);if(t=k.errorMsg,i=k.isValidate){var A=u(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:c,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 L=this.parent.createElement("div",{className:"e-dlg-error",id:"e-invalid",innerHTML:t});p.appendChild(L),o.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(ki),a=0;if("List"===t?!(e.length>0):"Between"===r||"NotBetween"===r?2!==e.length:!(e.length>0))n={isValidate:!1,errorMsg:i.getConstant("EmptyError")};else{for(var o=0;o=p&&d<=c||!(!g||""!==o);break;case"NotBetween":n=!(d>=p&&d<=c);break;case"GreaterThan":n=d>p||!(!g||""!==o);break;case"LessThan":n=d=p||!(!g||""!==o);break;case"LessThanOrEqualTo":n=d<=p||!(!g||""!==o)}}}if(i=r.getConstant("ValidationError"),n){var S=this.parent.getCellStyleValue(["backgroundColor","color"],[e.range[0],e.range[1]]);this.parent.notify(It,{style:S,rowIdx:e.range[0],colIdx:e.range[1],isHeightCheckNeeded:!0,manualUpdate:!0,onActionUpdate:!0})}return{isValidate:n,errorMsg:i}},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=this.parent.element.getElementsByClassName("e-sheet-panel")[0],a=this.parent.createElement("form",{id:"formId",className:"form-horizontal"}),o=this.parent.createElement("input",{id:"e-validation",innerHTML:e});o.setAttribute("name","validation"),o.setAttribute("type","text"),o.setAttribute("value",e),a.appendChild(o),n.appendChild(a);var s;switch(t){case"Date":s={rules:{validation:{date:!0}},customPlacement:function(e,t){r=t.innerText}};break;case"Decimal":s={rules:{validation:{number:!0}},customPlacement:function(e,t){r=t.innerText}};break;case"WholeNumber":s={rules:{validation:{regex:/^\d*\.?[0]*$/}},customPlacement:function(e,t){r=t.innerText}}}var l=new i.FormValidator("#formId",s).validate();return n.removeChild(n.getElementsByClassName("form-horizontal")[0]),{isValidate:l,errorMsg:r}},e.prototype.InvalidElementHandler=function(e){var t=e.rowIdx,r=e.colIdx,n=e.isRemoveHighlightedData;if(n){if(n){var i=this.parent.getCellStyleValue(["backgroundColor","color"],[t,r]);this.parent.notify(It,{style:i,rowIdx:t,colIdx:r,cell:e.td})}}else this.parent.notify(It,{style:{backgroundColor:"#ffff00",color:"#ff0000"},rowIdx:t,colIdx:r,cell:e.td})},e.prototype.validationErrorHandler=function(e){var t=this,r=document.getElementsByClassName("e-spreadsheet-edit")[0],n=this.parent.serviceLocator.getService(ki);if(!this.parent.element.querySelector(".e-validationerror-dlg")){var i=this.parent.serviceLocator.getService(Ai),a={width:400,height:200,isModal:!0,showCloseIcon:!0,cssClass:"e-validationerror-dlg",target:document.querySelector(".e-control.e-spreadsheet"),beforeOpen:function(n){var a={dialogName:"ValidationErrorDialog",element:n.element,target:n.target,cancel:n.cancel,content:e};t.parent.trigger("dialogBeforeOpen",a),a.cancel&&(t.errorDlgHandler(i,"Cancel"),n.cancel=!0),r.focus(),i.dialogInstance.content=a.content,i.dialogInstance.dataBind()},buttons:[{buttonModel:{content:n.getConstant("Retry"),isPrimary:!0},click:function(){t.errorDlgHandler(i,"Retry")}},{buttonModel:{content:n.getConstant("Cancel")},click:function(){t.errorDlgHandler(i,"Cancel")}}]};i.show(a,!1)}},e.prototype.errorDlgHandler=function(e,t){if("Retry"===t){var r=document.getElementsByClassName("e-spreadsheet-edit")[0];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 a=u(this.parent.getActiveSheet().activeCell),o=$(a[0],a[1],this.parent.getActiveSheet()),s=o?this.parent.getDisplayText(o):"";this.parent.notify(Wt,{action:"cancelEdit",value:s,refreshFormulaBar:!0,refreshEditorElem:!0,isAppend:!1,trigEvent:!0}),e.hide()}},e.prototype.getModuleName=function(){return"dataValidation"},e}(),Zn=function(){function e(e){this.password="",this.parent=e,this.init()}return e.prototype.init=function(){this.addEventListener()},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on("applyProtect",this.protect,this),this.parent.on("protectSheet",this.protectSheetHandler,this),this.parent.on("editAlert",this.editProtectedAlert,this),this.parent.on("applyLockCells",this.lockCellsHandler,this),this.parent.on("protectWorkbook",this.protectWorkbook,this),this.parent.on(Yt,this.KeyUpHandler,this),this.parent.on("unProtectWorkbook",this.unProtectWorkbook,this),this.parent.on("getPassWord",this.getPassWord,this),this.parent.on("importProtectWorkbook",this.importProtectWorkbook,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyProtect",this.protect),this.parent.off("protectSheet",this.protectSheetHandler),this.parent.off("editAlert",this.editProtectedAlert),this.parent.off("applyLockCells",this.lockCellsHandler),this.parent.off("protectWorkbook",this.protectWorkbook),this.parent.off(Yt,this.KeyUpHandler),this.parent.off("unProtectWorkbook",this.unProtectWorkbook),this.parent.off("getPassWord",this.getPassWord),this.parent.off("importProtectWorkbook",this.importProtectWorkbook))},e.prototype.protect=function(e){this.parent.notify("clearCopy",null),e.isActive?(this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1),this.parent.notify("updateToggleItem",{props:"Protect"}),this.parent.notify("protectSheet",{isActive:e.isActive}),this.parent.notify("protectSelection",null)):this.createDialogue()},e.prototype.createDialogue=function(){var e=this,r=this.parent.serviceLocator.getService(ki),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 s.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.setSheetPropertyOnMute(this.parent.getActiveSheet(),"isProtected",!1);var o=new a.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")}),d=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:d.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),Ct(e.parent.element)},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(o.element,"click",e.checkBoxClickHandler),Ct(e.parent.element)},buttons:[{click:this.selectOption.bind(this,this.dialog,this),buttonModel:{content:r.getConstant("Ok"),isPrimary:!0}}]}),o.appendTo("#"+this.parent.element.id+"_protect_check"),this.optionList.appendTo("#"+this.parent.element.id+"_option_list"),this.optionList.selectMultipleItems([{id:"1"}]),t.EventHandler.add(o.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(ki),t=this.optionList.getSelectedItems();this.parent.setSheetPropertyOnMute(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("protectSelection",null),this.parent.notify("clearUndoRedoCollection",null),this.dialog.hide()},e.prototype.protectSheetHandler=function(){var e=this.parent.getActiveSheet(),t=this.parent.element.id,r=[t+"_undo",t+"_redo",t+"_cut",t+"_copy",t+"_paste",t+"_number_format",t+"_font_name",t+"_font_size",t+"_bold",t+"_italic",t+"_line-through",t+"_underline",t+"_font_color_picker",t+"_fill_color_picker",t+"_borders",t+"_merge_cells",t+"_text_align",t+"_vertical_align",t+"_wrap",t+"_sorting",t+"_clear",t+"_conditionalformatting"],n=[t+"_cut",t+"_copy",t+"_number_format",t+"_font_name",t+"_font_size",t+"_bold",t+"_italic",t+"_line-through",t+"_underline",t+"_font_color_picker",t+"_fill_color_picker",t+"_borders",t+"_text_align",t+"_vertical_align",t+"_wrap",t+"_sorting",t+"_clear",t+"_conditionalformatting"],i=[t+"_insert_function"],a=[t+"_hyperlink",t+"_",t+"_chart"],o=[t+"_"],s=[t+"_find"],l=[t+"_datavalidation"],h=[t+"_chart"],d=document.getElementById(this.parent.element.id+"_sheet_panel");d&&(e.isProtected&&e.protectSettings.selectCells?d.classList.remove("e-protected"):d.classList.add("e-protected"),e.isProtected||d.classList.remove("e-protected")),this.parent.dataBind(),this.parent.notify("protectCellFormat",{disableHomeBtnId:r,enableHomeBtnId:n,enableFrmlaBtnId:i,enableInsertBtnId:a,findBtnId:s,dataValidationBtnId:l,imageBtnId:o,chartBtnId:h}),this.parent.notify("enableFormulaInput",null),e.isProtected&&this.parent.notify("updateToggleItem",{props:"Protect"})},e.prototype.editProtectedAlert=function(){var e=this,t=this.parent.serviceLocator.getService(ki);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),Ct(e.parent.element)},close:function(){return Ct(e.parent.element)}})},e.prototype.lockCellsHandler=function(e){var t=this.parent.getActiveSheet(),r={isLocked:!!e.isLocked&&e.isLocked};Z(e.rowIdx,e.colIdx,t,r,!0)},e.prototype.protectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.serviceLocator.getService(Ai);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-protectworkbook-dlg",header:t.getConstant("ProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"ProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.passwordProtectContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0},click:function(){e.alertMessage(),e.dlgClickHandler(r)}}]})},e.prototype.passwordProtectContent=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("div",{className:"e-password-dialog"}),r=this.parent.createElement("div",{className:"e-password-content"}),n=this.parent.createElement("div",{className:"e-password-content"}),i=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("Password")}),a=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("ConfirmPassword")}),o=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}}),s=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return o.setAttribute("placeholder",e.getConstant("EnterThePassword")),s.setAttribute("placeholder",e.getConstant("EnterTheConfirmPassword")),r.appendChild(o),r.insertBefore(i,o),n.appendChild(s),n.insertBefore(a,s),t.appendChild(n),t.insertBefore(r,n),t},e.prototype.KeyUpHandler=function(e){var r=e.target;if(r.classList.contains("e-text")&&t.closest(r,".e-password-content")&&t.closest(r,".e-password-dialog")&&t.closest(r,".e-password-dialog").getElementsByClassName("e-password-content")[1]===r.parentElement){var n=t.closest(r,".e-protectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?n.removeAttribute("disabled"):n.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-unprotectpwd-content")&&t.closest(r,".e-unprotectpwd-dialog")&&t.closest(r,".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0]===r.parentElement){var i=t.closest(r,".e-unprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?i.removeAttribute("disabled"):i.setAttribute("disabled","true")}if(r.classList.contains("e-text")&&t.closest(r,".e-importprotectpwd-content")&&t.closest(r,".e-importprotectpwd-dialog")&&t.closest(r,".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0]===r.parentElement){var a=t.closest(r,".e-importprotectworkbook-dlg").getElementsByClassName("e-footer-content")[0].firstChild;""!==r.value?a.removeAttribute("disabled"):a.setAttribute("disabled","true")}},e.prototype.alertMessage=function(){var e=this.parent.element.querySelector(".e-pwd-alert-span"),t=this.parent.element.querySelector(".e-unprotectpwd-alert-span"),r=this.parent.element.querySelector(".e-importprotectpwd-alert-span");e&&e.remove(),t&&t.remove(),r&&r.remove()},e.prototype.dlgClickHandler=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[0].querySelector(".e-input"),n=this.parent.element.querySelector(".e-password-dialog").getElementsByClassName("e-password-content")[1].querySelector(".e-input"),i=this.parent.createElement("span",{className:"e-pwd-alert-span"});r.value===n.value?(this.parent.password=r.value,this.parent.isProtected=!0,e.hide(),this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled")),this.parent.notify("updateToggleItem",{props:"Protectworkbook"})):""===r.value?i.textContent=t.getConstant("PasswordAlertMsg"):""===n.value?i.textContent=t.getConstant("ConfirmPasswordAlertMsg"):r.value!==n.value&&(i.textContent=t.getConstant("PasswordAlert")),this.parent.element.querySelector(".e-protectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i)},e.prototype.unProtectWorkbook=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.parent.serviceLocator.getService(Ai);r.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-unprotectworkbook-dlg",header:t.getConstant("UnProtectWorkbook"),beforeOpen:function(t){var n={dialogName:"UnProtectWorkbook",element:t.element,target:t.target,cancel:t.cancel};e.parent.trigger("dialogBeforeOpen",n),n.cancel&&(t.cancel=!0),r.dialogInstance.content=e.unProtectPasswordContent(),r.dialogInstance.dataBind(),e.parent.element.focus()},buttons:[{buttonModel:{content:t.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){e.alertMessage(),e.unprotectdlgOkClick(r)}}]})},e.prototype.unProtectPasswordContent=function(){var e=this.parent.serviceLocator.getService(ki),t=this.parent.createElement("div",{className:"e-unprotectpwd-dialog"}),r=this.parent.createElement("div",{className:"e-unprotectpwd-content"}),n=this.parent.createElement("div",{className:"e-header",innerHTML:e.getConstant("EnterThePassword")}),i=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return r.appendChild(i),r.insertBefore(n,i),t.appendChild(r),t},e.prototype.unprotectdlgOkClick=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.element.querySelector(".e-unprotectpwd-dialog").getElementsByClassName("e-unprotectpwd-content")[0].querySelector(".e-input");if(this.parent.password===r.value)e.hide(),this.parent.password="",this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),document.getElementById(this.parent.element.id+"_protectworkbook").classList.remove("e-active"),this.parent.notify("updateToggleItem",{props:"Protectworkbook"});else{var n=this.parent.createElement("span",{className:"e-unprotectpwd-alert-span",innerHTML:t.getConstant("UnProtectPasswordAlert")});this.parent.element.querySelector(".e-unprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(n)}},e.prototype.getPassWord=function(e){e.passWord=this.password},e.prototype.importProtectWorkbook=function(e){var t=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);n.show({width:323,isModal:!0,showCloseIcon:!0,cssClass:"e-importprotectworkbook-dlg",header:r.getConstant("UnProtectWorkbook"),beforeOpen:function(r){var i={dialogName:"ImportProtectWorkbook",element:r.element,target:r.target,cancel:r.cancel};t.parent.trigger("dialogBeforeOpen",i),i.cancel&&(r.cancel=!0),n.dialogInstance.content=t.importProtectPasswordContent(e),n.dialogInstance.dataBind(),t.parent.element.focus()},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0,disabled:!0},click:function(){t.alertMessage(),t.importOkClick(e)}}]})},e.prototype.importProtectPasswordContent=function(e){var t=this.parent.serviceLocator.getService(ki),r=this.parent.createElement("div",{className:"e-importprotectpwd-dialog"}),n=this.parent.createElement("div",{className:"e-importprotectpwd-content"}),i=this.parent.createElement("span",{className:"e-header",innerHTML:'"'+e.file.name+'" '+t.getConstant("IsProtected")}),a=this.parent.createElement("input",{className:"e-input e-text",attrs:{type:"password"}});return a.setAttribute("placeholder",t.getConstant("EnterThePassword")),n.appendChild(i),n.appendChild(a),r.appendChild(n),r},e.prototype.importOkClick=function(e){var t=this.parent.element.querySelector(".e-importprotectpwd-dialog").getElementsByClassName("e-importprotectpwd-content")[0].querySelector(".e-input");this.parent.password=t.value;var r={file:e.file,password:t.value};this.parent.open(r)},e.prototype.getModuleName=function(){return"protectSheet"},e}(),Jn=function(){function e(e){this.shortValue="",this.parent=e,this.addEventListener()}return e.prototype.addEventListener=function(){this.parent.on(or,this.renderFindDlg,this),this.parent.on(ar,this.renderGotoDlg,this),this.parent.on(Lt,this.gotoHandler,this),this.parent.on("findHandler",this.findHandler,this),this.parent.on(sr,this.replaceHandler,this),this.parent.on(Nt,this.showDialog,this),this.parent.on("replaceAllDialog",this.replaceAllDialog,this),this.parent.on("findUndoRedo",this.findUndoRedo,this),this.parent.on("findKeyUp",this.findKeyUp,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off(or,this.renderFindDlg),this.parent.off(ar,this.renderGotoDlg),this.parent.off(Lt,this.gotoHandler),this.parent.off("findHandler",this.findHandler),this.parent.off(sr,this.replaceHandler),this.parent.off(Nt,this.showDialog),this.parent.off("replaceAllDialog",this.replaceAllDialog),this.parent.off("findUndoRedo",this.findUndoRedo),this.parent.off("findKeyUp",this.findKeyUp))},e.prototype.findUndoRedo=function(e){var t={address:e.address,compareVal:e.compareVal,cancel:!1};if("before"===e.undoRedoOpt)this.parent.notify(ir,{action:"beforeReplace",eventArgs:t});else if("after"===e.undoRedoOpt){if(!t.cancel){var r={address:e.address,compareVal:e.compareVal};this.parent.notify(nr,{action:"replace",eventArgs:r})}}else if("beforeReplaceAll"===e.undoRedoOpt){if(!t.cancel){var n={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(ir,{action:"beforeReplaceAll",eventArgs:n})}}else if("afterReplaceAll"===e.undoRedoOpt&&!t.cancel){var i={replaceValue:e.replaceValue,addressCollection:e.Collection};this.parent.notify(nr,{action:"replaceAll",eventArgs:i})}},e.prototype.renderFindDlg=function(){var e=this,r=this.parent.serviceLocator.getService(ki),n=this.parent.serviceLocator.getService(Ai);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(),Ct(e.parent.element)},buttons:[{buttonModel:{content:r.getConstant("FindPreviousBtn"),isPrimary:!0,cssClass:"e-btn-findPrevious",disabled:!0},click:function(t){if(e.dialogMessage(),t&&13===t.keyCode)return void e.findDlgClick("next");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(ki),n=this.parent.serviceLocator.getService(Ai);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(),Ct(e.parent.element)},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,a=this.parent.element.querySelector(".e-findnreplace-checkcase"),o=void 0;o=!!a&&t.getComponent(a,"checkbox").checked;var s=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=void 0;l=!!s&&t.getComponent(s,"checkbox").checked;var h=this.parent.element.querySelector(".e-findnreplace-searchby"),d=void 0;d=h?t.getComponent(h,"dropdownlist").value.toString():"By Row";var p=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=void 0;c=p?t.getComponent(p,"dropdownlist").value.toString():"Sheet";var u={value:n,sheetIndex:i,findOpt:e.findOption,mode:c,isCSen:o,isEMatch:l,searchBy:d};"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"),a=this.parent.element.querySelector(".e-findnreplace-checkcase"),o=t.getComponent(a,"checkbox"),s=this.parent.element.querySelector(".e-findnreplace-checkmatch"),l=t.getComponent(s,"checkbox"),h=this.parent.element.querySelector(".e-findnreplace-searchby"),d=t.getComponent(h,"dropdownlist"),p=this.parent.element.querySelector(".e-findnreplace-searchwithin"),c=t.getComponent(p,"dropdownlist"),u={value:n.value,mode:c.value.toString(),isCSen:o.checked,isEMatch:l.checked,searchBy:d.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(ki),t=this.parent.createElement("span",{className:"e-goto-alert-span",innerHTML:e.getConstant("InsertingEmptyValue")});this.parent.element.querySelector(".e-goto-alert-span")&&this.parent.element.querySelector(".e-goto-alert-span").remove(),this.parent.element.querySelector(".e-goto-dlg").querySelector(".e-dlg-content").appendChild(t)},e.prototype.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(ki),t=this.parent.createElement("span",{className:"e-find-alert-span",innerHTML:e.getConstant("NoElements")});this.parent.element.querySelector(".e-find-dlg")&&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(ki),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")&&this.parent.element.querySelector(".e-find-dlg").querySelector(".e-dlg-content").appendChild(r)},e.prototype.findKeyUp=function(e){if(e.target.classList.contains("e-text-findNext")){var r=this.parent.element.querySelector(".e-text-findNext").value;if(t.isNullOrUndefined(r)||""===r)t.getComponent(this.parent.element.querySelector(".e-btn-findPrevious"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!0,this.dialogMessage();else{var n=this.parent.element.querySelector(".e-btn-findPrevious");t.getComponent(n,"btn").disabled=!1,t.getComponent(this.parent.element.querySelector(".e-btn-findNext"),"btn").disabled=!1}}var i=this.parent.element.querySelector(".e-text-findNext").value,a=this.parent.element.querySelector(".e-text-replaceInp").value;t.isNullOrUndefined(i)||t.isNullOrUndefined(a)||""===i||""===a?(t.getComponent(this.parent.element.querySelector(".e-btn-replace"),"btn").disabled=!0,t.getComponent(this.parent.element.querySelector(".e-btn-replaceAll"),"btn").disabled=!0):!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(ki);e.appendChild(t);var s=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}});s.appendChild(h),s.insertBefore(l,h),t.appendChild(s);var d=new i.TextBox({width:"70%"});d.createElement=this.parent.createElement,d.appendTo(h);var p=this.parent.createElement("div",{className:"e-cont"}),c=this.parent.createElement("p",{className:"e-header",innerHTML:n.getConstant("ReplaceWith")}),u=this.parent.createElement("input",{className:"e-input e-text-replaceInp",attrs:{type:"Text",placeholder:n.getConstant("ReplaceValue")}});p.appendChild(u),p.insertBefore(c,u),t.appendChild(p);var f=new 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 o.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 o.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 a.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 a.CheckBox({label:n.getConstant("MatchExactCellElements"),checked:!1,cssClass:"e-findnreplace-exactmatchcheckbox"}),R=this.parent.createElement("input",{className:"e-findnreplace-checkmatch",attrs:{type:"checkbox"}});return r.appendChild(R),E.createElement=this.parent.createElement,E.appendTo(R),t.appendChild(r),e},e.prototype.GotoContent=function(){var e=this.parent.serviceLocator.getService(ki),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"}),a=this.parent.createElement("p",{className:"e-header",innerHTML:e.getConstant("Reference")}),o=new i.TextBox({placeholder:e.getConstant("EntercellAddress")}),s=this.parent.createElement("input",{className:"e-text-goto",attrs:{type:"Text"}});return n.appendChild(s),n.insertBefore(a,s),r.appendChild(n),o.createElement=this.parent.createElement,o.appendTo(s),t},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"findAndReplace"},e}(),Qn=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.merge=function(e){var t=this;if(e.showDialog)return void this.parent.serviceLocator.getService(Ai).show({target:this.parent.element,height:180,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).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),Ct(t.parent.element)}});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("activeCellMergedRange",r),r.range=r.range;var n=$(r.range[0],r.range[1],t)||{},i="row"===e.model?r.range[0]:r.range[1],a=i+((n[e.model+"Span"]||1)-1);if(!(!e.isEnd&&(e.start===i||Ae(t,i))||e.isEnd&&e.start>i&&!Ae(t,i))&&n[e.model+"Span"]>1&&a>=e.start)if("row"===e.model?be(t,i):Ae(t,i)){if(e.end1||n.rowSpan>1)){var o=this.parent.getCell(e.rowIdx,e.end+1);if(o&&(a-e.end>1&&(o.colSpan=a-e.end),o.style.display=""),n.rowSpan>1){var s=n.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(n.rowSpan-1));s>1&&(o.rowSpan=s)}}}else this.merge({rowIdx:r.range[0],colIdx:r.range[1]})},e.prototype.checkPrevMerge=function(e){var t,r,n,i=this.parent.getActiveSheet();if(e.isRow)return void(e.rowIdx-1>-1&&be(i,e.rowIdx-1)&&(void 0===(t=$(e.rowIdx-1,e.colIdx,i)||{}).rowSpan&&void 0===t.colSpan||!(void 0===t.colSpan||t.colSpan>1||e.colIdx-1>-1&&Ae(i,e.colIdx-1))||(r={range:[e.rowIdx-1,e.colIdx,e.rowIdx-1,e.colIdx]},this.parent.notify("activeCellMergedRange",r),r.range=r.range,be(i,r.range[0])&&r.range[2]>=e.rowIdx&&(t=$(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&&Ae(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&&Ae(i,e.colIdx-1)&&(void 0===(t=$(e.rowIdx,e.colIdx-1,i)||{}).colSpan&&void 0===t.rowSpan||!(void 0===t.rowSpan||t.rowSpan>1||e.rowIdx-1>-1&&be(i,e.rowIdx-1))||(r={range:[e.rowIdx,e.colIdx-1,e.rowIdx,e.colIdx-1]},this.parent.notify("activeCellMergedRange",r),r.range=r.range,Ae(i,r.range[1])&&r.range[3]>=e.colIdx&&(t=$(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&&be(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=$(e.rowIdx,e.colIdx,t)||{};if(e.isRow){if(void 0===r.colSpan||Ae(t,e.colIdx-1)){if((n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]}).range=n.range,this.parent.notify("activeCellMergedRange",n),Ae(t,e.colIdx-1)&&!Ae(t,n.range[1])||e.isFreezePane&&n.range[0]1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.rowSpan=i,e.td.style.display="")}}else if(void 0===r.rowSpan||be(t,e.rowIdx-1)){var n={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};if(n.range=n.range,this.parent.notify("activeCellMergedRange",n),be(t,e.rowIdx-1)&&!be(t,n.range[0])||e.isFreezePane&&n.range[1]1&&(this.merge({rowIdx:n.range[0],colIdx:n.range[1],element:e.td}),e.td.colSpan=i,e.td.style.display="")}},e.prototype.addEventListener=function(){this.parent.on("applyMerge",this.merge,this),this.parent.on("hiddenMerge",this.hideHandler,this),this.parent.on("checkPrevMerge",this.checkPrevMerge,this),this.parent.on("checkMerge",this.checkMerge,this)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applyMerge",this.merge),this.parent.off("hiddenMerge",this.hideHandler),this.parent.off("checkPrevMerge",this.checkPrevMerge),this.parent.off("checkMerge",this.checkMerge))},e.prototype.getModuleName=function(){return"merge"},e}(),ei=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.destroy=function(){this.removeEventListener()},e.prototype.addEventListener=function(){this.parent.on("cFRender",this.cFInitialRender,this),this.parent.on("cFInitialCheck",this.cFInitialCheckHandler,this),this.parent.on("checkConditionalFormat",this.checkConditionalFormatHandler,this),this.parent.on("initiateConditionalFormat",this.initiateCFHandler,this),this.parent.on("setCF",this.setCFHandler,this),this.parent.on(Pt,this.cFDeleteHandler,this),this.parent.on("clearCF",this.clearCFHandler,this),this.parent.on(_t,this.addClearCFHandler,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("cFRender",this.cFInitialRender),this.parent.off("cFInitialCheck",this.cFInitialCheckHandler),this.parent.off("checkConditionalFormat",this.checkConditionalFormatHandler),this.parent.off("initiateConditionalFormat",this.initiateCFHandler),this.parent.off("setCF",this.setCFHandler),this.parent.off(Pt,this.cFDeleteHandler),this.parent.off("clearCF",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(ir,{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(Bt,{conditionalFormat:e}),delete t.cancel,this.parent.notify(nr,{eventArgs:t,action:"conditionalFormat"}))},e.prototype.addClearCFHandler=function(e){for(var t=this.parent.getActiveSheet(),r=e.conditionalFormats,n=e.oldRange,i=e.selectedRange,a=t.conditionalFormats,o=0;o-1?o:o+":"+o);if(e>=s[0]&&e<=s[2]&&t>=s[1]&&t<=s[3]){n=!0;break}}return n},e.prototype.getDlgText=function(e){var t=this.parent.serviceLocator.getService(ki),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=0;p--){for(var u=l[p].range.trim().split(","),f=0;f-1?g:g+":"+g,r=c(g),e.rowIdx>=r[0]&&e.colIdx>=r[1]&&e.rowIdx<=r[2]&&e.colIdx<=r[3]){a=!0;break}if(a){if("GreaterThanLessThanEqualToBetweenContainsTextDateOccur".includes(o.conditionalFormats[p].type)){y=$(e.rowIdx,e.colIdx,o)&&$(e.rowIdx,e.colIdx,o).value?$(e.rowIdx,e.colIdx,o).value:"";i=(!t.isNullOrUndefined(y)||""!==y)&&this.cFRCheck(o.conditionalFormats[p],y,n),this.setColor(n,e.rowIdx,e.colIdx,p,i)}else if("Top10ItemsBottom10ItemsTop10%Bottom10%AboveAverageBelowAverageDuplicateUnique".includes(o.conditionalFormats[p].type))for(f=0;f-1?g:g+":"+g))[0];m<=r[2];m++){o.rows[m]||Ce(o,m,{});for(var v=r[1];v<=r[3];v++){o.rows[m].cells&&o.rows[m].cells[v]||Z(m,v,o,{});var y=$(m,v,o)&&$(m,v,o).value?$(m,v,o).value:"";i=this.cFRCheck(o.conditionalFormats[p],y,n,m,v,!1),n=this.parent.getCell(m,v),this.setColor(n,m,v,p,i)}}else if("BlueDataBarGreenDataBarRedDataBarOrangeDataBarLightBlueDataBarPurpleColorScaleGYRColorScaleRYGColorScaleGWRColorScaleRWGColorScaleBWRColorScaleRWBColorScaleWRColorScaleRWColorScaleGWColorScaleWGColorScaleGYColorScaleYGColorScaleThreeArrowsThreeArrowsGrayFourArrowsGrayFourArrowsFiveArrowsGrayFiveArrowsThreeTrafficLights1ThreeTrafficLights2ThreeSignsFourTrafficLightsFourRedToBlackThreeSymbolsThreeSymbols2ThreeFlagsFourRatingFiveQuartersFiveRatingThreeTrianglesThreeStarsFiveBoxes".includes(o.conditionalFormats[p].type)){for(var C=0;C1)if(h[0].split("(").length>1){for(var d="",p=0;p=v+.67*(y-v)?s[0].trim():o>=C?s[1].trim():s[2].trim())}else if(4===s.length){var b=v+.25*(y-v),S=v+.5*(y-v);m="e-"+(o>=(x=v+.75*(y-v))?s[0].trim():o>=S?s[1].trim():o>=b?s[2].trim():s[3].trim())}else if(5===s.length){var b=v+.2*(y-v),S=v+.4*(y-v),x=v+.6*(y-v);m="e-"+(o>=v+.8*(y-v)?s[0].trim():o>=x?s[1].trim():o>=S?s[2].trim():o>=b?s[3].trim():s[4].trim())}if(!t.isNullOrUndefined(d)){var w=this.parent.createElement("span",{className:"e-icon"});w.classList.add("e-iconsetspan"),w.classList.add(m),this.applyIconSetIcon({rowIndex:i,colIndex:a},w,p)}}},e.prototype.applyIconSetIcon=function(e,t,r){var n=this.parent.getActiveSheet(),i=$(e.rowIndex,e.colIndex,n).value,a=r;a.classList.contains("e-iconset")&&a.querySelector(".e-iconsetspan")&&a.removeChild(a.querySelector(".e-iconsetspan")),L(i)&&(a.insertBefore(t,a.childNodes[0]),a.classList.add("e-iconset"))},e.prototype.getIconList=function(e){switch(e){case"ThreeArrows":return"3arrows-1,3arrows-2,3arrows-3";case"ThreeArrowsGray":return"3arrowsgray-1,3arrowsgray-2,3arrowsgray-3";case"FourArrowsGray":return"4arrowsgray-1,4arrowsgray-2,4arrowsgray-3,4arrowsgray-4";case"FourArrows":return"4arrows-1,4arrows-2,4arrows-3,4arrows-4";case"FiveArrowsGray":return"5arrowsgray-1,5arrowsgray-2,5arrowsgray-3,5arrowsgray-4,5arrowsgray-5";case"FiveArrows":return"5arrows-1,5arrows-2,5arrows-3,5arrows-4,5arrows-5";case"ThreeTrafficLights1":return"3trafficlights-1,3trafficlights-2,3trafficlights-3";case"ThreeTrafficLights2":return"3rafficlights2-1,3rafficlights2-2,3rafficlights2-3";case"ThreeSigns":return"3signs-1,3signs-2,3signs-3";case"FourTrafficLights":return"4trafficlights-1,4trafficlights-2,4trafficlights-3,4trafficlights-4";case"FourRedToBlack":return"4redtoblack-1,4redtoblack-2,4redtoblack-3,4redtoblack-4";case"ThreeSymbols":return"3symbols-1,3symbols-2,3symbols-3";case"ThreeSymbols2":return"3symbols2-1,3symbols2-2,3symbols2-3";case"ThreeFlags":return"3flags-1,3flags-2,3flags-3";case"FourRating":return"4rating-1,4rating-2,4rating-3,4rating-4";case"FiveQuarters":return"5quarters-1,5quarters-2,5quarters-3,5quarters-4,5quarters-5";case"FiveRating":return"5rating-1,5rating-2,5rating-3,5rating-4,5rating-5";case"ThreeTriangles":return"3triangles-1,3triangles-2,3triangles-3";case"ThreeStars":return"3stars-1,3stars-2,3stars-3";case"FiveBoxes":return"5boxes-1,5boxes-2,5boxes-3,5boxes-4,5boxes-5"}return"3arrows-1,3arrows-2,3arrows-3"},e.prototype.applyColorScale=function(e,r,n,i,a){var o,s=this.parent.getActiveSheet(),l=parseInt(e,10),h=[],d=this.getColor(r.type),p=s.rows[i]&&s.rows[i].cells[a]?s.rows[i].cells[a]:null;if(p){for(var u=r.range.split(","),f=n||this.parent.getMainContent().getElementsByClassName("e-row")[i].getElementsByClassName("e-cell")[a],g=0;g0?C.push(g[k]):b.push(g[k]);if(p="BlueDataBar"===p?"B":"GreenDataBar"===p?"G":"RedDataBar"===p?"R":"OrangeDataBar"===p?"O":"LightBlueDataBar"===p?"LB":"PurpleDataBar"===p?"P":"",h=this.getColor(p)[0],d=this.getColor("R")[0],C=C.sort(function(e,t){return e-t}).reverse(),(b=b.sort(function(e,t){return e-t})).length&&C.length)f=C[0]+Math.abs(b[0]),S=Math.abs(b[0]/f*100);else{if(!b.length&&!C.length)return;f=b.length?b[0]:C[0]}if(v&&(t.isNullOrUndefined(x)||""===e)&&v.getElementsByClassName("e-cf-databar")[0]&&v.removeChild(v.getElementsByClassName("e-cf-databar")[0]),L(x)){var A=this.parent.createElement("div",{id:"spreadsheet-databar",className:"e-cf-databar"}),T=this.parent.createElement("span",{id:"spreadsheet-leftspan",className:"e-databar"}),F=this.parent.createElement("span",{id:"spreadsheet-rightspan",className:"e-databar"}),N=this.parent.createElement("span",{id:"spreadsheet-dataspan",className:"e-databar-value"}),D=void 0;s=T.style,l=F.style,A.appendChild(N),A.insertBefore(F,N),A.insertBefore(T,F),v.querySelector(".e-iconsetspan")&&(D=v.querySelector(".e-iconsetspan")),v.textContent="",v.appendChild(A),D&&v.insertBefore(D,v.firstElementChild),N.innerHTML=this.parent.getDisplayText(u),A.style.height=y-1+"px",N.style.fontSize="11pt",b.length?C.length?x>-1?(s.width=S+"%",s.height=y-3+"px",s.backgroundColor="transparent",s.left="0px",l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=h,l.left=S+"%"):x<0&&(s.width=Math.ceil(Math.abs(x/f*100))+"%",s.height=y-3+"px",s.backgroundColor=d,s.width===S+"%"?s.left="0px":s.right=100-S+"%"):(l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=d,l.left="0px"):(l.width=Math.ceil(Math.abs(x/f*100))+"%",l.height=y-3+"px",l.backgroundColor=p=h,l.left="0px")}}},e.prototype.getNumericArray=function(e,r){for(var n=this.parent.getActiveSheet(),i=e[0];i<=e[2];i++)for(var a=e[1];a<=e[3];a++){var o=$(i,a,n)&&$(i,a,n).value?$(i,a,n).value:"";if(t.isNullOrUndefined(o)||L(o)||F(o)){var s=parseInt(o,10);t.isNullOrUndefined(o)||""===o||r.push(s)}}return r},e.prototype.getColor=function(e){if("LB"===e)return["#008aef"];for(var t=e.split(""),r=[],n=0;n=o?this.getLinear(n,i,Math.abs((e-o)/o)):this.getLinear(r,n,e/o)},e.prototype.getLinear=function(e,t,r){return"#"+this.byteLinear(e[1]+e[2],t[1]+t[2],r)+this.byteLinear(e[3]+e[4],t[3]+t[4],r)+this.byteLinear(e[5]+e[6],t[5]+t[6],r)},e.prototype.byteLinear=function(e,t,r){var n=parseInt(e,16)*(1-r)+parseInt(t,16)*r|0;return Math.abs(n).toString(16)},e.prototype.isGreaterThanLessThan=function(e,t,r,n){var i=new RegExp(/[^.-a-zA-Z 0-9]+/g),a=!1;if(L(t))if(L(r))a=n?parseFloat(t)>parseFloat(r.replace(i,"")):parseFloat(t)o.updatedVal:tr.toLowerCase():t.toLowerCase()=parseFloat(r)&&parseFloat(t)<=parseFloat(n);else if(r&&n){var o={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1},s={value:n,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(Rt,o),this.parent.notify(Rt,s),(o.isDate||o.isTime)&&(s.isDate||s.isTime)?(a=t>=o.updatedVal&&t<=s.updatedVal,e.value=o.updatedVal.toString()+","+s.updatedVal.toString()):a=t.toLowerCase()>=r.toLowerCase()&&t.toLowerCase()<=n.toLowerCase()}return a},e.prototype.isEqualTo=function(e,t,r){var n=new RegExp(/[^.-a-zA-Z 0-9]+/g),i=!1;if(L(t))if(L(r))i=parseFloat(t)===parseFloat(r.replace(n,""));else{var a={value:r,rowIndex:0,colIndex:0,sheetIndex:0,isDate:!1,updatedVal:"",isTime:!1};this.parent.notify(Rt,a),a.isTime||a.isDate?(i=t===a.updatedVal,e.value=a.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:L(r.replace(n,""))?(r=r.replace(n,""),F(e)&&(e=T(e).toString()),i=e.indexOf(r)>-1):F(r)?(F(e)&&(e=T(e).toString()),i=e.indexOf(T(r).toString())>-1):i=e.toLowerCase().indexOf(r.toLowerCase())>-1,i},e.prototype.isTopBottomTenValue=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=parseInt(e,10),s=parseInt(t,10),l=!1;if(L(t)){L(e)?(o=parseFloat(e),s=parseFloat(t.replace(a,""))):F(e)&&(o=T(e),s=parseFloat(t));for(var h=[],d=void 0,p=r.range.split(","),u=0;u-1}return l},e.prototype.isTopBottomTenPercentage=function(e,t,r,n){var i=this.parent.getActiveSheet(),a=new RegExp(/[^.-a-zA-Z 0-9]+/g),o=parseInt(e,10),s=parseInt(t,10),l=!1;if(L(t)){L(e)?(o=parseFloat(e),s=parseFloat(t.replace(a,""))):F(e)&&(o=T(e),s=parseFloat(t));for(var h=[],d=void 0,p=0,u=void 0,f=r.range.split(","),g=0;g-1}return l},e.prototype.isAboveBelowAverage=function(e,t,r,n){for(var i,a=this.parent.getActiveSheet(),o=parseFloat(e),s=r.range.split(","),l=[],h=0,d=0;dh:o=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},ii=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ti(r,e),ni([t.Property("")],r.prototype,"text",void 0),ni([t.Property("")],r.prototype,"iconCss",void 0),ni([t.Property("left")],r.prototype,"iconPosition",void 0),r}(t.ChildProperty),ai=function(e){function r(){return null!==e&&e.apply(this,arguments)||this}return ti(r,e),ni([t.Complex({},ii)],r.prototype,"header",void 0),ni([t.Collection([],n.Item)],r.prototype,"content",void 0),ni([t.Property("")],r.prototype,"cssClass",void 0),ni([t.Property(!1)],r.prototype,"disabled",void 0),r}(t.ChildProperty),oi=function(e){function r(t,r){return e.call(this,t)||this}return ti(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 a=new n.Menu({cssClass:"e-file-menu",items:e,showItemOnClick:!0,beforeOpen:function(t){t.parentItem.text===e[0].text&&(a.showItemOnClick=!1),r.trigger("beforeOpen",t)},select:function(e){r.trigger("fileMenuItemSelect",e)},beforeClose:function(n){if("mouseover"===n.event.type&&!t.closest(n.event.target,".e-menu-popup"))return void(n.cancel=!0);r.trigger("beforeClose",n),n.parentItem&&n.parentItem.text!==e[0].text||requestAnimationFrame(function(){return a.setProperties({showItemOnClick:!0},!0)})},beforeItemRender:function(e){r.trigger("beforeFileMenuItemRender",e)}});return a.createElement=this.createElement,a.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=ri({},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 a=this.createElement("span",{className:"e-drop-icon e-icons"});a.addEventListener("click",this.ribbonExpandCollapse.bind(this)),this.element.appendChild(a)},r.prototype.ribbonExpandCollapse=function(e){var r,n={element:this.toolbarObj.element,expanded:!0};this.element.classList.contains("e-collapsed")?(r=this.tabObj.element.querySelector(".e-tab-header").getElementsByClassName("e-toolbar-item")[this.tabObj.selectedItem],this.element.classList.remove("e-collapsed"),r.classList.add("e-active"),t.EventHandler.remove(r,"click",this.ribbonExpandCollapse),this.trigger("expandCollapse",n)):(r=this.tabObj.element.querySelector(".e-tab-header .e-toolbar-item.e-active"),this.element.classList.add("e-collapsed"),n.expanded=!1,r.classList.remove("e-active"),t.EventHandler.add(r,"click",this.ribbonExpandCollapse,this),this.trigger("expandCollapse",n))},r.prototype.getIndex=function(e,t){return this.menuItems.length?t?e-1:e+1:e},r.prototype.updateToolbar=function(e){this.toolbarObj.items=this.items[e].content,this.toolbarObj.dataBind()},r.prototype.enableMenuItems=function(e,r,n){void 0===r&&(r=!0),this.menuItems.length&&t.getComponent(document.getElementById(this.element.id+"_menu"),"menu").enableItems(e,r,n)},r.prototype.hideMenuItems=function(e,r,n){if(void 0===r&&(r=!0),this.menuItems.length){var i=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");r?i.hideItems(e,n):i.showItems(e,n)}},r.prototype.addMenuItems=function(e,r,n,i){if(void 0===n&&(n=!0),this.menuItems.length){var a=t.getComponent(document.getElementById(this.element.id+"_menu"),"menu");n?a.insertAfter(e.reverse(),r,i):a.insertBefore(e,r,i)}},r.prototype.hideTabs=function(e,t){var r=this;void 0===t&&(t=!0);var n,i,a,o;if(t||(o=this.isAllHidden()),e.forEach(function(e){(n=r.getTabIndex(e,-1))>-1&&(t?r.items[n].cssClass.includes(" e-hide")||(r.items[n].cssClass=r.items[n].cssClass+" e-hide",r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0):r.items[n].cssClass.includes(" e-hide")&&(r.items[n].cssClass=r.items[n].cssClass.replace(" e-hide",""),r.tabObj.items[r.getIndex(n)].cssClass=r.items[n].cssClass,void 0===i&&n===r.selectedTab&&(i=!0),a=!0))}),this.setProperties({items:this.items},!0),this.tabObj.items=this.tabObj.items,this.tabObj.dataBind(),t&&(o=this.isAllHidden())&&(i=!1),!t&&o&&(i=!i),a&&o&&(this.element.classList.contains("e-collapsed")?(this.element.classList.remove("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.remove("e-hide")):(this.element.classList.add("e-collapsed"),this.element.querySelector(".e-drop-icon").classList.add("e-hide"))),i)for(var s=0;s-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 ai(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;r0?this.parent.notify("unProtectWorkbook",null):document.getElementById(this.parent.element.id+"_protectworkbook").classList.contains("e-active")?(document.getElementById(this.parent.element.id+"_protectworkbook").classList.remove("e-active"),this.parent.showSheetTabs&&this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled")):this.parent.notify("protectWorkbook",null)},e.prototype.getLocaleText=function(e,t){var r,n=this.parent.serviceLocator.getService(ki);return this.parent.getActiveSheet()["show"+e]?(t&&document.getElementById(this.parent.element.id+"_sheet").classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Hide"+e)):(t&&document.getElementById(this.parent.element.id+"_sheet").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(ki);return this.parent.getActiveSheet().isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant("Unprotect"+e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant("Protect"+e)),r},e.prototype.getLocaleProtectWorkbook=function(e,t){var r,n=this.parent.serviceLocator.getService(ki);return this.parent.isProtected?(t&&this.parent.getMainContent().classList.remove("e-hide-"+e.toLowerCase()),r=n.getConstant(e)):(t&&this.parent.getMainContent().classList.add("e-hide-"+e.toLowerCase()),r=n.getConstant(e)),r},e.prototype.insertDesignChart=function(){var e=this,t=this.parent.serviceLocator.getService(ki),r=this.ribbon.items.length-1;if(this.preTabIdx=this.ribbon.selectedTab,this.parent.allowChart&&this.ribbon.items[r]&&this.ribbon.items[r].header.text!==t.getConstant("ChartDesign")){var n=this.parent.element.id,i=[{header:{text:t.getConstant("ChartDesign")},content:[{template:this.getAddChartEleDBB(n),tooltipText:t.getConstant("AddChartElement"),id:n+"add_chart_ element_chart"},{type:"Separator"},{prefixIcon:"e-switch-row-column-icon",text:t.getConstant("SwitchRowColumn"),tooltipText:t.getConstant("SwitchRowColumn"),id:n+"switch_row_column_chart",click:function(){e.parent.notify("chartDesignTab",{switchRowColumn:!0})}},{type:"Separator"},{template:this.getChartThemeDDB(n),tooltipText:t.getConstant("ChartTheme"),id:n+"_chart_theme"},{type:"Separator"},{template:this.getChartDDB(n,!1),tooltipText:t.getConstant("ChartType"),id:n+"_chart_type"}]}];this.parent.addRibbonTabs(i),r=this.ribbon.items.length,this.ribbon.tabObj.select(r)}},e.prototype.removeDesignChart=function(){var e=this.parent.serviceLocator.getService(ki),t=this.ribbon.items.length-1;this.parent.allowChart&&this.ribbon.items[t]&&this.ribbon.items[t].header.text===e.getConstant("ChartDesign")&&(this.ribbon.tabObj.select(this.preTabIdx+1),this.parent.hideRibbonTabs([e.getConstant("ChartDesign")],!0),document.getElementsByClassName("e-addchart-ddb").length>0&&document.getElementsByClassName("e-addchart-ddb")[0].remove(),document.getElementsByClassName("e-chart-type-ddb").length>0&&document.getElementsByClassName("e-chart-type-ddb")[0].remove(),document.getElementsByClassName("e-charttheme-ddb").length>0&&document.getElementsByClassName("e-charttheme-ddb")[0].remove(),delete this.ribbon.items[t].content[0],this.ribbon.items.length=this.ribbon.items.length-1)},e.prototype.createRibbon=function(e){var t=this.parent.createElement("div",{id:this.parent.element.id+"_ribbon"});if(this.ribbon=new oi({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("tabSwitch",{activeTab:e.selectingIndex}))},e.prototype.beforeRenderHandler=function(e){var t=this.parent.serviceLocator.getService(ki);e.item.text!==t.getConstant("Open")||this.parent.openUrl&&this.parent.allowOpen||e.element.classList.add("e-disabled"),e.item.text!==t.getConstant("SaveAs")||this.parent.saveUrl&&this.parent.allowSave||e.element.classList.add("e-disabled")},e.prototype.getChartThemeDDB=function(e){var t=this,r=this.parent.createElement("button",{id:e+"_chart_theme"});return r.appendChild(this.parent.createElement("span",{className:"e-tbar-btn-text",innerHTML:"Material"})),this.chartThemeDDB=new l.DropDownButton({items:this.getChartThemeDdbItems(),content:"",select:function(e){return t.chartThemeDDBSelect(e)},close:function(){return t.parent.element.focus()},cssClass:"e-flat e-charttheme-ddb",beforeOpen:function(e){return t.tBarDdbBeforeOpen(e.element,e.items)}}),this.chartThemeDDB.createElement=this.parent.createElement,this.chartThemeDDB.appendTo(r),r},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 Ct(t.parent.element)},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(wt,r),r.cancel||(t.fontSizeDdb.content=r.style.fontSize.split("pt")[0],t.fontSizeDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),this.fontSizeDdb.createElement=this.parent.createElement,this.fontSizeDdb.appendTo(this.parent.createElement("button",{id:e+"_font_size"})),this.fontSizeDdb.element},e.prototype.getChartDDB=function(e,r){var i=this,a=this.parent.serviceLocator.getService(ki),o=r?"e-chart-menu":"e-chart-type-menu";this.chartMenu=new n.Menu({cssClass:o,items:[{iconCss:"e-icons e-column",text:a.getConstant("Column"),items:[{id:"column_chart"}]},{iconCss:"e-icons e-bar",text:a.getConstant("Bar"),items:[{id:"bar_chart"}]},{iconCss:"e-icons e-area",text:a.getConstant("Area"),items:[{id:"area_chart"}]},{iconCss:"e-icons e-pie-doughnut",text:a.getConstant("PieAndDoughnut"),items:[{id:"pie_doughnut_chart"}]},{iconCss:"e-icons e-line",text:a.getConstant("Line"),items:[{id:"line_chart"}]},{iconCss:"e-icons e-scatter",text:a.getConstant("Scatter"),items:[{id:"scatter_chart"}]}],orientation:"Vertical",beforeOpen:function(e){e.parentItem.text===a.getConstant("Column")?(e.element.firstChild.appendChild(s),e.element.parentElement.classList.add("e-column-chart")):e.parentItem.text===a.getConstant("Bar")?(e.element.firstChild.appendChild(y),e.element.parentElement.classList.add("e-bar-chart")):e.parentItem.text===a.getConstant("Area")?(e.element.firstChild.appendChild(A),e.element.parentElement.classList.add("e-area-chart")):e.parentItem.text===a.getConstant("Line")?(e.element.firstChild.appendChild(O),e.element.parentElement.classList.add("e-line-chart")):e.parentItem.text===a.getConstant("PieAndDoughnut")?(e.element.firstChild.appendChild(U),e.element.parentElement.classList.add("e-pie-doughnut-chart")):e.parentItem.text===a.getConstant("Radar")?(e.element.firstChild.appendChild(W),e.element.parentElement.classList.add("e-radar-chart")):e.parentItem.text===a.getConstant("Scatter")&&(e.element.firstChild.appendChild($),e.element.parentElement.classList.add("e-scatter-chart"))},select:this.chartSelected.bind(this)}),this.chartMenu.createElement=this.parent.createElement;var s=this.parent.createElement("div",{id:"column_main",className:"e-column-main"}),h=this.parent.createElement("div",{id:"column1_text",className:"e-column1-text",innerHTML:a.getConstant("Column")}),d=this.parent.createElement("div",{id:"column1_cont",className:"e-column1-cont"}),p=this.parent.createElement("div",{id:"column2_cont",className:"e-column2-cont"});s.appendChild(h),s.appendChild(d);var c=this.parent.createElement("span",{id:"clusteredColumn",className:"e-clusteredcolumn e-column-icon e-menu-icon e-icons"}),u=this.parent.createElement("span",{id:"stackedColumn",className:"e-stackedcolumn e-column-icon e-menu-icon e-icons"}),f=this.parent.createElement("span",{id:"stackedColumn100",className:"e-stackedcolumn100 e-column-icon e-menu-icon e-icons"}),g=this.parent.createElement("span",{id:"clusteredColumn3D",className:"e-clusteredColumn3D e-column-icon"}),m=this.parent.createElement("span",{id:"stackedColumn3D",className:"e-stackedColumn3D e-column-icon"}),v=this.parent.createElement("span",{id:"stackedColumn1003D",className:"e-stackedColumn1003D e-column-icon"});c.title=a.getConstant("ClusteredColumn"),u.title=a.getConstant("StackedColumn"),f.title=a.getConstant("StackedColumn100"),v.title=a.getConstant("OrangeDataBar"),m.title=a.getConstant("LightblueDataBar"),g.title=a.getConstant("PurpleDataBar"),d.appendChild(c),d.appendChild(u),d.appendChild(f),p.appendChild(g),p.appendChild(m),p.appendChild(v);var y=this.parent.createElement("div",{id:"bar_main",className:"e-bar-main"}),C=this.parent.createElement("div",{id:"bar1_text",className:"e-bar1-text",innerHTML:a.getConstant("Bar")}),b=this.parent.createElement("div",{id:"bar1_cont",className:"e-bar1-cont"}),S=this.parent.createElement("div",{id:"bar2_cont",className:"e-bar2-cont"});y.appendChild(C),y.appendChild(b);var x=this.parent.createElement("span",{id:"clusteredBar",className:"e-clusteredbar e-bar-icon e-menu-icon e-icons"}),w=this.parent.createElement("span",{id:"stackedBar",className:"e-stackedbar e-bar-icon e-menu-icon e-icons"}),I=this.parent.createElement("span",{id:"stackedBar100",className:"e-stackedbar100 e-bar-icon e-menu-icon e-icons"}),E=this.parent.createElement("span",{id:"clusteredBar3D",className:"e-clusteredBar3D e-bar-icon"}),R=this.parent.createElement("span",{id:"stackedBar3D",className:"e-stackedBar3D e-bar-icon"}),k=this.parent.createElement("span",{id:"stackedBar1003D",className:"e-stackedBar1003D e-bar-icon"});x.title=a.getConstant("ClusteredBar"),w.title=a.getConstant("StackedBar"),I.title=a.getConstant("StackedBar100"),k.title=a.getConstant("OrangeDataBar"),R.title=a.getConstant("LightblueDataBar"),E.title=a.getConstant("PurpleDataBar"),b.appendChild(x),b.appendChild(w),b.appendChild(I),S.appendChild(E),S.appendChild(R),S.appendChild(k);var A=this.parent.createElement("div",{id:"area_main",className:"e-area-main"}),T=this.parent.createElement("div",{id:"area_text",className:"e-area-text",innerHTML:a.getConstant("Area")}),F=this.parent.createElement("div",{id:"area_cont",className:"e-area-cont"});A.appendChild(T),A.appendChild(F);var L=this.parent.createElement("span",{id:"area",className:"e-area e-area-icon e-menu-icon e-icons"}),N=this.parent.createElement("span",{id:"stackedArea",className:"e-stackedarea e-area-icon e-menu-icon e-icons"}),D=this.parent.createElement("span",{id:"stackedArea100",className:"e-stackedarea100 e-area-icon e-menu-icon e-icons"});L.title=a.getConstant("Area"),N.title=a.getConstant("StackedArea"),D.title=a.getConstant("StackedArea100"),F.appendChild(L),F.appendChild(N),F.appendChild(D);var O=this.parent.createElement("div",{id:"line_main",className:"e-line-main"}),H=this.parent.createElement("div",{id:"line_text",className:"e-line-text",innerHTML:a.getConstant("Line")}),B=this.parent.createElement("div",{id:"line_cont",className:"e-line-cont"});O.appendChild(H),O.appendChild(B);var M=this.parent.createElement("span",{id:"line",className:"e-line e-line-icon e-menu-icon e-icons"}),P=this.parent.createElement("span",{id:"stackedLine",className:"e-stackedline e-line-icon e-menu-icon e-icons"}),_=this.parent.createElement("span",{id:"stackedline100",className:"e-stackedline100 e-line-icon e-menu-icon e-icons"});M.title=a.getConstant("Line"),P.title=a.getConstant("StackedLine"),_.title=a.getConstant("StackedLine100"),B.appendChild(M),B.appendChild(P),B.appendChild(_);var U=this.parent.createElement("div",{id:"pie_main",className:"e-pie-main"}),V=this.parent.createElement("div",{id:"pie_text",className:"e-pie-text",innerHTML:a.getConstant("Pie")}),z=this.parent.createElement("div",{id:"pie_cont",className:"e-pie-cont"});U.appendChild(V),U.appendChild(z);var q=this.parent.createElement("span",{id:"pie",className:"e-pie e-pie-icon e-menu-icon e-icons"}),j=this.parent.createElement("span",{id:"doughnut",className:"e-doughnut e-pie-icon e-menu-icon e-icons"});q.title=a.getConstant("Pie"),j.title=a.getConstant("Doughnut"),z.appendChild(q),z.appendChild(j);var W=this.parent.createElement("div",{id:"radar_main",className:"e-radar-main"}),G=this.parent.createElement("div",{id:"radar_text",className:"e-radar-text",innerHTML:"Radar"}),Y=this.parent.createElement("div",{id:"radar_cont",className:"e-radar-cont"});W.appendChild(G),W.appendChild(Y);var X=this.parent.createElement("span",{id:"radar",className:"e-radar e-radar-icon e-menu-icon e-icons"}),K=this.parent.createElement("span",{id:"radar_markers",className:"e-radar-markers e-radar-icon e-menu-icon e-icons"});X.title=a.getConstant("BlueDataBar"),K.title=a.getConstant("GreenDataBar"),Y.appendChild(X),Y.appendChild(K);var $=this.parent.createElement("div",{id:"scatter_main",className:"e-scatter-main"}),Z=this.parent.createElement("div",{id:"scatter_text",className:"e-scatter-text",innerHTML:a.getConstant("Scatter")}),J=this.parent.createElement("div",{id:"scatter_cont",className:"e-scatter-cont"});$.appendChild(Z),$.appendChild(J);var Q=this.parent.createElement("span",{id:"scatter",className:"e-scatter e-scatter-icon e-menu-icon e-icons"});Q.title=a.getConstant("Scatter"),J.appendChild(Q);var ee=r?"_chart_menu":"_chart_type_menu",te=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+ee,styles:"display: none;"}));this.chartMenu.appendTo(te),te.classList.add("e-ul");var re=r?"e-chart-icon":"e-chart-type-icon",ne=r?"e-chart-ddb":"e-chart-type-ddb",ie=r?e+"_chart-btn":e+"_chart-type-btn";this.chartDdb=new l.DropDownButton({iconCss:"e-icons "+re,cssClass:ne,target:this.chartMenu.element.parentElement,created:function(){i.chartMenu.element.style.display=""},beforeClose:function(e){e.event&&t.closest(e.event.target,"."+ne)&&t.closest(e.event.target,"."+ne).id!==ie&&(e.cancel=!0)},close:function(){return Ct(i.parent.element)}}),this.chartDdb.createElement=this.parent.createElement;var ae;return r?(ae=this.parent.createElement("button",{id:ie})).appendChild(this.parent.createElement("span",{id:e+"_chart",innerHTML:a.getConstant("Chart")})):(ae=this.parent.createElement("button",{id:ie})).appendChild(this.parent.createElement("span",{id:e+"_chart_type",innerHTML:a.getConstant("ChartType")})),this.chartDdb.appendTo(ae),this.chartDdb.element},e.prototype.getAddChartEleDBB=function(e){var r=this,i=this.parent.serviceLocator.getService(ki);this.addChartMenu=new n.Menu({cssClass:"e-addchart-menu",title:i.getConstant("AddChartElement"),items:[{iconCss:"e-icons e-axes",text:i.getConstant("Axes"),items:[{iconCss:"e-icons e-ph-axes",id:"PHAxes",text:i.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axes",id:"PVAxes",text:i.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-axis-title",text:i.getConstant("AxisTitle"),items:[{iconCss:"e-icons e-ph-axistitle",id:"PHAxisTitle",text:i.getConstant("PrimaryHorizontal")},{iconCss:"e-icons e-pv-axistitle",id:"PVAxisTitle",text:i.getConstant("PrimaryVertical")}]},{iconCss:"e-icons e-chart-title",text:i.getConstant("ChartTitle"),items:[{iconCss:"e-icons e-ct-none",id:"ChartTitleNone",text:i.getConstant("None")},{iconCss:"e-icons e-ct-abovechart",id:"ChartTitleAbove",text:i.getConstant("AboveChart")}]},{iconCss:"e-icons e-data-labels",text:i.getConstant("DataLabels"),items:[{iconCss:"e-icons e-dl-none",id:"DLNone",text:i.getConstant("None")},{iconCss:"e-icons e-dl-center",id:"DLCenter",text:i.getConstant("Center")},{iconCss:"e-icons e-dl-insideend",id:"DLInsideend",text:i.getConstant("InsideEnd")},{iconCss:"e-icons e-dl-insidebase",id:"DLInsidebase",text:i.getConstant("InsideBase")},{iconCss:"e-icons e-dl-outsideend",id:"DLOutsideend",text:i.getConstant("OutsideEnd")}]},{iconCss:"e-icons e-gridlines",text:i.getConstant("Gridlines"),items:[{iconCss:"e-icons e-gl-major-horizontal",id:"GLMajorHorizontal",text:i.getConstant("PrimaryMajorHorizontal")},{iconCss:"e-icons e-gl-major-vertical",id:"GLMajorVertical",text:i.getConstant("PrimaryMajorVertical")},{iconCss:"e-icons e-gl-minor-horizontal",id:"GLMinorHorizontal",text:i.getConstant("PrimaryMinorHorizontal")},{iconCss:"e-icons e-gl-minor-vertical",id:"GLMinorVertical",text:i.getConstant("PrimaryMinorVertical")}]},{iconCss:"e-icons e-legends",text:i.getConstant("Legends"),items:[{iconCss:"e-icons e-legends-none",id:"LegendNone",text:i.getConstant("None")},{iconCss:"e-icons e-legends-right",id:"LegendsRight",text:i.getConstant("Right")},{iconCss:"e-icons e-legends-left",id:"LegendsLeft",text:i.getConstant("Left")},{iconCss:"e-icons e-legends-bottom",id:"LegendsBottom",text:i.getConstant("Bottom")},{iconCss:"e-icons e-legends-top",id:"LegendsTop",text:i.getConstant("Top")}]}],orientation:"Vertical",select:this.addChartEleSelected.bind(this)});var a=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_add_chart_menu",styles:"display: none;"}));this.addChartMenu.appendTo(a),a.classList.add("e-ul"),this.addChartDdb=new l.DropDownButton({iconCss:"e-icons e-addchart-icon",cssClass:"e-addchart-ddb",target:this.addChartMenu.element.parentElement,created:function(){r.addChartMenu.element.style.display=""},beforeClose:function(r){r.event&&t.closest(r.event.target,".e-addchart-ddb")&&t.closest(r.event.target,".e-addchart-ddb").id!==e+"_addchart"&&(r.cancel=!0)},close:function(){return r.parent.element.focus()}}),this.addChartDdb.createElement=this.parent.createElement;var o=this.parent.createElement("button",{id:e+"_addchart"});return o.appendChild(this.parent.createElement("span",{id:e+"_chart",innerHTML:i.getConstant("AddChartElement")})),this.addChartDdb.appendTo(o),this.addChartDdb.element},e.prototype.getCFDBB=function(e){var t=this,r=this.parent.serviceLocator.getService(ki);this.cFMenu=new n.Menu({cssClass:"e-cf-menu",items:[{iconCss:"e-icons e-hlcellrules",text:r.getConstant("HighlightCellsRules"),items:[{iconCss:"e-icons e-greaterthan",id:"cf_greaterthan",text:r.getConstant("GreaterThan")+"..."},{iconCss:"e-icons e-lessthan",id:"cf_lessthan",text:r.getConstant("LessThan")+"..."},{iconCss:"e-icons e-between",id:"cf_between",text:r.getConstant("Between")+"..."},{iconCss:"e-icons e-equalto",id:"cf_eqaulto",text:r.getConstant("CFEqualTo")+"..."},{iconCss:"e-icons e-textcontains",id:"cf_textthatcontains",text:r.getConstant("TextThatContains")+"..."},{iconCss:"e-icons e-adateoccuring",id:"cf_adateoccuring",text:r.getConstant("ADateOccuring")+"..."},{iconCss:"e-icons e-duplicate",id:"cf_duplicatevalues",text:r.getConstant("DuplicateValues")+"..."}]},{iconCss:"e-icons e-topbottomrules",text:r.getConstant("TopBottomRules"),items:[{iconCss:"e-icons e-top10items",id:"cf_top10items",text:r.getConstant("Top10Items")+"..."},{iconCss:"e-icons e-top10",id:"cf_top10",text:r.getConstant("Top10")+" %..."},{iconCss:"e-icons e-bottom10items",id:"cf_bottom10items",text:r.getConstant("Bottom10Items")+"..."},{iconCss:"e-icons e-bottom10",id:"cf_bottom10",text:r.getConstant("Bottom10")+" %..."},{iconCss:"e-icons e-aboveaverage",id:"cf_aboveaverage",text:r.getConstant("AboveAverage")+"..."},{iconCss:"e-icons e-belowaverage",id:"cf_belowaverage",text:r.getConstant("BelowAverage")+"..."}]},{iconCss:"e-icons e-databars",text:r.getConstant("DataBars"),items:[{id:"cf_databars"}]},{iconCss:"e-icons e-colorscales",text:r.getConstant("ColorScales"),items:[{id:"cf_colorscales"}]},{iconCss:"e-icons e-iconsets",text:r.getConstant("IconSets"),items:[{id:"cf_iconsets"}]},{iconCss:"e-icons e-clearrules",text:r.getConstant("ClearRules"),items:[{id:"cf_cr_cells",text:r.getConstant("SelectedCells")},{id:"cf_cr_sheet",text:r.getConstant("EntireSheet")}]}],orientation:"Vertical",beforeOpen:function(e){e.parentItem.text===r.getConstant("DataBars")?(e.element.firstChild.appendChild(i),e.element.parentElement.classList.add("e-databars")):e.parentItem.text===r.getConstant("ColorScales")?(e.element.firstChild.appendChild(f),e.element.parentElement.classList.add("e-colorscales")):e.parentItem.text===r.getConstant("IconSets")&&(e.element.firstChild.appendChild(F),e.element.parentElement.classList.add("e-iconsets"))},select:this.cFSelected.bind(this)});var i=this.parent.createElement("div",{id:"db",className:"e-db"}),a=this.parent.createElement("div",{id:"db1",className:"e-db1"}),o=this.parent.createElement("div",{id:"db2",className:"e-db2"});i.appendChild(a),i.appendChild(o);var s=this.parent.createElement("span",{id:"BlueDataBar",className:"e-bdatabar e-databar-icon"}),h=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"}),p=this.parent.createElement("span",{id:"OrangeDataBar",className:"e-odatabar e-databar-icon"}),c=this.parent.createElement("span",{id:"LightBlueDataBar",className:"e-lbdatabar e-databar-icon"}),u=this.parent.createElement("span",{id:"PurpleDataBar",className:"e-pdatabar e-databar-icon"});s.title=r.getConstant("BlueDataBar"),h.title=r.getConstant("GreenDataBar"),d.title=r.getConstant("RedDataBar"),p.title=r.getConstant("OrangeDataBar"),c.title=r.getConstant("LightblueDataBar"),u.title=r.getConstant("PurpleDataBar"),a.appendChild(s),a.appendChild(h),a.appendChild(d),o.appendChild(p),o.appendChild(c),o.appendChild(u),this.cFMenu.createElement=this.parent.createElement;var f=this.parent.createElement("div",{id:"db",className:"e-cs"}),g=this.parent.createElement("div",{id:"cs1",className:"e-cs1"}),m=this.parent.createElement("div",{id:"cs2",className:"e-cs2"}),v=this.parent.createElement("div",{id:"cs3",className:"e-cs3"});f.appendChild(g),f.appendChild(m),f.appendChild(v);var y=this.parent.createElement("span",{id:"GYRColorScale",className:"e-gyr e-colorscale-icon"}),C=this.parent.createElement("span",{id:"RYGColorScale",className:"e-ryg e-colorscale-icon"}),b=this.parent.createElement("span",{id:"GWRColorScale",className:"e-gwr e-colorscale-icon"}),S=this.parent.createElement("span",{id:"RWGColorScale",className:"e-rwg e-colorscale-icon"}),x=this.parent.createElement("span",{id:"BWRColorScale",className:"e-bwr e-colorscale-icon"}),w=this.parent.createElement("span",{id:"RWBColorScale",className:"e-rwb e-colorscale-icon"}),I=this.parent.createElement("span",{id:"WRColorScale",className:"e-wr e-colorscale-icon"}),E=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"}),k=this.parent.createElement("span",{id:"WGColorScale",className:"e-wg e-colorscale-icon"}),A=this.parent.createElement("span",{id:"GYColorScale",className:"e-gy e-colorscale-icon"}),T=this.parent.createElement("span",{id:"YGColorScale",className:"e-yg e-colorscale-icon"});y.title=r.getConstant("GYRColorScale"),C.title=r.getConstant("RYGColorScale"),b.title=r.getConstant("GWRColorScale"),S.title=r.getConstant("RWGColorScale"),x.title=r.getConstant("BWRColorScale"),w.title=r.getConstant("RWBColorScale"),I.title=r.getConstant("WRColorScale"),E.title=r.getConstant("RWColorScale"),R.title=r.getConstant("GWColorScale"),k.title=r.getConstant("WGColorScale"),A.title=r.getConstant("GYColorScale"),T.title=r.getConstant("YGColorScale"),g.appendChild(y),g.appendChild(C),g.appendChild(b),g.appendChild(S),m.appendChild(x),m.appendChild(w),m.appendChild(I),m.appendChild(E),v.appendChild(R),v.appendChild(k),v.appendChild(A),v.appendChild(T);var F=this.parent.createElement("div",{id:"is",className:"e-is"}),L=this.parent.createElement("div",{id:"is1",className:"e-is1",innerHTML:"Directional"}),N=this.parent.createElement("div",{id:"is2",className:"e-is2"}),D=this.parent.createElement("div",{id:"is3",className:"e-is3",innerHTML:"Shapes"}),O=this.parent.createElement("div",{id:"is4",className:"e-is4"}),H=this.parent.createElement("div",{id:"is5",className:"e-is5",innerHTML:"Indicators"}),B=this.parent.createElement("div",{id:"is6",className:"e-is6"}),M=this.parent.createElement("div",{id:"is7",className:"e-is7",innerHTML:"Ratings"}),P=this.parent.createElement("div",{id:"is8",className:"e-is8"});L.title=r.getConstant("GYColorScale"),N.title=r.getConstant("YGColorScale"),D.title=r.getConstant("GYColorScale"),O.title=r.getConstant("YGColorScale"),H.title=r.getConstant("GYColorScale"),B.title=r.getConstant("YGColorScale"),M.title=r.getConstant("GYColorScale"),P.title=r.getConstant("YGColorScale"),F.appendChild(L),F.appendChild(N),F.appendChild(D),F.appendChild(O),F.appendChild(H),F.appendChild(B),F.appendChild(M),F.appendChild(P);var _=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"}),V=this.parent.createElement("div",{id:"ThreeTriangles",className:"e-3triangles e-is-wrapper"}),z=this.parent.createElement("div",{id:"FourArrowsGray",className:"e-4arrowsgray e-is-wrapper"}),q=this.parent.createElement("div",{id:"FourArrows",className:"e-4arrows e-is-wrapper"}),j=this.parent.createElement("div",{id:"FiveArrowsGray",className:"e-5arrowsgray e-is-wrapper"}),W=this.parent.createElement("div",{id:"FiveArrows",className:"e-5arrows e-is-wrapper"});_.title=r.getConstant("ThreeArrowsColor"),U.title=r.getConstant("ThreeArrowsGray"),V.title=r.getConstant("ThreeTriangles"),z.title=r.getConstant("FourArrowsColor"),q.title=r.getConstant("FourArrowsGray"),j.title=r.getConstant("FiveArrowsColor"),W.title=r.getConstant("FiveArrowsGray"),N.appendChild(_),N.appendChild(U),N.appendChild(V),N.appendChild(z),N.appendChild(q),N.appendChild(j),N.appendChild(W);var G=this.parent.createElement("div",{id:"ThreeTrafficLights1",className:"e-3trafficlights e-is-wrapper"}),Y=this.parent.createElement("div",{id:"ThreeTrafficLights2",className:"e-3rafficlights2 e-is-wrapper"}),X=this.parent.createElement("div",{id:"ThreeSigns",className:"e-3signs e-is-wrapper"}),K=this.parent.createElement("div",{id:"FourTrafficLights",className:"e-4trafficlights e-is-wrapper"}),$=this.parent.createElement("div",{id:"FourRedToBlack",className:"e-4redtoblack e-is-wrapper"});G.title=r.getConstant("ThreeTrafficLights1"),Y.title=r.getConstant("ThreeTrafficLights2"),X.title=r.getConstant("ThreeSigns"),K.title=r.getConstant("FourTrafficLights"),$.title=r.getConstant("RedToBlack"),O.appendChild(G),O.appendChild(Y),O.appendChild(X),O.appendChild(K),O.appendChild($);var Z=this.parent.createElement("div",{id:"ThreeSymbols",className:"e-3symbols e-is-wrapper"}),J=this.parent.createElement("div",{id:"ThreeSymbols2",className:"e-3symbols2 e-is-wrapper"}),Q=this.parent.createElement("div",{id:"ThreeFlags",className:"e-3flags e-is-wrapper"});Z.title=r.getConstant("ThreeSymbols1"),J.title=r.getConstant("ThreeSymbols2"),Q.title=r.getConstant("ThreeFlags"),B.appendChild(Z),B.appendChild(J),B.appendChild(Q);var ee=this.parent.createElement("div",{id:"ThreeStars",className:"e-3stars e-is-wrapper"}),te=this.parent.createElement("div",{id:"FourRating",className:"e-4rating e-is-wrapper"}),re=this.parent.createElement("div",{id:"FiveQuarters",className:"e-5quarters e-is-wrapper"}),ne=this.parent.createElement("div",{id:"FiveRating",className:"e-5rating e-is-wrapper"}),ie=this.parent.createElement("div",{id:"FiveBoxes",className:"e-5boxes e-is-wrapper"});ee.title=r.getConstant("ThreeStars"),te.title=r.getConstant("FourRatings"),re.title=r.getConstant("FiveQuarters"),ne.title=r.getConstant("FiveRatings"),ie.title=r.getConstant("FiveBoxes"),P.appendChild(ee),P.appendChild(te),P.appendChild(re),P.appendChild(ne),P.appendChild(ie),_.appendChild(this.createElement("span","e-3arrows-1 e-iconsetspan")),_.appendChild(this.createElement("span","e-3arrows-2 e-iconsetspan")),_.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")),V.appendChild(this.createElement("span","e-3triangles-1 e-iconsetspan")),V.appendChild(this.createElement("span","e-3triangles-2 e-iconsetspan")),V.appendChild(this.createElement("span","e-3triangles-3 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-1 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-2 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-3 e-iconsetspan")),z.appendChild(this.createElement("span","e-4arrowsgray-4 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-1 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-2 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-3 e-iconsetspan")),q.appendChild(this.createElement("span","e-4arrows-4 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-1 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-2 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-3 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-4 e-iconsetspan")),j.appendChild(this.createElement("span","e-5arrowsgray-5 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-1 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-2 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-3 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-4 e-iconsetspan")),W.appendChild(this.createElement("span","e-5arrows-5 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-1 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-2 e-iconsetspan")),G.appendChild(this.createElement("span","e-3trafficlights-3 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-1 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-2 e-iconsetspan")),Y.appendChild(this.createElement("span","e-3rafficlights2-3 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-1 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-2 e-iconsetspan")),X.appendChild(this.createElement("span","e-3signs-3 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-1 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-2 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-3 e-iconsetspan")),K.appendChild(this.createElement("span","e-4trafficlights-4 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-1 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-2 e-iconsetspan")),$.appendChild(this.createElement("span","e-4redtoblack-3 e-iconsetspan")),$.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")),J.appendChild(this.createElement("span","e-3symbols2-1 e-iconsetspan")),J.appendChild(this.createElement("span","e-3symbols2-2 e-iconsetspan")),J.appendChild(this.createElement("span","e-3symbols2-3 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-1 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-2 e-iconsetspan")),Q.appendChild(this.createElement("span","e-3flags-3 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-1 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-2 e-iconsetspan")),ee.appendChild(this.createElement("span","e-3stars-3 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-1 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-2 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-3 e-iconsetspan")),te.appendChild(this.createElement("span","e-4rating-4 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-1 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-2 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-3 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-4 e-iconsetspan")),re.appendChild(this.createElement("span","e-5quarters-5 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-1 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-2 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-3 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-4 e-iconsetspan")),ne.appendChild(this.createElement("span","e-5rating-5 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-1 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-2 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-3 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-4 e-iconsetspan")),ie.appendChild(this.createElement("span","e-5boxes-5 e-iconsetspan"));var ae=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_cf_menu",styles:"display: none;"}));return this.cFMenu.appendTo(ae),ae.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(){t.cFMenu.element.style.display=""},close:function(){return Ct(t.parent.element)}}),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){return this.parent.createElement(e,{className:t})},e.prototype.getBordersDBB=function(e){var r,a=this,o=this.parent.serviceLocator.getService(ki);this.bordersMenu=new n.Menu({cssClass:"e-borders-menu",items:[{iconCss:"e-icons e-top-borders",text:o.getConstant("TopBorders")},{iconCss:"e-icons e-left-borders",text:o.getConstant("LeftBorders")},{iconCss:"e-icons e-right-borders",text:o.getConstant("RightBorders")},{iconCss:"e-icons e-bottom-borders",text:o.getConstant("BottomBorders")},{iconCss:"e-icons e-all-borders",text:o.getConstant("AllBorders")},{iconCss:"e-icons e-horizontal-borders",text:o.getConstant("HorizontalBorders")},{iconCss:"e-icons e-vertical-borders",text:o.getConstant("VerticalBorders")},{iconCss:"e-icons e-outside-borders",text:o.getConstant("OutsideBorders")},{iconCss:"e-icons e-inside-borders",text:o.getConstant("InsideBorders")},{iconCss:"e-icons e-no-borders",text:o.getConstant("NoBorders")},{separator:!0},{text:o.getConstant("BorderColor"),items:[{id:e+"_border_colors"}]},{text:o.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?(a.colorPicker.refresh(),r=a.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")?(a.colorPicker=t.getComponent(a.cPickerEle,"colorpicker"),"Picker"===a.colorPicker.mode&&(a.colorPicker.mode="Palette",a.colorPicker.dataBind()),r.style.display="",a.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 s=this.parent.element.appendChild(this.parent.createElement("ul",{id:e+"_borders_menu",styles:"display: none;"}));return this.bordersMenu.appendTo(s),s.classList.add("e-ul"),this.cPickerEle=this.parent.createElement("input",{id:e+"_cell_border_color",attrs:{type:"color"}}),this.parent.element.appendChild(this.cPickerEle),this.colorPicker=new i.ColorPicker({cssClass:"e-border-colorpicker",mode:"Palette",inline:!0,change:function(e){var t=a.border.split(" ");t[2]=e.currentValue.hex,a.border=t.join(" ")},created:function(){r=a.colorPicker.element.parentElement}}),this.colorPicker.createElement=this.parent.createElement,this.colorPicker.appendTo(this.cPickerEle),this.bordersDdb=new l.DropDownButton({iconCss:"e-icons e-bottom-borders",cssClass:"e-borders-ddb",target:this.bordersMenu.element.parentElement,created:function(){a.bordersMenu.element.style.display=""},beforeOpen:function(e){return a.tBarDdbBeforeOpen(e.element.firstElementChild,a.bordersMenu.items,1)},beforeClose:function(e){e.event&&t.closest(e.event.target,".e-borders-menu")&&(e.cancel=!0)},close:function(){return Ct(a.parent.element)}}),this.bordersDdb.createElement=this.parent.createElement,this.bordersDdb.appendTo(this.parent.createElement("button",{id:e+"_borders"})),this.bordersDdb.element},e.prototype.chartSelected=function(e){var r=!t.isNullOrUndefined(t.closest(e.element,".e-chart-menu")),n=e.element.id;if("column_chartbar_chartarea_chartpie_doughnut_chartline_chartradar_chartscatter_chart".includes(n)){var i=e.event.target.id;this.parent.notify("insertChart",{action:n,id:i,isChart:r})}},e.prototype.addChartEleSelected=function(e){var t=e.element.id;this.parent.notify("chartDesignTab",{addChartEle:t})},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("initiateConditionalFormat",{action:e.item.text});else if("cf_databarscf_colorscales".includes(t)){var r=e.event.target.id;this.parent.notify("setCF",{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("setCF",{action:t,id:i})}if("cf_cr_cells"===t)this.parent.notify(Mt,{range:this.parent.getActiveSheet().selectedRange,isPublic:!1});else if("cf_cr_sheet"===t){var a=this.parent.getActiveSheet(),o=m([0,0,a.rowCount-1,a.colCount-1]);this.parent.conditionalFormat=null,this.parent.notify(Mt,{range:o,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(wt,{style:{borderTop:this.border},onActionUpdate:!0});break;case"Left Borders":this.parent.notify(wt,{style:{borderLeft:this.border},onActionUpdate:!0});break;case"Right Borders":this.parent.notify(wt,{style:{borderRight:this.border},onActionUpdate:!0});break;case"Bottom Borders":this.parent.notify(wt,{style:{borderBottom:this.border},onActionUpdate:!0});break;case"All Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0});break;case"Horizontal Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Horizontal"});break;case"Vertical Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Vertical"});break;case"Outside Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Outer"});break;case"Inside Borders":this.parent.notify(wt,{style:{border:this.border},onActionUpdate:!0,borderType:"Inner"});break;case"No Borders":this.parent.notify(wt,{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(wt,r),r.cancel||t.refreshFontNameSelection(r.style.fontFamily)},close:function(){return Ct(t.parent.element)},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 a.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,r=this,n=this.parent.serviceLocator.getService(ki);return this.datavalidationDdb=new l.DropDownButton({cssClass:"e-datavalidation-ddb",iconCss:"e-datavalidation-icon e-icons",items:[{text:n.getConstant("DataValidation")},{text:n.getConstant("HighlightInvalidData")},{text:n.getConstant("ClearHighlight")},{text:n.getConstant("ClearValidation")}],beforeOpen:function(e){r.refreshSelected(r.datavalidationDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case n.getConstant("DataValidation"):r.parent.notify("initiatedatavalidation",null);break;case n.getConstant("HighlightInvalidData"):r.parent.notify("invalidData",{isRemoveHighlight:!1});break;case n.getConstant("ClearHighlight"):r.parent.notify("invalidData",{isRemoveHighlight:!0});break;case n.getConstant("ClearValidation"):r.parent.notify("removeDataValidation",null);break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:t}}})}},close:function(){return Ct(r.parent.element)}}),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(wt,r),r.cancel||(t.textAlignDdb.iconCss="e-icons e-"+r.style.textAlign+"-icon",t.textAlignDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),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(wt,r),r.cancel||(t.verticalAlignDdb.iconCss="e-icons e-"+r.style.verticalAlign+"-icon",t.verticalAlignDdb.dataBind())},close:function(){return Ct(t.parent.element)}}),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(ki);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 Ct(t.parent.element)},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(Ht,{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(),a=c(i.selectedRange),o=a[0];o<=a[2];o++)for(var s=a[1];s<=a[3];s++)o===a[0]&&s===a[1]&&e.includes("merge_all")||o===a[0]&&e.includes("merge_vertically")||s===a[1]&&e.includes("_merge_horizontally")||((t=$(o,s,i)||{}).value||t.formula)&&(r=!0);if(!r)return void this.performMerge(e);var l=this.parent.serviceLocator.getService(Ai);l.show({target:this.parent.element,height:200,width:400,isModal:!0,showCloseIcon:!0,content:this.parent.serviceLocator.getService(ki).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),Ct(n.parent.element)},buttons:[{buttonModel:{content:this.parent.serviceLocator.getService(ki).getConstant("Ok"),isPrimary:!0},click:function(){l.hide(),n.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(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"All",isAction:!0,refreshRibbon:!0});break;case t+"_merge_horizontally":this.parent.notify(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Horizontally",isAction:!0});break;case t+"_merge_vertically":this.parent.notify(Ht,{merge:!0,range:this.parent.getActiveSheet().selectedRange,type:"Vertically",isAction:!0})}this.parent.hideSpinner()},e.prototype.getSortFilterDDB=function(e){var t,r=this,n=this.parent.serviceLocator.getService(ki);return this.sortingDdb=new l.DropDownButton({cssClass:"e-sort-filter-ddb",iconCss:"e-icons e-sort-filter-icon",items:[{text:n.getConstant("SortAscending"),iconCss:"e-icons e-sort-asc"},{text:n.getConstant("SortDescending"),iconCss:"e-icons e-sort-desc"},{text:n.getConstant("CustomSort")+"...",iconCss:"e-icons e-sort-custom"},{separator:!0},{text:n.getConstant("Filter"),iconCss:"e-icons e-filter-apply",id:e+"_applyfilter"},{text:n.getConstant("ClearAllFilter"),iconCss:"e-icons e-filter-clear",id:e+"_clearfilter"},{text:n.getConstant("ReapplyFilter"),iconCss:"e-icons e-filter-reapply",id:e+"_reapplyfilter"}],beforeItemRender:function(t){var n={isFiltered:!1,isClearAll:!0};if(r.parent.notify("getFilteredColumn",n),t.item.id===e+"_clearfilter"||t.item.id===e+"_reapplyfilter")n.isFiltered?t.element.classList.remove("e-disabled"):t.element.classList.add("e-disabled");else if(t.item.id===e+"_applyfilter"){var i=r.parent.getActiveSheet();(i.frozenColumns||i.frozenRows)&&t.element.classList.add("e-disabled")}},beforeOpen:function(e){r.refreshSelected(r.sortingDdb,e.element,"iconCss")},select:function(e){switch(e.item.text){case n.getConstant("Filter"):r.parent.applyFilter();break;case n.getConstant("ClearAllFilter"):r.parent.clearFilter();break;case n.getConstant("ReapplyFilter"):r.parent.notify("reapplyFilter",null);break;case n.getConstant("CustomSort")+"...":r.parent.notify("initiateCustomSort",null);break;default:t=e.item.text===n.getConstant("SortAscending")?"Ascending":"Descending",r.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:t}}})}},close:function(){return Ct(r.parent.element)}}),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 a.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,a=this.parent.createElement("div",{className:"e-input-group"}),o=this.parent.createElement("input",{className:"e-input e-text-findNext-short",attrs:{type:"Text",value:this.findValue}}),s=this.parent.serviceLocator.getService(ki);o.setAttribute("placeholder",s.getConstant("FindValue"));var l=this.parent.createElement("span",{className:"e-input-group-icon"});o.onkeyup=function(){e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount;var n=document.querySelector(".e-text-findNext-short").value,a=document.querySelector(".e-findRib-next"),o=document.querySelector(".e-findRib-prev");t.isNullOrUndefined(n)||""===n||"0 of 0"===e.findCount?(i.enableItems(a,!1),i.enableItems(o,!1),l.textContent="0 of 0"):t.isNullOrUndefined(n)&&"0 of 0"===e.findCount||(i.enableItems(a,!0),i.enableItems(o,!0))},o.onkeydown=function(t){e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e});var n=e.findCount;r.findOnKeyDown(t,n)},a.appendChild(o),a.appendChild(l);var d=[{type:"Input",template:a},{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(t){"e-findRib-next"===t.item.cssClass?(r.parent.notify("findHandler",{findOption:"next"}),e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount):"e-findRib-prev"===t.item.cssClass?(r.parent.notify("findHandler",{findOption:"prev"}),e={countOpt:"count",findCount:""},r.parent.notify("findHandler",{countArgs:e}),l.textContent=e.findCount):"e-findRib-more"===t.item.cssClass&&(r.parent.notify(or,null),r.findDialog.hide())},width:"auto",height:"auto",items:d,cssClass:"e-find-toolObj"});var p=this.parent.createElement("div",{className:"e-find-toolbar"}),c=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-sheet"),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),Ct(r.parent.element)},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.toString();r.findDialog.position={X:e.width-parseInt(t,10)-(r.parent.allowScrolling?Oe():0),Y:r.parent.getActiveSheet().showHeaders?31:0},r.findDialog.dataBind(),r.findDialog.show()}}),this.findDialog.createElement=this.parent.createElement,this.findDialog.appendTo(c)}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,Ct(this.parent.element))},e.prototype.findOnKeyDown=function(e,t){if(document.querySelector(".e-text-findNext-short").value&&"0 of 0"!==t)if(e.shiftKey){if(13===e.keyCode){var r={findOption:"prev"};this.parent.notify("findHandler",r)}}else if(13===e.keyCode){var n={findOption:"next"};this.parent.notify("findHandler",n)}},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(ki);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(lr,{options:{type:e.item.text}})},close:function(){return Ct(t.parent.element)}}),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(ki).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(ki).getConstant("Align"+t)},e.prototype.toggleBtnClicked=function(e){var r,n,i,a,o,s=t.closest(e.target,".e-btn"),l=this.parent.element.id,h=s.id,d=wt;switch(h){case l+"_bold":n={fontWeight:"normal"},i={fontWeight:"bold"},o="fontWeight";break;case l+"_italic":n={fontStyle:"normal"},i={fontStyle:"italic"},o="fontStyle";break;case l+"_line-through":d="textDecorationUpdate",i=n={textDecoration:"line-through"},o="textDecoration";break;case l+"_underline":d="textDecorationUpdate",i=n={textDecoration:"underline"},o="textDecoration"}s.classList.contains("e-active")?(r=i[o],a={style:i,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.remove("e-active")):(r=n[o],a={style:n,onActionUpdate:!0},this.parent.notify(d,a),a.cancel&&s.classList.add("e-active")),a.cancel||r===a.style[o]||this.refreshToggleBtn(u(this.parent.getActiveSheet().activeCell)),Ct(this.parent.element)},e.prototype.getCellStyleValue=function(e,t){var r=$(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;in?(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;r1||a.colSpan>1))this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:!0}]),this.toggleActiveState(!0);else{var d=c(r.selectedRange);this.enableToolbarItems([{tab:i.getConstant("Home"),items:[this.parent.element.id+"_merge_cells"],enable:d[0]!==d[2]||d[1]!==d[3]}]),this.toggleActiveState(!1)}},e.prototype.toggleActiveState=function(e){var t=this.parent.serviceLocator.getService(ki);this.parent.getActiveSheet().isProtected||(e?(this.mergeSplitBtn.element.classList.add("e-active"),this.mergeSplitBtn.element.title=t.getConstant("UnmergeCells")):(this.mergeSplitBtn.element.classList.contains("e-active")&&this.mergeSplitBtn.element.classList.remove("e-active"),this.mergeSplitBtn.element.title=t.getConstant("MergeCells")))},e.prototype.refreshToggleBtn=function(e){var t,r,n,i=this,a=this.parent.getActiveSheet(),o=this.parent.element.id,s=$(e[0],e[1],a),l=["fontWeight","fontStyle","textDecoration","textDecoration"];["bold","italic","line-through","underline","wrap"].forEach(function(h,d){(t=document.getElementById(o+"_"+h))&&(a.isProtected&&!a.protectSettings.formatCells?t.classList.remove("e-active"):"wrap"===h?n=s&&s.wrap:(r=i.getCellStyleValue(l[d],e).toLowerCase(),n=r.indexOf(h)>-1),n?t.classList.add("e-active"):t.classList.contains("e-active")&&t.classList.remove("e-active"))})},e.prototype.refreshFontNameSelection=function(e){e=e.split('"').join(""),this.fontNameDdb.element.firstElementChild.textContent=e;for(var t=0;t0?this.parent.notify("unProtectWorkbook",null):this.parent.isProtected?(this.parent.isProtected=!1,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").removeAttribute("disabled"),this.parent.element.querySelector(".e-add-sheet-tab").classList.remove("e-disabled")),this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab})):this.parent.element.querySelector(".e-add-sheet-tab").classList.contains("e-disabled")?this.toggleRibbonItems({props:"Protectworkbook",activeTab:this.ribbon.selectedTab}):this.parent.notify("protectWorkbook",null)}this.parent.notify("ribboClick",e)}},e.prototype.toggleRibbonItems=function(e){var r="",n=this.parent.serviceLocator.getService(ki).getConstant("View"),i=this.parent.serviceLocator.getService(ki).getConstant("Data");if(this.ribbon.items[this.ribbon.selectedTab].header.text===n){if(t.isNullOrUndefined(e.activeTab))for(var a=0,o=this.ribbon.items.length;a0?r=this.getLocaleProtectWorkbook("UnProtectWorkbook"):this.parent.isProtected||(r=this.getLocaleProtectWorkbook("ProtectWorkbook"))}for(var h=this.ribbon.items[e.activeTab].content.length,a=void 0;a-1?t=r.slice(0,n+1):(n=r.lastIndexOf("("))>-1&&(t=r.slice(0,n+1)),t+=e.itemData.value+"("}this.parent.notify(Wt,{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(Et,e),this.autocompleteInstance.dataSource=e.formulaCollection},e.prototype.keyUpHandler=function(e){if(this.parent.isEdit){var t=this.getEditingValue();this.isFormula=q(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}),Ct(this.parent.element);break;case this.keyCodes.ESC:Ct(this.parent.element)}}},e.prototype.formulaClick=function(e){if(this.parent.isEdit){var t=e.target;this.isFormulaBar=t.classList.contains("e-formula-bar")}},e.prototype.refreshFormulaSuggestion=function(e,t){if(t.length>0){var r=this.autocompleteInstance.element,n=e.keyCode,i=this.isPopupOpened;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=t.select("#"+this.parent.element.id+"_ac_popup");e&&t.detach(e),this.isPopupOpened=!1}},e.prototype.hidePopUp=function(){this.autocompleteInstance.hidePopup()},e.prototype.getSuggestionKeyFromFormula=function(e){var t="";if(e=e.substr(1)){var r=e.lastIndexOf("("),n=(e=e.substr(r+1)).split(this.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.getRelateToElem=function(){var e={action:"getElement"};return this.isFormulaBar?this.parent.notify("formulaBarOperation",e):this.parent.notify(Wt,e),e.element},e.prototype.getEditingValue=function(){var e={action:"getCurrentEditValue",editedValue:""};return this.parent.notify(Wt,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(Et,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){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 a=ce(this.parent,this.parent.activeSheetIndex),o=ve(this.parent);o=-1!==o.indexOf(" ")?"'"+o+"'":o;var s=a.selectedRange;if(!t.isNullOrUndefined(s)){var l=s.indexOf(":"),h=s.substr(0,l),d=s.substr(l+1,s.length);parseInt(d.replace(/\D/g,""),10)===a.rowCount&&1===parseInt(h.replace(/\D/g,""),10)?(d=d.replace(/[0-9]/g,""),s="$"+(h=h.replace(/[0-9]/g,""))+":$"+d):u(d)[1]===a.colCount-1&&0===u(h)[1]?(d=d.replace(/\D/g,""),s="$"+(h=h.replace(/\D/g,""))+":$"+d):s=h===d?h:s}e.refersTo=o+"!"+s,e.scope="Workbook"}if(n.length>0&&/^([a-zA-Z_0-9.]){0,255}$/.test(n)){var p={action:"addDefinedName",definedName:e,isAdded:!1};this.parent.notify(Et,p),i=p.isAdded,p.isAdded||this.parent.serviceLocator.getService(Ai).show({content:this.parent.serviceLocator.getService(ki).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(Ai).show({content:this.parent.serviceLocator.getService(ki).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}(),pi=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)return void this.destroy();var r=this.parent.serviceLocator.getService(ki),i=this.parent.createElement("div",{className:"e-sheet-tab-panel",id:this.parent.element.id+"_sheet_tab_panel"}),a=this.parent.createElement("button",{className:"e-add-sheet-tab e-btn e-css e-flat e-icon-btn"+(this.parent.allowInsert?"":" e-disabled"),attrs:{title:r.getConstant("AddSheet")}});a.appendChild(this.parent.createElement("span",{className:"e-btn-icon e-icons e-add-icon"})),a.addEventListener("click",this.addSheetTab.bind(this)),a.disabled=!this.parent.allowInsert,i.appendChild(a),this.addBtnRipple=t.rippleEffect(i,{selector:".e-add-sheet-tab"});var o=this.parent.createElement("button",{attrs:{title:r.getConstant("ListAllSheets")}});i.appendChild(o),this.parent.element.appendChild(i);var s=this.getSheetTabItems();this.dropDownInstance=new l.DropDownButton({iconCss:"e-icons",items:s.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 Ct(e.parent.element)}}),this.dropDownInstance.createElement=this.parent.createElement,this.dropDownInstance.appendTo(o);var h=this.parent.createElement("div",{className:"e-sheet-tab"});this.tabInstance=new n.Tab({selectedItem:this.parent.activeSheetIndex,overflowMode:"Scrollable",items:s.tabItems,scrollStep:250,selecting:function(t){var r={currentSheetIndex:t.selectingIndex,previousSheetIndex:t.selectedIndex,cancel:!1};e.isSelectCancel||e.parent.notify(ir,{eventArgs:r,action:"gotoSheet"}),e.isSelectCancel=r.cancel},selected:function(t){if(t.selectedIndex!==t.previousIndex){if(e.parent.notify("removeDesignChart",{}),e.parent.isEdit){var r=window.getSelection(),n=e.parent.element.getElementsByClassName("e-spreadsheet-edit")[0],i=!!n&&q(n.textContent);r&&r.focusNode&&r.focusNode.classList&&r.focusNode.classList.contains("e-formula-bar-panel")&&(i=q(e.parent.element.querySelector(".e-formula-bar").value)),i||e.parent.endEdit()}if(e.isSelectCancel)e.tabInstance.selectedItem=t.previousIndex,e.tabInstance.dataBind(),Ct(e.parent.element);else{e.parent.activeSheetIndex=t.selectedIndex,e.parent.dataBind(),e.updateDropDownItems(t.selectedIndex,t.previousIndex),Ct(e.parent.element);var a={previousSheetIndex:t.previousIndex,currentSheetIndex:t.selectedIndex};e.parent.notify(nr,{eventArgs:a,action:"gotoSheet"});var o={action:"registerGridInCalc",sheetID:(t.selectedIndex+1).toString()};e.parent.notify(Et,o)}}},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 d=s.tabItems.length,p=0;p-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 a=h.calculatePosition(e.element,r,"top");"right"===r&&(a.left-=i.getBoundingClientRect().width),i.style.left=a.left+"px",i.style.top=a.top-n+"px"}i.style.visibility=""},e.prototype.getSheetTabItems=function(){var e,t=this,r=[],n=[];return this.parent.sheets.forEach(function(i,a){e=ve(t.parent,a),r.push({header:{text:e},cssClass:"Visible"===i.state?"":"e-hide"}),n.push({text:e,iconCss:a===t.parent.activeSheetIndex?"e-selected-icon e-icons":""})}),{tabItems:r,ddbItems:n}},e.prototype.refreshSheetTab=function(){var e=this.getSheetTabItems();this.dropDownInstance.items=e.ddbItems,this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),this.tabInstance.items=e.tabItems,this.tabInstance.selectedItem=this.parent.activeSheetIndex,this.tabInstance.dataBind()},e.prototype.addSheetTab=function(){var e={action:"getCurrentEditValue",editedValue:""};this.parent.notify(Wt,e),this.parent.notify(Tt,{model:this.parent,start:this.parent.activeSheetIndex+1,end:this.parent.activeSheetIndex+1,modelType:"Sheet",isAction:!0,activeSheetIndex:this.parent.activeSheetIndex+1}),Ct(this.parent.element)},e.prototype.insertSheetTab=function(e){this.parent.notify("removeDesignChart",{}),e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[this.tabInstance.selectedItem].iconCss="");for(var t=e.startIdx;t<=e.endIdx;t++){var r=this.parent.sheets[t].name;this.dropDownInstance.items.splice(t,0,{text:r}),this.tabInstance.addTab([{header:{text:r},content:""}],t)}e.preventUpdate&&e.startIdx!==this.tabInstance.selectedItem||(this.dropDownInstance.items[e.startIdx].iconCss="e-selected-icon e-icons"),this.dropDownInstance.setProperties({items:this.dropDownInstance.items},!0),e.preventUpdate?e.startIdx!==this.tabInstance.selectedItem&&this.refreshSheetTab():this.updateSheetTab({idx:e.startIdx})},e.prototype.updateSheetTab=function(e){if("activeSheetChanged"===e.name)e.idx=this.parent.skipHiddenSheets(e.idx);else if("Hidden"===this.parent.sheets[e.idx].state){if(this.parent.isProtected)return;this.parent.setSheetPropertyOnMute(this.parent.sheets[e.idx],"state","Visible"),this.tabInstance.items[e.idx].cssClass="",this.tabInstance.dataBind()}this.tabInstance.selectedItem=e.idx,this.tabInstance.dataBind(),this.parent.notify("protectSheet",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,a=this.tabInstance.items.length;i0||this.parent.isProtected)&&(e.element.children[0].classList.add("e-disabled"),e.element.children[1].classList.add("e-disabled"),e.element.children[2].classList.add("e-disabled"),e.element.children[3].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={eventArgs:{name:r,index:this.parent.getActiveSheet().id},action:"renameSheet",cancel:!1};if(this.parent.trigger("actionBegin",n),n.cancel)return;var i=this.parent.createElement("input",{id:this.parent.element.id+"_rename_input",className:"e-input e-sheet-rename",styles:"width: "+e.getBoundingClientRect().width+"px",attrs:{type:"text",name:"Rename",required:"",value:r,spellcheck:"false",maxlength:"31"}});e.firstElementChild.style.display="none",e.appendChild(i),t.EventHandler.add(document,"mousedown touchstart",this.renameInputFocusOut,this),t.EventHandler.add(i,"input",this.updateWidth,this),i.focus(),i.setSelectionRange(0,r.length),t.EventHandler.remove(t.closest(e,".e-toolbar-items"),"dblclick",this.renameSheetTab)}},e.prototype.updateWidth=function(e){var t=e.target,r=t.value.length,n=t.value.split(" ");if(n.length){var i=n.length-1;r-=i,r+=.5*i}t.style.width=r+"ch"},e.prototype.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 Ct(this.parent.element);var n=r.value,i=this.parent.serviceLocator.getService(ki);if(n){var a=this.tabInstance.selectedItem;if(n.match(new RegExp(".*[\\[\\]\\*\\\\/\\?].*")))this.showRenameDialog(r,i.getConstant("SheetRenameInvalidAlert"));else{if(this.tabInstance.items[a].header.text!==n)for(var o=0,s=this.parent.sheets.length;o-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.dataBind()},e.prototype.hideSheet=function(){this.parent.setSheetPropertyOnMute(this.parent.getActiveSheet(),"state","Hidden"),this.tabInstance.items[this.parent.activeSheetIndex].cssClass="e-hide",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(Ai).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(ki);if(this.skipHiddenSheets()>1){var n=e.sheetName?ce(this.parent,ae(this.parent,e.sheetName)):this.parent.getActiveSheet(),i=e.index||ae(this.parent,n.name),a={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 o=this.parent.serviceLocator.getService(Ai);e.clicked?this.forceDelete(i):o.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),Ct(t.parent.element)},buttons:[{buttonModel:{content:r.getConstant("Ok"),isPrimary:!0},click:function(){o.hide(),t.forceDelete(i),t.parent.notify("clearUndoRedoCollection",null),e&&!e.isAction&&(a.sheetCount=t.parent.sheets.length,t.parent.notify(nr,{eventArgs:a,action:"removeSheet"}))}}]})}else{var s={action:"deleteSheetTab",sheetName:"",index:i+1};this.parent.notify(Et,s),this.destroySheet(i),this.parent.notify("clearUndoRedoCollection",null),e&&!e.isAction&&(a.sheetCount=this.parent.sheets.length,this.parent.notify(nr,{eventArgs:a,action:"removeSheet"}))}}else this.parent.serviceLocator.getService(Ai).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),Ct(t.parent.element)}})}},e.prototype.forceDelete=function(e){var t={action:"deleteSheetTab",sheetName:"",index:e+1};this.parent.notify("removeDesignChart",{}),this.parent.notify(Et,t),this.destroySheet(e)},e.prototype.destroySheet=function(e){var t=e||this.parent.activeSheetIndex;this.parent.removeSheet(t),this.parent.notify("sheetsDestroyed",{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("protectSheet",null),Ct(this.parent.element)},e.prototype.showAggregate=function(){var e=this;if(!I(c(this.parent.getActiveSheet().selectedRange))){var t={Count:0,Sum:"0",Avg:"0",Min:"0",Max:"0",countOnly:!0};if(this.parent.notify("aggregateComputation",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 a=this.parent.createElement("button",{id:this.parent.element.id+"_aggregate"});document.getElementById(this.parent.element.id+"_sheet_tab_panel").appendChild(a),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 Ct(e.parent.element)},cssClass:r}),this.aggregateDropDown.createElement=this.parent.createElement,this.aggregateDropDown.appendTo(a)}}else this.removeAggregate()}},e.prototype.getAggregateItems=function(e){var t,r,n=this,i=[];return Object.keys(e).forEach(function(a){"aggregateComputation"!==e[a]&&(t=a+": "+e[a],r=a===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("sheetTabs",this.createSheetTabs,this),this.parent.on("refreshSheetTabs",this.refreshSheetTab,this),this.parent.on("insertSheetTab",this.insertSheetTab,this),this.parent.on($t,this.removeSheetTab,this),this.parent.on("renameSheetTab",this.renameSheetTab,this),this.parent.on(Kt,this.switchSheetTab,this),this.parent.on("activeSheetChanged",this.updateSheetTab,this),this.parent.on("renameSheet",this.renameInputFocusOut,this),this.parent.on("activeCellChanged",this.removeAggregate,this),this.parent.on("verticalScroll",this.focusRenameInput,this),this.parent.on("horizontalScroll",this.focusRenameInput,this),this.parent.on("sheetNameUpdate",this.updateSheetName,this),this.parent.on("hideSheet",this.hideSheet,this),this.parent.on("showAggregate",this.showAggregate,this)},e.prototype.destroy=function(){this.removeEventListener(),this.dropDownInstance.destroy(),this.dropDownInstance=null,this.tabInstance.destroy(),this.tabInstance=null,this.removeAggregate(),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("sheetTabs",this.createSheetTabs),this.parent.off("refreshSheetTabs",this.refreshSheetTab),this.parent.off("insertSheetTab",this.insertSheetTab),this.parent.off($t,this.removeSheetTab),this.parent.off("renameSheetTab",this.renameSheetTab),this.parent.off(Kt,this.switchSheetTab),this.parent.off("activeSheetChanged",this.updateSheetTab),this.parent.off("renameSheet",this.renameInputFocusOut),this.parent.off("activeCellChanged",this.removeAggregate),this.parent.off("verticalScroll",this.focusRenameInput),this.parent.off("horizontalScroll",this.focusRenameInput),this.parent.off("sheetNameUpdate",this.updateSheetName),this.parent.off("hideSheet",this.hideSheet),this.parent.off("showAggregate",this.showAggregate))},e}(),ci=function(){function e(e){this.parent=e,this.addEventListener(),this.renderFileUpload()}return e.prototype.addEventListener=function(){this.parent.on("openSuccess",this.openSuccess,this),this.parent.on("openFailure",this.openFailed,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("openSuccess",this.openSuccess),this.parent.off("openFailure",this.openFailed))},e.prototype.renderFileUpload=function(){var e=this.parent.element.id+"_fileUpload";this.parent.element.appendChild(this.parent.createElement("input",{id:e,attrs:{type:"file",accept:".xls, .xlsx, .csv, .xlsm",name:"fileUpload"}}));var t=document.getElementById(e);t.onchange=this.fileSelect.bind(this),t.onerror=this.openFailed.bind(this),t.style.display="none"},e.prototype.fileSelect=function(e){var t=e.target.files[0];if(!(t&&t.length<1)){var r={file:t};this.parent.open(r),document.getElementById(this.parent.element.id+"_fileUpload").value=""}},e.prototype.openSuccess=function(e){var t=this,r=["UnsupportedFile","InvalidUrl","NeedPassword","InCorrectPassword"];if(r.indexOf(e.data)>-1)if(r[2]===e.data)this.parent.element.querySelector(".e-importprotectworkbook-dlg")||this.parent.notify("importProtectWorkbook",e.eventArgs);else{if(r[3]!==e.data)return(a=this.parent.serviceLocator.getService(Ai)).hide(),this.parent.serviceLocator.getService(Ai).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();var n=this.parent.serviceLocator.getService(ki),i=this.parent.createElement("span",{className:"e-importprotectpwd-alert-span",innerHTML:n.getConstant("InCorrectPassword")});this.parent.element.querySelector(".e-importprotectworkbook-dlg").querySelector(".e-dlg-content").appendChild(i)}else{var a=this.parent.serviceLocator.getService(Ai);a.hide(),this.parent.showSpinner()}this.parent.element&&(this.parent.trigger("openComplete",{response:e}),this.parent.notify(nr,{response:e,action:"import"}),this.parent.renderModule.refreshSheet(!0),this.parent.notify("refreshSheetTabs",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}(),ui=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("beginSave",this.initiateSave,this),this.parent.on("saveCompleted",this.saveCompleted,this),this.parent.on("saveError",this.showErrorDialog,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("beginSave",this.initiateSave),this.parent.off("saveCompleted",this.saveCompleted),this.parent.off("saveError",this.showErrorDialog))},e.prototype.getModuleName=function(){return"save"},e.prototype.initiateSave=function(){this.parent.showSpinner()},e.prototype.saveCompleted=function(){this.parent.hideSpinner()},e.prototype.showErrorDialog=function(e){var t=this;this.parent.serviceLocator.getService(Ai).show({target:this.parent.element,isModal:!0,showCloseIcon:!0,height:180,width:400,content:e.content,beforeOpen:function(){return Ct(t.parent.element)}})},e}(),fi=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,i,a,o=this.parent.element.id+"_cmenu";if(!r.cancel){var s=void 0;switch(e.item.id){case o+"_cut":this.parent.notify(Zt,{isAction:!0,promise:Promise});break;case o+"_copy":this.parent.notify("copy",{isAction:!0,promise:Promise});break;case o+"_paste":this.parent.notify(Jt,{isAction:!0,isInternal:!0});break;case o+"_pastevalues":this.parent.notify(Jt,{type:"Values",isAction:!0,isInternal:!0});break;case o+"_pasteformats":this.parent.notify(Jt,{type:"Formats",isAction:!0,isInternal:!0});break;case o+"_rename":this.parent.notify("renameSheetTab",{});break;case o+"_delete_sheet":this.parent.notify($t,{});break;case o+"_insert_sheet":this.parent.notify(Tt,{model:this.parent,start:this.parent.activeSheetIndex,end:this.parent.activeSheetIndex,modelType:"Sheet",isAction:!0});break;case o+"_hide_sheet":this.parent.notify("hideSheet",null);break;case o+"_ascending":this.parent.notify("applySort",null);break;case o+"_descending":this.parent.notify("applySort",{sortOptions:{sortDescriptors:{order:"Descending"}}});break;case o+"_customsort":this.parent.notify("initiateCustomSort",null);break;case o+"_filtercellvalue":this.parent.notify("filterByCellValue",null);break;case o+"_clearfilter":n=v(u(this.parent.getActiveSheet().activeCell)[1]+1),this.parent.notify("clearFilter",{field:n});break;case o+"_reapplyfilter":this.parent.notify("reapplyFilter",null);break;case o+"_hide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[0],endIndex:s[2],hide:!0,isCol:!1,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_unhide_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[0],endIndex:s[2],hide:!1,isCol:!1,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_hide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[1],endIndex:s[3],hide:!0,isCol:!0,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_unhide_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(er,{startIndex:s[1],endIndex:s[3],hide:!1,isCol:!0,actionUpdate:!0}),Ct(this.parent.element);break;case o+"_insert_row_above":case o+"_delete_row":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[0],end:s[2],modelType:"Row",isAction:!0,insertType:"above"}),Ct(this.parent.element);break;case o+"_insert_row_below":s=x(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Tt,{model:this.parent.getActiveSheet(),start:s[2]+1,end:s[2]+1+(s[2]-s[0]),modelType:"Row",isAction:!0,insertType:"below"}),Ct(this.parent.element);break;case o+"_insert_column_before":case o+"_delete_column":s=c(this.parent.getActiveSheet().selectedRange),this.parent.notify(e.item.id.substr(o.length+1,6)+"Model",{model:this.parent.getActiveSheet(),start:s[1],end:s[3],modelType:"Column",isAction:!0}),Ct(this.parent.element);break;case o+"_insert_column_after":s=x(c(this.parent.getActiveSheet().selectedRange)),this.parent.notify(Tt,{model:this.parent.getActiveSheet(),start:s[3]+1,end:s[3]+1+(s[3]-s[1]),modelType:"Column",isAction:!0}),Ct(this.parent.element);break;case o+"_hyperlink":this.parent.notify("initiateHyperlink",null);break;case o+"_editHyperlink":this.parent.notify("editHyperlink",null);break;case o+"_openHyperlink":this.parent.notify("openHyperlink",null);break;case o+"_removeHyperlink":this.parent.removeHyperlink(this.parent.getActiveSheet().selectedRange);break;case o+"_protect":i=this.parent.getActiveSheet(),this.parent.setSheetPropertyOnMute(i,"isProtected",!i.isProtected),a=!i.isProtected,this.parent.notify("applyProtect",{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);if(e.element.classList.contains("e-contextmenu")?(r=this.getDataSource(n),this.contextMenuInstance.items=r,this.contextMenuInstance.dataBind()):r=e.items,("ColumnHeader"===n||"RowHeader"===n)&&e.element&&e.element.childElementCount>0){var i="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_insert_row"),a="ColumnHeader"===n?e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_column"):e.element.querySelector("#"+this.parent.element.id+"_cmenu_delete_row");this.parent.allowInsert&&i.classList.contains("e-disabled")?i.classList.remove("e-disabled"):this.parent.allowInsert||i.classList.contains("e-disabled")||i.classList.add("e-disabled"),this.parent.allowDelete&&a.classList.contains("e-disabled")?a.classList.remove("e-disabled"):this.parent.allowDelete||a.classList.contains("e-disabled")||a.classList.add("e-disabled")}this.parent.trigger("contextMenuBeforeOpen",e),this.parent.notify(Kt,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")?e.classList.contains("e-header-cell")?"ColumnHeader":"Content":t.closest(e,".e-row-header")?e.classList.contains("e-header-cell")?"RowHeader":"Content":t.closest(e,".e-sheet-tabs-items")?"Footer":t.closest(e,".e-selectall-container")?e.classList.contains("e-header-cell")?t.closest(e,".e-header-row")?"ColumnHeader":"RowHeader":t.closest(e,".e-select-all-cell")?"SelectAll":"Content":""},e.prototype.getDataSource=function(e){var t=this.parent.serviceLocator.getService(ki),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);a=c((i=this.parent.getActiveSheet()).selectedRange);this.setInsertDeleteItems(r,t,"Row",n,[a[0],a[2]],["Above","Below"]),i.frozenRows||i.frozenColumns||this.setHideShowItems(r,t,"Row",n,[a[0],a[2]])}else if("ColumnHeader"===e){this.setClipboardData(r,t,n);var i=this.parent.getActiveSheet(),a=c(i.selectedRange);this.setInsertDeleteItems(r,t,"Column",n,[a[1],a[3]],["Before","After"]),i.frozenRows||i.frozenColumns||this.setHideShowItems(r,t,"Column",n,[a[1],a[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(ki);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(ki),n={clearFilterText:null,isFiltered:!1};this.parent.notify("getFilteredColumn",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(ki);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(ki);!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,a){e.push({separator:!0}),["Insert","Delete"].forEach(function(o){i[0]===i[1]?e.push({text:t.getConstant(""+o+r),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}):e.push({text:t.getConstant(""+o+r+"s"),id:n+"_"+o.toLowerCase()+"_"+r.toLowerCase()}),"Insert"===o&&(e[e.length-1].items=[],a.forEach(function(r){e[e.length-1].items.push({text:t.getConstant(r),id:e[e.length-1].id+"_"+r.toLowerCase()})}))})},e.prototype.setHideShowItems=function(e,t,r,n,i){if(i[0]===i[1])e.push({text:t.getConstant("Hide"+r),id:n+"_hide_"+r.toLowerCase()});else{var a=i[0];i[0]=i[0]>i[1]?i[1]:i[0],i[1]=i[1]>a?i[1]:a,e.push({text:t.getConstant("Hide"+r+"s"),id:n+"_hide_"+r.toLowerCase()})}this.parent.hiddenCount(i[0],i[1],r.toLowerCase()+"s")&&e.push({text:t.getConstant("UnHide"+r+"s"),id:n+"_unhide_"+r.toLowerCase()})},e.prototype.addEventListener=function(){this.parent.on("addContextMenuItems",this.addItemsHandler,this),this.parent.on("removeContextMenuItems",this.removeItemsHandler,this),this.parent.on("enableContextMenuItems",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("addContextMenuItems",this.addItemsHandler),this.parent.off("removeContextMenuItems",this.removeItemsHandler),this.parent.off("enableContextMenuItems",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}(),gi=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("refreshCellElem",this.refreshCellElement,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||this.parent.off("refreshCellElem",this.refreshCellElement)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.getModuleName=function(){return"numberFormat"},e}(),mi=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("applySort",this.applySortHandler,this),this.parent.on("sortComplete",this.sortCompleteHandler,this),this.parent.on("initiateCustomSort",this.initiateCustomSortHandler,this),this.parent.on("sortImport",this.sortImport,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("applySort",this.applySortHandler),this.parent.off("sortComplete",this.sortCompleteHandler),this.parent.off("initiateCustomSort",this.initiateCustomSortHandler),this.parent.off("sortImport",this.sortImport))},e.prototype.getModuleName=function(){return"sort"},e.prototype.isValidSortRange=function(){var e=this.parent.getActiveSheet(),t=x(y(e.selectedRange));return!(t[0]>e.usedRange.rowIndex||t[1]>e.usedRange.colIndex)},e.prototype.sortImport=function(e){for(var t,r=this.parent.sortCollection,n=this.parent.getActiveSheet().usedRange.rowIndex-1,i=e?e.sheetIdx:this.parent.activeSheetIndex,a=0;a"+s+""+i.getConstant("SortDuplicateFieldError"),!0}return!1},e.prototype.customSortContent=function(){var e=this.parent.createElement("div",{className:"e-sort-dialog"}),r=this.getFields(),n=t.getUniqueID("customSort"),i=this.getCustomListview(n);this.setHeaderTab(e,i,r);var a=this.parent.createElement("div",{className:"e-sort-listsection",styles:""});e.appendChild(a);var o=this.parent.createElement("div",{className:"e-list-sort",styles:""});a.appendChild(o),i.createElement=this.parent.createElement,i.appendTo(o),this.renderListItem(n,i,!0,r);var s=this.parent.createElement("div",{className:"e-sort-error"});return e.appendChild(s),e},e.prototype.getFields=function(){var e=this.parent.getActiveSheet(),t=x(y(e.selectedRange));if(t[0]===t[2]&&t[2]-t[0]==0){t[0]=0,t[1]=0,t[3]=e.usedRange.colIndex;var r={filterRange:[],hasFilter:!1};this.parent.notify("getFilterRange",r),r.hasFilter&&r.filterRange&&(t[0]=r.filterRange[0])}var n,i=[];for(t[1];t[1]<=t[3];t[1]++){var a=$(t[0],t[1],e);if(a&&a.value){var o={formattedText:a.value,value:a.value,format:a.format,onLoad:!0};a.format&&this.parent.notify("getFormattedCell",o),n=o.formattedText}else n="Column "+v(t[1]+1);i.push({text:n,value:"Column "+v(t[1]+1)})}return i},e.prototype.setHeaderTab=function(e,r,n){var i=this,o=this.parent.serviceLocator.getService(ki),s=this.parent.createElement("div",{className:"e-sort-header",styles:"",innerHTML:""});e.appendChild(s);var l=this.parent.createElement("button",{className:"e-btn e-sort-addbtn e-flat",innerHTML:o.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:o.getConstant("ThenBy"),field:"",order:"ascending"}]),i.renderListItem(e,r,d.checked,n,!0)}});var d=new a.CheckBox({label:o.getConstant("ContainsHeader"),checked:!0,change:function(r){var i=r.checked?{text:"text",value:"value"}:{text:"value"};Array.prototype.forEach.call(e.getElementsByClassName("e-sort-field e-dropdownlist e-lib"),function(e){var r=t.getComponent(e,"dropdownlist");r.dataSource=null,r.dataSource=n,r.fields=i,r.dataBind()})},cssClass:"e-sort-headercheckbox"}),p=this.parent.createElement("input",{className:"e-sort-checkheader",attrs:{type:"checkbox"}});s.appendChild(p),d.createElement=this.parent.createElement,d.appendTo(p);var c=new a.CheckBox({label:o.getConstant("CaseSensitive"),checked:!1,cssClass:"e-sort-casecheckbox"}),u=this.parent.createElement("input",{className:"e-sort-checkcase",attrs:{type:"checkbox"}});s.appendChild(u),c.createElement=this.parent.createElement,c.appendTo(u)},e.prototype.getCustomListview=function(e){var r=[{id:e,text:this.parent.serviceLocator.getService(ki).getConstant("SortBy"),field:"",order:"ascending"}];return t.enableRipple(!1),new s.ListView({dataSource:r,fields:{id:"id"},height:"100%",template:'
${text}
',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 s=this,l=this.parent.serviceLocator.getService(ki),h=t.element.querySelector("li[data-uid="+e+"]"),d=r?{text:"text",value:"value"}:{text:"value"},p=h.getElementsByClassName("e-sort-field")[0],c=new o.DropDownList({dataSource:n,width:"auto",cssClass:"e-sort-field-ddl",fields:d,placeholder:l.getConstant("SelectAColumn"),change:function(r){r.value&&(Array.prototype.some.call(t.dataSource,function(t){return t.id===e&&(t.field=r.value.toString().replace("Column ","")),t.id===e}),s.clearError())}});c.createElement=this.parent.createElement,c.appendTo(p),i||(c.index=0);var u=h.getElementsByClassName("e-sort-order")[0],f="ascending"===u.getElementsByClassName("e-sort-ordertxt")[0].innerText.toLocaleLowerCase(),g=new a.RadioButton({label:l.getConstant("SortAscending"),name:"sortAZ_"+e,value:"ascending",checked:f,cssClass:"e-sort-radiobutton",change:function(r){s.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 a.RadioButton({label:l.getConstant("SortDescending"),name:"sortAZ_"+e,value:"descending",checked:!f,cssClass:"e-sort-radiobutton",change:function(r){s.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(ir,{eventArgs:n,action:"beforeSort"}),this.parent.showSpinner();var i=x(y(n.range)),a={filterRange:[],hasFilter:!1};i[0]===i[2]&&i[2]-i[0]==0&&(this.parent.notify("getFilterRange",a),a.hasFilter&&G(a.filterRange,i[0],i[1])&&(i[0]=a.filterRange[0],i[1]=0,i[2]=r.usedRange.rowIndex,i[3]=r.usedRange.colIndex,n.sortOptions.containsHeader=!0)),this.parent.sort(n.sortOptions,m(i)).then(function(e){return t.parent.trigger("sortComplete",e),t.parent.notify(nr,{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=y(e.range);this.parent.serviceLocator.getService("cell").refreshRange(t),this.parent.hideSpinner()},e}(),vi=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("filterRangeAlert",this.filterRangeAlertHandler,this),this.parent.on(rr,this.initiateFilterUIHandler,this),this.parent.on("mouseDown",this.filterMouseDownHandler,this),this.parent.on("renderFilterCell",this.renderFilterCellHandler,this),this.parent.on("clearAllFilter",this.clearAllFilterHandler,this),this.parent.on(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler,this),this.parent.on(d.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler,this),this.parent.on("reapplyFilter",this.reapplyFilterHandler,this),this.parent.on("filterByCellValue",this.filterByCellValueHandler,this),this.parent.on("clearFilter",this.clearFilterHandler,this),this.parent.on("getFilteredColumn",this.getFilteredColumnHandler,this),this.parent.on(Kt,this.cMenuBeforeOpenHandler,this),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler,this),this.parent.on("getFilterRange",this.getFilterRangeHandler,this),this.parent.on("filterCellKeyDown",this.filterCellKeyDownHandler,this),this.parent.on("getFilteredCollection",this.getFilteredCollection,this),this.parent.on("contentLoaded",this.updateFilter,this),this.parent.on("updateFilter",this.updateFilter,this)},e.prototype.removeEventListener=function(){this.parent.isDestroyed||(this.parent.off("filterRangeAlert",this.filterRangeAlertHandler),this.parent.off(rr,this.initiateFilterUIHandler),this.parent.off("mouseDown",this.filterMouseDownHandler),this.parent.off("renderFilterCell",this.renderFilterCellHandler),this.parent.off("clearAllFilter",this.clearAllFilterHandler),this.parent.off(d.beforeFltrcMenuOpen,this.beforeFilterMenuOpenHandler),this.parent.off(d.beforeCustomFilterOpen,this.beforeCustomFilterOpenHandler),this.parent.off("reapplyFilter",this.reapplyFilterHandler),this.parent.off("filterByCellValue",this.filterByCellValueHandler),this.parent.off("clearFilter",this.clearFilterHandler),this.parent.off("getFilteredColumn",this.getFilteredColumnHandler),this.parent.off(Kt,this.cMenuBeforeOpenHandler),this.parent.on(d.filterCboxValue,this.filterCboxValueHandler),this.parent.off("getFilterRange",this.getFilterRangeHandler),this.parent.off("filterCellKeyDown",this.filterCellKeyDownHandler),this.parent.off("getFilteredCollection",this.getFilteredCollection),this.parent.off("contentLoaded",this.updateFilter),this.parent.off("updateFilter",this.updateFilter))},e.prototype.getModuleName=function(){return"filter"},e.prototype.isInValidFilterRange=function(e,t){var r=x(t?y(t):y(e.selectedRange));return r[0]>e.usedRange.rowIndex||r[1]>e.usedRange.colIndex},e.prototype.filterRangeAlertHandler=function(e){var t=this;this.parent.serviceLocator.getService(Ai).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(ki);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=e.sIdx;if(i||0===i||(i=this.parent.activeSheetIndex),!(this.filterRange.size>0&&this.filterRange.has(i))||(this.removeFilter(i),n)){var a=ce(this.parent,i);if(this.isInValidFilterRange(a,e.range)){var o=this.parent.serviceLocator.getService(ki);return void this.filterRangeAlertHandler({error:o.getConstant("FilterOutOfRangeError")})}var s=a.selectedRange,l=c(s);l[0]===l[2]&&l[1]===l[3]&&(l[0]=0,l[1]=0,l[2]=a.usedRange.rowIndex,l[3]=a.usedRange.colIndex,s=m(l));var h={range:e.range?e.range:s,filterOptions:{predicates:e.predicates},cancel:!1};if(e.isCut||this.parent.notify(ir,{action:"filter",eventArgs:h}),this.processRange(a,i,e?e.range:null),n){var d=this.filterRange.get(i).slice();d[0]=d[0]+1,d[2]=a.usedRange.rowIndex,ee(this.parent,a.name+"!"+m(d),!0,!0).then(function(a){t.filterSuccessHandler(new r.DataManager(a),{action:"filtering",filterCollection:n,field:n[0]?n[0].field:null,sIdx:e.sIdx}),n.forEach(function(e){t.filterClassList.get(i)[e.field]&&t.filterClassList.get(i)[e.field].indexOf(" e-filtered")<0&&(t.filterClassList.get(i)[e.field]+=" e-filtered")}),t.refreshFilterRange(null,!1,e.sIdx)})}e.isCut||this.parent.notify(nr,{action:"filter",eventArgs:h})}},e.prototype.processRange=function(e,t,r){var n=x(y(r||e.selectedRange));n[0]===n[2]&&n[1]===n[3]&&(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,!1,t)},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)},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(ki);return void this.filterRangeAlertHandler({error:i.getConstant("FilterOutOfRangeError")})}var a=u(n.activeCell);this.isFilterRange(t,a[0],a[1])||this.processRange(n,t);var o=this.filterRange.get(t).slice();o[0]=o[0]+1,o[2]=n.usedRange.rowIndex;var s=v(a[1]+1),l=this.getColumnType(n,a[1]+1,o),h=[{field:s,operator:"date"===l||"datetime"===l||"boolean"===l?"equal":"contains",value:$(a[0],a[1],n).value,matchCase:!1,type:l}];ee(this.parent,n.name+"!"+m(o),!0,!0).then(function(t){e.filterSuccessHandler(new r.DataManager(t),{action:"filtering",filterCollection:h,field:s})})},e.prototype.renderFilterCellHandler=function(e){var r=e.sIdx;if(r||0===r||(r=this.parent.activeSheetIndex),this.filterRange.has(r)&&this.isFilterCell(r,e.rowIndex,e.colIndex)){if(!e.td)return;var n=v(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");(s=t.getComponent(i,"btn")).iconCss="e-icons e-filter-icon"+this.filterClassList.get(r)[n]}else{var o=this.parent.createElement("div",{className:"e-filter-btn"}),s=new a.Button({iconCss:"e-icons e-filter-icon"+this.filterClassList.get(r)[n],cssClass:"e-filter-iconbtn"});e.td.insertBefore(o,e.td.firstChild),s.createElement=this.parent.createElement,s.appendTo(o)}}this.parent.sortCollection&&this.parent.notify("sortImport",{sheetIdx:r})},e.prototype.refreshFilterRange=function(e,t,r){var n=r;n||0===n||(n=this.parent.activeSheetIndex);for(var i=e||this.filterRange.get(n).slice(),a=i[1];a<=i[3];a++){var o=this.parent.getCell(i[0],a);if(t){if(o&&o.hasChildNodes()){var s=o.querySelector(".e-filter-btn");s&&o.removeChild(s)}}else this.renderFilterCellHandler({td:o,rowIndex:i[0],colIndex:a,sIdx:n})}this.parent.sortCollection&&this.parent.notify("sortImport",null)},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(ki);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(),a=this.parent.getActiveSheet(),o=u(a.activeCell);if(this.isFilterRange(t,o[0],o[1])){e.field=v(o[1]+1);var s=$(i[0],o[1],a),l=this.parent.getDisplayText(s);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=document.querySelector(".e-filter-popup");if(e&&e.id.includes(this.parent.element.id)){var r=t.getComponent(e,"dialog");t.EventHandler.remove(e,qe(),this.filterMouseDownHandler),r&&r.hide()}},e.prototype.isPopupOpened=function(){var e=document.querySelector(".e-filter-popup");return e&&e.id.includes(this.parent.element.id)&&"none"!==e.style.display},e.prototype.filterCellKeyDownHandler=function(e){var t=this.parent.activeSheetIndex,r=this.parent.getActiveSheet(),n=u(r.activeCell);if(this.isFilterCell(t,n[0],n[1])){e.isFilterCell=!0;var i=Pe(r,n),a=this.parent.getCell(n[0],n[1]);this.isPopupOpened()&&this.closeDialog(),this.openDialog(a,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,n,i){var a=this,o=d.parentsUntil(e,"e-cell"),s=parseInt(o.getAttribute("aria-colindex"),10),l=v(s);this.parent.showSpinner();var h=this.parent.activeSheetIndex,p=this.filterRange.get(h).slice(),c=this.parent.getActiveSheet(),u=$(p[0],s-1,c),f=this.parent.getDisplayText(u);p[0]=p[0]+1,p[2]=c.usedRange.rowIndex,ee(this.parent,c.name+"!"+m(p),!0,!0,null,!0).then(function(o){var u;o.some(function(e,t){return e&&(u=new r.DataManager(o.slice(t))),!!e});var g={type:a.getColumnType(c,s,p),field:l,displayName:f||"Column "+l,dataSource:u,height:a.parent.element.classList.contains("e-bigger")?800:500,columns:[],hideSearchbox:!1,filteredColumns:a.filterCollection.get(h),column:{field:l,filter:{}},handler:a.filterSuccessHandler.bind(a,new r.DataManager(o)),target:e,position:{X:n,Y:i},localeObj:a.parent.serviceLocator.getService(ki)};new d.ExcelFilterBase(a.parent,a.getLocalizedCustomOperators()).openDialog(g);var m=document.querySelector(".e-filter-popup");m&&m.id.includes(a.parent.element.id)&&t.EventHandler.add(m,qe(),a.filterMouseDownHandler,a),a.parent.hideSpinner()})},e.prototype.filterCboxValueHandler=function(e){if(e.column&&e.data){var t=e.column.field;if(e.value){var r=u(t+e.data.dataObj.__rowIndex),n=$(r[0],r[1],this.parent.getActiveSheet());n&&n.format&&(e.value=this.parent.getDisplayText(n))}}},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("applySort",{sortOptions:{sortDescriptors:{order:t}},range:m(i)});for(var a=y(r.activeCell),o=v(a[1]+1),s=0,l=Object.keys(this.filterClassList.get(n));si&&n>a&&n>0?"number":i>n&&i>a&&i>0?"string":a>n&&a>i&&a>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));e0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,r=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,n=this.parent.serviceLocator.getService(Ti),i=e.options.imageId?e.options.imageId:this.parent.element.id+"_overlay_picture_"+this.pictureCount,a=c(t),o=r?this.parent.sheets[r]:this.parent.getActiveSheet();if(!document.getElementById(i)){var s={requestType:"beforeInsertImage",range:o.name+"!"+t,imageData:e.options.src,sheetIndex:r};if(e.isPublic&&this.parent.notify("actionBegin",{eventArgs:s,action:"beforeInsertImage"}),!s.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:o.frozenRows||o.frozenColumns?a[0]?we(o,0,a[0]-1):0:parseFloat(l.style.top.replace("px","")),left:o.frozenRows||o.frozenColumns?a[1]?ke(o,0,a[1]-1):0:parseFloat(l.style.left.replace("px",""))};this.parent.setUsedRange(a[0],a[1]),(e.isPublic||e.isUndoRedo)&&this.parent.notify("setImage",{options:[h],range:o.name+"!"+t});var d=$(a[0],a[1],o);d.image[d.image.length-1].id||(d.image[d.image.length-1].id=h.id),s={requestType:"insertImage",range:o.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:s,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,a=e.sheetIdx,o=this.parent.sheets[a],s=$(e.rowIdx,e.colIdx,o),l=s.image.length,h=0;h0){for(var l=0;l0?e.range.split("!")[1]:e.range.split("!")[0]:this.parent.getActiveSheet().selectedRange,h=e.range&&e.range.indexOf("!")>0?ae(this.parent,e.range.split("!")[0]):this.parent.activeSheetIndex,d=c(l);t=d[0],r=d[1],n=this.parent.sheets[h]}for(var p=$(t,r,n).image,u=p.length,f=0;f-1&&"safari"===t.Browser.info.name&&(s.style.height="7px",s.style.top="-7px"))},e.prototype.getScrollSize=function(){var e=this.parent.enableRtl?"margin-left":"margin-right";return parseInt(this.headerPanel.style[e],10)?parseInt(this.headerPanel.style[e],10):0},e.prototype.setHeaderPanelWidth=function(e,t){[].slice.call(e.querySelectorAll("col.e-empty")).forEach(function(e){t+=parseInt(e.style.width,10)}),e.style.width=t+"px"},e.prototype.setPanelHeight=function(e){var r=this.getScrollSize();if(e.frozenRows){var n=u(e.topLeftCell)[0],i=(e.showHeaders?et(31):0)+we(e,n,n+e.frozenRows-1,!0);e.showHeaders||e.frozenColumns?this.headerPanel.style.height="":this.headerPanel.style.height=i+"px",this.contentPanel.style.height="calc(100% - "+(i+r)+"px)";var a=document.getElementById(this.parent.element.id+"_sheet").getElementsByClassName("e-frozen-row")[0];a.style.width=t.Browser.isDevice?"100%":"calc(100% - "+r+"px)",a.style.top=i-1-(e.showHeaders?1:0)+"px",a.style.display=""}else this.contentPanel.style.height="calc(100% - "+((e.showHeaders?31:0)+r)+"px)"},e.prototype.renderPanel=function(){this.contentPanel=this.parent.createElement("div",{className:"e-main-panel"});var e=this.parent.getActiveSheet(),r=this.parent.element.id;this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-row-header",id:r+"_row_header"})),this.initHeaderPanel(),this.parent.allowScrolling&&this.parent.scrollModule.setPadding();var n=document.getElementById(this.parent.element.id+"_sheet");e.frozenColumns&&n.classList.add("e-frozen-columns"),e.frozenRows&&n.classList.add("e-frozen-rows"),this.updateHideHeaders(e,n),e.showGridLines||n.classList.add("e-hide-gridlines");var i=this.contentPanel.appendChild(this.parent.createElement("div",{className:"e-sheet-content",id:r+"_main_content"}));this.parent.allowScrolling||(i.style.overflow="hidden"),e.frozenRows&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-row",styles:"display: none"})),e.frozenColumns&&n.appendChild(this.parent.createElement("div",{className:"e-frozen-column",styles:"display: none"})),t.Browser.userAgent.indexOf("Mac OS")>-1&&"safari"===t.Browser.info.name&&n.classList.add("e-mac-safari")},e.prototype.initHeaderPanel=function(){var e=this.parent.element.id;this.headerPanel=this.parent.createElement("div",{className:"e-header-panel"}),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-selectall-container",id:e+"_selectall"})),this.headerPanel.appendChild(this.parent.createElement("div",{className:"e-column-header",id:e+"_col_header"}))},e.prototype.createHeaderTable=function(){var e=this.contentPanel.querySelector(".e-row-header"),t=this.parent.getActiveSheet();(t.frozenRows||t.frozenColumns)&&this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"selectall",this.headerPanel.querySelector(".e-selectall-container")),this.updateTable(t.frozenRows?["thead","tbody"]:["thead"],"colhdr",this.headerPanel.querySelector(".e-column-header")),this.updateTable(["tbody"],"rowhdr",e),this.updateLeftColGroup(null,e)},e.prototype.updateTable=function(e,t,r){var n=this,i=this.parent.createElement("table",{className:"e-table",attrs:{role:"grid"}});i.classList.add("e-"+t+"-table"),r.appendChild(i),e.forEach(function(e){i.appendChild(n.parent.createElement(e))})},e.prototype.renderTable=function(e){var r,n,i,a=this,o=this.parent.getActiveSheet(),s=document.createDocumentFragment();if(s.appendChild(this.headerPanel),s.appendChild(this.contentPanel),this.parent.allowScrolling){var l=this.parent.createElement("div",{className:"e-scrollbar"});l.appendChild(this.parent.createElement("div",{className:"e-scroller"})),s.appendChild(l)}this.createHeaderTable(),this.updateTable(["tbody"],"content",this.contentPanel.lastElementChild);var h,d=this.parent.createElement("colgroup"),p=this.contentPanel.querySelector(".e-sheet-content tbody");this.refreshSelectALLContent();var u=this.getSelectAllContent().querySelector("colgroup"),f=this.getRowHeaderPanel().querySelector("colgroup"),g=this.getSelectAllContent().querySelector("thead .e-header-row"),m=this.contentPanel.querySelector(".e-row-header tbody"),v=this.getSelectAllContent().querySelector("tbody"),y=this.headerPanel.querySelector(".e-column-header thead"),C=this.headerPanel.querySelector(".e-column-header tbody"),b=this.rowRenderer.render();y.appendChild(b),this.getColHeaderTable().insertBefore(d,y);var S=this.parent.frozenRowCount(o),x=this.parent.frozenColCount(o);this.parent.notify("beforeContentLoaded",{top:e.top,left:e.left});var w=o.colCount.toString(),I=o.colCount.toString(),E=e.top&&e.left?"RowColumn":e.top?"Row":e.left?"Column":"";this.parent.getColHeaderTable().setAttribute("aria-colcount",w),this.parent.getRowHeaderTable().setAttribute("aria-rowcount",I);var R;t.attributes(this.parent.getContentTable(),{"aria-rowcount":I,"aria-colcount":w}),e.cells.forEach(function(t,s){if((r=c(s))[1]!==e.indexes[1]&&n||(i=a.rowRenderer.render(r[0],!0),x&&S&&r[1]a.parent.viewport.bottomIndex){n=!1;break}n&&a.triggerCreatedEvent()}})},e.prototype.triggerCreatedEvent=function(){this.parent.isOpen||this.parent.hideSpinner(),this.parent.createdHandler&&(this.parent.createdHandler.observers?this.parent.created.observers=this.parent.createdHandler.observers:this.parent.setProperties({created:this.parent.createdHandler},!0),this.parent.createdHandler=void 0,this.parent.trigger("created",null),this.parent.notify("clearUndoRedoCollection",null))},e.prototype.checkTableWidth=function(e){if(this.parent.scrollSettings.isFinite&&!this.parent.scrollSettings.enableVirtualization&&e.colCount-1===this.parent.viewport.rightIndex){var t=ke(e,this.parent.viewport.leftIndex+this.parent.frozenColCount(e),this.parent.viewport.rightIndex),r=this.getRowHeaderWidth(e),n=this.getScrollSize();t=r[0]&&this.refreshPrevMerge(r[0]+1,e[1])}a&&(a.colSpan>1||a.rowSpan>1)&&this.cellRenderer.refresh(e[0]+(r[2]-r[0])+1,e[1],null,a)}else if(i.rowSpan>1){var l=r[2]+1;e[0]+i.rowSpan-1>l&&e[0]1&&this.cellRenderer.refresh(e,t,null,n)},e.prototype.checkColMerge=function(e,r,n,i,a){if(this.parent.scrollSettings.enableVirtualization&&n&&e[1]===this.parent.viewport.leftIndex+this.parent.frozenColCount(this.parent.getActiveSheet())&&(!t.isNullOrUndefined(i.rowSpan)||!t.isNullOrUndefined(i.colSpan))){if(i.colSpan<0){var o={td:n,colIdx:e[1],rowIdx:e[0],isFreezePane:!0};if(this.parent.notify("checkMerge",o),o.insideFreezePane)return}a&&(a.colSpan>1||a.rowSpan>1)&&this.cellRenderer.refresh(e[0],e[1]+(r[3]-r[1])+1,null,a)}},e.prototype.showHideHeaders=function(){var e=this,t=this.parent.getActiveSheet();Le(function(){if(t.showHeaders){var r=e.getContentPanel();e.setPanelWidth(t,e.getRowHeaderPanel()),e.setPanelHeight(t),document.getElementById(e.parent.element.id+"_sheet").classList.remove("e-hide-headers"),e.getColHeaderPanel().scrollLeft=r.scrollLeft,e.parent.selectRange(t.selectedRange)}else{if(e.updateHideHeaders(t,document.getElementById(e.parent.element.id+"_sheet")),e.setPanelHeight(t),e.parent.frozenColCount(t)||e.parent.frozenRowCount(t))e.setPanelWidth(t,e.getRowHeaderPanel()),e.parent.selectRange(t.selectedRange);else{e.getContentPanel().style.width="";var n=e.parent.enableRtl?"right":"left";e.getContentPanel().style[n]=""}e.getScrollElement().style.left=e.getRowHeaderWidth(t)+"px"}})},e.prototype.updateHideHeaders=function(e,t){e.showHeaders||t.classList.add("e-hide-headers")},e.prototype.rowHeightChange=function(e){if(e.threshold){var t=this.parent.getActiveSheet();e.rowIdx-1&&!l&&h.split("\n").length>1&&this.parent.notify(At,{range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx],wrap:!0,initial:!0,sheet:this.parent.getActiveSheet(),td:e.td,row:e.row,hRow:e.hRow}),s.element},e.prototype.update=function(e){var r=this.parent.getActiveSheet();if(e.isRefresh){if(e.td.rowSpan&&(this.mergeFreezeRow(r,e.rowIdx,e.colIdx,e.td.rowSpan,e.row,!0),e.td.removeAttribute("rowSpan")),e.td.colSpan&&(this.mergeFreezeCol(r,e.rowIdx,e.colIdx,e.td.colSpan,!0),e.td.removeAttribute("colSpan")),this.checkMerged(e))return;e.cell&&!e.cell.hyperlink&&e.td.querySelector(".e-hyperlink")&&e.td.removeChild(e.td.querySelector(".e-hyperlink"))}e.cell&&e.cell.formula&&(!e.cell.value||e.isRefreshing)&&this.calculateFormula(e);var n={type:e.cell&&H(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("getFormattedCell",n),t.isNullOrUndefined(e.td)||this.parent.refreshNode(e.td,{type:n.type,result:n.formattedText,curSymbol:t.getNumberDependable(this.parent.locale,"USD"),isRightAlign:n.isRightAlign,value:n.value||""});var i={};if(e.cell){if(e.cell.style&&(i=e.cell.style.properties?J(e.cell.style,!0):e.cell.style),e.cell.chart&&e.cell.chart.length>0&&this.parent.notify(Ut,{chart:e.cell.chart,isInitCell:!0,range:g(e.rowIdx,e.colIdx)}),e.cell.hyperlink&&this.parent.notify("createHyperlinkElement",{cell:e.cell,td:e.td,rowIdx:e.rowIdx,colIdx:e.colIdx}),e.cell.rowSpan>1){var a=e.cell.rowSpan-this.parent.hiddenCount(e.rowIdx,e.rowIdx+(e.cell.rowSpan-1));a>1&&(e.td.rowSpan=a,this.mergeFreezeRow(r,e.rowIdx,e.colIdx,a,e.row))}if(e.cell.colSpan>1){var o=e.cell.colSpan-this.parent.hiddenCount(e.colIdx,e.colIdx+(e.cell.colSpan-1),"columns");o>1&&(e.td.colSpan=o,this.mergeFreezeCol(r,e.rowIdx,e.colIdx,o))}if(e.cell.image)for(var s=0;s20})}},e.prototype.calculateFormula=function(e){var r=q(e.cell.formula),n={action:"refreshCalculate",value:e.cell.formula,rowIndex:e.rowIdx,colIndex:e.colIdx,isFormula:r,sheetIndex:e.sheetIndex};this.parent.notify(Et,n),e.cell.value=$(e.rowIdx,e.colIdx,t.isNullOrUndefined(e.sheetIndex)?this.parent.getActiveSheet():ce(this.parent,e.sheetIndex)).value},e.prototype.checkMerged=function(e){if(e.cell&&(e.cell.colSpan<0||e.cell.rowSpan<0)){var t=this.parent.getActiveSheet();if(t.frozenRows||t.frozenColumns){var r={range:[e.rowIdx,e.colIdx,e.rowIdx,e.colIdx]};this.parent.notify("activeCellMergedRange",r);var n=this.parent.frozenRowCount(t),i=this.parent.frozenColCount(t);(t.frozenRows&&t.frozenColumns?r.range[0]=n||e.rowIdx=i||e.colIdx=s){var l=void 0,h=0,d=void 0,p=this.parent.frozenColCount(e),c=a||this.parent.getRow(r,null,n),f=[].slice.call(c.parentElement.querySelectorAll(".e-empty"));if(o){var g=r+i-s;if(gm&&(m=r+v.rowSpan-s);if(m===g)return}else m=g;for(var b=r+(i-1),y=m,C=f.length;yy||((l=c.cloneNode()).classList.add("e-empty"),l.style.visibility="hidden",l.style.height=d+"px",c.parentElement.appendChild(l));this.updateSpanTop(n,p,h)}},e.prototype.updateSpanTop=function(e,t,r,n){var i=this.parent.serviceLocator.getService("sheet").contentPanel;if(n){if(!parseInt(i.style.top,10))return;r=parseInt(i.style.top,10)+r}if(t&&e=o){var s=void 0,l=void 0,h=this.parent.frozenRowCount(e),d=(rf&&(f=n+g.colSpan-o);if(f===c)return}else f=c;for(var v=f,m=p.length;vv||((s=d.childNodes[0].cloneNode()).classList.add("e-empty"),s.style.visibility="hidden",l=Re(e,v,null,!0),s.style.width=l+"px",d.appendChild(s),v===m&&this.parent.serviceLocator.getService("sheet").setPanelWidth(e,this.parent.getRowHeaderContent()))}},e.prototype.updateColZIndex=function(e,t,r){e=t&&n[3]>=r){if(e)return this.compileCellTemplate(a[o].template);if(!$(t,r,i,!0))return this.compileCellTemplate(a[o].template)}return""},e.prototype.compileCellTemplate=function(e){if("string"==typeof e){var r=void 0;return r=0===e.trim().indexOf("#")?document.querySelector(e).innerHTML.trim():e,t.compile(r)({},null,null,"",!0)[0].outerHTML}return t.compile(e)({},this.parent,"ranges","")[0]},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=Se(r,e.rowIdx),a=this.getRowHeightOnInit();if(a>i){var o=et(a);n.style.height=o+"px",(e.hRow||this.parent.getRow(e.rowIdx,this.parent.getRowHeaderTable())).style.height=o+"px",xe(r,e.rowIdx,a)}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){var n;if(e.style.length){var i=(n=this.parent.getCellStyleValue(["borderLeft","border"],[t,r+1])).borderLeft||n.border,a=(n=this.parent.getCellStyleValue(["borderTop","border"],[t+1,r])).borderTop||n.border;i||a?[].slice.call(e.style).forEach(function(t){(!i||t.indexOf("border-right")>-1||a)&&(!a||t.indexOf("border-bottom")>-1||i)||e.style.removeProperty(t)}):e.removeAttribute("style")}var o=this.parent.getCell(t-1,r);if(o&&o.style.borderBottom){var s=Number(o.parentElement.getAttribute("aria-rowindex"))-1;(n=this.parent.getCellStyleValue(["borderBottom","border"],[s,r])).borderBottom||n.border||(o.style.borderBottom="")}var l=e.previousElementSibling;l&&l.style.borderRight&&(r=Number(l.getAttribute("aria-colindex"))-1,(n=this.parent.getCellStyleValue(["borderRight","border"],[t,r])).borderRight||n.border||(l.style.borderRight=""))},e.prototype.refreshRange=function(e,t){var r=this.parent.getActiveSheet(),n=e.slice();if(Me(this.parent,n,!0))for(var i=n[0];i<=n[2];i++)if(!be(r,i))for(var a=n[1];a<=n[3];a++){var o=this.parent.getCell(i,a);o&&(this.update({rowIdx:i,colIdx:a,td:o,cell:$(i,a,r),isRefreshing:t,lastCell:a===n[3],isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify("renderFilterCell",{td:o,rowIndex:i,colIndex:a}))}},e.prototype.refresh=function(e,t,r,n){var i=this.parent.getActiveSheet();if((n||!be(i,e)&&!Ae(i,t))&&(n||!this.parent.scrollSettings.enableVirtualization||this.parent.insideViewport(e,t))){var a=n||this.parent.getCell(e,t);this.update({rowIdx:e,colIdx:t,td:a,cell:$(e,t,i),lastCell:r,isRefresh:!0,isHeightCheckNeeded:!0,manualUpdate:!0,first:""}),this.parent.notify("renderFilterCell",{td:a,rowIndex:e,colIndex:t})}},e.prototype.updateView=function(e){t.isNullOrUndefined(e.sheetIndex)||e.sheetIndex===this.parent.activeSheetIndex?this.refreshRange(e.indexes,e.refreshing):e.refreshing&&this.calculateFormula({cell:$(e.indexes[0],e.indexes[1],ce(this.parent,e.sheetIndex),!0),rowIdx:e.indexes[0],colIdx:e.indexes[1],sheetIndex:e.sheetIndex})},e}(),Bi=function(){function e(e){this.parent=e,this.addEventListener()}return e.prototype.render=function(e){this.parent.activeSheetIndex=this.parent.skipHiddenSheets(this.parent.activeSheetIndex),this.parent.isMobileView()||(this.parent.notify("ribbon",null),this.parent.notify("formulaBar",null));var t=this.parent.createElement("div",{id:this.parent.element.id+"_sheet_panel",className:"e-sheet-panel"});if(this.parent.enableRtl&&t.classList.add("e-rtl"),this.parent.element.appendChild(t),this.parent.showSheetTabs)this.parent.notify("sheetTabs",null);else{var r={action:"addSheet",sheetName:"Sheet1",index:1,visibleName:ve(this.parent,0)};this.parent.notify(Et,r),this.parent.notify(Et,{action:"initiateDefinedNames"})}this.parent.isMobileView()&&(this.parent.notify("formulaBar",null),this.parent.notify("ribbon",null)),(this.parent.password.length>0||this.parent.isProtected)&&(this.parent.isProtected=!0,this.parent.showSheetTabs&&(this.parent.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.parent.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"))),this.setSheetPanelSize(),this.renderSheet(t),this.checkTopLeftCell(!0,e)},e.prototype.checkTopLeftCell=function(e,t){var r=this.parent.getActiveSheet();this.parent.showSpinner();var n,i="A1"===r.topLeftCell,a=u(r.topLeftCell);if(r.topLeftCell!==r.paneTopLeftCell&&(r.frozenRows||r.frozenColumns)){var o=u(r.paneTopLeftCell);n=this.parent.scrollSettings.enableVirtualization,i=r.frozenRows&&r.frozenColumns?a[0]+r.frozenRows===o[0]&&a[1]+r.frozenColumns===o[1]:r.frozenRows?a[0]+r.frozenRows===o[0]&&0===a[1]:a[1]+r.frozenColumns===o[1]&&0===a[0],a[0]&&o[0]>a[0]?this.parent.viewport.beforeFreezeHeight=we(r,0,a[0]-1,!0):this.parent.viewport.beforeFreezeHeight=0,a[1]&&o[1]>a[1]?this.parent.viewport.beforeFreezeWidth=ke(r,0,a[1]-1,!0):this.parent.viewport.beforeFreezeWidth=0}else this.parent.viewport.beforeFreezeHeight=this.parent.viewport.beforeFreezeWidth=0;if(!this.parent.scrollSettings.enableVirtualization||i)this.refreshUI({rowIndex:a[0],colIndex:a[1],refresh:"All"},null,e,t),n&&(this.parent.viewport.topIndex=yt(r,0,!0),this.parent.viewport.leftIndex=yt(r,0,!0,"columns"));else{var s=r.paneTopLeftCell===r.topLeftCell?a:u(r.paneTopLeftCell),l=this.parent.frozenRowCount(r),h=this.parent.frozenColCount(r),d={preventScroll:!0};d.scrollTop=s[0]>l?we(r,l||0,s[0]-1):0,d.scrollLeft=s[1]>h?ke(r,h||0,s[1]-1):0,this.parent.notify("onContentScroll",d);var p=this.parent.getThreshold("row"),c=r.frozenRows?a[0]:a[0]>p?yt(r,a[0]-p,!0):0,f=[];r.frozenRows&&f.push(s[0]-p>l?s[0]-p:l),p=this.parent.getThreshold("col");var g=r.frozenColumns?a[1]:a[1]>p?yt(r,a[1]-p,!0,"columns"):0;r.frozenColumns?(f.length||f.push(l),f.push(s[1]-p>h?s[1]-p:h)):f.length&&f.push(h),this.refreshUI({rowIndex:c,colIndex:g,refresh:"All",top:d.scrollTop,left:d.scrollLeft,frozenIndexes:f},null,e,t),n&&(f[0]>=l&&(this.parent.viewport.topIndex=yt(r,f[0]-l,!0)),f[1]>=h&&(this.parent.viewport.leftIndex=yt(r,f[1]-h,!0,"columns")))}},e.prototype.renderSheet=function(e){void 0===e&&(e=document.getElementById(this.parent.element.id+"_sheet_panel")),e.appendChild(this.parent.createElement("div",{className:"e-sheet",id:this.parent.element.id+"_sheet",styles:"background-color: #fff"})),this.parent.serviceLocator.getService("sheet").renderPanel()},e.prototype.refreshUI=function(e,t,r,n){var i=this;"All"!==e.refresh&&this.parent.showSpinner();var a=this.parent.serviceLocator.getService("sheet"),o=this.parent.getActiveSheet(),s=ve(this.parent),l={rowCount:o.rowCount,colCount:o.colCount};if(e.frozenIndexes=e.frozenIndexes?e.frozenIndexes:[],!t)if(this.parent.scrollSettings.enableVirtualization){var h=e.rowIndex+this.parent.viewport.rowCount+2*this.parent.getThreshold("row"),d=e.colIndex+this.parent.viewport.colCount+2*this.parent.getThreshold("col"),p=this.parent.frozenRowCount(o),c=this.parent.frozenColCount(o);e.frozenIndexes.length&&(h+=e.frozenIndexes[0]-p,d+=e.frozenIndexes[1]-c),h+=o.frozenRows,d+=o.frozenColumns;var f=o.rowCount-1;this.parent.scrollSettings.isFinite&&h>f&&(h=f),f=o.colCount-1,this.parent.scrollSettings.isFinite&&d>f&&(d=f);var m=this.parent.skipHidden(e.rowIndex,h);if(e.rowIndex!==m[0]){var v=u(o.topLeftCell);v[0]===e.rowIndex&&this.parent.updateTopLeftCell(m[0],v[1],"row"),e.rowIndex=m[0]}var y=e.rowIndex;h=m[1];var C=u(o.topLeftCell);m=this.parent.skipHidden(e.colIndex,d,"columns"),e.colIndex!==m[0]&&(C[1]===e.colIndex&&this.parent.updateTopLeftCell(C[0],m[0],"col"),e.colIndex=m[0]);var b=e.colIndex;d=m[1],"Row"===e.refresh&&(y+=p,p&&(h+=C[0])),"Column"===e.refresh&&(b+=c,c&&(d+=C[1])),this.parent.viewport.topIndex=e.rowIndex,this.parent.viewport.bottomIndex=h,this.parent.viewport.leftIndex=e.colIndex,this.parent.viewport.rightIndex=d,t=g(y,b)+":"+g(h,d)}else this.parent.viewport.bottomIndex=o.rowCount-1,this.parent.viewport.rightIndex=o.colCount-1,t=g(o.frozenRows?u(o.topLeftCell)[0]:0,o.frozenColumns?u(o.topLeftCell)[1]:0)+":"+g(this.parent.viewport.bottomIndex,this.parent.viewport.rightIndex);"All"===e.refresh&&this.parent.trigger("beforeDataBound",{}),tt(this.parent.getMainContent(),{busy:!0});var S=this.parent.sheets.length;ee(this.parent,s+"!"+t,null,null,e.frozenIndexes).then(function(s){if(!(S-1&&i.checkTopLeftCell());var d,p=[e.rowIndex,e.colIndex].concat(u(t.split(":")[1]));switch(e.refresh){case"All":a.renderTable({cells:s,indexes:p,top:e.top,left:e.left,initLoad:r,isRefreshing:n});break;case"Row":a.refreshRowContent({cells:s,indexes:p,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l}),d={isEdit:!1},i.parent.notify("isFormulaBarEdit",d),d.isEdit&&i.parent.notify(Wt,{action:"startEdit",refreshCurPos:!1});break;case"Column":a.refreshColumnContent({cells:s,indexes:p,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l});break;case"RowPart":a.updateRowContent({cells:s,indexes:p,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l});break;case"ColumnPart":a.updateColContent({cells:s,indexes:p,direction:e.direction,skipUpdateOnFirst:e.skipUpdateOnFirst,prevRowColCnt:l})}i.parent.isReact&&i.parent.renderReactTemplates()}}),this.parent.notify("beforeVirtualContentLoaded",{refresh:e.refresh})},e.prototype.removeSheet=function(){t.remove(document.getElementById(this.parent.element.id+"_sheet"))},e.prototype.refreshSheet=function(e){this.removeSheet(),this.renderSheet(),this.parent.notify("deInitProperties",{}),this.checkTopLeftCell(!1,e)},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-He(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 Hi(this.parent)),this.parent.serviceLocator.register("row",new Oi(this.parent)),this.parent.serviceLocator.register("sheet",new Di(this.parent))},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e.prototype.addEventListener=function(){this.parent.on(jt,this.instantiateRenderer,this),this.parent.on("dataRefresh",this.refreshSheet,this),this.parent.on("spreadsheetDestroyed",this.destroy,this)},e.prototype.removeEventListener=function(){this.parent.off(jt,this.instantiateRenderer),this.parent.off("dataRefresh",this.refreshSheet),this.parent.off("spreadsheetDestroyed",this.destroy)},e}(),Mi=function(){function e(e){this.parent=e}return e.prototype.show=function(e,r){var n,i=this;r=!!t.isNullOrUndefined(r);var a=e.close||null,o={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,a&&a()},t.extend(o,e),r&&(n=this.parent.serviceLocator.getService(ki).getConstant(o.buttons.length?"Cancel":"Ok"),o.buttons.push({buttonModel:{content:n,isPrimary:0===o.buttons.length},click:this.hide.bind(this)}));var s=this.parent.createElement("div");document.body.appendChild(s),this.dialogInstance=new h.Dialog(o),this.dialogInstance.createElement=this.parent.createElement,this.dialogInstance.appendTo(s),this.dialogInstance.refreshPosition()},e.prototype.hide=function(){this.dialogInstance&&this.dialogInstance.hide()},e.prototype.destroy=function(){this.parent=null},e}(),Pi=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&&"beforeInsertChart"!==e.action&&"filter"!==e.action&&"cellDelete"!==e.action||this.parent.notify("setActionData",{args:e})},e.prototype.actionCompleteHandler=function(e){this.parent.notify("triggerDataChange",e),this.parent.trigger("actionComplete",e),"undoRedo"!==e.action&&"gotoSheet"!==e.action&&this.parent.notify("updateUndoRedoCollection",{args:e})},e.prototype.addEventListener=function(){this.parent.on(nr,this.actionCompleteHandler,this),this.parent.on(ir,this.actionBeginHandler,this)},e.prototype.removeEventListener=function(){this.parent.off(nr,this.actionCompleteHandler),this.parent.off(ir,this.actionBeginHandler)},e}(),_i=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=c(t),a=this.parent.sheets[r],o=this.parent.frozenRowCount(a),s=this.parent.frozenColCount(a),l=Pe(a,i,o,s,this.parent.viewport.beforeFreezeHeight,this.parent.viewport.beforeFreezeWidth,this.parent.sheetModule.colGroupWidth);if(i[0]>=o&&i[1]=s&&i[0]=o?l.top+=(a.showHeaders?31:0)+we(a,u(a.topLeftCell)[0],o-1):s||(l.left+=this.parent.sheetModule.getRowHeaderWidth(a,!0))),s&&(i[1]>=s?l.left+=this.parent.sheetModule.getRowHeaderWidth(a):o||(l.left+=a.showHeaders?31:0))):p=this.parent.getMainContent(),n.style.top=l.top+"px",n.style.left=l.left+"px",p.appendChild(n),this.renderResizeHandles(n),this.addEventListener(n),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(document.getElementById(this.parent.element.id+"_sheet"),"mousemove",this.overlayMouseMoveHandler,this),t.EventHandler.add(document,"mouseup",this.overlayMouseUpHandler,this),this.parent.on("overlayEleSize",this.setOriginalSize,this)},e.prototype.setOriginalSize=function(e){this.originalHeight=e.height,this.originalWidth=e.width},e.prototype.overlayMouseMoveHandler=function(e){var r,n,i,a,o,s,l=e.target,h=document.getElementsByClassName("e-ss-overlay-active")[0],d=this.parent.getActiveSheet(),p=d.frozenRows||d.frozenColumns?[29,this.parent.sheetModule.getRowHeaderWidth(d,!0)]:[-1,-1];if(this.isOverlayClicked&&this.isResizerClicked)switch(this.resizer){case"e-ss-overlay-t":r=Math.max(this.originalMouseY-e.clientY+this.originalHeight,20),n=e.clientY-(this.originalMouseY-this.originalResizeTop),r>180&&n>p[0]&&(h.style.height=r+"px",h.style.top=n+"px",this.resizedReorderTop=n,this.currenHeight=r,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-r":(i=this.originalWidth+(e.pageX-this.originalMouseX))>180&&(h.style.width=i+"px",this.currentWidth=i,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-b":(a=this.originalHeight+(e.pageY-this.originalMouseY))>180&&(h.style.height=a+"px",this.currenHeight=a,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}));break;case"e-ss-overlay-l":o=Math.max(this.originalMouseX-e.clientX+this.originalWidth,20),s=e.clientX-(this.originalMouseX-this.originalResizeLeft),o>180&&s>p[1]&&(h.style.width=o+"px",h.style.left=s+"px",this.resizedReorderLeft=s,this.currentWidth=o,this.parent.notify(Vt,{height:h.style.height,width:h.style.width,overlayEle:h}))}else if(this.isOverlayClicked)if(t.closest(l,".e-sheet")&&!l.classList.contains("e-sheet-content")||l.classList.contains("e-cell")){if(!h)return;var c=e.clientX-this.diffX,u=e.clientY-this.diffY;c>p[1]&&(h.style.left=c+"px"),u>p[0]&&(h.style.top=u+"px"),this.resizedReorderLeft=c,this.resizedReorderTop=u}else this.overlayMouseUpHandler(e,!0)},e.prototype.overlayMouseUpHandler=function(e,r){if(!this.parent.getActiveSheet().isProtected){this.isResizerClicked=!1;var n=e.target,i=document.getElementsByClassName("e-datavisualization-chart e-ss-overlay-active");n.classList.contains("e-ss-overlay")||(n=t.closest(e.target,".e-datavisualization-chart")?t.closest(e.target,".e-datavisualization-chart"):n);var a=this.parent.getActiveSheet(),o={prevTop:a.frozenRows||a.frozenColumns?this.prevY:this.originalReorderTop,prevLeft:a.frozenRows||a.frozenColumns?this.prevX:this.originalReorderLeft,currentTop:this.resizedReorderTop?this.resizedReorderTop:this.originalReorderTop,currentLeft:this.resizedReorderLeft?this.resizedReorderLeft:this.originalReorderLeft,id:n.id,currentHeight:this.currenHeight,currentWidth:this.currentWidth,requestType:"imageRefresh",prevHeight:this.originalHeight,prevWidth:this.originalWidth};if(this.isOverlayClicked||r){var s=void 0,l=void 0,h={clientY:o.prevTop,isImage:!0},d={clientX:o.prevLeft,isImage:!0},p=this.parent.element.getElementsByClassName("e-ss-overlay-active")[0];if(a.frozenRows||a.frozenColumns){if(!p)return;h.isImage=!1,d.isImage=!1,h.target=p,d.target=p,o.prevTop=f&&o.currentColIdx>=u){var g=parseInt(p.style.top,10),m=parseInt(p.style.left,10);g+=this.parent.sheetModule.contentPanel.scrollTop,g-=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,m+=this.parent.getScrollElement().scrollLeft,m-=this.parent.sheetModule.getRowHeaderWidth(a),p.style.top=g+"px",p.style.left=m+"px",this.parent.getMainContent().appendChild(p)}}i&&i[0]&&i[0].querySelector(".e-control")&&(o.id=i[0].id),this.originalReorderTop!==this.resizedReorderTop||this.originalReorderLeft!==this.resizedReorderLeft?(o.id=n.id,i&&i[0]?(o.requestType="chartRefresh",this.parent.notify("refreshChartCellObj",o)):this.parent.notify(hr,o),this.resizedReorderTop=this.originalReorderTop,this.resizedReorderLeft=this.originalReorderLeft):this.currenHeight===this.originalHeight&&this.originalWidth===this.currentWidth||(o.id=n.id.indexOf("overlay")>0?n.id:n.parentElement?n.parentElement.id:"",i&&i[0]?(o.requestType="chartRefresh",this.parent.notify("refreshChartCellObj",o)):this.parent.notify(hr,o),this.originalHeight=this.currenHeight,this.originalWidth=this.currentWidth)}this.isOverlayClicked=!1}},e.prototype.overlayClickHandler=function(e){if(!this.parent.getActiveSheet().isProtected){this.isOverlayClicked=!0;var r=e.target,n=e.target;r.classList.contains("e-ss-overlay")||(n=r.parentElement,t.closest(e.target,".e-datavisualization-chart")&&(n=t.closest(e.target,".e-datavisualization-chart"),this.currentWidth=parseFloat(getComputedStyle(n,null).getPropertyValue("width").replace("px","")),this.currenHeight=parseFloat(getComputedStyle(n,null).getPropertyValue("height").replace("px",""))));var i=this.parent.getActiveSheet();if((i.frozenColumns||i.frozenRows)&&t.closest(n,".e-sheet-content")){var a=parseInt(n.style.top,10),o=parseInt(n.style.left,10);a-=this.parent.sheetModule.contentPanel.scrollTop,a+=this.parent.getColumnHeaderContent().parentElement.getBoundingClientRect().height,o-=this.parent.getScrollElement().scrollLeft,o+=this.parent.sheetModule.getRowHeaderWidth(i),n.style.top=a+"px",n.style.left=o+"px",document.getElementById(this.parent.element.id+"_sheet").appendChild(n)}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 s=document.getElementsByClassName("e-ss-overlay-active")[0];s&&t.removeClass([s],"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),n.classList.contains("e-datavisualization-chart")&&(this.parent.notify("focusChartBorder",{id:n.id}),s||this.parent.notify("insertDesignChart",{id:n.id}));var l=n.getBoundingClientRect();this.prevX=l.left,this.prevY=l.top}},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");e&&(t.EventHandler.remove(e,"mousedown",this.overlayClickHandler),t.EventHandler.remove(e,"mousemove",this.overlayMouseMoveHandler)),t.EventHandler.remove(document.getElementById(this.parent.element.id+"_sheet"),"mousemove",this.overlayMouseMoveHandler),t.EventHandler.remove(document,"mouseup",this.overlayMouseUpHandler),this.parent.off("overlayEleSize",this.setOriginalSize)},e.prototype.destroy=function(){this.removeEventListener(),this.parent=null},e}(),Ui=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,t,r,n){var i,a=arguments.length,o=a<3?t:null===n?n=Object.getOwnPropertyDescriptor(t,r):n;if("object"==typeof Reflect&&"function"==typeof Reflect.decorate)o=Reflect.decorate(e,t,r,n);else for(var s=e.length-1;s>=0;s--)(i=e[s])&&(o=(a<3?i(o):a>3?i(t,r,o):i(t,r))||o);return a>3&&o&&Object.defineProperty(t,r,o),o},zi=function(e){function r(t,r){var i=e.call(this,t)||this;return i.viewport={rowCount:0,colCount:0,height:0,topIndex:0,leftIndex:0,width:0,bottomIndex:0,rightIndex:0,beforeFreezeHeight:0,beforeFreezeWidth:0},i.needsID=!0,n.Inject(li,hi,pi,Bn,Hn,_n,Un,On,qt,ci,fi,ui,gi,Vn,di,Yn,Or,ur,mr,Dr,zt,Ar,mi,Tr,zn,Gn,Fr,vi,Wn,Hr,Xn,Kn,Br,Mr,$n,Pr,Zn,Ur,Jn,_r,Qn,Vr,yi,ei,Lr,zr,Ci,Nr),r&&i.appendTo(r),i}Ui(r,e),n=r,r.prototype.getCell=function(e,t,r){return r||(r=this.getRow(e,null,t)),t=this.getViewportIndex(t,!0),r?r.cells[t]:r},r.prototype.getRow=function(e,r,n){if(!r){var i=this.getActiveSheet(),a=this.frozenRowCount(i),o=this.frozenColCount(i);r=t.isNullOrUndefined(n)||e>a-1&&n>o-1?this.getContentTable():e0&&(this.createdHandler={observers:this.created.observers},this.created.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 Mn(this)),this.scrollSettings.enableVirtualization&&new Pn(this),this.renderModule.render(this.refreshing),new jn(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=ae(this,t)),t&&(this.setSheetPropertyOnMute(this.sheets[t],"isProtected",!0),this.setSheetPropertyOnMute(this.sheets[t],"protectSettings",r)),t=this.getActiveSheet().index,this.setSheetPropertyOnMute(this.getActiveSheet(),"isProtected",!0),e.prototype.protectSheet.call(this,t,r)},r.prototype.unprotectSheet=function(t){"string"==typeof t&&(t=ae(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){t={value:t.value,mode:t.mode?t.mode:"Sheet",isCSen:!!t.isCSen&&t.isCSen,isEMatch:!!t.isEMatch&&t.isEMatch,searchBy:t.searchBy?t.searchBy:"By Row",replaceValue:t.replaceValue,replaceBy:t.replaceBy,sheetIndex:t.sheetIndex?t.sheetIndex:this.activeSheetIndex,findOpt:t.findOpt?t.findOpt:""},e.prototype.replaceHandler.call(this,t)},r.prototype.findAll=function(e,t,r,n,i){var a=[],o={value:e,mode:t=t||"Sheet",sheetIndex:i=i||this.activeSheetIndex,isCSen:r=r||!1,isEMatch:n=n||!1,findCollection:a};return this.notify("findAllValues",o),a},r.prototype.goTo=function(e){if(e.includes("!")){var t=e.split("!"),r=ae(this,t[0]);if(void 0===r)return;if(r!==this.activeSheetIndex){var n=t[1].split(":")[0],i=this.sheets[r];this.setSheetPropertyOnMute(i,"activeCell",n),this.setSheetPropertyOnMute(i,"selectedRange",t[1]);var a=u(n);if(i.frozenColumns||i.frozenRows){var o=u(i.topLeftCell);if(!(i.frozenRows&&a[0]=s?d.push(a[0]):d.push(p[0])):(h.push(a[0]),d.push(a[0])),l?(h.push(o[1]),a[1]>=l?d.push(a[1]):d.push(p[1])):(h.push(a[1]),d.push(a[1])),this.setSheetPropertyOnMute(i,"topLeftCell",g(h[0],h[1])),this.setSheetPropertyOnMute(i,"paneTopLeftCell",g(d[0],d[1]))}}else a[0]=b[0]&&f[0]=b[1]&&f[1]=b[0]&&f[0]=b[1]&&f[1]=b[0]&&f[0]=b[1]&&f[1](R=parseFloat(A.querySelector(".e-virtualtrack").style.height))&&(k+=10,(x=A.querySelector(".e-virtualtrack")).style.height=k+"px",Le(function(){x.style.height=R+"px"}))),A.scrollTop=I,A=this.element.getElementsByClassName("e-scroller")[0],f[1]===y?I=0:(I=ke(m,y,f[1]-1,!0),this.scrollSettings.enableVirtualization&&(k=I+this.getContentTable().getBoundingClientRect().width)>(E=parseFloat(A.querySelector(".e-virtualtrack").style.width))&&(k+=10,(x=A.querySelector(".e-virtualtrack")).style.width=k+"px",(w=this.getColumnHeaderContent().querySelector(".e-virtualtrack")).style.width=k+"px",(x=this.getMainContent().querySelector(".e-virtualtrack")).style.width=k+"px",Le(function(){x.style.width=E+"px",w.style.width=E+"px"}))),A.scrollLeft=I,C||this.selectRange(e)},r.prototype.insideViewport=function(e,t){var r=this.getActiveSheet();if(r.frozenRows||r.frozenColumns){var n=this.frozenRowCount(r),i=this.frozenColCount(r),a=u(r.topLeftCell);return(e>=a[0]&&e=this.viewport.topIndex+n&&e<=this.viewport.bottomIndex)&&(t>=a[1]&&t=this.viewport.leftIndex+i&&t<=this.viewport.rightIndex)}return e>=this.viewport.topIndex&&e<=this.viewport.bottomIndex&&t>=this.viewport.leftIndex&&t<=this.viewport.rightIndex},r.prototype.resize=function(){this.renderModule.setSheetPanelSize(),this.scrollSettings.enableVirtualization&&this.renderModule.refreshSheet()},r.prototype.cut=function(e){var t=new Promise(function(e,t){e(void 0)});return this.notify(Zt,e?{range:y(e),sId:this.sheets[ae(this,se(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:y(e),sId:this.sheets[ae(this,se(e))]?this.sheets[ae(this,se(e))].id:this.activeSheetIndex,promise:t}:{promise:t}),t},r.prototype.paste=function(e,t){this.notify(Jt,{range:e?y(e):e,sIdx:e?ae(this,se(e)):e,type:t,isAction:!1,isInternal:!0})},r.prototype.updateAction=function(e){ot(e,this)},r.prototype.setHeight=function(){this.height.toString().indexOf("%")>-1&&(this.element.style.minHeight="400px"),this.element.style.height=t.formatUnit(this.height)},r.prototype.setWidth=function(){(this.width.toString().indexOf("%")>-1||"auto"===this.width)&&(this.element.style.minWidth="300px"),this.element.style.width=t.formatUnit(this.width)},r.prototype.setColWidth=function(e,r,n){void 0===e&&(e=64),void 0===r&&(r=0);var i=this.getThreshold("col"),a=this.viewport.leftIndex+this.viewport.colCount+2*i,o=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n];if(o){var s=r,l="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?u(o.activeCell)[1]:r,o===this.getActiveSheet())if(r>=this.viewport.leftIndex&&r<=a){this.scrollSettings.enableVirtualization&&(r-=this.viewport.leftIndex);var h=void 0;h=o.showHeaders?this.getColumnHeaderContent().getElementsByClassName("e-header-cell")[r]:this.getContentTable().getElementsByClassName("e-row")[0].getElementsByClassName("e-cell")[r];var d=Re(o,r,null,!0);(f=et(parseInt(l,10))-d)<0&&d<-f&&(u(o.activeCell),f=-d);var p=parseInt(h.getAttribute("aria-colindex"),10)-1;this.getActiveSheet()===o&&(this.notify("colWidthChanged",{threshold:f,colIdx:p}),nt(r,r,l,!0,this))}else{var c=Re(o,r),f=void 0;f=parseInt(l,10)>0?-(c-parseInt(l,10)):-c,this.notify("colWidthChanged",{threshold:f,colIdx:r})}Ie(o,s).width=parseInt(l,10)>0?parseInt(l,10):0,o.columns[s].customWidth=!0}},r.prototype.setRowHeight=function(e,r,n,i){void 0===e&&(e=20),void 0===r&&(r=0);var a=t.isNullOrUndefined(n)?this.getActiveSheet():this.sheets[n-1];if(a){var o=r,s="number"==typeof e?e+"px":e;if(r=t.isNullOrUndefined(r)?u(a.activeCell)[0]:r,a===this.getActiveSheet())if(r<=this.viewport.bottomIndex&&r>=this.viewport.topIndex){this.scrollSettings.enableVirtualization&&(r-=this.viewport.topIndex);var l=void 0;l=a.showHeaders?this.getRowHeaderContent().getElementsByClassName("e-header-cell")[r].parentElement:this.getContentTable().getElementsByClassName("e-row")[r];var h=Se(a,r,!0);(c=et(parseInt(s,10))-h)<0&&h<-c&&(c=-h);var d=parseInt(l.getAttribute("aria-rowindex"),10)-1;this.getActiveSheet()===a&&(this.notify(Qt,{threshold:c,rowIdx:d}),t.isNullOrUndefined(i)&&(i=!1),i||(nt(r,r,s,!1,this),i=!1))}else{var p=Se(a,r),c=void 0;c=parseInt(s,10)>0?-(p-parseInt(s,10)):-p,this.notify(Qt,{threshold:c,rowIdx:r})}xe(a,o,parseInt(s,10)>0?parseInt(s,10):0),a.rows[o].customHeight=!0}},r.prototype.autoFit=function(e){var t=this.getIndexes(e),r=t.startIdx,n=t.endIdx,i=t.isCol,a=i?f("XFD"):1048576;if(r<=a)for(n>a&&(n=a),r;r<=n;r++)this.notify("setAutoFit",{idx:r,isCol:i})},r.prototype.getIndexes=function(e){var r,n,i,a;if(-1!==e.indexOf(":")){var o=e.split(":");i=o[0],a=o[1]}else i=e,a=e;if(!t.isNullOrUndefined(i)){var s=this.getAddress(i);i=s.address,r=s.isCol}if(!t.isNullOrUndefined(a)){var l=this.getAddress(a);a=l.address,n=l.isCol}var h=!0===r&&!0===n;return{startIdx:h?f(i.toUpperCase()):parseInt(i,10),endIdx:h?f(a.toUpperCase()):parseInt(a,10),isCol:h}},r.prototype.getAddress=function(e){var t;return e.substring(0,1).match(/\D/g)?(t=!0,e=e.replace(/[0-9]/g,""),{address:e,isCol:t}):e.substring(0,1).match(/[0-9]/g)&&e.match(/\D/g)?{address:"",isCol:!1}:(e=(parseInt(e,10)-1).toString(),{address:e,isCol:t})},r.prototype.addHyperlink=function(e,t){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,a=0;a-1||t.Browser.isDevice)&&-1===this.cssClass.indexOf("e-desktop-view")&&!1},r.prototype.getValueRowCol=function(t,r,n,i){return e.prototype.getValueRowCol.call(this,t,r,n,i)},r.prototype.updateCell=function(t,r){r=r||this.getActiveSheet().activeCell,e.prototype.updateCell.call(this,t,r),this.serviceLocator.getService("cell").refreshRange(y(r)),this.notify("activeCellChanged",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("sortComplete",e),Promise.resolve(e)}):Promise.reject()},r.prototype.setValueRowCol=function(t,r,n,i){if("circular reference: "===r){var a={action:"isCircularReference",argValue:r};this.notify("formulaOperation",a),r=a.argValue}e.prototype.setValueRowCol.call(this,t,r,n,i),t=oe(this,t),this.notify(Wt,{action:"refreshDependentCellValue",rowIdx:n,colIdx:i,sheetIdx:t})},r.prototype.getModuleName=function(){return"spreadsheet"},r.prototype.refreshNode=function(e,r){var n;if(e){var i=t.select("#"+this.element.id+"_currency",e),a="e-right-align";if(r){if(r.result=t.isNullOrUndefined(r.result)?"":r.result.toString(),i&&t.detach(i),"Accounting"===r.type&&L(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(a);!r.result||"true"!==r.result.toLowerCase()&&"false"!==r.result.toLowerCase()||(r.result=r.result.toUpperCase(),a="e-center-align",r.isRightAlign=!0),n=r.result,r.isRightAlign?e.classList.add(a):e.classList.remove(a)}if(n=t.isNullOrUndefined(n)?"":n,!t.isNullOrUndefined(e)){var o=e.lastChild;e.querySelector(".e-databar-value")&&(o=e.querySelector(".e-databar-value").lastChild),e.querySelector(".e-hyperlink")&&(o=e.querySelector(".e-hyperlink").lastChild),e.querySelector(".e-wrap-content")&&(o=e.querySelector(".e-wrap-content").lastChild),!o||3!==o.nodeType&&1!==o.nodeType?e.appendChild(document.createTextNode(n)):o.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 a=e;a<=t;a++)if(i[r][a]&&i[r][a].hidden){if(i.frozenColumns||i.frozenRows){"rows"===r?Ce(i,a,{hidden:!1}):Ee(i,a,{hidden:!1});continue}if(e===a&&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.undo=function(){this.notify("performUndoRedo",{isUndo:!0,isPublic:!0})},r.prototype.redo=function(){this.notify("performUndoRedo",{isUndo:!1,isPublic:!0})},r.prototype.updateUndoRedoCollection=function(e){this.notify("updateUndoRedoCollection",{args:e,isPublic:!0})},r.prototype.addDefinedName=function(e){var t={action:"addDefinedName",isAdded:!1,definedName:e};return this.notify("formulaOperation",t),t.isAdded},r.prototype.removeDefinedName=function(t,r){return e.prototype.removeDefinedName.call(this,t,r)},r.prototype.mouseClickHandler=function(e){this.notify(Gt,e)},r.prototype.mouseDownHandler=function(e){this.notify("mouseDown",e)},r.prototype.keyUpHandler=function(e){t.closest(e.target,".e-find-dlg")?this.notify("findKeyUp",e):this.notify(Yt,e)},r.prototype.keyDownHandler=function(e){t.closest(e.target,".e-findtool-dlg")||this.notify(Xt,e)},r.prototype.freeze=function(e){var t={row:e.row,column:e.column,cancel:!1,sheetIndex:this.activeSheetIndex};if(this.notify(ir,{eventArgs:t,action:"freezePanes"}),!t.cancel){if(this.on("contentLoaded",this.freezePaneUpdated,this),e.row||e.column){var r=!1;if(this.notify("getFilteredCollection",null),this.filterCollection)for(var n=0,i=this.filterCollection.length;n0&&this.showSheetTabs&&(this.element.querySelector(".e-add-sheet-tab").setAttribute("disabled","true"),this.element.querySelector(".e-add-sheet-tab").classList.add("e-disabled"));break;case"isProtected":if(this.isProtected){var h=this.element.getElementsByClassName("e-add-sheet-tab")[0];h&&(h.disabled=this.isProtected,this.isProtected?h.classList.contains("e-disabled")&&h.classList.add("e-disabled"):h.classList.contains("e-disabled")||h.classList.remove("e-disabled"))}}}},r.prototype.requiredModules=function(){return Te(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("clearFilter",{field:t}):e.prototype.clearFilter.call(this)},r.prototype.applyFilter=function(e,t){this.notify(rr,{predicates:e,range:t})},r.prototype.addCustomFunction=function(t,r){e.prototype.addCustomFunction.call(this,t,r),this.notify("refreshFormulaDatasource",null)};var n;return Vi([t.Property("")],r.prototype,"cssClass",void 0),Vi([t.Property(!0)],r.prototype,"allowScrolling",void 0),Vi([t.Property(!0)],r.prototype,"allowResizing",void 0),Vi([t.Property(!0)],r.prototype,"enableClipboard",void 0),Vi([t.Property(!0)],r.prototype,"enableContextMenu",void 0),Vi([t.Property(!0)],r.prototype,"enableKeyboardNavigation",void 0),Vi([t.Property(!0)],r.prototype,"enableKeyboardShortcut",void 0),Vi([t.Property(!0)],r.prototype,"allowUndoRedo",void 0),Vi([t.Property(!0)],r.prototype,"allowWrap",void 0),Vi([t.Complex({},Ei)],r.prototype,"selectionSettings",void 0),Vi([t.Complex({},Ii)],r.prototype,"scrollSettings",void 0),Vi([t.Event()],r.prototype,"beforeCellRender",void 0),Vi([t.Event()],r.prototype,"beforeSelect",void 0),Vi([t.Event()],r.prototype,"select",void 0),Vi([t.Event()],r.prototype,"contextMenuBeforeOpen",void 0),Vi([t.Event()],r.prototype,"fileMenuBeforeOpen",void 0),Vi([t.Event()],r.prototype,"contextMenuBeforeClose",void 0),Vi([t.Event()],r.prototype,"dialogBeforeOpen",void 0),Vi([t.Event()],r.prototype,"fileMenuBeforeClose",void 0),Vi([t.Event()],r.prototype,"contextMenuItemSelect",void 0),Vi([t.Event()],r.prototype,"fileMenuItemSelect",void 0),Vi([t.Event()],r.prototype,"beforeDataBound",void 0),Vi([t.Event()],r.prototype,"dataBound",void 0),Vi([t.Event()],r.prototype,"dataSourceChanged",void 0),Vi([t.Event()],r.prototype,"cellEdit",void 0),Vi([t.Event()],r.prototype,"cellEditing",void 0),Vi([t.Event()],r.prototype,"cellSave",void 0),Vi([t.Event()],r.prototype,"beforeCellSave",void 0),Vi([t.Event()],r.prototype,"created",void 0),Vi([t.Event()],r.prototype,"beforeSort",void 0),Vi([t.Event()],r.prototype,"beforeHyperlinkCreate",void 0),Vi([t.Event()],r.prototype,"afterHyperlinkCreate",void 0),Vi([t.Event()],r.prototype,"beforeHyperlinkClick",void 0),Vi([t.Event()],r.prototype,"afterHyperlinkClick",void 0),Vi([t.Event()],r.prototype,"actionBegin",void 0),Vi([t.Event()],r.prototype,"actionComplete",void 0),Vi([t.Event()],r.prototype,"openComplete",void 0),Vi([t.Event()],r.prototype,"sortComplete",void 0),r=n=Vi([t.NotifyPropertyChanges],r)}(In);return zi.Inject(On,Hn,_n,Un,qn,Bn,fi,hi,li,ui,ci,pi,qt,Si,bi,Vn,gi,di),e.Workbook=In,e.Range=vn,e.UsedRange=yn,e.Sheet=Cn,e.getSheetIndex=ae,e.getSheetIndexFromId=oe,e.getSheetNameFromAddress=se,e.getSheetIndexByName=le,e.updateSelectedRange=he,e.getSelectedRange=de,e.getSingleSelectedRange=pe,e.getSheet=ce,e.getSheetNameCount=ue,e.getMaxSheetId=fe,e.initSheet=ge,e.getSheetName=ve,e.Row=kn,e.getRow=ye,e.setRow=Ce,e.isHiddenRow=be,e.getRowHeight=Se,e.setRowHeight=xe,e.getRowsHeight=we,e.Column=Fn,e.getColumn=Ie,e.setColumn=Ee,e.getColumnWidth=Re,e.getColumnsWidth=ke,e.isHiddenCol=Ae,e.Cell=fn,e.getCell=$,e.setCell=Z,e.skipDefaultValue=J,e.wrap=Q,e.getData=ee,e.getModel=re,e.processIdx=ne,e.clearRange=ie,e.getRangeIndexes=c,e.getCellIndexes=u,e.getColIndex=f,e.getCellAddress=g,e.getRangeAddress=m,e.getColumnHeaderText=v,e.getIndexesFromAddress=y,e.getRangeFromAddress=C,e.getAddressFromSelectedRange=b,e.getAddressInfo=S,e.getSwapRange=x,e.isSingleCell=I,e.executeTaskAsync=E,e.WorkbookBasicModule=qr,e.WorkbookAllModule=jr,e.getWorkbookRequiredModules=z,e.CellStyle=Yr,e.FilterCollection=Xr,e.SortCollection=Kr,e.DefineName=$r,e.ProtectSettings=Zr,e.Hyperlink=Jr,e.Validation=Qr,e.Format=en,e.ConditionalFormat=tn,e.LegendSettings=rn,e.DataLabelSettings=nn,e.MajorGridLines=an,e.MinorGridLines=on,e.Axis=sn,e.Chart=ln,e.Image=hn,e.workbookDestroyed="workbookDestroyed",e.updateSheetFromDataSource=xt,e.dataSourceChanged="dataSourceChanged",e.dataChanged="dataChanged",e.triggerDataChange="triggerDataChange",e.workbookOpen="workbookOpen",e.beginSave="beginSave",e.sortImport="sortImport",e.ribbonFind="ribbonFind",e.getFilteredCollection="getFilteredCollection",e.saveCompleted="saveCompleted",e.applyNumberFormatting="applyNumber",e.getFormattedCellObject="getFormattedCell",e.refreshCellElement="refreshCellElem",e.setCellFormat=wt,e.findAllValues="findAllValues",e.textDecorationUpdate="textDecorationUpdate",e.applyCellFormat=It,e.updateUsedRange="updateUsedRange",e.workbookFormulaOperation=Et,e.workbookEditOperation="workbookEditOperation",e.checkDateFormat=Rt,e.getFormattedBarText="getFormattedBarText",e.activeCellChanged="activeCellChanged",e.openSuccess="openSuccess",e.openFailure="openFailure",e.sheetCreated="sheetCreated",e.sheetsDestroyed="sheetsDestroyed",e.aggregateComputation="aggregateComputation",e.beforeSort="beforeSort",e.initiateSort=kt,e.sortComplete="sortComplete",e.sortRangeAlert="sortRangeAlert",e.initiatelink="initiatelink",e.beforeHyperlinkCreate="beforeHyperlinkCreate",e.afterHyperlinkCreate="afterHyperlinkCreate",e.beforeHyperlinkClick="beforeHyperlinkClick",e.afterHyperlinkClick="afterHyperlinkClick",e.addHyperlink="addHyperlink",e.setLinkModel="setLinkModel",e.beforeFilter="beforeFilter",e.initiateFilter="initiateFilter",e.filterComplete="filterComplete",e.filterRangeAlert="filterRangeAlert",e.clearAllFilter="clearAllFilter",e.wrapEvent=At,e.onSave="onSave",e.insert="insert",e.deleteAction="delete",e.insertModel=Tt,e.deleteModel="deleteModel",e.isValidation="isValidation",e.setValidation=Ft,e.addHighlight="addHighlight",e.dataValidate="dataValidate",e.findNext="findNext",e.findPrevious="findPrevious",e.goto=Lt,e.findWorkbookHandler="findHandler",e.replaceHandler="replace",e.replaceAllHandler="replaceAll",e.showDialog=Nt,e.findUndoRedo="findUndoRedo",e.findKeyUp="findKeyUp",e.removeValidation=Dt,e.removeHighlight="removeHighlight",e.queryCellInfo=Ot,e.count="count",e.findCount="findCount",e.protectSheetWorkBook="protectSheet",e.updateToggle="updateToggleItem",e.protectsheetHandler="protectsheetHandler",e.replaceAllDialog="replaceAllDialog",e.unprotectsheetHandler="unprotectsheetHandler",e.workBookeditAlert="editAlert",e.setLockCells="setLockCells",e.applyLockCells="applyLockCells",e.setMerge=Ht,e.applyMerge="applyMerge",e.mergedRange="mergedRange",e.activeCellMergedRange="activeCellMergedRange",e.insertMerge="insertMerge",e.pasteMerge="pasteMerge",e.setCFRule=Bt,e.cFInitialCheck="cFInitialCheck",e.clearCFRule=Mt,e.initiateClearCFRule="initiateClearCFRule",e.cFRender="cFRender",e.cFDelete=Pt,e.clear="clear",e.clearCF="clearCF",e.clearCells=_t,e.setImage="setImage",e.setChart=Ut,e.initiateChart="initiateChart",e.refreshRibbonIcons="refreshRibbonIcons",e.refreshChart="refreshChart",e.refreshChartSize=Vt,e.updateChart="updateChart",e.deleteChartColl="deleteChartColl",e.initiateChartModel="initiateChartModel",e.focusChartBorder="focusChartBorder",e.saveError="saveError",e.validationHighlight="validationHighlight",e.dataRefresh="dataRefresh",e.updateFilter="updateFilter",e.checkIsFormula=q,e.isCellReference=j,e.isChar=W,e.inRange=G,e.isInRange=Y,e.isLocked=X,e.isValidCellReference=K,e.toFraction=R,e.getGcd=k,e.intToDate=A,e.dateToInt=T,e.isDateTime=F,e.isNumber=L,e.toDate=N,e.parseIntValue=D,e.workbookLocale=dn,e.localeData=pn,e.DataBind=qt,e.WorkbookOpen=ur,e.WorkbookSave=mr,e.WorkbookFormula=Ar,e.WorkbookNumberFormat=zt,e.getFormatFromType=O,e.getTypeFromFormat=H,e.WorkbookSort=Tr,e.WorkbookFilter=Fr,e.WorkbookImage=Lr,e.WorkbookChart=Nr,e.WorkbookCellFormat=Dr,e.WorkbookEdit=Or,e.WorkbookHyperlink=Hr,e.WorkbookInsert=Br,e.WorkbookDelete=Mr,e.WorkbookDataValidation=Pr,e.WorkbookFindAndReplace=_r,e.WorkbookProtectSheet=Ur,e.WorkbookMerge=Vr,e.WorkbookConditionalFormat=zr,e.getRequiredModules=Te,e.ribbon="ribbon",e.formulaBar="formulaBar",e.sheetTabs="sheetTabs",e.refreshSheetTabs="refreshSheetTabs",e.isFormulaBarEdit="isFormulaBarEdit",e.initialLoad=jt,e.contentLoaded="contentLoaded",e.mouseDown="mouseDown",e.spreadsheetDestroyed="spreadsheetDestroyed",e.editOperation=Wt,e.formulaOperation="formulaOperation",e.formulaBarOperation="formulaBarOperation",e.click=Gt,e.keyUp=Yt,e.keyDown=Xt,e.formulaKeyUp="formulaKeyUp",e.formulaBarUpdate="formulaBarUpdate",e.onVerticalScroll="verticalScroll",e.onHorizontalScroll="horizontalScroll",e.beforeContentLoaded="beforeContentLoaded",e.beforeVirtualContentLoaded="beforeVirtualContentLoaded",e.virtualContentLoaded="virtualContentLoaded",e.contextMenuOpen="contextMenuOpen",e.cellNavigate="cellNavigate",e.mouseUpAfterSelection="mouseUpAfterSelection",e.selectionComplete="selectionComplete",e.cMenuBeforeOpen=Kt,e.insertSheetTab="insertSheetTab",e.removeSheetTab=$t,e.renameSheetTab="renameSheetTab",e.ribbonClick="ribboClick",e.refreshRibbon="ribbonRefresh",e.enableToolbarItems="enableToolbarItems",e.tabSwitch="tabSwitch",e.selectRange="selectRange",e.cut=Zt,e.copy="copy",e.paste=Jt,e.clearCopy="clearCopy",e.dataBound="dataBound",e.beforeDataBound="beforeDataBound",e.addContextMenuItems="addContextMenuItems",e.removeContextMenuItems="removeContextMenuItems",e.enableContextMenuItems="enableContextMenuItems",e.enableFileMenuItems="enableFileMenuItems",e.hideFileMenuItems="hideFileMenuItems",e.addFileMenuItems="addFileMenuItems",e.hideRibbonTabs="hideRibbonTabs",e.enableRibbonTabs="enableRibbonTabs",e.addRibbonTabs="addRibbonTabs",e.addToolbarItems="addToolbarItems",e.hideToolbarItems="hideToolbarItems",e.beforeRibbonCreate="beforeRibbonCreate",e.rowHeightChanged=Qt,e.colWidthChanged="colWidthChanged",e.onContentScroll="onContentScroll",e.deInitProperties="deInitProperties",e.activeSheetChanged="activeSheetChanged",e.renameSheet="renameSheet",e.initiateCustomSort="initiateCustomSort",e.applySort="applySort",e.collaborativeUpdate="collaborativeUpdate",e.hideShow=er,e.autoFit=tr,e.updateToggleItem="updateToggleItem",e.initiateHyperlink="initiateHyperlink",e.editHyperlink="editHyperlink",e.openHyperlink="openHyperlink",e.removeHyperlink="removeHyperlink",e.createHyperlinkElement="createHyperlinkElement",e.sheetNameUpdate="sheetNameUpdate",e.hideSheet="hideSheet",e.performUndoRedo="performUndoRedo",e.updateUndoRedoCollection="updateUndoRedoCollection",e.setActionData="setActionData",e.getBeforeActionData="getBeforeActionData",e.clearUndoRedoCollection="clearUndoRedoCollection",e.initiateFilterUI=rr,e.renderFilterCell="renderFilterCell",e.reapplyFilter="reapplyFilter",e.filterByCellValue="filterByCellValue",e.clearFilter="clearFilter",e.getFilteredColumn="getFilteredColumn",e.completeAction=nr,e.beginAction=ir,e.filterCellKeyDown="filterCellKeyDown",e.getFilterRange="getFilterRange",e.setAutoFit="setAutoFit",e.refreshFormulaDatasource="refreshFormulaDatasource",e.setScrollEvent="setScrollEvent",e.initiateDataValidation="initiatedatavalidation",e.validationError="validationError",e.startEdit="startEdit",e.invalidData="invalidData",e.clearInvalid="clearInvalid",e.protectSheet="protectSheet",e.applyProtect="applyProtect",e.unprotectSheet="unprotectSheet",e.protectCellFormat="protectCellFormat",e.gotoDlg=ar,e.findDlg=or,e.findHandler="findHandler",e.replace=sr,e.created="created",e.editAlert="editAlert",e.setUndoRedo="setUndoRedo",e.enableFormulaInput="enableFormulaInput",e.protectSelection="protectSelection",e.hiddenMerge="hiddenMerge",e.checkPrevMerge="checkPrevMerge",e.checkMerge="checkMerge",e.removeDataValidation="removeDataValidation",e.showAggregate="showAggregate",e.initiateConditionalFormat="initiateConditionalFormat",e.checkConditionalFormat="checkConditionalFormat",e.setCF="setCF",e.clearViewer=lr,e.initiateFormulaReference="initiateFormulaReference",e.initiateCur="initiateCur",e.clearCellRef="clearCellRef",e.editValue="editValue",e.addressHandle="addressHandle",e.initiateEdit="initiateEdit",e.forRefSelRender="forRefSelRender",e.blankWorkbook="blankWorkbook",e.insertImage="insertImage",e.refreshImgElem="refreshImgElem",e.refreshImgCellObj=hr,e.getRowIdxFromClientY="getRowIdxFromClientY",e.getColIdxFromClientX="getColIdxFromClientX",e.createImageElement=dr,e.deleteImage=pr,e.deleteChart=cr,e.refreshChartCellObj="refreshChartCellObj",e.refreshImagePosition="refreshImagePosition",e.updateTableWidth="updateTableWidth",e.focusBorder="focusBorder",e.clearChartBorder="clearChartBorder",e.insertChart="insertChart",e.chartRangeSelection="chartRangeSelection",e.insertDesignChart="insertDesignChart",e.removeDesignChart="removeDesignChart",e.chartDesignTab="chartDesignTab",e.addChartEle="addChartEle",e.isReact="isReact",e.renderReactTemplates="renderReactTemplates",e.clearTemplate="clearTemplate",e.protectWorkbook="protectWorkbook",e.unProtectWorkbook="unProtectWorkbook",e.getPassWord="getPassWord",e.importProtectWorkbook="importProtectWorkbook",e.selectionStatus="selectionStatus",e.freeze="freeze",e.overlayEleSize="overlayEleSize",e.getUpdateUsingRaf=Le,e.removeAllChildren=Ne,e.getColGroupWidth=De,e.getScrollBarWidth=Oe,e.getSiblingsHeight=He,e.inView=Me,e.getCellPosition=Pe,e.setPosition=_e,e.removeRangeEle=Ue,e.locateElem=Ve,e.setStyleAttribute=ze,e.getStartEvent=qe,e.getMoveEvent=je,e.getEndEvent=We,e.isTouchStart=Ge,e.isTouchMove=Ye,e.isTouchEnd=Xe,e.isMouseDown=Ke,e.isMouseMove=$e,e.isMouseUp=Ze,e.getClientX=Je,e.getClientY=Qe,e.getDPRValue=et,e.setAriaOptions=tt,e.destroyComponent=rt,e.setResize=nt,e.setWidthAndHeight=it,e.findMaxValue=at,e.updateAction=ot,e.hasTemplate=st,e.setRowEleHeight=lt,e.getTextHeight=ht,e.getTextWidth=dt,e.getLines=pt,e.getBorderHeight=ut,e.getExcludedColumnWidth=ft,e.getTextHeightWithBorder=gt,e.setMaxHgt=mt,e.getMaxHgt=vt,e.skipHiddenIdx=yt,e.focus=Ct,e.isLockedCells=bt,e.BasicModule=bi,e.AllModule=Si,e.ScrollSettings=Ii,e.SelectionSettings=Ei,e.DISABLED="e-disabled",e.WRAPTEXT=Ri,e.locale=ki,e.dialog=Ai,e.actionEvents="actionEvents",e.overlay=Ti,e.fontColor=Fi,e.fillColor=Li,e.defaultLocale=Ni,e.Spreadsheet=zi,e.Clipboard=On,e.Edit=Hn,e.Selection=Bn,e.Scroll=Mn,e.VirtualScroll=Pn,e.KeyboardNavigation=_n,e.KeyboardShortcut=Un,e.CellFormat=Vn,e.Resize=zn,e.CollaborativeEditing=qn,e.ShowHide=jn,e.SpreadsheetHyperlink=Wn,e.UndoRedo=Gn,e.WrapText=Yn,e.Insert=Xn,e.Delete=Kn,e.DataValidation=$n,e.ProtectSheet=Zn,e.FindAndReplace=Jn,e.Merge=Qn,e.ConditionalFormatting=ei,e.Ribbon=li,e.FormulaBar=hi,e.Formula=di,e.SheetTabs=pi,e.Open=ci,e.Save=ui,e.ContextMenu=fi,e.NumberFormat=gi,e.Sort=mi,e.Filter=vi,e.SpreadsheetImage=yi,e.SpreadsheetChart=Ci,e.Render=Bi,e.SheetRender=Di,e.RowRenderer=Oi,e.CellRenderer=Hi,e.Calculate=wr,e.FormulaError=Ir,e.FormulaInfo=Er,e.CalcSheetFamilyItem=Rr,e.getAlphalabel=V,e.ValueChangedArgs=kr,e.Parser=br,e.CalculateCommon=vr,e.isUndefined=B,e.getSkeletonVal=M,e.getModules=P,e.getValue=_,e.setValue=U,e.ModuleLoader=yr,e.BasicFormulas=Cr,e}({},ej.base,ej.data,ej.navigations,ej.inputs,ej.buttons,ej.dropdowns,ej.lists,ej.splitbuttons,ej.popups,ej.grids,ej.charts),this.ejs=ej;