@justybase/spreadsheet-tasks 2.2.0 → 3.1.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,4 +1,4 @@
1
- "use strict";var JustybaseSpreadsheet=(()=>{var $=Object.defineProperty;var M=Object.getOwnPropertyDescriptor;var z=Object.getOwnPropertyNames;var b=Object.prototype.hasOwnProperty;var O=(d,t)=>{for(var e in t)$(d,e,{get:t[e],enumerable:!0})},H=(d,t,e,x)=>{if(t&&typeof t=="object"||typeof t=="function")for(let s of z(t))!b.call(d,s)&&s!==e&&$(d,s,{get:()=>t[s],enumerable:!(x=M(t,s))||x.enumerable});return d};var W=d=>H($({},"__esModule",{value:!0}),d);var G={};O(G,{BrowserBigBuffer:()=>y,BrowserXlsbWriter:()=>C,BrowserXlsxWriter:()=>S,BrowserZip:()=>F,F:()=>V,downloadXlsb:()=>q,downloadXlsbMultiSheet:()=>j,downloadXlsx:()=>X,downloadXlsxMultiSheet:()=>Y});var y=class{constructor(t=65536){this.chunkSize=t,this.chunks=[],this.currentBuffer=new Uint8Array(t),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0,this._textEncoder=new TextEncoder}ensureCapacity(t){this.cursor+t>this.chunkSize&&this._flush()}_flush(){this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0)}write(t){let e=t.length,x=0;for(;e>0;){let s=this.chunkSize-this.cursor;s===0&&(this._flush(),s=this.chunkSize);let i=Math.min(e,s);this.currentBuffer.set(t.subarray(x,x+i),this.cursor),this.cursor+=i,x+=i,e-=i}}writeByte(t){this.ensureCapacity(1),this.currentBuffer[this.cursor]=t,this.cursor++}writeUnsafeByte(t){this.currentBuffer[this.cursor++]=t}writeInt32LE(t){this.ensureCapacity(4),this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeUnsafeInt32LE(t){this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeDoubleLE(t){this.ensureCapacity(8),this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeUnsafeDoubleLE(t){this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeString(t){let e=this._textEncoder.encode(t),x=e.length;if(this.cursor+x<=this.chunkSize){this.currentBuffer.set(e,this.cursor),this.cursor+=x;return}this._flush(),x>this.chunkSize?this.chunks.push(e):(this.currentBuffer.set(e,this.cursor),this.cursor+=x)}writeUtf16LE(t){let e=t.length*2;if(this.cursor+e<=this.chunkSize){for(let x=0;x<t.length;x++){let s=t.charCodeAt(x);this.currentBuffer[this.cursor++]=s&255,this.currentBuffer[this.cursor++]=s>>8&255}return}if(this._flush(),e>this.chunkSize){let x=new Uint8Array(e);for(let s=0;s<t.length;s++){let i=t.charCodeAt(s);x[s*2]=i&255,x[s*2+1]=i>>8&255}this.chunks.push(x)}else for(let x=0;x<t.length;x++){let s=t.charCodeAt(x);this.currentBuffer[this.cursor++]=s&255,this.currentBuffer[this.cursor++]=s>>8&255}}getChunks(){return this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0),this.chunks}toUint8Array(){let t=this.getChunks(),e=0;for(let i of t)e+=i.length;let x=new Uint8Array(e),s=0;for(let i of t)x.set(i,s),s+=i.length;return x}reset(){this.chunks=[],this.cursor=0}};var F=class d{constructor(){this.files=[]}addFile(t,e){let x;if(typeof e=="string")x=new TextEncoder().encode(e);else if(Array.isArray(e)){let s=0;for(let n of e)s+=n.length;x=new Uint8Array(s);let i=0;for(let n of e)x.set(n,i),i+=n.length}else x=e;this.files.push({name:t,data:x})}toBlob(){let t=[],e=[],x=0;for(let o of this.files){let f=new TextEncoder().encode(o.name),c=this._crc32(o.data),h=new Uint8Array(30+f.length),l=new DataView(h.buffer);l.setUint32(0,67324752,!0),l.setUint16(4,20,!0),l.setUint16(6,0,!0),l.setUint16(8,0,!0),l.setUint16(10,0,!0),l.setUint16(12,0,!0),l.setUint32(14,c,!0),l.setUint32(18,o.data.length,!0),l.setUint32(22,o.data.length,!0),l.setUint16(26,f.length,!0),l.setUint16(28,0,!0),h.set(f,30),t.push(h),t.push(o.data);let a=new Uint8Array(46+f.length),m=new DataView(a.buffer);m.setUint32(0,33639248,!0),m.setUint16(4,20,!0),m.setUint16(6,20,!0),m.setUint16(8,0,!0),m.setUint16(10,0,!0),m.setUint16(12,0,!0),m.setUint16(14,0,!0),m.setUint32(16,c,!0),m.setUint32(20,o.data.length,!0),m.setUint32(24,o.data.length,!0),m.setUint16(28,f.length,!0),m.setUint16(30,0,!0),m.setUint16(32,0,!0),m.setUint16(34,0,!0),m.setUint16(36,0,!0),m.setUint32(38,0,!0),m.setUint32(42,x,!0),a.set(f,46),e.push(a),x+=h.length+o.data.length}let s=x,i=0;for(let o of e)t.push(o),i+=o.length;let n=new Uint8Array(22),r=new DataView(n.buffer);return r.setUint32(0,101010256,!0),r.setUint16(4,0,!0),r.setUint16(6,0,!0),r.setUint16(8,this.files.length,!0),r.setUint16(10,this.files.length,!0),r.setUint32(12,i,!0),r.setUint32(16,s,!0),r.setUint16(20,0,!0),t.push(n),new Blob(t,{type:"application/octet-stream"})}_crc32(t){if(!d._crc32Table){d._crc32Table=new Uint32Array(256);for(let s=0;s<256;s++){let i=s;for(let n=0;n<8;n++)i=i&1?3988292384^i>>>1:i>>>1;d._crc32Table[s]=i}}let e=d._crc32Table,x=4294967295;for(let s=0;s<t.length;s++)x=e[(x^t[s])&255]^x>>>8;return(x^4294967295)>>>0}};F._crc32Table=null;var V={THOUSANDS_SEP:"#,##0",CURRENCY_PLN:'#,##0.00 "z\u0142"',CURRENCY_EUR:"#,##0.00 \u20AC",PERCENTAGE:"0%",SCIENTIFIC:"0.00E+00",TWO_DECIMALS:"#,##0.00",TEXT:"@",LEADING_ZEROS:"000000000",DATE_SHORT:"dd.mm.yyyy",DATE_LONG:"d mmmm yyyy",DATE_DAY_MONTH_YEAR:"dd-mm-yyyy",DATE_ISO:"yyyy-mm-dd",DATE_MONTH_YEAR:"mmmm yyyy",DATE_WEEKDAY:"dddd, d mmmm yyyy",DATE_DAY_MONTH:"d mmmm",DATE_YEAR_ONLY:"yyyy",DATETIME_SHORT:"dd.mm.yyyy hh:mm",DATETIME_LONG:"d mmmm yyyy hh:mm:ss",TIME_HH_MM:"hh:mm",TIME_HH_MM_SS:"hh:mm:ss",TIME_12H:"h:mm AM/PM",DATETIME_24H:"dd.mm.yyyy hh:mm:ss",DATETIME_ISO:'yyyy-mm-dd"T"hh:mm:ss',TIME_MS:"hh:mm:ss.000"};function A(d){return d!=null&&typeof d=="object"&&"format"in d&&typeof d.format=="string"}function D(d){return A(d)?d.value:d}function T(d){return A(d)?d.format:null}var N=(()=>{let d=[];for(let e=65;e<91;e++)d.push(String.fromCharCode(e));let t=[];for(let e of d)for(let x=65;x<91;x++)t.push(e+String.fromCharCode(x));return d.push(...t),d})(),S=class{constructor(){this._zip=new F,this._sc=0,this._sl=[],this._sstA=[],this._sstM=new Map,this._sstCnt=0,this._cw=[],this._afOn=!1,this._oaE=Date.UTC(1899,11,30),this._csb=null,this._csrn=0,this._csSC=0,this._csEC=0,this._csAF=!1,this._isS=!1,this._csCL=[],this._fmtReg=new Map,this._fmtXf=new Map,this._nextNfmt=165,this._nextXf=6}_cl(t){return t<N.length?N[t]:"A"}_san(t){if(!t||typeof t!="string")return`Sheet${this._sc+1}`;let e=t.replace(/[\\/*?[\]:]/g,"_");return e.length>31&&(e=e.substring(0,31)),e.trim()||(e=`Sheet${this._sc+1}`),e}_ex(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}_esc(t){if(typeof t!="string")return t;let e=!1;for(let i=0;i<t.length;i++){let n=t.charCodeAt(i);if(n===38||n===60||n===62||n===34||n===39||n>=0&&n<=8||n===11||n===12||n>=14&&n<=31){e=!0;break}}if(!e)return t;let x=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;"),s="";for(let i=0;i<x.length;i++){let n=x.charCodeAt(i);n<=8||n===11||n===12||n>=14&&n<=31||(s+=x[i])}return s}_fmn(t){return/[\s\-+=()!@#$%^&]/.test(t)||/^[0-9]/.test(t)?`'${t.replace(/'/g,"''")}'`:t}addSheet(t,e=!1){let x=this._san(t);this._sc++,this._sl.push({name:x,path:`xl/worksheets/sheet${this._sc}.xml`,hidden:e,fn:`sheet${this._sc}.xml`,id:this._sc,rId:`rId${this._sc}`,fhr:null})}_wsc(t,e,x,s,i){let n=this._sstM.get(e);n===void 0&&(n=this._sstA.length,this._sstA.push(e),this._sstM.set(e,n)),this._sstCnt++;let r=i!==void 0?` s="${i}"`:"";t.writeString(`<c r="${x}${s}" t="s"${r}><v>${n}</v></c>`)}_wscStyle(t,e,x,s,i){let n=this._sstM.get(e);n===void 0&&(n=this._sstA.length,this._sstA.push(e),this._sstM.set(e,n)),this._sstCnt++,t.writeString(`<c r="${x}${s}" t="s" s="${i}"><v>${n}</v></c>`)}_oa(t){return(t.getTime()-this._oaE)/864e5}_regFmt(t){if(this._fmtXf.has(t))return this._fmtXf.get(t);let e=this._nextNfmt++;this._fmtReg.set(t,e);let x=this._nextXf++;return this._fmtXf.set(t,x),x}_wcv(t,e,x,s){if(e==null)return;let i=T(e),n=i!==null?D(e):e,r=i!==null?this._regFmt(i):-1,o=r>=0?` s="${r}"`:"";if(typeof n=="number")Number.isFinite(n)?t.writeString(`<c r="${x}${s}"${o}><v>${n}</v></c>`):this._wsc(t,n.toString(),x,s,r>=0?r:void 0);else if(typeof n=="bigint")this._wsc(t,n.toString(),x,s,r>=0?r:void 0);else if(typeof n=="boolean")t.writeString(`<c r="${x}${s}" t="b"${o}><v>${n?1:0}</v></c>`);else if(n instanceof Date){let f=this._oa(n);Number.isFinite(f)?t.writeString(`<c r="${x}${s}" s="${r>=0?r:1}"><v>${f}</v></c>`):this._wsc(t,n.toString(),x,s,r>=0?r:void 0)}else this._wsc(t,n.toString(),x,s,r>=0?r:void 0)}_sheetHead(t,e,x,s){t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'),t.writeString('<dimension ref="A1"/>'),s?t.writeString(`<sheetViews><sheetView ${x?'tabSelected="1" ':""}workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>`):t.writeString(`<sheetViews><sheetView ${x?'tabSelected="1" ':""}workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/>`),t.writeString("<cols>");for(let i=0;i<e;i++){let n=this._cw[i]>0?this._cw[i]:10;t.writeString(`<col min="${i+1}" max="${i+1}" width="${n}" bestFit="1" customWidth="1"/>`)}t.writeString("</cols><sheetData>")}startSheet(t,e,x,s={}){if(this._isS)throw new Error("Already streaming");let{hidden:i=!1,doAutofilter:n=!0,headerStyle:r="bold"}=s,o=3;r==="fill"?o=4:r==="bold+fill"&&(o=5),this.addSheet(t,i),this._isS=!0,this._csb=new y,this._csrn=0,this._csSC=0,this._csEC=e,this._csAF=n&&x!==void 0,this._cw=new Array(e).fill(-1);let f=new Array(e);for(let c=0;c<e;c++)f[c]=this._cl(c);if(this._csCL=f,x)for(let c=0;c<e;c++){let h=1.3*(x[c]?x[c].length:0)+3;h>80&&(h=80),this._cw[c]<h&&(this._cw[c]=h)}if(this._sheetHead(this._csb,e,this._sc===1,this._csAF),x){this._csrn++,this._csb.writeString(`<row r="${this._csrn}">`);for(let c=0;c<x.length;c++)this._wscStyle(this._csb,x[c],f[c],this._csrn,o);this._csb.writeString("</row>")}}writeRow(t){if(!this._isS)throw new Error("Not streaming");this._csrn++,this._csb.writeString(`<row r="${this._csrn}">`);for(let e=0;e<t.length;e++)this._wcv(this._csb,t[e],this._csCL[e],this._csrn);this._csb.writeString("</row>")}endSheet(){if(!this._isS)throw new Error("Not streaming");if(this._csb.writeString("</sheetData>"),this._csAF&&this._csEC>0){this._afOn=!0;let t=`A1:${this._csCL[this._csEC-1]}${this._csrn}`;this._csb.writeString(`<autoFilter ref="${t}"/>`);let e=this._sl[this._sc-1];e.fhr=`${this._fmn(e.name)}!$A$1:$${this._csCL[this._csEC-1]}$${this._csrn}`}this._csb.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,this._csb.toUint8Array()),this._isS=!1,this._csb=null}writeSheet(t,e=null,x={}){let s=x.doAutofilter!==!1,i=x.headerStyle||"bold",n=3;i==="fill"?n=4:i==="bold+fill"&&(n=5);let r=new y,o=t.length>0?t[0].length:e?e.length:0;this._cw=new Array(o).fill(-1);let f=new Array(o);for(let l=0;l<o;l++)f[l]=this._cl(l);if(e)for(let l=0;l<o;l++){let a=1.3*(e[l]?e[l].length:0)+3;a>80&&(a=80),this._cw[l]<a&&(this._cw[l]=a)}for(let l=0;l<Math.min(t.length,100);l++)for(let a=0;a<t[l].length;a++){let m=t[l][a];if(m==null)continue;let g=A(m)?m.value:m,p=1.3*(g instanceof Date?10:g.toString().length)+3;p>80&&(p=80),this._cw[a]<p&&(this._cw[a]=p)}let c=t.length+(e?1:0);this._sheetHead(r,o,this._sc===1,s&&!!e);let h=0;if(e){h++,r.writeString(`<row r="${h}">`);for(let l=0;l<e.length;l++)this._wscStyle(r,e[l],f[l],h,n);r.writeString("</row>")}for(let l=0;l<t.length;l++){h++,r.writeString(`<row r="${h}">`);for(let a=0;a<t[l].length;a++)this._wcv(r,t[l][a],f[a],h);r.writeString("</row>")}if(r.writeString("</sheetData>"),s&&e&&o>0){this._afOn=!0;let l=`A1:${f[o-1]}${c}`;r.writeString(`<autoFilter ref="${l}"/>`);let a=this._sl[this._sc-1];a.fhr=`${this._fmn(a.name)}!$A$1:$${f[o-1]}$${c}`}r.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,r.toUint8Array())}finalize(){return this._writeSst(),this._writeStyles(),this._writeWb(),this._writeCt(),this._writeRels(),this._zip.toBlob()}_writeSst(){let t=new y;t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString(`<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${this._sstCnt}" uniqueCount="${this._sstA.length}">`);for(let e of this._sstA){let x=this._esc(e);x.length>0&&(x[0]===" "||x[x.length-1]===" "||/[\t\n\r]/.test(x))?t.writeString(`<si><t xml:space="preserve">${x}</t></si>`):t.writeString(`<si><t>${x}</t></si>`)}t.writeString("</sst>"),this._zip.addFile("xl/sharedStrings.xml",t.toUint8Array())}_writeStyles(){let t='<numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd\\ hh:mm:ss"/>',e=1,x=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>','<xf numFmtId="14" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>','<xf numFmtId="0" fontId="0" fillId="1" borderId="0" xfId="0" applyFill="1"/>','<xf numFmtId="0" fontId="1" fillId="1" borderId="0" xfId="0" applyFont="1" applyFill="1"/>'];for(let[i,n]of this._fmtReg){let r=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");t+=`<numFmt numFmtId="${n}" formatCode="${r}"/>`,e++}let s=[...this._fmtXf.entries()].sort((i,n)=>i[1]-n[1]);for(let[i]of s){let n=this._fmtReg.get(i);x.push(`<xf numFmtId="${n}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`)}this._zip.addFile("xl/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
1
+ "use strict";var JustybaseSpreadsheet=(()=>{var N=Object.defineProperty;var q=Object.getOwnPropertyDescriptor;var Y=Object.getOwnPropertyNames;var j=Object.prototype.hasOwnProperty;var G=(h,t)=>{for(var e in t)N(h,e,{get:t[e],enumerable:!0})},K=(h,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let x of Y(t))!j.call(h,x)&&x!==e&&N(h,x,{get:()=>t[x],enumerable:!(r=q(t,x))||r.enumerable});return h};var J=h=>K(N({},"__esModule",{value:!0}),h);var s0={};G(s0,{BrowserBigBuffer:()=>g,BrowserXlsbWriter:()=>U,BrowserXlsxWriter:()=>E,BrowserZip:()=>B,F:()=>z,downloadXlsb:()=>i0,downloadXlsbMultiSheet:()=>n0,downloadXlsx:()=>r0,downloadXlsxMultiSheet:()=>x0});var g=class{constructor(t=65536){this.chunkSize=t,this.chunks=[],this.currentBuffer=new Uint8Array(t),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0,this._textEncoder=new TextEncoder}ensureCapacity(t){this.cursor+t>this.chunkSize&&this._flush()}_flush(){this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0)}write(t){let e=t.length,r=0;for(;e>0;){let x=this.chunkSize-this.cursor;x===0&&(this._flush(),x=this.chunkSize);let i=Math.min(e,x);this.currentBuffer.set(t.subarray(r,r+i),this.cursor),this.cursor+=i,r+=i,e-=i}}writeByte(t){this.ensureCapacity(1),this.currentBuffer[this.cursor]=t,this.cursor++}writeUnsafeByte(t){this.currentBuffer[this.cursor++]=t}writeInt32LE(t){this.ensureCapacity(4),this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeUnsafeInt32LE(t){this.dataView.setInt32(this.cursor,t,!0),this.cursor+=4}writeDoubleLE(t){this.ensureCapacity(8),this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeUnsafeDoubleLE(t){this.dataView.setFloat64(this.cursor,t,!0),this.cursor+=8}writeString(t){let e=this._textEncoder.encode(t),r=e.length;if(this.cursor+r<=this.chunkSize){this.currentBuffer.set(e,this.cursor),this.cursor+=r;return}this._flush(),r>this.chunkSize?this.chunks.push(e):(this.currentBuffer.set(e,this.cursor),this.cursor+=r)}writeUtf16LE(t){let e=t.length*2;if(this.cursor+e<=this.chunkSize){for(let r=0;r<t.length;r++){let x=t.charCodeAt(r);this.currentBuffer[this.cursor++]=x&255,this.currentBuffer[this.cursor++]=x>>8&255}return}if(this._flush(),e>this.chunkSize){let r=new Uint8Array(e);for(let x=0;x<t.length;x++){let i=t.charCodeAt(x);r[x*2]=i&255,r[x*2+1]=i>>8&255}this.chunks.push(r)}else for(let r=0;r<t.length;r++){let x=t.charCodeAt(r);this.currentBuffer[this.cursor++]=x&255,this.currentBuffer[this.cursor++]=x>>8&255}}getChunks(){return this.cursor>0&&(this.chunks.push(this.currentBuffer.slice(0,this.cursor)),this.currentBuffer=new Uint8Array(this.chunkSize),this.dataView=new DataView(this.currentBuffer.buffer),this.cursor=0),this.chunks}toUint8Array(){let t=this.getChunks(),e=0;for(let i of t)e+=i.length;let r=new Uint8Array(e),x=0;for(let i of t)r.set(i,x),x+=i.length;return r}reset(){this.chunks=[],this.cursor=0}};var B=class h{constructor(){this.files=[];this.files=[]}static{this._crc32Table=null}addFile(t,e){let r;if(typeof e=="string")r=new TextEncoder().encode(e);else if(Array.isArray(e)){let x=0;for(let l of e)x+=l.length;r=new Uint8Array(x);let i=0;for(let l of e)r.set(l,i),i+=l.length}else r=e;this.files.push({name:t,data:r})}toBlob(){let t=[],e=[],r=0;for(let s of this.files){let u=new TextEncoder().encode(s.name),d=this._crc32(s.data),a=new Uint8Array(30+u.length),n=new DataView(a.buffer);n.setUint32(0,67324752,!0),n.setUint16(4,20,!0),n.setUint16(6,0,!0),n.setUint16(8,0,!0),n.setUint16(10,0,!0),n.setUint16(12,0,!0),n.setUint32(14,d,!0),n.setUint32(18,s.data.length,!0),n.setUint32(22,s.data.length,!0),n.setUint16(26,u.length,!0),n.setUint16(28,0,!0),a.set(u,30),t.push(a),t.push(s.data);let f=new Uint8Array(46+u.length),c=new DataView(f.buffer);c.setUint32(0,33639248,!0),c.setUint16(4,20,!0),c.setUint16(6,20,!0),c.setUint16(8,0,!0),c.setUint16(10,0,!0),c.setUint16(12,0,!0),c.setUint16(14,0,!0),c.setUint32(16,d,!0),c.setUint32(20,s.data.length,!0),c.setUint32(24,s.data.length,!0),c.setUint16(28,u.length,!0),c.setUint16(30,0,!0),c.setUint16(32,0,!0),c.setUint16(34,0,!0),c.setUint16(36,0,!0),c.setUint32(38,0,!0),c.setUint32(42,r,!0),f.set(u,46),e.push(f),r+=a.length+s.data.length}let x=r,i=0;for(let s of e)t.push(s),i+=s.length;let l=new Uint8Array(22),o=new DataView(l.buffer);return o.setUint32(0,101010256,!0),o.setUint16(4,0,!0),o.setUint16(6,0,!0),o.setUint16(8,this.files.length,!0),o.setUint16(10,this.files.length,!0),o.setUint32(12,i,!0),o.setUint32(16,x,!0),o.setUint16(20,0,!0),t.push(l),new Blob(t,{type:"application/octet-stream"})}_crc32(t){if(!h._crc32Table){h._crc32Table=new Uint32Array(256);for(let x=0;x<256;x++){let i=x;for(let l=0;l<8;l++)i=i&1?3988292384^i>>>1:i>>>1;h._crc32Table[x]=i}}let e=h._crc32Table,r=4294967295;for(let x=0;x<t.length;x++)r=e[(r^t[x])&255]^r>>>8;return(r^4294967295)>>>0}};var z={THOUSANDS_SEP:"#,##0",CURRENCY_PLN:'#,##0.00 "z\u0142"',CURRENCY_EUR:"#,##0.00 \u20AC",PERCENTAGE:"0%",SCIENTIFIC:"0.00E+00",TWO_DECIMALS:"#,##0.00",TEXT:"@",LEADING_ZEROS:"000000000",DATE_SHORT:"dd.mm.yyyy",DATE_LONG:"d mmmm yyyy",DATE_DAY_MONTH_YEAR:"dd-mm-yyyy",DATE_ISO:"yyyy-mm-dd",DATE_MONTH_YEAR:"mmmm yyyy",DATE_WEEKDAY:"dddd, d mmmm yyyy",DATE_DAY_MONTH:"d mmmm",DATE_YEAR_ONLY:"yyyy",DATETIME_SHORT:"dd.mm.yyyy hh:mm",DATETIME_LONG:"d mmmm yyyy hh:mm:ss",TIME_HH_MM:"hh:mm",TIME_HH_MM_SS:"hh:mm:ss",TIME_12H:"h:mm AM/PM",DATETIME_24H:"dd.mm.yyyy hh:mm:ss",DATETIME_ISO:'yyyy-mm-dd"T"hh:mm:ss',TIME_MS:"hh:mm:ss.000"};function C(h){return h!=null&&typeof h=="object"&&"format"in h&&typeof h.format=="string"}function R(h){return C(h)?h.value:h}function L(h){return C(h)?h.format:null}function H(h){let t=h+1,e="";for(;t>0;){let r=(t-1)%26;e=String.fromCharCode(65+r)+e,t=Math.floor((t-1)/26)}return e}var Q=Date.UTC(1899,11,30),t0=Date.UTC(1900,2,1);function k(h,t){let e=(h-t)/864e5;return t===Q&&h<t0&&(e-=1),e}var X=1048576,W=16384,P=32767;function y(h){if(h.length>P)throw new Error(`Excel cell text exceeds ${P} UTF-16 code units (got ${h.length}).`)}function I(h){if(!Number.isInteger(h)||h<1||h>W)throw new Error(`Excel column count must be 1..${W} (got ${h}).`)}function S(h,t,e){if(t>e)throw new Error(`Excel ${h} length ${t} exceeds columnCount ${e}.`)}function v(h){if(h>X)throw new Error(`Excel row count exceeds ${X} (got ${h}).`)}function Z(h,t,e,r){return h===t+1?"":` r="${e}${r}"`}var E=class{constructor(){this._zip=new B,this._sc=0,this._sl=[],this._sstA=[],this._sstM=new Map,this._sstCnt=0,this._cw=[],this._afOn=!1,this._oaE=Date.UTC(1899,11,30),this._csb=null,this._csrn=0,this._csSC=0,this._csEC=0,this._csAF=!1,this._isS=!1,this._csCL=[],this._fmtReg=new Map,this._fmtXf=new Map,this._nextNfmt=165,this._nextXf=6}_cl(t){return H(t)}_san(t){if(!t||typeof t!="string")return`Sheet${this._sc+1}`;let e=t.replace(/[\\/*?[\]:]/g,"_");return e.length>31&&(e=e.substring(0,31)),e.trim()||(e=`Sheet${this._sc+1}`),e}_ex(t){return t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;")}_esc(t){t=t.replace(/_x([0-9A-Fa-f]{4})_/g,"_x005F_x$1_");let e=!1;for(let i=0;i<t.length;i++){let l=t.charCodeAt(i);if(l===38||l===60||l===62||l===34||l===39||l===13||l>=0&&l<=8||l===11||l===12||l>=14&&l<=31){e=!0;break}}if(!e)return t;let r=t.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;").replace(/\r/g,"&#13;"),x="";for(let i=0;i<r.length;i++){let l=r.charCodeAt(i);l<=8||l===11||l===12||l>=14&&l<=31||(x+=r[i])}return x}_fmn(t){return/[\s\-+=()!@#$%^&]/.test(t)||/^[0-9]/.test(t)?`'${t.replace(/'/g,"''")}'`:t}addSheet(t,e=!1){let r=this._san(t);this._sc++,this._sl.push({name:r,path:`xl/worksheets/sheet${this._sc}.xml`,hidden:e,fn:`sheet${this._sc}.xml`,id:this._sc,rId:`rId${this._sc}`,fhr:null})}_wsc(t,e,r,x){y(e);let i=this._sstM.get(e);i===void 0&&(i=this._sstA.length,this._sstA.push(e),this._sstM.set(e,i)),this._sstCnt++;let l=x!==void 0?` s="${x}"`:"";t.writeString(`<c${r} t="s"${l}><v>${i}</v></c>`)}_wscStyle(t,e,r,x){y(e);let i=this._sstM.get(e);i===void 0&&(i=this._sstA.length,this._sstA.push(e),this._sstM.set(e,i)),this._sstCnt++,t.writeString(`<c${r} t="s" s="${x}"><v>${i}</v></c>`)}_oa(t){return k(t.getTime(),this._oaE)}_regFmt(t){let e=this._fmtXf.get(t);if(e!==void 0)return e;let r=this._nextNfmt++;this._fmtReg.set(t,r);let x=this._nextXf++;return this._fmtXf.set(t,x),x}_wcv(t,e,r,x,i,l){if(e==null)return l;let o=L(e),s=R(e),u=o!==null?this._regFmt(o):-1,d=u>=0?` s="${u}"`:"";if(s==null)return l;let a=Z(r,l,x,i),n=u>=0?u:void 0;if(typeof s=="number")Number.isFinite(s)?t.writeString(`<c${a}${d}><v>${s}</v></c>`):this._wsc(t,s.toString(),a,n);else if(typeof s=="bigint")this._wsc(t,s.toString(),a,n);else if(typeof s=="boolean")t.writeString(`<c${a} t="b"${d}><v>${s?1:0}</v></c>`);else if(s instanceof Date){let f=this._oa(s);Number.isFinite(f)?t.writeString(`<c${a} s="${u>=0?u:1}"><v>${f}</v></c>`):this._wsc(t,s.toString(),a,n)}else this._wsc(t,s.toString(),a,n);return r}_sheetHead(t,e,r,x){t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString('<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'),t.writeString('<dimension ref="A1"/>'),x?t.writeString(`<sheetViews><sheetView ${r?'tabSelected="1" ':""}workbookViewId="0"><pane ySplit="1" topLeftCell="A2" activePane="bottomLeft" state="frozen"/><selection pane="bottomLeft"/></sheetView></sheetViews><sheetFormatPr defaultRowHeight="15"/>`):t.writeString(`<sheetViews><sheetView ${r?'tabSelected="1" ':""}workbookViewId="0"/></sheetViews><sheetFormatPr defaultRowHeight="15"/>`),t.writeString("<cols>");for(let i=0;i<e;i++){let l=this._cw[i]>0?this._cw[i]:10;t.writeString(`<col min="${i+1}" max="${i+1}" width="${l}" bestFit="1" customWidth="1"/>`)}t.writeString("</cols><sheetData>")}startSheet(t,e,r,x={}){if(this._isS)throw new Error("Already streaming");if(I(e),r!==void 0){S("header",r.length,e);for(let a of r)y(a)}let{hidden:i=!1,doAutofilter:l=!0,headerStyle:o="bold"}=x,s=3;o==="fill"?s=4:o==="bold+fill"&&(s=5),this.addSheet(t,i),this._isS=!0;let u=new g;this._csb=u,this._csrn=0,this._csSC=0,this._csEC=e,this._csAF=l&&r!==void 0,this._cw=new Array(e).fill(-1);let d=new Array(e);for(let a=0;a<e;a++)d[a]=this._cl(a);if(this._csCL=d,r)for(let a=0;a<e;a++){let n=1.3*(r[a]?r[a].length:0)+3;n>80&&(n=80),this._cw[a]<n&&(this._cw[a]=n)}if(this._sheetHead(u,e,this._sc===1,this._csAF),r){this._csrn++,u.writeString(`<row r="${this._csrn}">`);for(let a=0;a<r.length;a++)this._wscStyle(u,r[a],"",s);u.writeString("</row>")}}writeRow(t){if(!this._isS||this._csb===null)throw new Error("Not streaming");if(t.length!==this._csEC)throw new Error(`Row length mismatch. Expected ${this._csEC} columns, got ${t.length}`);let e=this._csb;this._csrn++,v(this._csrn),e.writeString(`<row r="${this._csrn}">`);let r=-1;for(let x=0;x<t.length;x++)r=this._wcv(e,t[x],x,this._csCL[x],this._csrn,r);e.writeString("</row>")}endSheet(){if(!this._isS||this._csb===null)throw new Error("Not streaming");let t=this._csb;if(t.writeString("</sheetData>"),this._csAF&&this._csEC>0){this._afOn=!0;let e=`A1:${this._csCL[this._csEC-1]}${this._csrn}`;t.writeString(`<autoFilter ref="${e}"/>`);let r=this._sl[this._sc-1];r.fhr=`${this._fmn(r.name)}!$A$1:$${this._csCL[this._csEC-1]}$${this._csrn}`}t.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,t.toUint8Array()),this._isS=!1,this._csb=null}writeSheet(t,e=null,r={}){let x=r.doAutofilter!==!1,i=r.headerStyle||"bold",l=3;i==="fill"?l=4:i==="bold+fill"&&(l=5);let o=new g,s=t.length>0?t[0].length:e?e.length:0;s>0&&I(s);let u=t.length+(e?1:0);if(v(u),e){S("header",e.length,s);for(let n of e)y(n)}for(let n=0;n<t.length;n++)S("row",t[n].length,s);this._cw=new Array(s).fill(-1);let d=new Array(s);for(let n=0;n<s;n++)d[n]=this._cl(n);if(e)for(let n=0;n<s;n++){let f=1.3*(e[n]?e[n].length:0)+3;f>80&&(f=80),this._cw[n]<f&&(this._cw[n]=f)}for(let n=0;n<Math.min(t.length,100);n++)for(let f=0;f<t[n].length;f++){let c=t[n][f];if(c==null)continue;let p=C(c)?c.value:c;if(p==null)continue;let F=1.3*(p instanceof Date?10:p.toString().length)+3;F>80&&(F=80),this._cw[f]<F&&(this._cw[f]=F)}this._sheetHead(o,s,this._sc===1,x&&!!e);let a=0;if(e){a++,o.writeString(`<row r="${a}">`);for(let n=0;n<e.length;n++)this._wscStyle(o,e[n],"",l);o.writeString("</row>")}for(let n=0;n<t.length;n++){a++,o.writeString(`<row r="${a}">`);let f=-1;for(let c=0;c<t[n].length;c++)f=this._wcv(o,t[n][c],c,d[c],a,f);o.writeString("</row>")}if(o.writeString("</sheetData>"),x&&e&&s>0){this._afOn=!0;let n=`A1:${d[s-1]}${u}`;o.writeString(`<autoFilter ref="${n}"/>`);let f=this._sl[this._sc-1];f.fhr=`${this._fmn(f.name)}!$A$1:$${d[s-1]}$${u}`}o.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,o.toUint8Array())}finalize(){return this._writeSst(),this._writeStyles(),this._writeWb(),this._writeCt(),this._writeRels(),this._zip.toBlob()}_writeSst(){let t=new g;t.writeString('<?xml version="1.0" encoding="UTF-8" standalone="yes"?>'),t.writeString(`<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${this._sstCnt}" uniqueCount="${this._sstA.length}">`);for(let e of this._sstA){let r=this._esc(e);r.length>0&&(r[0]===" "||r[r.length-1]===" "||/[\t\n\r]/.test(r))?t.writeString(`<si><t xml:space="preserve">${r}</t></si>`):t.writeString(`<si><t>${r}</t></si>`)}t.writeString("</sst>"),this._zip.addFile("xl/sharedStrings.xml",t.toUint8Array())}_writeStyles(){let t='<numFmt numFmtId="164" formatCode="yyyy\\-mm\\-dd\\ hh:mm:ss"/>',e=1,r=['<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>','<xf numFmtId="14" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="164" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>','<xf numFmtId="0" fontId="1" fillId="0" borderId="0" xfId="0" applyFont="1"/>','<xf numFmtId="0" fontId="0" fillId="1" borderId="0" xfId="0" applyFill="1"/>','<xf numFmtId="0" fontId="1" fillId="1" borderId="0" xfId="0" applyFont="1" applyFill="1"/>'];for(let[i,l]of this._fmtReg){let o=i.replace(/&/g,"&amp;").replace(/</g,"&lt;").replace(/>/g,"&gt;").replace(/"/g,"&quot;").replace(/'/g,"&apos;");t+=`<numFmt numFmtId="${l}" formatCode="${o}"/>`,e++}let x=[...this._fmtXf.entries()].sort((i,l)=>i[1]-l[1]);for(let[i]of x){let l=this._fmtReg.get(i);r.push(`<xf numFmtId="${l}" fontId="0" fillId="0" borderId="0" xfId="0" applyNumberFormat="1"/>`)}this._zip.addFile("xl/styles.xml",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
2
2
  <styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
3
3
  <numFmts count="${e}">${t}</numFmts>
4
4
  <fonts count="2">
@@ -8,29 +8,29 @@
8
8
  <fills count="2"><fill><patternFill patternType="none"/></fill><fill><patternFill patternType="gray125"/></fill></fills>
9
9
  <borders count="1"><border><left/><right/><top/><bottom/><diagonal/></border></borders>
10
10
  <cellStyleXfs count="1"><xf numFmtId="0" fontId="0" fillId="0" borderId="0"/></cellStyleXfs>
11
- <cellXfs count="${x.length}">
12
- ${x.join(`
11
+ <cellXfs count="${r.length}">
12
+ ${r.join(`
13
13
  `)}
14
14
  </cellXfs>
15
15
  <cellStyles count="1"><cellStyle name="Normal" xfId="0" builtinId="0"/></cellStyles>
16
16
  <dxfs count="0"/><tableStyles count="0" defaultTableStyle="TableStyleMedium2" defaultPivotStyle="PivotStyleLight16"/>
17
- </styleSheet>`)}_writeWb(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4505"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/></bookViews><sheets>';for(let e of this._sl)t+=`<sheet name="${this._ex(e.name)}" sheetId="${e.id}"${e.hidden?' state="hidden"':""} r:id="${e.rId}"/>`;if(t+="</sheets>",this._afOn){t+="<definedNames>";for(let e of this._sl)e.fhr&&(t+=`<definedName name="_xlnm._FilterDatabase" localSheetId="${e.id-1}" hidden="1">${this._esc(e.fhr)}</definedName>`);t+="</definedNames>"}t+='<calcPr calcId="124519" fullCalcOnLoad="1"/></workbook>',this._zip.addFile("xl/workbook.xml",t)}_writeCt(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>';for(let e of this._sl)t+=`<Override PartName="/${e.path}" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`;t+="</Types>",this._zip.addFile("[Content_Types].xml",t)}_writeRels(){this._zip.addFile("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>');let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';for(let x of this._sl)t+=`<Relationship Id="${x.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${x.fn}"/>`;let e=this._sl.length+1;t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>`,t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>`,t+="</Relationships>",this._zip.addFile("xl/_rels/workbook.xml.rels",t)}};var P=/[\\/*?[\]:]/g,C=class{constructor(){this._zip=new F,this._sheetCount=0,this._sheetList=[],this._sstDic=new Map,this._sstCntUnique=0,this._sstCntAll=0,this._colWidths=[],this._autofilterIsOn=!1,this._oaEpoch=Date.UTC(1899,11,30),this._isStreaming=!1,this._currentSheetBuffer=null,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=0,this._currentSheetDoAutofilter=!1,this._fmtMap=new Map,this._nextNid=167,this._nextXf=4,this._sheet1Bytes=new Uint8Array([129,1,0,147,1,23,203,4,2,0,64,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,148,1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,1,0,137,1,30,220,3,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,152,1,36,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,1,0,134,1,0,37,6,1,0,2,14,0,128,149,8,2,5,0,38,0,229,3,12,255,255,255,255,8,0,44,1,0,0,0,0,145,1,0,37,6,1,0,2,14,0,128,128,8,2,5,0,38,0,0,25,0,0,0,0,0,0,0,0,44,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,7,12,0,0,0,0,0,0,0,0,0,0,0,0,146,1,0,151,4,66,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,221,3,2,16,0,220,3,48,102,102,102,102,102,102,230,63,102,102,102,102,102,102,230,63,0,0,0,0,0,0,232,63,0,0,0,0,0,0,232,63,51,51,51,51,51,51,211,63,51,51,51,51,51,51,211,63,37,6,1,0,0,16,0,128,128,24,16,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,38,0,130,1,0]),this._workbookBinStart=new Uint8Array([131,1,0,128,1,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,120,0,108,0,1,0,0,0,55,0,1,0,0,0,54,0,5,0,0,0,50,0,52,0,51,0,50,0,54,0,153,1,12,32,0,1,0,0,0,0,0,0,0,0,0,37,6,1,0,3,15,0,128,151,16,52,24,0,0,0,67,0,58,0,92,0,115,0,113,0,108,0,115,0,92,0,84,0,101,0,115,0,116,0,121,0,90,0,97,0,112,0,105,0,115,0,117,0,88,0,108,0,115,0,98,0,92,0,38,0,37,6,1,0,0,16,0,128,129,24,130,1,0,0,0,0,0,0,0,0,47,0,0,0,49,0,51,0,95,0,110,0,99,0,114,0,58,0,49,0,95,0,123,0,49,0,54,0,53,0,48,0,56,0,68,0,54,0,57,0,45,0,67,0,70,0,56,0,55,0,45,0,52,0,55,0,54,0,57,0,45,0,56,0,52,0,53,0,54,0,45,0,68,0,52,0,65,0,52,0,48,0,49,0,49,0,51,0,49,0,53,0,54,0,55,0,125,0,47,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,135,1,0,37,6,1,0,2,16,0,128,128,24,16,0,0,0,0,13,0,0,0,255,255,255,255,0,0,0,0,38,0,158,1,29,0,0,0,0,158,22,0,0,180,105,0,0,232,38,0,0,88,2,0,0,0,0,0,0,0,0,0,0,120,136,1,0,143,1,0]),this._workbookBinMiddle=new Uint8Array([144,1,0]),this._workbookBinEnd=new Uint8Array([157,1,26,53,234,2,0,1,0,0,0,100,0,0,0,252,169,241,210,77,98,80,63,1,0,0,0,106,0,155,1,1,0,35,4,3,15,0,0,171,16,1,1,36,0,132,1,0]),this._stylesBin=new Uint8Array([150,2,0,231,4,4,2,0,0,0,44,44,164,0,19,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,92,0,32,0,104,0,104,0,58,0,109,0,109,0,44,30,166,0,12,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,232,4,0,227,4,4,2,0,0,0,43,39,220,0,0,0,144,1,0,0,0,2,0,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,43,39,220,0,1,0,188,2,0,0,0,2,238,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,37,6,1,0,2,14,0,128,129,8,0,38,0,228,4,0,219,4,4,2,0,0,0,45,68,0,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,68,17,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,220,4,0,229,4,4,1,0,0,0,46,51,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,230,4,0,242,4,4,1,0,0,0,47,16,255,255,0,0,0,0,0,0,0,0,0,0,16,16,0,0,243,4,0,233,4,4,6,0,0,0,47,16,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,0,47,16,0,0,164,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,166,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,0,0,1,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,1,0,0,0,0,0,16,16,1,0,234,4,0,235,4,4,1,0,0,0,37,6,1,0,2,17,0,128,128,24,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,48,28,0,0,0,0,1,0,0,0,8,0,0,0,78,0,111,0,114,0,109,0,97,0,108,0,110,0,121,0,236,4,0,249,3,4,0,0,0,0,250,3,0,252,3,80,0,0,0,0,17,0,0,0,84,0,97,0,98,0,108,0,101,0,83,0,116,0,121,0,108,0,101,0,77,0,101,0,100,0,105,0,117,0,109,0,50,0,17,0,0,0,80,0,105,0,118,0,111,0,116,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,54,0,253,3,0,35,4,2,14,0,0,235,8,0,246,8,42,0,0,0,0,17,0,0,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,247,8,0,236,8,0,36,0,35,4,3,15,0,0,176,16,0,178,16,50,0,0,0,0,21,0,0,0,84,0,105,0,109,0,101,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,179,16,0,177,16,0,36,0,151,2,0]),this._binaryIndexBin=new Uint8Array([42,24,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,2,0]),this._rRkIntegerLowerLimit=-1<<29,this._rRkIntegerUpperLimit=(1<<29)-1,this._autoFilterStartBytes=new Uint8Array([161,1,16]),this._autoFilterEndBytes=new Uint8Array([162,1,0]),this._stickHeaderA1bytes=new Uint8Array([151,1,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,63,1,0,0,0,0,0,0,0,2,0,0,0,3]),this._magicFilterExcel2016Fix0=new Uint8Array([225,2,0,229,2,0,234,2]),this._magicFilterExcel2016Fix1=new Uint8Array([39,70,33,0,0,0,0,255,0,0,0,15,0,0,0,95,0,70,0,105,0,108,0,116,0,101,0,114,0,68,0,97,0,116,0,97,0,98,0,97,0,115,0,101,0,15,0,0,0,59,255,0]),this._magicFilterExcel2016Fix2=new Uint8Array([0,0,0,0,255,255,255,255])}_sanitizeSheetName(t){if(!t||typeof t!="string")return`Sheet${this._sheetCount+1}`;let e=t.replace(P,"_");return e.length>31&&(e=e.substring(0,31)),e.trim().length===0&&(e=`Sheet${this._sheetCount+1}`),e}_registerFormat(t){if(this._fmtMap.has(t))return this._fmtMap.get(t).xf;let e=this._nextNid++,x=this._nextXf++;return this._fmtMap.set(t,{nid:e,xf:x}),x}_buildStylesBin(){if(this._fmtMap.size===0)return this._stylesBin;let t=this._stylesBin,e=-1;for(let u=3;u<t.length-3;u++)if(t[u]===232&&t[u+1]===4&&t[u+2]===0){e=u;break}let x=-1;for(let u=e+3;u<t.length-2;u++)if(t[u]===233&&t[u+1]===4){x=u;break}let s=-1;for(let u=x;u<t.length-3;u++)if(t[u]===234&&t[u+1]===4&&t[u+2]===0){s=u;break}let i=-1;for(let u=e+3;u<t.length-2;u++)if(t[u]===227&&t[u+1]===4){i=u;break}let n=2+this._fmtMap.size,r=4+this._fmtMap.size,o=[];function f(u){let w=[];for(;u>=128;)w.push(u&127|128),u>>>=7;return w.push(u&127),w}function c(u,w){return new Uint8Array([...f(u),...f(w.length),...w])}function h(u,w){let I=w.length,B=6+I*2,_=new Uint8Array(2+B);_[0]=44,_[1]=B;let U=new DataView(_.buffer);U.setUint16(2,u,!0),U.setUint32(4,I,!0);for(let E=0;E<I;E++){let L=w.charCodeAt(E);_[8+E*2]=L&255,_[8+E*2+1]=L>>8&255}return _}function l(u,w,I,B=0){let _=new Uint8Array(18),U=new DataView(_.buffer);return _[0]=47,_[1]=16,U.setUint16(2,u,!0),U.setUint16(4,w,!0),_[6]=B,_[14]=16,_[15]=16,U.setUint16(16,I,!0),_}o.push(t.subarray(0,3));let a=new Uint8Array(4);new DataView(a.buffer).setUint16(0,n,!0),o.push(c(615,a)),o.push(h(164,"yyyy\\-mm\\-dd\\ hh:mm:ss")),o.push(h(166,"yyyy\\-mm\\-dd"));for(let[u,w]of this._fmtMap)o.push(h(w.nid,u));o.push(c(616,new Uint8Array(0))),o.push(t.subarray(i,x));let m=new Uint8Array(4);new DataView(m.buffer).setUint16(0,r,!0),o.push(c(617,m)),o.push(l(0,0,0)),o.push(l(0,164,1)),o.push(l(0,166,1)),o.push(l(1,0,0,1));let g=[...this._fmtMap.entries()].sort((u,w)=>u[1].xf-w[1].xf);for(let[,u]of g)o.push(l(0,u.nid,1));o.push(c(618,new Uint8Array(0))),o.push(t.subarray(s+3));let p=0;for(let u of o)p+=u.length;let v=new Uint8Array(p),R=0;for(let u of o)v.set(u,R),R+=u.length;return v}addSheet(t,e=!1){let x=this._sanitizeSheetName(t);this._sheetCount++,this._sheetList.push({name:x,pathInArchive:`xl/worksheets/sheet${this._sheetCount}.bin`,hidden:e,nameInArchive:`sheet${this._sheetCount}.bin`,sheetId:this._sheetCount,filterHeaderRange:null})}startSheet(t,e,x,s={}){if(this._isStreaming)throw new Error("Already streaming");let{hidden:i=!1,doAutofilter:n=!0,headerStyle:r="bold"}=s,o=3;if(r==="fill"?o=4:r==="bold+fill"&&(o=5),this.addSheet(t,i),this._isStreaming=!0,this._currentSheetBuffer=new y,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=e,this._currentSheetDoAutofilter=n&&x!==void 0,this._colWidths=new Array(e).fill(-1),x)for(let f=0;f<e;f++){let h=1.3*(x[f]?x[f].length:0)+3;h>80&&(h=80),this._colWidths[f]<h&&(this._colWidths[f]=h)}if(this._writeSheetHeader(this._currentSheetBuffer,this._currentSheetStartCol,this._currentSheetEndCol,this._currentSheetDoAutofilter),x){this.createRowHeader(this._currentSheetBuffer,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let f=0;f<x.length;f++)this.writeString(this._currentSheetBuffer,x[f],f,o);this._currentSheetRowNum++}}writeRow(t){if(!this._isStreaming)throw new Error("Not streaming");let e=this._currentSheetBuffer;this.createRowHeader(e,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let x=0;x<t.length;x++)this._writeCell(e,t[x],x);this._currentSheetRowNum++}endSheet(){if(!this._isStreaming)throw new Error("Not streaming");let t=this._currentSheetBuffer;if(t.write(this._sheet1Bytes.subarray(218,290)),this._currentSheetDoAutofilter){this._autofilterIsOn=!0,t.write(this._autoFilterStartBytes);let e=new Uint8Array(8),x=new DataView(e.buffer);x.setInt32(0,0,!0),x.setInt32(4,this._currentSheetRowNum-1,!0),t.write(e);let s=new Uint8Array(8),i=new DataView(s.buffer);i.setInt32(0,this._currentSheetStartCol,!0),i.setInt32(4,this._currentSheetEndCol-1,!0),t.write(s),t.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:this._currentSheetRowNum-1,startColumn:this._currentSheetStartCol,endColumn:this._currentSheetEndCol-1}}t.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,t.toUint8Array()),this._isStreaming=!1,this._currentSheetBuffer=null}writeSheet(t,e=null,x={}){let s=x.doAutofilter!==!1,i=x.headerStyle||"bold",n=3;i==="fill"?n=4:i==="bold+fill"&&(n=5);let r=new y,o=t.length>0?t[0].length:e?e.length:0;if(this._colWidths=new Array(o).fill(-1),e)for(let h=0;h<o;h++){let a=1.3*(e[h]?e[h].length:0)+3;a>80&&(a=80),this._colWidths[h]<a&&(this._colWidths[h]=a)}for(let h=0;h<Math.min(t.length,100);h++)for(let l=0;l<t[h].length;l++){let a=t[h][l];if(a==null)continue;let m=A(a)?a.value:a,p=1.3*(m instanceof Date?10:m.toString().length)+3;p>80&&(p=80),this._colWidths[l]<p&&(this._colWidths[l]=p)}let f=s&&!!e;this._writeSheetHeader(r,0,o,f);let c=0;if(e){this.createRowHeader(r,c,0,o);for(let h=0;h<e.length;h++)this.writeString(r,e[h],h,n);c++}for(let h=0;h<t.length;h++){this.createRowHeader(r,c,0,o);for(let l=0;l<t[h].length;l++)this._writeCell(r,t[h][l],l);c++}if(r.write(this._sheet1Bytes.subarray(218,290)),f){this._autofilterIsOn=!0,r.write(this._autoFilterStartBytes);let h=new Uint8Array(8),l=new DataView(h.buffer);l.setInt32(0,0,!0),l.setInt32(4,c-1,!0),r.write(h);let a=new Uint8Array(8),m=new DataView(a.buffer);m.setInt32(0,0,!0),m.setInt32(4,o-1,!0),r.write(a),r.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:c,startColumn:0,endColumn:o-1}}r.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,r.toUint8Array())}_writeSheetHeader(t,e,x,s){let i=new Uint8Array(this._sheet1Bytes),n=new DataView(i.buffer);n.setInt32(40,e,!0),n.setInt32(44,x,!0),this._sheetCount!==1&&(i[54]=156),t.write(i.subarray(0,84)),s&&t.write(this._stickHeaderA1bytes),t.write(i.subarray(84,159)),t.writeByte(134),t.writeByte(3);for(let r=e;r<x;r++){t.writeByte(0),t.writeByte(60),t.writeByte(18),t.writeInt32LE(r),t.writeInt32LE(r);let o=this._colWidths[r]>0?this._colWidths[r]:10;t.writeInt32LE(Math.round(o*256)),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(2)}t.writeByte(0),t.writeByte(135),t.writeByte(3),t.writeByte(0),t.write(i.subarray(159,175)),t.write(new Uint8Array([38,0]))}_writeCell(t,e,x){if(e==null)return;let s=T(e),i=s!==null?D(e):e,n=s!==null?this._registerFormat(s):0;if(typeof i=="number")Number.isInteger(i)&&i>=this._rRkIntegerLowerLimit&&i<=this._rRkIntegerUpperLimit?this.writeRkNumberInteger(t,i,x,n):this.writeDouble(t,i,x,n);else if(typeof i=="bigint")this.writeString(t,i.toString(),x);else if(typeof i=="boolean")this.writeBool(t,i,x);else if(i instanceof Date){let r=(i.getTime()-this._oaEpoch)/864e5;this.writeDouble(t,r,x,s!==null?n:1)}else this.writeString(t,i.toString(),x,0,s!==null?n:void 0)}createRowHeader(t,e,x,s){t.ensureCapacity(27),t.writeUnsafeByte(0),t.writeUnsafeByte(25),t.writeUnsafeInt32LE(e),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(44),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(x),t.writeUnsafeInt32LE(s)}writeRkNumberInteger(t,e,x,s=0){t.ensureCapacity(14),t.writeUnsafeByte(2),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(s),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(e<<2|2)}writeDouble(t,e,x,s=0){t.ensureCapacity(18),t.writeUnsafeByte(5),t.writeUnsafeByte(16),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(s),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeDoubleLE(e)}writeBool(t,e,x){t.ensureCapacity(13),t.writeUnsafeByte(4),t.writeUnsafeByte(9),t.writeUnsafeInt32LE(x),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(e?1:0)}writeDateTime(t,e,x){this.writeDouble(t,(e.getTime()-this._oaEpoch)/864e5,x,1)}writeString(t,e,x,s=0,i=void 0){let n;this._sstDic.has(e)?n=this._sstDic.get(e):(n=this._sstCntUnique++,this._sstDic.set(e,n)),this._sstCntAll++;let r=i!==void 0?i:s;t.ensureCapacity(17),t.writeUnsafeByte(7),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(x),t.writeUnsafeByte(r),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(n)}_saveSst(){let t=new y;t.writeByte(159),t.writeByte(1),t.writeByte(8),t.writeInt32LE(this._sstCntUnique),t.writeInt32LE(this._sstCntAll);for(let[e]of this._sstDic){let x=e.length;t.writeByte(19);let s=5+2*x;if(s>=128){t.writeByte(128+s%128);let i=s>>7;i>=256?t.writeByte(128+i%128):t.writeByte(i),t.writeByte(s>>14),s>>14>0&&t.writeByte(0)}else t.writeByte(s&255),t.writeByte(s>>8&255);t.writeInt32LE(x),t.writeUtf16LE(e)}t.writeByte(160),t.writeByte(1),t.writeByte(0),this._zip.addFile("xl/sharedStrings.bin",t.toUint8Array())}_writeFilterDefinedName(t,e,x){let s=e.filterData,i=new Uint8Array(this._magicFilterExcel2016Fix1);i[7]=e.sheetId-1,i[i.length-2]=x,t.push(i);let n=new Uint8Array(8),r=new DataView(n.buffer);r.setInt32(0,s.startRow,!0),r.setInt32(4,s.endRow,!0),t.push(n);let o=new Uint8Array(4),f=new DataView(o.buffer);f.setInt16(0,s.startColumn,!0),f.setInt16(2,s.endColumn,!0),t.push(o),t.push(this._magicFilterExcel2016Fix2)}finalize(){this._saveSst(),this._zip.addFile("xl/styles.bin",this._buildStylesBin());let t=[this._workbookBinStart];for(let r of this._sheetList){let o=`rId${r.sheetId}`,f=r.name,c=16+f.length*2+o.length*2,h=new Uint8Array(3+c),l=new DataView(h.buffer);h[0]=156,h[1]=1,h[2]=c;let a=3;l.setInt32(a,r.hidden?1:0,!0),a+=4,l.setInt32(a,r.sheetId,!0),a+=4,l.setInt32(a,o.length,!0),a+=4;for(let m=0;m<o.length;m++){let g=o.charCodeAt(m);h[a++]=g&255,h[a++]=g>>8&255}l.setInt32(a,f.length,!0),a+=4;for(let m=0;m<f.length;m++){let g=f.charCodeAt(m);h[a++]=g&255,h[a++]=g>>8&255}t.push(h)}if(t.push(this._workbookBinMiddle),this._autofilterIsOn){let r=this._sheetList.filter(o=>o.filterData);if(r.length>0){t.push(this._magicFilterExcel2016Fix0);let o=r.length,f=o<=20?16+(o-1)*12:128+(o-21)*12;t.push(o<=10?new Uint8Array([f,o,0,0,0]):new Uint8Array([f,Math.floor((o-1)/10),o,0,0,0]));for(let c=0;c<r.length;c++){let h=r[c].sheetId-1,l=new Uint8Array(12);l[4]=h,l[8]=h,t.push(l)}t.push(new Uint8Array([226,2,0]));for(let c=0;c<r.length;c++)this._writeFilterDefinedName(t,r[c],c)}}t.push(this._workbookBinEnd);let e=0;for(let r of t)e+=r.length;let x=new Uint8Array(e),s=0;for(let r of t)x.set(r,s),s+=r.length;this._zip.addFile("xl/workbook.bin",x);for(let r of this._sheetList)this._zip.addFile(`xl/worksheets/binaryIndex${r.sheetId}.bin`,this._binaryIndexBin);let i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
17
+ </styleSheet>`)}_writeWb(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"><fileVersion appName="xl" lastEdited="4" lowestEdited="4" rupBuild="4505"/><workbookPr defaultThemeVersion="124226"/><bookViews><workbookView xWindow="240" yWindow="15" windowWidth="16095" windowHeight="9660"/></bookViews><sheets>';for(let e of this._sl)t+=`<sheet name="${this._ex(e.name)}" sheetId="${e.id}"${e.hidden?' state="hidden"':""} r:id="${e.rId}"/>`;if(t+="</sheets>",this._afOn){t+="<definedNames>";for(let e of this._sl)e.fhr&&(t+=`<definedName name="_xlnm._FilterDatabase" localSheetId="${e.id-1}" hidden="1">${this._esc(e.fhr)}</definedName>`);t+="</definedNames>"}t+='<calcPr calcId="124519" fullCalcOnLoad="1"/></workbook>',this._zip.addFile("xl/workbook.xml",t)}_writeCt(){let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types"><Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/><Default Extension="xml" ContentType="application/xml"/><Override PartName="/xl/workbook.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"/><Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/><Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>';for(let e of this._sl)t+=`<Override PartName="/${e.path}" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`;t+="</Types>",this._zip.addFile("[Content_Types].xml",t)}_writeRels(){this._zip.addFile("_rels/.rels",'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships"><Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/></Relationships>');let t='<?xml version="1.0" encoding="UTF-8" standalone="yes"?><Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">';for(let r of this._sl)t+=`<Relationship Id="${r.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${r.fn}"/>`;let e=this._sl.length+1;t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>`,t+=`<Relationship Id="rId${e++}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>`,t+="</Relationships>",this._zip.addFile("xl/_rels/workbook.xml.rels",t)}};var e0=/[\\/*?[\]:]/g,U=class{constructor(){this._zip=new B,this._sheetCount=0,this._sheetList=[],this._sstDic=new Map,this._sstCntUnique=0,this._sstCntAll=0,this._colWidths=[],this._autofilterIsOn=!1,this._oaEpoch=Date.UTC(1899,11,30),this._isStreaming=!1,this._currentSheetBuffer=null,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=0,this._currentSheetDoAutofilter=!1,this._fmtMap=new Map,this._nextNid=167,this._nextXf=4,this._sheet1Bytes=new Uint8Array([129,1,0,147,1,23,203,4,2,0,64,0,0,0,0,0,0,255,255,255,255,255,255,255,255,0,0,0,0,148,1,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,133,1,0,137,1,30,220,3,0,0,0,0,0,0,0,0,0,0,0,0,64,0,0,0,100,0,0,0,0,0,0,0,0,0,0,0,152,1,36,3,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,138,1,0,134,1,0,37,6,1,0,2,14,0,128,149,8,2,5,0,38,0,229,3,12,255,255,255,255,8,0,44,1,0,0,0,0,145,1,0,37,6,1,0,2,14,0,128,128,8,2,5,0,38,0,0,25,0,0,0,0,0,0,0,0,44,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,7,12,0,0,0,0,0,0,0,0,0,0,0,0,146,1,0,151,4,66,0,0,0,0,0,0,1,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,1,0,0,0,221,3,2,16,0,220,3,48,102,102,102,102,102,102,230,63,102,102,102,102,102,102,230,63,0,0,0,0,0,0,232,63,0,0,0,0,0,0,232,63,51,51,51,51,51,51,211,63,51,51,51,51,51,51,211,63,37,6,1,0,0,16,0,128,128,24,16,0,0,0,0,1,0,0,0,0,0,0,0,0,0,0,0,38,0,130,1,0]),this._workbookBinStart=new Uint8Array([131,1,0,128,1,50,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,2,0,0,0,120,0,108,0,1,0,0,0,55,0,1,0,0,0,54,0,5,0,0,0,50,0,52,0,51,0,50,0,54,0,153,1,12,32,0,1,0,0,0,0,0,0,0,0,0,37,6,1,0,3,15,0,128,151,16,52,24,0,0,0,67,0,58,0,92,0,115,0,113,0,108,0,115,0,92,0,84,0,101,0,115,0,116,0,121,0,90,0,97,0,112,0,105,0,115,0,117,0,88,0,108,0,115,0,98,0,92,0,38,0,37,6,1,0,0,16,0,128,129,24,130,1,0,0,0,0,0,0,0,0,47,0,0,0,49,0,51,0,95,0,110,0,99,0,114,0,58,0,49,0,95,0,123,0,49,0,54,0,53,0,48,0,56,0,68,0,54,0,57,0,45,0,67,0,70,0,56,0,55,0,45,0,52,0,55,0,54,0,57,0,45,0,56,0,52,0,53,0,54,0,45,0,68,0,52,0,65,0,52,0,48,0,49,0,49,0,51,0,49,0,53,0,54,0,55,0,125,0,47,0,0,0,47,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,135,1,0,37,6,1,0,2,16,0,128,128,24,16,0,0,0,0,13,0,0,0,255,255,255,255,0,0,0,0,38,0,158,1,29,0,0,0,0,158,22,0,0,180,105,0,0,232,38,0,0,88,2,0,0,0,0,0,0,0,0,0,0,120,136,1,0,143,1,0]),this._workbookBinMiddle=new Uint8Array([144,1,0]),this._workbookBinEnd=new Uint8Array([157,1,26,53,234,2,0,1,0,0,0,100,0,0,0,252,169,241,210,77,98,80,63,1,0,0,0,106,0,155,1,1,0,35,4,3,15,0,0,171,16,1,1,36,0,132,1,0]),this._stylesBin=new Uint8Array([150,2,0,231,4,4,2,0,0,0,44,44,164,0,19,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,92,0,32,0,104,0,104,0,58,0,109,0,109,0,44,30,166,0,12,0,0,0,121,0,121,0,121,0,121,0,92,0,45,0,109,0,109,0,92,0,45,0,100,0,100,0,232,4,0,227,4,4,2,0,0,0,43,39,220,0,0,0,144,1,0,0,0,2,0,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,43,39,220,0,1,0,188,2,0,0,0,2,238,0,7,1,0,0,0,0,0,255,2,7,0,0,0,67,0,97,0,108,0,105,0,98,0,114,0,105,0,37,6,1,0,2,14,0,128,129,8,0,38,0,228,4,0,219,4,4,2,0,0,0,45,68,0,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,45,68,17,0,0,0,3,64,0,0,0,0,0,255,3,65,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,220,4,0,229,4,4,1,0,0,0,46,51,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,0,0,1,0,0,0,0,0,0,0,230,4,0,242,4,4,1,0,0,0,47,16,255,255,0,0,0,0,0,0,0,0,0,0,16,16,0,0,243,4,0,233,4,4,6,0,0,0,47,16,0,0,0,0,0,0,0,0,0,0,0,0,16,16,0,0,47,16,0,0,164,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,166,0,0,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,0,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,0,0,1,0,0,0,0,0,16,16,1,0,47,16,0,0,0,0,1,0,1,0,0,0,0,0,16,16,1,0,234,4,0,235,4,4,1,0,0,0,37,6,1,0,2,17,0,128,128,24,16,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,38,0,48,28,0,0,0,0,1,0,0,0,8,0,0,0,78,0,111,0,114,0,109,0,97,0,108,0,110,0,121,0,236,4,0,249,3,4,0,0,0,0,250,3,0,252,3,80,0,0,0,0,17,0,0,0,84,0,97,0,98,0,108,0,101,0,83,0,116,0,121,0,108,0,101,0,77,0,101,0,100,0,105,0,117,0,109,0,50,0,17,0,0,0,80,0,105,0,118,0,111,0,116,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,54,0,253,3,0,35,4,2,14,0,0,235,8,0,246,8,42,0,0,0,0,17,0,0,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,247,8,0,236,8,0,36,0,35,4,3,15,0,0,176,16,0,178,16,50,0,0,0,0,21,0,0,0,84,0,105,0,109,0,101,0,83,0,108,0,105,0,99,0,101,0,114,0,83,0,116,0,121,0,108,0,101,0,76,0,105,0,103,0,104,0,116,0,49,0,179,16,0,177,16,0,36,0,151,2,0]),this._binaryIndexBin=new Uint8Array([42,24,0,0,0,0,32,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,149,2,0]),this._rRkIntegerLowerLimit=-1<<29,this._rRkIntegerUpperLimit=(1<<29)-1,this._autoFilterStartBytes=new Uint8Array([161,1,16]),this._autoFilterEndBytes=new Uint8Array([162,1,0]),this._stickHeaderA1bytes=new Uint8Array([151,1,29,0,0,0,0,0,0,0,0,0,0,0,0,0,0,240,63,1,0,0,0,0,0,0,0,2,0,0,0,3]),this._magicFilterExcel2016Fix0=new Uint8Array([225,2,0,229,2,0,234,2]),this._magicFilterExcel2016Fix1=new Uint8Array([39,70,33,0,0,0,0,255,0,0,0,15,0,0,0,95,0,70,0,105,0,108,0,116,0,101,0,114,0,68,0,97,0,116,0,97,0,98,0,97,0,115,0,101,0,15,0,0,0,59,255,0]),this._magicFilterExcel2016Fix2=new Uint8Array([0,0,0,0,255,255,255,255])}_sanitizeSheetName(t){if(!t||typeof t!="string")return`Sheet${this._sheetCount+1}`;let e=t.replace(e0,"_");return e.length>31&&(e=e.substring(0,31)),e.trim().length===0&&(e=`Sheet${this._sheetCount+1}`),e}_registerFormat(t){let e=this._fmtMap.get(t);if(e!==void 0)return e.xf;let r=this._nextNid++,x=this._nextXf++;return this._fmtMap.set(t,{nid:r,xf:x}),x}_buildStylesBin(){if(this._fmtMap.size===0)return this._stylesBin;let t=this._stylesBin,e=-1;for(let m=3;m<t.length-3;m++)if(t[m]===232&&t[m+1]===4&&t[m+2]===0){e=m;break}let r=-1;for(let m=e+3;m<t.length-2;m++)if(t[m]===233&&t[m+1]===4){r=m;break}let x=-1;for(let m=r;m<t.length-3;m++)if(t[m]===234&&t[m+1]===4&&t[m+2]===0){x=m;break}let i=-1;for(let m=e+3;m<t.length-2;m++)if(t[m]===227&&t[m+1]===4){i=m;break}let l=2+this._fmtMap.size,o=4+this._fmtMap.size,s=[];function u(m){let w=[];for(;m>=128;)w.push(m&127|128),m>>>=7;return w.push(m&127),w}function d(m,w){return new Uint8Array([...u(m),...u(w.length),...w])}function a(m,w){let D=w.length,$=6+D*2,_=new Uint8Array(2+$);_[0]=44,_[1]=$;let b=new DataView(_.buffer);b.setUint16(2,m,!0),b.setUint32(4,D,!0);for(let T=0;T<D;T++){let O=w.charCodeAt(T);_[8+T*2]=O&255,_[8+T*2+1]=O>>8&255}return _}function n(m,w,D,$=0){let _=new Uint8Array(18),b=new DataView(_.buffer);return _[0]=47,_[1]=16,b.setUint16(2,m,!0),b.setUint16(4,w,!0),_[6]=$,_[14]=16,_[15]=16,b.setUint16(16,D,!0),_}s.push(t.subarray(0,3));let f=new Uint8Array(4);new DataView(f.buffer).setUint16(0,l,!0),s.push(d(615,f)),s.push(a(164,"yyyy\\-mm\\-dd\\ hh:mm:ss")),s.push(a(166,"yyyy\\-mm\\-dd"));for(let[m,w]of this._fmtMap)s.push(a(w.nid,m));s.push(d(616,new Uint8Array(0))),s.push(t.subarray(i,r));let c=new Uint8Array(4);new DataView(c.buffer).setUint16(0,o,!0),s.push(d(617,c)),s.push(n(0,0,0)),s.push(n(0,164,1)),s.push(n(0,166,1)),s.push(n(1,0,0,1));let p=[...this._fmtMap.entries()].sort((m,w)=>m[1].xf-w[1].xf);for(let[,m]of p)s.push(n(0,m.nid,1));s.push(d(618,new Uint8Array(0))),s.push(t.subarray(x+3));let F=0;for(let m of s)F+=m.length;let A=new Uint8Array(F),M=0;for(let m of s)A.set(m,M),M+=m.length;return A}addSheet(t,e=!1){let r=this._sanitizeSheetName(t);this._sheetCount++,this._sheetList.push({name:r,pathInArchive:`xl/worksheets/sheet${this._sheetCount}.bin`,hidden:e,nameInArchive:`sheet${this._sheetCount}.bin`,sheetId:this._sheetCount,filterHeaderRange:null})}startSheet(t,e,r,x={}){if(this._isStreaming)throw new Error("Already streaming");if(I(e),r!==void 0){S("header",r.length,e);for(let u of r)y(u)}let{hidden:i=!1,doAutofilter:l=!0,headerStyle:o="bold"}=x,s=3;if(o==="fill"?s=4:o==="bold+fill"&&(s=5),this.addSheet(t,i),this._isStreaming=!0,this._currentSheetBuffer=new g,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=e,this._currentSheetDoAutofilter=l&&r!==void 0,this._colWidths=new Array(e).fill(-1),r)for(let u=0;u<e;u++){let a=1.3*(r[u]?r[u].length:0)+3;a>80&&(a=80),this._colWidths[u]<a&&(this._colWidths[u]=a)}if(this._writeSheetHeader(this._currentSheetBuffer,this._currentSheetStartCol,this._currentSheetEndCol,this._currentSheetDoAutofilter),r){this.createRowHeader(this._currentSheetBuffer,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let u=0;u<r.length;u++)this.writeString(this._currentSheetBuffer,r[u],u,s);this._currentSheetRowNum++}}writeRow(t){let e=this._currentSheetBuffer;if(!this._isStreaming||e===null)throw new Error("Not streaming");if(t.length!==this._currentSheetEndCol-this._currentSheetStartCol)throw new Error(`Row length mismatch. Expected ${this._currentSheetEndCol-this._currentSheetStartCol} columns, got ${t.length}`);v(this._currentSheetRowNum+1),this.createRowHeader(e,this._currentSheetRowNum,this._currentSheetStartCol,this._currentSheetEndCol);for(let r=0;r<t.length;r++)this._writeCell(e,t[r],r);this._currentSheetRowNum++}endSheet(){let t=this._currentSheetBuffer;if(!this._isStreaming||t===null)throw new Error("Not streaming");if(t.write(this._sheet1Bytes.subarray(218,290)),this._currentSheetDoAutofilter){this._autofilterIsOn=!0,t.write(this._autoFilterStartBytes);let e=new Uint8Array(8),r=new DataView(e.buffer);r.setInt32(0,0,!0),r.setInt32(4,this._currentSheetRowNum-1,!0),t.write(e);let x=new Uint8Array(8),i=new DataView(x.buffer);i.setInt32(0,this._currentSheetStartCol,!0),i.setInt32(4,this._currentSheetEndCol-1,!0),t.write(x),t.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:this._currentSheetRowNum-1,startColumn:this._currentSheetStartCol,endColumn:this._currentSheetEndCol-1}}t.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,t.toUint8Array()),this._isStreaming=!1,this._currentSheetBuffer=null}writeSheet(t,e=null,r={}){let x=r.doAutofilter!==!1,i=r.headerStyle||"bold",l=3;i==="fill"?l=4:i==="bold+fill"&&(l=5);let o=new g,s=t.length>0?t[0].length:e?e.length:0;s>0&&I(s);let u=t.length+(e?1:0);if(v(u),e){S("header",e.length,s);for(let n of e)y(n)}for(let n=0;n<t.length;n++)S("row",t[n].length,s);if(this._colWidths=new Array(s).fill(-1),e)for(let n=0;n<s;n++){let c=1.3*(e[n]?e[n].length:0)+3;c>80&&(c=80),this._colWidths[n]<c&&(this._colWidths[n]=c)}for(let n=0;n<Math.min(t.length,100);n++)for(let f=0;f<t[n].length;f++){let c=t[n][f];if(c==null)continue;let p=C(c)?c.value:c;if(p==null)continue;let A=1.3*(p instanceof Date?10:p.toString().length)+3;A>80&&(A=80),this._colWidths[f]<A&&(this._colWidths[f]=A)}let d=x&&!!e;this._writeSheetHeader(o,0,s,d);let a=0;if(e){this.createRowHeader(o,a,0,s);for(let n=0;n<e.length;n++)this.writeString(o,e[n],n,l);a++}for(let n=0;n<t.length;n++){this.createRowHeader(o,a,0,s);for(let f=0;f<t[n].length;f++)this._writeCell(o,t[n][f],f);a++}if(o.write(this._sheet1Bytes.subarray(218,290)),d){this._autofilterIsOn=!0,o.write(this._autoFilterStartBytes);let n=new Uint8Array(8),f=new DataView(n.buffer);f.setInt32(0,0,!0),f.setInt32(4,a-1,!0),o.write(n);let c=new Uint8Array(8),p=new DataView(c.buffer);p.setInt32(0,0,!0),p.setInt32(4,s-1,!0),o.write(c),o.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:a,startColumn:0,endColumn:s-1}}o.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,o.toUint8Array())}_writeSheetHeader(t,e,r,x){let i=new Uint8Array(this._sheet1Bytes),l=new DataView(i.buffer);l.setInt32(40,e,!0),l.setInt32(44,r,!0),this._sheetCount!==1&&(i[54]=156),t.write(i.subarray(0,84)),x&&t.write(this._stickHeaderA1bytes),t.write(i.subarray(84,159)),t.writeByte(134),t.writeByte(3);for(let o=e;o<r;o++){t.writeByte(0),t.writeByte(60),t.writeByte(18),t.writeInt32LE(o),t.writeInt32LE(o);let s=this._colWidths[o]>0?this._colWidths[o]:10;t.writeInt32LE(Math.round(s*256)),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(0),t.writeByte(2)}t.writeByte(0),t.writeByte(135),t.writeByte(3),t.writeByte(0),t.write(i.subarray(159,175)),t.write(new Uint8Array([38,0]))}_writeCell(t,e,r){if(e==null)return;let x=L(e),i=R(e),l=x!==null?this._registerFormat(x):0;if(typeof i=="number")Number.isInteger(i)&&i>=this._rRkIntegerLowerLimit&&i<=this._rRkIntegerUpperLimit?this.writeRkNumberInteger(t,i,r,l):this.writeDouble(t,i,r,l);else if(typeof i=="bigint")this.writeString(t,i.toString(),r);else if(typeof i=="boolean")this.writeBool(t,i,r);else if(i instanceof Date){let o=k(i.getTime(),this._oaEpoch);this.writeDouble(t,o,r,x!==null?l:1)}else i!=null&&this.writeString(t,i.toString(),r,0,x!==null?l:void 0)}createRowHeader(t,e,r,x){t.ensureCapacity(27),t.writeUnsafeByte(0),t.writeUnsafeByte(25),t.writeUnsafeInt32LE(e),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(44),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(1),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(r),t.writeUnsafeInt32LE(x)}writeRkNumberInteger(t,e,r,x=0){t.ensureCapacity(14),t.writeUnsafeByte(2),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(r),t.writeUnsafeByte(x),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(e<<2|2)}writeDouble(t,e,r,x=0){t.ensureCapacity(18),t.writeUnsafeByte(5),t.writeUnsafeByte(16),t.writeUnsafeInt32LE(r),t.writeUnsafeByte(x),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeDoubleLE(e)}writeBool(t,e,r){t.ensureCapacity(13),t.writeUnsafeByte(4),t.writeUnsafeByte(9),t.writeUnsafeInt32LE(r),t.writeUnsafeInt32LE(0),t.writeUnsafeByte(e?1:0)}writeDateTime(t,e,r){this.writeDouble(t,k(e.getTime(),this._oaEpoch),r,1)}writeString(t,e,r,x=0,i){y(e);let l=this._sstDic.get(e);l===void 0&&(l=this._sstCntUnique++,this._sstDic.set(e,l)),this._sstCntAll++;let o=i!==void 0?i:x;t.ensureCapacity(17),t.writeUnsafeByte(7),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(r),t.writeUnsafeByte(o),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(l)}_saveSst(){let t=new g;t.writeByte(159),t.writeByte(1),t.writeByte(8),t.writeInt32LE(this._sstCntAll),t.writeInt32LE(this._sstCntUnique);for(let[e]of this._sstDic){let r=e.length;t.writeByte(19);let x=5+2*r;if(x>=128){t.writeByte(128+x%128);let i=x>>7;i>=256?t.writeByte(128+i%128):t.writeByte(i),t.writeByte(x>>14),x>>14>0&&t.writeByte(0)}else t.writeByte(x&255),t.writeByte(x>>8&255);t.writeInt32LE(r),t.writeUtf16LE(e)}t.writeByte(160),t.writeByte(1),t.writeByte(0),this._zip.addFile("xl/sharedStrings.bin",t.toUint8Array())}_writeFilterDefinedName(t,e,r){let x=e.filterData,i=new Uint8Array(this._magicFilterExcel2016Fix1);i[7]=e.sheetId-1,i[i.length-2]=r,t.push(i);let l=new Uint8Array(8),o=new DataView(l.buffer);o.setInt32(0,x.startRow,!0),o.setInt32(4,x.endRow,!0),t.push(l);let s=new Uint8Array(4),u=new DataView(s.buffer);u.setInt16(0,x.startColumn,!0),u.setInt16(2,x.endColumn,!0),t.push(s),t.push(this._magicFilterExcel2016Fix2)}finalize(){this._saveSst(),this._zip.addFile("xl/styles.bin",this._buildStylesBin());let t=[this._workbookBinStart];for(let o of this._sheetList){let s=`rId${o.sheetId}`,u=o.name,d=16+u.length*2+s.length*2,a=new Uint8Array(3+d),n=new DataView(a.buffer);a[0]=156,a[1]=1,a[2]=d;let f=3;n.setInt32(f,o.hidden?1:0,!0),f+=4,n.setInt32(f,o.sheetId,!0),f+=4,n.setInt32(f,s.length,!0),f+=4;for(let c=0;c<s.length;c++){let p=s.charCodeAt(c);a[f++]=p&255,a[f++]=p>>8&255}n.setInt32(f,u.length,!0),f+=4;for(let c=0;c<u.length;c++){let p=u.charCodeAt(c);a[f++]=p&255,a[f++]=p>>8&255}t.push(a)}if(t.push(this._workbookBinMiddle),this._autofilterIsOn){let o=this._sheetList.filter(s=>s.filterData!==void 0);if(o.length>0){t.push(this._magicFilterExcel2016Fix0);let s=o.length,u=s<=20?16+(s-1)*12:128+(s-21)*12;t.push(s<=10?new Uint8Array([u,s,0,0,0]):new Uint8Array([u,Math.floor((s-1)/10),s,0,0,0]));for(let d=0;d<o.length;d++){let a=o[d].sheetId-1,n=new Uint8Array(12);n[4]=a,n[8]=a,t.push(n)}t.push(new Uint8Array([226,2,0]));for(let d=0;d<o.length;d++)this._writeFilterDefinedName(t,o[d],d)}}t.push(this._workbookBinEnd);let e=0;for(let o of t)e+=o.length;let r=new Uint8Array(e),x=0;for(let o of t)r.set(o,x),x+=o.length;this._zip.addFile("xl/workbook.bin",r);for(let o of this._sheetList)this._zip.addFile(`xl/worksheets/binaryIndex${o.sheetId}.bin`,this._binaryIndexBin);let i=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
18
18
  <Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
19
19
  <Default Extension="bin" ContentType="application/vnd.ms-excel.sheet.binary.macroEnabled.main"/>
20
20
  <Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
21
- <Default Extension="xml" ContentType="application/xml"/>`;for(let r of this._sheetList)i+=`<Override PartName="/${r.pathInArchive}" ContentType="application/vnd.ms-excel.worksheet"/>
22
- <Override PartName="/xl/worksheets/binaryIndex${r.sheetId}.bin" ContentType="application/vnd.ms-excel.binIndexWs"/>
21
+ <Default Extension="xml" ContentType="application/xml"/>`;for(let o of this._sheetList)i+=`<Override PartName="/${o.pathInArchive}" ContentType="application/vnd.ms-excel.worksheet"/>
22
+ <Override PartName="/xl/worksheets/binaryIndex${o.sheetId}.bin" ContentType="application/vnd.ms-excel.binIndexWs"/>
23
23
  `;i+=`<Override PartName="/xl/styles.bin" ContentType="application/vnd.ms-excel.styles"/>
24
24
  <Override PartName="/xl/sharedStrings.bin" ContentType="application/vnd.ms-excel.sharedStrings"/>
25
- </Types>`,this._zip.addFile("[Content_Types].xml",i);let n=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
25
+ </Types>`,this._zip.addFile("[Content_Types].xml",i);let l=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
26
26
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
27
- `;for(let r of this._sheetList)n+=`<Relationship Id="rId${r.sheetId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${r.nameInArchive}"/>
28
- `;n+=`<Relationship Id="rId${this._sheetList.length+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.bin"/>
27
+ `;for(let o of this._sheetList)l+=`<Relationship Id="rId${o.sheetId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${o.nameInArchive}"/>
28
+ `;l+=`<Relationship Id="rId${this._sheetList.length+2}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.bin"/>
29
29
  <Relationship Id="rId${this._sheetList.length+3}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.bin"/>
30
- </Relationships>`,this._zip.addFile("xl/_rels/workbook.bin.rels",n),this._zip.addFile("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
30
+ </Relationships>`,this._zip.addFile("xl/_rels/workbook.bin.rels",l),this._zip.addFile("_rels/.rels",`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
31
31
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
32
32
  <Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.bin"/>
33
- </Relationships>`);for(let r of this._sheetList)this._zip.addFile(`xl/worksheets/_rels/${r.nameInArchive}.rels`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
33
+ </Relationships>`);for(let o of this._sheetList)this._zip.addFile(`xl/worksheets/_rels/${o.nameInArchive}.rels`,`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
34
34
  <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
35
- <Relationship Id="rId1" Type="http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex" Target="binaryIndex${r.sheetId}.bin"/>
36
- </Relationships>`);return this._zip.toBlob()}};function k(d,t){let e=URL.createObjectURL(d),x=document.createElement("a");x.href=e,x.download=t,document.body.appendChild(x),x.click(),document.body.removeChild(x),setTimeout(()=>URL.revokeObjectURL(e),5e3)}function X(d,t,e,x="Sheet1"){let s=new S;s.addSheet(x),s.writeSheet(t,e,{doAutofilter:!0}),k(s.finalize(),d)}function Y(d,t){let e=new S;for(let x of t)e.addSheet(x.name),e.writeSheet(x.rows,x.headers,{doAutofilter:!0});k(e.finalize(),d)}function q(d,t,e,x="Sheet1"){let s=new C;s.addSheet(x),s.writeSheet(t,e,{doAutofilter:!0}),k(s.finalize(),d)}function j(d,t){let e=new C;for(let x of t)e.addSheet(x.name),e.writeSheet(x.rows,x.headers,{doAutofilter:!0});k(e.finalize(),d)}return W(G);})();
35
+ <Relationship Id="rId1" Type="http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex" Target="binaryIndex${o.sheetId}.bin"/>
36
+ </Relationships>`);return this._zip.toBlob()}};function V(h,t){let e=URL.createObjectURL(h),r=document.createElement("a");r.href=e,r.download=t,document.body.appendChild(r),r.click(),document.body.removeChild(r),setTimeout(()=>URL.revokeObjectURL(e),5e3)}function r0(h,t,e,r="Sheet1"){let x=new E;x.addSheet(r),x.writeSheet(t,e,{doAutofilter:!0}),V(x.finalize(),h)}function x0(h,t){let e=new E;for(let r of t)e.addSheet(r.name),e.writeSheet(r.rows,r.headers,{doAutofilter:!0});V(e.finalize(),h)}function i0(h,t,e,r="Sheet1"){let x=new U;x.addSheet(r),x.writeSheet(t,e,{doAutofilter:!0}),V(x.finalize(),h)}function n0(h,t){let e=new U;for(let r of t)e.addSheet(r.name),e.writeSheet(r.rows,r.headers,{doAutofilter:!0});V(e.finalize(),h)}return J(s0);})();
@@ -82,6 +82,16 @@ declare abstract class ExcelReaderAbstract {
82
82
  abstract getSheetNames(): string[];
83
83
  /** Cell value for column index `i` of the current row (0-based). */
84
84
  abstract getValue(i: number): CellValue;
85
+ /**
86
+ * Select a worksheet for subsequent `read()` calls (by name or 0-based index).
87
+ * Resets row state/EOF; default is sheet 0. Resets `fieldCount`.
88
+ */
89
+ abstract selectSheet(nameOrIndex: string | number): Promise<void>;
90
+ /**
91
+ * Advance to the next worksheet (like `nextResult` in DB readers).
92
+ * @returns true if another sheet was selected; false at end.
93
+ */
94
+ abstract nextResult(): Promise<boolean>;
85
95
  dispose(): void;
86
96
  getDateTimeFromOaDate(oaDate: number): Date;
87
97
  }
@@ -138,6 +148,7 @@ declare class XlsbReader extends ExcelReaderAbstract {
138
148
  private _reader;
139
149
  private _currentRow;
140
150
  private _pendingRowIndex;
151
+ private _nextExpectedRow;
141
152
  private _eof;
142
153
  xfIdToNumFmtId: number[];
143
154
  customDateFormats: Set<number> | null;
@@ -146,6 +157,8 @@ declare class XlsbReader extends ExcelReaderAbstract {
146
157
  private _readSharedStrings;
147
158
  private _readStyles;
148
159
  getSheetNames(): string[];
160
+ selectSheet(nameOrIndex: string | number): Promise<void>;
161
+ nextResult(): Promise<boolean>;
149
162
  read(): Promise<boolean>;
150
163
  private _initSheet;
151
164
  getValue(i: number): CellValue;
@@ -160,7 +173,11 @@ declare class XlsxReader extends ExcelReaderAbstract {
160
173
  private _currentSheetIndex;
161
174
  private _sheetXml;
162
175
  private _xmlPos;
176
+ /** End of the sheetData element; row tags must not be searched past it. */
177
+ private _xmlEnd;
163
178
  private _currentRow;
179
+ private _expectedRowNum;
180
+ private _pendingEmptyCount;
164
181
  xfIdToNumFmtId: number[];
165
182
  customDateFormats: Set<number>;
166
183
  constructor();
@@ -171,8 +188,15 @@ declare class XlsxReader extends ExcelReaderAbstract {
171
188
  private _parseStyles;
172
189
  getSheetNames(): string[];
173
190
  read(): Promise<boolean>;
191
+ selectSheet(nameOrIndex: string | number): Promise<void>;
192
+ nextResult(): Promise<boolean>;
174
193
  private _initSheet;
175
194
  private _readNextRow;
195
+ /**
196
+ * Find the next `<row …>` start, ignoring similarly named elements such as
197
+ * `<rowBreaks>` that follow `</sheetData>`.
198
+ */
199
+ private _findRowTagStart;
176
200
  private _parseRowByIndex;
177
201
  getValue(i: number): CellValue;
178
202
  }
@@ -195,6 +219,10 @@ declare class ReaderFactory {
195
219
  declare class XlsbWriter {
196
220
  private output;
197
221
  private archive;
222
+ private readonly _targetPath;
223
+ private readonly _tempPath;
224
+ private _outputError;
225
+ private _finalized;
198
226
  private sheetCount;
199
227
  private sheetList;
200
228
  private sstDic;
@@ -226,7 +254,13 @@ declare class XlsbWriter {
226
254
  /**
227
255
  * @param filePath Destination `.xlsb` path on disk.
228
256
  */
229
- constructor(filePath: string);
257
+ /**
258
+ * @param filePath Destination `.xlsb` path on disk.
259
+ * @param options.compressionLevel Deflate level 0-9 (default 6).
260
+ */
261
+ constructor(filePath: string, options?: {
262
+ compressionLevel?: number;
263
+ });
230
264
  /** @deprecated Internal; kept for unit-test access. Prefer sanitizeSheetName(). */
231
265
  private _sanitizeSheetName;
232
266
  private _registerFormat;
@@ -292,6 +326,10 @@ declare class XlsbWriter {
292
326
  declare class XlsxWriter {
293
327
  private output;
294
328
  private archive;
329
+ private readonly _targetPath;
330
+ private readonly _tempPath;
331
+ private _outputError;
332
+ private _finalized;
295
333
  private sheetCount;
296
334
  private sheetList;
297
335
  private sstArray;
@@ -308,7 +346,13 @@ declare class XlsxWriter {
308
346
  /**
309
347
  * @param filePath Destination `.xlsx` path on disk.
310
348
  */
311
- constructor(filePath: string);
349
+ /**
350
+ * @param filePath Destination `.xlsx` path on disk.
351
+ * @param options.compressionLevel Deflate level 0-9 (default 6).
352
+ */
353
+ constructor(filePath: string, options?: {
354
+ compressionLevel?: number;
355
+ });
312
356
  private _getColumnLetter;
313
357
  /** @deprecated Internal; kept for unit-test access. Prefer sanitizeSheetName(). */
314
358
  private _sanitizeSheetName;
@@ -336,6 +380,7 @@ declare class XlsxWriter {
336
380
  * Write an entire sheet in one call (batch mode).
337
381
  */
338
382
  writeSheet(rows: CellValue[][], headers?: string[] | null, doAutofilter?: boolean): void;
383
+ /** `ref` is the cell's `r` attribute from `cellRefAttr`, or '' when omitted. */
339
384
  private _writeStringCell;
340
385
  private _registerFormat;
341
386
  private _toOADate;
@@ -397,7 +442,7 @@ declare class XlsxUpdater {
397
442
  private sharedStringsPending;
398
443
  private sharedStringsDirty;
399
444
  private stringIndexMap;
400
- private readonly _oaEpoch;
445
+ private _oaEpoch;
401
446
  /**
402
447
  * @param path Path to an existing `.xlsx` file.
403
448
  */
@@ -457,6 +502,28 @@ declare class XlsxUpdater {
457
502
  private _patchSheetFile;
458
503
  private _updatePivotCaches;
459
504
  private _addRefreshOnLoadToPivotTables;
505
+ /**
506
+ * Remove the stale calculation chain (xl/calcChain.xml). Excel rebuilds it
507
+ * on open; keeping stale <c> entries for the replaced sheet would force a
508
+ * repair prompt. Removes the part, its Content_Types override and its
509
+ * workbook rels entry (xlspy parity).
510
+ */
511
+ private _removeCalcChain;
512
+ private _writePartText;
513
+ private _ensureCalcPrFullCalc;
514
+ /**
515
+ * Insertion offset for a missing `<calcPr>`. The element follows
516
+ * sheets/externalReferences/definedNames in the workbook schema, so insert
517
+ * after the last of those that exists instead of right after `<workbook>`.
518
+ */
519
+ private static _calcPrInsertPosition;
520
+ /**
521
+ * Update ListObject table ranges (xl/tables/*.xml) for the replaced sheet.
522
+ * Only tables anchored at A1 are updated to the new dimension; tables
523
+ * elsewhere are left untouched (moving them would corrupt the sheet).
524
+ * Empty replacements (dimRef "A1") do not shrink multi-column tables.
525
+ */
526
+ private _updateTableRefs;
460
527
  }
461
528
 
462
529
  /**
@@ -505,7 +572,7 @@ declare class XlsbUpdater {
505
572
  private sharedStringsEndSst;
506
573
  private stringIndexMap;
507
574
  private sharedStringsDirty;
508
- private readonly _oaEpoch;
575
+ private _oaEpoch;
509
576
  /**
510
577
  * @param path Path to an existing `.xlsb` file.
511
578
  */
@@ -560,13 +627,21 @@ declare class XlsbUpdater {
560
627
  private _patchSheetMetadataFile;
561
628
  private _findRowsRegion;
562
629
  /**
563
- * Keep the sheet dimension record (0x98) in sync with the new data.
564
- * Excel uses its rwLast (payload offset 24) and colLast (payload offset 32)
630
+ * Keep the sheet dimension record (0x94) in sync with the new data.
631
+ * Excel uses its rwLast (payload offset 4) and colLast (payload offset 12)
565
632
  * fields to read the full row range; stale values make the last written row
566
633
  * invisible to Excel (and drop it from pivot refreshes).
567
634
  */
568
635
  private _patchDimension;
569
636
  private _patchPivotCaches;
637
+ /**
638
+ * Remove the stale calculation chain (xl/calcChain.bin). Excel rebuilds it
639
+ * on open. Removes the part, its Content_Types override and its workbook
640
+ * rels entry. XLSB tables are not patched (documented limitation).
641
+ */
642
+ private _removeCalcChain;
643
+ /** Write an XML/text part to its staged file when present, else into the ZIP. */
644
+ private _writePartText;
570
645
  }
571
646
 
572
647
  /** Options for an Excel format conversion. */
@@ -586,6 +661,18 @@ declare const INVALID_SHEET_NAME_CHARS: RegExp;
586
661
  * @param sheetCount Current sheet count before adding this sheet (used for defaults).
587
662
  */
588
663
  declare function sanitizeSheetName(name: string, sheetCount: number): string;
664
+ /** Excel limits (decision: throw on violation, like xlspy). */
665
+ declare const MAX_ROWS = 1048576;
666
+ declare const MAX_COLS = 16384;
667
+ declare const MAX_CELL_CHARS = 32767;
668
+ /** Throw when cell text exceeds Excel's 32,767 UTF-16 unit limit. */
669
+ declare function assertCellTextLength(text: string): void;
670
+ /** Throw when column count is outside Excel bounds. */
671
+ declare function assertColumnCount(columnCount: number): void;
672
+ /** Throw when a row/header is longer than the declared column count. */
673
+ declare function assertRowFitsColumns(kind: string, length: number, columnCount: number): void;
674
+ /** Throw when total row count exceeds Excel bounds. */
675
+ declare function assertRowCount(totalRows: number): void;
589
676
  /** Create column-width scratch array filled with -1 (unknown). */
590
677
  declare function initColWidths(columnCount: number): number[];
591
678
  /** Apply autofit widths from header labels. */
@@ -624,4 +711,44 @@ declare class StreamingSheetState {
624
711
  end(): void;
625
712
  }
626
713
 
627
- export { BiffReaderWriter, BigBuffer, type CellValue, type ExcelConversionOptions, ExcelReaderAbstract, F, type FormattedCell, INVALID_SHEET_NAME_CHARS, type PrimitiveCellValue, ReaderFactory, type ReplaceSheetDataOptions$1 as ReplaceSheetDataOptions, type RowSource$1 as RowSource, StreamingSheetState, XlsbReader, type ReplaceSheetDataOptions as XlsbReplaceSheetDataOptions, XlsbUpdater, XlsbWriter, XlsxUpdater as XlsmUpdater, XlsxReader, XlsxUpdater, XlsxWriter, applyHeaderWidths, convertXlsbToXlsx, convertXlsxToXlsb, defaultColWidth, getFormat, initColWidths, isFormattedCell, sanitizeSheetName, unwrapCell, updateColWidthsFromRows };
714
+ /**
715
+ * Shared low-level XML helpers used by readers and the XlsxUpdater.
716
+ */
717
+ /** Escape text content for use inside an XML element body. */
718
+ declare function escapeXmlText(str: string): string;
719
+ /** Unescape the five predefined XML entities (single-pass, order-independent). */
720
+ declare function unescapeXml(str: string): string;
721
+ /**
722
+ * Escape text of a shared string or inline string. Beyond XML escaping, a literal
723
+ * `_xHHHH_` must be written as `_x005F_xHHHH_` because Excel decodes that pattern
724
+ * in these elements (ECMA-376 ST_Xstring). Attribute values use `escapeXmlText`.
725
+ */
726
+ declare function escapeXlsxText(str: string): string;
727
+ /**
728
+ * Unescape element text content. Raw CR LF and lone CR are normalized to LF first
729
+ * (XML 1.0 §2.11); character references such as `&#13;` are kept as CR. Then the
730
+ * ST_Xstring escape `_xHHHH_` that Excel writes for control characters is decoded.
731
+ */
732
+ declare function unescapeXmlText(str: string): string;
733
+ /** Parse XML tag attributes into a map, independent of order/prefix/quote style. */
734
+ declare function parseTagAttributes(tag: string): Record<string, string>;
735
+ /** Resolve a workbook rel Target to a zip entry path (xlspy _resolve_path logic). */
736
+ declare function resolveRelTarget(target: string): string;
737
+ /** 0-based column index -> "A", "B", ..., "AA", "AB", ... (bijective base-26). */
738
+ declare function columnIndexToLetter(colIndex: number): string;
739
+ /** "A", "AB", ... -> 0-based column index. */
740
+ declare function columnLetterToIndex(letter: string): number;
741
+ /**
742
+ * Remove trailing rows that contain no non-empty cells (padding rows sometimes
743
+ * produced by SQL exports). This keeps the written range aligned with the
744
+ * actual data, so pivot tables do not pick up "(blank)" items from empty rows.
745
+ */
746
+ declare function trimTrailingEmptyRows<T>(rows: T[][]): T[][];
747
+ /**
748
+ * Parse the contents of xl/sharedStrings.xml into the list of string values.
749
+ * Handles plain `<si><t>…</t></si>` entries as well as rich-text `<si><r><t>…</t></r></si>` runs.
750
+ * Phonetic `<rPh>` blocks are skipped (xlspy parity) and self-closing `<si/>` yields "".
751
+ */
752
+ declare function parseSharedStringsXml(xml: string): string[];
753
+
754
+ export { BiffReaderWriter, BigBuffer, type CellValue, type ExcelConversionOptions, ExcelReaderAbstract, F, type FormattedCell, INVALID_SHEET_NAME_CHARS, MAX_CELL_CHARS, MAX_COLS, MAX_ROWS, type PrimitiveCellValue, ReaderFactory, type ReplaceSheetDataOptions$1 as ReplaceSheetDataOptions, type RowSource$1 as RowSource, StreamingSheetState, XlsbReader, type ReplaceSheetDataOptions as XlsbReplaceSheetDataOptions, XlsbUpdater, XlsbWriter, XlsxUpdater as XlsmUpdater, XlsxReader, XlsxUpdater, XlsxWriter, applyHeaderWidths, assertCellTextLength, assertColumnCount, assertRowCount, assertRowFitsColumns, columnIndexToLetter, columnLetterToIndex, convertXlsbToXlsx, convertXlsxToXlsb, defaultColWidth, escapeXlsxText, escapeXmlText, getFormat, initColWidths, isFormattedCell, parseSharedStringsXml, parseTagAttributes, resolveRelTarget, sanitizeSheetName, trimTrailingEmptyRows, unescapeXml, unescapeXmlText, unwrapCell, updateColWidthsFromRows };