Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

excel-builder-vanilla

Package Overview
Dependencies
Maintainers
1
Versions
14
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

excel-builder-vanilla - npm Package Compare versions

Comparing version 3.0.0 to 3.0.1

2

dist/excel-builder.iife.js

@@ -1,3 +0,3 @@

var ExcelBuilder=function(p,S){"use strict";var ne=Object.defineProperty;var le=(p,S,T)=>S in p?ne(p,S,{enumerable:!0,configurable:!0,writable:!0,value:T}):p[S]=T;var s=(p,S,T)=>(le(p,typeof S!="symbol"?S+"":S,T),T);const T={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_=h=>(typeof h!="string"&&(h=`${h}`),h.replace(/[&<>"']/g,e=>T[e]));function E(h){const e=typeof h;return h!=null&&(e==="object"||e==="function")}function B(h){if(typeof h!="object"||h===null||Object.prototype.toString.call(h)!=="[object Object]")return!1;const e=Object.getPrototypeOf(h);if(e===null)return!0;const t=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Function.prototype.call(t)===Function.prototype.call(h)}function F(h){return h!=null&&typeof h.valueOf()=="string"}function j(h,e){return e.reduce((t,i)=>(h!=null&&h.hasOwnProperty(i)&&(t[i]=h[i]),t),{})}const M={};function b(h="$lodash$"){M[h]||(M[h]=0);const e=++M[h];return h==="$lodash$"?`${e}`:`${h}${e}`}class P{constructor(e,t){s(this,"documentElement");this.documentElement=this.createElement(t),this.documentElement.setAttribute("xmlns",e)}createElement(e){return new R({nodeName:e})}createTextNode(e){return new W(e)}toString(){return this.documentElement.toString()}}s(P,"Node",{Create:e=>{switch(e.type){case"XML":return new R(e);case"TEXT":return new W(e.nodeValue);default:return null}}});class W{constructor(e){s(this,"nodeValue");this.nodeValue=e}toJSON(){return{nodeValue:this.nodeValue,type:"TEXT"}}toString(){return _(this.nodeValue)}}class R{constructor(e){s(this,"nodeName","");s(this,"children");s(this,"nodeValue");s(this,"attributes");s(this,"firstChild");if(this.nodeName=e.nodeName,this.children=[],this.nodeValue=e.nodeValue||"",this.attributes={},e.children)for(let t=0,i=e.children.length;t<i;t++)this.appendChild(P.Node.Create(e.children[t]));if(e.attributes)for(const t in e.attributes)e.attributes.hasOwnProperty(t)&&this.setAttribute(t,e.attributes[t])}toString(){let e=`<${this.nodeName}`;for(const i in this.attributes)this.attributes.hasOwnProperty(i)&&(e=`${e} ${i}="${_(this.attributes[i])}"`);let t="";for(let i=0,r=this.children.length;i<r;i++)t+=this.children[i].toString();return t?e+=`>${t}</${this.nodeName}>`:e+="/>",e}toJSON(){const e=[];for(let t=0,i=this.children.length;t<i;t++)e.push(this.children[t].toJSON());return{nodeName:this.nodeName,children:e,nodeValue:this.nodeValue,attributes:this.attributes,type:"XML"}}setAttribute(e,t){if(t===null){delete this.attributes[e],delete this[e];return}this.attributes[e]=t,this[e]=t}appendChild(e){this.children.push(e),this.firstChild=this.children[0]}cloneNode(e){return new R(this.toJSON())}}const x=class x{static uniqueId(e){return x._idSpaces[e]||(x._idSpaces[e]=1),x._idSpaces[e]++}static createXmlDoc(e,t){return new P(e||null,t)}static createElement(e,t,i){const r=e.createElement(t);i=i||[];let n=i.length;for(;n--;)r.setAttribute(i[n][0],i[n][1]);return r}static setAttributesOnDoc(e,t){for(let[i,r]of Object.entries(t)){if(B(r))if(r.v!==null&&r.v!==void 0)switch(r.type){case Boolean:r=r.v?"1":"0";break}else r=null;r!=null&&e.setAttribute(i,r)}}static positionToLetterRef(e,t){let i=1,r,n=e,o="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";if(x.LETTER_REFS[e])return x.LETTER_REFS[e].concat(t);for(;n>0;)n-=Math.pow(26,i-1),r=n%Math.pow(26,i),n-=r,r=r/Math.pow(26,i-1),o=a.charAt(r)+o,i+=1;return x.LETTER_REFS[e]=o,o.concat(String(t))}};s(x,"_idSpaces",{}),s(x,"LETTER_REFS",{}),s(x,"schemas",{worksheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",sharedStrings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",stylesheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",relationships:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",relationshipPackage:"http://schemas.openxmlformats.org/package/2006/relationships",contentTypes:"http://schemas.openxmlformats.org/package/2006/content-types",spreadsheetml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",markupCompat:"http://schemas.openxmlformats.org/markup-compatibility/2006",x14ac:"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",package:"http://schemas.openxmlformats.org/package/2006/relationships",table:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",spreadsheetDrawing:"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",drawing:"http://schemas.openxmlformats.org/drawingml/2006/main",drawingRelationship:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"});let l=x;class I{constructor(e){s(this,"x",null);s(this,"y",null);s(this,"width",null);s(this,"height",null);e&&(this.setPos(e.x,e.y),this.setDimensions(e.width,e.height))}setPos(e,t){this.x=e,this.y=t}setDimensions(e,t){this.width=e,this.height=t}toXML(e,t){const i=l.createElement(e,"xdr:absoluteAnchor"),r=l.createElement(e,"xdr:pos");r.setAttribute("x",this.x),r.setAttribute("y",this.y),i.appendChild(r);const n=l.createElement(e,"xdr:ext");return n.setAttribute("cx",this.width),n.setAttribute("cy",this.height),i.appendChild(n),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class G{}class D{constructor(e){s(this,"x",null);s(this,"y",null);s(this,"xOff",null);s(this,"yOff",null);s(this,"width",null);s(this,"height",null);e&&(this.setPos(e.x,e.y,e.xOff,e.yOff),this.setDimensions(e.width,e.height))}setPos(e,t,i,r){this.x=e,this.y=t,i!==void 0&&(this.xOff=i),r!==void 0&&(this.yOff=r)}setDimensions(e,t){this.width=e,this.height=t}toXML(e,t){const i=l.createElement(e,"xdr:oneCellAnchor"),r=l.createElement(e,"xdr:from"),n=l.createElement(e,"xdr:col");n.appendChild(e.createTextNode(String(this.x)));const o=l.createElement(e,"xdr:colOff");o.appendChild(e.createTextNode(String(this.xOff||0)));const a=l.createElement(e,"xdr:row");a.appendChild(e.createTextNode(String(this.y)));const d=l.createElement(e,"xdr:rowOff");d.appendChild(e.createTextNode(String(this.yOff||0))),r.appendChild(n),r.appendChild(o),r.appendChild(a),r.appendChild(d),i.appendChild(r);const m=l.createElement(e,"xdr:ext");return m.setAttribute("cx",String(this.width)),m.setAttribute("cy",String(this.height)),i.appendChild(m),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class z{constructor(e){s(this,"from",{xOff:0,yOff:0});s(this,"to",{xOff:0,yOff:0});e&&(this.setFrom(e.from.x,e.from.y,e.to.xOff,e.to.yOff),this.setTo(e.to.x,e.to.y,e.to.xOff,e.to.yOff))}setFrom(e,t,i,r){this.from.x=e,this.from.y=t,i!==void 0&&(this.from.xOff=i),r!==void 0&&(this.from.yOff=i)}setTo(e,t,i,r){this.to.x=e,this.to.y=t,i!==void 0&&(this.to.xOff=i),r!==void 0&&(this.to.yOff=i)}toXML(e,t){const i=l.createElement(e,"xdr:twoCellAnchor"),r=l.createElement(e,"xdr:from"),n=l.createElement(e,"xdr:col");n.appendChild(e.createTextNode(this.from.x));const o=l.createElement(e,"xdr:colOff");o.appendChild(e.createTextNode(this.from.xOff));const a=l.createElement(e,"xdr:row");a.appendChild(e.createTextNode(this.from.y));const d=l.createElement(e,"xdr:rowOff");d.appendChild(e.createTextNode(this.from.yOff)),r.appendChild(n),r.appendChild(o),r.appendChild(a),r.appendChild(d);const m=l.createElement(e,"xdr:to"),f=l.createElement(e,"xdr:col");f.appendChild(e.createTextNode(this.to.x));const k=l.createElement(e,"xdr:colOff");k.appendChild(e.createTextNode(this.from.xOff));const N=l.createElement(e,"xdr:row");N.appendChild(e.createTextNode(this.to.y));const v=l.createElement(e,"xdr:rowOff");return v.appendChild(e.createTextNode(this.from.yOff)),m.appendChild(f),m.appendChild(k),m.appendChild(N),m.appendChild(v),i.appendChild(r),i.appendChild(m),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class q{constructor(){s(this,"anchor");s(this,"id",b("Drawing"))}get AbsoluteAnchor(){return I}get Chart(){return G}get OneCellAnchor(){return D}get TwoCellAnchor(){return z}createAnchor(e,t){switch(t=t||{},t.drawing=this,e){case"absoluteAnchor":this.anchor=new I(t);break;case"oneCellAnchor":this.anchor=new D(t);break;case"twoCellAnchor":this.anchor=new z(t);break}return this.anchor}}class Q extends q{constructor(){super();s(this,"media",null);s(this,"id",b("Picture"));s(this,"pictureId",l.uniqueId("Picture"));s(this,"fill",{});s(this,"mediaData",null);s(this,"description","");this.id=b("Picture"),this.pictureId=l.uniqueId("Picture")}setMedia(t){this.mediaData=t}setDescription(t){this.description=t}setFillType(t){this.fill.type=t}setFillConfig(t){Object.assign(this.fill,t)}getMediaType(){return"image"}getMediaData(){return this.mediaData}setRelationshipId(t){this.mediaData.rId=t}toXML(t){const i=l.createElement(t,"xdr:pic"),r=l.createElement(t,"xdr:nvPicPr"),n=l.createElement(t,"xdr:cNvPr",[["id",this.pictureId],["name",this.mediaData.fileName],["descr",this.description||""]]);r.appendChild(n);const o=l.createElement(t,"xdr:cNvPicPr");o.appendChild(l.createElement(t,"a:picLocks",[["noChangeAspect","1"],["noChangeArrowheads","1"]])),r.appendChild(o),i.appendChild(r);const a=l.createElement(t,"xdr:blipFill");a.appendChild(l.createElement(t,"a:blip",[["xmlns:r",l.schemas.relationships],["r:embed",this.mediaData.rId]])),a.appendChild(l.createElement(t,"a:srcRect"));const d=l.createElement(t,"a:stretch");d.appendChild(l.createElement(t,"a:fillRect")),a.appendChild(d),i.appendChild(a);const m=l.createElement(t,"xdr:spPr",[["bwMode","auto"]]),f=l.createElement(t,"a:xfrm");m.appendChild(f);const k=l.createElement(t,"a:prstGeom",[["prst","rect"]]);return m.appendChild(k),i.appendChild(m),this.anchor.toXML(t,i)}}const A={};class O{constructor(){s(this,"relations",{});s(this,"lastId",1);b("rId")}importData(e){this.relations=e.relations,this.lastId=e.lastId}exportData(){return{relations:this.relations,lastId:this.lastId}}addRelation(e,t){return this.relations[e.id]={id:b("rId"),schema:l.schemas[t],object:e},this.relations[e.id].id}getRelationshipId(e){return this.relations[e.id]?this.relations[e.id].id:null}toXML(){const e=l.createXmlDoc(l.schemas.relationshipPackage,"Relationships"),t=e.documentElement;for(const[i,r]of Object.entries(this.relations)){const n=l.createElement(e,"Relationship",[["Id",r.id],["Type",r.schema],["Target",r.object.target||A[i]]]);r.object.targetMode&&n.setAttribute("TargetMode",r.object.targetMode),t.appendChild(n)}return e}}class Y{constructor(){s(this,"drawings",[]);s(this,"relations",new O);s(this,"id",b("Drawings"))}addDrawing(e){this.drawings.push(e)}getCount(){return this.drawings.length}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetDrawing,"xdr:wsDr"),t=e.documentElement;t.setAttribute("xmlns:a",l.schemas.drawing),t.setAttribute("xmlns:r",l.schemas.relationships),t.setAttribute("xmlns:xdr",l.schemas.spreadsheetDrawing);for(let i=0,r=this.drawings.length;i<r;i++){let n=this.relations.getRelationshipId(this.drawings[i].getMediaData());n||(n=this.relations.addRelation(this.drawings[i].getMediaData(),this.drawings[i].getMediaType())),this.drawings[i].setRelationshipId(n),t.appendChild(this.drawings[i].toXML(e))}return e}}class H{constructor(){s(this,"state",null);s(this,"xSplit",null);s(this,"ySplit",null);s(this,"activePane","bottomRight");s(this,"topLeftCell",null);s(this,"_freezePane")}freezePane(e,t,i){this._freezePane={xSplit:e,ySplit:t,cell:i}}exportXML(e){const t=e.createElement("pane");return this.state!==null&&(t.setAttribute("xSplit",this._freezePane.xSplit),t.setAttribute("ySplit",this._freezePane.ySplit),t.setAttribute("topLeftCell",this._freezePane.cell),t.setAttribute("activePane","bottomRight"),t.setAttribute("state","frozen")),t}}class ee{static pixelsToEMUs(e){return Math.round(e*914400/96)}}class ${constructor(){s(this,"strings",{});s(this,"stringArray",[]);s(this,"id",b("SharedStrings"))}addString(e){return this.strings[e]=this.stringArray.length,this.stringArray[this.stringArray.length]=e,this.strings[e]}exportData(){return this.strings}toXML(){var a;const e=l.createXmlDoc(l.schemas.spreadsheetml,"sst"),t=e.documentElement;this.stringArray.reverse();let i=this.stringArray.length;t.setAttribute("count",i),t.setAttribute("uniqueCount",i);const r=e.createElement("si"),n=e.createElement("t");n.appendChild(e.createTextNode("--placeholder--")),r.appendChild(n);const o=this.stringArray;for(;i--;){const d=r.cloneNode(!0);(a=o[i])!=null&&a.match(/\s+/)&&d.firstChild.setAttribute("xml:space","preserve"),d.firstChild.firstChild.nodeValue=o[i],t.appendChild(d)}return e}}class U{constructor(e){s(this,"pane");s(this,"showZeros",null);s(this,"defaultGridColor",null);s(this,"colorId",null);s(this,"rightToLeft",null);s(this,"showFormulas",null);s(this,"showGridLines",null);s(this,"showOutlineSymbols",null);s(this,"showRowColHeaders",null);s(this,"showRuler",null);s(this,"showWhiteSpace",null);s(this,"tabSelected",null);s(this,"topLeftCell",null);s(this,"viewType",null);s(this,"windowProtection",null);s(this,"zoomScale",null);s(this,"zoomScaleNormal",null);s(this,"zoomScalePageLayoutView",null);s(this,"zoomScaleSheetLayoutView",null);const t=e||{};this.pane=t.pane||new H}freezePane(e,t,i){this.pane.state="frozen",this.pane.xSplit=e,this.pane.ySplit=t,this.pane.topLeftCell=i}exportXML(e){const t=e.createElement("sheetViews"),i=e.createElement("sheetView");return l.setAttributesOnDoc(i,{workbookViewId:0,showZeros:{v:this.showZeros,type:Boolean},defaultGridColor:{v:this.defaultGridColor,type:Boolean},colorId:this.colorId,rightToLeft:{v:this.rightToLeft,type:Boolean},showFormulas:{v:this.showFormulas,type:Boolean},showGridLines:{v:this.showGridLines,type:Boolean},showOutlineSymbols:{v:this.showOutlineSymbols,type:Boolean},showRowColHeaders:{v:this.showRowColHeaders,type:Boolean},showRuler:{v:this.showRuler,type:Boolean},showWhiteSpace:{v:this.showWhiteSpace,type:Boolean},tabSelected:{v:this.tabSelected,type:Boolean},viewType:this.viewType,windowProtection:{v:this.windowProtection,type:Boolean},zoomScale:{v:this.zoomScale,type:Boolean},zoomScaleNormal:this.zoomScaleNormal,zoomScalePageLayoutView:this.zoomScalePageLayoutView,zoomScaleSheetLayoutView:this.zoomScaleSheetLayoutView}),i.appendChild(this.pane.exportXML(e)),t.appendChild(i),t}}class X{constructor(){s(this,"id",b("StyleSheet"));s(this,"cellStyles",[{name:"Normal",xfId:"0",builtinId:"0"}]);s(this,"defaultTableStyle",!1);s(this,"differentialStyles",[{}]);s(this,"masterCellFormats",[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfid:0}]);s(this,"masterCellStyles",[{numFmtId:0,fontId:0,fillId:0,borderId:0}]);s(this,"fonts",[{}]);s(this,"numberFormatters",[]);s(this,"fills",[{},{type:"pattern",patternType:"gray125",fgColor:"FF333333",bgColor:"FF333333"}]);s(this,"borders",[{top:{},left:{},right:{},bottom:{},diagonal:{}}]);s(this,"tableStyles",[])}createSimpleFormatter(e){const i={id:this.masterCellFormats.length};switch(e){case"date":i.numFmtId=14;break}return this.masterCellFormats.push(i),i}createFill(e){const t=this.fills.length,i=e;return i.id=t,this.fills.push(i),i}createNumberFormatter(e){const i={id:this.numberFormatters.length+100,formatCode:e};return this.numberFormatters.push(i),i}createFormat(e){const i={id:this.masterCellFormats.length};if(e.protection&&(i.protection=e.protection),e.font&&E(e.font))i.fontId=this.createFontStyle(e.font).id;else if(e.font){if(Number.isNaN(parseInt(e.font,10)))throw new Error("Passing a non-numeric font id is not supported");i.fontId=e.font}if(e.format&&F(e.format))i.numFmtId=this.createNumberFormatter(e.format).id;else if(e.format){if(Number.isNaN(parseInt(e.format,10)))throw new Error("Invalid number formatter id");i.numFmtId=e.format}if(e.border&&E(e.border))i.borderId=this.createBorderFormatter(e.border).id;else if(e.border){if(Number.isNaN(parseInt(e.border,10)))throw new Error("Passing a non-numeric border id is not supported");i.borderId=e.border}if(e.fill&&E(e.fill))i.fillId=this.createFill(e.fill).id;else if(e.fill){if(Number.isNaN(parseInt(e.fill,10)))throw new Error("Passing a non-numeric fill id is not supported");i.fillId=e.fill}return e.alignment&&E(e.alignment)&&(i.alignment=j(e.alignment,["horizontal","justifyLastLine","readingOrder","relativeIndent","shrinkToFit","textRotation","vertical","wrapText"])),this.masterCellFormats.push(i),i}createDifferentialStyle(e){const t=this.differentialStyles.length,i={id:t};return e.font&&E(e.font)&&(i.font=e.font),e.border&&E(e.border)&&(i.border=Object.assign({top:{},left:{},right:{},bottom:{},diagonal:{}},e.border)),e.fill&&E(e.fill)&&(i.fill=e.fill),e.alignment&&E(e.alignment)&&(i.alignment=e.alignment),e.format&&F(e.format)&&(i.numFmt=e.format),this.differentialStyles[t]=i,i}createTableStyle(e){this.tableStyles.push(e)}createBorderFormatter(e){return e={top:{},left:{},right:{},bottom:{},diagonal:{},id:this.borders.length,...e},this.borders.push(e),e}createFontStyle(e){const i={id:this.fonts.length};return e.bold&&(i.bold=!0),e.italic&&(i.italic=!0),e.superscript&&(i.vertAlign="superscript"),e.subscript&&(i.vertAlign="subscript"),e.underline&&(typeof e.underline=="string"&&["double","singleAccounting","doubleAccounting"].includes(e.underline)?i.underline=e.underline:i.underline=!0),e.strike&&(i.strike=!0),e.outline&&(i.outline=!0),e.shadow&&(i.shadow=!0),e.size&&(i.size=e.size),e.color&&(i.color=e.color),e.fontName&&(i.fontName=e.fontName),this.fonts.push(i),i}exportBorders(e){const t=e.createElement("borders");t.setAttribute("count",this.borders.length);for(let i=0,r=this.borders.length;i<r;i++)t.appendChild(this.exportBorder(e,this.borders[i]));return t}exportBorder(e,t){const i=e.createElement("border"),r=n=>{const o=e.createElement(n);return t[n].style&&o.setAttribute("style",t[n].style),t[n].color&&o.appendChild(this.exportColor(e,t[n].color)),o};return i.appendChild(r("left")),i.appendChild(r("right")),i.appendChild(r("top")),i.appendChild(r("bottom")),i.appendChild(r("diagonal")),i}exportColor(e,t){const i=e.createElement("color");return F(t)?(i.setAttribute("rgb",t),i):(t.tint!==void 0&&i.setAttribute("tint",t.tint),t.auto!==void 0&&i.setAttribute("auto",String(!!t.auto)),t.theme!==void 0&&i.setAttribute("theme",t.theme),i)}exportMasterCellFormats(e){const t=l.createElement(e,"cellXfs",[["count",this.masterCellFormats.length]]);for(let i=0,r=this.masterCellFormats.length;i<r;i++){const n=this.masterCellFormats[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportMasterCellStyles(e){const t=l.createElement(e,"cellStyleXfs",[["count",this.masterCellStyles.length]]);for(let i=0,r=this.masterCellStyles.length;i<r;i++){const n=this.masterCellStyles[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportCellFormatElement(e,t){const i=e.createElement("xf"),r=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","borderId","fillId","fontId","numFmtId","pivotButton","quotePrefix","xfId"],n=Object.keys(t).filter(a=>r.indexOf(a)!==-1);if(t.alignment){const a=t.alignment;i.appendChild(this.exportAlignment(e,a))}t.protection&&(i.appendChild(this.exportProtection(e,t.protection)),i.setAttribute("applyProtection","1"));let o=n.length;for(;o--;)i.setAttribute(n[o],t[n[o]]);return t.fillId&&i.setAttribute("applyFill","1"),t.fontId&&i.setAttribute("applyFont","1"),t.borderId&&i.setAttribute("applyBorder","1"),t.alignment&&i.setAttribute("applyAlignment","1"),t.numFmtId&&i.setAttribute("applyNumberFormat","1"),t.numFmtId!==void 0&&t.xfId===void 0&&i.setAttribute("xfId","0"),i}exportAlignment(e,t){const i=e.createElement("alignment"),r=Object.keys(t);for(let n=0,o=r.length;n<o;n++)i.setAttribute(r[n],t[r[n]]);return i}exportFonts(e){const t=e.createElement("fonts");t.setAttribute("count",String(this.fonts.length));for(let i=0,r=this.fonts.length;i<r;i++){const n=this.fonts[i];t.appendChild(this.exportFont(e,n))}return t}exportFont(e,t){const i=e.createElement("font");if(t.size){const r=e.createElement("sz");r.setAttribute("val",t.size),i.appendChild(r)}if(t.fontName){const r=e.createElement("name");r.setAttribute("val",t.fontName),i.appendChild(r)}if(t.bold&&i.appendChild(e.createElement("b")),t.italic&&i.appendChild(e.createElement("i")),t.vertAlign){const r=e.createElement("vertAlign");r.setAttribute("val",t.vertAlign),i.appendChild(r)}if(t.underline){const r=e.createElement("u");t.underline!==!0&&r.setAttribute("val",t.underline),i.appendChild(r)}return t.strike&&i.appendChild(e.createElement("strike")),t.shadow&&i.appendChild(e.createElement("shadow")),t.outline&&i.appendChild(e.createElement("outline")),t.color&&i.appendChild(this.exportColor(e,t.color)),i}exportFills(e){const t=e.createElement("fills");t.setAttribute("count",String(this.fills.length));for(let i=0,r=this.fills.length;i<r;i++){const n=this.fills[i];t.appendChild(this.exportFill(e,n))}return t}exportFill(e,t){let i;const r=e.createElement("fill");return t.type==="pattern"?(i=this.exportPatternFill(e,t),r.appendChild(i)):t.type==="gradient"&&(i=this.exportGradientFill(e,t),r.appendChild(i)),r}exportGradientFill(e,t){const i=e.createElement("gradientFill");t.degree?i.setAttribute("degree",t.degree):t.left&&(i.setAttribute("left",t.left),i.setAttribute("right",t.right),i.setAttribute("top",t.top),i.setAttribute("bottom",t.bottom));const r=e.createElement("stop");r.setAttribute("position",t.start.pureAt||0);const n=e.createElement("color");typeof t.start=="string"||t.start.color?n.setAttribute("rgb",t.start.color||t.start):t.start.theme&&n.setAttribute("theme",t.start.theme);const o=e.createElement("stop"),a=e.createElement("color");return o.setAttribute("position",t.end.pureAt||1),typeof t.start=="string"||t.end.color?a.setAttribute("rgb",t.end.color||t.end):t.end.theme&&a.setAttribute("theme",t.end.theme),r.appendChild(n),o.appendChild(a),i.appendChild(r),i.appendChild(o),i}exportPatternFill(e,t){const i=l.createElement(e,"patternFill",[["patternType",t.patternType]]);t.bgColor||(t.bgColor="FFFFFFFF"),t.fgColor||(t.fgColor="FFFFFFFF");const r=e.createElement("bgColor");F(t.bgColor)?r.setAttribute("rgb",t.bgColor):t.bgColor.theme?r.setAttribute("theme",t.bgColor.theme):r.setAttribute("rgb",t.bgColor.rbg);const n=e.createElement("fgColor");return F(t.fgColor)?n.setAttribute("rgb",t.fgColor):t.fgColor.theme?n.setAttribute("theme",t.fgColor.theme):n.setAttribute("rgb",t.fgColor.rbg),i.appendChild(n),i.appendChild(r),i}exportNumberFormatters(e){const t=e.createElement("numFmts");t.setAttribute("count",String(this.numberFormatters.length));for(let i=0,r=this.numberFormatters.length;i<r;i++){const n=this.numberFormatters[i];t.appendChild(this.exportNumberFormatter(e,n))}return t}exportNumberFormatter(e,t){const i=e.createElement("numFmt");return i.setAttribute("numFmtId",t.id),i.setAttribute("formatCode",t.formatCode),i}exportCellStyles(e){const t=e.createElement("cellStyles");t.setAttribute("count",String(this.cellStyles.length));for(let i=0,r=this.cellStyles.length;i<r;i++){const n=this.cellStyles[i];delete n.id;const o=l.createElement(e,"cellStyle");t.appendChild(o);const a=Object.keys(n);let d=a.length;for(;d--;)o.setAttribute(a[d],n[a[d]])}return t}exportDifferentialStyles(e){const t=e.createElement("dxfs");t.setAttribute("count",String(this.differentialStyles.length));for(let i=0,r=this.differentialStyles.length;i<r;i++){const n=this.differentialStyles[i];t.appendChild(this.exportDFX(e,n))}return t}exportDFX(e,t){const i=e.createElement("dxf");return t.font&&i.appendChild(this.exportFont(e,t.font)),t.fill&&i.appendChild(this.exportFill(e,t.fill)),t.border&&i.appendChild(this.exportBorder(e,t.border)),t.numFmt&&i.appendChild(this.exportNumberFormatter(e,t.numFmt)),t.alignment&&i.appendChild(this.exportAlignment(e,t.alignment)),i}exportTableStyles(e){const t=e.createElement("tableStyles");t.setAttribute("count",String(this.tableStyles.length)),this.defaultTableStyle&&t.setAttribute("defaultTableStyle",String(this.defaultTableStyle));for(let i=0,r=this.tableStyles.length;i<r;i++)t.appendChild(this.exportTableStyle(e,this.tableStyles[i]));return t}exportTableStyle(e,t){const i=e.createElement("tableStyle");i.setAttribute("name",t.name),i.setAttribute("pivot",String(0));let r=0;return Object.entries(t).forEach(([n,o])=>{if(n==="name")return;r++;const a=e.createElement("tableStyleElement");a.setAttribute("type",n),a.setAttribute("dxfId",o),i.appendChild(a)}),i.setAttribute("count",String(r)),i}exportProtection(e,t){const i=e.createElement("protection");for(const r in t)t.hasOwn(r)&&i.setAttribute(r,t[r]);return i}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"styleSheet"),t=e.documentElement;return t.appendChild(this.exportNumberFormatters(e)),t.appendChild(this.exportFonts(e)),t.appendChild(this.exportFills(e)),t.appendChild(this.exportBorders(e)),t.appendChild(this.exportMasterCellStyles(e)),t.appendChild(this.exportMasterCellFormats(e)),t.appendChild(this.exportCellStyles(e)),t.appendChild(this.exportDifferentialStyles(e)),this.tableStyles.length&&t.appendChild(this.exportTableStyles(e)),e}}class te{constructor(e){s(this,"name","");s(this,"id","");s(this,"tableId","");s(this,"displayName","");s(this,"dataCellStyle",null);s(this,"dataDfxId",null);s(this,"headerRowBorderDxfId",null);s(this,"headerRowCellStyle",null);s(this,"headerRowCount",1);s(this,"headerRowDxfId",null);s(this,"insertRow",!1);s(this,"insertRowShift",!1);s(this,"ref",null);s(this,"tableBorderDxfId",null);s(this,"totalsRowBorderDxfId",null);s(this,"totalsRowCellStyle",null);s(this,"totalsRowCount",0);s(this,"totalsRowDxfId",null);s(this,"tableColumns",[]);s(this,"autoFilter",null);s(this,"sortState",null);s(this,"styleInfo",{});this.initialize(e)}initialize(e){this.displayName=b("Table"),this.name=this.displayName,this.id=this.name,this.tableId=this.id.replace("Table",""),Object.assign(this,e)}setReferenceRange(e,t){this.ref=[e,t]}setTableColumns(e){e.forEach(t=>{this.addTableColumn(t)})}addTableColumn(e){if(F(e)&&(e={name:e}),!e.name)throw new Error("Invalid argument for addTableColumn - minimum requirement is a name property");this.tableColumns.push(e)}setSortState(e){this.sortState=e}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"table"),t=e.documentElement;t.setAttribute("id",this.tableId),t.setAttribute("name",this.name),t.setAttribute("displayName",this.displayName);const i=this.ref[0],r=this.ref[1];if(t.setAttribute("ref",`${l.positionToLetterRef(i[0],i[1])}:${l.positionToLetterRef(r[0],r[1])}`),t.setAttribute("totalsRowCount",this.totalsRowCount),t.setAttribute("headerRowCount",this.headerRowCount),this.headerRowDxfId&&t.setAttribute("headerRowDxfId",this.headerRowDxfId),this.headerRowBorderDxfId&&t.setAttribute("headerRowBorderDxfId",this.headerRowBorderDxfId),!this.ref)throw new Error("Needs at least a reference range");return this.autoFilter||this.addAutoFilter(this.ref[0],this.ref[1]),t.appendChild(this.exportAutoFilter(e)),t.appendChild(this.exportTableColumns(e)),t.appendChild(this.exportTableStyleInfo(e)),e}exportTableColumns(e){const t=e.createElement("tableColumns");t.setAttribute("count",this.tableColumns.length);const i=this.tableColumns;for(let r=0,n=i.length;r<n;r++){const o=i[r],a=e.createElement("tableColumn");a.setAttribute("id",String(r+1)),a.setAttribute("name",o.name),t.appendChild(a),o.totalsRowFunction&&a.setAttribute("totalsRowFunction",o.totalsRowFunction),o.totalsRowLabel&&a.setAttribute("totalsRowLabel",o.totalsRowLabel)}return t}exportAutoFilter(e){const t=e.createElement("autoFilter"),i=this.autoFilter[0],r=this.autoFilter[1];return t.setAttribute("ref",`${l.positionToLetterRef(i[0],i[1])}:${l.positionToLetterRef(r[0],r[1]-this.totalsRowCount)}`),t}exportTableStyleInfo(e){const t=this.styleInfo,i=e.createElement("tableStyleInfo");return i.setAttribute("name",t.themeStyle),i.setAttribute("showFirstColumn",t.showFirstColumn?"1":"0"),i.setAttribute("showLastColumn",t.showLastColumn?"1":"0"),i.setAttribute("showColumnStripes",t.showColumnStripes?"1":"0"),i.setAttribute("showRowStripes",t.showRowStripes?"1":"0"),i}addAutoFilter(e,t){this.autoFilter=[e,t]}}class J{constructor(e){s(this,"name","");s(this,"id",b("Worksheet"));s(this,"_timezoneOffset");s(this,"relations",null);s(this,"columnFormats",[]);s(this,"data",[]);s(this,"mergedCells",[]);s(this,"columns",[]);s(this,"sheetProtection",!1);s(this,"_headers",[]);s(this,"_footers",[]);s(this,"_tables",[]);s(this,"_drawings",[]);s(this,"_orientation");s(this,"_margin");s(this,"_rowInstructions",{});s(this,"_freezePane",{});s(this,"sharedStrings",null);s(this,"hyperlinks",[]);s(this,"sheetView");s(this,"showZeros",null);this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,this.sheetView=e.sheetView||new U,this.initialize(e)}initialize(e){e=e||{},this.name=e.name,this.id=b("Worksheet"),this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,e.columns&&this.setColumns(e.columns),this.relations=new O}exportData(){return{relations:this.relations.exportData(),columnFormats:this.columnFormats,data:this.data,columns:this.columns,mergedCells:this.mergedCells,_headers:this._headers,_footers:this._footers,_tables:this._tables,_rowInstructions:this._rowInstructions,_freezePane:this._freezePane,name:this.name,id:this.id}}importData(e){this.relations.importData(e.relations),delete e.relations,Object.assign(this,e)}setSharedStringCollection(e){this.sharedStrings=e}addTable(e){this._tables.push(e),this.relations.addRelation(e,"table")}addDrawings(e){this._drawings.push(e),this.relations.addRelation(e,"drawingRelationship")}setRowInstructions(e,t){this._rowInstructions[e]=t}setHeader(e){if(!Array.isArray(e))throw"Invalid argument type - setHeader expects an array of three instructions";this._headers=e}setFooter(e){if(!Array.isArray(e))throw"Invalid argument type - setFooter expects an array of three instructions";this._footers=e}compilePageDetailPackage(e){return e=e||"",["&L",this.compilePageDetailPiece(e[0]||""),"&C",this.compilePageDetailPiece(e[1]||""),"&R",this.compilePageDetailPiece(e[2]||"")].join("")}compilePageDetailPiece(e){if(F(e))return'&"-,Regular"'.concat(e);if(E(e)&&!Array.isArray(e)){let t="";if(e.font||e.bold){const i=e.bold?"Bold":"Regular";t+=`&"${e.font||"-"}`,t+=`,${i}"`}else t+='&"-,Regular"';return e.underline&&(t+="&U"),e.fontSize&&(t+=`&${e.fontSize}`),t+=e.text,t}if(Array.isArray(e))return e.reduce((t,i)=>t.concat(this.compilePageDetailPiece(i)),"")}exportHeader(e){const t=e.createElement("oddHeader");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._headers))),t}exportFooter(e){const t=e.createElement("oddFooter");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._footers))),t}_buildCache(e){const t=e.createElement("c"),i=e.createElement("v");i.appendChild(e.createTextNode("--temp--")),t.appendChild(i);const r=e.createElement("c"),n=e.createElement("f");n.appendChild(e.createTextNode("--temp--")),r.appendChild(n);const o=e.createElement("c");o.setAttribute("t","s");const a=e.createElement("v");return a.appendChild(e.createTextNode("--temp--")),o.appendChild(a),{number:t,date:t,string:o,formula:r}}collectSharedStrings(){const e=this.data,t={};for(let i=0,r=e.length;i<r;i++){const n=e[i],o=n.length;for(let a=0;a<o;a++){let d=n[a];const m=(d==null?void 0:d.metadata)||{};d&&typeof d=="object"&&(d=d.value),m.type||typeof d=="number"&&(m.type="number"),(m.type==="text"||!m.type)&&typeof t[d]>"u"&&(t[d]=!0)}}return Object.keys(t)}toXML(){var k,N,v;const e=this.data,t=this.columns||[],i=l.createXmlDoc(l.schemas.spreadsheetml,"worksheet"),r=i.documentElement;let n,o,a;r.setAttribute("xmlns:r",l.schemas.relationships),r.setAttribute("xmlns:mc",l.schemas.markupCompat);let d=0;const m=l.createElement(i,"sheetData"),f=this._buildCache(i);for(a=0,o=e.length;a<o;a++){const c=e[a],C=c.length;d=C>d?C:d;const y=i.createElement("row");for(let u=0;u<C;u++){t[u]=t[u]||{};let g=c[u],w;const L=(g==null?void 0:g.metadata)||{};switch(g&&typeof g=="object"&&(g=g.value),L.type||typeof g=="number"&&(L.type="number"),L.type){case"number":w=f.number.cloneNode(!0),w.firstChild.firstChild.nodeValue=g;break;case"date":w=f.date.cloneNode(!0),g instanceof Date&&(g=g.getTime()),w.firstChild.firstChild.nodeValue=25569+(g-this._timezoneOffset)/864e5;break;case"formula":w=f.formula.cloneNode(!0),w.firstChild.firstChild.nodeValue=g;break;case"text":default:{let V;typeof((k=this.sharedStrings)==null?void 0:k.strings[g])<"u"?V=this.sharedStrings.strings[g]:V=(N=this.sharedStrings)==null?void 0:N.addString(g),w=f.string.cloneNode(!0),w.firstChild.firstChild.nodeValue=V;break}}L.style?w.setAttribute("s",L.style):((v=this._rowInstructions[a])==null?void 0:v.style)!==void 0&&w.setAttribute("s",this._rowInstructions[a].style),w.setAttribute("r",l.positionToLetterRef(u+1,String(a+1))),y.appendChild(w)}if(y.setAttribute("r",a+1),this._rowInstructions[a]){const u=this._rowInstructions[a];u.height!==void 0&&(y.setAttribute("customHeight","1"),y.setAttribute("ht",u.height)),u.style!==void 0&&(y.setAttribute("customFormat","1"),y.setAttribute("s",u.style))}m.appendChild(y)}if(d!==0?r.appendChild(l.createElement(i,"dimension",[["ref",`${l.positionToLetterRef(1,1)}:${l.positionToLetterRef(d,String(e.length))}`]])):r.appendChild(l.createElement(i,"dimension",[["ref",l.positionToLetterRef(1,1)]])),r.appendChild(this.sheetView.exportXML(i)),this.columns.length&&r.appendChild(this.exportColumns(i)),r.appendChild(m),this.sheetProtection&&r.appendChild(this.sheetProtection.exportXML(i)),this.hyperlinks.length>0){const c=i.createElement("hyperlinks"),C=this.hyperlinks;for(n=0,o=C.length;n<o;n++){const y=i.createElement("hyperlink"),u=C[n];y.setAttribute("ref",String(u.cell)),u.id=l.uniqueId("hyperlink"),this.relations.addRelation({id:u.id,target:u.location,targetMode:u.targetMode||"External"},"hyperlink"),y.setAttribute("r:id",this.relations.getRelationshipId(u)),c.appendChild(y)}r.appendChild(c)}if(this.mergedCells.length>0){const c=i.createElement("mergeCells");for(n=0,o=this.mergedCells.length;n<o;n++){const C=i.createElement("mergeCell");C.setAttribute("ref",`${this.mergedCells[n][0]}:${this.mergedCells[n][1]}`),c.appendChild(C)}r.appendChild(c)}if(this.exportPageSettings(i,r),this._headers.length>0||this._footers.length>0){const c=i.createElement("headerFooter");this._headers.length>0&&c.appendChild(this.exportHeader(i)),this._footers.length>0&&c.appendChild(this.exportFooter(i)),r.appendChild(c)}for(n=0,o=this._drawings.length;n<o;n++){const c=i.createElement("drawing");c.setAttribute("r:id",this.relations.getRelationshipId(this._drawings[n])),r.appendChild(c)}if(this._tables.length>0){const c=i.createElement("tableParts");for(c.setAttribute("count",this._tables.length),n=0,o=this._tables.length;n<o;n++){const C=i.createElement("tablePart");C.setAttribute("r:id",this.relations.getRelationshipId(this._tables[n])),c.appendChild(C)}r.appendChild(c)}return i}exportColumns(e){const t=l.createElement(e,"cols");for(let i=0,r=this.columns.length;i<r;i++){const n=this.columns[i],o=l.createElement(e,"col",[["min",n.min||i+1],["max",n.max||i+1]]);n.hidden&&o.setAttribute("hidden",String(1)),n.bestFit&&o.setAttribute("bestFit",String(1)),(n.customWidth||n.width)&&o.setAttribute("customWidth",String(1)),n.width?o.setAttribute("width",n.width):o.setAttribute("width",String(9.140625)),t.appendChild(o)}return t}exportPageSettings(e,t){if(this._margin){let i=.7;const r=this._margin.left?this._margin.left:i,n=this._margin.right?this._margin.right:i,o=this._margin.top?this._margin.top:i,a=this._margin.bottom?this._margin.bottom:i;i=.3;const d=this._margin.header?this._margin.header:i,m=this._margin.footer?this._margin.footer:i;t.appendChild(l.createElement(e,"pageMargins",[["top",o],["bottom",a],["left",r],["right",n],["header",d],["footer",m]]))}this._orientation&&t.appendChild(l.createElement(e,"pageSetup",[["orientation",this._orientation]]))}setPageOrientation(e){this._orientation=e}setPageMargin(e){this._margin=e}setColumns(e){this.columns=e}setData(e){this.data=e}mergeCells(e,t){this.mergedCells.push([e,t])}freezePane(e,t,i){this.sheetView.freezePane(e,t,i)}setColumnFormats(e){this.columnFormats=e}}class Z{constructor(){s(this,"id",b("Workbook"));s(this,"styleSheet",new X);s(this,"sharedStrings",new $);s(this,"relations",new O);s(this,"worksheets",[]);s(this,"tables",[]);s(this,"drawings",[]);s(this,"media",{});s(this,"printTitles");this.initialize()}initialize(){this.id=b("Workbook"),this.styleSheet=new X,this.sharedStrings=new $,this.relations=new O,this.relations.addRelation(this.styleSheet,"stylesheet"),this.relations.addRelation(this.sharedStrings,"sharedStrings")}createWorksheet(e){return e=Object.assign({},{name:"Sheet ".concat(String(this.worksheets.length+1))},e),new J(e)}getStyleSheet(){return this.styleSheet}addTable(e){this.tables.push(e)}addDrawings(e){this.drawings.push(e)}setPrintTitleTop(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].top=t}setPrintTitleLeft(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].left=String.fromCharCode(64+t)}addMedia(e,t,i,r){const n=t.split("."),o=n[n.length-1];if(!r)switch(o.toLowerCase()){case"jpeg":case"jpg":r="image/jpeg";break;case"png":r="image/png";break;case"gif":r="image/gif";break;default:r=null;break}return this.media[t]||(this.media[t]={id:t,data:i,fileName:t,contentType:r,extension:o}),this.media[t]}addWorksheet(e){this.relations.addRelation(e,"worksheet"),e.setSharedStringCollection(this.sharedStrings),this.worksheets.push(e)}createContentTypes(){const e=l.createXmlDoc(l.schemas.contentTypes,"Types"),t=e.documentElement;let i,r;t.appendChild(l.createElement(e,"Default",[["Extension","rels"],["ContentType","application/vnd.openxmlformats-package.relationships+xml"]])),t.appendChild(l.createElement(e,"Default",[["Extension","xml"],["ContentType","application/xml"]]));const n={};for(const o in this.media)this.media.hasOwn(o)&&(n[this.media[o].extension]=this.media[o].contentType);for(const o in n)n.hasOwn(o)&&t.appendChild(l.createElement(e,"Default",[["Extension",o],["ContentType",n[o]]]));for(t.appendChild(l.createElement(e,"Override",[["PartName","/xl/workbook.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"]])),t.appendChild(l.createElement(e,"Override",[["PartName","/xl/sharedStrings.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"]])),t.appendChild(l.createElement(e,"Override",[["PartName","/xl/styles.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"]])),i=0,r=this.worksheets.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/worksheets/sheet${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"]]));for(i=0,r=this.tables.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/tables/table${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"]]));for(i=0,r=this.drawings.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/drawings/drawing${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.drawing+xml"]]));return e}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"workbook"),t=e.documentElement;t.setAttribute("xmlns:r",l.schemas.relationships);const i=31,r=l.createElement(e,"sheets");for(let a=0,d=this.worksheets.length;a<d;a++){const m=e.createElement("sheet");typeof console<"u"&&this.worksheets[a].name.length>i&&console.log(`Microsoft Excel requires work sheet names to be less than ${i+1} characters long, work sheet name "${this.worksheets[a].name}" is ${this.worksheets[a].name.length} characters long`),m.setAttribute("name",this.worksheets[a].name),m.setAttribute("sheetId",a+1),m.setAttribute("r:id",this.relations.getRelationshipId(this.worksheets[a])),r.appendChild(m)}t.appendChild(r);const n=l.createElement(e,"definedNames");let o=0;for(const a in this.printTitles){if(!this.printTitles.hasOwn(a))continue;const d=this.printTitles[a],m=e.createElement("definedName");m.setAttribute("name","_xlnm.Print_Titles"),m.setAttribute("localSheetId",o++);let f="";d.top&&(f+=`${a}!$1:$${d.top}`,d.left&&(f+=",")),d.left&&(f+=`${a}!$A:$${d.left}`),m.appendChild(e.createTextNode(f)),n.appendChild(m)}return t.appendChild(n),e}createWorkbookRelationship(){const e=l.createXmlDoc(l.schemas.relationshipPackage,"Relationships");return e.documentElement.appendChild(l.createElement(e,"Relationship",[["Id","rId1"],["Type",l.schemas.officeDocument],["Target","xl/workbook.xml"]])),e}_generateCorePaths(e){let t,i;for(A[this.styleSheet.id]="styles.xml",A[this.sharedStrings.id]="sharedStrings.xml",A[this.id]="/xl/workbook.xml",t=0,i=this.tables.length;t<i;t++)e[`/xl/tables/table${t+1}.xml`]=this.tables[t].toXML(),A[this.tables[t].id]=`/xl/tables/table${t+1}.xml`;for(const r in this.media)if(this.media.hasOwn(r)){const n=this.media[r];e[`/xl/media/${r}`]=n.data,A[r]=`/xl/media/${r}`}for(t=0,i=this.drawings.length;t<i;t++)e[`/xl/drawings/drawing${t+1}.xml`]=this.drawings[t].toXML(),A[this.drawings[t].id]=`/xl/drawings/drawing${t+1}.xml`,e[`/xl/drawings/_rels/drawing${t+1}.xml.rels`]=this.drawings[t].relations.toXML()}_prepareFilesForPackaging(e){Object.assign(e,{"/[Content_Types].xml":this.createContentTypes(),"/_rels/.rels":this.createWorkbookRelationship(),"/xl/styles.xml":this.styleSheet.toXML(),"/xl/workbook.xml":this.toXML(),"/xl/sharedStrings.xml":this.sharedStrings.toXML(),"/xl/_rels/workbook.xml.rels":this.relations.toXML()});for(const[t,i]of Object.entries(e))if(t.indexOf(".xml")!==-1||t.indexOf(".rels")!==-1){i instanceof P?e[t]=i.toString():e[t]=i.xml||new window.XMLSerializer().serializeToString(i);let r=e[t].replace(/xmlns=""/g,"");r=r.replace(/NS[\d]+:/g,""),r=r.replace(/xmlns:NS[\d]+=""/g,""),e[t]=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
var ExcelBuilder=function(p,S){"use strict";var ne=Object.defineProperty;var le=(p,S,T)=>S in p?ne(p,S,{enumerable:!0,configurable:!0,writable:!0,value:T}):p[S]=T;var s=(p,S,T)=>(le(p,typeof S!="symbol"?S+"":S,T),T);const T={"&":"&amp;","<":"&lt;",">":"&gt;",'"':"&quot;","'":"&#39;"},_=h=>(typeof h!="string"&&(h=`${h}`),h.replace(/[&<>"']/g,e=>T[e]));function E(h){const e=typeof h;return h!=null&&(e==="object"||e==="function")}function B(h){if(typeof h!="object"||h===null||Object.prototype.toString.call(h)!=="[object Object]")return!1;const e=Object.getPrototypeOf(h);if(e===null)return!0;const t=Object.prototype.hasOwnProperty.call(e,"constructor")&&e.constructor;return typeof t=="function"&&t instanceof t&&Function.prototype.call(t)===Function.prototype.call(h)}function F(h){return h!=null&&typeof h.valueOf()=="string"}function j(h,e){return e.reduce((t,i)=>(h!=null&&h.hasOwnProperty(i)&&(t[i]=h[i]),t),{})}const M={};function b(h="$lodash$"){M[h]||(M[h]=0);const e=++M[h];return h==="$lodash$"?`${e}`:`${h}${e}`}class P{constructor(e,t){s(this,"documentElement");this.documentElement=this.createElement(t),this.documentElement.setAttribute("xmlns",e)}createElement(e){return new R({nodeName:e})}createTextNode(e){return new W(e)}toString(){return this.documentElement.toString()}}s(P,"Node",{Create:e=>{switch(e.type){case"XML":return new R(e);case"TEXT":return new W(e.nodeValue);default:return null}}});class W{constructor(e){s(this,"nodeValue");this.nodeValue=e}toJSON(){return{nodeValue:this.nodeValue,type:"TEXT"}}toString(){return _(this.nodeValue)}}class R{constructor(e){s(this,"nodeName","");s(this,"children");s(this,"nodeValue");s(this,"attributes");s(this,"firstChild");if(this.nodeName=e.nodeName,this.children=[],this.nodeValue=e.nodeValue||"",this.attributes={},e.children)for(let t=0,i=e.children.length;t<i;t++)this.appendChild(P.Node.Create(e.children[t]));if(e.attributes)for(const t in e.attributes)e.attributes.hasOwnProperty(t)&&this.setAttribute(t,e.attributes[t])}toString(){let e=`<${this.nodeName}`;for(const i in this.attributes)this.attributes.hasOwnProperty(i)&&(e=`${e} ${i}="${_(this.attributes[i])}"`);let t="";for(let i=0,r=this.children.length;i<r;i++)t+=this.children[i].toString();return t?e+=`>${t}</${this.nodeName}>`:e+="/>",e}toJSON(){const e=[];for(let t=0,i=this.children.length;t<i;t++)e.push(this.children[t].toJSON());return{nodeName:this.nodeName,children:e,nodeValue:this.nodeValue,attributes:this.attributes,type:"XML"}}setAttribute(e,t){if(t===null){delete this.attributes[e],delete this[e];return}this.attributes[e]=t,this[e]=t}appendChild(e){this.children.push(e),this.firstChild=this.children[0]}cloneNode(e){return new R(this.toJSON())}}const x=class x{static uniqueId(e){return x._idSpaces[e]||(x._idSpaces[e]=1),x._idSpaces[e]++}static createXmlDoc(e,t){return new P(e||null,t)}static createElement(e,t,i){const r=e.createElement(t);i=i||[];let n=i.length;for(;n--;)r.setAttribute(i[n][0],i[n][1]);return r}static setAttributesOnDoc(e,t){for(let[i,r]of Object.entries(t)){if(B(r))if(r.v!==null&&r.v!==void 0)switch(r.type){case Boolean:r=r.v?"1":"0";break}else r=null;r!=null&&e.setAttribute(i,r)}}static positionToLetterRef(e,t){let i=1,r,n=e,o="";const a="ABCDEFGHIJKLMNOPQRSTUVWXYZ";if(x.LETTER_REFS[e])return x.LETTER_REFS[e].concat(t);for(;n>0;)n-=Math.pow(26,i-1),r=n%Math.pow(26,i),n-=r,r=r/Math.pow(26,i-1),o=a.charAt(r)+o,i+=1;return x.LETTER_REFS[e]=o,o.concat(String(t))}};s(x,"_idSpaces",{}),s(x,"LETTER_REFS",{}),s(x,"schemas",{worksheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet",sharedStrings:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings",stylesheet:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles",relationships:"http://schemas.openxmlformats.org/officeDocument/2006/relationships",relationshipPackage:"http://schemas.openxmlformats.org/package/2006/relationships",contentTypes:"http://schemas.openxmlformats.org/package/2006/content-types",spreadsheetml:"http://schemas.openxmlformats.org/spreadsheetml/2006/main",markupCompat:"http://schemas.openxmlformats.org/markup-compatibility/2006",x14ac:"http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac",officeDocument:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument",package:"http://schemas.openxmlformats.org/package/2006/relationships",table:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/table",spreadsheetDrawing:"http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing",drawing:"http://schemas.openxmlformats.org/drawingml/2006/main",drawingRelationship:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing",image:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/image",chart:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart",hyperlink:"http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink"});let l=x;class I{constructor(e){s(this,"x",null);s(this,"y",null);s(this,"width",null);s(this,"height",null);e&&(this.setPos(e.x,e.y),this.setDimensions(e.width,e.height))}setPos(e,t){this.x=e,this.y=t}setDimensions(e,t){this.width=e,this.height=t}toXML(e,t){const i=l.createElement(e,"xdr:absoluteAnchor"),r=l.createElement(e,"xdr:pos");r.setAttribute("x",this.x),r.setAttribute("y",this.y),i.appendChild(r);const n=l.createElement(e,"xdr:ext");return n.setAttribute("cx",this.width),n.setAttribute("cy",this.height),i.appendChild(n),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class G{}class D{constructor(e){s(this,"x",null);s(this,"y",null);s(this,"xOff",null);s(this,"yOff",null);s(this,"width",null);s(this,"height",null);e&&(this.setPos(e.x,e.y,e.xOff,e.yOff),this.setDimensions(e.width,e.height))}setPos(e,t,i,r){this.x=e,this.y=t,i!==void 0&&(this.xOff=i),r!==void 0&&(this.yOff=r)}setDimensions(e,t){this.width=e,this.height=t}toXML(e,t){const i=l.createElement(e,"xdr:oneCellAnchor"),r=l.createElement(e,"xdr:from"),n=l.createElement(e,"xdr:col");n.appendChild(e.createTextNode(String(this.x)));const o=l.createElement(e,"xdr:colOff");o.appendChild(e.createTextNode(String(this.xOff||0)));const a=l.createElement(e,"xdr:row");a.appendChild(e.createTextNode(String(this.y)));const d=l.createElement(e,"xdr:rowOff");d.appendChild(e.createTextNode(String(this.yOff||0))),r.appendChild(n),r.appendChild(o),r.appendChild(a),r.appendChild(d),i.appendChild(r);const m=l.createElement(e,"xdr:ext");return m.setAttribute("cx",String(this.width)),m.setAttribute("cy",String(this.height)),i.appendChild(m),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class z{constructor(e){s(this,"from",{xOff:0,yOff:0});s(this,"to",{xOff:0,yOff:0});e&&(this.setFrom(e.from.x,e.from.y,e.to.xOff,e.to.yOff),this.setTo(e.to.x,e.to.y,e.to.xOff,e.to.yOff))}setFrom(e,t,i,r){this.from.x=e,this.from.y=t,i!==void 0&&(this.from.xOff=i),r!==void 0&&(this.from.yOff=i)}setTo(e,t,i,r){this.to.x=e,this.to.y=t,i!==void 0&&(this.to.xOff=i),r!==void 0&&(this.to.yOff=i)}toXML(e,t){const i=l.createElement(e,"xdr:twoCellAnchor"),r=l.createElement(e,"xdr:from"),n=l.createElement(e,"xdr:col");n.appendChild(e.createTextNode(this.from.x));const o=l.createElement(e,"xdr:colOff");o.appendChild(e.createTextNode(this.from.xOff));const a=l.createElement(e,"xdr:row");a.appendChild(e.createTextNode(this.from.y));const d=l.createElement(e,"xdr:rowOff");d.appendChild(e.createTextNode(this.from.yOff)),r.appendChild(n),r.appendChild(o),r.appendChild(a),r.appendChild(d);const m=l.createElement(e,"xdr:to"),f=l.createElement(e,"xdr:col");f.appendChild(e.createTextNode(this.to.x));const k=l.createElement(e,"xdr:colOff");k.appendChild(e.createTextNode(this.from.xOff));const N=l.createElement(e,"xdr:row");N.appendChild(e.createTextNode(this.to.y));const v=l.createElement(e,"xdr:rowOff");return v.appendChild(e.createTextNode(this.from.yOff)),m.appendChild(f),m.appendChild(k),m.appendChild(N),m.appendChild(v),i.appendChild(r),i.appendChild(m),i.appendChild(t),i.appendChild(l.createElement(e,"xdr:clientData")),i}}class q{constructor(){s(this,"anchor");s(this,"id",b("Drawing"))}get AbsoluteAnchor(){return I}get Chart(){return G}get OneCellAnchor(){return D}get TwoCellAnchor(){return z}createAnchor(e,t){switch(t=t||{},t.drawing=this,e){case"absoluteAnchor":this.anchor=new I(t);break;case"oneCellAnchor":this.anchor=new D(t);break;case"twoCellAnchor":this.anchor=new z(t);break}return this.anchor}}class Q extends q{constructor(){super();s(this,"media",null);s(this,"id",b("Picture"));s(this,"pictureId",l.uniqueId("Picture"));s(this,"fill",{});s(this,"mediaData",null);s(this,"description","");this.id=b("Picture"),this.pictureId=l.uniqueId("Picture")}setMedia(t){this.mediaData=t}setDescription(t){this.description=t}setFillType(t){this.fill.type=t}setFillConfig(t){Object.assign(this.fill,t)}getMediaType(){return"image"}getMediaData(){return this.mediaData}setRelationshipId(t){this.mediaData.rId=t}toXML(t){const i=l.createElement(t,"xdr:pic"),r=l.createElement(t,"xdr:nvPicPr"),n=l.createElement(t,"xdr:cNvPr",[["id",this.pictureId],["name",this.mediaData.fileName],["descr",this.description||""]]);r.appendChild(n);const o=l.createElement(t,"xdr:cNvPicPr");o.appendChild(l.createElement(t,"a:picLocks",[["noChangeAspect","1"],["noChangeArrowheads","1"]])),r.appendChild(o),i.appendChild(r);const a=l.createElement(t,"xdr:blipFill");a.appendChild(l.createElement(t,"a:blip",[["xmlns:r",l.schemas.relationships],["r:embed",this.mediaData.rId]])),a.appendChild(l.createElement(t,"a:srcRect"));const d=l.createElement(t,"a:stretch");d.appendChild(l.createElement(t,"a:fillRect")),a.appendChild(d),i.appendChild(a);const m=l.createElement(t,"xdr:spPr",[["bwMode","auto"]]),f=l.createElement(t,"a:xfrm");m.appendChild(f);const k=l.createElement(t,"a:prstGeom",[["prst","rect"]]);return m.appendChild(k),i.appendChild(m),this.anchor.toXML(t,i)}}const A={};class O{constructor(){s(this,"relations",{});s(this,"lastId",1);b("rId")}importData(e){this.relations=e.relations,this.lastId=e.lastId}exportData(){return{relations:this.relations,lastId:this.lastId}}addRelation(e,t){return this.relations[e.id]={id:b("rId"),schema:l.schemas[t],object:e},this.relations[e.id].id}getRelationshipId(e){return this.relations[e.id]?this.relations[e.id].id:null}toXML(){const e=l.createXmlDoc(l.schemas.relationshipPackage,"Relationships"),t=e.documentElement;for(const[i,r]of Object.entries(this.relations)){const n=l.createElement(e,"Relationship",[["Id",r.id],["Type",r.schema],["Target",r.object.target||A[i]]]);r.object.targetMode&&n.setAttribute("TargetMode",r.object.targetMode),t.appendChild(n)}return e}}class Y{constructor(){s(this,"drawings",[]);s(this,"relations",new O);s(this,"id",b("Drawings"))}addDrawing(e){this.drawings.push(e)}getCount(){return this.drawings.length}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetDrawing,"xdr:wsDr"),t=e.documentElement;t.setAttribute("xmlns:a",l.schemas.drawing),t.setAttribute("xmlns:r",l.schemas.relationships),t.setAttribute("xmlns:xdr",l.schemas.spreadsheetDrawing);for(let i=0,r=this.drawings.length;i<r;i++){let n=this.relations.getRelationshipId(this.drawings[i].getMediaData());n||(n=this.relations.addRelation(this.drawings[i].getMediaData(),this.drawings[i].getMediaType())),this.drawings[i].setRelationshipId(n),t.appendChild(this.drawings[i].toXML(e))}return e}}class H{constructor(){s(this,"state",null);s(this,"xSplit",null);s(this,"ySplit",null);s(this,"activePane","bottomRight");s(this,"topLeftCell",null);s(this,"_freezePane")}freezePane(e,t,i){this._freezePane={xSplit:e,ySplit:t,cell:i}}exportXML(e){const t=e.createElement("pane");return this.state!==null&&(t.setAttribute("xSplit",this._freezePane.xSplit),t.setAttribute("ySplit",this._freezePane.ySplit),t.setAttribute("topLeftCell",this._freezePane.cell),t.setAttribute("activePane","bottomRight"),t.setAttribute("state","frozen")),t}}class ee{static pixelsToEMUs(e){return Math.round(e*914400/96)}}class ${constructor(){s(this,"strings",{});s(this,"stringArray",[]);s(this,"id",b("SharedStrings"))}addString(e){return this.strings[e]=this.stringArray.length,this.stringArray[this.stringArray.length]=e,this.strings[e]}exportData(){return this.strings}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"sst"),t=e.documentElement;this.stringArray.reverse();let i=this.stringArray.length;t.setAttribute("count",i),t.setAttribute("uniqueCount",i);const r=e.createElement("si"),n=e.createElement("t");n.appendChild(e.createTextNode("--placeholder--")),r.appendChild(n);const o=this.stringArray;for(;i--;){const a=r.cloneNode(!0);typeof o[i]=="string"&&o[i].match(/\s+/)&&a.firstChild.setAttribute("xml:space","preserve"),a.firstChild.firstChild.nodeValue=o[i],t.appendChild(a)}return e}}class U{constructor(e){s(this,"pane");s(this,"showZeros",null);s(this,"defaultGridColor",null);s(this,"colorId",null);s(this,"rightToLeft",null);s(this,"showFormulas",null);s(this,"showGridLines",null);s(this,"showOutlineSymbols",null);s(this,"showRowColHeaders",null);s(this,"showRuler",null);s(this,"showWhiteSpace",null);s(this,"tabSelected",null);s(this,"topLeftCell",null);s(this,"viewType",null);s(this,"windowProtection",null);s(this,"zoomScale",null);s(this,"zoomScaleNormal",null);s(this,"zoomScalePageLayoutView",null);s(this,"zoomScaleSheetLayoutView",null);const t=e||{};this.pane=t.pane||new H}freezePane(e,t,i){this.pane.state="frozen",this.pane.xSplit=e,this.pane.ySplit=t,this.pane.topLeftCell=i}exportXML(e){const t=e.createElement("sheetViews"),i=e.createElement("sheetView");return l.setAttributesOnDoc(i,{workbookViewId:0,showZeros:{v:this.showZeros,type:Boolean},defaultGridColor:{v:this.defaultGridColor,type:Boolean},colorId:this.colorId,rightToLeft:{v:this.rightToLeft,type:Boolean},showFormulas:{v:this.showFormulas,type:Boolean},showGridLines:{v:this.showGridLines,type:Boolean},showOutlineSymbols:{v:this.showOutlineSymbols,type:Boolean},showRowColHeaders:{v:this.showRowColHeaders,type:Boolean},showRuler:{v:this.showRuler,type:Boolean},showWhiteSpace:{v:this.showWhiteSpace,type:Boolean},tabSelected:{v:this.tabSelected,type:Boolean},viewType:this.viewType,windowProtection:{v:this.windowProtection,type:Boolean},zoomScale:{v:this.zoomScale,type:Boolean},zoomScaleNormal:this.zoomScaleNormal,zoomScalePageLayoutView:this.zoomScalePageLayoutView,zoomScaleSheetLayoutView:this.zoomScaleSheetLayoutView}),i.appendChild(this.pane.exportXML(e)),t.appendChild(i),t}}class X{constructor(){s(this,"id",b("StyleSheet"));s(this,"cellStyles",[{name:"Normal",xfId:"0",builtinId:"0"}]);s(this,"defaultTableStyle",!1);s(this,"differentialStyles",[{}]);s(this,"masterCellFormats",[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfid:0}]);s(this,"masterCellStyles",[{numFmtId:0,fontId:0,fillId:0,borderId:0}]);s(this,"fonts",[{}]);s(this,"numberFormatters",[]);s(this,"fills",[{},{type:"pattern",patternType:"gray125",fgColor:"FF333333",bgColor:"FF333333"}]);s(this,"borders",[{top:{},left:{},right:{},bottom:{},diagonal:{}}]);s(this,"tableStyles",[])}createSimpleFormatter(e){const i={id:this.masterCellFormats.length};switch(e){case"date":i.numFmtId=14;break}return this.masterCellFormats.push(i),i}createFill(e){const t=this.fills.length,i=e;return i.id=t,this.fills.push(i),i}createNumberFormatter(e){const i={id:this.numberFormatters.length+100,formatCode:e};return this.numberFormatters.push(i),i}createFormat(e){const i={id:this.masterCellFormats.length};if(e.protection&&(i.protection=e.protection),e.font&&E(e.font))i.fontId=this.createFontStyle(e.font).id;else if(e.font){if(Number.isNaN(parseInt(e.font,10)))throw new Error("Passing a non-numeric font id is not supported");i.fontId=e.font}if(e.format&&F(e.format))i.numFmtId=this.createNumberFormatter(e.format).id;else if(e.format){if(Number.isNaN(parseInt(e.format,10)))throw new Error("Invalid number formatter id");i.numFmtId=e.format}if(e.border&&E(e.border))i.borderId=this.createBorderFormatter(e.border).id;else if(e.border){if(Number.isNaN(parseInt(e.border,10)))throw new Error("Passing a non-numeric border id is not supported");i.borderId=e.border}if(e.fill&&E(e.fill))i.fillId=this.createFill(e.fill).id;else if(e.fill){if(Number.isNaN(parseInt(e.fill,10)))throw new Error("Passing a non-numeric fill id is not supported");i.fillId=e.fill}return e.alignment&&E(e.alignment)&&(i.alignment=j(e.alignment,["horizontal","justifyLastLine","readingOrder","relativeIndent","shrinkToFit","textRotation","vertical","wrapText"])),this.masterCellFormats.push(i),i}createDifferentialStyle(e){const t=this.differentialStyles.length,i={id:t};return e.font&&E(e.font)&&(i.font=e.font),e.border&&E(e.border)&&(i.border=Object.assign({top:{},left:{},right:{},bottom:{},diagonal:{}},e.border)),e.fill&&E(e.fill)&&(i.fill=e.fill),e.alignment&&E(e.alignment)&&(i.alignment=e.alignment),e.format&&F(e.format)&&(i.numFmt=e.format),this.differentialStyles[t]=i,i}createTableStyle(e){this.tableStyles.push(e)}createBorderFormatter(e){return e={top:{},left:{},right:{},bottom:{},diagonal:{},id:this.borders.length,...e},this.borders.push(e),e}createFontStyle(e){const i={id:this.fonts.length};return e.bold&&(i.bold=!0),e.italic&&(i.italic=!0),e.superscript&&(i.vertAlign="superscript"),e.subscript&&(i.vertAlign="subscript"),e.underline&&(typeof e.underline=="string"&&["double","singleAccounting","doubleAccounting"].includes(e.underline)?i.underline=e.underline:i.underline=!0),e.strike&&(i.strike=!0),e.outline&&(i.outline=!0),e.shadow&&(i.shadow=!0),e.size&&(i.size=e.size),e.color&&(i.color=e.color),e.fontName&&(i.fontName=e.fontName),this.fonts.push(i),i}exportBorders(e){const t=e.createElement("borders");t.setAttribute("count",this.borders.length);for(let i=0,r=this.borders.length;i<r;i++)t.appendChild(this.exportBorder(e,this.borders[i]));return t}exportBorder(e,t){const i=e.createElement("border"),r=n=>{const o=e.createElement(n);return t[n].style&&o.setAttribute("style",t[n].style),t[n].color&&o.appendChild(this.exportColor(e,t[n].color)),o};return i.appendChild(r("left")),i.appendChild(r("right")),i.appendChild(r("top")),i.appendChild(r("bottom")),i.appendChild(r("diagonal")),i}exportColor(e,t){const i=e.createElement("color");return F(t)?(i.setAttribute("rgb",t),i):(t.tint!==void 0&&i.setAttribute("tint",t.tint),t.auto!==void 0&&i.setAttribute("auto",String(!!t.auto)),t.theme!==void 0&&i.setAttribute("theme",t.theme),i)}exportMasterCellFormats(e){const t=l.createElement(e,"cellXfs",[["count",this.masterCellFormats.length]]);for(let i=0,r=this.masterCellFormats.length;i<r;i++){const n=this.masterCellFormats[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportMasterCellStyles(e){const t=l.createElement(e,"cellStyleXfs",[["count",this.masterCellStyles.length]]);for(let i=0,r=this.masterCellStyles.length;i<r;i++){const n=this.masterCellStyles[i];t.appendChild(this.exportCellFormatElement(e,n))}return t}exportCellFormatElement(e,t){const i=e.createElement("xf"),r=["applyAlignment","applyBorder","applyFill","applyFont","applyNumberFormat","applyProtection","borderId","fillId","fontId","numFmtId","pivotButton","quotePrefix","xfId"],n=Object.keys(t).filter(a=>r.indexOf(a)!==-1);if(t.alignment){const a=t.alignment;i.appendChild(this.exportAlignment(e,a))}t.protection&&(i.appendChild(this.exportProtection(e,t.protection)),i.setAttribute("applyProtection","1"));let o=n.length;for(;o--;)i.setAttribute(n[o],t[n[o]]);return t.fillId&&i.setAttribute("applyFill","1"),t.fontId&&i.setAttribute("applyFont","1"),t.borderId&&i.setAttribute("applyBorder","1"),t.alignment&&i.setAttribute("applyAlignment","1"),t.numFmtId&&i.setAttribute("applyNumberFormat","1"),t.numFmtId!==void 0&&t.xfId===void 0&&i.setAttribute("xfId","0"),i}exportAlignment(e,t){const i=e.createElement("alignment"),r=Object.keys(t);for(let n=0,o=r.length;n<o;n++)i.setAttribute(r[n],t[r[n]]);return i}exportFonts(e){const t=e.createElement("fonts");t.setAttribute("count",String(this.fonts.length));for(let i=0,r=this.fonts.length;i<r;i++){const n=this.fonts[i];t.appendChild(this.exportFont(e,n))}return t}exportFont(e,t){const i=e.createElement("font");if(t.size){const r=e.createElement("sz");r.setAttribute("val",t.size),i.appendChild(r)}if(t.fontName){const r=e.createElement("name");r.setAttribute("val",t.fontName),i.appendChild(r)}if(t.bold&&i.appendChild(e.createElement("b")),t.italic&&i.appendChild(e.createElement("i")),t.vertAlign){const r=e.createElement("vertAlign");r.setAttribute("val",t.vertAlign),i.appendChild(r)}if(t.underline){const r=e.createElement("u");t.underline!==!0&&r.setAttribute("val",t.underline),i.appendChild(r)}return t.strike&&i.appendChild(e.createElement("strike")),t.shadow&&i.appendChild(e.createElement("shadow")),t.outline&&i.appendChild(e.createElement("outline")),t.color&&i.appendChild(this.exportColor(e,t.color)),i}exportFills(e){const t=e.createElement("fills");t.setAttribute("count",String(this.fills.length));for(let i=0,r=this.fills.length;i<r;i++){const n=this.fills[i];t.appendChild(this.exportFill(e,n))}return t}exportFill(e,t){let i;const r=e.createElement("fill");return t.type==="pattern"?(i=this.exportPatternFill(e,t),r.appendChild(i)):t.type==="gradient"&&(i=this.exportGradientFill(e,t),r.appendChild(i)),r}exportGradientFill(e,t){const i=e.createElement("gradientFill");t.degree?i.setAttribute("degree",t.degree):t.left&&(i.setAttribute("left",t.left),i.setAttribute("right",t.right),i.setAttribute("top",t.top),i.setAttribute("bottom",t.bottom));const r=e.createElement("stop");r.setAttribute("position",t.start.pureAt||0);const n=e.createElement("color");typeof t.start=="string"||t.start.color?n.setAttribute("rgb",t.start.color||t.start):t.start.theme&&n.setAttribute("theme",t.start.theme);const o=e.createElement("stop"),a=e.createElement("color");return o.setAttribute("position",t.end.pureAt||1),typeof t.start=="string"||t.end.color?a.setAttribute("rgb",t.end.color||t.end):t.end.theme&&a.setAttribute("theme",t.end.theme),r.appendChild(n),o.appendChild(a),i.appendChild(r),i.appendChild(o),i}exportPatternFill(e,t){const i=l.createElement(e,"patternFill",[["patternType",t.patternType]]);t.bgColor||(t.bgColor="FFFFFFFF"),t.fgColor||(t.fgColor="FFFFFFFF");const r=e.createElement("bgColor");F(t.bgColor)?r.setAttribute("rgb",t.bgColor):t.bgColor.theme?r.setAttribute("theme",t.bgColor.theme):r.setAttribute("rgb",t.bgColor.rbg);const n=e.createElement("fgColor");return F(t.fgColor)?n.setAttribute("rgb",t.fgColor):t.fgColor.theme?n.setAttribute("theme",t.fgColor.theme):n.setAttribute("rgb",t.fgColor.rbg),i.appendChild(n),i.appendChild(r),i}exportNumberFormatters(e){const t=e.createElement("numFmts");t.setAttribute("count",String(this.numberFormatters.length));for(let i=0,r=this.numberFormatters.length;i<r;i++){const n=this.numberFormatters[i];t.appendChild(this.exportNumberFormatter(e,n))}return t}exportNumberFormatter(e,t){const i=e.createElement("numFmt");return i.setAttribute("numFmtId",t.id),i.setAttribute("formatCode",t.formatCode),i}exportCellStyles(e){const t=e.createElement("cellStyles");t.setAttribute("count",String(this.cellStyles.length));for(let i=0,r=this.cellStyles.length;i<r;i++){const n=this.cellStyles[i];delete n.id;const o=l.createElement(e,"cellStyle");t.appendChild(o);const a=Object.keys(n);let d=a.length;for(;d--;)o.setAttribute(a[d],n[a[d]])}return t}exportDifferentialStyles(e){const t=e.createElement("dxfs");t.setAttribute("count",String(this.differentialStyles.length));for(let i=0,r=this.differentialStyles.length;i<r;i++){const n=this.differentialStyles[i];t.appendChild(this.exportDFX(e,n))}return t}exportDFX(e,t){const i=e.createElement("dxf");return t.font&&i.appendChild(this.exportFont(e,t.font)),t.fill&&i.appendChild(this.exportFill(e,t.fill)),t.border&&i.appendChild(this.exportBorder(e,t.border)),t.numFmt&&i.appendChild(this.exportNumberFormatter(e,t.numFmt)),t.alignment&&i.appendChild(this.exportAlignment(e,t.alignment)),i}exportTableStyles(e){const t=e.createElement("tableStyles");t.setAttribute("count",String(this.tableStyles.length)),this.defaultTableStyle&&t.setAttribute("defaultTableStyle",String(this.defaultTableStyle));for(let i=0,r=this.tableStyles.length;i<r;i++)t.appendChild(this.exportTableStyle(e,this.tableStyles[i]));return t}exportTableStyle(e,t){const i=e.createElement("tableStyle");i.setAttribute("name",t.name),i.setAttribute("pivot",String(0));let r=0;return Object.entries(t).forEach(([n,o])=>{if(n==="name")return;r++;const a=e.createElement("tableStyleElement");a.setAttribute("type",n),a.setAttribute("dxfId",o),i.appendChild(a)}),i.setAttribute("count",String(r)),i}exportProtection(e,t){const i=e.createElement("protection");for(const r in t)t.hasOwn(r)&&i.setAttribute(r,t[r]);return i}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"styleSheet"),t=e.documentElement;return t.appendChild(this.exportNumberFormatters(e)),t.appendChild(this.exportFonts(e)),t.appendChild(this.exportFills(e)),t.appendChild(this.exportBorders(e)),t.appendChild(this.exportMasterCellStyles(e)),t.appendChild(this.exportMasterCellFormats(e)),t.appendChild(this.exportCellStyles(e)),t.appendChild(this.exportDifferentialStyles(e)),this.tableStyles.length&&t.appendChild(this.exportTableStyles(e)),e}}class te{constructor(e){s(this,"name","");s(this,"id","");s(this,"tableId","");s(this,"displayName","");s(this,"dataCellStyle",null);s(this,"dataDfxId",null);s(this,"headerRowBorderDxfId",null);s(this,"headerRowCellStyle",null);s(this,"headerRowCount",1);s(this,"headerRowDxfId",null);s(this,"insertRow",!1);s(this,"insertRowShift",!1);s(this,"ref",null);s(this,"tableBorderDxfId",null);s(this,"totalsRowBorderDxfId",null);s(this,"totalsRowCellStyle",null);s(this,"totalsRowCount",0);s(this,"totalsRowDxfId",null);s(this,"tableColumns",[]);s(this,"autoFilter",null);s(this,"sortState",null);s(this,"styleInfo",{});this.initialize(e)}initialize(e){this.displayName=b("Table"),this.name=this.displayName,this.id=this.name,this.tableId=this.id.replace("Table",""),Object.assign(this,e)}setReferenceRange(e,t){this.ref=[e,t]}setTableColumns(e){e.forEach(t=>{this.addTableColumn(t)})}addTableColumn(e){if(F(e)&&(e={name:e}),!e.name)throw new Error("Invalid argument for addTableColumn - minimum requirement is a name property");this.tableColumns.push(e)}setSortState(e){this.sortState=e}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"table"),t=e.documentElement;t.setAttribute("id",this.tableId),t.setAttribute("name",this.name),t.setAttribute("displayName",this.displayName);const i=this.ref[0],r=this.ref[1];if(t.setAttribute("ref",`${l.positionToLetterRef(i[0],i[1])}:${l.positionToLetterRef(r[0],r[1])}`),t.setAttribute("totalsRowCount",this.totalsRowCount),t.setAttribute("headerRowCount",this.headerRowCount),this.headerRowDxfId&&t.setAttribute("headerRowDxfId",this.headerRowDxfId),this.headerRowBorderDxfId&&t.setAttribute("headerRowBorderDxfId",this.headerRowBorderDxfId),!this.ref)throw new Error("Needs at least a reference range");return this.autoFilter||this.addAutoFilter(this.ref[0],this.ref[1]),t.appendChild(this.exportAutoFilter(e)),t.appendChild(this.exportTableColumns(e)),t.appendChild(this.exportTableStyleInfo(e)),e}exportTableColumns(e){const t=e.createElement("tableColumns");t.setAttribute("count",this.tableColumns.length);const i=this.tableColumns;for(let r=0,n=i.length;r<n;r++){const o=i[r],a=e.createElement("tableColumn");a.setAttribute("id",String(r+1)),a.setAttribute("name",o.name),t.appendChild(a),o.totalsRowFunction&&a.setAttribute("totalsRowFunction",o.totalsRowFunction),o.totalsRowLabel&&a.setAttribute("totalsRowLabel",o.totalsRowLabel)}return t}exportAutoFilter(e){const t=e.createElement("autoFilter"),i=this.autoFilter[0],r=this.autoFilter[1];return t.setAttribute("ref",`${l.positionToLetterRef(i[0],i[1])}:${l.positionToLetterRef(r[0],r[1]-this.totalsRowCount)}`),t}exportTableStyleInfo(e){const t=this.styleInfo,i=e.createElement("tableStyleInfo");return i.setAttribute("name",t.themeStyle),i.setAttribute("showFirstColumn",t.showFirstColumn?"1":"0"),i.setAttribute("showLastColumn",t.showLastColumn?"1":"0"),i.setAttribute("showColumnStripes",t.showColumnStripes?"1":"0"),i.setAttribute("showRowStripes",t.showRowStripes?"1":"0"),i}addAutoFilter(e,t){this.autoFilter=[e,t]}}class J{constructor(e){s(this,"name","");s(this,"id",b("Worksheet"));s(this,"_timezoneOffset");s(this,"relations",null);s(this,"columnFormats",[]);s(this,"data",[]);s(this,"mergedCells",[]);s(this,"columns",[]);s(this,"sheetProtection",!1);s(this,"_headers",[]);s(this,"_footers",[]);s(this,"_tables",[]);s(this,"_drawings",[]);s(this,"_orientation");s(this,"_margin");s(this,"_rowInstructions",{});s(this,"_freezePane",{});s(this,"sharedStrings",null);s(this,"hyperlinks",[]);s(this,"sheetView");s(this,"showZeros",null);this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,this.sheetView=e.sheetView||new U,this.initialize(e)}initialize(e){e=e||{},this.name=e.name,this.id=b("Worksheet"),this._timezoneOffset=new Date().getTimezoneOffset()*60*1e3,e.columns&&this.setColumns(e.columns),this.relations=new O}exportData(){return{relations:this.relations.exportData(),columnFormats:this.columnFormats,data:this.data,columns:this.columns,mergedCells:this.mergedCells,_headers:this._headers,_footers:this._footers,_tables:this._tables,_rowInstructions:this._rowInstructions,_freezePane:this._freezePane,name:this.name,id:this.id}}importData(e){this.relations.importData(e.relations),delete e.relations,Object.assign(this,e)}setSharedStringCollection(e){this.sharedStrings=e}addTable(e){this._tables.push(e),this.relations.addRelation(e,"table")}addDrawings(e){this._drawings.push(e),this.relations.addRelation(e,"drawingRelationship")}setRowInstructions(e,t){this._rowInstructions[e]=t}setHeader(e){if(!Array.isArray(e))throw"Invalid argument type - setHeader expects an array of three instructions";this._headers=e}setFooter(e){if(!Array.isArray(e))throw"Invalid argument type - setFooter expects an array of three instructions";this._footers=e}compilePageDetailPackage(e){return e=e||"",["&L",this.compilePageDetailPiece(e[0]||""),"&C",this.compilePageDetailPiece(e[1]||""),"&R",this.compilePageDetailPiece(e[2]||"")].join("")}compilePageDetailPiece(e){if(F(e))return'&"-,Regular"'.concat(e);if(E(e)&&!Array.isArray(e)){let t="";if(e.font||e.bold){const i=e.bold?"Bold":"Regular";t+=`&"${e.font||"-"}`,t+=`,${i}"`}else t+='&"-,Regular"';return e.underline&&(t+="&U"),e.fontSize&&(t+=`&${e.fontSize}`),t+=e.text,t}if(Array.isArray(e))return e.reduce((t,i)=>t.concat(this.compilePageDetailPiece(i)),"")}exportHeader(e){const t=e.createElement("oddHeader");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._headers))),t}exportFooter(e){const t=e.createElement("oddFooter");return t.appendChild(e.createTextNode(this.compilePageDetailPackage(this._footers))),t}_buildCache(e){const t=e.createElement("c"),i=e.createElement("v");i.appendChild(e.createTextNode("--temp--")),t.appendChild(i);const r=e.createElement("c"),n=e.createElement("f");n.appendChild(e.createTextNode("--temp--")),r.appendChild(n);const o=e.createElement("c");o.setAttribute("t","s");const a=e.createElement("v");return a.appendChild(e.createTextNode("--temp--")),o.appendChild(a),{number:t,date:t,string:o,formula:r}}collectSharedStrings(){const e=this.data,t={};for(let i=0,r=e.length;i<r;i++){const n=e[i],o=n.length;for(let a=0;a<o;a++){let d=n[a];const m=(d==null?void 0:d.metadata)||{};d&&typeof d=="object"&&(d=d.value),m.type||typeof d=="number"&&(m.type="number"),(m.type==="text"||!m.type)&&typeof t[d]>"u"&&(t[d]=!0)}}return Object.keys(t)}toXML(){var k,N,v;const e=this.data,t=this.columns||[],i=l.createXmlDoc(l.schemas.spreadsheetml,"worksheet"),r=i.documentElement;let n,o,a;r.setAttribute("xmlns:r",l.schemas.relationships),r.setAttribute("xmlns:mc",l.schemas.markupCompat);let d=0;const m=l.createElement(i,"sheetData"),f=this._buildCache(i);for(a=0,o=e.length;a<o;a++){const c=e[a],C=c.length;d=C>d?C:d;const y=i.createElement("row");for(let u=0;u<C;u++){t[u]=t[u]||{};let g=c[u],w;const L=(g==null?void 0:g.metadata)||{};switch(g&&typeof g=="object"&&(g=g.value),L.type||typeof g=="number"&&(L.type="number"),L.type){case"number":w=f.number.cloneNode(!0),w.firstChild.firstChild.nodeValue=g;break;case"date":w=f.date.cloneNode(!0),g instanceof Date&&(g=g.getTime()),w.firstChild.firstChild.nodeValue=25569+(g-this._timezoneOffset)/864e5;break;case"formula":w=f.formula.cloneNode(!0),w.firstChild.firstChild.nodeValue=g;break;case"text":default:{let V;typeof((k=this.sharedStrings)==null?void 0:k.strings[g])<"u"?V=this.sharedStrings.strings[g]:V=(N=this.sharedStrings)==null?void 0:N.addString(g),w=f.string.cloneNode(!0),w.firstChild.firstChild.nodeValue=V;break}}L.style?w.setAttribute("s",L.style):((v=this._rowInstructions[a])==null?void 0:v.style)!==void 0&&w.setAttribute("s",this._rowInstructions[a].style),w.setAttribute("r",l.positionToLetterRef(u+1,String(a+1))),y.appendChild(w)}if(y.setAttribute("r",a+1),this._rowInstructions[a]){const u=this._rowInstructions[a];u.height!==void 0&&(y.setAttribute("customHeight","1"),y.setAttribute("ht",u.height)),u.style!==void 0&&(y.setAttribute("customFormat","1"),y.setAttribute("s",u.style))}m.appendChild(y)}if(d!==0?r.appendChild(l.createElement(i,"dimension",[["ref",`${l.positionToLetterRef(1,1)}:${l.positionToLetterRef(d,String(e.length))}`]])):r.appendChild(l.createElement(i,"dimension",[["ref",l.positionToLetterRef(1,1)]])),r.appendChild(this.sheetView.exportXML(i)),this.columns.length&&r.appendChild(this.exportColumns(i)),r.appendChild(m),this.sheetProtection&&r.appendChild(this.sheetProtection.exportXML(i)),this.hyperlinks.length>0){const c=i.createElement("hyperlinks"),C=this.hyperlinks;for(n=0,o=C.length;n<o;n++){const y=i.createElement("hyperlink"),u=C[n];y.setAttribute("ref",String(u.cell)),u.id=l.uniqueId("hyperlink"),this.relations.addRelation({id:u.id,target:u.location,targetMode:u.targetMode||"External"},"hyperlink"),y.setAttribute("r:id",this.relations.getRelationshipId(u)),c.appendChild(y)}r.appendChild(c)}if(this.mergedCells.length>0){const c=i.createElement("mergeCells");for(n=0,o=this.mergedCells.length;n<o;n++){const C=i.createElement("mergeCell");C.setAttribute("ref",`${this.mergedCells[n][0]}:${this.mergedCells[n][1]}`),c.appendChild(C)}r.appendChild(c)}if(this.exportPageSettings(i,r),this._headers.length>0||this._footers.length>0){const c=i.createElement("headerFooter");this._headers.length>0&&c.appendChild(this.exportHeader(i)),this._footers.length>0&&c.appendChild(this.exportFooter(i)),r.appendChild(c)}for(n=0,o=this._drawings.length;n<o;n++){const c=i.createElement("drawing");c.setAttribute("r:id",this.relations.getRelationshipId(this._drawings[n])),r.appendChild(c)}if(this._tables.length>0){const c=i.createElement("tableParts");for(c.setAttribute("count",this._tables.length),n=0,o=this._tables.length;n<o;n++){const C=i.createElement("tablePart");C.setAttribute("r:id",this.relations.getRelationshipId(this._tables[n])),c.appendChild(C)}r.appendChild(c)}return i}exportColumns(e){const t=l.createElement(e,"cols");for(let i=0,r=this.columns.length;i<r;i++){const n=this.columns[i],o=l.createElement(e,"col",[["min",n.min||i+1],["max",n.max||i+1]]);n.hidden&&o.setAttribute("hidden",String(1)),n.bestFit&&o.setAttribute("bestFit",String(1)),(n.customWidth||n.width)&&o.setAttribute("customWidth",String(1)),n.width?o.setAttribute("width",n.width):o.setAttribute("width",String(9.140625)),t.appendChild(o)}return t}exportPageSettings(e,t){if(this._margin){let i=.7;const r=this._margin.left?this._margin.left:i,n=this._margin.right?this._margin.right:i,o=this._margin.top?this._margin.top:i,a=this._margin.bottom?this._margin.bottom:i;i=.3;const d=this._margin.header?this._margin.header:i,m=this._margin.footer?this._margin.footer:i;t.appendChild(l.createElement(e,"pageMargins",[["top",o],["bottom",a],["left",r],["right",n],["header",d],["footer",m]]))}this._orientation&&t.appendChild(l.createElement(e,"pageSetup",[["orientation",this._orientation]]))}setPageOrientation(e){this._orientation=e}setPageMargin(e){this._margin=e}setColumns(e){this.columns=e}setData(e){this.data=e}mergeCells(e,t){this.mergedCells.push([e,t])}freezePane(e,t,i){this.sheetView.freezePane(e,t,i)}setColumnFormats(e){this.columnFormats=e}}class Z{constructor(){s(this,"id",b("Workbook"));s(this,"styleSheet",new X);s(this,"sharedStrings",new $);s(this,"relations",new O);s(this,"worksheets",[]);s(this,"tables",[]);s(this,"drawings",[]);s(this,"media",{});s(this,"printTitles");this.initialize()}initialize(){this.id=b("Workbook"),this.styleSheet=new X,this.sharedStrings=new $,this.relations=new O,this.relations.addRelation(this.styleSheet,"stylesheet"),this.relations.addRelation(this.sharedStrings,"sharedStrings")}createWorksheet(e){return e=Object.assign({},{name:"Sheet ".concat(String(this.worksheets.length+1))},e),new J(e)}getStyleSheet(){return this.styleSheet}addTable(e){this.tables.push(e)}addDrawings(e){this.drawings.push(e)}setPrintTitleTop(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].top=t}setPrintTitleLeft(e,t){this.printTitles==null&&(this.printTitles={}),this.printTitles[e]==null&&(this.printTitles[e]={}),this.printTitles[e].left=String.fromCharCode(64+t)}addMedia(e,t,i,r){const n=t.split("."),o=n[n.length-1];if(!r)switch(o.toLowerCase()){case"jpeg":case"jpg":r="image/jpeg";break;case"png":r="image/png";break;case"gif":r="image/gif";break;default:r=null;break}return this.media[t]||(this.media[t]={id:t,data:i,fileName:t,contentType:r,extension:o}),this.media[t]}addWorksheet(e){this.relations.addRelation(e,"worksheet"),e.setSharedStringCollection(this.sharedStrings),this.worksheets.push(e)}createContentTypes(){const e=l.createXmlDoc(l.schemas.contentTypes,"Types"),t=e.documentElement;let i,r;t.appendChild(l.createElement(e,"Default",[["Extension","rels"],["ContentType","application/vnd.openxmlformats-package.relationships+xml"]])),t.appendChild(l.createElement(e,"Default",[["Extension","xml"],["ContentType","application/xml"]]));const n={};for(const o in this.media)this.media.hasOwn(o)&&(n[this.media[o].extension]=this.media[o].contentType);for(const o in n)n.hasOwn(o)&&t.appendChild(l.createElement(e,"Default",[["Extension",o],["ContentType",n[o]]]));for(t.appendChild(l.createElement(e,"Override",[["PartName","/xl/workbook.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"]])),t.appendChild(l.createElement(e,"Override",[["PartName","/xl/sharedStrings.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"]])),t.appendChild(l.createElement(e,"Override",[["PartName","/xl/styles.xml"],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"]])),i=0,r=this.worksheets.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/worksheets/sheet${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"]]));for(i=0,r=this.tables.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/tables/table${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"]]));for(i=0,r=this.drawings.length;i<r;i++)t.appendChild(l.createElement(e,"Override",[["PartName",`/xl/drawings/drawing${i+1}.xml`],["ContentType","application/vnd.openxmlformats-officedocument.drawing+xml"]]));return e}toXML(){const e=l.createXmlDoc(l.schemas.spreadsheetml,"workbook"),t=e.documentElement;t.setAttribute("xmlns:r",l.schemas.relationships);const i=31,r=l.createElement(e,"sheets");for(let a=0,d=this.worksheets.length;a<d;a++){const m=e.createElement("sheet");typeof console<"u"&&this.worksheets[a].name.length>i&&console.log(`Microsoft Excel requires work sheet names to be less than ${i+1} characters long, work sheet name "${this.worksheets[a].name}" is ${this.worksheets[a].name.length} characters long`),m.setAttribute("name",this.worksheets[a].name),m.setAttribute("sheetId",a+1),m.setAttribute("r:id",this.relations.getRelationshipId(this.worksheets[a])),r.appendChild(m)}t.appendChild(r);const n=l.createElement(e,"definedNames");let o=0;for(const a in this.printTitles){if(!this.printTitles.hasOwn(a))continue;const d=this.printTitles[a],m=e.createElement("definedName");m.setAttribute("name","_xlnm.Print_Titles"),m.setAttribute("localSheetId",o++);let f="";d.top&&(f+=`${a}!$1:$${d.top}`,d.left&&(f+=",")),d.left&&(f+=`${a}!$A:$${d.left}`),m.appendChild(e.createTextNode(f)),n.appendChild(m)}return t.appendChild(n),e}createWorkbookRelationship(){const e=l.createXmlDoc(l.schemas.relationshipPackage,"Relationships");return e.documentElement.appendChild(l.createElement(e,"Relationship",[["Id","rId1"],["Type",l.schemas.officeDocument],["Target","xl/workbook.xml"]])),e}_generateCorePaths(e){let t,i;for(A[this.styleSheet.id]="styles.xml",A[this.sharedStrings.id]="sharedStrings.xml",A[this.id]="/xl/workbook.xml",t=0,i=this.tables.length;t<i;t++)e[`/xl/tables/table${t+1}.xml`]=this.tables[t].toXML(),A[this.tables[t].id]=`/xl/tables/table${t+1}.xml`;for(const r in this.media)if(this.media.hasOwn(r)){const n=this.media[r];e[`/xl/media/${r}`]=n.data,A[r]=`/xl/media/${r}`}for(t=0,i=this.drawings.length;t<i;t++)e[`/xl/drawings/drawing${t+1}.xml`]=this.drawings[t].toXML(),A[this.drawings[t].id]=`/xl/drawings/drawing${t+1}.xml`,e[`/xl/drawings/_rels/drawing${t+1}.xml.rels`]=this.drawings[t].relations.toXML()}_prepareFilesForPackaging(e){Object.assign(e,{"/[Content_Types].xml":this.createContentTypes(),"/_rels/.rels":this.createWorkbookRelationship(),"/xl/styles.xml":this.styleSheet.toXML(),"/xl/workbook.xml":this.toXML(),"/xl/sharedStrings.xml":this.sharedStrings.toXML(),"/xl/_rels/workbook.xml.rels":this.relations.toXML()});for(const[t,i]of Object.entries(e))if(t.indexOf(".xml")!==-1||t.indexOf(".rels")!==-1){i instanceof P?e[t]=i.toString():e[t]=i.xml||new window.XMLSerializer().serializeToString(i);let r=e[t].replace(/xmlns=""/g,"");r=r.replace(/NS[\d]+:/g,""),r=r.replace(/xmlns:NS[\d]+=""/g,""),e[t]=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
${r}`}}generateFiles(){return new Promise(e=>{const t={};this._generateCorePaths(t);for(let i=0,r=this.worksheets.length;i<r;i++)t[`/xl/worksheets/sheet${i+1}.xml`]=this.worksheets[i].toXML(),A[this.worksheets[i].id]=`worksheets/sheet${i+1}.xml`,t[`/xl/worksheets/_rels/sheet${i+1}.xml.rels`]=this.worksheets[i].relations.toXML();return this._prepareFilesForPackaging(t),e(t)})}}function ie(){return new Z}function K(h,e,t){const i={};return new Promise((r,n)=>{h.generateFiles().then(o=>{for(const[a,d]of Object.entries(o))i[a.substr(1)]=S.strToU8(d);return S.zip(i,(t==null?void 0:t.zipOptions)||{},(a,d)=>{if(a){n(a);return}if(e==="Uint8Array")r(d);else{const m=(t==null?void 0:t.fileFormat)??"xlsx";let f=t==null?void 0:t.mimeType;f===void 0&&(f=m==="xls"?"application/vnd.ms-excel":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"),r(new Blob([d],{type:f}))}})})})}function re(h,e,t){if((t==null?void 0:t.downloadType)==="node")throw new Error('[Excel-Builder-Vanilla] Please note that `downloadExcelFile()` is currently only supporting the "browser" download type at the moment.');const i=e.match(/.*\.xls$/)?"xls":"xlsx";return K(h,"Blob",{...t,fileFormat:i}).then(r=>{se(e,r)})}function se(h,e){const t=document.createElement("a"),i=URL.createObjectURL(e);t&&document&&(t.textContent="download",t.href=i,t.setAttribute("download",h),t.style.visibility="hidden",document.body.appendChild(t),t.click(),document.body.removeChild(t),URL.revokeObjectURL(i))}return p.AbsoluteAnchor=I,p.Chart=G,p.Drawing=q,p.Drawings=Y,p.OneCellAnchor=D,p.Pane=H,p.Paths=A,p.Picture=Q,p.Positioning=ee,p.RelationshipManager=O,p.SharedStrings=$,p.SheetView=U,p.StyleSheet=X,p.Table=te,p.TwoCellAnchor=z,p.Util=l,p.Workbook=Z,p.Worksheet=J,p.XMLDOM=P,p.XMLNode=R,p.createExcelFile=K,p.createWorkbook=ie,p.downloadExcelFile=re,p.htmlEscape=_,p.isObject=E,p.isPlainObject=B,p.isString=F,p.pick=j,p.uniqueId=b,Object.defineProperty(p,Symbol.toStringTag,{value:"Module"}),p}({},fflate);
//# sourceMappingURL=excel-builder.iife.js.map

@@ -19,4 +19,4 @@ import type { Drawing } from './Drawing/Drawing';

getCount(): number;
toXML(): import("src").XMLDOM;
toXML(): import("./XMLDOM").XMLDOM;
}
//# sourceMappingURL=Drawings.d.ts.map

@@ -42,4 +42,4 @@ import { Util } from './Util';

}): string | null;
toXML(): import("src").XMLDOM;
toXML(): import("./XMLDOM").XMLDOM;
}
//# sourceMappingURL=RelationshipManager.d.ts.map

@@ -21,4 +21,4 @@ /**

};
toXML(): import("src").XMLDOM;
toXML(): import("./XMLDOM").XMLDOM;
}
//# sourceMappingURL=SharedStrings.d.ts.map

@@ -90,8 +90,9 @@ /**

}
export interface ExcelMetadata {
type?: string;
style?: number;
}
export interface ExcelColumnMetadata {
value: any;
metadata?: {
type?: string;
style?: number;
};
metadata?: ExcelMetadata;
}

@@ -98,0 +99,0 @@ export interface ExcelMargin {

{
"name": "excel-builder-vanilla",
"version": "3.0.0",
"version": "3.0.1",
"description": "An easy way of building Excel files with javascript",

@@ -57,3 +57,3 @@ "keywords": [

},
"gitHead": "637cd50190064d679f54cdb93e2f2d912782adfc"
"gitHead": "f00006d47223047373ddf5177e3d05e0d64a723e"
}

@@ -19,3 +19,3 @@ # Excel-Builder-Vanilla

1. ESM: to `import from` (prefered)
2. CJS: CommonJS to support old Node `require()`... might be removed in the future
2. CJS: CommonJS to support old Node `require()` - will possibly be removed in the future
3. IIFE: standalone script with `ExcelBuilder` available on the `window` object

@@ -32,2 +32,5 @@

<script src="https://cdn.jsdelivr.net/npm/excel-builder-vanilla@3.0.0/dist/excel-builder.iife.js"></script>
<script>
const worksheet = ExcelBuilder.createWorksheet();
</script>
```

@@ -34,0 +37,0 @@

@@ -45,3 +45,3 @@ import { uniqueId } from '../utilities';

const clone = template.cloneNode(true);
if (strings[l]?.match(/\s+/)) {
if (typeof strings[l] === 'string' && strings[l].match(/\s+/)) {
clone.firstChild!.setAttribute('xml:space', 'preserve');

@@ -48,0 +48,0 @@ }

@@ -117,8 +117,10 @@ /**

export interface ExcelMetadata {
type?: string;
style?: number;
}
export interface ExcelColumnMetadata {
value: any;
metadata?: {
type?: string;
style?: number;
};
metadata?: ExcelMetadata;
}

@@ -125,0 +127,0 @@

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is too big to display

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc