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