@justybase/spreadsheet-tasks 2.2.0 → 3.0.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.
- package/CHANGELOG.md +64 -0
- package/browser/browser-spreadsheet.js +131 -43
- package/browser/justybase-spreadsheet.min.js +13 -13
- package/dist/cjs/index.d.ts +107 -5
- package/dist/cjs/index.js +1299 -431
- package/dist/cjs/index.js.map +1 -1
- package/dist/esm/index.js +1284 -431
- package/dist/esm/index.js.map +1 -1
- package/docs/API.md +66 -1
- package/package.json +4 -3
|
@@ -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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");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 Z=Object.getOwnPropertyDescriptor;var q=Object.getOwnPropertyNames;var Y=Object.prototype.hasOwnProperty;var j=(h,t)=>{for(var e in t)N(h,e,{get:t[e],enumerable:!0})},G=(h,t,e,r)=>{if(t&&typeof t=="object"||typeof t=="function")for(let x of q(t))!Y.call(h,x)&&x!==e&&N(h,x,{get:()=>t[x],enumerable:!(r=Z(t,x))||r.enumerable});return h};var K=h=>G(N({},"__esModule",{value:!0}),h);var n0={};j(n0,{BrowserBigBuffer:()=>g,BrowserXlsbWriter:()=>E,BrowserXlsxWriter:()=>U,BrowserZip:()=>B,F:()=>O,downloadXlsb:()=>x0,downloadXlsbMultiSheet:()=>i0,downloadXlsx:()=>e0,downloadXlsxMultiSheet:()=>r0});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 o of e)x+=o.length;r=new Uint8Array(x);let i=0;for(let o of e)r.set(o,i),i+=o.length}else r=e;this.files.push({name:t,data:r})}toBlob(){let t=[],e=[],r=0;for(let l of this.files){let u=new TextEncoder().encode(l.name),d=this._crc32(l.data),a=new Uint8Array(30+u.length),s=new DataView(a.buffer);s.setUint32(0,67324752,!0),s.setUint16(4,20,!0),s.setUint16(6,0,!0),s.setUint16(8,0,!0),s.setUint16(10,0,!0),s.setUint16(12,0,!0),s.setUint32(14,d,!0),s.setUint32(18,l.data.length,!0),s.setUint32(22,l.data.length,!0),s.setUint16(26,u.length,!0),s.setUint16(28,0,!0),a.set(u,30),t.push(a),t.push(l.data);let f=new Uint8Array(46+u.length),m=new DataView(f.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,d,!0),m.setUint32(20,l.data.length,!0),m.setUint32(24,l.data.length,!0),m.setUint16(28,u.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,r,!0),f.set(u,46),e.push(f),r+=a.length+l.data.length}let x=r,i=0;for(let l of e)t.push(l),i+=l.length;let o=new Uint8Array(22),n=new DataView(o.buffer);return n.setUint32(0,101010256,!0),n.setUint16(4,0,!0),n.setUint16(6,0,!0),n.setUint16(8,this.files.length,!0),n.setUint16(10,this.files.length,!0),n.setUint32(12,i,!0),n.setUint32(16,x,!0),n.setUint16(20,0,!0),t.push(o),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 o=0;o<8;o++)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 O={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 J=Date.UTC(1899,11,30),Q=Date.UTC(1900,2,1);function k(h,t){let e=(h-t)/864e5;return t===J&&h<Q&&(e-=1),e}var W=1048576,X=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 b(h){if(!Number.isInteger(h)||h<1||h>X)throw new Error(`Excel column count must be 1..${X} (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>W)throw new Error(`Excel row count exceeds ${W} (got ${h}).`)}var U=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,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}_esc(t){let e=!1;for(let i=0;i<t.length;i++){let o=t.charCodeAt(i);if(o===38||o===60||o===62||o===34||o===39||o>=0&&o<=8||o===11||o===12||o>=14&&o<=31){e=!0;break}}if(!e)return t;let r=t.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'"),x="";for(let i=0;i<r.length;i++){let o=r.charCodeAt(i);o<=8||o===11||o===12||o>=14&&o<=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,i){y(e);let o=this._sstM.get(e);o===void 0&&(o=this._sstA.length,this._sstA.push(e),this._sstM.set(e,o)),this._sstCnt++;let n=i!==void 0?` s="${i}"`:"";t.writeString(`<c r="${r}${x}" t="s"${n}><v>${o}</v></c>`)}_wscStyle(t,e,r,x,i){y(e);let o=this._sstM.get(e);o===void 0&&(o=this._sstA.length,this._sstA.push(e),this._sstM.set(e,o)),this._sstCnt++,t.writeString(`<c r="${r}${x}" t="s" s="${i}"><v>${o}</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){if(e==null)return;let i=L(e),o=R(e),n=i!==null?this._regFmt(i):-1,l=n>=0?` s="${n}"`:"";if(o!=null)if(typeof o=="number")Number.isFinite(o)?t.writeString(`<c r="${r}${x}"${l}><v>${o}</v></c>`):this._wsc(t,o.toString(),r,x,n>=0?n:void 0);else if(typeof o=="bigint")this._wsc(t,o.toString(),r,x,n>=0?n:void 0);else if(typeof o=="boolean")t.writeString(`<c r="${r}${x}" t="b"${l}><v>${o?1:0}</v></c>`);else if(o instanceof Date){let u=this._oa(o);Number.isFinite(u)?t.writeString(`<c r="${r}${x}" s="${n>=0?n:1}"><v>${u}</v></c>`):this._wsc(t,o.toString(),r,x,n>=0?n:void 0)}else this._wsc(t,o.toString(),r,x,n>=0?n:void 0)}_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 o=this._cw[i]>0?this._cw[i]:10;t.writeString(`<col min="${i+1}" max="${i+1}" width="${o}" bestFit="1" customWidth="1"/>`)}t.writeString("</cols><sheetData>")}startSheet(t,e,r,x={}){if(this._isS)throw new Error("Already streaming");if(b(e),r!==void 0){S("header",r.length,e);for(let a of r)y(a)}let{hidden:i=!1,doAutofilter:o=!0,headerStyle:n="bold"}=x,l=3;n==="fill"?l=4:n==="bold+fill"&&(l=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=o&&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 s=1.3*(r[a]?r[a].length:0)+3;s>80&&(s=80),this._cw[a]<s&&(this._cw[a]=s)}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],d[a],this._csrn,l);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}">`);for(let r=0;r<t.length;r++)this._wcv(e,t[r],this._csCL[r],this._csrn);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",o=3;i==="fill"?o=4:i==="bold+fill"&&(o=5);let n=new g,l=t.length>0?t[0].length:e?e.length:0;l>0&&b(l);let u=t.length+(e?1:0);if(v(u),e){S("header",e.length,l);for(let s of e)y(s)}for(let s=0;s<t.length;s++)S("row",t[s].length,l);this._cw=new Array(l).fill(-1);let d=new Array(l);for(let s=0;s<l;s++)d[s]=this._cl(s);if(e)for(let s=0;s<l;s++){let f=1.3*(e[s]?e[s].length:0)+3;f>80&&(f=80),this._cw[s]<f&&(this._cw[s]=f)}for(let s=0;s<Math.min(t.length,100);s++)for(let f=0;f<t[s].length;f++){let m=t[s][f];if(m==null)continue;let p=C(m)?m.value:m;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(n,l,this._sc===1,x&&!!e);let a=0;if(e){a++,n.writeString(`<row r="${a}">`);for(let s=0;s<e.length;s++)this._wscStyle(n,e[s],d[s],a,o);n.writeString("</row>")}for(let s=0;s<t.length;s++){a++,n.writeString(`<row r="${a}">`);for(let f=0;f<t[s].length;f++)this._wcv(n,t[s][f],d[f],a);n.writeString("</row>")}if(n.writeString("</sheetData>"),x&&e&&l>0){this._afOn=!0;let s=`A1:${d[l-1]}${u}`;n.writeString(`<autoFilter ref="${s}"/>`);let f=this._sl[this._sc-1];f.fhr=`${this._fmn(f.name)}!$A$1:$${d[l-1]}$${u}`}n.writeString("</worksheet>"),this._zip.addFile(this._sl[this._sc-1].path,n.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,o]of this._fmtReg){let n=i.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'");t+=`<numFmt numFmtId="${o}" formatCode="${n}"/>`,e++}let x=[...this._fmtXf.entries()].sort((i,o)=>i[1]-o[1]);for(let[i]of x){let o=this._fmtReg.get(i);r.push(`<xf numFmtId="${o}" 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="${
|
|
12
|
-
${
|
|
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 t0=/[\\/*?[\]:]/g,E=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(t0,"_");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 c=3;c<t.length-3;c++)if(t[c]===232&&t[c+1]===4&&t[c+2]===0){e=c;break}let r=-1;for(let c=e+3;c<t.length-2;c++)if(t[c]===233&&t[c+1]===4){r=c;break}let x=-1;for(let c=r;c<t.length-3;c++)if(t[c]===234&&t[c+1]===4&&t[c+2]===0){x=c;break}let i=-1;for(let c=e+3;c<t.length-2;c++)if(t[c]===227&&t[c+1]===4){i=c;break}let o=2+this._fmtMap.size,n=4+this._fmtMap.size,l=[];function u(c){let w=[];for(;c>=128;)w.push(c&127|128),c>>>=7;return w.push(c&127),w}function d(c,w){return new Uint8Array([...u(c),...u(w.length),...w])}function a(c,w){let D=w.length,$=6+D*2,_=new Uint8Array(2+$);_[0]=44,_[1]=$;let I=new DataView(_.buffer);I.setUint16(2,c,!0),I.setUint32(4,D,!0);for(let T=0;T<D;T++){let z=w.charCodeAt(T);_[8+T*2]=z&255,_[8+T*2+1]=z>>8&255}return _}function s(c,w,D,$=0){let _=new Uint8Array(18),I=new DataView(_.buffer);return _[0]=47,_[1]=16,I.setUint16(2,c,!0),I.setUint16(4,w,!0),_[6]=$,_[14]=16,_[15]=16,I.setUint16(16,D,!0),_}l.push(t.subarray(0,3));let f=new Uint8Array(4);new DataView(f.buffer).setUint16(0,o,!0),l.push(d(615,f)),l.push(a(164,"yyyy\\-mm\\-dd\\ hh:mm:ss")),l.push(a(166,"yyyy\\-mm\\-dd"));for(let[c,w]of this._fmtMap)l.push(a(w.nid,c));l.push(d(616,new Uint8Array(0))),l.push(t.subarray(i,r));let m=new Uint8Array(4);new DataView(m.buffer).setUint16(0,n,!0),l.push(d(617,m)),l.push(s(0,0,0)),l.push(s(0,164,1)),l.push(s(0,166,1)),l.push(s(1,0,0,1));let p=[...this._fmtMap.entries()].sort((c,w)=>c[1].xf-w[1].xf);for(let[,c]of p)l.push(s(0,c.nid,1));l.push(d(618,new Uint8Array(0))),l.push(t.subarray(x+3));let F=0;for(let c of l)F+=c.length;let A=new Uint8Array(F),M=0;for(let c of l)A.set(c,M),M+=c.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(b(e),r!==void 0){S("header",r.length,e);for(let u of r)y(u)}let{hidden:i=!1,doAutofilter:o=!0,headerStyle:n="bold"}=x,l=3;if(n==="fill"?l=4:n==="bold+fill"&&(l=5),this.addSheet(t,i),this._isStreaming=!0,this._currentSheetBuffer=new g,this._currentSheetRowNum=0,this._currentSheetStartCol=0,this._currentSheetEndCol=e,this._currentSheetDoAutofilter=o&&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,l);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",o=3;i==="fill"?o=4:i==="bold+fill"&&(o=5);let n=new g,l=t.length>0?t[0].length:e?e.length:0;l>0&&b(l);let u=t.length+(e?1:0);if(v(u),e){S("header",e.length,l);for(let s of e)y(s)}for(let s=0;s<t.length;s++)S("row",t[s].length,l);if(this._colWidths=new Array(l).fill(-1),e)for(let s=0;s<l;s++){let m=1.3*(e[s]?e[s].length:0)+3;m>80&&(m=80),this._colWidths[s]<m&&(this._colWidths[s]=m)}for(let s=0;s<Math.min(t.length,100);s++)for(let f=0;f<t[s].length;f++){let m=t[s][f];if(m==null)continue;let p=C(m)?m.value:m;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(n,0,l,d);let a=0;if(e){this.createRowHeader(n,a,0,l);for(let s=0;s<e.length;s++)this.writeString(n,e[s],s,o);a++}for(let s=0;s<t.length;s++){this.createRowHeader(n,a,0,l);for(let f=0;f<t[s].length;f++)this._writeCell(n,t[s][f],f);a++}if(n.write(this._sheet1Bytes.subarray(218,290)),d){this._autofilterIsOn=!0,n.write(this._autoFilterStartBytes);let s=new Uint8Array(8),f=new DataView(s.buffer);f.setInt32(0,0,!0),f.setInt32(4,a-1,!0),n.write(s);let m=new Uint8Array(8),p=new DataView(m.buffer);p.setInt32(0,0,!0),p.setInt32(4,l-1,!0),n.write(m),n.write(this._autoFilterEndBytes),this._sheetList[this._sheetCount-1].filterData={startRow:0,endRow:a,startColumn:0,endColumn:l-1}}n.write(this._sheet1Bytes.subarray(290)),this._zip.addFile(this._sheetList[this._sheetCount-1].pathInArchive,n.toUint8Array())}_writeSheetHeader(t,e,r,x){let i=new Uint8Array(this._sheet1Bytes),o=new DataView(i.buffer);o.setInt32(40,e,!0),o.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 n=e;n<r;n++){t.writeByte(0),t.writeByte(60),t.writeByte(18),t.writeInt32LE(n),t.writeInt32LE(n);let l=this._colWidths[n]>0?this._colWidths[n]:10;t.writeInt32LE(Math.round(l*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),o=x!==null?this._registerFormat(x):0;if(typeof i=="number")Number.isInteger(i)&&i>=this._rRkIntegerLowerLimit&&i<=this._rRkIntegerUpperLimit?this.writeRkNumberInteger(t,i,r,o):this.writeDouble(t,i,r,o);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 n=k(i.getTime(),this._oaEpoch);this.writeDouble(t,n,r,x!==null?o:1)}else i!=null&&this.writeString(t,i.toString(),r,0,x!==null?o: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 o=this._sstDic.get(e);o===void 0&&(o=this._sstCntUnique++,this._sstDic.set(e,o)),this._sstCntAll++;let n=i!==void 0?i:x;t.ensureCapacity(17),t.writeUnsafeByte(7),t.writeUnsafeByte(12),t.writeUnsafeInt32LE(r),t.writeUnsafeByte(n),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeByte(0),t.writeUnsafeInt32LE(o)}_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 o=new Uint8Array(8),n=new DataView(o.buffer);n.setInt32(0,x.startRow,!0),n.setInt32(4,x.endRow,!0),t.push(o);let l=new Uint8Array(4),u=new DataView(l.buffer);u.setInt16(0,x.startColumn,!0),u.setInt16(2,x.endColumn,!0),t.push(l),t.push(this._magicFilterExcel2016Fix2)}finalize(){this._saveSst(),this._zip.addFile("xl/styles.bin",this._buildStylesBin());let t=[this._workbookBinStart];for(let n of this._sheetList){let l=`rId${n.sheetId}`,u=n.name,d=16+u.length*2+l.length*2,a=new Uint8Array(3+d),s=new DataView(a.buffer);a[0]=156,a[1]=1,a[2]=d;let f=3;s.setInt32(f,n.hidden?1:0,!0),f+=4,s.setInt32(f,n.sheetId,!0),f+=4,s.setInt32(f,l.length,!0),f+=4;for(let m=0;m<l.length;m++){let p=l.charCodeAt(m);a[f++]=p&255,a[f++]=p>>8&255}s.setInt32(f,u.length,!0),f+=4;for(let m=0;m<u.length;m++){let p=u.charCodeAt(m);a[f++]=p&255,a[f++]=p>>8&255}t.push(a)}if(t.push(this._workbookBinMiddle),this._autofilterIsOn){let n=this._sheetList.filter(l=>l.filterData!==void 0);if(n.length>0){t.push(this._magicFilterExcel2016Fix0);let l=n.length,u=l<=20?16+(l-1)*12:128+(l-21)*12;t.push(l<=10?new Uint8Array([u,l,0,0,0]):new Uint8Array([u,Math.floor((l-1)/10),l,0,0,0]));for(let d=0;d<n.length;d++){let a=n[d].sheetId-1,s=new Uint8Array(12);s[4]=a,s[8]=a,t.push(s)}t.push(new Uint8Array([226,2,0]));for(let d=0;d<n.length;d++)this._writeFilterDefinedName(t,n[d],d)}}t.push(this._workbookBinEnd);let e=0;for(let n of t)e+=n.length;let r=new Uint8Array(e),x=0;for(let n of t)r.set(n,x),x+=n.length;this._zip.addFile("xl/workbook.bin",r);for(let n of this._sheetList)this._zip.addFile(`xl/worksheets/binaryIndex${n.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
|
|
22
|
-
<Override PartName="/xl/worksheets/binaryIndex${
|
|
21
|
+
<Default Extension="xml" ContentType="application/xml"/>`;for(let n of this._sheetList)i+=`<Override PartName="/${n.pathInArchive}" ContentType="application/vnd.ms-excel.worksheet"/>
|
|
22
|
+
<Override PartName="/xl/worksheets/binaryIndex${n.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
|
|
25
|
+
</Types>`,this._zip.addFile("[Content_Types].xml",i);let o=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
26
26
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
27
|
-
`;for(let
|
|
28
|
-
`;
|
|
27
|
+
`;for(let n of this._sheetList)o+=`<Relationship Id="rId${n.sheetId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet" Target="worksheets/${n.nameInArchive}"/>
|
|
28
|
+
`;o+=`<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",
|
|
30
|
+
</Relationships>`,this._zip.addFile("xl/_rels/workbook.bin.rels",o),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
|
|
33
|
+
</Relationships>`);for(let n of this._sheetList)this._zip.addFile(`xl/worksheets/_rels/${n.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${
|
|
36
|
-
</Relationships>`);return this._zip.toBlob()}};function
|
|
35
|
+
<Relationship Id="rId1" Type="http://schemas.microsoft.com/office/2006/relationships/xlBinaryIndex" Target="binaryIndex${n.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 e0(h,t,e,r="Sheet1"){let x=new U;x.addSheet(r),x.writeSheet(t,e,{doAutofilter:!0}),V(x.finalize(),h)}function r0(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)}function x0(h,t,e,r="Sheet1"){let x=new E;x.addSheet(r),x.writeSheet(t,e,{doAutofilter:!0}),V(x.finalize(),h)}function i0(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)}return K(n0);})();
|
package/dist/cjs/index.d.ts
CHANGED
|
@@ -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;
|
|
@@ -292,6 +320,10 @@ declare class XlsbWriter {
|
|
|
292
320
|
declare class XlsxWriter {
|
|
293
321
|
private output;
|
|
294
322
|
private archive;
|
|
323
|
+
private readonly _targetPath;
|
|
324
|
+
private readonly _tempPath;
|
|
325
|
+
private _outputError;
|
|
326
|
+
private _finalized;
|
|
295
327
|
private sheetCount;
|
|
296
328
|
private sheetList;
|
|
297
329
|
private sstArray;
|
|
@@ -397,7 +429,7 @@ declare class XlsxUpdater {
|
|
|
397
429
|
private sharedStringsPending;
|
|
398
430
|
private sharedStringsDirty;
|
|
399
431
|
private stringIndexMap;
|
|
400
|
-
private
|
|
432
|
+
private _oaEpoch;
|
|
401
433
|
/**
|
|
402
434
|
* @param path Path to an existing `.xlsx` file.
|
|
403
435
|
*/
|
|
@@ -457,6 +489,28 @@ declare class XlsxUpdater {
|
|
|
457
489
|
private _patchSheetFile;
|
|
458
490
|
private _updatePivotCaches;
|
|
459
491
|
private _addRefreshOnLoadToPivotTables;
|
|
492
|
+
/**
|
|
493
|
+
* Remove the stale calculation chain (xl/calcChain.xml). Excel rebuilds it
|
|
494
|
+
* on open; keeping stale <c> entries for the replaced sheet would force a
|
|
495
|
+
* repair prompt. Removes the part, its Content_Types override and its
|
|
496
|
+
* workbook rels entry (xlspy parity).
|
|
497
|
+
*/
|
|
498
|
+
private _removeCalcChain;
|
|
499
|
+
private _writePartText;
|
|
500
|
+
private _ensureCalcPrFullCalc;
|
|
501
|
+
/**
|
|
502
|
+
* Insertion offset for a missing `<calcPr>`. The element follows
|
|
503
|
+
* sheets/externalReferences/definedNames in the workbook schema, so insert
|
|
504
|
+
* after the last of those that exists instead of right after `<workbook>`.
|
|
505
|
+
*/
|
|
506
|
+
private static _calcPrInsertPosition;
|
|
507
|
+
/**
|
|
508
|
+
* Update ListObject table ranges (xl/tables/*.xml) for the replaced sheet.
|
|
509
|
+
* Only tables anchored at A1 are updated to the new dimension; tables
|
|
510
|
+
* elsewhere are left untouched (moving them would corrupt the sheet).
|
|
511
|
+
* Empty replacements (dimRef "A1") do not shrink multi-column tables.
|
|
512
|
+
*/
|
|
513
|
+
private _updateTableRefs;
|
|
460
514
|
}
|
|
461
515
|
|
|
462
516
|
/**
|
|
@@ -505,7 +559,7 @@ declare class XlsbUpdater {
|
|
|
505
559
|
private sharedStringsEndSst;
|
|
506
560
|
private stringIndexMap;
|
|
507
561
|
private sharedStringsDirty;
|
|
508
|
-
private
|
|
562
|
+
private _oaEpoch;
|
|
509
563
|
/**
|
|
510
564
|
* @param path Path to an existing `.xlsb` file.
|
|
511
565
|
*/
|
|
@@ -560,13 +614,21 @@ declare class XlsbUpdater {
|
|
|
560
614
|
private _patchSheetMetadataFile;
|
|
561
615
|
private _findRowsRegion;
|
|
562
616
|
/**
|
|
563
|
-
* Keep the sheet dimension record (
|
|
564
|
-
* Excel uses its rwLast (payload offset
|
|
617
|
+
* Keep the sheet dimension record (0x94) in sync with the new data.
|
|
618
|
+
* Excel uses its rwLast (payload offset 4) and colLast (payload offset 12)
|
|
565
619
|
* fields to read the full row range; stale values make the last written row
|
|
566
620
|
* invisible to Excel (and drop it from pivot refreshes).
|
|
567
621
|
*/
|
|
568
622
|
private _patchDimension;
|
|
569
623
|
private _patchPivotCaches;
|
|
624
|
+
/**
|
|
625
|
+
* Remove the stale calculation chain (xl/calcChain.bin). Excel rebuilds it
|
|
626
|
+
* on open. Removes the part, its Content_Types override and its workbook
|
|
627
|
+
* rels entry. XLSB tables are not patched (documented limitation).
|
|
628
|
+
*/
|
|
629
|
+
private _removeCalcChain;
|
|
630
|
+
/** Write an XML/text part to its staged file when present, else into the ZIP. */
|
|
631
|
+
private _writePartText;
|
|
570
632
|
}
|
|
571
633
|
|
|
572
634
|
/** Options for an Excel format conversion. */
|
|
@@ -586,6 +648,18 @@ declare const INVALID_SHEET_NAME_CHARS: RegExp;
|
|
|
586
648
|
* @param sheetCount Current sheet count before adding this sheet (used for defaults).
|
|
587
649
|
*/
|
|
588
650
|
declare function sanitizeSheetName(name: string, sheetCount: number): string;
|
|
651
|
+
/** Excel limits (decision: throw on violation, like xlspy). */
|
|
652
|
+
declare const MAX_ROWS = 1048576;
|
|
653
|
+
declare const MAX_COLS = 16384;
|
|
654
|
+
declare const MAX_CELL_CHARS = 32767;
|
|
655
|
+
/** Throw when cell text exceeds Excel's 32,767 UTF-16 unit limit. */
|
|
656
|
+
declare function assertCellTextLength(text: string): void;
|
|
657
|
+
/** Throw when column count is outside Excel bounds. */
|
|
658
|
+
declare function assertColumnCount(columnCount: number): void;
|
|
659
|
+
/** Throw when a row/header is longer than the declared column count. */
|
|
660
|
+
declare function assertRowFitsColumns(kind: string, length: number, columnCount: number): void;
|
|
661
|
+
/** Throw when total row count exceeds Excel bounds. */
|
|
662
|
+
declare function assertRowCount(totalRows: number): void;
|
|
589
663
|
/** Create column-width scratch array filled with -1 (unknown). */
|
|
590
664
|
declare function initColWidths(columnCount: number): number[];
|
|
591
665
|
/** Apply autofit widths from header labels. */
|
|
@@ -624,4 +698,32 @@ declare class StreamingSheetState {
|
|
|
624
698
|
end(): void;
|
|
625
699
|
}
|
|
626
700
|
|
|
627
|
-
|
|
701
|
+
/**
|
|
702
|
+
* Shared low-level XML helpers used by readers and the XlsxUpdater.
|
|
703
|
+
*/
|
|
704
|
+
/** Escape text content for use inside an XML element body. */
|
|
705
|
+
declare function escapeXmlText(str: string): string;
|
|
706
|
+
/** Unescape the five predefined XML entities (single-pass, order-independent). */
|
|
707
|
+
declare function unescapeXml(str: string): string;
|
|
708
|
+
/** Parse XML tag attributes into a map, independent of order/prefix/quote style. */
|
|
709
|
+
declare function parseTagAttributes(tag: string): Record<string, string>;
|
|
710
|
+
/** Resolve a workbook rel Target to a zip entry path (xlspy _resolve_path logic). */
|
|
711
|
+
declare function resolveRelTarget(target: string): string;
|
|
712
|
+
/** 0-based column index -> "A", "B", ..., "AA", "AB", ... (bijective base-26). */
|
|
713
|
+
declare function columnIndexToLetter(colIndex: number): string;
|
|
714
|
+
/** "A", "AB", ... -> 0-based column index. */
|
|
715
|
+
declare function columnLetterToIndex(letter: string): number;
|
|
716
|
+
/**
|
|
717
|
+
* Remove trailing rows that contain no non-empty cells (padding rows sometimes
|
|
718
|
+
* produced by SQL exports). This keeps the written range aligned with the
|
|
719
|
+
* actual data, so pivot tables do not pick up "(blank)" items from empty rows.
|
|
720
|
+
*/
|
|
721
|
+
declare function trimTrailingEmptyRows<T>(rows: T[][]): T[][];
|
|
722
|
+
/**
|
|
723
|
+
* Parse the contents of xl/sharedStrings.xml into the list of string values.
|
|
724
|
+
* Handles plain `<si><t>…</t></si>` entries as well as rich-text `<si><r><t>…</t></r></si>` runs.
|
|
725
|
+
* Phonetic `<rPh>` blocks are skipped (xlspy parity) and self-closing `<si/>` yields "".
|
|
726
|
+
*/
|
|
727
|
+
declare function parseSharedStringsXml(xml: string): string[];
|
|
728
|
+
|
|
729
|
+
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, escapeXmlText, getFormat, initColWidths, isFormattedCell, parseSharedStringsXml, parseTagAttributes, resolveRelTarget, sanitizeSheetName, trimTrailingEmptyRows, unescapeXml, unwrapCell, updateColWidthsFromRows };
|