@node-projects/excelforge 2.4.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.
- package/.github/FUNDING.yml +4 -0
- package/FEATURES.md +294 -0
- package/README.md +628 -12
- package/dist/core/SharedStrings.js +6 -2
- package/dist/core/SharedStrings.js.map +1 -1
- package/dist/core/Workbook.d.ts +43 -1
- package/dist/core/Workbook.js +881 -58
- package/dist/core/Workbook.js.map +1 -1
- package/dist/core/WorkbookReader.d.ts +18 -4
- package/dist/core/WorkbookReader.js +1386 -20
- package/dist/core/WorkbookReader.js.map +1 -1
- package/dist/core/Worksheet.d.ts +136 -2
- package/dist/core/Worksheet.js +828 -63
- package/dist/core/Worksheet.js.map +1 -1
- package/dist/core/types.d.ts +311 -5
- package/dist/core/types.js +12 -1
- package/dist/core/types.js.map +1 -1
- package/dist/features/ChartBuilder.d.ts +9 -1
- package/dist/features/ChartBuilder.js +140 -14
- package/dist/features/ChartBuilder.js.map +1 -1
- package/dist/features/CsvModule.d.ts +11 -0
- package/dist/features/CsvModule.js +137 -0
- package/dist/features/CsvModule.js.map +1 -0
- package/dist/features/Encryption.d.ts +6 -0
- package/dist/features/Encryption.js +806 -0
- package/dist/features/Encryption.js.map +1 -0
- package/dist/features/FormControlBuilder.d.ts +6 -0
- package/dist/features/FormControlBuilder.js +135 -0
- package/dist/features/FormControlBuilder.js.map +1 -0
- package/dist/features/FormulaEngine.d.ts +22 -0
- package/dist/features/FormulaEngine.js +498 -0
- package/dist/features/FormulaEngine.js.map +1 -0
- package/dist/features/HtmlModule.d.ts +22 -0
- package/dist/features/HtmlModule.js +1441 -0
- package/dist/features/HtmlModule.js.map +1 -0
- package/dist/features/JsonModule.d.ts +10 -0
- package/dist/features/JsonModule.js +76 -0
- package/dist/features/JsonModule.js.map +1 -0
- package/dist/features/PdfModule.d.ts +30 -0
- package/dist/features/PdfModule.js +1567 -0
- package/dist/features/PdfModule.js.map +1 -0
- package/dist/features/PivotTableBuilder.d.ts +7 -0
- package/dist/features/PivotTableBuilder.js +170 -0
- package/dist/features/PivotTableBuilder.js.map +1 -0
- package/dist/features/Signing.d.ts +12 -0
- package/dist/features/Signing.js +326 -0
- package/dist/features/Signing.js.map +1 -0
- package/dist/features/TableBuilder.js +2 -2
- package/dist/features/TableBuilder.js.map +1 -1
- package/dist/index-min.js +609 -147
- package/dist/index.d.ts +19 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/dist/styles/StyleRegistry.d.ts +14 -0
- package/dist/styles/StyleRegistry.js +95 -30
- package/dist/styles/StyleRegistry.js.map +1 -1
- package/dist/utils/helpers.d.ts +4 -0
- package/dist/utils/helpers.js +64 -14
- package/dist/utils/helpers.js.map +1 -1
- package/dist/utils/zip.js +145 -73
- package/dist/utils/zip.js.map +1 -1
- package/dist/vba/VbaProject.d.ts +31 -0
- package/dist/vba/VbaProject.js +576 -0
- package/dist/vba/VbaProject.js.map +1 -0
- package/dist/vba/cfb.d.ts +7 -0
- package/dist/vba/cfb.js +352 -0
- package/dist/vba/cfb.js.map +1 -0
- package/dist/vba/ovba.d.ts +2 -0
- package/dist/vba/ovba.js +137 -0
- package/dist/vba/ovba.js.map +1 -0
- package/package.json +4 -3
- package/validator.cs +0 -155
- package/validatorEpplus.cs +0 -27
- package/validatorReadData.cs +0 -111
package/dist/index-min.js
CHANGED
|
@@ -1,259 +1,721 @@
|
|
|
1
|
-
function W(s){let t="";for(;s>0;){let e=(s-1)%26;t=String.fromCharCode(65+e)+t,s=Math.floor((s-1)/26)}return t}function Nt(s){let t=0;for(let e=0;e<s.length;e++)t=t*26+(s.charCodeAt(e)-64);return t}function H(s){let t=s.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!t)throw new Error(`Invalid cell ref: ${s}`);return{col:Nt(t[2]),row:parseInt(t[4],10)}}function rt(s,t,e=!1){let r=e?"$":"";return`${r}${W(t)}${r}${s}`}function ot(s){let[t,e]=s.split(":"),r=H(t.replace(/\$/g,"")),o=e?H(e.replace(/\$/g,"")):r;return{startRow:r.row,startCol:r.col,endRow:o.row,endCol:o.col}}function g(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}var re=new TextEncoder;function C(s){return re.encode(s)}function gt(s,t=!1){let e=t?Date.UTC(1904,0,1):Date.UTC(1899,11,30),r=(s.getTime()-e)/864e5;return t||r>=60,r}function xt(s){return Math.round(s*914400/96)}function ct(s){let t=atob(s),e=new Uint8Array(t.length);for(let r=0;r<t.length;r++)e[r]=t.charCodeAt(r);return e}function oe(s){let t="";for(let e=0;e<s.length;e++)t+=String.fromCharCode(s[e]);return btoa(t)}var ne={average:101,count:102,countNums:103,max:104,min:105,stdDev:107,sum:109,var:110,vars:111},J=class{constructor(t,e={}){this.cells=new Map,this.merges=[],this.images=[],this.charts=[],this.conditionalFormats=[],this.tables=[],this.sparklines=[],this.colDefs=new Map,this.rowDefs=new Map,this.dataValidations=new Map,this.sheetIndex=0,this.rId="",this.drawingRId="",this.legacyDrawingRId="",this.tableRIds=[],this.name=t,this.options={...e,name:t}}key(t,e){return`${t},${e}`}getCell(t,e){let r=this.key(t,e);return this.cells.has(r)||this.cells.set(r,{}),this.cells.get(r)}getCellByRef(t){let{row:e,col:r}=H(t);return this.getCell(e,r)}setCell(t,e,r){return this.cells.set(this.key(t,e),r),this}setValue(t,e,r){return this.getCell(t,e).value=r,this}setFormula(t,e,r){return this.getCell(t,e).formula=r,this}setStyle(t,e,r){return this.getCell(t,e).style=r,this}writeArray(t,e,r){for(let o=0;o<r.length;o++)for(let n=0;n<r[o].length;n++)this.setValue(t+o,e+n,r[o][n]);return this}writeColumn(t,e,r){return r.forEach((o,n)=>this.setValue(t+n,e,o)),this}writeRow(t,e,r){return r.forEach((o,n)=>this.setValue(t,e+n,o)),this}setColumn(t,e){return this.colDefs.set(t,e),this}setColumnWidth(t,e){let r=this.colDefs.get(t)??{};return this.colDefs.set(t,{...r,width:e,customWidth:!0}),this}setRow(t,e){return this.rowDefs.set(t,e),this}setRowHeight(t,e){let r=this.rowDefs.get(t)??{};return this.rowDefs.set(t,{...r,height:e}),this}merge(t,e,r,o){return this.merges.push({startRow:t,startCol:e,endRow:r,endCol:o}),this}mergeByRef(t){let[e,r]=t.split(":"),o=H(e),n=H(r);return this.merge(o.row,o.col,n.row,n.col)}addImage(t){return this.images.push(t),this}getImages(){return this.images}getComments(){let t=[];for(let[e,r]of this.cells)if(r.comment){let[o,n]=e.split(",").map(Number);t.push({row:o,col:n,comment:r.comment})}return t}addChart(t){return this.charts.push(t),this}getCharts(){return this.charts}addConditionalFormat(t){return this.conditionalFormats.push(t),this}addTable(t){if(this.tables.push(t),t.totalsRow&&t.columns?.length){let{startRow:e,startCol:r,endRow:o}=ot(t.ref),n=e+1,i=o-1;t.columns.forEach((l,c)=>{let a=r+c;if(l.totalsRowLabel)this.setValue(o,a,l.totalsRowLabel);else if(l.totalsRowFunction&&l.totalsRowFunction!=="none"){let d=ne[l.totalsRowFunction];if(d!==void 0){let m=W(a);this.setFormula(o,a,`SUBTOTAL(${d},${m}${n}:${m}${i})`)}}})}return this}getTables(){return this.tables}addSparkline(t){return this.sparklines.push(t),this}addDataValidation(t,e){return this.dataValidations.set(t,e),this}freeze(t,e){return this.freezePane={row:t,col:e},this}toXml(t,e){let r=this.pageSetup?.fitToPage,o=this.options?.tabColor,n=r||o?`<sheetPr>${o?`<tabColor rgb="${o}"/>`:""}${r?'<pageSetUpPr fitToPage="1"/>':""}</sheetPr>`:"",i=this._sheetViewXml(),l=this._colsXml(t),c=this._sheetDataXml(t,e),a=this._mergesXml(),d=this._conditionalFormatXml(t),m=this._dataValidationsXml(),p=this.autoFilter?`<autoFilter ref="${this.autoFilter.ref}"/>`:"",h=this.tables.length?`<tableParts count="${this.tables.length}">${this.tableRIds.map(T=>`<tablePart r:id="${T}"/>`).join("")}</tableParts>`:"",u=(this.images.length||this.charts.length)&&this.drawingRId?`<drawing r:id="${this.drawingRId}"/>`:"",$=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"",x=this._sparklineXml(),y=this._protectionXml(),b=this._pageSetupXml(),F=this._pageMarginsXml(),I=this._headerFooterXml(),X=this._printOptionsXml();return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
1
|
+
var te=class e{constructor(t){this.error=t}toString(){return this.error}static{this.NULL=new e("#NULL!")}static{this.DIV0=new e("#DIV/0!")}static{this.VALUE=new e("#VALUE!")}static{this.REF=new e("#REF!")}static{this.NAME=new e("#NAME?")}static{this.NUM=new e("#NUM!")}static{this.NA=new e("#N/A")}static{this.GETTING=new e("#GETTING_DATA")}};var Eo=[];function Ut(e){if(Eo[e])return Eo[e];let t="",o=e;for(;o>0;){let n=(o-1)%26;t=String.fromCharCode(65+n)+t,o=Math.floor((o-1)/26)}return Eo[e]=t,t}function qt(e){let t=0;for(let o=0;o<e.length;o++)t=t*26+(e.charCodeAt(o)-64);return t}function Gt(e){let t=e.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!t)throw new Error(`Invalid cell ref: ${e}`);return{col:qt(t[2]),row:parseInt(t[4],10)}}function ye(e,t,o=!1){let n=o?"$":"";return`${n}${Ut(t)}${n}${e}`}function Jt(e){let[t,o]=e.split(":"),n=Gt(t.replace(/\$/g,"")),r=o?Gt(o.replace(/\$/g,"")):n;return{startRow:n.row,startCol:n.col,endRow:r.row,endCol:r.col}}var Mr={"&":"&","<":"<",">":">",'"':""","'":"'"},Bo=/[&<>"']/g;function I(e){return Bo.test(e)?(Bo.lastIndex=0,e.replace(Bo,t=>Mr[t])):e}var Er=new TextEncoder;function st(e){return Er.encode(e)}function _o(e,t=!1){let o=t?Date.UTC(1904,0,1):Date.UTC(1899,11,30),n=(e.getTime()-o)/864e5;return t||n>=60,n}function jo(e){return Math.round(e*914400/96)}function le(e){let t=atob(e),o=new Uint8Array(t.length);for(let n=0;n<t.length;n++)o[n]=t.charCodeAt(n);return o}function Br(e){let t=[];for(let o=0;o<e.length;o+=8192)t.push(String.fromCharCode.apply(null,e.subarray(o,o+8192)));return btoa(t.join(""))}function un(e,t,o){let n=e.match(/^(\$?)([A-Z]+)(\$?)(\d+)$/);if(!n)return e;let r=n[1]==="$",s=qt(n[2]),i=n[3]==="$",a=parseInt(n[4],10),l=i?`R${a}`:a===t?"R":`R[${a-t}]`,h=r?`C${s}`:s===o?"C":`C[${s-o}]`;return l+h}function gn(e,t,o){let n=e.match(/^R(\[(-?\d+)\]|(\d+))?C(\[(-?\d+)\]|(\d+))?$/);if(!n)return e;let r,s,i,a;return n[3]!==void 0?(r=parseInt(n[3],10),s=!0):n[2]!==void 0?(r=t+parseInt(n[2],10),s=!1):(r=t,s=!1),n[6]!==void 0?(i=parseInt(n[6],10),a=!0):n[5]!==void 0?(i=o+parseInt(n[5],10),a=!1):(i=o,a=!1),`${a?"$":""}${Ut(i)}${s?"$":""}${r}`}function _r(e,t,o){return e.replace(/(\$?)([A-Z]+)(\$?)(\d+)/g,(n,r,s,i,a)=>un(`${r}${s}${i}${a}`,t,o))}function jr(e,t,o){return e.replace(/R(\[(-?\d+)\]|(\d+))?C(\[(-?\d+)\]|(\d+))?/g,n=>gn(n,t,o))}var Oo=/[&<>]/g,Or={"&":"&","<":"<",">":">"};function Lo(e){return Oo.test(e)?(Oo.lastIndex=0,e.replace(Oo,t=>Or[t])):e}function xn(e){return e.startsWith("theme:")?`<color theme="${e.slice(6)}"/>`:`<color rgb="${e.startsWith("#")?"FF"+e.slice(1):e}"/>`}var Lr={average:101,count:102,countNums:103,max:104,min:105,stdDev:107,sum:109,var:110,vars:111},Ie=class{constructor(t,o={}){this.cells=new Map,this.merges=[],this.images=[],this.cellImages=[],this.charts=[],this.conditionalFormats=[],this.tables=[],this.pivotTables=[],this.sparklines=[],this.formControls=[],this.shapes=[],this.wordArt=[],this.queryTables=[],this.tableSlicers=[],this.mathEquations=[],this.oleObjects=[],this.colDefs=new Map,this.rowDefs=new Map,this.dataValidations=new Map,this.rowBreaks=[],this.colBreaks=[],this.preservedXml=[],this._nextSharedIdx=0,this._isChartSheet=!1,this._isDialogSheet=!1,this.sheetIndex=0,this.rId="",this.drawingRId="",this.legacyDrawingRId="",this.tableRIds=[],this.ctrlPropRIds=[],this.slicerRId="",this._slicerDrawingInfo=[],this._cellImageVm=new Map,this.ignoreErrors=[],this.oleRIds=[],this.oleIconRIds=[],this.name=t,this.options={...o,name:t}}getCell(t,o){let n=this.cells.get(t);n||(n=new Map,this.cells.set(t,n));let r=n.get(o);return r||(r={},n.set(o,r)),r}getCellByRef(t){let{row:o,col:n}=Gt(t);return this.getCell(o,n)}setCell(t,o,n){let r=this.cells.get(t);return r||(r=new Map,this.cells.set(t,r)),r.set(o,n),this}setValue(t,o,n){return this.getCell(t,o).value=n,this}setFormula(t,o,n){return this.getCell(t,o).formula=n,this}setDynamicArrayFormula(t,o,n){let r=this.getCell(t,o);return r.arrayFormula=n,r._dynamic=!0,this}setSharedFormula(t,o,n,r){let s=this._nextSharedIdx++,i=this.getCell(t,o);i.formula=n,i._sharedRef=r,i._sharedIdx=s;let{startRow:a,startCol:l,endRow:h,endCol:c}=Jt(r);for(let m=a;m<=h;m++)for(let d=l;d<=c;d++){if(m===t&&d===o)continue;let f=this.getCell(m,d);f._sharedIdx=s}return this}setStyle(t,o,n){return this.getCell(t,o).style=n,this}writeArray(t,o,n){for(let r=0;r<n.length;r++)for(let s=0;s<n[r].length;s++)this.setValue(t+r,o+s,n[r][s]);return this}writeColumn(t,o,n){return n.forEach((r,s)=>this.setValue(t+s,o,r)),this}writeRow(t,o,n){return n.forEach((r,s)=>this.setValue(t,o+s,r)),this}setColumn(t,o){return this.colDefs.set(t,o),this}setColumnWidth(t,o){let n=this.colDefs.get(t)??{};return this.colDefs.set(t,{...n,width:o,customWidth:!0}),this}setRow(t,o){return this.rowDefs.set(t,o),this}setRowHeight(t,o){let n=this.rowDefs.get(t)??{};return this.rowDefs.set(t,{...n,height:o}),this}merge(t,o,n,r){return this.merges.push({startRow:t,startCol:o,endRow:n,endCol:r}),this}mergeByRef(t){let[o,n]=t.split(":"),r=Gt(o),s=Gt(n);return this.merge(r.row,r.col,s.row,s.col)}getMerges(){return this.merges}addImage(t){return this.images.push(t),this}getImages(){return this.images}addCellImage(t){return this.cellImages.push(t),this}getCellImages(){return this.cellImages}getComments(){let t=[];for(let[o,n]of this.cells)for(let[r,s]of n)s.comment&&t.push({row:o,col:r,comment:s.comment});return t}addChart(t){return this.charts.push(t),this}getCharts(){return this.charts}addConditionalFormat(t){return this.conditionalFormats.push(t),this}getConditionalFormats(){return this.conditionalFormats}getDataValidations(){return this.dataValidations}addTable(t){if(this.tables.push(t),t.totalsRow&&t.columns?.length){let{startRow:o,startCol:n,endRow:r}=Jt(t.ref),s=o+1,i=r-1;t.columns.forEach((a,l)=>{let h=n+l;if(a.totalsRowLabel)this.setValue(r,h,a.totalsRowLabel);else if(a.totalsRowFunction&&a.totalsRowFunction!=="none"){let c=Lr[a.totalsRowFunction];if(c!==void 0){let m=Ut(h);this.setFormula(r,h,`SUBTOTAL(${c},${m}${s}:${m}${i})`)}}})}return this}getTables(){return this.tables}addPivotTable(t){return this.pivotTables.push(t),this}getPivotTables(){return this.pivotTables}readRange(t){let{startRow:o,startCol:n,endRow:r,endCol:s}=Jt(t),i=[];for(let a=o;a<=r;a++){let l=[],h=this.cells.get(a);for(let c=n;c<=s;c++){let m=h?.get(c);l.push(m?.value??null)}i.push(l)}return i}readAllCells(){let t=[];for(let[o,n]of this.cells)for(let[r,s]of n)t.push({row:o,col:r,cell:s});return t}getUsedRange(){let t=1/0,o=0,n=1/0,r=0;for(let[s,i]of this.cells)for(let[a]of i)s<t&&(t=s),s>o&&(o=s),a<n&&(n=a),a>r&&(r=a);return o===0?null:{startRow:t,startCol:n,endRow:o,endCol:r}}getColumn(t){return this.colDefs.get(t)}getRow(t){return this.rowDefs.get(t)}insertRows(t,o){let n=[...this.cells.keys()].filter(s=>s>=t).sort((s,i)=>i-s);for(let s of n){let i=this.cells.get(s);this.cells.delete(s),this.cells.set(s+o,i)}let r=[...this.rowDefs.keys()].filter(s=>s>=t).sort((s,i)=>i-s);for(let s of r){let i=this.rowDefs.get(s);this.rowDefs.delete(s),this.rowDefs.set(s+o,i)}for(let s of this.merges)s.startRow>=t&&(s.startRow+=o),s.endRow>=t&&(s.endRow+=o);return this}deleteRows(t,o){for(let s=t;s<t+o;s++)this.cells.delete(s),this.rowDefs.delete(s);let n=[...this.cells.keys()].filter(s=>s>=t+o).sort((s,i)=>s-i);for(let s of n){let i=this.cells.get(s);this.cells.delete(s),this.cells.set(s-o,i)}let r=[...this.rowDefs.keys()].filter(s=>s>=t+o).sort((s,i)=>s-i);for(let s of r){let i=this.rowDefs.get(s);this.rowDefs.delete(s),this.rowDefs.set(s-o,i)}this.merges=this.merges.filter(s=>!(s.startRow>=t&&s.endRow<t+o));for(let s of this.merges)s.startRow>=t+o&&(s.startRow-=o),s.endRow>=t+o&&(s.endRow-=o);return this}insertColumns(t,o){for(let[,r]of this.cells){let s=[...r.keys()].filter(i=>i>=t).sort((i,a)=>a-i);for(let i of s){let a=r.get(i);r.delete(i),r.set(i+o,a)}}let n=[...this.colDefs.keys()].filter(r=>r>=t).sort((r,s)=>s-r);for(let r of n){let s=this.colDefs.get(r);this.colDefs.delete(r),this.colDefs.set(r+o,s)}for(let r of this.merges)r.startCol>=t&&(r.startCol+=o),r.endCol>=t&&(r.endCol+=o);return this}copyRange(t,o,n){let{startRow:r,startCol:s,endRow:i,endCol:a}=Jt(t);for(let l=r;l<=i;l++)for(let h=s;h<=a;h++){let c=this.getCell(l,h),m=o+(l-r),d=n+(h-s);c.value!=null&&this.setValue(m,d,c.value),c.formula&&this.setFormula(m,d,c.formula),c.style&&this.setStyle(m,d,{...c.style})}return this}moveRange(t,o,n){let{startRow:r,startCol:s,endRow:i,endCol:a}=Jt(t);this.copyRange(t,o,n);let l=o+(i-r),h=n+(a-s);for(let c=r;c<=i;c++)for(let m=s;m<=a;m++){let d=o+(c-r),f=n+(m-s);if(d===c&&f===m)continue;let p=this.cells.get(c);p&&p.delete(m)}return this}sortRange(t,o,n="asc"){let{startRow:r,startCol:s,endRow:i,endCol:a}=Jt(t),l=[];for(let h=r;h<=i;h++){let c=this.cells.get(h),m=new Map;for(let d=s;d<=a;d++){let f=c?.get(d);f&&m.set(d,{...f})}l.push({rowIdx:h,cells:m})}l.sort((h,c)=>{let m=h.cells.get(o)?.value,d=c.cells.get(o)?.value,f=typeof m=="number"||typeof m=="string"?m:"",p=typeof d=="number"||typeof d=="string"?d:"",g=0;return typeof f=="number"&&typeof p=="number"?g=f-p:g=String(f).localeCompare(String(p)),n==="desc"?-g:g});for(let h=0;h<l.length;h++){let c=r+h;for(let m=s;m<=a;m++){let d=l[h].cells.get(m),f=this.cells.get(c)??new Map;this.cells.has(c)||this.cells.set(c,f),d?f.set(m,d):f.delete(m)}}return this}fillNumber(t,o,n,r=0,s=1){for(let i=0;i<n;i++)this.setValue(t+i,o,r+i*s);return this}fillDate(t,o,n,r,s="day",i=1){for(let a=0;a<n;a++){let l=new Date(r);switch(s){case"day":l.setDate(l.getDate()+a*i);break;case"week":l.setDate(l.getDate()+a*i*7);break;case"month":l.setMonth(l.getMonth()+a*i);break;case"year":l.setFullYear(l.getFullYear()+a*i);break}this.setValue(t+a,o,l)}return this}fillList(t,o,n,r){for(let s=0;s<r;s++)this.setValue(t+s,o,n[s%n.length]);return this}autoFitColumns(t=8,o=60){let n=this.getUsedRange();if(!n)return this;for(let r=n.startCol;r<=n.endCol;r++){let s=0;for(let i=n.startRow;i<=n.endRow;i++){let a=this.cells.get(i)?.get(r);if(a?.value!=null){let l=String(a.value);l.length>s&&(s=l.length)}if(a?.richText){let l=a.richText.map(h=>h.text).join("");l.length>s&&(s=l.length)}}if(s>0){let i=Math.max(t,Math.min(o,s*1.2+2));this.setColumn(r,{...this.colDefs.get(r)??{},width:i,customWidth:!0})}}return this}duplicateRow(t,o){this.insertRows(o,1);let n=this.cells.get(t>=o?t+1:t);if(n){let s=new Map;for(let[i,a]of n)s.set(i,{...a,style:a.style?{...a.style}:void 0});this.cells.set(o,s)}let r=this.rowDefs.get(t>=o?t+1:t);return r&&this.rowDefs.set(o,{...r}),this}spliceRows(t,o,n){if(o>0&&this.deleteRows(t,o),n&&n.length>0){this.insertRows(t,n.length);for(let r=0;r<n.length;r++)this.writeRow(t+r,1,n[r])}return this}setAutoFilter(t,o){return this.autoFilter={ref:t},o?.columns&&(this._filterColumns=o.columns),this}addSparkline(t){return this.sparklines.push(t),this}getSparklines(){return this.sparklines}addDataValidation(t,o){return this.dataValidations.set(t,o),this}addRowBreak(t,o=!0){return this.rowBreaks.push({id:t,manual:o}),this}addColBreak(t,o=!0){return this.colBreaks.push({id:t,manual:o}),this}getRowBreaks(){return this.rowBreaks}getColBreaks(){return this.colBreaks}addFormControl(t){if(!t.to&&(t.width||t.height)){let r=t.width??100,s=t.height??30,i=t.from.col+r/64,a=t.from.row+s/20;t={...t,to:{col:Math.floor(i),row:Math.floor(a),colOff:Math.round(i%1*64),rowOff:Math.round(a%1*20)}}}return this.formControls.push(t),this}getFormControls(){return this.formControls}addShape(t){return this.shapes.push(t),this}getShapes(){return this.shapes}addOleObject(t){return this.oleObjects.push(t),this}getOleObjects(){return this.oleObjects}addWordArt(t){return this.wordArt.push(t),this}getWordArt(){return this.wordArt}addQueryTable(t){return this.queryTables.push(t),this}getQueryTables(){return this.queryTables}addTableSlicer(t){return this.tableSlicers.push(t),this}getTableSlicers(){return this.tableSlicers}addMathEquation(t){return this.mathEquations.push(t),this}getMathEquations(){return this.mathEquations}addIgnoredError(t,o){return this.ignoreErrors.push({sqref:t,...o}),this}getIgnoredErrors(){return this.ignoreErrors}addPreservedXml(t){return this.preservedXml.push(t),this}freeze(t,o){return this.freezePane={row:t,col:o},this}toXml(t,o){let n=this.pageSetup?.fitToPage,r=this.options?.tabColor,s=n||r?`<sheetPr>${r?`<tabColor rgb="${r}"/>`:""}${n?'<pageSetUpPr fitToPage="1"/>':""}</sheetPr>`:"",i=this._sheetViewXml(),a=this._colsXml(t),l=this._sheetDataXml(t,o),h=this._mergesXml(),c=this._conditionalFormatXml(t),m=this._dataValidationsXml(),d=this.autoFilter&&!this.tables.some(k=>k.ref===this.autoFilter.ref)?this._autoFilterXml():"",f=this.tables.length?`<tableParts count="${this.tables.length}">${this.tableRIds.map(k=>`<tablePart r:id="${k}"/>`).join("")}</tableParts>`:"",p=this.drawingRId?`<drawing r:id="${this.drawingRId}"/>`:"",g=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"",u=this._formControlsXml(),$=this._oleObjectsXml(),x=this._sparklineXml(),b=this._customIconExtXml(),F=this.slicerRId?`<extLst><ext uri="{A8765BA9-456A-4dab-B4F3-ACF838C121DE}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerList><x14:slicer r:id="${this.slicerRId}"/></x14:slicerList></ext></extLst>`:"",y=this._ignoredErrorsXml(),v=this._protectionXml(),w=this._pageSetupXml(),R=this._pageMarginsXml(),T=this._headerFooterXml(),S=this._printOptionsXml(),M=this._pageBreaksXml("rowBreaks",this.rowBreaks,16383),D=this._pageBreaksXml("colBreaks",this.colBreaks,1048575);return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
2
2
|
<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
|
|
3
3
|
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships"
|
|
4
4
|
xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"
|
|
5
|
-
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
|
|
6
|
-
|
|
5
|
+
xmlns:xr="http://schemas.microsoft.com/office/spreadsheetml/2014/revision"
|
|
6
|
+
xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"
|
|
7
|
+
xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing">
|
|
8
|
+
${s}
|
|
7
9
|
${i}
|
|
10
|
+
${a}
|
|
8
11
|
${l}
|
|
12
|
+
${v}
|
|
13
|
+
${d}
|
|
14
|
+
${h}
|
|
9
15
|
${c}
|
|
16
|
+
${m}
|
|
17
|
+
${S}
|
|
18
|
+
${R}
|
|
19
|
+
${w}
|
|
20
|
+
${T}
|
|
21
|
+
${M}
|
|
22
|
+
${D}
|
|
10
23
|
${y}
|
|
11
24
|
${p}
|
|
12
|
-
${
|
|
13
|
-
${d}
|
|
14
|
-
${m}
|
|
15
|
-
${X}
|
|
16
|
-
${F}
|
|
17
|
-
${b}
|
|
18
|
-
${I}
|
|
19
|
-
${u}
|
|
25
|
+
${g}
|
|
20
26
|
${$}
|
|
27
|
+
${u}
|
|
21
28
|
${x}
|
|
22
|
-
${
|
|
23
|
-
|
|
24
|
-
|
|
29
|
+
${b}
|
|
30
|
+
${f}
|
|
31
|
+
${F}
|
|
32
|
+
${this.preservedXml.join(`
|
|
33
|
+
`)}
|
|
34
|
+
</worksheet>`}toChartSheetXml(){let t=this._pageMarginsXml(),o=this._pageSetupXml();return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
35
|
+
<chartsheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
|
|
36
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
37
|
+
<sheetPr/>
|
|
38
|
+
<sheetViews><sheetView zoomScale="99" workbookViewId="0" zoomToFit="1"/></sheetViews>
|
|
39
|
+
${t||'<pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/>'}
|
|
40
|
+
${o}
|
|
41
|
+
<drawing r:id="${this.drawingRId}"/>
|
|
42
|
+
</chartsheet>`}toDialogSheetXml(t,o){let n=this._pageMarginsXml(),r=this.legacyDrawingRId?`<legacyDrawing r:id="${this.legacyDrawingRId}"/>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
43
|
+
<dialogsheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
|
|
44
|
+
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
45
|
+
<sheetViews><sheetView showRowColHeaders="0" showZeros="0" showOutlineSymbols="0" workbookViewId="0"/></sheetViews>
|
|
46
|
+
<sheetFormatPr baseColWidth="10" defaultColWidth="1" defaultRowHeight="5.65" customHeight="1"/>
|
|
47
|
+
<sheetProtection sheet="1"/>
|
|
48
|
+
${n||'<pageMargins left="0.7" right="0.7" top="0.78740157499999996" bottom="0.78740157499999996" header="0.3" footer="0.3"/>'}
|
|
49
|
+
${r}
|
|
50
|
+
</dialogsheet>`}_sheetViewXml(){let t=this.view??{},o=['workbookViewId="0"',t.showGridLines===!1?'showGridLines="0"':"",t.showRowColHeaders===!1?'showRowColHeaders="0"':"",t.zoomScale!==void 0?`zoomScale="${t.zoomScale}"`:"",t.rightToLeft?'rightToLeft="1"':"",t.tabSelected?'tabSelected="1"':"",t.view?`view="${t.view}"`:""].filter(Boolean),n="";if(this.freezePane){let{row:r=0,col:s=0}=this.freezePane,i=r&&s?ye(r+1,s+1):r?ye(r+1,1):ye(1,s+1),a=r&&s?"bottomRight":r?"bottomLeft":"topRight";n=`<pane xSplit="${s}" ySplit="${r}" topLeftCell="${i}" activePane="${a}" state="frozen"/>
|
|
51
|
+
<selection pane="${a}" activeCell="${i}" sqref="${i}"/>`}return`<sheetViews><sheetView ${o.join(" ")}>${n}</sheetView></sheetViews>`}_colsXml(t){return this.colDefs.size?`<cols>${[...this.colDefs.entries()].sort((r,s)=>r[0]-s[0]).map(([r,s])=>{let i=s.style?t.register(s.style):0;return`<col min="${r}" max="${r}"`+(s.width?` width="${s.width}" customWidth="1"`:"")+(s.hidden?' hidden="1"':"")+(s.bestFit?' bestFit="1"':"")+(s.outlineLevel?` outlineLevel="${s.outlineLevel}"`:"")+(s.collapsed?' collapsed="1"':"")+(i?` style="${i}"`:"")+"/>"}).join("")}</cols>`:""}_sheetDataXml(t,o){let n=[...this.cells.entries()].sort((s,i)=>s[0]-i[0]),r=["<sheetData>"];for(let s=0;s<n.length;s++){let[i,a]=n[s],l=this.rowDefs.get(i),h=l?.style?t.register(l.style):0,c=`r="${i}"`;l?.height&&(c+=` ht="${l.height}" customHeight="1"`),l?.hidden&&(c+=' hidden="1"'),l?.outlineLevel&&(c+=` outlineLevel="${l.outlineLevel}"`),l?.collapsed&&(c+=' collapsed="1"'),h&&(c+=` s="${h}" customFormat="1"`),l?.thickTop&&(c+=' thickTop="1"'),l?.thickBot&&(c+=' thickBot="1"'),r.push(`<row ${c}>`);let m=[...a.entries()].sort((d,f)=>d[0]-f[0]);for(let d=0;d<m.length;d++)r.push(this._cellXml(i,m[d][0],m[d][1],t,o));r.push("</row>")}return r.push("</sheetData>"),r.join("")}_cellXml(t,o,n,r,s){let i=`${Ut(o)}${t}`,a=n.style?r.register(n.style):0,l=a?` s="${a}"`:"",h=this._cellImageVm.get(i),c=h!==void 0?` vm="${h}"`:"";if(n.arrayFormula){let f=`<f t="array" ref="${i}">${Lo(n.arrayFormula)}</f>`;return`<c r="${i}"${l}${c}>${f}<v>0</v></c>`}if(n._sharedIdx!==void 0){let f=n._sharedIdx,p=n._sharedRef;if(n.formula&&p){let g=`<f t="shared" ref="${p}" si="${f}">${Lo(n.formula)}</f>`;return`<c r="${i}"${l}${c}>${g}</c>`}return`<c r="${i}"${l}${c}><f t="shared" si="${f}"/></c>`}if(n.formula){let f=`<f>${Lo(n.formula)}</f>`;return`<c r="${i}"${l}${c}>${f}</c>`}if(n.richText){let f=s.internRichText(n.richText);return`<c r="${i}" t="s"${l}${c}><v>${f}</v></c>`}let m=n.value;if(m==null)return c?`<c r="${i}"${l} t="e"${c}><v>#VALUE!</v></c>`:a?`<c r="${i}"${l}/>`:"";if(m instanceof te)return`<c r="${i}" t="e"${l}${c}><v>${I(m.error)}</v></c>`;if(typeof m=="boolean")return`<c r="${i}" t="b"${l}${c}><v>${m?1:0}</v></c>`;if(m instanceof Date){let f=_o(m);return`<c r="${i}"${l}${c}><v>${f}</v></c>`}if(typeof m=="number")return`<c r="${i}"${l}${c}><v>${m}</v></c>`;let d=s.intern(m);return`<c r="${i}" t="s"${l}${c}><v>${d}</v></c>`}_mergesXml(){if(!this.merges.length)return"";let t=this.merges.map(o=>{let n=`${Ut(o.startCol)}${o.startRow}`,r=`${Ut(o.endCol)}${o.endRow}`;return`<mergeCell ref="${n}:${r}"/>`});return`<mergeCells count="${this.merges.length}">${t.join("")}</mergeCells>`}_conditionalFormatXml(t){return this.conditionalFormats.map(o=>{let n=o.style?t.registerDxf(o.style):void 0,r="";if(o.colorScale?.type==="colorScale"){let l=o.colorScale,h=l.cfvo.map(m=>`<cfvo type="${m.type}"${m.val?` val="${m.val}"`:""}/>`).join(""),c=l.color.map(m=>xn(m)).join("");r=`<colorScale>${h}${c}</colorScale>`}else if(o.dataBar?.type==="dataBar"){let l=o.dataBar,h=`<cfvo type="${l.minType??"min"}"${l.minVal!=null?` val="${l.minVal}"`:""}/>`,c=`<cfvo type="${l.maxType??"max"}"${l.maxVal!=null?` val="${l.maxVal}"`:""}/>`,m=l.color??l.minColor??"FF638EC6";r=`<dataBar${l.showValue===!1?' showValue="0"':""}>${h}${c}${xn(m)}</dataBar>`}else if(o.iconSet?.type==="iconSet"){let l=o.iconSet,h=l.cfvo.map(c=>`<cfvo type="${c.type}"${c.val?` val="${c.val}"`:""}/>`).join("");r=`<iconSet iconSet="${l.iconSet}"${l.showValue===!1?' showValue="0"':""}${l.reverse?' reverse="1"':""}>${h}</iconSet>`}let s=[`type="${o.type}"`,o.operator?`operator="${o.operator}"`:"",n!==void 0?`dxfId="${n}"`:"",`priority="${o.priority??1}"`,o.aboveAverage===!1?'aboveAverage="0"':"",o.percent?'percent="1"':"",o.rank?`rank="${o.rank}"`:"",o.timePeriod?`timePeriod="${o.timePeriod}"`:"",o.text?`text="${I(o.text)}"`:""].filter(Boolean).join(" "),i=o.formula?`<formula>${I(o.formula)}</formula>`:"",a=o.formula2?`<formula>${I(o.formula2)}</formula>`:"";return`<conditionalFormatting sqref="${o.sqref}"><cfRule ${s}>${i}${a}${r}</cfRule></conditionalFormatting>`}).join("")}_dataValidationsXml(){if(!this.dataValidations.size)return"";let t=[...this.dataValidations.entries()].map(([o,n])=>{let r=n.type==="list"&&n.list?`<formula1>"${n.list.join(",")}"</formula1>`:n.formula1?`<formula1>${I(n.formula1)}</formula1>`:"",s=n.formula2?`<formula2>${I(n.formula2)}</formula2>`:"";return`<dataValidation ${[`type="${n.type}"`,n.operator?`operator="${n.operator}"`:"",`sqref="${o}"`,n.showDropDown!==!1&&n.type==="list"?"":'showDropDown="1"',n.allowBlank!==!1?'allowBlank="1"':"",n.showErrorAlert?'showErrorMessage="1"':"",n.errorTitle?`errorTitle="${I(n.errorTitle)}"`:"",n.error?`error="${I(n.error)}"`:"",n.showInputMessage?'showInputMessage="1"':"",n.promptTitle?`promptTitle="${I(n.promptTitle)}"`:"",n.prompt?`prompt="${I(n.prompt)}"`:""].filter(Boolean).join(" ")}>${r}${s}</dataValidation>`});return`<dataValidations count="${this.dataValidations.size}">${t.join("")}</dataValidations>`}_protectionXml(){let t=this.protection;return t?`<sheetProtection ${[t.sheet?'sheet="1"':"",t.password?`password="${Nr(t.password)}"`:"",t.selectLockedCells===!1?'selectLockedCells="0"':"",t.selectUnlockedCells===!1?'selectUnlockedCells="0"':"",t.formatCells?'formatCells="0"':"",t.formatColumns?'formatColumns="0"':"",t.formatRows?'formatRows="0"':"",t.insertColumns?'insertColumns="0"':"",t.insertRows?'insertRows="0"':"",t.insertHyperlinks?'insertHyperlinks="0"':"",t.deleteColumns?'deleteColumns="0"':"",t.deleteRows?'deleteRows="0"':"",t.sort?'sort="0"':"",t.autoFilter?'autoFilter="0"':"",t.pivotTables?'pivotTables="0"':""].filter(Boolean).join(" ")}/>`:""}_pageSetupXml(){let t=this.pageSetup;return t?`<pageSetup ${[t.paperSize?`paperSize="${t.paperSize}"`:"",t.orientation?`orientation="${t.orientation}"`:"",t.fitToWidth!==void 0?`fitToWidth="${t.fitToWidth}"`:"",t.fitToHeight!==void 0?`fitToHeight="${t.fitToHeight}"`:"",t.scale?`scale="${t.scale}"`:"",t.horizontalDpi?`horizontalDpi="${t.horizontalDpi}"`:"",t.verticalDpi?`verticalDpi="${t.verticalDpi}"`:"",t.firstPageNumber?`firstPageNumber="${t.firstPageNumber}" useFirstPageNumber="1"`:""].filter(Boolean).join(" ")}/>`:""}_pageMarginsXml(){let t=this.pageMargins,n={...{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},...t};return`<pageMargins left="${n.left}" right="${n.right}" top="${n.top}" bottom="${n.bottom}" header="${n.header}" footer="${n.footer}"/>`}_headerFooterXml(){let t=this.headerFooter;if(!t)return"";let o=[t.differentOddEven?'differentOddEven="1"':"",t.differentFirst?'differentFirst="1"':""].filter(Boolean).join(" "),n=t.oddHeader?`<oddHeader>${I(t.oddHeader)}</oddHeader>`:"",r=t.oddFooter?`<oddFooter>${I(t.oddFooter)}</oddFooter>`:"",s=t.evenHeader?`<evenHeader>${I(t.evenHeader)}</evenHeader>`:"",i=t.evenFooter?`<evenFooter>${I(t.evenFooter)}</evenFooter>`:"",a=t.firstHeader?`<firstHeader>${I(t.firstHeader)}</firstHeader>`:"",l=t.firstFooter?`<firstFooter>${I(t.firstFooter)}</firstFooter>`:"";return`<headerFooter${o?" "+o:""}>${n}${r}${s}${i}${a}${l}</headerFooter>`}_printOptionsXml(){let t=this.printOptions;if(!t)return"";let o=[t.gridLines?'gridLines="1"':"",t.gridLinesSet?'gridLinesSet="1"':"",t.headings?'headings="1"':"",t.centerHorizontal?'horizontalCentered="1"':"",t.centerVertical?'verticalCentered="1"':""].filter(Boolean).join(" ");return o?`<printOptions ${o}/>`:""}_pageBreaksXml(t,o,n){if(!o.length)return"";let r=o.filter(i=>i.manual!==!1).length,s=o.map(i=>`<brk id="${i.id}" max="${n}"${i.manual!==!1?' man="1"':""}/>`).join("");return`<${t} count="${o.length}" manualBreakCount="${r}">${s}</${t}>`}_formControlsXml(){if(!this.formControls.length||!this.ctrlPropRIds.length)return"";let t=1025+this.sheetIndex*1e3,o=0;for(let r of this.cells.values())for(let s of r.values())s.comment&&o++;return`<mc:AlternateContent><mc:Choice Requires="x14"><controls>${this.formControls.map((r,s)=>{let i=r._shapeId??t+o+s,a=this.ctrlPropRIds[s];if(!a)return"";let l=r.text??`${r.type} ${s+1}`;return`<mc:AlternateContent><mc:Choice Requires="x14"><control shapeId="${i}" r:id="${a}" name="${I(l)}"><controlPr defaultSize="0" print="0" autoFill="0" autoPict="0"${r.macro?` macro="${I(r.macro)}"`:""}><anchor moveWithCells="1"><from><xdr:col>${r.from.col}</xdr:col><xdr:colOff>${r.from.colOff??0}</xdr:colOff><xdr:row>${r.from.row}</xdr:row><xdr:rowOff>${r.from.rowOff??0}</xdr:rowOff></from><to><xdr:col>${r.to.col}</xdr:col><xdr:colOff>${r.to.colOff??0}</xdr:colOff><xdr:row>${r.to.row}</xdr:row><xdr:rowOff>${r.to.rowOff??0}</xdr:rowOff></to></anchor></controlPr></control></mc:Choice></mc:AlternateContent>`}).join("")}</controls></mc:Choice></mc:AlternateContent>`}_oleObjectsXml(){if(!this.oleObjects.length||!this.oleRIds.length)return"";let t=2025+this.sheetIndex*1e3;return`<oleObjects>${this.oleObjects.map((n,r)=>{let s=t+r,i=this.oleRIds[r],a=n.progId??"Package",l=n.linkToFile&&n.linkPath?` link="${I(n.linkPath)}"`:"";return`<oleObject progId="${I(a)}" shapeId="${s}" r:id="${i}"${l}/>`}).join("")}</oleObjects>`}_sparklineXml(){if(!this.sparklines.length)return"";let t=(r,s)=>{if(!s)return"";let i=s.startsWith("#")?"FF"+s.slice(1):s;return`<x14:${r} rgb="${i}"/>`};return`<extLst><ext uri="{05C60535-1F16-4fd2-B633-F4F36F0B64E0}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">${`<x14:sparklineGroups xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main">${this.sparklines.map(r=>{let i=[`type="${r.type==="bar"?"column":r.type}"`,r.lineWidth!==void 0?`lineWeight="${r.lineWidth}"`:"",r.showMarkers?'markers="1"':"",r.showFirst?'first="1"':"",r.showLast?'last="1"':"",r.showHigh?'high="1"':"",r.showLow?'low="1"':"",r.showNegative?'negative="1"':"",r.minAxisType?`minAxisType="${r.minAxisType}"`:"",r.maxAxisType?`maxAxisType="${r.maxAxisType}"`:""].filter(Boolean).join(" "),a=[t("colorSeries",r.color),t("colorHigh",r.highColor),t("colorLow",r.lowColor),t("colorFirst",r.firstColor),t("colorLast",r.lastColor),t("colorNegative",r.negativeColor),t("colorMarkers",r.markersColor)].join(""),l=r.dataRange.includes("!")?r.dataRange:`${this.name}!${r.dataRange}`,h=`<x14:sparklines><x14:sparkline><xm:f>${I(l)}</xm:f><xm:sqref>${r.location}</xm:sqref></x14:sparkline></x14:sparklines>`;return`<x14:sparklineGroup ${i}>${a}${h}</x14:sparklineGroup>`}).join("")}</x14:sparklineGroups>`}</ext></extLst>`}_customIconExtXml(){let t=this.conditionalFormats.filter(n=>n.iconSet?.type==="iconSet"&&"custom"in n.iconSet&&n.iconSet.custom?.length);return t.length?`<extLst><ext uri="{78C0D931-6437-407d-A8EE-F0AAD7539E65}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main">${t.map((n,r)=>{let s=n.iconSet,i=s.cfvo.map(l=>`<x14:cfvo type="${l.type}"${l.val?` val="${l.val}"`:""}/>`).join(""),a=s.custom.map(l=>`<x14:cfIcon iconSet="${l.iconSet}" iconId="${l.iconId}"/>`).join("");return`<x14:conditionalFormatting xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"><x14:cfRule type="iconSet" id="{${this._uuid()}}"><x14:iconSet iconSet="${s.iconSet}" custom="1"${s.showValue===!1?' showValue="0"':""}${s.reverse?' reverse="1"':""}>${i}${a}</x14:iconSet></x14:cfRule><xm:sqref>${n.sqref}</xm:sqref></x14:conditionalFormatting>`}).join("")}</ext></extLst>`:""}_uuid(){let t="0123456789ABCDEF",o="";for(let n=0;n<36;n++)n===8||n===13||n===18||n===23?o+="-":n===14?o+="4":n===19?o+=t[(Math.random()*4|0)+8]:o+=t[Math.random()*16|0];return o}_autoFilterXml(){if(!this.autoFilter)return"";let t=this._filterColumns;if(!t||t.length===0)return`<autoFilter ref="${this.autoFilter.ref}"/>`;let o=t.map(n=>{let r=n.col-1,s="";return n.type==="custom"?s=`<customFilters><customFilter operator="${n.operator??"greaterThan"}" val="${n.val??""}"/></customFilters>`:n.type==="top10"?s=`<top10 ${[n.top===!1?'top="0"':"",n.percent?'percent="1"':"",`val="${n.val??10}"`].filter(Boolean).join(" ")}/>`:n.type==="value"&&n.items?s=`<filters>${n.items.map(i=>`<filter val="${I(String(i))}"/>`).join("")}</filters>`:n.type==="dynamic"&&(s=`<dynamicFilter type="${n.dynamicType??"aboveAverage"}"/>`),`<filterColumn colId="${r}">${s}</filterColumn>`}).join("");return`<autoFilter ref="${this.autoFilter.ref}">${o}</autoFilter>`}_ignoredErrorsXml(){return this.ignoreErrors.length?`<ignoredErrors>${this.ignoreErrors.map(o=>{let n=[`sqref="${o.sqref}"`];return o.numberStoredAsText&&n.push('numberStoredAsText="1"'),o.formula&&n.push('formula="1"'),o.formulaRange&&n.push('formulaRange="1"'),o.unlockedFormula&&n.push('unlockedFormula="1"'),o.evalError&&n.push('evalError="1"'),o.twoDigitTextYear&&n.push('twoDigitTextYear="1"'),o.emptyRef&&n.push('emptyRef="1"'),o.listDataValidation&&n.push('listDataValidation="1"'),o.calculatedColumn&&n.push('calculatedColumn="1"'),`<ignoredError ${n.join(" ")}/>`}).join("")}</ignoredErrors>`:""}toDrawingXml(t,o){let n=[],r=jo;this.images.forEach((a,l)=>{let h=t[l],c=r(a.width??100),m=r(a.height??100),d,f;if(a.position)d=`<xdr:absoluteAnchor><xdr:pos x="${r(a.position.x)}" y="${r(a.position.y)}"/><xdr:ext cx="${c}" cy="${m}"/>`,f="</xdr:absoluteAnchor>";else{let g=a.from,u=a.to,$=`<xdr:from><xdr:col>${g.col}</xdr:col><xdr:colOff>${g.colOff??0}</xdr:colOff><xdr:row>${g.row}</xdr:row><xdr:rowOff>${g.rowOff??0}</xdr:rowOff></xdr:from>`;if(u){let x=`<xdr:to><xdr:col>${u.col}</xdr:col><xdr:colOff>${u.colOff??0}</xdr:colOff><xdr:row>${u.row}</xdr:row><xdr:rowOff>${u.rowOff??0}</xdr:rowOff></xdr:to>`;d=`<xdr:twoCellAnchor editAs="oneCell">${$}${x}`,f="</xdr:twoCellAnchor>"}else d=`<xdr:oneCellAnchor>${$}<xdr:ext cx="${c}" cy="${m}"/>`,f="</xdr:oneCellAnchor>"}let p=`<xdr:pic>
|
|
25
52
|
<xdr:nvPicPr>
|
|
26
|
-
<xdr:cNvPr id="${
|
|
53
|
+
<xdr:cNvPr id="${l+2}" name="Image ${l+1}"${a.altText?` descr="${I(a.altText)}"`:""}/>
|
|
27
54
|
<xdr:cNvPicPr><a:picLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noChangeAspect="1"/></xdr:cNvPicPr>
|
|
28
55
|
</xdr:nvPicPr>
|
|
29
56
|
<xdr:blipFill>
|
|
30
|
-
<a:blip xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:embed="${
|
|
57
|
+
<a:blip xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" r:embed="${h}"/>
|
|
31
58
|
<a:stretch xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:fillRect/></a:stretch>
|
|
32
59
|
</xdr:blipFill>
|
|
33
60
|
<xdr:spPr>
|
|
34
61
|
<a:xfrm xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
|
|
35
|
-
<a:off x="0" y="0"/><a:ext cx="${
|
|
62
|
+
<a:off x="0" y="0"/><a:ext cx="${c}" cy="${m}"/>
|
|
36
63
|
</a:xfrm>
|
|
37
64
|
<a:prstGeom xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" prst="rect"><a:avLst/></a:prstGeom>
|
|
38
65
|
</xdr:spPr>
|
|
39
|
-
</xdr:pic
|
|
66
|
+
</xdr:pic>`;n.push(`${d}${p}<xdr:clientData/>${f}`)}),this.charts.forEach((a,l)=>{let h=o[l],c=a.from,m=a.to,d=`<a:graphic xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
|
|
40
67
|
<a:graphicData uri="http://schemas.openxmlformats.org/drawingml/2006/chart">
|
|
41
|
-
<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" r:id="${
|
|
68
|
+
<c:chart xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart" r:id="${h}"/>
|
|
42
69
|
</a:graphicData>
|
|
43
|
-
</a:graphic>`;r.push(`<xdr:twoCellAnchor editAs="oneCell">${d}${m}<xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+i+2}" name="Chart ${i+1}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${p}</xdr:graphicFrame><xdr:clientData/></xdr:twoCellAnchor>`)}),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
70
|
+
</a:graphic>`;if(this._isChartSheet)n.push(`<xdr:absoluteAnchor><xdr:pos x="0" y="0"/><xdr:ext cx="9294091" cy="6003636"/><xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+l+2}" name="Chart ${l+1}"/><xdr:cNvGraphicFramePr><a:graphicFrameLocks xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" noGrp="1"/></xdr:cNvGraphicFramePr></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${d}</xdr:graphicFrame><xdr:clientData/></xdr:absoluteAnchor>`);else{let f=`<xdr:from><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:from>`,p=`<xdr:to><xdr:col>${m.col}</xdr:col><xdr:colOff>${m.colOff??0}</xdr:colOff><xdr:row>${m.row}</xdr:row><xdr:rowOff>${m.rowOff??0}</xdr:rowOff></xdr:to>`;n.push(`<xdr:twoCellAnchor editAs="oneCell">${f}${p}<xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${this.images.length+l+2}" name="Chart ${l+1}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" x="0" y="0"/><a:ext xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" cx="0" cy="0"/></xdr:xfrm>${d}</xdr:graphicFrame><xdr:clientData/></xdr:twoCellAnchor>`)}});let s=this.images.length+this.charts.length+2,i=a=>{let l=a.replace(/^#/,"");return l.length===8&&(l=l.substring(2)),l};this.shapes.forEach(a=>{let l=s++,h=a.from,c=a.to,m=`<xdr:from><xdr:col>${h.col}</xdr:col><xdr:colOff>${h.colOff??0}</xdr:colOff><xdr:row>${h.row}</xdr:row><xdr:rowOff>${h.rowOff??0}</xdr:rowOff></xdr:from>`,d=`<xdr:to><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:to>`,f=a.fillColor?`<a:solidFill><a:srgbClr val="${i(a.fillColor)}"/></a:solidFill>`:"<a:noFill/>",p=a.lineColor?`<a:ln${a.lineWidth?` w="${a.lineWidth*12700}"`:""}><a:solidFill><a:srgbClr val="${i(a.lineColor)}"/></a:solidFill></a:ln>`:"",g=a.rotation?` rot="${a.rotation*6e4}"`:"",u=a.text?`<xdr:txBody><a:bodyPr vertOverflow="clip" wrap="square" rtlCol="0" anchor="ctr"/><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r><a:rPr lang="en-US"${a.font?.bold?' b="1"':""}${a.font?.size?` sz="${a.font.size*100}"`:""}/><a:t>${I(a.text)}</a:t></a:r></a:p></xdr:txBody>`:"";n.push(`<xdr:twoCellAnchor editAs="oneCell">${m}${d}<xdr:sp><xdr:nvSpPr><xdr:cNvPr id="${l}" name="Shape ${l}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr><a:xfrm${g}><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></a:xfrm><a:prstGeom prst="${a.type}"><a:avLst/></a:prstGeom>${f}${p}</xdr:spPr>${u}</xdr:sp><xdr:clientData/></xdr:twoCellAnchor>`)}),this.wordArt.forEach(a=>{let l=s++,h=a.from,c=a.to,m=`<xdr:from><xdr:col>${h.col}</xdr:col><xdr:colOff>${h.colOff??0}</xdr:colOff><xdr:row>${h.row}</xdr:row><xdr:rowOff>${h.rowOff??0}</xdr:rowOff></xdr:from>`,d=`<xdr:to><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:to>`,f=a.preset??"textPlain",p=a.font?.size?a.font.size*100:3600,g=a.fillColor?i(a.fillColor):"",u=a.outlineColor?i(a.outlineColor):"",$=g?`<a:solidFill><a:srgbClr val="${g}"/></a:solidFill>`:'<a:solidFill><a:schemeClr val="tx1"/></a:solidFill>',x=u?`<a:ln w="12700"><a:solidFill><a:srgbClr val="${u}"/></a:solidFill><a:prstDash val="solid"/></a:ln>`:"",b='<a:effectLst><a:outerShdw dist="38100" dir="2700000" algn="bl" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="40000"/></a:srgbClr></a:outerShdw></a:effectLst>',F=['lang="en-US"',`sz="${p}"`,(a.font?.bold,'b="1"'),a.font?.italic?'i="1"':"",'cap="none" spc="0"'].filter(Boolean).join(" "),y=a.font?.name??"Calibri",v=f!=="textPlain"?`<a:prstTxWarp prst="${f}"><a:avLst/></a:prstTxWarp>`:"";n.push(`<xdr:twoCellAnchor editAs="oneCell">${m}${d}<xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="WordArt ${l}"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr wrap="square" lIns="91440" tIns="45720" rIns="91440" bIns="45720">${v}<a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a:pPr algn="ctr"/><a:r><a:rPr ${F}>${x}${$}${b}<a:latin typeface="${I(y)}"/></a:rPr><a:t>${I(a.text)}</a:t></a:r></a:p></xdr:txBody></xdr:sp><xdr:clientData/></xdr:twoCellAnchor>`)}),this.mathEquations.forEach(a=>{let l=s++,h=a.from,c=`<xdr:from><xdr:col>${h.col}</xdr:col><xdr:colOff>${h.colOff??0}</xdr:colOff><xdr:row>${h.row}</xdr:row><xdr:rowOff>${h.rowOff??0}</xdr:rowOff></xdr:from>`,m=a.width??18e5,d=a.height??5e5,f=`<xdr:ext cx="${m}" cy="${d}"/>`,p=a.fontSize?a.fontSize*100:1100,g=a.fontName??"Cambria Math",u=`<a:rPr lang="en-US" sz="${p}" i="1"><a:latin typeface="${I(g)}" panose="02040503050406030204" pitchFamily="18" charset="0"/></a:rPr>`,$=`<m:ctrlPr>${u}</m:ctrlPr>`,x=w=>{switch(w.type){case"text":return`<m:r>${u}<m:t>${I(w.text??"")}</m:t></m:r>`;case"frac":return`<m:f><m:fPr>${w.hideDegree?'<m:type m:val="noBar"/>':""}${$}</m:fPr><m:num>${(w.base??[]).map(x).join("")}</m:num><m:den>${(w.argument??[]).map(x).join("")}</m:den></m:f>`;case"sup":return`<m:sSup><m:sSupPr>${$}</m:sSupPr><m:e>${(w.base??[]).map(x).join("")}</m:e><m:sup>${(w.argument??[]).map(x).join("")}</m:sup></m:sSup>`;case"sub":return`<m:sSub><m:sSubPr>${$}</m:sSubPr><m:e>${(w.base??[]).map(x).join("")}</m:e><m:sub>${(w.argument??[]).map(x).join("")}</m:sub></m:sSub>`;case"subSup":return`<m:sSubSup><m:sSubSupPr>${$}</m:sSubSupPr><m:e>${(w.base??[]).map(x).join("")}</m:e><m:sub>${(w.subscript??[]).map(x).join("")}</m:sub><m:sup>${(w.superscript??[]).map(x).join("")}</m:sup></m:sSubSup>`;case"nary":{let R=w.operator??"\u2211";return`<m:nary><m:naryPr><m:chr m:val="${I(R)}"/>${$}</m:naryPr><m:sub>${(w.lower??[]).map(x).join("")}</m:sub><m:sup>${(w.upper??[]).map(x).join("")}</m:sup><m:e>${(w.body??[]).map(x).join("")}</m:e></m:nary>`}case"rad":return`<m:rad><m:radPr>${w.hideDegree?'<m:degHide m:val="1"/>':""}${$}</m:radPr><m:deg>${(w.degree??[]).map(x).join("")}</m:deg><m:e>${(w.body??[]).map(x).join("")}</m:e></m:rad>`;case"delim":{let R=w.open??"(",T=w.close??")";return`<m:d><m:dPr>${R!=="("?`<m:begChr m:val="${I(R)}"/>`:""}${T!==")"?`<m:endChr m:val="${I(T)}"/>`:""}${$}</m:dPr><m:e>${(w.body??[]).map(x).join("")}</m:e></m:d>`}case"func":return`<m:func><m:funcPr>${$}</m:funcPr><m:fName>${(w.base??[]).map(x).join("")}</m:fName><m:e>${(w.argument??[]).map(x).join("")}</m:e></m:func>`;case"accent":return`<m:acc><m:accPr>${w.operator?`<m:chr m:val="${I(w.operator)}"/>`:""}${$}</m:accPr><m:e>${(w.body??[]).map(x).join("")}</m:e></m:acc>`;case"bar":return`<m:bar><m:barPr>${$}</m:barPr><m:e>${(w.body??[]).map(x).join("")}</m:e></m:bar>`;case"matrix":return`<m:m><m:mPr>${$}</m:mPr>${(w.rows??[]).map(R=>`<m:mr>${R.map(T=>`<m:e>${x(T)}</m:e>`).join("")}</m:mr>`).join("")}</m:m>`;case"eqArr":return`<m:eqArr><m:eqArrPr>${$}</m:eqArrPr>${(w.rows??[]).map(R=>`<m:e>${R.map(x).join("")}</m:e>`).join("")}</m:eqArr>`;case"limLow":return`<m:limLow><m:limLowPr>${$}</m:limLowPr><m:e>${(w.base??[]).map(x).join("")}</m:e><m:lim>${(w.argument??[]).map(x).join("")}</m:lim></m:limLow>`;case"limUpp":return`<m:limUpp><m:limUppPr>${$}</m:limUppPr><m:e>${(w.base??[]).map(x).join("")}</m:e><m:lim>${(w.argument??[]).map(x).join("")}</m:lim></m:limUpp>`;case"groupChar":return`<m:groupChr><m:groupChrPr>${w.operator?`<m:chr m:val="${I(w.operator)}"/>`:""}${$}</m:groupChrPr><m:e>${(w.body??[]).map(x).join("")}</m:e></m:groupChr>`;default:return`<m:r>${u}<m:t>${I(w.text??"")}</m:t></m:r>`}},F=`<m:oMathPara xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math"><m:oMathParaPr><m:jc m:val="centerGroup"/></m:oMathParaPr><m:oMath xmlns:m="http://schemas.openxmlformats.org/officeDocument/2006/math">${a.elements.map(x).join("")}</m:oMath></m:oMathPara>`,y=w=>{if(w.text)return w.text;let R=[w.base,w.argument,w.body,w.lower,w.upper,w.superscript,w.subscript,w.degree].filter(Boolean).map(T=>T.map(y).join("")).join("");return w.type==="frac"?`(${(w.base??[]).map(y).join("")})/(${(w.argument??[]).map(y).join("")})`:w.type==="sup"?`${(w.base??[]).map(y).join("")}^${(w.argument??[]).map(y).join("")}`:w.type==="nary"?`${w.operator??"\u2211"}(${(w.body??[]).map(y).join("")})`:w.type==="delim"?`${w.open??"("}${(w.body??[]).map(y).join("")}${w.close??")"}`:w.type==="rad"?`\u221A(${(w.body??[]).map(y).join("")})`:R},v=a.elements.map(y).join("");n.push(`<xdr:oneCellAnchor>${c}${f}<mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:a14="http://schemas.microsoft.com/office/drawing/2010/main" Requires="a14"><xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="MathEq ${l}"/><xdr:cNvSpPr txBox="1"/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${m}" cy="${d}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" rtlCol="0" anchor="t"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a14:m>${F}</a14:m><a:endParaRPr lang="en-US" sz="${p}"/></a:p></xdr:txBody></xdr:sp></mc:Choice><mc:Fallback><xdr:sp macro="" textlink=""><xdr:nvSpPr><xdr:cNvPr id="${l}" name="MathEq ${l}"/><xdr:cNvSpPr txBox="1"/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="${m}" cy="${d}"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom><a:noFill/></xdr:spPr><xdr:txBody><a:bodyPr vertOverflow="clip" horzOverflow="clip" wrap="none" lIns="0" tIns="0" rIns="0" bIns="0" rtlCol="0" anchor="t"><a:spAutoFit/></a:bodyPr><a:lstStyle/><a:p><a:r><a:rPr lang="en-US" sz="${p}" i="0"><a:latin typeface="${I(g)}" panose="02040503050406030204" pitchFamily="18" charset="0"/></a:rPr><a:t>${I(v)}</a:t></a:r><a:endParaRPr lang="en-US" sz="${p}"/></a:p></xdr:txBody></xdr:sp></mc:Fallback></mc:AlternateContent><xdr:clientData/></xdr:oneCellAnchor>`)}),this.oleObjects.forEach((a,l)=>{let h=s++,c=a.from,m=a.to,d=`<xdr:from><xdr:col>${c.col}</xdr:col><xdr:colOff>${c.colOff??0}</xdr:colOff><xdr:row>${c.row}</xdr:row><xdr:rowOff>${c.rowOff??0}</xdr:rowOff></xdr:from>`,f=`<xdr:to><xdr:col>${m.col}</xdr:col><xdr:colOff>${m.colOff??0}</xdr:colOff><xdr:row>${m.row}</xdr:row><xdr:rowOff>${m.rowOff??0}</xdr:rowOff></xdr:to>`,p=this.oleRIds[l]??"",g=this.oleIconRIds[l]??"",u=a.progId??"Package",$=a.displayAsIcon?' showAsIcon="1"':"",x=a.linkToFile&&a.linkPath?` link="${I(a.linkPath)}"`:"",b=g?`<a:blip r:embed="${g}"/><a:stretch><a:fillRect/></a:stretch>`:"<a:blip/><a:stretch><a:fillRect/></a:stretch>";n.push(`<xdr:twoCellAnchor editAs="oneCell">${d}${f}<xdr:sp macro=""><xdr:nvSpPr><xdr:cNvPr id="${h}" name="${I(a.name)}" hidden="1"/><xdr:cNvSpPr/></xdr:nvSpPr><xdr:spPr><a:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></a:xfrm><a:prstGeom prst="rect"><a:avLst/></a:prstGeom></xdr:spPr></xdr:sp><xdr:clientData/></xdr:twoCellAnchor>`)});for(let a of this._slicerDrawingInfo){let l=s++,{row:h,col:c}=a.cell?Gt(a.cell):{row:1,col:6},m=c-1,d=h-1,f=m+2,p=d+12;n.push(`<xdr:twoCellAnchor editAs="oneCell"><xdr:from><xdr:col>${m}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${d}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:from><xdr:to><xdr:col>${f}</xdr:col><xdr:colOff>0</xdr:colOff><xdr:row>${p}</xdr:row><xdr:rowOff>0</xdr:rowOff></xdr:to><mc:AlternateContent xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006"><mc:Choice xmlns:sle15="http://schemas.microsoft.com/office/drawing/2012/slicer" Requires="sle15"><xdr:graphicFrame macro=""><xdr:nvGraphicFramePr><xdr:cNvPr id="${l}" name="${I(a.name)}"/><xdr:cNvGraphicFramePr/></xdr:nvGraphicFramePr><xdr:xfrm><a:off x="0" y="0"/><a:ext cx="0" cy="0"/></xdr:xfrm><a:graphic><a:graphicData uri="http://schemas.microsoft.com/office/drawing/2010/slicer"><sle:slicer xmlns:sle="http://schemas.microsoft.com/office/drawing/2010/slicer" name="${I(a.name)}"/></a:graphicData></a:graphic></xdr:graphicFrame></mc:Choice><mc:Fallback/></mc:AlternateContent><xdr:clientData/></xdr:twoCellAnchor>`)}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
44
71
|
<xdr:wsDr xmlns:xdr="http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing"
|
|
72
|
+
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
45
73
|
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
46
|
-
${
|
|
74
|
+
${n.join(`
|
|
47
75
|
`)}
|
|
48
|
-
</xdr:wsDr>`}};function
|
|
76
|
+
</xdr:wsDr>`}};function Nr(e){let t=0;for(let o=e.length-1;o>=0;o--)t=t>>14&1|t<<1&32767,t^=e.charCodeAt(o);return t=t>>14&1|t<<1&32767,t^=e.length,t^=52811,t.toString(16).toUpperCase().padStart(4,"0")}function to(e,t){if(!t)return"";if(t.startsWith("theme:"))return`<${e} theme="${t.slice(6)}"/>`;let o=t.startsWith("#")?"FF"+t.slice(1):t;return`<${e} rgb="${o}"/>`}function No(e){let t=[];return e.bold&&t.push("<b/>"),e.italic&&t.push("<i/>"),e.strike&&t.push("<strike/>"),e.underline&&e.underline!=="none"&&t.push(`<u val="${e.underline}"/>`),e.vertAlign&&t.push(`<vertAlign val="${e.vertAlign}"/>`),e.size&&t.push(`<sz val="${e.size}"/>`),e.color&&t.push(to("color",e.color)),e.name&&t.push(`<name val="${I(e.name)}"/>`),e.family&&t.push(`<family val="${e.family}"/>`),e.scheme&&t.push(`<scheme val="${e.scheme}"/>`),e.charset&&t.push(`<charset val="${e.charset}"/>`),t.join("")}function uo(e){if(e.type==="pattern"){let r=e,s=to("fgColor",r.fgColor),i=to("bgColor",r.bgColor);return`<patternFill patternType="${r.pattern}">${s}${i}</patternFill>`}let t=e,o=t.stops.map(r=>`<stop position="${r.position}">${to("color",r.color)}</stop>`).join("");return`<gradientFill ${[t.gradientType?`type="${t.gradientType}"`:"",t.degree!==void 0?`degree="${t.degree}"`:"",t.left!==void 0?`left="${t.left}"`:"",t.right!==void 0?`right="${t.right}"`:"",t.top!==void 0?`top="${t.top}"`:"",t.bottom!==void 0?`bottom="${t.bottom}"`:""].filter(Boolean).join(" ")}>${o}</gradientFill>`}function Je(e,t){if(!t)return`<${e}/>`;let o=to("color",t.color);return t.style?`<${e} style="${t.style}">${o}</${e}>`:`<${e}/>`}function Xo(e){let t=[e.diagonalUp?'diagonalUp="1"':"",e.diagonalDown?'diagonalDown="1"':""].filter(Boolean).join(" ");return`<border${t?" "+t:""}>`+Je("left",e.left)+Je("right",e.right)+Je("top",e.top)+Je("bottom",e.bottom)+Je("diagonal",e.diagonal)+"</border>"}function $n(e){return`<alignment ${[e.horizontal?`horizontal="${e.horizontal}"`:"",e.vertical?`vertical="${e.vertical}"`:"",e.wrapText?'wrapText="1"':"",e.shrinkToFit?'shrinkToFit="1"':"",e.textRotation!==void 0?`textRotation="${e.textRotation}"`:"",e.indent?`indent="${e.indent}"`:"",e.readingOrder!==void 0?`readingOrder="${e.readingOrder}"`:""].filter(Boolean).join(" ")}/>`}var Oe=class{constructor(){this.fonts=[],this.fills=[],this.borders=[],this.fontIdx=new Map,this.fillIdx=new Map,this.borderIdx=new Map,this.numFmts=new Map,this.xfs=[],this.styleKey=new Map,this.dxfs=[],this.nextNumFmtId=164,this.cellStyleXfs=[],this.cellStyleNames=[],this.tableStyleDefs=[];let t=No({name:"Calibri",size:11,scheme:"minor"});this.fonts.push(t),this.fontIdx.set(t,0);let o=uo({type:"pattern",pattern:"none"}),n=uo({type:"pattern",pattern:"gray125"});this.fills.push(o,n),this.fillIdx.set(o,0),this.fillIdx.set(n,1);let r=Xo({});this.borders.push(r),this.borderIdx.set(r,0),this.cellStyleXfs.push('<xf numFmtId="0" fontId="0" fillId="0" borderId="0"/>'),this.cellStyleNames.push({name:"Normal",xfId:0,builtinId:0}),this.xfs.push('<xf numFmtId="0" fontId="0" fillId="0" borderId="0" xfId="0"/>')}registerNamedStyle(t,o,n){let r=this.internFont(o.font),s=this.internFill(o.fill),i=this.internBorder(o.border),a=this.internNumFmt(o.numberFormat,o.numFmtId),l=o.font?' applyFont="1"':"",h=o.fill?' applyFill="1"':"",c=o.border?' applyBorder="1"':"",m=o.alignment?' applyAlignment="1"':"",d=o.numberFormat||o.numFmtId!==void 0?' applyNumberFormat="1"':"",f=o.alignment?$n(o.alignment):"",p=`<xf numFmtId="${a}" fontId="${r}" fillId="${s}" borderId="${i}"${l}${h}${c}${m}${d}>${f}</xf>`;this.cellStyleXfs.push(p);let g=this.cellStyleXfs.length-1;return this.cellStyleNames.push({name:t,xfId:g,builtinId:n}),g}internFont(t){if(!t)return 0;let o=No(t),n=this.fontIdx.get(o);if(n!==void 0)return n;let r=this.fonts.length;return this.fonts.push(o),this.fontIdx.set(o,r),r}internFill(t){if(!t)return 0;let o=uo(t),n=this.fillIdx.get(o);if(n!==void 0)return n;let r=this.fills.length;return this.fills.push(o),this.fillIdx.set(o,r),r}internBorder(t){if(!t)return 0;let o=Xo(t),n=this.borderIdx.get(o);if(n!==void 0)return n;let r=this.borders.length;return this.borders.push(o),this.borderIdx.set(o,r),r}internNumFmt(t,o){if(o!==void 0)return o;if(!t)return 0;if(this.numFmts.has(t.formatCode))return this.numFmts.get(t.formatCode);let n=this.nextNumFmtId++;return this.numFmts.set(t.formatCode,n),n}register(t){if(!t)return 0;let o=JSON.stringify(t);if(this.styleKey.has(o))return this.styleKey.get(o);let n=this.internFont(t.font),r=this.internFill(t.fill),s=this.internBorder(t.border),i=this.internNumFmt(t.numberFormat,t.numFmtId),a=t.font?' applyFont="1"':"",l=t.fill?' applyFill="1"':"",h=t.border?' applyBorder="1"':"",c=t.alignment?' applyAlignment="1"':"",m=t.numberFormat||t.numFmtId!==void 0?' applyNumberFormat="1"':"",d=t.locked!==void 0||t.hidden!==void 0?' applyProtection="1"':"",f=t.alignment?$n(t.alignment):"",p=t.locked!==void 0||t.hidden!==void 0?`<protection${t.locked!==void 0?` locked="${t.locked?"1":"0"}"`:""}${t.hidden!==void 0?` hidden="${t.hidden?"1":"0"}"`:""}/>`:"",g=t.namedStyleId??0,u=`<xf numFmtId="${i}" fontId="${n}" fillId="${r}" borderId="${s}" xfId="${g}"${a}${l}${h}${c}${m}${d}>${f}${p}</xf>`;this.xfs.push(u);let $=this.xfs.length-1;return this.styleKey.set(o,$),$}registerDxf(t){let o=[];if(t.font&&o.push(`<font>${No(t.font)}</font>`),t.numberFormat){let r=this.internNumFmt(t.numberFormat);o.push(`<numFmt numFmtId="${r}" formatCode="${I(t.numberFormat.formatCode)}"/>`)}t.fill&&o.push(`<fill>${uo(t.fill)}</fill>`),t.alignment&&o.push(`<alignment${t.alignment.horizontal?` horizontal="${t.alignment.horizontal}"`:""}${t.alignment.vertical?` vertical="${t.alignment.vertical}"`:""}${t.alignment.wrapText?' wrapText="1"':""}${t.alignment.textRotation?` textRotation="${t.alignment.textRotation}"`:""}/>`),t.border&&o.push(Xo(t.border));let n=o.join("");return this.dxfs.push(n),this.dxfs.length-1}prependRawDxfs(t){this.dxfs.unshift(...t)}registerTableStyle(t,o){let n=[];o.headerRow&&n.push({type:"headerRow",dxfId:this.registerDxf(o.headerRow)}),o.totalRow&&n.push({type:"totalRow",dxfId:this.registerDxf(o.totalRow)}),o.dataRow1&&n.push({type:"firstRowStripe",dxfId:this.registerDxf(o.dataRow1)}),o.dataRow2&&n.push({type:"secondRowStripe",dxfId:this.registerDxf(o.dataRow2)}),this.tableStyleDefs.push({name:t,elements:n})}toXml(){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
49
77
|
<styleSheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
50
|
-
${this.numFmts.size?`<numFmts count="${this.numFmts.size}">${[...this.numFmts.entries()].map(([
|
|
51
|
-
<fonts count="${this.fonts.length}">${this.fonts.map(
|
|
52
|
-
<fills count="${this.fills.length}">${this.fills.map(
|
|
78
|
+
${this.numFmts.size?`<numFmts count="${this.numFmts.size}">${[...this.numFmts.entries()].map(([o,n])=>`<numFmt numFmtId="${n}" formatCode="${I(o)}"/>`).join("")}</numFmts>`:""}
|
|
79
|
+
<fonts count="${this.fonts.length}">${this.fonts.map(o=>`<font>${o}</font>`).join("")}</fonts>
|
|
80
|
+
<fills count="${this.fills.length}">${this.fills.map(o=>`<fill>${o}</fill>`).join("")}</fills>
|
|
53
81
|
<borders count="${this.borders.length}">${this.borders.join("")}</borders>
|
|
54
|
-
<cellStyleXfs count="
|
|
82
|
+
<cellStyleXfs count="${this.cellStyleXfs.length}">${this.cellStyleXfs.join("")}</cellStyleXfs>
|
|
55
83
|
<cellXfs count="${this.xfs.length}">${this.xfs.join("")}</cellXfs>
|
|
56
|
-
<cellStyles count="
|
|
57
|
-
${this.dxfs.length?`<dxfs count="${this.dxfs.length}">${this.dxfs.map(
|
|
58
|
-
|
|
59
|
-
|
|
84
|
+
<cellStyles count="${this.cellStyleNames.length}">${this.cellStyleNames.map(o=>`<cellStyle name="${I(o.name)}" xfId="${o.xfId}"${o.builtinId!==void 0?` builtinId="${o.builtinId}"`:""}/>`).join("")}</cellStyles>
|
|
85
|
+
${this.dxfs.length?`<dxfs count="${this.dxfs.length}">${this.dxfs.map(o=>`<dxf>${o}</dxf>`).join("")}</dxfs>`:""}
|
|
86
|
+
${this.tableStyleDefs.length?`<tableStyles count="${this.tableStyleDefs.length}">${this.tableStyleDefs.map(o=>`<tableStyle name="${I(o.name)}" count="${o.elements.length}">${o.elements.map(n=>`<tableStyleElement type="${n.type}" dxfId="${n.dxfId}"/>`).join("")}</tableStyle>`).join("")}</tableStyles>`:""}
|
|
87
|
+
</styleSheet>`}};var Le=class{constructor(){this.table=new Map,this.strings=[],this._count=0}get count(){return this._count}get uniqueCount(){return this.strings.length}intern(t){this._count++;let o=this.table.get(t);if(o!==void 0)return o;let n=this.strings.length;return this.strings.push(t),this.table.set(t,n),n}internRichText(t){let o=JSON.stringify(t);this._count++;let n=this.table.get(o);if(n!==void 0)return n;let r=t.map(i=>`<r>${i.font?Xr(i.font):""}<t xml:space="preserve">${I(i.text)}</t></r>`).join(""),s=this.strings.length;return this.strings.push("\0RICH\0"+r),this.table.set(o,s),s}toXml(){let t=this.strings.map(o=>o.startsWith("\0RICH\0")?`<si>${o.slice(6)}</si>`:`<si><t${o!==o.trim()||o.includes(`
|
|
88
|
+
`)?' xml:space="preserve"':""}>${I(o)}</t></si>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
60
89
|
<sst xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" count="${this._count}" uniqueCount="${this.strings.length}">
|
|
61
90
|
${t}
|
|
62
|
-
</sst>`}};function
|
|
63
|
-
<c:axId val="${
|
|
64
|
-
<c:scaling><c:orientation val="minMax"/>${
|
|
91
|
+
</sst>`}};function Xr(e){let t=[];return e.bold&&t.push("<b/>"),e.italic&&t.push("<i/>"),e.strike&&t.push("<strike/>"),e.underline&&e.underline!=="none"&&t.push(`<u val="${e.underline}"/>`),e.size&&t.push(`<sz val="${e.size}"/>`),e.color&&(e.color.startsWith("theme:")?t.push(`<color theme="${e.color.slice(6)}"/>`):t.push(`<color rgb="${e.color.startsWith("#")?"FF"+e.color.slice(1):e.color}"/>`)),e.name&&t.push(`<name val="${I(e.name)}"/>`),t.length?`<rPr>${t.join("")}</rPr>`:""}var yn=["FF4472C4","FFED7D31","FFA5A5A5","FFFFC000","FF5B9BD5","FF70AD47","FF264478","FF9E480E","FF636363","FF997300"],Ur={office:["4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47","264478","9E480E","636363","997300"],blue:["5B9BD5","8FAADC","B4C7E7","D6DCE4","4472C4","2F5597","1F4E79","002060","00B0F0","0070C0"],orange:["ED7D31","F4B183","F8CBAD","FCE4D6","C55A11","843C0C","BF8F00","806000","FFD966","FFC000"],green:["70AD47","A9D18E","C5E0B4","E2F0D9","548235","375623","92D050","00B050","00B0F0","00FF00"],red:["FF0000","FF6161","FF9F9F","FFD2D2","C00000","8B0000","FFC000","FF6600","FF3300","CC0000"],purple:["7030A0","9B59B6","BB8FCE","D7BDE2","5B2C6F","4A235A","8E44AD","6C3483","A569BD","D2B4DE"],teal:["00B0F0","00BCD4","26C6DA","80DEEA","0097A7","006064","009688","00796B","4DB6AC","80CBC4"],gray:["595959","808080","A6A6A6","D9D9D9","404040","262626","BFBFBF","F2F2F2","7F7F7F","C0C0C0"],gold:["FFC000","FFD966","FFE699","FFF2CC","BF8F00","806000","ED7D31","F4B183","DBA13A","C09100"],blueWarm:["4472C4","5B9BD5","9DC3E6","BDD7EE","DEEBF7","2E75B6","1F4E79","2F5597","8FAADC","D6DCE4"],blueGreen:["00B0F0","00B050","70AD47","5B9BD5","4472C4","2E75B6","548235","00B0F0","009688","00796B"],greenYellow:["70AD47","92D050","C9E265","FFD966","FFC000","548235","BF8F00","A9D18E","E2F0D9","C5E0B4"],redOrange:["FF0000","ED7D31","FFC000","FF6600","C00000","843C0C","BF8F00","FF3300","F4B183","FFD966"],redViolet:["FF0000","7030A0","ED7D31","C00000","5B2C6F","843C0C","FF6161","9B59B6","F4B183","BB8FCE"],yellowOrange:["FFC000","ED7D31","FFD966","F4B183","BF8F00","C55A11","FFE699","F8CBAD","806000","843C0C"],slipstream:["4472C4","ED7D31","A5A5A5","FFC000","5B9BD5","70AD47","255E91","9E480E","636363","997300"],marquee:["ED7D31","4472C4","70AD47","FFC000","5B9BD5","A5A5A5","264478","9E480E","636363","997300"],aspect:["5B9BD5","4472C4","ED7D31","FFC000","70AD47","A5A5A5","9E480E","264478","636363","997300"]},Vr={colorful1:102,colorful2:103,colorful3:104,colorful4:105,monochromatic1:201,monochromatic2:202,monochromatic3:203,monochromatic4:204,monochromatic5:205,monochromatic6:206,monochromatic7:207,monochromatic8:208,monochromatic9:209,monochromatic10:210,monochromatic11:211,monochromatic12:212};function Wr(e,t){let o=' xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"',n=e.replace(/^FF/,""),r;t?.fillType==="gradient"&&t.gradientStops?.length?r=`<a:gradFill><a:gsLst>${t.gradientStops.map(l=>`<a:gs pos="${l.pos*1e3}"><a:srgbClr val="${l.color.replace(/^FF/,"").replace(/^#/,"")}"/></a:gs>`).join("")}</a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill>`:r=`<a:solidFill><a:srgbClr val="${n}"/></a:solidFill>`;let s=t?.lineWidth?` w="${Math.round(t.lineWidth*12700)}"`:"",i=s?`<a:ln${s}><a:solidFill><a:srgbClr val="${n}"/></a:solidFill></a:ln>`:"";return`<c:spPr${o}>${r}${i}</c:spPr>`}function wn(e){return e?`<c:dLbls>${[e.numFmt?`<c:numFmt formatCode="${I(e.numFmt)}" sourceLinked="0"/>`:"",e.position?`<c:dLblPos val="${e.position}"/>`:"",'<c:showLegendKey val="0"/>',`<c:showVal val="${e.showValue?"1":"0"}"/>`,`<c:showCatName val="${e.showCategory?"1":"0"}"/>`,`<c:showSerName val="${e.showSeriesName?"1":"0"}"/>`,`<c:showPercent val="${e.showPercent?"1":"0"}"/>`].join("")}</c:dLbls>`:""}function Te(e,t,o,n){return t.map((r,s)=>{let i=r.color?r.color.startsWith("#")?"FF"+r.color.slice(1):r.color:n?"FF"+n[s%n.length]:yn[s%yn.length],a=r.categories?`<c:cat><c:strRef><c:f>${I(r.categories)}</c:f></c:strRef></c:cat>`:"",l=`<c:val><c:numRef><c:f>${I(r.values)}</c:f></c:numRef></c:val>`,h=r.name?`<c:tx><c:strRef><c:f>"${I(r.name)}"</c:f></c:strRef></c:tx>`:"",c=e.startsWith("line")||e==="scatter"?'<c:marker><c:symbol val="none"/></c:marker>':"",m=wn(r.dataLabels);return`<c:ser><c:idx val="${s}"/><c:order val="${s}"/>${h}${Wr(i,r)}${c}${m}${a}${l}</c:ser>`}).join("")}function Hr(e,t,o,n=!1){if(n)return`<c:valAx><c:axId val="${e}"/><c:scaling><c:orientation val="minMax"/></c:scaling><c:delete val="1"/><c:axPos val="b"/><c:crossAx val="${t}"/></c:valAx>`;let r=o?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${I(o.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",s=[o?.min!==void 0?`<c:min val="${o.min}"/>`:"",o?.max!==void 0?`<c:max val="${o.max}"/>`:""].join(""),i=o?.numFmt?`<c:numFmt formatCode="${I(o.numFmt)}" sourceLinked="0"/>`:"",a=o?.gridLines!==!1?"<c:majorGridlines/>":"";return`<c:valAx>
|
|
92
|
+
<c:axId val="${e}"/>
|
|
93
|
+
<c:scaling><c:orientation val="minMax"/>${s}</c:scaling>
|
|
65
94
|
<c:delete val="0"/>
|
|
66
95
|
<c:axPos val="l"/>
|
|
67
|
-
${
|
|
96
|
+
${a}${r}${i}
|
|
68
97
|
<c:crossAx val="${t}"/>
|
|
69
|
-
</c:valAx>`}function
|
|
70
|
-
<c:axId val="${
|
|
98
|
+
</c:valAx>`}function zr(e,t,o){let n=o?.title?`<c:title><c:tx><c:rich><a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/><a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"><a:r><a:t>${I(o.title)}</a:t></a:r></a:p></c:rich></c:tx><c:overlay val="0"/></c:title>`:"",r=o?.gridLines?"<c:majorGridlines/>":"";return`<c:catAx>
|
|
99
|
+
<c:axId val="${e}"/>
|
|
71
100
|
<c:scaling><c:orientation val="minMax"/></c:scaling>
|
|
72
101
|
<c:delete val="0"/>
|
|
73
102
|
<c:axPos val="b"/>
|
|
74
|
-
${
|
|
103
|
+
${r}${n}
|
|
75
104
|
<c:crossAx val="${t}"/>
|
|
76
|
-
</c:catAx>`}function
|
|
105
|
+
</c:catAx>`}function Gr(e){if(e===!1)return"";let t=typeof e=="string"?e:"b";return`<c:legend><c:legendPos val="${{bottom:"b",top:"t",left:"l",right:"r",corner:"tr"}[t]??t}"/></c:legend>`}function bn(e){let t=e.type,o=e.series,n=e.colorPalette?Ur[e.colorPalette]:void 0,r=e.title?`<c:title><c:tx><c:rich>
|
|
77
106
|
<a:bodyPr xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"/>
|
|
78
107
|
<a:p xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main">
|
|
79
|
-
<a:r><a:t>${
|
|
108
|
+
<a:r><a:t>${I(e.title)}</a:t></a:r>
|
|
80
109
|
</a:p>
|
|
81
|
-
</c:rich></c:tx><c:overlay val="0"/></c:title>`:"",
|
|
110
|
+
</c:rich></c:tx><c:overlay val="0"/></c:title>`:"",s=e.varyColors?'<c:varyColors val="1"/>':"",i=wn(e.dataLabels),a="",l=t==="pie"||t==="doughnut",h=t.startsWith("bar")||t.startsWith("column"),c=t.startsWith("line"),m=t.startsWith("scatter")||t==="bubble",d=t.startsWith("area"),f=t.startsWith("radar"),p=t==="stock",g=e.grouping??(t.endsWith("Stacked100")?"percentStacked":t.endsWith("Stacked")?"stacked":h?"clustered":c||d?"standard":void 0);if(l){let w=t==="doughnut"?"doughnutChart":"pieChart",R=t==="doughnut"?'<c:holeSize val="50"/>':"";a=`<c:${w}>${s}${Te(t,o,0,n)}${i}${R}</c:${w}>`}else h?a=`<c:barChart>
|
|
82
111
|
<c:barDir val="${t.startsWith("bar")?"bar":"col"}"/>
|
|
83
|
-
${
|
|
84
|
-
${
|
|
85
|
-
${
|
|
112
|
+
${g?`<c:grouping val="${g}"/>`:""}
|
|
113
|
+
${s}
|
|
114
|
+
${Te(t,o,0,n)}
|
|
115
|
+
${i}
|
|
86
116
|
<c:axId val="1"/><c:axId val="2"/>
|
|
87
|
-
</c:barChart>`:c?
|
|
88
|
-
${
|
|
89
|
-
${
|
|
90
|
-
${
|
|
117
|
+
</c:barChart>`:c?a=`<c:lineChart>
|
|
118
|
+
${g?`<c:grouping val="${g}"/>`:""}
|
|
119
|
+
${s}
|
|
120
|
+
${Te(t,o,0,n)}
|
|
121
|
+
${i}
|
|
91
122
|
<c:axId val="1"/><c:axId val="2"/>
|
|
92
|
-
</c:lineChart>`:a
|
|
123
|
+
</c:lineChart>`:m?a=`<c:scatterChart>
|
|
93
124
|
<c:scatterStyle val="${t==="scatterSmooth"?"smoothMarker":"marker"}"/>
|
|
94
|
-
${
|
|
95
|
-
${
|
|
125
|
+
${s}
|
|
126
|
+
${Te(t,o,0,n)}
|
|
127
|
+
${i}
|
|
96
128
|
<c:axId val="1"/><c:axId val="2"/>
|
|
97
|
-
</c:scatterChart>`:d?
|
|
98
|
-
${
|
|
99
|
-
${
|
|
100
|
-
${
|
|
129
|
+
</c:scatterChart>`:d?a=`<c:areaChart>
|
|
130
|
+
${g?`<c:grouping val="${g}"/>`:""}
|
|
131
|
+
${s}
|
|
132
|
+
${Te(t,o,0,n)}
|
|
133
|
+
${i}
|
|
101
134
|
<c:axId val="1"/><c:axId val="2"/>
|
|
102
|
-
</c:areaChart>`:
|
|
135
|
+
</c:areaChart>`:f?a=`<c:radarChart>
|
|
103
136
|
<c:radarStyle val="${t==="radarFilled"?"filled":"marker"}"/>
|
|
104
|
-
${
|
|
105
|
-
${
|
|
137
|
+
${s}
|
|
138
|
+
${Te(t,o,0,n)}
|
|
139
|
+
${i}
|
|
106
140
|
<c:axId val="1"/><c:axId val="2"/>
|
|
107
|
-
</c:radarChart>`:
|
|
141
|
+
</c:radarChart>`:a=`<c:barChart>
|
|
108
142
|
<c:barDir val="col"/>
|
|
109
143
|
<c:grouping val="clustered"/>
|
|
110
|
-
${
|
|
111
|
-
${
|
|
144
|
+
${s}
|
|
145
|
+
${Te(t,o,0,n)}
|
|
146
|
+
${i}
|
|
112
147
|
<c:axId val="1"/><c:axId val="2"/>
|
|
113
|
-
</c:barChart>`;let $=!
|
|
148
|
+
</c:barChart>`;let $=!l?zr(1,2,e.xAxis)+Hr(2,1,e.yAxis):"",x=Gr(e.legend??"b"),b=e.modernStyle?Math.min(Vr[e.modernStyle],48):e.style,F=b?`<c:style val="${b}"/>`:"",y="";if(e.chartFill||e.shadow){let w=e.chartFill==="gradient"?'<a:gradFill><a:gsLst><a:gs pos="0"><a:schemeClr val="lt1"/></a:gs><a:gs pos="100000"><a:schemeClr val="bg1"><a:lumMod val="85000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill>':e.chartFill==="white"?'<a:solidFill><a:srgbClr val="FFFFFF"/></a:solidFill>':e.chartFill==="none"?"<a:noFill/>":"",R=e.shadow?'<a:effectLst><a:outerShdw blurRad="50800" dist="38100" dir="5400000" algn="t" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="40000"/></a:srgbClr></a:outerShdw></a:effectLst>':"";y=`<c:spPr>${w}${R}</c:spPr>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
114
149
|
<c:chartSpace xmlns:c="http://schemas.openxmlformats.org/drawingml/2006/chart"
|
|
115
150
|
xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main"
|
|
116
151
|
xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
117
|
-
${
|
|
152
|
+
${e.roundedCorners?'<c:roundedCorners val="1"/>':""}
|
|
153
|
+
${F}
|
|
118
154
|
<c:chart>
|
|
119
155
|
${r}
|
|
120
|
-
<c:autoTitleDeleted val="${
|
|
156
|
+
<c:autoTitleDeleted val="${e.title?"0":"1"}"/>
|
|
121
157
|
<c:plotArea>
|
|
122
|
-
${
|
|
158
|
+
${a}
|
|
123
159
|
${$}
|
|
124
160
|
</c:plotArea>
|
|
125
161
|
${x}
|
|
126
162
|
<c:plotVisOnly val="1"/>
|
|
127
163
|
</c:chart>
|
|
128
|
-
|
|
164
|
+
${y}
|
|
165
|
+
</c:chartSpace>`}function qr(e){return{type:e.type,style:e.style,modernStyle:e.modernStyle,colorPalette:e.colorPalette,legend:e.legend,xAxis:e.xAxis,yAxis:e.yAxis,dataLabels:e.dataLabels,chartFill:e.chartFill,roundedCorners:e.roundedCorners,shadow:e.shadow,varyColors:e.varyColors,grouping:e.grouping}}function Kr(e,t){return{type:t.type??e.type,title:t.title,series:t.series,from:t.from,to:t.to,xAxis:t.xAxis??e.xAxis,yAxis:t.yAxis??e.yAxis,legend:t.legend??e.legend,style:t.style??e.style,modernStyle:t.modernStyle??e.modernStyle,colorPalette:t.colorPalette??e.colorPalette,dataLabels:t.dataLabels??e.dataLabels,chartFill:t.chartFill??e.chartFill,roundedCorners:t.roundedCorners??e.roundedCorners,shadow:t.shadow??e.shadow,varyColors:t.varyColors??e.varyColors,grouping:t.grouping??e.grouping}}function Zr(e){return JSON.stringify(e)}function Yr(e){return JSON.parse(e)}function Uo(e,t){let{startRow:o,startCol:n,endRow:r,endCol:s}=Jt(e.ref),i=e.displayName??e.name,a=e.columns.map((f,p)=>{let g=n+p,u=p+1,$=f.totalsRowFunction??"none",x=e.totalsRow?` totalsRowFunction="${$}"${$!=="none"&&f.totalsRowFormula?` totalsRowFormula="${I(f.totalsRowFormula)}"`:""}`:"",b=e.totalsRow&&f.totalsRowLabel?` totalsRowLabel="${I(f.totalsRowLabel)}"`:"";return`<tableColumn id="${u}" name="${I(f.name)}"${x}${b}/>`}).join(""),l=[`name="${I(e.style??"TableStyleMedium2")}"`,e.showFirstColumn?'showFirstColumn="1"':"",e.showLastColumn?'showLastColumn="1"':"",e.showRowStripes!==!1?'showRowStripes="1"':"",e.showColumnStripes?'showColumnStripes="1"':""].filter(Boolean).join(" "),h=e.totalsRow?1:0,c=Ut(n),m=Ut(s),d=`${c}${o}:${m}${r-h}`;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
129
166
|
<table xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"
|
|
130
|
-
id="${t}" name="${
|
|
131
|
-
ref="${
|
|
132
|
-
<autoFilter ref="${
|
|
133
|
-
<tableColumns count="${
|
|
134
|
-
<tableStyleInfo ${
|
|
135
|
-
</table>`}var it=null;function pe(){if(it)return it;it=new Uint32Array(256);for(let s=0;s<256;s++){let t=s;for(let e=0;e<8;e++)t=t&1?3988292384^t>>>1:t>>>1;it[s]=t}return it}function fe(s){let t=pe(),e=4294967295;for(let r=0;r<s.length;r++)e=e>>>8^t[(e^s[r])&255];return(e^4294967295)>>>0}var dt=class{constructor(){this.buf=[],this.bits=0,this.bitLen=0}writeBits(t,e){for(this.bits|=(t&(1<<e)-1)<<this.bitLen,this.bitLen+=e;this.bitLen>=8;)this.buf.push(this.bits&255),this.bits>>>=8,this.bitLen-=8}flush(){this.bitLen>0&&(this.buf.push(this.bits&255),this.bits=0,this.bitLen=0)}toBytes(){return new Uint8Array(this.buf)}};function yt(s,t){let e=s.length,r=new Uint8Array(e),o=[];for(let a=0;a<e;a++)s[a]>0&&o.push(a);if(o.length===0)return r;if(o.length===1)return r[o[0]]=1,r;let n=o.map(a=>({freq:s[a],sym:a}));(()=>{for(n.sort((a,d)=>a.freq-d.freq);n.length>1;){let a=n.shift(),d=n.shift(),m={freq:a.freq+d.freq,sym:-1,left:a,right:d},p=0;for(;p<n.length&&n[p].freq<=m.freq;)p++;n.splice(p,0,m)}})();let l=(a,d)=>{if(a){if(a.sym>=0){r[a.sym]=Math.min(d,t);return}l(a.left,d+1),l(a.right,d+1)}};l(n[0],0);let c=0;for(let a=0;a<e;a++)r[a]>t&&(c+=(1<<r[a]-t)-1,r[a]=t);if(c>0)for(let a=t-1;a>=1&&c>0;a--)for(let d=0;d<e&&c>0;d++)r[d]===a&&(r[d]++,c--);return r}function at(s){let t=Math.max(...s),e=new Uint32Array(t+1);for(let i of s)i>0&&e[i]++;let r=new Uint32Array(t+1),o=0;for(let i=1;i<=t;i++)o=o+e[i-1]<<1,r[i]=o;let n=new Uint32Array(s.length);for(let i=0;i<s.length;i++)s[i]>0&&(n[i]=r[s[i]]++);return n}function G(s,t){let e=0;for(let r=0;r<t;r++)e=e<<1|s&1,s>>=1;return e}function ue(){let s=new Uint8Array(288);for(let t=0;t<=143;t++)s[t]=8;for(let t=144;t<=255;t++)s[t]=9;for(let t=256;t<=279;t++)s[t]=7;for(let t=280;t<=287;t++)s[t]=8;return s}function ge(){let s=new Uint8Array(32);return s.fill(5),s}var Et=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],bt=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],Wt=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ft=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577];function Ut(s){for(let t=0;t<29;t++)if(s<=bt[t]+(1<<Et[t])-1&&s>=bt[t])return[257+t,Et[t],s-bt[t]];return[285,0,0]}function zt(s){for(let t=0;t<30;t++){let e=Ft[t]+(1<<Wt[t])-1;if(s>=Ft[t]&&s<=e)return[t,Wt[t],s-Ft[t]]}return[29,13,0]}var V=32768,vt=258,Ht=3,xe=8,$e=32,we=128;function ye(s,t){let e=t<=1?xe:t<=6?$e:we,r=[],o=s.length,n=65536,i=new Int32Array(n).fill(-1),l=new Int32Array(Math.min(o,V)).fill(-1),c=h=>((s[h]*4129^s[h+1]*155^s[h+2])&n-1)>>>0,a=0,d=-1,m=h=>{r.push({lit:h})},p=(h,u)=>{d>=0&&(m(d),d=-1),r.push({len:h,dist:u})};for(;a<o;){if(a+2>=o){m(s[a++]);continue}let h=c(a),u=Ht-1,$=0,x=i[h],y=0;for(;x>=0&&y<e;){let b=a-x;if(b>V)break;let F=0,I=Math.min(vt,o-a);for(;F<I&&s[x+F]===s[a+F];)F++;if(F>u&&(u=F,$=b),u===vt)break;x=l[x&V-1],y++}if(l[a&V-1]=i[h],i[h]=a,u>=Ht){if(t>=6&&a+3<o){let b=c(a+1),F=i[b],I=0,X=0,T=0;for(;F>=0&&T<e;){let v=a+1-F;if(v>V)break;let f=0,w=Math.min(vt,o-a-1);for(;f<w&&s[F+f]===s[a+1+f];)f++;f>I&&(I=f,X=v),F=l[F&V-1],T++}if(I>u+1){m(s[a]),a++,l[a&V-1]=i[b],i[b]=a,p(I,X);for(let v=1;v<I;v++)if(a++,a+2<o){let f=c(a);l[a&V-1]=i[f],i[f]=a}a++;continue}}p(u,$);for(let b=0;b<u;b++)if(a+b+2<o){let F=c(a+b);l[a+b&V-1]=i[F],i[F]=a+b}a+=u}else m(s[a++])}return r}function be(s,t,e,r){let o=0;for(;o<s.length;){let n=s[o];if(n===0){let i=0;for(;o+i<s.length&&s[o+i]===0&&i<138;)i++;i<3?(t.writeBits(G(e[0],r[0]),r[0]),o++):i<=10?(t.writeBits(G(e[17],r[17]),r[17]),t.writeBits(i-3,3),o+=i):(t.writeBits(G(e[18],r[18]),r[18]),t.writeBits(i-11,7),o+=i)}else{t.writeBits(G(e[n],r[n]),r[n]),o++;let i=0;for(;o+i<s.length&&s[o+i]===n&&i<6;)i++;i>=3&&(t.writeBits(G(e[16],r[16]),r[16]),t.writeBits(i-3,2),o+=i)}}}function Vt(s,t,e,r){let o=new Uint32Array(286),n=new Uint32Array(30);o[256]=1;for(let m of s)if("lit"in m)o[m.lit]++;else{let[p]=Ut(m.len);o[p]++;let[h]=zt(m.dist);n[h]++}let i,l,c,a;if(r){i=yt(o,15),l=yt(n,15),l.every(F=>F===0)&&(l[0]=1),c=at(i),a=at(l);let m=Gt(i,257,286)+1,p=Gt(l,1,30)+1,h=[...i.subarray(0,m),...l.subarray(0,p)],u=new Uint32Array(19);ve(h,u);let $=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],x=yt(u,7),y=at(x),b=Fe($.map(F=>x[F]),4,19)+1;t.writeBits(e?1:0,1),t.writeBits(2,2),t.writeBits(m-257,5),t.writeBits(p-1,5),t.writeBits(b-4,4);for(let F=0;F<b;F++)t.writeBits(x[$[F]],3);be(h,t,y,x)}else i=ue(),l=ge(),c=at(i),a=at(l),t.writeBits(e?1:0,1),t.writeBits(1,2);for(let m of s)if("lit"in m){let p=i[m.lit];t.writeBits(G(c[m.lit],p),p)}else{let[p,h,u]=Ut(m.len),$=i[p];t.writeBits(G(c[p],$),$),h>0&&t.writeBits(u,h);let[x,y,b]=zt(m.dist),F=l[x];t.writeBits(G(a[x],F),F),y>0&&t.writeBits(b,y)}let d=i[256];t.writeBits(G(c[256],d),d)}function Gt(s,t,e){let r=t-1;for(let o=t;o<Math.min(s.length,e);o++)s[o]>0&&(r=o);return Math.max(r,t-1)}function Fe(s,t,e){let r=t-1;for(let o=t;o<Math.min(s.length,e);o++)s[o]>0&&(r=o);return Math.max(r,t-1)}function ve(s,t){let e=0;for(;e<s.length;){let r=s[e];if(r===0){let o=0;for(;e+o<s.length&&s[e+o]===0&&o<138;)o++;o<3?(t[0]++,e++):o<=10?(t[17]++,e+=o):(t[18]++,e+=o)}else{t[r]++,e++;let o=0;for(;e+o<s.length&&s[e+o]===r&&o<6;)o++;o>=3&&(t[16]++,e+=o)}}}var Ct=65536;function Ce(s,t=6){if(t===0){let i=new dt,l=0;for(;l<s.length||s.length===0;){let c=Math.min(Ct,s.length-l),a=l+c>=s.length;i.flush(),i.writeBits(a?1:0,1),i.writeBits(0,2),i.flush();let d=c;i.buf.push(d&255,d>>8&255,~d&255,~d>>8&255);for(let m=0;m<c;m++)i.buf.push(s[l+m]);if(l+=c,s.length===0)break}return i.toBytes()}let e=Math.max(1,Math.min(9,t)),r=e>=2,o=new dt,n=0;for(;n<s.length||s.length===0;){let i=s.subarray(n,n+Ct),l=n+Ct>=s.length,c=ye(i,e);if(Vt(c,o,l,r),n+=i.length,s.length===0){Vt([],o,!0,r);break}}return o.flush(),o.toBytes()}function P(s,t,e){s[t]=e&255,s[t+1]=e>>8&255}function E(s,t,e){s[t]=e&255,s[t+1]=e>>8&255,s[t+2]=e>>16&255,s[t+3]=e>>24&255}var ke=new TextEncoder,Te=new Set(["png","jpg","jpeg","gif","tiff","emf","wmf","bmp","webp"]);function kt(s,t={}){let e=t.level??6,r=t.noCompress?new Set(t.noCompress.map(u=>u.toLowerCase())):Te,o=[],n=[],i=0;for(let u of s){let $=ke.encode(u.name),x=u.name.split(".").pop()?.toLowerCase()??"",y=u.level??(r.has(x)?0:e),b=y>0&&u.data.length>0,F=fe(u.data),I,X;b?(I=Ce(u.data,y),I.length>=u.data.length?(I=u.data,X=0):X=8):(I=u.data,X=0);let T=new Uint8Array(30+$.length);E(T,0,67324752),P(T,4,20),P(T,6,0),P(T,8,X),P(T,10,0),P(T,12,0),E(T,14,F),E(T,18,I.length),E(T,22,u.data.length),P(T,26,$.length),P(T,28,0),T.set($,30);let v=new Uint8Array(46+$.length);E(v,0,33639248),P(v,4,20),P(v,6,20),P(v,8,0),P(v,10,X),P(v,12,0),P(v,14,0),E(v,16,F),E(v,20,I.length),E(v,24,u.data.length),P(v,28,$.length),P(v,30,0),P(v,32,0),P(v,34,0),P(v,36,0),E(v,38,0),E(v,42,i),v.set($,46),o.push(T,I),n.push(v),i+=T.length+I.length}let l=i,c=n.reduce((u,$)=>u+$.length,0),a=new Uint8Array(22);E(a,0,101010256),P(a,4,0),P(a,6,0),P(a,8,n.length),P(a,10,n.length),E(a,12,c),E(a,16,l),P(a,20,0);let d=[...o,...n,a],m=d.reduce((u,$)=>u+$.length,0),p=new Uint8Array(m),h=0;for(let u of d)p.set(u,h),h+=u.length;return p}function Q(s,t){return s[t]|s[t+1]<<8}function et(s,t){return(s[t]|s[t+1]<<8|s[t+2]<<16|s[t+3]<<24)>>>0}async function Ie(s){let t=new DecompressionStream("deflate-raw"),e=t.writable.getWriter(),r=t.readable.getReader();e.write(s),e.close();let o=[],n=!1;for(;!n;){let{value:a,done:d}=await r.read();a&&o.push(a),n=d}let i=o.reduce((a,d)=>a+d.length,0),l=new Uint8Array(i),c=0;for(let a of o)l.set(a,c),c+=a.length;return l}async function qt(s){let t=new TextDecoder("utf-8"),e=new Map,r=-1;for(let l=s.length-22;l>=0;l--)if(s[l]===80&&s[l+1]===75&&s[l+2]===5&&s[l+3]===6){r=l;break}if(r<0)throw new Error("Not a valid ZIP file (EOCD not found)");let o=et(s,r+16),n=Q(s,r+8),i=o;for(let l=0;l<n;l++){if(et(s,i)!==33639248)throw new Error("Invalid central directory entry");let c=Q(s,i+10),a=et(s,i+20),d=et(s,i+24),m=Q(s,i+28),p=Q(s,i+30),h=Q(s,i+32),u=et(s,i+42),$=s.subarray(i+46,i+46+m),x=t.decode($);i+=46+m+p+h;let y=u;if(et(s,y)!==67324752)throw new Error("Invalid local file header");let b=Q(s,y+26),F=Q(s,y+28),I=y+30+b+F,X=s.subarray(I,I+a),T;c===0?T=X.slice():c===8?T=await Ie(X):T=X.slice(),x.endsWith("/")||e.set(x,{name:x,data:T})}return e}function Tt(s){return new TextDecoder("utf-8").decode(s.data)}function It(s){let t=Object.entries(s.attrs).map(([o,n])=>`${o}="${Re(n)}"`).join(" "),e=t?`<${s.tag} ${t}`:`<${s.tag}`,r=(s.text??"")+s.children.map(It).join("");return r?`${e}>${r}</${s.tag}>`:`${e}/>`}function Re(s){return s.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function U(s){let t=[],e=[],r=0;for(s.startsWith("<?")&&(r=s.indexOf("?>")+2);r<s.length;){if(s[r]!=="<"){let m=s.indexOf("<",r),p=m<0?s.slice(r):s.slice(r,m);if(e.length&&p.trim()){let h=e[e.length-1];h.text=(h.text??"")+Zt(p)}r=m<0?s.length:m;continue}if(s.startsWith("<!--",r)){let m=s.indexOf("-->",r);if(e.length){let p=e[e.length-1];p.text=(p.text??"")+s.slice(r,m+3)}r=m+3;continue}if(s.startsWith("<![CDATA[",r)){let m=s.indexOf("]]>",r),p=s.slice(r+9,m);if(e.length){let h=e[e.length-1];h.text=(h.text??"")+p}r=m+3;continue}if(s[r+1]==="/"){let m=s.indexOf(">",r),p=e.pop();e.length?e[e.length-1].children.push(p):t.push(p),r=m+1;continue}if(s[r+1]==="?"){r=s.indexOf("?>",r)+2;continue}let o=Se(s,r),n=s.slice(r+1,o),i=n.endsWith("/"),l=i?n.slice(0,-1).trim():n.trim(),{tag:c,attrs:a}=Pe(l),d={tag:c,attrs:a,children:[]};i?e.length?e[e.length-1].children.push(d):t.push(d):e.push(d),r=o+1}for(;e.length>1;){let o=e.pop();e[e.length-1].children.push(o)}if(e.length===1&&t.push(e[0]),t.length===0)throw new Error("Empty XML document");return t[0]}function Se(s,t){let e=null;for(let r=t+1;r<s.length;r++){let o=s[r];if(e)o===e&&(e=null);else if(o==='"'||o==="'")e=o;else if(o===">")return r}return s.length-1}function Pe(s){let t={},e=s.search(/\s/),r=e<0?s:s.slice(0,e);if(e<0)return{tag:r,attrs:t};let o=s.slice(e),n=/(\S+?)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,i;for(;(i=n.exec(o))!==null;)t[i[1]]=Zt(i[2]??i[3]??"");return{tag:r,attrs:t}}function Zt(s){return s.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,e)=>String.fromCharCode(parseInt(e,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,e)=>String.fromCharCode(parseInt(e,16)))}function S(s,t){return s.children.find(e=>O(e.tag)===t)}function _(s,t){return s.children.filter(e=>O(e.tag)===t)}function O(s){let t=s.indexOf(":");return t<0?s:s.slice(t+1)}function De(s){return s.toISOString()}function Rt(s){let t=(r,o)=>o!==void 0?`<${r}>${g(o)}</${r}>`:"",e=(r,o)=>o?`<${r} xsi:type="dcterms:W3CDTF">${De(o)}</${r}>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
167
|
+
id="${t}" name="${I(e.name)}" displayName="${I(i)}"
|
|
168
|
+
ref="${e.ref}" totalsRowCount="${h}">
|
|
169
|
+
<autoFilter ref="${d}"/>
|
|
170
|
+
<tableColumns count="${e.columns.length}">${a}</tableColumns>
|
|
171
|
+
<tableStyleInfo ${l}/>
|
|
172
|
+
</table>`}var Qr={sum:"sum",count:"count",average:"average",max:"max",min:"min",product:"product",countNums:"countNums",stdDev:"stdDev",stdDevp:"stdDevp",var:"var",varp:"varp"};function Cn(e,t,o,n){let r=(t[0]??[]).map(G=>String(G??"")),s=t.slice(1),i=r.length,a=e.rowGrandTotals!==!1,l=e.colGrandTotals!==!1,h=new Map(r.map((G,X)=>[G,X])),c=e.rowFields.map(G=>h.get(G)??0),m=e.colFields.map(G=>h.get(G)??0),d=e.dataFields.map(G=>h.get(G.field)??0),f=Array.from({length:i},()=>[]),p=Array.from({length:i},()=>new Map),g=new Array(i).fill(!0);for(let G of s)for(let X=0;X<i;X++){let C=G[X],A=C==null?"":String(C);typeof C!="number"&&(g[X]=!1),p[X].has(A)||(p[X].set(A,f[X].length),f[X].push(A))}let{row:u,col:$}=Gt(e.targetCell),x=m.length>0,b=x?m.reduce((G,X)=>G*Math.max(f[X].length,1),1):1,y=1+(c.length?c.reduce((G,X)=>G*Math.max(f[X].length,1),1):1)+(a?1:0),v=e.dataFields.length+(e.calculatedFields??[]).length,w=c.length+b*v+(l?v:0),R=`${ye(u,$)}:${ye(u+y-1,$+w-1)}`,T=c.length+1,S=new Set([...c,...m]),M=e.calculatedFields??[],D=M.map(G=>`<cacheField name="${I(G.name)}" numFmtId="0" formula="${I(G.formula)}" databaseField="0"><sharedItems/></cacheField>`).join(""),k=i+M.length,W=new Map;for(let G of e.fieldGrouping??[]){let X=h.get(G.field);X!==void 0&&W.set(X,G)}let Q=r.map((G,X)=>{let C=W.get(X);if(S.has(X)){let A=f[X].map(Y=>`<s v="${I(Y)}"/>`).join(""),U="";return C&&(C.groupBy==="numeric"?U=`<fieldGroup base="${X}"><rangePr startNum="${C.start??0}" endNum="${C.end??100}" groupInterval="${C.interval??10}"/></fieldGroup>`:U=`<fieldGroup base="${X}"><rangePr groupBy="${{days:"days",months:"months",quarters:"quarters",years:"years"}[C.groupBy]??"months"}"/></fieldGroup>`),`<cacheField name="${I(G)}" numFmtId="0"><sharedItems count="${f[X].length}">${A}</sharedItems>${U}</cacheField>`}if(g[X]){let A=s.map(rt=>Number(rt[X])).filter(rt=>!isNaN(rt)),U=A.length?Math.min(...A):0,Y=A.length?Math.max(...A):0;return`<cacheField name="${I(G)}" numFmtId="0"><sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" minValue="${U}" maxValue="${Y}"/></cacheField>`}return`<cacheField name="${I(G)}" numFmtId="0"><sharedItems/></cacheField>`}).join("")+D,q=s.map(G=>`<r>${r.map((C,A)=>{let U=G[A];if(S.has(A)){let Y=U==null?"":String(U);return`<x v="${p[A].get(Y)??0}"/>`}return typeof U=="number"?`<n v="${U}"/>`:typeof U=="boolean"?`<b v="${U?1:0}"/>`:`<s v="${I(String(U??""))}"/>`}).join("")}</r>`).join(""),E=r.map((G,X)=>{let C=c.includes(X),A=m.includes(X),U=d.includes(X);if(C){let Y=f[X].map((rt,ht)=>`<item x="${ht}"/>`).join("")+'<item t="default"/>';return`<pivotField axis="axisRow" showAll="0"><items count="${f[X].length+1}">${Y}</items></pivotField>`}if(A){let Y=f[X].map((rt,ht)=>`<item x="${ht}"/>`).join("")+'<item t="default"/>';return`<pivotField axis="axisCol" showAll="0"><items count="${f[X].length+1}">${Y}</items></pivotField>`}return U?'<pivotField dataField="1" showAll="0"/>':'<pivotField showAll="0"/>'}).join("")+M.map(()=>'<pivotField dataField="1" showAll="0"/>').join(""),_="",P="";if(c.length){_=`<rowFields count="${c.length}">${c.map(A=>`<field x="${A}"/>`).join("")}</rowFields>`;let G=c[0],X=f[G].map((A,U)=>`<i><x v="${U}"/></i>`).join(""),C=a?'<i t="grand"><x/></i>':"";P=`<rowItems count="${f[G].length+(a?1:0)}">${X}${C}</rowItems>`}let N="",H="";if(x){N=`<colFields count="${m.length}">${m.map(A=>`<field x="${A}"/>`).join("")}</colFields>`;let G=m[0],X=f[G].map((A,U)=>`<i><x v="${U}"/></i>`).join(""),C=l?'<i t="grand"><x/></i>':"";H=`<colItems count="${f[G].length+(l?1:0)}">${X}${C}</colItems>`}else if(v>1){N='<colFields count="1"><field x="-2"/></colFields>';let G=Array.from({length:v},(X,C)=>`<i><x v="${C}"/></i>`).join("");H=`<colItems count="${v}">${G}</colItems>`}let V=[];for(let G=0;G<e.dataFields.length;G++){let X=e.dataFields[G],C=d[G],A=Qr[X.func??"sum"]??"sum",U=X.name??`Sum of ${X.field}`;V.push(`<dataField name="${I(U)}" fld="${C}" subtotal="${A}" showDataAs="normal" baseField="0" baseItem="0"/>`)}for(let G=0;G<M.length;G++){let X=M[G],C=i+G;V.push(`<dataField name="${I(X.name)}" fld="${C}" subtotal="sum" showDataAs="normal" baseField="0" baseItem="0"/>`)}let K=`<dataFields count="${V.length}">${V.join("")}</dataFields>`,z=[a?"":'rowGrandTotals="0"',l?"":'colGrandTotals="0"'].filter(Boolean),mt=z.length?" "+z.join(" "):"",it=I(e.style??"PivotStyleMedium9"),gt=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
173
|
+
<pivotTableDefinition xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" name="${I(e.name)}" cacheId="${n}" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="1" dataCaption="Values" updatedVersion="6" minRefreshableVersion="3" useAutoFormatting="1" itemPrintTitles="1" createdVersion="6" indent="0" outline="1" outlineData="1" multipleFieldFilters="0"${mt}>
|
|
174
|
+
<location ref="${R}" firstHeaderRow="1" firstDataRow="2" firstDataCol="${T}"/>
|
|
175
|
+
<pivotFields count="${k}">${E}</pivotFields>
|
|
176
|
+
${_}${P}${N}${H}${K}
|
|
177
|
+
<pivotTableStyleInfo name="${it}" showRowHeaders="1" showColHeaders="1" showRowStripes="0" showColStripes="0" showLastColumn="1"/>
|
|
178
|
+
</pivotTableDefinition>`,St=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
179
|
+
<pivotCacheDefinition xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" r:id="rId1" refreshedBy="ExcelForge" refreshedDate="45000" createdVersion="6" refreshedVersion="6" minRefreshableVersion="3" recordCount="${s.length}" saveData="1">
|
|
180
|
+
<cacheSource type="worksheet"><worksheetSource ref="${e.sourceRef}" sheet="${I(e.sourceSheet)}"/></cacheSource>
|
|
181
|
+
<cacheFields count="${k}">${Q}</cacheFields>
|
|
182
|
+
</pivotCacheDefinition>`,J=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
183
|
+
<pivotCacheRecords xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" count="${s.length}">${q}</pivotCacheRecords>`;return{pivotTableXml:gt,cacheDefXml:St,cacheRecordsXml:J}}var Vo={button:"Button",checkBox:"Checkbox",comboBox:"Drop",listBox:"List",optionButton:"Radio",groupBox:"GBox",label:"Label",scrollBar:"Scroll",spinner:"Spin",dialog:"Dialog"},Jr={...Vo,checkBox:"CheckBox",dialog:"Dialog"},Fn={...Object.fromEntries(Object.entries(Vo).map(([e,t])=>[t,e])),CheckBox:"checkBox"},vn={unchecked:"0",checked:"1",mixed:"2"},Sn={0:"unchecked",1:"checked",2:"mixed"};function In(e){if(e._ctrlPropXml)return e._ctrlPropXml;let o=[`objectType="${Jr[e.type]??"Button"}"`,'lockText="1"'];if(e.linkedCell&&o.push(`fmlaLink="${I(e.linkedCell)}"`),e.inputRange&&o.push(`fmlaRange="${I(e.inputRange)}"`),e.checked!==void 0&&o.push(`checked="${vn[e.checked]??"0"}"`),e.dropLines!==void 0&&o.push(`dropLines="${e.dropLines}"`),e.min!==void 0&&o.push(`min="${e.min}"`),e.max!==void 0&&o.push(`max="${e.max}"`),e.inc!==void 0&&o.push(`inc="${e.inc}"`),e.page!==void 0&&o.push(`page="${e.page}"`),e.val!==void 0&&o.push(`val="${e.val}"`),e.selType){let n={single:"Single",multi:"Multi",extend:"Extend"};o.push(`selType="${n[e.selType]??"Single"}"`)}return e.noThreeD&&o.push('noThreeD="1"'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
184
|
+
<formControlPr xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" ${o.join(" ")}/>`}function ts(e,t){return`${e.col}, ${e.colOff??0}, ${e.row}, ${e.rowOff??0}, ${t.col}, ${t.colOff??0}, ${t.row}, ${t.rowOff??0}`}function Tn(e,t){if(e._vmlShapeXml)return e._vmlShapeXml;let o=Vo[e.type]??"Button",n=ts(e.from,e.to),r=[];if(r.push(`<x:Anchor>${n}</x:Anchor>`),r.push("<x:PrintObject>False</x:PrintObject>"),r.push("<x:AutoFill>False</x:AutoFill>"),e.macro&&r.push(`<x:FmlaMacro>${I(e.macro)}</x:FmlaMacro>`),e.linkedCell&&r.push(`<x:FmlaLink>${I(e.linkedCell)}</x:FmlaLink>`),e.inputRange&&r.push(`<x:FmlaRange>${I(e.inputRange)}</x:FmlaRange>`),e.checked!==void 0&&r.push(`<x:Checked>${vn[e.checked]??"0"}</x:Checked>`),e.dropLines!==void 0&&r.push(`<x:DropLines>${e.dropLines}</x:DropLines>`),e.dropStyle&&r.push(`<x:DropStyle>${I(e.dropStyle)}</x:DropStyle>`),e.min!==void 0&&r.push(`<x:Min>${e.min}</x:Min>`),e.max!==void 0&&r.push(`<x:Max>${e.max}</x:Max>`),e.inc!==void 0&&r.push(`<x:Inc>${e.inc}</x:Inc>`),e.page!==void 0&&r.push(`<x:Page>${e.page}</x:Page>`),e.val!==void 0&&r.push(`<x:Val>${e.val}</x:Val>`),e.selType){let d={single:"Single",multi:"Multi",extend:"Extend"};r.push(`<x:Sel>${d[e.selType]??"Single"}</x:Sel>`)}e.noThreeD&&r.push("<x:NoThreeD/>"),e.isDefault&&r.push("<x:Default/>"),e.isDismiss&&r.push("<x:Dismiss/>"),e.isCancel&&r.push("<x:Cancel/>");let s="";e.text&&(e.type==="button"||e.type==="checkBox"||e.type==="optionButton"||e.type==="groupBox"||e.type==="label"||e.type==="dialog")&&(s=`<v:textbox style="mso-direction-alt:auto"><div style="text-align:${e.type==="button"?"center":"left"}"><font face="Calibri" size="220" color="#000000">${I(e.text)}</font></div></v:textbox>`,r.push("<x:TextHAlign>Center</x:TextHAlign>"),r.push("<x:TextVAlign>Center</x:TextVAlign>"));let i=(e.from.col*64+(e.from.colOff??0))*.75,a=(e.from.row*20+(e.from.rowOff??0))*.75,l=(e.to.col-e.from.col)*64*.75,h=(e.to.row-e.from.row)*20*.75,c=e.text??`${e.type}_${t}`,m=e.type==="dialog"?"":' filled="f" stroked="f"';return`<v:shape o:spid="_x0000_s${t}" id="${I(c)}" type="#_x0000_t201" style="position:absolute;margin-left:${i.toFixed(1)}pt;margin-top:${a.toFixed(1)}pt;width:${l.toFixed(1)}pt;height:${h.toFixed(1)}pt;z-index:${t}"${m} o:insetmode="auto"><o:lock v:ext="edit" rotation="t"/>${s}<x:ClientData ObjectType="${o}">${r.join("")}</x:ClientData></v:shape>`}function kn(e,t){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">
|
|
185
|
+
<o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout>
|
|
186
|
+
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>
|
|
187
|
+
<v:shapetype id="_x0000_t201" coordsize="21600,21600" o:spt="201" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path shadowok="f" o:extrusionok="f" strokeok="f" fillok="f" o:connecttype="rect"/><o:lock v:ext="edit" shapetype="t"/></v:shapetype>
|
|
188
|
+
${e.join(`
|
|
189
|
+
`)}
|
|
190
|
+
${t.join(`
|
|
191
|
+
`)}
|
|
192
|
+
</xml>`}function An(e){return e<=16?4:e<=32?5:e<=64?6:e<=128?7:e<=256?8:e<=512?9:e<=1024?10:e<=2048?11:12}function Wo(e){let t=[1],o=0;for(;o<e.length;){let n=o,r=Math.min(o+4096,e.length),s=es(e,n,r);if(s.length<4096){let a=45056|s.length+2-3&4095;t.push(a&255,a>>8&255);for(let l of s)t.push(l)}else{t.push(255,63);for(let a=n;a<r;a++)t.push(e[a]);for(let a=r-n;a<4096;a++)t.push(0)}o=r}return new Uint8Array(t)}function es(e,t,o){let n=[],r=0;for(;t+r<o;){let s=0,i=n.length;n.push(0);for(let a=0;a<8&&t+r<o;a++){if(r===0){n.push(e[t]),r++;continue}let l=An(r),h=1<<l,c=16-l,m=(1<<c)-1+3,d=Math.max(0,r-h),f=0,p=0;for(let g=d;g<r;g++){let u=0;for(;r+u<o-t&&u<m&&e[t+g+u]===e[t+r+u];)u++;u>p&&(p=u,f=r-g)}if(p>=3){s|=1<<a;let g=f-1<<c|p-3;n.push(g&255,g>>8&255),r+=p}else n.push(e[t+r]),r++}n[i]=s}return n}function Ho(e){if(e.length===0||e[0]!==1)throw new Error("Invalid OVBA compressed container (bad signature)");let t=[],o=1;for(;o<e.length&&!(o+1>=e.length);){let n=e[o]|e[o+1]<<8;o+=2;let r=(n&4095)+3,s=n>>15&1,i=r-2,a=o+i;if(s){let l=t.length;for(;o<a&&o<e.length;){let h=e[o++];for(let c=0;c<8&&o<a&&o<e.length;c++)if((h&1<<c)===0)t.push(e[o++]);else{if(o+1>=e.length)break;let m=e[o]|e[o+1]<<8;o+=2;let d=t.length-l,p=16-An(d),g=(m>>p)+1,u=(m&(1<<p)-1)+3,$=t.length-g;for(let x=0;x<u;x++)t.push(t[$+x])}}}else{for(let l=0;l<4096&&o<e.length;l++)t.push(e[o++]);o=Math.max(o,a)}}return new Uint8Array(t)}var Dn=new Uint8Array([208,207,17,224,161,177,26,225]),ke=4294967294,Ue=4294967295,os=4294967293,Xe=4294967295,Kt=512,go=64,Rn=4096,$o=128;function zo(e,t){return e[t]|e[t+1]<<8}function ee(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Ne(e,t,o){e[t]=o&255,e[t+1]=o>>8&255}function Et(e,t,o){e[t]=o&255,e[t+1]=o>>8&255,e[t+2]=o>>16&255,e[t+3]=o>>24&255}function ns(e){if(e.length>31)throw new Error(`CFB entry name too long (${e.length} chars, max 31): "${e}"`);let t=new Uint8Array(64),o=0;for(let n of e){let r=n.charCodeAt(0);t[o++]=r&255,t[o++]=r>>8&255}return t[o++]=0,t[o++]=0,{bytes:t,size:o}}function rs(e,t,o){let n="",r=Math.max(0,o-2);for(let s=0;s<r;s+=2){let i=e[t+s]|e[t+s+1]<<8;if(i===0)break;n+=String.fromCharCode(i)}return n}function eo(e,t){let o=[],n=t;for(;n!==ke&&n<e.length;)o.push(n),n=e[n];return o}function xo(e,t){return Math.ceil(e/t)}function Pn(e){for(let T=0;T<8;T++)if(e[T]!==Dn[T])throw new Error("Not a CFB file");let o=1<<zo(e,30),r=1<<zo(e,32),s=ee(e,44),i=ee(e,48),a=ee(e,60),l=T=>512+T*o,h=[];for(let T=0;T<109&&T<s;T++){let S=ee(e,76+T*4);S!==Ue&&h.push(S)}let c=Math.floor((e.length-512)/o),m=new Uint32Array(c);m.fill(Ue);for(let T=0;T<h.length;T++){let S=l(h[T]),M=o/4;for(let D=0;D<M&&T*M+D<c;D++)m[T*M+D]=ee(e,S+D*4)}let d=eo(m,i),f=new Uint8Array(d.length*o);for(let T=0;T<d.length;T++)f.set(e.subarray(l(d[T]),l(d[T])+o),T*o);let p=f.length/$o,g=[];for(let T=0;T<p;T++){let S=T*$o,M=zo(f,S+64);M!==0&&g.push({name:rs(f,S,M),type:f[S+66],child:ee(f,S+76),left:ee(f,S+68),right:ee(f,S+72),startSector:ee(f,S+116),size:ee(f,S+120),index:T})}let u=g.find(T=>T.type===5);if(!u)throw new Error("No root entry in CFB");let $=eo(m,u.startSector),x=new Uint8Array($.length*o);for(let T=0;T<$.length;T++)x.set(e.subarray(l($[T]),l($[T])+o),T*o);let b=eo(m,a),F=b.length*(o/4),y=new Uint32Array(F);y.fill(Ue);for(let T=0;T<b.length;T++){let S=l(b[T]),M=o/4;for(let D=0;D<M;D++)y[T*M+D]=ee(e,S+D*4)}let v=new Map;function w(T,S){let M=g.find(k=>k.index===T);if(!M||M.child===Xe)return;let D=k=>{if(k===Xe||k>=p)return;let W=g.find(Q=>Q.index===k);W&&(v.set(k,S),W.type===1&&w(k,W.name),D(W.left),D(W.right))};D(M.child)}w(u.index,"");let R=[];for(let T of g){if(T.type!==2)continue;let S;if(T.size<Rn){let M=eo(y,T.startSector),D=new Uint8Array(M.length*r);for(let k=0;k<M.length;k++){let W=M[k]*r;D.set(x.subarray(W,W+r),k*r)}S=D.subarray(0,T.size)}else{let M=eo(m,T.startSector),D=new Uint8Array(M.length*o);for(let k=0;k<M.length;k++)D.set(e.subarray(l(M[k]),l(M[k])+o),k*o);S=D.subarray(0,T.size)}R.push({name:T.name,data:S,storage:v.get(T.index)||void 0})}return R}function Mn(e){let t={name:"Root Entry",type:5,children:[]},o=new Map;o.set("",t);for(let k of e){let W=k.storage??"",Q=o.get(W);Q||(Q={name:W,type:1,children:[]},o.set(W,Q),t.children.push(Q));let q={name:k.name,type:2,data:k.data};Q.children.push(q)}let n=[],r=[t];for(;r.length;){let k=r.shift();if(n.push({node:k,parentIdx:-1,childIdx:Xe,leftIdx:Xe,rightIdx:Xe,miniStart:0,size:k.data?.length??0}),k.children)for(let W of k.children)r.push(W)}for(let k=0;k<n.length;k++){let W=n[k].node;if(!W.children?.length)continue;let Q=n.map((_,P)=>({e:_,idx:P})).filter(({e:_})=>W.children.includes(_.node)).map(({idx:_})=>_);if(Q.length===0)continue;let q=Q.sort((_,P)=>{let N=n[_].node.name,H=n[P].node.name;return N.length!==H.length?N.length-H.length:N.toUpperCase()<H.toUpperCase()?-1:N.toUpperCase()>H.toUpperCase()?1:0}),E=_=>{if(_.length===0)return Xe;let P=_.length>>1;return n[_[P]].leftIdx=E(_.slice(0,P)),n[_[P]].rightIdx=E(_.slice(P+1)),_[P]};n[k].childIdx=E(q)}let s=[],i=new Map,a=0;for(let k=0;k<n.length;k++){let W=n[k].node.data;if(!W||W.length===0)continue;let Q=xo(W.length,go),q=[];for(let E=0;E<Q;E++){q.push(a++);let _=W.subarray(E*go,Math.min((E+1)*go,W.length));for(let P of _)s.push(P);for(let P=_.length;P<go;P++)s.push(0)}n[k].miniStart=q[0],i.set(k,q)}let h=Math.max(a,1),c=xo(h*4,Kt),m=new Uint32Array(c*(Kt/4));m.fill(Ue);for(let k of i.values())for(let W=0;W<k.length;W++)m[k[W]]=W+1<k.length?k[W+1]:ke;let d=new Uint8Array(s),f=xo(d.length||1,Kt),p=n.length,g=xo(p*$o,Kt),u=0,$=1,x=$+g,b=x+c,F=1+g+c+f,y=new Uint32Array(Kt/4);y.fill(Ue),y[u]=os;for(let k=0;k<g;k++)y[$+k]=k+1<g?$+k+1:ke;for(let k=0;k<c;k++)y[x+k]=k+1<c?x+k+1:ke;for(let k=0;k<f;k++)y[b+k]=k+1<f?b+k+1:ke;n[0].miniStart=b,n[0].size=d.length;let v=new Uint8Array(g*Kt);for(let k=0;k<n.length;k++){let W=k*$o,Q=n[k],{bytes:q,size:E}=ns(Q.node.name);v.set(q,W),Ne(v,W+64,E),v[W+66]=Q.node.type,v[W+67]=1,Et(v,W+68,Q.leftIdx),Et(v,W+72,Q.rightIdx),Et(v,W+76,Q.childIdx),Q.node.type===5?(Et(v,W+116,b),Et(v,W+120,d.length)):Q.node.type===2&&Q.node.data&&Q.node.data.length>0?(Et(v,W+116,Q.miniStart),Et(v,W+120,Q.node.data.length)):Q.node.type===1?(Et(v,W+116,0),Et(v,W+120,0)):(Et(v,W+116,ke),Et(v,W+120,0))}let w=new Uint8Array(512);w.set(Dn,0),Ne(w,24,62),Ne(w,26,3),Ne(w,28,65534),Ne(w,30,9),Ne(w,32,6),Et(w,44,1),Et(w,48,$),Et(w,56,Rn),Et(w,60,x),Et(w,64,c),Et(w,68,ke),Et(w,72,0),Et(w,76,u);for(let k=1;k<109;k++)Et(w,76+k*4,Ue);let R=512+F*Kt,T=new Uint8Array(R);T.set(w,0);let S=new Uint8Array(Kt);for(let k=0;k<y.length;k++)Et(S,k*4,y[k]);T.set(S,512+u*Kt),T.set(v,512+$*Kt);let M=new Uint8Array(c*Kt);for(let k=0;k<m.length;k++)Et(M,k*4,m[k]);T.set(M,512+x*Kt);let D=new Uint8Array(f*Kt);return D.set(d),T.set(D,512+b*Kt),T}var Zt=new TextEncoder,yo=new TextDecoder("utf-8");function we(e){return[e&255,e>>8&255]}function vt(e){return[e&255,e>>8&255,e>>16&255,e>>24&255]}function ss(e,t){return e[t]|e[t+1]<<8}function En(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function Tt(e,t){let o=t instanceof Uint8Array?Array.from(t):t;return[...we(e),...vt(o.length),...o]}function as(e){let t=[];for(let o of e){let n=o.charCodeAt(0);t.push(n&255,n>>8&255)}return t}function is(e){let t=[`Attribute VB_Name = "${e.name}"`];if(e.type==="document"){let o=e.name==="ThisWorkbook"?"0{00020819-0000-0000-C000-000000000046}":"0{00020820-0000-0000-C000-000000000046}";t.push(`Attribute VB_Base = "${o}"`,"Attribute VB_GlobalNameSpace = False","Attribute VB_Creatable = False","Attribute VB_PredeclaredId = True","Attribute VB_Exposed = True","Attribute VB_TemplateDerived = False","Attribute VB_Customizable = True")}else e.type==="userform"?t.push('Attribute VB_Base = "0{F8A47041-B2A6-11CE-8027-00AA00611080}"',"Attribute VB_GlobalNameSpace = False","Attribute VB_Creatable = False","Attribute VB_PredeclaredId = True","Attribute VB_Exposed = False","Attribute VB_TemplateDerived = False","Attribute VB_Customizable = False"):e.type==="class"&&t.push("Attribute VB_GlobalNameSpace = False","Attribute VB_Creatable = False","Attribute VB_PredeclaredId = False","Attribute VB_Exposed = False");return t.join(`\r
|
|
193
|
+
`)+`\r
|
|
194
|
+
`}var oo=class e{constructor(){this.modules=[],this._dirty=!1}addModule(t){return this.modules.push(t),this._dirty=!0,this}removeModule(t){return this.modules=this.modules.filter(o=>o.name!==t),this._dirty=!0,this}getModule(t){return this.modules.find(o=>o.name===t)}build(){if(this._raw&&!this._dirty)return this._raw;let o=this.modules.some(p=>p.name==="ThisWorkbook"&&p.type==="document")?this.modules:[{name:"ThisWorkbook",type:"document",code:""},...this.modules],n=[...o.filter(p=>p.type==="document"),...o.filter(p=>p.type!=="document")],r=[];for(let p of n){let g=is(p)+p.code,u=Wo(Zt.encode(g));r.push({name:p.name,data:u,storage:"VBA"})}let s={name:"_VBA_PROJECT",data:new Uint8Array([204,97,255,255,0,0,0]),storage:"VBA"},i=this._buildDirStream(n),l={name:"dir",data:Wo(i),storage:"VBA"},h=this._buildProjectText(n),c={name:"PROJECT",data:Zt.encode(h)},m=this._buildProjectWm(n),d={name:"PROJECTwm",data:new Uint8Array(m)},f=[s,l,...r,c,d];for(let p of n)if(p.type==="userform")if(p._formStreams&&p._formStreams.size>0)for(let[g,u]of p._formStreams)f.push({name:g,data:u,storage:p.name});else f.push({name:"CompObj",data:ms(),storage:p.name}),f.push({name:"VBFrame",data:Zt.encode(ds(p)),storage:p.name}),f.push({name:"f",data:fs(p),storage:p.name}),f.push({name:"o",data:xs(p),storage:p.name});return Mn(f)}_buildDirStream(t){let o=[],r=Zt.encode("VBAProject");o.push(...Tt(1,vt(1))),o.push(...Tt(2,vt(1033))),o.push(...Tt(20,vt(1033))),o.push(...Tt(3,we(1252))),o.push(...Tt(4,Array.from(r))),o.push(...Tt(5,[])),o.push(...Tt(64,[])),o.push(...Tt(6,[])),o.push(...Tt(61,[])),o.push(...Tt(7,vt(0))),o.push(...Tt(8,vt(0))),o.push(...we(9),...vt(4),...vt(1443),...we(2)),o.push(...Tt(12,[])),o.push(...Tt(60,[])),o.push(...Tt(15,we(t.length))),o.push(...Tt(19,we(65535)));for(let s of t){let i=Zt.encode(s.name),a=as(s.name);o.push(...Tt(25,Array.from(i))),o.push(...Tt(71,a)),o.push(...Tt(26,Array.from(i))),o.push(...Tt(50,a)),o.push(...Tt(28,[])),o.push(...Tt(72,[])),o.push(...Tt(49,vt(0))),o.push(...Tt(30,vt(0))),o.push(...Tt(44,we(65535))),s.type==="document"||s.type==="userform"?o.push(...Tt(34,[])):o.push(...Tt(33,[])),o.push(...Tt(43,[]))}return o.push(...Tt(16,[])),new Uint8Array(o)}_buildProjectText(t){let o=['ID="{00000000-0000-0000-0000-000000000000}"'],n=t.filter(s=>s.type==="document"),r=t.filter(s=>s.type!=="document");for(let s of n)o.push(`Document=${s.name}/&H00000000`);for(let s of r)s.type==="class"?o.push(`Class=${s.name}`):s.type==="userform"?(o.push("Package={AC9F2F90-E877-11CE-9F68-00AA00574A4F}"),o.push(`BaseClass=${s.name}`)):o.push(`Module=${s.name}`);o.push('Name="VBAProject"',"HelpContextID=0",'VersionCompatible32="393222000"',"","[Host Extender Info]","&H00000001={3832D640-CF90-11CF-8E43-00A0C911005A};VBE;&H00000000","","[Workspace]");for(let s of[...n,...r])o.push(`${s.name}=0, 0, 0, 0, C `);return o.join(`\r
|
|
195
|
+
`)+`\r
|
|
196
|
+
`}_buildProjectWm(t){let o=[];for(let n of t){for(let r of n.name)o.push(r.charCodeAt(0));o.push(0);for(let r of n.name){let s=r.charCodeAt(0);o.push(s&255,s>>8&255)}o.push(0,0)}return o.push(0),o}static fromBytes(t){let o=new e;o._raw=t;let n=Pn(t),r=new Map;for(let m of n){let d=m.storage?`${m.storage}/${m.name}`:m.name;r.set(d,m.data)}let s=r.get("VBA/dir");if(!s)return o;let i;try{i=Ho(s)}catch{return o}let a=new Set,l=new Set,h=r.get("PROJECT");if(h){let m=yo.decode(h);for(let d of m.split(/\r?\n/)){let f=d.match(/^Class=(.+)$/);f&&a.add(f[1]);let p=d.match(/^BaseClass=(.+)$/);p&&l.add(p[1])}}let c=ls(i);for(let m of c){let d=`VBA/${m.name}`,f=r.get(d);if(!f)continue;let p="";try{let x=f.subarray(m.offset),b=Ho(x);p=yo.decode(b)}catch{p=yo.decode(f.subarray(m.offset))}let g=cs(p),u=l.has(m.name)?"userform":a.has(m.name)?"class":m.type,$={name:m.name,type:u,code:g};if(u==="userform"){let x=new Map;for(let[y,v]of r)if(y.startsWith(m.name+"/")){let w=y.substring(m.name.length+1);x.set(w,v)}x.size>0&&($._formStreams=x);let b=`${m.name}/f`,F=r.get(b);F&&($.designerData=F)}o.modules.push($)}return o._dirty=!1,o}};function ls(e){let t=[],o=0,n=null;for(;o+6<=e.length;){let r=ss(e,o),s=En(e,o+2);if(o+=6,r===9){o+=6;continue}if(o+s>e.length)break;let i=e.subarray(o,o+s);switch(o+=s,r){case 25:n={name:yo.decode(i),type:"standard",offset:0};break;case 49:n&&i.length>=4&&(n.offset=En(i,0));break;case 33:n&&(n.type="standard");break;case 34:n&&(n.type="document");break;case 43:n?.name&&t.push(n),n=null;break}}return t}function cs(e){let t=e.split(/\r?\n/),o=t.findIndex(r=>!r.startsWith("Attribute "));return o<0?e:t.slice(o).join(`
|
|
197
|
+
`)}var hs="{C62A69F0-16DC-11CE-9E98-00AA00574A4F}",wo={Image:12,Frame:14,SpinButton:16,CommandButton:17,Label:21,TextBox:23,ListBox:24,ComboBox:25,CheckBox:26,OptionButton:27,ToggleButton:28,ScrollBar:47};function ms(){return new Uint8Array([1,0,254,255,3,10,0,0,255,255,255,255,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,25,0,0,0,77,105,99,114,111,115,111,102,116,32,70,111,114,109,115,32,50,46,48,32,70,111,114,109,0,16,0,0,0,69,109,98,101,100,100,101,100,32,79,98,106,101,99,116,0,0,0,0,0,244,57,178,113,0,0,0,0,0,0,0,0,0,0,0,0])}function ds(e){return["VERSION 5.00",`Begin ${hs} ${e.name} `,` Caption = "${e.name}"`," ClientHeight = 3015"," ClientLeft = 120"," ClientTop = 465"," ClientWidth = 4560"," StartUpPosition = 1 'CenterOwner"," TypeInfoVer = 2","End"].join(`\r
|
|
198
|
+
`)+`\r
|
|
199
|
+
`}function fs(e){let t=e.controls??[],o=t.length,n=t.map(F=>Bn(F)),r=[];r.push(0),r.push(4);let s=r.length;r.push(0,0);let i=8,a=1024,l=2048,h=1<<26,c=1<<27,m=i|a|l|h|c;r.push(m&255,m>>8&255,m>>16&255,m>>24&255),r.push(...vt(o+1)),r.push(...vt(0)),r.push(...vt(32e3));let d=200,f=120;for(let F of t){let y=(F.left??0)+(F.width??72),v=(F.top??0)+(F.height??24);y>d&&(d=y),v>f&&(f=v)}let p=(d+20)*26,g=(f+20)*26;r.push(...vt(p)),r.push(...vt(g)),r.push(...vt(0)),r.push(...vt(0));let u=r.length-4;r[s]=u&255,r[s+1]=u>>8&255,r.push(...we(0)),r.push(...vt(o));let $=r.length;r.push(0,0,0,0);let x=r.length;for(let F=0;F<o;F++)r.push(0),r.push(1);for(;(r.length-x)%4!==0;)r.push(0);for(let F=0;F<o;F++){let y=t[F],v=Zt.encode(y.name),w=wo[y.type]??wo.CommandButton;r.push(0,0);let R=r.length;r.push(0,0);let T=485;for(r.push(T&255,T>>8&255,T>>16&255,T>>24&255),r.push(...vt(v.length|2147483648)),r.push(...vt(F+1)),r.push(...vt(n[F].length)),r.push(F&255,F>>8&255),r.push(w&255,w>>8&255),r.push(...v);(r.length-x)%4!==0;)r.push(0);let S=(y.left??10+F*80)*26,M=(y.top??10+F*30)*26;r.push(...vt(S)),r.push(...vt(M));let D=r.length-R-2;r[R]=D&255,r[R+1]=D>>8&255}let b=r.length-x;return r[$]=b&255,r[$+1]=b>>8&255,r[$+2]=b>>16&255,r[$+3]=b>>24&255,new Uint8Array(r)}function Bn(e){let t=wo[e.type]??wo.CommandButton;return t===17?ps(e):t===21?us(e):gs(e)}function Go(e){e.push(0,2);let t=e.length;e.push(0,0),e.push(5,0,0,0);let o=Zt.encode("Tahoma");for(e.push(...vt(o.length|2147483648)),e.push(160,0,0,0),e.push(...o);e.length%4!==0;)e.push(0);let n=e.length-t-2;e[t]=n&255,e[t+1]=n>>8&255}function ps(e){let t=[],o=!!e.caption;t.push(0,2);let n=t.length;t.push(0,0);let r=32;if(o&&(r|=8),t.push(r&255,r>>8&255,r>>16&255,r>>24&255),o){let l=Zt.encode(e.caption);t.push(...vt(l.length|2147483648))}if(o){let l=Zt.encode(e.caption);for(t.push(...l);t.length%4!==0;)t.push(0)}let s=(e.width??72)*26,i=(e.height??24)*26;t.push(...vt(s)),t.push(...vt(i));let a=t.length-n-2;return t[n]=a&255,t[n+1]=a>>8&255,Go(t),new Uint8Array(t)}function us(e){let t=[],o=!!e.caption;t.push(0,2);let n=t.length;t.push(0,0);let r=32;if(o&&(r|=8),t.push(r&255,r>>8&255,r>>16&255,r>>24&255),o){let l=Zt.encode(e.caption);t.push(...vt(l.length|2147483648))}if(o){let l=Zt.encode(e.caption);for(t.push(...l);t.length%4!==0;)t.push(0)}let s=(e.width??80)*26,i=(e.height??18)*26;t.push(...vt(s)),t.push(...vt(i));let a=t.length-n-2;return t[n]=a&255,t[n+1]=a>>8&255,Go(t),new Uint8Array(t)}function gs(e){let t=[],o=!!e.caption;t.push(0,2);let n=t.length;t.push(0,0);let r=257;if(o&&(r|=1<<23),r|=1<<31,t.push(r&255,r>>8&255,r>>16&255,r>>>24&255),t.push(0,0,0,0),t.push(27,72,128,44),o){let l=Zt.encode(e.caption);t.push(...vt(l.length|2147483648))}let s=(e.width??72)*26,i=(e.height??24)*26;if(t.push(...vt(s)),t.push(...vt(i)),o){let l=Zt.encode(e.caption);for(t.push(...l);t.length%4!==0;)t.push(0)}let a=t.length-n-2;return t[n]=a&255,t[n+1]=a>>8&255,Go(t),new Uint8Array(t)}function xs(e){let t=e.controls??[];if(t.length===0)return new Uint8Array(0);let o=[];for(let i of t)o.push(Bn(i));let n=o.reduce((i,a)=>i+a.length,0),r=new Uint8Array(n),s=0;for(let i of o)r.set(i,s),s+=i.length;return r}var no=null;function $s(){if(no)return no;no=new Uint32Array(256);for(let e=0;e<256;e++){let t=e;for(let o=0;o<8;o++)t=t&1?3988292384^t>>>1:t>>>1;no[e]=t}return no}function ys(e){let t=$s(),o=4294967295;for(let n=0;n<e.length;n++)o=o>>>8^t[(o^e[n])&255];return(o^4294967295)>>>0}var bo=class{constructor(t=65536){this.pos=0,this.bits=0,this.bitLen=0,this.buf=new Uint8Array(t)}grow(){let t=new Uint8Array(this.buf.length*2);t.set(this.buf),this.buf=t}writeBits(t,o){for(this.bits|=(t&(1<<o)-1)<<this.bitLen,this.bitLen+=o;this.bitLen>=8;)this.pos>=this.buf.length&&this.grow(),this.buf[this.pos++]=this.bits&255,this.bits>>>=8,this.bitLen-=8}writeByte(t){this.pos>=this.buf.length&&this.grow(),this.buf[this.pos++]=t}flush(){this.bitLen>0&&(this.writeByte(this.bits&255),this.bits=0,this.bitLen=0)}toBytes(){return this.buf.subarray(0,this.pos)}};function qo(e,t){let o=e.length,n=new Uint8Array(o),r=[];for(let c=0;c<o;c++)e[c]>0&&r.push(c);if(r.length===0)return n;if(r.length===1)return n[r[0]]=1,n;let s=r.map(c=>({freq:e[c],sym:c})),i=(c,m,d)=>{for(;;){let f=m,p=2*m+1,g=2*m+2;if(p<d&&c[p].freq<c[f].freq&&(f=p),g<d&&c[g].freq<c[f].freq&&(f=g),f===m)break;let u=c[m];c[m]=c[f],c[f]=u,m=f}},a=(c,m)=>{for(;m>0;){let d=m-1>>1;if(c[d].freq<=c[m].freq)break;let f=c[m];c[m]=c[d],c[d]=f,m=d}};for(let c=(s.length>>1)-1;c>=0;c--)i(s,c,s.length);let l=s.length;for(;l>1;){let c=s[0];s[0]=s[--l],i(s,0,l);let m=s[0];s[0]={freq:c.freq+m.freq,sym:-1,left:c,right:m},i(s,0,l)}let h=(c,m)=>{if(c){if(c.sym>=0){n[c.sym]=Math.min(m,t);return}h(c.left,m+1),h(c.right,m+1)}};h(s[0],0);{let c=()=>{let f=0;for(let p=0;p<o;p++)n[p]>0&&(f+=1<<t-n[p]);return f},m=1<<t,d=c();if(d>m){let f=d-m;for(let p=t-1;p>=1&&f>0;p--){let g=1<<t-p-1;for(let u=0;u<o&&f>0;u++)n[u]===p&&(n[u]=p+1,f-=g)}}for(d=c();d<m;){let f=!1;for(let p=0;p<o;p++)if(n[p]===t){n[p]--,d++,f=!0;break}if(!f)break}}return n}function ro(e){let t=Math.max(...e),o=new Uint32Array(t+1);for(let i of e)i>0&&o[i]++;let n=new Uint32Array(t+1),r=0;for(let i=1;i<=t;i++)r=r+o[i-1]<<1,n[i]=r;let s=new Uint32Array(e.length);for(let i=0;i<e.length;i++)e[i]>0&&(s[i]=n[e[i]]++);return s}function he(e,t){let o=0;for(let n=0;n<t;n++)o=o<<1|e&1,e>>=1;return o}function ws(){let e=new Uint8Array(288);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return e}function bs(){let e=new Uint8Array(32);return e.fill(5),e}var Cs=[0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0],Fs=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258,0,0],vs=[0,0,0,0,1,1,2,2,3,3,4,4,5,5,6,6,7,7,8,8,9,9,10,10,11,11,12,12,13,13],Ss=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],Yo=new Array(259);for(let e=0;e<29;e++){let t=Fs[e],o=Cs[e];for(let n=t;n<t+(1<<o);n++)n<=258&&(Yo[n]=[257+e,o,n-t])}Yo[258]=[285,0,0];function _n(e){return Yo[e]}var Xn=new Array(32769);for(let e=0;e<30;e++){let t=Ss[e],o=vs[e];for(let n=t;n<t+(1<<o);n++)n<=32768&&(Xn[n]=[e,o,n-t])}function jn(e){return Xn[e]}var ce=32768,Ko=258,On=3,Is=8,Ts=32,ks=128;function As(e,t){let o=t<=1?Is:t<=6?Ts:ks,n=e.length,r=Math.min(n+1,65536),s=new Uint16Array(r),i=new Uint16Array(r),a=0,l=()=>{if(a>=r){r=r*2;let u=new Uint16Array(r);u.set(s),s=u;let $=new Uint16Array(r);$.set(i),i=$}},h=65536,c=new Int32Array(h).fill(-1),m=new Int32Array(Math.min(n,ce)).fill(-1),d=u=>((e[u]*4129^e[u+1]*155^e[u+2])&h-1)>>>0,f=0,p=u=>{l(),s[a]=u+1,i[a]=0,a++},g=(u,$)=>{l(),s[a]=u,i[a]=$,a++};for(;f<n;){if(f+2>=n){p(e[f++]);continue}let u=d(f),$=On-1,x=0,b=c[u],F=0;for(;b>=0&&F<o;){let y=f-b;if(y>ce)break;let v=0,w=Math.min(Ko,n-f);for(;v<w&&e[b+v]===e[f+v];)v++;if(v>$&&($=v,x=y),$===Ko)break;b=m[b&ce-1],F++}if(m[f&ce-1]=c[u],c[u]=f,$>=On){if(t>=6&&f+3<n){let y=d(f+1),v=c[y],w=0,R=0,T=0;for(;v>=0&&T<o;){let S=f+1-v;if(S>ce)break;let M=0,D=Math.min(Ko,n-f-1);for(;M<D&&e[v+M]===e[f+1+M];)M++;M>w&&(w=M,R=S),v=m[v&ce-1],T++}if(w>$+1){p(e[f]),f++,m[f&ce-1]=c[y],c[y]=f,g(w,R);for(let S=1;S<w;S++)if(f++,f+2<n){let M=d(f);m[f&ce-1]=c[M],c[M]=f}f++;continue}}g($,x);for(let y=0;y<$;y++)if(f+y+2<n){let v=d(f+y);m[f+y&ce-1]=c[v],c[v]=f+y}f+=$}else p(e[f++])}return{litLen:s,dist:i,count:a}}function Ds(e,t,o,n){let r=0;for(;r<e.length;){let s=e[r];if(s===0){let i=0;for(;r+i<e.length&&e[r+i]===0&&i<138;)i++;i<3?(t.writeBits(he(o[0],n[0]),n[0]),r++):i<=10?(t.writeBits(he(o[17],n[17]),n[17]),t.writeBits(i-3,3),r+=i):(t.writeBits(he(o[18],n[18]),n[18]),t.writeBits(i-11,7),r+=i)}else{t.writeBits(he(o[s],n[s]),n[s]),r++;let i=0;for(;r+i<e.length&&e[r+i]===s&&i<6;)i++;i>=3&&(t.writeBits(he(o[16],n[16]),n[16]),t.writeBits(i-3,2),r+=i)}}}function Ln(e,t,o,n){let r=new Uint32Array(286),s=new Uint32Array(30);r[256]=1;let{litLen:i,dist:a,count:l}=e;for(let p=0;p<l;p++)if(a[p]===0)r[i[p]-1]++;else{let[g]=_n(i[p]);r[g]++;let[u]=jn(a[p]);s[u]++}let h,c,m,d;if(n){h=qo(r,15),c=qo(s,15),c.every(v=>v===0)&&(c[0]=1),m=ro(h),d=ro(c);let p=Nn(h,257,286)+1,g=Nn(c,1,30)+1,u=[...h.subarray(0,p),...c.subarray(0,g)],$=new Uint32Array(19);Ps(u,$);let x=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15],b=qo($,7),F=ro(b),y=Rs(x.map(v=>b[v]),4,19)+1;t.writeBits(o?1:0,1),t.writeBits(2,2),t.writeBits(p-257,5),t.writeBits(g-1,5),t.writeBits(y-4,4);for(let v=0;v<y;v++)t.writeBits(b[x[v]],3);Ds(u,t,F,b)}else h=ws(),c=bs(),m=ro(h),d=ro(c),t.writeBits(o?1:0,1),t.writeBits(1,2);for(let p=0;p<l;p++)if(a[p]===0){let g=i[p]-1,u=h[g];t.writeBits(he(m[g],u),u)}else{let[g,u,$]=_n(i[p]),x=h[g];t.writeBits(he(m[g],x),x),u>0&&t.writeBits($,u);let[b,F,y]=jn(a[p]),v=c[b];t.writeBits(he(d[b],v),v),F>0&&t.writeBits(y,F)}let f=h[256];t.writeBits(he(m[256],f),f)}function Nn(e,t,o){let n=t-1;for(let r=t;r<Math.min(e.length,o);r++)e[r]>0&&(n=r);return Math.max(n,t-1)}function Rs(e,t,o){let n=t-1;for(let r=t;r<Math.min(e.length,o);r++)e[r]>0&&(n=r);return Math.max(n,t-1)}function Ps(e,t){let o=0;for(;o<e.length;){let n=e[o];if(n===0){let r=0;for(;o+r<e.length&&e[o+r]===0&&r<138;)r++;r<3?(t[0]++,o++):r<=10?(t[17]++,o+=r):(t[18]++,o+=r)}else{t[n]++,o++;let r=0;for(;o+r<e.length&&e[o+r]===n&&r<6;)r++;r>=3&&(t[16]++,o+=r)}}}var Zo=65536;function Qo(e,t=6){if(t===0){let i=new bo,a=0;for(;a<e.length||e.length===0;){let l=Math.min(Zo,e.length-a),h=a+l>=e.length;i.flush(),i.writeBits(h?1:0,1),i.writeBits(0,2),i.flush();let c=l;for(i.writeByte(c&255),i.writeByte(c>>8&255),i.writeByte(~c&255),i.writeByte(~c>>8&255);i.pos+l>i.buf.length;)i.buf=(()=>{let m=new Uint8Array(i.buf.length*2);return m.set(i.buf),m})();if(i.buf.set(e.subarray(a,a+l),i.pos),i.pos+=l,a+=l,e.length===0)break}return i.toBytes()}let o=Math.max(1,Math.min(9,t)),n=o>=2,r=new bo,s=0;for(;s<e.length||e.length===0;){let i=e.subarray(s,s+Zo),a=s+Zo>=e.length,l=As(i,o);if(Ln(l,r,a,n),s+=i.length,e.length===0){Ln({litLen:new Uint16Array(0),dist:new Uint16Array(0),count:0},r,!0,n);break}}return r.flush(),r.toBytes()}function Mt(e,t,o){e[t]=o&255,e[t+1]=o>>8&255}function Yt(e,t,o){e[t]=o&255,e[t+1]=o>>8&255,e[t+2]=o>>16&255,e[t+3]=o>>24&255}var Ms=new TextEncoder,Es=new Set(["png","jpg","jpeg","gif","tiff","emf","wmf","bmp","webp"]);function Jo(e,t={}){let o=t.level??6,n=t.noCompress?new Set(t.noCompress.map(p=>p.toLowerCase())):Es,r=[],s=[],i=0;for(let p of e){let g=Ms.encode(p.name),u=p.name.split(".").pop()?.toLowerCase()??"",$=p.level??(n.has(u)?0:o),x=$>0&&p.data.length>0,b=ys(p.data),F,y;x?(F=Qo(p.data,$),F.length>=p.data.length?(F=p.data,y=0):y=8):(F=p.data,y=0);let v=new Uint8Array(30+g.length);Yt(v,0,67324752),Mt(v,4,20),Mt(v,6,0),Mt(v,8,y),Mt(v,10,0),Mt(v,12,0),Yt(v,14,b),Yt(v,18,F.length),Yt(v,22,p.data.length),Mt(v,26,g.length),Mt(v,28,0),v.set(g,30);let w=new Uint8Array(46+g.length);Yt(w,0,33639248),Mt(w,4,20),Mt(w,6,20),Mt(w,8,0),Mt(w,10,y),Mt(w,12,0),Mt(w,14,0),Yt(w,16,b),Yt(w,20,F.length),Yt(w,24,p.data.length),Mt(w,28,g.length),Mt(w,30,0),Mt(w,32,0),Mt(w,34,0),Mt(w,36,0),Yt(w,38,0),Yt(w,42,i),w.set(g,46),r.push(v,F),s.push(w),i+=v.length+F.length}let a=i,l=s.reduce((p,g)=>p+g.length,0),h=new Uint8Array(22);Yt(h,0,101010256),Mt(h,4,0),Mt(h,6,0),Mt(h,8,s.length),Mt(h,10,s.length),Yt(h,12,l),Yt(h,16,a),Mt(h,20,0);let c=[...r,...s,h],m=c.reduce((p,g)=>p+g.length,0),d=new Uint8Array(m),f=0;for(let p of c)d.set(p,f),f+=p.length;return d}function Ae(e,t){return e[t]|e[t+1]<<8}function Ve(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}async function Bs(e){let t=new DecompressionStream("deflate-raw"),o=t.writable.getWriter(),n=t.readable.getReader();o.write(e),o.close();let r=[],s=!1;for(;!s;){let{value:h,done:c}=await n.read();h&&r.push(h),s=c}let i=r.reduce((h,c)=>h+c.length,0),a=new Uint8Array(i),l=0;for(let h of r)a.set(h,l),l+=h.length;return a}async function tn(e){let t=new TextDecoder("utf-8"),o=new Map,n=-1;for(let a=e.length-22;a>=0;a--)if(e[a]===80&&e[a+1]===75&&e[a+2]===5&&e[a+3]===6){n=a;break}if(n<0)throw new Error("Not a valid ZIP file (EOCD not found)");let r=Ve(e,n+16),s=Ae(e,n+8),i=r;for(let a=0;a<s;a++){if(Ve(e,i)!==33639248)throw new Error("Invalid central directory entry");let l=Ae(e,i+10),h=Ve(e,i+20),c=Ve(e,i+24),m=Ae(e,i+28),d=Ae(e,i+30),f=Ae(e,i+32),p=Ve(e,i+42),g=e.subarray(i+46,i+46+m),u=t.decode(g);i+=46+m+d+f;let $=p;if(Ve(e,$)!==67324752)throw new Error("Invalid local file header");let x=Ae(e,$+26),b=Ae(e,$+28),F=$+30+x+b,y=e.subarray(F,F+h),v;l===0?v=y.slice():l===8?v=await Bs(y):v=y.slice(),u.endsWith("/")||o.set(u,{name:u,data:v})}return o}function Co(e){return new TextDecoder("utf-8").decode(e.data)}function so(e){let t=Object.entries(e.attrs).map(([r,s])=>`${r}="${_s(s)}"`).join(" "),o=t?`<${e.tag} ${t}`:`<${e.tag}`,n=(e.text??"")+e.children.map(so).join("");return n?`${o}>${n}</${e.tag}>`:`${o}/>`}function _s(e){return e.replace(/&/g,"&").replace(/"/g,""").replace(/</g,"<").replace(/>/g,">")}function Lt(e){let t=[],o=[],n=0;for(e.startsWith("<?")&&(n=e.indexOf("?>")+2);n<e.length;){if(e[n]!=="<"){let m=e.indexOf("<",n),d=m<0?e.slice(n):e.slice(n,m);if(o.length&&d.trim()){let f=o[o.length-1];f.text=(f.text??"")+Un(d)}n=m<0?e.length:m;continue}if(e.startsWith("<!--",n)){let m=e.indexOf("-->",n);if(o.length){let d=o[o.length-1];d.text=(d.text??"")+e.slice(n,m+3)}n=m+3;continue}if(e.startsWith("<![CDATA[",n)){let m=e.indexOf("]]>",n),d=e.slice(n+9,m);if(o.length){let f=o[o.length-1];f.text=(f.text??"")+d}n=m+3;continue}if(e[n+1]==="/"){let m=e.indexOf(">",n),d=o.pop();o.length?o[o.length-1].children.push(d):t.push(d),n=m+1;continue}if(e[n+1]==="?"){n=e.indexOf("?>",n)+2;continue}let r=js(e,n),s=e.slice(n+1,r),i=s.endsWith("/"),a=i?s.slice(0,-1).trim():s.trim(),{tag:l,attrs:h}=Os(a),c={tag:l,attrs:h,children:[]};i?o.length?o[o.length-1].children.push(c):t.push(c):o.push(c),n=r+1}for(;o.length>1;){let r=o.pop();o[o.length-1].children.push(r)}if(o.length===1&&t.push(o[0]),t.length===0)throw new Error("Empty XML document");return t[0]}function js(e,t){let o=null;for(let n=t+1;n<e.length;n++){let r=e[n];if(o)r===o&&(o=null);else if(r==='"'||r==="'")o=r;else if(r===">")return n}return e.length-1}function Os(e){let t={},o=e.search(/\s/),n=o<0?e:e.slice(0,o);if(o<0)return{tag:n,attrs:t};let r=e.slice(o),s=/(\S+?)\s*=\s*(?:"([^"]*)"|'([^']*)')/g,i;for(;(i=s.exec(r))!==null;)t[i[1]]=Un(i[2]??i[3]??"");return{tag:n,attrs:t}}function Un(e){return e.replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,'"').replace(/'/g,"'").replace(/&#(\d+);/g,(t,o)=>String.fromCharCode(parseInt(o,10))).replace(/&#x([0-9a-fA-F]+);/g,(t,o)=>String.fromCharCode(parseInt(o,16)))}function B(e,t){return e.children.find(o=>ct(o.tag)===t)}function ut(e,t){return e.children.filter(o=>ct(o.tag)===t)}function Vn(e,t){if(e.attrs[t]!==void 0)return e.attrs[t];let o=ct(t);for(let[n,r]of Object.entries(e.attrs))if(ct(n)===o)return r}function ct(e){let t=e.indexOf(":");return t<0?e:e.slice(t+1)}function Ls(e){return e.toISOString()}function en(e){let t=(n,r)=>r!==void 0?`<${n}>${I(r)}</${n}>`:"",o=(n,r)=>r?`<${n} xsi:type="dcterms:W3CDTF">${Ls(r)}</${n}>`:"";return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
136
200
|
<cp:coreProperties
|
|
137
201
|
xmlns:cp="http://schemas.openxmlformats.org/package/2006/metadata/core-properties"
|
|
138
202
|
xmlns:dc="http://purl.org/dc/elements/1.1/"
|
|
139
203
|
xmlns:dcterms="http://purl.org/dc/terms/"
|
|
140
204
|
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
|
|
141
|
-
${t("dc:title",
|
|
142
|
-
${t("dc:subject",
|
|
143
|
-
${t("dc:creator",
|
|
144
|
-
${t("cp:keywords",
|
|
145
|
-
${t("dc:description",
|
|
146
|
-
${t("cp:lastModifiedBy",
|
|
147
|
-
${t("cp:revision",
|
|
148
|
-
${t("dc:language",
|
|
149
|
-
${t("dc:identifier",
|
|
150
|
-
${t("cp:version",
|
|
151
|
-
${t("cp:category",
|
|
152
|
-
${t("cp:contentStatus",
|
|
153
|
-
${
|
|
154
|
-
${
|
|
155
|
-
</cp:coreProperties>`}function
|
|
205
|
+
${t("dc:title",e.title)}
|
|
206
|
+
${t("dc:subject",e.subject)}
|
|
207
|
+
${t("dc:creator",e.creator)}
|
|
208
|
+
${t("cp:keywords",e.keywords)}
|
|
209
|
+
${t("dc:description",e.description)}
|
|
210
|
+
${t("cp:lastModifiedBy",e.lastModifiedBy)}
|
|
211
|
+
${t("cp:revision",e.revision??"1")}
|
|
212
|
+
${t("dc:language",e.language)}
|
|
213
|
+
${t("dc:identifier",e.identifier)}
|
|
214
|
+
${t("cp:version",e.version)}
|
|
215
|
+
${t("cp:category",e.category)}
|
|
216
|
+
${t("cp:contentStatus",e.contentStatus)}
|
|
217
|
+
${o("dcterms:created",e.created??new Date)}
|
|
218
|
+
${o("dcterms:modified",e.modified??new Date)}
|
|
219
|
+
</cp:coreProperties>`}function on(e,t){let o=(s,i)=>i!==void 0?`<${s}>${I(String(i))}</${s}>`:"",n="",r="";if(e.headingPairs?.length){let s=e.headingPairs.map(i=>`<vt:variant><vt:lpstr>${I(i.name)}</vt:lpstr></vt:variant><vt:variant><vt:i4>${i.count}</vt:i4></vt:variant>`).join("");n=`<HeadingPairs><vt:vector size="${e.headingPairs.length*2}" baseType="variant">${s}</vt:vector></HeadingPairs>`}if(e.titlesOfParts?.length){let s=e.titlesOfParts.map(i=>`<vt:lpstr>${I(i)}</vt:lpstr>`).join("");r=`<TitlesOfParts><vt:vector size="${e.titlesOfParts.length}" baseType="lpstr">${s}</vt:vector></TitlesOfParts>`}return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
156
220
|
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/extended-properties"
|
|
157
221
|
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
158
|
-
${
|
|
159
|
-
${
|
|
160
|
-
${
|
|
161
|
-
${
|
|
162
|
-
${
|
|
163
|
-
${
|
|
164
|
-
${
|
|
165
|
-
${
|
|
166
|
-
${
|
|
167
|
-
${
|
|
168
|
-
${
|
|
169
|
-
${
|
|
170
|
-
${
|
|
171
|
-
${
|
|
172
|
-
${
|
|
173
|
-
${
|
|
174
|
-
${
|
|
175
|
-
${
|
|
176
|
-
${
|
|
177
|
-
${
|
|
178
|
-
${
|
|
179
|
-
${
|
|
180
|
-
${
|
|
222
|
+
${o("Application",e.application??"ExcelForge")}
|
|
223
|
+
${o("AppVersion",e.appVersion)}
|
|
224
|
+
${o("Company",e.company)}
|
|
225
|
+
${o("Manager",e.manager)}
|
|
226
|
+
${o("DocSecurity",e.docSecurity??0)}
|
|
227
|
+
${o("ScaleCrop",e.scaleCrop??!1)}
|
|
228
|
+
${o("LinksUpToDate",e.linksUpToDate??!1)}
|
|
229
|
+
${o("SharedDoc",e.sharedDoc??!1)}
|
|
230
|
+
${o("HyperlinksChanged",e.hyperlinksChanged??!1)}
|
|
231
|
+
${o("Characters",e.characters)}
|
|
232
|
+
${o("CharactersWithSpaces",e.charactersByWord)}
|
|
233
|
+
${o("Words",e.words)}
|
|
234
|
+
${o("Lines",e.lines)}
|
|
235
|
+
${o("Paragraphs",e.paragraphs)}
|
|
236
|
+
${o("Pages",e.pages)}
|
|
237
|
+
${o("Slides",e.slides)}
|
|
238
|
+
${o("Notes",e.notes)}
|
|
239
|
+
${o("HiddenSlides",e.hiddenSlides)}
|
|
240
|
+
${o("MMClips",e.mmClips)}
|
|
241
|
+
${o("Template",e.template)}
|
|
242
|
+
${o("PresentationFormat",e.presentationFormat)}
|
|
243
|
+
${o("TotalTime",e.totalTime)}
|
|
244
|
+
${o("HyperlinkBase",e.hyperlinkBase)}
|
|
245
|
+
${n}
|
|
181
246
|
${r}
|
|
182
|
-
${o}
|
|
183
247
|
${t??""}
|
|
184
|
-
</Properties>`}function
|
|
248
|
+
</Properties>`}function nn(e){let t=2;return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
185
249
|
<Properties xmlns="http://schemas.openxmlformats.org/officeDocument/2006/custom-properties"
|
|
186
250
|
xmlns:vt="http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes">
|
|
187
|
-
${
|
|
251
|
+
${e.map(n=>{let r,s=n.value;switch(s.type){case"string":r=`<vt:lpwstr>${I(s.value)}</vt:lpwstr>`;break;case"int":r=`<vt:i4>${s.value}</vt:i4>`;break;case"decimal":r=`<vt:decimal>${s.value}</vt:decimal>`;break;case"bool":r=`<vt:bool>${s.value}</vt:bool>`;break;case"date":r=`<vt:filetime>${s.value.toISOString()}</vt:filetime>`;break;case"r8":r=`<vt:r8>${s.value}</vt:r8>`;break;case"i8":r=`<vt:i8>${s.value}</vt:i8>`;break;case"error":r=`<vt:error>${I(s.value)}</vt:error>`;break;default:r="<vt:lpwstr></vt:lpwstr>";break}return`<property fmtid="{D5CDD505-2E9C-101B-9397-08002B2CF9AE}" pid="${t++}" name="${I(n.name)}">${r}</property>`}).join(`
|
|
188
252
|
`)}
|
|
189
|
-
</Properties>`}function
|
|
190
|
-
`);return{props:{application:e("Application"),appVersion:e("AppVersion"),company:e("Company"),manager:e("Manager"),docSecurity:r("DocSecurity"),scaleCrop:o("ScaleCrop"),linksUpToDate:o("LinksUpToDate"),sharedDoc:o("SharedDoc"),hyperlinksChanged:o("HyperlinksChanged"),characters:r("Characters"),charactersByWord:r("CharactersWithSpaces"),words:r("Words"),lines:r("Lines"),paragraphs:r("Paragraphs"),pages:r("Pages"),slides:r("Slides"),notes:r("Notes"),hiddenSlides:r("HiddenSlides"),mmClips:r("MMClips"),template:e("Template"),presentationFormat:e("PresentationFormat"),totalTime:r("TotalTime"),hyperlinkBase:e("HyperlinkBase"),headingPairs:n,titlesOfParts:l},unknownRaw:m}}function Qt(s){return U(s).children.filter(e=>O(e.tag)==="property").map(e=>{let r=e.attrs.name??"",o=e.children[0];if(!o)return null;let n=O(o.tag),i=o.text??"",l;switch(n){case"lpwstr":case"lpstr":case"bstr":l={type:"string",value:i};break;case"i4":case"int":l={type:"int",value:parseInt(i,10)};break;case"decimal":l={type:"decimal",value:parseFloat(i)};break;case"bool":l={type:"bool",value:i==="true"||i==="1"};break;case"filetime":l={type:"date",value:new Date(i)};break;case"r8":l={type:"r8",value:parseFloat(i)};break;case"i8":l={type:"i8",value:BigInt(i)};break;case"error":l={type:"error",value:i};break;default:l={type:"string",value:i};break}return{name:r,value:l}}).filter(Boolean)}function Yt(s){let t=new Map;try{let e=U(s);for(let r of e.children)O(r.tag)==="Relationship"&&t.set(r.attrs.Id??"",{type:r.attrs.Type??"",target:r.attrs.Target??""})}catch{}return t}function Xe(s){let t=new Map;try{let e=U(s);for(let r of e.children)if(O(r.tag)==="Override"){let n=r.attrs.PartName??"",i=r.attrs.ContentType??"";t.set(n.startsWith("/")?n.slice(1):n,i)}}catch{}return t}function Le(s){let t=U(s),e=new Map,r=[],o={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"mm-dd-yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"},n=q(t,"numFmts");if(n)for(let h of _(n,"numFmt")){let u=parseInt(h.attrs.numFmtId??"0",10),$=h.attrs.formatCode??"";e.set(u,$)}let i=q(t,"fonts"),l=[];if(i)for(let h of _(i,"font"))l.push(Be(h));let c=q(t,"fills"),a=[];if(c)for(let h of _(c,"fill"))a.push(Ae(h));let d=q(t,"borders"),m=[];if(d)for(let h of _(d,"border"))m.push(_e(h));let p=q(t,"cellXfs");if(p)for(let h of _(p,"xf")){let u=parseInt(h.attrs.fontId??"0",10),$=parseInt(h.attrs.fillId??"0",10),x=parseInt(h.attrs.borderId??"0",10),y=parseInt(h.attrs.numFmtId??"0",10),b=h.attrs.applyFont==="1",F=h.attrs.applyFill==="1",I=h.attrs.applyBorder==="1",X=h.attrs.applyAlignment==="1",T=h.attrs.applyNumberFormat==="1",v=h.attrs.applyProtection==="1",f={};b&&l[u]&&(f.font=l[u]),F&&a[$]&&(f.fill=a[$]),I&&m[x]&&(f.border=m[x]),T&&y!==0&&(e.has(y)?f.numberFormat={formatCode:e.get(y)}:o[y]&&(f.numFmtId=y));let w=S(h,"alignment");X&&w&&(f.alignment=Oe(w));let D=S(h,"protection");v&&D&&(D.attrs.locked!==void 0&&(f.locked=D.attrs.locked!=="0"),D.attrs.hidden!==void 0&&(f.hidden=D.attrs.hidden!=="0")),r.push(f)}return{xfs:r,numFmts:e}}function q(s,t){if(O(s.tag)===t)return s;for(let e of s.children){let r=q(e,t);if(r)return r}}function Be(s){let t={};for(let e of s.children)switch(O(e.tag)){case"b":t.bold=e.attrs.val!=="0";break;case"i":t.italic=e.attrs.val!=="0";break;case"strike":t.strike=e.attrs.val!=="0";break;case"u":t.underline=e.attrs.val??"single";break;case"sz":t.size=parseFloat(e.attrs.val??"11");break;case"name":t.name=e.attrs.val;break;case"family":t.family=parseInt(e.attrs.val??"0",10);break;case"scheme":t.scheme=e.attrs.val;break;case"charset":t.charset=parseInt(e.attrs.val??"0",10);break;case"vertAlign":t.vertAlign=e.attrs.val;break;case"color":{let r=e.attrs.rgb??e.attrs.theme;r&&(t.color=r);break}}return t}function Ae(s){let t=S(s,"patternFill");if(t){let r=S(t,"fgColor"),o=S(t,"bgColor");return{type:"pattern",pattern:t.attrs.patternType??"none",fgColor:r?.attrs.rgb??r?.attrs.theme,bgColor:o?.attrs.rgb??o?.attrs.theme}}let e=S(s,"gradientFill");if(e){let r=_(e,"stop").concat(_(e,"gradientStop")).map(o=>{let n=S(o,"color");return{position:parseFloat(o.attrs.position??"0"),color:n?.attrs.rgb??n?.attrs.theme??"FF000000"}});return{type:"gradient",gradientType:e.attrs.type,degree:e.attrs.degree?parseFloat(e.attrs.degree):void 0,stops:r}}return{type:"pattern",pattern:"none"}}function _e(s){let t=e=>{let r=S(s,e);if(!r)return;let o=r.attrs.style,n=S(r,"color");if(!(!o&&!n))return{style:o,color:n?.attrs.rgb}};return{left:t("left"),right:t("right"),top:t("top"),bottom:t("bottom"),diagonal:t("diagonal"),diagonalUp:s.attrs.diagonalUp==="1",diagonalDown:s.attrs.diagonalDown==="1"}}function Oe(s){let t={};return s.attrs.horizontal&&(t.horizontal=s.attrs.horizontal),s.attrs.vertical&&(t.vertical=s.attrs.vertical),s.attrs.wrapText&&(t.wrapText=s.attrs.wrapText!=="0"),s.attrs.shrinkToFit&&(t.shrinkToFit=s.attrs.shrinkToFit!=="0"),s.attrs.textRotation&&(t.textRotation=parseInt(s.attrs.textRotation,10)),s.attrs.indent&&(t.indent=parseInt(s.attrs.indent,10)),s.attrs.readingOrder&&(t.readingOrder=parseInt(s.attrs.readingOrder,10)),t}function Ne(s){let t=U(s);return _(t,"si").map(e=>{let r=S(e,"t");return r&&!S(e,"r")?r.text??"":_(e,"r").map(o=>S(o,"t")?.text??"").join("")})}function je(s,t,e,r){let o=new J(t),n=U(s),i=[],l=[],c=new Set(["sheetPr","dimension","sheetViews","sheetFormatPr","cols","sheetData","mergeCells","conditionalFormatting","dataValidations","sheetProtection","printOptions","pageMargins","pageSetup","headerFooter","drawing","tableParts","autoFilter","rowBreaks","colBreaks","picture","oleObjects","ctrlProps"]);for(let a of n.children){let d=O(a.tag);switch(d){case"sheetViews":Me(a,o);break;case"cols":Ee(a,o,e);break;case"sheetData":We(a,o,e,r);break;case"mergeCells":Ue(a,o);break;case"autoFilter":o.autoFilter={ref:a.attrs.ref??""};break;case"tableParts":for(let m of _(a,"tablePart")){let p=m.attrs["r:id"]??"";p&&l.push(p)}break;case"sheetProtection":ze(a,o);break;case"pageMargins":He(a,o);break;case"pageSetup":Ve(a,o);break;case"headerFooter":Ge(a,o);break;case"printOptions":qe(a,o);break;default:c.has(d)||i.push(It(a));break}}return{ws:o,originalXml:s,unknownParts:i,tableRIds:l}}function Me(s,t){let e=_(s,"sheetView")[0];if(!e)return;t.view={showGridLines:e.attrs.showGridLines!=="0",showRowColHeaders:e.attrs.showRowColHeaders!=="0",zoomScale:e.attrs.zoomScale?parseInt(e.attrs.zoomScale,10):void 0,rightToLeft:e.attrs.rightToLeft==="1",tabSelected:e.attrs.tabSelected==="1",view:e.attrs.view};let r=S(e,"pane");r&&r.attrs.state==="frozen"&&(t.freezePane={col:r.attrs.xSplit?parseInt(r.attrs.xSplit,10):void 0,row:r.attrs.ySplit?parseInt(r.attrs.ySplit,10):void 0})}function Ee(s,t,e){for(let r of _(s,"col")){let o=parseInt(r.attrs.min??"1",10),n=parseInt(r.attrs.max??"1",10),i={width:r.attrs.width?parseFloat(r.attrs.width):void 0,hidden:r.attrs.hidden==="1",customWidth:r.attrs.customWidth==="1",outlineLevel:r.attrs.outlineLevel?parseInt(r.attrs.outlineLevel,10):void 0,style:r.attrs.style?e.xfs[parseInt(r.attrs.style,10)]:void 0};for(let l=o;l<=n;l++)t.setColumn(l,i)}}function We(s,t,e,r){for(let o of _(s,"row")){let n=parseInt(o.attrs.r??"0",10);if(!n)continue;let i={};o.attrs.ht&&(i.height=parseFloat(o.attrs.ht)),o.attrs.hidden&&(i.hidden=o.attrs.hidden==="1"),o.attrs.outlineLevel&&(i.outlineLevel=parseInt(o.attrs.outlineLevel,10)),o.attrs.collapsed&&(i.collapsed=o.attrs.collapsed==="1"),o.attrs.s&&(i.style=e.xfs[parseInt(o.attrs.s,10)]),Object.keys(i).length&&t.setRow(n,i);for(let l of _(o,"c")){let c=l.attrs.r??"";if(!c)continue;let{row:a,col:d}=H(c),m=l.attrs.s?parseInt(l.attrs.s,10):0,p=m>0?e.xfs[m]:void 0,h=l.attrs.t??"",u=S(l,"f"),$=S(l,"v"),x={};if(p&&(x.style=p),u)u.attrs.t==="array"?x.arrayFormula=u.text??"":x.formula=u.text??"";else if($){let y=$.text??"";switch(h){case"s":{let b=parseInt(y,10);x.value=r[b]??"";break}case"b":x.value=y==="1"||y==="true";break;case"str":case"inlineStr":{let b=S(l,"is");x.value=b?S(b,"t")?.text??y:y;break}case"e":x.value=y;break;default:{let b=parseFloat(y);x.value=isNaN(b)?y:b;break}}}(Object.keys(x).length||x.value!==void 0)&&t.setCell(a,d,x)}}}function Ue(s,t){for(let e of _(s,"mergeCell")){let r=e.attrs.ref??"";r.includes(":")&&t.mergeByRef(r)}}function ze(s,t){t.protection={sheet:s.attrs.sheet!=="0",password:void 0,selectLockedCells:s.attrs.selectLockedCells!=="0",selectUnlockedCells:s.attrs.selectUnlockedCells!=="0",formatCells:s.attrs.formatCells==="0",formatColumns:s.attrs.formatColumns==="0",formatRows:s.attrs.formatRows==="0",insertColumns:s.attrs.insertColumns==="0",insertRows:s.attrs.insertRows==="0",insertHyperlinks:s.attrs.insertHyperlinks==="0",deleteColumns:s.attrs.deleteColumns==="0",deleteRows:s.attrs.deleteRows==="0",sort:s.attrs.sort==="0",autoFilter:s.attrs.autoFilter==="0",pivotTables:s.attrs.pivotTables==="0"}}function He(s,t){t.pageMargins={left:parseFloat(s.attrs.left??"0.7"),right:parseFloat(s.attrs.right??"0.7"),top:parseFloat(s.attrs.top??"0.75"),bottom:parseFloat(s.attrs.bottom??"0.75"),header:parseFloat(s.attrs.header??"0.3"),footer:parseFloat(s.attrs.footer??"0.3")}}function Ve(s,t){t.pageSetup={paperSize:s.attrs.paperSize?parseInt(s.attrs.paperSize,10):void 0,orientation:s.attrs.orientation,fitToPage:s.attrs.fitToPage==="1",fitToWidth:s.attrs.fitToWidth?parseInt(s.attrs.fitToWidth,10):void 0,fitToHeight:s.attrs.fitToHeight?parseInt(s.attrs.fitToHeight,10):void 0,scale:s.attrs.scale?parseInt(s.attrs.scale,10):void 0,horizontalDpi:s.attrs.horizontalDpi?parseInt(s.attrs.horizontalDpi,10):void 0,verticalDpi:s.attrs.verticalDpi?parseInt(s.attrs.verticalDpi,10):void 0}}function Ge(s,t){t.headerFooter={oddHeader:S(s,"oddHeader")?.text,oddFooter:S(s,"oddFooter")?.text,evenHeader:S(s,"evenHeader")?.text,evenFooter:S(s,"evenFooter")?.text,firstHeader:S(s,"firstHeader")?.text,firstFooter:S(s,"firstFooter")?.text,differentOddEven:s.attrs.differentOddEven==="1",differentFirst:s.attrs.differentFirst==="1"}}function qe(s,t){t.printOptions={gridLines:s.attrs.gridLines==="1",gridLinesSet:s.attrs.gridLinesSet==="1",headings:s.attrs.headings==="1",centerHorizontal:s.attrs.horizontalCentered==="1",centerVertical:s.attrs.verticalCentered==="1"}}function Ze(s){try{let t=U(s);if(O(t.tag)!=="table")return null;let r=t.attrs.name??"",o=t.attrs.displayName??r,n=t.attrs.ref??"",i=parseInt(t.attrs.totalsRowCount??"0",10),l=[],c=q(t,"tableColumns");if(c)for(let m of _(c,"tableColumn")){let p={name:m.attrs.name??""};m.attrs.totalsRowFunction&&(p.totalsRowFunction=m.attrs.totalsRowFunction),m.attrs.totalsRowFormula&&(p.totalsRowFormula=m.attrs.totalsRowFormula),m.attrs.totalsRowLabel&&(p.totalsRowLabel=m.attrs.totalsRowLabel),l.push(p)}let a={name:r,ref:n,columns:l};o&&o!==r&&(a.displayName=o),i>0&&(a.totalsRow=!0);let d=q(t,"tableStyleInfo");return d&&(d.attrs.name&&(a.style=d.attrs.name),d.attrs.showFirstColumn==="1"&&(a.showFirstColumn=!0),d.attrs.showLastColumn==="1"&&(a.showLastColumn=!0),d.attrs.showRowStripes==="1"&&(a.showRowStripes=!0),d.attrs.showColumnStripes==="1"&&(a.showColumnStripes=!0)),a}catch{return null}}function Je(s,t){let e=s.replace(/\/$/,"").split("/");for(let r of t.split("/"))r===".."?e.pop():r!=="."&&e.push(r);return e.join("/")}async function te(s){let t=await qt(s),e=R=>t.get(R)??t.get(R.replace(/^\//,"")),r=R=>{let N=e(R);return N?Tt(N):void 0},o=r("[Content_Types].xml")??"<Types/>",n=Xe(o),i=r("xl/_rels/workbook.xml.rels")??"<Relationships/>",l=Yt(i),c=r("xl/workbook.xml")??"<workbook/>",a=r("xl/styles.xml")??"<styleSheet/>",d=Le(a),m=r("xl/sharedStrings.xml")??"<sst/>",p=m!=="<sst/>"?Ne(m):[],h=r("docProps/core.xml")??"",u=h?Jt(h):{},$=r("docProps/app.xml")??"",x={},y="";if($){let R=Kt($);x=R.props,y=R.unknownRaw}let b=r("docProps/custom.xml")??"",F=b?Qt(b):[],I=U(c),X=q(I,"sheets"),T=X?_(X,"sheet"):[],v=new Map;for(let[R,N]of t)R.includes("_rels/")&&v.set(R,Yt(Tt(N)));let f=[];for(let R of T){let N=R.attrs["r:id"]??Object.values(R.attrs).find(ut=>ut.startsWith("rId"))??"",Z=R.attrs.sheetId??"",j=R.attrs.name??`Sheet${Z}`,A=l.get(N);if(!A)continue;let k=A.target.startsWith("/")?A.target.slice(1):`xl/${A.target}`,M=r(k)??"";if(!M)continue;let{ws:L,originalXml:z,unknownParts:st,tableRIds:ft}=je(M,j,d,p);L.sheetIndex=f.length+1,L.rId=N;let Xt=[];if(ft.length){let ut=k.split("/").pop()??"",Lt=k.substring(0,k.lastIndexOf("/")+1),ee=`${Lt}_rels/${ut}.rels`,Bt=v.get(ee);if(Bt){for(let se of ft){let lt=Bt.get(se);if(!lt)continue;let At=lt.target.startsWith("/")?lt.target.slice(1):Je(Lt,lt.target),_t=r(At);if(_t){let Ot=Ze(_t);Ot&&L.addTable(Ot),Xt.push(At)}}L.tableRIds=ft}}f.push({ws:L,sheetId:Z,rId:N,originalXml:z,unknownParts:st,tablePaths:Xt})}let w=new Set(["xl/workbook.xml","xl/styles.xml","xl/sharedStrings.xml","xl/worksheets/","docProps/","[Content_Types].xml","_rels/","xl/_rels/"]),D=new Map;for(let[R,N]of t){if(R.endsWith("_rels/")||R==="[Content_Types].xml")continue;[...w].some(j=>R.startsWith(j))||D.set(R,N.data)}return{sheets:f,styles:d,stylesXml:a,sharedStrings:p,sharedXml:m,workbookXml:c,workbookRels:l,contentTypes:n,contentTypesXml:o,core:u,extended:x,extendedUnknownRaw:y,custom:F,hasCustomProps:F.length>0,unknownParts:D,allRels:v}}var Dt=class s{constructor(){this.sheets=[],this.namedRanges=[],this.properties={},this.compressionLevel=6,this.coreProperties={},this.extendedProperties={},this.customProperties=[],this._dirtySheets=new Set}markDirty(t){if(typeof t=="string"){let e=this.sheets.findIndex(r=>r.name===t);e>=0&&this._dirtySheets.add(e)}else this._dirtySheets.add(t)}static async fromBytes(t){let e=new s,r=await te(t);return e._readResult=r,e.coreProperties=r.core,e.extendedProperties=r.extended,e.customProperties=r.custom,e.properties={title:r.core.title,author:r.core.creator,subject:r.core.subject,description:r.core.description,keywords:r.core.keywords,company:r.extended.company,lastModifiedBy:r.core.lastModifiedBy,created:r.core.created,modified:r.core.modified,category:r.core.category,status:r.core.contentStatus},e.sheets=r.sheets.map(o=>o.ws),e}static async fromBase64(t){return s.fromBytes(ct(t))}static async fromFile(t){let r=await(await import("fs/promises")).readFile(t);return s.fromBytes(new Uint8Array(r))}static async fromBlob(t){return s.fromBytes(new Uint8Array(await t.arrayBuffer()))}addSheet(t,e={}){let r=new J(t,e);return r.sheetIndex=this.sheets.length+1,this.sheets.push(r),this._dirtySheets.add(r.sheetIndex-1),r}getSheet(t){return this.sheets.find(e=>e.name===t)}getSheetByIndex(t){return this.sheets[t]}getSheetNames(){return this.sheets.map(t=>t.name)}removeSheet(t){return this.sheets=this.sheets.filter(e=>e.name!==t),this}addNamedRange(t){return this.namedRanges.push(t),this}getCustomProperty(t){return this.customProperties.find(e=>e.name===t)}setCustomProperty(t,e){let r=this.customProperties.findIndex(o=>o.name===t);return r>=0?this.customProperties[r]={name:t,value:e}:this.customProperties.push({name:t,value:e}),this}removeCustomProperty(t){return this.customProperties=this.customProperties.filter(e=>e.name!==t),this}async build(){return this._syncLegacyProperties(),this._readResult?this._buildPatched():this._buildFresh()}async _buildPatched(){let t=this._readResult,e=[],r=this._dirtySheets.size>0,o=new Y,n=new tt,i=new Map;if(r)for(let a=0;a<this.sheets.length;a++)i.set(a,this.sheets[a].toXml(o,n));e.push({name:"docProps/core.xml",data:C(Rt({...t.core,...this.coreProperties,modified:new Date}))}),e.push({name:"docProps/app.xml",data:C(St({...t.extended,...this.extendedProperties,titlesOfParts:this.sheets.map(a=>a.name),headingPairs:[{name:"Worksheets",count:this.sheets.length}]},t.extendedUnknownRaw))});let l=this.customProperties.length>0?this.customProperties:t.hasCustomProps?t.custom:null;l&&l.length>0&&e.push({name:"docProps/custom.xml",data:C(Pt(l))}),e.push({name:"xl/workbook.xml",data:C(this._patchWorkbookXml(t.workbookXml))}),r?(e.push({name:"xl/styles.xml",data:C(o.toXml())}),e.push({name:"xl/sharedStrings.xml",data:C(n.toXml())})):(e.push({name:"xl/styles.xml",data:C(t.stylesXml)}),e.push({name:"xl/sharedStrings.xml",data:C(t.sharedXml)}));for(let a=0;a<this.sheets.length;a++){let d=`xl/worksheets/sheet${a+1}.xml`;if(r)e.push({name:d,data:C(i.get(a)??"")});else{let m=t.sheets[a]?.originalXml??"",p=t.sheets[a]?.unknownParts.join(`
|
|
191
|
-
`)??"";e.push({name:d,data:C(p?m.replace("</worksheet>",`${p}</worksheet>`):m)})}}let c=new Set;if(r){for(let a=0;a<this.sheets.length;a++)if(t.sheets[a]?.tablePaths)for(let d of t.sheets[a].tablePaths)c.add(d)}for(let[a,d]of t.unknownParts)c.has(a)||e.push({name:a,data:d});if(r)for(let a=0;a<this.sheets.length;a++){let m=this.sheets[a].getTables(),p=t.sheets[a]?.tablePaths??[];for(let h=0;h<m.length;h++){let u=p[h];if(u){let $=u.match(/table(\d+)\.xml$/),x=$?parseInt($[1],10):h+1;e.push({name:u,data:C(wt(m[h],x))})}}}e.push({name:"_rels/.rels",data:C(this._buildRootRels(l!=null&&l.length>0))}),e.push({name:"xl/_rels/workbook.xml.rels",data:C(this._buildWorkbookRels(t))});for(let[a,d]of t.allRels)a==="xl/_rels/workbook.xml.rels"||a==="_rels/.rels"||e.push({name:a,data:C(this._relsToXml(d))});return e.push({name:"[Content_Types].xml",data:C(this._patchContentTypes(t.contentTypesXml,l!=null&&l.length>0))}),kt(e,{level:this.compressionLevel})}async _buildFresh(){let t=new Y,e=new tt,r=[],o=1;for(let f of this.sheets)f.rId=`rId${o++}`;let n=[],i=[],l=[],c=new Map,a=new Map,d=new Map,m=1,p=1,h=1,u=1;for(let f of this.sheets){let w=f.getImages(),D=f.getCharts(),R=f.getTables(),N=[],Z=[],j=[];(w.length||D.length)&&(f.drawingRId=`rId${o++}`),f.getComments().length&&(f.legacyDrawingRId=`rId${o++}`);for(let A of w){let k=`rId${o++}`;N.push(k),n.push({ws:f,img:A,ext:A.format==="jpeg"?"jpg":A.format,idx:m++})}for(let A=0;A<D.length;A++){let k=`rId${o++}`;Z.push(k),i.push({ws:f,chartIdx:A,globalIdx:p++})}for(let A=0;A<R.length;A++){let k=`rId${o++}`;j.push(k),l.push({ws:f,tableIdx:A,globalTableId:h++})}c.set(f,N),a.set(f,Z),d.set(f,j),f.tableRIds=j}let $=this.customProperties.length>0,x=new Set;for(let{ext:f}of n){let w=f==="jpg"?"image/jpeg":f==="png"?"image/png":`image/${f}`;x.add(`<Default Extension="${f}" ContentType="${w}"/>`)}let y=this.sheets.filter(f=>f.getComments().length),b=y.length?'<Default Extension="vml" ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>':"",F=0,I=y.map(()=>`<Override PartName="/xl/comments${++F}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"/>`).join("");r.push({name:"[Content_Types].xml",data:C(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
253
|
+
</Properties>`}function Wn(e){let t=Lt(e),o=r=>{let s=t.children.find(i=>ct(i.tag)===r);return s?.text??s?.children[0]?.text},n=r=>{let s=o(r);return s?new Date(s):void 0};return{title:o("title"),subject:o("subject"),creator:o("creator"),keywords:o("keywords"),description:o("description"),lastModifiedBy:o("lastModifiedBy"),revision:o("revision"),created:n("created"),modified:n("modified"),category:o("category"),contentStatus:o("contentStatus"),language:o("language"),identifier:o("identifier"),version:o("version")}}function Hn(e){let t=Lt(e),o=d=>t.children.find(f=>ct(f.tag)===d)?.text,n=d=>{let f=o(d);return f!==void 0?Number(f):void 0},r=d=>{let f=o(d);return f!==void 0?f==="true"||f==="1":void 0},s,i=t.children.find(d=>ct(d.tag)==="HeadingPairs");if(i){let d=i.children[0];if(d){let f=d.children.filter(p=>ct(p.tag)==="variant");s=[];for(let p=0;p<f.length-1;p+=2){let g=f[p].children[0],u=f[p+1].children[0];s.push({name:g?.text??"",count:parseInt(u?.text??"0",10)})}}}let a,l=t.children.find(d=>ct(d.tag)==="TitlesOfParts");if(l){let d=l.children[0];d&&(a=d.children.map(f=>f.text??""))}let h=new Set(["Application","AppVersion","Company","Manager","DocSecurity","ScaleCrop","LinksUpToDate","SharedDoc","HyperlinksChanged","Characters","CharactersWithSpaces","Words","Lines","Paragraphs","Pages","Slides","Notes","HiddenSlides","MMClips","Template","PresentationFormat","TotalTime","HyperlinkBase","HeadingPairs","TitlesOfParts"]),m=t.children.filter(d=>!h.has(ct(d.tag))).map(d=>{let f=Object.entries(d.attrs).map(([g,u])=>` ${g}="${u}"`).join(""),p=d.text??"";return!p&&!d.children.length?`<${d.tag}${f}/>`:`<${d.tag}${f}>${p}</${d.tag}>`}).join(`
|
|
254
|
+
`);return{props:{application:o("Application"),appVersion:o("AppVersion"),company:o("Company"),manager:o("Manager"),docSecurity:n("DocSecurity"),scaleCrop:r("ScaleCrop"),linksUpToDate:r("LinksUpToDate"),sharedDoc:r("SharedDoc"),hyperlinksChanged:r("HyperlinksChanged"),characters:n("Characters"),charactersByWord:n("CharactersWithSpaces"),words:n("Words"),lines:n("Lines"),paragraphs:n("Paragraphs"),pages:n("Pages"),slides:n("Slides"),notes:n("Notes"),hiddenSlides:n("HiddenSlides"),mmClips:n("MMClips"),template:o("Template"),presentationFormat:o("PresentationFormat"),totalTime:n("TotalTime"),hyperlinkBase:o("HyperlinkBase"),headingPairs:s,titlesOfParts:a},unknownRaw:m}}function zn(e){return Lt(e).children.filter(o=>ct(o.tag)==="property").map(o=>{let n=o.attrs.name??"",r=o.children[0];if(!r)return null;let s=ct(r.tag),i=r.text??"",a;switch(s){case"lpwstr":case"lpstr":case"bstr":a={type:"string",value:i};break;case"i4":case"int":a={type:"int",value:parseInt(i,10)};break;case"decimal":a={type:"decimal",value:parseFloat(i)};break;case"bool":a={type:"bool",value:i==="true"||i==="1"};break;case"filetime":a={type:"date",value:new Date(i)};break;case"r8":a={type:"r8",value:parseFloat(i)};break;case"i8":a={type:"i8",value:BigInt(i)};break;case"error":a={type:"error",value:i};break;default:a={type:"string",value:i};break}return{name:n,value:a}}).filter(Boolean)}function rn(e){let t=new Map;try{let o=Lt(e);for(let n of o.children)if(ct(n.tag)==="Relationship"){let r={type:n.attrs.Type??"",target:n.attrs.Target??""};n.attrs.TargetMode&&(r.targetMode=n.attrs.TargetMode),t.set(n.attrs.Id??"",r)}}catch{}return t}function Ns(e){let t=new Map;try{let o=Lt(e);for(let n of o.children)if(ct(n.tag)==="Override"){let s=n.attrs.PartName??"",i=n.attrs.ContentType??"";t.set(s.startsWith("/")?s.slice(1):s,i)}}catch{}return t}function Xs(e){let t=Lt(e),o=new Map,n=[],r={0:"General",1:"0",2:"0.00",3:"#,##0",4:"#,##0.00",9:"0%",10:"0.00%",11:"0.00E+00",12:"# ?/?",13:"# ??/??",14:"mm-dd-yy",15:"d-mmm-yy",16:"d-mmm",17:"mmm-yy",18:"h:mm AM/PM",19:"h:mm:ss AM/PM",20:"h:mm",21:"h:mm:ss",22:"m/d/yy h:mm",37:"#,##0 ;(#,##0)",38:"#,##0 ;[Red](#,##0)",39:"#,##0.00;(#,##0.00)",40:"#,##0.00;[Red](#,##0.00)",45:"mm:ss",46:"[h]:mm:ss",47:"mmss.0",48:"##0.0E+0",49:"@"},s=oe(t,"numFmts");if(s)for(let g of ut(s,"numFmt")){let u=parseInt(g.attrs.numFmtId??"0",10),$=g.attrs.formatCode??"";o.set(u,$)}let i=oe(t,"fonts"),a=[];if(i)for(let g of ut(i,"font"))a.push(sn(g));let l=oe(t,"fills"),h=[];if(l)for(let g of ut(l,"fill"))h.push(Gn(g));let c=oe(t,"borders"),m=[];if(c)for(let g of ut(c,"border"))m.push(qn(g));let d=oe(t,"cellXfs");if(d)for(let g of ut(d,"xf")){let u=parseInt(g.attrs.fontId??"0",10),$=parseInt(g.attrs.fillId??"0",10),x=parseInt(g.attrs.borderId??"0",10),b=parseInt(g.attrs.numFmtId??"0",10),F=g.attrs.applyFont==="1",y=g.attrs.applyFill==="1",v=g.attrs.applyBorder==="1",w=g.attrs.applyAlignment==="1",R=g.attrs.applyNumberFormat==="1",T=g.attrs.applyProtection==="1",S={};F&&a[u]&&(S.font=a[u]),y&&h[$]&&(S.fill=h[$]),v&&m[x]&&(S.border=m[x]),R&&b!==0&&(o.has(b)?S.numberFormat={formatCode:o.get(b)}:r[b]&&(S.numFmtId=b));let M=B(g,"alignment");w&&M&&(S.alignment=Kn(M));let D=B(g,"protection");T&&D&&(D.attrs.locked!==void 0&&(S.locked=D.attrs.locked!=="0"),D.attrs.hidden!==void 0&&(S.hidden=D.attrs.hidden!=="0")),n.push(S)}let f=[],p=oe(t,"dxfs");if(p)for(let g of ut(p,"dxf")){let u={},$=B(g,"font");$&&(u.font=sn($));let x=B(g,"fill");x&&(u.fill=Gn(x));let b=B(g,"border");b&&(u.border=qn(b));let F=B(g,"numFmt");if(F){let v=F.attrs.formatCode??"";v&&(u.numberFormat={formatCode:v})}let y=B(g,"alignment");y&&(u.alignment=Kn(y)),f.push(u)}return{xfs:n,numFmts:o,dxfs:f}}function oe(e,t){if(ct(e.tag)===t)return e;for(let o of e.children){let n=oe(o,t);if(n)return n}}function sn(e){let t={};for(let o of e.children)switch(ct(o.tag)){case"b":t.bold=o.attrs.val!=="0";break;case"i":t.italic=o.attrs.val!=="0";break;case"strike":t.strike=o.attrs.val!=="0";break;case"u":t.underline=o.attrs.val??"single";break;case"sz":t.size=parseFloat(o.attrs.val??"11");break;case"name":t.name=o.attrs.val;break;case"family":t.family=parseInt(o.attrs.val??"0",10);break;case"scheme":t.scheme=o.attrs.val;break;case"charset":t.charset=parseInt(o.attrs.val??"0",10);break;case"vertAlign":t.vertAlign=o.attrs.val;break;case"color":{let n=o.attrs.rgb,r=o.attrs.theme;n?t.color=n:r&&(t.color=`theme:${r}`);break}}return t}function Gn(e){let t=B(e,"patternFill");if(t){let n=B(t,"fgColor"),r=B(t,"bgColor");return{type:"pattern",pattern:t.attrs.patternType??"none",fgColor:n?.attrs.rgb??(n?.attrs.theme?`theme:${n.attrs.theme}`:void 0),bgColor:r?.attrs.rgb??(r?.attrs.theme?`theme:${r.attrs.theme}`:void 0)}}let o=B(e,"gradientFill");if(o){let n=ut(o,"stop").concat(ut(o,"gradientStop")).map(r=>{let s=B(r,"color");return{position:parseFloat(r.attrs.position??"0"),color:s?.attrs.rgb??(s?.attrs.theme?`theme:${s.attrs.theme}`:"FF000000")}});return{type:"gradient",gradientType:o.attrs.type,degree:o.attrs.degree?parseFloat(o.attrs.degree):void 0,stops:n}}return{type:"pattern",pattern:"none"}}function qn(e){let t=o=>{let n=B(e,o);if(!n)return;let r=n.attrs.style,s=B(n,"color");if(!r&&!s)return;let i=s?.attrs.rgb??(s?.attrs.theme?`theme:${s.attrs.theme}`:void 0);return{style:r,color:i}};return{left:t("left"),right:t("right"),top:t("top"),bottom:t("bottom"),diagonal:t("diagonal"),diagonalUp:e.attrs.diagonalUp==="1",diagonalDown:e.attrs.diagonalDown==="1"}}function Kn(e){let t={};return e.attrs.horizontal&&(t.horizontal=e.attrs.horizontal),e.attrs.vertical&&(t.vertical=e.attrs.vertical),e.attrs.wrapText&&(t.wrapText=e.attrs.wrapText!=="0"),e.attrs.shrinkToFit&&(t.shrinkToFit=e.attrs.shrinkToFit!=="0"),e.attrs.textRotation&&(t.textRotation=parseInt(e.attrs.textRotation,10)),e.attrs.indent&&(t.indent=parseInt(e.attrs.indent,10)),e.attrs.readingOrder&&(t.readingOrder=parseInt(e.attrs.readingOrder,10)),t}function Us(e){let t=Lt(e);return ut(t,"si").map(o=>{let n=B(o,"t"),r=ut(o,"r");if(n&&!r.length)return{text:n.text??""};let s=r.map(l=>{let h=B(l,"t")?.text??"",c=B(l,"rPr"),m={text:h};return c&&(m.font=sn(c)),m}),i=s.map(l=>l.text).join("");return s.some(l=>l.font&&Object.keys(l.font).length>0)?{text:i,richText:s}:{text:i}})}function Vs(e,t,o,n){let r=new Ie(t),s=Lt(e),i=[],a=[],l="",h="",c=[],m=new Map,d=new Set(["sheetPr","dimension","sheetViews","sheetFormatPr","cols","sheetData","mergeCells","conditionalFormatting","dataValidations","sheetProtection","printOptions","pageMargins","pageSetup","headerFooter","drawing","tableParts","autoFilter","rowBreaks","colBreaks","picture","oleObjects","ctrlProps","legacyDrawing","AlternateContent","extLst"]);for(let f of s.children){let p=ct(f.tag);switch(p){case"sheetViews":Ws(f,r);break;case"cols":Hs(f,r,o);break;case"sheetData":zs(f,r,o,n,m);break;case"mergeCells":Gs(f,r);break;case"autoFilter":r.autoFilter={ref:f.attrs.ref??""};break;case"tableParts":for(let g of ut(f,"tablePart")){let u=g.attrs["r:id"]??"";u&&a.push(u)}break;case"sheetProtection":qs(f,r);break;case"pageMargins":Ks(f,r);break;case"pageSetup":Zs(f,r);break;case"headerFooter":Ys(f,r);break;case"printOptions":Qs(f,r);break;case"conditionalFormatting":Js(f,r,o);break;case"dataValidations":ta(f,r);break;case"rowBreaks":for(let g of ut(f,"brk")){let u=parseInt(g.attrs.id??"0",10);u>0&&r.addRowBreak(u,g.attrs.man==="1")}break;case"colBreaks":for(let g of ut(f,"brk")){let u=parseInt(g.attrs.id??"0",10);u>0&&r.addColBreak(u,g.attrs.man==="1")}break;case"drawing":h=f.attrs["r:id"]??"";break;case"legacyDrawing":l=f.attrs["r:id"]??"";break;case"AlternateContent":{let g=f.children.find($=>typeof $!="string"&&ct($.tag)==="Choice"),u=g?g.children.find($=>typeof $!="string"&&ct($.tag)==="controls"):void 0;if(u)for(let $ of u.children){if(typeof $=="string")continue;let x;if(ct($.tag)==="control"?x=$:ct($.tag)==="AlternateContent"&&(x=$.children.find(v=>typeof v!="string"&&ct(v.tag)==="Choice")?.children.find(v=>typeof v!="string"&&ct(v.tag)==="control")),!x)continue;let b=x.children.find(y=>typeof y!="string"&&ct(y.tag)==="controlPr"),F=x.attrs["r:id"]??b?.attrs["r:id"]??"";F&&c.push(F)}break}case"extLst":sa(f,r);break;default:d.has(p)||i.push(so(f));break}}return{ws:r,originalXml:e,unknownParts:i,tableRIds:a,legacyDrawingRId:l,ctrlPropRIds:c,drawingRId:h,vmCells:m}}function Ws(e,t){let o=ut(e,"sheetView")[0];if(!o)return;t.view={showGridLines:o.attrs.showGridLines!=="0",showRowColHeaders:o.attrs.showRowColHeaders!=="0",zoomScale:o.attrs.zoomScale?parseInt(o.attrs.zoomScale,10):void 0,rightToLeft:o.attrs.rightToLeft==="1",tabSelected:o.attrs.tabSelected==="1",view:o.attrs.view};let n=B(o,"pane");n&&n.attrs.state==="frozen"&&(t.freezePane={col:n.attrs.xSplit?parseInt(n.attrs.xSplit,10):void 0,row:n.attrs.ySplit?parseInt(n.attrs.ySplit,10):void 0})}function Hs(e,t,o){for(let n of ut(e,"col")){let r=parseInt(n.attrs.min??"1",10),s=parseInt(n.attrs.max??"1",10),i={width:n.attrs.width?parseFloat(n.attrs.width):void 0,hidden:n.attrs.hidden==="1",customWidth:n.attrs.customWidth==="1",outlineLevel:n.attrs.outlineLevel?parseInt(n.attrs.outlineLevel,10):void 0,style:n.attrs.style?o.xfs[parseInt(n.attrs.style,10)]:void 0};for(let a=r;a<=s;a++)t.setColumn(a,i)}}function zs(e,t,o,n,r){for(let s of ut(e,"row")){let i=parseInt(s.attrs.r??"0",10);if(!i)continue;let a={};s.attrs.ht&&(a.height=parseFloat(s.attrs.ht)),s.attrs.hidden&&(a.hidden=s.attrs.hidden==="1"),s.attrs.outlineLevel&&(a.outlineLevel=parseInt(s.attrs.outlineLevel,10)),s.attrs.collapsed&&(a.collapsed=s.attrs.collapsed==="1"),s.attrs.s&&(a.style=o.xfs[parseInt(s.attrs.s,10)]),Object.keys(a).length&&t.setRow(i,a);for(let l of ut(s,"c")){let h=l.attrs.r??"";if(!h)continue;let{row:c,col:m}=Gt(h),d=l.attrs.s?parseInt(l.attrs.s,10):0,f=d>0?o.xfs[d]:void 0,p=l.attrs.t??"",g=B(l,"f"),u=B(l,"v"),$={};f&&($.style=f);let x=l.attrs.vm;if(x&&r&&r.set(h,parseInt(x,10)),g)g.attrs.t==="array"?$.arrayFormula=g.text??"":$.formula=g.text??"";else if(u){let b=u.text??"";switch(p){case"s":{let F=parseInt(b,10),y=n[F];y?($.value=y.text,y.richText&&($.richText=y.richText)):$.value="";break}case"b":$.value=b==="1"||b==="true";break;case"str":case"inlineStr":{let F=B(l,"is");$.value=F?B(F,"t")?.text??b:b;break}case"e":$.value=new te(b);break;default:{let F=parseFloat(b);$.value=isNaN(F)?b:F;break}}}(Object.keys($).length||$.value!==void 0)&&t.setCell(c,m,$)}}}function Gs(e,t){for(let o of ut(e,"mergeCell")){let n=o.attrs.ref??"";n.includes(":")&&t.mergeByRef(n)}}function qs(e,t){t.protection={sheet:e.attrs.sheet!=="0",password:void 0,selectLockedCells:e.attrs.selectLockedCells!=="0",selectUnlockedCells:e.attrs.selectUnlockedCells!=="0",formatCells:e.attrs.formatCells==="0",formatColumns:e.attrs.formatColumns==="0",formatRows:e.attrs.formatRows==="0",insertColumns:e.attrs.insertColumns==="0",insertRows:e.attrs.insertRows==="0",insertHyperlinks:e.attrs.insertHyperlinks==="0",deleteColumns:e.attrs.deleteColumns==="0",deleteRows:e.attrs.deleteRows==="0",sort:e.attrs.sort==="0",autoFilter:e.attrs.autoFilter==="0",pivotTables:e.attrs.pivotTables==="0"}}function Ks(e,t){t.pageMargins={left:parseFloat(e.attrs.left??"0.7"),right:parseFloat(e.attrs.right??"0.7"),top:parseFloat(e.attrs.top??"0.75"),bottom:parseFloat(e.attrs.bottom??"0.75"),header:parseFloat(e.attrs.header??"0.3"),footer:parseFloat(e.attrs.footer??"0.3")}}function Zs(e,t){t.pageSetup={paperSize:e.attrs.paperSize?parseInt(e.attrs.paperSize,10):void 0,orientation:e.attrs.orientation,fitToPage:e.attrs.fitToPage==="1",fitToWidth:e.attrs.fitToWidth?parseInt(e.attrs.fitToWidth,10):void 0,fitToHeight:e.attrs.fitToHeight?parseInt(e.attrs.fitToHeight,10):void 0,scale:e.attrs.scale?parseInt(e.attrs.scale,10):void 0,horizontalDpi:e.attrs.horizontalDpi?parseInt(e.attrs.horizontalDpi,10):void 0,verticalDpi:e.attrs.verticalDpi?parseInt(e.attrs.verticalDpi,10):void 0}}function Ys(e,t){t.headerFooter={oddHeader:B(e,"oddHeader")?.text,oddFooter:B(e,"oddFooter")?.text,evenHeader:B(e,"evenHeader")?.text,evenFooter:B(e,"evenFooter")?.text,firstHeader:B(e,"firstHeader")?.text,firstFooter:B(e,"firstFooter")?.text,differentOddEven:e.attrs.differentOddEven==="1",differentFirst:e.attrs.differentFirst==="1"}}function Qs(e,t){t.printOptions={gridLines:e.attrs.gridLines==="1",gridLinesSet:e.attrs.gridLinesSet==="1",headings:e.attrs.headings==="1",centerHorizontal:e.attrs.horizontalCentered==="1",centerVertical:e.attrs.verticalCentered==="1"}}function Js(e,t,o){let n=e.attrs.sqref??"";for(let r of ut(e,"cfRule")){let s=r.attrs.type??"cellIs",i={sqref:n,type:s};if(r.attrs.operator&&(i.operator=r.attrs.operator),r.attrs.priority&&(i.priority=parseInt(r.attrs.priority,10)),r.attrs.text&&(i.text=r.attrs.text),r.attrs.aboveAverage==="0"&&(i.aboveAverage=!1),r.attrs.percent==="1"&&(i.percent=!0),r.attrs.rank&&(i.rank=parseInt(r.attrs.rank,10)),r.attrs.timePeriod&&(i.timePeriod=r.attrs.timePeriod),r.attrs.dxfId!==void 0){let m=parseInt(r.attrs.dxfId,10);o.dxfs[m]&&(i.style=o.dxfs[m])}let a=ut(r,"formula");a[0]?.text&&(i.formula=a[0].text),a[1]?.text&&(i.formula2=a[1].text);let l=B(r,"colorScale");if(l){let m=ut(l,"cfvo").map(f=>({type:f.attrs.type??"min",val:f.attrs.val})),d=ut(l,"color").map(f=>f.attrs.rgb??f.attrs.theme??"");i.colorScale={type:"colorScale",cfvo:m,color:d}}let h=B(r,"dataBar");if(h){let m=ut(h,"cfvo"),d=B(h,"color");i.dataBar={type:"dataBar",showValue:h.attrs.showValue!=="0"?void 0:!1,minType:m[0]?.attrs.type,minVal:m[0]?.attrs.val,maxType:m[1]?.attrs.type,maxVal:m[1]?.attrs.val,color:d?.attrs.rgb}}let c=B(r,"iconSet");if(c){let m=ut(c,"cfvo").map(d=>({type:d.attrs.type??"percent",val:d.attrs.val}));i.iconSet={type:"iconSet",iconSet:c.attrs.iconSet??"3TrafficLights1",cfvo:m,showValue:c.attrs.showValue==="0"?!1:void 0,reverse:c.attrs.reverse==="1"?!0:void 0}}t.addConditionalFormat(i)}}function ta(e,t){for(let o of ut(e,"dataValidation")){let n=o.attrs.sqref??"";if(!n)continue;let r=o.attrs.type??"whole",s={type:r};o.attrs.operator&&(s.operator=o.attrs.operator),o.attrs.allowBlank==="1"&&(s.allowBlank=!0),o.attrs.showErrorMessage==="1"&&(s.showErrorAlert=!0),o.attrs.errorTitle&&(s.errorTitle=o.attrs.errorTitle),o.attrs.error&&(s.error=o.attrs.error),o.attrs.showInputMessage==="1"&&(s.showInputMessage=!0),o.attrs.promptTitle&&(s.promptTitle=o.attrs.promptTitle),o.attrs.prompt&&(s.prompt=o.attrs.prompt),o.attrs.showDropDown==="1"&&(s.showDropDown=!1);let i=B(o,"formula1"),a=B(o,"formula2");i?.text&&(r==="list"&&i.text.startsWith('"')&&i.text.endsWith('"')?s.list=i.text.slice(1,-1).split(","):s.formula1=i.text),a?.text&&(s.formula2=a.text),t.addDataValidation(n,s)}}function ea(e){try{let t=Lt(e);if(ct(t.tag)!=="table")return null;let n=t.attrs.name??"",r=t.attrs.displayName??n,s=t.attrs.ref??"",i=parseInt(t.attrs.totalsRowCount??"0",10),a=[],l=oe(t,"tableColumns");if(l)for(let m of ut(l,"tableColumn")){let d={name:m.attrs.name??""};m.attrs.totalsRowFunction&&(d.totalsRowFunction=m.attrs.totalsRowFunction),m.attrs.totalsRowFormula&&(d.totalsRowFormula=m.attrs.totalsRowFormula),m.attrs.totalsRowLabel&&(d.totalsRowLabel=m.attrs.totalsRowLabel),a.push(d)}let h={name:n,ref:s,columns:a};r&&r!==n&&(h.displayName=r),i>0&&(h.totalsRow=!0);let c=oe(t,"tableStyleInfo");return c&&(c.attrs.name&&(h.style=c.attrs.name),c.attrs.showFirstColumn==="1"&&(h.showFirstColumn=!0),c.attrs.showLastColumn==="1"&&(h.showLastColumn=!0),c.attrs.showRowStripes==="1"&&(h.showRowStripes=!0),c.attrs.showColumnStripes==="1"&&(h.showColumnStripes=!0)),h}catch{return null}}var De=9525;function Zn(e){return{col:parseInt(B(e,"col")?.text??"0",10),row:parseInt(B(e,"row")?.text??"0",10),colOff:parseInt(B(e,"colOff")?.text??"0",10),rowOff:parseInt(B(e,"rowOff")?.text??"0",10)}}function Yn(e){return{png:"png",jpg:"jpeg",jpeg:"jpeg",gif:"gif",emf:"emf",wmf:"wmf",tiff:"tiff",tif:"tiff",svg:"svg",ico:"ico",webp:"webp",bmp:"bmp"}[e.toLowerCase()]??"png"}function oa(e,t,o,n,r){let s=Lt(e);for(let i of s.children){if(typeof i=="string")continue;let a=ct(i.tag);if(a!=="twoCellAnchor"&&a!=="oneCellAnchor"&&a!=="absoluteAnchor")continue;let l=aa(i,a),h=wt(i,"pic");if(h){ia(h,i,a,l,t,o,n,r);continue}let c=wt(i,"graphicFrame");if(c){na(c,i,a,t,o,n,r);continue}let m=wt(i,"oMath");if(m){la(m,i,a,l,r);continue}let d=wt(i,"sp");if(d){ra(d,i,a,r);continue}}}function na(e,t,o,n,r,s,i){let a=wt(e,"chart");if(!a||!n)return;let l=a.attrs["r:id"]??Vn(a,"r:id")??"";if(!l)return;let h=n.get(l);if(!h)return;let c=h.target.startsWith("/")?h.target.slice(1):We(r,h.target),m=s(c);if(!m)return;let f=new TextDecoder().decode(m.data),p=Lt(f),g={col:0,row:0},u={col:8,row:15};if(o==="twoCellAnchor"){let E=B(t,"from"),_=B(t,"to");E&&(g={col:parseInt(B(E,"col")?.text??"0",10),row:parseInt(B(E,"row")?.text??"0",10)}),_&&(u={col:parseInt(B(_,"col")?.text??"0",10),row:parseInt(B(_,"row")?.text??"0",10)})}let $=wt(p,"plotArea");if(!$)return;let x={barChart:"column",bar3DChart:"column",lineChart:"line",line3DChart:"line",areaChart:"area",area3DChart:"area",pieChart:"pie",pie3DChart:"pie",doughnutChart:"doughnut",scatterChart:"scatter",bubbleChart:"bubble",radarChart:"radar",stockChart:"stock"},b="column",F;for(let E of $.children){if(typeof E=="string")continue;let _=ct(E.tag);if(x[_]){if(b=x[_],F=E,_==="barChart"||_==="bar3DChart"){(B(E,"barDir")?.attrs.val??"")==="bar"&&(b="bar");let V=B(E,"grouping")?.attrs.val??"";V==="stacked"&&(b=b==="bar"?"barStacked":"columnStacked"),V==="percentStacked"&&(b=b==="bar"?"barStacked100":"columnStacked100")}if(_==="lineChart"){let P=wt(E,"marker");if(P){let N=B(P,"symbol")?.attrs.val??"";N&&N!=="none"&&(b="lineMarker")}}_==="scatterChart"&&B(E,"scatterStyle")?.attrs.val?.includes("Smooth")&&(b="scatterSmooth"),_==="radarChart"&&B(E,"radarStyle")?.attrs.val==="filled"&&(b="radarFilled");break}}if(!F)return;let y=[];for(let E of ut(F,"ser")){let _={values:""},P=B(E,"tx");if(P){let K=wt(P,"strRef");if(K){let mt=B(K,"f");mt?.text&&(_.name=mt.text);let it=B(K,"strCache");if(it){let gt=wt(it,"pt"),St=gt?wt(gt,"v"):void 0;St?.text&&(_.name=St.text)}}let z=wt(P,"v");z?.text&&!_.name&&(_.name=z.text)}let N=B(E,"val")||B(E,"yVal");if(N){let K=wt(N,"numRef");if(K){let z=B(K,"f");z?.text&&(_.values=z.text)}}let H=B(E,"cat")||B(E,"xVal");if(H){let K=wt(H,"strRef"),z=wt(H,"numRef"),mt=K||z;if(mt){let it=B(mt,"f");it?.text&&(_.categories=it.text)}}let V=B(E,"spPr");if(V){let K=B(V,"solidFill");if(K){let z=B(K,"srgbClr");z?.attrs.val&&(_.color="#"+z.attrs.val)}}_.values&&y.push(_)}if(!y.length)return;let v,w=B(p,"title")||wt(p,"title");if(w){let E=wt(w,"t");E?.text&&(v=E.text)}let R,T,S=wt($,"catAx")||wt($,"dateAx"),M=wt($,"valAx");if(S){R={};let E=wt(S,"title");if(E){let _=wt(E,"t");_?.text&&(R.title=_.text)}}if(M){T={};let E=wt(M,"title");if(E){let P=wt(E,"t");P?.text&&(T.title=P.text)}B(M,"majorGridlines")&&(T.gridLines=!0)}let D=!1,k=wt(p,"legend");k&&(D=B(k,"legendPos")?.attrs.val||!0);let Q=B(F,"varyColors")?.attrs.val!=="0",q={type:b,series:y,from:g,to:u};v&&(q.title=v),R&&(q.xAxis=R),T&&(q.yAxis=T),D!==!1&&(q.legend=D),Q&&(q.varyColors=!0),i.addChart(q)}function ra(e,t,o,n){let r={col:0,row:0},s={col:2,row:2};if(o==="twoCellAnchor"){let u=B(t,"from"),$=B(t,"to");u&&(r={col:parseInt(B(u,"col")?.text??"0",10),row:parseInt(B(u,"row")?.text??"0",10)}),$&&(s={col:parseInt(B($,"col")?.text??"0",10),row:parseInt(B($,"row")?.text??"0",10)})}let i=wt(e,"spPr"),a="rect",l,h,c,m;if(i){let u=wt(i,"prstGeom");if(u){let F=u.attrs.prst??"";new Set(["rect","roundRect","ellipse","triangle","diamond","pentagon","hexagon","octagon","star5","star6","rightArrow","leftArrow","upArrow","downArrow","line","curvedConnector3","callout1","callout2","cloud","heart","lightningBolt","sun","moon","smileyFace","flowChartProcess","flowChartDecision","flowChartTerminator","flowChartDocument"]).has(F)&&(a=F)}let $=B(i,"solidFill");if($){let F=B($,"srgbClr");F?.attrs.val&&(l="#"+F.attrs.val);let y=B($,"schemeClr");y?.attrs.val&&(l="theme:"+y.attrs.val)}let x=B(i,"ln");if(x){let F=x.attrs.w;F&&(c=Math.round(parseInt(F,10)/De));let y=B(x,"solidFill");if(y){let v=B(y,"srgbClr");v?.attrs.val&&(h="#"+v.attrs.val)}}let b=wt(i,"xfrm");b?.attrs.rot&&(m=parseInt(b.attrs.rot,10)/6e4)}let d,f,p=wt(e,"txBody");if(p){let u=B(p,"bodyPr"),x=(u?B(u,"prstTxWarp"):void 0)?.attrs.prst??u?.attrs.prstTxWarp??"",b=[];for(let y of ut(p,"p"))for(let v of ut(y,"r")){let w=B(v,"t");if(w?.text&&b.push(w.text),!f){let R=B(v,"rPr");if(R){f={},R.attrs.sz&&(f.size=parseInt(R.attrs.sz,10)/100),R.attrs.b==="1"&&(f.bold=!0),R.attrs.i==="1"&&(f.italic=!0);let T=wt(R,"latin");T?.attrs.typeface&&(f.name=T.attrs.typeface);let S=B(R,"solidFill");if(S){let M=B(S,"srgbClr");M?.attrs.val&&(f.color="#"+M.attrs.val)}}}}if(d=b.join(""),x&&new Set(["textPlain","textArchUp","textArchDown","textCircle","textWave1","textWave2","textInflate","textDeflate","textFadeUp","textFadeDown","textFadeLeft","textFadeRight","textSlantUp","textSlantDown","textCascadeUp","textCascadeDown","textChevron","textRingInside","textRingOutside","textStop"]).has(x)&&d){let y={text:d,from:r,to:s};x!=="textPlain"&&(y.preset=x),f&&(y.font=f),l&&(y.fillColor=l),h&&(y.outlineColor=h),n.addWordArt(y);return}}let g={type:a,from:r,to:s};d&&(g.text=d),l&&(g.fillColor=l),h&&(g.lineColor=h),c&&(g.lineWidth=c),f&&(g.font=f),m&&(g.rotation=m),n.addShape(g)}function sa(e,t){for(let o of ut(e,"ext")){let n=o.children?.filter(r=>typeof r!="string"&&ct(r.tag)==="sparklineGroups");if(n?.length)for(let r of n)for(let s of ut(r,"sparklineGroup")){let i=s.attrs.type??"line",a=i==="column"?"bar":i==="stacked"?"stacked":"line",l=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorSeries"),h=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorHigh"),c=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorLow"),m=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorFirst"),d=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorLast"),f=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorNegative"),p=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="colorMarkers"),g=s.attrs.high==="1",u=s.attrs.low==="1",$=s.attrs.first==="1",x=s.attrs.last==="1",b=s.attrs.negative==="1",F=s.attrs.markers==="1",y=s.attrs.lineWeight,v=y?parseFloat(y):void 0,w=s.attrs.minAxisType==="individual"?"individual":s.attrs.minAxisType==="custom"?"custom":void 0,R=s.attrs.maxAxisType==="individual"?"individual":s.attrs.maxAxisType==="custom"?"custom":void 0,T=s.children?.find(M=>typeof M!="string"&&ct(M.tag)==="sparklines");if(!T)continue;let S=T.children?.filter(M=>typeof M!="string"&&ct(M.tag)==="sparkline");if(S)for(let M of S){let D=M.children?.find(E=>typeof E!="string"&&ct(E.tag)==="f"),k=M.children?.find(E=>typeof E!="string"&&ct(E.tag)==="sqref"),W=D?.text??"",Q=k?.text??"";if(!W||!Q)continue;let q={type:a,dataRange:W,location:Q};if(l){let E=l.attrs.rgb;E&&(q.color="#"+E.slice(2));let _=l.attrs.theme;_&&(q.color="theme:"+_)}if(h){let E=h.attrs.rgb;E&&(q.highColor="#"+E.slice(2));let _=h.attrs.theme;_&&(q.highColor="theme:"+_)}if(c){let E=c.attrs.rgb;E&&(q.lowColor="#"+E.slice(2));let _=c.attrs.theme;_&&(q.lowColor="theme:"+_)}if(m){let E=m.attrs.rgb;E&&(q.firstColor="#"+E.slice(2));let _=m.attrs.theme;_&&(q.firstColor="theme:"+_)}if(d){let E=d.attrs.rgb;E&&(q.lastColor="#"+E.slice(2));let _=d.attrs.theme;_&&(q.lastColor="theme:"+_)}if(f){let E=f.attrs.rgb;E&&(q.negativeColor="#"+E.slice(2));let _=f.attrs.theme;_&&(q.negativeColor="theme:"+_)}if(p){let E=p.attrs.rgb;E&&(q.markersColor="#"+E.slice(2));let _=p.attrs.theme;_&&(q.markersColor="theme:"+_)}g&&(q.showHigh=!0),u&&(q.showLow=!0),$&&(q.showFirst=!0),x&&(q.showLast=!0),b&&(q.showNegative=!0),F&&(q.showMarkers=!0),v!==void 0&&(q.lineWidth=v),w&&(q.minAxisType=w),R&&(q.maxAxisType=R),t.addSparkline(q)}}}}function aa(e,t){let o={};if(t==="twoCellAnchor"||t==="oneCellAnchor"){let n=B(e,"from");n&&(o.from={col:parseInt(B(n,"col")?.text??"0",10),row:parseInt(B(n,"row")?.text??"0",10),colOff:parseInt(B(n,"colOff")?.text??"0",10),rowOff:parseInt(B(n,"rowOff")?.text??"0",10)})}if(t==="oneCellAnchor"){let n=wt(e,"ext");n&&(o.width=parseInt(n.attrs.cx??"0",10),o.height=parseInt(n.attrs.cy??"0",10))}return o}function ia(e,t,o,n,r,s,i,a){let l=wt(e,"blipFill"),h=l?wt(l,"blip"):void 0,c=h?.attrs["r:embed"]??h?.attrs.embed??"";if(!c||!r)return;let m=r.get(c);if(!m)return;let d=m.target.startsWith("/")?m.target.slice(1):We(s,m.target),f=i(d);if(!f)return;let p=d.split(".").pop()??"png",g=Yn(p),$=wt(e,"cNvPr")?.attrs.descr||void 0,x={data:f.data,format:g};if($&&(x.altText=$),o==="twoCellAnchor"){let b=B(t,"from"),F=B(t,"to");b&&(x.from=Zn(b)),F&&(x.to=Zn(F))}else if(o==="oneCellAnchor")n.from&&(x.from=n.from),n.width&&(x.width=Math.round(n.width/De)),n.height&&(x.height=Math.round(n.height/De));else{let b=B(t,"pos"),F=B(t,"ext");b&&(x.position={x:Math.round(parseInt(b.attrs.x??"0",10)/De),y:Math.round(parseInt(b.attrs.y??"0",10)/De)}),F&&(x.width=Math.round(parseInt(F.attrs.cx??"0",10)/De),x.height=Math.round(parseInt(F.attrs.cy??"0",10)/De))}a.addImage(x)}function la(e,t,o,n,r){let s=kt(e);if(!s.length)return;let i=n.from??{col:0,row:0},a={elements:s,from:i};n.width&&(a.width=n.width),n.height&&(a.height=n.height);let l=wt(e,"rPr");if(l){let h=l.attrs.sz;h&&(a.fontSize=parseInt(h,10)/100);let c=wt(l,"latin");c?.attrs.typeface&&(a.fontName=c.attrs.typeface)}r.addMathEquation(a)}function kt(e){let t=[];for(let o of e.children){if(typeof o=="string")continue;let n=ca(o);n&&t.push(n)}return t}function ca(e){switch(ct(e.tag)){case"r":return{type:"text",text:wt(e,"t")?.text??""};case"f":{let o=B(e,"num"),n=B(e,"den");return{type:"frac",base:o?kt(o):[],argument:n?kt(n):[]}}case"sSup":{let o=B(e,"e"),n=B(e,"sup");return{type:"sup",base:o?kt(o):[],argument:n?kt(n):[]}}case"sSub":{let o=B(e,"e"),n=B(e,"sub");return{type:"sub",base:o?kt(o):[],argument:n?kt(n):[]}}case"sSubSup":{let o=B(e,"e"),n=B(e,"sub"),r=B(e,"sup");return{type:"subSup",base:o?kt(o):[],subscript:n?kt(n):[],superscript:r?kt(r):[]}}case"nary":{let o=B(e,"naryPr"),n=o?B(o,"chr"):void 0,r=n?.attrs["m:val"]??n?.attrs.val??"\u2211",s=B(e,"sub"),i=B(e,"sup"),a=B(e,"e");return{type:"nary",operator:r,lower:s?kt(s):[],upper:i?kt(i):[],body:a?kt(a):[]}}case"rad":{let o=B(e,"radPr"),n=o?B(o,"degHide"):void 0,r=n?.attrs["m:val"]==="1"||n?.attrs.val==="1",s=B(e,"deg"),i=B(e,"e");return{type:"rad",hideDegree:r,degree:s?kt(s):[],body:i?kt(i):[]}}case"d":{let o=B(e,"dPr"),n=o?B(o,"begChr"):void 0,r=o?B(o,"endChr"):void 0,s=B(e,"e");return{type:"delim",open:n?.attrs["m:val"]??n?.attrs.val??"(",close:r?.attrs["m:val"]??r?.attrs.val??")",body:s?kt(s):[]}}case"func":{let o=B(e,"fName"),n=B(e,"e");return{type:"func",base:o?kt(o):[],argument:n?kt(n):[]}}case"groupChr":{let o=B(e,"groupChrPr"),n=o?B(o,"chr"):void 0,r=B(e,"e");return{type:"groupChar",operator:n?.attrs["m:val"]??n?.attrs.val??"\u23DF",base:r?kt(r):[]}}case"acc":{let o=B(e,"accPr"),n=o?B(o,"chr"):void 0,r=B(e,"e");return{type:"accent",operator:n?.attrs["m:val"]??n?.attrs.val??"\u0302",base:r?kt(r):[]}}case"bar":{let o=B(e,"e");return{type:"bar",base:o?kt(o):[]}}case"limLow":{let o=B(e,"e"),n=B(e,"lim");return{type:"limLow",base:o?kt(o):[],argument:n?kt(n):[]}}case"limUpp":{let o=B(e,"e"),n=B(e,"lim");return{type:"limUpp",base:o?kt(o):[],argument:n?kt(n):[]}}case"m":{let o=[];for(let n of ut(e,"mr")){let r=[];for(let s of ut(n,"e")){let i=kt(s);i.length===1?r.push(i[0]):r.push({type:"text",text:i.map(a=>a.text??"").join("")})}o.push(r)}return{type:"matrix",rows:o}}case"eqArr":{let o=[];for(let n of ut(e,"e"))o.push(kt(n));return{type:"eqArr",rows:o}}default:return null}}function ha(e,t,o,n){let r=t("xl/metadata.xml");if(!r)return;let s=Lt(r),i=B(s,"valueMetadata");if(!i)return;let a=ut(i,"bk"),l=s.children.find(x=>typeof x!="string"&&ct(x.tag)==="futureMetadata"),h=l?ut(l,"bk"):[],c=t("xl/richData/rdrichvalue.xml");if(!c)return;let m=Lt(c),d=ut(m,"rv"),f=t("xl/richData/_rels/richValueRel.xml.rels");if(!f)return;let p=rn(f),g=t("xl/richData/richValueRel.xml");if(!g)return;let u=Lt(g),$=ut(u,"rel");for(let[x,b]of e){let F=a[b-1];if(!F)continue;let y=F.children.find(N=>typeof N!="string"&&ct(N.tag)==="rc");if(!y)continue;let v=parseInt(y.attrs.v??"-1",10);if(v<0)continue;let w=h[v];if(!w)continue;let R=wt(w,"rvb"),T=parseInt(R?.attrs.i??"-1",10);if(T<0)continue;let S=d[T];if(!S)continue;let M=ut(S,"v"),D=parseInt(M[0]?.text??"-1",10);if(D<0)continue;let k=$[D];if(!k)continue;let W=k.attrs["r:id"]??"",Q=p.get(W);if(!Q)continue;let q=Q.target.startsWith("/")?Q.target.slice(1):`xl/richData/${Q.target}`,E=o(q);if(!E)continue;let _=q.split(".").pop()??"png",P=Yn(_);n.addCellImage({data:E.data,format:P,cell:x})}}function wt(e,t){for(let o of e.children){if(typeof o=="string")continue;if(ct(o.tag)===t)return o;let n=wt(o,t);if(n)return n}}function We(e,t){let o=e.replace(/\/$/,"").split("/");for(let n of t.split("/"))n===".."?o.pop():n!=="."&&o.push(n);return o.join("/")}async function Qn(e){let t=await tn(e),o=E=>t.get(E)??t.get(E.replace(/^\//,"")),n=E=>{let _=o(E);return _?Co(_):void 0},r=n("[Content_Types].xml")??"<Types/>",s=Ns(r),i=n("xl/_rels/workbook.xml.rels")??"<Relationships/>",a=rn(i),l=n("xl/workbook.xml")??"<workbook/>",h=n("xl/styles.xml")??"<styleSheet/>",c=Xs(h),m=n("xl/sharedStrings.xml")??"<sst/>",d=m!=="<sst/>"?Us(m):[],f=n("docProps/core.xml")??"",p=f?Wn(f):{},g=n("docProps/app.xml")??"",u={},$="";if(g){let E=Hn(g);u=E.props,$=E.unknownRaw}let x=n("docProps/custom.xml")??"",b=x?zn(x):[],F=Lt(l),y=oe(F,"sheets"),v=y?ut(y,"sheet"):[],w=[],R=oe(F,"definedNames");if(R)for(let E of ut(R,"definedName")){let _=E.attrs.name??"",P=E.text??"";if(!_||!P)continue;let N={name:_,ref:P};if(E.attrs.localSheetId!==void 0){let H=parseInt(E.attrs.localSheetId,10),V=v[H];V&&(N.scope=V.attrs.name??void 0)}E.attrs.comment&&(N.comment=E.attrs.comment),w.push(N)}let T=new Map;for(let[E,_]of t)E.includes("_rels/")&&T.set(E,rn(Co(_)));let S=[];for(let E of v){let _=E.attrs["r:id"]??Object.values(E.attrs).find(U=>U.startsWith("rId"))??"",P=E.attrs.sheetId??"",N=E.attrs.name??`Sheet${P}`,H=a.get(_);if(!H)continue;let V=H.target.startsWith("/")?H.target.slice(1):`xl/${H.target}`,K=n(V)??"";if(!K)continue;let{ws:z,originalXml:mt,unknownParts:it,tableRIds:gt,legacyDrawingRId:St,ctrlPropRIds:J,drawingRId:G,vmCells:X}=Vs(K,N,c,d);z.sheetIndex=S.length+1,z.rId=_;let C=[],A=[];if(gt.length){let U=V.split("/").pop()??"",Y=V.substring(0,V.lastIndexOf("/")+1),rt=`${Y}_rels/${U}.rels`,ht=T.get(rt);if(ht){for(let tt of gt){let ft=ht.get(tt);if(!ft)continue;let j=ft.target.startsWith("/")?ft.target.slice(1):We(Y,ft.target),et=n(j);if(et){let L=ea(et);L&&z.addTable(L),C.push(j),A.push(et)}}z.tableRIds=gt}}if(St&&J.length){let U=V.split("/").pop()??"",Y=V.substring(0,V.lastIndexOf("/")+1),rt=`${Y}_rels/${U}.rels`,ht=T.get(rt);if(ht){let tt=ht.get(St),ft=tt?tt.target.startsWith("/")?tt.target.slice(1):We(Y,tt.target):"",j=ft?n(ft):"",et=[];if(j){let L=Lt(j);for(let $t of L.children){if(typeof $t=="string"||ct($t.tag)!=="shape")continue;let ot=$t.children.find(bt=>typeof bt!="string"&&ct(bt.tag)==="ClientData");if(!ot)continue;let Ft=ot.attrs.ObjectType??"";if(Ft==="Note"||!Ft)continue;let xt=($t.attrs.id??"").replace(/\D/g,""),at=parseInt(xt,10)||0;et.push({objectType:Ft,shapeXml:so($t),clientData:ot,shapeId:at})}}for(let L=0;L<J.length;L++){let $t=ht.get(J[L]);if(!$t)continue;let ot=$t.target.startsWith("/")?$t.target.slice(1):We(Y,$t.target),Ft=n(ot)??"",xt=Ft?Lt(Ft):null,at=xt?.attrs.objectType??"",bt=Fn[at]??"button",Z=et[L],yt=ma(Z?.clientData),nt={type:bt,from:yt.from,to:yt.to,_ctrlPropXml:Ft||void 0,_vmlShapeXml:Z?.shapeXml,_shapeId:Z?.shapeId};if(xt){if(xt.attrs.fmlaLink&&(nt.linkedCell=xt.attrs.fmlaLink),xt.attrs.fmlaRange&&(nt.inputRange=xt.attrs.fmlaRange),xt.attrs.checked&&(nt.checked=Sn[xt.attrs.checked]??"unchecked"),xt.attrs.dropLines&&(nt.dropLines=parseInt(xt.attrs.dropLines,10)),xt.attrs.min&&(nt.min=parseInt(xt.attrs.min,10)),xt.attrs.max&&(nt.max=parseInt(xt.attrs.max,10)),xt.attrs.inc&&(nt.inc=parseInt(xt.attrs.inc,10)),xt.attrs.page&&(nt.page=parseInt(xt.attrs.page,10)),xt.attrs.val&&(nt.val=parseInt(xt.attrs.val,10)),xt.attrs.selType){let dt={Single:"single",Multi:"multi",Extend:"extend"};nt.selType=dt[xt.attrs.selType]??"single"}xt.attrs.noThreeD==="1"&&(nt.noThreeD=!0)}if(Z?.clientData){let dt=Z.clientData.children.find(pt=>typeof pt!="string"&&ct(pt.tag)==="FmlaMacro");dt&&(nt.macro=dt.text??"")}z.addFormControl(nt)}z.legacyDrawingRId=St,z.ctrlPropRIds=J}}if(G){let U=V.split("/").pop()??"",Y=V.substring(0,V.lastIndexOf("/")+1),rt=`${Y}_rels/${U}.rels`,ht=T.get(rt);if(ht){let tt=ht.get(G);if(tt){let ft=tt.target.startsWith("/")?tt.target.slice(1):We(Y,tt.target),j=n(ft);if(j){let et=ft.substring(0,ft.lastIndexOf("/")+1),L=ft.split("/").pop()??"",$t=`${et}_rels/${L}.rels`,ot=T.get($t);oa(j,ot,et,o,z)}}}}X.size>0&&ha(X,n,o,z),S.push({ws:z,sheetId:P,rId:_,originalXml:mt,unknownParts:it,tablePaths:C,tableXmls:A})}let M=n("xl/connections.xml")??"",D=[];if(M){let E=Lt(M);for(let _ of ut(E,"connection")){let P=parseInt(_.attrs.id??"0",10),N=_.attrs.name??"",H=parseInt(_.attrs.type??"0",10),V=fa(H);if(!N||!V)continue;let K={id:P,name:N,type:V};_.attrs.description&&(K.description=_.attrs.description),_.attrs.refreshOnLoad==="1"&&(K.refreshOnLoad=!0),_.attrs.background==="1"&&(K.background=!0),_.attrs.saveData==="1"&&(K.saveData=!0),_.attrs.keepAlive==="1"&&(K.keepAlive=!0),_.attrs.interval&&(K.interval=parseInt(_.attrs.interval,10));let z=B(_,"dbPr");z&&(z.attrs.connection&&(K.connectionString=z.attrs.connection),z.attrs.command&&(K.command=z.attrs.command),z.attrs.commandType&&(K.commandType=ua(parseInt(z.attrs.commandType,10)))),K._rawXml=so(_),D.push(K)}}let k=[];for(let[E,_]of t)if(!(!E.startsWith("customXml/item")||E.includes("Props")||E.includes("_rels")))try{let P=await ga(_.data);if(P.length){k.push(...P);break}}catch{}let W=new Set(["xl/workbook.xml","xl/styles.xml","xl/sharedStrings.xml","xl/worksheets/","docProps/","[Content_Types].xml","_rels/","xl/_rels/","xl/connections.xml"]),Q=new Map;for(let[E,_]of t){if(E.endsWith("_rels/")||E==="[Content_Types].xml")continue;[...W].some(N=>E.startsWith(N))||Q.set(E,_.data)}let q=[];for(let E of w)if(E.name==="_xlnm.Print_Area"&&E.scope){let _=S.find(P=>P.ws.name===E.scope);_&&(_.ws.printArea=E.ref)}else q.push(E);return{sheets:S,styles:c,stylesXml:h,sharedStrings:d,sharedXml:m,workbookXml:l,workbookRels:a,contentTypes:s,contentTypesXml:r,core:p,extended:u,extendedUnknownRaw:$,custom:b,hasCustomProps:b.length>0,namedRanges:q,connections:D,connectionsXml:M,powerQueries:k,unknownParts:Q,allRels:T}}function ma(e){let t={from:{col:0,row:0},to:{col:2,row:2}};if(!e)return t;let o=e.children.find(s=>typeof s!="string"&&ct(s.tag)==="Anchor");if(!o)return t;let r=(o.text??"").split(",").map(s=>parseInt(s.trim(),10));return r.length<8||r.some(isNaN)?t:{from:{col:r[0],colOff:r[1],row:r[2],rowOff:r[3]},to:{col:r[4],colOff:r[5],row:r[6],rowOff:r[7]}}}var Jn={1:"odbc",2:"dao",3:"file",4:"web",5:"oledb",6:"text",7:"dsp"},da=Object.fromEntries(Object.entries(Jn).map(([e,t])=>[t,Number(e)]));function fa(e){return Jn[e]}function tr(e){return da[e]}var er={1:"sql",2:"table",3:"default",4:"web",5:"oledb"},pa=Object.fromEntries(Object.entries(er).map(([e,t])=>[t,Number(e)]));function ua(e){return er[e]}function or(e){return pa[e]}async function ga(e){if(e.length<12)return[];let t=new DataView(e.buffer,e.byteOffset,e.byteLength);if(t.getUint32(0,!0)!==0)return[];let n=t.getUint32(4,!0);if(n<4||8+n>e.length)return[];let r=e.subarray(8,8+n);if(r[0]!==80||r[1]!==75)return[];let s=await tn(r),i=[];for(let[a,l]of s){if(!a.includes("/Formula/")||!a.endsWith(".m"))continue;let h=Co(l);if(!h)continue;let c=a.match(/Formulas\/([^/]+)\//),m=c?c[1]:void 0,d=/shared\s+(?:#"([^"]+)"|(\w+))\s*=/g,f,p=new Set;for(;(f=d.exec(h))!==null;){let g=f[1]??f[2];p.add(g)}if(p.size>0){let g=/shared\s+(?:#"([^"]+)"|(\w+))\s*=\s*([\s\S]*?)(?=,\s*shared\s|\]\s*$)/g,u;for(;(u=g.exec(h))!==null;){let $=u[1]??u[2],x=u[3].replace(/,\s*$/,"").trim();i.push({name:$,formula:x})}i.length===0&&i.push({name:m??"Section1",formula:h})}else m&&i.push({name:m,formula:h})}return i}var ao=class e{constructor(){this.sheets=[],this.namedRanges=[],this.connections=[],this.powerQueries=[],this.externalLinks=[],this.customPivotStyles=[],this.pivotSlicers=[],this.properties={},this.compressionLevel=6,this.coreProperties={},this.extendedProperties={},this.customProperties=[],this.isTemplate=!1,this._dirtySheets=new Set,this._customTableStyles=new Map}markDirty(t){if(typeof t=="string"){let o=this.sheets.findIndex(n=>n.name===t);o>=0&&this._dirtySheets.add(o)}else this._dirtySheets.add(t)}static async fromBytes(t){let o=new e,n=await Qn(t);o._readResult=n,o.coreProperties=n.core,o.extendedProperties=n.extended,o.customProperties=n.custom,o.properties={title:n.core.title,author:n.core.creator,subject:n.core.subject,description:n.core.description,keywords:n.core.keywords,company:n.extended.company,lastModifiedBy:n.core.lastModifiedBy,created:n.core.created,modified:n.core.modified,category:n.core.category,status:n.core.contentStatus},o.sheets=n.sheets.map(i=>i.ws),o.namedRanges=n.namedRanges,o.connections=n.connections,o.powerQueries=n.powerQueries;let r=n.unknownParts.get("xl/vbaProject.bin");if(r)try{o.vbaProject=oo.fromBytes(r)}catch{}let s=n.workbookXml.match(/<calcPr([^>]*)\/?>/);if(s){let i=s[1],a={},l=i.match(/calcMode="([^"]+)"/);l&&(a.calcMode=l[1]),/fullCalcOnLoad="1"/.test(i)?a.fullCalcOnLoad=!0:/fullCalcOnLoad="0"/.test(i)&&(a.fullCalcOnLoad=!1),/iterate="1"/.test(i)&&(a.iterate=!0);let h=i.match(/iterateCount="(\d+)"/);h&&(a.iterateCount=parseInt(h[1],10));let c=i.match(/iterateDelta="([^"]+)"/);c&&(a.iterateDelta=parseFloat(c[1])),/fullPrecision="1"/.test(i)?a.fullPrecision=!0:/fullPrecision="0"/.test(i)&&(a.fullPrecision=!1),/calcOnSave="1"/.test(i)?a.calcOnSave=!0:/calcOnSave="0"/.test(i)&&(a.calcOnSave=!1),/concurrentCalc="1"/.test(i)?a.concurrentCalc=!0:/concurrentCalc="0"/.test(i)&&(a.concurrentCalc=!1),Object.keys(a).length>0&&(o.calcSettings=a)}return o}static async fromBase64(t){return e.fromBytes(le(t))}static async fromFile(t){let n=await(await import("fs/promises")).readFile(t);return e.fromBytes(new Uint8Array(n))}static async fromBlob(t){return e.fromBytes(new Uint8Array(await t.arrayBuffer()))}addSheet(t,o={}){let n=new Ie(t,o);return n.sheetIndex=this.sheets.length+1,this.sheets.push(n),this._dirtySheets.add(n.sheetIndex-1),n}getSheet(t){return this.sheets.find(o=>o.name===t)}getSheetByIndex(t){return this.sheets[t]}getSheetNames(){return this.sheets.map(t=>t.name)}getSheets(){return this.sheets}removeSheet(t){return this.sheets=this.sheets.filter(o=>o.name!==t),this}addChartSheet(t,o){let n=this.addSheet(t);return n._isChartSheet=!0,n.addChart(o),n}addDialogSheet(t){let o=this.addSheet(t);return o._isDialogSheet=!0,o}copySheet(t,o){let n=this.getSheet(t);if(!n)throw new Error(`Sheet "${t}" not found`);let r=this.addSheet(o),s=n.readAllCells();for(let{row:a,col:l,cell:h}of s){let c=r.getCell(a,l);h.value!=null&&(c.value=h.value),h.formula&&(c.formula=h.formula),h.arrayFormula&&(c.arrayFormula=h.arrayFormula),h.richText&&(c.richText=h.richText.map(m=>({...m,font:m.font?{...m.font}:void 0}))),h.style&&(c.style={...h.style}),h.comment&&(c.comment={...h.comment}),h.hyperlink&&(c.hyperlink={...h.hyperlink})}for(let a of n.getMerges())r.merge(a.startRow,a.startCol,a.endRow,a.endCol);let i=n.getUsedRange();if(i)for(let a=i.startCol;a<=i.endCol;a++){let l=n.getColumn(a);l&&r.setColumn(a,{...l})}return n.pageSetup&&(r.pageSetup={...n.pageSetup}),n.printArea&&(r.printArea=n.printArea),r}registerTableStyle(t,o){return this._customTableStyles.set(t,o),this}addNamedRange(t){return this.namedRanges.push(t),this}getNamedRanges(){return this.namedRanges}getNamedRange(t){return this.namedRanges.find(o=>o.name===t)}removeNamedRange(t){return this.namedRanges=this.namedRanges.filter(o=>o.name!==t),this}addConnection(t){return this.connections.push(t),this}getConnections(){return this.connections}getConnection(t){return this.connections.find(o=>o.name===t)}removeConnection(t){return this.connections=this.connections.filter(o=>o.name!==t),this}getPowerQueries(){return this.powerQueries}getPowerQuery(t){return this.powerQueries.find(o=>o.name===t)}getCustomProperty(t){return this.customProperties.find(o=>o.name===t)}setCustomProperty(t,o){let n=this.customProperties.findIndex(r=>r.name===t);return n>=0?this.customProperties[n]={name:t,value:o}:this.customProperties.push({name:t,value:o}),this}removeCustomProperty(t){return this.customProperties=this.customProperties.filter(o=>o.name!==t),this}addExternalLink(t){return this.externalLinks.push(t),this}getExternalLinks(){return this.externalLinks}registerPivotStyle(t){return this.customPivotStyles.push(t),this}addPivotSlicer(t){return this.pivotSlicers.push(t),this}getPivotSlicers(){return this.pivotSlicers}async build(){return this._syncLegacyProperties(),this._readResult?this._buildPatched():this._buildFresh()}async _buildPatched(){let t=this._readResult,o=[],n=this._dirtySheets.size>0,r=new Oe,s=new Le,i=new Map;if(n){let c=/<dxf>([\s\S]*?)<\/dxf>|<dxf\/>/g,m=[],d;for(;(d=c.exec(t.stylesXml))!==null;)m.push(d[1]??"");m.length&&r.prependRawDxfs(m);for(let f=0;f<this.sheets.length;f++)i.set(f,this.sheets[f].toXml(r,s))}o.push({name:"docProps/core.xml",data:st(en({...t.core,...this.coreProperties,modified:new Date}))}),o.push({name:"docProps/app.xml",data:st(on({...t.extended,...this.extendedProperties,titlesOfParts:this.sheets.map(c=>c.name),headingPairs:this._headingPairs()},t.extendedUnknownRaw))});let a=this.customProperties.length>0?this.customProperties:t.hasCustomProps?t.custom:null;a&&a.length>0&&o.push({name:"docProps/custom.xml",data:st(nn(a))}),o.push({name:"xl/workbook.xml",data:st(this._patchWorkbookXml(t.workbookXml))});let l=this._connectionsXml(t.connectionsXml);l&&o.push({name:"xl/connections.xml",data:st(l)}),n?(o.push({name:"xl/styles.xml",data:st(r.toXml())}),o.push({name:"xl/sharedStrings.xml",data:st(s.toXml())})):(o.push({name:"xl/styles.xml",data:st(t.stylesXml)}),o.push({name:"xl/sharedStrings.xml",data:st(t.sharedXml)}));for(let c=0;c<this.sheets.length;c++){let m=this.sheets[c],f=`xl/${m._isChartSheet?"chartsheets":m._isDialogSheet?"dialogsheets":"worksheets"}/sheet${c+1}.xml`;n?m._isChartSheet?o.push({name:f,data:st(m.toChartSheetXml())}):m._isDialogSheet?o.push({name:f,data:st(m.toDialogSheetXml(r,s))}):o.push({name:f,data:st(i.get(c)??"")}):o.push({name:f,data:st(t.sheets[c]?.originalXml??"")})}let h=new Set;for(let c=0;c<this.sheets.length;c++){let d=this.sheets[c].getTables(),f=t.sheets[c]?.tablePaths??[],p=t.sheets[c]?.tableXmls??[];for(let g=0;g<d.length;g++){let u=f[g];if(u)if(h.add(u),g<p.length){let $=p[g],x=$.match(/\bref="([^"]+)"/);x&&x[1]!==d[g].ref&&($=$.replace(`ref="${x[1]}"`,`ref="${d[g].ref}"`)),o.push({name:u,data:st($)})}else{let $=u.match(/table(\d+)\.xml$/),x=$?parseInt($[1],10):g+1;o.push({name:u,data:st(Uo(d[g],x))})}}}for(let[c,m]of t.unknownParts)h.has(c)||c==="xl/vbaProject.bin"&&this.vbaProject||t.allRels.has(c)||n&&c==="xl/calcChain.xml"||o.push({name:c,data:m});this.vbaProject&&(this._ensureVbaSheetModules(),o.push({name:"xl/vbaProject.bin",data:this.vbaProject.build()})),o.push({name:"_rels/.rels",data:st(this._buildRootRels(a!=null&&a.length>0))}),o.push({name:"xl/_rels/workbook.xml.rels",data:st(this._buildWorkbookRels(t,n))});for(let[c,m]of t.allRels)c==="xl/_rels/workbook.xml.rels"||c==="_rels/.rels"||o.push({name:c,data:st(this._relsToXml(m))});return o.push({name:"[Content_Types].xml",data:st(this._patchContentTypes(t.contentTypesXml,a!=null&&a.length>0,n))}),Jo(o,{level:this.compressionLevel})}async _buildFresh(){let t=new Oe,o=new Le,n=[];for(let[C,A]of this._customTableStyles)t.registerTableStyle(C,A);let r=1;for(let C of this.sheets)C.rId=`rId${r++}`;let s=[],i=[],a=[],l=[],h=new Map,c=new Map,m=new Map,d=new Map,f=1,p=1,g=1,u=1,$=1,x=0,b=0,F=0;for(let C of this.sheets){let A=C.getImages(),U=C.getCharts(),Y=C.getTables(),rt=[],ht=[],tt=[];(A.length||U.length||C.getShapes().length||C.getWordArt().length||C.getMathEquations().length||C.getTableSlicers().length||C.getOleObjects().length)&&(C.drawingRId=`rId${r++}`);let ft=C.getFormControls();(C.getComments().length||ft.length)&&(C.legacyDrawingRId=`rId${r++}`);for(let ot of A){let Ft=`rId${r++}`;rt.push(Ft),s.push({ws:C,img:ot,ext:nr(ot.format),idx:f++})}for(let ot=0;ot<U.length;ot++){let Ft=`rId${r++}`;ht.push(Ft),i.push({ws:C,chartIdx:ot,globalIdx:p++})}for(let ot=0;ot<Y.length;ot++){let Ft=`rId${r++}`;tt.push(Ft),a.push({ws:C,tableIdx:ot,globalTableId:g++})}let j=[],et=[];for(let ot of C.getOleObjects())j.push(`rId${r++}`),ot.iconData?et.push(`rId${r++}`):et.push("");C.oleRIds=j,C.oleIconRIds=et;let L=[];for(let ot=0;ot<ft.length;ot++)L.push(`rId${r++}`);C.ctrlPropRIds=L,h.set(C,rt),c.set(C,ht),m.set(C,tt),C.tableRIds=tt;let $t=[];for(let ot of C.getPivotTables()){let Ft=`rId${r++}`,xt=`rId${r++}`;$t.push(Ft),l.push({ws:C,pt:ot,pivotIdx:$++,cacheId:x++,pivotRId:Ft,cacheRId:xt})}d.set(C,$t)}let y=[],v=f,w=1;for(let C of this.sheets){C._cellImageVm=new Map;for(let A of C.getCellImages()){let U=nr(A.format);y.push({img:A,ext:U,idx:v++}),C._cellImageVm.set(A.cell,w++),C.getCellByRef(A.cell)}}let R=y.length>0,T=new Map,S=[],M=0,D=0;for(let C of this.sheets)C.getTableSlicers().length&&T.set(C,{tableSlicers:[],pivotSlicers:[],slicerDefRId:"",slicerDefIdx:0});for(let C of this.pivotSlicers)for(let A of this.sheets)if(A.getPivotTables().some(U=>U.name===C.pivotTableName)){T.has(A)||T.set(A,{tableSlicers:[],pivotSlicers:[],slicerDefRId:"",slicerDefIdx:0});break}for(let[C,A]of T){C.drawingRId||(C.drawingRId=`rId${r++}`),A.slicerDefRId=`rId${r++}`,A.slicerDefIdx=++M,C.slicerRId=A.slicerDefRId;let U=[];for(let Y of C.getTableSlicers()){let rt=C.getTables().find(j=>j.name===Y.tableName),tt=a.find(j=>j.ws===C&&C.getTables()[j.tableIdx]===rt)?.globalTableId??1,ft=rt?(rt.columns?.findIndex(j=>j.name===Y.columnName)??0)+1:1;A.tableSlicers.push({slicer:Y,tableId:tt,columnIndex:ft}),U.push({name:Y.name,cell:Y.cell}),S.push({name:Y.name+"_cache",sourceName:Y.columnName,type:"table",rId:`rId${r++}`,idx:++D,tableId:tt,columnIndex:ft,sortOrder:Y.sortOrder??"ascending"})}for(let Y of this.pivotSlicers){let rt=C.getPivotTables().find(et=>et.name===Y.pivotTableName);if(!rt)continue;let ht=l.find(et=>et.ws===C&&et.pt===rt),tt=this.sheets.indexOf(C)+1,ft=[],j=this.sheets.find(et=>et.name===rt.sourceSheet);if(j){let et=j.readRange(rt.sourceRef),$t=(et[0]??[]).map(ot=>String(ot??"")).indexOf(Y.fieldName);if($t>=0){let ot=new Set;for(let Ft=1;Ft<et.length;Ft++)ot.add(String(et[Ft][$t]??""));ft=[...ot]}}A.pivotSlicers.push({slicer:Y,pivotCacheId:ht?.cacheId??0}),U.push({name:Y.name,cell:Y.cell}),S.push({name:Y.name+"_cache",sourceName:Y.fieldName,type:"pivot",rId:`rId${r++}`,idx:++D,pivotTableName:Y.pivotTableName,pivotCacheId:ht?.cacheId??0,tabId:tt,items:ft})}C._slicerDrawingInfo=U}let k=T.size>0,W=this.customProperties.length>0,Q=!!this.vbaProject,q=new Set;for(let{ext:C}of[...s,...y]){let A=xa(C);q.add(`<Default Extension="${C}" ContentType="${A}"/>`)}let E=this.sheets.filter(C=>C.getComments().length),P=this.sheets.filter(C=>C.getComments().length||C.getFormControls().length).length?'<Default Extension="vml" ContentType="application/vnd.openxmlformats-officedocument.vmlDrawing"/>':"",N=0,H=E.map(()=>`<Override PartName="/xl/comments${++N}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml"/>`).join(""),V=0,K=[];for(let C of this.sheets)if(!C._isDialogSheet)for(let A=0;A<C.getFormControls().length;A++)K.push(`<Override PartName="/xl/ctrlProps/ctrlProp${++V}.xml" ContentType="application/vnd.ms-excel.controlproperties+xml"/>`);let mt=this.sheets.some(C=>C.getOleObjects().length>0)?'<Default Extension="bin" ContentType="application/vnd.openxmlformats-officedocument.oleObject"/>':"";n.push({name:"[Content_Types].xml",data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
192
255
|
<Types xmlns="http://schemas.openxmlformats.org/package/2006/content-types">
|
|
193
256
|
<Default Extension="rels" ContentType="application/vnd.openxmlformats-package.relationships+xml"/>
|
|
194
257
|
<Default Extension="xml" ContentType="application/xml"/>
|
|
195
|
-
${
|
|
196
|
-
${
|
|
197
|
-
|
|
258
|
+
${P}
|
|
259
|
+
${mt}
|
|
260
|
+
${[...q].join("")}
|
|
261
|
+
<Override PartName="/xl/workbook.xml" ContentType="${Q?"application/vnd.ms-excel.sheet.macroEnabled.main+xml":this.isTemplate?"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml"}"/>
|
|
262
|
+
${Q?'<Override PartName="/xl/vbaProject.bin" ContentType="application/vnd.ms-office.vbaProject"/>':""}
|
|
198
263
|
<Override PartName="/xl/styles.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml"/>
|
|
199
264
|
<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
|
|
200
|
-
|
|
201
|
-
${this.sheets.filter(
|
|
202
|
-
${
|
|
203
|
-
${
|
|
204
|
-
${
|
|
265
|
+
<Override PartName="/xl/theme/theme1.xml" ContentType="application/vnd.openxmlformats-officedocument.theme+xml"/>
|
|
266
|
+
${this.sheets.filter(C=>!C._isChartSheet&&!C._isDialogSheet).map(C=>`<Override PartName="/xl/worksheets/sheet${this.sheets.indexOf(C)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml"/>`).join("")}
|
|
267
|
+
${this.sheets.filter(C=>C._isChartSheet).map(C=>`<Override PartName="/xl/chartsheets/sheet${this.sheets.indexOf(C)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml"/>`).join("")}
|
|
268
|
+
${this.sheets.filter(C=>C._isDialogSheet).map(C=>`<Override PartName="/xl/dialogsheets/sheet${this.sheets.indexOf(C)+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml"/>`).join("")}
|
|
269
|
+
${this.sheets.filter(C=>C.drawingRId).map((C,A)=>`<Override PartName="/xl/drawings/drawing${A+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawing+xml"/>`).join("")}
|
|
270
|
+
${i.map(({globalIdx:C})=>`<Override PartName="/xl/charts/chart${C}.xml" ContentType="application/vnd.openxmlformats-officedocument.drawingml.chart+xml"/>`).join("")}
|
|
271
|
+
${a.map(({globalTableId:C})=>`<Override PartName="/xl/tables/table${C}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml"/>`).join("")}
|
|
272
|
+
${l.map(C=>`<Override PartName="/xl/pivotTables/pivotTable${C.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml"/>`).join(`
|
|
273
|
+
`)}
|
|
274
|
+
${l.map(C=>`<Override PartName="/xl/pivotCache/pivotCacheDefinition${C.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml"/>`).join(`
|
|
275
|
+
`)}
|
|
276
|
+
${l.map(C=>`<Override PartName="/xl/pivotCache/pivotCacheRecords${C.pivotIdx}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml"/>`).join(`
|
|
277
|
+
`)}
|
|
278
|
+
${H}
|
|
279
|
+
${K.join("")}
|
|
205
280
|
<Override PartName="/docProps/core.xml" ContentType="application/vnd.openxmlformats-package.core-properties+xml"/>
|
|
206
281
|
<Override PartName="/docProps/app.xml" ContentType="application/vnd.openxmlformats-officedocument.extended-properties+xml"/>
|
|
207
|
-
${
|
|
208
|
-
|
|
282
|
+
${W?'<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>':""}
|
|
283
|
+
${this.connections.length?'<Override PartName="/xl/connections.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"/>':""}
|
|
284
|
+
${this.externalLinks.map((C,A)=>`<Override PartName="/xl/externalLinks/externalLink${A+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml"/>`).join(`
|
|
285
|
+
`)}
|
|
286
|
+
${[...T.values()].map(C=>`<Override PartName="/xl/slicers/slicer${C.slicerDefIdx}.xml" ContentType="application/vnd.ms-excel.slicer+xml"/>`).join(`
|
|
287
|
+
`)}
|
|
288
|
+
${S.map(C=>`<Override PartName="/xl/slicerCaches/slicerCache${C.idx}.xml" ContentType="application/vnd.ms-excel.slicerCache+xml"/>`).join(`
|
|
289
|
+
`)}
|
|
290
|
+
${this.sheets.flatMap(C=>C.getQueryTables()).map((C,A)=>`<Override PartName="/xl/queryTables/queryTable${A+1}.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.queryTable+xml"/>`).join(`
|
|
291
|
+
`)}
|
|
292
|
+
${R?`<Override PartName="/xl/metadata.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml"/>
|
|
293
|
+
<Override PartName="/xl/richData/rdrichvalue.xml" ContentType="application/vnd.ms-excel.rdrichvalue+xml"/>
|
|
294
|
+
<Override PartName="/xl/richData/rdRichValueStructure.xml" ContentType="application/vnd.ms-excel.rdrichvaluestructure+xml"/>
|
|
295
|
+
<Override PartName="/xl/richData/richValueRel.xml" ContentType="application/vnd.ms-excel.richvaluerel+xml"/>
|
|
296
|
+
<Override PartName="/xl/richData/rdRichValueTypes.xml" ContentType="application/vnd.ms-excel.rdrichvaluetypes+xml"/>
|
|
297
|
+
<Override PartName="/xl/richData/rdarray.xml" ContentType="application/vnd.ms-excel.rdarray+xml"/>`:""}
|
|
298
|
+
</Types>`)}),n.push({name:"_rels/.rels",data:st(this._buildRootRels(W))}),n.push({name:"xl/_rels/workbook.xml.rels",data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
209
299
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
210
|
-
${this.sheets.map((
|
|
300
|
+
${this.sheets.map((C,A)=>{let U=C._isChartSheet?"chartsheet":C._isDialogSheet?"dialogsheet":"worksheet",Y=C._isChartSheet?"chartsheets":C._isDialogSheet?"dialogsheets":"worksheets";return`<Relationship Id="${C.rId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/${U}" Target="${Y}/sheet${A+1}.xml"/>`}).join("")}
|
|
211
301
|
<Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>
|
|
212
302
|
<Relationship Id="rIdShared" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>
|
|
213
|
-
|
|
303
|
+
<Relationship Id="rIdTheme" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme" Target="theme/theme1.xml"/>
|
|
304
|
+
${l.map(C=>`<Relationship Id="${C.cacheRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition" Target="pivotCache/pivotCacheDefinition${C.pivotIdx}.xml"/>`).join(`
|
|
305
|
+
`)}
|
|
306
|
+
${S.map(C=>`<Relationship Id="${C.rId}" Type="http://schemas.microsoft.com/office/2007/relationships/slicerCache" Target="slicerCaches/slicerCache${C.idx}.xml"/>`).join(`
|
|
307
|
+
`)}
|
|
308
|
+
${Q?'<Relationship Id="rIdVBA" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" Target="vbaProject.bin"/>':""}
|
|
309
|
+
${this.connections.length?'<Relationship Id="rIdConns" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections" Target="connections.xml"/>':""}
|
|
310
|
+
${this.externalLinks.map((C,A)=>`<Relationship Id="rIdExtLink${A+1}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink" Target="externalLinks/externalLink${A+1}.xml"/>`).join(`
|
|
311
|
+
`)}
|
|
312
|
+
${R?'<Relationship Id="rIdMeta" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sheetMetadata" Target="metadata.xml"/>':""}
|
|
313
|
+
${R?'<Relationship Id="rIdRichValueRel" Type="http://schemas.microsoft.com/office/2022/10/relationships/richValueRel" Target="richData/richValueRel.xml"/>':""}
|
|
314
|
+
${R?'<Relationship Id="rIdRichValue" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValue" Target="richData/rdrichvalue.xml"/>':""}
|
|
315
|
+
${R?'<Relationship Id="rIdRichValueStruct" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValueStructure" Target="richData/rdRichValueStructure.xml"/>':""}
|
|
316
|
+
${R?'<Relationship Id="rIdRichValueTypes" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdRichValueTypes" Target="richData/rdRichValueTypes.xml"/>':""}
|
|
317
|
+
${R?'<Relationship Id="rIdRdArray" Type="http://schemas.microsoft.com/office/2017/06/relationships/rdArray" Target="richData/rdarray.xml"/>':""}
|
|
318
|
+
</Relationships>`)}),Q&&(this._ensureVbaSheetModules(),n.push({name:"xl/vbaProject.bin",data:this.vbaProject.build()}));let it=[this.properties.date1904?'date1904="1"':"",Q?'codeName="ThisWorkbook"':""].filter(Boolean).join(" "),gt=`<workbookPr${it?" "+it:""}/>`,St=this._definedNamesXml(S),J=l.length?`<pivotCaches>${l.map(C=>`<pivotCache cacheId="${C.cacheId}" r:id="${C.cacheRId}"/>`).join("")}</pivotCaches>`:"";n.push({name:"xl/workbook.xml",data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
214
319
|
<workbook xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
215
|
-
${
|
|
320
|
+
${gt}
|
|
216
321
|
<bookViews><workbookView xWindow="0" yWindow="0" windowWidth="14400" windowHeight="8260"/></bookViews>
|
|
217
|
-
<sheets>${this.sheets.map((
|
|
218
|
-
${
|
|
219
|
-
|
|
220
|
-
|
|
322
|
+
<sheets>${this.sheets.map((C,A)=>`<sheet name="${I(C.name)}" sheetId="${A+1}" r:id="${C.rId}"${C.options?.state&&C.options.state!=="visible"?` state="${C.options.state}"`:""}/>`).join("")}</sheets>
|
|
323
|
+
${St}
|
|
324
|
+
${this._calcPrXml()}
|
|
325
|
+
${J}
|
|
326
|
+
${k?(()=>{let C=S.filter(Y=>Y.type==="table"),A=S.filter(Y=>Y.type==="pivot"),U="<extLst>";return A.length&&(U+=`<ext uri="{BBE1A952-AA13-448e-AADC-164F8A28A991}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:slicerCaches>${A.map(Y=>`<x14:slicerCache r:id="${Y.rId}"/>`).join("")}</x14:slicerCaches></ext>`),C.length&&(U+=`<ext uri="{46BE6895-7355-4a93-B00E-2C351335B9C9}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x15:slicerCaches>${C.map(Y=>`<x14:slicerCache r:id="${Y.rId}"/>`).join("")}</x15:slicerCaches></ext>`),U+="</extLst>",U})():""}
|
|
327
|
+
</workbook>`)}),this.connections.length&&n.push({name:"xl/connections.xml",data:st(this._connectionsXml())});for(let C=0;C<this.sheets.length;C++){let A=this.sheets[C],U=h.get(A)??[],Y=c.get(A)??[],rt=a.filter(at=>at.ws===A),ht=m.get(A)??[],tt=A._isChartSheet?"chartsheets":A._isDialogSheet?"dialogsheets":"worksheets",ft=`xl/${tt}/sheet${C+1}.xml`;A._isChartSheet?n.push({name:ft,data:st(A.toChartSheetXml())}):A._isDialogSheet?n.push({name:ft,data:st(A.toDialogSheetXml(t,o))}):n.push({name:ft,data:st(A.toXml(t,o))});let j=[];if(A.drawingRId){let at=this.sheets.filter((bt,Z)=>Z<=C&&bt.drawingRId).length;j.push(`<Relationship Id="${A.drawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing" Target="../drawings/drawing${at}.xml"/>`)}for(let at=0;at<A.getImages().length;at++){let bt=s.filter(Z=>Z.ws===A)[at];bt&&j.push(`<Relationship Id="${U[at]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${bt.idx}.${bt.ext}"/>`)}for(let at=0;at<rt.length;at++)j.push(`<Relationship Id="${ht[at]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/table" Target="../tables/table${rt[at].globalTableId}.xml"/>`);let et=d.get(A)??[],L=l.filter(at=>at.ws===A);for(let at=0;at<L.length;at++)j.push(`<Relationship Id="${et[at]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable" Target="../pivotTables/pivotTable${L[at].pivotIdx}.xml"/>`);let $t=T.get(A);$t&&j.push(`<Relationship Id="${$t.slicerDefRId}" Type="http://schemas.microsoft.com/office/2007/relationships/slicer" Target="../slicers/slicer${$t.slicerDefIdx}.xml"/>`);let ot=A.getComments(),Ft=A.getFormControls();if((ot.length||Ft.length)&&A.legacyDrawingRId){let at=u++;if(j.push(`<Relationship Id="${A.legacyDrawingRId}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing" Target="../drawings/vmlDrawing${at}.vml"/>`),ot.length){let nt=`rId${r++}`;j.push(`<Relationship Id="${nt}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments" Target="../comments${at}.xml"/>`),n.push({name:`xl/comments${at}.xml`,data:st(this._buildCommentsXml(ot))})}let bt=ot.map(({row:nt,col:dt},pt)=>{let Rt=(dt+1)*64,Ee=(nt-1)*20;return`<v:shape id="_x0000_s${1025+C*1e3+pt}" type="#_x0000_t202" style="position:absolute;margin-left:${Rt}pt;margin-top:${Ee}pt;width:108pt;height:59.25pt;z-index:${pt+1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto">
|
|
328
|
+
<v:fill color2="#ffffe1"/>
|
|
329
|
+
<v:shadow color="black" obscured="t"/>
|
|
330
|
+
<v:path o:connecttype="none"/>
|
|
331
|
+
<v:textbox style="mso-direction-alt:auto"><div style="text-align:left"/></v:textbox>
|
|
332
|
+
<x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${dt+1},15,${nt-1},10,${dt+3},15,${nt+4},4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${nt-1}</x:Row><x:Column>${dt-1}</x:Column></x:ClientData>
|
|
333
|
+
</v:shape>`}),Z=1025+A.sheetIndex*1e3+ot.length,yt=Ft.map((nt,dt)=>Tn(nt,Z+dt));if(n.push({name:`xl/drawings/vmlDrawing${at}.vml`,data:st(kn(bt,yt))}),!A._isDialogSheet){let nt=A.ctrlPropRIds;for(let dt=0;dt<Ft.length;dt++){let pt=++b;j.push(`<Relationship Id="${nt[dt]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp" Target="../ctrlProps/ctrlProp${pt}.xml"/>`),n.push({name:`xl/ctrlProps/ctrlProp${pt}.xml`,data:st(In(Ft[dt]))})}}}let xt=A.getOleObjects();for(let at=0;at<xt.length;at++){let bt=xt[at],Z=++F,yt=A.oleRIds[at];if(bt.linkToFile)j.push(`<Relationship Id="${yt}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="${I(bt.linkPath??"")}" TargetMode="External"/>`);else{let nt=`xl/embeddings/oleObject${Z}.bin`;j.push(`<Relationship Id="${yt}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/oleObject" Target="../embeddings/oleObject${Z}.bin"/>`);let dt=bt.data?typeof bt.data=="string"?le(bt.data):bt.data:new Uint8Array(0);n.push({name:nt,data:dt})}if(bt.iconData){let nt=bt.iconFormat??"emf",dt=f++,pt=A.oleIconRIds[at];j.push(`<Relationship Id="${pt}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${dt}.${nt}"/>`);let Rt=typeof bt.iconData=="string"?le(bt.iconData):bt.iconData;n.push({name:`xl/media/image${dt}.${nt}`,data:Rt})}}if(j.length&&n.push({name:`xl/${tt}/_rels/sheet${C+1}.xml.rels`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
221
334
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
222
335
|
${j.join(`
|
|
223
336
|
`)}
|
|
224
|
-
</Relationships>`)}),
|
|
337
|
+
</Relationships>`)}),A.drawingRId){let at=this.sheets.filter((Z,yt)=>yt<=C&&Z.drawingRId).length;n.push({name:`xl/drawings/drawing${at}.xml`,data:st(A.toDrawingXml(U,Y))});let bt=[];for(let Z=0;Z<A.getImages().length;Z++){let yt=s.filter(nt=>nt.ws===A)[Z];yt&&bt.push(`<Relationship Id="${U[Z]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="../media/image${yt.idx}.${yt.ext}"/>`)}for(let Z=0;Z<A.getCharts().length;Z++){let yt=i.filter(nt=>nt.ws===A)[Z];yt&&bt.push(`<Relationship Id="${Y[Z]}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/chart" Target="../charts/chart${yt.globalIdx}.xml"/>`)}bt.length&&n.push({name:`xl/drawings/_rels/drawing${at}.xml.rels`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
225
338
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
226
|
-
${
|
|
339
|
+
${bt.join(`
|
|
227
340
|
`)}
|
|
228
|
-
</Relationships>`)})}}for(let{img:
|
|
341
|
+
</Relationships>`)})}}for(let{img:C,ext:A,idx:U}of s)n.push({name:`xl/media/image${U}.${A}`,data:typeof C.data=="string"?le(C.data):C.data});if(R){let C=[],A=[];for(let U=0;U<y.length;U++){let{img:Y,ext:rt,idx:ht}=y[U],tt=`rId${U+1}`;C.push(tt),A.push(`<Relationship Id="${tt}" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/image" Target="/xl/media/image${ht}.${rt}"/>`),n.push({name:`xl/media/image${ht}.${rt}`,data:typeof Y.data=="string"?le(Y.data):Y.data})}n.push({name:"xl/metadata.xml",data:st($a(y.length))}),n.push({name:"xl/richData/rdrichvalue.xml",data:st(ya(y.length))}),n.push({name:"xl/richData/richValueRel.xml",data:st(wa(C))}),n.push({name:"xl/richData/rdRichValueStructure.xml",data:st(ba())}),n.push({name:"xl/richData/rdRichValueTypes.xml",data:st(Ca())}),n.push({name:"xl/richData/rdarray.xml",data:st('<?xml version="1.0" encoding="UTF-8" standalone="yes"?><arrayData xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2" count="0"></arrayData>')}),n.push({name:"xl/richData/_rels/richValueRel.xml.rels",data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
229
342
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
230
|
-
${
|
|
343
|
+
${A.join(`
|
|
344
|
+
`)}
|
|
345
|
+
</Relationships>`)})}for(let{ws:C,chartIdx:A,globalIdx:U}of i)n.push({name:`xl/charts/chart${U}.xml`,data:st(bn(C.getCharts()[A]))});for(let{ws:C,tableIdx:A,globalTableId:U}of a)n.push({name:`xl/tables/table${U}.xml`,data:st(Uo(C.getTables()[A],U))});for(let{ws:C,pt:A,pivotIdx:U,cacheId:Y}of l){let rt=this.sheets.find(L=>L.name===A.sourceSheet),ht=rt?rt.readRange(A.sourceRef):[[]],{pivotTableXml:tt,cacheDefXml:ft,cacheRecordsXml:j}=Cn(A,ht,U,Y),et=(L,$t)=>`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
346
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
347
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/${L}" Target="${$t}"/>
|
|
348
|
+
</Relationships>`;n.push({name:`xl/pivotTables/pivotTable${U}.xml`,data:st(tt)}),n.push({name:`xl/pivotTables/_rels/pivotTable${U}.xml.rels`,data:st(et("pivotCacheDefinition",`../pivotCache/pivotCacheDefinition${U}.xml`))}),n.push({name:`xl/pivotCache/pivotCacheDefinition${U}.xml`,data:st(ft)}),n.push({name:`xl/pivotCache/_rels/pivotCacheDefinition${U}.xml.rels`,data:st(et("pivotCacheRecords",`pivotCacheRecords${U}.xml`))}),n.push({name:`xl/pivotCache/pivotCacheRecords${U}.xml`,data:st(j)})}n.push({name:"xl/styles.xml",data:st(t.toXml())}),n.push({name:"xl/sharedStrings.xml",data:st(o.toXml())}),n.push({name:"xl/theme/theme1.xml",data:st(this._buildThemeXml())});for(let C=0;C<this.externalLinks.length;C++){let A=this.externalLinks[C],U=C+1,Y=A.sheets.map(rt=>{let ht=rt.definedNames?.map(tt=>`<definedName name="${I(tt.name)}" refersTo="${I(tt.ref)}"/>`).join("")??"";return`<sheetName val="${I(rt.name)}"/>${ht?`<sheetDataSet>${ht}</sheetDataSet>`:""}`}).join("");n.push({name:`xl/externalLinks/externalLink${U}.xml`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
349
|
+
<externalLink xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">
|
|
350
|
+
<externalBook r:id="rId1"><sheetNames>${Y}</sheetNames></externalBook>
|
|
351
|
+
</externalLink>`)}),n.push({name:`xl/externalLinks/_rels/externalLink${U}.xml.rels`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
352
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
353
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLinkPath" Target="${I(A.target)}" TargetMode="External"/>
|
|
354
|
+
</Relationships>`)})}for(let[C,A]of T){let U=[];for(let Y of A.tableSlicers){let rt=Y.slicer;U.push(`<slicer name="${I(rt.name)}" cache="${I(rt.name+"_cache")}" caption="${I(rt.caption??rt.columnName)}" rowHeight="241300" columnCount="${rt.columnCount??1}" style="${rt.style??"SlicerStyleLight1"}"/>`)}for(let Y of A.pivotSlicers){let rt=Y.slicer;U.push(`<slicer name="${I(rt.name)}" cache="${I(rt.name+"_cache")}" caption="${I(rt.caption??rt.fieldName)}" rowHeight="241300" columnCount="${rt.columnCount??1}" style="${rt.style??"SlicerStyleLight1"}"/>`)}n.push({name:`xl/slicers/slicer${A.slicerDefIdx}.xml`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
355
|
+
<slicers xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" mc:Ignorable="x">
|
|
356
|
+
${U.join(`
|
|
357
|
+
`)}
|
|
358
|
+
</slicers>`)})}for(let C of S){let A;if(C.type==="table")A=`<extLst><x:ext uri="{2F2917AC-EB37-4324-AD4E-5DD8C200BD13}" xmlns:x15="http://schemas.microsoft.com/office/spreadsheetml/2010/11/main"><x15:tableSlicerCache tableId="${C.tableId}" column="${C.columnIndex}" sortOrder="${C.sortOrder??"ascending"}"/></x:ext></extLst>`;else{let U=(C.items??[]).map((Y,rt)=>`<i x="${rt}" s="1"/>`).join("");A=`<pivotTables><pivotTable tabId="${C.tabId}" name="${I(C.pivotTableName??"")}"/></pivotTables>`+(C.items?.length?`<data><tabular pivotCacheId="${C.pivotCacheId}" showMissing="0"><items count="${C.items.length}">${U}</items></tabular></data>`:"")}n.push({name:`xl/slicerCaches/slicerCache${C.idx}.xml`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
359
|
+
<slicerCacheDefinition xmlns="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x" name="${I(C.name)}" sourceName="${I(C.sourceName)}">
|
|
360
|
+
${A}
|
|
361
|
+
</slicerCacheDefinition>`)})}let G=this.sheets.flatMap(C=>C.getQueryTables());for(let C=0;C<G.length;C++){let A=G[C];n.push({name:`xl/queryTables/queryTable${C+1}.xml`,data:st(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
362
|
+
<queryTable xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" name="${I(A.name)}" connectionId="${A.connectionId}" autoFormatId="16" applyNumberFormats="0" applyBorderFormats="0" applyFontFormats="0" applyPatternFormats="0" applyAlignmentFormats="0" applyWidthHeightFormats="0">
|
|
363
|
+
<queryTableRefresh nextId="${(A.columns?.length??0)+1}">
|
|
364
|
+
<queryTableFields count="${A.columns?.length??0}">
|
|
365
|
+
${(A.columns??[]).map((U,Y)=>`<queryTableField id="${Y+1}" name="${I(U)}" tableColumnId="${Y+1}"/>`).join(`
|
|
366
|
+
`)}
|
|
367
|
+
</queryTableFields>
|
|
368
|
+
</queryTableRefresh>
|
|
369
|
+
</queryTable>`)})}let X={...this.coreProperties,created:this.coreProperties.created??new Date,modified:new Date};return!X.creator&&this.properties.author&&(X.creator=this.properties.author),n.push({name:"docProps/core.xml",data:st(en(X))}),n.push({name:"docProps/app.xml",data:st(on({...this.extendedProperties,application:this.extendedProperties.application??"ExcelForge",company:this.extendedProperties.company??this.properties.company,titlesOfParts:this.sheets.map(C=>C.name),headingPairs:this._headingPairs()}))}),W&&n.push({name:"docProps/custom.xml",data:st(nn(this.customProperties))}),Jo(n,{level:this.compressionLevel})}_headingPairs(){let t=this.sheets.filter(s=>!s._isChartSheet&&!s._isDialogSheet).length,o=this.sheets.filter(s=>s._isChartSheet).length,n=this.sheets.filter(s=>s._isDialogSheet).length,r=[];return t&&r.push({name:"Worksheets",count:t}),o&&r.push({name:"Charts",count:o}),n&&r.push({name:"Dialogs",count:n}),r.length||r.push({name:"Worksheets",count:0}),r}_syncLegacyProperties(){let t=this.properties;t.title&&(this.coreProperties.title??=t.title),t.author&&(this.coreProperties.creator??=t.author),t.subject&&(this.coreProperties.subject??=t.subject),t.description&&(this.coreProperties.description??=t.description),t.keywords&&(this.coreProperties.keywords??=t.keywords),t.company&&(this.extendedProperties.company??=t.company),t.lastModifiedBy&&(this.coreProperties.lastModifiedBy??=t.lastModifiedBy),t.created&&(this.coreProperties.created??=t.created),t.category&&(this.coreProperties.category??=t.category),t.status&&(this.coreProperties.contentStatus??=t.status)}_ensureVbaSheetModules(){if(!(!this.vbaProject||this.vbaProject.modules.filter(o=>o.type==="document"&&o.name!=="ThisWorkbook").length>=this.sheets.length))for(let o of this.sheets){let n=o.name.replace(/[^A-Za-z0-9_]/g,"_");this.vbaProject.getModule(n)||this.vbaProject.addModule({name:n,type:"document",code:""})}}_patchWorkbookXml(t){let o=t;for(let r=0;r<this.sheets.length;r++)o=o.replace(new RegExp(`(<sheet[^>]+sheetId="${r+1}"[^>]+)name="[^"]*"`),`$1name="${I(this.sheets[r].name)}"`);this.vbaProject&&!o.includes("codeName=")&&(o=o.replace("<workbookPr",'<workbookPr codeName="ThisWorkbook"'),o.includes("<workbookPr")||(o=o.replace("<bookViews",'<workbookPr codeName="ThisWorkbook"/><bookViews')));let n=this._definedNamesXml();if(o.includes("<definedNames")?o=o.replace(/<definedNames[\s\S]*?<\/definedNames>/,n):n&&(o=o.replace("</sheets>",`</sheets>${n}`)),this.calcSettings){let r=this._calcPrXml();o.includes("<calcPr")?o=o.replace(/<calcPr[^>]*\/>|<calcPr[^>]*>[\s\S]*?<\/calcPr>/,r):o=o.replace("</workbook>",`${r}</workbook>`)}return o}_definedNamesXml(t){let o=[];for(let s of this.sheets)if(s.printArea){let i=s.printArea.includes("!")?s.printArea:`'${s.name}'!${s.printArea}`;o.push({name:"_xlnm.Print_Area",ref:i,scope:s.name})}let n=(t??[]).map(s=>({name:s.name,ref:"#N/A"})),r=[...this.namedRanges,...o,...n];return r.length?`<definedNames>${r.map(s=>{let i=`name="${I(s.name)}"`;if(s.scope){let a=this.sheets.findIndex(l=>l.name===s.scope);a>=0&&(i+=` localSheetId="${a}"`)}return s.comment&&(i+=` comment="${I(s.comment)}"`),`<definedName ${i}>${I(s.ref)}</definedName>`}).join("")}</definedNames>`:""}_calcPrXml(){let t=this.calcSettings,o='calcId="191028"';return t&&(t.calcMode==="manual"?o+=' calcMode="manual"':t.calcMode==="autoNoTable"&&(o+=' calcMode="autoNoTable"'),t.fullCalcOnLoad&&(o+=' fullCalcOnLoad="1"'),t.iterate&&(o+=' iterate="1"',t.iterateCount!=null&&(o+=` iterateCount="${t.iterateCount}"`),t.iterateDelta!=null&&(o+=` iterateDelta="${t.iterateDelta}"`)),t.fullPrecision===!1&&(o+=' fullPrecision="0"'),t.calcOnSave===!1&&(o+=' calcOnSave="0"'),t.concurrentCalc===!1&&(o+=' concurrentCalc="0"')),`<calcPr ${o}/>`}_connectionsXml(t){return this.connections.length?`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
370
|
+
<connections xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">${this.connections.map(o=>{if(o._rawXml)return o._rawXml;let n=` id="${o.id}" name="${I(o.name)}" type="${tr(o.type)}" refreshedVersion="6"`;o.description&&(n+=` description="${I(o.description)}"`),o.refreshOnLoad&&(n+=' refreshOnLoad="1"'),o.background&&(n+=' background="1"'),o.saveData&&(n+=' saveData="1"'),o.keepAlive&&(n+=' keepAlive="1"'),o.interval&&(n+=` interval="${o.interval}"`);let r=o.connectionString||o.command?`<dbPr${o.connectionString?` connection="${I(o.connectionString)}"`:""}${o.command?` command="${I(o.command)}"`:""}${o.commandType?` commandType="${or(o.commandType)}"`:""}/>`:"";return`<connection${n}>${r}</connection>`}).join("")}</connections>`:""}_buildWorkbookRels(t,o=!1){let n=[...t.workbookRels.entries()].filter(([r,s])=>!(o&&s.type.includes("/calcChain"))).map(([r,s])=>`<Relationship Id="${r}" Type="${s.type}" Target="${s.target}"/>`);return[...t.workbookRels.values()].some(r=>r.type.includes("/styles"))||n.push('<Relationship Id="rIdStyles" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles" Target="styles.xml"/>'),[...t.workbookRels.values()].some(r=>r.type.includes("/sharedStrings"))||n.push('<Relationship Id="rIdShared" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings" Target="sharedStrings.xml"/>'),this.vbaProject&&![...t.workbookRels.values()].some(r=>r.type.includes("vbaProject"))&&n.push('<Relationship Id="rIdVBA" Type="http://schemas.microsoft.com/office/2006/relationships/vbaProject" Target="vbaProject.bin"/>'),this.connections.length&&![...t.workbookRels.values()].some(r=>r.type.includes("/connections"))&&n.push('<Relationship Id="rIdConns" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/connections" Target="connections.xml"/>'),`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
371
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
372
|
+
${n.join(`
|
|
231
373
|
`)}
|
|
232
374
|
</Relationships>`}_relsToXml(t){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
233
375
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
234
|
-
${[...t.entries()].map(([
|
|
376
|
+
${[...t.entries()].map(([o,n])=>`<Relationship Id="${I(o)}" Type="${I(n.type)}" Target="${I(n.target)}"${n.targetMode?` TargetMode="${I(n.targetMode)}"`:""}/>`).join(`
|
|
235
377
|
`)}
|
|
236
|
-
</Relationships>`}
|
|
378
|
+
</Relationships>`}_buildThemeXml(){let t=this.theme,o=t?.majorFont??"Calibri Light",n=t?.minorFont??"Calibri",r=[{name:"dk1",color:"000000"},{name:"lt1",color:"FFFFFF"},{name:"dk2",color:"44546A"},{name:"lt2",color:"E7E6E6"},{name:"accent1",color:"4472C4"},{name:"accent2",color:"ED7D31"},{name:"accent3",color:"A5A5A5"},{name:"accent4",color:"FFC000"},{name:"accent5",color:"5B9BD5"},{name:"accent6",color:"70AD47"},{name:"hlink",color:"0563C1"},{name:"folHlink",color:"954F72"}],i=(t?.colors?.map(a=>{let l=a.color.replace(/^#/,"");return l.length===8&&(l=l.substring(2)),{name:a.name,color:l}})??r).map(a=>a.name==="dk1"||a.name==="lt1"?`<a:${a.name}><a:sysClr val="${a.name==="dk1"?"windowText":"window"}" lastClr="${a.color}"/></a:${a.name}>`:`<a:${a.name}><a:srgbClr val="${a.color}"/></a:${a.name}>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
379
|
+
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="${I(t?.name??"Office Theme")}">
|
|
380
|
+
<a:themeElements>
|
|
381
|
+
<a:clrScheme name="Office">${i}</a:clrScheme>
|
|
382
|
+
<a:fontScheme name="Office">
|
|
383
|
+
<a:majorFont><a:latin typeface="${I(o)}"/><a:ea typeface=""/><a:cs typeface=""/></a:majorFont>
|
|
384
|
+
<a:minorFont><a:latin typeface="${I(n)}"/><a:ea typeface=""/><a:cs typeface=""/></a:minorFont>
|
|
385
|
+
</a:fontScheme>
|
|
386
|
+
<a:fmtScheme name="Office">
|
|
387
|
+
<a:fillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:lumMod val="110000"/><a:satMod val="105000"/><a:tint val="67000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="103000"/><a:tint val="73000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="105000"/><a:satMod val="109000"/><a:tint val="81000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:satMod val="103000"/><a:lumMod val="102000"/><a:tint val="94000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:satMod val="110000"/><a:lumMod val="100000"/><a:shade val="100000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:lumMod val="99000"/><a:satMod val="120000"/><a:shade val="78000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:fillStyleLst>
|
|
388
|
+
<a:lnStyleLst><a:ln w="6350" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="12700" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln><a:ln w="19050" cap="flat" cmpd="sng" algn="ctr"><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:prstDash val="solid"/><a:miter lim="800000"/></a:ln></a:lnStyleLst>
|
|
389
|
+
<a:effectStyleLst><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst/></a:effectStyle><a:effectStyle><a:effectLst><a:outerShdw blurRad="57150" dist="19050" dir="5400000" algn="ctr" rotWithShape="0"><a:srgbClr val="000000"><a:alpha val="63000"/></a:srgbClr></a:outerShdw></a:effectLst></a:effectStyle></a:effectStyleLst>
|
|
390
|
+
<a:bgFillStyleLst><a:solidFill><a:schemeClr val="phClr"/></a:solidFill><a:solidFill><a:schemeClr val="phClr"><a:tint val="95000"/><a:satMod val="170000"/></a:schemeClr></a:solidFill><a:gradFill rotWithShape="1"><a:gsLst><a:gs pos="0"><a:schemeClr val="phClr"><a:tint val="93000"/><a:satMod val="150000"/><a:shade val="98000"/><a:lumMod val="102000"/></a:schemeClr></a:gs><a:gs pos="50000"><a:schemeClr val="phClr"><a:tint val="98000"/><a:satMod val="130000"/><a:shade val="90000"/><a:lumMod val="103000"/></a:schemeClr></a:gs><a:gs pos="100000"><a:schemeClr val="phClr"><a:shade val="63000"/><a:satMod val="120000"/></a:schemeClr></a:gs></a:gsLst><a:lin ang="5400000" scaled="0"/></a:gradFill></a:bgFillStyleLst>
|
|
391
|
+
</a:fmtScheme>
|
|
392
|
+
</a:themeElements>
|
|
393
|
+
<a:objectDefaults/>
|
|
394
|
+
<a:extraClrSchemeLst/>
|
|
395
|
+
</a:theme>`}_buildRootRels(t){return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
237
396
|
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
238
397
|
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument" Target="xl/workbook.xml"/>
|
|
239
398
|
<Relationship Id="rId2" Type="http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties" Target="docProps/core.xml"/>
|
|
240
399
|
<Relationship Id="rId3" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties" Target="docProps/app.xml"/>
|
|
241
400
|
${t?'<Relationship Id="rId4" Type="http://schemas.openxmlformats.org/officeDocument/2006/relationships/custom-properties" Target="docProps/custom.xml"/>':""}
|
|
242
|
-
</Relationships>`}_patchContentTypes(t,
|
|
243
|
-
</Types>`)),
|
|
244
|
-
</Types>`)),
|
|
401
|
+
</Relationships>`}_patchContentTypes(t,o,n=!1){let r=t;return n&&(r=r.replace(/<Override[^>]*calcChain[^>]*\/>/g,"")),r.includes("sharedStrings")||(r=r.replace("</Types>",`<Override PartName="/xl/sharedStrings.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml"/>
|
|
402
|
+
</Types>`)),o&&!r.includes("custom-properties")&&(r=r.replace("</Types>",`<Override PartName="/docProps/custom.xml" ContentType="application/vnd.openxmlformats-officedocument.custom-properties+xml"/>
|
|
403
|
+
</Types>`)),this.vbaProject&&(r.includes("vbaProject.bin")||(r=r.replace("</Types>",`<Override PartName="/xl/vbaProject.bin" ContentType="application/vnd.ms-office.vbaProject"/>
|
|
404
|
+
</Types>`)),r=r.replace("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml","application/vnd.ms-excel.sheet.macroEnabled.main+xml")),this.isTemplate&&!this.vbaProject&&(r=r.replace("application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml","application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml")),this.connections.length&&!r.includes("connections.xml")&&(r=r.replace("</Types>",`<Override PartName="/xl/connections.xml" ContentType="application/vnd.openxmlformats-officedocument.spreadsheetml.connections+xml"/>
|
|
405
|
+
</Types>`)),r}async buildBase64(){let t=await this.build(),o="";for(let n=0;n<t.length;n++)o+=String.fromCharCode(t[n]);return btoa(o)}async writeFile(t){let o=await this.build();await(await import("fs/promises")).writeFile(t,o)}_buildCommentsXml(t){let o=[...new Set(t.map(s=>s.comment.author??""))],n=o.map(s=>`<author>${I(s)}</author>`).join(""),r=t.map(({row:s,col:i,comment:a})=>{let l=`${Ut(i)}${s}`,h=o.indexOf(a.author??""),c;return a.richText&&a.richText.length>0?c=a.richText.map(m=>{let d="";if(m.font){let p=m.font;p.bold&&(d+="<b/>"),p.italic&&(d+="<i/>"),p.underline&&p.underline!=="none"&&(d+=`<u val="${p.underline==="single"?"single":p.underline}"/>`),p.strike&&(d+="<strike/>"),p.size&&(d+=`<sz val="${p.size}"/>`),p.color&&(d+=`<color rgb="${p.color}"/>`),p.name&&(d+=`<rFont val="${I(p.name)}"/>`),p.family!=null&&(d+=`<family val="${p.family}"/>`)}return`<r>${d?`<rPr>${d}</rPr>`:""}<t xml:space="preserve">${I(m.text)}</t></r>`}).join(""):c=`<r><t>${I(a.text)}</t></r>`,`<comment ref="${l}" authorId="${h}"><text>${c}</text></comment>`}).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
245
406
|
<comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main">
|
|
246
|
-
<authors>${
|
|
247
|
-
<commentList>${
|
|
248
|
-
</comments>`}_buildVmlXml(t,
|
|
407
|
+
<authors>${n}</authors>
|
|
408
|
+
<commentList>${r}</commentList>
|
|
409
|
+
</comments>`}_buildVmlXml(t,o){return`<xml xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:x="urn:schemas-microsoft-com:office:excel">
|
|
249
410
|
<o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1"/></o:shapelayout>
|
|
250
411
|
<v:shapetype id="_x0000_t202" coordsize="21600,21600" o:spt="202" path="m,l,21600r21600,l21600,xe"><v:stroke joinstyle="miter"/><v:path gradientshapeok="t" o:connecttype="rect"/></v:shapetype>
|
|
251
|
-
${t.map(({row:
|
|
412
|
+
${t.map(({row:r,col:s},i)=>{let a=(s+1)*64,l=(r-1)*20;return`<v:shape id="_x0000_s${1025+o*1e3+i}" type="#_x0000_t202" style="position:absolute;margin-left:${a}pt;margin-top:${l}pt;width:108pt;height:59.25pt;z-index:${i+1};visibility:hidden" fillcolor="#ffffe1" o:insetmode="auto">
|
|
252
413
|
<v:fill color2="#ffffe1"/>
|
|
253
414
|
<v:shadow color="black" obscured="t"/>
|
|
254
415
|
<v:path o:connecttype="none"/>
|
|
255
416
|
<v:textbox style="mso-direction-alt:auto"><div style="text-align:left"/></v:textbox>
|
|
256
|
-
<x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${
|
|
417
|
+
<x:ClientData ObjectType="Note"><x:MoveWithCells/><x:SizeWithCells/><x:Anchor>${s+1},15,${r-1},10,${s+3},15,${r+4},4</x:Anchor><x:AutoFill>False</x:AutoFill><x:Row>${r-1}</x:Row><x:Column>${s-1}</x:Column></x:ClientData>
|
|
257
418
|
</v:shape>`}).join(`
|
|
258
419
|
`)}
|
|
259
|
-
</xml>`}async download(t="workbook.xlsx"){let
|
|
420
|
+
</xml>`}async download(t="workbook.xlsx"){let o=await this.build(),n=new Blob([o.buffer],{type:"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet"}),r=URL.createObjectURL(n),s=document.createElement("a");s.href=r,s.download=t,s.click(),URL.revokeObjectURL(r)}};function xa(e){switch(e){case"jpg":return"image/jpeg";case"png":return"image/png";case"gif":return"image/gif";case"bmp":return"image/bmp";case"tiff":return"image/tiff";case"emf":return"image/x-emf";case"wmf":return"image/x-wmf";case"svg":return"image/svg+xml";case"ico":return"image/x-icon";case"webp":return"image/webp";default:return`image/${e}`}}function nr(e){return e==="jpeg"?"jpg":e}function $a(e){let t=Array.from({length:e},(n,r)=>`<bk><extLst><ext uri="{3e2802c4-a4d2-4d8b-9148-e3be6c30e623}"><xlrd:rvb i="${r}"/></ext></extLst></bk>`).join(""),o=Array.from({length:e},(n,r)=>`<bk><rc t="1" v="${r}"/></bk>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><metadata xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:xlrd="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata"><metadataTypes count="1"><metadataType name="XLRICHVALUE" minSupportedVersion="120000" copy="1" pasteAll="1" pasteValues="1" merge="1" splitFirst="1" rowColShift="1" clearFormats="1" clearComments="1" assign="1" coerce="1"/></metadataTypes><futureMetadata name="XLRICHVALUE" count="${e}">${t}</futureMetadata><valueMetadata count="${e}">${o}</valueMetadata></metadata>`}function ya(e){let t=Array.from({length:e},(o,n)=>`<rv s="0"><v>${n}</v><v>5</v><v></v></rv>`).join("");return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvData xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" count="${e}">${t}</rvData>`}function wa(e){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><richValueRels xmlns="http://schemas.microsoft.com/office/spreadsheetml/2022/richvaluerel" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships">'+e.map(t=>`<rel r:id="${t}"/>`).join("")+"</richValueRels>"}function ba(){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvStructures xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata" count="1"><s t="_localImage"><k n="_rvRel:LocalImageIdentifier" t="i"/><k n="CalcOrigin" t="i"/><k n="Text" t="s"/></s></rvStructures>'}function Ca(){return'<?xml version="1.0" encoding="UTF-8" standalone="yes"?><rvTypesInfo xmlns="http://schemas.microsoft.com/office/spreadsheetml/2017/richdata2" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x" xmlns:x="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><global><keyFlags><key name="_Self"><flag name="ExcludeFromFile" value="1"/><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_DisplayString"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Flags"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Format"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_SubLabel"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Attribution"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Icon"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_Display"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_CanonicalPropertyNames"><flag name="ExcludeFromCalcComparison" value="1"/></key><key name="_ClassificationId"><flag name="ExcludeFromCalcComparison" value="1"/></key></keyFlags></global><types></types></rvTypesInfo>'}var Fo=class{constructor(){this.s={}}font(t){return this.s.font={...this.s.font??{},...t},this}fontSize(t){return this.font({size:t})}fontName(t){return this.font({name:t})}bold(t=!0){return this.font({bold:t})}italic(t=!0){return this.font({italic:t})}strike(t=!0){return this.font({strike:t})}underline(t="single"){return this.font({underline:t})}fontColor(t){return this.font({color:t})}fill(t,o,n){return this.s.fill={type:"pattern",pattern:t,fgColor:o,bgColor:n},this}bg(t){return this.fill("solid",t)}border(t,o){let n={style:t,color:o};return this.s.border={left:n,right:n,top:n,bottom:n},this}borderLeft(t,o){return this.s.border={...this.s.border??{},left:{style:t,color:o}},this}borderRight(t,o){return this.s.border={...this.s.border??{},right:{style:t,color:o}},this}borderTop(t,o){return this.s.border={...this.s.border??{},top:{style:t,color:o}},this}borderBottom(t,o){return this.s.border={...this.s.border??{},bottom:{style:t,color:o}},this}align(t,o){return this.s.alignment={...this.s.alignment??{},horizontal:t,vertical:o},this}center(){return this.align("center","center")}wrap(t=!0){return this.s.alignment={...this.s.alignment??{},wrapText:t},this}rotate(t){return this.s.alignment={...this.s.alignment??{},textRotation:t},this}indent(t){return this.s.alignment={...this.s.alignment??{},indent:t},this}shrink(t=!0){return this.s.alignment={...this.s.alignment??{},shrinkToFit:t},this}numFmt(t){return this.s.numberFormat={formatCode:t},this}numFmtId(t){return this.s.numFmtId=t,this}locked(t=!0){return this.s.locked=t,this}hidden(t=!0){return this.s.hidden=t,this}build(){return{...this.s}}};function jt(){return new Fo}var Fa={headerBlue:jt().bold().bg("FF4472C4").fontColor("FFFFFFFF").center().build(),headerGray:jt().bold().bg("FF595959").fontColor("FFFFFFFF").center().build(),headerGreen:jt().bold().bg("FF70AD47").fontColor("FFFFFFFF").center().build(),currency:jt().numFmt('"$"#,##0.00').build(),percent:jt().numFmt("0.00%").build(),integer:jt().numFmt("#,##0").build(),date:jt().numFmtId(14).build(),dateTime:jt().numFmtId(22).build(),bold:jt().bold().build(),centered:jt().center().build(),wrapped:jt().wrap().build(),bordered:jt().border("thin").build(),borderedBlack:jt().border("thin","FF000000").build(),highlight:jt().bg("FFFFFF00").build(),lightBlue:jt().bg("FFDCE6F1").build(),redText:jt().fontColor("FFFF0000").build(),blueText:jt().fontColor("FF0000FF").build(),greenText:jt().fontColor("FF00B050").build(),tableHeader:jt().bold().border("thin").center().bg("FFD9E1F2").build(),deleted:jt().strike().fontColor("FF808080").build()},va={General:"General",Integer:"#,##0",Decimal2:"#,##0.00",Currency:'"$"#,##0.00',CurrencyNeg:'"$"#,##0.00;[Red]("$"#,##0.00)',Percent:"0%",Percent2:"0.00%",Scientific:"0.00E+00",Fraction:"# ?/?",ShortDate:"mm/dd/yyyy",LongDate:"mmmm d, yyyy",Time:"h:mm AM/PM",DateTime:"mm/dd/yyyy h:mm",Text:"@",Accounting:'_("$"* #,##0.00_);_("$"* (#,##0.00);_("$"* "-"??_);_(@_)',FinancialPos:"#,##0;(#,##0)",ZeroDash:'#,##0;(#,##0);"-"',Multiple:'0.0"x"'},Sa={White:"FFFFFFFF",Black:"FF000000",Red:"FFFF0000",Green:"FF00B050",Blue:"FF0070C0",Yellow:"FFFFFF00",Orange:"FFFFA500",Gray:"FF808080",LightGray:"FFD3D3D3",DarkBlue:"FF003366",ExcelBlue:"FF4472C4",ExcelOrange:"FFED7D31",ExcelGreen:"FF70AD47",ExcelRed:"FFFF0000",ExcelPurple:"FF7030A0",Transparent:"00FFFFFF"};function Ia(e,t={}){let o=t.delimiter??",",n=t.lineEnding??`\r
|
|
421
|
+
`,r=t.quote??'"',s=[],i=e.readAllCells(),a=0,l=0;for(let{row:c,col:m}of i)c>a&&(a=c),m>l&&(l=m);let h=new Map;for(let{row:c,col:m,cell:d}of i)h.set(`${c},${m}`,d.value??null);for(let c=1;c<=a;c++){let m=[];for(let d=1;d<=l;d++){let f=h.get(`${c},${d}`),p=Ta(f);p.includes(o)||p.includes(r)||p.includes(`
|
|
422
|
+
`)||p.includes("\r")?m.push(r+p.replace(new RegExp(r.replace(/[.*+?^${}()|[\]\\]/g,"\\$&"),"g"),r+r)+r):m.push(p)}s.push(m.join(o))}return s.join(n)}function Ta(e){return e==null?"":e instanceof te?e.error:e instanceof Date?e.toISOString():String(e)}function ka(e,t={}){let o=t.delimiter??",",n=t.quote??'"',r=t.sheetName??"Sheet1",s=Aa(e,o,n),i=new ao,a=i.addSheet(r);for(let l=0;l<s.length;l++)for(let h=0;h<s[l].length;h++){let c=s[l][h];if(c==="")continue;let m=Number(c);!isNaN(m)&&c.trim()!==""?a.setValue(l+1,h+1,m):c.toLowerCase()==="true"?a.setValue(l+1,h+1,!0):c.toLowerCase()==="false"?a.setValue(l+1,h+1,!1):a.setValue(l+1,h+1,c)}return i}function Aa(e,t,o){let n=[],r=[],s="",i=!1,a=0,l=e.length;for(;a<l;){let h=e[a];i?h===o?a+1<l&&e[a+1]===o?(s+=o,a+=2):(i=!1,a++):(s+=h,a++):h===o?(i=!0,a++):h===t?(r.push(s),s="",a++):h==="\r"?(r.push(s),s="",n.push(r),r=[],a++,a<l&&e[a]===`
|
|
423
|
+
`&&a++):h===`
|
|
424
|
+
`?(r.push(s),s="",n.push(r),r=[],a++):(s+=h,a++)}return(s||r.length)&&(r.push(s),n.push(r)),n}function sr(e,t={}){let o=t.header!==!1,n=t.includeEmpty??!1,r=t.range?e.readRange(t.range):Ra(e);if(r.length===0)return[];if(o){let s=r[0].map(i=>String(i??""));return r.slice(1).map(i=>{let a={};for(let l=0;l<s.length;l++){let h=l<i.length?i[l]:null;!n&&h==null||(a[s[l]]=rr(h,t))}return a})}else return r.map(s=>s.map(i=>rr(i,t)))}function Da(e,t={}){let o={};for(let n of e.getSheets())o[n.name]=sr(n,t);return o}function rr(e,t){if(e==null)return null;if(e instanceof te)return e.error;if(e instanceof Date)switch(t.dateFormat){case"epoch":return e.getTime();case"serial":return(e.getTime()-Date.UTC(1899,11,30))/864e5;default:return e.toISOString()}return e}function Ra(e){let t=e.readAllCells();if(t.length===0)return[];let o=0,n=0;for(let{row:i,col:a}of t)i>o&&(o=i),a>n&&(n=a);let r=[],s=new Map;for(let{row:i,col:a,cell:l}of t)s.has(i)||s.set(i,new Map),s.get(i).set(a,l.value??null);for(let i=1;i<=o;i++){let a=[],l=s.get(i);for(let h=1;h<=n;h++)a.push(l?.get(h)??null);r.push(a)}return r}function lt(e){if(typeof e=="number")return e;if(typeof e=="boolean")return e?1:0;if(typeof e=="string"){let t=Number(e);return isNaN(t)?0:t}return 0}var me=class{constructor(){this.calculating=new Set}calculateWorkbook(t){let o=t.getSheets();for(let n of o)this.calculateSheet(n)}calculateSheet(t){this.ws=t;let o=t.readAllCells();for(let{row:n,col:r,cell:s}of o)if(s.formula){this.calculating.clear();let i=this.evaluate(s.formula,n,r);s.value=i}}getCellValue(t,o){let n=this.ws.getCell(t,o);if(n.formula){let r=`${t},${o}`;if(this.calculating.has(r))return 0;this.calculating.add(r);let s=this.evaluate(n.formula,t,o);n.value=s,this.calculating.delete(r)}return n.value??null}resolveRange(t){let n=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"");if(n.includes(":")){let{startRow:i,startCol:a,endRow:l,endCol:h}=Jt(n),c=[];for(let m=i;m<=l;m++)for(let d=a;d<=h;d++)c.push(this.getCellValue(m,d));return c}let{row:r,col:s}=Gt(n);return[this.getCellValue(r,s)]}evaluate(t,o,n){try{return this.parseExpression(t.trim(),0,o,n).value}catch{return"#VALUE!"}}parseExpression(t,o,n,r){return this.parseComparison(t,o,n,r)}parseComparison(t,o,n,r){let s=this.parseAddSub(t,o,n,r),{value:i,pos:a}=s;a=this.skipSpaces(t,a);let l=[">=","<=","<>",">","<","="];for(let h of l)if(t.slice(a,a+h.length)===h){let c=this.parseAddSub(t,a+h.length,n,r),m=i,d=c.value;switch(h){case">=":i=lt(m)>=lt(d);break;case"<=":i=lt(m)<=lt(d);break;case"<>":i=m!==d;break;case">":i=lt(m)>lt(d);break;case"<":i=lt(m)<lt(d);break;case"=":i=m===d||lt(m)===lt(d);break}a=c.pos;break}return{value:i,pos:a}}parseAddSub(t,o,n,r){let s=this.parseMulDiv(t,o,n,r),{value:i,pos:a}=s;for(;a<t.length;)if(a=this.skipSpaces(t,a),t[a]==="+"){let l=this.parseMulDiv(t,a+1,n,r);i=lt(i)+lt(l.value),a=l.pos}else if(t[a]==="-"){let l=this.parseMulDiv(t,a+1,n,r);i=lt(i)-lt(l.value),a=l.pos}else if(t[a]==="&"){let l=this.parseMulDiv(t,a+1,n,r);i=String(i??"")+String(l.value??""),a=l.pos}else break;return{value:i,pos:a}}parseMulDiv(t,o,n,r){let s=this.parsePower(t,o,n,r),{value:i,pos:a}=s;for(;a<t.length;)if(a=this.skipSpaces(t,a),t[a]==="*"){let l=this.parsePower(t,a+1,n,r);i=lt(i)*lt(l.value),a=l.pos}else if(t[a]==="/"){let l=this.parsePower(t,a+1,n,r),h=lt(l.value);i=h===0?"#DIV/0!":lt(i)/h,a=l.pos}else break;return{value:i,pos:a}}parsePower(t,o,n,r){let s=this.parseUnary(t,o,n,r),{value:i,pos:a}=s;if(a=this.skipSpaces(t,a),a<t.length&&t[a]==="^"){let l=this.parseUnary(t,a+1,n,r);i=Math.pow(lt(i),lt(l.value)),a=l.pos}return{value:i,pos:a}}parseUnary(t,o,n,r){if(o=this.skipSpaces(t,o),t[o]==="-"){let s=this.parseAtom(t,o+1,n,r);return{value:-lt(s.value),pos:s.pos}}return t[o]==="+"?this.parseAtom(t,o+1,n,r):this.parseAtom(t,o,n,r)}parseAtom(t,o,n,r){if(o=this.skipSpaces(t,o),t[o]==="("){let l=this.parseExpression(t,o+1,n,r),h=this.skipSpaces(t,l.pos);return t[h]===")"&&h++,{value:l.value,pos:h}}if(t[o]==='"'){let l=o+1,h="";for(;l<t.length;){if(t[l]==='"'){if(t[l+1]==='"'){h+='"',l+=2;continue}break}h+=t[l++]}return{value:h,pos:l+1}}if(/[0-9.]/.test(t[o])){let l=o;for(;l<t.length&&/[0-9.eE+-]/.test(t[l])&&!(l>o&&(t[l]==="+"||t[l]==="-")&&!/[eE]/.test(t[l-1]));)l++;return{value:parseFloat(t.slice(o,l)),pos:l}}if(t.slice(o,o+4).toUpperCase()==="TRUE")return{value:!0,pos:o+4};if(t.slice(o,o+5).toUpperCase()==="FALSE")return{value:!1,pos:o+5};let s=o;for(;s<t.length&&/[A-Za-z0-9_$!:]/.test(t[s]);)s++;let i=t.slice(o,s),a=this.skipSpaces(t,s);if(t[a]==="("){let l=i.toUpperCase(),h=this.parseArgList(t,a,n,r);return{value:this.callFunction(l,h.args,n,r),pos:h.pos}}if(i.includes(":")||/^[A-Z]+[0-9]+$/i.test(i.replace(/\$/g,""))||i.includes("!")){let l=this.resolveRange(i);return{value:(l.length===1,l[0]),pos:s}}return{value:i,pos:s}}parseArgList(t,o,n,r){o++;let s=[];if(this.skipSpaces(t,o)<t.length&&t[this.skipSpaces(t,o)]===")")return{args:[],pos:this.skipSpaces(t,o)+1};for(;o<t.length;){o=this.skipSpaces(t,o);let i=t.slice(o).match(/^([A-Z$]+[0-9$]+:[A-Z$]+[0-9$]+|[A-Za-z]+![A-Z$]+[0-9$]+:[A-Z$]+[0-9$]+)/i);if(i){let a=i[1];s.push(this.resolveRange(a)),o+=a.length}else{let a=this.parseExpression(t,o,n,r);s.push([a.value]),o=a.pos}if(o=this.skipSpaces(t,o),t[o]===","){o++;continue}if(t[o]===")"){o++;break}break}return{args:s,pos:o}}skipSpaces(t,o){for(;o<t.length&&t[o]===" ";)o++;return o}callFunction(t,o,n,r){let s=a=>a.flat(),i=a=>s(a).filter(l=>typeof l=="number"||typeof l=="string"&&l!==""&&!isNaN(Number(l))).map(l=>Number(l));switch(t){case"SUM":return i(o).reduce((a,l)=>a+l,0);case"AVERAGE":{let a=i(o);return a.length?a.reduce((l,h)=>l+h,0)/a.length:0}case"COUNT":return i(o).length;case"COUNTA":return s(o).filter(a=>a!=null&&a!=="").length;case"COUNTBLANK":return s(o).filter(a=>a==null||a==="").length;case"MAX":{let a=i(o);return a.length?Math.max(...a):0}case"MIN":{let a=i(o);return a.length?Math.min(...a):0}case"ABS":return Math.abs(lt(s(o)[0]));case"ROUND":{let a=lt(s(o)[0]),l=lt(s(o)[1]??0),h=Math.pow(10,l);return Math.round(a*h)/h}case"ROUNDUP":{let a=lt(s(o)[0]),l=lt(s(o)[1]??0),h=Math.pow(10,l);return Math.ceil(a*h)/h}case"ROUNDDOWN":{let a=lt(s(o)[0]),l=lt(s(o)[1]??0),h=Math.pow(10,l);return Math.floor(a*h)/h}case"INT":return Math.floor(lt(s(o)[0]));case"MOD":return lt(s(o)[0])%lt(s(o)[1]);case"POWER":return Math.pow(lt(s(o)[0]),lt(s(o)[1]));case"SQRT":return Math.sqrt(lt(s(o)[0]));case"PI":return Math.PI;case"RAND":return Math.random();case"RANDBETWEEN":{let a=lt(s(o)[0]),l=lt(s(o)[1]);return Math.floor(Math.random()*(l-a+1))+a}case"SUMPRODUCT":{if(o.length<2)return 0;let a=o[0].length,l=0;for(let h=0;h<a;h++){let c=1;for(let m of o)c*=lt(m[h]??0);l+=c}return l}case"SUMIF":{let a=o[0]??[],l=String(s(o.slice(1,2))[0]??""),h=o[2]??a,c=0;for(let m=0;m<a.length;m++)this.matchCriteria(a[m],l)&&(c+=lt(h[m]??0));return c}case"COUNTIF":{let a=o[0]??[],l=String(s(o.slice(1,2))[0]??"");return a.filter(h=>this.matchCriteria(h,l)).length}case"IF":{let a=s(o.slice(0,1))[0],l=s(o.slice(1,2))[0]??!0,h=o.length>2?s(o.slice(2,3))[0]??!1:!1;return a?l:h}case"AND":return s(o).every(a=>!!a);case"OR":return s(o).some(a=>!!a);case"NOT":return!s(o)[0];case"IFERROR":{let a=s(o.slice(0,1))[0];return typeof a=="string"&&a.startsWith("#")?s(o.slice(1,2))[0]??"":a}case"IFNA":{let a=s(o.slice(0,1))[0];return a==="#N/A"?s(o.slice(1,2))[0]??"":a}case"CONCATENATE":case"CONCAT":return s(o).map(a=>String(a??"")).join("");case"TEXTJOIN":{let a=String(s(o.slice(0,1))[0]??""),l=!!s(o.slice(1,2))[0],h=s(o.slice(2));return(l?h.filter(m=>m!=null&&m!==""):h).map(m=>String(m??"")).join(a)}case"LEN":return String(s(o)[0]??"").length;case"LEFT":return String(s(o)[0]??"").slice(0,lt(s(o)[1])||1);case"RIGHT":{let a=String(s(o)[0]??""),l=lt(s(o)[1])||1;return a.slice(-l)}case"MID":{let a=String(s(o)[0]??""),l=lt(s(o)[1])-1,h=lt(s(o)[2]);return a.slice(l,l+h)}case"UPPER":return String(s(o)[0]??"").toUpperCase();case"LOWER":return String(s(o)[0]??"").toLowerCase();case"TRIM":return String(s(o)[0]??"").trim().replace(/\s+/g," ");case"SUBSTITUTE":{let a=String(s(o)[0]??""),l=String(s(o)[1]??""),h=String(s(o)[2]??"");return a.split(l).join(h)}case"FIND":case"SEARCH":{let a=String(s(o)[0]??""),l=String(s(o)[1]??""),h=lt(s(o)[2])||1,c=t==="SEARCH"?d=>d.toLowerCase():d=>d,m=c(l).indexOf(c(a),h-1);return m>=0?m+1:"#VALUE!"}case"REPLACE":{let a=String(s(o)[0]??""),l=lt(s(o)[1])-1,h=lt(s(o)[2]),c=String(s(o)[3]??"");return a.slice(0,l)+c+a.slice(l+h)}case"REPT":return String(s(o)[0]??"").repeat(lt(s(o)[1]));case"TEXT":return String(s(o)[0]??"");case"VALUE":return lt(s(o)[0]);case"EXACT":return String(s(o)[0]??"")===String(s(o)[1]??"");case"VLOOKUP":{let a=s(o.slice(0,1))[0],l=o[1]??[],h=lt(s(o.slice(2,3))[0])-1;return"#N/A"}case"INDEX":{let a=o[0]??[],l=lt(s(o.slice(1,2))[0])-1;return a[l]??"#REF!"}case"MATCH":{let a=s(o.slice(0,1))[0],h=(o[1]??[]).findIndex(c=>c===a||String(c)===String(a));return h>=0?h+1:"#N/A"}case"ISBLANK":return s(o)[0]==null||s(o)[0]==="";case"ISNUMBER":return typeof s(o)[0]=="number";case"ISTEXT":return typeof s(o)[0]=="string";case"ISLOGICAL":return typeof s(o)[0]=="boolean";case"ISERROR":{let a=s(o)[0];return typeof a=="string"&&a.startsWith("#")}case"ISNA":return s(o)[0]==="#N/A";case"TYPE":{let a=s(o)[0];return typeof a=="number"?1:typeof a=="string"?2:typeof a=="boolean"?4:1}case"ROW":return n;case"COLUMN":return r;case"NA":return"#N/A";case"TODAY":return new Date().toISOString().slice(0,10);case"NOW":return new Date().toISOString();case"YEAR":return new Date(String(s(o)[0])).getFullYear();case"MONTH":return new Date(String(s(o)[0])).getMonth()+1;case"DAY":return new Date(String(s(o)[0])).getDate();case"GETPIVOTDATA":return String(s(o.slice(0,1))[0]??"")||"#REF!";default:return"#NAME?"}}matchCriteria(t,o){let n=[">=","<=","<>",">","<","="];for(let r of n)if(o.startsWith(r)){let s=o.slice(r.length),i=lt(t),a=Number(s);if(!isNaN(a))switch(r){case">=":return i>=a;case"<=":return i<=a;case"<>":return i!==a;case">":return i>a;case"<":return i<a;case"=":return i===a}switch(r){case"<>":return String(t)!==s;case"=":return String(t)===s}}return typeof t=="number"?t===Number(o):String(t)===o}};var Pa=["#000000","#FFFFFF","#44546A","#E7E6E6","#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47"];function Nt(e){if(!e)return"";if(e.startsWith("#"))return e;if(e.startsWith("theme:")){let t=parseInt(e.slice(6),10);return Pa[t]??"#000"}return e.length===8&&!e.startsWith("#")?"#"+e.slice(2):"#"+e}function ar(e){let t=e.replace("#","");return[parseInt(t.slice(0,2),16),parseInt(t.slice(2,4),16),parseInt(t.slice(4,6),16)]}function an(e,t,o){let[n,r,s]=ar(Nt(e)||"#FFFFFF"),[i,a,l]=ar(Nt(t)||"#000000"),h=Math.round(n+(i-n)*o),c=Math.round(r+(a-r)*o),m=Math.round(s+(l-s)*o);return`#${h.toString(16).padStart(2,"0")}${c.toString(16).padStart(2,"0")}${m.toString(16).padStart(2,"0")}`}function ir(e){let t=[];e.bold&&t.push("font-weight:bold"),e.italic&&t.push("font-style:italic");let o=[];return e.underline&&e.underline!=="none"&&o.push("underline"),e.strike&&o.push("line-through"),o.length&&t.push(`text-decoration:${o.join(" ")}`),e.size&&t.push(`font-size:${e.size}pt`),e.color&&t.push(`color:${Nt(e.color)}`),e.name&&t.push(`font-family:'${e.name}',sans-serif`),e.vertAlign==="superscript"?t.push("vertical-align:super;font-size:smaller"):e.vertAlign==="subscript"&&t.push("vertical-align:sub;font-size:smaller"),t.join(";")}function Ma(e){if(e.type==="pattern"){let t=e;if(t.pattern==="solid"&&t.fgColor)return`background-color:${Nt(t.fgColor)}`}if(e.type==="gradient"){let t=e;if(t.stops&&t.stops.length>=2){let o=t.stops.map(r=>`${Nt(r.color)} ${Math.round(r.position*100)}%`).join(",");return`background:linear-gradient(${t.degree??0}deg,${o})`}}return""}function vo(e){if(!e||!e.style)return"";let t={thin:"1px",medium:"2px",thick:"3px",dashed:"1px",dotted:"1px",double:"3px",hair:"1px",mediumDashed:"2px",dashDot:"1px",mediumDashDot:"2px",dashDotDot:"1px",mediumDashDotDot:"2px",slantDashDot:"2px"},o={thin:"solid",medium:"solid",thick:"solid",dashed:"dashed",dotted:"dotted",double:"double",hair:"solid",mediumDashed:"dashed",dashDot:"dashed",mediumDashDot:"dashed",dashDotDot:"dotted",mediumDashDotDot:"dotted",slantDashDot:"dashed"},n=t[e.style]??"1px",r=o[e.style]??"solid",s=e.color?Nt(e.color):"#000";return`${n} ${r} ${s}`}function Ea(e){let t=[];if(e.horizontal){let o={left:"left",center:"center",right:"right",fill:"justify",justify:"justify",distributed:"justify"};t.push(`text-align:${o[e.horizontal]??e.horizontal}`)}if(e.vertical){let o={top:"top",center:"middle",bottom:"bottom",distributed:"middle"};t.push(`vertical-align:${o[e.vertical]??"bottom"}`)}return e.wrapText&&t.push("white-space:normal;word-wrap:break-word"),e.textRotation&&t.push(`transform:rotate(-${e.textRotation}deg)`),e.indent&&t.push(`padding-left:${e.indent*8}px`),t.join(";")}function Ba(e){let t=[];return e.font&&t.push(ir(e.font)),e.fill&&t.push(Ma(e.fill)),e.alignment&&t.push(Ea(e.alignment)),e.border&&(e.border.top&&t.push(`border-top:${vo(e.border.top)}`),e.border.bottom&&t.push(`border-bottom:${vo(e.border.bottom)}`),e.border.left&&t.push(`border-left:${vo(e.border.left)}`),e.border.right&&t.push(`border-right:${vo(e.border.right)}`)),t.filter(Boolean).join(";")}function _a(e,t){if(e==null)return"";if(!t||t==="General")return String(e);let o=typeof e=="number"?e:parseFloat(String(e));if(isNaN(o))return String(e);if(t.includes("%")){let s=(t.match(/0\.(0+)%/)??[])[1]?.length??0;return(o*100).toFixed(s)+"%"}let n=t.match(/[$€£¥]|"CHF"/);if(n){let s=n[0].replace(/"/g,""),i=(t.match(/\.(0+)/)??[])[1]?.length??2,a=Math.abs(o).toFixed(i).replace(/\B(?=(\d{3})+(?!\d))/g,",");return t.indexOf(n[0])<t.indexOf("0")?(o<0?"-":"")+s+a:(o<0?"-":"")+a+" "+s}if(t.includes("#,##0")||t.includes("#,###")){let s=(t.match(/\.(0+)/)??[])[1]?.length??0;return o.toFixed(s).replace(/\B(?=(\d{3})+(?!\d))/g,",")}let r=t.match(/^0\.(0+)$/);if(r)return o.toFixed(r[1].length);if(/[ymdh]/i.test(t))return ja(o,t);if(t.includes("?/?")||t.includes("??/??"))return Oa(o);if(/0\.0+E\+0+/i.test(t)){let s=(t.match(/0\.(0+)/)??[])[1]?.length??2;return o.toExponential(s).toUpperCase()}return String(e)}function ja(e,t){let o=new Date(1899,11,30),n=new Date(o.getTime()+e*864e5),r=n.getFullYear(),s=n.getMonth()+1,i=n.getDate(),a=n.getHours(),l=n.getMinutes(),h=n.getSeconds();return t.replace(/yyyy/gi,String(r)).replace(/yy/gi,String(r).slice(-2)).replace(/mmmm/gi,n.toLocaleDateString("en",{month:"long"})).replace(/mmm/gi,n.toLocaleDateString("en",{month:"short"})).replace(/mm/gi,String(s).padStart(2,"0")).replace(/m/gi,String(s)).replace(/dd/gi,String(i).padStart(2,"0")).replace(/d/gi,String(i)).replace(/hh/gi,String(a).padStart(2,"0")).replace(/h/gi,String(a)).replace(/ss/gi,String(h).padStart(2,"0")).replace(/nn|MM/g,String(l).padStart(2,"0"))}function Oa(e){let t=Math.floor(Math.abs(e)),o=Math.abs(e)-t;if(o<1e-4)return String(e<0?-t:t);let n=0,r=1,s=1;for(let a=1;a<=100;a++){let l=Math.round(o*a),h=Math.abs(o-l/a);if(h<s&&(n=l,r=a,s=h),h<1e-4)break}let i=e<0?"-":"";return t>0?`${i}${t} ${n}/${r}`:`${i}${n}/${r}`}function La(e,t,o){if(e.colorScale){let n=[...o].sort((h,c)=>h-c),r=n[0],i=n[n.length-1]-r||1,a=(t-r)/i,l=e.colorScale;if(l.color.length===2)return`background-color:${an(l.color[0],l.color[1],a)}`;if(l.color.length>=3)return a<=.5?`background-color:${an(l.color[0],l.color[1],a*2)}`:`background-color:${an(l.color[1],l.color[2],(a-.5)*2)}`}if(e.dataBar){let n=[...o].sort((l,h)=>l-h),r=n[0],s=n[n.length-1],i=Math.round((t-r)/(s-r||1)*100);return`background:linear-gradient(90deg,${Nt(e.dataBar.color)||"#638EC6"} ${i}%,transparent ${i}%)`}if(e.iconSet){let n=[...o].sort((c,m)=>c-m),r=n[0],s=n[n.length-1],i=(t-r)/(s-r||1),l={"3Arrows":["\u2193","\u2192","\u2191"],"3ArrowsGray":["\u21E9","\u21E8","\u21E7"],"3TrafficLights1":["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],"3TrafficLights2":["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],"3Signs":["\u26D4","\u26A0\uFE0F","\u2705"],"3Symbols":["\u2716","!","\u2714"],"3Symbols2":["\u2716","!","\u2714"],"3Flags":["\u{1F3F4}","\u{1F3F3}","\u{1F3C1}"],"3Stars":["\u2606","\u2605","\u2605"],"4Arrows":["\u2193","\u2198","\u2197","\u2191"],"4ArrowsGray":["\u21E9","\u21D8","\u21D7","\u21E7"],"4Rating":["\u25D4","\u25D1","\u25D5","\u25CF"],"4RedToBlack":["\u2B24","\u2B24","\u2B24","\u2B24"],"4TrafficLights":["\u2B24","\u2B24","\u2B24","\u2B24"],"5Arrows":["\u2193","\u2198","\u2192","\u2197","\u2191"],"5ArrowsGray":["\u21E9","\u21D8","\u21E8","\u21D7","\u21E7"],"5Quarters":["\u25CB","\u25D4","\u25D1","\u25D5","\u25CF"],"5Rating":["\u25D4","\u25D4","\u25D1","\u25D5","\u25CF"]}[e.iconSet.iconSet??"3TrafficLights1"]??["\u{1F534}","\u{1F7E1}","\u{1F7E2}"],h=Math.min(Math.floor(i*l.length),l.length-1);return`data-icon="${l[h]}"`}return""}function Na(e,t){if(!t.length)return"";let o=100,n=20,r=Math.min(...t),i=Math.max(...t)-r||1,a=Nt(e.color)||"#4472C4",l=t.indexOf(Math.max(...t)),h=t.indexOf(Math.min(...t));if(e.type==="bar"||e.type==="stacked"){let g=o/t.length,u=t.map(($,x)=>{let b=e.type==="stacked"?($>=0,n/2):Math.max(1,($-r)/i*n),F=e.type==="stacked"?$>=0?n/2-b:n/2:n-b,y=a;return $<0&&e.negativeColor?y=Nt(e.negativeColor):e.showHigh&&x===l&&e.highColor?y=Nt(e.highColor):e.showLow&&x===h&&e.lowColor?y=Nt(e.lowColor):e.showFirst&&x===0&&e.firstColor?y=Nt(e.firstColor):e.showLast&&x===t.length-1&&e.lastColor&&(y=Nt(e.lastColor)),`<rect x="${x*g+g*.1}" y="${F}" width="${g*.8}" height="${b}" fill="${y}" rx="1"/>`}).join("");return`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}" viewBox="0 0 ${o} ${n}" style="display:inline-block;vertical-align:middle">${u}</svg>`}let c=e.lineWidth??1.5,m=t.map((g,u)=>`${u/(t.length-1||1)*o},${n-(g-r)/i*n}`).join(" "),d="";e.showMarkers&&(d=t.map((g,u)=>{let $=u/(t.length-1||1)*o,x=n-(g-r)/i*n;return`<circle cx="${$}" cy="${x}" r="1.5" fill="${Nt(e.markersColor)||a}"/>`}).join(""));let f=[],p=(g,u)=>{let $=g/(t.length-1||1)*o,x=n-(t[g]-r)/i*n;f.push(`<circle cx="${$}" cy="${x}" r="2.5" fill="${u}" stroke="white" stroke-width="0.5"/>`)};return e.showHigh&&e.highColor&&p(l,Nt(e.highColor)),e.showLow&&e.lowColor&&p(h,Nt(e.lowColor)),e.showFirst&&e.firstColor&&p(0,Nt(e.firstColor)),e.showLast&&e.lastColor&&p(t.length-1,Nt(e.lastColor)),e.showNegative&&e.negativeColor&&t.forEach((g,u)=>{if(g<0){let $=u/(t.length-1||1)*o,x=n-(g-r)/i*n;f.push(`<circle cx="${$}" cy="${x}" r="2" fill="${Nt(e.negativeColor)}"/>`)}}),`<svg xmlns="http://www.w3.org/2000/svg" width="${o}" height="${n}" viewBox="0 0 ${o} ${n}" style="display:inline-block;vertical-align:middle"><polyline points="${m}" fill="none" stroke="${a}" stroke-width="${c}"/>${d}${f.join("")}</svg>`}var He=["#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47","#264478","#9B57A0","#636363","#EB7E3A"];function lr(e,t){let o=[],s=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"").match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(!s)return o;let i=ne(s[1]),a=parseInt(s[2],10),l=ne(s[3]),h=parseInt(s[4],10);for(let c=a;c<=h;c++)for(let m=i;m<=l;m++){let d=e.getCell(c,m);o.push(typeof d.value=="number"?d.value:null)}return o}function Xa(e,t){let o=[],s=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"").match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(!s)return o;let i=ne(s[1]),a=parseInt(s[2],10),l=ne(s[3]),h=parseInt(s[4],10);for(let c=a;c<=h;c++)for(let m=i;m<=l;m++){let d=e.getCell(c,m);o.push(d.value!=null?String(d.value):"")}return o}function cr(e,t){let c=e.title??"",m=e.type,d=[],f=[];for(let P=0;P<e.series.length;P++){let N=e.series[P],V=lr(t,N.values).map(K=>K??0);N.categories&&!f.length&&(f=Xa(t,N.categories)),d.push({name:N.name??`Series ${P+1}`,values:V,color:N.color?Nt(N.color):He[P%He.length]})}if(!d.length||!d[0].values.length)return`<div style="display:inline-block;width:520px;height:340px;border:1px solid #ccc;background:#f9f9f9;text-align:center;line-height:340px;color:#666;font-size:14px" data-chart-type="${m}">[Chart: ${I(c||m)} \u2014 no data]</div>`;let p=Math.max(...d.map(P=>P.values.length));if(f.length||(f=Array.from({length:p},(P,N)=>String(N+1))),m==="pie"||m==="doughnut")return Ua(e,d,f,520,340);if(m==="radar"||m==="radarFilled")return Va(e,d,f,520,340);if(m==="scatter"||m==="scatterSmooth"||m==="bubble")return Wa(e,d,t,520,340);let g=d.flatMap(P=>P.values),u=e.yAxis?.min??Math.min(0,...g),$=e.yAxis?.max??Math.max(...g);$===u&&($=u+1);let x=$-u,b=5,F=[],y=[];for(let P=0;P<=b;P++){let N=u+x*P/b,H=285-240*(N-u)/x;F.push(`<line x1="65" y1="${H}" x2="500" y2="${H}" stroke="#e0e0e0" stroke-width="1"/>`);let V=Math.abs(N)>=1e3?(N/1e3).toFixed(1)+"k":Number.isInteger(N)?String(N):N.toFixed(1);y.push(`<text x="57" y="${H+4}" text-anchor="end" font-size="10" fill="#666">${V}</text>`)}let v=285-240*(0-u)/x,w="",R=m==="bar"||m==="barStacked"||m==="barStacked100",T=m==="column"||m==="columnStacked"||m==="columnStacked100",S=m==="area"||m==="areaStacked",M=m==="line"||m==="lineStacked"||m==="lineMarker",D=m.includes("Stacked"),k=m.includes("100");if(R){let P=240/p,N=D?P*.7:P*.7/d.length;for(let H=0;H<p;H++)if(D){let V=0,K=k&&d.reduce((z,mt)=>z+Math.abs(mt.values[H]??0),0)||1;for(let z=0;z<d.length;z++){let mt=d[z].values[H]??0;k&&(mt=mt/K*($-u));let it=Math.abs(mt)/x*435,gt=65+V/x*435,St=45+H*P+P*.15;w+=`<rect x="${gt}" y="${St}" width="${it}" height="${N}" fill="${d[z].color}" rx="2"><title>${d[z].name}: ${d[z].values[H]??0}</title></rect>`,V+=Math.abs(mt)}}else for(let V=0;V<d.length;V++){let K=d[V].values[H]??0,z=Math.abs(K-u)/x*435,mt=45+H*P+P*.15+V*N;w+=`<rect x="65" y="${mt}" width="${z}" height="${N}" fill="${d[V].color}" rx="2"><title>${d[V].name}: ${K}</title></rect>`}for(let H=0;H<p;H++){let V=45+H*P+P/2+4;y.push(`<text x="57" y="${V}" text-anchor="end" font-size="10" fill="#666">${I(f[H]??"")}</text>`)}}else if(T||!M&&!S){let P=435/p,N=D?P*.6:P*.6/d.length;for(let H=0;H<p;H++)if(D){let V=0,K=k&&d.reduce((z,mt)=>z+Math.abs(mt.values[H]??0),0)||1;for(let z=0;z<d.length;z++){let mt=d[z].values[H]??0;k&&(mt=mt/K*x);let it=Math.abs(mt)/x*240,gt=65+H*P+P*.2,St=v-V-it;w+=`<rect x="${gt}" y="${St}" width="${N}" height="${it}" fill="${d[z].color}" rx="2"><title>${d[z].name}: ${d[z].values[H]??0}</title></rect>`,V+=it}}else for(let V=0;V<d.length;V++){let K=d[V].values[H]??0,z=Math.abs(K-u)/x*240,mt=65+H*P+P*.2+V*N,it=285-z;w+=`<rect x="${mt}" y="${it}" width="${N}" height="${z}" fill="${d[V].color}" rx="2"><title>${d[V].name}: ${K}</title></rect>`}}if(S)for(let P=0;P<d.length;P++){let N=[];for(let z=0;z<p;z++){let mt=d[P].values[z]??0,it=65+z/(p-1||1)*435,gt=285-(mt-u)/x*240;N.push(`${it},${gt}`)}let H=65,V=65+(p-1)/(p-1||1)*435,K=`M${H},${v} L${N.join(" L")} L${V},${v} Z`;w+=`<path d="${K}" fill="${d[P].color}" fill-opacity="0.3"/>`,w+=`<polyline points="${N.join(" ")}" fill="none" stroke="${d[P].color}" stroke-width="2"/>`}if(M)for(let P=0;P<d.length;P++){let N=[];for(let H=0;H<p;H++){let V=d[P].values[H]??0,K=65+H/(p-1||1)*435,z=285-(V-u)/x*240;N.push(`${K},${z}`)}if(w+=`<polyline points="${N.join(" ")}" fill="none" stroke="${d[P].color}" stroke-width="2.5"/>`,m==="lineMarker"||d[P].values.length<=20)for(let H=0;H<p;H++){let V=d[P].values[H]??0,K=65+H/(p-1||1)*435,z=285-(V-u)/x*240;w+=`<circle cx="${K}" cy="${z}" r="3.5" fill="${d[P].color}" stroke="white" stroke-width="1.5"><title>${d[P].name}: ${V}</title></circle>`}}let W="";if(!R){let P=p>20?Math.ceil(p/15):1;for(let N=0;N<p;N+=P){let H=T||!M&&!S?65+N*(435/p)+435/p/2:65+N/(p-1||1)*435;W+=`<text x="${H}" y="303" text-anchor="middle" font-size="10" fill="#666" transform="rotate(-30 ${H} 303)">${I((f[N]??"").slice(0,12))}</text>`}}let Q="";if(e.legend!==!1&&d.length>1){let H=(520-d.reduce((V,K)=>V+K.name.length*7+25,0))/2;for(let V of d)Q+=`<rect x="${H}" y="320" width="12" height="12" rx="2" fill="${V.color}"/>`,Q+=`<text x="${H+16}" y="330" font-size="10" fill="#444">${I(V.name)}</text>`,H+=V.name.length*7+25}let q="";return e.xAxis?.title&&(q+=`<text x="${520/2}" y="338" text-anchor="middle" font-size="11" fill="#444">${I(e.xAxis.title)}</text>`),e.yAxis?.title&&(q+=`<text x="14" y="${45+240/2}" text-anchor="middle" font-size="11" fill="#444" transform="rotate(-90 14 ${45+240/2})">${I(e.yAxis.title)}</text>`),`<svg xmlns="http://www.w3.org/2000/svg" width="520" height="340" viewBox="0 0 520 340" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
|
|
425
|
+
${c?`<text x="${520/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${I(c)}</text>`:""}
|
|
426
|
+
${F.join(`
|
|
427
|
+
`)}
|
|
428
|
+
<rect x="65" y="45" width="435" height="240" fill="none" stroke="#ccc" stroke-width="0.5"/>
|
|
429
|
+
${w}
|
|
430
|
+
${W}
|
|
431
|
+
${y.join(`
|
|
432
|
+
`)}
|
|
433
|
+
${Q}
|
|
434
|
+
${q}
|
|
435
|
+
</svg>`}function Ua(e,t,o,n,r){let s=n/2,i=r/2+10,a=Math.min(n,r)/2-40,l=e.type==="doughnut"?a*.5:0,h=t[0].values,c=h.reduce(($,x)=>$+Math.abs(x),0)||1,m=e.title??"",d=-Math.PI/2,f=[],p=[];for(let $=0;$<h.length;$++){let x=Math.abs(h[$])/c,b=x*Math.PI*2,F=d+b/2,y=b>Math.PI?1:0,v=s+a*Math.cos(d),w=i+a*Math.sin(d),R=s+a*Math.cos(d+b),T=i+a*Math.sin(d+b),S;if(l>0){let D=s+l*Math.cos(d),k=i+l*Math.sin(d),W=s+l*Math.cos(d+b),Q=i+l*Math.sin(d+b);S=`M${v},${w} A${a},${a} 0 ${y} 1 ${R},${T} L${W},${Q} A${l},${l} 0 ${y} 0 ${D},${k} Z`}else S=h.length===1?`M${s-a},${i} A${a},${a} 0 1 1 ${s+a},${i} A${a},${a} 0 1 1 ${s-a},${i} Z`:`M${s},${i} L${v},${w} A${a},${a} 0 ${y} 1 ${R},${T} Z`;let M=He[$%He.length];if(f.push(`<path d="${S}" fill="${M}" stroke="white" stroke-width="1.5"><title>${I(o[$]??"")}: ${h[$]} (${(x*100).toFixed(1)}%)</title></path>`),x>.04){let D=a+16,k=s+D*Math.cos(F),W=i+D*Math.sin(F),Q=F>Math.PI/2&&F<Math.PI*1.5?"end":"start";p.push(`<text x="${k}" y="${W+4}" text-anchor="${Q}" font-size="10" fill="#444">${I((o[$]??"").slice(0,10))} ${(x*100).toFixed(0)}%</text>`)}d+=b}let g="";if(e.legend!==!1){let $=n-10;for(let x=0;x<Math.min(h.length,10);x++){let b=40+x*18;g+=`<rect x="${$-80}" y="${b-8}" width="10" height="10" rx="2" fill="${He[x%He.length]}"/>`,g+=`<text x="${$-65}" y="${b+2}" font-size="10" fill="#444">${I((o[x]??"").slice(0,10))}</text>`}}let u=m?`<text x="${n/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${I(m)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
|
|
436
|
+
${u}
|
|
437
|
+
${f.join(`
|
|
438
|
+
`)}
|
|
439
|
+
${p.join(`
|
|
440
|
+
`)}
|
|
441
|
+
${g}
|
|
442
|
+
</svg>`}function Va(e,t,o,n,r){let s=n/2,i=r/2+10,a=Math.min(n,r)/2-50,l=o.length||1,h=e.type==="radarFilled",c=t.flatMap(u=>u.values),m=Math.max(...c,1),d=[];for(let u=1;u<=4;u++){let $=a*u/4,x=Array.from({length:l},(b,F)=>{let y=-Math.PI/2+2*Math.PI*F/l;return`${s+$*Math.cos(y)},${i+$*Math.sin(y)}`});d.push(`<polygon points="${x.join(" ")}" fill="none" stroke="#e0e0e0" stroke-width="0.5"/>`)}let f=[];for(let u=0;u<l;u++){let $=-Math.PI/2+2*Math.PI*u/l,x=s+a*Math.cos($),b=i+a*Math.sin($);f.push(`<line x1="${s}" y1="${i}" x2="${x}" y2="${b}" stroke="#ccc" stroke-width="0.5"/>`);let F=s+(a+14)*Math.cos($),y=i+(a+14)*Math.sin($);f.push(`<text x="${F}" y="${y+4}" text-anchor="middle" font-size="9" fill="#666">${I((o[u]??"").slice(0,8))}</text>`)}let p=[];for(let u of t){let $=u.values.map((x,b)=>{let F=-Math.PI/2+2*Math.PI*b/l,y=x/m*a;return`${s+y*Math.cos(F)},${i+y*Math.sin(F)}`});h?p.push(`<polygon points="${$.join(" ")}" fill="${u.color}" fill-opacity="0.2" stroke="${u.color}" stroke-width="2"/>`):p.push(`<polygon points="${$.join(" ")}" fill="none" stroke="${u.color}" stroke-width="2"/>`),u.values.forEach((x,b)=>{let F=-Math.PI/2+2*Math.PI*b/l,y=x/m*a;p.push(`<circle cx="${s+y*Math.cos(F)}" cy="${i+y*Math.sin(F)}" r="3" fill="${u.color}" stroke="white" stroke-width="1"><title>${u.name}: ${x}</title></circle>`)})}let g=e.title?`<text x="${n/2}" y="20" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${I(e.title)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
|
|
443
|
+
${g}
|
|
444
|
+
${d.join(`
|
|
445
|
+
`)}
|
|
446
|
+
${f.join(`
|
|
447
|
+
`)}
|
|
448
|
+
${p.join(`
|
|
449
|
+
`)}
|
|
450
|
+
</svg>`}function Wa(e,t,o,n,r){let h=n-60-20,c=r-45-40,m=e.series[0]?.categories?lr(o,e.series[0].categories):[],d=[];for(let w of t)for(let R=0;R<w.values.length;R++)d.push({x:m[R]??R,y:w.values[R],name:w.name,color:w.color});if(!d.length)return"";let f=Math.min(...d.map(w=>w.x)),p=Math.max(...d.map(w=>w.x)),g=Math.min(0,...d.map(w=>w.y)),u=Math.max(...d.map(w=>w.y)),$=p-f||1,x=u-g||1,b=[];for(let w=0;w<=4;w++){let R=45+c-c*w/4;b.push(`<line x1="60" y1="${R}" x2="${n-20}" y2="${R}" stroke="#e0e0e0" stroke-width="0.5"/>`);let T=g+x*w/4;b.push(`<text x="52" y="${R+4}" text-anchor="end" font-size="10" fill="#666">${T.toFixed(0)}</text>`)}let F=d.map(w=>{let R=60+(w.x-f)/$*h,T=45+c-(w.y-g)/x*c,S=e.type==="bubble"?Math.max(4,Math.min(20,Math.sqrt(Math.abs(w.y))*2)):4;return`<circle cx="${R}" cy="${T}" r="${S}" fill="${w.color}" fill-opacity="${e.type==="bubble"?"0.6":"1"}" stroke="white" stroke-width="1"><title>${w.name}: (${w.x}, ${w.y})</title></circle>`}).join(`
|
|
451
|
+
`),y="";if(e.type==="scatterSmooth")for(let w of t){let R=w.values.map((T,S)=>{let D=60+((m[S]??S)-f)/$*h,k=45+c-(T-g)/x*c;return`${D},${k}`});y+=`<polyline points="${R.join(" ")}" fill="none" stroke="${w.color}" stroke-width="2"/>`}let v=e.title?`<text x="${n/2}" y="22" text-anchor="middle" font-size="14" font-weight="600" fill="#333">${I(e.title)}</text>`:"";return`<svg xmlns="http://www.w3.org/2000/svg" width="${n}" height="${r}" viewBox="0 0 ${n} ${r}" style="background:white;border:1px solid #e0e0e0;border-radius:6px;box-shadow:0 1px 4px rgba(0,0,0,.08);margin:4px">
|
|
452
|
+
${v}
|
|
453
|
+
${b.join(`
|
|
454
|
+
`)}
|
|
455
|
+
<rect x="60" y="45" width="${h}" height="${c}" fill="none" stroke="#ccc" stroke-width="0.5"/>
|
|
456
|
+
${y}
|
|
457
|
+
${F}
|
|
458
|
+
</svg>`}function Ha(e,t){return`<div class="xl-chart" data-from-col="${e.from.col}" data-from-row="${e.from.row}" data-to-col="${e.to.col}" data-to-row="${e.to.row}" style="position:absolute;z-index:4">${cr(e,t)}</div>`}function za(e,t,o){switch(e){case"rect":return`<rect x="0" y="0" width="${t}" height="${o}"/>`;case"roundRect":return`<rect x="0" y="0" width="${t}" height="${o}" rx="${Math.min(t,o)*.15}"/>`;case"ellipse":return`<ellipse cx="${t/2}" cy="${o/2}" rx="${t/2}" ry="${o/2}"/>`;case"triangle":return`<polygon points="${t/2},0 ${t},${o} 0,${o}"/>`;case"diamond":return`<polygon points="${t/2},0 ${t},${o/2} ${t/2},${o} 0,${o/2}"/>`;case"pentagon":return`<polygon points="${Array.from({length:5},(r,s)=>{let i=-Math.PI/2+2*Math.PI*s/5;return`${t/2+t/2*Math.cos(i)},${o/2+o/2*Math.sin(i)}`}).join(" ")}"/>`;case"hexagon":return`<polygon points="${Array.from({length:6},(r,s)=>{let i=-Math.PI/6+2*Math.PI*s/6;return`${t/2+t/2*Math.cos(i)},${o/2+o/2*Math.sin(i)}`}).join(" ")}"/>`;case"octagon":return`<polygon points="${Array.from({length:8},(r,s)=>{let i=-Math.PI/8+2*Math.PI*s/8;return`${t/2+t/2*Math.cos(i)},${o/2+o/2*Math.sin(i)}`}).join(" ")}"/>`;case"star5":case"star6":{let n=e==="star5"?5:6,r=[];for(let s=0;s<n*2;s++){let i=-Math.PI/2+Math.PI*s/n,a=s%2===0?Math.min(t,o)/2:Math.min(t,o)/4.5;r.push(`${t/2+a*Math.cos(i)},${o/2+a*Math.sin(i)}`)}return`<polygon points="${r.join(" ")}"/>`}case"rightArrow":return`<polygon points="0,${o*.25} ${t*.65},${o*.25} ${t*.65},0 ${t},${o/2} ${t*.65},${o} ${t*.65},${o*.75} 0,${o*.75}"/>`;case"leftArrow":return`<polygon points="${t},${o*.25} ${t*.35},${o*.25} ${t*.35},0 0,${o/2} ${t*.35},${o} ${t*.35},${o*.75} ${t},${o*.75}"/>`;case"upArrow":return`<polygon points="${t*.25},${o} ${t*.25},${o*.35} 0,${o*.35} ${t/2},0 ${t},${o*.35} ${t*.75},${o*.35} ${t*.75},${o}"/>`;case"downArrow":return`<polygon points="${t*.25},0 ${t*.75},0 ${t*.75},${o*.65} ${t},${o*.65} ${t/2},${o} 0,${o*.65} ${t*.25},${o*.65}"/>`;case"heart":{let n=t/2,r=o;return`<path d="M${n},${r*.35} C${n},${r*.15} ${n*.5},0 ${n*.25},0 C0,0 0,${r*.35} 0,${r*.35} C0,${r*.6} ${n*.5},${r*.8} ${n},${r} C${n*1.5},${r*.8} ${t},${r*.6} ${t},${r*.35} C${t},${r*.35} ${t},0 ${n*1.75},0 C${n*1.5},0 ${n},${r*.15} ${n},${r*.35} Z"/>`}case"lightningBolt":return`<polygon points="${t*.55},0 ${t*.2},${o*.45} ${t*.45},${o*.45} ${t*.15},${o} ${t*.8},${o*.4} ${t*.55},${o*.4}"/>`;case"sun":return`<circle cx="${t/2}" cy="${o/2}" r="${Math.min(t,o)*.3}"/>`;case"moon":return`<path d="M${t*.6},${o*.1} A${t*.4},${o*.4} 0 1 0 ${t*.6},${o*.9} A${t*.3},${o*.35} 0 1 1 ${t*.6},${o*.1} Z"/>`;case"smileyFace":return`<circle cx="${t/2}" cy="${o/2}" r="${Math.min(t,o)*.45}"/><circle cx="${t*.35}" cy="${o*.38}" r="${Math.min(t,o)*.04}" fill="white"/><circle cx="${t*.65}" cy="${o*.38}" r="${Math.min(t,o)*.04}" fill="white"/><path d="M${t*.3},${o*.58} Q${t/2},${o*.78} ${t*.7},${o*.58}" fill="none" stroke="white" stroke-width="2"/>`;case"cloud":return`<ellipse cx="${t*.35}" cy="${o*.55}" rx="${t*.25}" ry="${o*.25}"/><ellipse cx="${t*.55}" cy="${o*.35}" rx="${t*.22}" ry="${o*.22}"/><ellipse cx="${t*.7}" cy="${o*.5}" rx="${t*.2}" ry="${o*.2}"/><rect x="${t*.15}" y="${o*.5}" width="${t*.7}" height="${o*.25}" rx="4"/>`;case"callout1":return`<path d="M0,0 L${t},0 L${t},${o*.7} L${t*.4},${o*.7} L${t*.25},${o} L${t*.3},${o*.7} L0,${o*.7} Z"/>`;case"callout2":return`<path d="M${t*.1},0 L${t*.9},0 Q${t},0 ${t},${o*.1} L${t},${o*.6} Q${t},${o*.7} ${t*.9},${o*.7} L${t*.4},${o*.7} L${t*.25},${o} L${t*.3},${o*.7} L${t*.1},${o*.7} Q0,${o*.7} 0,${o*.6} L0,${o*.1} Q0,0 ${t*.1},0 Z"/>`;case"flowChartProcess":return`<rect x="0" y="0" width="${t}" height="${o}" rx="2"/>`;case"flowChartDecision":return`<polygon points="${t/2},0 ${t},${o/2} ${t/2},${o} 0,${o/2}"/>`;case"flowChartTerminator":return`<rect x="0" y="0" width="${t}" height="${o}" rx="${o/2}"/>`;case"flowChartDocument":return`<path d="M0,0 L${t},0 L${t},${o*.8} Q${t*.75},${o*.65} ${t*.5},${o*.8} Q${t*.25},${o*.95} 0,${o*.8} Z"/>`;case"line":return`<line x1="0" y1="${o/2}" x2="${t}" y2="${o/2}" stroke-width="2"/>`;case"curvedConnector3":return`<path d="M0,${o/2} C${t*.3},${o*.1} ${t*.7},${o*.9} ${t},${o/2}" fill="none" stroke-width="2"/>`;default:return`<rect x="0" y="0" width="${t}" height="${o}" rx="4"/>`}}function Ga(e){let t=m=>{let d=m.replace(/^#/,"");return d.length===8&&(d=d.substring(2)),"#"+d},o=e.fillColor?t(e.fillColor):"#4472C4",n=e.lineColor?t(e.lineColor):"#2F5496",r=e.lineWidth??2,s=160,i=80,a=e.rotation?` transform="rotate(${e.rotation} ${s/2} ${i/2})"`:"",l=e.text?`<text x="${s/2}" y="${i/2+5}" text-anchor="middle" fill="white" font-size="13" font-weight="600"${e.font?.name?` font-family="'${I(e.font.name)}'"`:""}>${I(e.text)}</text>`:"",c=e.type==="line"||e.type==="curvedConnector3"?`fill="none" stroke="${o}"`:`fill="${o}" stroke="${n}" stroke-width="${r}"`;return`<div class="xl-shape" data-from-col="${e.from.col}" data-from-row="${e.from.row}" data-to-col="${e.to.col}" data-to-row="${e.to.row}" style="position:absolute;z-index:2">
|
|
459
|
+
<svg xmlns="http://www.w3.org/2000/svg" width="${s}" height="${i}" viewBox="0 0 ${s} ${i}"${a}>
|
|
460
|
+
<g ${c}>${za(e.type,s,i)}</g>
|
|
461
|
+
${l}
|
|
462
|
+
</svg></div>`}function qa(e){let t=c=>{let m=c.replace(/^#/,"");return m.length===8&&(m=m.substring(2)),"#"+m},o=e.fillColor?t(e.fillColor):"#333",n=e.outlineColor?t(e.outlineColor):"",r=e.font?.name??"Impact",s=e.font?.size??36,i=e.font?.bold!==!1?"font-weight:bold;":"",a=e.font?.italic?"font-style:italic;":"",l=n?`-webkit-text-stroke:1px ${n};paint-order:stroke fill;`:"",h=Ka(e.preset);return`<div class="xl-wordart" data-from-col="${e.from.col}" data-from-row="${e.from.row}" data-to-col="${e.to.col}" data-to-row="${e.to.row}" style="position:absolute;z-index:2;font-family:'${I(r)}',sans-serif;font-size:${s}px;${i}${a}color:${o};${l}text-shadow:2px 2px 4px rgba(0,0,0,.3);${h}padding:8px 16px;white-space:nowrap;line-height:1.2">${I(e.text)}</div>`}function Ka(e){return!e||e==="textPlain"?"":{textArchUp:"letter-spacing:4px;",textArchDown:"letter-spacing:4px;transform:scaleY(-1);",textCircle:"letter-spacing:6px;",textWave1:"letter-spacing:2px;font-style:italic;transform:skewX(-5deg);",textWave2:"letter-spacing:2px;font-style:italic;transform:skewX(5deg);",textInflate:"letter-spacing:3px;transform:scaleY(1.3);",textDeflate:"letter-spacing:1px;transform:scaleY(0.7);",textSlantUp:"transform:perspective(300px) rotateY(-8deg) rotateX(3deg);",textSlantDown:"transform:perspective(300px) rotateY(8deg) rotateX(-3deg);",textFadeUp:"transform:perspective(200px) rotateX(-8deg);",textFadeDown:"transform:perspective(200px) rotateX(8deg);",textFadeLeft:"transform:perspective(200px) rotateY(8deg);",textFadeRight:"transform:perspective(200px) rotateY(-8deg);",textCascadeUp:"letter-spacing:3px;transform:rotate(-5deg) scaleX(1.1);",textCascadeDown:"letter-spacing:3px;transform:rotate(5deg) scaleX(1.1);",textChevron:"letter-spacing:5px;transform:scaleX(1.15);",textRingInside:"letter-spacing:8px;",textRingOutside:"letter-spacing:6px;",textStop:"letter-spacing:2px;transform:scaleY(0.85) scaleX(1.1);"}[e]??""}function Za(e){let t="";for(let o=0;o<e.length;o+=3){let n=e[o],r=e[o+1]??0,s=e[o+2]??0,i=n<<16|r<<8|s,a="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";t+=a[i>>18&63]+a[i>>12&63],t+=o+1<e.length?a[i>>6&63]:"=",t+=o+2<e.length?a[i&63]:"="}return t}function hr(e,t){let o=Ja(t),n=typeof e=="string"?e:Za(e);return`data:${o};base64,${n}`}function Ya(e){let t=hr(e.data,e.format),o=e.altText?` alt="${I(e.altText)}"`:"",n=e.width?`width:${e.width}px;`:"max-width:400px;",r=e.height?`height:${e.height}px;`:"max-height:300px;",s=e.from?.col??0,i=e.from?.row??0;return`<img src="${t}"${o} class="xl-img" data-from-col="${s}" data-from-row="${i}" style="${n}${r}border:1px solid #ddd;border-radius:4px"/>`}function Qa(e){let t=hr(e.data,e.format),o=e.altText?` alt="${I(e.altText)}"`:"";return`<img src="${t}"${o} style="max-width:100%;max-height:100%;object-fit:contain"/>`}function Ja(e){switch(e){case"jpeg":case"jpg":return"image/jpeg";case"gif":return"image/gif";case"svg":return"image/svg+xml";case"webp":return"image/webp";case"bmp":return"image/bmp";default:return"image/png"}}function At(e){switch(e.type){case"text":{let t=I(e.text??"");return e.font==="normal"||/^[a-zA-Z]{2,}$/.test(e.text??"")?`<mi mathvariant="normal">${t}</mi>`:/^[0-9.]+$/.test(e.text??"")?`<mn>${t}</mn>`:e.text&&e.text.length===1&&/[+\-*/=<>±×÷≤≥≠∞∈∉∪∩⊂⊃∧∨¬→←↔∀∃∑∏∫]/.test(e.text)?`<mo>${t}</mo>`:`<mi>${t}</mi>`}case"frac":return`<mfrac><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.argument??[]).map(At).join("")}</mrow></mfrac>`;case"sup":return`<msup><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.argument??[]).map(At).join("")}</mrow></msup>`;case"sub":return`<msub><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.argument??[]).map(At).join("")}</mrow></msub>`;case"subSup":return`<msubsup><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.subscript??[]).map(At).join("")}</mrow><mrow>${(e.superscript??[]).map(At).join("")}</mrow></msubsup>`;case"nary":return`<munderover><mo>${I(e.operator??"\u2211")}</mo><mrow>${(e.lower??[]).map(At).join("")}</mrow><mrow>${(e.upper??[]).map(At).join("")}</mrow></munderover><mrow>${(e.body??[]).map(At).join("")}</mrow>`;case"rad":return!e.hideDegree&&e.degree?.length?`<mroot><mrow>${(e.body??[]).map(At).join("")}</mrow><mrow>${e.degree.map(At).join("")}</mrow></mroot>`:`<msqrt><mrow>${(e.body??[]).map(At).join("")}</mrow></msqrt>`;case"delim":return`<mrow><mo>${I(e.open??"(")}</mo>${(e.body??[]).map(At).join("")}<mo>${I(e.close??")")}</mo></mrow>`;case"func":return`<mrow><mi mathvariant="normal">${(e.base??[]).map(t=>I(t.text??"")).join("")}</mi><mo>⁡</mo>${(e.argument??[]).map(At).join("")}</mrow>`;case"groupChar":return`<munder><mrow>${(e.base??[]).map(At).join("")}</mrow><mo>${I(e.operator??"\u23DF")}</mo></munder>`;case"accent":return`<mover accent="true"><mrow>${(e.base??[]).map(At).join("")}</mrow><mo>${I(e.operator??"\u0302")}</mo></mover>`;case"bar":return`<mover><mrow>${(e.base??[]).map(At).join("")}</mrow><mo>\xAF</mo></mover>`;case"limLow":return`<munder><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.argument??[]).map(At).join("")}</mrow></munder>`;case"limUpp":return`<mover><mrow>${(e.base??[]).map(At).join("")}</mrow><mrow>${(e.argument??[]).map(At).join("")}</mrow></mover>`;case"eqArr":return`<mtable>${(e.rows??[]).map(t=>`<mtr><mtd>${t.map(At).join("")}</mtd></mtr>`).join("")}</mtable>`;case"matrix":return`<mrow><mo>(</mo><mtable>${(e.rows??[]).map(t=>`<mtr>${t.map(o=>`<mtd>${At(o)}</mtd>`).join("")}</mtr>`).join("")}</mtable><mo>)</mo></mrow>`;default:return e.text?`<mi>${I(e.text)}</mi>`:"<mrow></mrow>"}}function ti(e){let t=e.fontSize??11,o=e.fontName??"Cambria Math";return`<div class="xl-math" data-from-col="${e.from.col}" data-from-row="${e.from.row}" style="position:absolute;z-index:2;font-family:'${I(o)}',serif;font-size:${t}pt;padding:4px;background:white"><math xmlns="http://www.w3.org/1998/Math/MathML" display="block"><mrow>${e.elements.map(At).join("")}</mrow></math></div>`}function mr(e){let t=e.from.col,o=e.from.row,n=e.to?.col,r=e.to?.row,s=n!=null&&r!=null?` data-to-col="${n}" data-to-row="${r}"`:"",i=e.linkedCell?` data-linked-cell="${I(e.linkedCell)}"`:"",a=e.inputRange?` data-input-range="${I(e.inputRange)}"`:"",l=e.macro?` data-macro="${I(e.macro)}"`:"",h="";switch(e.type){case"button":case"dialog":h=`<button style="width:100%;height:100%;padding:4px 12px;font-size:13px;border:1px outset #ccc;background:linear-gradient(180deg,#f8f8f8,#e0e0e0);cursor:pointer;border-radius:3px;white-space:nowrap"${l}>${I(e.text??"Button")}</button>`;break;case"checkBox":{let c=e.checked==="checked"?" checked":"",m=e.checked==="mixed"?' data-indeterminate="true"':"";h=`<label style="font-size:13px;display:inline-flex;align-items:center;gap:4px;width:100%;height:100%;padding:2px 4px;cursor:pointer"><input type="checkbox"${c}${m}${i}/> ${I(e.text??"Checkbox")}</label>`;break}case"optionButton":{h=`<label style="font-size:13px;display:inline-flex;align-items:center;gap:4px;width:100%;height:100%;padding:2px 4px;cursor:pointer"><input type="radio" name="group"${e.checked==="checked"?" checked":""}${i}/> ${I(e.text??"Option")}</label>`;break}case"comboBox":{let c=e.dropLines??8;h=`<select style="width:100%;height:100%;padding:2px 4px;font-size:13px;border:1px solid #aaa;background:white"${i}${a} size="1" data-drop-lines="${c}"><option>${I(e.text??"Select...")}</option></select>`;break}case"listBox":{let c=e.dropLines??5,m=e.selType??"single";h=`<select style="width:100%;height:100%;padding:2px;font-size:13px;border:1px solid #aaa;background:white"${i}${a} size="${c}"${m==="multi"||m==="extend"?" multiple":""}><option>${I(e.text??"Item")}</option></select>`;break}case"spinner":{let c=e.min??0,m=e.max??100,d=e.inc??1;h=`<input type="number" value="${e.val??c}" min="${c}" max="${m}" step="${d}" style="width:100%;height:100%;padding:2px 4px;font-size:13px;border:1px solid #aaa"${i}/>`;break}case"scrollBar":{let c=e.min??0,m=e.max??100,d=e.inc??1;h=`<input type="range" value="${e.val??c}" min="${c}" max="${m}" step="${d}" style="width:100%;height:100%"${i}/>`;break}case"label":h=`<span style="font-size:13px;display:flex;align-items:center;width:100%;height:100%;padding:2px 4px">${I(e.text??"Label")}</span>`;break;case"groupBox":h=`<fieldset style="width:100%;height:100%;padding:8px;border:1px solid #999;font-size:13px;margin:0;box-sizing:border-box"><legend>${I(e.text??"Group")}</legend></fieldset>`;break;default:h=`<span style="font-size:13px">[${I(e.type)}]</span>`}return`<div class="xl-fc" data-from-col="${t}" data-from-row="${o}"${s} style="position:absolute;overflow:hidden">${h}</div>`}function ne(e){let t=0;for(let o=0;o<e.length;o++)t=t*26+(e.charCodeAt(o)-64);return t}function ei(e,t){let o=[],r=(t.includes("!")?t.split("!")[1]:t).match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(r){let s=ne(r[1]),i=parseInt(r[2],10),a=ne(r[3]),l=parseInt(r[4],10);for(let h=i;h<=l;h++)for(let c=s;c<=a;c++){let m=e.getCell(h,c);typeof m.value=="number"&&o.push(m.value)}}return o}function ln(e,t={}){t.evaluateFormulas&&new me().calculateSheet(e);let o=e.getUsedRange();if(!o)return t.fullDocument!==!1?`<!DOCTYPE html><html><head><title>${I(t.title??"")}</title></head><body><p>Empty worksheet</p></body></html>`:"<table></table>";let{startRow:n,startCol:r,endRow:s,endCol:i}=o;if(t.printAreaOnly&&e.printArea){let N=e.printArea.match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);N&&(r=ne(N[1]),n=parseInt(N[2],10),i=ne(N[3]),s=parseInt(N[4],10))}let a=e.getMerges(),l=t.includeConditionalFormatting!==!1?e.getConditionalFormats():[],h=t.includeSparklines!==!1?e.getSparklines():[],c=new Map;for(let P of h){let N=P.location.match(/^([A-Z]+)(\d+)$/);N&&c.set(`${parseInt(N[2],10)},${ne(N[1])}`,P)}let m=new Map;for(let P of l){if(!P.colorScale&&!P.dataBar&&!P.iconSet)continue;let N=[],H=P.sqref.split(" ");for(let V of H){let K=V.match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(K)for(let z=parseInt(K[2],10);z<=parseInt(K[4],10);z++)for(let mt=ne(K[1]);mt<=ne(K[3]);mt++){let it=e.getCell(z,mt);typeof it.value=="number"&&N.push(it.value)}}m.set(P,N)}let d=new Map;for(let P of a){let N=P.endRow-P.startRow+1,H=P.endCol-P.startCol+1;d.set(`${P.startRow},${P.startCol}`,{rowSpan:N,colSpan:H});for(let V=P.startRow;V<=P.endRow;V++)for(let K=P.startCol;K<=P.endCol;K++)(V!==P.startRow||K!==P.startCol)&&d.set(`${V},${K}`,"skip")}let f=[];if(t.includeColumnWidths!==!1)for(let P=r;P<=i;P++){let N=e.getColumn(P);if(t.skipHidden&&N?.hidden)continue;let H=N?.width?Math.round(N.width*7.5):void 0;f.push(H?`<col style="width:${H}px">`:"<col>")}let p=new Map,g=e.getCellImages?.();if(g)for(let P of g)p.set(P.cell,P);let u=[];for(let P=n;P<=s;P++){let N=e.getRow(P);if(t.skipHidden&&N?.hidden)continue;let H=N?.height?` style="height:${N.height}px"`:"",V=[];for(let K=r;K<=i;K++){let z=e.getColumn(K);if(t.skipHidden&&z?.hidden)continue;let mt=`${P},${K}`,it=d.get(mt);if(it==="skip")continue;let gt=e.getCell(P,K),St="",J=`${Ut(K)}${P}`,G=p.get(J);if(G)St=Qa(G);else if(gt.richText)St=gt.richText.map(ht=>{let tt=ht.font?ir(ht.font):"";return tt?`<span style="${tt}">${I(ht.text)}</span>`:I(ht.text)}).join("");else if(gt.value!=null){let ht=gt.style?.numberFormat?_a(gt.value,gt.style.numberFormat.formatCode):String(gt.value);St=I(ht)}if(gt.hyperlink){let ht=I(gt.hyperlink.href??""),tt=gt.hyperlink.tooltip?` title="${I(gt.hyperlink.tooltip)}"`:"";St=`<a href="${ht}"${tt} style="color:#0563C1;text-decoration:underline">${St}</a>`}if(gt.comment){let ht=gt.comment.richText?gt.comment.richText.map(tt=>tt.text).join(""):gt.comment.text;St=`<span title="${I(ht)}" style="cursor:help">${St}</span>`}let X=[];it&&typeof it!="string"&&(it.rowSpan>1&&X.push(`rowspan="${it.rowSpan}"`),it.colSpan>1&&X.push(`colspan="${it.colSpan}"`));let C=[];t.includeStyles!==!1&>.style&&C.push(Ba(gt.style));let A="";if(typeof gt.value=="number")for(let ht of l){let tt=m.get(ht);if(!tt)continue;let ft=La(ht,gt.value,tt);ft.startsWith("data-icon=")?A=` ${ft}`:ft&&C.push(ft)}let U=C.filter(Boolean).join(";");U&&X.push(`style="${U}"`),X.push(`data-cell="${Ut(K)}${P}"`);let Y=c.get(mt);Y&&(St+=Na(Y,ei(e,Y.dataRange)));let rt=X.length?" "+X.join(" "):"";V.push(`<td${rt}${A}>${St}</td>`)}u.push(`<tr${H}>${V.join("")}</tr>`)}let x=`<div class="xl-sheet-wrapper" style="position:relative;display:inline-block"><table border="0" cellpadding="4" cellspacing="0">
|
|
463
|
+
${f.length?`<colgroup>${f.join("")}</colgroup>`:""}
|
|
464
|
+
${u.join(`
|
|
465
|
+
`)}
|
|
466
|
+
</table>`,b="";if(t.includeCharts!==!1){let P=e.getCharts();P.length&&(b=`
|
|
467
|
+
<div class="xl-charts">`+P.map(N=>Ha(N,e)).join(`
|
|
468
|
+
`)+"</div>")}let F="",y=e.getImages?.();y?.length&&(F=`
|
|
469
|
+
<div class="xl-images">`+y.map(Ya).join(`
|
|
470
|
+
`)+"</div>");let v="",w=e.getShapes?.();w?.length&&(v=`
|
|
471
|
+
<div class="xl-shapes">`+w.map(Ga).join(`
|
|
472
|
+
`)+"</div>");let R="",T=e.getWordArt?.();T?.length&&(R=`
|
|
473
|
+
<div class="xl-wordarts">`+T.map(qa).join(`
|
|
474
|
+
`)+"</div>");let S="",M=e.getMathEquations?.();M?.length&&(S=`
|
|
475
|
+
<div class="xl-math-equations">`+M.map(ti).join(`
|
|
476
|
+
`)+"</div>");let D="",k=e.getFormControls?.();k?.length&&(D=`
|
|
477
|
+
<div class="xl-form-controls">`+k.map(mr).join(`
|
|
478
|
+
`)+"</div>");let W=b+F+v+R+S+D,Q="</div>";return t.fullDocument===!1?x+W+Q:`<!DOCTYPE html>
|
|
479
|
+
<html lang="en">
|
|
480
|
+
<head>
|
|
481
|
+
<meta charset="UTF-8">
|
|
482
|
+
<title>${I(t.title??t.sheetName??"Export")}</title>
|
|
483
|
+
<style>
|
|
484
|
+
* { box-sizing: border-box; }
|
|
485
|
+
body { font-family: 'Segoe UI', Calibri, sans-serif; margin: 20px; background: #f5f6fa; }
|
|
486
|
+
.xl-sheet-wrapper { position: relative; display: inline-block; }
|
|
487
|
+
table { border-collapse: collapse; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
|
|
488
|
+
td { padding: 4px 8px; border: 1px solid #d4d4d4; vertical-align: bottom; }
|
|
489
|
+
td[data-icon]::before { content: attr(data-icon); margin-right: 4px; }
|
|
490
|
+
.xl-images { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
491
|
+
.xl-images .xl-img { pointer-events: auto; position: absolute; z-index: 2; }
|
|
492
|
+
.xl-charts { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
493
|
+
.xl-charts .xl-chart { pointer-events: auto; }
|
|
494
|
+
.xl-shapes { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
495
|
+
.xl-shapes .xl-shape { pointer-events: auto; }
|
|
496
|
+
.xl-wordarts { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
497
|
+
.xl-wordarts .xl-wordart { pointer-events: auto; }
|
|
498
|
+
.xl-math-equations { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
499
|
+
.xl-math-equations .xl-math { pointer-events: auto; }
|
|
500
|
+
.xl-form-controls { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
501
|
+
.xl-form-controls .xl-fc { pointer-events: auto; z-index: 3; }
|
|
502
|
+
a { color: #0563C1; }
|
|
503
|
+
</style>
|
|
504
|
+
</head>
|
|
505
|
+
<body>
|
|
506
|
+
${x}${W}${Q}
|
|
507
|
+
<script>
|
|
508
|
+
(function(){
|
|
509
|
+
document.querySelectorAll('.xl-sheet-wrapper').forEach(function(wrapper){
|
|
510
|
+
var table = wrapper.querySelector('table');
|
|
511
|
+
if (!table) return;
|
|
512
|
+
var startRow = parseInt((table.rows[0] && table.rows[0].cells[0] || {}).getAttribute && table.rows[0].cells[0].getAttribute('data-cell') ? table.rows[0].cells[0].getAttribute('data-cell').replace(/[A-Z]+/,'') : '1', 10) || 1;
|
|
513
|
+
var startCol = 1;
|
|
514
|
+
var firstCell = table.rows[0] && table.rows[0].cells[0] ? table.rows[0].cells[0].getAttribute('data-cell') : null;
|
|
515
|
+
if (firstCell) {
|
|
516
|
+
var colStr = firstCell.replace(/[0-9]+/g,'');
|
|
517
|
+
startCol = 0;
|
|
518
|
+
for (var ci = 0; ci < colStr.length; ci++) startCol = startCol * 26 + (colStr.charCodeAt(ci) - 64);
|
|
519
|
+
}
|
|
520
|
+
function cellRect(sheetRow, sheetCol) {
|
|
521
|
+
var ri = sheetRow - startRow;
|
|
522
|
+
var colIdx = sheetCol - startCol;
|
|
523
|
+
if (ri < 0) ri = 0;
|
|
524
|
+
if (colIdx < 0) colIdx = 0;
|
|
525
|
+
var tr = table.rows[ri];
|
|
526
|
+
if (!tr) tr = table.rows[table.rows.length - 1] || table.rows[0];
|
|
527
|
+
if (!tr) return {x:0, y:0, w:0, h:0};
|
|
528
|
+
var td = tr.cells[colIdx];
|
|
529
|
+
if (!td) td = tr.cells[tr.cells.length - 1] || tr.cells[0];
|
|
530
|
+
if (!td) return {x:0, y:0, w:0, h:0};
|
|
531
|
+
return {x: td.offsetLeft, y: td.offsetTop, w: td.offsetWidth, h: td.offsetHeight};
|
|
532
|
+
}
|
|
533
|
+
wrapper.querySelectorAll('[data-from-col][data-from-row]').forEach(function(el){
|
|
534
|
+
var fc = parseInt(el.getAttribute('data-from-col'),10);
|
|
535
|
+
var fr = parseInt(el.getAttribute('data-from-row'),10);
|
|
536
|
+
var from = cellRect(fr, fc);
|
|
537
|
+
el.style.left = from.x + 'px';
|
|
538
|
+
el.style.top = from.y + 'px';
|
|
539
|
+
var tc = el.getAttribute('data-to-col');
|
|
540
|
+
var tr2 = el.getAttribute('data-to-row');
|
|
541
|
+
if (tc !== null && tr2 !== null) {
|
|
542
|
+
var to = cellRect(parseInt(tr2,10), parseInt(tc,10));
|
|
543
|
+
var w = to.x + to.w - from.x;
|
|
544
|
+
var h = to.y + to.h - from.y;
|
|
545
|
+
if (w > 0) el.style.width = w + 'px';
|
|
546
|
+
if (h > 0) el.style.height = h + 'px';
|
|
547
|
+
}
|
|
548
|
+
});
|
|
549
|
+
});
|
|
550
|
+
})();
|
|
551
|
+
</script>
|
|
552
|
+
</body>
|
|
553
|
+
</html>`}function oi(e,t={}){let o=e.getSheets(),n=e.getSheetNames(),r=t.sheets??n,s=t.includeTabs!==!1;t.evaluateFormulas&&new me().calculateWorkbook(e);let i=[];for(let c=0;c<o.length;c++){if(!r.includes(n[c]))continue;if(o[c]._isChartSheet){let d=o[c].getCharts();if(d.length){let f=cr(d[0],o[c]);i.push({name:n[c],html:`<div class="xl-sheet-wrapper" style="position:relative;display:inline-block">${f}</div>`})}continue}if(o[c]._isDialogSheet){let d=o[c].getFormControls?.()??[];if(d.length){let f=d.map(mr).join(`
|
|
554
|
+
`);i.push({name:n[c],html:`<div class="xl-sheet-wrapper" style="position:relative;display:inline-block;min-width:400px;min-height:300px"><div class="xl-form-controls">${f}</div></div>`})}else i.push({name:n[c],html:'<div class="xl-sheet-wrapper"><p>Dialog Sheet</p></div>'});continue}let m=ln(o[c],{...t,fullDocument:!1,sheetName:n[c]});i.push({name:n[c],html:m})}if(i.length===1&&!s)return ln(o[0],t);let a=I(t.title??"Workbook Export"),l=i.map((c,m)=>`<button class="tab${m===0?" active":""}" onclick="switchTab(${m})">${I(c.name)}</button>`).join(""),h=i.map((c,m)=>`<div class="panel${m===0?" active":""}" id="panel-${m}">${c.html}</div>`).join(`
|
|
555
|
+
`);return`<!DOCTYPE html>
|
|
556
|
+
<html lang="en">
|
|
557
|
+
<head>
|
|
558
|
+
<meta charset="UTF-8">
|
|
559
|
+
<title>${a}</title>
|
|
560
|
+
<style>
|
|
561
|
+
* { box-sizing: border-box; }
|
|
562
|
+
body { font-family: 'Segoe UI', Calibri, sans-serif; margin: 0; background: #f5f6fa; }
|
|
563
|
+
.tab-bar { display: flex; background: #2b579a; padding: 0 16px; gap: 2px; position: sticky; top: 0; z-index: 10; }
|
|
564
|
+
.tab { padding: 8px 20px; border: none; background: rgba(255,255,255,.15); color: white; cursor: pointer;
|
|
565
|
+
font-size: 13px; border-radius: 4px 4px 0 0; margin-top: 4px; transition: background .15s; }
|
|
566
|
+
.tab:hover { background: rgba(255,255,255,.3); }
|
|
567
|
+
.tab.active { background: white; color: #2b579a; font-weight: 600; }
|
|
568
|
+
.panel { display: none; padding: 20px; overflow: auto; }
|
|
569
|
+
.panel.active { display: block; }
|
|
570
|
+
.xl-sheet-wrapper { position: relative; display: inline-block; }
|
|
571
|
+
table { border-collapse: collapse; background: white; box-shadow: 0 1px 4px rgba(0,0,0,.1); }
|
|
572
|
+
td { padding: 4px 8px; border: 1px solid #d4d4d4; vertical-align: bottom; }
|
|
573
|
+
td[data-icon]::before { content: attr(data-icon); margin-right: 4px; }
|
|
574
|
+
.xl-images { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
575
|
+
.xl-images .xl-img { pointer-events: auto; position: absolute; z-index: 2; }
|
|
576
|
+
.xl-charts { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
577
|
+
.xl-charts .xl-chart { pointer-events: auto; }
|
|
578
|
+
.xl-shapes { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
579
|
+
.xl-shapes .xl-shape { pointer-events: auto; }
|
|
580
|
+
.xl-wordarts { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
581
|
+
.xl-wordarts .xl-wordart { pointer-events: auto; }
|
|
582
|
+
.xl-math-equations { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
583
|
+
.xl-math-equations .xl-math { pointer-events: auto; }
|
|
584
|
+
.xl-form-controls { position: absolute; top: 0; left: 0; pointer-events: none; }
|
|
585
|
+
.xl-form-controls .xl-fc { pointer-events: auto; z-index: 3; }
|
|
586
|
+
a { color: #0563C1; }
|
|
587
|
+
</style>
|
|
588
|
+
</head>
|
|
589
|
+
<body>
|
|
590
|
+
${s?`<div class="tab-bar">${l}</div>`:""}
|
|
591
|
+
${h}
|
|
592
|
+
<script>
|
|
593
|
+
function switchTab(idx) {
|
|
594
|
+
document.querySelectorAll('.tab').forEach((t,i) => t.classList.toggle('active', i===idx));
|
|
595
|
+
document.querySelectorAll('.panel').forEach((p,i) => p.classList.toggle('active', i===idx));
|
|
596
|
+
// Re-run positioning after tab switch since hidden panels may have 0 dimensions
|
|
597
|
+
setTimeout(positionOverlays, 50);
|
|
598
|
+
}
|
|
599
|
+
function positionOverlays() {
|
|
600
|
+
document.querySelectorAll('.xl-sheet-wrapper').forEach(function(wrapper){
|
|
601
|
+
var table = wrapper.querySelector('table');
|
|
602
|
+
if (!table) return;
|
|
603
|
+
var startRow = 1, startCol = 1;
|
|
604
|
+
var firstCell = table.rows[0] && table.rows[0].cells[0] ? table.rows[0].cells[0].getAttribute('data-cell') : null;
|
|
605
|
+
if (firstCell) {
|
|
606
|
+
startRow = parseInt(firstCell.replace(/[A-Z]+/,''), 10) || 1;
|
|
607
|
+
var colStr = firstCell.replace(/[0-9]+/g,'');
|
|
608
|
+
startCol = 0;
|
|
609
|
+
for (var ci = 0; ci < colStr.length; ci++) startCol = startCol * 26 + (colStr.charCodeAt(ci) - 64);
|
|
610
|
+
}
|
|
611
|
+
function cellRect(sheetRow, sheetCol) {
|
|
612
|
+
var ri = sheetRow - startRow;
|
|
613
|
+
var colIdx = sheetCol - startCol;
|
|
614
|
+
if (ri < 0) ri = 0;
|
|
615
|
+
if (colIdx < 0) colIdx = 0;
|
|
616
|
+
var tr = table.rows[ri];
|
|
617
|
+
if (!tr) tr = table.rows[table.rows.length - 1] || table.rows[0];
|
|
618
|
+
if (!tr) return {x:0, y:0, w:0, h:0};
|
|
619
|
+
var td = tr.cells[colIdx];
|
|
620
|
+
if (!td) td = tr.cells[tr.cells.length - 1] || tr.cells[0];
|
|
621
|
+
if (!td) return {x:0, y:0, w:0, h:0};
|
|
622
|
+
return {x: td.offsetLeft, y: td.offsetTop, w: td.offsetWidth, h: td.offsetHeight};
|
|
623
|
+
}
|
|
624
|
+
wrapper.querySelectorAll('[data-from-col][data-from-row]').forEach(function(el){
|
|
625
|
+
var fc = parseInt(el.getAttribute('data-from-col'),10);
|
|
626
|
+
var fr = parseInt(el.getAttribute('data-from-row'),10);
|
|
627
|
+
var from = cellRect(fr, fc);
|
|
628
|
+
el.style.left = from.x + 'px';
|
|
629
|
+
el.style.top = from.y + 'px';
|
|
630
|
+
var tc = el.getAttribute('data-to-col');
|
|
631
|
+
var tr2 = el.getAttribute('data-to-row');
|
|
632
|
+
if (tc !== null && tr2 !== null) {
|
|
633
|
+
var to = cellRect(parseInt(tr2,10), parseInt(tc,10));
|
|
634
|
+
var w = to.x + to.w - from.x;
|
|
635
|
+
var h = to.y + to.h - from.y;
|
|
636
|
+
if (w > 0) el.style.width = w + 'px';
|
|
637
|
+
if (h > 0) el.style.height = h + 'px';
|
|
638
|
+
}
|
|
639
|
+
});
|
|
640
|
+
});
|
|
641
|
+
}
|
|
642
|
+
positionOverlays();
|
|
643
|
+
</script>
|
|
644
|
+
</body>
|
|
645
|
+
</html>`}var Ce={letter:[612,792],legal:[612,1008],a4:[595.28,841.89],a3:[841.89,1190.55],tabloid:[792,1224]},ni=["#000000","#FFFFFF","#44546A","#E7E6E6","#4472C4","#ED7D31","#A5A5A5","#FFC000","#5B9BD5","#70AD47"],ri=[278,278,355,556,556,889,667,191,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,278,278,584,584,584,556,1015,667,667,722,722,667,611,778,722,278,500,667,556,833,722,778,667,778,722,667,611,722,667,944,667,667,611,278,278,278,469,556,333,556,556,500,556,556,278,556,556,222,222,500,222,833,556,556,556,556,333,500,278,556,500,722,500,500,500,334,260,334,584],si=[278,333,474,556,556,889,722,238,333,333,389,584,278,333,278,278,556,556,556,556,556,556,556,556,556,556,333,333,584,584,584,611,975,722,722,722,722,667,611,778,722,278,556,722,611,833,722,778,667,778,722,667,611,722,667,944,667,667,611,333,278,333,584,556,333,556,611,556,611,556,333,611,611,278,278,556,278,889,611,611,611,611,389,556,333,611,556,778,556,556,500,389,280,389,584];function se(e,t,o){let n=o?si:ri,r=0;for(let s=0;s<e.length;s++){let i=e.charCodeAt(s);r+=i>=32&&i<=126?n[i-32]:500}return r/1e3*t}function ai(e){if(!e)return"";if(e.startsWith("#"))return e;if(e.startsWith("theme:")){let t=parseInt(e.slice(6),10);return ni[t]??"#000000"}return e.length===8&&!e.startsWith("#")?"#"+e.slice(2):"#"+e}function ii(e){let t=e.replace("#","");return[parseInt(t.slice(0,2),16)/255,parseInt(t.slice(2,4),16)/255,parseInt(t.slice(4,6),16)/255]}function be(e){let t=ai(e);return t?ii(t):null}function li(e,t){if(e==null)return"";if(!t||t==="General")return String(e);let o=typeof e=="number"?e:parseFloat(String(e));if(isNaN(o))return String(e);if(t.includes("%")){let s=(t.match(/0\.(0+)%/)??[])[1]?.length??0;return(o*100).toFixed(s)+"%"}let n=t.match(/[$€£¥]|"CHF"/);if(n){let s=n[0].replace(/"/g,""),i=(t.match(/\.(0+)/)??[])[1]?.length??2,a=Math.abs(o).toFixed(i).replace(/\B(?=(\d{3})+(?!\d))/g,",");return t.indexOf(n[0])<t.indexOf("0")?(o<0?"-":"")+s+a:(o<0?"-":"")+a+" "+s}if(t.includes("#,##0")||t.includes("#,###")){let s=(t.match(/\.(0+)/)??[])[1]?.length??0;return o.toFixed(s).replace(/\B(?=(\d{3})+(?!\d))/g,",")}let r=t.match(/^0\.(0+)$/);if(r)return o.toFixed(r[1].length);if(/[ymdh]/i.test(t))return ci(o,t);if(/0\.0+E\+0+/i.test(t)){let s=(t.match(/0\.(0+)/)??[])[1]?.length??2;return o.toExponential(s).toUpperCase()}return String(e)}function ci(e,t){let o=new Date(1899,11,30),n=new Date(o.getTime()+e*864e5),r=n.getFullYear(),s=n.getMonth()+1,i=n.getDate(),a=n.getHours(),l=n.getMinutes(),h=n.getSeconds();return t.replace(/yyyy/gi,String(r)).replace(/yy/gi,String(r).slice(-2)).replace(/mmmm/gi,n.toLocaleDateString("en",{month:"long"})).replace(/mmm/gi,n.toLocaleDateString("en",{month:"short"})).replace(/mm/gi,String(s).padStart(2,"0")).replace(/m/gi,String(s)).replace(/dd/gi,String(i).padStart(2,"0")).replace(/d/gi,String(i)).replace(/hh/gi,String(a).padStart(2,"0")).replace(/h/gi,String(a)).replace(/ss/gi,String(h).padStart(2,"0")).replace(/nn|MM/g,String(l).padStart(2,"0"))}function io(e){return e.replace(/\\/g,"\\\\").replace(/\(/g,"\\(").replace(/\)/g,"\\)")}function O(e){return+e.toFixed(4)+""}var ze=new TextEncoder,lo=class{constructor(){this.objects=[null],this.streams=[null]}alloc(){return this.objects.push(null),this.streams.push(null),this.objects.length-1}set(t,o,n){for(;this.objects.length<=t;)this.objects.push(null),this.streams.push(null);this.objects[t]=o,this.streams[t]=n??null}add(t,o){let n=this.alloc();return this.set(n,t,o),n}addDeflated(t,o){let n=Qo(o,6),r=new Uint8Array(2+n.length+4);r[0]=120,r[1]=156,r.set(n,2);let s=1,i=0;for(let c=0;c<o.length;c++)s=(s+o[c])%65521,i=(i+s)%65521;let a=(i<<16|s)>>>0,l=2+n.length;r[l]=a>>>24&255,r[l+1]=a>>>16&255,r[l+2]=a>>>8&255,r[l+3]=a&255;let h=`${t}/Filter/FlateDecode/Length ${r.length}>>`;return this.add(h,r)}build(t,o){let n=[],r=f=>n.push(ze.encode(f)),s=f=>n.push(f);r(`%PDF-1.4
|
|
646
|
+
%\xE2\xE3\xCF\xD3
|
|
647
|
+
`);let i=0,a=new Array(this.objects.length).fill(0);for(let f of n)i+=f.length;let l=[];for(let f=1;f<this.objects.length;f++){let p=this.objects[f];if(!p)continue;let g=[],u=this.streams[f];a[f]=i;let $=`${f} 0 obj
|
|
648
|
+
`;if(g.push(ze.encode($)),i+=$.length,u){let x=p+`
|
|
649
|
+
stream
|
|
650
|
+
`;g.push(ze.encode(x)),i+=x.length,g.push(u),i+=u.length;let b=`
|
|
651
|
+
endstream
|
|
652
|
+
endobj
|
|
653
|
+
`;g.push(ze.encode(b)),i+=b.length}else{let x=p+`
|
|
654
|
+
endobj
|
|
655
|
+
`;g.push(ze.encode(x)),i+=x.length}l.push(g)}for(let f of l)for(let p of f)s(p);let h=i;r(`xref
|
|
656
|
+
0 ${this.objects.length}
|
|
657
|
+
`),r(`0000000000 65535 f
|
|
658
|
+
`);for(let f=1;f<this.objects.length;f++)r(`${String(a[f]).padStart(10,"0")} 00000 n
|
|
659
|
+
`);r(`trailer
|
|
660
|
+
<</Size ${this.objects.length}/Root ${t} 0 R`),o&&r(`/Info ${o} 0 R`),r(`>>
|
|
661
|
+
startxref
|
|
662
|
+
${h}
|
|
663
|
+
%%EOF
|
|
664
|
+
`);let c=0;for(let f of n)c+=f.length;let m=new Uint8Array(c),d=0;for(let f of n)m.set(f,d),d+=f.length;return m}},Re=class{constructor(){this._parts=[]}raw(t){return this._parts.push(t),this}gsave(){return this._parts.push("q"),this}grestore(){return this._parts.push("Q"),this}fillColor(t,o,n){return this._parts.push(`${O(t)} ${O(o)} ${O(n)} rg`),this}strokeColor(t,o,n){return this._parts.push(`${O(t)} ${O(o)} ${O(n)} RG`),this}lineWidth(t){return this._parts.push(`${O(t)} w`),this}dash(t,o){return this._parts.push(`[${t.map(O).join(" ")}] ${O(o)} d`),this}noDash(){return this._parts.push("[] 0 d"),this}fillRect(t,o,n,r){return this._parts.push(`${O(t)} ${O(o)} ${O(n)} ${O(r)} re f`),this}strokeRect(t,o,n,r){return this._parts.push(`${O(t)} ${O(o)} ${O(n)} ${O(r)} re S`),this}line(t,o,n,r){return this._parts.push(`${O(t)} ${O(o)} m ${O(n)} ${O(r)} l S`),this}beginText(){return this._parts.push("BT"),this}endText(){return this._parts.push("ET"),this}font(t,o){return this._parts.push(`/${t} ${O(o)} Tf`),this}textPos(t,o){return this._parts.push(`${O(t)} ${O(o)} Td`),this}showText(t){return this._parts.push(`(${io(t)}) Tj`),this}drawImage(t,o,n,r,s){return this.gsave(),this._parts.push(`${O(r)} 0 0 ${O(s)} ${O(o)} ${O(n)} cm`),this._parts.push(`/${t} Do`),this.grestore(),this}clipRect(t,o,n,r){return this._parts.push(`${O(t)} ${O(o)} ${O(n)} ${O(r)} re W n`),this}toBytes(){return ze.encode(this._parts.join(`
|
|
665
|
+
`)+`
|
|
666
|
+
`)}};function hi(e){return e?{thin:.5,medium:1,thick:1.5,dashed:.5,dotted:.5,double:1.5,hair:.25,mediumDashed:1,dashDot:.5,mediumDashDot:1,dashDotDot:.5,mediumDashDotDot:1,slantDashDot:1}[e]??.5:0}function mi(e){return e?{dashed:[3,2],dotted:[1,1],mediumDashed:[4,2],dashDot:[3,1,1,1],mediumDashDot:[4,1,1,1],dashDotDot:[3,1,1,1,1,1],mediumDashDotDot:[4,1,1,1,1,1],slantDashDot:[4,1,2,1]}[e]??null:null}function dr(e){if(e[0]!==255||e[1]!==216)return null;let t=2;for(;t<e.length-1&&e[t]===255;){let o=e[t+1];if(o===217||o===218)break;let n=e[t+2]<<8|e[t+3];if(o===192||o===193||o===194){let r=e[t+5]<<8|e[t+6];return{width:e[t+7]<<8|e[t+8],height:r}}t+=2+n}return null}function ur(e,t={}){let o=e.getUsedRange();if(!o)return br(t);let{startRow:n,startCol:r,endRow:s,endCol:i}=o;if(t.printAreaOnly&&e.printArea){let j=e.printArea.match(/^'?[^']*'?!?\$?([A-Z]+)\$?(\d+):\$?([A-Z]+)\$?(\d+)$/);j&&(r=qt(j[1]),n=parseInt(j[2],10),i=qt(j[3]),s=parseInt(j[4],10))}let a=e.pageSetup,l=e.pageMargins,h=t.paperSize??(a?.paperSize?$r(a.paperSize):"a4"),c=t.orientation??a?.orientation??"portrait",[m,d]=Ce[h]??Ce.a4,f=c==="landscape"?d:m,p=c==="landscape"?m:d,g={top:(t.margins?.top??l?.top??.75)*72,bottom:(t.margins?.bottom??l?.bottom??.75)*72,left:(t.margins?.left??l?.left??.7)*72,right:(t.margins?.right??l?.right??.7)*72},u=f-g.left-g.right,$=p-g.top-g.bottom,x=t.defaultFontSize??10,b=t.gridLines!==!1,F=t.headings===!0,y=t.repeatRows??0,v=t.headerText??e.headerFooter?.oddHeader,w=t.footerText??e.headerFooter?.oddFooter,R=F?30:0,T=[],S=[];for(let j=r;j<=i;j++){let et=e.getColumn(j);if(t.skipHidden&&et?.hidden)continue;T.push(j);let L=et?.width?et.width*6:48;S.push(L)}let M=S.reduce((j,et)=>j+et,0)+R,D=t.scale??1;t.fitToWidth!==!1&&M*D>u&&(D=u/M),D=Math.max(.1,Math.min(2,D));let k=[],W=[];for(let j=n;j<=s;j++){let et=e.getRow(j);if(t.skipHidden&&et?.hidden)continue;k.push(j);let L=et?.height??x+6;W.push(L)}let Q=e.getMerges(),q=new Map;for(let j of Q){let et=j.endRow-j.startRow+1,L=j.endCol-j.startCol+1;q.set(`${j.startRow},${j.startCol}`,{rowSpan:et,colSpan:L});for(let $t=j.startRow;$t<=j.endRow;$t++)for(let ot=j.startCol;ot<=j.endCol;ot++)($t!==j.startRow||ot!==j.startCol)&&q.set(`${$t},${ot}`,"skip")}let E=new Map,_=e.getSparklines?.()??[];for(let j of _){let et=j.location.match(/^([A-Z]+)(\d+)$/);et&&E.set(`${parseInt(et[2],10)},${qt(et[1])}`,j)}let P=new Map,N=e.getCellImages?.()??[];for(let j of N)P.set(j.cell,j);t.evaluateFormulas&&new me().calculateSheet(e);let H=new Set;for(let j of e.getRowBreaks())H.add(j.id);let V=[],K=0,z=0,mt=k.slice(0,y).reduce((j,et,L)=>j+W[L]*D,0);for(let j=0;j<k.length;j++){let et=W[j]*D,L=$-(V.length>0?mt:0),$t=j>K&&H.has(k[j]);z+et>L&&j>K||$t?(V.push({rowStart:K,rowEnd:j-1}),K=j,z=mt+et):z+=et}K<k.length&&V.push({rowStart:K,rowEnd:k.length-1});let it=new lo,gt=it.alloc(),St=it.alloc(),J=it.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica/Encoding/WinAnsiEncoding>>"),G=it.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-Bold/Encoding/WinAnsiEncoding>>"),X=it.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-Oblique/Encoding/WinAnsiEncoding>>"),C=it.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-BoldOblique/Encoding/WinAnsiEncoding>>"),A=e.getImages?.()??[],U=[],Y=0;for(let j of A){let et=typeof j.data=="string"?fr(j.data):j.data;if(j.format==="jpeg"||j.format==="png"){if(j.format==="jpeg"){let L=dr(et);if(!L)continue;let $t=`Im${++Y}`,ot=it.add(`<</Type/XObject/Subtype/Image/Width ${L.width}/Height ${L.height}/ColorSpace/DeviceRGB/BitsPerComponent 8/Filter/DCTDecode/Length ${et.length}>>`,et);U.push({id:ot,name:$t,width:L.width,height:L.height})}if(j.format==="png"){let L=pr(et,it);L&&(L.name=`Im${++Y}`,U.push(L))}}}let rt=[];function ht(){let j=[...U.map(et=>({name:et.name,id:et.id})),...rt];return j.length?"/XObject<<"+j.map(et=>`/${et.name} ${et.id} 0 R`).join("")+">>":""}let tt;if(t.title||t.author){let j=["/Producer(ExcelForge)"];t.title&&j.push(`/Title(${io(t.title)})`),t.author&&j.push(`/Author(${io(t.author)})`),tt=it.add(`<<${j.join("")}>>`)}let ft=[];for(let j=0;j<V.length;j++){let et=V[j],L=new Re;D!==1&&(L.gsave(),L.raw(`${O(D)} 0 0 ${O(D)} ${O(g.left*(1-D))} ${O(g.bottom*(1-D))} cm`));let $t=[];if(j>0&&y>0)for(let Z=0;Z<Math.min(y,k.length);Z++)$t.push({sheetRow:k[Z],height:W[Z],ri:Z});for(let Z=et.rowStart;Z<=et.rowEnd;Z++)$t.push({sheetRow:k[Z],height:W[Z],ri:Z});let ot=p-g.top;for(let Z of $t){let yt=Z.height*D,nt=g.left;if(F){L.gsave(),L.fillColor(.9,.9,.9),L.fillRect(nt,ot-yt,R*D,yt),L.strokeColor(.7,.7,.7).lineWidth(.25),L.strokeRect(nt,ot-yt,R*D,yt),L.fillColor(.3,.3,.3),L.beginText().font("F1",7*D);let dt=String(Z.sheetRow),pt=se(dt,7,!1)*D;L.textPos(nt+(R*D-pt)/2,ot-yt+(yt-7*D)/2+1),L.showText(dt).endText(),L.grestore(),nt+=R*D}for(let dt=0;dt<T.length;dt++){let pt=T[dt],Rt=S[dt]*D,Ee=`${Z.sheetRow},${pt}`,ue=q.get(Ee);if(ue==="skip"){nt+=Rt;continue}let Wt=Rt,_t=yt;if(ue&&typeof ue!="string"){Wt=0;for(let It=0;It<ue.colSpan;It++){let Dt=T.indexOf(pt+It);Dt>=0&&(Wt+=S[Dt]*D)}_t=0;for(let It=0;It<ue.rowSpan;It++){let Dt=k.indexOf(Z.sheetRow+It);Dt>=0&&(_t+=W[Dt]*D)}}let Qe=e.getCell(Z.sheetRow,pt),Xt=Qe.style;if(Xt?.fill&&Xt.fill.type==="pattern"){let It=Xt.fill;if(It.pattern==="solid"&&It.fgColor){let Dt=be(It.fgColor);Dt&&(L.gsave(),L.fillColor(Dt[0],Dt[1],Dt[2]),L.fillRect(nt,ot-_t,Wt,_t),L.grestore())}}b&&!Xt?.border&&(L.gsave(),L.strokeColor(.82,.82,.82).lineWidth(.25),L.strokeRect(nt,ot-_t,Wt,_t),L.grestore()),Xt?.border&&(L.gsave(),xr(L,Xt.border,nt,ot-_t,Wt,_t),L.grestore());let ge=gr(Qe,Xt);if(ge){L.gsave(),L.clipRect(nt+1,ot-_t,Wt-2,_t);let It=(Xt?.font?.size??x)*D,Dt=Xt?.font?.bold??!1,ie=Xt?.font?.italic??!1,ve=Dt&&ie?"F4":Dt?"F2":ie?"F3":"F1",Vt=be(Xt?.font?.color)??[0,0,0];L.fillColor(Vt[0],Vt[1],Vt[2]);let zt=se(ge,It/D,Dt)*D,je=Xt?.alignment?.horizontal??(typeof Qe.value=="number"?"right":"left"),Pr=Xt?.alignment?.vertical??"bottom",$e,po=2*D;switch(je){case"center":case"fill":case"justify":case"distributed":$e=nt+(Wt-zt)/2;break;case"right":$e=nt+Wt-zt-po;break;default:$e=nt+po+(Xt?.alignment?.indent??0)*6*D;break}let Se;switch(Pr){case"top":Se=ot-It-po;break;case"center":case"distributed":Se=ot-_t/2-It*.35;break;default:Se=ot-_t+po;break}if(L.beginText().font(ve,It).textPos($e,Se).showText(ge).endText(),Xt?.font?.underline&&Xt.font.underline!=="none"&&(L.strokeColor(Vt[0],Vt[1],Vt[2]),L.lineWidth(It*.05),L.line($e,Se-It*.15,$e+zt,Se-It*.15)),Xt?.font?.strike){L.strokeColor(Vt[0],Vt[1],Vt[2]),L.lineWidth(It*.05);let pn=Se+It*.3;L.line($e,pn,$e+zt,pn)}L.grestore()}let Be=`${Z.sheetRow},${pt}`,xe=E.get(Be);if(xe){let It=yr(e,xe.dataRange);It.length&&wr(L,xe,It,nt,ot-_t,Wt,_t)}let Rr=`${Ut(pt)}${Z.sheetRow}`,_e=P.get(Rr);if(_e){let It=typeof _e.data=="string"?fr(_e.data):_e.data;if(_e.format==="jpeg"){let Dt=dr(It);if(Dt){let ie=`Ci${Z.sheetRow}_${pt}`,ve=it.add(`<</Type/XObject/Subtype/Image/Width ${Dt.width}/Height ${Dt.height}/ColorSpace/DeviceRGB/BitsPerComponent 8/Filter/DCTDecode/Length ${It.length}>>`,It);rt.push({name:ie,id:ve});let Vt=Dt.width/Dt.height,zt=Wt-2,je=_t-2;zt/je>Vt?zt=je*Vt:je=zt/Vt,L.drawImage(ie,nt+1,ot-_t+1,zt,je)}}else if(_e.format==="png"){let Dt=pr(It,it);if(Dt){let ie=`Ci${Z.sheetRow}_${pt}`;Dt.name=ie,rt.push({name:ie,id:Dt.id});let ve=Dt.width/Dt.height,Vt=Wt-2,zt=_t-2;Vt/zt>ve?Vt=zt*ve:zt=Vt/ve,L.drawImage(ie,nt+1,ot-_t+1,Vt,zt)}}}nt+=Rt}ot-=yt}if(F){let Z=p-g.top,yt=g.left+R*D;L.gsave();for(let nt=0;nt<T.length;nt++){let dt=S[nt]*D;L.fillColor(.9,.9,.9),L.fillRect(yt,Z,dt,14*D),L.strokeColor(.7,.7,.7).lineWidth(.25),L.strokeRect(yt,Z,dt,14*D),L.fillColor(.3,.3,.3);let pt=Ut(T[nt]),Rt=se(pt,7,!1)*D;L.beginText().font("F1",7*D),L.textPos(yt+(dt-Rt)/2,Z+3*D),L.showText(pt).endText(),yt+=dt}L.grestore()}for(let Z=0;Z<U.length;Z++){let yt=A[Z],nt=U[Z];if(!yt||!nt)continue;let dt=pi(yt,T,k,S,W,D,g,p,r,n);dt&&L.drawImage(nt.name,dt.x,dt.y,dt.w,dt.h)}let Ft=e.getFormControls?.()??[];for(let Z of Ft)cn(L,Z,T,k,S,W,D,g,p);if(v){let Z=Io(v,j+1,V.length);L.gsave(),L.fillColor(.3,.3,.3),L.beginText().font("F1",8);let yt=se(Z,8,!1);L.textPos(f/2-yt/2,p-g.top/2),L.showText(Z).endText(),L.grestore()}if(w){let Z=Io(w,j+1,V.length);L.gsave(),L.fillColor(.3,.3,.3),L.beginText().font("F1",8);let yt=se(Z,8,!1);L.textPos(f/2-yt/2,g.bottom/2),L.showText(Z).endText(),L.grestore()}D!==1&&L.grestore();let xt=L.toBytes(),at=it.addDeflated("<<",xt),bt=it.add(`<</Type/Page/Parent ${St} 0 R/MediaBox[0 0 ${O(f)} ${O(p)}]/Contents ${at} 0 R/Resources<</Font<</F1 ${J} 0 R/F2 ${G} 0 R/F3 ${X} 0 R/F4 ${C} 0 R>>`+ht()+">>>>");ft.push(bt)}return it.set(St,`<</Type/Pages/Kids[${ft.map(j=>`${j} 0 R`).join(" ")}]/Count ${ft.length}>>`),it.set(gt,`<</Type/Catalog/Pages ${St} 0 R>>`),it.build(gt,tt)}function di(e,t={}){let o=e.getSheets(),n=e.getSheetNames(),r=t.sheets??n;t.evaluateFormulas&&new me().calculateWorkbook(e);let s=o.filter((y,v)=>r.includes(n[v]));if(s.length===0)return br(t);if(s.length===1&&!s[0]._isChartSheet&&!s[0]._isDialogSheet)return ur(s[0],t);let i=new lo,a=i.alloc(),l=i.alloc(),h=i.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica/Encoding/WinAnsiEncoding>>"),c=i.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-Bold/Encoding/WinAnsiEncoding>>"),m=i.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-Oblique/Encoding/WinAnsiEncoding>>"),d=i.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica-BoldOblique/Encoding/WinAnsiEncoding>>"),f;if(t.title||t.author){let y=["/Producer(ExcelForge)"];t.title&&y.push(`/Title(${io(t.title)})`),t.author&&y.push(`/Author(${io(t.author)})`),f=i.add(`<<${y.join("")}>>`)}let p=[],g=t.paperSize??"a4",u=t.orientation??"portrait",[$,x]=Ce[g]??Ce.a4,b=u==="landscape"?x:$,F=u==="landscape"?$:x;for(let y of s)if(y._isChartSheet){let v=y.getCharts();if(v.length){let w=new Re;ui(w,v[0],y,40,40,b-80,F-80);let R=w.toBytes(),T=i.addDeflated("<<",R),S=i.add(`<</Type/Page/Parent ${l} 0 R/MediaBox[0 0 ${O(b)} ${O(F)}]/Contents ${T} 0 R/Resources<</Font<</F1 ${h} 0 R/F2 ${c} 0 R>>>>>>`);p.push(S)}}else if(y._isDialogSheet){let v=y.getFormControls?.()??[];if(v.length){let w=new Re,R={left:50,top:50},T=[1],S=[1],M=[48],D=[16];for(let q of v)cn(w,q,T,S,M,D,1,R,F);let k=w.toBytes(),W=i.addDeflated("<<",k),Q=i.add(`<</Type/Page/Parent ${l} 0 R/MediaBox[0 0 ${O(b)} ${O(F)}]/Contents ${W} 0 R/Resources<</Font<</F1 ${h} 0 R/F2 ${c} 0 R>>>>>>`);p.push(Q)}}else{let v=fi(y,t,i,h,c,m,d,l);p.push(...v)}return i.set(l,`<</Type/Pages/Kids[${p.map(y=>`${y} 0 R`).join(" ")}]/Count ${p.length}>>`),i.set(a,`<</Type/Catalog/Pages ${l} 0 R>>`),i.build(a,f)}function fi(e,t,o,n,r,s,i,a){let l=e.getUsedRange();if(!l)return[];let{startRow:h,startCol:c,endRow:m,endCol:d}=l;if(t.printAreaOnly&&e.printArea){let J=e.printArea.match(/^'?[^']*'?!?\$?([A-Z]+)\$?(\d+):\$?([A-Z]+)\$?(\d+)$/);J&&(c=qt(J[1]),h=parseInt(J[2],10),d=qt(J[3]),m=parseInt(J[4],10))}let f=e.pageSetup,p=e.pageMargins,g=t.paperSize??(f?.paperSize?$r(f.paperSize):"a4"),u=t.orientation??f?.orientation??"portrait",[$,x]=Ce[g]??Ce.a4,b=u==="landscape"?x:$,F=u==="landscape"?$:x,y={top:(t.margins?.top??p?.top??.75)*72,bottom:(t.margins?.bottom??p?.bottom??.75)*72,left:(t.margins?.left??p?.left??.7)*72,right:(t.margins?.right??p?.right??.7)*72},v=b-y.left-y.right,w=F-y.top-y.bottom,R=t.defaultFontSize??10,T=t.gridLines!==!1,S=t.repeatRows??0,M=t.headerText??e.headerFooter?.oddHeader,D=t.footerText??e.headerFooter?.oddFooter,k=[],W=[];for(let J=c;J<=d;J++){let G=e.getColumn(J);t.skipHidden&&G?.hidden||(k.push(J),W.push(G?.width?G.width*6:48))}let Q=W.reduce((J,G)=>J+G,0),q=t.scale??1;t.fitToWidth!==!1&&Q*q>v&&(q=v/Q),q=Math.max(.1,Math.min(2,q));let E=[],_=[];for(let J=h;J<=m;J++){let G=e.getRow(J);t.skipHidden&&G?.hidden||(E.push(J),_.push(G?.height??R+6))}let P=e.getMerges(),N=new Map;for(let J of P){N.set(`${J.startRow},${J.startCol}`,{rowSpan:J.endRow-J.startRow+1,colSpan:J.endCol-J.startCol+1});for(let G=J.startRow;G<=J.endRow;G++)for(let X=J.startCol;X<=J.endCol;X++)(G!==J.startRow||X!==J.startCol)&&N.set(`${G},${X}`,"skip")}let H=new Map;for(let J of e.getSparklines?.()??[]){let G=J.location.match(/^([A-Z]+)(\d+)$/);G&&H.set(`${parseInt(G[2],10)},${qt(G[1])}`,J)}let V=new Map;for(let J of e.getCellImages?.()??[])V.set(J.cell,J);let K=new Set;for(let J of e.getRowBreaks())K.add(J.id);let z=[],mt=0,it=0,gt=E.slice(0,S).reduce((J,G,X)=>J+_[X]*q,0);for(let J=0;J<E.length;J++){let G=_[J]*q,X=w-(z.length>0?gt:0),C=J>mt&&K.has(E[J]);it+G>X&&J>mt||C?(z.push({rowStart:mt,rowEnd:J-1}),mt=J,it=gt+G):it+=G}mt<E.length&&z.push({rowStart:mt,rowEnd:E.length-1});let St=[];for(let J=0;J<z.length;J++){let G=z[J],X=new Re,C=[];if(J>0&&S>0)for(let tt=0;tt<Math.min(S,E.length);tt++)C.push({sheetRow:E[tt],height:_[tt]});for(let tt=G.rowStart;tt<=G.rowEnd;tt++)C.push({sheetRow:E[tt],height:_[tt]});let A=F-y.top;for(let tt of C){let ft=tt.height*q,j=y.left;for(let et=0;et<k.length;et++){let L=k[et],$t=W[et]*q,ot=`${tt.sheetRow},${L}`,Ft=N.get(ot);if(Ft==="skip"){j+=$t;continue}let xt=$t,at=ft;if(Ft&&typeof Ft!="string"){xt=0;for(let pt=0;pt<Ft.colSpan;pt++){let Rt=k.indexOf(L+pt);Rt>=0&&(xt+=W[Rt]*q)}at=0;for(let pt=0;pt<Ft.rowSpan;pt++){let Rt=E.indexOf(tt.sheetRow+pt);Rt>=0&&(at+=_[Rt]*q)}}let bt=e.getCell(tt.sheetRow,L),Z=bt.style;if(Z?.fill&&Z.fill.type==="pattern"){let pt=Z.fill;if(pt.pattern==="solid"&&pt.fgColor){let Rt=be(pt.fgColor);Rt&&(X.gsave(),X.fillColor(Rt[0],Rt[1],Rt[2]),X.fillRect(j,A-at,xt,at),X.grestore())}}T&&!Z?.border&&(X.gsave(),X.strokeColor(.82,.82,.82).lineWidth(.25),X.strokeRect(j,A-at,xt,at),X.grestore()),Z?.border&&(X.gsave(),xr(X,Z.border,j,A-at,xt,at),X.grestore());let yt=gr(bt,Z);if(yt){X.gsave(),X.clipRect(j+1,A-at,xt-2,at);let pt=(Z?.font?.size??R)*q,Rt=Z?.font?.bold??!1,Ee=Z?.font?.italic??!1,ue=Rt&&Ee?"F4":Rt?"F2":Ee?"F3":"F1",Wt=be(Z?.font?.color)??[0,0,0];X.fillColor(Wt[0],Wt[1],Wt[2]);let _t=se(yt,pt/q,Rt)*q,Qe=Z?.alignment?.horizontal??(typeof bt.value=="number"?"right":"left"),Xt=Z?.alignment?.vertical??"bottom",ge=2*q,Be;switch(Qe){case"center":case"fill":case"justify":case"distributed":Be=j+(xt-_t)/2;break;case"right":Be=j+xt-_t-ge;break;default:Be=j+ge+(Z?.alignment?.indent??0)*6*q;break}let xe;switch(Xt){case"top":xe=A-pt-ge;break;case"center":case"distributed":xe=A-at/2-pt*.35;break;default:xe=A-at+ge;break}X.beginText().font(ue,pt).textPos(Be,xe).showText(yt).endText(),X.grestore()}let nt=`${tt.sheetRow},${L}`,dt=H.get(nt);if(dt){let pt=yr(e,dt.dataRange);pt.length&&wr(X,dt,pt,j,A-at,xt,at)}j+=$t}A-=ft}let U=e.getFormControls?.()??[];for(let tt of U)cn(X,tt,k,E,W,_,q,y,F);if(M){let tt=Io(M,J+1,z.length);X.gsave().fillColor(.3,.3,.3);let ft=se(tt,8,!1);X.beginText().font("F1",8).textPos(b/2-ft/2,F-y.top/2).showText(tt).endText(),X.grestore()}if(D){let tt=Io(D,J+1,z.length);X.gsave().fillColor(.3,.3,.3);let ft=se(tt,8,!1);X.beginText().font("F1",8).textPos(b/2-ft/2,y.bottom/2).showText(tt).endText(),X.grestore()}let Y=X.toBytes(),rt=o.addDeflated("<<",Y),ht=o.add(`<</Type/Page/Parent ${a} 0 R/MediaBox[0 0 ${O(b)} ${O(F)}]/Contents ${rt} 0 R/Resources<</Font<</F1 ${n} 0 R/F2 ${r} 0 R/F3 ${s} 0 R/F4 ${i} 0 R>>>>>>`);St.push(ht)}return St}function gr(e,t){return e.richText?e.richText.map(o=>o.text).join(""):e.value==null?"":t?.numberFormat?li(e.value,t.numberFormat.formatCode):String(e.value)}function xr(e,t,o,n,r,s){let i=[[t.bottom,o,n,o+r,n],[t.top,o,n+s,o+r,n+s],[t.left,o,n,o,n+s],[t.right,o+r,n,o+r,n+s]];for(let[a,l,h,c,m]of i){if(!a?.style)continue;let d=hi(a.style),f=be(a.color)??[0,0,0];e.strokeColor(f[0],f[1],f[2]),e.lineWidth(d);let p=mi(a.style);p?e.dash(p,0):e.noDash(),e.line(l,h,c,m)}}function $r(e){return{1:"letter",5:"legal",9:"a4",8:"a3",3:"tabloid"}[e]??"a4"}function Io(e,t,o){let n=e.replace(/&[LCR]/g,"").replace(/&"[^"]*"/g,"").replace(/&\d+/g,"");return n=n.replace(/&P/gi,String(t)).replace(/&N/gi,String(o)).replace(/&D/gi,new Date().toLocaleDateString()).replace(/&T/gi,new Date().toLocaleTimeString()).replace(/&F/gi,"").replace(/&A/gi,""),n.trim()}function pi(e,t,o,n,r,s,i,a,l,h){if(e.position){let c=i.left+e.position.x*.75*s,m=a-i.top-e.position.y*.75*s,d=(e.width??100)*.75*s,f=(e.height??100)*.75*s;return{x:c,y:m-f,w:d,h:f}}if(e.from){let c=i.left;for(let g=0;g<t.length&&!(t[g]>=e.from.col);g++)c+=n[g]*s;let m=0;for(let g=0;g<o.length&&!(o[g]>=e.from.row);g++)m+=r[g]*s;let d=(e.width??100)*.75*s,f=(e.height??100)*.75*s,p=a-i.top-m;return{x:c,y:p-f,w:d,h:f}}return null}function fr(e){return le(e)}function pr(e,t){if(e[0]!==137||e[1]!==80||e[2]!==78||e[3]!==71)return null;let o=8,n=g=>(e[g]<<24|e[g+1]<<16|e[g+2]<<8|e[g+3])>>>0,r=n(o);o+=4;let s=String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3]);if(o+=4,s!=="IHDR"||r!==13)return null;let i=n(o);o+=4;let a=n(o);o+=4;let l=e[o++],h=e[o++];if(o+=7,l!==8||h!==2&&h!==6)return null;let c=[];for(;o<e.length-4;){let g=n(o);o+=4;let u=String.fromCharCode(e[o],e[o+1],e[o+2],e[o+3]);if(o+=4,u==="IDAT"&&c.push(e.subarray(o,o+g)),u==="IEND")break;o+=g+4}if(!c.length)return null;let m=0;for(let g of c)m+=g.length;let d=new Uint8Array(m),f=0;for(let g of c)d.set(g,f),f+=g.length;let p=h===6?4:3;return h===2?{id:t.add(`<</Type/XObject/Subtype/Image/Width ${i}/Height ${a}/ColorSpace/DeviceRGB/BitsPerComponent 8/Filter/FlateDecode/DecodeParms<</Predictor 15/Colors 3/BitsPerComponent 8/Columns ${i}>>/Length ${d.length}>>`,d),name:"",width:i,height:a}:null}function yr(e,t){let o=[],r=(t.includes("!")?t.split("!")[1]:t).match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(r){let s=qt(r[1]),i=parseInt(r[2],10),a=qt(r[3]),l=parseInt(r[4],10);for(let h=i;h<=l;h++)for(let c=s;c<=a;c++){let m=e.getCell(h,c);typeof m.value=="number"&&o.push(m.value)}}return o}function wr(e,t,o,n,r,s,i){if(!o.length)return;let a=2,l=n+a,h=r+a,c=s-a*2,m=i-a*2,d=Math.min(...o),p=Math.max(...o)-d||1,g=be(t.color)??[.267,.447,.769];if(e.gsave(),e.clipRect(n,r,s,i),t.type==="bar"||t.type==="stacked"){let u=c/o.length;for(let $=0;$<o.length;$++){let x=o[$],b=Math.max(1,(x-d)/p*m),F=l+$*u+u*.1,y=h+(m-b),v=g;x<0&&t.negativeColor&&(v=be(t.negativeColor)??g),e.fillColor(v[0],v[1],v[2]),e.fillRect(F,y,u*.8,b)}}else{e.strokeColor(g[0],g[1],g[2]),e.lineWidth(t.lineWidth??1);let u=o.map(($,x)=>[l+x/(o.length-1||1)*c,h+($-d)/p*m]);if(u.length>=2){let $=`${O(u[0][0])} ${O(u[0][1])} m`;for(let x=1;x<u.length;x++)$+=` ${O(u[x][0])} ${O(u[x][1])} l`;e.raw($+" S")}if(t.showMarkers&&t.markersColor){let $=be(t.markersColor)??g;e.fillColor($[0],$[1],$[2]);for(let[x,b]of u)e.fillRect(x-1.5,b-1.5,3,3)}}e.grestore()}function cn(e,t,o,n,r,s,i,a,l){let h=a.left,c=0;for(let u=0;u<o.length&&!(o[u]>=t.from.col+1);u++)h+=r[u]*i;for(let u=0;u<n.length&&!(n[u]>=t.from.row+1);u++)c+=s[u]*i;let m=(t.width??80)*.75*i,d=(t.height??24)*.75*i,p=l-a.top-c-d,g=t.text??"";switch(e.gsave(),t.type){case"button":case"dialog":if(e.fillColor(.93,.93,.93),e.fillRect(h,p,m,d),e.strokeColor(.6,.6,.6).lineWidth(.5),e.strokeRect(h,p,m,d),g){e.fillColor(0,0,0);let u=Math.min(9*i,d*.6),$=se(g,u/i,!1)*i;e.beginText().font("F1",u).textPos(h+(m-$)/2,p+(d-u)/2).showText(g).endText()}break;case"checkBox":{e.strokeColor(.4,.4,.4).lineWidth(.5);let u=Math.min(d-2,10*i);if(e.strokeRect(h+2,p+(d-u)/2,u,u),t.checked==="checked"){e.strokeColor(0,0,0).lineWidth(1);let $=h+2,x=p+(d-u)/2;e.line($+2,x+u/2,$+u/2,x+2),e.line($+u/2,x+2,$+u-2,x+u-2)}if(g){e.fillColor(0,0,0);let $=Math.min(8*i,d*.7);e.beginText().font("F1",$).textPos(h+u+6,p+(d-$)/2).showText(g).endText()}break}case"optionButton":{let u=Math.min(d/2-1,5*i),$=h+2+u,x=p+d/2,b=.5523;if(e.strokeColor(.4,.4,.4).lineWidth(.5),e.raw(`${O($+u)} ${O(x)} m ${O($+u)} ${O(x+u*b)} ${O($+u*b)} ${O(x+u)} ${O($)} ${O(x+u)} c`),e.raw(`${O($-u*b)} ${O(x+u)} ${O($-u)} ${O(x+u*b)} ${O($-u)} ${O(x)} c`),e.raw(`${O($-u)} ${O(x-u*b)} ${O($-u*b)} ${O(x-u)} ${O($)} ${O(x-u)} c`),e.raw(`${O($+u*b)} ${O(x-u)} ${O($+u)} ${O(x-u*b)} ${O($+u)} ${O(x)} c S`),t.checked==="checked"){let F=u*.5;e.fillColor(0,0,0),e.raw(`${O($+F)} ${O(x)} m ${O($+F)} ${O(x+F*b)} ${O($+F*b)} ${O(x+F)} ${O($)} ${O(x+F)} c`),e.raw(`${O($-F*b)} ${O(x+F)} ${O($-F)} ${O(x+F*b)} ${O($-F)} ${O(x)} c`),e.raw(`${O($-F)} ${O(x-F*b)} ${O($-F*b)} ${O(x-F)} ${O($)} ${O(x-F)} c`),e.raw(`${O($+F*b)} ${O(x-F)} ${O($+F)} ${O(x-F*b)} ${O($+F)} ${O(x)} c f`)}if(g){e.fillColor(0,0,0);let F=Math.min(8*i,d*.7);e.beginText().font("F1",F).textPos(h+u*2+6,p+(d-F)/2).showText(g).endText()}break}case"label":case"groupBox":if(g){e.fillColor(0,0,0);let u=Math.min(9*i,d*.7);e.beginText().font("F1",u).textPos(h+2,p+(d-u)/2).showText(g).endText()}t.type==="groupBox"&&(e.strokeColor(.7,.7,.7).lineWidth(.5),e.strokeRect(h,p,m,d));break;case"comboBox":case"listBox":if(e.fillColor(1,1,1),e.fillRect(h,p,m,d),e.strokeColor(.7,.7,.7).lineWidth(.5),e.strokeRect(h,p,m,d),t.type==="comboBox"){let u=Math.min(16*i,m*.2);e.strokeRect(h+m-u,p,u,d);let $=h+m-u/2,x=p+d/2;e.fillColor(.3,.3,.3),e.raw(`${O($-3)} ${O(x+2)} m ${O($+3)} ${O(x+2)} l ${O($)} ${O(x-2)} l f`)}break;case"scrollBar":case"spinner":e.fillColor(.92,.92,.92),e.fillRect(h,p,m,d),e.strokeColor(.7,.7,.7).lineWidth(.5),e.strokeRect(h,p,m,d);break;default:if(e.strokeColor(.7,.7,.7).lineWidth(.5),e.strokeRect(h,p,m,d),g){e.fillColor(0,0,0);let u=Math.min(8*i,d*.7);e.beginText().font("F1",u).textPos(h+2,p+(d-u)/2).showText(g).endText()}}e.grestore()}var So=[[.267,.447,.769],[.929,.49,.192],[.647,.647,.647],[1,.753,0],[.357,.608,.835],[.439,.678,.278]];function ui(e,t,o,n,r,s,i){let l=n+10+30,h=r+10,c=s-20-40,m=i-20-20,d=[];for(let x=0;x<t.series.length;x++){let b=t.series[x],F=gi(o,b.values);d.push({name:b.name??`Series ${x+1}`,values:F,color:So[x%So.length]})}if(!d.length||!d[0].values.length)return;if(e.gsave(),t.title){e.fillColor(0,0,0);let x=10,b=se(t.title,x,!0);e.beginText().font("F2",x).textPos(n+(s-b)/2,r+i-8).showText(t.title).endText()}let f=t.type,p=d.flatMap(x=>x.values),g=Math.min(0,...p),$=Math.max(1,...p)-g||1;if(e.strokeColor(.5,.5,.5).lineWidth(.5),e.line(l,h,l,h+m),e.line(l,h,l+c,h),f==="pie"||f==="doughnut"){let x=n+s/2,b=r+i/2,F=Math.min(c,m)/2-5,y=d[0].values.filter(R=>R>0),v=y.reduce((R,T)=>R+T,0)||1,w=0;for(let R=0;R<y.length;R++){let T=y[R]/v*2*Math.PI,S=So[R%So.length];e.fillColor(S[0],S[1],S[2]),e.raw(`${O(x)} ${O(b)} m`);let M=Math.max(8,Math.ceil(T/.2));for(let D=0;D<=M;D++){let k=w+T*D/M;e.raw(`${O(x+F*Math.cos(k))} ${O(b+F*Math.sin(k))} l`)}e.raw("f"),w+=T}}else if(f.startsWith("bar")){let x=d[0].values.length,b=m/x;for(let F=0;F<x;F++)for(let y=0;y<d.length;y++){let w=((d[y].values[F]??0)-g)/$*c,R=h+F*b+b*.1,T=b*.8/d.length,S=d[y].color;e.fillColor(S[0],S[1],S[2]),e.fillRect(l,R+y*T,Math.max(0,w),T)}}else if(f.startsWith("column")||f==="stock"){let x=d[0].values.length,b=c/x;for(let F=0;F<x;F++)for(let y=0;y<d.length;y++){let w=((d[y].values[F]??0)-g)/$*m,R=l+F*b+b*.1,T=b*.8/d.length,S=d[y].color;e.fillColor(S[0],S[1],S[2]),e.fillRect(R+y*T,h,T,Math.max(0,w))}}else for(let x of d){let b=x.values.map((F,y)=>[l+y/(x.values.length-1||1)*c,h+(F-g)/$*m]);if(e.strokeColor(x.color[0],x.color[1],x.color[2]).lineWidth(1.5),b.length>=2){let F=`${O(b[0][0])} ${O(b[0][1])} m`;for(let y=1;y<b.length;y++)F+=` ${O(b[y][0])} ${O(b[y][1])} l`;f.startsWith("area")?(F+=` ${O(b[b.length-1][0])} ${O(h)} l ${O(b[0][0])} ${O(h)} l`,e.fillColor(x.color[0],x.color[1],x.color[2]),e.raw(F+" f")):e.raw(F+" S")}if(f.startsWith("scatter")||f==="bubble"){e.fillColor(x.color[0],x.color[1],x.color[2]);for(let[F,y]of b)e.fillRect(F-2,y-2,4,4)}}e.grestore()}function gi(e,t){let o=[],s=(t.includes("!")?t.split("!")[1]:t).replace(/\$/g,"").match(/^([A-Z]+)(\d+):([A-Z]+)(\d+)$/);if(!s)return o;let i=qt(s[1]),a=parseInt(s[2],10),l=qt(s[3]),h=parseInt(s[4],10);for(let c=a;c<=h;c++)for(let m=i;m<=l;m++){let d=e.getCell(c,m);o.push(typeof d.value=="number"?d.value:0)}return o}function br(e){let t=new lo,o=t.alloc(),n=t.alloc(),r=e.paperSize??"a4",s=e.orientation??"portrait",[i,a]=Ce[r]??Ce.a4,l=s==="landscape"?a:i,h=s==="landscape"?i:a,c=t.add("<</Type/Font/Subtype/Type1/BaseFont/Helvetica>>"),m=new Re;m.beginText().font("F1",12).fillColor(.5,.5,.5),m.textPos(l/2-40,h/2),m.showText("Empty worksheet").endText();let d=m.toBytes(),f=t.addDeflated("<<",d),p=t.add(`<</Type/Page/Parent ${n} 0 R/MediaBox[0 0 ${O(l)} ${O(h)}]/Contents ${f} 0 R/Resources<</Font<</F1 ${c} 0 R>>>>>>`);return t.set(n,`<</Type/Pages/Kids[${p} 0 R]/Count 1>>`),t.set(o,`<</Type/Catalog/Pages ${n} 0 R>>`),t.build(o)}var hn=new Uint8Array([208,207,17,224,161,177,26,225]),Ht=4294967294,Fe=4294967295,xi=4294967293,ae=512,co=64,Cr=4096,Ao=128;function Pt(e,t,o){e[t]=o&255,e[t+1]=o>>8&255}function Ct(e,t,o){e[t]=o&255,e[t+1]=o>>8&255,e[t+2]=o>>16&255,e[t+3]=o>>24&255}function To(e,t){return e[t]|e[t+1]<<8}function re(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0}function $i(e){let t=new Uint8Array(64),o=Math.min(e.length,31);for(let n=0;n<o;n++)Pt(t,n*2,e.charCodeAt(n));return Pt(t,o*2,0),{bytes:t,size:(o+1)*2}}function Fr(e){for(let v=0;v<8;v++)if(e[v]!==hn[v])throw new Error("Not a CFB file");let o=1<<To(e,30),r=1<<To(e,32),s=re(e,56),i=re(e,44),a=re(e,48),l=re(e,60),h=v=>o+v*o,c=[];for(let v=0;v<109;v++){let w=re(e,76+v*4);if(w===Fe||w===Ht)break;c.push(w)}let m=[];for(let v of c){let w=h(v);for(let R=0;R<o/4;R++)m.push(re(e,w+R*4))}let d=v=>{let w=[],R=v;for(;R!==Ht&&R!==Fe&&w.length<1e4;)w.push(R),R=m[R]??Ht;return w},f=(v,w)=>{let R=d(v),T=new Uint8Array(w),S=0;for(let M of R){let D=h(M),k=Math.min(o,w-S);T.set(e.subarray(D,D+k),S),S+=k}return T},p=d(a),g=new Uint8Array(p.length*o);p.forEach((v,w)=>g.set(e.subarray(h(v),h(v)+o),w*o));let u=[];for(let v=0;v<g.length/Ao;v++){let w=v*Ao,R=To(g,w+64);if(R===0)continue;let T="";for(let S=0;S<(R-2)/2;S++)T+=String.fromCharCode(To(g,w+S*2));u.push({name:T,type:g[w+66],start:re(g,w+116),size:re(g,w+120),child:re(g,w+76)})}let $=u[0],x=new Uint8Array(0);$&&$.start!==Ht&&(x=new Uint8Array(f($.start,$.size)));let b=[];if(l!==Ht){let v=d(l);for(let w of v){let R=h(w);for(let T=0;T<o/4;T++)b.push(re(e,R+T*4))}}let F=(v,w)=>{let R=new Uint8Array(w),T=v,S=0;for(;T!==Ht&&S<w;){let M=T*r,D=Math.min(r,w-S);R.set(x.subarray(M,M+D),S),S+=D,T=b[T]??Ht}return R},y=[];for(let v=1;v<u.length;v++){let w=u[v];if(w.type!==2)continue;let R;w.size<s?R=F(w.start,w.size):R=f(w.start,w.size),y.push({name:w.name,data:R})}return y}function Me(){if(typeof globalThis.crypto<"u")return globalThis.crypto;throw new Error("Web Crypto API not available. Requires Node.js 18+ or a modern browser.")}function ho(e){return Me().getRandomValues(new Uint8Array(e))}async function pe(e){let t=await Me().subtle.digest("SHA-512",e);return new Uint8Array(t)}async function yi(e,t){let o=await Me().subtle.importKey("raw",e,{name:"HMAC",hash:"SHA-512"},!1,["sign"]),n=await Me().subtle.sign("HMAC",o,t);return new Uint8Array(n)}async function Ke(e,t,o,n,r){let s=new Uint8Array(e.length*2);for(let d=0;d<e.length;d++)s[d*2]=e.charCodeAt(d)&255,s[d*2+1]=e.charCodeAt(d)>>8&255;let i=new Uint8Array(t.length+s.length);i.set(t),i.set(s,t.length);let a=await pe(i);for(let d=0;d<o;d++){let f=new Uint8Array(4+a.length);f[0]=d&255,f[1]=d>>8&255,f[2]=d>>16&255,f[3]=d>>24&255,f.set(a,4),a=await pe(f)}let l=new Uint8Array(a.length+r.length);l.set(a),l.set(r,a.length);let h=await pe(l),c=n/8;if(h.length>=c)return h.subarray(0,c);let m=new Uint8Array(c);return m.set(h),m.fill(54,h.length),m}async function Ge(e,t,o){let n=await Me().subtle.importKey("raw",e,{name:"AES-CBC"},!1,["encrypt"]),r=await Me().subtle.encrypt({name:"AES-CBC",iv:t},n,o);return new Uint8Array(r).subarray(0,o.length)}async function ko(e,t,o){let n=Me().subtle,r=o.subarray(o.length-16),s=new Uint8Array(16).fill(16),i=new Uint8Array(16);for(let f=0;f<16;f++)i[f]=s[f]^r[f];let a=await n.importKey("raw",e,{name:"AES-CBC"},!1,["encrypt"]),l=await n.encrypt({name:"AES-CBC",iv:new Uint8Array(16)},a,i),h=new Uint8Array(l).subarray(0,16),c=fe(o,h),m=await n.importKey("raw",e,{name:"AES-CBC"},!1,["decrypt"]),d=await n.decrypt({name:"AES-CBC",iv:t},m,c);return new Uint8Array(d)}function qe(e,t){let o=e.length%t;if(o===0)return e;let n=new Uint8Array(e.length+(t-o));return n.set(e),n}function fe(...e){let t=0;for(let r of e)t+=r.length;let o=new Uint8Array(t),n=0;for(let r of e)o.set(r,n),n+=r.length;return o}var vr=new Uint8Array([254,167,210,118,59,75,158,121]),Sr=new Uint8Array([215,170,15,109,48,97,52,78]),Ir=new Uint8Array([20,110,11,231,171,172,208,214]),wi=new Uint8Array([95,178,173,1,12,185,225,246]),bi=new Uint8Array([160,103,127,2,178,44,132,51]);function Ci(e,t,o,n,r,s,i,a){let l=h=>{let c="",m="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/";for(let d=0;d<h.length;d+=3){let f=h[d],p=h[d+1]??0,g=h[d+2]??0,u=f<<16|p<<8|g;c+=m[u>>18&63]+m[u>>12&63],c+=d+1<h.length?m[u>>6&63]:"=",c+=d+2<h.length?m[u&63]:"="}return c};return`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
667
|
+
<encryption xmlns="http://schemas.microsoft.com/office/2006/encryption"
|
|
668
|
+
xmlns:p="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
|
|
669
|
+
<keyData saltSize="16" blockSize="16" keyBits="256" hashSize="64"
|
|
670
|
+
cipherAlgorithm="AES" cipherChaining="ChainingModeCBC"
|
|
671
|
+
hashAlgorithm="SHA512"
|
|
672
|
+
saltValue="${l(e)}"/>
|
|
673
|
+
<dataIntegrity encryptedHmacKey="${l(r)}"
|
|
674
|
+
encryptedHmacValue="${l(s)}"/>
|
|
675
|
+
<keyEncryptors>
|
|
676
|
+
<keyEncryptor uri="http://schemas.microsoft.com/office/2006/keyEncryptor/password">
|
|
677
|
+
<p:encryptedKey spinCount="${a}" saltSize="16" blockSize="16"
|
|
678
|
+
keyBits="256" hashSize="64"
|
|
679
|
+
cipherAlgorithm="AES" cipherChaining="ChainingModeCBC"
|
|
680
|
+
hashAlgorithm="SHA512"
|
|
681
|
+
saltValue="${l(i)}"
|
|
682
|
+
encryptedVerifierHashInput="${l(o)}"
|
|
683
|
+
encryptedVerifierHashValue="${l(n)}"
|
|
684
|
+
encryptedKeyValue="${l(t)}"/>
|
|
685
|
+
</keyEncryptor>
|
|
686
|
+
</keyEncryptors>
|
|
687
|
+
</encryption>`}function Pe(e){let t="ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/",o=new Uint8Array(128);for(let h=0;h<t.length;h++)o[t.charCodeAt(h)]=h;let n=e.replace(/[^A-Za-z0-9+/]/g,""),r=e.endsWith("==")?2:e.endsWith("=")?1:0,i=(n.length+r)/4*3-r,a=new Uint8Array(i),l=0;for(let h=0;h<n.length;h+=4){let c=o[n.charCodeAt(h)],m=o[n.charCodeAt(h+1)],d=o[n.charCodeAt(h+2)],f=o[n.charCodeAt(h+3)],p=c<<18|m<<12|d<<6|f;l<i&&(a[l++]=p>>16&255),l<i&&(a[l++]=p>>8&255),l<i&&(a[l++]=p&255)}return a}function de(e,t){let o=new RegExp(`${t}="([^"]*)"`,"i"),n=e.match(o);return n?n[1]:""}function Fi(e){return{keySalt:Pe(de(e.split("keyData")[1]??e,"saltValue")),passwordSalt:Pe(de(e.split("encryptedKey")[1]??e,"saltValue")),spinCount:parseInt(de(e,"spinCount"),10)||1e5,keyBits:parseInt(de(e.split("encryptedKey")[1]??e,"keyBits"),10)||256,encryptedVerifierInput:Pe(de(e,"encryptedVerifierHashInput")),encryptedVerifierHash:Pe(de(e,"encryptedVerifierHashValue")),encryptedKeyValue:Pe(de(e,"encryptedKeyValue")),encryptedHmacKey:Pe(de(e,"encryptedHmacKey")),encryptedHmacValue:Pe(de(e,"encryptedHmacValue"))}}function mo(e){let t=e.length*2,o=(4-t%4)%4,n=new Uint8Array(4+t+o);Ct(n,0,t);for(let r=0;r<e.length;r++)Pt(n,4+r*2,e.charCodeAt(r));return n}function vi(){let e="Microsoft.Container.DataSpaces",t=e.length*2,o=new Uint8Array(4+t+12);Ct(o,0,t);for(let r=0;r<e.length;r++)Pt(o,4+r*2,e.charCodeAt(r));let n=4+t;return Pt(o,n,1),Pt(o,n+2,0),Pt(o,n+4,1),Pt(o,n+6,0),Pt(o,n+8,1),Pt(o,n+10,0),o}function Si(){let e=mo("EncryptedPackage"),t=mo("StrongEncryptionDataSpace"),o=8+e.length+t.length,n=new Uint8Array(12+o);Ct(n,0,8),Ct(n,4,1),Ct(n,8,o);let r=12;return Ct(n,r,1),r+=4,Ct(n,r,0),r+=4,n.set(e,r),r+=e.length,n.set(t,r),n}function Ii(){let e=mo("StrongEncryptionTransform"),t=new Uint8Array(8+e.length);return Ct(t,0,8),Ct(t,4,1),t.set(e,8),t}function Ti(){let e=mo("{FF9A3F03-56EF-4613-BDD5-5A41C1D07246}"),t=mo("Microsoft.Container.EncryptionTransform"),o=4+e.length+t.length+12,n=new Uint8Array(4+o);Ct(n,0,o);let r=4;return Ct(n,r,1),r+=4,n.set(e,r),r+=e.length,n.set(t,r),r+=t.length,Pt(n,r,1),Pt(n,r+2,0),r+=4,Pt(n,r,1),Pt(n,r+2,0),r+=4,Pt(n,r,1),Pt(n,r+2,0),n}function ki(e,t){let o=vi(),n=Si(),r=Ii(),s=Ti(),i=[{name:"Root Entry",type:5,childId:2,leftId:-1,rightId:-1,size:0},{name:"DataSpaces",type:1,childId:5,leftId:-1,rightId:-1,size:0},{name:"EncryptionInfo",type:2,childId:-1,leftId:1,rightId:3,data:e,size:e.length},{name:"EncryptedPackage",type:2,childId:-1,leftId:-1,rightId:-1,data:t,size:t.length},{name:"Version",type:2,childId:-1,leftId:-1,rightId:-1,data:o,size:o.length},{name:"DataSpaceMap",type:2,childId:-1,leftId:4,rightId:6,data:n,size:n.length},{name:"DataSpaceInfo",type:1,childId:8,leftId:-1,rightId:7,size:0},{name:"TransformInfo",type:1,childId:9,leftId:-1,rightId:-1,size:0},{name:"StrongEncryptionDataSpace",type:2,childId:-1,leftId:-1,rightId:-1,data:r,size:r.length},{name:"StrongEncryptionTransform",type:1,childId:10,leftId:-1,rightId:-1,size:0},{name:"Primary",type:2,childId:-1,leftId:-1,rightId:-1,data:s,size:s.length}],a=new Uint8Array(0),l=0,h=[],c=[];for(let S of i){if(!S.data){h.push({inMini:!1,miniStart:0,regularStart:0});continue}if(S.data.length<Cr){let M=Math.ceil(S.data.length/co)*co,D=new Uint8Array(a.length+M);D.set(a),D.set(S.data,a.length),h.push({inMini:!0,miniStart:l/co,regularStart:0}),l+=M,a=D}else h.push({inMini:!1,miniStart:0,regularStart:0})}let m=i.length,d=Math.ceil(m*Ao/ae),f=Math.ceil(a.length/ae),p=1+d+f;for(let S=0;S<i.length;S++)i[S].data&&!h[S].inMini&&(h[S].regularStart=p,c.push({data:i[S].data,startSector:p}),p+=Math.ceil(i[S].data.length/ae));let g=p+1,u=new Uint32Array(Math.max(g+8,128));u.fill(Fe),u[0]=xi;for(let S=1;S<1+d;S++)u[S]=S<d?S+1:Ht;for(let S=1+d;S<1+d+f;S++)u[S]=S<d+f?S+1:Ht;for(let S of c){let M=Math.ceil(S.data.length/ae);for(let D=0;D<M;D++)u[S.startSector+D]=D<M-1?S.startSector+D+1:Ht}let $=Math.max(Math.ceil(a.length/co),1),x=new Uint32Array(Math.max($,128));x.fill(Fe);for(let S=0;S<i.length;S++)if(i[S].data&&h[S].inMini){let M=Math.ceil(i[S].data.length/co),D=h[S].miniStart;for(let k=0;k<M;k++)x[D+k]=k<M-1?D+k+1:Ht}let b=p;u[b]=Ht;let F=(1+b+1)*ae,y=new Uint8Array(F);y.set(hn,0),Pt(y,24,62),Pt(y,26,3),Pt(y,28,65534),Pt(y,30,9),Pt(y,32,6),Ct(y,44,1),Ct(y,48,1),Ct(y,56,Cr),Ct(y,60,b),Ct(y,64,1),Ct(y,68,Ht),Ct(y,72,0);for(let S=0;S<109;S++)Ct(y,76+S*4,Fe);Ct(y,76,0);let v=ae;for(let S=0;S<128;S++)Ct(y,v+S*4,u[S]);let w=ae*2;for(let S=0;S<i.length;S++){let M=i[S],D=w+S*Ao,k=$i(M.name);y.set(k.bytes,D),Pt(y,D+64,k.size),y[D+66]=M.type,y[D+67]=1,Ct(y,D+68,M.leftId>=0?M.leftId:Fe),Ct(y,D+72,M.rightId>=0?M.rightId:Fe),Ct(y,D+76,M.childId>=0?M.childId:Fe),M.type===5?(Ct(y,D+116,f>0?1+d:Ht),Ct(y,D+120,a.length)):M.data?(h[S].inMini?Ct(y,D+116,h[S].miniStart):Ct(y,D+116,h[S].regularStart),Ct(y,D+120,M.data.length)):(Ct(y,D+116,Ht),Ct(y,D+120,0))}let R=ae*(2+d);y.set(a,R);for(let S of c)y.set(S.data,ae*(1+S.startSector));let T=ae*(1+b);for(let S=0;S<128;S++)Ct(y,T+S*4,x[S]);return y}async function Ai(e,t,o){let n=o?.spinCount??1e5,r=ho(16),s=ho(16),i=ho(16),a=await Ke(t,s,n,256,Ir),l=ho(32),h=await Ge(a,s,qe(l,16)),c=await Ke(t,s,n,256,vr),m=await Ge(c,s,qe(i,16)),d=await pe(i),f=await Ke(t,s,n,256,Sr),p=await Ge(f,s,qe(d,16)),g=e,u=4096,$=[];for(let Q=0;Q<g.length;Q+=u){let q=g.subarray(Q,Math.min(Q+u,g.length)),E=qe(q,16),_=Q/u,P=new Uint8Array(4);P[0]=_&255,P[1]=_>>8&255,P[2]=_>>16&255,P[3]=_>>24&255;let H=(await pe(fe(r,P))).subarray(0,16),V=await Ge(l,H,E);$.push(V)}let x=fe(...$),b=new Uint8Array(8);Ct(b,0,e.length);let F=fe(b,x),y=ho(64),v=(await pe(fe(r,wi))).subarray(0,16),w=await Ge(l,v,qe(y,16)),R=await yi(y,F),T=(await pe(fe(r,bi))).subarray(0,16),S=await Ge(l,T,qe(R,16)),M=Ci(r,h,m,p,w,S,s,n),D=new TextEncoder().encode(M),k=new Uint8Array(8);Pt(k,0,4),Pt(k,2,4),Ct(k,4,64);let W=fe(k,D);return ki(W,F)}async function Di(e,t){let o=Fr(e),n=o.find(b=>b.name==="EncryptionInfo"),r=o.find(b=>b.name==="EncryptedPackage");if(!n||!r)throw new Error("Not an encrypted Office file");let s=n.data.subarray(8),i=new TextDecoder().decode(s),a=Fi(i),l=await Ke(t,a.passwordSalt,a.spinCount,a.keyBits,Ir),h;try{h=await ko(l,a.passwordSalt,a.encryptedKeyValue),h=h.subarray(0,a.keyBits/8)}catch{throw new Error("Incorrect password")}let c=await Ke(t,a.passwordSalt,a.spinCount,a.keyBits,vr),m;try{m=await ko(c,a.passwordSalt,a.encryptedVerifierInput),m=m.subarray(0,16)}catch{throw new Error("Incorrect password")}let d=await Ke(t,a.passwordSalt,a.spinCount,a.keyBits,Sr);try{let b=await ko(d,a.passwordSalt,a.encryptedVerifierHash),F=await pe(m);for(let y=0;y<64;y++)if(b[y]!==F[y])throw new Error("Incorrect password")}catch(b){throw b.message==="Incorrect password"?b:new Error("Incorrect password")}let f=a.keySalt,p=re(r.data,0),g=r.data.subarray(8),u=4096,$=[];for(let b=0;b<g.length;b+=u){let F=b+u;F>g.length&&(F=g.length);let y=Math.ceil((F-b)/16)*16,v=g.subarray(b,b+y),w=b/u,R=new Uint8Array(4);R[0]=w&255,R[1]=w>>8&255,R[2]=w>>16&255,R[3]=w>>24&255;let S=(await pe(fe(f,R))).subarray(0,16);try{let M=await ko(h,S,v);$.push(M)}catch{throw new Error("Decryption failed \u2014 data may be corrupted")}}return fe(...$).subarray(0,p)}function Ri(e){if(e.length<8)return!1;for(let t=0;t<8;t++)if(e[t]!==hn[t])return!1;try{return Fr(e).some(o=>o.name==="EncryptionInfo")}catch{return!1}}function Pi(e){return e<128?new Uint8Array([e]):e<256?new Uint8Array([129,e]):e<65536?new Uint8Array([130,e>>8,e&255]):new Uint8Array([131,e>>16&255,e>>8&255,e&255])}function Ot(e,t){let o=Pi(t.length),n=new Uint8Array(1+o.length+t.length);return n[0]=e,n.set(o,1),n.set(t,1+o.length),n}function Bt(...e){let t=0;for(let r of e)t+=r.length;let o=new Uint8Array(t),n=0;for(let r of e)o.set(r,n),n+=r.length;return Ot(48,o)}function Ye(...e){let t=0;for(let r of e)t+=r.length;let o=new Uint8Array(t),n=0;for(let r of e)o.set(r,n),n+=r.length;return Ot(49,o)}function Qt(e){let t=[40*e[0]+e[1]];for(let o=2;o<e.length;o++){let n=e[o];if(n<128)t.push(n);else{let r=[];for(;n>0;)r.unshift(n&127),n>>=7;for(let s=0;s<r.length-1;s++)r[s]|=128;t.push(...r)}}return Ot(6,new Uint8Array(t))}function mn(e){if(e===0)return Ot(2,new Uint8Array([0]));let t=[],o=e;for(;o>0;)t.unshift(o&255),o>>=8;return t[0]&128&&t.unshift(0),Ot(2,new Uint8Array(t))}function Do(e){return Ot(4,e)}function Mi(e){return Ot(12,new TextEncoder().encode(e))}function Ro(e,t){return Ot(160|e,t)}var dn=[2,16,840,1,101,3,4,2,1],Ei=[1,2,840,113549,1,1,1],Bi=[1,2,840,113549,1,1,11],_i=[1,2,840,113549,1,7,2];var ji=[1,2,840,113549,1,9,3],Oi=[1,2,840,113549,1,9,4],Li=[1,2,840,113549,1,9,5],Tr=[1,3,6,1,4,1,311,2,1,4];function fo(e){let t=e.replace(/-----[A-Z\s]+-----/g,"").replace(/\s+/g,""),o=atob(t),n=new Uint8Array(o.length);for(let r=0;r<o.length;r++)n[r]=o.charCodeAt(r);return n}function Po(e){let t="";for(let o=0;o<e.length;o++)t+=String.fromCharCode(e[o]);return btoa(t)}function Ze(e,t){let o=e[t],n=t+1,r=e[n++];if(r&128){let s=r&127;r=0;for(let i=0;i<s;i++)r=r<<8|e[n++]}return{tag:o,content:e.slice(n,n+r),next:n+r}}async function Mo(e){let t=await crypto.subtle.digest("SHA-256",e);return new Uint8Array(t)}async function fn(e){return crypto.subtle.importKey("pkcs8",e,{name:"RSASSA-PKCS1-v1_5",hash:"SHA-256"},!1,["sign"])}async function kr(e,t){let o=await crypto.subtle.sign("RSASSA-PKCS1-v1_5",e,t);return new Uint8Array(o)}async function Ni(e,t,o,n){let r=await Mo(t),s=Ze(o,0),i=Ze(s.content,0),a=0,l=Ze(i.content,a);l.tag===160&&(a=l.next,l=Ze(i.content,a));let h=l.content;a=l.next,l=Ze(i.content,a),a=l.next,l=Ze(i.content,a);let c=i.content.slice(a,l.next),d=new Date().toISOString().replace(/[-:T]/g,"").slice(0,14)+"Z",f=new TextEncoder().encode(d),p=Bt(Qt(dn),Ot(5,new Uint8Array(0))),g=[Bt(Qt(ji),Ye(Qt(e))),Bt(Qt(Li),Ye(Ot(23,f))),Bt(Qt(Oi),Ye(Do(r)))],u=new Uint8Array(0);for(let R of g){let T=new Uint8Array(u.length+R.length);T.set(u),T.set(R,u.length),u=T}let $=Ot(49,u),x=Ot(160,u),F=await kr(n,$),y=Bt(mn(1),Bt(c,Ot(2,h)),p,x,Bt(Qt(Ei),Ot(5,new Uint8Array(0))),Do(F)),v=Bt(Qt(e),Ro(0,Do(t))),w=Bt(mn(1),Ye(p),v,Ro(0,o),Ye(y));return Bt(Qt(_i),Ro(0,w))}var Xi=[2,5,4,3];function Ui(e){let t=new Uint8Array(1+e.length);return t[0]=0,t.set(e,1),Ot(3,t)}async function Vi(e,t,o){let n=fo(t),r=await fn(n),s=Bt(Qt(Bi),Ot(5,new Uint8Array(0))),i=Bt(Ye(Bt(Qt(Xi),Mi(e)))),a=new Date,l=new Date(a.getFullYear()+10,a.getMonth(),a.getDate()),h=v=>{let w=v.toISOString().replace(/[-:T]/g,"").slice(2,14)+"Z";return Ot(23,new TextEncoder().encode(w))},c=Bt(h(a),h(l)),m=Ot(2,new Uint8Array([1])),d=Ro(0,mn(2)),f=Bt(d,m,s,i,c,i,Ot(48,o.slice((o.indexOf(48,1)>=0,0)))),g=Bt(d,m,s,i,c,i,o),u=await Mo(g),$=await crypto.subtle.sign("RSASSA-PKCS1-v1_5",r,g),x=new Uint8Array($),b=Bt(g,s,Ui(x));return`-----BEGIN CERTIFICATE-----
|
|
688
|
+
${Po(b).match(/.{1,64}/g).join(`
|
|
689
|
+
`)}
|
|
690
|
+
-----END CERTIFICATE-----`}async function Ar(e,t){let o=fo(t.certificate),n=fo(t.privateKey),r=await fn(n),s=new TextEncoder,i=new Map,a=[];for(let[g,u]of e){let $=await Mo(u),x=Po($);a.push(`<Reference URI="/${g}?ContentType=${Wi(g)}">
|
|
691
|
+
<DigestMethod Algorithm="http://www.w3.org/2001/04/xmlenc#sha256"/>
|
|
692
|
+
<DigestValue>${x}</DigestValue>
|
|
693
|
+
</Reference>`)}let l=`<SignedInfo xmlns="http://www.w3.org/2000/09/xmldsig#">
|
|
694
|
+
<CanonicalizationMethod Algorithm="http://www.w3.org/TR/2001/REC-xml-c14n-20010315"/>
|
|
695
|
+
<SignatureMethod Algorithm="http://www.w3.org/2001/04/xmldsig-more#rsa-sha256"/>
|
|
696
|
+
${a.join(`
|
|
697
|
+
`)}
|
|
698
|
+
</SignedInfo>`,h=s.encode(l),c=await kr(r,h),m=Po(c),d=Po(o),f=`<?xml version="1.0" encoding="UTF-8"?>
|
|
699
|
+
<Signature xmlns="http://www.w3.org/2000/09/xmldsig#" Id="idPackageSignature">
|
|
700
|
+
${l}
|
|
701
|
+
<SignatureValue>${m}</SignatureValue>
|
|
702
|
+
<KeyInfo>
|
|
703
|
+
<X509Data>
|
|
704
|
+
<X509Certificate>${d}</X509Certificate>
|
|
705
|
+
</X509Data>
|
|
706
|
+
</KeyInfo>
|
|
707
|
+
<Object>
|
|
708
|
+
<SignatureProperties>
|
|
709
|
+
<SignatureProperty Id="idSignatureTime" Target="#idPackageSignature">
|
|
710
|
+
<mdssi:SignatureTime xmlns:mdssi="http://schemas.openxmlformats.org/package/2006/digital-signature">
|
|
711
|
+
<mdssi:Format>YYYY-MM-DDThh:mm:ssTZD</mdssi:Format>
|
|
712
|
+
<mdssi:Value>${new Date().toISOString()}</mdssi:Value>
|
|
713
|
+
</mdssi:SignatureTime>
|
|
714
|
+
</SignatureProperty>
|
|
715
|
+
</SignatureProperties>
|
|
716
|
+
</Object>
|
|
717
|
+
</Signature>`;i.set("_xmlsignatures/sig1.xml",s.encode(f)),i.set("_xmlsignatures/origin.sigs",new Uint8Array(0)),i.set("_xmlsignatures/_rels/origin.sigs.rels",s.encode(`<?xml version="1.0" encoding="UTF-8"?>
|
|
718
|
+
<Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">
|
|
719
|
+
<Relationship Id="rId1" Type="http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/signature" Target="sig1.xml"/>
|
|
720
|
+
</Relationships>`));let p=e.get("_rels/.rels");if(p){let g=new TextDecoder().decode(p);g.includes("digital-signature/origin")||(g=g.replace("</Relationships>",` <Relationship Id="rIdSig" Type="http://schemas.openxmlformats.org/package/2006/relationships/digital-signature/origin" Target="_xmlsignatures/origin.sigs"/>
|
|
721
|
+
</Relationships>`),i.set("_rels/.rels",s.encode(g)))}return i}function Wi(e){return e.endsWith(".xml")?"application/xml":e.endsWith(".rels")?"application/vnd.openxmlformats-package.relationships+xml":e.endsWith(".bin")?"application/vnd.ms-office.vbaProject":"application/octet-stream"}async function Dr(e,t){let o=fo(t.certificate),n=fo(t.privateKey),r=await fn(n),s=await Mo(e),i=Bt(Bt(Qt(Tr),Bt(Qt(dn),Ot(5,new Uint8Array(0)))),Bt(Bt(Qt(dn),Ot(5,new Uint8Array(0))),Do(s))),a=await Ni(Tr,i,o,r),l=new Uint8Array(8+a.length),h=new DataView(l.buffer);return h.setUint32(0,3,!0),h.setUint32(4,a.length,!0),l.set(a,8),l}async function Hi(e,t,o){let n=await Ar(e,t),r;return o&&(r=await Dr(o,t)),{packageSignatureEntries:n,vbaSignature:r}}export{te as CellError,Sa as Colors,me as FormulaEngine,va as NumFmt,Le as SharedStrings,Fo as StyleBuilder,Oe as StyleRegistry,Fa as Styles,oo as VbaProject,ao as Workbook,Ie as Worksheet,un as a1ToR1C1,Kr as applyChartTemplate,le as base64ToBytes,Br as bytesToBase64,Gt as cellRefToIndices,Ut as colIndexToLetter,qt as colLetterToIndex,ka as csvToWorkbook,_o as dateToSerial,Di as decryptWorkbook,Yr as deserializeChartTemplate,Ai as encryptWorkbook,jr as formulaFromR1C1,_r as formulaToR1C1,Vi as generateTestCertificate,ye as indicesToCellRef,Ri as isEncrypted,Jt as parseRange,jo as pxToEmu,gn as r1c1ToA1,qr as saveChartTemplate,Zr as serializeChartTemplate,Ar as signPackage,Dr as signVbaProject,Hi as signWorkbook,jt as style,oi as workbookToHtml,Da as workbookToJson,di as workbookToPdf,Ia as worksheetToCsv,ln as worksheetToHtml,sr as worksheetToJson,ur as worksheetToPdf};
|