/*
    *
    * Wijmo Library 5.20182.500
    * http://wijmo.com/
    *
    * Copyright(c) GrapeCity, Inc.  All rights reserved.
    *
    * Licensed under the GrapeCity Commercial License.
    * sales@wijmo.com
    * wijmo.com/products/wijmo-5/license/
    *
    */
var __extends=this&&this.__extends||function(){var e=Object.setPrototypeOf||{__proto__:[]}instanceof Array&&function(e,o){e.__proto__=o}||function(e,o){for(var t in o)o.hasOwnProperty(t)&&(e[t]=o[t])};return function(o,t){function l(){this.constructor=o}e(o,t),o.prototype=null===t?Object.create(t):(l.prototype=t.prototype,new l)}}();define(["require","exports","wijmo/wijmo.grid","wijmo/wijmo.xlsx","wijmo/wijmo","wijmo/wijmo.grid.xlsx"],function(e,o,t,l,r,n){"use strict";function s(){var e,o;return(e=window.wijmo)&&(o=e.grid)&&o.detail}function i(){var e,o;return(e=window.wijmo)&&(o=e.grid)&&o.multirow}Object.defineProperty(o,"__esModule",{value:!0});var a=n||o;window.wijmo=window.wijmo||{},window.wijmo.grid=window.wijmo.grid||{},window.wijmo.grid.xlsx=a;var d=function(){function e(){}return e.save=function(e,o,t){var l=this._saveFlexGridToWorkbook(e,o);return t&&l.save(t),l},e.saveAsync=function(e,o,t,l,r){var n=this._saveFlexGridToWorkbook(e,o);return n.saveAsync(t,l,r),n},e.load=function(e,o,t){var n=this;if(o instanceof Blob){var s=new FileReader;s.onload=function(){var o=l.Workbook._base64EncArr(new Uint8Array(s.result)),r=new l.Workbook;r.load(o),o=null,e.deferUpdate(function(){n._loadToFlexGrid(e,r,t),r=null})},s.readAsArrayBuffer(o)}else if(o instanceof l.Workbook)e.deferUpdate(function(){n._loadToFlexGrid(e,o,t),o=null});else{if(o instanceof ArrayBuffer)o=l.Workbook._base64EncArr(new Uint8Array(o));else if(!r.isString(o))throw"Invalid workbook.";var i=new l.Workbook;i.load(o),o=null,e.deferUpdate(function(){n._loadToFlexGrid(e,i,t),i=null})}},e.loadAsync=function(e,o,t,n,s){var i=this;if(o instanceof Blob){var a=new FileReader;a.onload=function(){var o=l.Workbook._base64EncArr(new Uint8Array(a.result)),r=new l.Workbook;r.loadAsync(o,function(l){o=null,r=null,e.deferUpdate(function(){i._loadToFlexGrid(e,l,t),n&&n(l),l=null})},s)},a.readAsArrayBuffer(o)}else if(o instanceof l.Workbook)e.deferUpdate(function(){i._loadToFlexGrid(e,o,t),n&&n(o),o=null});else{if(o instanceof ArrayBuffer)o=l.Workbook._base64EncArr(new Uint8Array(o));else if(!r.isString(o))throw"Invalid workbook.";(new l.Workbook).loadAsync(o,function(l){o=null,e.deferUpdate(function(){i._loadToFlexGrid(e,l,t),n&&n(l),l=null})},s)}},e._saveFlexGridToWorkbook=function(e,o){var n,s,i,a,d,u,c,f,h,p,g,m,w,y=new l.Workbook,b=new l.WorkSheet,_=(new l.WorkbookStyle,new l.WorkbookFrozenPane),x=!o||null==o.includeColumnHeaders||o.includeColumnHeaders,C=!(!o||null==o.includeRowHeaders)&&o.includeRowHeaders,k=!o||null==o.includeCellStyles||o.includeCellStyles,v=o?o.activeWorksheet:null,S=o?o.includeColumns:null,T=o?o.formatItem:null,W=0,R=0,A=0,F=0,B=[];if(null==this.hasCssText&&(this.hasCssText="cssText"in document.body.style),p=e.wj_sheetInfo,b.name=o?o.sheetName:"",b.visible=!o||!1!==o.sheetVisible,p&&p.tables&&p.tables.length>0)for(var H=0;H<p.tables.length;H++)b.tables.push(p.tables[H]);if(u=[],p||!k&&!T||((g=document.createElement("div")).style.visibility="hidden",g.setAttribute(t.FlexGrid._WJS_MEASURE,"true"),e.hostElement.appendChild(g)),C){for(f=0,c=0;c<e.rowHeaders.rows.length;c++)if(!(e.rowHeaders.rows[c].renderSize<=0)){for(u[f]=[],h=0;h<e.rowHeaders.columns.length;h++)i=e._getBindingColumn(e.rowHeaders,c,e.rowHeaders.columns[h]),a=this._getColumnSetting(i,h,e.columnHeaders.columns),u[f][h]=a,0===f&&((d=new l.WorkbookColumn)._deserialize(a),b._addWorkbookColumn(d,h));f++}F=h}if(e.columnHeaders.rows.length>0){for(f=0,c=0;c<e.columnHeaders.rows.length;c++)if(!(e.columnHeaders.rows[c].renderSize<=0)){for(u[f]||(u[f]=[]),h=0;h<e.columnHeaders.columns.length;h++)i=e._getBindingColumn(e.columnHeaders,c,e.columnHeaders.columns[h]),a=this._getColumnSetting(i,h,e.columnHeaders.columns),u[f][F+h]=a,0===f&&(S&&!S(i)||((d=new l.WorkbookColumn)._deserialize(a),b._addWorkbookColumn(d)));x&&(F=0,n={},s=new l.WorkbookRow,C&&(F=this._parseFlexGridRowToSheetRow(e.topLeftCells,n,c,0,u,k,g,B,!1,0,S,T)),this._parseFlexGridRowToSheetRow(e.columnHeaders,n,c,F,u,k,g,B,!1,0,S,T),n.cells.length>0&&(s._deserialize(n),b._addWorkbookRow(s,f))),f++}R=x?f:0}for(c=0;c<e.cells.rows.length;c++)F=0,n={},s=new l.WorkbookRow,(m=e.rows[c])instanceof t._NewRowTemplate||((w=m instanceof t.GroupRow)?W=r.tryCast(m,t.GroupRow).level:e.rows.maxGroupLevel>-1&&(W=e.rows.maxGroupLevel+1),C&&(F=this._parseFlexGridRowToSheetRow(e.rowHeaders,n,c,0,u,k,g,B,w,W,S,T)),this._parseFlexGridRowToSheetRow(e.cells,n,c,F,u,k,g,B,w,W,S,T),n.cells.length>0&&(s._deserialize(n),b._addWorkbookRow(s,R+c)));for(A=e.cells.rows.length,c=0;c<e.columnFooters.rows.length;c++)F=0,n={},s=new l.WorkbookRow,w=(m=e.columnFooters.rows[c])instanceof t.GroupRow,C&&(F=this._parseFlexGridRowToSheetRow(e.rowHeaders,n,c,0,u,k,g,B,w,0,S,T)),this._parseFlexGridRowToSheetRow(e.columnFooters,n,c,F,u,k,g,B,w,0,S,T),n.cells.length>0&&(s._deserialize(n),b._addWorkbookRow(s,R+A+c));return _.rows=x?e.frozenRows+R:e.frozenRows,_.columns=C?e.frozenColumns+F:e.frozenColumns,b.frozenPane=_,y._addWorkSheet(b),p||!k&&!T||(e.hostElement.removeChild(g),B.forEach(function(e){return e.forEach(function(e){e&&e.parentElement&&e.parentElement.removeChild(e)})})),y.activeWorksheet=v,y},e._loadToFlexGrid=function(e,o,n){var s,i,a,d,u,c,f,h,p,g,m,w,y,b,_,x,C,k,v,S,T,W,R,A,F,B,H,N,D,E,I,z,j=!n||null==n.includeColumnHeaders||n.includeColumnHeaders,G=!n||null==n.includeColumnHeaders||n.includeColumnHeaders,O=n&&null!=n.sheetIndex&&!isNaN(n.sheetIndex)?n.sheetIndex:0,L=n?n.sheetName:null,M=!n||n.sheetVisible,P=null!=e.wj_sheetInfo,V=0,U=0,X=!1,q={};if(e.itemsSource=null,e.columns.clear(),e.rows.clear(),e.frozenColumns=0,e.frozenRows=0,B={},H=[],U=0,a=[],N=[],O<0||O>=o.sheets.length)throw"The sheet index option is out of the sheet range of current workbook.";if(null!=L)for(s=0;s<o.sheets.length;s++)if(L===o.sheets[s].name){m=o.sheets[s];break}if(null!=(m=m||o.sheets[O]).rows){for(j&&(U=1,m.rows.length<=1&&(G=!1,U=0),f=m.rows[0]),y=this._getColumnCount(m.rows),w=this._getRowCount(m.rows,y),k=m.summaryBelow,i=m.columns,V=0;V<y;V++)e.columns.push(new t.Column),i[V]&&(isNaN(+i[V].width)||(e.columns[V].width=+i[V].width),i[V].visible||null==i[V].visible||(e.columns[V].visible=!!i[V].visible),i[V].style&&i[V].style.wordWrap&&(e.columns[V].wordWrap=i[V].style.wordWrap));for(;U<w;U++){if(b=!1,z=null,g=m.rows[U])for(x=U+1;x<m.rows.length;){if(C=m.rows[x]){(isNaN(g.groupLevel)&&!isNaN(C.groupLevel)||!isNaN(g.groupLevel)&&g.groupLevel<C.groupLevel)&&(b=!0);break}x++}for(b&&!k?(S&&(S.isCollapsed=X),(S=new t.GroupRow).isReadOnly=!1,X=null!=g.collapsed&&g.collapsed,S.level=isNaN(g.groupLevel)?0:g.groupLevel,q[S.level]=X,this._checkParentCollapsed(q,S.level)&&S._setFlag(t.RowColFlags.ParentCollapsed,!0),e.rows.push(S)):(v=new t.Row,g&&this._checkParentCollapsed(q,g.groupLevel)&&v._setFlag(t.RowColFlags.ParentCollapsed,!0),e.rows.push(v)),g&&g.height&&!isNaN(g.height)&&(e.rows[G?U-1:U].height=g.height),V=0;V<y;V++)if(g){if(_=g.cells[V],(R=_?_.formula:null)&&"="!==R[0]&&(R="="+R),_&&_.textRuns&&_.textRuns.length>0?(e.rows[G?U-1:U].isContentHtml=!0,e.setCellData(G?U-1:U,V,this._parseTextRunsToHTML(_.textRuns))):e.setCellData(G?U-1:U,V,R&&P?R:this._getItemValue(_)),b||this._setColumn(a,V,_),A=U*y+V,F=_?_.style:null,D=l.Workbook._parseExcelFormat(_),F){if(z=null==z?!!F.wordWrap:z&&!!F.wordWrap,E=this._getItemType(_),F.hAlign)I=l.Workbook._parseHAlignToString(r.asEnum(F.hAlign,l.HAlign));else switch(E){case r.DataType.Number:I="right";break;case r.DataType.Boolean:I="center";break;default:I=D&&0===D.search(/[n,c,p]/i)?"right":"left"}B[A]={fontWeight:F.font&&F.font.bold?"bold":"none",fontStyle:F.font&&F.font.italic?"italic":"none",textDecoration:F.font&&F.font.underline?"underline":"none",textAlign:I,fontFamily:F.font&&F.font.family?F.font.family:"",fontSize:F.font&&F.font.size?F.font.size+"px":"",color:F.font&&F.font.color?F.font.color:"",backgroundColor:F.fill&&F.fill.color?F.fill.color:"",whiteSpace:F.wordWrap?"pre-wrap":"normal",format:D},F.borders&&(F.borders.left&&(this._parseBorderStyle(F.borders.left.style,"Left",B[A]),B[A].borderLeftColor=F.borders.left.color),F.borders.right&&(this._parseBorderStyle(F.borders.right.style,"Right",B[A]),B[A].borderRightColor=F.borders.right.color),F.borders.top&&(this._parseBorderStyle(F.borders.top.style,"Top",B[A]),B[A].borderTopColor=F.borders.top.color),F.borders.bottom&&(this._parseBorderStyle(F.borders.bottom.style,"Bottom",B[A]),B[A].borderBottomColor=F.borders.bottom.color)),F.font&&-1===N.indexOf(F.font.family)&&N.push(F.font.family)}_&&r.isNumber(_.rowSpan)&&_.rowSpan>0&&r.isNumber(_.colSpan)&&_.colSpan>0&&(_.rowSpan>1||_.colSpan>1)&&H.push(new t.CellRange(U,V,U+_.rowSpan-1,V+_.colSpan-1))}g&&(this._checkParentCollapsed(q,g.groupLevel)||g.visible||null==g.visible||(e.rows[G?U-1:U].visible=g.visible),e.rows[G?U-1:U].wordWrap=!!g.style&&!!g.style.wordWrap||!!z)}for(S&&(S.isCollapsed=X),m.frozenPane&&(T=m.frozenPane.columns,r.isNumber(T)&&!isNaN(T)&&(e.frozenColumns=T),W=m.frozenPane.rows,r.isNumber(W)&&!isNaN(W)&&(e.frozenRows=G&&W>0?W-1:W)),V=0;V<e.columnHeaders.columns.length;V++)d=a[V],(u=e.columns[V]).isRequired=!1,G&&((h=f?f.cells[V]:null)&&h.value?(p=l.Workbook._parseExcelFormat(h),c=r.Globalize.format(h.value,p)):c=""),u.header=c,d&&(d.dataType===r.DataType.Boolean&&(u.dataType=d.dataType),u.format=d.format,u.align=d.hAlign,u.wordWrap=u.wordWrap||!!d.wordWrap);P&&(e.wj_sheetInfo.name=m.name,e.wj_sheetInfo.visible=!0===M||!1!==m.visible,e.wj_sheetInfo.styledCells=B,e.wj_sheetInfo.mergedRanges=H,e.wj_sheetInfo.fonts=N,e.wj_sheetInfo.tables=m.tables)}},e._parseFlexGridRowToSheetRow=function(e,o,n,a,d,c,f,h,p,g,m,w){var y,b,_,x,C,k,v,S,T,W,R,A,F,B,H,N,D,E,I,z,j,G,O,L,M,P,V,U,X=!1,q=!1;for(E=(y=e.grid).wj_sheetInfo,null==(b=e.rows[n]).recordIndex?(G=0,e.cellType===t.CellType.ColumnHeader&&e.rows.length>1&&(G=n===d.length?n-1:n)):G=b.recordIndex,o.cells||(o.cells=[]),o.visible=b.isVisible,o.height=b.renderHeight||e.rows.defaultSize,o.groupLevel=g,p&&(o.collapsed=b.isCollapsed),b.wordWrap&&(o.style={wordWrap:b.wordWrap}),(b.constructor===t.Row||b.constructor===t._NewRowTemplate||s()&&b.constructor===s().DetailRow||i()&&b.constructor===i()._MultiRow)&&(X=!0),s()&&b.constructor===s().DetailRow&&(q=!0),x=0;x<e.columns.length;x++)if(C=null,D=1,N=1,V=0,j=!1,B=null,M=null,L=null,S=null,z=y._getBindingColumn(e,n,e.columns[x]),H=null,E&&e===y.cells?(F=n*e.columns.length+x,E.mergedRanges&&(H=this._getMergedRange(n,x,E.mergedRanges)),E.styledCells&&(B=E.styledCells[F])):c&&(L=this._getMeasureCell(e,x,f,h),B=(H=y.getMergedRange(e,n,x,!1))?this._getCellStyle(e,L,H.bottomRow,H.rightCol)||{}:this._getCellStyle(e,L,n,x)||{}),H||(H=y.getMergedRange(e,n,x,!1)),H?n===H.topRow&&x===H.leftCol&&(N=H.bottomRow-H.topRow+1,D=this._getColSpan(e,H,m),j=!0):j=!0,!m||m(z)){if(_=d[G]?d[G][x+a]:null,X||p?(v=j?e.getCellData(n,x,!0):null,T=j?e.getCellData(n,x,!1):null,R=!1,v&&r.isString(v)&&v.length>1&&"="===v[0]&&(R=!0),I=r.isDate(T),B&&B.format?(C=B.format,/[hsmyt\:]/i.test(C)&&(I=!0),k=l.Workbook._parseCellFormat(B.format,I)):_&&_.style&&_.style.format?(C=z.format,k=_.style.format):k=null,k||(I?k="m/d/yyyy":r.isNumber(T)&&!z.dataMap?k=r.isInt(T)?"#,##0":"#,##0.00":R?(A=v.toLowerCase()).indexOf("now()")>-1?(k="m/d/yyyy h:mm",I=!0):A.indexOf("today()")>-1||A.indexOf("date(")>-1?(k="m/d/yyyy",I=!0):A.indexOf("time(")>-1&&(k="h:mm AM/PM",I=!0):k="General")):(v=j?y.columnHeaders.getCellData(0,x,!0):null,k="General"),r.isString(v)&&-1!==v.indexOf("<span")&&(S=this._parseToTextRuns(v),v=null),M=this._parseCellStyle(B)||{},e===y.cells&&p&&b.hasChildren&&x===y.columns.firstVisibleIndex){if(v?W=v:j&&(W=b.getGroupHeader().replace(/<\/?\w+>/g,"").replace(/&#39;/g,"'")),null==W&&!B)continue;!(I=r.isDate(W))&&C&&"d"===C.toLowerCase()&&r.isInt(W)&&(k="0"),W=r.isString(W)?l.Workbook._unescapeXML(W):W,x===y.columns.firstVisibleIndex&&y.treeIndent&&(V=g),O={value:W,isDate:I,formula:R?this._parseToExcelFormula(v,I):null,colSpan:D,rowSpan:N,style:this._extend(M,{format:k,font:{bold:!0},hAlign:l.HAlign.Left,indent:V}),textRuns:S}}else v=r.isString(v)?l.Workbook._unescapeXML(v):v,T=r.isString(T)?l.Workbook._unescapeXML(T):T,!I&&C&&"d"===C.toLowerCase()&&r.isInt(T)&&(k="0"),P=M&&M.hAlign?M.hAlign:_&&_.style&&null!=_.style.hAlign?r.asEnum(_.style.hAlign,l.HAlign,!0):r.isDate(T)?l.HAlign.Left:l.HAlign.General,x!==y.columns.firstVisibleIndex||!y.treeIndent||P!==l.HAlign.Left&&P!==l.HAlign.General||(V=g),O={value:R?null:"General"===k?v:T,isDate:I,formula:R?this._parseToExcelFormula(v,I):null,colSpan:x<y.columns.firstVisibleIndex?1:D,rowSpan:N,style:this._extend(M,{format:k,hAlign:P,vAlign:N>1?e===y.cells||!1===y.centerHeadersVertically?l.VAlign.Top:l.VAlign.Center:null,indent:V}),textRuns:S},q&&(U=e.getCellElement(n,x))&&U.appendChild(b.detail);w&&w(new u(e,new t.CellRange(n,x),L,f,h,O)),o.cells.push(O)}return a+x},e._parseCellStyle=function(e,o){if(void 0===o&&(o=!1),null==e)return null;var t=e.fontSize;t=t?+t.substring(0,t.indexOf("px")):null,isNaN(t)&&(t=null);var r=e.fontWeight;r="bold"===r||+r>=700;var n="italic"===e.fontStyle,s=e.textDecorationStyle;null==s&&(s=e.textDecoration),s="underline"===s;var i=e.whiteSpace;return i=!!i&&i.indexOf("pre")>-1,{font:{bold:r,italic:n,underline:s,family:this._parseToExcelFontFamily(e.fontFamily),size:t,color:e.color},fill:{color:e.backgroundColor},borders:this._parseBorder(e,o),hAlign:l.Workbook._parseStringToHAlign(e.textAlign),wordWrap:i}},e._parseBorder=function(e,o){var t={};return t.left=this._parseEgdeBorder(e,"Left"),t.right=this._parseEgdeBorder(e,"Right"),t.top=this._parseEgdeBorder(e,"Top"),t.bottom=this._parseEgdeBorder(e,"Bottom"),o&&(t.vertical=this._parseEgdeBorder(e,"Vertical"),t.horizontal=this._parseEgdeBorder(e,"Horizontal")),t},e._parseEgdeBorder=function(e,o){var t,r=e["border"+o+"Style"],n=e["border"+o+"Width"];if(n&&n.length>2&&(n=+n.substring(0,n.length-2)),r&&"none"!==r&&"hidden"!==r){switch(t={},r=r.toLowerCase()){case"dotted":t.style=n>1?l.BorderStyle.MediumDashDotted:l.BorderStyle.Dotted;break;case"dashed":t.style=n>1?l.BorderStyle.MediumDashed:l.BorderStyle.Dashed;break;case"double":t.style=l.BorderStyle.Double;break;default:t.style=n>2?l.BorderStyle.Thick:n>1?l.BorderStyle.Medium:l.BorderStyle.Thin}t.color=e["border"+o+"Color"]}return t},e._parseBorderStyle=function(e,o,t){var r="border"+o+"Style",n="border"+o+"Width";switch(e){case l.BorderStyle.Dotted:case l.BorderStyle.Hair:t[r]="dotted",t[n]="1px";break;case l.BorderStyle.Dashed:case l.BorderStyle.ThinDashDotDotted:case l.BorderStyle.ThinDashDotted:t[r]="dashed",t[n]="1px";break;case l.BorderStyle.MediumDashed:case l.BorderStyle.MediumDashDotDotted:case l.BorderStyle.MediumDashDotted:case l.BorderStyle.SlantedMediumDashDotted:t[r]="dashed",t[n]="2px";break;case l.BorderStyle.Double:t[r]="double",t[n]="3px";break;case l.BorderStyle.Medium:t[r]="solid",t[n]="2px";break;default:t[r]="solid",t[n]="1px"}},e._parseToExcelFontFamily=function(e){var o;return e&&(o=e.split(","))&&o.length>0&&(e=o[0].replace(/\"|\'/g,"")),e},e._parseToExcelFormula=function(e,o){var t,r,n,s,i,a,d,u=/(floor|ceiling)\([+-]?\d+\.?\d*\)/gi,c=/text\(\"?\w+\"?\s*\,\s*\"\w+\"\)/gi,f=/\"?\w+\"?\s*\,\s*\"(\w+)\"/i;if(t=e.match(u))for(i=0;i<t.length;i++)d=(a=t[i]).substring(0,a.lastIndexOf(")"))+", 1)",e=e.replace(a,d);if(t=null,t=e.match(c))for(i=0;i<t.length;i++)(r=(a=t[i]).match(f))&&2===r.length&&(n=r[1],/^d{1,4}?$/.test(n)||(s=l.Workbook._parseCellFormat(n,o),d=a.replace(n,s),e=e.replace(a,d)));return e},e._parseToTextRuns=function(e){var o,t,l,r=e.split("<span "),n=[];for(o=0;o<r.length;o++)l=-1!==(t=r[o]).indexOf("</span>")?{text:t.substring(t.indexOf(">")+1,t.indexOf("</span>")),font:this._parseToTextRunFont(t.substring(t.indexOf('style="')+7,t.indexOf(';"')))}:{text:t},n.push(l);return n},e._parseToTextRunFont=function(e){var o,t,l,r,n,s,i,a,d,u=e.split(";");if(u.length>0){for(o=0;o<u.length;o++)if(2===(t=u[o].split(":")).length)switch(t[1]=t[1].trim(),t[0]){case"font-size":s=+t[1].substring(0,t[1].indexOf("px")),isNaN(s)&&(s=null);break;case"font-weight":l="bold"===t[1]||+t[1]>=700;break;case"font-style":r="italic"===t[1];break;case"text-decoration-style":case"text-decoration":n="underline"===t[1];break;case"font-family":i=this._parseToExcelFontFamily(t[1]);break;case"color":a=t[1]}d={bold:l,italic:r,underline:n,family:i,size:s,color:a}}return d},e._getMeasureCell=function(e,o,t,l){var r=l[e.cellType],n=r&&r[o],s=null==n;if(n){if(this.hasCssText){n.style;n.style.cssText="",n.style.visibility="hidden"}}else r||(l[e.cellType]=r=[]),r[o]=n=t.cloneNode();return!s&&n.parentElement||(e.hostElement.children.length>0?e.hostElement.children[0].appendChild(n):e.hostElement.appendChild(n)),n},e._getColumnSetting=function(e,o,t){var n;return n=null!=e.colspan?this._getColumnRenderWidth(o,t):e.renderWidth,n=n||t.defaultSize,{autoWidth:!0,width:n,visible:e.visible,style:{format:e.format?l.Workbook._parseCellFormat(e.format,e.dataType===r.DataType.Date):"",hAlign:l.Workbook._parseStringToHAlign(this._toExcelHAlign(e.getAlignment())),wordWrap:e.wordWrap}}},e._toExcelHAlign=function(e){return(e=e?e.trim().toLowerCase():e)?e.indexOf("center")>-1?"center":e.indexOf("right")>-1||e.indexOf("end")>-1?"right":e.indexOf("justify")>-1?"justify":"left":e},e._getColumnCount=function(e){for(var o,t=0,l=0,n=0;n<e.length;n++)(o=e[n]&&e[n].cells?e[n].cells:[])&&o.length>0&&(l=o.length,r.isInt(o[l-1].colSpan)&&o[l-1].colSpan>1&&(l=l+o[l-1].colSpan-1),l>t&&(t=l));return t},e._getRowCount=function(e,o){for(var t,l,n,s=e.length,i=s-1,a=0;a<o;a++)e:for(;i>=0;i--)if(t=e[i],l=t&&t.cells?t.cells:[],(n=l[a])&&(null!=n.value&&""!==n.value||r.isInt(n.rowSpan)&&n.rowSpan>1)){r.isInt(n.rowSpan)&&n.rowSpan>1&&i+n.rowSpan>s&&(s=i+n.rowSpan);break e}return s},e._numAlpha=function(e){var o=Math.floor(e/26)-1;return(o>-1?this._numAlpha(o):"")+String.fromCharCode(65+e%26)},e._getItemType=function(e){return null==e||null==e.value||isNaN(e.value)?null:r.getType(e.value)},e._setColumn=function(e,o,t){var n,s,i,a=e[o];a?(n=this._getItemType(t),a.dataType!==n&&a.dataType===r.DataType.Boolean&&n!==r.DataType.Boolean&&(a.dataType=n),!t||null==t.value||r.isString(t.value)&&r.isNullOrWhiteSpace(t.value)||(s=l.Workbook._parseExcelFormat(t))&&a.format!==s&&"General"!==s&&(a.format=s),t&&t.style&&(t.style.hAlign&&(i=l.Workbook._parseHAlignToString(r.asEnum(t.style.hAlign,l.HAlign))),null==a.wordWrap?a.wordWrap=!!t.style.wordWrap:a.wordWrap=a.wordWrap&&!!t.style.wordWrap),i||n!==r.DataType.Number||(i="right"),a.hAlign=i):e[o]={dataType:this._getItemType(t),format:l.Workbook._parseExcelFormat(t),hAlign:"",wordWrap:null}},e._getItemValue=function(e){if(null==e||null==e.value)return null;var o=e.value;return r.isNumber(o)&&isNaN(o)?"":o instanceof Date&&isNaN(o.getTime())?"":o},e._getCellStyle=function(e,o,t,l){try{e.grid.cellFactory.updateCell(e,t,l,o),o.className=o.className.replace("wj-state-selected",""),o.className=o.className.replace("wj-state-multi-selected","")}catch(e){return null}return window.getComputedStyle(o)},e._parseTextRunsToHTML=function(e){var o,t,l,r;for(l="",r=0;r<e.length;r++)l+=(t=(o=e[r]).font)?'<span style="'+(t.bold?"font-weight: bold;":"")+(t.italic?"font-style: italic;":"")+(t.underline?"text-decoration: underline;":"")+(t.family?"font-family: "+t.family+";":"")+(null!=t.size?"font-size: "+t.size+"px;":"")+(t.color?"color: "+t.color+";":"")+'">'+o.text+"</span>":o.text;return l},e._extend=function(e,o){for(var t in o){var l=o[t];r.isObject(l)&&e[t]?r.copy(e[t],l):e[t]=l}return e},e._checkParentCollapsed=function(e,o){var t=!1;return Object.keys(e).forEach(function(l){!0===e[l]&&!1===t&&!isNaN(o)&&+l<o&&(t=!0)}),t},e._getColSpan=function(e,o,t){for(var l=0,r=o.leftCol;r<=o.rightCol;r++)t&&!t(e.columns[r])||l++;return l},e._getColumnRenderWidth=function(e,o){var t;return e>=o.length?0:null!=(t=o[e]).renderWidth?t.renderWidth:o.defaultSize},e._getMergedRange=function(e,o,t){var l,r;for(l=0;l<t.length;l++)if(r=t[l],e>=r.topRow&&e<=r.bottomRow&&o>=r.leftCol&&o<=r.rightCol)return r;return null},e}();o.FlexGridXlsxConverter=d;var u=function(e){function o(o,t,l,r,n,s){var i=e.call(this,o,t)||this;return i._cell=l,i._patternCell=r,i._xlsxCell=s,i._cellsCache=n,i}return __extends(o,e),Object.defineProperty(o.prototype,"cell",{get:function(){return this._cell},enumerable:!0,configurable:!0}),Object.defineProperty(o.prototype,"xlsxCell",{get:function(){return this._xlsxCell},set:function(e){this._xlsxCell=e},enumerable:!0,configurable:!0}),o.prototype.getFormattedCell=function(){return this._cell||(this._cell=d._getMeasureCell(this.panel,this.col,this._patternCell,this._cellsCache),d._getCellStyle(this.panel,this._cell,this.row,this.col)),this._cell},o}(t.CellRangeEventArgs);o.XlsxFormatItemEventArgs=u});