text: "use strict";if(!jSuites&&"function"==typeof require){var jSuites=require("jsuites");require("jsuites/dist/jsuites.css")}var jexcel=function(el,options){var obj={options:{}},defaults={url:null,data:[[]],copyCompatibility:!1,rows:[],columns:[],colHeaders:[],colWidths:[],colAlignments:[],nestedHeaders:null,defaultColWidth:50,minSpareRows:0,minSpareCols:0,minDimensions:[0,0],allowExport:!0,columnSorting:!0,columnDrag:!1,columnResize:!0,rowResize:!1,rowDrag:!0,editable:!0,allowInsertRow:!0,allowManualInsertRow:!0,allowInsertColumn:!0,allowManualInsertColumn:!0,allowDeleteRow:!0,allowDeleteColumn:!0,allowRenameColumn:!0,allowComments:!1,wordWrap:!1,csv:null,csvFileName:"jexcel",csvHeaders:!0,csvDelimiter:",",selectionCopy:!0,mergeCells:[],toolbar:null,search:!1,pagination:!1,paginationOptions:null,fullscreen:!1,lazyLoading:!1,loadingSpin:!1,tableOverflow:!1,tableHeight:"300px",tableWidth:null,style:null,onload:null,onchange:null,onbeforechange:null,oninsertrow:null,oninsertcolumn:null,ondeleterow:null,ondeletecolumn:null,onmoverow:null,onmovecolumn:null,onresizerow:null,onresizecolumn:null,onsort:null,onselection:null,onpaste:null,onmerge:null,onfocus:null,onblur:null,updateTable:null,text:{noRecordsFound:"No records found",showingPage:"Showing page {0} of {1} entries",show:"Show ",search:"Search",entries:" entries",insertANewColumnBefore:"Insert a new column before",insertANewColumnAfter:"Insert a new column after",deleteSelectedColumns:"Delete selected columns",renameThisColumn:"Rename this column",orderAscending:"Order ascending",orderDescending:"Order descending",insertANewRowBefore:"Insert a new row before",insertANewRowAfter:"Insert a new row after",deleteSelectedRows:"Delete selected rows",editComments:"Edit comments",addComments:"Add comments",comments:"Comments",clearComments:"Clear comments",copy:"Copy...",paste:"Paste...",saveAs:"Save as...",about:"About",areYouSureToDeleteTheSelectedRows:"Are you sure to delete the selected rows?",areYouSureToDeleteTheSelectedColumns:"Are you sure to delete the selected columns?",thisActionWillDestroyAnyExistingMergedCellsAreYouSure:"This action will destroy any existing merged cells. Are you sure?",thisActionWillClearYourSearchResultsAreYouSure:"This action will clear your search results. Are you sure?",thereIsAConflictWithAnotherMergedCell:"There is a conflict with another merged cell",invalidMergeProperties:"Invalid merged properties",cellAlreadyMerged:"Cell already merged",noCellsSelected:"No cells selected"},about:"jExcel CE Spreadsheet\nVersion 3.3.1\nAuthor: Paul Hodel <paul.hodel@gmail.com>\nWebsite: https://jexcel.net/v3"};for(var property in defaults)options&&options.hasOwnProperty(property)?obj.options[property]="text"==property?Object.assign(defaults[property],options[property]):options[property]:obj.options[property]=defaults[property];return obj.el=el,obj.corner=null,obj.contextMenu=null,obj.textarea=null,obj.ads=null,obj.content=null,obj.table=null,obj.thead=null,obj.tbody=null,obj.rows=[],obj.results=null,obj.searchInput=null,obj.toolbar=null,obj.pagination=null,obj.pageNumber=null,obj.headerContainer=null,obj.colgroupContainer=null,obj.headers=[],obj.records=[],obj.history=[],obj.formula=[],obj.formulaStack=0,obj.colgroup=[],obj.selection=[],obj.highlighted=[],obj.selectedCell=null,obj.selectedContainer=null,obj.style=[],obj.meta=[],obj.data=null,obj.cursor=null,obj.historyIndex=-1,obj.ignoreEvents=!1,obj.ignoreHistory=!1,obj.edition=null,obj.hashString=null,obj.resizing=null,obj.dragging=null,1==obj.options.lazyLoading&&0==obj.options.tableOverflow&&0==obj.options.fullscreen&&(console.error("JEXCEL: The lazyloading only works when tableOverflow = yes or fullscreen = yes"),obj.options.lazyLoading=!1),obj.prepareTable=function(){var e=obj.options.columns.length;void 0!==obj.options.data[0]&&obj.options.data[0].length>e&&(e=obj.options.data[0].length),obj.options.minDimensions[0]>e&&(e=obj.options.minDimensions[0]);for(var t=[],r=[],o=0;o<e;o++)obj.options.colHeaders[o]||(obj.options.colHeaders[o]=""),obj.options.colWidths[o]||(obj.options.colWidths[o]=obj.options.defaultColWidth||"50"),obj.options.colAlignments[o]||(obj.options.colAlignments[o]="center"),obj.options.columns[o]?obj.options.columns[o]||(obj.options.columns[o].type="text"):obj.options.columns[o]={type:"text"},obj.options.columns[o].source||(obj.options.columns[o].source=[]),obj.options.columns[o].options||(obj.options.columns[o].options=[]),obj.options.columns[o].editor||(obj.options.columns[o].editor=null),obj.options.columns[o].allowEmpty||(obj.options.columns[o].allowEmpty=!1),obj.options.columns[o].title||(obj.options.columns[o].title=obj.options.colHeaders[o]?obj.options.colHeaders[o]:""),obj.options.columns[o].width||(obj.options.columns[o].width=obj.options.colWidths[o]?obj.options.colWidths[o]:"50"),obj.options.columns[o].align||(obj.options.columns[o].align=obj.options.colAlignments[o]?obj.options.colAlignments[o]:"center"),"autocomplete"==obj.options.columns[o].type||"dropdown"==obj.options.columns[o].type?obj.options.columns[o].url&&(r.push(o),t.push(fetch(obj.options.columns[o].url,{headers:new Headers({"content-type":"text/json"})}).then(function(e){return e.json()}))):"calendar"==obj.options.columns[o].type&&(obj.options.columns[o].options.format||(obj.options.columns[o].options.format="DD/MM/YYYY"));t.length?Promise.all(t).then(function(e){for(var t=0;t<e.length;t++)obj.options.columns[t].source=e[t];obj.createTable()}):obj.createTable()},obj.createTable=function(){obj.table=document.createElement("table"),obj.thead=document.createElement("thead"),obj.tbody=document.createElement("tbody"),obj.headers=[],obj.colgroup=[],obj.content=document.createElement("div"),obj.content.classList.add("jexcel_content"),obj.toolbar=document.createElement("div"),obj.toolbar.classList.add("jexcel_toolbar");var e=document.createElement("div"),t=document.createTextNode(obj.options.text.search+": ");obj.searchInput=document.createElement("input"),obj.searchInput.classList.add("jexcel_search"),e.appendChild(t),e.appendChild(obj.searchInput),obj.searchInput.onfocus=function(){obj.resetSelection()};var r,o=document.createElement("div");if(obj.options.pagination>0&&obj.options.paginationOptions&&obj.options.paginationOptions.length>0){obj.paginationDropdown=document.createElement("select"),obj.paginationDropdown.classList.add("jexcel_pagination_dropdown"),obj.paginationDropdown.onchange=function(){obj.options.pagination=parseInt(this.value),obj.page(0)};for(var n=0;n<obj.options.paginationOptions.length;n++){var l=document.createElement("option");l.value=obj.options.paginationOptions[n],l.innerHTML=obj.options.paginationOptions[n],obj.paginationDropdown.appendChild(l)}o.appendChild(document.createTextNode(obj.options.text.show)),o.appendChild(obj.paginationDropdown),o.appendChild(document.createTextNode(obj.options.text.entries))}if(obj.filter=document.createElement("div"),obj.filter.classList.add("jexcel_filter"),obj.filter.appendChild(o),obj.filter.appendChild(e),obj.colgroupContainer=document.createElement("colgroup"),(r=document.createElement("col")).setAttribute("width",50),obj.colgroupContainer.appendChild(r),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var s=0;s<obj.options.nestedHeaders.length;s++)obj.thead.appendChild(obj.createNestedHeader(obj.options.nestedHeaders[s]));else obj.thead.appendChild(obj.createNestedHeader(obj.options.nestedHeaders));obj.headerContainer=document.createElement("tr"),(r=document.createElement("td")).classList.add("jexcel_selectall"),obj.headerContainer.appendChild(r);for(n=0;n<obj.options.columns.length;n++)obj.createCellHeader(n),obj.headerContainer.appendChild(obj.headers[n]),obj.colgroupContainer.appendChild(obj.colgroup[n]);obj.thead.appendChild(obj.headerContainer),obj.table=document.createElement("table"),obj.table.classList.add("jexcel"),obj.table.setAttribute("cellpadding","0"),obj.table.setAttribute("cellspacing","0"),obj.table.setAttribute("unselectable","yes"),obj.table.setAttribute("onselectstart","return false"),obj.table.appendChild(obj.colgroupContainer),obj.table.appendChild(obj.thead),obj.table.appendChild(obj.tbody),obj.corner=document.createElement("div"),obj.corner.className="jexcel_corner",obj.corner.setAttribute("unselectable","on"),obj.corner.setAttribute("onselectstart","return false"),0==obj.options.selectionCopy&&(obj.corner.style.display="none"),obj.textarea=document.createElement("textarea"),obj.textarea.className="jexcel_textarea",obj.textarea.id="jexcel_textarea",obj.contextMenu=document.createElement("div"),obj.contextMenu.className="jexcel_contextmenu",jSuites.contextmenu(obj.contextMenu,{onclick:function(){obj.contextMenu.contextmenu.close(!1)}});var i='<a href="https://bossanova.uk/jexcel/"><img src="//bossanova.uk/jexcel/logo.png">jExcel Spreadsheet</a>';obj.ads=document.createElement("div"),obj.ads.className="jexcel_about","undefined"!=typeof sessionStorage?sessionStorage.getItem("jexcel")||(sessionStorage.setItem("jexcel",!0),obj.ads.innerHTML=i):obj.ads.innerHTML=i,document.createElement("div").classList.add("jexcel_table"),obj.pagination=document.createElement("div"),obj.pagination.classList.add("jexcel_pagination");var a=document.createElement("div"),u=document.createElement("div");obj.pagination.appendChild(a),obj.pagination.appendChild(u),1==obj.options.search&&el.appendChild(obj.filter),obj.content.appendChild(obj.table),obj.content.appendChild(obj.corner),obj.content.appendChild(obj.textarea),el.appendChild(obj.toolbar),el.appendChild(obj.content),el.appendChild(obj.pagination),el.appendChild(obj.contextMenu),el.appendChild(obj.ads),el.classList.add("jexcel_container"),obj.options.toolbar&&obj.options.toolbar.length&&obj.createToolbar(),1==obj.options.fullscreen?(el.classList.add("fullscreen"),obj.options.toolbar&&el.classList.add("with-toolbar")):1==obj.options.tableOverflow&&(obj.options.tableHeight&&(obj.content.style["overflow-y"]="auto",obj.content.style.height=obj.options.tableHeight),obj.options.tableWidth&&(obj.content.style["overflow-x"]="auto",obj.content.style.width=obj.options.tableWidth)),1==obj.options.columnDrag&&obj.thead.classList.add("draggable"),1==obj.options.columnResize&&obj.thead.classList.add("resizable"),1==obj.options.rowDrag&&obj.tbody.classList.add("draggable"),1==obj.options.rowResize&&obj.tbody.classList.add("resizable"),obj.setData(),obj.options.style&&obj.setStyle(obj.options.style,null,null,1,1)},obj.setData=function(e){e&&("string"==typeof e&&(e=JSON.parse(e)),obj.options.data=e);var t=0,r=0,o=obj.options.columns.length,n=obj.options.data.length,l=obj.options.minDimensions[0],s=obj.options.minDimensions[1],i=l>o?l:o,a=s>n?s:n;for(t=0;t<a;t++)for(r=0;r<i;r++)null==obj.options.data[t]&&(obj.options.data[t]=[]),null==obj.options.data[t][r]&&(obj.options.data[t][r]="");if(obj.rows=[],obj.results=null,obj.records=[],obj.history=[],obj.historyIndex=-1,obj.tbody.innerHTML="",1==obj.options.lazyLoading){var u=0,c=obj.options.data.length<100?obj.options.data.length:100;obj.options.pagination&&(obj.options.pagination=!1,console.error("JEXCEL: Pagination will be disable due the lazyLoading"))}else if(obj.options.pagination){obj.pageNumber||(obj.pageNumber=0);obj.options.pagination;u=obj.options.pagination*obj.pageNumber,c=obj.options.pagination*obj.pageNumber+obj.options.pagination,obj.options.data.length<c&&(c=obj.options.data.length)}else u=0,c=obj.options.data.length;for(t=0;t<obj.options.data.length;t++){var b=obj.createRow(t,obj.options.data[t]);t>=u&&t<c&&obj.tbody.appendChild(b)}if(1==obj.options.lazyLoading||obj.options.pagination&&obj.updatePagination(),obj.options.mergeCells){var p=Object.keys(obj.options.mergeCells);for(r=0;r<p.length;r++){var d=obj.options.mergeCells[p[r]];obj.setMerge(p[r],d[0],d[1],1)}}obj.updateTable(),obj.ignoreEvents||"function"==typeof obj.options.onload&&obj.options.onload(el)},obj.getData=function(e){for(var t=[],r=0,o=0,n=obj.options.data[0].length,l=obj.options.data.length,s=0;s<l;s++){r=0;for(var i=0;i<n;i++)e&&!obj.records[s][i].classList.contains("highlight")||(t[o]||(t[o]=[]),t[o][r]=obj.options.data[s][i],r++);r>0&&o++}return t},obj.getRowData=function(e){return obj.options.data[e]},obj.setRowData=function(e,t){for(var r=0;r<obj.headers.length;r++){var o=jexcel.getColumnNameFromId([r,e]);obj.setValue(o,t[r])}},obj.getColumnData=function(e){for(var t=[],r=0;r<obj.options.data.length;r++)t.push(obj.options.data[r][e]);return t},obj.createRow=function(e,t){obj.records[e]||(obj.records[e]=[]),obj.rows[e]=document.createElement("tr"),obj.rows[e].setAttribute("data-y",e),obj.options.rows[e]&&obj.options.rows[e].height&&(obj.rows[e].style.height=obj.options.rows[e].height);var r=document.createElement("td");for(r.innerHTML=parseInt(e+1),r.setAttribute("data-y",e),r.className="jexcel_row",obj.rows[e].appendChild(r),i=0;i<obj.options.columns.length;i++)obj.records[e][i]=obj.createCell(i,e,t[i]),obj.rows[e].appendChild(obj.records[e][i]);return obj.rows[e]},obj.createCell=function(e,t,r){var o=document.createElement("td");if(o.setAttribute("data-x",e),o.setAttribute("data-y",t),"hidden"==obj.options.columns[e].type)o.style.display="none",o.innerHTML=r;else if("checkbox"==obj.options.columns[e].type||"radio"==obj.options.columns[e].type){var n=document.createElement("input");n.type=obj.options.columns[e].type,n.name="c"+e,n.checked=1==r||1==r||"true"==r,n.onclick=function(){obj.setValue(o,this.checked)},1==obj.options.columns[e].readOnly&&n.setAttribute("disabled","disabled"),o.appendChild(n),obj.options.data[t][e]=n.checked}else if("calendar"==obj.options.columns[e].type){var l=jSuites.calendar.extractDateFromString(r,obj.options.columns[e].options.format);o.innerHTML=jSuites.calendar.getDateString(l||r,obj.options.columns[e].options.format)}else if("dropdown"==obj.options.columns[e].type||"autocomplete"==obj.options.columns[e].type)o.classList.add("dropdown"),o.innerHTML=obj.getDropDownValue(e,r);else if("color"==obj.options.columns[e].type)if("square"==obj.options.columns[e].render){var s=document.createElement("div");s.className="color",s.style.backgroundColor=r,o.appendChild(s)}else o.style.color=r,o.innerHTML=r;else if("image"==obj.options.columns[e].type){if(r&&"data:image"==r.substr(0,10)){var i=document.createElement("img");i.src=r,o.appendChild(i)}}else{if("="==(""+r).substr(0,1)&&(r=obj.executeFormula(r,e,t)),obj.options.columns[e].mask){var a=obj.options.columns[e].decimal||".";r=""+jSuites.mask.run(r,obj.options.columns[e].mask,a)}o.innerHTML=r}1==obj.options.columns[e].readOnly&&(o.className="readonly");var u=obj.options.columns[e].align?obj.options.columns[e].align:"center";return o.style.textAlign=u,(1==obj.options.wordWrap||1==obj.options.columns[e].wordWrap||o.innerHTML.length>200)&&(o.style.whiteSpace="pre-wrap"),e>0&&(r||o.innerHTML?obj.records[t][e-1].style.overflow="hidden":e==obj.options.columns.length-1&&(o.style.overflow="hidden")),o},obj.createCellHeader=function(e){var t=obj.options.columns[e].width?obj.options.columns[e].width:obj.options.defaultColWidth,r=obj.options.columns[e].align?obj.options.columns[e].align:"center";obj.headers[e]=document.createElement("td"),obj.headers[e].innerHTML=obj.options.columns[e].title?obj.options.columns[e].title:jexcel.getColumnName(e),obj.headers[e].setAttribute("data-x",e),obj.headers[e].style.textAlign=r,obj.options.columns[e].title&&obj.headers[e].setAttribute("title",obj.options.columns[e].title),obj.colgroup[e]=document.createElement("col"),obj.colgroup[e].setAttribute("width",t),"hidden"==obj.options.columns[e].type&&(obj.headers[e].style.display="none",obj.colgroup[e].style.display="none")},obj.createNestedHeader=function(e){var t=document.createElement("tr");t.classList.add("jexcel_nested");var r=document.createElement("td");t.appendChild(r);for(var o=0,n=0;n<e.length;n++){e[n].colspan||(e[n].colspan=1),e[n].align||(e[n].align="center"),e[n].title||(e[n].title="");for(var l=[],s=0;s<e[n].colspan;s++)l.push(o),o++;(r=document.createElement("td")).setAttribute("data-column",l.join(",")),r.setAttribute("colspan",e[n].colspan),r.setAttribute("align",e[n].align),r.innerHTML=e[n].title,t.appendChild(r)}return t},obj.createToolbar=function(e){if(e)obj.options.toolbar=e;else e=obj.options.toolbar;for(var t=0;t<e.length;t++){if("i"==e[t].type)(n=document.createElement("i")).classList.add("jexcel_toolbar_item"),n.classList.add("material-icons"),n.setAttribute("data-k",e[t].k),n.setAttribute("data-v",e[t].v),e[t].onclick&&(e[t].onclick,1)?n.onclick=e[t].onclick:n.onclick=function(){var e=this.getAttribute("data-k"),t=this.getAttribute("data-v");obj.setStyle(obj.highlighted,e,t)},n.innerHTML=e[t].content,obj.toolbar.appendChild(n);else if("select"==e[t].type){(n=document.createElement("select")).classList.add("jexcel_toolbar_item"),n.setAttribute("data-k",e[t].k),e[t].onchange&&(e[t].onchange,1)?n.onchange=e[t].onchange:n.onchange=function(){var e=this.getAttribute("data-k");obj.setStyle(obj.highlighted,e,this.value)};for(var r=0;r<e[t].v.length;r++){var o=document.createElement("option");o.value=e[t].v[r],o.innerHTML=e[t].v[r],n.appendChild(o)}obj.toolbar.appendChild(n)}else if("color"==e[t].type){var n;(n=document.createElement("i")).classList.add("jexcel_toolbar_item"),n.classList.add("material-icons"),n.setAttribute("data-k",e[t].k),n.setAttribute("data-v",""),obj.toolbar.appendChild(n),n.onclick=function(){this.color.open()},n.innerHTML=e[t].content,jSuites.color(n,{onchange:function(e,t){var r=e.getAttribute("data-k");obj.setStyle(obj.highlighted,r,t)}})}}},obj.setMerge=function(e,t,r,o){var n=!1;if(!e){if(!obj.highlighted.length)return alert(obj.options.text.noCellsSelected),null;var l=parseInt(obj.highlighted[0].getAttribute("data-x")),s=parseInt(obj.highlighted[0].getAttribute("data-y")),i=parseInt(obj.highlighted[obj.highlighted.length-1].getAttribute("data-x")),a=parseInt(obj.highlighted[obj.highlighted.length-1].getAttribute("data-y"));e=jexcel.getColumnNameFromId([l,s]),t=i-l+1,r=a-s+1}var u=jexcel.getIdFromColumnName(e,!0),c=obj.options.mergeCells[e];if(c&&c[2]&&(c[0]!==t||c[1]!==r))n=obj.options.text.cellAlreadyMerged;else if((!t||t<2)&&(!r||r<2))n=obj.options.text.invalidMergeProperties;else for(var b=u[1];b<u[1]+r;b++)for(var p=u[0];p<u[0]+t;p++){var d=jexcel.getColumnNameFromId([p,b]);(c=obj.options.mergeCells[d])&&c[2]&&(c[0]!==t||c[1]!==r)&&(n=obj.options.text.thereIsAConflictWithAnotherMergedCell)}if(n)alert(n);else{t>1?obj.records[u[1]][u[0]].setAttribute("colspan",t):t=1,r>1?obj.records[u[1]][u[0]].setAttribute("rowspan",r):r=1,obj.options.mergeCells[e]=[t,r,[]],obj.records[u[1]][u[0]].setAttribute("data-merged","true"),obj.records[u[1]][u[0]].style.overflow="hidden";for(var j=[],f=u[1];f<u[1]+r;f++)for(var h=u[0];h<u[0]+t;h++)u[0]==h&&u[1]==f||(j.push(obj.options.data[f][h]),obj.updateCell(h,f,"",!0),obj.options.mergeCells[e][2].push(obj.records[f][h]),obj.records[f][h].style.display="none",obj.records[f][h]=obj.records[u[1]][u[0]]);obj.updateSelection(obj.records[u[1]][u[0]]),o||(obj.setHistory({action:"setMerge",column:e,colspan:t,rowspan:r,data:j}),"function"==typeof obj.options.onmerge&&obj.options.onmerge(el,column,width,oldWidth))}},obj.getMerge=function(e){var t={};if(e)t=obj.options.mergeCells[e]?[obj.options.mergeCells[e][0],obj.options.mergeCells[e][1]]:null;else if(obj.options.mergeCells){obj.options.mergeCells;for(var r=Object.keys(obj.options.mergeCells),o=0;o<r.length;o++)t[r[o]]=[obj.options.mergeCells[r[o]][0],obj.options.mergeCells[r[o]][1]]}return t},obj.removeMerge=function(e,t,r){if(obj.options.mergeCells[e]){var o=jexcel.getIdFromColumnName(e,!0);obj.records[o[1]][o[0]].removeAttribute("colspan"),obj.records[o[1]][o[0]].removeAttribute("rowspan"),obj.records[o[1]][o[0]].removeAttribute("data-merged");for(var n=obj.options.mergeCells[e],l=0,s=0;s<n[1];s++)for(var i=0;i<n[0];i++)(s>0||i>0)&&(obj.records[o[1]+s][o[0]+i]=n[2][l],obj.records[o[1]+s][o[0]+i].style.display="",t&&t[l]&&obj.updateCell(o[0]+i,o[1]+s,t[l]),l++);obj.updateSelection(obj.records[o[1]][o[0]],obj.records[o[1]+s-1][o[0]+i-1]),r||delete obj.options.mergeCells[e]}},obj.destroyMerged=function(e){if(obj.options.mergeCells){obj.options.mergeCells;for(var t=Object.keys(obj.options.mergeCells),r=0;r<t.length;r++)obj.removeMerge(t[r],null,e)}},obj.isColMerged=function(e,t){var r=[];if(obj.options.mergeCells)for(var o=Object.keys(obj.options.mergeCells),n=0;n<o.length;n++){var l=jexcel.getIdFromColumnName(o[n],!0),s=obj.options.mergeCells[o[n]][0],i=l[0],a=l[0]+(s>1?s-1:0);null==t?i<=e&&a>=e&&r.push(o[n]):t?i<e&&a>=e&&r.push(o[n]):i<=e&&a>e&&r.push(o[n])}return r},obj.isRowMerged=function(e,t){var r=[];if(obj.options.mergeCells)for(var o=Object.keys(obj.options.mergeCells),n=0;n<o.length;n++){var l=jexcel.getIdFromColumnName(o[n],!0),s=obj.options.mergeCells[o[n]][1],i=l[1],a=l[1]+(s>1?s-1:0);null==t?i<=e&&a>=e&&r.push(o[n]):t?i<e&&a>=e&&r.push(o[n]):i<=e&&a>e&&r.push(o[n])}return r},obj.openEditor=function(e,t,r){var o=e.getAttribute("data-y"),n=e.getAttribute("data-x");n>0&&(obj.records[o][n-1].style.overflow="hidden");var l=function(t){let r=e.getBoundingClientRect();var o=document.createElement(t);return o.style.width=r.width+"px",o.style.height=r.height-2+"px",o.style.minHeight=r.height-2+"px",e.classList.add("editor"),e.innerHTML="",e.appendChild(o),o};if(1==e.classList.contains("readonly"));else if(obj.edition=[obj.records[o][n],obj.records[o][n].innerHTML,n,o],obj.options.columns[n].editor)obj.options.columns[n].editor.openEditor(e,el);else if("hidden"==obj.options.columns[n].type);else if("checkbox"==obj.options.columns[n].type||"radio"==obj.options.columns[n].type){var s=!e.children[0].checked;obj.setValue(e,s),obj.edition=null}else if("dropdown"==obj.options.columns[n].type||"autocomplete"==obj.options.columns[n].type){s=obj.options.data[o][n];if("function"==typeof obj.options.columns[n].filter)var i=obj.options.columns[n].filter(el,e,n,o,obj.options.columns[n].source);else i=obj.options.columns[n].source;var a=l("div"),u={data:i,multiple:!!obj.options.columns[n].multiple,autocomplete:!(!obj.options.columns[n].autocomplete&&"autocomplete"!=obj.options.columns[n].type),opened:!0,value:obj.options.columns[n].multiple?s.split(";"):s,width:"100%",height:a.style.minHeight,position:1==obj.options.tableOverflow||1==obj.options.fullscreen,onclose:function(){obj.closeEditor(e,!0)}};obj.options.columns[n].options&&obj.options.columns[n].options.type&&(u.type=obj.options.columns[n].options.type),jSuites.dropdown(a,u)}else if("calendar"==obj.options.columns[n].type||"color"==obj.options.columns[n].type){s=obj.options.data[o][n];if((a=l("input")).value=s,1!=obj.options.tableOverflow&&1!=obj.options.fullscreen||(obj.options.columns[n].options.position=!0),obj.options.columns[n].options.value=obj.options.data[o][n],obj.options.columns[n].options.onclose=function(t,r){obj.closeEditor(e,!0)},"color"==obj.options.columns[n].type)jSuites.color(a,obj.options.columns[n].options);else jSuites.calendar(a,obj.options.columns[n].options).setValue(s);a.focus()}else if("image"==obj.options.columns[n].type){var c=e.children[0];(a=l("div")).style.position="relative";var b=document.createElement("div");b.classList.add("jclose"),c&&c.src&&b.appendChild(c),a.appendChild(b),jSuites.image(b);const t=e.getBoundingClientRect(),r=b.getBoundingClientRect();window.innerHeight<t.bottom+r.height?b.style.top=t.top-(r.height+2)+"px":b.style.top=t.top+"px"}else{s=1==t?"":obj.options.data[o][n];if(1==obj.options.wordWrap||1==obj.options.columns[n].wordWrap||s.length>200)a=l("textarea");else{a=l("input");obj.options.columns[n].mask&&a.setAttribute("data-mask",obj.options.columns[n].mask)}a.value=s,a.onblur=function(){obj.closeEditor(e,!0)},a.focus()}},obj.closeEditor=function(e,t){var r=parseInt(e.getAttribute("data-x")),o=parseInt(e.getAttribute("data-y"));if(1==t){if(obj.options.columns[r].editor)var n=obj.options.columns[r].editor.closeEditor(e,t);else if("checkbox"==obj.options.columns[r].type||"radio"==obj.options.columns[r].type||"hidden"==obj.options.columns[r].type);else if("dropdown"==obj.options.columns[r].type||"autocomplete"==obj.options.columns[r].type)n=e.children[0].dropdown.close(!0);else if("calendar"==obj.options.columns[r].type)n=e.children[0].calendar.close(!0);else if("color"==obj.options.columns[r].type)n=e.children[1].color.close(!0);else if("image"==obj.options.columns[r].type){var l=e.children[0].children[0].children[0];n=l&&"IMG"==l.tagName?l.src:""}else if("numeric"==obj.options.columns[r].type){"="!=(n=e.children[0].value).substr(0,1)&&""==n&&(n=obj.options.columns[r].allowEmpty?"":0),e.children[0].onblur=null}else{n=e.children[0].value;e.children[0].onblur=null}var s=!!obj.ignoreEvents,i=!!obj.ignoreHistory;obj.options.data[o][r]==n&&(obj.ignoreEvents=!0,obj.ignoreHistory=!0),obj.edition[1]==n?e.innerHTML=obj.edition[1]:obj.setValue(e,n),obj.ignoreEvents=s,obj.ignoreHistory=i}else obj.options.columns[r].editor?obj.options.columns[r].editor.closeEditor(e,t):"dropdown"==obj.options.columns[r].type||"autocomplete"==obj.options.columns[r].type?e.children[0].dropdown.close(!1):"calendar"==obj.options.columns[r].type?e.children[0].calendar.close(!1):"color"==obj.options.columns[r].type?e.children[1].color.close(!1):e.children[0].onblur=null,e.innerHTML=obj.edition[1];e.classList.remove("editor"),obj.edition=null},obj.getValue=function(e){if("object"==typeof e)var t=e.getAttribute("data-x"),r=e.getAttribute("data-y");else t=(e=jexcel.getIdFromColumnName(e,!0))[0],r=e[1];return null!=t&&null!=r?obj.options.data[r][t]:null},obj.getValueFromCoords=function(e,t){if(null!=e&&null!=t)return obj.options.data[t][e]},obj.setValue=function(e,t,r){var o=[];if("string"==typeof e){var n=jexcel.getIdFromColumnName(e,!0),l=n[0],s=n[1];o.push(obj.updateCell(l,s,t))}else{var i=Object.keys(e);if(i.length>0)for(var a=0;a<i.length;a++){l=e[a].getAttribute("data-x"),s=e[a].getAttribute("data-y");o.push(obj.updateCell(l,s,t))}else{l=e.getAttribute("data-x"),s=e.getAttribute("data-y");o.push(obj.updateCell(l,s,t))}}obj.updateFormulaChain(l,s,o),obj.setHistory({action:"setValue",records:o,selection:obj.selectedCell}),obj.updateTable()},obj.setCheckRadioValue=function(){for(var e=[],t=Object.keys(obj.highlighted),r=0;r<t.length;r++){var o=obj.highlighted[r].getAttribute("data-x"),n=obj.highlighted[r].getAttribute("data-y");"checkbox"!=obj.options.columns[o].type&&"radio"!=obj.options.columns[o].type||e.push(obj.updateCell(o,n,!obj.options.data[n][o]))}e.length&&obj.setHistory({action:"setValue",records:e,selection:obj.selectedCell})},obj.updateCell=function(e,t,r,o){if(1!=obj.records[t][e].classList.contains("readonly")||o){obj.ignoreEvents||"function"==typeof obj.options.onbeforechange&&obj.options.onbeforechange(el,obj.records[t][e],e,t,r);var n={col:e,row:t,newValue:r,oldValue:obj.options.data[t][e]};if(obj.options.columns[e].editor)obj.options.data[t][e]=r,obj.options.columns[e].editor.setValue(obj.records[t][e],r,o);else if("checkbox"==obj.options.columns[e].type||"radio"==obj.options.columns[e].type){if("radio"==obj.options.columns[e].type)for(var l=0;l<obj.options.data.length;l++)obj.options.data[l][e]=!1;obj.records[t][e].children[0].checked=1==r||1==r||"true"==r,obj.options.data[t][e]=obj.records[t][e].children[0].checked}else if("dropdown"==obj.options.columns[e].type||"autocomplete"==obj.options.columns[e].type)obj.options.data[t][e]=r,obj.records[t][e].innerHTML=obj.getDropDownValue(e,r);else if("calendar"==obj.options.columns[e].type){var s=jSuites.calendar.extractDateFromString(r,obj.options.columns[e].options.format);obj.options.data[t][e]=r,obj.records[t][e].innerHTML=jSuites.calendar.getDateString(s||r,obj.options.columns[e].options.format)}else if("color"==obj.options.columns[e].type)if(obj.options.data[t][e]=r,"square"==obj.options.columns[e].render){var i=document.createElement("div");i.className="color",i.style.backgroundColor=r,obj.records[t][e].innerHTML="",obj.records[t][e].appendChild(i)}else obj.records[t][e].style.color=r,obj.records[t][e].innerHTML=r;else if("image"==obj.options.columns[e].type){if(r=""+r,obj.options.data[t][e]=r,obj.records[t][e].innerHTML="",r&&"data:image"==r.substr(0,10)){var a=document.createElement("img");a.src=r,obj.records[t][e].appendChild(a)}}else{if(0!=obj.options.columns[e].autoCasting?obj.options.data[t][e]=r&&Number(r)==r?Number(r):r:obj.options.data[t][e]=r,"="==(""+r).substr(0,1)&&(r=obj.executeFormula(r,e,t)),obj.options.columns[e].mask){var u=obj.options.columns[e].decimal||".";r=""+jSuites.mask.run(r,obj.options.columns[e].mask,u)}obj.records[t][e].innerHTML=r,obj.records[t][e].innerHTML.length>200?obj.records[t][e].style.whiteSpace="pre-wrap":0==obj.options.wordWrap&&0==obj.options.columns[e].wordWrap&&(obj.records[t][e].style.whiteSpace="")}e>0&&(obj.options.data[t][e]||"text"!=obj.options.columns[e].type&&"number"!=obj.options.columns[e].type?obj.records[t][e-1].style.overflow="hidden":obj.records[t][e-1].style.overflow=""),obj.ignoreEvents||"function"==typeof obj.options.onchange&&obj.options.onchange(el,obj.records[t][e],e,t,r)}else;return n},obj.copyData=function(e,t){for(var r=obj.getData(!0),o=obj.selectedContainer[1],n=obj.selectedContainer[3],l=parseInt(e.getAttribute("data-x")),s=parseInt(e.getAttribute("data-y")),i=parseInt(t.getAttribute("data-x")),a=parseInt(t.getAttribute("data-y")),u=[],c=[],b=1,p=!1,d=0,j=0,f=s;f<=a;f++)if("none"!=obj.rows[f].style.display){null==r[j]&&(j=0),d=0;for(var h=l;h<=i;h++){if(obj.records[f][h]&&!obj.records[f][h].classList.contains("readonly")&&"none"!=obj.records[f][h].style.display&&0==p){if(!obj.selection.length&&obj.options.data[f][h]){p=!0;continue}if(null==r[j])d=0;else if(null==r[j][d])d=0;else var g=r[j][d];if(g&&o==n)if("text"==obj.options.columns[h].type||"number"==obj.options.columns[h].type)if("="==(""+g).substr(0,1)){var m=g.match(/([A-Z]+[0-9]+)/g);if(m){for(var v=[],x=0;x<m.length;x++){var y=jexcel.getIdFromColumnName(m[x],1);y[1]+=b;var C=jexcel.getColumnNameFromId([y[0],y[1]]);C!=m[x]&&(v[m[x]]=C)}v&&(g=obj.updateFormula(g,v))}}else g==Number(g)&&(g=Number(g)+b);else if("calendar"==obj.options.columns[h].type){var E=new Date(g);E.setDate(E.getDate()+b),g=E.getFullYear()+"-"+parseInt(E.getMonth()+1)+"-"+E.getDate()+" "+E.getHours()+":"+E.getMinutes()+":00"}u.push(obj.updateCell(h,f,g)),"="==(""+g).substr(0,1)&&(c[h+","+f]=!0)}d++}j++,b++}var N=Object.keys(c);for(h=0;h<N.length;h++){var I=N[h].split(",");obj.updateFormulaChain(I[0],I[1],u)}obj.setHistory({action:"setValue",records:u,selection:obj.selectedCell}),obj.updateTable()},obj.refreshSelection=function(){obj.selectedCell&&obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])},obj.conditionalSelectionUpdate=function(e,t,r){if(1==e){if(obj.selectedCell&&(t>=obj.selectedCell[1]&&t<=obj.selectedCell[3]||r>=obj.selectedCell[1]&&r<=obj.selectedCell[3]))return void obj.resetSelection()}else if(obj.selectedCell&&(t>=obj.selectedCell[0]&&t<=obj.selectedCell[2]||r>=obj.selectedCell[0]&&r<=obj.selectedCell[2]))return void obj.resetSelection()},obj.resetSelection=function(e){if(obj.highlighted.length){u=1;for(var t=0;t<obj.highlighted.length;t++){obj.highlighted[t].classList.remove("highlight"),obj.highlighted[t].classList.remove("highlight-left"),obj.highlighted[t].classList.remove("highlight-right"),obj.highlighted[t].classList.remove("highlight-top"),obj.highlighted[t].classList.remove("highlight-bottom"),obj.highlighted[t].classList.remove("highlight-selected");var r=parseInt(obj.highlighted[t].getAttribute("data-x")),o=parseInt(obj.highlighted[t].getAttribute("data-y"));if(obj.highlighted[t].getAttribute("data-merged"))var n=parseInt(obj.highlighted[t].getAttribute("colspan")),l=parseInt(obj.highlighted[t].getAttribute("rowspan")),s=n>0?r+(n-1):r,i=l>0?o+(l-1):o;else s=r,i=o;for(var a=r;a<=s;a++)obj.headers[a]&&obj.headers[a].classList.remove("selected");for(a=o;a<=i;a++)obj.rows[a]&&obj.rows[a].classList.remove("selected")}}else var u=0;return obj.highlighted=[],obj.selectedCell=null,obj.corner.style.top="-2000px",obj.corner.style.left="-2000px",1!=obj.ignoreEvents&&1==e&&obj.options.onblur&&"function"==typeof obj.options.onblur&&1==u&&obj.options.onblur(el),u},obj.updateSelection=function(e,t,r){var o=e.getAttribute("data-x"),n=e.getAttribute("data-y");if(t)var l=t.getAttribute("data-x"),s=t.getAttribute("data-y");else l=o,s=n;obj.updateSelectionFromCoords(o,n,l,s,r)},obj.updateSelectionFromCoords=function(e,t,r,o,n){var l=obj.resetSelection();if(null==r&&(r=e),null==o&&(o=t),e>=obj.headers.length&&(e=obj.headers.length-1),t>=obj.rows.length&&(t=obj.rows.length-1),r>=obj.headers.length&&(r=obj.headers.length-1),o>=obj.rows.length&&(o=obj.rows.length-1),obj.selectedCell=[e,t,r,o],null!=e){if(obj.records[t][e].classList.add("highlight-selected"),parseInt(e)<parseInt(r))var s=parseInt(e),i=parseInt(r);else s=parseInt(r),i=parseInt(e);if(parseInt(t)<parseInt(o))var a=parseInt(t),u=parseInt(o);else a=parseInt(o),u=parseInt(t);for(var c=s;c<=i;c++)for(var b=a;b<=u;b++)if(obj.records[b][c].getAttribute("data-merged")){var p=parseInt(obj.records[b][c].getAttribute("data-x")),d=parseInt(obj.records[b][c].getAttribute("data-y")),j=parseInt(obj.records[b][c].getAttribute("colspan")),f=parseInt(obj.records[b][c].getAttribute("rowspan"));j>1&&(p<s&&(s=p),p+j>i&&(i=p+j-1)),f&&(d<a&&(a=d),d+f>u&&(u=d+f-1))}var h=null,g=null,m=null,v=null;for(b=a;b<=u;b++)"none"!=obj.rows[b].style.display&&(null==m&&(m=b),v=b);for(c=s;c<=i;c++){for(b=a;b<=u;b++)"none"!=obj.rows[b].style.display&&"none"!=obj.records[b][c].style.display&&(obj.records[b][c].classList.add("highlight"),obj.highlighted.push(obj.records[b][c]));"hidden"!=obj.options.columns[c].type&&(null==h&&(h=c),g=c)}h||(h=0),g||(g=0);for(c=h;c<=g;c++)"hidden"!=obj.options.columns[c].type&&(obj.records[m][c].classList.add("highlight-top"),obj.records[v][c].classList.add("highlight-bottom"),obj.headers[c].classList.add("selected"));for(b=m;b<=v;b++)"none"!=obj.rows[b].style.display&&(obj.records[b][h].classList.add("highlight-left"),obj.records[b][g].classList.add("highlight-right"),obj.rows[b].classList.add("selected"));obj.selectedContainer=[h,m,g,v]}1!=obj.ignoreEvents&&(obj.options.onfocus&&"function"==typeof obj.options.onfocus&&0==l&&obj.options.onfocus(el),"function"==typeof obj.options.onselection&&obj.options.onselection(el,h,m,g,v,n)),obj.updateCornerPosition()},obj.removeCopySelection=function(){for(var e=0;e<obj.selection.length;e++)obj.selection[e].classList.remove("selection"),obj.selection[e].classList.remove("selection-left"),obj.selection[e].classList.remove("selection-right"),obj.selection[e].classList.remove("selection-top"),obj.selection[e].classList.remove("selection-bottom");obj.selection=[]},obj.updateCopySelection=function(e,t){obj.removeCopySelection();var r=obj.selectedContainer[0],o=obj.selectedContainer[1],n=obj.selectedContainer[2],l=obj.selectedContainer[3];if(e&&t){if(e-n>0)var s=parseInt(n)+1,i=parseInt(e);else s=parseInt(e),i=parseInt(r)-1;if(t-l>0)var a=parseInt(l)+1,u=parseInt(t);else a=parseInt(t),u=parseInt(o)-1;if(i-s<u-a)s=parseInt(r),i=parseInt(n);else a=parseInt(o),u=parseInt(l);for(var c=a;c<=u;c++)for(var b=s;b<=i;b++)obj.records[c][b]&&"none"!=obj.rows[c].style.display&&"none"!=obj.records[c][b].style.display&&(obj.records[c][b].classList.add("selection"),obj.records[a][b].classList.add("selection-top"),obj.records[u][b].classList.add("selection-bottom"),obj.records[c][s].classList.add("selection-left"),obj.records[c][i].classList.add("selection-right"),obj.selection.push(obj.records[c][b]))}},obj.updateCornerPosition=function(){if(obj.highlighted.length){var e=obj.highlighted[obj.highlighted.length-1],t=obj.content.getBoundingClientRect().left,r=obj.content.getBoundingClientRect().top,o=e.getBoundingClientRect().left,n=e.getBoundingClientRect().top,l=e.getBoundingClientRect().width,s=e.getBoundingClientRect().height,i=o-t+obj.content.scrollLeft+l-4,a=n-r+obj.content.scrollTop+s-4;obj.corner.style.top=a+"px",obj.corner.style.left=i+"px"}else obj.corner.style.top="-2000px",obj.corner.style.left="-2000px"},obj.updateScroll=function(e){var t=obj.content.getBoundingClientRect().left,r=obj.content.getBoundingClientRect().top,o=obj.content.getBoundingClientRect().width,n=obj.content.getBoundingClientRect().height,l=obj.records[obj.selectedCell[3]][obj.selectedCell[2]],s=l.getBoundingClientRect().left,i=l.getBoundingClientRect().top,a=l.getBoundingClientRect().width,u=l.getBoundingClientRect().height;if(0==e||1==e)var c=s-t+obj.content.scrollLeft,b=i-r+obj.content.scrollTop-2;else c=s-t+obj.content.scrollLeft+a,b=i-r+obj.content.scrollTop+u;b>obj.content.scrollTop+30&&b<obj.content.scrollTop+n||(b<obj.content.scrollTop+30?obj.content.scrollTop=b-u:obj.content.scrollTop=b-(n-2)),c>obj.content.scrollLeft&&c<obj.content.scrollLeft+o||(c<obj.content.scrollLeft+30?(obj.content.scrollLeft=c,obj.content.scrollLeft<50&&(obj.content.scrollLeft=0)):obj.content.scrollLeft=c-(o-20))},obj.getWidth=function(e){if(e)"object"==typeof e&&(e=$(e).getAttribute("data-x")),t=obj.colgroup[e].getAttribute("width");else for(var t=[],r=0;r<obj.headers.length;r++)t.push(obj.options.columns[r].width);return t},obj.setWidth=function(e,t,r){t>0&&("object"==typeof e&&(e=$(e).getAttribute("data-x")),r||obj.colgroup[e].getAttribute("width"),obj.colgroup[e].setAttribute("width",t),obj.options.columns[e].width=t,obj.setHistory({action:"setWidth",column:e,oldValue:r,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onresizecolumn&&obj.options.onresizecolumn(el,e,t,r),obj.updateCornerPosition())},obj.setHeight=function(e,t,r){t>0&&("object"==typeof e&&(column=$(e).getAttribute("data-y")),r||obj.rows[e].getAttribute("height"),obj.rows[e].setAttribute("height",t),obj.options.rows[e]||(obj.options.rows[e]={}),obj.options.rows[e].height=t,obj.setHistory({action:"setHeight",row:e,oldValue:r,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onresizerow&&obj.options.onresizerow(el,e,t,r),obj.updateCornerPosition())},obj.getHeight=function(e){return e&&("object"==typeof e&&(e=$(e).getAttribute("data-y")),data=obj.rows[e].getAttribute("height")),data},obj.getHeader=function(e){return obj.headers[e].innerText},obj.setHeader=function(e,t){if(obj.headers[e]){var r=obj.headers[e].innerText;t||(t=prompt("Column name",r)),t&&(obj.headers[e].innerHTML=t),obj.setHistory({action:"setHeader",column:e,oldValue:r,newValue:t})}},obj.getHeaders=function(e){for(var t=[],r=0;r<obj.headers.length;r++)t.push(obj.getHeader(r));return e?t:t.join(",")},obj.getStyle=function(e,t){if(e)return e=jexcel.getIdFromColumnName(e,!0),t?obj.records[e[1]][e[0]].style[t]:obj.records[e[1]][e[0]].getAttribute("style");for(var r={},o=obj.options.data[0].length,n=obj.options.data.length,l=0;l<n;l++)for(var s=0;s<o;s++){var i=t?obj.records[l][s].style[t]:obj.records[l][s].getAttribute("style");if(i)r[jexcel.getColumnNameFromId([s,l])]=i}return r},obj.resetStyle=function(e,t){for(var r=Object.keys(e),o=0;o<r.length;o++){var n=jexcel.getIdFromColumnName(r[o],!0);obj.records[n[1]]&&obj.records[n[1]][n[0]]&&obj.records[n[1]][n[0]].setAttribute("style","")}obj.setStyle(e,null,null,null,t)},obj.setStyle=function(e,t,r,o,n){var l={},s={},i=function(e,t,r){var n=jexcel.getIdFromColumnName(e,!0);if(obj.records[n[1]]&&obj.records[n[1]][n[0]]){var i=obj.records[n[1]][n[0]].style[t];i!=r||o?obj.records[n[1]][n[0]].style[t]=r:(r="",obj.records[n[1]][n[0]].style[t]=""),s[e]||(s[e]=[]),l[e]||(l[e]=[]),s[e].push([t+":"+i]),l[e].push([t+":"+r])}};if(t&&r)if("string"==typeof e)i(e,t,r);else for(var a=[],u=0;u<e.length;u++){var c=e[u].getAttribute("data-x"),b=e[u].getAttribute("data-y"),p=jexcel.getColumnNameFromId([c,b]);a[p]||(i(p,t,r),a[p]=!0)}else{var d=Object.keys(e);for(u=0;u<d.length;u++){var j=e[d[u]];"string"==typeof j&&(j=j.split(";"));for(var f=0;f<j.length;f++)"string"==typeof j[f]&&(j[f]=j[f].split(":")),j[f][0].trim()&&i(d[u],j[f][0].trim(),j[f][1])}}for(d=Object.keys(s),u=0;u<d.length;u++)s[d[u]]=s[d[u]].join(";");for(d=Object.keys(l),u=0;u<d.length;u++)l[d[u]]=l[d[u]].join(";");n||obj.setHistory({action:"setStyle",oldValue:s,newValue:l})},obj.getComments=function(e,t){if("string"==typeof e)e=jexcel.getIdFromColumnName(e,!0);return t?[obj.records[e[1]][e[0]].getAttribute("title"),obj.records[e[1]][e[0]].getAttribute("author")]:obj.records[e[1]][e[0]].getAttribute("title")||""},obj.setComments=function(e,t,r){if("string"==typeof e)var o=jexcel.getIdFromColumnName(e,!0);else o=e;var n=[obj.records[o[1]][o[0]].getAttribute("title"),r=obj.records[o[1]][o[0]].getAttribute("data-author")];obj.records[o[1]][o[0]].setAttribute("title",t||""),obj.records[o[1]][o[0]].setAttribute("data-author",r||""),t?obj.records[o[1]][o[0]].classList.add("jexcel_comments"):obj.records[o[1]][o[0]].classList.remove("jexcel_comments"),obj.setHistory({action:"setComments",column:e,newValue:[t,r],oldValue:n})},obj.getConfig=function(){var e=obj.options;return e.style=obj.getStyle,e},obj.orderBy=function(e,t){if(e>=0){if(Object.keys(obj.options.mergeCells).length>0){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}t=null==t?obj.headers[e].classList.contains("arrow-down")?1:0:t?1:0,Array.prototype.orderBy=function(e,t){return this.slice(0).sort(function(r,o){var n=Number(r[e])==r[e]?Number(r[e]):r[e].toLowerCase(),l=Number(o[e])==o[e]?Number(o[e]):o[e].toLowerCase();return t?n>l?-1:n<l?1:0:n>l?1:n<l?-1:0})};var r=[];if("calendar"==obj.options.columns[e].type||"checkbox"==obj.options.columns[e].type||"radio"==obj.options.columns[e].type)for(var o=0;o<obj.options.data.length;o++)r[o]=[o,obj.options.data[o][e]];else for(o=0;o<obj.options.data.length;o++)r[o]=[o,obj.records[o][e].innerHTML];r=r.orderBy(1,t);var n=[];for(o=0;o<r.length;o++)n[o]=r[o][0];return obj.setHistory({action:"orderBy",rows:n,column:e,order:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onsort&&obj.options.onsort(el,e,t),obj.updateOrderArrow(e,t),obj.updateOrder(n),!0}},obj.updateOrderArrow=function(e,t){for(var r=0;r<obj.headers.length;r++)obj.headers[r].classList.remove("arrow-up"),obj.headers[r].classList.remove("arrow-down");t?obj.headers[e].classList.add("arrow-up"):obj.headers[e].classList.add("arrow-down")},obj.updateOrder=function(e){for(var t=[],r=0;r<e.length;r++)t[r]=obj.options.data[e[r]];obj.options.data=t;for(t=[],r=0;r<e.length;r++)t[r]=obj.records[e[r]];obj.records=t;for(t=[],r=0;r<e.length;r++)t[r]=obj.rows[e[r]];if(obj.rows=t,obj.updateTableReferences(),obj.searchInput.value)obj.search(obj.searchInput.value);else if(obj.results=null,obj.pageNumber=0,obj.options.pagination>0)obj.page(0);else if(1==obj.options.lazyLoading)obj.loadPage(0);else for(r=0;r<obj.rows.length;r++)obj.tbody.appendChild(obj.rows[r])},obj.moveRow=function(e,t,r){if(Object.keys(obj.options.mergeCells).length>0&&obj.isRowMerged(t).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if(1==obj.options.search){if(obj.results&&obj.results.length!=obj.rows.length){if(!confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))return!1;obj.resetSearch()}obj.results=null}r||(Array.prototype.indexOf.call(obj.tbody.children,obj.rows[t])>=0?e>t?obj.tbody.insertBefore(obj.rows[e],obj.rows[t]):obj.tbody.insertBefore(obj.rows[e],obj.rows[t].nextSibling):obj.tbody.removeChild(obj.rows[e])),obj.rows.splice(t,0,obj.rows.splice(e,1)[0]),obj.records.splice(t,0,obj.records.splice(e,1)[0]),obj.options.data.splice(t,0,obj.options.data.splice(e,1)[0]),obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.setHistory({action:"moveRow",oldValue:e,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onmoverow&&obj.options.onmoverow(el,e,t),obj.updateTableReferences()},obj.insertRow=function(e,t,r){if(1==obj.options.allowInsertRow){var o=[];if(e>0)var n=e;else{n=1;e&&(o=e)}r=!!r;var l=obj.options.data.length-1;if((null==t||t>=parseInt(l)||t<0)&&(t=l),Object.keys(obj.options.mergeCells).length>0&&obj.isRowMerged(t,r).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if(1==obj.options.search){if(obj.results&&obj.results.length!=obj.rows.length){if(!confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))return!1;obj.resetSearch()}obj.results=null}for(var s=r?t:t+1,i=obj.records.splice(s),a=obj.options.data.splice(s),u=obj.rows.splice(s),c=[],b=[],p=[],d=s;d<n+s;d++){obj.options.data[d]=[];for(var j=0;j<obj.options.columns.length;j++)obj.options.data[d][j]=o[j]?o[j]:"";var f=obj.createRow(d,obj.options.data[d]);(!u[0]||Array.prototype.indexOf.call(obj.tbody.children,u[0])>=0)&&obj.tbody.insertBefore(f,u[0]),c.push(obj.records[d]),b.push(obj.options.data[d]),p.push(f)}Array.prototype.push.apply(obj.records,i),Array.prototype.push.apply(obj.options.data,a),Array.prototype.push.apply(obj.rows,u),obj.options.pagination>0&&obj.page(obj.pageNumber),obj.setHistory({action:"insertRow",rowNumber:t,numOfRows:n,insertBefore:r,rowRecords:c,rowData:b,rowNode:p}),1!=obj.ignoreEvents&&"function"==typeof obj.options.oninsertrow&&obj.options.oninsertrow(el,t,n,c),obj.updateTableReferences()}},obj.deleteRow=function(e,t){if(1==obj.options.allowDeleteRow)if(obj.options.data.length>1){if(null==e){var r=obj.getSelectedRows();r[0]?(e=parseInt(r[0].getAttribute("data-y")),t=r.length):(e=obj.options.data.length-1,t=1)}var o=obj.options.data.length-1;if((null==e||e>o||e<0)&&(e=o),t||(t=1),e+t>=obj.options.data.length&&(t=obj.options.data.length-e),parseInt(e)>-1){var n=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var l=e;l<e+t;l++)obj.isRowMerged(l,!1).length&&(n=!0);if(n){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if(1==obj.options.search){if(obj.results&&obj.results.length!=obj.rows.length){if(!confirm(obj.options.text.thisActionWillClearYourSearchResultsAreYouSure))return!1;obj.resetSearch()}obj.results=null}for(l=e;l<e+t;l++)Array.prototype.indexOf.call(obj.tbody.children,obj.rows[l])>=0&&(obj.rows[l].className="",obj.rows[l].remove());var s=obj.records.splice(e,t),i=obj.options.data.splice(e,t),a=obj.rows.splice(e,t);obj.options.pagination>0&&obj.tbody.children.length!=obj.options.pagination&&obj.page(obj.pageNumber),obj.conditionalSelectionUpdate(1,e,e+t-1),obj.setHistory({action:"deleteRow",rowNumber:e,numOfRows:t,insertBefore:1,rowRecords:s,rowData:i,rowNode:a}),1!=obj.ignoreEvents&&"function"==typeof obj.options.ondeleterow&&obj.options.ondeleterow(el,e,t,s),obj.updateTableReferences()}}else console.error("JEXCEL. It is not possible to delete the last row")},obj.moveColumn=function(e,t){if(Object.keys(obj.options.mergeCells).length>0&&obj.isColMerged(t).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}if((e=parseInt(e))>(t=parseInt(t))){obj.headerContainer.insertBefore(obj.headers[e],obj.headers[t]),obj.colgroupContainer.insertBefore(obj.colgroup[e],obj.colgroup[t]);for(var r=0;r<obj.rows.length;r++)obj.rows[r].insertBefore(obj.records[r][e],obj.records[r][t])}else{obj.headerContainer.insertBefore(obj.headers[e],obj.headers[t].nextSibling),obj.colgroupContainer.insertBefore(obj.colgroup[e],obj.colgroup[t].nextSibling);for(r=0;r<obj.rows.length;r++)obj.rows[r].insertBefore(obj.records[r][e],obj.records[r][t].nextSibling)}obj.options.columns.splice(t,0,obj.options.columns.splice(e,1)[0]),obj.headers.splice(t,0,obj.headers.splice(e,1)[0]),obj.colgroup.splice(t,0,obj.colgroup.splice(e,1)[0]);for(r=0;r<obj.rows.length;r++)obj.options.data[r].splice(t,0,obj.options.data[r].splice(e,1)[0]),obj.records[r].splice(t,0,obj.records[r].splice(e,1)[0]);obj.setHistory({action:"moveColumn",oldValue:e,newValue:t}),1!=obj.ignoreEvents&&"function"==typeof obj.options.onmovecolumn&&obj.options.onmovecolumn(el,e,t),obj.updateTableReferences()},obj.insertColumn=function(e,t,r,o){if(1==obj.options.allowInsertColumn){var n=[];if(e>0)var l=e;else{l=1;e&&(n=e)}r=!!r;var s=obj.options.columns.length-1;if((null==t||t>=parseInt(s)||t<0)&&(t=s),Object.keys(obj.options.mergeCells).length>0&&obj.isColMerged(t,r).length){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}o||(o=[]),o.columns||(o.columns=[]);for(var i=0;i<l;i++)o.columns[i]||(o.columns[i]={type:"text",source:[],options:[],width:"50",align:"center"});var a=r?t:t+1;obj.options.columns=obj.options.columns.injectArray(a,o.columns);for(var u=obj.headers.splice(a),c=obj.colgroup.splice(a),b=[],p=[],d=[],j=[],f=a;f<l+a;f++)obj.createCellHeader(f),obj.headerContainer.insertBefore(obj.headers[f],obj.headerContainer.children[f+1]),obj.colgroupContainer.insertBefore(obj.colgroup[f],obj.colgroupContainer.children[f+1]),b.push(obj.headers[f]),p.push(obj.colgroup[f]);for(var h=0;h<obj.options.data.length;h++){var g=obj.options.data[h].splice(a),m=obj.records[h].splice(a);j[h]=[],d[h]=[];for(f=a;f<l+a;f++){var v=n[h]?n[h]:"";obj.options.data[h][f]=v;var x=obj.createCell(f,h,obj.options.data[h][f]);obj.records[h][f]=x,obj.rows[h]&&obj.rows[h].insertBefore(x,obj.rows[h].children[f+1]),j[h].push(v),d[h].push(x)}Array.prototype.push.apply(obj.options.data[h],g),Array.prototype.push.apply(obj.records[h],m)}if(Array.prototype.push.apply(obj.headers,u),Array.prototype.push.apply(obj.colgroup,c),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var y=0;y<obj.options.nestedHeaders.length;y++){var C=parseInt(obj.options.nestedHeaders[y][obj.options.nestedHeaders[y].length-1].colspan)+l;obj.options.nestedHeaders[y][obj.options.nestedHeaders[y].length-1].colspan=C,obj.thead.children[y].children[obj.thead.children[y].children.length-1].setAttribute("colspan",C)}else{C=parseInt(obj.options.nestedHeaders[0].colspan)+l;obj.options.nestedHeaders[0].colspan=C,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",C)}obj.setHistory({action:"insertColumn",columnNumber:t,numOfColumns:l,insertBefore:r,columns:o.columns,headers:b,colgroup:p,records:d,data:j}),1!=obj.ignoreEvents&&"function"==typeof obj.options.oninsertcolumn&&obj.options.oninsertcolumn(el,t,l),obj.updateTableReferences()}},obj.deleteColumn=function(e,t){if(1==obj.options.allowDeleteColumn)if(obj.headers.length>1){if(null==e){var r=obj.getSelectedColumns(!0);r.length?(e=parseInt(r[0]),t=parseInt(r.length)):(e=obj.headers.length-1,t=1)}var o=obj.options.data[0].length-1;if((null==e||e>o||e<0)&&(e=o),t||(t=1),t>obj.options.data[0].length-e&&(t=obj.options.data[0].length-e),parseInt(e)>-1){var n=!1;if(Object.keys(obj.options.mergeCells).length>0)for(var l=e;l<e+t;l++)obj.isColMerged(l,!1).length&&(n=!0);if(n){if(!confirm(obj.options.text.thisActionWillDestroyAnyExistingMergedCellsAreYouSure))return!1;obj.destroyMerged()}var s=obj.options.columns.splice(e,t);for(l=e;l<e+t;l++)obj.colgroup[l].className="",obj.headers[l].className="",obj.colgroup[l].remove(),obj.headers[l].remove();for(var i=obj.headers.splice(e,t),a=obj.colgroup.splice(e,t),u=[],c=[],b=0;b<obj.options.data.length;b++)for(l=e;l<e+t;l++)obj.records[b][l].className="",obj.records[b][l].remove();for(b=0;b<obj.options.data.length;b++)c[b]=obj.options.data[b].splice(e,t),u[b]=obj.records[b].splice(e,t);if(obj.conditionalSelectionUpdate(0,e,e+t-1),obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(var p=0;p<obj.options.nestedHeaders.length;p++){var d=parseInt(obj.options.nestedHeaders[p][obj.options.nestedHeaders[p].length-1].colspan)-t;obj.options.nestedHeaders[p][obj.options.nestedHeaders[p].length-1].colspan=d,obj.thead.children[p].children[obj.thead.children[p].children.length-1].setAttribute("colspan",d)}else{d=parseInt(obj.options.nestedHeaders[0].colspan)-t;obj.options.nestedHeaders[0].colspan=d,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",d)}obj.setHistory({action:"deleteColumn",columnNumber:e,numOfColumns:t,insertBefore:1,columns:s,headers:i,colgroup:a,records:u,data:c}),1!=obj.ignoreEvents&&"function"==typeof obj.options.ondeletecolumn&&obj.options.ondeletecolumn(el,e,t,records),obj.updateTableReferences()}}else console.error("JEXCEL. It is not possible to delete the last column")},obj.getSelectedRows=function(e){for(var t=[],r=0;r<obj.rows.length;r++)obj.rows[r].classList.contains("selected")&&(e?t.push(r):t.push(obj.rows[r]));return t},obj.getSelectedColumns=function(){for(var e=[],t=0;t<obj.headers.length;t++)obj.headers[t].classList.contains("selected")&&e.push(t);return e},obj.updateTableReferences=function(){for(var e=0;e<obj.headers.length;e++){(l=obj.headers[e].getAttribute("data-x"))!=e&&(obj.headers[e].setAttribute("data-x",e),obj.headers[e].getAttribute("title")||(obj.headers[e].innerHTML=jexcel.getColumnName(e)))}for(var t=0;t<obj.rows.length;t++){(s=obj.rows[t].getAttribute("data-y"))!=t&&(obj.rows[t].setAttribute("data-y",t),obj.rows[t].children[0].setAttribute("data-y",t),obj.rows[t].children[0].innerHTML=t+1)}var r=[],o=[],n=function(e,t,o,n){if(e!=o&&obj.records[n][o].setAttribute("data-x",o),t!=n&&obj.records[n][o].setAttribute("data-y",n),e!=o||t!=n){var l=jexcel.getColumnNameFromId([e,t]),s=jexcel.getColumnNameFromId([o,n]);r[l]=s}};for(t=0;t<obj.records.length;t++)for(e=0;e<obj.records[0].length;e++){var l=obj.records[t][e].getAttribute("data-x"),s=obj.records[t][e].getAttribute("data-y");if(obj.records[t][e].getAttribute("data-merged")){var i=jexcel.getColumnNameFromId([l,s]),a=jexcel.getColumnNameFromId([e,t]);if(null==o[i])if(i==a)o[i]=!1;else{var u=parseInt(e-l),c=parseInt(t-s);o[i]=[a,u,c]}}else n(l,s,e,t)}var b=Object.keys(o);if(b.length)for(e=0;e<b.length;e++)if(o[b[e]]){var p=jexcel.getIdFromColumnName(b[e],!0);n(l=p[0],s=p[1],l+o[b[e]][1],s+o[b[e]][2]);for(i=b[e],a=o[b[e]][0],t=0;t<obj.options.mergeCells[i][2].length;t++){l=parseInt(obj.options.mergeCells[i][2][t].getAttribute("data-x")),s=parseInt(obj.options.mergeCells[i][2][t].getAttribute("data-y"));obj.options.mergeCells[i][2][t].setAttribute("data-x",l+o[b[e]][1]),obj.options.mergeCells[i][2][t].setAttribute("data-y",s+o[b[e]][2])}obj.options.mergeCells[a]=obj.options.mergeCells[i],delete obj.options.mergeCells[i]}obj.updateFormulas(r),obj.refreshSelection(),obj.updateTable()},obj.updateTable=function(){if(obj.options.minSpareRows>0){for(var e=0,t=obj.rows.length-1;t>=0;t--){for(var r=!1,o=0;o<obj.headers.length;o++)obj.options.data[t][o]&&(r=!0);if(r)break;e++}obj.options.minSpareRows-e>0&&obj.insertRow(obj.options.minSpareRows-e)}if(obj.options.minSpareCols>0){var n=0;for(o=obj.headers.length-1;o>=0;o--){for(r=!1,t=0;t<obj.rows.length;t++)obj.options.data[t][o]&&(r=!0);if(r)break;n++}obj.options.minSpareCols-n>0&&obj.insertColumn(obj.options.minSpareCols-n)}if("function"==typeof obj.options.updateTable)for(t=0;t<obj.rows.length;t++)for(o=0;o<obj.headers.length;o++)obj.options.updateTable(el,obj.records[t][o],o,t,obj.options.data[t][o],obj.records[t][o].innerText,jexcel.getColumnNameFromId([o,t]));setTimeout(function(){obj.updateCornerPosition()},0)},obj.showIndex=function(){obj.colgroupContainer.children[0].width=40},obj.hideIndex=function(){obj.colgroupContainer.children[0].width=0},obj.updateFormulaChain=function(e,t,r){var o=jexcel.getColumnNameFromId([e,t]);if(obj.formula[o]&&obj.formula[o].length>0)for(var n=0;n<obj.formula[o].length;n++){var l=jexcel.getIdFromColumnName(obj.formula[o][n],!0),s=""+obj.options.data[l[1]][l[0]];"="==s.substr(0,1)?r.push(obj.updateCell(l[0],l[1],s,!0)):Object.keys(obj.formula)[n]=null,obj.updateFormulaChain(l[0],l[1],r)}},obj.updateFormulas=function(e){for(var t=0;t<obj.options.data.length;t++)for(var r=0;r<obj.options.data[0].length;r++){if("="==(i=""+obj.options.data[t][r]).substr(0,1)){var o=obj.updateFormula(i,e);o!=i&&(obj.options.data[t][r]=o)}}var n=[],l=Object.keys(obj.formula);for(t=0;t<l.length;t++){var s=l[t],i=obj.formula[s];e[s]&&(s=e[s]),n[s]=[];for(r=0;r<i.length;r++){var a=i[r];e[a]&&(a=e[a]),n[s].push(a)}}obj.formula=n},obj.updateFormula=function(e,t){for(var r=/[A-Z]/,o=/[0-9]/,n="",l=null,s=null,i="",a=0;a<e.length;a++)r.exec(e[a])?(l=1,s=0,i+=e[a]):o.exec(e[a])?(s=l?1:0,i+=e[a]):(l&&s&&(i=t[i]?t[i]:i),n+=i,n+=e[a],l=0,s=0,i="");return i&&(l&&s&&(i=t[i]?t[i]:i),n+=i),n},obj.executeFormula=function(expression,x,y){if(obj.formulaStack++,obj.formulaStack>5)return console.error("Too many executions..."),0;var parentId=jexcel.getColumnNameFromId([x,y]),tokensUpdate=function(e){for(var t=0;t<e.length;t++){var r=[],o=e[t].split(":"),n=jexcel.getIdFromColumnName(o[0],!0),l=jexcel.getIdFromColumnName(o[1],!0);if(n[0]<=l[0])var s=n[0],i=l[0];else s=l[0],i=n[0];if(n[1]<=l[1])var a=n[1],u=l[1];else a=l[1],u=n[1];for(var c=a;c<=u;c++)for(var b=s;b<=i;b++)r.push(jexcel.getColumnNameFromId([b,c]));expression=expression.replace(e[t],r.join(","))}},tokens=expression.match(/([A-Z]+[0-9]+)\:([A-Z]+[0-9]+)/g);tokens&&tokens.length&&tokensUpdate(tokens);var tokens=expression.match(/([A-Z]+[0-9]+)/g);if(tokens)for(var evalstring="",i=0;i<tokens.length;i++)if(obj.formula[tokens[i]]||(obj.formula[tokens[i]]=[]),obj.formula[tokens[i]].indexOf(parentId)<0&&obj.formula[tokens[i]].push(parentId),eval("typeof("+tokens[i]+') == "undefined"')){evalstring+="var "+tokens[i]+" = null;";var position=jexcel.getIdFromColumnName(tokens[i],1);if(obj.records[position[1]]&&obj.records[position[1]][position[0]])var value=obj.records[position[1]][position[0]].innerHTML;else if(obj.options.data[position[1]]&&obj.options.data[position[1]][position[0]])var value=obj.options.data[position[1]][position[0]];else var value="";if("="==(""+value).substr(0,1)&&(value=obj.executeFormula(value,position[0],position[1])),""==(""+value).trim()||value!=Number(value)){var number=""+value,decimal=obj.options.columns[position[0]].decimal||".";number=number.split(decimal),number[0]=number[0].match(/[0-9]*/g).join(""),number[1]&&(number[1]=number[1].match(/[0-9]*/g).join("")),""!=number[0]&&Number(number[0])>=0?number[1]?evalstring+="var "+tokens[i]+" = "+number[0]+"."+number[1]+";":evalstring+="var "+tokens[i]+" = "+number[0]+".00;":evalstring+="var "+tokens[i]+" = '"+value+"';"}else evalstring+="var "+tokens[i]+" = "+value+";"}obj.formulaStack=0;try{var res=eval(evalstring+expression.substr(1))}catch(e){var res="#ERROR"}return res},obj.row=function(e){},obj.col=function(e){},obj.up=function(e,t){if(e?obj.selectedCell[3]>0&&obj.up.visible(1,t?0:1):(obj.selectedCell[1]>0&&obj.up.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),1==obj.options.lazyLoading)if(0==obj.selectedCell[1]||0==obj.selectedCell[3])obj.loadPage(0),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else if(obj.loadValidation())obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]);else{var r=parseInt(obj.tbody.firstChild.getAttribute("data-y"));obj.selectedCell[1]-r<30&&(obj.loadUp(),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]))}else if(obj.options.pagination>0){var o=obj.whichPage(obj.selectedCell[3]);o!=obj.pageNumber&&obj.page(o)}obj.updateScroll(1)},obj.up.visible=function(e,t){if(0==e)var r=parseInt(obj.selectedCell[0]),o=parseInt(obj.selectedCell[1]);else r=parseInt(obj.selectedCell[2]),o=parseInt(obj.selectedCell[3]);if(0==t){for(var n=0;n<o;n++)if("none"!=obj.records[n][r].style.display&&"none"!=obj.rows[n].style.display){o=n;break}}else o=obj.up.get(r,o);0==e?(obj.selectedCell[0]=r,obj.selectedCell[1]=o):(obj.selectedCell[2]=r,obj.selectedCell[3]=o)},obj.up.get=function(e,t){e=parseInt(e);for(var r=(t=parseInt(t))-1;r>=0;r--)if("none"!=obj.records[r][e].style.display&&"none"!=obj.rows[r].style.display){if(obj.records[r][e].getAttribute("data-merged")&&obj.records[r][e]==obj.records[t][e])continue;t=r;break}return t},obj.down=function(e,t){if(e?obj.selectedCell[3]<obj.records.length-1&&obj.down.visible(1,t?0:1):(obj.selectedCell[1]<obj.records.length-1&&obj.down.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),1==obj.options.lazyLoading)obj.selectedCell[1]==obj.records.length-1||obj.selectedCell[3]==obj.records.length-1?(obj.loadPage(-1),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])):obj.loadValidation()?obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]):parseInt(obj.tbody.lastChild.getAttribute("data-y"))-obj.selectedCell[3]<30&&(obj.loadDown(),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]));else if(obj.options.pagination>0){var r=obj.whichPage(obj.selectedCell[3]);r!=obj.pageNumber&&obj.page(r)}obj.updateScroll(3)},obj.down.visible=function(e,t){if(0==e)var r=parseInt(obj.selectedCell[0]),o=parseInt(obj.selectedCell[1]);else r=parseInt(obj.selectedCell[2]),o=parseInt(obj.selectedCell[3]);if(0==t){for(var n=obj.rows.length-1;n>o;n--)if("none"!=obj.records[n][r].style.display&&"none"!=obj.rows[n].style.display){o=n;break}}else o=obj.down.get(r,o);0==e?(obj.selectedCell[0]=r,obj.selectedCell[1]=o):(obj.selectedCell[2]=r,obj.selectedCell[3]=o)},obj.down.get=function(e,t){e=parseInt(e);for(var r=(t=parseInt(t))+1;r<obj.rows.length;r++)if("none"!=obj.records[r][e].style.display&&"none"!=obj.rows[r].style.display){if(obj.records[r][e].getAttribute("data-merged")&&obj.records[r][e]==obj.records[t][e])continue;t=r;break}return t},obj.right=function(e,t){e?obj.selectedCell[2]<obj.headers.length-1&&obj.right.visible(1,t?0:1):(obj.selectedCell[0]<obj.headers.length-1&&obj.right.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(2)},obj.right.visible=function(e,t){if(0==e)var r=parseInt(obj.selectedCell[0]),o=parseInt(obj.selectedCell[1]);else r=parseInt(obj.selectedCell[2]),o=parseInt(obj.selectedCell[3]);if(0==t){for(var n=obj.headers.length-1;n>r;n--)if("none"!=obj.records[o][n].style.display){r=n;break}}else r=obj.right.get(r,o);0==e?(obj.selectedCell[0]=r,obj.selectedCell[1]=o):(obj.selectedCell[2]=r,obj.selectedCell[3]=o)},obj.right.get=function(e,t){e=parseInt(e),t=parseInt(t);for(var r=e+1;r<obj.headers.length;r++)if("none"!=obj.records[t][r].style.display){if(obj.records[t][r].getAttribute("data-merged")&&obj.records[t][r]==obj.records[t][e])continue;e=r;break}return e},obj.left=function(e,t){e?obj.selectedCell[2]>0&&obj.left.visible(1,t?0:1):(obj.selectedCell[0]>0&&obj.left.visible(0,t?0:1),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(0)},obj.left.visible=function(e,t){if(0==e)var r=parseInt(obj.selectedCell[0]),o=parseInt(obj.selectedCell[1]);else r=parseInt(obj.selectedCell[2]),o=parseInt(obj.selectedCell[3]);if(0==t){for(var n=0;n<r;n++)if("none"!=obj.records[o][n].style.display){r=n;break}}else r=obj.left.get(r,o);0==e?(obj.selectedCell[0]=r,obj.selectedCell[1]=o):(obj.selectedCell[2]=r,obj.selectedCell[3]=o)},obj.left.get=function(e,t){e=parseInt(e),t=parseInt(t);for(var r=e-1;r>=0;r--)if("none"!=obj.records[t][r].style.display){if(obj.records[t][r].getAttribute("data-merged")&&obj.records[t][r]==obj.records[t][e])continue;e=r;break}return e},obj.first=function(e,t){if(e?t?obj.selectedCell[3]=0:obj.left.visible(1,0):(t?obj.selectedCell[1]=0:obj.left.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),1!=obj.options.lazyLoading||0!=obj.selectedCell[1]&&0!=obj.selectedCell[3]){if(obj.options.pagination>0){var r=obj.whichPage(obj.selectedCell[3]);r!=obj.pageNumber&&obj.page(r)}}else obj.loadPage(0);obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(1)},obj.last=function(e,t){if(e?t?obj.selectedCell[3]=obj.records.length-1:obj.right.visible(1,0):(t?obj.selectedCell[1]=obj.records.length-1:obj.right.visible(0,0),obj.selectedCell[2]=obj.selectedCell[0],obj.selectedCell[3]=obj.selectedCell[1]),1!=obj.options.lazyLoading||obj.selectedCell[1]!=obj.records.length-1&&obj.selectedCell[3]!=obj.records.length-1){if(obj.options.pagination>0){var r=obj.whichPage(obj.selectedCell[3]);r!=obj.pageNumber&&obj.page(r)}}else obj.loadPage(-1);obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3]),obj.updateScroll(3)},obj.selectAll=function(){obj.selectedCell||(obj.selectedCell=[]),obj.selectedCell[0]=0,obj.selectedCell[1]=0,obj.selectedCell[2]=obj.headers.length-1,obj.selectedCell[3]=obj.records.length-1,obj.updateSelectionFromCoords(obj.selectedCell[0],obj.selectedCell[1],obj.selectedCell[2],obj.selectedCell[3])},obj.loadPage=function(e){if(1==obj.options.search&&obj.results)var t=obj.results;else t=obj.rows;null!=e&&-1!=e||(e=Math.ceil(t.length/100));var r=100*e,o=100*e+100;o>t.length&&(o=t.length),(r=o-100)<0&&(r=0);for(var n=r;n<o;n++)1==obj.options.search&&obj.results?obj.tbody.appendChild(obj.rows[t[n]]):obj.tbody.appendChild(obj.rows[n]),obj.tbody.children.length>100&&obj.tbody.removeChild(obj.tbody.firstChild)},obj.loadUp=function(){if(1==obj.options.search&&obj.results)var e=obj.results;else e=obj.rows;var t=0;if(e.length>100){var r=parseInt(obj.tbody.firstChild.getAttribute("data-y"));if(1==obj.options.search&&obj.results&&(r=e.indexOf(r)),r>0)for(var o=0;o<30;o++)(r-=1)>-1&&(1==obj.options.search&&obj.results?obj.tbody.insertBefore(obj.rows[e[r]],obj.tbody.firstChild):obj.tbody.insertBefore(obj.rows[r],obj.tbody.firstChild),obj.tbody.children.length>100&&(obj.tbody.removeChild(obj.tbody.lastChild),t=1))}return t},obj.loadDown=function(){if(1==obj.options.search&&obj.results)var e=obj.results;else e=obj.rows;var t=0;if(e.length>100){var r=parseInt(obj.tbody.lastChild.getAttribute("data-y"));if(1==obj.options.search&&obj.results&&(r=e.indexOf(r)),r<obj.rows.length-1)for(var o=0;o<=30;o++)r<e.length&&(1==obj.options.search&&obj.results?obj.tbody.appendChild(obj.rows[e[r]]):obj.tbody.appendChild(obj.rows[r]),obj.tbody.children.length>100&&(obj.tbody.removeChild(obj.tbody.firstChild),t=1)),r+=1}return t},obj.loadValidation=function(){if(obj.selectedCell){var e=parseInt(obj.tbody.firstChild.getAttribute("data-y"))/100,t=parseInt(obj.selectedCell[3]/100),r=parseInt(obj.rows.length/100);if(e!=t&&t<=r&&!Array.prototype.indexOf.call(obj.tbody.children,obj.rows[obj.selectedCell[3]]))return obj.loadPage(t),!0}return!1},obj.resetSearch=function(){obj.searchInput.value="",obj.search(""),obj.results=null},obj.search=function(e){if(e)e=e.toLowerCase();if(obj.resetSelection(),obj.pageNumber=0,obj.results=[],e){var t=function(e){-1==obj.results.indexOf(e)&&obj.results.push(e)};obj.options.data.filter(function(r,o){if(function(e,t){for(var r=0;r<e.length;r++)if((""+e[r]).toLowerCase().search(t)>=0)return!0;return!1}(r,e)){var n=obj.isRowMerged(o);if(n.length)for(var l=0;l<n.length;l++)for(var s=jexcel.getIdFromColumnName(n[l],!0),i=0;i<obj.options.mergeCells[n[l]][1];i++)t(s[1]+i);else t(o);return!0}return!1})}else obj.results=null;var r=0,o=0;r=1==obj.options.lazyLoading?100:obj.options.pagination>0?obj.options.pagination:obj.results?obj.results.length:obj.rows.length,obj.tbody.innerHTML="";for(var n=0;n<obj.rows.length;n++)!obj.results||obj.results.indexOf(n)>-1?(o<r&&(obj.tbody.appendChild(obj.rows[n]),o++),obj.rows[n].style.display=""):obj.rows[n].style.display="none";return obj.options.pagination>0&&obj.updatePagination(),r},obj.whichPage=function(e){return Math.ceil((parseInt(e)+1)/parseInt(obj.options.pagination))-1},obj.page=function(e){if(1==obj.options.search&&obj.results)var t=obj.results;else t=obj.rows;var r=parseInt(obj.options.pagination);null!=e&&-1!=e||(e=Math.ceil(t.length/r)),obj.pageNumber=e;var o=e*r,n=e*r+r;n>t.length&&(n=t.length),o<0&&(o=0),obj.tbody.innerHTML="";for(var l=o;l<n;l++)1==obj.options.search&&obj.results?obj.tbody.appendChild(obj.rows[t[l]]):obj.tbody.appendChild(obj.rows[l]);obj.options.pagination>0&&obj.updatePagination(),obj.updateCornerPosition()},obj.updatePagination=function(){if(obj.pagination.children[0].innerHTML="",obj.pagination.children[1].innerHTML="",obj.options.pagination){if(1==obj.options.search&&obj.results)var e=obj.results.length;else e=obj.rows.length;if(e){var t=Math.ceil(e/obj.options.pagination);if(obj.pageNumber<6)var r=1,o=t<10?t:10;else if(t-obj.pageNumber<5)r=t-9,o=t;else r=obj.pageNumber-4,o=obj.pageNumber+5;if(r>1)(l=document.createElement("div")).className="jexcel_page",l.innerHTML="<",l.title=1,obj.pagination.children[1].appendChild(l);for(var n=r;n<=o;n++){var l;(l=document.createElement("div")).className="jexcel_page",l.innerHTML=n,obj.pagination.children[1].appendChild(l),obj.pageNumber==n-1&&l.classList.add("jexcel_page_selected")}if(o<t)(l=document.createElement("div")).className="jexcel_page",l.innerHTML=">",l.title=t,obj.pagination.children[1].appendChild(l);obj.pagination.children[0].innerHTML=function(e){var t=Array.prototype.slice.call(arguments,1);return e.replace(/{(\d+)}/g,function(e,r){return void 0!==t[r]?t[r]:e})}(obj.options.text.showingPage,obj.pageNumber+1,t)}else obj.pagination.children[0].innerHTML=obj.options.text.noRecordsFound}},obj.download=function(){if(0==obj.options.allowExport)console.error("Export not allowed");else{var e="";e+=obj.copy(!1,",",!0);var t=document.createElement("a"),r=new Blob([e],{type:"text/csv;charset=utf-8;"}),o=URL.createObjectURL(r);t.href=o,t.setAttribute("download",obj.options.csvFileName+".csv"),document.body.appendChild(t),t.click(),t.remove()}},obj.setHistory=function(e){if(1!=obj.ignoreHistory){var t=++obj.historyIndex;obj.history=obj.history=obj.history.slice(0,t+1),obj.history[t]=e}},obj.copy=function(e,t,r){t||(t="\t");var o=[],n=[],l=[],s=[],i=obj.options.data[0].length,a=obj.options.data.length,u="";obj.style=[];for(var c=0;c<a;c++){o=[],n=[];for(var b=0;b<i;b++)if(!e||obj.records[c][b].classList.contains("highlight")){var p=obj.options.data[c][b];p.match&&(p.match(/,/g)||p.match(/\n/)||p.match(/\"/))&&(p='"'+(p=p.replace(new RegExp('"',"g"),'""'))+'"'),o.push(p);var d=obj.records[c][b].innerHTML;d.match&&(d.match(/,/g)||d.match(/\n/)||d.match(/\"/))&&(d='"'+(d=d.replace(new RegExp('"',"g"),'""'))+'"'),n.push(d),u=obj.records[c][b].getAttribute("style"),obj.style.push(u||"")}o.length&&l.push(o.join(t)),n.length&&s.push(n.join(t))}var j=l.join("\n"),f=s.join("\n");return r||(1==obj.options.copyCompatibility?obj.textarea.value=f:obj.textarea.value=j,obj.textarea.select(),jexcel.copyControls.enabled=!1,document.execCommand("copy"),jexcel.copyControls.enabled=!0),obj.data=j,obj.hashString=obj.hash(obj.textarea.value),j},obj.paste=function(e,t,r){if("function"==typeof obj.options.onbeforepaste)r=obj.options.onbeforepaste(r);var o=obj.hash(r),n=o==obj.hashString?obj.style:null;if(1==obj.options.copyCompatibility&&o==obj.hashString)r=obj.data;r=obj.parseCSV(r,"\t");if(null!=e&&null!=t&&r){for(var l=0,s=0,i=[],a={},u={},c=0,b=parseInt(e),p=parseInt(t),d=null;d=r[s];){l=0;for(b=parseInt(e);null!=d[l];){var j=obj.updateCell(b,p,d[l]);if(i.push(j),n){var f=jexcel.getColumnNameFromId([b,p]);a[f]=n[c],u[f]=obj.getStyle(f),obj.records[p][b].style=n[c],c++}null!=d[++l]&&(b>=obj.headers.length-1&&obj.insertColumn(),b=obj.right.get(b,p))}if(r[++s]){p>=obj.rows.length-1&&obj.insertRow();p=obj.down.get(e,p)}}obj.updateSelectionFromCoords(e,t,b,p),obj.setHistory({action:"setValue",records:i,selection:obj.selectedCell,newStyle:a,oldStyle:u}),"function"==typeof obj.options.onpaste&&obj.options.onpaste(el,i),obj.updateTable()}},obj.historyProcessRow=function(e,t){var r=t.insertBefore?t.rowNumber:t.rowNumber+1;if(1==obj.options.search&&obj.results&&obj.results.length!=obj.rows.length&&obj.resetSearch(),1==e){for(var o=t.numOfRows,n=r;n<o+r;n++)obj.rows[n].remove();obj.records.splice(r,o),obj.options.data.splice(r,o),obj.rows.splice(r,o),obj.conditionalSelectionUpdate(1,r,o+r-1)}else{obj.records=obj.records.injectArray(r,t.rowRecords),obj.options.data=obj.options.data.injectArray(r,t.rowData),obj.rows=obj.rows.injectArray(r,t.rowNode);var l=0;for(n=r;n<t.numOfRows+r;n++)obj.tbody.insertBefore(t.rowNode[l],obj.tbody.children[n]),l++}obj.options.pagination>0&&obj.page(obj.pageNumber),obj.updateTableReferences()},obj.historyProcessColumn=function(e,t){var r=t.insertBefore?t.columnNumber:t.columnNumber+1;if(1==e){var o=t.numOfColumns;obj.options.columns.splice(r,o);for(var n=r;n<o+r;n++)obj.headers[n].remove(),obj.colgroup[n].remove();obj.headers.splice(r,o),obj.colgroup.splice(r,o);for(var l=0;l<t.data.length;l++){for(n=r;n<o+r;n++)obj.records[l][n].remove();obj.records[l].splice(r,o),obj.options.data[l].splice(r,o)}obj.conditionalSelectionUpdate(0,r,o+r-1)}else{obj.options.columns=obj.options.columns.injectArray(r,t.columns),obj.headers=obj.headers.injectArray(r,t.headers),obj.colgroup=obj.colgroup.injectArray(r,t.colgroup);var s=0;for(n=r;n<t.numOfColumns+r;n++)obj.headerContainer.insertBefore(t.headers[s],obj.headerContainer.children[n+1]),obj.colgroupContainer.insertBefore(t.colgroup[s],obj.colgroupContainer.children[n+1]),s++;for(l=0;l<t.data.length;l++){obj.options.data[l]=obj.options.data[l].injectArray(r,t.data[l]),obj.records[l]=obj.records[l].injectArray(r,t.records[l]);for(s=0,n=r;n<t.numOfColumns+r;n++)obj.rows[l].insertBefore(t.records[l][s],obj.rows[l].children[n+1]),s++}}if(obj.options.nestedHeaders&&obj.options.nestedHeaders.length>0)if(obj.options.nestedHeaders[0]&&obj.options.nestedHeaders[0][0])for(l=0;l<obj.options.nestedHeaders.length;l++){if(1==e)var i=parseInt(obj.options.nestedHeaders[l][obj.options.nestedHeaders[l].length-1].colspan)-t.numOfColumns;else i=parseInt(obj.options.nestedHeaders[l][obj.options.nestedHeaders[l].length-1].colspan)+t.numOfColumns;obj.options.nestedHeaders[l][obj.options.nestedHeaders[l].length-1].colspan=i,obj.thead.children[l].children[obj.thead.children[l].children.length-1].setAttribute("colspan",i)}else{if(1==e)i=parseInt(obj.options.nestedHeaders[0].colspan)-t.numOfColumns;else i=parseInt(obj.options.nestedHeaders[0].colspan)+t.numOfColumns;obj.options.nestedHeaders[0].colspan=i,obj.thead.children[0].children[obj.thead.children[0].children.length-1].setAttribute("colspan",i)}obj.updateTableReferences()},obj.undo=function(){var e=!!obj.ignoreEvents,t=!!obj.ignoreHistory;obj.ignoreEvents=!0,obj.ignoreHistory=!0;var r=[];if(obj.historyIndex>=0){var o=obj.history[obj.historyIndex--];if("insertRow"==o.action)obj.historyProcessRow(1,o);else if("deleteRow"==o.action)obj.historyProcessRow(0,o);else if("insertColumn"==o.action)obj.historyProcessColumn(1,o);else if("deleteColumn"==o.action)obj.historyProcessColumn(0,o);else if("moveRow"==o.action)obj.moveRow(o.newValue,o.oldValue);else if("moveColumn"==o.action)obj.moveColumn(o.newValue,o.oldValue);else if("setMerge"==o.action)obj.removeMerge(o.column,o.data);else if("setStyle"==o.action)obj.setStyle(o.oldValue,null,null,1);else if("setWidth"==o.action)obj.setWidth(o.column,o.oldValue);else if("setHeight"==o.action)obj.setHeight(o.row,o.oldValue);else if("setHeader"==o.action)obj.setHeader(o.column,o.oldValue);else if("setComments"==o.action)obj.setComments(o.column,o.oldValue[0],o.oldValue[1]);else if("orderBy"==o.action){for(var n=[],l=0;l<o.rows.length;l++)n[o.rows[l]]=l;obj.updateOrderArrow(o.column,o.order?0:1),obj.updateOrder(n)}else if("setValue"==o.action){for(var s=0;s<o.records.length;s++)obj.updateCell(o.records[s].col,o.records[s].row,o.records[s].oldValue),obj.updateFormulaChain(o.records[s].col,o.records[s].row,r),o.oldStyle&&obj.resetStyle(o.oldStyle,!0);o.selection||(o.selection=[o.records[0].col,o.records[0].row]),obj.updateSelectionFromCoords(o.selection[0],o.selection[1],o.selection[2],o.selection[3]),obj.updateTable()}}obj.ignoreEvents=e,obj.ignoreHistory=t},obj.redo=function(){var e=!!obj.ignoreEvents,t=!!obj.ignoreHistory;obj.ignoreEvents=!0,obj.ignoreHistory=!0;var r=[];if(obj.historyIndex<obj.history.length-1){var o=obj.history[++obj.historyIndex];if("insertRow"==o.action)obj.historyProcessRow(0,o);else if("deleteRow"==o.action)obj.historyProcessRow(1,o);else if("insertColumn"==o.action)obj.historyProcessColumn(0,o);else if("deleteColumn"==o.action)obj.historyProcessColumn(1,o);else if("moveRow"==o.action)obj.moveRow(o.oldValue,o.newValue);else if("moveColumn"==o.action)obj.moveColumn(o.oldValue,o.newValue);else if("setMerge"==o.action)obj.setMerge(o.column,o.colspan,o.rowspan,1);else if("setStyle"==o.action)obj.setStyle(o.newValue,null,null,1);else if("setWidth"==o.action)obj.setWidth(o.column,o.newValue);else if("setHeight"==o.action)obj.setHeight(o.row,o.newValue);else if("setHeader"==o.action)obj.setHeader(o.column,o.newValue);else if("setComments"==o.action)obj.setComments(o.column,o.newValue[0],o.newValue[1]);else if("orderBy"==o.action)obj.updateOrderArrow(o.column,o.order),obj.updateOrder(o.rows);else if("setValue"==o.action){for(var n=0;n<o.records.length;n++)obj.updateCell(o.records[n].col,o.records[n].row,o.records[n].newValue),obj.updateFormulaChain(o.records[n].col,o.records[n].row,r),o.newStyle&&obj.resetStyle(o.newStyle,!0);o.selection||(o.selection=[o.records[0].col,o.records[0].row]),obj.updateSelectionFromCoords(o.selection[0],o.selection[1],o.selection[2],o.selection[3]),obj.updateTable()}}obj.ignoreEvents=e,obj.ignoreHistory=t},obj.getDropDownValue=function(e,t){var r=[];if(obj.options.columns[e]&&obj.options.columns[e].source){for(var o=[],n=obj.options.columns[e].source,l=0;l<n.length;l++)"object"==typeof n[l]?o[n[l].id]=n[l].name:o[n[l]]=n[l];var s=(""+t).split(";");for(l=0;l<s.length;l++)o[s[l]]&&r.push(o[s[l]])}else console.error("Invalid column");return r.length>0?r.join("; "):""},obj.parseCSV=function(e,t){9==(e=e.replace(/\r?\n$|\r$|\n$/g,"")).charCodeAt(e.length-1)&&(e+="\0"),t=t||",";for(var r=[],o=!1,n=0,l=0,s=0;s<e.length;s++){var i=e[s],a=e[s+1];r[n]=r[n]||[],r[n][l]=r[n][l]||"",'"'==i&&o&&'"'==a?(r[n][l]+=i,++s):'"'!=i?i!=t||o?"\r"!=i||"\n"!=a||o?("\n"!=i||o)&&("\r"!=i||o)?r[n][l]+=i:(++n,l=0):(++n,l=0,++s):++l:o=!o}return r},obj.hash=function(e){for(var t="",r=0;r<e.length;r++)e.charCodeAt(r)>30&&e.charCodeAt(r)<=127&&(t+=e.charAt(r));return t.split("").reduce((e,t)=>(e<<5)-e+t.charCodeAt(0),0)},obj.init=function(){jexcel.current=obj,"function"==typeof jexcel.build&&(jexcel.build(),jexcel.build=null),1==obj.options.loadingSpin&&jSuites.loading.show(),obj.options.csv?fetch(obj.options.csv).then(function(e){e.text().then(function(e){e=obj.parseCSV(e,obj.options.csvDelimiter);if(1==obj.options.csvHeaders&&e.length>0)for(var t=e.shift(),r=0;r<t.length;r++)obj.options.columns[r]||(obj.options.columns[r]={type:"text",align:"center",width:obj.options.defaultColWidth}),void 0===obj.options.columns[r].title&&(obj.options.columns[r].title=t[r]);obj.options.data=e,obj.prepareTable(),1==obj.options.loadingSpin&&jSuites.loading.hide()})}):obj.options.url?fetch(obj.options.url,{headers:new Headers({"content-type":"text/json"})}).then(function(e){e.json().then(function(e){obj.options.data=e.data?e.data:e,obj.prepareTable(),1==obj.options.loadingSpin&&jSuites.loading.hide()})}):obj.prepareTable()},Array.prototype.injectArray=function(e,t){return this.slice(0,e).concat(t).concat(this.slice(e))},options&&null!=options.contextMenu?obj.options.contextMenu=options.contextMenu:obj.options.contextMenu=function(e,t,r,o){var n=[];if(null==r)1==obj.options.allowInsertColumn&&n.push({title:obj.options.text.insertANewColumnBefore,onclick:function(){obj.insertColumn(1,parseInt(t),1)}}),1==obj.options.allowInsertColumn&&n.push({title:obj.options.text.insertANewColumnAfter,onclick:function(){obj.insertColumn(1,parseInt(t),0)}}),1==obj.options.allowDeleteColumn&&n.push({title:obj.options.text.deleteSelectedColumns,onclick:function(){obj.deleteColumn()}}),1==obj.options.allowRenameColumn&&n.push({title:obj.options.text.renameThisColumn,onclick:function(){obj.setHeader(t)}}),n.push({type:"line"}),1==obj.options.allowDeleteColumn&&(n.push({title:obj.options.text.orderAscending,onclick:function(){obj.orderBy(t,0)}}),n.push({title:obj.options.text.orderDescending,onclick:function(){obj.orderBy(t,1)}}));else if(1==obj.options.allowInsertRow&&(n.push({title:obj.options.text.insertANewRowBefore,onclick:function(){obj.insertRow(1,parseInt(r),1)}}),n.push({title:obj.options.text.insertANewRowAfter,onclick:function(){obj.insertRow(1,parseInt(r))}})),1==obj.options.allowDeleteRow&&n.push({title:obj.options.text.deleteSelectedRows,onclick:function(){obj.deleteRow()}}),t&&1==obj.options.allowComments){n.push({type:"line"});var l=obj.records[r][t].getAttribute("title")||"";n.push({title:l?obj.options.text.editComments:obj.options.text.addComments,onclick:function(){obj.setComments([t,r],prompt(obj.options.text.comments,l))}}),l&&n.push({title:obj.options.text.clearComments,onclick:function(){obj.setComments([t,r],"")}})}return n.push({type:"line"}),n.push({title:obj.options.text.copy,shortcut:"Ctrl + C",onclick:function(){obj.copy(!0)}}),navigator&&navigator.clipboard&&n.push({title:obj.options.text.paste,shortcut:"Ctrl + V",onclick:function(){obj.selectedCell&&navigator.clipboard.readText().then(function(e){e&&jexcel.current.paste(obj.selectedCell[0],obj.selectedCell[1],e)})}}),n.push({title:obj.options.text.saveAs,shortcut:"Ctrl + S",onclick:function(){obj.download(!0)}}),obj.options.about&&n.push({title:obj.options.text.about,onclick:function(){alert(obj.options.about)}}),n},obj.scrollControls=function(e){1==obj.options.lazyLoading&&null==jexcel.timeControlLoading&&(jexcel.timeControlLoading=setTimeout(function(){obj.content.scrollTop+obj.content.clientHeight>=obj.content.scrollHeight?obj.loadDown()&&(obj.content.scrollTop+obj.content.clientHeight>obj.content.scrollHeight-10&&(obj.content.scrollTop=obj.content.scrollTop-obj.content.clientHeight),obj.updateCornerPosition()):obj.content.scrollTop<=obj.content.clientHeight&&obj.loadUp()&&(obj.content.scrollTop<10&&(obj.content.scrollTop=obj.content.scrollTop+obj.content.clientHeight),obj.updateCornerPosition()),jexcel.timeControlLoading=null},100)),1!=obj.options.lazyLoading&&1!=obj.options.tableOverflow||obj.edition&&"jdropdown"!=e.target.className.substr(0,9)&&obj.closeEditor(obj.edition[0],!0)},el.addEventListener("scroll",obj.scrollControls),el.addEventListener("mousewheel",obj.scrollControls),obj.init(),el.jexcel=obj,obj};jexcel.current=null,jexcel.timeControl=null,jexcel.timeControlLoading=null,jexcel.destroy=function(e,t){e.jexcel&&(e.jexcel=null,e.innerHTML="",t&&(document.removeEventListener("keydown",jexcel.keyDownControls),document.removeEventListener("mouseup",jexcel.mouseUpControls),document.removeEventListener("mousedown",jexcel.mouseDownControls),document.removeEventListener("mousemove",jexcel.mouseMoveControls),document.removeEventListener("mouseover",jexcel.mouseOverControls),document.removeEventListener("dblclick",jexcel.doubleClickControls),document.removeEventListener("copy",jexcel.copyControls),document.removeEventListener("cut",jexcel.cutControls),document.removeEventListener("paste",jexcel.pasteControls),document.removeEventListener("contextmenu",jexcel.contextMenuControls),document.removeEventListener("touchstart",jexcel.touchStartControls),document.removeEventListener("touchend",jexcel.touchEndControls),document.removeEventListener("touchcancel",jexcel.touchEndControls),jexcel=null))},jexcel.build=function(){document.addEventListener("keydown",jexcel.keyDownControls),document.addEventListener("mouseup",jexcel.mouseUpControls),document.addEventListener("mousedown",jexcel.mouseDownControls),document.addEventListener("mousemove",jexcel.mouseMoveControls),document.addEventListener("mouseover",jexcel.mouseOverControls),document.addEventListener("dblclick",jexcel.doubleClickControls),document.addEventListener("copy",jexcel.copyControls),document.addEventListener("cut",jexcel.cutControls),document.addEventListener("paste",jexcel.pasteControls),document.addEventListener("contextmenu",jexcel.contextMenuControls),document.addEventListener("touchstart",jexcel.touchStartControls),document.addEventListener("touchend",jexcel.touchEndControls),document.addEventListener("touchcancel",jexcel.touchEndControls),document.addEventListener("touchmove",jexcel.touchEndControls)},jexcel.getColumnName=function(e){var t="";return e>701?(t+=String.fromCharCode(64+parseInt(e/676)),t+=String.fromCharCode(64+parseInt(e%676/26))):e>25&&(t+=String.fromCharCode(64+parseInt(e/26))),t+=String.fromCharCode(65+e%26)},jexcel.getIdFromColumnName=function(e,t){var r=/^[a-zA-Z]+/.exec(e);if(r){for(var o=0,n=0;n<r[0].length;n++)o+=parseInt(r[0].charCodeAt(n)-64)*Math.pow(26,r[0].length-1-n);--o<0&&(o=0);var l=parseInt(/[0-9]+$/.exec(e));l>0&&l--,e=1==t?[o,l]:o+"-"+l}return e},jexcel.getColumnNameFromId=function(e){return Array.isArray(e)||(e=e.split("-")),jexcel.getColumnName(parseInt(e[0]))+(parseInt(e[1])+1)},jexcel.getElement=function(e){var t=0,r=0;return function e(o){o.className&&o.classList.contains("jexcel_container")&&(r=o),"THEAD"==o.tagName?t=1:"TBODY"==o.tagName&&(t=2),o.parentNode&&e(o.parentNode)}(e),[r,t]},jexcel.keyDownControls=function(e){if(jexcel.current){if(jexcel.current.edition)if(27==e.which)jexcel.current.edition&&jexcel.current.closeEditor(jexcel.current.edition[0],!1),e.preventDefault();else if(13==e.which)if("calendar"==jexcel.current.options.columns[jexcel.current.edition[2]].type)jexcel.current.editor[0].children[0].calendar.close(1);else if("dropdown"==jexcel.current.options.columns[jexcel.current.edition[2]].type||"autocomplete"==jexcel.current.options.columns[jexcel.current.edition[2]].type);else if((1==jexcel.current.options.wordWrap||1==jexcel.current.options.columns[jexcel.current.edition[2]].wordWrap||jexcel.current.options.data[jexcel.current.edition[3]][jexcel.current.edition[2]].length>200)&&e.altKey){var t=jexcel.current.edition[0].children[0],r=jexcel.current.edition[0].children[0].value,o=t.selectionStart;r=r.slice(0,o)+"\n"+r.slice(o),t.value=r,t.focus(),t.selectionStart=o+1,t.selectionEnd=o+1}else jexcel.current.edition[0].children[0].blur();else 9==e.which&&("calendar"==jexcel.current.options.columns[jexcel.current.edition[2]].type?jexcel.current.edition[0].children[0].calendar.close(1):jexcel.current.edition[0].children[0].blur());if(!jexcel.current.edition&&jexcel.current.selectedCell){if(37==e.which)jexcel.current.left(e.shiftKey,e.ctrlKey),e.preventDefault();else if(39==e.which)jexcel.current.right(e.shiftKey,e.ctrlKey),e.preventDefault();else if(38==e.which)jexcel.current.up(e.shiftKey,e.ctrlKey),e.preventDefault();else if(40==e.which)jexcel.current.down(e.shiftKey,e.ctrlKey),e.preventDefault();else if(36==e.which)jexcel.current.first(e.shiftKey,e.ctrlKey),e.preventDefault();else if(35==e.which)jexcel.current.last(e.shiftKey,e.ctrlKey),e.preventDefault();else if(32==e.which)1==jexcel.current.options.editable&&jexcel.current.setCheckRadioValue(),e.preventDefault();else if(46==e.which)1==jexcel.current.options.editable&&(jexcel.current.selectedRow?1==jexcel.current.options.allowDeleteRow&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedRows)&&jexcel.current.deleteRow():jexcel.current.selectedHeader?1==jexcel.current.options.allowDeleteColumn&&confirm(jexcel.current.options.text.areYouSureToDeleteTheSelectedColumns)&&jexcel.current.deleteColumn():jexcel.current.setValue(jexcel.current.highlighted,""));else if(13==e.which)e.shiftKey?jexcel.current.up():(1==jexcel.current.options.allowInsertRow&&1==jexcel.current.options.allowManualInsertRow&&jexcel.current.selectedCell[1]==jexcel.current.options.data.length-1&&jexcel.current.insertRow(),jexcel.current.down()),e.preventDefault();else if(9==e.which)e.shiftKey?jexcel.current.left():(1==jexcel.current.options.allowInsertColumn&&1==jexcel.current.options.allowManualInsertColumn&&jexcel.current.selectedCell[0]==jexcel.current.options.data[0].length-1&&jexcel.current.insertColumn(),jexcel.current.right()),e.preventDefault();else if(!e.shiftKey)if(e.ctrlKey||e.metaKey)65==e.which?(jexcel.current.selectAll(),e.preventDefault()):83==e.which?(jexcel.current.download(),e.preventDefault()):89==e.which?(jexcel.current.redo(),e.preventDefault()):90==e.which&&(jexcel.current.undo(),e.preventDefault());else if(jexcel.current.selectedCell&&1==jexcel.current.options.editable){var n=jexcel.current.selectedCell[1],l=jexcel.current.selectedCell[0];"readonly"!=jexcel.current.options.columns[l].type&&(32==e.keyCode?"checkbox"==jexcel.current.options.columns[l].type||"radio"==jexcel.current.options.columns[l].type?e.preventDefault():jexcel.current.openEditor(jexcel.current.records[n][l],!0):110==e.keyCode||e.keyCode>=48&&e.keyCode<=57||e.keyCode>=65&&e.keyCode<=90||e.keyCode>=96&&e.keyCode<=105||e.keyCode>=186&&e.keyCode<=190?jexcel.current.openEditor(jexcel.current.records[n][l],!0):113==e.keyCode&&jexcel.current.openEditor(jexcel.current.records[n][l],!1))}}else e.target.classList.contains("jexcel_search")&&(jexcel.timeControl&&clearTimeout(jexcel.timeControl),jexcel.timeControl=setTimeout(function(){jexcel.current.search(e.target.value)},200))}},jexcel.isMouseAction=!1,jexcel.mouseDownControls=function(e){if("buttons"in(e=e||window.event))var t=e.buttons;else t=e.which||e.button;var r=jexcel.getElement(e.target);if(r[0]?jexcel.current!=r[0].jexcel&&(jexcel.current&&jexcel.current.resetSelection(),jexcel.current=r[0].jexcel):jexcel.current&&(jexcel.current.resetSelection(!0),jexcel.current=null),jexcel.current&&1==t){if(e.target.classList.contains("jexcel_selectall"))jexcel.current&&jexcel.current.selectAll();else if(e.target.classList.contains("jexcel_corner"))1==jexcel.current.options.editable&&(jexcel.current.selectedCorner=!0);else{if(1==r[1]){if(d=e.target.getAttribute("data-x")){var o=e.target.getBoundingClientRect();if(1==jexcel.current.options.columnResize&&o.width-e.offsetX<6){jexcel.current.resizing={mousePosition:e.pageX,column:d,width:o.width},jexcel.current.headers[d].classList.add("resizing");for(var n=0;n<jexcel.current.records.length;n++)jexcel.current.records[n][d].classList.add("resizing")}else if(1==jexcel.current.options.columnDrag&&o.height-e.offsetY<6)if(jexcel.current.isColMerged(d).length)console.error("JEXCEL: This column is part of a merged cell.");else{jexcel.current.resetSelection(),jexcel.current.dragging={element:e.target,column:d,destination:d},jexcel.current.headers[d].classList.add("dragging");for(n=0;n<jexcel.current.records.length;n++)jexcel.current.records[n][d].classList.add("dragging")}else{if(jexcel.current.selectedHeader&&(e.shiftKey||e.ctrlKey))var l=jexcel.current.selectedHeader,s=d;else{jexcel.current.selectedHeader==d&&1==jexcel.current.options.allowRenameColumn&&(jexcel.timeControl=setTimeout(function(){jexcel.current.setHeader(d)},800)),jexcel.current.selectedHeader=d;l=d,s=d}jexcel.current.updateSelectionFromCoords(l,0,s,jexcel.current.options.data.length-1)}}else if(e.target.parentNode.classList.contains("jexcel_nested")){var i=e.target.getAttribute("data-column").split(","),a=parseInt(i[0]),u=parseInt(i[i.length-1]);jexcel.current.updateSelectionFromCoords(a,0,u,jexcel.current.options.data.length-1)}}else jexcel.current.selectedHeader=!1;if(2==r[1]){var c=e.target.getAttribute("data-y");if(e.target.classList.contains("jexcel_row")){o=e.target.getBoundingClientRect();if(1==jexcel.current.options.rowResize&&o.height-e.offsetY<6)jexcel.current.resizing={element:e.target.parentNode,mousePosition:e.pageY,row:c,height:o.height},e.target.parentNode.classList.add("resizing");else if(1==jexcel.current.options.rowDrag&&o.width-e.offsetX<6)jexcel.current.isRowMerged(c).length?console.error("JEXCEL: This row is part of a merged cell"):1==jexcel.current.options.search&&jexcel.current.results?console.error("JEXCEL: Please clear your search before perform this action"):(jexcel.current.resetSelection(),jexcel.current.dragging={element:e.target.parentNode,row:c,destination:c},e.target.parentNode.classList.add("dragging"));else{if(jexcel.current.selectedRow&&(e.shiftKey||e.ctrlKey))l=jexcel.current.selectedRow,s=c;else{jexcel.current.selectedRow=c;l=c,s=c}jexcel.current.updateSelectionFromCoords(0,l,jexcel.current.options.data[0].length-1,s)}}else if(e.target.classList.contains("jclose")&&e.target.clientWidth-e.offsetX<50&&e.offsetY<50)jexcel.current.closeEditor(jexcel.current.edition[0],!0);else{var b=function(e){var t=e.getAttribute("data-x"),r=e.getAttribute("data-y");return t&&r?[t,r]:e.parentNode?b(e.parentNode):void 0},p=b(e.target);if(p){var d=p[0];c=p[1];jexcel.current.edition&&(jexcel.current.edition[2]==d&&jexcel.current.edition[3]==c||jexcel.current.closeEditor(jexcel.current.edition[0],!0)),jexcel.current.edition||(e.shiftKey?jexcel.current.updateSelectionFromCoords(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],d,c):jexcel.current.updateSelectionFromCoords(d,c)),jexcel.current.selectedHeader=null,jexcel.current.selectedRow=null}}}else jexcel.current.selectedRow=!1;e.target.classList.contains("jexcel_page")&&("<"==e.target.innerText?jexcel.current.page(0):">"==e.target.innerText?jexcel.current.page(e.target.getAttribute("title")-1):jexcel.current.page(e.target.innerText-1))}jexcel.current.edition?jexcel.isMouseAction=!1:jexcel.isMouseAction=!0}else jexcel.isMouseAction=!1},jexcel.mouseUpControls=function(e){if(jexcel.current)if(jexcel.current.resizing){if(jexcel.current.resizing.column){jexcel.current.headers[jexcel.current.resizing.column].classList.remove("resizing");var t=jexcel.current.colgroup[jexcel.current.resizing.column].getAttribute("width");jexcel.current.setWidth(jexcel.current.resizing.column,t,jexcel.current.resizing.width),jexcel.current.headers[jexcel.current.resizing.column].classList.remove("resizing");for(var r=0;r<jexcel.current.records.length;r++)jexcel.current.records[r][jexcel.current.resizing.column].classList.remove("resizing")}else{jexcel.current.rows[jexcel.current.resizing.row].children[0].classList.remove("resizing");var o=jexcel.current.rows[jexcel.current.resizing.row].getAttribute("height");jexcel.current.setHeight(jexcel.current.resizing.row,o,jexcel.current.resizing.height),jexcel.current.resizing.element.classList.remove("resizing")}jexcel.current.resizing=null}else if(jexcel.current.dragging){if(jexcel.current.dragging){if(jexcel.current.dragging.column){var n=e.target.getAttribute("data-x");jexcel.current.headers[jexcel.current.dragging.column].classList.remove("dragging");for(r=0;r<jexcel.current.rows.length;r++)jexcel.current.records[r][jexcel.current.dragging.column].classList.remove("dragging");for(var l=0;l<jexcel.current.headers.length;l++)jexcel.current.headers[l].classList.remove("dragging-left"),jexcel.current.headers[l].classList.remove("dragging-right");n&&jexcel.current.dragging.column!=jexcel.current.dragging.destination&&jexcel.current.moveColumn(jexcel.current.dragging.column,jexcel.current.dragging.destination)}else{var s=Array.prototype.indexOf.call(jexcel.current.dragging.element.parentNode.children,jexcel.current.dragging.element);jexcel.current.dragging.row!=s&&jexcel.current.moveRow(jexcel.current.dragging.row,s,!0),jexcel.current.dragging.element.classList.remove("dragging")}jexcel.current.dragging=null}}else jexcel.current.selectedCorner&&(jexcel.current.selectedCorner=!1,jexcel.current.selection.length>0&&(jexcel.current.copyData(jexcel.current.selection[0],jexcel.current.selection[jexcel.current.selection.length-1]),jexcel.current.removeCopySelection()));jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null),jexcel.isMouseAction=!1},jexcel.mouseMoveControls=function(e){if("buttons"in(e=e||window.event))var t=e.buttons;else t=e.which||e.button;if(t||(jexcel.isMouseAction=!1),jexcel.current&&1==jexcel.isMouseAction&&jexcel.current.resizing)if(jexcel.current.resizing.column){var r=e.pageX-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.width+r>0){var o=jexcel.current.resizing.width+r;jexcel.current.colgroup[jexcel.current.resizing.column].setAttribute("width",o),jexcel.current.updateCornerPosition()}}else{var n=e.pageY-jexcel.current.resizing.mousePosition;if(jexcel.current.resizing.height+n>0){var l=jexcel.current.resizing.height+n;jexcel.current.rows[jexcel.current.resizing.row].setAttribute("height",l),jexcel.current.updateCornerPosition()}}},jexcel.mouseOverControls=function(e){if("buttons"in(e=e||window.event))var t=e.buttons;else t=e.which||e.button;if(t||(jexcel.isMouseAction=!1),jexcel.current&&1==jexcel.isMouseAction){var r=jexcel.getElement(e.target);if(r[0]){if(jexcel.current!=r[0].jexcel&&jexcel.current)return!1;var o=e.target.getAttribute("data-x"),n=e.target.getAttribute("data-y");if(jexcel.current.dragging){if(jexcel.current.dragging.column){if(o)if(jexcel.current.isColMerged(o).length)console.error("JEXCEL: This column is part of a merged cell.");else{for(var l=0;l<jexcel.current.headers.length;l++)jexcel.current.headers[l].classList.remove("dragging-left"),jexcel.current.headers[l].classList.remove("dragging-right");jexcel.current.dragging.column==o?jexcel.current.dragging.destination=parseInt(o):e.target.clientWidth/2>e.offsetX?(jexcel.current.dragging.column<o?jexcel.current.dragging.destination=parseInt(o)-1:jexcel.current.dragging.destination=parseInt(o),jexcel.current.headers[o].classList.add("dragging-left")):(jexcel.current.dragging.column<o?jexcel.current.dragging.destination=parseInt(o):jexcel.current.dragging.destination=parseInt(o)+1,jexcel.current.headers[o].classList.add("dragging-right"))}}else if(n)if(jexcel.current.isRowMerged(n).length)console.error("JEXCEL: This row is part of a merged cell.");else{var s=e.target.clientHeight/2>e.offsetY?e.target.parentNode.nextSibling:e.target.parentNode;e.target.parentNode.parentNode.insertBefore(jexcel.current.dragging.element,s)}}else if(jexcel.current.resizing);else{if(1==r[1]&&jexcel.current.selectedHeader){o=e.target.getAttribute("data-x");var i=jexcel.current.selectedHeader,a=o;jexcel.current.updateSelectionFromCoords(i,0,a,jexcel.current.options.data.length-1)}if(2==r[1])if(e.target.classList.contains("jexcel_row")){if(jexcel.current.selectedRow){i=jexcel.current.selectedRow,a=n;jexcel.current.updateSelectionFromCoords(0,i,jexcel.current.options.data[0].length-1,a)}}else jexcel.current.edition||o&&n&&(jexcel.current.selectedCorner?jexcel.current.updateCopySelection(o,n):jexcel.current.selectedCell&&jexcel.current.updateSelectionFromCoords(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],o,n))}}}jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null)},jexcel.doubleClickControls=function(e){if(jexcel.current)if(e.target.classList.contains("jexcel_corner")){if(jexcel.current.highlighted.length>0){var t=jexcel.current.highlighted[0].getAttribute("data-x"),r=parseInt(jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-y"))+1,o=jexcel.current.highlighted[jexcel.current.highlighted.length-1].getAttribute("data-x"),n=jexcel.current.records.length-1;jexcel.current.copyData(jexcel.current.records[r][t],jexcel.current.records[n][o])}}else{var l=jexcel.getElement(e.target);if(1==l[1]&&1==jexcel.current.options.columnSorting){var s=e.target.getAttribute("data-x");s&&jexcel.current.orderBy(s)}if(2==l[1]&&1==jexcel.current.options.editable&&!jexcel.current.edition){var i=function(e){if(e.parentNode){var t=e.getAttribute("data-x"),r=e.getAttribute("data-y");return t&&r?e:i(e.parentNode)}},a=i(e.target);a&&a.classList.contains("highlight")&&jexcel.current.openEditor(a)}}},jexcel.copyControls=function(e){jexcel.current&&jexcel.copyControls.enabled&&(jexcel.current.edition||jexcel.current.copy(!0))},jexcel.cutControls=function(e){jexcel.current&&(jexcel.current.edition||(jexcel.current.copy(!0),1==jexcel.current.options.editable&&jexcel.current.setValue(jexcel.current.highlighted,"")))},jexcel.pasteControls=function(e){jexcel.current&&jexcel.current.selectedCell&&(jexcel.current.edition||e.clipboardData&&(1==jexcel.current.options.editable&&jexcel.current.paste(jexcel.current.selectedCell[0],jexcel.current.selectedCell[1],e.clipboardData.getData("text")),e.preventDefault()))},jexcel.contextMenuControls=function(e){if("buttons"in(e=e||window.event))e.buttons;else e.which||e.button;if(jexcel.current)if(jexcel.current.edition)e.preventDefault();else if(jexcel.current.options.contextMenu&&(jexcel.current.contextMenu.contextmenu.close(),jexcel.current)){var t=e.target.getAttribute("data-x"),r=e.target.getAttribute("data-y");if(t||r){var o=jexcel.current.options.contextMenu(jexcel.current,t,r,e);jexcel.current.contextMenu.contextmenu.open(e,o),e.preventDefault()}}},jexcel.touchStartControls=function(e){var t=jexcel.getElement(e.target);if(t[0]?jexcel.current!=t[0].jexcel&&(jexcel.current&&jexcel.current.resetSelection(),jexcel.current=t[0].jexcel):jexcel.current&&(jexcel.current.resetSelection(),jexcel.current=null),jexcel.current&&!jexcel.current.edition){var r=e.target.getAttribute("data-x"),o=e.target.getAttribute("data-y");r&&o&&(jexcel.current.updateSelectionFromCoords(r,o),jexcel.timeControl=setTimeout(function(){jexcel.current.openEditor(e.target,!1,e)},500))}},jexcel.touchEndControls=function(e){jexcel.timeControl&&(clearTimeout(jexcel.timeControl),jexcel.timeControl=null)},jexcel.copyControls.enabled=!0,"undefined"!=typeof jQuery&&function(e){var t={init:function(r){t=jexcel(e(this).get(0),r)}};e.fn.jexcel=function(r){return t[r]?t[r].apply(this,Array.prototype.slice.call(arguments,1)):"object"!=typeof r&&r?void e.error("Method "+r+" does not exist on jQuery.tooltip"):t.init.apply(this,arguments)}}(jQuery),jexcel.createTabs=function(e,t){e.innerHTML="",e.classList.add("jexcel_tabs");for(var r=[],o=[],n=0;n<t.length;n++)r[n]=document.createElement("div"),r[n].classList.add("jexcel_tab"),o[n]=document.createElement("div"),o[n].classList.add("jexcel_tab_link"),o[n].setAttribute("data-spreadsheet",n),o[n].innerHTML=t[n].sheetName,o[n].onclick=function(){for(var e=0;e<r.length;e++)r[e].style.display="none",o[e].classList.remove("selected");var t=this.getAttribute("data-spreadsheet");r[t].style.display="block",o[t].classList.add("selected")},e.appendChild(o[n]);for(n=0;n<r.length-1;n++)e.appendChild(r[n]),jexcel(r[n],t[n]);r[0].style.display="block",o[0].classList.add("selected")},jexcel.fromSpreadsheet=function(e,t){var r,o=function(e){var t=[];return e.SheetNames.forEach(function(r){var o={rows:[],columns:[],data:[],style:{}};if(o.sheetName=r,(p=e.Sheets[r]["!cols"])&&p.length)for(var n=0;n<p.length;n++)o.columns[n]={},o.columns[n].width=p[n].wpx+"px";if((p=e.Sheets[r]["!rows"])&&p.length)for(n=0;n<p.length;n++)p[n]&&p[n].hpx&&(o.rows[n]={},o.rows[n].height=p[n].hpx+"px");if((p=e.Sheets[r]["!merges"])&&p.length>0){o.mergeCells=[];for(n=0;n<p.length;n++){var l=p[n].s.c,s=p[n].s.r,i=p[n].e.c,a=p[n].e.r,u=jexcel.getColumnNameFromId([l,s]);o.mergeCells[u]=[i-l+1,a-s+1]}}var c=0,b=0,p=Object.keys(e.Sheets[r]);for(n=0;n<p.length;n++)if("!"!=p[n].substr(0,1)){var d=e.Sheets[r][p[n]],j=jexcel.getIdFromColumnName(p[n],!0);o.data[j[1]]||(o.data[j[1]]=[]),o.data[j[1]][j[0]]=d.f?"="+d.f:d.w,c<j[0]&&(c=j[0]),b<j[1]&&(b=j[1]),d.style&&Object.keys(d.style).length>0&&(o.style[p[n]]=d.style),d.s&&d.s.fgColor&&(o.style[p[n]]&&(o.style[p[n]]+=";"),o.style[p[n]]+="background-color:#"+d.s.fgColor.rgb)}for(var f=o.columns,h=0;h<=b;h++)for(n=0;n<=c;n++)o.data[h]||(o.data[h]=[]),o.data[h][n]||f<n&&(o.data[h][n]="");t.push(o)}),t};(r=new XMLHttpRequest).open("GET",e,!0),"undefined"!=typeof Uint8Array?(r.responseType="arraybuffer",r.onload=function(e){var n=r.response,l=new Uint8Array(n),s=XLSX.read(l,{type:"array",cellFormula:!0,cellStyles:!0});t(o(s))}):(r.setRequestHeader("Accept-Charset","x-user-defined"),r.onreadystatechange=function(){if(4==r.readyState&&200==r.status){var e=convertResponseBodyToText(r.responseBody),n=XLSX.read(e,{type:"binary",cellFormula:!0,cellStyles:!0});t(o(n))}}),r.send()};var error=function(){var e={};return e.nil=new Error("#NULL!"),e.div0=new Error("#DIV/0!"),e.value=new Error("#VALUE!"),e.ref=new Error("#REF!"),e.name=new Error("#NAME?"),e.num=new Error("#NUM!"),e.na=new Error("#N/A"),e.error=new Error("#ERROR!"),e.data=new Error("#GETTING_DATA"),e}(),utils=function(){var e={flattenShallow:function(e){return e&&e.reduce?e.reduce(function(e,t){var r=Array.isArray(e),o=Array.isArray(t);return r&&o?e.concat(t):r?(e.push(t),e):o?[e].concat(t):[e,t]}):e},isFlat:function(e){if(!e)return!1;for(var t=0;t<e.length;++t)if(Array.isArray(e[t]))return!1;return!0},flatten:function(){for(var t=e.argsToArray.apply(null,arguments);!e.isFlat(t);)t=e.flattenShallow(t);return t},argsToArray:function(t){var r=[];return e.arrayEach(t,function(e){r.push(e)}),r},numbers:function(){return this.flatten.apply(null,arguments).filter(function(e){return"number"==typeof e})},cleanFloat:function(e){return Math.round(1e14*e)/1e14},parseBool:function(e){if("boolean"==typeof e)return e;if(e instanceof Error)return e;if("number"==typeof e)return 0!==e;if("string"==typeof e){var t=e.toUpperCase();if("TRUE"===t)return!0;if("FALSE"===t)return!1}return e instanceof Date&&!isNaN(e)||error.value},parseNumber:function(e){return void 0===e||""===e?error.value:isNaN(e)?error.value:parseFloat(e)},parseNumberArray:function(t){var r,o;if(!t||0===(r=t.length))return error.value;for(;r--;){if((o=e.parseNumber(t[r]))===error.value)return o;t[r]=o}return t},parseMatrix:function(t){var r;if(!t||0===t.length)return error.value;for(var o=0;o<t.length;o++)if(r=e.parseNumberArray(t[o]),t[o]=r,r instanceof Error)return r;return t}},t=new Date(Date.UTC(1900,0,1));return e.parseDate=function(e){if(!isNaN(e)){if(e instanceof Date)return new Date(e);var r=parseInt(e,10);return r<0?error.num:r<=60?new Date(t.getTime()+864e5*(r-1)):new Date(t.getTime()+864e5*(r-2))}return"string"!=typeof e||(e=new Date(e),isNaN(e))?error.value:e},e.parseDateArray=function(e){for(var t,r=e.length;r--;){if((t=this.parseDate(e[r]))===error.value)return t;e[r]=t}return e},e.anyIsError=function(){for(var e=arguments.length;e--;)if(arguments[e]instanceof Error)return!0;return!1},e.arrayValuesToNumbers=function(e){for(var t,r=e.length;r--;)if("number"!=typeof(t=e[r]))if(!0!==t)if(!1!==t){if("string"==typeof t){var o=this.parseNumber(t);o instanceof Error?e[r]=0:e[r]=o}}else e[r]=0;else e[r]=1;return e},e.rest=function(e,t){return t=t||1,e&&"function"==typeof e.slice?e.slice(t):e},e.initial=function(e,t){return t=t||1,e&&"function"==typeof e.slice?e.slice(0,e.length-t):e},e.arrayEach=function(e,t){for(var r=-1,o=e.length;++r<o&&!1!==t(e[r],r,e););return e},e.transpose=function(e){return e?e[0].map(function(t,r){return e.map(function(e){return e[r]})}):error.value},e}();jexcel.methods={},jexcel.methods.datetime=function(){var e={},t=new Date(1900,0,1),r=[[],[1,2,3,4,5,6,7],[7,1,2,3,4,5,6],[6,0,1,2,3,4,5],[],[],[],[],[],[],[],[7,1,2,3,4,5,6],[6,7,1,2,3,4,5],[5,6,7,1,2,3,4],[4,5,6,7,1,2,3],[3,4,5,6,7,1,2],[2,3,4,5,6,7,1],[1,2,3,4,5,6,7]];function o(e){return(e-t)/864e5+(e>-22038912e5?2:1)}return e.DATE=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:e<0||t<0||r<0?error.num:new Date(e,t-1,r)},e.DATEVALUE=function(e){if("string"!=typeof e)return error.value;var r=Date.parse(e);return isNaN(r)?error.value:r<=-22038912e5?(r-t)/864e5+1:(r-t)/864e5+2},e.DAY=function(e){var t=utils.parseDate(e);return t instanceof Error?t:t.getDate()},e.DAYS=function(e,t){return e=utils.parseDate(e),t=utils.parseDate(t),e instanceof Error?e:t instanceof Error?t:o(e)-o(t)},e.DAYS360=function(e,t,r){},e.EDATE=function(e,t){return(e=utils.parseDate(e))instanceof Error?e:isNaN(t)?error.value:(t=parseInt(t,10),e.setMonth(e.getMonth()+t),o(e))},e.EOMONTH=function(e,t){return(e=utils.parseDate(e))instanceof Error?e:isNaN(t)?error.value:(t=parseInt(t,10),o(new Date(e.getFullYear(),e.getMonth()+t+1,0)))},e.HOUR=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getHours()},e.INTERVAL=function(e){if("number"!=typeof e&&"string"!=typeof e)return error.value;e=parseInt(e,10);var t=Math.floor(e/94608e4);e%=94608e4;var r=Math.floor(e/2592e3);e%=2592e3;var o=Math.floor(e/86400);e%=86400;var n=Math.floor(e/3600);e%=3600;var l=Math.floor(e/60),s=e%=60;return"P"+(t=t>0?t+"Y":"")+(r=r>0?r+"M":"")+(o=o>0?o+"D":"")+"T"+(n=n>0?n+"H":"")+(l=l>0?l+"M":"")+(s=s>0?s+"S":"")},e.ISOWEEKNUM=function(e){if((e=utils.parseDate(e))instanceof Error)return e;e.setHours(0,0,0),e.setDate(e.getDate()+4-(e.getDay()||7));var t=new Date(e.getFullYear(),0,1);return Math.ceil(((e-t)/864e5+1)/7)},e.MINUTE=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getMinutes()},e.MONTH=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getMonth()+1},e.NETWORKDAYS=function(e,t,r){},e.NETWORKDAYS.INTL=function(e,t,r,o){},e.NOW=function(){return new Date},e.SECOND=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getSeconds()},e.TIME=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:e<0||t<0||r<0?error.num:(3600*e+60*t+r)/86400},e.TIMEVALUE=function(e){return(e=utils.parseDate(e))instanceof Error?e:(3600*e.getHours()+60*e.getMinutes()+e.getSeconds())/86400},e.TODAY=function(){return new Date},e.WEEKDAY=function(e,t){if((e=utils.parseDate(e))instanceof Error)return e;void 0===t&&(t=1);var o=e.getDay();return r[t][o]},e.WEEKNUM=function(e,t){},e.WORKDAY=function(e,t,r){},e.WORKDAY.INTL=function(e,t,r,o){},e.YEAR=function(e){return(e=utils.parseDate(e))instanceof Error?e:e.getFullYear()},e.YEARFRAC=function(e,t,r){},e}(),jexcel.methods.database=function(){var exports={};function compact(e){if(!e)return e;for(var t=[],r=0;r<e.length;++r)e[r]&&t.push(e[r]);return t}function findResultIndex(database,criterias){for(var matches={},i=1;i<database[0].length;++i)matches[i]=!0;var maxCriteriaLength=criterias[0].length;for(i=1;i<criterias.length;++i)criterias[i].length>maxCriteriaLength&&(maxCriteriaLength=criterias[i].length);for(var k=1;k<database.length;++k)for(var l=1;l<database[k].length;++l){for(var currentCriteriaResult=!1,hasMatchingCriteria=!1,j=0;j<criterias.length;++j){var criteria=criterias[j];if(!(criteria.length<maxCriteriaLength)){var criteriaField=criteria[0];if(database[k][0]===criteriaField){hasMatchingCriteria=!0;for(var p=1;p<criteria.length;++p)currentCriteriaResult=currentCriteriaResult||eval(database[k][l]+criteria[p])}}}hasMatchingCriteria&&(matches[l]=matches[l]&&currentCriteriaResult)}for(var result=[],n=0;n<database[0].length;++n)matches[n]&&result.push(n-1);return result}return exports.FINDFIELD=function(e,t){for(var r=null,o=0;o<e.length;o++)if(e[o][0]===t){r=o;break}return null==r?error.value:r},exports.DAVERAGE=function(e,t,r){if(isNaN(t)&&"string"!=typeof t)return error.value;var o=findResultIndex(e,r),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=0,i=0;i<o.length;i++)s+=n[o[i]];return 0===o.length?error.div0:s/o.length},exports.DCOUNT=function(e,t,r){},exports.DCOUNTA=function(e,t,r){},exports.DGET=function(e,t,r){if(isNaN(t)&&"string"!=typeof t)return error.value;var o=findResultIndex(e,r),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);return 0===o.length?error.value:o.length>1?error.num:n[o[0]]},exports.DMAX=function(e,t,r){if(isNaN(t)&&"string"!=typeof t)return error.value;var o=findResultIndex(e,r),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=n[o[0]],i=1;i<o.length;i++)s<n[o[i]]&&(s=n[o[i]]);return s},exports.DMIN=function(e,t,r){if(isNaN(t)&&"string"!=typeof t)return error.value;var o=findResultIndex(e,r),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=n[o[0]],i=1;i<o.length;i++)s>n[o[i]]&&(s=n[o[i]]);return s},exports.DPRODUCT=function(e,t,r){if(isNaN(t)&&"string"!=typeof t)return error.value;var o=findResultIndex(e,r),n=[];if("string"==typeof t){var l=exports.FINDFIELD(e,t);n=utils.rest(e[l])}else n=utils.rest(e[t]);for(var s=[],i=0;i<o.length;i++)s[i]=n[o[i]];s=compact(s);var a=1;for(i=0;i<s.length;i++)a*=s[i];return a},exports.DSTDEV=function(e,t,r){},exports.DSTDEVP=function(e,t,r){},exports.DSUM=function(e,t,r){},exports.DVAR=function(e,t,r){},exports.DVARP=function(e,t,r){},exports.MATCH=function(e,t,r){if(!e&&!t)return error.na;if(2===arguments.length&&(r=1),!(t instanceof Array))return error.na;if(-1!==r&&0!==r&&1!==r)return error.na;for(var o,n,l=0;l<t.length;l++)if(1===r){if(t[l]===e)return l+1;t[l]<e&&(n?t[l]>n&&(o=l+1,n=t[l]):(o=l+1,n=t[l]))}else if(0===r){if("string"==typeof e){if(e=e.replace(/\?/g,"."),t[l].toLowerCase().match(e.toLowerCase()))return l+1}else if(t[l]===e)return l+1}else if(-1===r){if(t[l]===e)return l+1;t[l]>e&&(n?t[l]<n&&(o=l+1,n=t[l]):(o=l+1,n=t[l]))}return o||error.na},exports}(),jexcel.methods.engineering=function(){var e={};function t(e){return/^[01]{1,10}$/.test(e)}return e.BESSELI=function(e,t){},e.BESSELJ=function(e,t){},e.BESSELK=function(e,t){},e.BESSELY=function(e,t){},e.BIN2DEC=function(e){if(!t(e))return error.num;var r=parseInt(e,2),o=e.toString();return 10===o.length&&"1"===o.substring(0,1)?parseInt(o.substring(1),2)-512:r},e.BIN2HEX=function(e,r){if(!t(e))return error.num;var o=e.toString();if(10===o.length&&"1"===o.substring(0,1))return(0xfffffffe00+parseInt(o.substring(1),2)).toString(16);var n=parseInt(e,2).toString(16);return void 0===r?n:isNaN(r)?error.value:r<0?error.num:(r=Math.floor(r))>=n.length?REPT("0",r-n.length)+n:error.num},e.BIN2OCT=function(e,r){if(!t(e))return error.num;var o=e.toString();if(10===o.length&&"1"===o.substring(0,1))return(1073741312+parseInt(o.substring(1),2)).toString(8);var n=parseInt(e,2).toString(8);return void 0===r?n:isNaN(r)?error.value:r<0?error.num:(r=Math.floor(r))>=n.length?REPT("0",r-n.length)+n:error.num},e.BITAND=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e&t},e.BITLSHIFT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0?error.num:Math.floor(e)!==e?error.num:e>0xffffffffffff?error.num:Math.abs(t)>53?error.num:t>=0?e<<t:e>>-t},e.BITOR=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e|t},e.BITRSHIFT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0?error.num:Math.floor(e)!==e?error.num:e>0xffffffffffff?error.num:Math.abs(t)>53?error.num:t>=0?e>>t:e<<-t},e.BITXOR=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<0||t<0?error.num:Math.floor(e)!==e||Math.floor(t)!==t?error.num:e>0xffffffffffff||t>0xffffffffffff?error.num:e^t},e.COMPLEX=function(e,t,r){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return e;if("i"!==(r=void 0===r?"i":r)&&"j"!==r)return error.value;if(0===e&&0===t)return 0;if(0===e)return 1===t?r:t.toString()+r;if(0===t)return e.toString();var o=t>0?"+":"";return e.toString()+o+(1===t?r:t.toString()+r)},e.CONVERT=function(e,t,r){if((e=utils.parseNumber(e))instanceof Error)return e;for(var o,n=[["a.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["a.u. of charge","e",null,"electric_charge",!1,!1,1.60217653141414e-19],["a.u. of energy","Eh",null,"energy",!1,!1,4.35974417757576e-18],["a.u. of length","a?",null,"length",!1,!1,5.29177210818182e-11],["a.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["a.u. of time","?/Eh",null,"time",!1,!1,2.41888432650516e-17],["admiralty knot","admkn",null,"speed",!1,!0,.514773333],["ampere","A",null,"electric_current",!0,!1,1],["ampere per meter","A/m",null,"magnetic_field_intensity",!0,!1,1],["ångström","Å",["ang"],"length",!1,!0,1e-10],["are","ar",null,"area",!1,!0,100],["astronomical unit","ua",null,"length",!1,!1,1.49597870691667e-11],["bar","bar",null,"pressure",!1,!1,1e5],["barn","b",null,"area",!1,!1,1e-28],["becquerel","Bq",null,"radioactivity",!0,!1,1],["bit","bit",["b"],"information",!1,!0,1],["btu","BTU",["btu"],"energy",!1,!0,1055.05585262],["byte","byte",null,"information",!1,!0,8],["candela","cd",null,"luminous_intensity",!0,!1,1],["candela per square metre","cd/m?",null,"luminance",!0,!1,1],["coulomb","C",null,"electric_charge",!0,!1,1],["cubic ångström","ang3",["ang^3"],"volume",!1,!0,1e-30],["cubic foot","ft3",["ft^3"],"volume",!1,!0,.028316846592],["cubic inch","in3",["in^3"],"volume",!1,!0,16387064e-12],["cubic light-year","ly3",["ly^3"],"volume",!1,!0,8.46786664623715e-47],["cubic metre","m?",null,"volume",!0,!0,1],["cubic mile","mi3",["mi^3"],"volume",!1,!0,4168181825.44058],["cubic nautical mile","Nmi3",["Nmi^3"],"volume",!1,!0,6352182208],["cubic Pica","Pica3",["Picapt3","Pica^3","Picapt^3"],"volume",!1,!0,7.58660370370369e-8],["cubic yard","yd3",["yd^3"],"volume",!1,!0,.764554857984],["cup","cup",null,"volume",!1,!0,.0002365882365],["dalton","Da",["u"],"mass",!1,!1,1.66053886282828e-27],["day","d",["day"],"time",!1,!0,86400],["degree","°",null,"angle",!1,!1,.0174532925199433],["degrees Rankine","Rank",null,"temperature",!1,!0,.555555555555556],["dyne","dyn",["dy"],"force",!1,!0,1e-5],["electronvolt","eV",["ev"],"energy",!1,!0,1.60217656514141],["ell","ell",null,"length",!1,!0,1.143],["erg","erg",["e"],"energy",!1,!0,1e-7],["farad","F",null,"electric_capacitance",!0,!1,1],["fluid ounce","oz",null,"volume",!1,!0,295735295625e-16],["foot","ft",null,"length",!1,!0,.3048],["foot-pound","flb",null,"energy",!1,!0,1.3558179483314],["gal","Gal",null,"acceleration",!1,!1,.01],["gallon","gal",null,"volume",!1,!0,.003785411784],["gauss","G",["ga"],"magnetic_flux_density",!1,!0,1],["grain","grain",null,"mass",!1,!0,647989e-10],["gram","g",null,"mass",!1,!0,.001],["gray","Gy",null,"absorbed_dose",!0,!1,1],["gross registered ton","GRT",["regton"],"volume",!1,!0,2.8316846592],["hectare","ha",null,"area",!1,!0,1e4],["henry","H",null,"inductance",!0,!1,1],["hertz","Hz",null,"frequency",!0,!1,1],["horsepower","HP",["h"],"power",!1,!0,745.69987158227],["horsepower-hour","HPh",["hh","hph"],"energy",!1,!0,2684519.538],["hour","h",["hr"],"time",!1,!0,3600],["imperial gallon (U.K.)","uk_gal",null,"volume",!1,!0,.00454609],["imperial hundredweight","lcwt",["uk_cwt","hweight"],"mass",!1,!0,50.802345],["imperial quart (U.K)","uk_qt",null,"volume",!1,!0,.0011365225],["imperial ton","brton",["uk_ton","LTON"],"mass",!1,!0,1016.046909],["inch","in",null,"length",!1,!0,.0254],["international acre","uk_acre",null,"area",!1,!0,4046.8564224],["IT calorie","cal",null,"energy",!1,!0,4.1868],["joule","J",null,"energy",!0,!0,1],["katal","kat",null,"catalytic_activity",!0,!1,1],["kelvin","K",["kel"],"temperature",!0,!0,1],["kilogram","kg",null,"mass",!0,!0,1],["knot","kn",null,"speed",!1,!0,.514444444444444],["light-year","ly",null,"length",!1,!0,9460730472580800],["litre","L",["l","lt"],"volume",!1,!0,.001],["lumen","lm",null,"luminous_flux",!0,!1,1],["lux","lx",null,"illuminance",!0,!1,1],["maxwell","Mx",null,"magnetic_flux",!1,!1,1e-18],["measurement ton","MTON",null,"volume",!1,!0,1.13267386368],["meter per hour","m/h",["m/hr"],"speed",!1,!0,.00027777777777778],["meter per second","m/s",["m/sec"],"speed",!0,!0,1],["meter per second squared","m?s??",null,"acceleration",!0,!1,1],["parsec","pc",["parsec"],"length",!1,!0,0x6da012f958ee1c],["meter squared per second","m?/s",null,"kinematic_viscosity",!0,!1,1],["metre","m",null,"length",!0,!0,1],["miles per hour","mph",null,"speed",!1,!0,.44704],["millimetre of mercury","mmHg",null,"pressure",!1,!1,133.322],["minute","?",null,"angle",!1,!1,.000290888208665722],["minute","min",["mn"],"time",!1,!0,60],["modern teaspoon","tspm",null,"volume",!1,!0,5e-6],["mole","mol",null,"amount_of_substance",!0,!1,1],["morgen","Morgen",null,"area",!1,!0,2500],["n.u. of action","?",null,"action",!1,!1,1.05457168181818e-34],["n.u. of mass","m?",null,"mass",!1,!1,9.10938261616162e-31],["n.u. of speed","c?",null,"speed",!1,!1,299792458],["n.u. of time","?/(me?c??)",null,"time",!1,!1,1.28808866778687e-21],["nautical mile","M",["Nmi"],"length",!1,!0,1852],["newton","N",null,"force",!0,!0,1],["œrsted","Oe ",null,"magnetic_field_intensity",!1,!1,79.5774715459477],["ohm","Ω",null,"electric_resistance",!0,!1,1],["ounce mass","ozm",null,"mass",!1,!0,.028349523125],["pascal","Pa",null,"pressure",!0,!1,1],["pascal second","Pa?s",null,"dynamic_viscosity",!0,!1,1],["pferdestärke","PS",null,"power",!1,!0,735.49875],["phot","ph",null,"illuminance",!1,!1,1e-4],["pica (1/6 inch)","pica",null,"length",!1,!0,.00035277777777778],["pica (1/72 inch)","Pica",["Picapt"],"length",!1,!0,.00423333333333333],["poise","P",null,"dynamic_viscosity",!1,!1,.1],["pond","pond",null,"force",!1,!0,.00980665],["pound force","lbf",null,"force",!1,!0,4.4482216152605],["pound mass","lbm",null,"mass",!1,!0,.45359237],["quart","qt",null,"volume",!1,!0,.000946352946],["radian","rad",null,"angle",!0,!1,1],["second","?",null,"angle",!1,!1,484813681109536e-20],["second","s",["sec"],"time",!0,!0,1],["short hundredweight","cwt",["shweight"],"mass",!1,!0,45.359237],["siemens","S",null,"electrical_conductance",!0,!1,1],["sievert","Sv",null,"equivalent_dose",!0,!1,1],["slug","sg",null,"mass",!1,!0,14.59390294],["square ångström","ang2",["ang^2"],"area",!1,!0,1e-20],["square foot","ft2",["ft^2"],"area",!1,!0,.09290304],["square inch","in2",["in^2"],"area",!1,!0,64516e-8],["square light-year","ly2",["ly^2"],"area",!1,!0,8.95054210748189e31],["square meter","m?",null,"area",!0,!0,1],["square mile","mi2",["mi^2"],"area",!1,!0,2589988.110336],["square nautical mile","Nmi2",["Nmi^2"],"area",!1,!0,3429904],["square Pica","Pica2",["Picapt2","Pica^2","Picapt^2"],"area",!1,!0,1792111111111e-17],["square yard","yd2",["yd^2"],"area",!1,!0,.83612736],["statute mile","mi",null,"length",!1,!0,1609.344],["steradian","sr",null,"solid_angle",!0,!1,1],["stilb","sb",null,"luminance",!1,!1,1e-4],["stokes","St",null,"kinematic_viscosity",!1,!1,1e-4],["stone","stone",null,"mass",!1,!0,6.35029318],["tablespoon","tbs",null,"volume",!1,!0,147868e-10],["teaspoon","tsp",null,"volume",!1,!0,492892e-11],["tesla","T",null,"magnetic_flux_density",!0,!0,1],["thermodynamic calorie","c",null,"energy",!1,!0,4.184],["ton","ton",null,"mass",!1,!0,907.18474],["tonne","t",null,"mass",!1,!1,1e3],["U.K. pint","uk_pt",null,"volume",!1,!0,.00056826125],["U.S. bushel","bushel",null,"volume",!1,!0,.03523907],["U.S. oil barrel","barrel",null,"volume",!1,!0,.158987295],["U.S. pint","pt",["us_pt"],"volume",!1,!0,.000473176473],["U.S. survey mile","survey_mi",null,"length",!1,!0,1609.347219],["U.S. survey/statute acre","us_acre",null,"area",!1,!0,4046.87261],["volt","V",null,"voltage",!0,!1,1],["watt","W",null,"power",!0,!0,1],["watt-hour","Wh",["wh"],"energy",!1,!0,3600],["weber","Wb",null,"magnetic_flux",!0,!1,1],["yard","yd",null,"length",!1,!0,.9144],["year","yr",null,"time",!1,!0,31557600]],l={Yi:["yobi",80,1.2089258196146292e24,"Yi","yotta"],Zi:["zebi",70,0x400000000000000000,"Zi","zetta"],Ei:["exbi",60,0x1000000000000000,"Ei","exa"],Pi:["pebi",50,0x4000000000000,"Pi","peta"],Ti:["tebi",40,1099511627776,"Ti","tera"],Gi:["gibi",30,1073741824,"Gi","giga"],Mi:["mebi",20,1048576,"Mi","mega"],ki:["kibi",10,1024,"ki","kilo"]},s={Y:["yotta",1e24,"Y"],Z:["zetta",1e21,"Z"],E:["exa",1e18,"E"],P:["peta",1e15,"P"],T:["tera",1e12,"T"],G:["giga",1e9,"G"],M:["mega",1e6,"M"],k:["kilo",1e3,"k"],h:["hecto",100,"h"],e:["dekao",10,"e"],d:["deci",.1,"d"],c:["centi",.01,"c"],m:["milli",.001,"m"],u:["micro",1e-6,"u"],n:["nano",1e-9,"n"],p:["pico",1e-12,"p"],f:["femto",1e-15,"f"],a:["atto",1e-18,"a"],z:["zepto",1e-21,"z"],y:["yocto",1e-24,"y"]},i=null,a=null,u=t,c=r,b=1,p=1,d=0;d<n.length;d++)o=null===n[d][2]?[]:n[d][2],(n[d][1]===u||o.indexOf(u)>=0)&&(i=n[d]),(n[d][1]===c||o.indexOf(c)>=0)&&(a=n[d]);if(null===i){var j=l[t.substring(0,2)],f=s[t.substring(0,1)];"da"===t.substring(0,2)&&(f=["dekao",10,"da"]),j?(b=j[2],u=t.substring(2)):f&&(b=f[1],u=t.substring(f[2].length));for(var h=0;h<n.length;h++)o=null===n[h][2]?[]:n[h][2],(n[h][1]===u||o.indexOf(u)>=0)&&(i=n[h])}if(null===a){var g=l[r.substring(0,2)],m=s[r.substring(0,1)];"da"===r.substring(0,2)&&(m=["dekao",10,"da"]),g?(p=g[2],c=r.substring(2)):m&&(p=m[1],c=r.substring(m[2].length));for(var v=0;v<n.length;v++)o=null===n[v][2]?[]:n[v][2],(n[v][1]===c||o.indexOf(c)>=0)&&(a=n[v])}return null===i||null===a?error.na:i[3]!==a[3]?error.na:e*i[6]*b/(a[6]*p)},e.DEC2BIN=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,3}$/.test(e)||e<-512||e>511)return error.num;if(e<0)return"1"+REPT("0",9-(512+e).toString(2).length)+(512+e).toString(2);var r=parseInt(e,10).toString(2);return void 0===t?r:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=r.length?REPT("0",t-r.length)+r:error.num},e.DEC2HEX=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,12}$/.test(e)||e<-549755813888||e>549755813887)return error.num;if(e<0)return(1099511627776+e).toString(16);var r=parseInt(e,10).toString(16);return void 0===t?r:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=r.length?REPT("0",t-r.length)+r:error.num},e.DEC2OCT=function(e,t){if((e=utils.parseNumber(e))instanceof Error)return e;if(!/^-?[0-9]{1,9}$/.test(e)||e<-536870912||e>536870911)return error.num;if(e<0)return(1073741824+e).toString(8);var r=parseInt(e,10).toString(8);return void 0===t?r:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=r.length?REPT("0",t-r.length)+r:error.num},e.DELTA=function(e,t){return t=void 0===t?0:t,e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e===t?1:0},e.ERF=function(e,t){},e.ERF.PRECISE=function(){},e.ERFC=function(e){},e.ERFC.PRECISE=function(){},e.GESTEP=function(e,t){return t=t||0,e=utils.parseNumber(e),utils.anyIsError(t,e)?e:e>=t?1:0},e.HEX2BIN=function(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var r=10===e.length&&"f"===e.substring(0,1).toLowerCase(),o=r?parseInt(e,16)-1099511627776:parseInt(e,16);if(o<-512||o>511)return error.num;if(r)return"1"+REPT("0",9-(512+o).toString(2).length)+(512+o).toString(2);var n=o.toString(2);return void 0===t?n:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=n.length?REPT("0",t-n.length)+n:error.num},e.HEX2DEC=function(e){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var t=parseInt(e,16);return t>=549755813888?t-1099511627776:t},e.HEX2OCT=function(e,t){if(!/^[0-9A-Fa-f]{1,10}$/.test(e))return error.num;var r=parseInt(e,16);if(r>536870911&&r<0xffe0000000)return error.num;if(r>=0xffe0000000)return(r-0xffc0000000).toString(8);var o=r.toString(8);return void 0===t?o:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=o.length?REPT("0",t-o.length)+o:error.num},e.IMABS=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:Math.sqrt(Math.pow(r,2)+Math.pow(o,2))},e.IMAGINARY=function(e){if(void 0===e||!0===e||!1===e)return error.value;if(0===e||"0"===e)return 0;if(["i","j"].indexOf(e)>=0)return 1;var t=(e=e.replace("+i","+1i").replace("-i","-1i").replace("+j","+1j").replace("-j","-1j")).indexOf("+"),r=e.indexOf("-");0===t&&(t=e.indexOf("+",1)),0===r&&(r=e.indexOf("-",1));var o=e.substring(e.length-1,e.length),n="i"===o||"j"===o;return t>=0||r>=0?n?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?error.num:Number(e.substring(t+1,e.length-1)):isNaN(e.substring(0,r))||isNaN(e.substring(r+1,e.length-1))?error.num:-Number(e.substring(r+1,e.length-1)):error.num:n?isNaN(e.substring(0,e.length-1))?error.num:e.substring(0,e.length-1):isNaN(e)?error.num:0},e.IMARGUMENT=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:0===r&&0===o?error.div0:0===r&&o>0?Math.PI/2:0===r&&o<0?-Math.PI/2:0===o&&r>0?0:0===o&&r<0?-Math.PI:r>0?Math.atan(o/r):r<0&&o>=0?Math.atan(o/r)+Math.PI:Math.atan(o/r)-Math.PI},e.IMCONJUGATE=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",0!==o?e.COMPLEX(r,-o,n):t},e.IMCOS=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(r)*(Math.exp(o)+Math.exp(-o))/2,-Math.sin(r)*(Math.exp(o)-Math.exp(-o))/2,n)},e.IMCOSH=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(o)*(Math.exp(r)+Math.exp(-r))/2,Math.sin(o)*(Math.exp(r)-Math.exp(-r))/2,n)},e.IMCOT=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:e.IMDIV(e.IMCOS(t),e.IMSIN(t))},e.IMDIV=function(t,r){var o=e.IMREAL(t),n=e.IMAGINARY(t),l=e.IMREAL(r),s=e.IMAGINARY(r);if(utils.anyIsError(o,n,l,s))return error.value;var i=t.substring(t.length-1),a=r.substring(r.length-1),u="i";if("j"===i?u="j":"j"===a&&(u="j"),0===l&&0===s)return error.num;var c=l*l+s*s;return e.COMPLEX((o*l+n*s)/c,(n*l-o*s)/c,u)},e.IMEXP=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);n="i"===n||"j"===n?n:"i";var l=Math.exp(r);return e.COMPLEX(l*Math.cos(o),l*Math.sin(o),n)},e.IMLN=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(r*r+o*o)),Math.atan(o/r),n)},e.IMLOG10=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(r*r+o*o))/Math.log(10),Math.atan(o/r)/Math.log(10),n)},e.IMLOG2=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.log(Math.sqrt(r*r+o*o))/Math.log(2),Math.atan(o/r)/Math.log(2),n)},e.IMPOWER=function(t,r){r=utils.parseNumber(r);var o=e.IMREAL(t),n=e.IMAGINARY(t);if(utils.anyIsError(r,o,n))return error.value;var l=t.substring(t.length-1);l="i"===l||"j"===l?l:"i";var s=Math.pow(e.IMABS(t),r),i=e.IMARGUMENT(t);return e.COMPLEX(s*Math.cos(r*i),s*Math.sin(r*i),l)},e.IMPRODUCT=function(){for(var t=arguments[0],r=1;r<arguments.length;r++){var o=e.IMREAL(t),n=e.IMAGINARY(t),l=e.IMREAL(arguments[r]),s=e.IMAGINARY(arguments[r]);if(utils.anyIsError(o,n,l,s))return error.value;t=e.COMPLEX(o*l-n*s,o*s+n*l)}return t},e.IMREAL=function(e){if(void 0===e||!0===e||!1===e)return error.value;if(0===e||"0"===e)return 0;if(["i","+i","1i","+1i","-i","-1i","j","+j","1j","+1j","-j","-1j"].indexOf(e)>=0)return 0;var t=e.indexOf("+"),r=e.indexOf("-");0===t&&(t=e.indexOf("+",1)),0===r&&(r=e.indexOf("-",1));var o=e.substring(e.length-1,e.length),n="i"===o||"j"===o;return t>=0||r>=0?n?t>=0?isNaN(e.substring(0,t))||isNaN(e.substring(t+1,e.length-1))?error.num:Number(e.substring(0,t)):isNaN(e.substring(0,r))||isNaN(e.substring(r+1,e.length-1))?error.num:Number(e.substring(0,r)):error.num:n?isNaN(e.substring(0,e.length-1))?error.num:0:isNaN(e)?error.num:e},e.IMSEC=function(t){if(!0===t||!1===t)return error.value;var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:e.IMDIV("1",e.IMCOS(t))},e.IMSECH=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:e.IMDIV("1",e.IMCOSH(t))},e.IMSIN=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.sin(r)*(Math.exp(o)+Math.exp(-o))/2,Math.cos(r)*(Math.exp(o)-Math.exp(-o))/2,n)},e.IMSINH=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);return n="i"===n||"j"===n?n:"i",e.COMPLEX(Math.cos(o)*(Math.exp(r)-Math.exp(-r))/2,Math.sin(o)*(Math.exp(r)+Math.exp(-r))/2,n)},e.IMSQRT=function(t){var r=e.IMREAL(t),o=e.IMAGINARY(t);if(utils.anyIsError(r,o))return error.value;var n=t.substring(t.length-1);n="i"===n||"j"===n?n:"i";var l=Math.sqrt(e.IMABS(t)),s=e.IMARGUMENT(t);return e.COMPLEX(l*Math.cos(s/2),l*Math.sin(s/2),n)},e.IMCSC=function(t){if(!0===t||!1===t)return error.value;var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.num:e.IMDIV("1",e.IMSIN(t))},e.IMCSCH=function(t){if(!0===t||!1===t)return error.value;var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.num:e.IMDIV("1",e.IMSINH(t))},e.IMSUB=function(e,t){var r=this.IMREAL(e),o=this.IMAGINARY(e),n=this.IMREAL(t),l=this.IMAGINARY(t);if(utils.anyIsError(r,o,n,l))return error.value;var s=e.substring(e.length-1),i=t.substring(t.length-1),a="i";return"j"===s?a="j":"j"===i&&(a="j"),this.COMPLEX(r-n,o-l,a)},e.IMSUM=function(){for(var e=utils.flatten(arguments),t=e[0],r=1;r<e.length;r++){var o=this.IMREAL(t),n=this.IMAGINARY(t),l=this.IMREAL(e[r]),s=this.IMAGINARY(e[r]);if(utils.anyIsError(o,n,l,s))return error.value;t=this.COMPLEX(o+l,n+s)}return t},e.IMTAN=function(t){if(!0===t||!1===t)return error.value;var r=e.IMREAL(t),o=e.IMAGINARY(t);return utils.anyIsError(r,o)?error.value:this.IMDIV(this.IMSIN(t),this.IMCOS(t))},e.OCT2BIN=function(e,t){if(!/^[0-7]{1,10}$/.test(e))return error.num;var r=10===e.length&&"7"===e.substring(0,1),o=r?parseInt(e,8)-1073741824:parseInt(e,8);if(o<-512||o>511)return error.num;if(r)return"1"+REPT("0",9-(512+o).toString(2).length)+(512+o).toString(2);var n=o.toString(2);return void 0===t?n:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=n.length?REPT("0",t-n.length)+n:error.num},e.OCT2DEC=function(e){if(!/^[0-7]{1,10}$/.test(e))return error.num;var t=parseInt(e,8);return t>=536870912?t-1073741824:t},e.OCT2HEX=function(e,t){if(!/^[0-7]{1,10}$/.test(e))return error.num;var r=parseInt(e,8);if(r>=536870912)return"ff"+(r+3221225472).toString(16);var o=r.toString(16);return void 0===t?o:isNaN(t)?error.value:t<0?error.num:(t=Math.floor(t))>=o.length?REPT("0",t-o.length)+o:error.num},e}(),jexcel.methods.financial=function(){var e={};function t(e){return e&&e.getTime&&!isNaN(e.getTime())}function r(e){return e instanceof Date?e:new Date(e)}return e.ACCRINT=function(e,o,n,l,s,i,a){return e=r(e),o=r(o),n=r(n),t(e)&&t(o)&&t(n)?l<=0||s<=0?"#NUM!":-1===[1,2,4].indexOf(i)?"#NUM!":-1===[0,1,2,3,4].indexOf(a)?"#NUM!":n<=e?"#NUM!":(a=a||0,(s=s||0)*l*YEARFRAC(e,n,a)):"#VALUE!"},e.ACCRINTM=null,e.AMORDEGRC=null,e.AMORLINC=null,e.COUPDAYBS=null,e.COUPDAYS=null,e.COUPDAYSNC=null,e.COUPNCD=null,e.COUPNUM=null,e.COUPPCD=null,e.CUMIPMT=function(t,r,o,n,l,s){if(t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(t,r,o))return error.value;if(t<=0||r<=0||o<=0)return error.num;if(n<1||l<1||n>l)return error.num;if(0!==s&&1!==s)return error.num;var i=e.PMT(t,r,o,0,s),a=0;1===n&&0===s&&(a=-o,n++);for(var u=n;u<=l;u++)a+=1===s?e.FV(t,u-2,i,o,1)-i:e.FV(t,u-1,i,o,0);return a*=t},e.CUMPRINC=function(t,r,o,n,l,s){if(t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(t,r,o))return error.value;if(t<=0||r<=0||o<=0)return error.num;if(n<1||l<1||n>l)return error.num;if(0!==s&&1!==s)return error.num;var i=e.PMT(t,r,o,0,s),a=0;1===n&&(a=0===s?i+o*t:i,n++);for(var u=n;u<=l;u++)a+=s>0?i-(e.FV(t,u-2,i,o,1)-i)*t:i-e.FV(t,u-1,i,o,0)*t;return a},e.DB=function(e,t,r,o,n){if(n=void 0===n?12:n,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n))return error.value;if(e<0||t<0||r<0||o<0)return error.num;if(-1===[1,2,3,4,5,6,7,8,9,10,11,12].indexOf(n))return error.num;if(o>r)return error.num;if(t>=e)return 0;for(var l=(1-Math.pow(t/e,1/r)).toFixed(3),s=e*l*n/12,i=s,a=0,u=o===r?r-1:o,c=2;c<=u;c++)i+=a=(e-i)*l;return 1===o?s:o===r?(e-i)*l:a},e.DDB=function(e,t,r,o,n){if(n=void 0===n?2:n,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n))return error.value;if(e<0||t<0||r<0||o<0||n<=0)return error.num;if(o>r)return error.num;if(t>=e)return 0;for(var l=0,s=0,i=1;i<=o;i++)l+=s=Math.min(n/r*(e-l),e-t-l);return s},e.DISC=null,e.DOLLARDE=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(t<0)return error.num;if(t>=0&&t<1)return error.div0;t=parseInt(t,10);var r=parseInt(e,10);r+=e%1*Math.pow(10,Math.ceil(Math.log(t)/Math.LN10))/t;var o=Math.pow(10,Math.ceil(Math.log(t)/Math.LN2)+1);return r=Math.round(r*o)/o},e.DOLLARFR=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(t<0)return error.num;if(t>=0&&t<1)return error.div0;t=parseInt(t,10);var r=parseInt(e,10);return r+=e%1*Math.pow(10,-Math.ceil(Math.log(t)/Math.LN10))*t},e.DURATION=null,e.EFFECT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<=0||t<1?error.num:(t=parseInt(t,10),Math.pow(1+e/t,t)-1)},e.FV=function(e,t,r,o,n){if(o=o||0,n=n||0,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n))return error.value;var l;if(0===e)l=o+r*t;else{var s=Math.pow(1+e,t);l=1===n?o*s+r*(1+e)*(s-1)/e:o*s+r*(s-1)/e}return-l},e.FVSCHEDULE=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var r=t.length,o=e,n=0;n<r;n++)o*=1+t[n];return o},e.INTRATE=null,e.IPMT=function(t,r,o,n,l,s){if(l=l||0,s=s||0,t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),l=utils.parseNumber(l),s=utils.parseNumber(s),utils.anyIsError(t,r,o,n,l,s))return error.value;var i=e.PMT(t,o,n,l,s);return(1===r?1===s?0:-n:1===s?e.FV(t,r-2,i,n,1)-i:e.FV(t,r-1,i,n,0))*t},e.IRR=function(e,t){if(t=t||0,e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;for(var r=function(e,t,r){for(var o=r+1,n=e[0],l=1;l<e.length;l++)n+=e[l]/Math.pow(o,(t[l]-t[0])/365);return n},o=function(e,t,r){for(var o=r+1,n=0,l=1;l<e.length;l++){var s=(t[l]-t[0])/365;n-=s*e[l]/Math.pow(o,s+1)}return n},n=[],l=!1,s=!1,i=0;i<e.length;i++)n[i]=0===i?0:n[i-1]+365,e[i]>0&&(l=!0),e[i]<0&&(s=!0);if(!l||!s)return error.num;var a,u,c,b=t=void 0===t?.1:t,p=!0;do{a=b-(c=r(e,n,b))/o(e,n,b),u=Math.abs(a-b),b=a,p=u>1e-10&&Math.abs(c)>1e-10}while(p);return b},e.ISPMT=function(e,t,r,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(e,t,r,o)?error.value:o*e*(t/r-1)},e.MDURATION=null,e.MIRR=function(t,r,o){if(t=utils.parseNumberArray(utils.flatten(t)),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(t,r,o))return error.value;for(var n=t.length,l=[],s=[],i=0;i<n;i++)t[i]<0?l.push(t[i]):s.push(t[i]);var a=-e.NPV(o,s)*Math.pow(1+o,n-1),u=e.NPV(r,l)*(1+r);return Math.pow(a/u,1/(n-1))-1},e.NOMINAL=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e<=0||t<1?error.num:(t=parseInt(t,10),(Math.pow(e+1,1/t)-1)*t)},e.NPER=function(e,t,r,o,n){if(n=void 0===n?0:n,o=void 0===o?0:o,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n))return error.value;var l=t*(1+e*n)-o*e,s=r*e+t*(1+e*n);return Math.log(l/s)/Math.log(1+e)},e.NPV=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=e[0],r=0,o=1;o<e.length;o++)r+=e[o]/Math.pow(1+t,o);return r},e.ODDFPRICE=null,e.ODDFYIELD=null,e.ODDLPRICE=null,e.ODDLYIELD=null,e.PDURATION=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:e<=0?error.num:(Math.log(r)-Math.log(t))/Math.log(1+e)},e.PMT=function(e,t,r,o,n){if(o=o||0,n=n||0,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n))return error.value;var l;if(0===e)l=(r+o)/t;else{var s=Math.pow(1+e,t);l=1===n?(o*e/(s-1)+r*e/(1-1/s))/(1+e):o*e/(s-1)+r*e/(1-1/s)}return-l},e.PPMT=function(t,r,o,n,l,s){return l=l||0,s=s||0,t=utils.parseNumber(t),o=utils.parseNumber(o),n=utils.parseNumber(n),l=utils.parseNumber(l),s=utils.parseNumber(s),utils.anyIsError(t,o,n,l,s)?error.value:e.PMT(t,o,n,l,s)-e.IPMT(t,r,o,n,l,s)},e.PRICE=null,e.PRICEDISC=null,e.PRICEMAT=null,e.PV=function(e,t,r,o,n){return o=o||0,n=n||0,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),utils.anyIsError(e,t,r,o,n)?error.value:0===e?-r*t-o:((1-Math.pow(1+e,t))/e*r*(1+e*n)-o)/Math.pow(1+e,t)},e.RATE=function(e,t,r,o,n,l){if(l=void 0===l?.01:l,o=void 0===o?0:o,n=void 0===n?0:n,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),n=utils.parseNumber(n),l=utils.parseNumber(l),utils.anyIsError(e,t,r,o,n,l))return error.value;for(var s=0,i=!1,a=l;s<100&&!i;){var u=Math.pow(a+1,e),c=Math.pow(a+1,e-1),b=a-(o+u*r+t*(u-1)*(a*n+1)/a)/(e*c*r-t*(u-1)*(a*n+1)/Math.pow(a,2)+(e*t*c*(a*n+1)/a+t*(u-1)*n/a));Math.abs(b-a)<1e-6&&(i=!0),s++,a=b}return i?a:Number.NaN+a},e.RECEIVED=null,e.RRI=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:0===e||0===t?error.num:Math.pow(r/t,1/e)-1},e.SLN=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:0===r?error.num:(e-t)/r},e.SYD=function(e,t,r,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(e,t,r,o)?error.value:0===r?error.num:o<1||o>r?error.num:(e-t)*(r-(o=parseInt(o,10))+1)*2/(r*(r+1))},e.TBILLEQ=function(e,t,r){return e=utils.parseDate(e),t=utils.parseDate(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:r<=0?error.num:e>t?error.num:t-e>31536e6?error.num:365*r/(360-r*DAYS360(e,t,!1))},e.TBILLPRICE=function(e,t,r){return e=utils.parseDate(e),t=utils.parseDate(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:r<=0?error.num:e>t?error.num:t-e>31536e6?error.num:100*(1-r*DAYS360(e,t,!1)/360)},e.TBILLYIELD=function(e,t,r){return e=utils.parseDate(e),t=utils.parseDate(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:r<=0?error.num:e>t?error.num:t-e>31536e6?error.num:360*(100-r)/(r*DAYS360(e,t,!1))},e.VDB=null,e.XIRR=function(e,t,r){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseDateArray(utils.flatten(t)),r=utils.parseNumber(r),utils.anyIsError(e,t,r))return error.value;for(var o=function(e,t,r){for(var o=r+1,n=e[0],l=1;l<e.length;l++)n+=e[l]/Math.pow(o,DAYS(t[l],t[0])/365);return n},n=function(e,t,r){for(var o=r+1,n=0,l=1;l<e.length;l++){var s=DAYS(t[l],t[0])/365;n-=s*e[l]/Math.pow(o,s+1)}return n},l=!1,s=!1,i=0;i<e.length;i++)e[i]>0&&(l=!0),e[i]<0&&(s=!0);if(!l||!s)return error.num;var a,u,c,b=r=r||.1,p=!0;do{a=b-(c=o(e,t,b))/n(e,t,b),u=Math.abs(a-b),b=a,p=u>1e-10&&Math.abs(c)>1e-10}while(p);return b},e.XNPV=function(e,t,r){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),r=utils.parseDateArray(utils.flatten(r)),utils.anyIsError(e,t,r))return error.value;for(var o=0,n=0;n<t.length;n++)o+=t[n]/Math.pow(1+e,DAYS(r[n],r[0])/365);return o},e.YIELD=null,e.YIELDDISC=null,e.YIELDMAT=null,e}(),jexcel.methods.information=function(){var e={CELL:null,ERROR:{}};return e.ERROR.TYPE=function(e){switch(e){case error.nil:return 1;case error.div0:return 2;case error.value:return 3;case error.ref:return 4;case error.name:return 5;case error.num:return 6;case error.na:return 7;case error.data:return 8}return error.na},e.INFO=null,e.ISBLANK=function(e){return null===e},e.ISBINARY=function(e){return/^[01]{1,10}$/.test(e)},e.ISERR=function(e){return[error.value,error.ref,error.div0,error.num,error.name,error.nil].indexOf(e)>=0||"number"==typeof e&&(isNaN(e)||!isFinite(e))},e.ISERROR=function(t){return e.ISERR(t)||t===error.na},e.ISEVEN=function(e){return!(1&Math.floor(Math.abs(e)))},e.ISFORMULA=null,e.ISLOGICAL=function(e){return!0===e||!1===e},e.ISNA=function(e){return e===error.na},e.ISNONTEXT=function(e){return"string"!=typeof e},e.ISNUMBER=function(e){return"number"==typeof e&&!isNaN(e)&&isFinite(e)},e.ISODD=function(e){return!!(1&Math.floor(Math.abs(e)))},e.ISREF=null,e.ISTEXT=function(e){return"string"==typeof e},e.N=function(e){return this.ISNUMBER(e)?e:e instanceof Date?e.getTime():!0===e?1:!1===e?0:this.ISERROR(e)?e:0},e.NA=function(){return error.na},e.SHEET=null,e.SHEETS=null,e.TYPE=function(e){return this.ISNUMBER(e)?1:this.ISTEXT(e)?2:this.ISLOGICAL(e)?4:this.ISERROR(e)?16:Array.isArray(e)?64:void 0},e}(),jexcel.methods.logical=function(){var e={AND:function(){for(var e=utils.flatten(arguments),t=!0,r=0;r<e.length;r++)e[r]||(t=!1);return t},CHOOSE:function(){if(arguments.length<2)return error.na;var e=arguments[0];return e<1||e>254?error.value:arguments.length<e+1?error.value:arguments[e]},FALSE:function(){return!1},IF:function(e,t,r){return e?t:r},IFERROR:function(e,t){return ISERROR(e)?t:e},IFNA:function(e,t){return e===error.na?t:e},NOT:function(e){return!e},OR:function(){for(var e=utils.flatten(arguments),t=!1,r=0;r<e.length;r++)e[r]&&(t=!0);return t},TRUE:function(){return!0},XOR:function(){for(var e=utils.flatten(arguments),t=0,r=0;r<e.length;r++)e[r]&&t++;return!!(1&Math.floor(Math.abs(t)))},SWITCH:function(){var e;if(arguments.length>0){var t=arguments[0],r=arguments.length-1,o=Math.floor(r/2),n=!1,l=r%2==0?null:arguments[arguments.length-1];if(o)for(var s=0;s<o;s++)if(t===arguments[2*s+1]){e=arguments[2*s+2],n=!0;break}!n&&l&&(e=l)}return e}};return e}(),jexcel.methods.math=function(){var exports={ABS:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.abs(utils.parseNumber(e))},ACOS:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.acos(e)},ACOSH:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e+Math.sqrt(e*e-1))},ACOT:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.atan(1/e)},ACOTH:function(e){return(e=utils.parseNumber(e))instanceof Error?e:.5*Math.log((e+1)/(e-1))},AGGREGATE:null,ARABIC:function(e){if(!/^M*(?:D?C{0,3}|C[MD])(?:L?X{0,3}|X[CL])(?:V?I{0,3}|I[XV])$/.test(e))return error.value;var t=0;return e.replace(/[MDLV]|C[MD]?|X[CL]?|I[XV]?/g,function(e){t+={M:1e3,CM:900,D:500,CD:400,C:100,XC:90,L:50,XL:40,X:10,IX:9,V:5,IV:4,I:1}[e]}),t},ASIN:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.asin(e)},ASINH:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e+Math.sqrt(e*e+1))},ATAN:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.atan(e)},ATAN2:function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:Math.atan2(e,t)},ATANH:function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log((1+e)/(1-e))/2},BASE:function(e,t,r){if(r=r||0,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r))return error.value;r=void 0===r?0:r;var o=e.toString(t);return new Array(Math.max(r+1-o.length,0)).join("0")+o},CEILING:function(e,t,r){return t=void 0===t?1:t,r=void 0===r?0:r,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:0===t?0:(t=Math.abs(t),e>=0?Math.ceil(e/t)*t:0===r?-1*Math.floor(Math.abs(e)/t)*t:-1*Math.ceil(Math.abs(e)/t)*t)}};exports.CEILING.MATH=exports.CEILING,exports.CEILING.PRECISE=exports.CEILING,exports.COMBIN=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:exports.FACT(e)/(exports.FACT(t)*exports.FACT(e-t))},exports.COMBINA=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:0===e&&0===t?1:exports.COMBIN(e+t-1,e-1)},exports.COS=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.cos(e)},exports.COSH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:(Math.exp(e)+Math.exp(-e))/2},exports.COT=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.tan(e)},exports.COTH=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.exp(2*e);return(t+1)/(t-1)},exports.CSC=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.sin(e)},exports.CSCH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:2/(Math.exp(e)-Math.exp(-e))},exports.DECIMAL=function(e,t){return arguments.length<1?error.value:parseInt(e,t)},exports.DEGREES=function(e){return(e=utils.parseNumber(e))instanceof Error?e:180*e/Math.PI},exports.EVEN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:exports.CEILING(e,-2,-1)},exports.EXP=Math.exp;var MEMOIZED_FACT=[];return exports.FACT=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.floor(e);return 0===t||1===t?1:MEMOIZED_FACT[t]>0?MEMOIZED_FACT[t]:(MEMOIZED_FACT[t]=exports.FACT(t-1)*t,MEMOIZED_FACT[t])},exports.FACTDOUBLE=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.floor(e);return t<=0?1:t*exports.FACTDOUBLE(t-2)},exports.FLOOR=function(e,t,r){return t=void 0===t?1:t,r=void 0===r?0:r,e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:0===t?0:(t=Math.abs(t),e>=0?Math.floor(e/t)*t:0===r?-1*Math.ceil(Math.abs(e)/t)*t:-1*Math.floor(Math.abs(e)/t)*t)},exports.FLOOR.MATH=exports.FLOOR,exports.GCD=null,exports.INT=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.floor(e)},exports.LCM=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t,r,o,n,l=1;void 0!==(o=e.pop());)for(;o>1;){if(o%2){for(t=3,r=Math.floor(Math.sqrt(o));t<=r&&o%t;t+=2);n=t<=r?t:o}else n=2;for(o/=n,l*=n,t=e.length;t;e[--t]%n==0&&1==(e[t]/=n)&&e.splice(t,1));}return l},exports.LN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e)},exports.LOG=function(e,t){return e=utils.parseNumber(e),t=void 0===t?10:utils.parseNumber(t),utils.anyIsError(e,t)?error.value:Math.log(e)/Math.log(t)},exports.LOG10=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log(e)/Math.log(10)},exports.MDETERM=null,exports.MINVERSE=null,exports.MMULT=null,exports.MOD=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;if(0===t)return error.div0;var r=Math.abs(e%t);return t>0?r:-r},exports.MROUND=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e*t<0?error.num:Math.round(e/t)*t},exports.MULTINOMIAL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=0,r=1,o=0;o<e.length;o++)t+=e[o],r*=exports.FACT(e[o]);return exports.FACT(t)/r},exports.MUNIT=null,exports.ODD=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.ceil(Math.abs(e));return t=1&t?t:t+1,e>0?t:-t},exports.PI=function(){return Math.PI},exports.POWER=function(e,t){if(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var r=Math.pow(e,t);return isNaN(r)?error.num:r},exports.PRODUCT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=1,r=0;r<e.length;r++)t*=e[r];return t},exports.QUOTIENT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:parseInt(e/t,10)},exports.RADIANS=function(e){return(e=utils.parseNumber(e))instanceof Error?e:e*Math.PI/180},exports.RAND=function(){return Math.random()},exports.RANDBETWEEN=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e+Math.ceil((t-e+1)*Math.random())-1},exports.ROMAN=null,exports.ROUND=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:Math.round(e*Math.pow(10,t))/Math.pow(10,t)},exports.ROUNDDOWN=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:(e>0?1:-1)*Math.floor(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports.ROUNDUP=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:(e>0?1:-1)*Math.ceil(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports.SEC=function(e){return(e=utils.parseNumber(e))instanceof Error?e:1/Math.cos(e)},exports.SECH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:2/(Math.exp(e)+Math.exp(-e))},exports.SERIESSUM=function(e,t,r,o){if(e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),o=utils.parseNumberArray(o),utils.anyIsError(e,t,r,o))return error.value;for(var n=o[0]*Math.pow(e,t),l=1;l<o.length;l++)n+=o[l]*Math.pow(e,t+l*r);return n},exports.SIGN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:e<0?-1:0===e?0:1},exports.SIN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.sin(e)},exports.SINH=function(e){return(e=utils.parseNumber(e))instanceof Error?e:(Math.exp(e)-Math.exp(-e))/2},exports.SQRT=function(e){return(e=utils.parseNumber(e))instanceof Error?e:e<0?error.num:Math.sqrt(e)},exports.SQRTPI=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.sqrt(e*Math.PI)},exports.SUBTOTAL=null,exports.ADD=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e+t)},exports.MINUS=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e-t)},exports.DIVIDE=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:0===t?error.div0:e/t)},exports.MULTIPLY=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:e*t)},exports.GTE=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.error:e>=t)},exports.LT=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.error:e<t)},exports.LTE=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.error:e<=t)},exports.EQ=function(e,t){return 2!==arguments.length?error.na:e===t},exports.NE=function(e,t){return 2!==arguments.length?error.na:e!==t},exports.POW=function(e,t){return 2!==arguments.length?error.na:(e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.error:exports.POWER(e,t))},exports.SUM=function(){for(var e=0,t=Object.keys(arguments),r=0;r<t.length;++r){var o=arguments[t[r]];if("number"==typeof o)e+=o;else if("string"==typeof o){var n=parseFloat(o);!isNaN(n)&&(e+=n)}else Array.isArray(o)&&(e+=exports.SUM.apply(null,o))}return e},exports.SUMIF=function(range,criteria){if(range=utils.parseNumberArray(utils.flatten(range)),range instanceof Error)return range;for(var result=0,i=0;i<range.length;i++)result+=eval(range[i]+criteria)?range[i]:0;return result},exports.SUMIFS=function(){var args=utils.argsToArray(arguments),range=utils.parseNumberArray(utils.flatten(args.shift()));if(range instanceof Error)return range;for(var criteria=args,n_range_elements=range.length,n_criterias=criteria.length,result=0,i=0;i<n_range_elements;i++){for(var el=range[i],condition="",c=0;c<n_criterias;c++)condition+=el+criteria[c],c!==n_criterias-1&&(condition+="&&");eval(condition)&&(result+=el)}return result},exports.SUMPRODUCT=null,exports.SUMSQ=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t=0,r=e.length,o=0;o<r;o++)t+=ISNUMBER(e[o])?e[o]*e[o]:0;return t},exports.SUMX2MY2=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var r=0,o=0;o<e.length;o++)r+=e[o]*e[o]-t[o]*t[o];return r},exports.SUMX2PY2=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;var r=0;e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t));for(var o=0;o<e.length;o++)r+=e[o]*e[o]+t[o]*t[o];return r},exports.SUMXMY2=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;var r=0;e=utils.flatten(e),t=utils.flatten(t);for(var o=0;o<e.length;o++)r+=Math.pow(e[o]-t[o],2);return r},exports.TAN=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.tan(e)},exports.TANH=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.exp(2*e);return(t-1)/(t+1)},exports.TRUNC=function(e,t){return t=void 0===t?0:t,e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:(e>0?1:-1)*Math.floor(Math.abs(e)*Math.pow(10,t))/Math.pow(10,t)},exports}(),jexcel.methods.misc=function(){var e={UNIQUE:function(){for(var e=[],t=0;t<arguments.length;++t){for(var r=!1,o=arguments[t],n=0;n<e.length&&!(r=e[n]===o);++n);r||e.push(o)}return e}};return e.FLATTEN=utils.flatten,e.ARGS2ARRAY=function(){return Array.prototype.slice.call(arguments,0)},e.REFERENCE=function(e,t){try{for(var r=t.split("."),o=e,n=0;n<r.length;++n){var l=r[n];if("]"===l[l.length-1]){var s=l.indexOf("["),i=l.substring(s+1,l.length-1);o=o[l.substring(0,s)][i]}else o=o[l]}return o}catch(e){}},e.JOIN=function(e,t){return e.join(t)},e.NUMBERS=function(){return utils.flatten(arguments).filter(function(e){return"number"==typeof e})},e.NUMERAL=null,e}(),jexcel.methods.text=function(){var e={ASC:null,BAHTTEXT:null,CHAR:function(e){return(e=utils.parseNumber(e))instanceof Error?e:String.fromCharCode(e)},CLEAN:function(e){return(e=e||"").replace(/[\0-\x1F]/g,"")},CODE:function(e){return(e=e||"").charCodeAt(0)},CONCATENATE:function(){for(var e=utils.flatten(arguments),t=0;(t=e.indexOf(!0))>-1;)e[t]="TRUE";for(var r=0;(r=e.indexOf(!1))>-1;)e[r]="FALSE";return e.join("")},DBCS:null,DOLLAR:null,EXACT:function(e,t){return e===t},FIND:function(e,t,r){return r=void 0===r?0:r,t?t.indexOf(e,r-1)+1:null},FIXED:null,HTML2TEXT:function(e){var t="";return e&&(e instanceof Array?e.forEach(function(e){""!==t&&(t+="\n"),t+=e.replace(/<(?:.|\n)*?>/gm,"")}):t=e.replace(/<(?:.|\n)*?>/gm,"")),t},LEFT:function(e,t){return t=void 0===t?1:t,(t=utils.parseNumber(t))instanceof Error||"string"!=typeof e?error.value:e?e.substring(0,t):null},LEN:function(e){return 0===arguments.length?error.error:"string"==typeof e?e?e.length:0:e.length?e.length:error.value},LOWER:function(e){return"string"!=typeof e?error.value:e?e.toLowerCase():e},MID:function(e,t,r){if(t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(t,r)||"string"!=typeof e)return r;var o=t-1,n=o+r;return e.substring(o,n)},NUMBERVALUE:null,PRONETIC:null,PROPER:function(e){return void 0===e||0===e.length?error.value:(!0===e&&(e="TRUE"),!1===e&&(e="FALSE"),isNaN(e)&&"number"==typeof e?error.value:("number"==typeof e&&(e=""+e),e.replace(/\w\S*/g,function(e){return e.charAt(0).toUpperCase()+e.substr(1).toLowerCase()})))},REGEXEXTRACT:function(e,t){var r=e.match(new RegExp(t));return r?r[r.length>1?r.length-1:0]:null},REGEXMATCH:function(e,t,r){var o=e.match(new RegExp(t));return r?o:!!o},REGEXREPLACE:function(e,t,r){return e.replace(new RegExp(t),r)},REPLACE:function(e,t,r,o){return t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(t,r)||"string"!=typeof e||"string"!=typeof o?error.value:e.substr(0,t-1)+o+e.substr(t-1+r)},REPT:function(e,t){return(t=utils.parseNumber(t))instanceof Error?t:new Array(t+1).join(e)},RIGHT:function(e,t){return t=void 0===t?1:t,(t=utils.parseNumber(t))instanceof Error?t:e?e.substring(e.length-t):null},SEARCH:function(e,t,r){var o;return"string"!=typeof e||"string"!=typeof t?error.value:(r=void 0===r?0:r,0===(o=t.toLowerCase().indexOf(e.toLowerCase(),r-1)+1)?error.value:o)},SPLIT:function(e,t){return e.split(t)},SUBSTITUTE:function(e,t,r,o){if(!(e&&t&&r))return e;if(void 0===o)return e.replace(new RegExp(t,"g"),r);for(var n=0,l=0;e.indexOf(t,n)>0;)if(n=e.indexOf(t,n+1),++l===o)return e.substring(0,n)+r+e.substring(n+t.length)},T:function(e){return"string"==typeof e?e:""},TEXT:null,TRIM:function(e){return"string"!=typeof e?error.value:e.replace(/ +/g," ").trim()}};return e.UNICHAR=e.CHAR,e.UNICODE=e.CODE,e.UPPER=function(e){return"string"!=typeof e?error.value:e.toUpperCase()},e.VALUE=null,e}(),jexcel.methods.stats=function(){var exports={},SQRT2PI=2.5066282746310002;return exports.AVEDEV=null,exports.AVERAGE=function(){for(var e=utils.numbers(utils.flatten(arguments)),t=e.length,r=0,o=0,n=0;n<t;n++)r+=e[n],o+=1;return r/o},exports.AVERAGEA=function(){for(var e=utils.flatten(arguments),t=e.length,r=0,o=0,n=0;n<t;n++){var l=e[n];"number"==typeof l&&(r+=l),!0===l&&r++,null!==l&&o++}return r/o},exports.AVERAGEIF=function(range,criteria,average_range){if(average_range=average_range||range,range=utils.flatten(range),average_range=utils.parseNumberArray(utils.flatten(average_range)),average_range instanceof Error)return average_range;for(var average_count=0,result=0,i=0;i<range.length;i++)eval(range[i]+criteria)&&(result+=average_range[i],average_count++);return result/average_count},exports.AVERAGEIFS=null,exports.COUNT=function(){return utils.numbers(utils.flatten(arguments)).length},exports.COUNTA=function(){var e=utils.flatten(arguments);return e.length-exports.COUNTBLANK(e)},exports.COUNTIN=function(e,t){for(var r=0,o=0;o<e.length;o++)e[o]===t&&r++;return r},exports.COUNTBLANK=function(){for(var e,t=utils.flatten(arguments),r=0,o=0;o<t.length;o++)null!==(e=t[o])&&""!==e||r++;return r},exports.COUNTIF=function(range,criteria){range=utils.flatten(range),/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var matches=0,i=0;i<range.length;i++)"string"!=typeof range[i]?eval(range[i]+criteria)&&matches++:eval('"'+range[i]+'"'+criteria)&&matches++;return matches},exports.COUNTIFS=function(){for(var args=utils.argsToArray(arguments),results=new Array(utils.flatten(args[0]).length),i=0;i<results.length;i++)results[i]=!0;for(i=0;i<args.length;i+=2){var range=utils.flatten(args[i]),criteria=args[i+1];/[<>=!]/.test(criteria)||(criteria='=="'+criteria+'"');for(var j=0;j<range.length;j++)"string"!=typeof range[j]?results[j]=results[j]&&eval(range[j]+criteria):results[j]=results[j]&&eval('"'+range[j]+'"'+criteria)}var result=0;for(i=0;i<results.length;i++)results[i]&&result++;return result},exports.COUNTUNIQUE=function(){return UNIQUE.apply(null,utils.flatten(arguments)).length},exports.FISHER=function(e){return(e=utils.parseNumber(e))instanceof Error?e:Math.log((1+e)/(1-e))/2},exports.FISHERINV=function(e){if((e=utils.parseNumber(e))instanceof Error)return e;var t=Math.exp(2*e);return(t-1)/(t+1)},exports.FREQUENCY=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var r=e.length,o=t.length,n=[],l=0;l<=o;l++){n[l]=0;for(var s=0;s<r;s++)0===l?e[s]<=t[0]&&(n[0]+=1):l<o?e[s]>t[l-1]&&e[s]<=t[l]&&(n[l]+=1):l===o&&e[s]>t[o-1]&&(n[o]+=1)}return n},exports.LARGE=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t)?e:e.sort(function(e,t){return t-e})[t-1]},exports.MAX=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MAXA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.max.apply(Math,e)},exports.MIN=function(){var e=utils.numbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MINA=function(){var e=utils.arrayValuesToNumbers(utils.flatten(arguments));return 0===e.length?0:Math.min.apply(Math,e)},exports.MODE={},exports.MODE.MULT=function(){var e=utils.parseNumberArray(utils.flatten(arguments));if(e instanceof Error)return e;for(var t,r=e.length,o={},n=[],l=0,s=0;s<r;s++)o[t=e[s]]=o[t]?o[t]+1:1,o[t]>l&&(l=o[t],n=[]),o[t]===l&&(n[n.length]=t);return n},exports.MODE.SNGL=function(){var e=utils.parseNumberArray(utils.flatten(arguments));return e instanceof Error?e:exports.MODE.MULT(e).sort(function(e,t){return e-t})[0]},exports.PERCENTILE={},exports.PERCENTILE.EXC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var r=(e=e.sort(function(e,t){return e-t})).length;if(t<1/(r+1)||t>1-1/(r+1))return error.num;var o=t*(r+1)-1,n=Math.floor(o);return utils.cleanFloat(o===n?e[o]:e[n]+(o-n)*(e[n+1]-e[n]))},exports.PERCENTILE.INC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;var r=t*((e=e.sort(function(e,t){return e-t})).length-1),o=Math.floor(r);return utils.cleanFloat(r===o?e[r]:e[o]+(r-o)*(e[o+1]-e[o]))},exports.PERCENTRANK={},exports.PERCENTRANK.EXC=function(e,t,r){if(r=void 0===r?3:r,e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r))return error.value;e=e.sort(function(e,t){return e-t});for(var o=UNIQUE.apply(null,e),n=e.length,l=o.length,s=Math.pow(10,r),i=0,a=!1,u=0;!a&&u<l;)t===o[u]?(i=(e.indexOf(o[u])+1)/(n+1),a=!0):t>=o[u]&&(t<o[u+1]||u===l-1)&&(i=(e.indexOf(o[u])+1+(t-o[u])/(o[u+1]-o[u]))/(n+1),a=!0),u++;return Math.floor(i*s)/s},exports.PERCENTRANK.INC=function(e,t,r){if(r=void 0===r?3:r,e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r))return error.value;e=e.sort(function(e,t){return e-t});for(var o=UNIQUE.apply(null,e),n=e.length,l=o.length,s=Math.pow(10,r),i=0,a=!1,u=0;!a&&u<l;)t===o[u]?(i=e.indexOf(o[u])/(n-1),a=!0):t>=o[u]&&(t<o[u+1]||u===l-1)&&(i=(e.indexOf(o[u])+(t-o[u])/(o[u+1]-o[u]))/(n-1),a=!0),u++;return Math.floor(i*s)/s},exports.PERMUT=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:FACT(e)/FACT(e-t)},exports.PERMUTATIONA=function(e,t){return e=utils.parseNumber(e),t=utils.parseNumber(t),utils.anyIsError(e,t)?error.value:Math.pow(e,t)},exports.PHI=function(e){return(e=utils.parseNumber(e))instanceof Error?error.value:Math.exp(-.5*e*e)/SQRT2PI},exports.PROB=function(e,t,r,o){if(void 0===r)return 0;if(o=void 0===o?r:o,e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),r=utils.parseNumber(r),o=utils.parseNumber(o),utils.anyIsError(e,t,r,o))return error.value;if(r===o)return e.indexOf(r)>=0?t[e.indexOf(r)]:0;for(var n=e.sort(function(e,t){return e-t}),l=n.length,s=0,i=0;i<l;i++)n[i]>=r&&n[i]<=o&&(s+=t[e.indexOf(n[i])]);return s},exports.QUARTILE={},exports.QUARTILE.EXC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;switch(t){case 1:return exports.PERCENTILE.EXC(e,.25);case 2:return exports.PERCENTILE.EXC(e,.5);case 3:return exports.PERCENTILE.EXC(e,.75);default:return error.num}},exports.QUARTILE.INC=function(e,t){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;switch(t){case 1:return exports.PERCENTILE.INC(e,.25);case 2:return exports.PERCENTILE.INC(e,.5);case 3:return exports.PERCENTILE.INC(e,.75);default:return error.num}},exports.RANK={},exports.RANK.AVG=function(e,t,r){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;for(var o=(r=r||!1)?function(e,t){return e-t}:function(e,t){return t-e},n=(t=(t=utils.flatten(t)).sort(o)).length,l=0,s=0;s<n;s++)t[s]===e&&l++;return l>1?(2*t.indexOf(e)+l+1)/2:t.indexOf(e)+1},exports.RANK.EQ=function(e,t,r){if(e=utils.parseNumber(e),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t))return error.value;var o=(r=r||!1)?function(e,t){return e-t}:function(e,t){return t-e};return(t=t.sort(o)).indexOf(e)+1},exports.RSQ=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumberArray(utils.flatten(t)),utils.anyIsError(e,t)?error.value:Math.pow(exports.PEARSON(e,t),2)},exports.SMALL=function(e,t){return e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t)?e:e.sort(function(e,t){return e-t})[t-1]},exports.STANDARDIZE=function(e,t,r){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:(e-t)/r},exports.STDEV={},exports.STDEV.P=function(){var e=exports.VAR.P.apply(this,arguments);return Math.sqrt(e)},exports.STDEV.S=function(){var e=exports.VAR.S.apply(this,arguments);return Math.sqrt(e)},exports.STDEVA=function(){var e=exports.VARA.apply(this,arguments);return Math.sqrt(e)},exports.STDEVPA=function(){var e=exports.VARPA.apply(this,arguments);return Math.sqrt(e)},exports.VAR={},exports.VAR.P=function(){for(var e=utils.numbers(utils.flatten(arguments)),t=e.length,r=0,o=exports.AVERAGE(e),n=0;n<t;n++)r+=Math.pow(e[n]-o,2);return r/t},exports.VAR.S=function(){for(var e=utils.numbers(utils.flatten(arguments)),t=e.length,r=0,o=exports.AVERAGE(e),n=0;n<t;n++)r+=Math.pow(e[n]-o,2);return r/(t-1)},exports.VARA=function(){for(var e=utils.flatten(arguments),t=e.length,r=0,o=0,n=exports.AVERAGEA(e),l=0;l<t;l++){var s=e[l];r+="number"==typeof s?Math.pow(s-n,2):!0===s?Math.pow(1-n,2):Math.pow(0-n,2),null!==s&&o++}return r/(o-1)},exports.VARPA=function(){for(var e=utils.flatten(arguments),t=e.length,r=0,o=0,n=exports.AVERAGEA(e),l=0;l<t;l++){var s=e[l];r+="number"==typeof s?Math.pow(s-n,2):!0===s?Math.pow(1-n,2):Math.pow(0-n,2),null!==s&&o++}return r/o},exports.WEIBULL={},exports.WEIBULL.DIST=function(e,t,r,o){return e=utils.parseNumber(e),t=utils.parseNumber(t),r=utils.parseNumber(r),utils.anyIsError(e,t,r)?error.value:o?1-Math.exp(-Math.pow(e/r,t)):Math.pow(e,t-1)*Math.exp(-Math.pow(e/r,t))*t/Math.pow(r,t)},exports.Z={},exports.Z.TEST=function(e,t,r){if(e=utils.parseNumberArray(utils.flatten(e)),t=utils.parseNumber(t),utils.anyIsError(e,t))return error.value;r=r||exports.STDEV.S(e);var o=e.length;return 1-exports.NORM.S.DIST((exports.AVERAGE(e)-t)/(r/Math.sqrt(o)),!0)},exports}();for(var i=0;i<Object.keys(jexcel.methods).length;i++)for(var methods=jexcel.methods[Object.keys(jexcel.methods)[i]],j=0;j<Object.keys(methods).length;j++)"function"==typeof methods[Object.keys(methods)[j]]?window[Object.keys(methods)[j]]=methods[Object.keys(methods)[j]]:window[Object.keys(methods)[j]]=function(){return Object.keys(methods)[j]+"Not implemented"};"object"==typeof exports&&"undefined"!=typeof module&&(module.exports=jexcel);