@cj-tech-master/excelts 5.1.17 → 5.1.18

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.
Files changed (64) hide show
  1. package/dist/browser/modules/archive/unzip/stream.base.js +11 -4
  2. package/dist/browser/modules/archive/unzip/stream.browser.js +3 -3
  3. package/dist/browser/modules/excel/anchor.js +2 -5
  4. package/dist/browser/modules/excel/cell.js +11 -9
  5. package/dist/browser/modules/excel/column.js +2 -2
  6. package/dist/browser/modules/excel/defined-names.js +2 -2
  7. package/dist/browser/modules/excel/note.js +1 -1
  8. package/dist/browser/modules/excel/row.js +7 -4
  9. package/dist/browser/modules/excel/stream/worksheet-reader.js +4 -1
  10. package/dist/browser/modules/excel/table.d.ts +20 -1
  11. package/dist/browser/modules/excel/table.js +118 -15
  12. package/dist/browser/modules/excel/utils/sheet-utils.js +1 -1
  13. package/dist/browser/modules/excel/worksheet.d.ts +1 -1
  14. package/dist/browser/modules/excel/worksheet.js +5 -4
  15. package/dist/browser/modules/excel/xlsx/xform/book/workbook-xform.d.ts +3 -0
  16. package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +1 -1
  17. package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +6 -5
  18. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.d.ts +3 -0
  19. package/dist/browser/modules/excel/xlsx/xform/style/styles-xform.d.ts +4 -0
  20. package/dist/browser/modules/stream/streams.browser.d.ts +5 -5
  21. package/dist/browser/modules/stream/streams.browser.js +12 -4
  22. package/dist/browser/utils/utils.base.js +1 -1
  23. package/dist/cjs/modules/archive/unzip/stream.base.js +11 -4
  24. package/dist/cjs/modules/archive/unzip/stream.browser.js +3 -3
  25. package/dist/cjs/modules/excel/anchor.js +2 -5
  26. package/dist/cjs/modules/excel/cell.js +11 -9
  27. package/dist/cjs/modules/excel/column.js +2 -2
  28. package/dist/cjs/modules/excel/defined-names.js +2 -2
  29. package/dist/cjs/modules/excel/note.js +1 -1
  30. package/dist/cjs/modules/excel/row.js +7 -4
  31. package/dist/cjs/modules/excel/stream/worksheet-reader.js +4 -1
  32. package/dist/cjs/modules/excel/table.js +118 -14
  33. package/dist/cjs/modules/excel/utils/sheet-utils.js +1 -1
  34. package/dist/cjs/modules/excel/worksheet.js +5 -4
  35. package/dist/cjs/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +1 -1
  36. package/dist/cjs/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +6 -5
  37. package/dist/cjs/modules/stream/streams.browser.js +12 -4
  38. package/dist/cjs/utils/utils.base.js +1 -1
  39. package/dist/esm/modules/archive/unzip/stream.base.js +11 -4
  40. package/dist/esm/modules/archive/unzip/stream.browser.js +3 -3
  41. package/dist/esm/modules/excel/anchor.js +2 -5
  42. package/dist/esm/modules/excel/cell.js +11 -9
  43. package/dist/esm/modules/excel/column.js +2 -2
  44. package/dist/esm/modules/excel/defined-names.js +2 -2
  45. package/dist/esm/modules/excel/note.js +1 -1
  46. package/dist/esm/modules/excel/row.js +7 -4
  47. package/dist/esm/modules/excel/stream/worksheet-reader.js +4 -1
  48. package/dist/esm/modules/excel/table.js +118 -15
  49. package/dist/esm/modules/excel/utils/sheet-utils.js +1 -1
  50. package/dist/esm/modules/excel/worksheet.js +5 -4
  51. package/dist/esm/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +1 -1
  52. package/dist/esm/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +6 -5
  53. package/dist/esm/modules/stream/streams.browser.js +12 -4
  54. package/dist/esm/utils/utils.base.js +1 -1
  55. package/dist/iife/excelts.iife.js +724 -888
  56. package/dist/iife/excelts.iife.js.map +1 -1
  57. package/dist/iife/excelts.iife.min.js +24 -23
  58. package/dist/types/modules/excel/table.d.ts +20 -1
  59. package/dist/types/modules/excel/worksheet.d.ts +1 -1
  60. package/dist/types/modules/excel/xlsx/xform/book/workbook-xform.d.ts +3 -0
  61. package/dist/types/modules/excel/xlsx/xform/sheet/worksheet-xform.d.ts +3 -0
  62. package/dist/types/modules/excel/xlsx/xform/style/styles-xform.d.ts +4 -0
  63. package/dist/types/modules/stream/streams.browser.d.ts +5 -5
  64. package/package.json +16 -16
@@ -1,53 +1,54 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v5.1.17
2
+ * @cj-tech-master/excelts v5.1.18
3
3
  * TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
4
4
  * (c) 2026 cjnoname
5
5
  * Released under the MIT License
6
6
  */
7
- var ExcelTS=(function(e){let t=/^[A-Z]+\d+$/,n={_dictionary:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_l2nFill:0,_l2n:{},_n2l:[],_level(e){return e<=26?1:e<=676?2:3},_fill(e){let t,n,r,i,a,o=1;if(e>=4)throw Error(`Out of bounds. Excel supports columns from 1 to 16384`);if(this._l2nFill<1&&e>=1){for(;o<=26;)t=this._dictionary[o-1],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&e>=2){for(o=27;o<=702;)n=o-27,r=n%26,i=Math.floor(n/26),t=this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&e>=3){for(o=703;o<=16384;)n=o-703,r=n%26,i=Math.floor(n/26)%26,a=Math.floor(n/676),t=this._dictionary[a]+this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=3}},l2n(e){if(this._l2n[e]||this._fill(e.length),!this._l2n[e])throw Error(`Out of bounds. Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw Error(`${e} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},validateAddress(e){if(!t.test(e))throw Error(`Invalid Address: ${e}`);return!0},decodeAddress(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.length<5&&this._hash[e];if(t)return t;let n=!1,r=``,i=0,a=!1,o=``,s=0;for(let t=0,c;t<e.length;t++)if(c=e.charCodeAt(t),!a&&c>=65&&c<=90)n=!0,r+=e[t],i=i*26+c-64;else if(c>=48&&c<=57)a=!0,o+=e[t],s=s*10+c-48;else if(a&&n&&c!==36)break;if(!n)i=void 0;else if(i>16384)throw Error(`Out of bounds. Invalid column letter: ${r}`);a||(s=void 0),e=r+o;let c={address:e,col:i,row:s,$col$row:`$${r}$${o}`};return i<=100&&s<=100&&(this._hash[e]=c,this._hash[c.$col$row]=c),c},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,t){return n.n2l(t)+e},encode(...e){switch(e.length){case 2:return n.encodeAddress(e[0],e[1]);case 4:return`${n.encodeAddress(e[0],e[1])}:${n.encodeAddress(e[2],e[3])}`;default:throw Error(`Can only encode with 2 or 4 arguments`)}},inRange(e,t){let[n,r,,i,a]=e,[o,s]=t;return o>=n&&o<=i&&s>=r&&s<=a}};var r=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,t,r,i,a){if(typeof e==`string`&&typeof t==`string`){let i=n.decodeAddress(e),a=n.decodeAddress(t);this.model={top:Math.min(i.row,a.row),left:Math.min(i.col,a.col),bottom:Math.max(i.row,a.row),right:Math.max(i.col,a.col),sheetName:typeof r==`string`?r:void 0}}else typeof e==`number`&&typeof t==`number`&&typeof r==`number`&&typeof i==`number`&&(this.model={top:Math.min(e,r),left:Math.min(t,i),bottom:Math.max(e,r),right:Math.max(t,i),sheetName:a})}decode(t){switch(t.length){case 5:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&typeof t[4]==`string`&&this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:typeof t[0]==`string`&&typeof t[1]==`string`&&typeof t[2]==`string`&&this.setTLBR(t[0],t[1],t[2]);break;case 2:typeof t[0]==`string`&&typeof t[1]==`string`&&this.setTLBR(t[0],t[1]);break;case 1:{let r=t[0];if(r instanceof e)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(Array.isArray(r))this.decode(r);else if(typeof r==`object`&&`top`in r&&`left`in r&&`bottom`in r&&`right`in r)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else if(typeof r==`string`){let e=n.decodeEx(r);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw Error(`Invalid number of arguments to _getDimensions() - ${t.length}`)}}get top(){return this.model.top||1}set top(e){this.model.top=e}get left(){return this.model.left||1}set left(e){this.model.left=e}get bottom(){return this.model.bottom||1}set bottom(e){this.model.bottom=e}get right(){return this.model.right||1}set right(e){this.model.right=e}get sheetName(){return this.model.sheetName}set sheetName(e){this.model.sheetName=e}get _serialisedSheetName(){let{sheetName:e}=this.model;return e?/^[a-zA-Z0-9]*$/.test(e)?`${e}!`:`'${e}'!`:``}expand(e,t,n,r){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||r>this.right)&&(this.right=r)}expandRow(e){if(e){let{dimensions:t,number:n}=e;t&&this.expand(n,t.min,n,t.max)}}expandToAddress(e){let t=n.decodeEx(e);`row`in t&&`col`in t&&this.expand(t.row,t.col,t.row,t.col)}get tl(){return n.n2l(this.left)+this.top}get $t$l(){return`$${n.n2l(this.left)}$${this.top}`}get br(){return n.n2l(this.right)+this.bottom}get $b$r(){return`$${n.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottom<this.top||e.top>this.bottom||e.right<this.left||e.left>this.right)}contains(e){let t=n.decodeEx(e);return`row`in t&&`col`in t?this.containsEx(t):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let r=this.top;r<=this.bottom;r++)e(n.encodeAddress(r,t),r,t)}};let i=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e[e.Checkbox=12]=`Checkbox`,e}({}),a=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),o=function(e){return e[e.None=0]=`None`,e[e.OfficeDocument=1]=`OfficeDocument`,e[e.Worksheet=2]=`Worksheet`,e[e.CalcChain=3]=`CalcChain`,e[e.SharedStrings=4]=`SharedStrings`,e[e.Styles=5]=`Styles`,e[e.Theme=6]=`Theme`,e[e.Hyperlink=7]=`Hyperlink`,e}({}),s=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),c=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),l={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},u={ValueType:i,FormulaType:a,RelationshipType:o,DocumentType:s,ReadingOrder:c,ErrorValue:l},d={'"':`&quot;`,"&":`&amp;`,"<":`&lt;`,">":`&gt;`},f=/["&<>]/g;function p(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;let n=typeof e;if(n!==typeof t||n!==`object`)return!1;let r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!p(e[r],t[r]))return!1;return!0}let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!Object.prototype.hasOwnProperty.call(t,r)||!p(e[r],t[r]))return!1}return!0}function m(e){return e.replace(f,e=>d[e])}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(...e){let t=e[0]||{},n=e.length;for(let r=1;r<n;r++){let n=e[r];if(n)if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){let r=n[e];if(r===void 0)continue;let i=t[e];Array.isArray(r)?t[e]=g(Array.isArray(i)?i:[],r):h(r)?t[e]=g(h(i)?i:{},r):t[e]=r}else{let e=Object.keys(n);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=n[i];if(a===void 0)continue;let o=t[i];Array.isArray(a)?t[i]=g(Array.isArray(o)?o:[],a):h(a)?t[i]=g(h(o)?o:{},a):t[i]=a}}}return t}var _=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t=null;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note};break}return g({},e.DEFAULT_CONFIGS,t)}set model(e){let{note:t}=e,{texts:n}=t;n&&n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=t}static fromModel(t){let n=new e;return n.model=t,n}};let v=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,y=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function b(e,t,r){let i=n.decode(t),a=n.decode(r);return e.replace(v,(e,t,r,o,s)=>{if(s)return e;let c=y.exec(o);if(c){let r=c[1],o=c[2].toUpperCase(),s=c[3],l=c[4];if(o.length>3||o.length===3&&o>`XFD`)return e;let u=n.l2n(o),d=parseInt(l,10);return r||(u+=a.col-i.col),s||(d+=a.row-i.row),(t??``)+(r??``)+n.n2l(u)+(s??``)+d}return e})}let x=e=>!!e&&(typeof e!=`object`||Object.keys(e).length>0);var S=class e{static{this.Types=u.ValueType}constructor(t,r,i){if(!t||!r)throw Error(`A Cell needs a Row`);this._row=t,this._column=r,n.validateAddress(i),this._address=i,this._value=D.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,r.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){delete this.style,delete this._value,delete this._row,delete this._column,delete this._address}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&x(e.font)&&e.font||t&&x(t.font)&&t.font;i&&(n.font=i);let a=e&&x(e.alignment)&&e.alignment||t&&x(t.alignment)&&t.alignment;a&&(n.alignment=a);let o=e&&x(e.border)&&e.border||t&&x(t.border)&&t.border;o&&(n.border=o);let s=e&&x(e.fill)&&e.fill||t&&x(t.fill)&&t.fill;s&&(n.fill=s);let c=e&&x(e.protection)&&e.protection||t&&x(t.protection)&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=D.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=D.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{...this.style}))}isMergedTo(t){return this._value.type===e.Types.Merge?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=D.create(D.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new _(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof _?this._comment=e:this._comment=new _(e)}get text(){return this._value.toString()}get html(){return m(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=D.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=D.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=_.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},ee=class{constructor(e){this.model={address:e.address,type:S.Types.Null}}get value(){return null}set value(e){}get type(){return S.Types.Null}get effectiveType(){return S.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},te=class{constructor(e,t){this.model={address:e.address,type:S.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Number}get effectiveType(){return S.Types.Number}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},ne=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.String}get effectiveType(){return S.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.model.value.replace(/"/g,`""`)}"`}release(){}toString(){return this.model.value}},C=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}toString(){return this.model.value.richText.map(e=>e.text).join(``)}get type(){return S.Types.RichText}get effectiveType(){return S.Types.RichText}get address(){return this.model.address}set address(e){this.model.address=e}get text(){return this.toString()}toCsvString(){return`"${this.text.replace(/"/g,`""`)}"`}release(){}},w=class{constructor(e,t){this.model={address:e.address,type:S.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Date}get effectiveType(){return S.Types.Date}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}},re=class{constructor(e,t){this.model={address:e.address,type:S.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text??``,hyperlink:this.model.hyperlink??``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return S.Types.Hyperlink}get effectiveType(){return S.Types.Hyperlink}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.hyperlink??``}release(){}toString(){return this.model.text??``}},T=class{constructor(e,t){this.model={address:e.address,type:S.Types.Merge,master:t?t.address:void 0},this._master=t,t&&t.addMergeRef()}get value(){return this._master.value}set value(e){e instanceof S?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}isMergedTo(e){return e===this._master}get master(){return this._master}get type(){return S.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value.toString()}},ie=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:S.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(D.getType(e)){case S.Types.Null:case S.Types.String:case S.Types.Number:case S.Types.Date:break;case S.Types.Hyperlink:case S.Types.Formula:default:throw Error(`Cannot process that type of result value`)}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,``).match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()||``}set formula(e){this.model.formula=e}get formulaType(){return this.model.formula?u.FormulaType.Master:this.model.sharedFormula?u.FormulaType.Shared:u.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return S.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?u.ValueType.Null:e instanceof String||typeof e==`string`?u.ValueType.String:typeof e==`number`?u.ValueType.Number:e instanceof Date?u.ValueType.Date:typeof e==`object`&&`error`in e?u.ValueType.Error:u.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&b(t.formula,t.address,this.model.address)}return this._translatedFormula}toCsvString(){return`${this.model.result??``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},ae=class{constructor(e,t){this.model={address:e.address,type:S.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.SharedString}get effectiveType(){return S.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},oe=class{constructor(e,t){this.model={address:e.address,type:S.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Boolean}get effectiveType(){return S.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},E=class{constructor(e,t){this.model={address:e.address,type:S.Types.Checkbox,value:t.checkbox}}get value(){return{checkbox:this.model.value}}set value(e){this.model.value=e.checkbox}get type(){return S.Types.Checkbox}get effectiveType(){return S.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},se=class{constructor(e,t){this.model={address:e.address,type:S.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Error}get effectiveType(){return S.Types.Error}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}},ce=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:JSON.stringify(t),rawValue:t}}get value(){return this.model.rawValue}set value(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}get type(){return S.Types.String}get effectiveType(){return S.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}};let D={getType(e){if(e==null)return S.Types.Null;if(e instanceof String||typeof e==`string`)return S.Types.String;if(typeof e==`number`)return S.Types.Number;if(typeof e==`boolean`)return S.Types.Boolean;if(e instanceof Date)return S.Types.Date;if(typeof e==`object`){if(`checkbox`in e&&typeof e.checkbox==`boolean`)return S.Types.Checkbox;if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return S.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return S.Types.Formula;if(`richText`in e&&e.richText)return S.Types.RichText;if(`sharedString`in e&&e.sharedString)return S.Types.SharedString;if(`error`in e&&e.error)return S.Types.Error}return S.Types.JSON},types:[{t:S.Types.Null,f:ee},{t:S.Types.Number,f:te},{t:S.Types.String,f:ne},{t:S.Types.Date,f:w},{t:S.Types.Hyperlink,f:re},{t:S.Types.Formula,f:ie},{t:S.Types.Merge,f:T},{t:S.Types.JSON,f:ce},{t:S.Types.SharedString,f:ae},{t:S.Types.RichText,f:C},{t:S.Types.Boolean,f:oe},{t:S.Types.Error,f:se},{t:S.Types.Checkbox,f:E}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw Error(`Could not create Value of type ${e}`);return new r(t,n)}},le=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),O=(e,t,n,r=[])=>{e[n]&&(t[n]=le(e[n],r))},ue=e=>Object.keys(e).length===0,k=e=>{if(!e)return e;if(ue(e))return{};let t={...e};return O(e,t,`font`,[`color`]),O(e,t,`alignment`),O(e,t,`protection`),e.border&&(O(e,t,`border`),O(e.border,t.border,`top`,[`color`]),O(e.border,t.border,`left`,[`color`]),O(e.border,t.border,`bottom`,[`color`]),O(e.border,t.border,`right`,[`color`]),O(e.border,t.border,`diagonal`,[`color`])),e.fill&&(O(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>le(e,[`color`])))),t};var de=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){delete this._worksheet,delete this._cells,delete this.style}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new S(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let t;if(typeof e==`string`){let r=this._worksheet.getColumnKey(e);t=r?r.number:n.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:n.encodeAddress(this._number,t),row:this._number,col:t})}splice(e,t,...n){let r=e+t,i=n.length-t,a=this._cells.length,o,s,c;if(i<0)for(o=e+n.length;o<=a;o++)c=this._cells[o-1],s=this._cells[o-i-1],s?(c=this.getCell(o),c.value=s.value,c.style=k(s.style)??{},c.comment=s.comment):c&&(c.value=null,c.style={},c.comment=void 0);else if(i>0)for(o=a;o>=r;o--)s=this._cells[o-1],s?(c=this.getCell(o+i),c.value=s.value,c.style=k(s.style)??{},c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==u.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==u.ValueType.Null&&(e[t.col]=t.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let t=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(t=1),e.forEach((e,r)=>{e!==void 0&&(this.getCellEx({address:n.encodeAddress(this._number,r+t),row:this._number,col:r+t}).value=e)})}else this._worksheet.eachColumnKey((t,r)=>{e[r]!==void 0&&(this.getCellEx({address:n.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[r])})}getValues(){let e=[];return this._cells.forEach(t=>{t&&t.type!==u.ValueType.Null&&(e[t.col-1]=t.value)}),e}valuesToString(e=`,`){return this.getValues().join(e)}get hasValues(){return this._cells.some(e=>e&&e.type!==u.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,t=0;return this._cells.forEach(n=>{n&&n.type!==u.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelRow)}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height!=null||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,customHeight:this.customHeight,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed,dyDescent:this.dyDescent}:null}set model(e){if(e.number!==this._number)throw Error(`Invalid row number in model`);this._cells=[];let t;e.cells.forEach(e=>{switch(e.type){case S.Types.Merge:break;default:{let r;if(e.address)r=n.decodeAddress(e.address);else if(t){let{row:e}=t,i=t.col+1;r={row:e,col:i,address:n.encodeAddress(e,i),$col$row:`$${n.n2l(i)}$${e}`}}t=r;let i=this.getCellEx(r);i.model=e;break}}}),e.height==null?delete this.height:this.height=e.height,e.customHeight==null?delete this.customHeight:this.customHeight=e.customHeight,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel??0,this.dyDescent=e.dyDescent,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},fe=class e{constructor(e,t,n){this._worksheet=e,this._number=t,n!==!1&&(this.defn=n)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return n.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,bestFit:this.bestFit}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden,this.bestFit=e.bestFit):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0,delete this.bestFit)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(this._key,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=this._worksheet.properties.outlineLevelCol)}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&p(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&this.bestFit===e.bestFit&&p(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel||this.bestFit)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==u.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||1048575,a={id:this._number,max:i,man:1};r&&(a.min=r),n.colBreaks.push(a)}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed,bestFit:e.bestFit},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){let r=t,i=Array.isArray(t)?t:n??[];i??=[];let a=[],o=1,s=0;for(i=i.sort(function(e,t){return e.min-t.min});s<i.length;){let t=i[s++];for(;o<t.min;)a.push(new e(r,o++));for(;o<=t.max;)a.push(new e(r,o++,t))}return a.length?a:null}};function pe(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function me(e){return typeof e==`object`&&`col`in e&&`row`in e}var he=class e{constructor(e,t,r=0){if(this.worksheet=e,!t)this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;else if(typeof t==`string`){let e=n.decodeAddress(t);this.nativeCol=e.col+r,this.nativeColOff=0,this.nativeRow=e.row+r,this.nativeRowOff=0}else pe(t)?(this.nativeCol=t.nativeCol??0,this.nativeColOff=t.nativeColOff??0,this.nativeRow=t.nativeRow??0,this.nativeRowOff=t.nativeRowOff??0):me(t)?(this.col=t.col+r,this.row=t.row+r):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){return this.worksheet&&this.worksheet.getRow(this.nativeRow+1)&&this.worksheet.getRow(this.nativeRow+1).height?Math.floor(this.worksheet.getRow(this.nativeRow+1).height*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}clone(t){return new e(t??this.worksheet,this.model)}},ge=class e{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId};case`image`:return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw Error(`Invalid Image Type`)}}set model({type:e,imageId:t,range:r,hyperlinks:i}){if(this.type=e,this.imageId=t,e===`image`)if(typeof r==`string`){let e=n.decode(r);`top`in e&&(this.range={tl:new he(this.worksheet,{col:e.left,row:e.top},-1),br:new he(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else r&&(this.range={tl:new he(this.worksheet,r.tl,0),br:r.br?new he(this.worksheet,r.br,0):void 0,ext:r.ext,editAs:r.editAs,hyperlinks:i||(`hyperlinks`in r?r.hyperlinks:void 0)})}clone(t){let n=t??this.worksheet,r=new e(n);return r.type=this.type,r.imageId=this.imageId,this.range&&(r.range={tl:this.range.tl.clone(n),br:this.range.br?this.range.br.clone(n):void 0,ext:this.range.ext?{...this.range.ext}:void 0,editAs:this.range.editAs,hyperlinks:this.range.hyperlinks?{...this.range.hyperlinks}:void 0}),r}},_e=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},ve=class{constructor(e,t){if(this.worksheet=e,t){if(this.table=t,Array.isArray(t.rows)&&t.rows.length===0&&t.tableRef){let r=n.decode(t.tableRef);if(`dimensions`in r){let n=r.top+(t.headerRow===!1?0:1),i=r.bottom-(t.totalsRow===!0?1:0);if(i>=n)for(let a=n;a<=i;a++){let n=e.getRow(a),i=[];for(let e=r.left;e<=r.right;e++)i.push(n.getCell(e).value);t.rows.push(i)}}}this.validate(),this.store()}}getFormula(e){switch(e.totalsRowFunction){case`none`:return null;case`average`:return`SUBTOTAL(101,${this.table.name}[${e.name}])`;case`countNums`:return`SUBTOTAL(102,${this.table.name}[${e.name}])`;case`count`:return`SUBTOTAL(103,${this.table.name}[${e.name}])`;case`max`:return`SUBTOTAL(104,${this.table.name}[${e.name}])`;case`min`:return`SUBTOTAL(105,${this.table.name}[${e.name}])`;case`stdDev`:return`SUBTOTAL(106,${this.table.name}[${e.name}])`;case`var`:return`SUBTOTAL(107,${this.table.name}[${e.name}])`;case`sum`:return`SUBTOTAL(109,${this.table.name}[${e.name}])`;case`custom`:return e.totalsRowFormula??null;default:throw Error(`Invalid Totals Row Function: ${e.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{}),t(e.style,`theme`,`TableStyleMedium2`),t(e.style,`showFirstColumn`,!1),t(e.style,`showLastColumn`,!1),t(e.style,`showRowStripes`,!1),t(e.style,`showColumnStripes`,!1);let r=(e,t)=>{if(!e)throw Error(t)};r(!!e.ref,`Table must have ref`),r(!!e.columns,`Table must have column definitions`),r(!!e.rows,`Table must have row definitions`),e.tl=n.decodeAddress(e.ref);let{row:i,col:a}=e.tl;r(i>0,`Table must be on valid row`),r(a>0,`Table must be on valid col`);let{width:o,tableHeight:s}=this;e.autoFilterRef=n.encode(i,a,i,a+o-1),e.tableRef=n.encode(i,a,i+s-1,a+o-1),e.columns.forEach((e,n)=>{r(!!e.name,`Column ${n} must have a name`),n===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)??void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r),o=t?.formula;if(typeof o==`string`){let e=n.qualifyImplicitStructuredReferences===!0;a.value={...t,formula:e?o.replace(/(^|[^A-Za-z0-9_])\[@\[?([^\[\]]+?)\]?\]/g,`$1${n.name}[[#This Row],[$2]]`):o}}else a.value=t;e(a,n.columns[r]?.style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);n===0?r.value=t.totalsRowLabel:this.getFormula(t)?r.value={formula:t.totalsRowFormula,result:t.totalsRowResult}:r.value=null,e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);t===0?n.value=e.totalsRowLabel:this.getFormula(e)&&(n.value={formula:e.totalsRowFormula,result:e.totalsRowResult})})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=n.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store(),this._cache=void 0}addRow(e,t,n){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e),n?.commit!==!1&&this.commit()}removeRows(e,t=1,n){this.cacheState(),this.table.rows.splice(e,t),n?.commit!==!1&&this.commit()}getColumn(e){let t=this.table.columns[e];return new _e(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.table.name=e}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.table.displayName=e}get headerRow(){return this.table.headerRow}set headerRow(e){this._assign(this.table,`headerRow`,e)}get totalsRow(){return this.table.totalsRow}set totalsRow(e){this._assign(this.table,`totalsRow`,e)}get theme(){return this.table.style.theme}set theme(e){this.table.style.theme=e}get showFirstColumn(){return this.table.style.showFirstColumn}set showFirstColumn(e){this.table.style.showFirstColumn=e}get showLastColumn(){return this.table.style.showLastColumn}set showLastColumn(e){this.table.style.showLastColumn=e}get showRowStripes(){return this.table.style.showRowStripes}set showRowStripes(e){this.table.style.showRowStripes=e}get showColumnStripes(){return this.table.style.showColumnStripes}set showColumnStripes(e){this.table.style.showColumnStripes=e}},ye=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){let t=this.model[e];if(t!==void 0)return t;let r;for(let t in this.model){if(!t.startsWith(`range:`))continue;r||=n.decodeAddress(e);let i=t.slice(6),a=n.decodeEx(i);if(!a.dimensions)continue;let o=a.tl,s=a.br;if(r.row>=o.row&&r.row<=s.row&&r.col>=o.col&&r.col<=s.col)return this.model[t]}}remove(e){this.model[e]=void 0}};let be=9525,xe=12700,Se=142875,Ce=28575,we=276225,Te=190500;var Ee=class e{constructor(e,t,n){this.worksheet=e;let{tl:r,br:i}=this._parseRange(t),a=1025+(e.formControls?.length??0),o;n?.link&&(o=this._toAbsoluteRef(n.link)),this.model={shapeId:a,ctrlPropId:0,tl:r,br:i,link:o,checked:n?.checked?`Checked`:`Unchecked`,text:n?.text??``,noThreeD:n?.noThreeD??!0,print:n?.print??!1}}get checked(){return this.model.checked===`Checked`}set checked(e){this.model.checked=e?`Checked`:`Unchecked`}get link(){return this.model.link}set link(e){this.model.link=e?this._toAbsoluteRef(e):void 0}get text(){return this.model.text}set text(e){this.model.text=e}_toAbsoluteRef(e){if(e.includes(`$`))return e;let t=n.decodeAddress(e);return`$${n.n2l(t.col)}$${t.row}`}_parseRange(e){let t,r;if(typeof e==`string`)if(e.includes(`:`)){let i=n.decode(e);if(`top`in i)if(i.left===i.right&&i.top===i.bottom){let e=i.left-1,n=i.top-1;t={col:e,colOff:Se,row:n,rowOff:Ce},r={col:e+2,colOff:we,row:n+1,rowOff:Te}}else t={col:i.left-1,colOff:Se,row:i.top-1,rowOff:Ce},r={col:i.right-1,colOff:we,row:i.bottom-1,rowOff:Te};else t={col:i.col-1,colOff:Se,row:i.row-1,rowOff:Ce},r={col:i.col+1,colOff:we,row:i.row,rowOff:Te}}else{let i=n.decodeAddress(e);t={col:i.col-1,colOff:Se,row:i.row-1,rowOff:Ce},r={col:i.col+1,colOff:we,row:i.row,rowOff:Te}}else if(`startCol`in e)t={col:e.startCol,colOff:e.startColOff??Se,row:e.startRow,rowOff:e.startRowOff??Ce},r={col:e.endCol,colOff:e.endColOff??we,row:e.endRow,rowOff:e.endRowOff??Te};else{if(typeof e.tl==`string`){let r=n.decodeAddress(e.tl);t={col:r.col-1,colOff:Se,row:r.row-1,rowOff:Ce}}else t={col:e.tl.col,colOff:e.tl.colOff??Se,row:e.tl.row,rowOff:e.tl.rowOff??Ce};if(e.br)if(typeof e.br==`string`){let t=n.decodeAddress(e.br);r={col:t.col-1,colOff:we,row:t.row-1,rowOff:Te}}else r={col:e.br.col,colOff:e.br.colOff??we,row:e.br.row,rowOff:e.br.rowOff??Te};else r={col:t.col+2,colOff:we,row:t.row+1,rowOff:Te}}return{tl:t,br:r}}getVmlAnchor(){return e.getVmlAnchor(this.model)}getVmlStyle(){return e.getVmlStyle(this.model)}getVmlCheckedValue(){return e.getVmlCheckedValue(this.model)}static getVmlAnchor(e){let{tl:t,br:n}=e,r=Math.round(t.colOff/be),i=Math.round(t.rowOff/be),a=Math.round(n.colOff/be),o=Math.round(n.rowOff/be);return`${t.col}, ${r}, ${t.row}, ${i}, ${n.col}, ${a}, ${n.row}, ${o}`}static getVmlStyle(e){return`position:absolute;margin-left:${Math.round(e.tl.colOff/xe)}pt;margin-top:${Math.round(e.tl.rowOff/xe)}pt;width:96pt;height:18pt;z-index:1;visibility:visible`}static getVmlCheckedValue(e){switch(e.checked){case`Checked`:return 1;case`Mixed`:return 2;default:return 0}}};function De(){return typeof process<`u`&&!!process.versions?.node}function Oe(e){if(De())return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function ke(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function Ae(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}function je(e){return new Date(e.endsWith(`Z`)?e:e+`Z`)}let Me={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function Ne(e){return e.indexOf(`&`)===-1?e:e.replace(/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1));return Number.isNaN(n)?e:String.fromCodePoint(n)}return Me[t]||e})}let Pe=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/;function A(e){let t=Pe.exec(e);if(!t)return e;let n=[],r=0;for(let i=t.index;i<e.length;i++){let t=e.charCodeAt(i),a=null;switch(t){case 34:a=`&quot;`;break;case 38:a=`&amp;`;break;case 39:a=`&apos;`;break;case 60:a=`&lt;`;break;case 62:a=`&gt;`;break;case 127:a=``;break;default:if(t<=31&&(t<=8||t>=11&&t!==13)){a=``;break}continue}r!==i&&n.push(e.substring(r,i)),r=i+1,a&&n.push(a)}return r<e.length&&n.push(e.substring(r)),n.join(``)}function Fe(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function Ie(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}let Le=/[ymdhMsb]/,Re=/\[[^\]]*\]|"[^"]*"/g;function ze(e){if(!e)return!1;let t=Ie(e)[0].replace(Re,``);return t.indexOf(`@`)>-1?!1:Le.test(t)}function j(e){return e===!0||e===`true`||e===1||e===`1`}function*Be(e,t,n=1){let r=n>0?(e,t)=>e<t:(e,t)=>e>t;for(let i=e;r(i,t);i+=n)yield i}function Ve(e){let t=Array.from(e);return t.length<=1?t:t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.every(e=>e instanceof Date)?t.sort((e,t)=>e.getTime()-t.getTime()):t.sort((e,t)=>{let n=He(e),r=He(t);return n===r?n===0?e-t:n===1?e.getTime()-t.getTime():String(e).localeCompare(String(t)):n-r})}function He(e){return Number.isFinite(e)?0:e instanceof Date?1:2}let Ue=new TextDecoder(`utf-8`),We;try{We=new TextDecoder(`latin1`)}catch{We=void 0}function Ge(e){return typeof e==`string`?e:Ue.decode(e)}function Ke(e){if(De())return Buffer.from(e).toString(`base64`);if(We)try{return btoa(We.decode(e))}catch{}let t=32768,n=[];for(let r=0;r<e.length;r+=t)n.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return btoa(n.join(``))}function qe(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}let Je=e=>Array.isArray(e);var M=class e{constructor(){this.__excelts_stream=!0,this._listeners=new Map,this._maxListeners=e.defaultMaxListeners}static{this.defaultMaxListeners=10}addListener(e,t){return this.on(e,t)}_listenerCount(e){return e?Je(e)?e.length:1:0}_hasListeners(e){return this._listenerCount(this._listeners.get(e))>0}on(e,t){let n=this._listeners.get(e);if(this._maxListeners>0){let t=this._listenerCount(n);t>=this._maxListeners&&console?.warn?.(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${t+1} ${String(e)} listeners added. Use emitter.setMaxListeners() to increase limit`)}return n?Je(n)?n.push(t):this._listeners.set(e,[n,t]):this._listeners.set(e,t),e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t),this}prependListener(e,t){let n=this._listeners.get(e);return n?Je(n)?n.unshift(t):this._listeners.set(e,[t,n]):this._listeners.set(e,t),e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.on(e,n)}prependOnceListener(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.prependListener(e,n)}removeListener(e,t){return this.off(e,t)}off(e,t){let n=this._listeners.get(e);if(!n)return this;if(!Je(n))return(n===t||n.listener===t)&&(this._listeners.delete(e),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t)),this;let r=n;if(r.length===0)return this._listeners.delete(e),this;let i=r.indexOf(t);if(i!==-1)r.splice(i,1);else for(let e=0,n=r.length;e<n;e++)if(r[e].listener===t){r.splice(e,1);break}return r.length===0?this._listeners.delete(e):r.length===1&&this._listeners.set(e,r[0]),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t),this}emit(e,...t){let n=this._listeners.get(e);if(!n)return!1;if(!Je(n)){try{n.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}let r=n,i=r.length;if(i===0)return!1;if(i===1){try{r[0].apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}if(i===2){let n=r[0],i=r[1];try{n.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}try{i.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}let a=r.slice();for(let n=0;n<a.length;n++)try{a[n].apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}removeAllListeners(e){return e===void 0?this._listeners.clear():this._listeners.delete(e),this}listenerCount(e){return this._listenerCount(this._listeners.get(e))}listeners(e){let t=this._listeners.get(e);return t?Je(t)?t.slice():[t]:[]}rawListeners(e){let t=this._listeners.get(e);return t?Je(t)?t.slice():[t]:[]}eventNames(){return[...this._listeners.keys()]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners}};let Ye=new TextEncoder,Xe=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ze=new Map;function Qe(e){if(!e||e===`utf-8`||e===`utf8`)return Xe;let t=e,n=Ze.get(t);return n||(n=new TextDecoder(t),Ze.set(t,n)),n}function $e(e){return Ye.encode(e)}function et(e,t){let n=e.length;if(n===0)return new Uint8Array;if(n===1)return e[0];if(t===void 0){let r=0;for(let t=0;t<n;t++)r+=e[t].length;t=r}let r=new Uint8Array(t),i=0;for(let t=0;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r}function tt(e){return!!e&&typeof e==`object`&&typeof e.getReader==`function`}function nt(e){return!!e&&typeof e==`object`&&typeof e.getWriter==`function`}function rt(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e[Symbol.asyncIterator]==`function`}function it(e){return!!e&&typeof e==`object`&&!!e.readable&&!!e.writable&&tt(e.readable)&&nt(e.writable)}let at=(e,t,n)=>{typeof e.off==`function`?e.off(t,n):typeof e.removeListener==`function`&&e.removeListener(t,n)},ot=(e,t,n,r)=>(r?.once&&typeof e.once==`function`?e.once(t,n):e.on(t,n),()=>at(e,t,n)),st=()=>{let e=[];return{add:(t,n,r)=>{e.push(ot(t,n,r))},once:(t,n,r)=>{e.push(ot(t,n,r,{once:!0}))},cleanup:()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}};var N=class e extends M{constructor(e){if(super(),this._reader=null,this._buffer=[],this._bufferIndex=0,this._unshiftBuffer=[],this._bufferSize=0,this._reading=!1,this._ended=!1,this._endEmitted=!1,this._destroyed=!1,this._errored=null,this._closed=!1,this._paused=!0,this._flowing=!1,this._pipeTo=[],this._pipeListeners=new Map,this._encoding=null,this._decoder=null,this._didRead=!1,this._aborted=!1,this._pushMode=!1,this._webStreamMode=!1,this.objectMode=e?.objectMode??!1,this.readableHighWaterMark=e?.highWaterMark??16384,this.autoDestroy=e?.autoDestroy??!0,this.emitClose=e?.emitClose??!0,e?.read&&(this._read=e.read.bind(this),this._pushMode=!0),e?.stream)this._stream=e.stream,this._webStreamMode=!0;else{let e;this._stream=new ReadableStream({start:t=>{e=t},pull:async()=>{this.emit(`drain`)},cancel:e=>{this._ended=!0,this._aborted=!0,this.emitClose&&this.emit(`close`)}}),this._controller=e}}static from(t,n){let r=new e({...n,objectMode:n?.objectMode??!0});return lt(r,ct(t)),r}static isDisturbed(e){return e._didRead||e._ended||e._destroyed}static fromWeb(t,n){return new e({...n,stream:t})}static toWeb(e){return e.webStream}push(e){if(this._destroyed)return!1;this._pushMode=!0;let t=this._controller;if(e===null){if(this._ended)return!1;if(this._ended=!0,t)try{t.close()}catch{}return this._bufferedLength()===0&&this._emitEndOnce(),!1}if(t&&!this._webStreamMode)try{t.enqueue(e)}catch{}if(this._flowing)return this.emit(`data`,this._applyEncoding(e)),this._flowing?(this._read&&!this._ended&&queueMicrotask(()=>{this._flowing&&!this._ended&&!this._destroyed&&this._read(this.readableHighWaterMark)}),!0):!1;{let t=this._bufferedLength()===0;return this._buffer.push(e),this.objectMode||(this._bufferSize+=this._getChunkSize(e)),t&&queueMicrotask(()=>this.emit(`readable`)),this.objectMode?this._bufferedLength()<this.readableHighWaterMark:this._bufferSize<this.readableHighWaterMark}}_emitEndOnce(){this._endEmitted||(this._endEmitted=!0,this.emit(`end`))}unshift(e){this._destroyed||(this._bufferUnshift(e),this.objectMode||(this._bufferSize+=this._getChunkSize(e)))}read(e){if(this._didRead=!0,this._bufferedLength()>0){if(this.objectMode||e===void 0){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e));let t=this._applyEncoding(e);return this._ended&&this._bufferedLength()===0&&queueMicrotask(()=>this._emitEndOnce()),t}let t=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(t));let n=this._applyEncoding(t);return this._ended&&this._bufferedLength()===0&&queueMicrotask(()=>this._emitEndOnce()),n}return null}_bufferedLength(){return this._unshiftBuffer.length+(this._buffer.length-this._bufferIndex)}_bufferPeek(){let e=this._unshiftBuffer.length;return e>0?this._unshiftBuffer[e-1]:this._bufferIndex<this._buffer.length?this._buffer[this._bufferIndex]:null}_bufferShift(){if(this._unshiftBuffer.length>0)return this._unshiftBuffer.pop();let e=this._buffer[this._bufferIndex++];return this._bufferIndex===this._buffer.length?(this._buffer.length=0,this._bufferIndex=0,e):(this._bufferIndex>1024&&this._bufferIndex*2>this._buffer.length&&(this._buffer=this._buffer.slice(this._bufferIndex),this._bufferIndex=0),e)}_bufferUnshift(e){if(this._bufferIndex===0){this._unshiftBuffer.push(e);return}this._bufferIndex--,this._buffer[this._bufferIndex]=e}_getChunkSize(e){return e instanceof Uint8Array?e.byteLength:1}setEncoding(e){return this._encoding=e,e===`utf-8`||e===`utf8`?this._decoder=Xe:this._decoder=null,this}_applyEncoding(e){return this._encoding&&e instanceof Uint8Array?(this._decoder||=Qe(this._encoding),this._decoder.decode(e)):e}wrap(e){return e.on(`data`,t=>{this.push(t)||e.pause()}),e.on(`end`,()=>this.push(null)),e.on(`error`,e=>this.destroy(e)),e.on(`close`,()=>this.destroy()),this}pause(){return this._paused=!0,this._flowing=!1,this}resume(){for(this._paused=!1,this._flowing=!0;this._bufferedLength()>0&&this._flowing;){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e)),this.emit(`data`,this._applyEncoding(e))}return this._ended&&this._bufferedLength()===0?this._emitEndOnce():this._read?queueMicrotask(()=>{this._flowing&&!this._ended&&!this._destroyed&&this._read(this.readableHighWaterMark)}):this._webStreamMode&&!this._pushMode&&this._startReading(),this}on(e,t){return super.on(e,t),e===`data`&&this.resume(),this}isPaused(){return this._paused}pipe(e){let t=e,n=t,r=typeof t?.write==`function`,i=typeof t?.end==`function`,a=typeof n?.on==`function`,o=typeof n?.once==`function`,s=typeof n?.off==`function`;if(!r||!i||!o&&!a||!s&&!n?.removeListener)throw Error(`Readable.pipe: invalid destination`);this._pipeTo.push(t);let c,l=()=>{c&&=(typeof n.off==`function`?n.off(`drain`,c):typeof n.removeListener==`function`&&n.removeListener(`drain`,c),void 0)},u=e=>{if(!t.write(e)&&(this.pause(),!c)){c=()=>{l(),this.resume()},n.on(`drain`,c);let e=this._pipeListeners.get(t);e&&(e.drain=c)}},d=()=>{t.end()},f=e=>{typeof t.destroy==`function`?t.destroy(e):n.emit?.(`error`,e)};return this._pipeListeners.set(t,{data:u,end:d,error:f,eventTarget:n}),this.on(`data`,u),this.once(`end`,d),this.once(`error`,f),this.resume(),e}unpipe(e){if(e){let t=this._pipeTo.indexOf(e);t!==-1&&this._pipeTo.splice(t,1);let n=this._pipeListeners.get(e);n&&(this.off(`data`,n.data),this.off(`end`,n.end),this.off(`error`,n.error),n.drain&&(typeof n.eventTarget?.off==`function`?n.eventTarget.off(`drain`,n.drain):typeof n.eventTarget?.removeListener==`function`&&n.eventTarget.removeListener(`drain`,n.drain)),this._pipeListeners.delete(e))}else{for(let e of this._pipeTo){let t=this._pipeListeners.get(e);t&&(this.off(`data`,t.data),this.off(`end`,t.end),this.off(`error`,t.error),t.drain&&(typeof t.eventTarget?.off==`function`?t.eventTarget.off(`drain`,t.drain):typeof t.eventTarget?.removeListener==`function`&&t.eventTarget.removeListener(`drain`,t.drain)),this._pipeListeners.delete(e))}this._pipeTo=[]}return this.pause(),this}destroy(e){if(this._destroyed)return this;if(this._destroyed=!0,this._ended=!0,this.unpipe(),e&&(this._errored=e,this.emit(`error`,e)),this._reader){let e=this._reader;this._reader=null,e.cancel().catch(()=>{}).finally(()=>{try{e.releaseLock()}catch{}})}return this._closed=!0,this.emit(`close`),this}get webStream(){return this._stream}get readable(){return!this._destroyed&&!this._ended}get readableEnded(){return this._ended}get readableLength(){return this._bufferedLength()}get destroyed(){return this._destroyed}get errored(){return this._errored}get closed(){return this._closed}get readableFlowing(){return!this._paused&&!this._ended?this._flowing:this._flowing?!0:null}get readableAborted(){return this._aborted}get readableDidRead(){return this._didRead}get readableEncoding(){return this._encoding}get readableObjectMode(){return this.objectMode}get readableBuffer(){return{length:this._bufferedLength(),head:this._bufferPeek()}}async _startReading(){if(!(this._reading||this._destroyed||!this._flowing)){this._reading=!0;try{for(this._reader||=this._stream.getReader();this._flowing&&!this._destroyed&&!this._pushMode;){let{done:e,value:t}=await this._reader.read();if(this._pushMode){if(this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}break}if(e){if(this._ended=!0,this._emitEndOnce(),this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}break}t!==void 0&&(this._flowing?this.emit(`data`,this._applyEncoding(t)):(this._buffer.push(t),this.objectMode||(this._bufferSize+=this._getChunkSize(t))))}}catch(e){if(this.emit(`error`,e),this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}}finally{this._reading=!1}}}async*[Symbol.asyncIterator](){for(;this._bufferedLength()>0;){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e)),yield this._applyEncoding(e)}if(this._ended)return;let e=this.readableHighWaterMark,t=Math.max(0,Math.floor(e/2)),n=e=>this.objectMode?1:e instanceof Uint8Array?e.byteLength:typeof e==`string`?e.length:1,r=[],i=0,a=0,o=null,s=null,c=!1,l=!1,u=null,d=t=>{o?(o(t),o=null,s=null):r.push(t),a+=n(t),!l&&a>=e&&(l=!0,this.pause())},f=()=>{c=!0,o&&(o(null),o=null,s=null)},p=()=>{c=!0,o&&(o(null),o=null,s=null)},m=e=>{c=!0,u=e,s&&=(s(e),o=null,null)};this.on(`data`,d),this.on(`end`,f),this.on(`error`,m),this.on(`close`,p);try{for(this.resume();;){if(u)throw u;if(i<r.length){let e=r[i++];a-=n(e),i>=1024&&i*2>=r.length&&(r.splice(0,i),i=0),l&&a<=t&&!c&&!this._destroyed&&(l=!1,this.resume()),yield e;continue}if(c)break;let e=await new Promise((e,t)=>{o=e,s=t});e!==null&&(a-=n(e),l&&a<=t&&!c&&!this._destroyed&&(l=!1,this.resume()),yield e)}}finally{this.off(`data`,d),this.off(`end`,f),this.off(`error`,m),this.off(`close`,p)}}iterator(e){let t=e?.destroyOnReturn??!0,n=this[Symbol.asyncIterator]();return t?{next:async()=>n.next(),return:async e=>(this.destroy(),{done:!0,value:e}),[Symbol.asyncIterator](){return this}}:n}async*map(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);yield await e(t,{signal:n})}}async*filter(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);await e(t,{signal:n})&&(yield t)}}async*flatMap(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);let r=await e(t,{signal:n});for await(let e of r)yield e}}async*take(e,t){let n=t?.signal,r=0;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(r>=e)break;yield t,r++}}async*drop(e,t){let n=t?.signal,r=0;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);r>=e&&(yield t),r++}}async reduce(e,t,n){let r=n?.signal,i=t,a=!0;for await(let t of this){if(r?.aborted)throw Error(`AbortError`);a&&i===void 0?(i=t,a=!1):i=await e(i,t,{signal:r})}if(i===void 0)throw TypeError(`Reduce of empty stream with no initial value`);return i}async every(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(!await e(t,{signal:n}))return!1}return!0}async some(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(await e(t,{signal:n}))return!0}return!1}async find(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(await e(t,{signal:n}))return t}}async forEach(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);await e(t,{signal:n})}}async toArray(e){let t=e?.signal,n=[];for await(let e of this){if(t?.aborted)throw Error(`AbortError`);n.push(e)}return n}async*asIndexedPairs(e){let t=e?.signal,n=0;for await(let e of this){if(t?.aborted)throw Error(`AbortError`);yield[n++,e]}}compose(t){if(typeof t==`function`){let n=t(this);return e.from(n)}return this.pipe(t),t}};function ct(e){return e&&typeof e[Symbol.asyncIterator]==`function`?e:(async function*(){for(let t of e)yield t})()}function lt(e,t){(async()=>{try{for await(let n of t)e.push(n)||await new Promise(e=>setTimeout(e,0));e.push(null)}catch(t){e.destroy(t)}})()}var P=class e extends M{constructor(e){if(super(),this._writer=null,this._ended=!1,this._finished=!1,this._destroyed=!1,this._errored=null,this._closed=!1,this._pendingWrites=0,this._writableLength=0,this._needDrain=!1,this._corked=0,this._corkedChunks=[],this._defaultEncoding=`utf8`,this._aborted=!1,this._ownsStream=!1,this.objectMode=e?.objectMode??!1,this.writableHighWaterMark=e?.highWaterMark??16384,this.autoDestroy=e?.autoDestroy??!0,this.emitClose=e?.emitClose??!0,this._defaultEncoding=e?.defaultEncoding??`utf8`,e?.write&&(this._writeFunc=e.write.bind(this)),e?.final&&(this._finalFunc=e.final.bind(this)),e?.stream)this._stream=e.stream,this._ownsStream=!1;else{this._ownsStream=!0;let e=()=>this._writeFunc,t=()=>this._finalFunc,n=()=>this._defaultEncoding,r=e=>{this._finished=e},i=e=>{this._aborted=e},a=this.emit.bind(this),o=()=>this.emitClose,s=e=>this._write?.(e);this._stream=new WritableStream({write:async t=>{let r=e();r?await new Promise((e,i)=>{r(t,n(),t=>{t?i(t):e()})}):s(t)},close:async()=>{let e=t();e&&await new Promise((t,n)=>{e(e=>{e?n(e):t()})}),r(!0),a(`finish`),o()&&a(`close`)},abort:e=>{i(!0),a(`error`,e)}})}}setDefaultEncoding(e){return this._defaultEncoding=e,this}cork(){this._corked++}uncork(){if(this._corked>0&&this._corked--,this._corked===0){let e=this._corkedChunks;this._corkedChunks=[];for(let{chunk:t,callback:n}of e)this._doWrite(t,n)}}write(e,t,n){if(this._destroyed||this._ended)return(typeof t==`function`?t:n)?.(Error(`Cannot write after stream destroyed/ended`)),!1;let r=typeof t==`function`?t:n;if(this._corked>0){this._corkedChunks.push({chunk:e,callback:r});let t=this._getChunkSize(e);return this._writableLength+=t,this._writableLength<this.writableHighWaterMark}let i=this._doWrite(e,r);return i||(this._needDrain=!0),i}_doWrite(e,t){let n=this._getChunkSize(e);return this._pendingWrites++,this._writableLength+=n,this._getWriter().write(e).then(()=>{this._pendingWrites--,this._writableLength-=n,this._needDrain&&this._writableLength<this.writableHighWaterMark&&(this._needDrain=!1,this.emit(`drain`)),t?.(null)}).catch(e=>{this._pendingWrites--,this._writableLength-=n,this._destroyed||(this._errored=e,this.emit(`error`,e)),t?.(e)}),this._writableLength<this.writableHighWaterMark}_getChunkSize(e){return this.objectMode?1:e instanceof Uint8Array?e.byteLength:typeof e==`string`?e.length:0}end(e,t,n){if(this._ended)return this;this._ended=!0;let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return(async()=>{try{let e=this._getWriter();if(r!==void 0&&await e.write(r),await e.close(),this._writer===e){this._writer=null;try{e.releaseLock()}catch{}}this._ownsStream||(this._finished=!0,this.emit(`finish`),this.emitClose&&this.emit(`close`)),i&&i()}catch(e){this.emit(`error`,e)}})(),this}destroy(e){if(this._destroyed)return this;if(this._destroyed=!0,this._ended=!0,e&&!this._errored&&(this._errored=e,this.emit(`error`,e)),this._writer){let t=this._writer;this._writer=null,t.abort(e).catch(()=>{}).finally(()=>{try{t.releaseLock()}catch{}})}return this._closed=!0,this.emit(`close`),this}get webStream(){return this._stream}get writable(){return!this._destroyed&&!this._ended}get writableEnded(){return this._ended}get writableFinished(){return this._finished}get writableLength(){return this._writableLength}get destroyed(){return this._destroyed}get errored(){return this._errored}get closed(){return this._closed}get writableNeedDrain(){return this._writableLength>=this.writableHighWaterMark}get writableCorked(){return this._corked}get writableAborted(){return this._aborted}get writableObjectMode(){return this.objectMode}get defaultEncoding(){return this._defaultEncoding}get writableBuffer(){return{length:this._corkedChunks.length,head:this._corkedChunks.length>0?this._corkedChunks[0].chunk:null}}_writev(e,t){let n=0,r=()=>{if(n>=e.length){t(null);return}let{chunk:i}=e[n++];this._doWrite(i,e=>{if(e){t(e);return}r()})};r()}writev(e,t){return this._destroyed||this._ended?(t?.(Error(`Cannot write after stream destroyed/ended`)),!1):(this._writev(e,t??(()=>{})),this._writableLength<this.writableHighWaterMark)}_getWriter(){return this._writer||=this._stream.getWriter(),this._writer}static fromWeb(t,n){return new e({...n,stream:t})}static toWeb(e){return e.webStream}};function ut(e){return e instanceof P?e:e?.getWriter?new P({stream:e}):e}var dt=class e extends M{push(e){return this._readable.push(e)}constructor(e){super(),this._destroyed=!1,this._ended=!1,this._errored=!1,this._dataForwardingSetup=!1,this._endTimer=null,this._webStream=null,this._sideForwardingCleanup=null,this.objectMode=e?.objectMode??!1,this._transformImpl=e?.transform,this._flushImpl=e?.flush,this._readable=new N({objectMode:this.objectMode}),this._writable=new P({objectMode:this.objectMode,write:(e,t,n)=>{this._runTransform(e).then(()=>n(null)).catch(e=>n(e))},final:e=>{this._runFlush().then(()=>{this._readable.push(null),e(null)}).catch(t=>e(t))}}),this._setupSideForwarding()}_setupSideForwarding(){this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null);let e=st();e.once(this._readable,`end`,()=>this.emit(`end`)),e.add(this._readable,`error`,e=>this._emitErrorOnce(e)),e.once(this._writable,`finish`,()=>this.emit(`finish`)),e.add(this._writable,`drain`,()=>this.emit(`drain`)),e.add(this._writable,`error`,e=>this._emitErrorOnce(e)),this._sideForwardingCleanup=()=>e.cleanup()}_scheduleEnd(){this._destroyed||this._errored||this._writable.writableEnded||(this._endTimer&&clearTimeout(this._endTimer),this._endTimer=setTimeout(()=>{this._endTimer=null,!(this._destroyed||this._errored||this._writable.writableEnded)&&this._writable.end()},0))}_emitErrorOnce(e){if(this._errored)return;this._errored=!0;let t=e instanceof Error?e:Error(String(e));this.emit(`error`,t),this._destroyed||(this._destroyed=!0,this._readable.destroy(t),this._writable.destroy(t),queueMicrotask(()=>this.emit(`close`)))}_hasSubclassTransform(){return this._transformImpl?!1:Object.getPrototypeOf(this)._transform!==e.prototype._transform}_hasSubclassFlush(){return this._flushImpl?!1:Object.getPrototypeOf(this)._flush!==e.prototype._flush}async _runTransform(e){if(this._destroyed||this._errored)throw Error(this._errored?`Cannot write after stream errored`:`Cannot write after stream destroyed`);try{if(this._hasSubclassTransform()){await new Promise((t,n)=>{this._transform(e,`utf8`,(e,r)=>{if(e){n(e);return}r!==void 0&&this.push(r),t()})});return}let t=this._transformImpl;if(!t){this.push(e);return}let n=t.length;if(n>=3){await new Promise((n,r)=>{t.call(this,e,`utf8`,(e,t)=>{if(e){r(e);return}t!==void 0&&this.push(t),n()})});return}if(n===2){await new Promise((n,r)=>{t.call(this,e,(e,t)=>{if(e){r(e);return}t!==void 0&&this.push(t),n()})});return}let r=t.call(this,e);if(r&&typeof r.then==`function`){let e=await r;e!==void 0&&this.push(e);return}r!==void 0&&this.push(r)}catch(e){throw this._emitErrorOnce(e),e}}async _runFlush(){if(!(this._destroyed||this._errored))try{if(this._hasSubclassFlush()){await new Promise((e,t)=>{this._flush((n,r)=>{if(n){t(n);return}r!==void 0&&this.push(r),e()})});return}let e=this._flushImpl;if(!e)return;if(e.length>=1){await new Promise((t,n)=>{e.call(this,(e,r)=>{if(e){n(e);return}r!==void 0&&this.push(r),t()})});return}let t=e.call(this);if(t&&typeof t.then==`function`){let e=await t;e!=null&&this.push(e);return}t!=null&&this.push(t)}catch(e){throw this._emitErrorOnce(e),e}}on(e,t){return e===`data`&&!this._dataForwardingSetup&&(this._dataForwardingSetup=!0,this._readable.on(`data`,e=>this.emit(`data`,e))),super.on(e,t)}write(e,t,n){let r=typeof t==`function`?t:n;return this._ended&&!this._writable.writableEnded&&this._scheduleEnd(),this._writable.write(e,r)}end(e,t,n){if(this._ended)return this;this._ended=!0;let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return i&&this.once(`finish`,i),r!==void 0&&this._writable.write(r),this._scheduleEnd(),this}read(e){return this._readable.read(e)}pipe(e){return this._readable.pipe(e)}unpipe(e){return this._readable.unpipe(e),this}isPaused(){return this._readable.isPaused()}resume(){return this._readable.resume(),this}pause(){return this._readable.pause(),this}destroy(e){this._destroyed||(this._destroyed=!0,this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null),this._readable.destroy(e),this._writable.destroy(e),queueMicrotask(()=>this.emit(`close`)))}get webStream(){if(this._webStream)return this._webStream;let e=this[Symbol.asyncIterator]();return this._webStream={readable:new ReadableStream({pull:async t=>{let{done:n,value:r}=await e.next();if(n){t.close();return}t.enqueue(r)},cancel:e=>{this.destroy(e instanceof Error?e:Error(String(e)))}}),writable:new WritableStream({write:e=>new Promise((t,n)=>{this.write(e,e=>{e?n(e):t()})}),close:()=>new Promise(e=>{this.end(()=>e())}),abort:e=>{this.destroy(e instanceof Error?e:Error(String(e)))}})},this._webStream}get readable(){return this._readable.readable}get writable(){return this._writable.writable}get readableEnded(){return this._readable.readableEnded}get writableEnded(){return this._writable.writableEnded}get writableFinished(){return this._writable.writableFinished}get readableLength(){return this._readable.readableLength}get writableLength(){return this._writable.writableLength}get readableHighWaterMark(){return this._readable.readableHighWaterMark}get writableHighWaterMark(){return this._writable.writableHighWaterMark}get readableObjectMode(){return this._readable.readableObjectMode??this._readable.objectMode}get readableFlowing(){return this._readable.readableFlowing}get destroyed(){return this._destroyed}async*[Symbol.asyncIterator](){yield*this._readable[Symbol.asyncIterator]()}static fromWeb(t,n){let r=new e(n);r._webStream=t;let i=N.fromWeb(t.readable,{objectMode:n?.objectMode}),a=P.fromWeb(t.writable,{objectMode:n?.objectMode});return r._sideForwardingCleanup&&=(r._sideForwardingCleanup(),null),r._readable=i,r._writable=a,r._setupSideForwarding(),r}static toWeb(e){return e.webStream}_transform(e,t,n){n(null,e)}_flush(e){e()}},ft=class e extends M{static from(t){if(t instanceof e)return t;let n=(e,t)=>{let n=new P({objectMode:t.readableObjectMode,write(e,n,r){t.push(e),r()},final(e){t.push(null),e()}}),r=ot(e,`error`,e=>{t.emit(`error`,e)});ot(e,`end`,r,{once:!0}),ot(e,`close`,r,{once:!0}),ot(n,`finish`,r,{once:!0}),e.pipe(n)};if(typeof t==`object`&&t&&`readable`in t&&`writable`in t){let r=t,i=new e({readableObjectMode:r.readable?.readableObjectMode,writableObjectMode:r.writable?.writableObjectMode,write:r.writable?(e,t,n)=>{r.writable.write(e,t,n)}:void 0,final:r.writable?e=>{r.writable.end(e)}:void 0});return r.readable&&n(r.readable,i),i}if(typeof t==`object`&&t&&(Symbol.asyncIterator in t||Symbol.iterator in t)){let r=N.from(t),i=new e;return n(r,i),i}if(t instanceof N){let r=new e;return n(t,r),r}if(t instanceof P)return new e({objectMode:!0,write(e,n,r){t.write(e,n,r)},final(e){t.end(e)}});throw Error(`Duplex.from: unsupported source type`)}static fromWeb(t,n){let r=new e(n),i=new N({stream:t.readable,objectMode:r.readableObjectMode}),a=new P({stream:t.writable,objectMode:r.writableObjectMode});return r._sideForwardingCleanup&&=(r._sideForwardingCleanup(),null),r._readable=i,r._writable=a,r._setupSideForwarding(),r}static toWeb(e){return{readable:e._readable.webStream,writable:e._writable.webStream}}constructor(e){super(),this._dataForwardingSetup=!1,this._sideForwardingCleanup=null,this.allowHalfOpen=e?.allowHalfOpen??!0;let t=e?.objectMode??!1;this.readableObjectMode=e?.readableObjectMode??t,this.writableObjectMode=e?.writableObjectMode??t,this._readable=new N({highWaterMark:e?.readableHighWaterMark,objectMode:this.readableObjectMode,read:e?.read?.bind(this)}),this._writable=new P({highWaterMark:e?.writableHighWaterMark,objectMode:this.writableObjectMode,write:e?.write?.bind(this),final:e?.final?.bind(this)}),this._setupSideForwarding()}_setupSideForwarding(){this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null);let e=st();e.once(this._readable,`end`,()=>{this.emit(`end`),this.allowHalfOpen||this._writable.end()}),e.add(this._readable,`error`,e=>this.emit(`error`,e)),e.add(this._writable,`error`,e=>this.emit(`error`,e)),e.once(this._writable,`finish`,()=>this.emit(`finish`)),e.add(this._writable,`drain`,()=>this.emit(`drain`)),e.once(this._writable,`close`,()=>{!this.allowHalfOpen&&!this._readable.destroyed&&this._readable.destroy()}),this._sideForwardingCleanup=()=>e.cleanup()}on(e,t){return e===`data`&&!this._dataForwardingSetup&&(this._dataForwardingSetup=!0,this._readable.on(`data`,e=>this.emit(`data`,e))),super.on(e,t)}push(e){return this._readable.push(e)}unshift(e){this._readable.unshift(e)}read(e){return this._readable.read(e)}write(e,t,n){let r=typeof t==`function`?t:n;return this._writable.write(e,r)}end(e,t,n){let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return i&&this.once(`finish`,i),r!==void 0&&this._writable.write(r),this._writable.end(),this}cork(){this._writable.cork()}uncork(){this._writable.uncork()}setEncoding(e){return this._readable.setEncoding(e),this}setDefaultEncoding(e){return this._writable.setDefaultEncoding(e),this}pipe(e){return e instanceof dt?(this._readable.pipe(e._writable),e):(this._readable.pipe(e),e)}unpipe(e){return this._readable.unpipe(e),this}pause(){return this._readable.pause(),this}resume(){return this._readable.resume(),this}isPaused(){return this._readable.isPaused()}destroy(e){return this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null),this._readable.destroy(e),this._writable.destroy(e),this}get readable(){return this._readable.readable}get writable(){return this._writable.writable}get readableEnded(){return this._readable.readableEnded}get writableEnded(){return this._writable.writableEnded}get writableFinished(){return this._writable.writableFinished}get readableLength(){return this._readable.readableLength}get writableLength(){return this._writable.writableLength}get readableHighWaterMark(){return this._readable.readableHighWaterMark}get writableHighWaterMark(){return this._writable.writableHighWaterMark}get destroyed(){return this._readable.destroyed&&this._writable.destroyed}get writableCorked(){return this._writable.writableCorked}get writableNeedDrain(){return this._writable.writableNeedDrain}[Symbol.asyncIterator](){return this._readable[Symbol.asyncIterator]()}},pt=class extends dt{constructor(e){super({...e,transform:e=>e})}};let mt=e=>!e||typeof e!=`object`||typeof e.pipe==`function`||typeof e.write==`function`||typeof e.end==`function`||typeof e.getReader==`function`||typeof e.getWriter==`function`?!1:Object.prototype.hasOwnProperty.call(e,`signal`)||Object.prototype.hasOwnProperty.call(e,`end`),ht=e=>e instanceof N||e instanceof P||e instanceof dt||e instanceof ft?e:it(e)?dt.fromWeb(e):tt(e)?N.fromWeb(e):nt(e)?P.fromWeb(e):e;function gt(...e){let t,n={},r,i=e[e.length-1];typeof i==`function`?(r=i,t=e.slice(0,-1)):mt(i)?(n=i,t=e.slice(0,-1)):t=e;let a=new Promise((e,r)=>{if(t.length<2){r(Error(`Pipeline requires at least 2 streams`));return}let i=t.map(ht),a=i[0],o=i[i.length-1],s=i.slice(1,-1),c=!1,l=[a,...s,o],u=st(),d,f=t=>{if(!c)if(c=!0,u.cleanup(),d&&n.signal&&n.signal.removeEventListener(`abort`,d),t){for(let e of l)typeof e.destroy==`function`&&e.destroy(t);r(t)}else e()};if(n.signal){if(n.signal.aborted){f(Error(`Pipeline aborted`));return}d=()=>f(Error(`Pipeline aborted`)),n.signal.addEventListener(`abort`,d)}let p=a;for(let e of s)p.pipe(e),p=e;if(n.end!==!1)p.pipe(o);else{let e=!1,t=!1,n=()=>{t=!1,e&&typeof p.resume==`function`&&(e=!1,p.resume())};u.add(p,`data`,r=>{!o.write(r)&&!t&&(t=!0,!e&&typeof p.pause==`function`&&(e=!0,p.pause()),u.once(o,`drain`,n))}),u.once(p,`end`,()=>f())}u.once(o,`finish`,()=>f());for(let e of l)u.once(e,`error`,e=>f(e))});return r&&a.then(()=>r(null)).catch(e=>r(e)),a}function _t(e,t,n){let r={},i;typeof t==`function`?i=t:t&&(r=t,i=n);let a=new Promise((t,n)=>{let i=ht(e),a=!1,o=st(),s,c=()=>{o.cleanup(),s&&r.signal&&r.signal.removeEventListener(`abort`,s)},l=e=>{a||(a=!0,c(),e&&!r.error?n(e):t())};if(r.signal){if(r.signal.aborted){l(Error(`Aborted`));return}s=()=>l(Error(`Aborted`)),r.signal.addEventListener(`abort`,s)}let u=r.readable!==!1,d=r.writable!==!1;if(u&&i.readableEnded){l();return}if(d&&i.writableFinished){l();return}d&&o.once(i,`finish`,()=>l()),u&&o.once(i,`end`,()=>l()),o.once(i,`error`,e=>l(e)),o.once(i,`close`,()=>l())});return i&&a.then(()=>i(null)).catch(e=>i(e)),a}function vt(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}let yt={async hash(e,...t){let n=et(t),r=await crypto.subtle.digest(e,new Uint8Array(n));return new Uint8Array(r)},async convertPasswordToHash(e,t,n,r){let i=qe(e),a=Oe(n),o=await this.hash(t,a,i);for(let e=0;e<r;e++)o=await this.hash(t,o,vt(e));return Ke(o)},randomBytes(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}};var bt=class{constructor(e){this.code=e}toString(){return`#${this.code}`}};let xt={sum:`Sum`,count:`Count`,average:`Average`,max:`Max`,min:`Min`,product:`Product`,countNums:`Count Numbers`,stdDev:`StdDev`,stdDevP:`StdDevP`,var:`Var`,varP:`VarP`},St=new Set(Object.keys(xt));function Ct(e){let t=e.model;if(t.headerRow===!1)throw Error(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!t.rows||t.rows.length===0)throw Error(`Cannot create pivot table from an empty table. Add data rows to the table.`);let r=t.columns.map(e=>e.name),i=new Set;for(let e of r){if(i.has(e))throw Error(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);i.add(e)}let a=[void 0,...r],o=t.rows.map(e=>[void 0,...e]),s=t.tl;if(!s)throw Error(`Table "${t.name}" is missing top-left cell address (tl)`);let c=s.row,l=s.col,u=c+t.rows.length,d=l+r.length-1,f=n.encode(c,l,u,d);return{name:e.worksheet.name,tableName:t.name,getRow(e){if(e===1)return{values:a};let t=e-2;return t>=0&&t<o.length?{values:o[t]}:{values:[]}},getColumn(e){if(e<1||e>r.length)return{values:[]};let n=[];n[1]=r[e-1];for(let r=0;r<t.rows.length;r++)n[r+2]=t.rows[r][e-1];return{values:n}},getSheetValues(){let e=[];e[1]=a;for(let t=0;t<o.length;t++)e[t+2]=o[t];return e},dimensions:{shortRange:f}}}function wt(e){if(e.sourceSheet&&e.sourceTable)throw Error(`Cannot specify both sourceSheet and sourceTable. Choose one.`);if(e.sourceTable)return Ct(e.sourceTable);if(!e.sourceSheet)throw Error(`Either sourceSheet or sourceTable must be provided.`);return e.sourceSheet}function Tt(e){return typeof e==`string`?e:e.name}function Et(e){return typeof e==`string`?void 0:e.metric}function Dt(e,t){let n=wt(t);Ot(t,n);let{rows:r}=t,i=t.columns??[],a=t.pages??[],o=t.values.map(Tt),s=t.metric??`sum`,c=t.values.map(e=>Et(e)??s),l=At(n,[...r,...i,...a],o),u={};for(let e=0;e<l.length;e++)u[l[e].name]=e;let d=(e,t)=>{let n=u[e];if(n===void 0)throw Error(`${t} field "${e}" not found in cache fields`);return n},f=r.map(e=>d(e,`Row`)),p=i.map(e=>d(e,`Column`)),m=o.map(e=>d(e,`Value`)),h=a.map(e=>d(e,`Page`)),g=e.workbook.pivotTables.map(e=>e.tableNumber).filter(e=>Number.isFinite(e)),_=g.length>0?g.reduce((e,t)=>e>t?e:t,-1/0)+1:1,v=e.workbook.pivotTables.map(e=>parseInt(e.cacheId,10)).filter(e=>Number.isFinite(e)),y=v.length>0?v.reduce((e,t)=>e>t?e:t,-1/0)+1:10+_-1;return{source:n,rows:f,columns:p,values:m,pages:h,metric:s,valueMetrics:c,cacheFields:l,cacheId:String(y),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:_}}function Ot(e,t){let n=e.columns??[],r=e.pages??[],i=e.values.map(Tt),a=t.getRow(1).values.slice(1);for(let e=0;e<a.length;e++){let n=a[e];if(n==null||n===``||typeof n==`string`&&n.trim()===``)throw Error(`Empty or missing header name at column ${e+1} in ${t.name}. Pivot tables require all columns to have non-empty headers.`)}let o=new Set;for(let e of a){let n=String(e);if(o.has(n))throw Error(`Duplicate header name "${n}" found in ${t.name}. Pivot tables require unique column names.`);o.add(n)}let s=new Set(a.map(String)),c=e=>{if(!s.has(e))throw Error(`The header name "${e}" was not found in ${t.name}.`)};for(let t of e.rows)c(t);for(let e of n)c(e);for(let e of i)c(e);for(let e of r)c(e);let l=new Map,u=[{name:`rows`,fields:e.rows},{name:`columns`,fields:n},{name:`pages`,fields:r}];for(let e of u)for(let t of e.fields){let n=l.get(t);if(n===e.name)throw Error(`Duplicate field "${t}" in ${e.name}. Each field can only appear once per axis area.`);if(n)throw Error(`Field "${t}" cannot appear in both ${n} and ${e.name}. Each field can only be assigned to one axis area.`);l.set(t,e.name)}if(!e.rows.length)throw Error(`No pivot table rows specified.`);if(e.values.length<1)throw Error(`Must have at least one value.`);if(e.metric!==void 0&&!St.has(e.metric))throw Error(`Invalid metric "${e.metric}". Must be one of: ${[...St].join(`, `)}.`);for(let t of e.values){let e=Et(t);if(e!==void 0&&!St.has(e))throw Error(`Invalid metric "${e}" on value field "${Tt(t)}". Must be one of: ${[...St].join(`, `)}.`)}let d=new Set;for(let e of i){if(d.has(e))throw Error(`Duplicate value field "${e}". Each value field name must be unique.`);d.add(e)}}function kt(e){if(e==null)return null;if(typeof e!=`object`||e instanceof Date||e instanceof bt)return e;let t=e;if(typeof t.error==`string`){let e=t.error;return new bt(e.startsWith(`#`)?e.slice(1):e)}if(`formula`in t||`sharedFormula`in t){let e=t.result;return e==null?null:kt(e)}return Array.isArray(t.richText)?t.richText.map(e=>e.text??``).join(``):typeof t.text==`string`&&typeof t.hyperlink==`string`?t.text:typeof t.checkbox==`boolean`?t.checkbox:String(e)}function At(e,t,n){let r=e.getRow(1).values,i=new Set(t),a=new Set(n),o=t=>{let n=e.getColumn(t).values,r=new Set,i=new Map,a=!1;for(let e=2;e<n.length;e++){let t=kt(n[e]);t===null||typeof t==`number`&&isNaN(t)?a=!0:t instanceof bt?i.has(t.code)||(i.set(t.code,t),r.add(t)):r.add(t)}let o=Ve(r);return a&&o.push(null),o},s=t=>{let n=e.getColumn(t).values,r=1/0,i=-1/0,a=!1,o=!0;for(let e=2;e<n.length;e++){let t=kt(n[e]);typeof t==`number`&&!isNaN(t)&&(a=!0,t<r&&(r=t),t>i&&(i=t),Number.isInteger(t)||(o=!1))}return a?{minValue:r,maxValue:i,allInteger:o}:null},c=[];for(let e of Be(1,r.length)){let t=r[e],n=String(t);if(i.has(n))c.push({name:n,sharedItems:o(e)});else if(a.has(n)){let t=s(e);c.push({name:n,sharedItems:null,containsNumber:t?`1`:void 0,minValue:t?.minValue,maxValue:t?.maxValue,containsInteger:t?.allInteger?`1`:void 0})}else c.push({name:n,sharedItems:null})}return c}function jt(e,t,n,r,i){let a=i(e,t)?.style?.border,o=r-t+1,s=n-e+1,c=Array(o),l=Array(o),u=Array(s),d=Array(s),f=!1;for(let o=t;o<=r;o++){let r=o-t,s=i(e,o)?.style?.border;c[r]=s?.top||a?.top,n===e?l[r]=s?.bottom||a?.bottom:l[r]=i(n,o)?.style?.border?.bottom||a?.bottom,(c[r]||l[r])&&(f=!0)}for(let o=e;o<=n;o++){let n=o-e,s=i(o,t)?.style?.border;u[n]=s?.left||a?.left,r===t?d[n]=s?.right||a?.right:d[n]=i(o,r)?.style?.border?.right||a?.right,(u[n]||d[n])&&(f=!0)}let p=a?.diagonal,m=a?.color;if(!(!f&&!p))return{topEdges:c,bottomEdges:l,leftEdges:u,rightEdges:d,diagonal:p,color:m}}function Mt(e,t,n,r,i,a){let{topEdges:o,bottomEdges:s,leftEdges:c,rightEdges:l,diagonal:u,color:d}=i,f=a(e,t).style;for(let i=e;i<=n;i++)for(let p=t;p<=r;p++){let m=a(i,p),h=k(f)||{},g={},_=!1;i===e&&o[p-t]&&(g.top=o[p-t],_=!0),i===n&&s[p-t]&&(g.bottom=s[p-t],_=!0),p===t&&c[i-e]&&(g.left=c[i-e],_=!0),p===r&&l[i-e]&&(g.right=l[i-e],_=!0),u&&(g.diagonal=u,_=!0),_?(d&&(g.color=d),h.border=g):delete h.border,m.style=h}}var Nt=class{constructor(e){e||={},this._workbook=e.workbook,this.id=e.id??0,this.orderNo=e.orderNo??0,this.name=e.name||`sheet${this.id}`,this.state=e.state??`visible`,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.colBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:void 0,verticalDpi:void 0,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.dataValidations=new ye,this.views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[],this.formControls=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name!==e){if(typeof e!=`string`)throw Error(`The name has to be a string.`);if(e===``)throw Error(`The name can't be empty.`);if(e===`History`)throw Error(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw Error(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw Error(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);if(e&&e.length>31&&(e=e.substring(0,31)),this._workbook.worksheets.find(t=>t&&t.name.toLowerCase()===e.toLowerCase()))throw Error(`Worksheet name already exists: ${e}`);this._name=e}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new r;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:t.header?1:0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new fe(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){let t;if(typeof e==`string`){let r=this._keys[e];if(r)return r;t=n.l2n(e)}else t=e;if(this._columns||=[],t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new fe(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===u.ValueType.Merge&&e.unmerge()}let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]??null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns?this._columns.length:0;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;if(this.workbook.definedNames.spliceColumns(this.name,e,t,n.length),i!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeCol>=e-1&&(n.nativeCol=Math.max(0,n.nativeCol+i)),r&&r.nativeCol>=e-1&&(r.nativeCol=Math.max(0,r.nativeCol+i))}}this._spliceMerges(`col`,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new de(this,e),t}getRows(e,t){if(t<1)return;let n=[];for(let r=e;r<e+t;r++)n.push(this.getRow(r));return n}addRow(e,t=`n`){let n=this._nextRow,r=this.getRow(n);return r.values=e,this._setStyleOption(n,t[0]===`i`?t:`n`),r}addRows(e,t=`n`){let n=[];return e.forEach(e=>{n.push(this.addRow(e,t))}),n}insertRow(e,t,n=`n`){return this.spliceRows(e,0,t),this._setStyleOption(e,n),this.getRow(e)}insertRows(e,t,n=`n`){if(this.spliceRows(e,0,...t),n!==`n`)for(let r=0;r<t.length;r++)n[0]===`o`&&this.findRow(t.length+e+r)!==void 0?this._copyStyle(t.length+e+r,e+r,n[1]===`+`):n[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e+r,n[1]===`+`);return this.getRows(e,t.length)}_setStyleOption(e,t=`n`){t[0]===`o`&&this.findRow(e+1)!==void 0?this._copyStyle(e+1,e,t[1]===`+`):t[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e,t[1]===`+`)}_copyStyle(e,t,n=!1){let r=this.getRow(e),i=this.getRow(t);i.style=k(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=k(e.style)}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this._rows[e-1],i=Array.from({length:t}).fill(r.values),a=[];for(let t of Object.values(this._merges))t.top===e&&t.bottom===e&&a.push(t);let o=[],s=e-1;for(let e of this._media)e.type===`image`&&e.range&&e.range.tl.nativeRow===s&&o.push(e);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=k(r.style)??{},t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=k(e.style)??{}})}if(a.length>0)for(let r=0;r<t;r++){let t=e+1+r;if(!n){let e=[];for(let[n,r]of Object.entries(this._merges))r.top<=t&&r.bottom>=t&&e.push(n);for(let t of e)this._unMergeMaster(this.getCell(t))}for(let e of a)this.mergeCellsWithoutStyle(t,e.left,t,e.right)}if(!n){let n=e,r=e+t-1;this._media=this._media.filter(e=>{if(e.type===`image`&&e.range){let t=e.range.tl.nativeRow;return t<n||t>r}return!0})}for(let e=0;e<t;e++){let t=e+1;for(let e of o){let n=e.clone();if(n.range.tl.nativeRow=s+t,n.range.br){let r=e.range.br.nativeRow-s;n.range.br.nativeRow=s+t+r}this._media.push(n)}}}spliceRows(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===u.ValueType.Merge&&e.unmerge()}let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=k(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=k(t.style)??{}}),this._rows[s-1]=void 0}else this._rows[s+a-1]=void 0;else if(a>0)for(s=o;s>=r;s--)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=k(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=k(t.style)??{}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}if(this.workbook.definedNames.spliceRows(this.name,e,t,i),a!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeRow>=e-1&&(n.nativeRow=Math.max(0,n.nativeRow+a)),r&&r.nativeRow>=e-1&&(r.nativeRow=Math.max(0,r.nativeRow+a))}}this._spliceMerges(`row`,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let r=n.getAddress(e,t),i=this._rows[r.row-1];return i?i.findCell(r.col):void 0}getCell(e,t){let r=n.getAddress(e,t);return this.getRow(r.row).getCellEx(r)}mergeCells(...e){let t=new r(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new r(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw Error(`Cannot merge already merged cells`)});let{top:n,left:r,bottom:i,right:a}=e,o=t?void 0:jt(n,r,i,a,(e,t)=>this.findCell(e,t)),s=this.getCell(e.top,e.left);for(let e=n;e<=i;e++)for(let i=r;i<=a;i++)(e>n||i>r)&&this.getCell(e,i).merge(s,t);o&&Mt(n,r,i,a,o,(e,t)=>this.getCell(e,t)),this._merges[s.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}_spliceMerges(e,t,i,a){let o=a-i;if(o===0&&i===0)return;let s=t+i,c=e===`row`,l={};for(let e of Object.values(this._merges)){let{top:a,left:u,bottom:d,right:f}=e.model,p=c?a:u,m=c?d:f;if(o<=0&&i>0){let i=s-1;if(p>i){let e=c?new r(a+o,u,d+o,f):new r(a,u+o,d,f+o);l[n.encodeAddress(e.top,e.left)]=e}else if(m<t)l[n.encodeAddress(a,u)]=e;else if(!(p>=t&&m<=i)){let e=a,i=u,s=d,p=f;c?(e=a<t?a:t,s=Math.max(e,d+o)):(i=u<t?u:t,p=Math.max(i,f+o));let m=new r(e,i,s,p);e===s&&i===p||(l[n.encodeAddress(m.top,m.left)]=m)}}else if(p>=s){let e=c?new r(a+o,u,d+o,f):new r(a,u+o,d,f+o);l[n.encodeAddress(e.top,e.left)]=e}else m<s||(c?e.model.bottom=d+o:e.model.right=f+o),l[n.encodeAddress(a,u)]=e}this._merges=l;for(let e of Object.values(l)){let t=this.getCell(e.top,e.left);for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++)(n>e.top||r>e.left)&&this.getCell(n,r).merge(t,!0)}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new r(e);for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++){let t=this.findCell(e,n);t&&(t.type===u.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,t,r,i=`shared`){let{top:a,left:o,bottom:s,right:c}=n.decode(e),l=c-o+1,u=n.encodeAddress(a,o),d=i===`shared`,f;f=typeof r==`function`?r:Array.isArray(r)?Array.isArray(r[0])?(e,t)=>r[e-a][t-o]:(e,t)=>r[(e-a)*l+(t-o)]:()=>void 0;let p=!0;for(let n=a;n<=s;n++)for(let r=o;r<=c;r++)if(p){let a=this.getCell(n,r);a.value={shareType:i,formula:t,ref:e,result:f(n,r)},p=!1}else this.getCell(n,r).value=d?{sharedFormula:u,result:f(n,r)}:f(n,r)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new ge(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new ge(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}addFormCheckbox(e,t){let n=new Ee(this,e,t);return this.formControls.push(n),n}getFormCheckboxes(){return this.formControls}async protect(e,t){this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=Ke(yt.randomBytes(16)),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=await yt.convertPasswordToHash(e,`SHA-512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount)}unprotect(){this.sheetProtection=null}addTable(e){let t=new ve(this,e);return this.tables[e.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=Dt(this,e);return this.pivotTables.push(t),this.workbook.pivotTables.push(t),t}addConditionalFormatting(e){this.conditionalFormattings.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormattings.splice(e,1):e instanceof Function?this.conditionalFormattings=this.conditionalFormattings.filter(e):this.conditionalFormattings=[]}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,colBreaks:this.colBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings,formControls:this.formControls.map(e=>e.model),drawing:this._drawing};e.cols=fe.toModel(this.columns??[]);let t=e.rows=[],n=e.dimensions=new r;return this._rows.forEach(e=>{let r=e&&e.model;r&&(n.expand(r.number,r.min,r.number,r.max),t.push(r))}),e.merges=[],Object.values(this._merges).forEach(t=>{e.merges.push(t.range)}),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new de(this,e.number);this._rows[t.number-1]=t,t.model=e})}_parseMergeCells(e){e.mergeCells&&e.mergeCells.forEach(e=>{this.mergeCellsWithoutStyle(e)})}set model(e){this.name=e.name,this._columns=fe.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new ye(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.rowBreaks=e.rowBreaks??[],this.colBreaks=e.colBreaks??[],this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new ge(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new ve(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings,this.formControls=[],this._drawing=e.drawing}};function Pt(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function Ft(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>Ft(e));let t={};for(let n of Object.keys(e))Pt(n)&&(t[n]=Ft(e[n]));return t}var It=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(n.decodeEx(e))}getCell(e){return this.findCellEx(n.decodeEx(e),!0)}findCell(e){return this.findCellEx(n.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets[e],i=r&&r[t];return i&&i[n]}addCellEx(e){if(e.top!==void 0)for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++)this.getCellAt(e.sheetName,t,n);else this.findCellEx(e,!0)}getCellEx(e){return this.findCellEx(e,!0)}findCellEx(e,t){let n=this.findSheet(e,t),r=this.findSheetRow(n,e,t);return this.findRowCell(r,e,t)}getCellAt(e,t,r){if(!Pt(e))throw Error(`Invalid sheet name: ${e}`);let i=this.sheets[e]||(this.sheets[e]=[]),a=i[t]||(i[t]=[]);return a[r]||(a[r]={sheetName:e,address:n.n2l(r)+t,row:t,col:r})}removeCellEx(e){let t=this.findSheet(e,!1);if(!t)return;let n=this.findSheetRow(t,e,!1);n&&delete n[e.col]}forEachInSheet(e,t){let n=this.sheets[e];n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){Object.keys(this.sheets).forEach(t=>{this.forEachInSheet(t,e)})}map(e){let t=[];return this.forEach(n=>{t.push(e(n))}),t}findSheet(e,t){let n=e.sheetName;if(!Pt(n))throw Error(`Invalid sheet name: ${n}`);if(Object.prototype.hasOwnProperty.call(this.sheets,n))return this.sheets[n];if(t)return this.sheets[n]=[]}findSheetRow(e,t,n){let{row:r}=t;if(!Pt(r))throw Error(`Invalid row: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let{col:r}=t;if(!Pt(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...Ft(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push([]);i.splice(t,n,...e)}}spliceColumns(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push(null);Object.values(i).forEach(r=>{r.splice(t,n,...e)})}}};let Lt=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Rt=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new It)}add(e,t){let r=n.decodeEx(e);`error`in r||this.addEx(r,t)}addEx(e,t){let r=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let i=e.top;i<=e.bottom;i++){let a={sheetName:e.sheetName,address:n.n2l(t)+i,row:i,col:t};r.addCellEx(a)}else r.addCellEx(e)}remove(e,t){let r=n.decodeEx(e);`error`in r||this.removeEx(r,t)}removeEx(e,t){let r=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let i=e.top;i<=e.bottom;i++)r.removeCellEx({sheetName:e.sheetName,address:n.n2l(t)+i,row:i,col:t});else r.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{if(`top`in e)for(let r=e.left;r<=e.right;r++)for(let i=e.top;i<=e.bottom;i++)t.removeCellEx({sheetName:e.sheetName,address:n.n2l(r)+i,row:i,col:r});else t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let t=n.decodeEx(e);return`error`in t||`top`in t?[]:this.getNamesEx(t)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let{sheetName:n}=t,i=new r(t.row,t.col,t.row,t.col,n),a,o,s=(t,r)=>e.findCellAt(n,t,r);function c(e,n){let r=s(e,t.col);return!r||!r.mark?!1:(i[n]=e,r.mark=!1,!0)}for(o=t.row-1;c(o,`top`);o--);for(o=t.row+1;c(o,`bottom`);o++);function l(e,t){let n=[];for(o=i.top;o<=i.bottom;o++){let t=s(o,e);if(t&&t.mark)n.push(t);else return!1}i[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(a=t.col-1;l(a,`left`);a--);for(a=t.col+1;l(a,`right`);a++);return i}getRanges(e,t){return t||=this.matrixMap[e],t?(t.forEach(e=>{e.mark=!0}),{name:e,ranges:t.map(e=>e.mark&&this._explore(t,e)).filter(Boolean).map(e=>e.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,t){e.forEachInSheet(t,(e,t,r)=>{e&&(e.row!==t||e.col!==r)&&(e.row=t,e.col=r,e.address=n.n2l(r)+t)})}spliceRows(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceRows(e,t,n,r),this.normaliseMatrix(i,e)})}spliceColumns(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceColumns(e,t,n,r),this.normaliseMatrix(i,e)})}get model(){return Object.entries(this.matrixMap).map(([e,t])=>this.getRanges(e,t)).filter(e=>e.ranges.length)}set model(e){let t=this.matrixMap={};e.forEach(e=>{let n=t[e.name]=new It;e.ranges.forEach(e=>{Lt.test(e.split(`!`).pop()??``)&&n.addCell(e)})})}};let zt=1e4;function Bt(e,t,n){e.push(` ${t}="${A(n.toString())}"`)}function Vt(e,t){if(t){let n=[];for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;let r=t[e];r!==void 0&&Bt(n,e,r)}e.push(n.join(``))}}var F=class{constructor(){this._xml=[],this._chunks=[],this._stack=[],this._rollbacks=[],this.leaf=!1,this.open=!1}_consolidate(){this._rollbacks.length>0||this._xml.length>=zt&&(this._chunks.push(this._xml.join(``)),this._xml.length=0)}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._chunks.length*zt+this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),Vt(t,e),t.push(`?>
8
- `)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),Vt(r,t),this.leaf=!0,this.open=!0}addAttribute(e,t){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);t!==void 0&&Bt(this._xml,e,t)}addAttributes(e){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);Vt(this._xml,e)}writeText(e){let t=this._xml;this.open&&=(t.push(`>`),!1),this.leaf=!1,t.push(A(e.toString()))}writeXml(e){this.open&&=(this._xml.push(`>`),!1),this.leaf=!1,this._xml.push(e)}closeNode(){let e=this._stack.pop(),t=this._xml;this.leaf?t.push(`/>`):(t.push(`</`),t.push(e),t.push(`>`)),this.open=!1,this.leaf=!1,this._consolidate()}leafNode(e,t,n){this.openNode(e,t),n!==void 0&&this.writeText(n),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf??!1,open:this.open??!1,chunksLength:this._chunks.length}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let e=this._rollbacks.pop();this._xml.length>e.xml&&(this._xml.length=e.xml),this._stack.length>e.stack&&(this._stack.length=e.stack),this._chunks.length>e.chunksLength&&(this._chunks.length=e.chunksLength),this.leaf=e.leaf,this.open=e.open}get xml(){return this.closeAll(),this._chunks.length===0?this._xml.join(``):(this._xml.length>0&&this._chunks.push(this._xml.join(``)),this._chunks.join(``))}static{this.StdDocAttributes={version:`1.0`,encoding:`UTF-8`,standalone:`yes`}}};let Ht=Array(128);for(let e=0;e<128;e++)Ht[e]=String.fromCharCode(e);function I(e){return e<128?Ht[e]:String.fromCodePoint(e)}let Ut=new Uint8Array(128);for(let e=97;e<=122;e++)Ut[e]=1;for(let e=65;e<=90;e++)Ut[e]=1;Ut[95]=1,Ut[58]=1;let Wt=new Uint8Array(128);for(let e=97;e<=122;e++)Wt[e]=1;for(let e=65;e<=90;e++)Wt[e]=1;for(let e=48;e<=57;e++)Wt[e]=1;Wt[95]=1,Wt[58]=1,Wt[45]=1,Wt[46]=1;function Gt(e){return e===32||e===10||e===13||e===9}function Kt(e){return e===34||e===39}function qt(e){return e<128?Ut[e]===1:e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Jt(e){return e<128?Wt[e]===1:e===183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=768&&e<=879||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Yt(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111}let Xt={amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`};var Zt=class{constructor(e){this.state=0,this.chunk=``,this.i=0,this.prevI=0,this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.entityReturnState=0,this.openWakaBang=``,this.sawRoot=!1,this.closedRoot=!1,this._closed=!1,this.reportedTextBeforeRoot=!1,this.reportedTextAfterRoot=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.ENTITIES={...Xt},this.trackPosition=e?.position!==!1,this.fileName=e?.fileName,this.fragment=e?.fragment??!1,this._init()}get closed(){return this._closed}get position(){return this.chunkPosition+this.i}_init(){this.state=(this.fragment,0),this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.openWakaBang=``,this.sawRoot=this.fragment,this.closedRoot=this.fragment,this.reportedTextBeforeRoot=this.fragment,this.reportedTextAfterRoot=this.fragment,this.carriedFromPrevious=void 0,this._closed=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.chunk=``,this.i=0,this.prevI=0}on(e,t){switch(e){case`text`:this.textHandler=t;break;case`opentag`:this.openTagHandler=t;break;case`closetag`:this.closeTagHandler=t;break;case`error`:this.errorHandler=t;break}}off(e){switch(e){case`text`:this.textHandler=void 0;break;case`opentag`:this.openTagHandler=void 0;break;case`closetag`:this.closeTagHandler=void 0;break;case`error`:this.errorHandler=void 0;break}}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e);if(this.errorHandler)this.errorHandler(t);else throw t;return this}write(e){if(this._closed)return this.fail(`cannot write after close`);let t=!1;e===null&&(t=!0,e=``),this.carriedFromPrevious!==void 0&&(e=this.carriedFromPrevious+e,this.carriedFromPrevious=void 0);let n=e.length;if(!t&&n>0){let t=e.charCodeAt(n-1);(t===13||t>=55296&&t<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n))}for(this.chunk=e,this.i=0;this.i<n;)this.processState();return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(n<10||n>13&&n<55296)return this.trackPosition&&this.column++,n;if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343)return this.i=t+2,this.trackPosition&&this.column++,65536+((n-55296)*1024+(r-56320))}return n===13?(e.charCodeAt(t+1)===10&&(this.i=t+2),this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),10):(n===10&&this.trackPosition?(this.line++,this.column=0,this.positionAtNewLine=this.position):this.trackPosition&&this.column++,n)}unget(){this.i=this.prevI,this.trackPosition&&this.column--}processState(){switch(this.state){case 0:this.sText();break;case 1:this.sOpenWaka();break;case 2:this.sOpenWakaBang();break;case 3:this.sOpenTag();break;case 4:this.sOpenTagSlash();break;case 5:this.sAttrib();break;case 6:this.sAttribName();break;case 7:this.sAttribNameSawWhite();break;case 8:this.sAttribValue();break;case 9:this.sAttribValueQuoted();break;case 10:this.sAttribValueClosed();break;case 11:this.sCloseTag();break;case 12:this.sCloseTagSawWhite();break;case 13:this.sComment();break;case 14:this.sCommentEnding();break;case 15:this.sCommentEnded();break;case 16:this.sCData();break;case 17:this.sCDataEnding();break;case 18:this.sCDataEnding2();break;case 19:this.sPI();break;case 20:this.sPIEnding();break;case 21:this.sDoctype();break;case 22:this.sDoctypeQuote();break;case 23:this.sDoctypeDTD();break;case 24:this.sDoctypeDTDQuoted();break;case 25:this.sEntity();break}}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}handleTextInRoot(){let{chunk:e}=this,{i:t}=this,n=this.textHandler;for(;;){let r=this.getCode();if(r===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));return}if(r===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;return}if(r===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``;return}r===10&&(n&&(this.text+=e.slice(t,this.prevI)+`
7
+ var ExcelTS=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});let t=/^[A-Z]+\d+$/,n={_dictionary:`ABCDEFGHIJKLMNOPQRSTUVWXYZ`.split(``),_l2nFill:0,_l2n:{},_n2l:[],_level(e){return e<=26?1:e<=676?2:3},_fill(e){let t,n,r,i,a,o=1;if(e>=4)throw Error(`Out of bounds. Excel supports columns from 1 to 16384`);if(this._l2nFill<1&&e>=1){for(;o<=26;)t=this._dictionary[o-1],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=1}if(this._l2nFill<2&&e>=2){for(o=27;o<=702;)n=o-27,r=n%26,i=Math.floor(n/26),t=this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=2}if(this._l2nFill<3&&e>=3){for(o=703;o<=16384;)n=o-703,r=n%26,i=Math.floor(n/26)%26,a=Math.floor(n/676),t=this._dictionary[a]+this._dictionary[i]+this._dictionary[r],this._n2l[o]=t,this._l2n[t]=o,o++;this._l2nFill=3}},l2n(e){if(this._l2n[e]||this._fill(e.length),!this._l2n[e])throw Error(`Out of bounds. Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw Error(`${e} is out of bounds. Excel supports columns from 1 to 16384`);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},validateAddress(e){if(!t.test(e))throw Error(`Invalid Address: ${e}`);return!0},decodeAddress(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.length<5&&this._hash[e];if(t)return t;let n=!1,r=``,i=0,a=!1,o=``,s=0;for(let t=0,c;t<e.length;t++)if(c=e.charCodeAt(t),!a&&c>=65&&c<=90)n=!0,r+=e[t],i=i*26+c-64;else if(c>=48&&c<=57)a=!0,o+=e[t],s=s*10+c-48;else if(a&&n&&c!==36)break;if(!n)i=void 0;else if(i>16384)throw Error(`Out of bounds. Invalid column letter: ${r}`);a||(s=void 0),e=r+o;let c={address:e,col:i,row:s,$col$row:`$${r}$${o}`};return i<=100&&s<=100&&(this._hash[e]=c,this._hash[c.$col$row]=c),c},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,t){return n.n2l(t)+e},encode(...e){switch(e.length){case 2:return n.encodeAddress(e[0],e[1]);case 4:return`${n.encodeAddress(e[0],e[1])}:${n.encodeAddress(e[2],e[3])}`;default:throw Error(`Can only encode with 2 or 4 arguments`)}},inRange(e,t){let[n,r,,i,a]=e,[o,s]=t;return o>=n&&o<=i&&s>=r&&s<=a}};var r=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,t,r,i,a){if(typeof e==`string`&&typeof t==`string`){let i=n.decodeAddress(e),a=n.decodeAddress(t);this.model={top:Math.min(i.row,a.row),left:Math.min(i.col,a.col),bottom:Math.max(i.row,a.row),right:Math.max(i.col,a.col),sheetName:typeof r==`string`?r:void 0}}else typeof e==`number`&&typeof t==`number`&&typeof r==`number`&&typeof i==`number`&&(this.model={top:Math.min(e,r),left:Math.min(t,i),bottom:Math.max(e,r),right:Math.max(t,i),sheetName:a})}decode(t){switch(t.length){case 5:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&typeof t[4]==`string`&&this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:typeof t[0]==`string`&&typeof t[1]==`string`&&typeof t[2]==`string`&&this.setTLBR(t[0],t[1],t[2]);break;case 2:typeof t[0]==`string`&&typeof t[1]==`string`&&this.setTLBR(t[0],t[1]);break;case 1:{let r=t[0];if(r instanceof e)this.model={top:r.model.top,left:r.model.left,bottom:r.model.bottom,right:r.model.right,sheetName:r.sheetName};else if(Array.isArray(r))this.decode(r);else if(typeof r==`object`&&`top`in r&&`left`in r&&`bottom`in r&&`right`in r)this.model={top:r.top,left:r.left,bottom:r.bottom,right:r.right,sheetName:r.sheetName};else if(typeof r==`string`){let e=n.decodeEx(r);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw Error(`Invalid number of arguments to _getDimensions() - ${t.length}`)}}get top(){return this.model.top||1}set top(e){this.model.top=e}get left(){return this.model.left||1}set left(e){this.model.left=e}get bottom(){return this.model.bottom||1}set bottom(e){this.model.bottom=e}get right(){return this.model.right||1}set right(e){this.model.right=e}get sheetName(){return this.model.sheetName}set sheetName(e){this.model.sheetName=e}get _serialisedSheetName(){let{sheetName:e}=this.model;return e?/^[a-zA-Z0-9]*$/.test(e)?`${e}!`:`'${e}'!`:``}expand(e,t,n,r){(!this.model.top||e<this.top)&&(this.top=e),(!this.model.left||t<this.left)&&(this.left=t),(!this.model.bottom||n>this.bottom)&&(this.bottom=n),(!this.model.right||r>this.right)&&(this.right=r)}expandRow(e){if(e){let{dimensions:t,number:n}=e;t&&this.expand(n,t.min,n,t.max)}}expandToAddress(e){let t=n.decodeEx(e);`row`in t&&`col`in t&&this.expand(t.row,t.col,t.row,t.col)}get tl(){return n.n2l(this.left)+this.top}get $t$l(){return`$${n.n2l(this.left)}$${this.top}`}get br(){return n.n2l(this.right)+this.bottom}get $b$r(){return`$${n.n2l(this.right)}$${this.bottom}`}get range(){return`${this._serialisedSheetName+this.tl}:${this.br}`}get $range(){return`${this._serialisedSheetName+this.$t$l}:${this.$b$r}`}get shortRange(){return this.count>1?this.range:this._serialisedSheetName+this.tl}get $shortRange(){return this.count>1?this.$range:this._serialisedSheetName+this.$t$l}get count(){return(1+this.bottom-this.top)*(1+this.right-this.left)}toString(){return this.range}intersects(e){return!(e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName||e.bottom<this.top||e.top>this.bottom||e.right<this.left||e.left>this.right)}contains(e){let t=n.decodeEx(e);return`row`in t&&`col`in t?this.containsEx(t):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let r=this.top;r<=this.bottom;r++)e(n.encodeAddress(r,t),r,t)}};let i=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e[e.Checkbox=12]=`Checkbox`,e}({}),a=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),o=function(e){return e[e.None=0]=`None`,e[e.OfficeDocument=1]=`OfficeDocument`,e[e.Worksheet=2]=`Worksheet`,e[e.CalcChain=3]=`CalcChain`,e[e.SharedStrings=4]=`SharedStrings`,e[e.Styles=5]=`Styles`,e[e.Theme=6]=`Theme`,e[e.Hyperlink=7]=`Hyperlink`,e}({}),s=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),c=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),l={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},u={ValueType:i,FormulaType:a,RelationshipType:o,DocumentType:s,ReadingOrder:c,ErrorValue:l},d={'"':`&quot;`,"&":`&amp;`,"<":`&lt;`,">":`&gt;`},f=/["&<>]/g;function p(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;let n=typeof e;if(n!==typeof t||n!==`object`)return!1;let r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!p(e[r],t[r]))return!1;return!0}let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!Object.prototype.hasOwnProperty.call(t,r)||!p(e[r],t[r]))return!1}return!0}function m(e){return e.replace(f,e=>d[e])}function h(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function g(...e){let t=e[0]||{},n=e.length;for(let r=1;r<n;r++){let n=e[r];if(n)if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){let r=n[e];if(r===void 0)continue;let i=t[e];Array.isArray(r)?t[e]=g(Array.isArray(i)?i:[],r):h(r)?t[e]=g(h(i)?i:{},r):t[e]=r}else{let e=Object.keys(n);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=n[i];if(a===void 0)continue;let o=t[i];Array.isArray(a)?t[i]=g(Array.isArray(o)?o:[],a):h(a)?t[i]=g(h(o)?o:{},a):t[i]=a}}}return t}var _=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note};break}return g({},e.DEFAULT_CONFIGS,t)}set model(e){let{note:t}=e,{texts:n}=t;n&&n.length===1&&Object.keys(n[0]).length===1?this.note=n[0].text:this.note=t}static fromModel(t){let n=new e;return n.model=t,n}};let v=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,y=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function b(e,t,r){let i=n.decode(t),a=n.decode(r);return e.replace(v,(e,t,r,o,s)=>{if(s)return e;let c=y.exec(o);if(c){let r=c[1],o=c[2].toUpperCase(),s=c[3],l=c[4];if(o.length>3||o.length===3&&o>`XFD`)return e;let u=n.l2n(o),d=parseInt(l,10);return r||(u+=a.col-i.col),s||(d+=a.row-i.row),(t??``)+(r??``)+n.n2l(u)+(s??``)+d}return e})}let x=e=>!!e&&(typeof e!=`object`||Object.keys(e).length>0);var S=class e{static{this.Types=u.ValueType}constructor(t,r,i){if(!t||!r)throw Error(`A Cell needs a Row`);this._row=t,this._column=r,n.validateAddress(i),this._address=i,this._value=D.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,r.style,{}),this._mergeCount=0}get worksheet(){return this._row.worksheet}get workbook(){return this._row.worksheet.workbook}destroy(){this.style=void 0,this._value=void 0,this._row=void 0,this._column=void 0,this._address=void 0}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&x(e.font)&&e.font||t&&x(t.font)&&t.font;i&&(n.font=i);let a=e&&x(e.alignment)&&e.alignment||t&&x(t.alignment)&&t.alignment;a&&(n.alignment=a);let o=e&&x(e.border)&&e.border||t&&x(t.border)&&t.border;o&&(n.border=o);let s=e&&x(e.fill)&&e.fill||t&&x(t.fill)&&t.fill;s&&(n.fill=s);let c=e&&x(e.protection)&&e.protection||t&&x(t.protection)&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=D.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=D.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{...this.style}))}isMergedTo(t){return this._value.type===e.Types.Merge&&this._value.isMergedTo?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=D.create(D.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new _(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof _?this._comment=e:this._comment=new _(e)}get text(){return this._value.toString()}get html(){return m(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=D.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType??u.FormulaType.None}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=D.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=_.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},ee=class{constructor(e){this.model={address:e.address,type:S.Types.Null}}get value(){return null}set value(e){}get type(){return S.Types.Null}get effectiveType(){return S.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},te=class{constructor(e,t){this.model={address:e.address,type:S.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Number}get effectiveType(){return S.Types.Number}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},ne=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.String}get effectiveType(){return S.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return`"${this.model.value.replace(/"/g,`""`)}"`}release(){}toString(){return this.model.value}},C=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}toString(){return this.model.value.richText.map(e=>e.text).join(``)}get type(){return S.Types.RichText}get effectiveType(){return S.Types.RichText}get address(){return this.model.address}set address(e){this.model.address=e}get text(){return this.toString()}toCsvString(){return`"${this.text.replace(/"/g,`""`)}"`}release(){}},w=class{constructor(e,t){this.model={address:e.address,type:S.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Date}get effectiveType(){return S.Types.Date}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toISOString()}release(){}toString(){return this.model.value.toString()}},re=class{constructor(e,t){this.model={address:e.address,type:S.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text??``,hyperlink:this.model.hyperlink??``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return S.Types.Hyperlink}get effectiveType(){return S.Types.Hyperlink}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.hyperlink??``}release(){}toString(){return this.model.text??``}},T=class{constructor(e,t){this.model={address:e.address,type:S.Types.Merge,master:t?t.address:void 0},this._master=t,t&&t.addMergeRef()}get value(){return this._master.value}set value(e){e instanceof S?(this._master&&this._master.releaseMergeRef(),e.addMergeRef(),this._master=e):this._master.value=e}isMergedTo(e){return e===this._master}get master(){return this._master}get type(){return S.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value==null?``:this.value.toString()}},ie=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:S.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(D.getType(e)){case S.Types.Null:case S.Types.String:case S.Types.Number:case S.Types.Date:break;case S.Types.Hyperlink:case S.Types.Formula:default:throw Error(`Cannot process that type of result value`)}}get dependencies(){return{ranges:this.formula.match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g),cells:this.formula.replace(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}:[A-Z]{1,3}\d{1,4}/g,``).match(/([a-zA-Z0-9]+!)?[A-Z]{1,3}\d{1,4}/g)}}get formula(){return this.model.formula||this._getTranslatedFormula()||``}set formula(e){this.model.formula=e}get formulaType(){return this.model.formula?u.FormulaType.Master:this.model.sharedFormula?u.FormulaType.Shared:u.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return S.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?u.ValueType.Null:e instanceof String||typeof e==`string`?u.ValueType.String:typeof e==`number`?u.ValueType.Number:e instanceof Date?u.ValueType.Date:typeof e==`object`&&`error`in e?u.ValueType.Error:u.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&t.formula?b(t.formula,t.address,this.model.address):void 0}return this._translatedFormula}toCsvString(){return`${this.model.result??``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},ae=class{constructor(e,t){this.model={address:e.address,type:S.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.SharedString}get effectiveType(){return S.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},oe=class{constructor(e,t){this.model={address:e.address,type:S.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Boolean}get effectiveType(){return S.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},E=class{constructor(e,t){this.model={address:e.address,type:S.Types.Checkbox,value:t.checkbox}}get value(){return{checkbox:this.model.value}}set value(e){this.model.value=e.checkbox}get type(){return S.Types.Checkbox}get effectiveType(){return S.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value?1:0}release(){}toString(){return this.model.value.toString()}},se=class{constructor(e,t){this.model={address:e.address,type:S.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return S.Types.Error}get effectiveType(){return S.Types.Error}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.toString()}release(){}toString(){return this.model.value.error.toString()}},ce=class{constructor(e,t){this.model={address:e.address,type:S.Types.String,value:JSON.stringify(t),rawValue:t}}get value(){return this.model.rawValue}set value(e){this.model.rawValue=e,this.model.value=JSON.stringify(e)}get type(){return S.Types.String}get effectiveType(){return S.Types.String}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value}release(){}toString(){return this.model.value}};let D={getType(e){if(e==null)return S.Types.Null;if(e instanceof String||typeof e==`string`)return S.Types.String;if(typeof e==`number`)return S.Types.Number;if(typeof e==`boolean`)return S.Types.Boolean;if(e instanceof Date)return S.Types.Date;if(typeof e==`object`){if(`checkbox`in e&&typeof e.checkbox==`boolean`)return S.Types.Checkbox;if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return S.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return S.Types.Formula;if(`richText`in e&&e.richText)return S.Types.RichText;if(`sharedString`in e&&e.sharedString)return S.Types.SharedString;if(`error`in e&&e.error)return S.Types.Error}return S.Types.JSON},types:[{t:S.Types.Null,f:ee},{t:S.Types.Number,f:te},{t:S.Types.String,f:ne},{t:S.Types.Date,f:w},{t:S.Types.Hyperlink,f:re},{t:S.Types.Formula,f:ie},{t:S.Types.Merge,f:T},{t:S.Types.JSON,f:ce},{t:S.Types.SharedString,f:ae},{t:S.Types.RichText,f:C},{t:S.Types.Boolean,f:oe},{t:S.Types.Error,f:se},{t:S.Types.Checkbox,f:E}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw Error(`Could not create Value of type ${e}`);return new r(t,n)}},le=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),O=(e,t,n,r=[])=>{e[n]&&(t[n]=le(e[n],r))},ue=e=>Object.keys(e).length===0,k=e=>{if(!e)return e;if(ue(e))return{};let t={...e};return O(e,t,`font`,[`color`]),O(e,t,`alignment`),O(e,t,`protection`),e.border&&(O(e,t,`border`),O(e.border,t.border,`top`,[`color`]),O(e.border,t.border,`left`,[`color`]),O(e.border,t.border,`bottom`,[`color`]),O(e.border,t.border,`right`,[`color`]),O(e.border,t.border,`diagonal`,[`color`])),e.fill&&(O(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>le(e,[`color`])))),t};var de=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){this._worksheet=void 0,this._cells=void 0,this.style=void 0}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new S(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let t;if(typeof e==`string`){let r=this._worksheet.getColumnKey(e);t=r?r.number:n.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:n.encodeAddress(this._number,t),row:this._number,col:t})}splice(e,t,...n){let r=e+t,i=n.length-t,a=this._cells.length,o,s,c;if(i<0)for(o=e+n.length;o<=a;o++)c=this._cells[o-1],s=this._cells[o-i-1],s?(c=this.getCell(o),c.value=s.value,c.style=k(s.style)??{},c.comment=s.comment):c&&(c.value=null,c.style={},c.comment=void 0);else if(i>0)for(o=a;o>=r;o--)s=this._cells[o-1],s?(c=this.getCell(o+i),c.value=s.value,c.style=k(s.style)??{},c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==u.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==u.ValueType.Null&&(e[t.col]=t.value)}),e}set values(e){if(this._cells=[],e)if(e instanceof Array){let t=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(t=1),e.forEach((e,r)=>{e!==void 0&&(this.getCellEx({address:n.encodeAddress(this._number,r+t),row:this._number,col:r+t}).value=e)})}else this._worksheet.eachColumnKey((t,r)=>{e[r]!==void 0&&(this.getCellEx({address:n.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[r])})}getValues(){let e=[];return this._cells.forEach(t=>{t&&t.type!==u.ValueType.Null&&(e[t.col-1]=t.value)}),e}valuesToString(e=`,`){return this.getValues().join(e)}get hasValues(){return this._cells.some(e=>e&&e.type!==u.ValueType.Null)}get cellCount(){return this._cells.length}get actualCellCount(){let e=0;return this.eachCell(()=>{e++}),e}get dimensions(){let e=0,t=0;return this._cells.forEach(n=>{n&&n.type!==u.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelRow??0))}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height!=null||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,customHeight:this.customHeight,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed,dyDescent:this.dyDescent}:null}set model(e){if(e.number!==this._number)throw Error(`Invalid row number in model`);this._cells=[];let t;e.cells.forEach(e=>{switch(e.type){case S.Types.Merge:break;default:{let r;if(e.address)r=n.decodeAddress(e.address);else if(t){let{row:e}=t,i=t.col+1;r={row:e,col:i,address:n.encodeAddress(e,i),$col$row:`$${n.n2l(i)}$${e}`}}if(t=r,!r)break;let i=this.getCellEx(r);i.model=e;break}}}),e.height==null?delete this.height:this.height=e.height,e.customHeight==null?delete this.customHeight:this.customHeight=e.customHeight,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel??0,this.dyDescent=e.dyDescent,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},fe=class e{constructor(e,t,n){this._worksheet=e,this._number=t,n!==!1&&(this.defn=n)}get number(){return this._number}get worksheet(){return this._worksheet}get letter(){return n.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,bestFit:this.bestFit}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden,this.bestFit=e.bestFit):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0,delete this.bestFit)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(e,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelCol??0))}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&p(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&this.bestFit===e.bestFit&&p(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel||this.bestFit)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==u.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||1048575,a={id:this._number,max:i,man:1};r&&(a.min=r),n.colBreaks.push(a)}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed,bestFit:e.bestFit},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){let r=t,i=Array.isArray(t)?t:n??[];i??=[];let a=[],o=1,s=0;for(i=i.sort(function(e,t){return e.min-t.min});s<i.length;){let t=i[s++];for(;o<t.min;)a.push(new e(r,o++));for(;o<=t.max;)a.push(new e(r,o++,t))}return a.length?a:null}};function pe(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function me(e){return typeof e==`object`&&`col`in e&&`row`in e}var he=class e{constructor(e,t,r=0){if(this.worksheet=e,!t)this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0;else if(typeof t==`string`){let e=n.decodeAddress(t);this.nativeCol=e.col+r,this.nativeColOff=0,this.nativeRow=e.row+r,this.nativeRowOff=0}else pe(t)?(this.nativeCol=t.nativeCol??0,this.nativeColOff=t.nativeColOff??0,this.nativeRow=t.nativeRow??0,this.nativeRowOff=t.nativeRowOff??0):me(t)?(this.col=t.col+r,this.row=t.row+r):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e),this.nativeColOff=Math.floor((e-this.nativeCol)*this.colWidth)}get row(){return this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e),this.nativeRowOff=Math.floor((e-this.nativeRow)*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){let e=this.worksheet?.getRow(this.nativeRow+1)?.height;return e?Math.floor(e*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}clone(t){return new e(t??this.worksheet,this.model)}},ge=class e{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId};case`image`:return{type:this.type,imageId:this.imageId,hyperlinks:this.range.hyperlinks,range:{tl:this.range.tl.model,br:this.range.br&&this.range.br.model,ext:this.range.ext,editAs:this.range.editAs}};default:throw Error(`Invalid Image Type`)}}set model({type:e,imageId:t,range:r,hyperlinks:i}){if(this.type=e,this.imageId=t,e===`image`)if(typeof r==`string`){let e=n.decode(r);`top`in e&&(this.range={tl:new he(this.worksheet,{col:e.left,row:e.top},-1),br:new he(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else r&&(this.range={tl:new he(this.worksheet,r.tl,0),br:r.br?new he(this.worksheet,r.br,0):void 0,ext:r.ext,editAs:r.editAs,hyperlinks:i||(`hyperlinks`in r?r.hyperlinks:void 0)})}clone(t){let n=t??this.worksheet,r=new e(n);return r.type=this.type,r.imageId=this.imageId,this.range&&(r.range={tl:this.range.tl.clone(n),br:this.range.br?this.range.br.clone(n):void 0,ext:this.range.ext?{...this.range.ext}:void 0,editAs:this.range.editAs,hyperlinks:this.range.hyperlinks?{...this.range.hyperlinks}:void 0}),r}};let _e=/^[A-Za-z]{1,3}\d+$/,ve=/^[Rr]\d+[Cc]\d+$/,ye=new Set([`C`,`c`,`R`,`r`]);function be(e){let t=e.replace(/\s/g,`_`),n=!1;return t.startsWith(`\\`)&&(n=!0,t=t.slice(1)),t=t.replace(/[^\p{L}\p{N}_.]/gu,``),n&&(t=`\\${t}`),t.length>0&&!/^[\p{L}_\\]/u.test(t[0])&&(t=`_${t}`),t.length>255&&(t=t.slice(0,255)),t.length===0?`_Table`:(t.length===1&&ye.has(t)&&(t=`_${t}`),(_e.test(t)||ve.test(t))&&(t=`_${t}`),t)}var xe=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},Se=class{constructor(e,t){if(this.worksheet=e,t){if(this.table=t,Array.isArray(t.rows)&&t.rows.length===0&&t.tableRef){let r=n.decode(t.tableRef);if(`dimensions`in r){let n=r.top+(t.headerRow===!1?0:1),i=r.bottom-(t.totalsRow===!0?1:0);if(i>=n)for(let a=n;a<=i;a++){let n=e.getRow(a),i=[];for(let e=r.left;e<=r.right;e++)i.push(n.getCell(e).value);t.rows.push(i)}}}this.validate(),this.store()}}getFormula(e){switch(e.totalsRowFunction){case`none`:return null;case`average`:return`SUBTOTAL(101,${this.table.name}[${e.name}])`;case`countNums`:return`SUBTOTAL(102,${this.table.name}[${e.name}])`;case`count`:return`SUBTOTAL(103,${this.table.name}[${e.name}])`;case`max`:return`SUBTOTAL(104,${this.table.name}[${e.name}])`;case`min`:return`SUBTOTAL(105,${this.table.name}[${e.name}])`;case`stdDev`:return`SUBTOTAL(106,${this.table.name}[${e.name}])`;case`var`:return`SUBTOTAL(107,${this.table.name}[${e.name}])`;case`sum`:return`SUBTOTAL(109,${this.table.name}[${e.name}])`;case`custom`:return e.totalsRowFormula??null;default:throw Error(`Invalid Totals Row Function: ${e.totalsRowFunction}`)}}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{});let r=e.style;t(r,`theme`,`TableStyleMedium2`),t(r,`showFirstColumn`,!1),t(r,`showLastColumn`,!1),t(r,`showRowStripes`,!1),t(r,`showColumnStripes`,!1),e.name&&=be(e.name),e.displayName&&=be(e.displayName);let i=(e,t)=>{if(!e)throw Error(t)};i(!!e.name,`Table must have a name`),i(!!e.ref,`Table must have ref`),i(!!e.columns,`Table must have column definitions`),i(!!e.rows,`Table must have row definitions`),e.tl=n.decodeAddress(e.ref);let{row:a,col:o}=e.tl;i(a>0,`Table must be on valid row`),i(o>0,`Table must be on valid col`);let{width:s,tableHeight:c}=this;e.autoFilterRef=n.encode(a,o,a,o+s-1),e.tableRef=n.encode(a,o,a+c-1,o+s-1),e.columns.forEach((e,n)=>{i(!!e.name,`Column ${n} must have a name`),n===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)??void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r),o=t?.formula;if(typeof o==`string`){let e=n.qualifyImplicitStructuredReferences===!0;a.value={...t,formula:e?o.replace(/(^|[^A-Za-z0-9_])\[@\[?([^\[\]]+?)\]?\]/g,`$1${n.name}[[#This Row],[$2]]`):o}}else a.value=t;e(a,n.columns[r]?.style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);if(n===0)r.value=t.totalsRowLabel;else{let e=this.getFormula(t);e?r.value={formula:e,result:t.totalsRowResult}:r.value=null}e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);if(t===0)n.value=e.totalsRowLabel;else{let t=this.getFormula(e);t&&(n.value={formula:t,result:e.totalsRowResult})}})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=n.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store(),this._cache=void 0}addRow(e,t,n){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e),n?.commit!==!1&&this.commit()}removeRows(e,t=1,n){this.cacheState(),this.table.rows.splice(e,t),n?.commit!==!1&&this.commit()}getColumn(e){let t=this.table.columns[e];return new xe(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.table.name=be(e)}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.table.displayName=be(e)}get headerRow(){return this.table.headerRow}set headerRow(e){this._assign(this.table,`headerRow`,e)}get totalsRow(){return this.table.totalsRow}set totalsRow(e){this._assign(this.table,`totalsRow`,e)}get theme(){return this.table.style?.theme}set theme(e){this.table.style||(this.table.style={}),this.table.style.theme=e}get showFirstColumn(){return this.table.style?.showFirstColumn}set showFirstColumn(e){this.table.style||(this.table.style={}),this.table.style.showFirstColumn=e}get showLastColumn(){return this.table.style?.showLastColumn}set showLastColumn(e){this.table.style||(this.table.style={}),this.table.style.showLastColumn=e}get showRowStripes(){return this.table.style?.showRowStripes}set showRowStripes(e){this.table.style||(this.table.style={}),this.table.style.showRowStripes=e}get showColumnStripes(){return this.table.style?.showColumnStripes}set showColumnStripes(e){this.table.style||(this.table.style={}),this.table.style.showColumnStripes=e}},Ce=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){let t=this.model[e];if(t!==void 0)return t;let r;for(let t in this.model){if(!t.startsWith(`range:`))continue;r||=n.decodeAddress(e);let i=t.slice(6),a=n.decodeEx(i);if(!a.dimensions)continue;let o=a.tl,s=a.br;if(r.row>=o.row&&r.row<=s.row&&r.col>=o.col&&r.col<=s.col)return this.model[t]}}remove(e){this.model[e]=void 0}};let we=9525,Te=12700,Ee=142875,De=28575,Oe=276225,ke=190500;var Ae=class e{constructor(e,t,n){this.worksheet=e;let{tl:r,br:i}=this._parseRange(t),a=1025+(e.formControls?.length??0),o;n?.link&&(o=this._toAbsoluteRef(n.link)),this.model={shapeId:a,ctrlPropId:0,tl:r,br:i,link:o,checked:n?.checked?`Checked`:`Unchecked`,text:n?.text??``,noThreeD:n?.noThreeD??!0,print:n?.print??!1}}get checked(){return this.model.checked===`Checked`}set checked(e){this.model.checked=e?`Checked`:`Unchecked`}get link(){return this.model.link}set link(e){this.model.link=e?this._toAbsoluteRef(e):void 0}get text(){return this.model.text}set text(e){this.model.text=e}_toAbsoluteRef(e){if(e.includes(`$`))return e;let t=n.decodeAddress(e);return`$${n.n2l(t.col)}$${t.row}`}_parseRange(e){let t,r;if(typeof e==`string`)if(e.includes(`:`)){let i=n.decode(e);if(`top`in i)if(i.left===i.right&&i.top===i.bottom){let e=i.left-1,n=i.top-1;t={col:e,colOff:Ee,row:n,rowOff:De},r={col:e+2,colOff:Oe,row:n+1,rowOff:ke}}else t={col:i.left-1,colOff:Ee,row:i.top-1,rowOff:De},r={col:i.right-1,colOff:Oe,row:i.bottom-1,rowOff:ke};else t={col:i.col-1,colOff:Ee,row:i.row-1,rowOff:De},r={col:i.col+1,colOff:Oe,row:i.row,rowOff:ke}}else{let i=n.decodeAddress(e);t={col:i.col-1,colOff:Ee,row:i.row-1,rowOff:De},r={col:i.col+1,colOff:Oe,row:i.row,rowOff:ke}}else if(`startCol`in e)t={col:e.startCol,colOff:e.startColOff??Ee,row:e.startRow,rowOff:e.startRowOff??De},r={col:e.endCol,colOff:e.endColOff??Oe,row:e.endRow,rowOff:e.endRowOff??ke};else{if(typeof e.tl==`string`){let r=n.decodeAddress(e.tl);t={col:r.col-1,colOff:Ee,row:r.row-1,rowOff:De}}else t={col:e.tl.col,colOff:e.tl.colOff??Ee,row:e.tl.row,rowOff:e.tl.rowOff??De};if(e.br)if(typeof e.br==`string`){let t=n.decodeAddress(e.br);r={col:t.col-1,colOff:Oe,row:t.row-1,rowOff:ke}}else r={col:e.br.col,colOff:e.br.colOff??Oe,row:e.br.row,rowOff:e.br.rowOff??ke};else r={col:t.col+2,colOff:Oe,row:t.row+1,rowOff:ke}}return{tl:t,br:r}}getVmlAnchor(){return e.getVmlAnchor(this.model)}getVmlStyle(){return e.getVmlStyle(this.model)}getVmlCheckedValue(){return e.getVmlCheckedValue(this.model)}static getVmlAnchor(e){let{tl:t,br:n}=e,r=Math.round(t.colOff/we),i=Math.round(t.rowOff/we),a=Math.round(n.colOff/we),o=Math.round(n.rowOff/we);return`${t.col}, ${r}, ${t.row}, ${i}, ${n.col}, ${a}, ${n.row}, ${o}`}static getVmlStyle(e){return`position:absolute;margin-left:${Math.round(e.tl.colOff/Te)}pt;margin-top:${Math.round(e.tl.rowOff/Te)}pt;width:96pt;height:18pt;z-index:1;visibility:visible`}static getVmlCheckedValue(e){switch(e.checked){case`Checked`:return 1;case`Mixed`:return 2;default:return 0}}};function je(){return typeof process<`u`&&!!process.versions?.node}function Me(e){if(je())return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function Ne(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function Pe(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}function Fe(e){return new Date(e.endsWith(`Z`)?e:e+`Z`)}let Ie={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`};function Le(e){return e.indexOf(`&`)===-1?e:e.replace(/&(#\d+|#x[0-9A-Fa-f]+|\w+);/g,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`?parseInt(t.slice(2),16):parseInt(t.slice(1));return Number.isNaN(n)?e:String.fromCodePoint(n)}return Ie[t]||e})}let Re=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/;function A(e){let t=Re.exec(e);if(!t)return e;let n=[],r=0;for(let i=t.index;i<e.length;i++){let t=e.charCodeAt(i),a;switch(t){case 34:a=`&quot;`;break;case 38:a=`&amp;`;break;case 39:a=`&apos;`;break;case 60:a=`&lt;`;break;case 62:a=`&gt;`;break;case 127:a=``;break;default:if(t<=31&&(t<=8||t>=11&&t!==13)){a=``;break}continue}r!==i&&n.push(e.substring(r,i)),r=i+1,a&&n.push(a)}return r<e.length&&n.push(e.substring(r)),n.join(``)}function ze(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function Be(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}let Ve=/[ymdhMsb]/,He=/\[[^\]]*\]|"[^"]*"/g;function Ue(e){if(!e)return!1;let t=Be(e)[0].replace(He,``);return t.indexOf(`@`)>-1?!1:Ve.test(t)}function j(e){return e===!0||e===`true`||e===1||e===`1`}function*We(e,t,n=1){let r=n>0?(e,t)=>e<t:(e,t)=>e>t;for(let i=e;r(i,t);i+=n)yield i}function Ge(e){let t=Array.from(e);return t.length<=1?t:t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.every(e=>e instanceof Date)?t.sort((e,t)=>e.getTime()-t.getTime()):t.sort((e,t)=>{let n=Ke(e),r=Ke(t);return n===r?n===0?e-t:n===1?e.getTime()-t.getTime():String(e).localeCompare(String(t)):n-r})}function Ke(e){return Number.isFinite(e)?0:e instanceof Date?1:2}let qe=new TextDecoder(`utf-8`),Je;try{Je=new TextDecoder(`latin1`)}catch{Je=void 0}function Ye(e){return typeof e==`string`?e:qe.decode(e)}function Xe(e){if(je())return Buffer.from(e).toString(`base64`);if(Je)try{return btoa(Je.decode(e))}catch{}let t=32768,n=[];for(let r=0;r<e.length;r+=t)n.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return btoa(n.join(``))}function Ze(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}let Qe=e=>Array.isArray(e);var M=class e{constructor(){this.__excelts_stream=!0,this._listeners=new Map,this._maxListeners=e.defaultMaxListeners}static{this.defaultMaxListeners=10}addListener(e,t){return this.on(e,t)}_listenerCount(e){return e?Qe(e)?e.length:1:0}_hasListeners(e){return this._listenerCount(this._listeners.get(e))>0}on(e,t){let n=this._listeners.get(e);if(this._maxListeners>0){let t=this._listenerCount(n);t>=this._maxListeners&&console?.warn?.(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${t+1} ${String(e)} listeners added. Use emitter.setMaxListeners() to increase limit`)}return n?Qe(n)?n.push(t):this._listeners.set(e,[n,t]):this._listeners.set(e,t),e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t),this}prependListener(e,t){let n=this._listeners.get(e);return n?Qe(n)?n.unshift(t):this._listeners.set(e,[t,n]):this._listeners.set(e,t),e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.on(e,n)}prependOnceListener(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.prependListener(e,n)}removeListener(e,t){return this.off(e,t)}off(e,t){let n=this._listeners.get(e);if(!n)return this;if(!Qe(n))return(n===t||n.listener===t)&&(this._listeners.delete(e),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t)),this;let r=n;if(r.length===0)return this._listeners.delete(e),this;let i=r.indexOf(t);if(i!==-1)r.splice(i,1);else for(let e=0,n=r.length;e<n;e++)if(r[e].listener===t){r.splice(e,1);break}return r.length===0?this._listeners.delete(e):r.length===1&&this._listeners.set(e,r[0]),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t),this}emit(e,...t){let n=this._listeners.get(e);if(!n)return!1;if(!Qe(n)){try{n.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}let r=n,i=r.length;if(i===0)return!1;if(i===1){try{r[0].apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}if(i===2){let n=r[0],i=r[1];try{n.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}try{i.apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}let a=r.slice();for(let n=0;n<a.length;n++)try{a[n].apply(this,t)}catch(t){e!==`error`&&this.emit(`error`,t)}return!0}removeAllListeners(e){return e===void 0?this._listeners.clear():this._listeners.delete(e),this}listenerCount(e){return this._listenerCount(this._listeners.get(e))}listeners(e){let t=this._listeners.get(e);return t?Qe(t)?t.slice():[t]:[]}rawListeners(e){let t=this._listeners.get(e);return t?Qe(t)?t.slice():[t]:[]}eventNames(){return[...this._listeners.keys()]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners}};let $e=new TextEncoder,et=new TextDecoder(`utf-8`,{ignoreBOM:!0}),tt=new Map;function nt(e){if(!e||e===`utf-8`||e===`utf8`)return et;let t=e,n=tt.get(t);return n||(n=new TextDecoder(t),tt.set(t,n)),n}function rt(e){return $e.encode(e)}function it(e,t){let n=e.length;if(n===0)return new Uint8Array;if(n===1)return e[0];if(t===void 0){let r=0;for(let t=0;t<n;t++)r+=e[t].length;t=r}let r=new Uint8Array(t),i=0;for(let t=0;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r}function at(e){return!!e&&typeof e==`object`&&typeof e.getReader==`function`}function ot(e){return!!e&&typeof e==`object`&&typeof e.getWriter==`function`}function st(e){return!!e&&(typeof e==`object`||typeof e==`function`)&&typeof e[Symbol.asyncIterator]==`function`}function ct(e){return!!e&&typeof e==`object`&&!!e.readable&&!!e.writable&&at(e.readable)&&ot(e.writable)}let lt=(e,t,n)=>{typeof e.off==`function`?e.off(t,n):typeof e.removeListener==`function`&&e.removeListener(t,n)},ut=(e,t,n,r)=>(r?.once&&typeof e.once==`function`?e.once(t,n):e.on(t,n),()=>lt(e,t,n)),dt=()=>{let e=[];return{add:(t,n,r)=>{e.push(ut(t,n,r))},once:(t,n,r)=>{e.push(ut(t,n,r,{once:!0}))},cleanup:()=>{for(let t=e.length-1;t>=0;t--)e[t]();e.length=0}}};var N=class e extends M{constructor(e){if(super(),this._reader=null,this._buffer=[],this._bufferIndex=0,this._unshiftBuffer=[],this._bufferSize=0,this._reading=!1,this._ended=!1,this._endEmitted=!1,this._destroyed=!1,this._errored=null,this._closed=!1,this._paused=!0,this._flowing=!1,this._pipeTo=[],this._pipeListeners=new Map,this._encoding=null,this._decoder=null,this._didRead=!1,this._aborted=!1,this._pushMode=!1,this._webStreamMode=!1,this.objectMode=e?.objectMode??!1,this.readableHighWaterMark=e?.highWaterMark??16384,this.autoDestroy=e?.autoDestroy??!0,this.emitClose=e?.emitClose??!0,e?.read&&(this._read=e.read.bind(this),this._pushMode=!0),e?.stream)this._stream=e.stream,this._webStreamMode=!0;else{let e;this._stream=new ReadableStream({start:t=>{e=t},pull:async()=>{this.emit(`drain`)},cancel:e=>{this._ended=!0,this._aborted=!0,this.emitClose&&this.emit(`close`)}}),this._controller=e}}static from(t,n){let r=new e({...n,objectMode:n?.objectMode??!0});return pt(r,ft(t)),r}static isDisturbed(e){return e._didRead||e._ended||e._destroyed}static fromWeb(t,n){return new e({...n,stream:t})}static toWeb(e){return e.webStream}push(e){if(this._destroyed)return!1;this._pushMode=!0;let t=this._controller;if(e===null){if(this._ended)return!1;if(this._ended=!0,t)try{t.close()}catch{}return this._bufferedLength()===0&&this._emitEndOnce(),!1}if(t&&!this._webStreamMode)try{t.enqueue(e)}catch{}if(this._flowing)return this.emit(`data`,this._applyEncoding(e)),this._flowing?(this._read&&!this._ended&&queueMicrotask(()=>{this._flowing&&!this._ended&&!this._destroyed&&this._read(this.readableHighWaterMark)}),!0):!1;{let t=this._bufferedLength()===0;return this._buffer.push(e),this.objectMode||(this._bufferSize+=this._getChunkSize(e)),t&&queueMicrotask(()=>this.emit(`readable`)),this.objectMode?this._bufferedLength()<this.readableHighWaterMark:this._bufferSize<this.readableHighWaterMark}}_emitEndOnce(){this._endEmitted||(this._endEmitted=!0,this.emit(`end`))}unshift(e){this._destroyed||(this._bufferUnshift(e),this.objectMode||(this._bufferSize+=this._getChunkSize(e)))}read(e){if(this._didRead=!0,this._bufferedLength()>0){if(this.objectMode||e===void 0){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e));let t=this._applyEncoding(e);return this._ended&&this._bufferedLength()===0&&queueMicrotask(()=>this._emitEndOnce()),t}let t=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(t));let n=this._applyEncoding(t);return this._ended&&this._bufferedLength()===0&&queueMicrotask(()=>this._emitEndOnce()),n}return null}_bufferedLength(){return this._unshiftBuffer.length+(this._buffer.length-this._bufferIndex)}_bufferPeek(){let e=this._unshiftBuffer.length;return e>0?this._unshiftBuffer[e-1]:this._bufferIndex<this._buffer.length?this._buffer[this._bufferIndex]:null}_bufferShift(){if(this._unshiftBuffer.length>0)return this._unshiftBuffer.pop();let e=this._buffer[this._bufferIndex++];return this._bufferIndex===this._buffer.length?(this._buffer.length=0,this._bufferIndex=0,e):(this._bufferIndex>1024&&this._bufferIndex*2>this._buffer.length&&(this._buffer=this._buffer.slice(this._bufferIndex),this._bufferIndex=0),e)}_bufferUnshift(e){if(this._bufferIndex===0){this._unshiftBuffer.push(e);return}this._bufferIndex--,this._buffer[this._bufferIndex]=e}_getChunkSize(e){return e instanceof Uint8Array?e.byteLength:1}setEncoding(e){return this._encoding=e,e===`utf-8`||e===`utf8`?this._decoder=et:this._decoder=null,this}_applyEncoding(e){return this._encoding&&e instanceof Uint8Array?(this._decoder||=nt(this._encoding),this._decoder.decode(e)):e}wrap(e){return e.on(`data`,t=>{this.push(t)||e.pause()}),e.on(`end`,()=>this.push(null)),e.on(`error`,e=>this.destroy(e)),e.on(`close`,()=>this.destroy()),this}pause(){return this._paused=!0,this._flowing=!1,this}resume(){for(this._paused=!1,this._flowing=!0;this._bufferedLength()>0&&this._flowing;){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e)),this.emit(`data`,this._applyEncoding(e))}return this._ended&&this._bufferedLength()===0?this._emitEndOnce():this._read?queueMicrotask(()=>{this._flowing&&!this._ended&&!this._destroyed&&this._read(this.readableHighWaterMark)}):this._webStreamMode&&!this._pushMode&&this._startReading(),this}on(e,t){return super.on(e,t),e===`data`&&this.resume(),this}isPaused(){return this._paused}pipe(e){let t=e,n=t,r=typeof t?.write==`function`,i=typeof t?.end==`function`,a=typeof n?.on==`function`,o=typeof n?.once==`function`,s=typeof n?.off==`function`;if(!r||!i||!o&&!a||!s&&!n?.removeListener)throw Error(`Readable.pipe: invalid destination`);this._pipeTo.push(t);let c,l=()=>{c&&=(typeof n.off==`function`?n.off(`drain`,c):typeof n.removeListener==`function`&&n.removeListener(`drain`,c),void 0)},u=e=>{if(!t.write(e)&&(this.pause(),!c)){c=()=>{l(),this.resume()},n.on(`drain`,c);let e=this._pipeListeners.get(t);e&&(e.drain=c)}},d=()=>{t.end()},f=e=>{typeof t.destroy==`function`?t.destroy(e):n.emit?.(`error`,e)};return this._pipeListeners.set(t,{data:u,end:d,error:f,eventTarget:n}),this.on(`data`,u),this.once(`end`,d),this.once(`error`,f),this.resume(),e}unpipe(e){if(e){let t=this._pipeTo.indexOf(e);t!==-1&&this._pipeTo.splice(t,1);let n=this._pipeListeners.get(e);n&&(this.off(`data`,n.data),this.off(`end`,n.end),this.off(`error`,n.error),n.drain&&(typeof n.eventTarget?.off==`function`?n.eventTarget.off(`drain`,n.drain):typeof n.eventTarget?.removeListener==`function`&&n.eventTarget.removeListener(`drain`,n.drain)),this._pipeListeners.delete(e))}else{for(let e of this._pipeTo){let t=this._pipeListeners.get(e);t&&(this.off(`data`,t.data),this.off(`end`,t.end),this.off(`error`,t.error),t.drain&&(typeof t.eventTarget?.off==`function`?t.eventTarget.off(`drain`,t.drain):typeof t.eventTarget?.removeListener==`function`&&t.eventTarget.removeListener(`drain`,t.drain)),this._pipeListeners.delete(e))}this._pipeTo=[]}return this.pause(),this}destroy(e){if(this._destroyed)return this;if(this._destroyed=!0,this._ended=!0,this.unpipe(),e&&(this._errored=e,this.emit(`error`,e)),this._reader){let e=this._reader;this._reader=null,e.cancel().catch(()=>{}).finally(()=>{try{e.releaseLock()}catch{}})}return this._closed=!0,this.emit(`close`),this}get webStream(){return this._stream}get readable(){return!this._destroyed&&!this._ended}get readableEnded(){return this._ended}get readableLength(){return this._bufferedLength()}get destroyed(){return this._destroyed}get errored(){return this._errored}get closed(){return this._closed}get readableFlowing(){return!this._paused&&!this._ended?this._flowing:this._flowing?!0:null}get readableAborted(){return this._aborted}get readableDidRead(){return this._didRead}get readableEncoding(){return this._encoding}get readableObjectMode(){return this.objectMode}get readableBuffer(){return{length:this._bufferedLength(),head:this._bufferPeek()}}async _startReading(){if(!(this._reading||this._destroyed||!this._flowing)){this._reading=!0;try{for(this._reader||=this._stream.getReader();this._flowing&&!this._destroyed&&!this._pushMode;){let{done:e,value:t}=await this._reader.read();if(this._pushMode){if(this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}break}if(e){if(this._ended=!0,this._emitEndOnce(),this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}break}t!==void 0&&(this._flowing?this.emit(`data`,this._applyEncoding(t)):(this._buffer.push(t),this.objectMode||(this._bufferSize+=this._getChunkSize(t))))}}catch(e){if(this.emit(`error`,e),this._reader){let e=this._reader;this._reader=null;try{e.releaseLock()}catch{}}}finally{this._reading=!1}}}async*[Symbol.asyncIterator](){for(;this._bufferedLength()>0;){let e=this._bufferShift();this.objectMode||(this._bufferSize-=this._getChunkSize(e)),yield this._applyEncoding(e)}if(this._ended)return;let e=this.readableHighWaterMark,t=Math.max(0,Math.floor(e/2)),n=e=>this.objectMode?1:e instanceof Uint8Array?e.byteLength:typeof e==`string`?e.length:1,r=[],i=0,a=0,o=null,s=null,c=!1,l=!1,u=null,d=t=>{o?(o(t),o=null,s=null):r.push(t),a+=n(t),!l&&a>=e&&(l=!0,this.pause())},f=()=>{c=!0,o&&(o(null),o=null,s=null)},p=()=>{c=!0,o&&(o(null),o=null,s=null)},m=e=>{c=!0,u=e,s&&=(s(e),o=null,null)};this.on(`data`,d),this.on(`end`,f),this.on(`error`,m),this.on(`close`,p);try{for(this.resume();;){if(u)throw u;if(i<r.length){let e=r[i++];a-=n(e),i>=1024&&i*2>=r.length&&(r.splice(0,i),i=0),l&&a<=t&&!c&&!this._destroyed&&(l=!1,this.resume()),yield e;continue}if(c)break;let e=await new Promise((e,t)=>{o=e,s=t});e!==null&&(a-=n(e),l&&a<=t&&!c&&!this._destroyed&&(l=!1,this.resume()),yield e)}}finally{this.off(`data`,d),this.off(`end`,f),this.off(`error`,m),this.off(`close`,p)}}iterator(e){let t=e?.destroyOnReturn??!0,n=this[Symbol.asyncIterator]();return t?{next:async()=>n.next(),return:async e=>(this.destroy(),{done:!0,value:e}),[Symbol.asyncIterator](){return this}}:n}async*map(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);yield await e(t,{signal:n})}}async*filter(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);await e(t,{signal:n})&&(yield t)}}async*flatMap(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);let r=await e(t,{signal:n});for await(let e of r)yield e}}async*take(e,t){let n=t?.signal,r=0;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(r>=e)break;yield t,r++}}async*drop(e,t){let n=t?.signal,r=0;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);r>=e&&(yield t),r++}}async reduce(e,t,n){let r=n?.signal,i=t,a=!0;for await(let t of this){if(r?.aborted)throw Error(`AbortError`);a&&i===void 0?(i=t,a=!1):i=await e(i,t,{signal:r})}if(i===void 0)throw TypeError(`Reduce of empty stream with no initial value`);return i}async every(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(!await e(t,{signal:n}))return!1}return!0}async some(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(await e(t,{signal:n}))return!0}return!1}async find(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);if(await e(t,{signal:n}))return t}}async forEach(e,t){let n=t?.signal;for await(let t of this){if(n?.aborted)throw Error(`AbortError`);await e(t,{signal:n})}}async toArray(e){let t=e?.signal,n=[];for await(let e of this){if(t?.aborted)throw Error(`AbortError`);n.push(e)}return n}async*asIndexedPairs(e){let t=e?.signal,n=0;for await(let e of this){if(t?.aborted)throw Error(`AbortError`);yield[n++,e]}}compose(t){if(typeof t==`function`){let n=t(this);return e.from(n)}return this.pipe(t),t}};function ft(e){return e&&typeof e[Symbol.asyncIterator]==`function`?e:(async function*(){for(let t of e)yield t})()}function pt(e,t){(async()=>{try{for await(let n of t)e.push(n)||await new Promise(e=>setTimeout(e,0));e.push(null)}catch(t){e.destroy(t)}})()}var P=class e extends M{constructor(e){if(super(),this._writer=null,this._ended=!1,this._finished=!1,this._destroyed=!1,this._errored=null,this._closed=!1,this._pendingWrites=0,this._writableLength=0,this._needDrain=!1,this._corked=0,this._corkedChunks=[],this._defaultEncoding=`utf8`,this._aborted=!1,this._ownsStream=!1,this.objectMode=e?.objectMode??!1,this.writableHighWaterMark=e?.highWaterMark??16384,this.autoDestroy=e?.autoDestroy??!0,this.emitClose=e?.emitClose??!0,this._defaultEncoding=e?.defaultEncoding??`utf8`,e?.write&&(this._writeFunc=e.write.bind(this)),e?.final&&(this._finalFunc=e.final.bind(this)),e?.stream)this._stream=e.stream,this._ownsStream=!1;else{this._ownsStream=!0;let e=()=>this._writeFunc,t=()=>this._finalFunc,n=()=>this._defaultEncoding,r=e=>{this._finished=e},i=e=>{this._aborted=e},a=this.emit.bind(this),o=()=>this.emitClose,s=e=>this._write?.(e);this._stream=new WritableStream({write:async t=>{let r=e();r?await new Promise((e,i)=>{r(t,n(),t=>{t?i(t):e()})}):s(t)},close:async()=>{let e=t();e&&await new Promise((t,n)=>{e(e=>{e?n(e):t()})}),r(!0),a(`finish`),o()&&a(`close`)},abort:e=>{i(!0),a(`error`,e)}})}}setDefaultEncoding(e){return this._defaultEncoding=e,this}cork(){this._corked++}uncork(){if(this._corked>0&&this._corked--,this._corked===0){let e=this._corkedChunks;this._corkedChunks=[];for(let{chunk:t,callback:n}of e)this._doWrite(t,n)}}write(e,t,n){if(this._destroyed||this._ended)return(typeof t==`function`?t:n)?.(Error(`Cannot write after stream destroyed/ended`)),!1;let r=typeof t==`function`?t:n;if(this._corked>0){this._corkedChunks.push({chunk:e,callback:r});let t=this._getChunkSize(e);return this._writableLength+=t,this._writableLength<this.writableHighWaterMark}let i=this._doWrite(e,r);return i||(this._needDrain=!0),i}_doWrite(e,t){let n=this._getChunkSize(e);return this._pendingWrites++,this._writableLength+=n,this._getWriter().write(e).then(()=>{this._pendingWrites--,this._writableLength-=n,this._needDrain&&this._writableLength<this.writableHighWaterMark&&(this._needDrain=!1,this.emit(`drain`)),t?.(null)}).catch(e=>{this._pendingWrites--,this._writableLength-=n,this._destroyed||(this._errored=e,this.emit(`error`,e)),t?.(e)}),this._writableLength<this.writableHighWaterMark}_getChunkSize(e){return this.objectMode?1:e instanceof Uint8Array?e.byteLength:typeof e==`string`?e.length:0}end(e,t,n){if(this._ended)return this;this._ended=!0;let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return(async()=>{try{let e=this._getWriter();if(r!==void 0&&await e.write(r),await e.close(),this._writer===e){this._writer=null;try{e.releaseLock()}catch{}}this._ownsStream||(this._finished=!0,this.emit(`finish`),this.emitClose&&this.emit(`close`)),i&&i()}catch(e){this.emit(`error`,e)}})(),this}destroy(e){if(this._destroyed)return this;if(this._destroyed=!0,this._ended=!0,e&&!this._errored&&(this._errored=e,this.emit(`error`,e)),this._writer){let t=this._writer;this._writer=null,t.abort(e).catch(()=>{}).finally(()=>{try{t.releaseLock()}catch{}})}return this._closed=!0,this.emit(`close`),this}get webStream(){return this._stream}get writable(){return!this._destroyed&&!this._ended}get writableEnded(){return this._ended}get writableFinished(){return this._finished}get writableLength(){return this._writableLength}get destroyed(){return this._destroyed}get errored(){return this._errored}get closed(){return this._closed}get writableNeedDrain(){return this._writableLength>=this.writableHighWaterMark}get writableCorked(){return this._corked}get writableAborted(){return this._aborted}get writableObjectMode(){return this.objectMode}get defaultEncoding(){return this._defaultEncoding}get writableBuffer(){return{length:this._corkedChunks.length,head:this._corkedChunks.length>0?this._corkedChunks[0].chunk:null}}_writev(e,t){let n=0,r=()=>{if(n>=e.length){t(null);return}let{chunk:i}=e[n++];this._doWrite(i,e=>{if(e){t(e);return}r()})};r()}writev(e,t){return this._destroyed||this._ended?(t?.(Error(`Cannot write after stream destroyed/ended`)),!1):(this._writev(e,t??(()=>{})),this._writableLength<this.writableHighWaterMark)}_getWriter(){return this._writer||=this._stream.getWriter(),this._writer}static fromWeb(t,n){return new e({...n,stream:t})}static toWeb(e){return e.webStream}};function mt(e){return e instanceof P?e:e?.getWriter?new P({stream:e}):e}var ht=class e extends M{push(e){return this._readable.push(e)}constructor(e){super(),this._destroyed=!1,this._ended=!1,this._errored=!1,this._dataForwardingSetup=!1,this._endTimer=null,this._webStream=null,this._sideForwardingCleanup=null,this.objectMode=e?.objectMode??!1,this._transformImpl=e?.transform,this._flushImpl=e?.flush,this._readable=new N({objectMode:this.objectMode}),this._writable=new P({objectMode:this.objectMode,write:(e,t,n)=>{this._runTransform(e).then(()=>n(null)).catch(e=>n(e))},final:e=>{this._runFlush().then(()=>{this._readable.push(null),e(null)}).catch(t=>e(t))}}),this._setupSideForwarding()}_setupSideForwarding(){this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null);let e=dt();e.once(this._readable,`end`,()=>this.emit(`end`)),e.add(this._readable,`error`,e=>this._emitErrorOnce(e)),e.once(this._writable,`finish`,()=>this.emit(`finish`)),e.add(this._writable,`drain`,()=>this.emit(`drain`)),e.add(this._writable,`error`,e=>this._emitErrorOnce(e)),this._sideForwardingCleanup=()=>e.cleanup()}_scheduleEnd(){this._destroyed||this._errored||this._writable.writableEnded||(this._endTimer&&clearTimeout(this._endTimer),this._endTimer=setTimeout(()=>{this._endTimer=null,!(this._destroyed||this._errored||this._writable.writableEnded)&&this._writable.end()},0))}_emitErrorOnce(e){if(this._errored)return;this._errored=!0;let t=e instanceof Error?e:Error(String(e));this.emit(`error`,t),this._destroyed||(this._destroyed=!0,this._readable.destroy(t),this._writable.destroy(t),queueMicrotask(()=>this.emit(`close`)))}_hasSubclassTransform(){return this._transformImpl?!1:Object.getPrototypeOf(this)._transform!==e.prototype._transform}_hasSubclassFlush(){return this._flushImpl?!1:Object.getPrototypeOf(this)._flush!==e.prototype._flush}async _runTransform(e){if(this._destroyed||this._errored)throw Error(this._errored?`Cannot write after stream errored`:`Cannot write after stream destroyed`);try{if(this._hasSubclassTransform()){await new Promise((t,n)=>{this._transform(e,`utf8`,(e,r)=>{if(e){n(e);return}r!==void 0&&this.push(r),t()})});return}let t=this._transformImpl;if(!t){this.push(e);return}let n=t.length;if(n>=3){await new Promise((n,r)=>{t.call(this,e,`utf8`,(e,t)=>{if(e){r(e);return}t!==void 0&&this.push(t),n()})});return}if(n===2){await new Promise((n,r)=>{t.call(this,e,(e,t)=>{if(e){r(e);return}t!==void 0&&this.push(t),n()})});return}let r=t.call(this,e);if(r instanceof Promise){let e=await r;e!==void 0&&this.push(e);return}r!==void 0&&this.push(r)}catch(e){throw this._emitErrorOnce(e),e}}async _runFlush(){if(!(this._destroyed||this._errored))try{if(this._hasSubclassFlush()){await new Promise((e,t)=>{this._flush((n,r)=>{if(n){t(n);return}r!==void 0&&this.push(r),e()})});return}let e=this._flushImpl;if(!e)return;if(e.length>=1){await new Promise((t,n)=>{e.call(this,(e,r)=>{if(e){n(e);return}r!==void 0&&this.push(r),t()})});return}let t=e.call(this);if(t instanceof Promise){let e=await t;e!=null&&this.push(e);return}t!=null&&this.push(t)}catch(e){throw this._emitErrorOnce(e),e}}on(e,t){return e===`data`&&!this._dataForwardingSetup&&(this._dataForwardingSetup=!0,this._readable.on(`data`,e=>this.emit(`data`,e))),super.on(e,t)}write(e,t,n){let r=typeof t==`function`?t:n;return this._ended&&!this._writable.writableEnded&&this._scheduleEnd(),this._writable.write(e,r)}end(e,t,n){if(this._ended)return this;this._ended=!0;let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return i&&this.once(`finish`,i),r!==void 0&&this._writable.write(r),this._scheduleEnd(),this}read(e){return this._readable.read(e)}pipe(e){return this._readable.pipe(e)}unpipe(e){return this._readable.unpipe(e),this}isPaused(){return this._readable.isPaused()}resume(){return this._readable.resume(),this}pause(){return this._readable.pause(),this}destroy(e){this._destroyed||(this._destroyed=!0,this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null),this._readable.destroy(e),this._writable.destroy(e),queueMicrotask(()=>this.emit(`close`)))}get webStream(){if(this._webStream)return this._webStream;let e=this[Symbol.asyncIterator]();return this._webStream={readable:new ReadableStream({pull:async t=>{let{done:n,value:r}=await e.next();if(n){t.close();return}t.enqueue(r)},cancel:e=>{this.destroy(e instanceof Error?e:Error(String(e)))}}),writable:new WritableStream({write:e=>new Promise((t,n)=>{this.write(e,e=>{e?n(e):t()})}),close:()=>new Promise(e=>{this.end(()=>e())}),abort:e=>{this.destroy(e instanceof Error?e:Error(String(e)))}})},this._webStream}get readable(){return this._readable.readable}get writable(){return this._writable.writable}get readableEnded(){return this._readable.readableEnded}get writableEnded(){return this._writable.writableEnded}get writableFinished(){return this._writable.writableFinished}get readableLength(){return this._readable.readableLength}get writableLength(){return this._writable.writableLength}get readableHighWaterMark(){return this._readable.readableHighWaterMark}get writableHighWaterMark(){return this._writable.writableHighWaterMark}get readableObjectMode(){return this._readable.readableObjectMode??this._readable.objectMode}get readableFlowing(){return this._readable.readableFlowing}get destroyed(){return this._destroyed}async*[Symbol.asyncIterator](){yield*this._readable[Symbol.asyncIterator]()}static fromWeb(t,n){let r=new e(n);r._webStream=t;let i=N.fromWeb(t.readable,{objectMode:n?.objectMode}),a=P.fromWeb(t.writable,{objectMode:n?.objectMode});return r._sideForwardingCleanup&&=(r._sideForwardingCleanup(),null),r._readable=i,r._writable=a,r._setupSideForwarding(),r}static toWeb(e){return e.webStream}_transform(e,t,n){n(null,e)}_flush(e){e()}},gt=class e extends M{static from(t){if(t instanceof e)return t;let n=(e,t)=>{let n=new P({objectMode:t.readableObjectMode,write(e,n,r){t.push(e),r()},final(e){t.push(null),e()}}),r=ut(e,`error`,e=>{t.emit(`error`,e)});ut(e,`end`,r,{once:!0}),ut(e,`close`,r,{once:!0}),ut(n,`finish`,r,{once:!0}),e.pipe(n)};if(typeof t==`object`&&t&&`readable`in t&&`writable`in t){let r=t,i=new e({readableObjectMode:r.readable?.readableObjectMode,writableObjectMode:r.writable?.writableObjectMode,write:r.writable?(e,t,n)=>{r.writable.write(e,t,n)}:void 0,final:r.writable?e=>{r.writable.end(e)}:void 0});return r.readable&&n(r.readable,i),i}if(typeof t==`object`&&t&&(Symbol.asyncIterator in t||Symbol.iterator in t)){let r=N.from(t),i=new e;return n(r,i),i}if(t instanceof N){let r=new e;return n(t,r),r}if(t instanceof P)return new e({objectMode:!0,write(e,n,r){t.write(e,n,r)},final(e){t.end(e)}});throw Error(`Duplex.from: unsupported source type`)}static fromWeb(t,n){let r=new e(n),i=new N({stream:t.readable,objectMode:r.readableObjectMode}),a=new P({stream:t.writable,objectMode:r.writableObjectMode});return r._sideForwardingCleanup&&=(r._sideForwardingCleanup(),null),r._readable=i,r._writable=a,r._setupSideForwarding(),r}static toWeb(e){return{readable:e._readable.webStream,writable:e._writable.webStream}}constructor(e){super(),this._dataForwardingSetup=!1,this._sideForwardingCleanup=null,this.allowHalfOpen=e?.allowHalfOpen??!0;let t=e?.objectMode??!1;this.readableObjectMode=e?.readableObjectMode??t,this.writableObjectMode=e?.writableObjectMode??t,this._readable=new N({highWaterMark:e?.readableHighWaterMark,objectMode:this.readableObjectMode,read:e?.read?.bind(this)}),this._writable=new P({highWaterMark:e?.writableHighWaterMark,objectMode:this.writableObjectMode,write:e?.write?.bind(this),final:e?.final?.bind(this)}),this._setupSideForwarding()}_setupSideForwarding(){this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null);let e=dt();e.once(this._readable,`end`,()=>{this.emit(`end`),this.allowHalfOpen||this._writable.end()}),e.add(this._readable,`error`,e=>this.emit(`error`,e)),e.add(this._writable,`error`,e=>this.emit(`error`,e)),e.once(this._writable,`finish`,()=>this.emit(`finish`)),e.add(this._writable,`drain`,()=>this.emit(`drain`)),e.once(this._writable,`close`,()=>{!this.allowHalfOpen&&!this._readable.destroyed&&this._readable.destroy()}),this._sideForwardingCleanup=()=>e.cleanup()}on(e,t){return e===`data`&&!this._dataForwardingSetup&&(this._dataForwardingSetup=!0,this._readable.on(`data`,e=>this.emit(`data`,e))),super.on(e,t)}push(e){return this._readable.push(e)}unshift(e){this._readable.unshift(e)}read(e){return this._readable.read(e)}write(e,t,n){let r=typeof t==`function`?t:n;return this._writable.write(e,r)}end(e,t,n){let r=typeof e==`function`?void 0:e,i=typeof e==`function`?e:typeof t==`function`?t:n;return i&&this.once(`finish`,i),r!==void 0&&this._writable.write(r),this._writable.end(),this}cork(){this._writable.cork()}uncork(){this._writable.uncork()}setEncoding(e){return this._readable.setEncoding(e),this}setDefaultEncoding(e){return this._writable.setDefaultEncoding(e),this}pipe(e){return e instanceof ht?(this._readable.pipe(e._writable),e):(this._readable.pipe(e),e)}unpipe(e){return this._readable.unpipe(e),this}pause(){return this._readable.pause(),this}resume(){return this._readable.resume(),this}isPaused(){return this._readable.isPaused()}destroy(e){return this._sideForwardingCleanup&&=(this._sideForwardingCleanup(),null),this._readable.destroy(e),this._writable.destroy(e),this}get readable(){return this._readable.readable}get writable(){return this._writable.writable}get readableEnded(){return this._readable.readableEnded}get writableEnded(){return this._writable.writableEnded}get writableFinished(){return this._writable.writableFinished}get readableLength(){return this._readable.readableLength}get writableLength(){return this._writable.writableLength}get readableHighWaterMark(){return this._readable.readableHighWaterMark}get writableHighWaterMark(){return this._writable.writableHighWaterMark}get destroyed(){return this._readable.destroyed&&this._writable.destroyed}get writableCorked(){return this._writable.writableCorked}get writableNeedDrain(){return this._writable.writableNeedDrain}[Symbol.asyncIterator](){return this._readable[Symbol.asyncIterator]()}},_t=class extends ht{constructor(e){super({...e,transform:e=>e})}};let vt=e=>!e||typeof e!=`object`||typeof e.pipe==`function`||typeof e.write==`function`||typeof e.end==`function`||typeof e.getReader==`function`||typeof e.getWriter==`function`?!1:Object.prototype.hasOwnProperty.call(e,`signal`)||Object.prototype.hasOwnProperty.call(e,`end`),yt=e=>e instanceof N||e instanceof P||e instanceof ht||e instanceof gt?e:ct(e)?ht.fromWeb(e):at(e)?N.fromWeb(e):ot(e)?P.fromWeb(e):e;function bt(...e){let t,n={},r,i=e[e.length-1];typeof i==`function`?(r=i,t=e.slice(0,-1)):vt(i)?(n=i,t=e.slice(0,-1)):t=e;let a=new Promise((e,r)=>{if(t.length<2){r(Error(`Pipeline requires at least 2 streams`));return}let i=t.map(yt),a=i[0],o=i[i.length-1],s=i.slice(1,-1),c=!1,l=[a,...s,o],u=dt(),d,f=t=>{if(!c)if(c=!0,u.cleanup(),d&&n.signal&&n.signal.removeEventListener(`abort`,d),t){for(let e of l)typeof e.destroy==`function`&&e.destroy(t);r(t)}else e()};if(n.signal){if(n.signal.aborted){f(Error(`Pipeline aborted`));return}d=()=>f(Error(`Pipeline aborted`)),n.signal.addEventListener(`abort`,d)}let p=a;for(let e of s)p.pipe(e),p=e;if(n.end!==!1)p.pipe(o);else{let e=!1,t=!1,n=()=>{t=!1,e&&typeof p.resume==`function`&&(e=!1,p.resume())};u.add(p,`data`,r=>{!o.write(r)&&!t&&(t=!0,!e&&typeof p.pause==`function`&&(e=!0,p.pause()),u.once(o,`drain`,n))}),u.once(p,`end`,()=>f())}u.once(o,`finish`,()=>f());for(let e of l)u.once(e,`error`,e=>f(e))});return r&&a.then(()=>r(null)).catch(e=>r(e)),a}function xt(e,t,n){let r={},i;typeof t==`function`?i=t:t&&(r=t,i=n);let a=new Promise((t,n)=>{let i=yt(e),a=!1,o=dt(),s,c=()=>{o.cleanup(),s&&r.signal&&r.signal.removeEventListener(`abort`,s)},l=e=>{a||(a=!0,c(),e&&!r.error?n(e):t())};if(r.signal){if(r.signal.aborted){l(Error(`Aborted`));return}s=()=>l(Error(`Aborted`)),r.signal.addEventListener(`abort`,s)}let u=r.readable!==!1,d=r.writable!==!1;if(u&&i.readableEnded){l();return}if(d&&i.writableFinished){l();return}d&&o.once(i,`finish`,()=>l()),u&&o.once(i,`end`,()=>l()),o.once(i,`error`,e=>l(e)),o.once(i,`close`,()=>l())});return i&&a.then(()=>i(null)).catch(e=>i(e)),a}function St(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}let Ct={async hash(e,...t){let n=it(t),r=await crypto.subtle.digest(e,new Uint8Array(n));return new Uint8Array(r)},async convertPasswordToHash(e,t,n,r){let i=Ze(e),a=Me(n),o=await this.hash(t,a,i);for(let e=0;e<r;e++)o=await this.hash(t,o,St(e));return Xe(o)},randomBytes(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}};var wt=class{constructor(e){this.code=e}toString(){return`#${this.code}`}};let Tt={sum:`Sum`,count:`Count`,average:`Average`,max:`Max`,min:`Min`,product:`Product`,countNums:`Count Numbers`,stdDev:`StdDev`,stdDevP:`StdDevP`,var:`Var`,varP:`VarP`},Et=new Set(Object.keys(Tt));function Dt(e){let t=e.model;if(t.headerRow===!1)throw Error(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!t.rows||t.rows.length===0)throw Error(`Cannot create pivot table from an empty table. Add data rows to the table.`);let r=t.columns.map(e=>e.name),i=new Set;for(let e of r){if(i.has(e))throw Error(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);i.add(e)}let a=[void 0,...r],o=t.rows.map(e=>[void 0,...e]),s=t.tl;if(!s)throw Error(`Table "${t.name}" is missing top-left cell address (tl)`);let c=s.row,l=s.col,u=c+t.rows.length,d=l+r.length-1,f=n.encode(c,l,u,d);return{name:e.worksheet.name,tableName:t.name,getRow(e){if(e===1)return{values:a};let t=e-2;return t>=0&&t<o.length?{values:o[t]}:{values:[]}},getColumn(e){if(e<1||e>r.length)return{values:[]};let n=[];n[1]=r[e-1];for(let r=0;r<t.rows.length;r++)n[r+2]=t.rows[r][e-1];return{values:n}},getSheetValues(){let e=[];e[1]=a;for(let t=0;t<o.length;t++)e[t+2]=o[t];return e},dimensions:{shortRange:f}}}function Ot(e){if(e.sourceSheet&&e.sourceTable)throw Error(`Cannot specify both sourceSheet and sourceTable. Choose one.`);if(e.sourceTable)return Dt(e.sourceTable);if(!e.sourceSheet)throw Error(`Either sourceSheet or sourceTable must be provided.`);return e.sourceSheet}function kt(e){return typeof e==`string`?e:e.name}function At(e){return typeof e==`string`?void 0:e.metric}function jt(e,t){let n=Ot(t);Mt(t,n);let{rows:r}=t,i=t.columns??[],a=t.pages??[],o=t.values.map(kt),s=t.metric??`sum`,c=t.values.map(e=>At(e)??s),l=Pt(n,[...r,...i,...a],o),u={};for(let e=0;e<l.length;e++)u[l[e].name]=e;let d=(e,t)=>{let n=u[e];if(n===void 0)throw Error(`${t} field "${e}" not found in cache fields`);return n},f=r.map(e=>d(e,`Row`)),p=i.map(e=>d(e,`Column`)),m=o.map(e=>d(e,`Value`)),h=a.map(e=>d(e,`Page`)),g=e.workbook.pivotTables.map(e=>e.tableNumber).filter(e=>Number.isFinite(e)),_=g.length>0?g.reduce((e,t)=>e>t?e:t,-1/0)+1:1,v=e.workbook.pivotTables.map(e=>parseInt(e.cacheId,10)).filter(e=>Number.isFinite(e)),y=v.length>0?v.reduce((e,t)=>e>t?e:t,-1/0)+1:10+_-1;return{source:n,rows:f,columns:p,values:m,pages:h,metric:s,valueMetrics:c,cacheFields:l,cacheId:String(y),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:_}}function Mt(e,t){let n=e.columns??[],r=e.pages??[],i=e.values.map(kt),a=t.getRow(1).values.slice(1);for(let e=0;e<a.length;e++){let n=a[e];if(n==null||n===``||typeof n==`string`&&n.trim()===``)throw Error(`Empty or missing header name at column ${e+1} in ${t.name}. Pivot tables require all columns to have non-empty headers.`)}let o=new Set;for(let e of a){let n=String(e);if(o.has(n))throw Error(`Duplicate header name "${n}" found in ${t.name}. Pivot tables require unique column names.`);o.add(n)}let s=new Set(a.map(String)),c=e=>{if(!s.has(e))throw Error(`The header name "${e}" was not found in ${t.name}.`)};for(let t of e.rows)c(t);for(let e of n)c(e);for(let e of i)c(e);for(let e of r)c(e);let l=new Map,u=[{name:`rows`,fields:e.rows},{name:`columns`,fields:n},{name:`pages`,fields:r}];for(let e of u)for(let t of e.fields){let n=l.get(t);if(n===e.name)throw Error(`Duplicate field "${t}" in ${e.name}. Each field can only appear once per axis area.`);if(n)throw Error(`Field "${t}" cannot appear in both ${n} and ${e.name}. Each field can only be assigned to one axis area.`);l.set(t,e.name)}if(!e.rows.length)throw Error(`No pivot table rows specified.`);if(e.values.length<1)throw Error(`Must have at least one value.`);if(e.metric!==void 0&&!Et.has(e.metric))throw Error(`Invalid metric "${e.metric}". Must be one of: ${[...Et].join(`, `)}.`);for(let t of e.values){let e=At(t);if(e!==void 0&&!Et.has(e))throw Error(`Invalid metric "${e}" on value field "${kt(t)}". Must be one of: ${[...Et].join(`, `)}.`)}let d=new Set;for(let e of i){if(d.has(e))throw Error(`Duplicate value field "${e}". Each value field name must be unique.`);d.add(e)}}function Nt(e){if(e==null)return null;if(typeof e!=`object`||e instanceof Date||e instanceof wt)return e;let t=e;if(typeof t.error==`string`){let e=t.error;return new wt(e.startsWith(`#`)?e.slice(1):e)}if(`formula`in t||`sharedFormula`in t){let e=t.result;return e==null?null:Nt(e)}return Array.isArray(t.richText)?t.richText.map(e=>e.text??``).join(``):typeof t.text==`string`&&typeof t.hyperlink==`string`?t.text:typeof t.checkbox==`boolean`?t.checkbox:String(e)}function Pt(e,t,n){let r=e.getRow(1).values,i=new Set(t),a=new Set(n),o=t=>{let n=e.getColumn(t).values,r=new Set,i=new Map,a=!1;for(let e=2;e<n.length;e++){let t=Nt(n[e]);t===null||typeof t==`number`&&isNaN(t)?a=!0:t instanceof wt?i.has(t.code)||(i.set(t.code,t),r.add(t)):r.add(t)}let o=Ge(r);return a&&o.push(null),o},s=t=>{let n=e.getColumn(t).values,r=1/0,i=-1/0,a=!1,o=!0;for(let e=2;e<n.length;e++){let t=Nt(n[e]);typeof t==`number`&&!isNaN(t)&&(a=!0,t<r&&(r=t),t>i&&(i=t),Number.isInteger(t)||(o=!1))}return a?{minValue:r,maxValue:i,allInteger:o}:null},c=[];for(let e of We(1,r.length)){let t=r[e],n=String(t);if(i.has(n))c.push({name:n,sharedItems:o(e)});else if(a.has(n)){let t=s(e);c.push({name:n,sharedItems:null,containsNumber:t?`1`:void 0,minValue:t?.minValue,maxValue:t?.maxValue,containsInteger:t?.allInteger?`1`:void 0})}else c.push({name:n,sharedItems:null})}return c}function Ft(e,t,n,r,i){let a=i(e,t)?.style?.border,o=r-t+1,s=n-e+1,c=Array(o),l=Array(o),u=Array(s),d=Array(s),f=!1;for(let o=t;o<=r;o++){let r=o-t,s=i(e,o)?.style?.border;c[r]=s?.top||a?.top,n===e?l[r]=s?.bottom||a?.bottom:l[r]=i(n,o)?.style?.border?.bottom||a?.bottom,(c[r]||l[r])&&(f=!0)}for(let o=e;o<=n;o++){let n=o-e,s=i(o,t)?.style?.border;u[n]=s?.left||a?.left,r===t?d[n]=s?.right||a?.right:d[n]=i(o,r)?.style?.border?.right||a?.right,(u[n]||d[n])&&(f=!0)}let p=a?.diagonal,m=a?.color;if(!(!f&&!p))return{topEdges:c,bottomEdges:l,leftEdges:u,rightEdges:d,diagonal:p,color:m}}function It(e,t,n,r,i,a){let{topEdges:o,bottomEdges:s,leftEdges:c,rightEdges:l,diagonal:u,color:d}=i,f=a(e,t).style;for(let i=e;i<=n;i++)for(let p=t;p<=r;p++){let m=a(i,p),h=k(f)||{},g={},_=!1;i===e&&o[p-t]&&(g.top=o[p-t],_=!0),i===n&&s[p-t]&&(g.bottom=s[p-t],_=!0),p===t&&c[i-e]&&(g.left=c[i-e],_=!0),p===r&&l[i-e]&&(g.right=l[i-e],_=!0),u&&(g.diagonal=u,_=!0),_?(d&&(g.color=d),h.border=g):delete h.border,m.style=h}}var Lt=class{constructor(e){e||={},this._workbook=e.workbook,this.id=e.id??0,this.orderNo=e.orderNo??0,this.name=e.name||`sheet${this.id}`,this.state=e.state??`visible`,this._rows=[],this._columns=null,this._keys={},this._merges={},this.rowBreaks=[],this.colBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:void 0,verticalDpi:void 0,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.dataValidations=new Ce,this.views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[],this.formControls=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name!==e){if(typeof e!=`string`)throw Error(`The name has to be a string.`);if(e===``)throw Error(`The name can't be empty.`);if(e===`History`)throw Error(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw Error(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw Error(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);if(e&&e.length>31&&(e=e.substring(0,31)),this._workbook.worksheets.find(t=>t&&t.name.toLowerCase()===e.toLowerCase()))throw Error(`Worksheet name already exists: ${e}`);this._name=e}}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new r;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:t.header?1:0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new fe(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){let t;if(typeof e==`string`){let r=this._keys[e];if(r)return r;t=n.l2n(e)}else t=e;if(this._columns||=[],t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new fe(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===u.ValueType.Merge&&e.unmerge()}let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]??null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns?this._columns.length:0;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;if(this.workbook.definedNames.spliceColumns(this.name,e,t,n.length),i!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeCol>=e-1&&(n.nativeCol=Math.max(0,n.nativeCol+i)),r&&r.nativeCol>=e-1&&(r.nativeCol=Math.max(0,r.nativeCol+i))}}this._spliceMerges(`col`,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new de(this,e),t}getRows(e,t){if(t<1)return;let n=[];for(let r=e;r<e+t;r++)n.push(this.getRow(r));return n}addRow(e,t=`n`){let n=this._nextRow,r=this.getRow(n);return r.values=e,this._setStyleOption(n,t[0]===`i`?t:`n`),r}addRows(e,t=`n`){let n=[];return e.forEach(e=>{n.push(this.addRow(e,t))}),n}insertRow(e,t,n=`n`){return this.spliceRows(e,0,t),this._setStyleOption(e,n),this.getRow(e)}insertRows(e,t,n=`n`){if(this.spliceRows(e,0,...t),n!==`n`)for(let r=0;r<t.length;r++)n[0]===`o`&&this.findRow(t.length+e+r)!==void 0?this._copyStyle(t.length+e+r,e+r,n[1]===`+`):n[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e+r,n[1]===`+`);return this.getRows(e,t.length)}_setStyleOption(e,t=`n`){t[0]===`o`&&this.findRow(e+1)!==void 0?this._copyStyle(e+1,e,t[1]===`+`):t[0]===`i`&&this.findRow(e-1)!==void 0&&this._copyStyle(e-1,e,t[1]===`+`)}_copyStyle(e,t,n=!1){let r=this.getRow(e),i=this.getRow(t);i.style=k(r.style)??{},r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=k(e.style)??{}}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this._rows[e-1],i=Array.from({length:t}).fill(r.values),a=[];for(let t of Object.values(this._merges))t.top===e&&t.bottom===e&&a.push(t);let o=[],s=e-1;for(let e of this._media)e.type===`image`&&e.range&&e.range.tl.nativeRow===s&&o.push(e);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=k(r.style)??{},t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=k(e.style)??{}})}if(a.length>0)for(let r=0;r<t;r++){let t=e+1+r;if(!n){let e=[];for(let[n,r]of Object.entries(this._merges))r.top<=t&&r.bottom>=t&&e.push(n);for(let t of e)this._unMergeMaster(this.getCell(t))}for(let e of a)this.mergeCellsWithoutStyle(t,e.left,t,e.right)}if(!n){let n=e,r=e+t-1;this._media=this._media.filter(e=>{if(e.type===`image`&&e.range){let t=e.range.tl.nativeRow;return t<n||t>r}return!0})}for(let e=0;e<t;e++){let t=e+1;for(let e of o){let n=e.clone();if(n.range.tl.nativeRow=s+t,n.range.br){let r=e.range.br.nativeRow-s;n.range.br.nativeRow=s+t+r}this._media.push(n)}}}spliceRows(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===u.ValueType.Merge&&e.unmerge()}let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=k(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=k(t.style)??{}}),this._rows[s-1]=void 0}else this._rows[s+a-1]=void 0;else if(a>0)for(s=o;s>=r;s--)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=k(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=k(t.style)??{}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}if(this.workbook.definedNames.spliceRows(this.name,e,t,i),a!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeRow>=e-1&&(n.nativeRow=Math.max(0,n.nativeRow+a)),r&&r.nativeRow>=e-1&&(r.nativeRow=Math.max(0,r.nativeRow+a))}}this._spliceMerges(`row`,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let r=n.getAddress(e,t),i=this._rows[r.row-1];return i?i.findCell(r.col):void 0}getCell(e,t){let r=n.getAddress(e,t);return this.getRow(r.row).getCellEx(r)}mergeCells(...e){let t=new r(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new r(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw Error(`Cannot merge already merged cells`)});let{top:n,left:r,bottom:i,right:a}=e,o=t?void 0:Ft(n,r,i,a,(e,t)=>this.findCell(e,t)),s=this.getCell(e.top,e.left);for(let e=n;e<=i;e++)for(let i=r;i<=a;i++)(e>n||i>r)&&this.getCell(e,i).merge(s,t);o&&It(n,r,i,a,o,(e,t)=>this.getCell(e,t)),this._merges[s.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}_spliceMerges(e,t,i,a){let o=a-i;if(o===0&&i===0)return;let s=t+i,c=e===`row`,l={};for(let e of Object.values(this._merges)){let{top:a,left:u,bottom:d,right:f}=e.model,p=c?a:u,m=c?d:f;if(o<=0&&i>0){let i=s-1;if(p>i){let e=c?new r(a+o,u,d+o,f):new r(a,u+o,d,f+o);l[n.encodeAddress(e.top,e.left)]=e}else if(m<t)l[n.encodeAddress(a,u)]=e;else if(!(p>=t&&m<=i)){let e=a,i=u,s=d,p=f;c?(e=a<t?a:t,s=Math.max(e,d+o)):(i=u<t?u:t,p=Math.max(i,f+o));let m=new r(e,i,s,p);e===s&&i===p||(l[n.encodeAddress(m.top,m.left)]=m)}}else if(p>=s){let e=c?new r(a+o,u,d+o,f):new r(a,u+o,d,f+o);l[n.encodeAddress(e.top,e.left)]=e}else m<s||(c?e.model.bottom=d+o:e.model.right=f+o),l[n.encodeAddress(a,u)]=e}this._merges=l;for(let e of Object.values(l)){let t=this.getCell(e.top,e.left);for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++)(n>e.top||r>e.left)&&this.getCell(n,r).merge(t,!0)}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new r(e);for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++){let t=this.findCell(e,n);t&&(t.type===u.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,t,r,i=`shared`){let{top:a,left:o,bottom:s,right:c}=n.decode(e),l=c-o+1,u=n.encodeAddress(a,o),d=i===`shared`,f;f=typeof r==`function`?r:Array.isArray(r)?Array.isArray(r[0])?(e,t)=>r[e-a][t-o]:(e,t)=>r[(e-a)*l+(t-o)]:()=>void 0;let p=!0;for(let n=a;n<=s;n++)for(let r=o;r<=c;r++)if(p){let a=this.getCell(n,r);a.value={shareType:i,formula:t,ref:e,result:f(n,r)},p=!1}else this.getCell(n,r).value=d?{sharedFormula:u,result:f(n,r)}:f(n,r)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new ge(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new ge(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}addFormCheckbox(e,t){let n=new Ae(this,e,t);return this.formControls.push(n),n}getFormCheckboxes(){return this.formControls}async protect(e,t){this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=Xe(Ct.randomBytes(16)),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=await Ct.convertPasswordToHash(e,`SHA-512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount)}unprotect(){this.sheetProtection=null}addTable(e){let t=new Se(this,e);return this.tables[t.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=jt(this,e);return this.pivotTables.push(t),this.workbook.pivotTables.push(t),t}addConditionalFormatting(e){this.conditionalFormattings.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormattings.splice(e,1):e instanceof Function?this.conditionalFormattings=this.conditionalFormattings.filter(e):this.conditionalFormattings=[]}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,colBreaks:this.colBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings,formControls:this.formControls.map(e=>e.model),drawing:this._drawing};e.cols=fe.toModel(this.columns??[]);let t=e.rows=[],n=e.dimensions=new r;return this._rows.forEach(e=>{let r=e&&e.model;r&&(n.expand(r.number,r.min,r.number,r.max),t.push(r))}),e.merges=[],Object.values(this._merges).forEach(t=>{e.merges.push(t.range)}),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new de(this,e.number);this._rows[t.number-1]=t,t.model=e})}_parseMergeCells(e){e.mergeCells&&e.mergeCells.forEach(e=>{this.mergeCellsWithoutStyle(e)})}set model(e){this.name=e.name,this._columns=fe.fromModel(this,e.cols??[]),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new Ce(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.rowBreaks=e.rowBreaks??[],this.colBreaks=e.colBreaks??[],this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new ge(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new Se(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings,this.formControls=[],this._drawing=e.drawing}};function Rt(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function zt(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>zt(e));let t={};for(let n of Object.keys(e))Rt(n)&&(t[n]=zt(e[n]));return t}var Bt=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(n.decodeEx(e))}getCell(e){return this.findCellEx(n.decodeEx(e),!0)}findCell(e){return this.findCellEx(n.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets[e],i=r&&r[t];return i&&i[n]}addCellEx(e){if(e.top!==void 0)for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++)this.getCellAt(e.sheetName,t,n);else this.findCellEx(e,!0)}getCellEx(e){return this.findCellEx(e,!0)}findCellEx(e,t){let n=this.findSheet(e,t),r=this.findSheetRow(n,e,t);return this.findRowCell(r,e,t)}getCellAt(e,t,r){if(!Rt(e))throw Error(`Invalid sheet name: ${e}`);let i=this.sheets[e]||(this.sheets[e]=[]),a=i[t]||(i[t]=[]);return a[r]||(a[r]={sheetName:e,address:n.n2l(r)+t,row:t,col:r})}removeCellEx(e){let t=this.findSheet(e,!1);if(!t)return;let n=this.findSheetRow(t,e,!1);n&&delete n[e.col]}forEachInSheet(e,t){let n=this.sheets[e];n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){Object.keys(this.sheets).forEach(t=>{this.forEachInSheet(t,e)})}map(e){let t=[];return this.forEach(n=>{t.push(e(n))}),t}findSheet(e,t){let n=e.sheetName;if(!Rt(n))throw Error(`Invalid sheet name: ${n}`);if(Object.prototype.hasOwnProperty.call(this.sheets,n))return this.sheets[n];if(t)return this.sheets[n]=[]}findSheetRow(e,t,n){let{row:r}=t;if(!Rt(r))throw Error(`Invalid row: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let{col:r}=t;if(!Rt(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...zt(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push([]);i.splice(t,n,...e)}}spliceColumns(e,t,n,r){let i=this.sheets[e];if(i){let e=[];for(let t=0;t<r;t++)e.push(null);Object.values(i).forEach(r=>{r.splice(t,n,...e)})}}};let Vt=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Ht=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new Bt)}add(e,t){let r=n.decodeEx(e);`error`in r||this.addEx(r,t)}addEx(e,t){let r=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let i=e.top;i<=e.bottom;i++){let a={sheetName:e.sheetName,address:n.n2l(t)+i,row:i,col:t};r.addCellEx(a)}else r.addCellEx(e)}remove(e,t){let r=n.decodeEx(e);`error`in r||this.removeEx(r,t)}removeEx(e,t){let r=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let i=e.top;i<=e.bottom;i++)r.removeCellEx({sheetName:e.sheetName,address:n.n2l(t)+i,row:i,col:t});else r.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{if(`top`in e)for(let r=e.left;r<=e.right;r++)for(let i=e.top;i<=e.bottom;i++)t.removeCellEx({sheetName:e.sheetName,address:n.n2l(r)+i,row:i,col:r});else t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let t=n.decodeEx(e);return`error`in t||`top`in t?[]:this.getNamesEx(t)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let n=t.sheetName,i=new r(t.row,t.col,t.row,t.col,n),a,o,s=(t,r)=>e.findCellAt(n,t,r);function c(e,n){let r=s(e,t.col);return!r||!r.mark?!1:(i[n]=e,r.mark=!1,!0)}for(o=t.row-1;c(o,`top`);o--);for(o=t.row+1;c(o,`bottom`);o++);function l(e,t){let n=[];for(o=i.top;o<=i.bottom;o++){let t=s(o,e);if(t&&t.mark)n.push(t);else return!1}i[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(a=t.col-1;l(a,`left`);a--);for(a=t.col+1;l(a,`right`);a++);return i}getRanges(e,t){return t||=this.matrixMap[e],t?(t.forEach(e=>{e.mark=!0}),{name:e,ranges:t.map(e=>e.mark&&this._explore(t,e)).filter(e=>!!e).map(e=>e.$shortRange)}):{name:e,ranges:[]}}normaliseMatrix(e,t){e.forEachInSheet(t,(e,t,r)=>{e&&(e.row!==t||e.col!==r)&&(e.row=t,e.col=r,e.address=n.n2l(r)+t)})}spliceRows(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceRows(e,t,n,r),this.normaliseMatrix(i,e)})}spliceColumns(e,t,n,r){Object.values(this.matrixMap).forEach(i=>{i.spliceColumns(e,t,n,r),this.normaliseMatrix(i,e)})}get model(){return Object.entries(this.matrixMap).map(([e,t])=>this.getRanges(e,t)).filter(e=>e.ranges.length)}set model(e){let t=this.matrixMap={};e.forEach(e=>{let n=t[e.name]=new Bt;e.ranges.forEach(e=>{Vt.test(e.split(`!`).pop()??``)&&n.addCell(e)})})}};let Ut=1e4;function Wt(e,t,n){e.push(` ${t}="${A(n.toString())}"`)}function Gt(e,t){if(t){let n=[];for(let e in t){if(!Object.prototype.hasOwnProperty.call(t,e))continue;let r=t[e];r!==void 0&&Wt(n,e,r)}e.push(n.join(``))}}var F=class{constructor(){this._xml=[],this._chunks=[],this._stack=[],this._rollbacks=[],this.leaf=!1,this.open=!1}_consolidate(){this._rollbacks.length>0||this._xml.length>=Ut&&(this._chunks.push(this._xml.join(``)),this._xml.length=0)}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._chunks.length*Ut+this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),Gt(t,e),t.push(`?>
8
+ `)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),Gt(r,t),this.leaf=!0,this.open=!0}addAttribute(e,t){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);t!==void 0&&Wt(this._xml,e,t)}addAttributes(e){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);Gt(this._xml,e)}writeText(e){let t=this._xml;this.open&&=(t.push(`>`),!1),this.leaf=!1,t.push(A(e.toString()))}writeXml(e){this.open&&=(this._xml.push(`>`),!1),this.leaf=!1,this._xml.push(e)}closeNode(){let e=this._stack.pop(),t=this._xml;this.leaf?t.push(`/>`):(t.push(`</`),t.push(e),t.push(`>`)),this.open=!1,this.leaf=!1,this._consolidate()}leafNode(e,t,n){this.openNode(e,t),n!==void 0&&this.writeText(n),this.closeNode()}closeAll(){for(;this._stack.length;)this.closeNode()}addRollback(){return this._rollbacks.push({xml:this._xml.length,stack:this._stack.length,leaf:this.leaf??!1,open:this.open??!1,chunksLength:this._chunks.length}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let e=this._rollbacks.pop();this._xml.length>e.xml&&(this._xml.length=e.xml),this._stack.length>e.stack&&(this._stack.length=e.stack),this._chunks.length>e.chunksLength&&(this._chunks.length=e.chunksLength),this.leaf=e.leaf,this.open=e.open}get xml(){return this.closeAll(),this._chunks.length===0?this._xml.join(``):(this._xml.length>0&&this._chunks.push(this._xml.join(``)),this._chunks.join(``))}static{this.StdDocAttributes={version:`1.0`,encoding:`UTF-8`,standalone:`yes`}}};let Kt=Array(128);for(let e=0;e<128;e++)Kt[e]=String.fromCharCode(e);function I(e){return e<128?Kt[e]:String.fromCodePoint(e)}let qt=new Uint8Array(128);for(let e=97;e<=122;e++)qt[e]=1;for(let e=65;e<=90;e++)qt[e]=1;qt[95]=1,qt[58]=1;let Jt=new Uint8Array(128);for(let e=97;e<=122;e++)Jt[e]=1;for(let e=65;e<=90;e++)Jt[e]=1;for(let e=48;e<=57;e++)Jt[e]=1;Jt[95]=1,Jt[58]=1,Jt[45]=1,Jt[46]=1;function Yt(e){return e===32||e===10||e===13||e===9}function Xt(e){return e===34||e===39}function Zt(e){return e<128?qt[e]===1:e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Qt(e){return e<128?Jt[e]===1:e===183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=768&&e<=879||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function $t(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111}let en={amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`};var tn=class{constructor(e){this.state=0,this.chunk=``,this.i=0,this.prevI=0,this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.entityReturnState=0,this.openWakaBang=``,this.sawRoot=!1,this.closedRoot=!1,this._closed=!1,this.reportedTextBeforeRoot=!1,this.reportedTextAfterRoot=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.ENTITIES={...en},this.trackPosition=e?.position!==!1,this.fileName=e?.fileName,this.fragment=e?.fragment??!1,this._init()}get closed(){return this._closed}get position(){return this.chunkPosition+this.i}_init(){this.state=(this.fragment,0),this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.openWakaBang=``,this.sawRoot=this.fragment,this.closedRoot=this.fragment,this.reportedTextBeforeRoot=this.fragment,this.reportedTextAfterRoot=this.fragment,this.carriedFromPrevious=void 0,this._closed=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.chunk=``,this.i=0,this.prevI=0}on(e,t){switch(e){case`text`:this.textHandler=t;break;case`opentag`:this.openTagHandler=t;break;case`closetag`:this.closeTagHandler=t;break;case`error`:this.errorHandler=t;break}}off(e){switch(e){case`text`:this.textHandler=void 0;break;case`opentag`:this.openTagHandler=void 0;break;case`closetag`:this.closeTagHandler=void 0;break;case`error`:this.errorHandler=void 0;break}}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e);if(this.errorHandler)this.errorHandler(t);else throw t;return this}write(e){if(this._closed)return this.fail(`cannot write after close`);let t=!1;e===null&&(t=!0,e=``),this.carriedFromPrevious!==void 0&&(e=this.carriedFromPrevious+e,this.carriedFromPrevious=void 0);let n=e.length;if(!t&&n>0){let t=e.charCodeAt(n-1);(t===13||t>=55296&&t<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n))}for(this.chunk=e,this.i=0;this.i<n;)this.processState();return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(n<10||n>13&&n<55296)return this.trackPosition&&this.column++,n;if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343)return this.i=t+2,this.trackPosition&&this.column++,65536+((n-55296)*1024+(r-56320))}return n===13?(e.charCodeAt(t+1)===10&&(this.i=t+2),this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),10):(n===10&&this.trackPosition?(this.line++,this.column=0,this.positionAtNewLine=this.position):this.trackPosition&&this.column++,n)}unget(){this.i=this.prevI,this.trackPosition&&this.column--}processState(){switch(this.state){case 0:this.sText();break;case 1:this.sOpenWaka();break;case 2:this.sOpenWakaBang();break;case 3:this.sOpenTag();break;case 4:this.sOpenTagSlash();break;case 5:this.sAttrib();break;case 6:this.sAttribName();break;case 7:this.sAttribNameSawWhite();break;case 8:this.sAttribValue();break;case 9:this.sAttribValueQuoted();break;case 10:this.sAttribValueClosed();break;case 11:this.sCloseTag();break;case 12:this.sCloseTagSawWhite();break;case 13:this.sComment();break;case 14:this.sCommentEnding();break;case 15:this.sCommentEnded();break;case 16:this.sCData();break;case 17:this.sCDataEnding();break;case 18:this.sCDataEnding2();break;case 19:this.sPI();break;case 20:this.sPIEnding();break;case 21:this.sDoctype();break;case 22:this.sDoctypeQuote();break;case 23:this.sDoctypeDTD();break;case 24:this.sDoctypeDTDQuoted();break;case 25:this.sEntity();break}}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}handleTextInRoot(){let{chunk:e}=this,{i:t}=this,n=this.textHandler;for(;;){let r=this.getCode();if(r===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));return}if(r===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;return}if(r===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``;return}r===10&&(n&&(this.text+=e.slice(t,this.prevI)+`
9
9
  `),t=this.i)}}handleTextOutsideRoot(){let{chunk:e}=this,{i:t}=this,n=this.textHandler,r=!1;for(;;){let i=this.getCode();if(i===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));break}if(i===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;break}if(i===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``,r=!0;break}i===10?(n&&(this.text+=e.slice(t,this.prevI)+`
10
- `),t=this.i):Gt(i)||(r=!0)}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}sOpenWaka(){let e=this.getCode();if(qt(e)){this.state=3,this.name=I(e);return}switch(e){case 47:this.state=11,this.name=``;break;case 33:this.state=2,this.openWakaBang=``;break;case 63:this.state=19,this.text=``;break;default:this.fail(`unexpected character in tag`),this.state=0}}sOpenWakaBang(){let e=this.getCode();switch(this.openWakaBang+=I(e),this.openWakaBang){case`[CDATA[`:this.state=16,this.text=``,this.openWakaBang=``;break;case`--`:this.state=13,this.text=``,this.openWakaBang=``;break;case`DOCTYPE`:this.state=21,this.text=``,this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&(this.fail(`incorrect syntax`),this.state=0)}}sOpenTag(){let e=this.getCode();if(e!==-1){if(Jt(e)){this.name+=I(e);return}this.tag={name:this.name,attributes:Object.create(null),isSelfClosing:!1},this.attribList=[],this.sawRoot=!0,e===62?this.openTag():e===47?this.state=4:(Gt(e)||this.fail(`unexpected character in tag`),this.state=5)}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`expected >`),this.state=5)}sAttrib(){let e=this.skipSpaces();e!==-1&&(qt(e)?(this.name=I(e),this.state=6):e===62?this.openTag():e===47?this.state=4:this.fail(`unexpected character in attribute`))}sAttribName(){let e=this.getCode();if(e!==-1){if(Jt(e)){this.name+=I(e);return}e===61?this.state=8:Gt(e)?this.state=7:e===62?(this.fail(`attribute without value`),this.attribList.push({name:this.name,value:this.name}),this.name=``,this.openTag()):this.fail(`unexpected character in attribute name`)}}sAttribNameSawWhite(){let e=this.skipSpaces();e!==-1&&(e===61?this.state=8:(this.fail(`attribute without value`),this.name=``,this.text=``,e===62?this.openTag():qt(e)?(this.name=I(e),this.state=6):(this.fail(`unexpected character`),this.state=5)))}sAttribValue(){let e=this.skipSpaces();e!==-1&&(Kt(e)?(this.q=e,this.text=``,this.state=9):(this.fail(`unquoted attribute value`),this.state=0))}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;){let r=this.getCode();if(r===-1){this.text+=t.slice(n,this.i);return}if(r===e){this.attribList.push({name:this.name,value:this.text+t.slice(n,this.prevI)}),this.name=``,this.text=``,this.q=null,this.state=10;return}if(r===38){this.text+=t.slice(n,this.prevI),this.state=25,this.entityReturnState=9,this.entity=``;return}if((r===10||r===9)&&(this.text+=t.slice(n,this.prevI)+` `,n=this.i),r===60){this.text+=t.slice(n,this.prevI),this.fail(`< not allowed in attribute value`);return}}}sAttribValueClosed(){let e=this.getCode();e!==-1&&(Gt(e)?this.state=5:e===62?this.openTag():e===47?this.state=4:qt(e)?(this.fail(`no whitespace between attributes`),this.name=I(e),this.state=6):this.fail(`unexpected character after attribute`))}sCloseTag(){let e=this.getCode();e!==-1&&(Jt(e)?this.name+=I(e):e===62?this.closeTag():Gt(e)?this.state=12:this.fail(`unexpected character in close tag`))}sCloseTagSawWhite(){let e=this.skipSpaces();e!==-1&&(e===62?this.closeTag():this.fail(`unexpected character in close tag`))}sComment(){let e=this.getCode();e!==-1&&(e===45?this.state=14:this.text+=I(e))}sCommentEnding(){let e=this.getCode();e===45?this.state=15:(this.text+=`-`+I(e),this.state=13)}sCommentEnded(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===45?this.text+=`-`:(this.fail(`malformed comment`),this.text+=`--`+I(e),this.state=13)}sCData(){let e=this.getCode();e!==-1&&(e===93?this.state=17:this.text+=I(e))}sCDataEnding(){let e=this.getCode();e===93?this.state=18:(this.text+=`]`+I(e),this.state=16)}sCDataEnding2(){let e=this.getCode();e===62?(this.textHandler&&this.text.length>0&&this.textHandler(this.text),this.text=``,this.state=0):e===93?this.text+=`]`:(this.text+=`]]`+I(e),this.state=16)}sPI(){let e=this.getCode();e!==-1&&(e===63?this.state=20:this.text+=I(e))}sPIEnding(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===63?this.text+=`?`:(this.text+=`?`+I(e),this.state=19)}sDoctype(){let e=this.getCode();e!==-1&&(e===62?(this.text=``,this.state=0):Kt(e)?(this.q=e,this.state=22):e===91?this.state=23:this.text+=I(e))}sDoctypeQuote(){let e=this.getCode();e!==-1&&(e===this.q?(this.q=null,this.state=21):this.text+=I(e))}sDoctypeDTD(){let e=this.getCode();e!==-1&&(e===93?this.state=21:Kt(e)&&(this.q=e,this.state=24))}sDoctypeDTDQuoted(){let e=this.getCode();e!==-1&&e===this.q&&(this.q=null,this.state=23)}sEntity(){let e=this.getCode();if(e!==-1)if(e===59){let e=this.entity,t;e===``?(this.fail(`empty entity`),t=`&;`):t=this.parseEntity(e),this.text+=t,this.state=this.entityReturnState,this.entity=``}else Jt(e)||e===35?this.entity+=I(e):(this.fail(`invalid entity character`),this.text+=`&`+this.entity+I(e),this.state=this.entityReturnState,this.entity=``)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(`undefined entity: `+e),`&`+e+`;`):t}let t;return t=e[1]===`x`||e[1]===`X`?parseInt(e.slice(2),16):parseInt(e.slice(1),10),isNaN(t)||!Yt(t)?(this.fail(`invalid character entity`),`&`+e+`;`):String.fromCodePoint(t)}skipSpaces(){for(;;){let e=this.getCode();if(e===-1||!Gt(e))return e}}openTag(){let e=this.tag;e.isSelfClosing=!1;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.tags.push(e),this.name=``,this.state=0}openSelfClosingTag(){let e=this.tag;e.isSelfClosing=!0;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.closeTagHandler?.(e),this.tags.length===0&&(this.closedRoot=!0),this.name=``,this.state=0}closeTag(){let{tags:e,name:t}=this;if(this.state=0,this.name=``,t===``){this.fail(`empty close tag`),this.text+=`</>`;return}let n=!1;for(let r=e.length-1;r>=0;r--)if(e[r].name===t){for(;e.length>r;){let t=e.pop();this.closeTagHandler?.(t),e.length>r&&this.fail(`unclosed tag: `+t.name)}n=!0;break}n||(this.fail(`unmatched close tag: `+t),this.text+=`</`+t+`>`),e.length===0&&(this.closedRoot=!0)}end(){for(this.sawRoot||this.fail(`document must contain a root element`);this.tags.length>0;){let e=this.tags.pop();this.fail(`unclosed tag: `+e.name)}return this.text.length>0&&this.textHandler&&(this.textHandler(this.text),this.text=``),this._closed=!0,this._init(),this}};async function*Qt(e){let t=new Zt({xmlns:!1,position:!0}),n;t.on(`error`,e=>{n=e});let r=[];t.on(`opentag`,e=>r.push({eventType:`opentag`,value:e})),t.on(`text`,e=>r.push({eventType:`text`,value:e})),t.on(`closetag`,e=>r.push({eventType:`closetag`,value:e}));for await(let i of e){let e=Ge(i);if(t.write(e),n)throw n;yield r,r=[]}if(t.close(),n)throw n;r.length>0&&(yield r)}let $t=new Set([`ep`,`cp`,`dc`,`dcterms`,`dcmitype`,`vt`]);function en(e,t){for(let e in t)if(e.length>6&&e.startsWith(`xmlns:`)){let n=e.slice(6);if(t[e]===`http://schemas.openxmlformats.org/spreadsheetml/2006/main`)return n;if($t.has(n))return null}let n=e.indexOf(`:`);return n!==-1&&$t.has(e.slice(0,n))?null:void 0}function tn(e,t){let n=e.indexOf(`:`);if(n===-1)return e;let r=e.slice(0,n);return r===t||$t.has(r)?e.slice(n+1):e}var L=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=void 0,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){let t=!1,n,r=0,i=null;for await(let a of e)if(!t){for(let{eventType:e,value:o}of a)if(e===`opentag`){if(r===1){this.parseOpen(o);continue}if(r===0){let e=en(o.name,o.attributes);if(e===void 0){r=1,this.parseOpen(o);continue}r=2,i=e}o.name=tn(o.name,i),this.parseOpen(o)}else if(e===`text`)this.parseText(o);else if(e===`closetag`){if(r===1){if(!this.parseClose(o.name)){t=!0,n=this.model;break}continue}if(!this.parseClose(tn(o.name,i))){t=!0,n=this.model;break}}}return t?n:this.model}async parseStream(e){return this.parse(Qt(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new F;return this.render(t,e),t.xml}static toAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e.toString()}static toStringAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toStringValue(e,t){return e===void 0?t:e}static toBoolAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e?`1`:`0`}static toBoolValue(e,t){return e===void 0?t:e===`1`}static toIntAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toIntValue(e,t){return e===void 0?t:parseInt(e,10)}static toFloatAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toFloatValue(e,t){return e===void 0?t:parseFloat(e)}};function nn(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{nn(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var rn=class extends L{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new F;nn(e,this._model),this._xml=e.xml}e.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},R=class extends L{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count??`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t?.length??0);let{childXform:n}=this;(t??[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=[],!0):this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw Error(`Max ${this.childXform.tag} count (${this.maxItems}) exceeded`);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},z=class extends L{constructor(e){super(),this.name=e??`color`}get tag(){return this.name}render(e,t){return t?(e.openNode(this.name),t.argb?e.addAttribute(`rgb`,t.argb):t.theme===void 0?t.indexed===void 0?e.addAttribute(`auto`,`1`):e.addAttribute(`indexed`,t.indexed):(e.addAttribute(`theme`,t.theme),t.tint!==void 0&&e.addAttribute(`tint`,t.tint)),e.closeNode(),!0):!1}parseOpen(e){return e.name===this.name?(e.attributes.rgb?this.model={argb:e.attributes.rgb}:e.attributes.theme?(this.model={theme:parseInt(e.attributes.theme,10)},e.attributes.tint&&(this.model.tint=parseFloat(e.attributes.tint))):e.attributes.indexed?this.model={indexed:parseInt(e.attributes.indexed,10)}:this.model=void 0,!0):!1}parseText(){}parseClose(){return!1}},an=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr}render(e,t){t&&(e.openNode(this.tag),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}},on=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.zero=e.zero,this.text=[]}render(e,t){(t||this.zero)&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){return e.name===this.tag?(this.attr?this.model=parseInt(e.attributes[this.attr],10):this.text=[],!0):!1}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=parseInt(this.text.join(``)||`0`,10)),!1}},B=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[]}render(e,t){t!==void 0&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=e.attributes[this.attr]:this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this.text.join(``)),!1}},sn=class e extends L{static{this.Attributes={single:{},double:{val:`double`},singleAccounting:{val:`singleAccounting`},doubleAccounting:{val:`doubleAccounting`}}}constructor(e){super(),this.model=e}get tag(){return`u`}render(t,n){if(n||=this.model,n===!0)t.leafNode(`u`);else{let r=e.Attributes[n];r&&t.leafNode(`u`,r)}}parseOpen(e){e.name===`u`&&(this.model=e.attributes.val||!0)}parseText(){}parseClose(){return!1}},cn=class e extends L{constructor(t){super(),this.options=t||e.OPTIONS;let n=[{tag:`b`,prop:`bold`,xform:new an({tag:`b`,attr:`val`})},{tag:`i`,prop:`italic`,xform:new an({tag:`i`,attr:`val`})},{tag:`u`,prop:`underline`,xform:new sn},{tag:`strike`,prop:`strike`,xform:new an({tag:`strike`,attr:`val`})},{tag:`condense`,prop:`condense`,xform:new an({tag:`condense`,attr:`val`})},{tag:`extend`,prop:`extend`,xform:new an({tag:`extend`,attr:`val`})},{tag:`outline`,prop:`outline`,xform:new an({tag:`outline`,attr:`val`})},{tag:`shadow`,prop:`shadow`,xform:new an({tag:`shadow`,attr:`val`})},{tag:`sz`,prop:`size`,xform:new on({tag:`sz`,attr:`val`})},{tag:`color`,prop:`color`,xform:new z},{tag:this.options.fontNameTag,prop:`name`,xform:new B({tag:this.options.fontNameTag,attr:`val`})},{tag:`family`,prop:`family`,xform:new on({tag:`family`,attr:`val`})},{tag:`scheme`,prop:`scheme`,xform:new B({tag:`scheme`,attr:`val`})},{tag:`charset`,prop:`charset`,xform:new on({tag:`charset`,attr:`val`})},{tag:`vertAlign`,prop:`vertAlign`,xform:new B({tag:`vertAlign`,attr:`val`})}];this.map=Object.fromEntries(n.map(e=>[e.tag,{prop:e.prop,xform:e.xform}])),this.renderOrder=n.map(e=>e.tag)}get tag(){return this.options.tagName}render(e,t){let{map:n,renderOrder:r}=this;e.openNode(this.options.tagName),r.forEach(r=>{n[r].xform.render(e,t[n[r].prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},ln=class extends L{constructor(){super(),this.map={color:new z}}get tag(){return`stop`}render(e,t){e.openNode(`stop`),e.addAttribute(`position`,t.position),this.map.color.render(e,t.color),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`stop`:return this.model={position:parseFloat(e.attributes.position)},!0;case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(){}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.color=this.parser.model,this.parser=void 0),!0):!1}},un=class extends L{constructor(){super(),this.map={fgColor:new z(`fgColor`),bgColor:new z(`bgColor`)}}get name(){return`pattern`}get tag(){return`patternFill`}render(e,t){e.openNode(`patternFill`),e.addAttribute(`patternType`,t.pattern),t.fgColor&&this.map.fgColor.render(e,t.fgColor),t.bgColor&&this.map.bgColor.render(e,t.bgColor),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`patternFill`:return this.model={type:`pattern`,pattern:e.attributes.patternType},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser.model&&(this.model[e]=this.parser.model),this.parser=void 0),!0):!1}},dn=class extends L{constructor(){super(),this.map={stop:new ln}}get name(){return`gradient`}get tag(){return`gradientFill`}render(e,t){switch(e.openNode(`gradientFill`),t.gradient){case`angle`:e.addAttribute(`degree`,t.degree);break;case`path`:e.addAttribute(`type`,`path`),t.center.left&&(e.addAttribute(`left`,t.center.left),t.center.right===void 0&&e.addAttribute(`right`,t.center.left)),t.center.right&&e.addAttribute(`right`,t.center.right),t.center.top&&(e.addAttribute(`top`,t.center.top),t.center.bottom===void 0&&e.addAttribute(`bottom`,t.center.top)),t.center.bottom&&e.addAttribute(`bottom`,t.center.bottom);break;default:break}let n=this.map.stop;t.stops.forEach(t=>{n.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`gradientFill`:{let t=this.model={stops:[]};return e.attributes.degree?(t.gradient=`angle`,t.degree=parseInt(e.attributes.degree,10)):e.attributes.type===`path`&&(t.gradient=`path`,t.center={left:e.attributes.left?parseFloat(e.attributes.left):0,top:e.attributes.top?parseFloat(e.attributes.top):0},e.attributes.right!==e.attributes.left&&(t.center.right=e.attributes.right?parseFloat(e.attributes.right):0),e.attributes.bottom!==e.attributes.top&&(t.center.bottom=e.attributes.bottom?parseFloat(e.attributes.bottom):0)),!0}case`stop`:return this.parser=this.map.stop,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0):!1}},fn=class e extends L{constructor(){super(),this.map={patternFill:new un,gradientFill:new dn}}get tag(){return`fill`}render(e,t){switch(e.addRollback(),e.openNode(`fill`),t.type){case`pattern`:this.map.patternFill.render(e,t);break;case`gradient`:this.map.gradientFill.render(e,t);break;default:e.rollback();return}e.closeNode(),e.commit()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`fill`:return this.model={},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0):!1}validStyle(t){return e.validPatternValues[t]}static{this.validPatternValues=[`none`,`solid`,`darkVertical`,`darkGray`,`mediumGray`,`lightGray`,`gray125`,`gray0625`,`darkHorizontal`,`darkVertical`,`darkDown`,`darkUp`,`darkGrid`,`darkTrellis`,`lightHorizontal`,`lightVertical`,`lightDown`,`lightUp`,`lightGrid`,`lightTrellis`,`lightGrid`].reduce((e,t)=>(e[t]=!0,e),{})}static{this.StopXform=ln}static{this.PatternFillXform=un}static{this.GradientFillXform=dn}},pn=class e extends L{constructor(e){super(),this.name=e,this.map={color:new z}}get tag(){return this.name}render(e,t,n){let r=t&&t.color||n||this.defaultColor;e.openNode(this.name),t&&t.style&&(e.addAttribute(`style`,t.style),r&&this.map.color.render(e,r)),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.name:{let{style:t}=e.attributes;return t?this.model={style:t}:this.model=void 0,!0}case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(e===this.name&&this.map.color.model&&(this.model||={},this.model.color=this.map.color.model),!1)}validStyle(t){return e.validStyleValues[t]}static{this.validStyleValues=[`thin`,`dashed`,`dotted`,`dashDot`,`hair`,`dashDotDot`,`slantDashDot`,`mediumDashed`,`mediumDashDotDot`,`mediumDashDot`,`medium`,`double`,`thick`].reduce((e,t)=>(e[t]=!0,e),{})}},mn=class extends L{constructor(){super(),this.map={top:new pn(`top`),left:new pn(`left`),bottom:new pn(`bottom`),right:new pn(`right`),diagonal:new pn(`diagonal`)}}render(e,t){let{color:n}=t;e.openNode(`border`),t.diagonal&&t.diagonal.style&&(t.diagonal.up&&e.addAttribute(`diagonalUp`,`1`),t.diagonal.down&&e.addAttribute(`diagonalDown`,`1`));let r=(r,i)=>{let a=r;a&&!a.color&&t.color&&(a={...a,color:t.color}),i.render(e,a,n)};r(t.left,this.map.left),r(t.right,this.map.right),r(t.top,this.map.top),r(t.bottom,this.map.bottom),r(t.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`border`:return this.reset(),this.diagonalUp=j(e.attributes.diagonalUp),this.diagonalDown=j(e.attributes.diagonalDown),!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`border`){let e=this.model={},t=(t,n,r)=>{n&&(r&&Object.assign(n,r),e[t]=n)};t(`left`,this.map.left.model),t(`right`,this.map.right.model),t(`top`,this.map.top.model),t(`bottom`,this.map.bottom.model),t(`diagonal`,this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}};let hn={0:{f:`General`},1:{f:`0`},2:{f:`0.00`},3:{f:`#,##0`},4:{f:`#,##0.00`},9:{f:`0%`},10:{f:`0.00%`},11:{f:`0.00E+00`},12:{f:`# ?/?`},13:{f:`# ??/??`},14:{f:`mm-dd-yy`},15:{f:`d-mmm-yy`},16:{f:`d-mmm`},17:{f:`mmm-yy`},18:{f:`h:mm AM/PM`},19:{f:`h:mm:ss AM/PM`},20:{f:`h:mm`},21:{f:`h:mm:ss`},22:{f:`m/d/yy "h":mm`},27:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},28:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},29:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},30:{"zh-tw":`m/d/yy `,"zh-cn":`m-d-yy`,"ja-jp":`m/d/yy`,"ko-kr":`mm-dd-yy`},31:{"zh-tw":`yyyy"年"m"月"d"日"`,"zh-cn":`yyyy"年"m"月"d"日"`,"ja-jp":`yyyy"年"m"月"d"日"`,"ko-kr":`yyyy"년" mm"월" dd"일"`},32:{"zh-tw":`hh"時"mm"分"`,"zh-cn":`h"时"mm"分"`,"ja-jp":`h"時"mm"分"`,"ko-kr":`h"시" mm"분"`},33:{"zh-tw":`hh"時"mm"分"ss"秒"`,"zh-cn":`h"时"mm"分"ss"秒"`,"ja-jp":`h"時"mm"分"ss"秒"`,"ko-kr":`h"시" mm"분" ss"초"`},34:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},35:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},36:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},37:{f:`#,##0 ;(#,##0)`},38:{f:`#,##0 ;[Red](#,##0)`},39:{f:`#,##0.00 ;(#,##0.00)`},40:{f:`#,##0.00 ;[Red](#,##0.00)`},45:{f:`mm:ss`},46:{f:`[h]:mm:ss`},47:{f:`mmss.0`},48:{f:`##0.0E+0`},49:{f:`@`},50:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},51:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},52:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},53:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`m"月"d"日"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},54:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},55:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},56:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},57:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},58:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},59:{"th-th":`t0`},60:{"th-th":`t0.00`},61:{"th-th":`t#,##0`},62:{"th-th":`t#,##0.00`},67:{"th-th":`t0%`},68:{"th-th":`t0.00%`},69:{"th-th":`t# ?/?`},70:{"th-th":`t# ??/??`},81:{"th-th":`d/m/bb`}};function gn(){let e={};return Object.entries(hn).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let _n=gn();var vn=class extends L{constructor(e,t){super(),this.id=e,this.formatCode=t}get tag(){return`numFmt`}render(e,t){e.leafNode(`numFmt`,{numFmtId:t.id,formatCode:t.formatCode})}parseOpen(e){switch(e.name){case`numFmt`:return this.model={id:parseInt(e.attributes.numFmtId,10),formatCode:e.attributes.formatCode.replace(/[\\](.)/g,`$1`)},!0;default:return!1}}parseText(){}parseClose(){return!1}static getDefaultFmtId(e){return _n[e]}static getDefaultFmtCode(e){return hn[e]&&hn[e].f}};let yn={ReadingOrder:{LeftToRight:1,RightToLeft:2}},bn={horizontalValues:[`left`,`center`,`right`,`fill`,`centerContinuous`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),horizontal(e){return this.horizontalValues[e]?e:void 0},verticalValues:[`top`,`middle`,`bottom`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),vertical(e){return e===`middle`?`center`:this.verticalValues[e]?e:void 0},wrapText(e){return e?!0:void 0},shrinkToFit(e){return e?!0:void 0},textRotation(e){switch(e){case`vertical`:return e;default:{let t=Fe(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=Fe(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return yn.ReadingOrder.LeftToRight;case`rtl`:return yn.ReadingOrder.RightToLeft;default:return}}},xn={toXml(e){let t=bn.textRotation(e);if(t){if(t===`vertical`)return 255;let e=Math.round(t);if(e>=0&&e<=90)return e;if(e<0&&e>=-90)return 90-e}},toModel(e){let t=Fe(e);if(t!==void 0){if(t===255)return`vertical`;if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}}};var Sn=class extends L{get tag(){return`alignment`}render(e,t){e.addRollback(),e.openNode(`alignment`);let n=!1;function r(t,r){r&&(e.addAttribute(t,r),n=!0)}r(`horizontal`,bn.horizontal(t.horizontal)),r(`vertical`,bn.vertical(t.vertical)),r(`wrapText`,bn.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,bn.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,bn.indent(t.indent)),r(`textRotation`,xn.toXml(t.textRotation)),r(`readingOrder`,bn.readingOrder(t.readingOrder)),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={},n=!1;function r(e,r,i){e&&(t[r]=i,n=!0)}r(e.attributes.horizontal,`horizontal`,e.attributes.horizontal),r(e.attributes.vertical,`vertical`,e.attributes.vertical===`center`?`middle`:e.attributes.vertical),r(e.attributes.wrapText,`wrapText`,j(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,j(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,xn.toModel(e.attributes.textRotation)),r(e.attributes.readingOrder,`readingOrder`,e.attributes.readingOrder===`2`?`rtl`:`ltr`),this.model=n?t:null}parseText(){}parseClose(){return!1}};let Cn={boolean(e,t){return e===void 0?t:e}};var wn=class extends L{get tag(){return`protection`}render(e,t){e.addRollback(),e.openNode(`protection`);let n=!1;function r(t,r){r!==void 0&&(e.addAttribute(t,r),n=!0)}r(`locked`,Cn.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,Cn.boolean(t.hidden,!1)?`1`:void 0),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={locked:e.attributes.locked!==`0`,hidden:e.attributes.hidden===`1`};this.model=!t.locked||t.hidden?t:null}parseText(){}parseClose(){return!1}},Tn=class extends L{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new Sn,protection:new wn}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId??0,fontId:t.fontId??0,fillId:t.fillId??0,borderId:t.borderId??0}),this.xfId&&e.addAttribute(`xfId`,t.xfId??0),(t.applyNumberFormat||t.numFmtId)&&e.addAttribute(`applyNumberFormat`,`1`),(t.applyFont||t.fontId)&&e.addAttribute(`applyFont`,`1`),(t.applyFill||t.fillId)&&e.addAttribute(`applyFill`,`1`),(t.applyBorder||t.borderId)&&e.addAttribute(`applyBorder`,`1`),(t.applyAlignment||t.alignment)&&e.addAttribute(`applyAlignment`,`1`),(t.applyProtection||t.protection)&&e.addAttribute(`applyProtection`,`1`),t.pivotButton&&e.addAttribute(`pivotButton`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),t.checkbox&&t.xfComplementIndex!==void 0&&(e.openNode(`extLst`),e.openNode(`ext`,{"xmlns:xfpb":`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`,uri:`{C7286773-470A-42A8-94C5-96B5CB345126}`}),e.leafNode(`xfpb:xfComplement`,{i:t.xfComplementIndex}),e.closeNode(),e.closeNode()),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),e.attributes.pivotButton===`1`&&(this.model.pivotButton=!0);for(let t of[`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e.attributes[t]===`1`&&(this.model[t]=!0);return!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},En=class extends L{constructor(){super(),this.map={alignment:new Sn,border:new mn,fill:new fn,font:new cn,numFmt:new vn,protection:new wn}}get tag(){return`dxf`}render(e,t){if(e.openNode(this.tag),t.font&&this.map.font.render(e,t.font),t.numFmt&&t.numFmtId){let n={id:t.numFmtId,formatCode:t.numFmt};this.map.numFmt.render(e,n)}t.fill&&this.map.fill.render(e,t.fill),t.alignment&&this.map.alignment.render(e,t.alignment),t.border&&this.map.border.render(e,t.border),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.reset(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e===this.tag?(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1):!0}},Dn=class e extends L{constructor(t){super(),this.map={numFmts:new R({tag:`numFmts`,count:!0,childXform:new vn}),fonts:new R({tag:`fonts`,count:!0,childXform:new cn,$:{"x14ac:knownFonts":1}}),fills:new R({tag:`fills`,count:!0,childXform:new fn}),borders:new R({tag:`borders`,count:!0,childXform:new mn}),cellStyleXfs:new R({tag:`cellStyleXfs`,count:!0,childXform:new Tn}),cellXfs:new R({tag:`cellXfs`,count:!0,childXform:new Tn({xfId:!0})}),dxfs:new R({tag:`dxfs`,always:!0,count:!0,childXform:new En}),numFmt:new vn,font:new cn,fill:new fn,border:new mn,style:new Tn({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap,this._hasCheckboxes=!1}setDefaultFont(e){this.defaultFont=e}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(`styleSheet`,e.STYLESHEET_ATTRIBUTES),this.index?(r.numFmts&&r.numFmts.length&&(t.openNode(`numFmts`,{count:r.numFmts.length}),r.numFmts.forEach(e=>{t.writeXml(e)}),t.closeNode()),r.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeXml(e)}),t.closeNode(),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),t.openNode(`cellXfs`,{count:r.styles.length}),r.styles.forEach(e=>{t.writeXml(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.map.fonts.model&&this.map.fonts.model.length>0&&(this.defaultFont=this.map.fonts.model[0]),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;this.model.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`});let n=t||u.ValueType.Number;if(n!==u.ValueType.Checkbox&&this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let r={};if(e.numFmt)r.numFmtId=this._addNumFmtStr(e.numFmt);else switch(n){case u.ValueType.Number:r.numFmtId=this._addNumFmtStr(`General`);break;case u.ValueType.Date:r.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(r.fontId=this._addFont(e.font)),e.border&&(r.borderId=this._addBorder(e.border)),e.fill&&(r.fillId=this._addFill(e.fill)),e.alignment&&(r.alignment=e.alignment),e.protection&&(r.protection=e.protection);for(let t of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e[t]&&(r[t]=!0);n===u.ValueType.Checkbox&&(this._hasCheckboxes=!0,r.alignment=r.alignment||{},r.checkbox=!0,r.xfComplementIndex=0);let i=this._addStyle(r);return n!==u.ValueType.Checkbox&&this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||vn.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection);for(let e of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])t[e]&&(n[e]=!0);return n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}get hasCheckboxes(){return!!this._hasCheckboxes}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=vn.getDefaultFmtId(e);if(t!==void 0||(t=this.index.numFmt[e],t!==void 0))return t;t=this.index.numFmt[e]=164+this.model.numFmts.length;let n=this.map.numFmt.toXml({id:t,formatCode:e});return this.model.numFmts.push(n),t}_addFont(e){let t=this.map.font.toXml(e),n=this.index.font[t];return n===void 0&&(n=this.index.font[t]=this.model.fonts.length,this.model.fonts.push(t)),n}_addBorder(e){let t=this.map.border.toXml(e),n=this.index.border[t];return n===void 0&&(n=this.index.border[t]=this.model.borders.length,this.model.borders.push(t)),n}_addFill(e){let t=this.map.fill.toXml(e),n=this.index.fill[t];return n===void 0&&(n=this.index.fill[t]=this.model.fills.length,this.model.fills.push(t)),n}static{this.STYLESHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac x16r2`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"xmlns:x16r2":`http://schemas.microsoft.com/office/spreadsheetml/2015/02/main`}}static{this.STATIC_XFORMS={cellStyles:new rn({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new rn({tag:`dxfs`,$:{count:0}}),tableStyles:new rn({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new rn({tag:`extLst`,c:[{tag:`ext`,$:{uri:`{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`},c:[{tag:`x14:slicerStyles`,$:{defaultSlicerStyle:`SlicerStyleLight1`}}]},{tag:`ext`,$:{uri:`{9260A510-F301-46a8-8635-F512D64BE5F5}`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`},c:[{tag:`x15:timelineStyles`,$:{defaultTimelineStyle:`TimeSlicerStyleLight1`}}]}]})}}};Dn.Mock=class extends Dn{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}],borders:[{}],fills:[{type:`pattern`,pattern:`none`},{type:`pattern`,pattern:`gray125`}]}}parseStream(e){return e.autodrain(),Promise.resolve()}addStyleModel(e,t){switch(t){case u.ValueType.Checkbox:throw Error(`Checkbox cells require styles to be enabled (useStyles: true)`);case u.ValueType.Date:return this.dateStyleId;default:return 0}}get hasCheckboxes(){return!1}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:vn.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var On=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}};let V={creator:`dc:creator`,title:`dc:title`,subject:`dc:subject`,description:`dc:description`,identifier:`dc:identifier`,language:`dc:language`,keywords:`cp:keywords`,category:`cp:category`,lastModifiedBy:`cp:lastModifiedBy`,lastPrinted:`cp:lastPrinted`,revision:`cp:revision`,version:`cp:version`,contentStatus:`cp:contentStatus`,contentType:`cp:contentType`,created:`dcterms:created`,modified:`dcterms:modified`};var kn=class e extends L{constructor(){super(),this.map={creator:new B({tag:V.creator}),title:new B({tag:V.title}),subject:new B({tag:V.subject}),description:new B({tag:V.description}),identifier:new B({tag:V.identifier}),language:new B({tag:V.language}),keywords:new B({tag:V.keywords}),category:new B({tag:V.category}),lastModifiedBy:new B({tag:V.lastModifiedBy}),lastPrinted:new On({tag:V.lastPrinted,format:e.DateFormat}),revision:new on({tag:V.revision}),version:new B({tag:V.version}),contentStatus:new B({tag:V.contentStatus}),contentType:new B({tag:V.contentType}),created:new On({tag:V.created,attrs:e.DateAttrs,format:e.DateFormat}),modified:new On({tag:V.modified,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES);for(let e of Object.keys(V))this.map[e].render(t,n[e]);t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):(e.name!==`coreProperties`&&(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`coreProperties`){this.model={};for(let e of Object.keys(V)){let t=this.map[e].model;t!==void 0&&t!==``&&(this.model[e]=t)}return!1}return!0}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},An=class extends L{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(t),e.closeNode()}parseOpen(e){return e.name===`t`?(this._text=[],this.model=``,!0):!1}parseText(e){this._text.push(e),this.model=this._text.join(``).replace(/_x([0-9A-F]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}parseClose(){return!1}},jn=class e extends L{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new An}get fontXform(){return this._fontXform||=new cn(e.FONT_OPTIONS)}render(e,t){let n=t||this.model;e.openNode(`r`),n.font&&this.fontXform.render(e,n.font),this.textXform.render(e,n.text),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`r`:return this.model={},!0;case`t`:return this.parser=this.textXform,this.parser.parseOpen(e),!0;case`rPr`:return this.parser=this.fontXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`r`:return!1;case`t`:return this.model.text=this.parser.model,this.parser=void 0,!0;case`rPr`:return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.FONT_OPTIONS={tagName:`rPr`,fontNameTag:`rFont`}}},Mn=class extends L{constructor(){super(),this.map={r:new jn,t:new An}}get tag(){return`rPh`}render(e,t){if(e.openNode(this.tag,{sb:t.sb??0,eb:t.eb??0}),t&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText){let{r:n}=this.map;t.richText.forEach(t=>{n.render(e,t)})}else t&&this.map.t.render(e,t.text);e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={sb:parseInt(e.attributes.sb,10),eb:parseInt(e.attributes.eb,10)},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model.text=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Nn=class extends L{constructor(e){super(),this.model=e,this.map={r:new jn,t:new An,rPh:new Mn}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model={},!0):(this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Pn=class extends L{constructor(e){super(),this.model=e||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||=new Nn}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(e){return this.model.values[e]}add(e){return e.richText?this.addRichText(e):this.addText(e)}addText(e){let t=this.hash[e];return t===void 0&&(t=this.hash[e]=this.model.values.length,this.model.values.push(e)),this.model.count++,t}addRichText(e){let t=this.sharedStringXform.toXml(e),n=this.rich[t];return n===void 0&&(n=this.rich[t]=this.model.values.length,this.model.values.push(e)),this.model.count++,n}render(e,t){let n=t||this._values;e.openXml(F.StdDocAttributes),e.openNode(`sst`,{xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,count:n.count,uniqueCount:n.values.length});let r=this.sharedStringXform;n.values.forEach(t=>{r.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`sst`:return!0;case`si`:return this.parser=this.sharedStringXform,this.parser.parseOpen(e),!0;default:throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;switch(e){case`sst`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Fn=class extends L{render(e,t){e.leafNode(`Relationship`,t)}parseOpen(e){switch(e.name){case`Relationship`:return this.model=e.attributes,!0;default:return!1}}parseText(){}parseClose(){return!1}},H=class e extends L{constructor(){super(),this.map={Relationship:new Fn}}render(t,n){let r=n||this._values;t.openXml(F.StdDocAttributes),t.openNode(`Relationships`,e.RELATIONSHIPS_ATTRIBUTES),r.forEach(e=>{this.map.Relationship.render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Relationships`:return this.model=[],!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.push(this.parser.model),this.parser=void 0),!0;switch(e){case`Relationships`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}};let U={contentTypes:`[Content_Types].xml`,rootRels:`_rels/.rels`,docPropsApp:`docProps/app.xml`,docPropsCore:`docProps/core.xml`,xlWorkbook:`xl/workbook.xml`,xlWorkbookRels:`xl/_rels/workbook.xml.rels`,xlSharedStrings:`xl/sharedStrings.xml`,xlStyles:`xl/styles.xml`,xlTheme1:`xl/theme/theme1.xml`,xlFeaturePropertyBag:`xl/featurePropertyBag/featurePropertyBag.xml`},In=/^xl\/worksheets\/sheet(\d+)[.]xml$/,Ln=/^xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels$/,Rn=/^xl\/theme\/[a-zA-Z0-9]+[.]xml$/,zn=/^xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/,Bn=/^xl\/drawings\/(drawing\d+)[.]xml$/,Vn=/^xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels$/,Hn=/^xl\/drawings\/(vmlDrawing\d+)[.]vml$/,Un=/^xl\/comments(\d+)[.]xml$/,Wn=/^xl\/tables\/(table\d+)[.]xml$/,Gn=/^xl\/pivotTables\/(pivotTable\d+)[.]xml$/,Kn=/^xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels$/,qn=/^xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml$/,Jn=/^xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels$/,Yn=/^xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml$/;function Xn(e){return e.startsWith(`/`)?e.slice(1):e}function Zn(e){let t=In.exec(e);if(t)return parseInt(t[1],10)}function Qn(e){let t=Ln.exec(e);if(t)return parseInt(t[1],10)}function $n(e){return e.startsWith(`xl/media/`)}function er(e){let t=zn.exec(e);return t?t[1]:void 0}function tr(e){return Rn.test(e)}function nr(e){let t=/^xl\/theme\/([a-zA-Z0-9]+)[.]xml$/.exec(e);return t?t[1]:void 0}function rr(e){return $n(e)||tr(e)}function ir(e){let t=Bn.exec(e);return t?t[1]:void 0}function ar(e){let t=Vn.exec(e);return t?t[1]:void 0}function or(e){let t=Hn.exec(e);return t?t[1]:void 0}function sr(e){let t=Un.exec(e);return t?t[1]:void 0}function cr(e){let t=Wn.exec(e);return t?t[1]:void 0}function lr(e){let t=Gn.exec(e);return t?t[1]:void 0}function ur(e){let t=Kn.exec(e);return t?t[1]:void 0}function dr(e){let t=qn.exec(e);return t?t[1]:void 0}function fr(e){let t=Jn.exec(e);return t?t[1]:void 0}function pr(e){let t=Yn.exec(e);return t?t[1]:void 0}function W(e){return e.startsWith(`/`)?e:`/${e}`}function mr(e){return`xl/theme/${e}.xml`}function hr(e){return`xl/media/${e}`}function gr(e){return`xl/worksheets/sheet${e}.xml`}function _r(e){return`xl/worksheets/_rels/sheet${e}.xml.rels`}function vr(e){return`worksheets/sheet${e}.xml`}function yr(e){return`xl/comments${e}.xml`}function br(e){return`xl/${e}.xml`}function xr(e){return`xl/drawings/vmlDrawing${e}.vml`}function Sr(e){return`xl/tables/${e}`}function Cr(e){return`xl/drawings/${e}.xml`}function wr(e){return`xl/drawings/_rels/${e}.xml.rels`}function Tr(e){return`xl/pivotCache/pivotCacheDefinition${e}.xml`}function Er(e){return`xl/pivotCache/_rels/pivotCacheDefinition${e}.xml.rels`}function Dr(e){return`xl/pivotCache/pivotCacheRecords${e}.xml`}function Or(e){return`pivotCacheRecords${e}.xml`}function kr(e){return`xl/pivotTables/pivotTable${e}.xml`}function Ar(e){return`xl/pivotTables/_rels/pivotTable${e}.xml.rels`}function jr(e){return`../pivotCache/pivotCacheDefinition${e}.xml`}let Mr={workbookStyles:`styles.xml`,workbookSharedStrings:`sharedStrings.xml`,workbookTheme1:`theme/theme1.xml`,workbookFeaturePropertyBag:`featurePropertyBag/featurePropertyBag.xml`};function Nr(e){return`pivotCache/pivotCacheDefinition${e}.xml`}function Pr(e){return`../comments${e}.xml`}function Fr(e){return`../drawings/vmlDrawing${e}.vml`}function Ir(e){return`../drawings/${e}.xml`}function Lr(e){return`../drawings/${e}.vml`}function Rr(e){return`../${e}.xml`}function zr(e){return`../pivotTables/pivotTable${e}.xml`}function Br(e){return`../pivotTables/${e}.xml`}function Vr(e){return`../tables/${e}`}function Hr(e){return`../tables/${e}.xml`}function Ur(e){return`../media/${e}`}function Wr(e){return`xl/ctrlProps/ctrlProp${e}.xml`}function Gr(e){return`../ctrlProps/ctrlProp${e}.xml`}var Kr=class e extends L{render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};if((n.media??[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:W(U.xlWorkbook),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{t.leafNode(`Override`,{PartName:W(gr(e.fileIndex)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables??[]).length){let e=new Set;(n.pivotTables??[]).forEach(n=>{let r=n.tableNumber,i=n.cacheId;e.has(i)||(e.add(i),t.leafNode(`Override`,{PartName:W(Tr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),(!n.isLoaded||n.cacheRecords)&&t.leafNode(`Override`,{PartName:W(Dr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`})),t.leafNode(`Override`,{PartName:W(kr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})})}t.leafNode(`Override`,{PartName:W(U.xlTheme1),ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:W(U.xlStyles),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.hasCheckboxes&&t.leafNode(`Override`,{PartName:W(U.xlFeaturePropertyBag),ContentType:`application/vnd.ms-excel.featurepropertybag+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:W(U.xlSharedStrings),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:W(Sr(e.target)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:W(Cr(e.name)),ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})});let i=n.commentRefs&&n.commentRefs.length>0,a=n.formControlRefs&&n.formControlRefs.length>0;if((i||a)&&t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),i&&n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:W(br(e)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})}),a)for(let e of n.formControlRefs)t.leafNode(`Override`,{PartName:W(Wr(e)),ContentType:`application/vnd.ms-excel.controlproperties+xml`});if(n.passthroughContentTypes)for(let{partName:e,contentType:r}of n.passthroughContentTypes)t.leafNode(`Override`,{PartName:W(e),ContentType:r});t.leafNode(`Override`,{PartName:W(U.docPropsCore),ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:W(U.docPropsApp),ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},qr=class extends L{render(e,t){e.openNode(`HeadingPairs`),e.openNode(`vt:vector`,{size:2,baseType:`variant`}),e.openNode(`vt:variant`),e.leafNode(`vt:lpstr`,void 0,`Worksheets`),e.closeNode(),e.openNode(`vt:variant`),e.leafNode(`vt:i4`,void 0,t.length),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`HeadingPairs`}parseText(){}parseClose(e){return e!==`HeadingPairs`}},Jr=class extends L{render(e,t){e.openNode(`TitlesOfParts`),e.openNode(`vt:vector`,{size:t.length,baseType:`lpstr`}),t.forEach(t=>{e.leafNode(`vt:lpstr`,void 0,t.name)}),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`TitlesOfParts`}parseText(){}parseClose(e){return e!==`TitlesOfParts`}},Yr=class e extends L{constructor(){super(),this.map={Company:new B({tag:`Company`}),Manager:new B({tag:`Manager`}),HeadingPairs:new qr,TitlesOfParts:new Jr}}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitlesOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company??``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitlesOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},Xr=class extends L{constructor(){super(),this._parsedText=[]}render(e,t){e.openNode(`definedName`,{name:t.name,localSheetId:t.localSheetId}),e.writeText(t.ranges.join(`,`)),e.closeNode()}parseOpen(e){switch(e.name){case`definedName`:return this._parsedName=e.attributes.name,this._parsedLocalSheetId=e.attributes.localSheetId,this._parsedText=[],!0;default:return!1}}parseText(e){this._parsedText.push(e)}parseClose(){return this.model={name:this._parsedName,ranges:ti(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};let Zr=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,Qr=/^[$]?\d+:[$]?\d+$/,$r=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function ei(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let t=e.split(`!`).pop()??``;if(!Zr.test(t)&&!Qr.test(t)&&!$r.test(t))return!1;try{let t=n.decodeEx(e);return`row`in t&&typeof t.row==`number`||`top`in t&&typeof t.top==`number`||`left`in t&&typeof t.left==`number`}catch{return!1}}function ti(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)??[]).length;if(!t){r?i+=`${e},`:ei(e)&&n.push(e);return}let a=t%2==0;!r&&a&&ei(e)?n.push(e):r&&!a?(r=!1,ei(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}var ni=class extends L{render(e,t){e.leafNode(`sheet`,{name:t.name,sheetId:t.id,state:t.state===`visible`?void 0:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:Ne(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},ri=class extends L{render(e,t){let n={xWindow:t.x??0,yWindow:t.y??0,windowWidth:t.width??12e3,windowHeight:t.height??24e3,firstSheet:t.firstSheet,activeTab:t.activeTab};t.visibility&&t.visibility!==`visible`&&(n.visibility=t.visibility),e.leafNode(`workbookView`,n)}parseOpen(e){if(e.name===`workbookView`){let t=this.model={},n=function(e,n,r){t[e]=n===void 0?r:n},r=function(e,n,r){let i=n===void 0?r:parseInt(n,10);i!==void 0&&(t[e]=i)};return r(`x`,e.attributes.xWindow,0),r(`y`,e.attributes.yWindow,0),r(`width`,e.attributes.windowWidth,25e3),r(`height`,e.attributes.windowHeight,1e4),n(`visibility`,e.attributes.visibility,`visible`),r(`activeTab`,e.attributes.activeTab,void 0),r(`firstSheet`,e.attributes.firstSheet,void 0),!0}return!1}parseText(){}parseClose(){return!1}},ii=class extends L{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},ai=class extends L{render(e,t){e.leafNode(`calcPr`,{calcId:171027,fullCalcOnLoad:t.fullCalcOnLoad?1:void 0})}parseOpen(e){return e.name===`calcPr`?(this.model={},!0):!1}parseText(){}parseClose(){return!1}},oi=class extends L{render(e,t){e.leafNode(`pivotCache`,{cacheId:t.cacheId,"r:id":t.rId})}parseOpen(e){return e.name===`pivotCache`?(this.model={cacheId:e.attributes.cacheId,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},si=class e extends L{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new ii,bookViews:new R({tag:`bookViews`,count:!1,childXform:new ri}),sheets:new R({tag:`sheets`,count:!1,childXform:new ni}),definedNames:new R({tag:`definedNames`,count:!1,childXform:new Xr}),calcPr:new ai,pivotCaches:new R({tag:`pivotCaches`,count:!1,childXform:new oi})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a=i[0],o=i[1]??a,s={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${a}:$${o}`],localSheetId:n};t.push(s)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media??[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties);let r=n.pivotTables??[],i=new Set,a=r.filter(e=>i.has(e.cacheId)?!1:(i.add(e.cacheId),!0));this.map.pivotCaches.render(t,a),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let t=(e.workbookRels??[]).reduce((e,t)=>(e[t.Id]=t,e),{}),r=[],i,a=0;(e.sheets??[]).forEach(n=>{let o=t[n.rId];o&&(i=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],i&&(i.name=n.name,i.id=n.id,i.state=n.state,r[a++]=i))});let o=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(i=r[e.localSheetId],i&&e.ranges?.length>0){i.pageSetup||={};let t=n.decodeEx(e.ranges[0]);i.pageSetup.printArea=i.pageSetup.printArea?`${i.pageSetup.printArea}&&${t.dimensions}`:t.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(i=r[e.localSheetId],i&&e.ranges?.length>0){i.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,r=t.match(/\$\d+:\$\d+/);if(r&&r.length){let e=r[0];i.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];i.pageSetup.printTitlesColumn=e.replace(n,``)}}}else o.push(e)}),e.definedNames=o,e.media.forEach((e,t)=>{e.index=t})}static{this.WORKBOOK_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x15`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`}}static{this.STATIC_XFORMS={fileVersion:new rn({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let G={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`,FeaturePropertyBag:`http://schemas.microsoft.com/office/2022/11/relationships/FeaturePropertyBag`,CtrlProp:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp`};var ci=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{let t=`${e.master}:${e.address}`;this.merges[e.master]=new r(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let r=n.decode(e);for(let e=r.top;e<=r.bottom;e++){let i=t[e-1];for(let t=r.left;t<=r.right;t++){let a=i.cells[t-1];a?a.type===u.ValueType.Merge&&(a.master=r.tl):i.cells[t]={type:u.ValueType.Null,address:n.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function li(e){if(e==null)return u.ValueType.Null;if(e instanceof String||typeof e==`string`)return u.ValueType.String;if(typeof e==`number`)return u.ValueType.Number;if(typeof e==`boolean`)return u.ValueType.Boolean;if(e instanceof Date)return u.ValueType.Date;if(e.text&&e.hyperlink)return u.ValueType.Hyperlink;if(e.formula)return u.ValueType.Formula;if(e.error)return u.ValueType.Error;throw Error(`I could not understand type of value`)}function ui(e){switch(e.type){case u.ValueType.Formula:return li(e.result);default:return e.type}}var di=class extends L{constructor(){super(),this.richTextXform=new jn}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},ui(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case u.ValueType.String:case u.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case u.ValueType.Date:t.date1904&&(e.date1904=!0);break;case u.ValueType.Hyperlink:t.sharedStrings&&e.text!==void 0&&e.text!==null&&(e.ssId=t.sharedStrings.add(e.text)),t.hyperlinks.push({address:e.address,target:e.hyperlink,tooltip:e.tooltip});break;case u.ValueType.Merge:t.merges.add(e);break;case u.ValueType.Formula:if(t.date1904&&(e.date1904=!0),e.shareType===`shared`&&(e.si=t.siFormulae++),e.formula)t.formulae[e.address]=e;else if(e.sharedFormula){let n=t.formulae[e.sharedFormula];if(!n)throw Error(`Shared Formula master must exist above and or left of clone for cell ${e.address}`);n.si===void 0?(n.shareType=`shared`,n.si=t.siFormulae++,n.range=new r(n.address,e.address)):n.range&&n.range.expandToAddress(e.address),e.si=n.si}break;default:break}}renderFormula(e,t){let n=null;switch(t.shareType){case`shared`:n={t:`shared`,ref:t.ref||t.range.range,si:t.si};break;case`array`:n={t:`array`,ref:t.ref};break;default:t.si!==void 0&&(n={t:`shared`,si:t.si});break}switch(li(t.result)){case u.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case u.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case u.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case u.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case u.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case u.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,ke(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===u.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case u.ValueType.Null:break;case u.ValueType.Number:e.leafNode(`v`,null,t.value);break;case u.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case u.ValueType.Checkbox:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case u.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case u.ValueType.String:case u.ValueType.RichText:t.ssId===void 0?t.value&&t.value.richText?(e.addAttribute(`t`,`inlineStr`),e.openNode(`is`),t.value.richText.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(`is`)):(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.value)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case u.ValueType.Date:e.leafNode(`v`,null,ke(t.value,t.date1904));break;case u.ValueType.Hyperlink:t.ssId===void 0?(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.text)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case u.ValueType.Formula:this.renderFormula(e,t);break;case u.ValueType.Merge:break;default:break}e.closeNode()}}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`c`:return this.model={address:e.attributes.r},this.t=e.attributes.t,e.attributes.s&&(this.model.styleId=parseInt(e.attributes.s,10)),!0;case`f`:return this.currentNode=`f`,this.model.si=e.attributes.si,this.model.shareType=e.attributes.t,this.model.ref=e.attributes.ref,!0;case`v`:return this.currentNode=`v`,!0;case`t`:return this.currentNode=`t`,!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){if(this.parser){this.parser.parseText(e);return}switch(this.currentNode){case`f`:this.model.formula=this.model.formula?this.model.formula+e:e;break;case`v`:case`t`:this.model.value&&this.model.value.richText?this.model.value.richText.text=this.model.value.richText.text?this.model.value.richText.text+e:e:this.model.value=this.model.value?this.model.value+e:e;break;default:break}}parseClose(e){switch(e){case`c`:{let{model:e}=this;if(e.formula||e.shareType)e.type=u.ValueType.Formula,e.value&&=(this.t===`str`?e.result=Ne(e.value):this.t===`b`?e.result=parseInt(e.value,10)!==0:this.t===`e`?e.result={error:e.value}:e.result=parseFloat(e.value),void 0);else if(e.value!==void 0)switch(this.t){case`s`:e.type=u.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=u.ValueType.String,e.value=Ne(e.value);break;case`inlineStr`:e.type=u.ValueType.String;break;case`b`:e.type=u.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=u.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=u.ValueType.Date,e.value=new Date(e.value);break;default:e.type=u.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=u.ValueType.Null:e.type=u.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText??[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId!==void 0&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case u.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=u.ValueType.RichText);break;case u.ValueType.Number:n&&ze(n.numFmt)&&(e.type=u.ValueType.Date,e.value=Ae(e.value,t.date1904));break;case u.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&ze(n.numFmt)&&(e.result=Ae(e.result,t.date1904)),e.shareType===`shared`&&(e.ref?t.formulae[e.si]=e.address:(e.sharedFormula=t.formulae[e.si],delete e.shareType),delete e.si);break;default:break}let r=t.hyperlinkMap[e.address];r&&(e.type===u.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=u.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},fi=class extends L{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new di}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height!=null&&t.height>0?(e.addAttribute(`ht`,t.height),t.customHeight!==!1&&e.addAttribute(`customHeight`,`1`)):t.height===0&&e.addAttribute(`ht`,1),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),t.dyDescent!==void 0&&e.addAttribute(`x14ac:dyDescent`,t.dyDescent),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),j(e.attributes.hidden)&&(n.hidden=!0),j(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),j(e.attributes.customHeight)&&(n.customHeight=!0),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),j(e.attributes.collapsed)&&(n.collapsed=!0),e.attributes[`x14ac:dyDescent`]!==void 0&&(n.dyDescent=parseFloat(e.attributes[`x14ac:dyDescent`])),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=n.decodeAddress(e.address).col:(this.lastCellCol+=1,e.address=n.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId===void 0?{}:t.styles.getStyleModel(e.styleId),e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},pi=class extends L{get tag(){return`col`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{});n&&(e.styleId=n)}render(e,t){e.openNode(`col`),e.addAttribute(`min`,t.min),e.addAttribute(`max`,t.max),t.width&&e.addAttribute(`width`,t.width),t.styleId&&e.addAttribute(`style`,t.styleId),t.hidden&&e.addAttribute(`hidden`,`1`),t.bestFit&&e.addAttribute(`bestFit`,`1`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`),e.addAttribute(`customWidth`,`1`),e.closeNode()}parseOpen(e){if(e.name===`col`){let t=this.model={min:parseInt(e.attributes.min??`0`,10),max:parseInt(e.attributes.max??`0`,10),width:e.attributes.width===void 0?void 0:parseFloat(e.attributes.width??`0`)};return e.attributes.style&&(t.styleId=parseInt(e.attributes.style,10)),j(e.attributes.hidden)&&(t.hidden=!0),j(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),j(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId!==void 0&&(e.style=t.styles.getStyleModel(e.styleId))}},mi=class extends L{get tag(){return`dimension`}render(e,t){t&&e.leafNode(`dimension`,{ref:t})}parseOpen(e){return e.name===`dimension`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},hi=class extends L{get tag(){return`hyperlink`}render(e,t){this.isInternalLink(t)?e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip,location:t.target}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){return e.name===`hyperlink`?(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location&&(this.model.target=e.attributes.location),!0):!1}parseText(){}parseClose(){return!1}isInternalLink(e){return!!(e.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(e.target))}},gi=class extends L{get tag(){return`mergeCell`}render(e,t){e.leafNode(`mergeCell`,{ref:t})}parseOpen(e){return e.name===`mergeCell`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}};function _i(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function vi(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=j(i)}function yi(e){if(!e)return[];let t=[],r={};for(let[n,i]of Object.entries(e))if(i!=null)if(n.startsWith(`range:`)){let e=n.slice(6),{sqref:r,...a}=i;t.push({...a,sqref:e})}else r[n]=i;if(Object.keys(r).length===0)return t;let i=Object.entries(r).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),a=Object.fromEntries(i.map(e=>[e.address,e])),o=(e,t,i)=>{for(let a=0;a<t;a++){let t=n.encodeAddress(e.row+a,i);if(!r[t]||!p(r[e.address],r[t]))return!1}return!0},s=i.map(e=>{if(!e.marked){let t=n.decodeEx(e.address);if(t.dimensions)return a[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let i=1,s=n.encodeAddress(t.row+i,t.col);for(;r[s]&&p(e.dataValidation,r[s]);)i++,s=n.encodeAddress(t.row+i,t.col);let c=1;for(;o(t,i,t.col+c);)c++;for(let e=0;e<i;e++)for(let r=0;r<c;r++)s=n.encodeAddress(t.row+e,t.col+r),a[s].marked=!0;if(i>1||c>1){let r=t.row+(i-1),a=t.col+(c-1);return{...e.dataValidation,sqref:`${e.address}:${n.encodeAddress(r,a)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...s]}var bi=class extends L{get tag(){return`dataValidations`}render(e,t){let n=yi(t);n.length&&(e.openNode(`dataValidations`,{count:n.length}),n.forEach(t=>{e.openNode(`dataValidation`),t.type!==`any`&&(e.addAttribute(`type`,t.type),t.operator&&t.type!==`list`&&t.operator!==`between`&&e.addAttribute(`operator`,t.operator),t.allowBlank&&e.addAttribute(`allowBlank`,`1`)),t.showInputMessage&&e.addAttribute(`showInputMessage`,`1`),t.promptTitle&&e.addAttribute(`promptTitle`,t.promptTitle),t.prompt&&e.addAttribute(`prompt`,t.prompt),t.showErrorMessage&&e.addAttribute(`showErrorMessage`,`1`),t.errorStyle&&e.addAttribute(`errorStyle`,t.errorStyle),t.errorTitle&&e.addAttribute(`errorTitle`,t.errorTitle),t.error&&e.addAttribute(`error`,t.error),e.addAttribute(`sqref`,t.sqref),(t.formulae??[]).forEach((n,r)=>{e.openNode(`formula${r+1}`),t.type===`date`?e.writeText(ke(new Date(n))):e.writeText(n),e.closeNode()}),e.closeNode()}),e.closeNode())}parseOpen(e){switch(e.name){case`dataValidations`:return this.model={},!0;case`dataValidation`:{this._address=e.attributes.sqref;let t={type:e.attributes.type??`any`,formulae:[]};switch(e.attributes.type&&vi(t,e.attributes,`allowBlank`),vi(t,e.attributes,`showInputMessage`),vi(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:_i(t,e.attributes,`operator`,`between`);break}return _i(t,e.attributes,`promptTitle`),_i(t,e.attributes,`prompt`),_i(t,e.attributes,`errorStyle`),_i(t,e.attributes,`errorTitle`),_i(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),this._address.split(/\s+/g).forEach(e=>{e.includes(`:`)?this.model[`range:${e}`]=this._dataValidation:this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=Ae(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},xi=class extends L{get tag(){return`pageSetUpPr`}render(e,t){return t&&t.fitToPage?(e.leafNode(this.tag,{fitToPage:t.fitToPage?`1`:void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={fitToPage:e.attributes.fitToPage===`1`},!0):!1}parseText(){}parseClose(){return!1}};let Si=e=>e!==void 0;var Ci=class extends L{get tag(){return`outlinePr`}render(e,t){return t&&(Si(t.summaryBelow)||Si(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:Si(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:Si(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:Si(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:Si(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},wi=class extends L{constructor(){super(),this.map={tabColor:new z(`tabColor`),pageSetUpPr:new xi,outlinePr:new Ci}}get tag(){return`sheetPr`}render(e,t){if(t){e.addRollback(),e.openNode(`sheetPr`);let n=!1;n=this.map.tabColor.render(e,t.tabColor)||n,n=this.map.pageSetUpPr.render(e,t.pageSetup)||n,n=this.map.outlinePr.render(e,t.outlineProperties)||n,n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):this.map[e.name]?(this.parser=this.map[e.name],this.parser.parseOpen(e),!0):!1}parseText(e){return this.parser?(this.parser.parseText(e),!0):!1}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}},Ti=class extends L{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow||void 0,outlineLevelCol:t.outlineLevelCol||void 0,"x14ac:dyDescent":t.dyDescent!==void 0&&t.dyDescent!==0?t.dyDescent:void 0};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),t.customHeight&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight??`0`),dyDescent:e.attributes[`x14ac:dyDescent`]===void 0?void 0:parseFloat(e.attributes[`x14ac:dyDescent`]),outlineLevelRow:parseInt(e.attributes.outlineLevelRow??`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol??`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),e.attributes.customHeight===`1`&&(this.model.customHeight=!0),!0):!1}parseText(){}parseClose(){return!1}};let Ei={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var Di=class extends L{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){let r={};t.tabSelected&&(r.tabSelected=`1`),r.workbookViewId=t.workbookViewId??0,e.openNode(`sheetView`,r);let i=function(t,n,r){r&&e.addAttribute(t,n)};i(`rightToLeft`,`1`,t.rightToLeft===!0),i(`showRuler`,`0`,t.showRuler===!1),i(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),i(`showGridLines`,`0`,t.showGridLines===!1),i(`zoomScale`,t.zoomScale,t.zoomScale!==void 0&&t.zoomScale!==100),i(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal!==void 0&&t.zoomScaleNormal!==100),i(`view`,t.style,t.style);let a,o,s,c;switch(t.state){case`frozen`:o=t.xSplit??0,s=t.ySplit??0,a=t.topLeftCell||n.getAddress(s+1,o+1).address,c=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:a,activePane:c,state:`frozen`}),e.leafNode(`selection`,{pane:c,activeCell:t.activeCell,sqref:t.activeCell});break;case`split`:t.activePane===`topLeft`&&(t.activePane=void 0),e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode(`selection`,{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case`normal`:t.activeCell&&e.leafNode(`selection`,{activeCell:t.activeCell,sqref:t.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale??`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal??`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit??`0`,10),ySplit:parseInt(e.attributes.ySplit??`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane??`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane??`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:Ei[this.pane.state]??`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function K(e,t){return e?t:void 0}function q(e,t){return e===t?!0:void 0}var Oi=class extends L{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:K(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:K(t.formatCells,`0`),formatColumns:K(t.formatColumns,`0`),formatRows:K(t.formatRows,`0`),insertColumns:K(t.insertColumns,`0`),insertRows:K(t.insertRows,`0`),insertHyperlinks:K(t.insertHyperlinks,`0`),deleteColumns:K(t.deleteColumns,`0`),deleteRows:K(t.deleteRows,`0`),sort:K(t.sort,`0`),autoFilter:K(t.autoFilter,`0`),pivotTables:K(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=K(t.objects===!1,`1`),n.scenarios=K(t.scenarios===!1,`1`)),Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={sheet:q(e.attributes.sheet,`1`),objects:e.attributes.objects===`1`?!1:void 0,scenarios:e.attributes.scenarios===`1`?!1:void 0,selectLockedCells:e.attributes.selectLockedCells===`1`?!1:void 0,selectUnlockedCells:e.attributes.selectUnlockedCells===`1`?!1:void 0,formatCells:q(e.attributes.formatCells,`0`),formatColumns:q(e.attributes.formatColumns,`0`),formatRows:q(e.attributes.formatRows,`0`),insertColumns:q(e.attributes.insertColumns,`0`),insertRows:q(e.attributes.insertRows,`0`),insertHyperlinks:q(e.attributes.insertHyperlinks,`0`),deleteColumns:q(e.attributes.deleteColumns,`0`),deleteRows:q(e.attributes.deleteRows,`0`),sort:q(e.attributes.sort,`0`),autoFilter:q(e.attributes.autoFilter,`0`),pivotTables:q(e.attributes.pivotTables,`0`)},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0;default:return!1}}parseText(){}parseClose(){return!1}},ki=class extends L{get tag(){return`pageMargins`}render(e,t){if(t){let n={left:t.left,right:t.right,top:t.top,bottom:t.bottom,header:t.header,footer:t.footer};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={left:parseFloat(e.attributes.left||.7),right:parseFloat(e.attributes.right||.7),top:parseFloat(e.attributes.top||.75),bottom:parseFloat(e.attributes.bottom||.75),header:parseFloat(e.attributes.header||.3),footer:parseFloat(e.attributes.footer||.3)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Ai(e){return e?`1`:void 0}function ji(e){switch(e){case`overThenDown`:return e;default:return}}function Mi(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function Ni(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Pi(e){return e===void 0?void 0:parseInt(e,10)}var Fi=class extends L{get tag(){return`pageSetup`}_dpiToXml(e){if(e!==void 0&&Number.isFinite(e)&&e!==4294967295)return e}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:this._dpiToXml(t.horizontalDpi),verticalDpi:this._dpiToXml(t.verticalDpi),pageOrder:ji(t.pageOrder),blackAndWhite:Ai(t.blackAndWhite),draft:Ai(t.draft),cellComments:Mi(t.cellComments),errors:Ni(t.errors),scale:t.scale===100?void 0:t.scale,fitToWidth:t.fitToWidth===1?void 0:t.fitToWidth,fitToHeight:t.fitToHeight===1?void 0:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Ai(!!t.firstPageNumber),usePrinterDefaults:Ai(t.usePrinterDefaults),copies:t.copies};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={paperSize:Pi(e.attributes.paperSize),orientation:e.attributes.orientation??`portrait`,horizontalDpi:parseInt(e.attributes.horizontalDpi??`4294967295`,10),verticalDpi:parseInt(e.attributes.verticalDpi??`4294967295`,10),pageOrder:e.attributes.pageOrder??`downThenOver`,blackAndWhite:e.attributes.blackAndWhite===`1`,draft:e.attributes.draft===`1`,cellComments:e.attributes.cellComments??`None`,errors:e.attributes.errors??`displayed`,scale:parseInt(e.attributes.scale??`100`,10),fitToWidth:parseInt(e.attributes.fitToWidth??`1`,10),fitToHeight:parseInt(e.attributes.fitToHeight??`1`,10),firstPageNumber:parseInt(e.attributes.firstPageNumber??`1`,10),useFirstPageNumber:e.attributes.useFirstPageNumber===`1`,usePrinterDefaults:e.attributes.usePrinterDefaults===`1`,copies:parseInt(e.attributes.copies??`1`,10)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Ii(e){return e?`1`:void 0}var Li=class extends L{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:Ii(t.showRowColHeaders),gridLines:Ii(t.showGridLines),horizontalCentered:Ii(t.horizontalCentered),verticalCentered:Ii(t.verticalCentered)};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={showRowColHeaders:e.attributes.headings===`1`,showGridLines:e.attributes.gridLines===`1`,horizontalCentered:e.attributes.horizontalCentered===`1`,verticalCentered:e.attributes.verticalCentered===`1`},!0;default:return!1}}parseText(){}parseClose(){return!1}},Ri=class extends L{get tag(){return`autoFilter`}render(e,t){if(t)if(typeof t==`string`)e.leafNode(`autoFilter`,{ref:t});else{let r=function(e){return typeof e==`string`?e:n.getAddress(e.row,e.column).address},i=r(t.from),a=r(t.to);i&&a&&e.leafNode(`autoFilter`,{ref:`${i}:${a}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},zi=class extends L{get tag(){return`picture`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Bi=class extends L{get tag(){return`drawing`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Vi=class extends L{get tag(){return`tablePart`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Hi=class extends L{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){if(e.name===`brk`){let{id:t,max:n,man:r,min:i}=e.attributes;return this.model={id:+t,max:+n,man:+r},i!==void 0&&(this.model.min=+i),!0}return!1}parseText(){}parseClose(){return!1}},Ui=class extends R{constructor(){super({tag:`rowBreaks`,count:!0,childXform:new Hi})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Wi=class extends R{constructor(){super({tag:`colBreaks`,count:!0,childXform:new Hi})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Gi=class extends L{get tag(){return`headerFooter`}render(e,t){if(t){e.addRollback();let n=!1;e.openNode(`headerFooter`),t.differentFirst&&(e.addAttribute(`differentFirst`,`1`),n=!0),t.differentOddEven&&(e.addAttribute(`differentOddEven`,`1`),n=!0),t.oddHeader&&typeof t.oddHeader==`string`&&(e.leafNode(`oddHeader`,null,t.oddHeader),n=!0),t.oddFooter&&typeof t.oddFooter==`string`&&(e.leafNode(`oddFooter`,null,t.oddFooter),n=!0),t.evenHeader&&typeof t.evenHeader==`string`&&(e.leafNode(`evenHeader`,null,t.evenHeader),n=!0),t.evenFooter&&typeof t.evenFooter==`string`&&(e.leafNode(`evenFooter`,null,t.evenFooter),n=!0),t.firstHeader&&typeof t.firstHeader==`string`&&(e.leafNode(`firstHeader`,null,t.firstHeader),n=!0),t.firstFooter&&typeof t.firstFooter==`string`&&(e.leafNode(`firstFooter`,null,t.firstFooter),n=!0),n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){switch(e.name){case`headerFooter`:return this.model={},e.attributes.differentFirst&&(this.model.differentFirst=parseInt(e.attributes.differentFirst,0)===1),e.attributes.differentOddEven&&(this.model.differentOddEven=parseInt(e.attributes.differentOddEven,0)===1),!0;case`oddHeader`:return this.currentNode=`oddHeader`,!0;case`oddFooter`:return this.currentNode=`oddFooter`,!0;case`evenHeader`:return this.currentNode=`evenHeader`,!0;case`evenFooter`:return this.currentNode=`evenFooter`,!0;case`firstHeader`:return this.currentNode=`firstHeader`,!0;case`firstFooter`:return this.currentNode=`firstFooter`,!0;default:return!1}}parseText(e){switch(this.currentNode){case`oddHeader`:this.model.oddHeader=(this.model.oddHeader??``)+e;break;case`oddFooter`:this.model.oddFooter=(this.model.oddFooter??``)+e;break;case`evenHeader`:this.model.evenHeader=(this.model.evenHeader??``)+e;break;case`evenFooter`:this.model.evenFooter=(this.model.evenFooter??``)+e;break;case`firstHeader`:this.model.firstHeader=(this.model.firstHeader??``)+e;break;case`firstFooter`:this.model.firstFooter=(this.model.firstFooter??``)+e;break;default:break}}parseClose(){switch(this.currentNode){case`oddHeader`:case`oddFooter`:case`evenHeader`:case`evenFooter`:case`firstHeader`:case`firstFooter`:return this.currentNode=void 0,!0;default:return!1}}},J=class extends L{createNewModel(e){return{}}parseOpen(e){return this.parser=this.parser||this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=this.createNewModel(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}onParserClose(e,t){this.model[e]=t.model}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.onParserClose(e,this.parser),this.parser=void 0),!0):e!==this.tag}get tag(){return``}},Ki=class extends L{get tag(){return`cfvo`}render(e,t){e.leafNode(this.tag,{type:t.type,val:t.value})}parseOpen(e){this.model={type:e.attributes.type,value:L.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},qi=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Ki,color:this.colorXform=new z}}get tag(){return`dataBar`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.colorXform.render(e,t.color),e.closeNode()}createNewModel(){return{cfvo:[]}}onParserClose(e,t){switch(e){case`cfvo`:this.model.cfvo.push(t.model);break;case`color`:this.model.color=t.model;break}}},Ji=class extends L{get tag(){return`x14:id`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Yi=class extends J{constructor(){super(),this.map={"x14:id":this.idXform=new Ji}}get tag(){return`ext`}render(e,t){e.openNode(this.tag,{uri:`{B025F937-C7B1-47D3-B67F-A62EFF666E3E}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.idXform.render(e,t.x14Id),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model.x14Id=t.model}},Xi=class extends J{constructor(){super(),this.map={ext:new Yi}}get tag(){return`extLst`}render(e,t){e.openNode(this.tag),this.map.ext.render(e,t),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){Object.assign(this.model,t.model)}},Zi=class extends L{get tag(){return`formula`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},Qi=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Ki,color:this.colorXform=new z}}get tag(){return`colorScale`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.color.forEach(t=>{this.colorXform.render(e,t)}),e.closeNode()}createNewModel(e){return{cfvo:[],color:[]}}onParserClose(e,t){this.model[e].push(t.model)}},$i=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Ki}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:L.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:L.toBoolAttribute(t.reverse,!1),showValue:L.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:L.toStringValue(e.iconSet,`3TrafficLights`),reverse:L.toBoolValue(e.reverse),showValue:L.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let ea={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},ta=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new r(e.ref);switch(e.operator){case`containsText`:return`NOT(ISERROR(SEARCH("${e.text}",${t})))`;case`containsBlanks`:return`LEN(TRIM(${t}))=0`;case`notContainsBlanks`:return`LEN(TRIM(${t}))>0`;case`containsErrors`:return`ISERROR(${t})`;case`notContainsErrors`:return`NOT(ISERROR(${t}))`;default:return}},na=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new r(e.ref);switch(e.timePeriod){case`thisWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(${t},0)-TODAY()<=7-WEEKDAY(TODAY()))`;case`lastWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(${t},0)<(WEEKDAY(TODAY())+7))`;case`nextWeek`:return`AND(ROUNDDOWN(${t},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(${t},0)-TODAY()<(15-WEEKDAY(TODAY())))`;case`yesterday`:return`FLOOR(${t},1)=TODAY()-1`;case`today`:return`FLOOR(${t},1)=TODAY()`;case`tomorrow`:return`FLOOR(${t},1)=TODAY()+1`;case`last7Days`:return`AND(TODAY()-FLOOR(${t},1)<=6,FLOOR(${t},1)<=TODAY())`;case`lastMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0-1)),YEAR(${t})=YEAR(EDATE(TODAY(),0-1)))`;case`thisMonth`:return`AND(MONTH(${t})=MONTH(TODAY()),YEAR(${t})=YEAR(TODAY()))`;case`nextMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0+1)),YEAR(${t})=YEAR(EDATE(TODAY(),0+1)))`;default:return}},ra=e=>{let{type:t,operator:n}=e;switch(t){case`containsText`:case`containsBlanks`:case`notContainsBlanks`:case`containsErrors`:case`notContainsErrors`:return{type:`containsText`,operator:t};default:return{type:t,operator:n}}};var ia=class e extends J{constructor(){super(),this.map={dataBar:this.databarXform=new qi,extLst:this.extLstRefXform=new Xi,formula:this.formulaXform=new Zi,colorScale:this.colorScaleXform=new Qi,iconSet:this.iconSetXform=new $i}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||ea[e.iconSet]))}render(e,t){switch(t.type){case`expression`:this.renderExpression(e,t);break;case`cellIs`:this.renderCellIs(e,t);break;case`top10`:this.renderTop10(e,t);break;case`aboveAverage`:this.renderAboveAverage(e,t);break;case`dataBar`:this.renderDataBar(e,t);break;case`colorScale`:this.renderColorScale(e,t);break;case`iconSet`:this.renderIconSet(e,t);break;case`containsText`:this.renderText(e,t);break;case`timePeriod`:this.renderTimePeriod(e,t);break}}renderExpression(e,t){e.openNode(this.tag,{type:`expression`,dxfId:t.dxfId,priority:t.priority}),this.formulaXform.render(e,t.formulae[0]),e.closeNode()}renderCellIs(e,t){e.openNode(this.tag,{type:`cellIs`,dxfId:t.dxfId,priority:t.priority,operator:t.operator}),t.formulae.forEach(t=>{this.formulaXform.render(e,t)}),e.closeNode()}renderTop10(e,t){e.leafNode(this.tag,{type:`top10`,dxfId:t.dxfId,priority:t.priority,percent:L.toBoolAttribute(t.percent,!1),bottom:L.toBoolAttribute(t.bottom,!1),rank:L.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:L.toBoolAttribute(t.aboveAverage,!0)})}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,priority:t.priority}),this.databarXform.render(e,t),this.extLstRefXform.render(e,t),e.closeNode()}renderColorScale(e,t){e.openNode(this.tag,{type:`colorScale`,priority:t.priority}),this.colorScaleXform.render(e,t),e.closeNode()}renderIconSet(t,n){e.isPrimitive(n)&&(t.openNode(this.tag,{type:`iconSet`,priority:n.priority}),this.iconSetXform.render(t,n),t.closeNode())}renderText(e,t){e.openNode(this.tag,{type:t.operator,dxfId:t.dxfId,priority:t.priority,operator:L.toStringAttribute(t.operator,`containsText`)});let n=ta(t);n&&this.formulaXform.render(e,n),e.closeNode()}renderTimePeriod(e,t){e.openNode(this.tag,{type:`timePeriod`,dxfId:t.dxfId,priority:t.priority,timePeriod:t.timePeriod});let n=na(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...ra(e),dxfId:L.toIntValue(e.dxfId),priority:L.toIntValue(e.priority),timePeriod:e.timePeriod,percent:L.toBoolValue(e.percent),bottom:L.toBoolValue(e.bottom),rank:L.toIntValue(e.rank),aboveAverage:L.toBoolValue(e.aboveAverage)}}onParserClose(e,t){switch(e){case`dataBar`:case`extLst`:case`colorScale`:case`iconSet`:Object.assign(this.model,t.model);break;case`formula`:this.model.formulae=this.model.formulae??[],this.model.formulae.push(t.model);break}}},aa=class extends J{constructor(){super(),this.map={cfRule:new ia}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(ia.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{ia.isPrimitive(n)&&(n.ref=t.ref,this.map.cfRule.render(e,n))}),e.closeNode())}createNewModel({attributes:e}){return{ref:e.sqref,rules:[]}}onParserClose(e,t){this.model.rules.push(t.model)}},oa=class extends L{constructor(){super(),this.cfXform=new aa}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority??0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style)),e.type===`dataBar`&&((!e.cfvo||e.cfvo.length<2)&&(e.cfvo=[{type:`min`},{type:`max`}]),e.color||={argb:`FF638EC6`})})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},sa=class extends L{get tag(){return`xm:f`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},ca=class extends J{constructor(){super(),this.map={"xm:f":this.fExtXform=new sa}}get tag(){return`x14:cfvo`}render(e,t){e.openNode(this.tag,{type:t.type}),t.value!==void 0&&this.fExtXform.render(e,t.value),e.closeNode()}createNewModel(e){return{type:e.attributes.type}}onParserClose(e,t){switch(e){case`xm:f`:this.model.value=t.model?parseFloat(t.model):0;break}}},la=class extends J{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ca,"x14:borderColor":this.borderColorXform=new z(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new z(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new z(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new z(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:L.toIntAttribute(t.minLength,0,!0),maxLength:L.toIntAttribute(t.maxLength,100,!0),border:L.toBoolAttribute(t.border,!1),gradient:L.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:L.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:L.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:L.toAttribute(t.axisPosition,`auto`),direction:L.toAttribute(t.direction,`leftToRight`)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.borderColorXform.render(e,t.borderColor),this.negativeBorderColorXform.render(e,t.negativeBorderColor),this.negativeFillColorXform.render(e,t.negativeFillColor),this.axisColorXform.render(e,t.axisColor),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],minLength:L.toIntValue(e.minLength,0),maxLength:L.toIntValue(e.maxLength,100),border:L.toBoolValue(e.border,!1),gradient:L.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:L.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:L.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:L.toStringValue(e.axisPosition,`auto`),direction:L.toStringValue(e.direction,`leftToRight`)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;default:this.model[n]=t.model;break}}},ua=class extends L{get tag(){return`x14:cfIcon`}render(e,t){e.leafNode(this.tag,{iconSet:t.iconSet,iconId:t.iconId})}parseOpen({attributes:e}){this.model={iconSet:e.iconSet,iconId:L.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},da=class extends J{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new ca,"x14:cfIcon":this.cfIconXform=new ua}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:L.toStringAttribute(t.iconSet),reverse:L.toBoolAttribute(t.reverse,!1),showValue:L.toBoolAttribute(t.showValue,!0),custom:L.toBoolAttribute(t.icons,!1)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.icons&&t.icons.forEach((t,n)=>{t.iconId=n,this.cfIconXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],iconSet:L.toStringValue(e.iconSet,`3TrafficLights`),reverse:L.toBoolValue(e.reverse,!1),showValue:L.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};function Y(e){return e.toString(16).padStart(2,`0`)}function fa(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=e;return Y(t[0])+Y(t[1])+Y(t[2])+Y(t[3])+`-`+Y(t[4])+Y(t[5])+`-`+Y(t[6])+Y(t[7])+`-`+Y(t[8])+Y(t[9])+`-`+Y(t[10])+Y(t[11])+Y(t[12])+Y(t[13])+Y(t[14])+Y(t[15])}function pa(){let e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();let t=new Uint8Array(16);if(e?.getRandomValues)return e.getRandomValues(t),fa(t);for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return fa(t)}let ma={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var ha=class e extends J{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new la,"x14:iconSet":this.iconSetXform=new da}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?la.isExt(e):!!(e.type===`iconSet`&&(e.custom||ma[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${pa()}}`.toUpperCase())}render(t,n){if(e.isExt(n))switch(n.type){case`dataBar`:this.renderDataBar(t,n);break;case`iconSet`:this.renderIconSet(t,n);break}}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,id:t.x14Id}),this.databarXform.render(e,t),e.closeNode()}renderIconSet(e,t){e.openNode(this.tag,{type:`iconSet`,priority:t.priority,id:t.x14Id??`{${pa()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:L.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},ga=class extends L{get tag(){return`xm:sqref`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},_a=class extends J{constructor(){super(),this.map={"xm:sqref":this.sqRef=new ga,"x14:cfRule":this.cfRule=new ha}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(ha.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(ha.isExt).forEach(t=>this.cfRule.render(e,t)),this.sqRef.render(e,t.ref),e.closeNode())}createNewModel(){return{rules:[]}}onParserClose(e,t){switch(e){case`xm:sqref`:this.model.ref=t.model;break;case`x14:cfRule`:this.model.rules.push(t.model);break}}},va=class extends J{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new _a}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(ha.isExt))),e.hasExtContent}prepare(e){e.forEach(e=>{this.cfXform.prepare(e)})}render(e,t){this.hasContent(t)&&(e.openNode(this.tag),t.forEach(t=>this.cfXform.render(e,t)),e.closeNode())}createNewModel(){return[]}onParserClose(e,t){this.model.push(t.model)}},ya=class extends J{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new va}}get tag(){return`ext`}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e){this.conditionalFormattings.prepare(e.conditionalFormattings)}render(e,t){e.openNode(`ext`,{uri:`{78C0D931-6437-407d-A8EE-F0AAD7539E65}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.conditionalFormattings.render(e,t.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}},ba=class extends J{constructor(){super(),this.map={ext:this.ext=new ya}}get tag(){return`extLst`}prepare(e,t){this.ext.prepare(e)}hasContent(e){return this.ext.hasContent(e)}render(e,t){this.hasContent(t)&&(e.openNode(`extLst`),this.ext.render(e,t),e.closeNode())}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}};let xa=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},Sa=(e,t)=>{if(!t||!t.length)return e;if(!e||!e.length)return t;let n={},r={};return e.forEach(e=>{n[e.ref]=e,e.rules.forEach(e=>{let{x14Id:t}=e;t&&(r[t]=e)})}),t.forEach(t=>{t.rules.forEach(i=>{let a=r[i.x14Id];a?xa(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var Ca=class e extends L{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"mc:Ignorable":`x14ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r??[],this.map={sheetPr:new wi,dimension:new mi,sheetViews:new R({tag:`sheetViews`,count:!1,childXform:new Di}),sheetFormatPr:new Ti,cols:new R({tag:`cols`,count:!1,childXform:new pi}),sheetData:new R({tag:`sheetData`,count:!1,empty:!0,childXform:new fi({maxItems:n}),maxItems:t}),autoFilter:new Ri,mergeCells:new R({tag:`mergeCells`,count:!0,childXform:new gi}),rowBreaks:new Ui,colBreaks:new Wi,hyperlinks:new R({tag:`hyperlinks`,count:!1,childXform:new hi}),pageMargins:new ki,dataValidations:new bi,pageSetup:new Fi,headerFooter:new Gi,printOptions:new Li,picture:new zi,drawing:new Bi,sheetProtection:new Oi,tableParts:new R({tag:`tableParts`,count:!0,childXform:new Vi}),conditionalFormatting:new oa,extLst:new ba}}prepare(e,t){t.merges=new ci,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],e.formControls&&e.formControls.length>0&&(!e.views||e.views.length===0)&&(e.views=[{workbookViewId:0}]),t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;let r=e.rels=[];function i(e){return`rId${e.length+1}`}e.hyperlinks.forEach(e=>{let t=i(r);e.rId=t,r.push({Id:t,Type:G.Hyperlink,Target:e.target,TargetMode:`External`})});let{fileIndex:a}=e;if(e.comments.length>0){let o={Id:i(r),Type:G.Comments,Target:Pr(a)};r.push(o);let s={Id:i(r),Type:G.VmlDrawing,Target:Fr(a)};r.push(s),e.comments.forEach(e=>{e.refAddress=n.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${a}`,vmlDrawing:`vmlDrawing${a}`})}if(e.drawing&&e.drawing.anchors){let n=e.drawing;n.rId=i(r),n.name||=`drawing${++t.drawingsCount}`;let a=(n.rels??[]).some(e=>e.Target&&e.Target.includes(`/charts/`));n.anchors=[],a||(n.rels=[]),t.drawings.push(n),r.push({Id:n.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Ir(n.name)})}let o=[],s;if(e.media.forEach(n=>{if(n.type===`background`){let a=i(r);s=t.media[n.imageId],r.push({Id:a,Type:G.Image,Target:Ur(`${s.name}.${s.extension}`)}),e.background={rId:a},e.image=t.media[n.imageId]}else if(n.type===`image`){let{drawing:a}=e;s=t.media[n.imageId],a||(a=e.drawing={rId:i(r),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(a),r.push({Id:a.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Ir(a.name)}));let c=this.preImageId===n.imageId?o[n.imageId]:o[a.rels.length];c||(c=i(a.rels),o[a.rels.length]=c,a.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:Ur(`${s.name}.${s.extension}`)}));let l={picture:{rId:c},range:n.range};if(n.hyperlinks&&n.hyperlinks.hyperlink){let e=i(a.rels);o[a.rels.length]=e,l.picture.hyperlinks={tooltip:n.hyperlinks.tooltip,rId:e},a.rels.push({Id:e,Type:G.Hyperlink,Target:n.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=n.imageId,a.anchors.push(l)}}),e.tables.forEach(e=>{let n=i(r);e.rId=n,r.push({Id:n,Type:G.Table,Target:Vr(e.target)}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables??[]).forEach(e=>{r.push({Id:i(r),Type:G.PivotTable,Target:zr(e.tableNumber)})}),e.formControls&&e.formControls.length>0){let{drawing:n}=e;n||(n=e.drawing={rId:i(r),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(n),r.push({Id:n.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Ir(n.name)})),e.comments.length===0&&r.push({Id:i(r),Type:G.VmlDrawing,Target:Fr(a)});let o=e=>({nativeCol:e.col,nativeColOff:e.colOff,nativeRow:e.row,nativeRowOff:e.rowOff});for(let a of e.formControls){let e=t.formControlRefs.length+1;a.ctrlPropId=e;let s=i(r);a.ctrlPropRelId=s,r.push({Id:s,Type:G.CtrlProp,Target:Gr(e)}),t.formControlRefs.push(e);let c=`Check Box ${Math.max(1,a.shapeId-1024)}`;n.anchors.push({range:{editAs:`absolute`,tl:o(a.tl),br:o(a.br)},alternateContent:{requires:`a14`},shape:{cNvPrId:a.shapeId,name:a.name||c,hidden:!0,spid:`_x0000_s${a.shapeId}`,text:a.text}})}}this.map.extLst.prepare(e,t)}render(t,n){t.openXml(F.StdDocAttributes);let r={...e.WORKSHEET_ATTRIBUTES};n.formControls&&n.formControls.length>0&&(r[`xmlns:x14`]=`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,r[`xmlns:xdr`]=`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,r[`mc:Ignorable`]=`${r[`mc:Ignorable`]} x14`),t.openNode(`worksheet`,r);let i=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow,customHeight:n.properties.customHeight}:void 0;n.properties&&n.properties.defaultColWidth&&(i.defaultColWidth=n.properties.defaultColWidth);let a={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},o=n.pageSetup&&n.pageSetup.margins,s={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},c=n.sheetProtection;if(this.map.sheetPr.render(t,a),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,i),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,c),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,s),this.map.pageMargins.render(t,o),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.colBreaks.render(t,n.colBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),n.rels&&n.rels.forEach(e=>{e.Type===G.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),n.formControls&&n.formControls.length>0){t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`controls`);for(let e of n.formControls){if(!e.ctrlPropRelId)continue;let n=`Check Box ${Math.max(1,e.shapeId-1024)}`;t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`control`,{shapeId:e.shapeId,"r:id":e.ctrlPropRelId,name:e.name||n}),t.openNode(`controlPr`,{locked:0,defaultSize:0,print:e.print?1:0,autoFill:0,autoLine:0,autoPict:0}),t.openNode(`anchor`),t.openNode(`from`),t.leafNode(`xdr:col`,void 0,e.tl.col),t.leafNode(`xdr:colOff`,void 0,e.tl.colOff),t.leafNode(`xdr:row`,void 0,e.tl.row),t.leafNode(`xdr:rowOff`,void 0,e.tl.rowOff),t.closeNode(),t.openNode(`to`),t.leafNode(`xdr:col`,void 0,e.br.col),t.leafNode(`xdr:colOff`,void 0,e.br.colOff),t.leafNode(`xdr:row`,void 0,e.br.row),t.leafNode(`xdr:rowOff`,void 0,e.br.rowOff),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=Sa(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r,rowBreaks:this.map.rowBreaks.model??[],colBreaks:this.map.colBreaks.model??[]},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships??[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===G.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===G.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings[r.Target].comments;e.comments.forEach((e,t)=>{e.note=Object.assign({},e.note,n[t])})}return n},{});if(t.commentsMap=(e.comments??[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks??[]).reduce((e,t)=>(t.rId&&(e[t.address]=n[t.rId].Target),e),{}),t.formulae={},e.rows=e.rows?.filter(Boolean)??[],e.rows.forEach(e=>{e.cells=e.cells?.filter(Boolean)??[]}),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){let r=n[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(r){let n=r[1],i=t.drawings[n];i&&(e.drawing={...i,name:n,rels:t.drawingRels?.[n]??i.rels??[]},i.anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}}))}}let r=e.background&&n[e.background.rId];if(r){let n=r.Target.split(`/media/`)[1],i=t.mediaIndex&&t.mediaIndex[n];i!==void 0&&e.media.push({type:`background`,imageId:i})}e.tables=(e.tables??[]).map(e=>{let r=n[e.rId];return t.tables[r.Target]}),e.pivotTables=[],(e.relationships??[]).forEach(n=>{if(n.Type===G.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},wa=class extends L{render(e){e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.openNode(`FeaturePropertyBags`,{xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`}),e.leafNode(`bag`,{type:`Checkbox`}),e.openNode(`bag`,{type:`XFControls`}),e.leafNode(`bagId`,{k:`CellControl`},`0`),e.closeNode(),e.openNode(`bag`,{type:`XFComplement`}),e.leafNode(`bagId`,{k:`XFControls`},`1`),e.closeNode(),e.openNode(`bag`,{type:`XFComplements`,extRef:`XFComplementsMapperExtRef`}),e.openNode(`a`,{k:`MappedFeaturePropertyBags`}),e.leafNode(`bagId`,{},`2`),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}},Ta=class extends L{parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={range:{editAs:e.attributes.editAs??`oneCell`}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}reconcilePicture(e,t){if(e&&e.rId){let n=t.rels[e.rId].Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);if(n){let e=n[1],r=t.mediaIndex[e];return t.media[r]}}}},Ea=class extends L{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new on({tag:`xdr:col`,zero:!0}),"xdr:colOff":new on({tag:`xdr:colOff`,zero:!0}),"xdr:row":new on({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new on({tag:`xdr:rowOff`,zero:!0})},this.model={nativeCol:0,nativeColOff:0,nativeRow:0,nativeRowOff:0}}render(e,t){e.openNode(this.tag),this.map[`xdr:col`].render(e,t.nativeCol),this.map[`xdr:colOff`].render(e,t.nativeColOff),this.map[`xdr:row`].render(e,t.nativeRow),this.map[`xdr:rowOff`].render(e,t.nativeRowOff),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model={nativeCol:this.map[`xdr:col`].model,nativeColOff:this.map[`xdr:colOff`].model,nativeRow:this.map[`xdr:row`].model,nativeRowOff:this.map[`xdr:rowOff`].model},!1;default:return!0}}},Da=class extends L{constructor(){super(),this.model={rId:``}}get tag(){return`a:blip`}render(e,t){e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:embed":t.rId,cstate:`print`})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:embed`]},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Oa=class extends L{constructor(){super(),this.map={"a:blip":new Da}}get tag(){return`xdr:blipFill`}render(e,t){e.openNode(this.tag),this.map[`a:blip`].render(e,t),e.openNode(`a:stretch`),e.leafNode(`a:fillRect`),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:blip`].model,!1;default:return!0}}},ka=class extends L{constructor(){super(),this.model={}}get tag(){return`a:hlinkClick`}render(e,t){t.hyperlinks&&t.hyperlinks.rId&&e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:id":t.hyperlinks.rId,tooltip:t.hyperlinks.tooltip})}parseOpen(e){switch(e.name){case this.tag:return this.model={hyperlinks:{rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip}},!0;default:return!0}}parseText(){}parseClose(){return!1}},Aa=class extends L{get tag(){return`a:extLst`}render(e){e.openNode(this.tag),e.openNode(`a:ext`,{uri:`{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}`}),e.leafNode(`a16:creationId`,{"xmlns:a16":`http://schemas.microsoft.com/office/drawing/2014/main`,id:`{00000000-0008-0000-0000-000002000000}`}),e.closeNode(),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},ja=class extends L{constructor(){super(),this.map={"a:hlinkClick":new ka,"a:extLst":new Aa}}get tag(){return`xdr:cNvPr`}render(e,t){e.openNode(this.tag,{id:t.index,name:`Picture ${t.index}`}),this.map[`a:hlinkClick`].render(e,t),this.map[`a:extLst`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:hlinkClick`].model,!1;default:return!0}}},Ma=class extends L{get tag(){return`xdr:cNvPicPr`}render(e){e.openNode(this.tag),e.leafNode(`a:picLocks`,{noChangeAspect:`1`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Na=class extends L{constructor(){super(),this.map={"xdr:cNvPr":new ja,"xdr:cNvPicPr":new Ma}}get tag(){return`xdr:nvPicPr`}render(e,t){e.openNode(this.tag),this.map[`xdr:cNvPr`].render(e,t),this.map[`xdr:cNvPicPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`xdr:cNvPr`].model,!1;default:return!0}}};let Pa={tag:`xdr:spPr`,c:[{tag:`a:xfrm`,c:[{tag:`a:off`,$:{x:`0`,y:`0`}},{tag:`a:ext`,$:{cx:`0`,cy:`0`}}]},{tag:`a:prstGeom`,$:{prst:`rect`},c:[{tag:`a:avLst`}]}]};var Fa=class extends L{constructor(){super(),this.map={"xdr:nvPicPr":new Na,"xdr:blipFill":new Oa,"xdr:spPr":new rn(Pa)}}get tag(){return`xdr:pic`}prepare(e,t){e.index=t.index+1}render(e,t){e.openNode(this.tag),this.map[`xdr:nvPicPr`].render(e,t),this.map[`xdr:blipFill`].render(e,t),this.map[`xdr:spPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.mergeModel(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}},Ia=class extends L{get tag(){return`xdr:sp`}render(e,t){t&&(e.openNode(this.tag,{macro:``,textlink:``}),e.openNode(`xdr:nvSpPr`),e.openNode(`xdr:cNvPr`,{id:t.cNvPrId,name:t.name,hidden:t.hidden?`1`:void 0}),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{63B3BB69-23CF-44E3-9099-C40C66FF867C}`}),e.leafNode(`a14:compatExt`,{spid:t.spid,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`},void 0),e.closeNode(),e.closeNode(),e.closeNode(),e.leafNode(`xdr:cNvSpPr`),e.closeNode(),e.openNode(`xdr:spPr`,{bwMode:`auto`}),e.openNode(`a:xfrm`),e.leafNode(`a:off`,{x:0,y:0}),e.leafNode(`a:ext`,{cx:0,cy:0}),e.closeNode(),e.openNode(`a:prstGeom`,{prst:`rect`}),e.leafNode(`a:avLst`),e.closeNode(),e.leafNode(`a:noFill`),e.openNode(`a:ln`),e.leafNode(`a:noFill`),e.closeNode(),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{909E8E84-426E-40DD-AFC4-6F175D3DCCD1}`}),e.openNode(`a14:hiddenFill`,{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`F0F0F0`}),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`a:ext`,{uri:`{91240B29-F687-4F45-9708-019B960494DF}`}),e.openNode(`a14:hiddenLine`,{w:9525,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:miter`,{lim:8e5}),e.leafNode(`a:headEnd`),e.leafNode(`a:tailEnd`),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`xdr:txBody`),e.leafNode(`a:bodyPr`,{vertOverflow:`clip`,wrap:`square`,lIns:18288,tIns:18288,rIns:0,bIns:18288,anchor:`ctr`,upright:1}),e.leafNode(`a:lstStyle`),e.openNode(`a:p`),e.openNode(`a:pPr`,{algn:`l`,rtl:0}),e.leafNode(`a:defRPr`,{sz:1e3}),e.closeNode(),e.openNode(`a:r`),e.openNode(`a:rPr`,{lang:`en-US`,sz:800,b:0,i:0,u:`none`,strike:`noStrike`,baseline:0}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:latin`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:ea`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:cs`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.closeNode(),e.openNode(`a:t`),e.writeText(t.text??``),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode())}},La=class extends Ta{constructor(){super(),this.map={"xdr:from":new Ea({tag:`xdr:from`}),"xdr:to":new Ea({tag:`xdr:to`}),"xdr:pic":new Fa,"xdr:sp":new Ia,"xdr:clientData":new rn({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){e.picture&&this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){let n=!!t.alternateContent;n&&(e.openNode(`mc:AlternateContent`,{"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`}),e.openNode(`mc:Choice`,{Requires:t.alternateContent?.requires,...t.alternateContent?.requires===`a14`?{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}:{}})),e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),t.picture?this.map[`xdr:pic`].render(e,t.picture):t.shape&&this.map[`xdr:sp`].render(e,t.shape),this.map[`xdr:clientData`].render(e,{}),e.closeNode(),n&&(e.closeNode(),e.leafNode(`mc:Fallback`),e.closeNode())}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};let Ra=9525;var za=class extends L{constructor(e){super(),this.tag=e.tag,this.map={},this.model={width:0,height:0}}render(e,t){e.openNode(this.tag);let n=Math.floor(t.width*Ra),r=Math.floor(t.height*Ra);e.addAttribute(`cx`,n),e.addAttribute(`cy`,r),e.closeNode()}parseOpen(e){return e.name===this.tag?(this.model={width:parseInt(e.attributes.cx??`0`,10)/Ra,height:parseInt(e.attributes.cy??`0`,10)/Ra},!0):!1}parseText(e){}parseClose(e){return!1}},Ba=class extends Ta{constructor(){super(),this.map={"xdr:from":new Ea({tag:`xdr:from`}),"xdr:ext":new za({tag:`xdr:ext`}),"xdr:pic":new Fa,"xdr:clientData":new rn({tag:`xdr:clientData`})}}get tag(){return`xdr:oneCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:ext`].render(e,t.range.ext),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.ext=this.map[`xdr:ext`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};function Va(e){return(typeof e.range==`string`?n.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Ha=class e extends L{constructor(){super(),this.map={"xdr:twoCellAnchor":new La,"xdr:oneCellAnchor":new Ba},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Va(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),r.anchors.forEach(e=>{this.map[e.anchorType].render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={anchors:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.anchors.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:xdr":`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,"xmlns:a":`http://schemas.openxmlformats.org/drawingml/2006/main`}}},Ua=class extends L{constructor(){super(),this.model={val:``}}get tag(){return`customFilter`}render(e,t){e.leafNode(this.tag,{val:t.val,operator:t.operator})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val,operator:e.attributes.operator},!0):!1}parseText(){}parseClose(){return!1}},Wa=class extends L{constructor(){super(),this.model={val:``}}get tag(){return`filter`}render(e,t){e.leafNode(this.tag,{val:t.val})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val},!0):!1}parseText(){}parseClose(){return!1}},Ga=class extends L{constructor(){super(),this.map={customFilters:new R({tag:`customFilters`,count:!1,empty:!0,childXform:new Ua}),filters:new R({tag:`filters`,count:!1,empty:!0,childXform:new Wa})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.customFilters=this.map.customFilters.model,!1;default:return!0}}},Ka=class extends L{constructor(){super(),this.map={filterColumn:new Ga},this.model={autoFilterRef:``,columns:[]}}get tag(){return`autoFilter`}prepare(e){e.columns.forEach((e,t)=>{this.map.filterColumn.prepare(e,{index:t})})}render(e,t){e.openNode(this.tag,{ref:t.autoFilterRef}),t.columns.forEach(t=>{this.map.filterColumn.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model={autoFilterRef:e.attributes.ref,columns:[]},!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},qa=class extends L{constructor(){super(),this._childText=``,this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}_renderAttributes(e){return{id:e.id.toString(),name:e.name,totalsRowLabel:e.totalsRowLabel,totalsRowFunction:e.totalsRowFunction===`none`?void 0:e.totalsRowFunction,dxfId:e.dxfId}}render(e,t){t.calculatedColumnFormula||t.totalsRowFormula?(e.openNode(this.tag,this._renderAttributes(t)),t.calculatedColumnFormula&&e.leafNode(`calculatedColumnFormula`,void 0,t.calculatedColumnFormula),t.totalsRowFormula&&e.leafNode(`totalsRowFormula`,void 0,t.totalsRowFormula),e.closeNode()):e.leafNode(this.tag,this._renderAttributes(t))}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return(e.name===`calculatedColumnFormula`||e.name===`totalsRowFormula`)&&(this._childTag=e.name,this._childText=``),!0}parseText(e){this._childTag&&(this._childText+=e)}parseClose(e){return e===this.tag?!1:(this._childTag&&e===this._childTag&&(this.model[this._childTag]=this._childText,this._childTag=void 0),!0)}},Ja=class extends L{constructor(){super(),this.model={theme:null,showFirstColumn:!1,showLastColumn:!1,showRowStripes:!1,showColumnStripes:!1}}get tag(){return`tableStyleInfo`}render(e,t){e.leafNode(this.tag,{name:t.theme?t.theme:void 0,showFirstColumn:t.showFirstColumn?`1`:`0`,showLastColumn:t.showLastColumn?`1`:`0`,showRowStripes:t.showRowStripes?`1`:`0`,showColumnStripes:t.showColumnStripes?`1`:`0`})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={theme:t.name?t.name:null,showFirstColumn:t.showFirstColumn===`1`,showLastColumn:t.showLastColumn===`1`,showRowStripes:t.showRowStripes===`1`,showColumnStripes:t.showColumnStripes===`1`},!0}return!1}parseText(){}parseClose(){return!1}},Ya=class e extends L{constructor(){super(),this.map={autoFilter:new Ka,tableColumns:new R({tag:`tableColumns`,count:!0,empty:!0,childXform:new qa}),tableStyleInfo:new Ja},this.model={id:0,name:``,tableRef:``,columns:[]}}prepare(e,t){this.map.autoFilter.prepare(e),this.map.tableColumns.prepare(e.columns,t)}get tag(){return`table`}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,headerRowCount:n.headerRow?void 0:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount!==`0`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}};function Xa(e){return isNaN(e.getTime())?``:e.toISOString().replace(/\.\d{3}Z$/,``)}function Za(e){let t=A(e.name),n=e.numFmtId??`0`,r=$a(e.extraAttrs),i=e.fieldGroupXml?`\n ${e.fieldGroupXml}`:``;if(e.sharedItems===null){if(e.isLoaded)return i?`<cacheField name="${t}" numFmtId="${n}"${r}>${i}\n </cacheField>`:`<cacheField name="${t}" numFmtId="${n}"${r} />`;let a;return a=e.minValue!==void 0&&e.maxValue!==void 0?` containsSemiMixedTypes="0" containsString="0" containsNumber="1"${e.containsInteger?` containsInteger="1"`:``} minValue="${e.minValue}" maxValue="${e.maxValue}"`:``,`<cacheField name="${t}" numFmtId="${n}"${r}>
10
+ `),t=this.i):Yt(i)||(r=!0)}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}sOpenWaka(){let e=this.getCode();if(Zt(e)){this.state=3,this.name=I(e);return}switch(e){case 47:this.state=11,this.name=``;break;case 33:this.state=2,this.openWakaBang=``;break;case 63:this.state=19,this.text=``;break;default:this.fail(`unexpected character in tag`),this.state=0}}sOpenWakaBang(){let e=this.getCode();switch(this.openWakaBang+=I(e),this.openWakaBang){case`[CDATA[`:this.state=16,this.text=``,this.openWakaBang=``;break;case`--`:this.state=13,this.text=``,this.openWakaBang=``;break;case`DOCTYPE`:this.state=21,this.text=``,this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&(this.fail(`incorrect syntax`),this.state=0)}}sOpenTag(){let e=this.getCode();if(e!==-1){if(Qt(e)){this.name+=I(e);return}this.tag={name:this.name,attributes:Object.create(null),isSelfClosing:!1},this.attribList=[],this.sawRoot=!0,e===62?this.openTag():e===47?this.state=4:(Yt(e)||this.fail(`unexpected character in tag`),this.state=5)}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`expected >`),this.state=5)}sAttrib(){let e=this.skipSpaces();e!==-1&&(Zt(e)?(this.name=I(e),this.state=6):e===62?this.openTag():e===47?this.state=4:this.fail(`unexpected character in attribute`))}sAttribName(){let e=this.getCode();if(e!==-1){if(Qt(e)){this.name+=I(e);return}e===61?this.state=8:Yt(e)?this.state=7:e===62?(this.fail(`attribute without value`),this.attribList.push({name:this.name,value:this.name}),this.name=``,this.openTag()):this.fail(`unexpected character in attribute name`)}}sAttribNameSawWhite(){let e=this.skipSpaces();e!==-1&&(e===61?this.state=8:(this.fail(`attribute without value`),this.name=``,this.text=``,e===62?this.openTag():Zt(e)?(this.name=I(e),this.state=6):(this.fail(`unexpected character`),this.state=5)))}sAttribValue(){let e=this.skipSpaces();e!==-1&&(Xt(e)?(this.q=e,this.text=``,this.state=9):(this.fail(`unquoted attribute value`),this.state=0))}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;){let r=this.getCode();if(r===-1){this.text+=t.slice(n,this.i);return}if(r===e){this.attribList.push({name:this.name,value:this.text+t.slice(n,this.prevI)}),this.name=``,this.text=``,this.q=null,this.state=10;return}if(r===38){this.text+=t.slice(n,this.prevI),this.state=25,this.entityReturnState=9,this.entity=``;return}if((r===10||r===9)&&(this.text+=t.slice(n,this.prevI)+` `,n=this.i),r===60){this.text+=t.slice(n,this.prevI),this.fail(`< not allowed in attribute value`);return}}}sAttribValueClosed(){let e=this.getCode();e!==-1&&(Yt(e)?this.state=5:e===62?this.openTag():e===47?this.state=4:Zt(e)?(this.fail(`no whitespace between attributes`),this.name=I(e),this.state=6):this.fail(`unexpected character after attribute`))}sCloseTag(){let e=this.getCode();e!==-1&&(Qt(e)?this.name+=I(e):e===62?this.closeTag():Yt(e)?this.state=12:this.fail(`unexpected character in close tag`))}sCloseTagSawWhite(){let e=this.skipSpaces();e!==-1&&(e===62?this.closeTag():this.fail(`unexpected character in close tag`))}sComment(){let e=this.getCode();e!==-1&&(e===45?this.state=14:this.text+=I(e))}sCommentEnding(){let e=this.getCode();e===45?this.state=15:(this.text+=`-`+I(e),this.state=13)}sCommentEnded(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===45?this.text+=`-`:(this.fail(`malformed comment`),this.text+=`--`+I(e),this.state=13)}sCData(){let e=this.getCode();e!==-1&&(e===93?this.state=17:this.text+=I(e))}sCDataEnding(){let e=this.getCode();e===93?this.state=18:(this.text+=`]`+I(e),this.state=16)}sCDataEnding2(){let e=this.getCode();e===62?(this.textHandler&&this.text.length>0&&this.textHandler(this.text),this.text=``,this.state=0):e===93?this.text+=`]`:(this.text+=`]]`+I(e),this.state=16)}sPI(){let e=this.getCode();e!==-1&&(e===63?this.state=20:this.text+=I(e))}sPIEnding(){let e=this.getCode();e===62?(this.text=``,this.state=0):e===63?this.text+=`?`:(this.text+=`?`+I(e),this.state=19)}sDoctype(){let e=this.getCode();e!==-1&&(e===62?(this.text=``,this.state=0):Xt(e)?(this.q=e,this.state=22):e===91?this.state=23:this.text+=I(e))}sDoctypeQuote(){let e=this.getCode();e!==-1&&(e===this.q?(this.q=null,this.state=21):this.text+=I(e))}sDoctypeDTD(){let e=this.getCode();e!==-1&&(e===93?this.state=21:Xt(e)&&(this.q=e,this.state=24))}sDoctypeDTDQuoted(){let e=this.getCode();e!==-1&&e===this.q&&(this.q=null,this.state=23)}sEntity(){let e=this.getCode();if(e!==-1)if(e===59){let e=this.entity,t;e===``?(this.fail(`empty entity`),t=`&;`):t=this.parseEntity(e),this.text+=t,this.state=this.entityReturnState,this.entity=``}else Qt(e)||e===35?this.entity+=I(e):(this.fail(`invalid entity character`),this.text+=`&`+this.entity+I(e),this.state=this.entityReturnState,this.entity=``)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(`undefined entity: `+e),`&`+e+`;`):t}let t;return t=e[1]===`x`||e[1]===`X`?parseInt(e.slice(2),16):parseInt(e.slice(1),10),isNaN(t)||!$t(t)?(this.fail(`invalid character entity`),`&`+e+`;`):String.fromCodePoint(t)}skipSpaces(){for(;;){let e=this.getCode();if(e===-1||!Yt(e))return e}}openTag(){let e=this.tag;e.isSelfClosing=!1;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.tags.push(e),this.name=``,this.state=0}openSelfClosingTag(){let e=this.tag;e.isSelfClosing=!0;for(let{name:t,value:n}of this.attribList)e.attributes[t]=n;this.attribList=[],this.openTagHandler?.(e),this.closeTagHandler?.(e),this.tags.length===0&&(this.closedRoot=!0),this.name=``,this.state=0}closeTag(){let{tags:e,name:t}=this;if(this.state=0,this.name=``,t===``){this.fail(`empty close tag`),this.text+=`</>`;return}let n=!1;for(let r=e.length-1;r>=0;r--)if(e[r].name===t){for(;e.length>r;){let t=e.pop();this.closeTagHandler?.(t),e.length>r&&this.fail(`unclosed tag: `+t.name)}n=!0;break}n||(this.fail(`unmatched close tag: `+t),this.text+=`</`+t+`>`),e.length===0&&(this.closedRoot=!0)}end(){for(this.sawRoot||this.fail(`document must contain a root element`);this.tags.length>0;){let e=this.tags.pop();this.fail(`unclosed tag: `+e.name)}return this.text.length>0&&this.textHandler&&(this.textHandler(this.text),this.text=``),this._closed=!0,this._init(),this}};async function*nn(e){let t=new tn({xmlns:!1,position:!0}),n;t.on(`error`,e=>{n=e});let r=[];t.on(`opentag`,e=>r.push({eventType:`opentag`,value:e})),t.on(`text`,e=>r.push({eventType:`text`,value:e})),t.on(`closetag`,e=>r.push({eventType:`closetag`,value:e}));for await(let i of e){let e=Ye(i);if(t.write(e),n)throw n;yield r,r=[]}if(t.close(),n)throw n;r.length>0&&(yield r)}let rn=new Set([`ep`,`cp`,`dc`,`dcterms`,`dcmitype`,`vt`]);function an(e,t){for(let e in t)if(e.length>6&&e.startsWith(`xmlns:`)){let n=e.slice(6);if(t[e]===`http://schemas.openxmlformats.org/spreadsheetml/2006/main`)return n;if(rn.has(n))return null}let n=e.indexOf(`:`);return n!==-1&&rn.has(e.slice(0,n))?null:void 0}function on(e,t){let n=e.indexOf(`:`);if(n===-1)return e;let r=e.slice(0,n);return r===t||rn.has(r)?e.slice(n+1):e}var L=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=void 0,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){let t=!1,n,r=0,i=null;for await(let a of e)if(!t){for(let{eventType:e,value:o}of a)if(e===`opentag`){if(r===1){this.parseOpen(o);continue}if(r===0){let e=an(o.name,o.attributes);if(e===void 0){r=1,this.parseOpen(o);continue}r=2,i=e}o.name=on(o.name,i),this.parseOpen(o)}else if(e===`text`)this.parseText(o);else if(e===`closetag`){if(r===1){if(!this.parseClose(o.name)){t=!0,n=this.model;break}continue}if(!this.parseClose(on(o.name,i))){t=!0,n=this.model;break}}}return t?n:this.model}async parseStream(e){return this.parse(nn(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new F;return this.render(t,e),t.xml}static toAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e.toString()}static toStringAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toStringValue(e,t){return e===void 0?t:e}static toBoolAttribute(e,t,n=!1){if(e===void 0){if(n)return t}else if(n||e!==t)return e?`1`:`0`}static toBoolValue(e,t){return e===void 0?t:e===`1`}static toIntAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toIntValue(e,t){return e===void 0?t:parseInt(e,10)}static toFloatAttribute(t,n,r=!1){return e.toAttribute(t,n,r)}static toFloatValue(e,t){return e===void 0?t:parseFloat(e)}};function sn(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{sn(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var cn=class extends L{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new F;sn(e,this._model),this._xml=e.xml}e.writeXml(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},R=class extends L{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count??`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t?.length??0);let{childXform:n}=this;(t??[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=[],!0):this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw Error(`Max ${this.childXform.tag} count (${this.maxItems}) exceeded`);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},z=class extends L{constructor(e){super(),this.name=e??`color`}get tag(){return this.name}render(e,t){return t?(e.openNode(this.name),t.argb?e.addAttribute(`rgb`,t.argb):t.theme===void 0?t.indexed===void 0?e.addAttribute(`auto`,`1`):e.addAttribute(`indexed`,t.indexed):(e.addAttribute(`theme`,t.theme),t.tint!==void 0&&e.addAttribute(`tint`,t.tint)),e.closeNode(),!0):!1}parseOpen(e){return e.name===this.name?(e.attributes.rgb?this.model={argb:e.attributes.rgb}:e.attributes.theme?(this.model={theme:parseInt(e.attributes.theme,10)},e.attributes.tint&&(this.model.tint=parseFloat(e.attributes.tint))):e.attributes.indexed?this.model={indexed:parseInt(e.attributes.indexed,10)}:this.model=void 0,!0):!1}parseText(){}parseClose(){return!1}},ln=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr}render(e,t){t&&(e.openNode(this.tag),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.model=!0)}parseText(){}parseClose(){return!1}},un=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.zero=e.zero,this.text=[]}render(e,t){(t||this.zero)&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){return e.name===this.tag?(this.attr?this.model=parseInt(e.attributes[this.attr],10):this.text=[],!0):!1}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=parseInt(this.text.join(``)||`0`,10)),!1}},B=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[]}render(e,t){t!==void 0&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,t):e.writeText(t),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=e.attributes[this.attr]:this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this.text.join(``)),!1}},dn=class e extends L{static{this.Attributes={single:{},double:{val:`double`},singleAccounting:{val:`singleAccounting`},doubleAccounting:{val:`doubleAccounting`}}}constructor(e){super(),this.model=e}get tag(){return`u`}render(t,n){if(n||=this.model,n===!0)t.leafNode(`u`);else{let r=e.Attributes[n];r&&t.leafNode(`u`,r)}}parseOpen(e){e.name===`u`&&(this.model=e.attributes.val||!0)}parseText(){}parseClose(){return!1}},fn=class e extends L{constructor(t){super(),this.options=t||e.OPTIONS;let n=[{tag:`b`,prop:`bold`,xform:new ln({tag:`b`,attr:`val`})},{tag:`i`,prop:`italic`,xform:new ln({tag:`i`,attr:`val`})},{tag:`u`,prop:`underline`,xform:new dn},{tag:`strike`,prop:`strike`,xform:new ln({tag:`strike`,attr:`val`})},{tag:`condense`,prop:`condense`,xform:new ln({tag:`condense`,attr:`val`})},{tag:`extend`,prop:`extend`,xform:new ln({tag:`extend`,attr:`val`})},{tag:`outline`,prop:`outline`,xform:new ln({tag:`outline`,attr:`val`})},{tag:`shadow`,prop:`shadow`,xform:new ln({tag:`shadow`,attr:`val`})},{tag:`sz`,prop:`size`,xform:new un({tag:`sz`,attr:`val`})},{tag:`color`,prop:`color`,xform:new z},{tag:this.options.fontNameTag,prop:`name`,xform:new B({tag:this.options.fontNameTag,attr:`val`})},{tag:`family`,prop:`family`,xform:new un({tag:`family`,attr:`val`})},{tag:`scheme`,prop:`scheme`,xform:new B({tag:`scheme`,attr:`val`})},{tag:`charset`,prop:`charset`,xform:new un({tag:`charset`,attr:`val`})},{tag:`vertAlign`,prop:`vertAlign`,xform:new B({tag:`vertAlign`,attr:`val`})}];this.map=Object.fromEntries(n.map(e=>[e.tag,{prop:e.prop,xform:e.xform}])),this.renderOrder=n.map(e=>e.tag)}get tag(){return this.options.tagName}render(e,t){let{map:n,renderOrder:r}=this;e.openNode(this.options.tagName),r.forEach(r=>{n[r].xform.render(e,t[n[r].prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},pn=class extends L{constructor(){super(),this.map={color:new z}}get tag(){return`stop`}render(e,t){e.openNode(`stop`),e.addAttribute(`position`,t.position),this.map.color.render(e,t.color),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`stop`:return this.model={position:parseFloat(e.attributes.position)},!0;case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(){}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.color=this.parser.model,this.parser=void 0),!0):!1}},mn=class extends L{constructor(){super(),this.map={fgColor:new z(`fgColor`),bgColor:new z(`bgColor`)}}get name(){return`pattern`}get tag(){return`patternFill`}render(e,t){e.openNode(`patternFill`),e.addAttribute(`patternType`,t.pattern),t.fgColor&&this.map.fgColor.render(e,t.fgColor),t.bgColor&&this.map.bgColor.render(e,t.bgColor),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`patternFill`:return this.model={type:`pattern`,pattern:e.attributes.patternType},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser.model&&(this.model[e]=this.parser.model),this.parser=void 0),!0):!1}},hn=class extends L{constructor(){super(),this.map={stop:new pn}}get name(){return`gradient`}get tag(){return`gradientFill`}render(e,t){switch(e.openNode(`gradientFill`),t.gradient){case`angle`:e.addAttribute(`degree`,t.degree);break;case`path`:e.addAttribute(`type`,`path`),t.center.left&&(e.addAttribute(`left`,t.center.left),t.center.right===void 0&&e.addAttribute(`right`,t.center.left)),t.center.right&&e.addAttribute(`right`,t.center.right),t.center.top&&(e.addAttribute(`top`,t.center.top),t.center.bottom===void 0&&e.addAttribute(`bottom`,t.center.top)),t.center.bottom&&e.addAttribute(`bottom`,t.center.bottom);break;default:break}let n=this.map.stop;t.stops.forEach(t=>{n.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`gradientFill`:{let t=this.model={stops:[]};return e.attributes.degree?(t.gradient=`angle`,t.degree=parseInt(e.attributes.degree,10)):e.attributes.type===`path`&&(t.gradient=`path`,t.center={left:e.attributes.left?parseFloat(e.attributes.left):0,top:e.attributes.top?parseFloat(e.attributes.top):0},e.attributes.right!==e.attributes.left&&(t.center.right=e.attributes.right?parseFloat(e.attributes.right):0),e.attributes.bottom!==e.attributes.top&&(t.center.bottom=e.attributes.bottom?parseFloat(e.attributes.bottom):0)),!0}case`stop`:return this.parser=this.map.stop,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model.stops.push(this.parser.model),this.parser=void 0),!0):!1}},gn=class e extends L{constructor(){super(),this.map={patternFill:new mn,gradientFill:new hn}}get tag(){return`fill`}render(e,t){switch(e.addRollback(),e.openNode(`fill`),t.type){case`pattern`:this.map.patternFill.render(e,t);break;case`gradient`:this.map.gradientFill.render(e,t);break;default:e.rollback();return}e.closeNode(),e.commit()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`fill`:return this.model={},!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.model=this.parser.model,this.model.type=this.parser.name,this.parser=void 0),!0):!1}validStyle(t){return e.validPatternValues[t]}static{this.validPatternValues=[`none`,`solid`,`darkVertical`,`darkGray`,`mediumGray`,`lightGray`,`gray125`,`gray0625`,`darkHorizontal`,`darkVertical`,`darkDown`,`darkUp`,`darkGrid`,`darkTrellis`,`lightHorizontal`,`lightVertical`,`lightDown`,`lightUp`,`lightGrid`,`lightTrellis`,`lightGrid`].reduce((e,t)=>(e[t]=!0,e),{})}static{this.StopXform=pn}static{this.PatternFillXform=mn}static{this.GradientFillXform=hn}},_n=class e extends L{constructor(e){super(),this.name=e,this.map={color:new z}}get tag(){return this.name}render(e,t,n){let r=t&&t.color||n||this.defaultColor;e.openNode(this.name),t&&t.style&&(e.addAttribute(`style`,t.style),r&&this.map.color.render(e,r)),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.name:{let{style:t}=e.attributes;return t?this.model={style:t}:this.model=void 0,!0}case`color`:return this.parser=this.map.color,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(e===this.name&&this.map.color.model&&(this.model||={},this.model.color=this.map.color.model),!1)}validStyle(t){return e.validStyleValues[t]}static{this.validStyleValues=[`thin`,`dashed`,`dotted`,`dashDot`,`hair`,`dashDotDot`,`slantDashDot`,`mediumDashed`,`mediumDashDotDot`,`mediumDashDot`,`medium`,`double`,`thick`].reduce((e,t)=>(e[t]=!0,e),{})}},vn=class extends L{constructor(){super(),this.map={top:new _n(`top`),left:new _n(`left`),bottom:new _n(`bottom`),right:new _n(`right`),diagonal:new _n(`diagonal`)}}render(e,t){let{color:n}=t;e.openNode(`border`),t.diagonal&&t.diagonal.style&&(t.diagonal.up&&e.addAttribute(`diagonalUp`,`1`),t.diagonal.down&&e.addAttribute(`diagonalDown`,`1`));let r=(r,i)=>{let a=r;a&&!a.color&&t.color&&(a={...a,color:t.color}),i.render(e,a,n)};r(t.left,this.map.left),r(t.right,this.map.right),r(t.top,this.map.top),r(t.bottom,this.map.bottom),r(t.diagonal,this.map.diagonal),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`border`:return this.reset(),this.diagonalUp=j(e.attributes.diagonalUp),this.diagonalDown=j(e.attributes.diagonalDown),!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`border`){let e=this.model={},t=(t,n,r)=>{n&&(r&&Object.assign(n,r),e[t]=n)};t(`left`,this.map.left.model),t(`right`,this.map.right.model),t(`top`,this.map.top.model),t(`bottom`,this.map.bottom.model),t(`diagonal`,this.map.diagonal.model,{up:this.diagonalUp,down:this.diagonalDown})}return!1}};let yn={0:{f:`General`},1:{f:`0`},2:{f:`0.00`},3:{f:`#,##0`},4:{f:`#,##0.00`},9:{f:`0%`},10:{f:`0.00%`},11:{f:`0.00E+00`},12:{f:`# ?/?`},13:{f:`# ??/??`},14:{f:`mm-dd-yy`},15:{f:`d-mmm-yy`},16:{f:`d-mmm`},17:{f:`mmm-yy`},18:{f:`h:mm AM/PM`},19:{f:`h:mm:ss AM/PM`},20:{f:`h:mm`},21:{f:`h:mm:ss`},22:{f:`m/d/yy "h":mm`},27:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},28:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},29:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},30:{"zh-tw":`m/d/yy `,"zh-cn":`m-d-yy`,"ja-jp":`m/d/yy`,"ko-kr":`mm-dd-yy`},31:{"zh-tw":`yyyy"年"m"月"d"日"`,"zh-cn":`yyyy"年"m"月"d"日"`,"ja-jp":`yyyy"年"m"月"d"日"`,"ko-kr":`yyyy"년" mm"월" dd"일"`},32:{"zh-tw":`hh"時"mm"分"`,"zh-cn":`h"时"mm"分"`,"ja-jp":`h"時"mm"分"`,"ko-kr":`h"시" mm"분"`},33:{"zh-tw":`hh"時"mm"分"ss"秒"`,"zh-cn":`h"时"mm"分"ss"秒"`,"ja-jp":`h"時"mm"分"ss"秒"`,"ko-kr":`h"시" mm"분" ss"초"`},34:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},35:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},36:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},37:{f:`#,##0 ;(#,##0)`},38:{f:`#,##0 ;[Red](#,##0)`},39:{f:`#,##0.00 ;(#,##0.00)`},40:{f:`#,##0.00 ;[Red](#,##0.00)`},45:{f:`mm:ss`},46:{f:`[h]:mm:ss`},47:{f:`mmss.0`},48:{f:`##0.0E+0`},49:{f:`@`},50:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},51:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},52:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},53:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`m"月"d"日"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},54:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},55:{"zh-tw":`上午/下午 hh"時"mm"分"`,"zh-cn":`上午/下午 h"时"mm"分"`,"ja-jp":`yyyy"年"m"月"`,"ko-kr":`yyyy-mm-dd`},56:{"zh-tw":`上午/下午 hh"時"mm"分"ss"秒"`,"zh-cn":`上午/下午 h"时"mm"分"ss"秒"`,"ja-jp":`m"月"d"日"`,"ko-kr":`yyyy-mm-dd`},57:{"zh-tw":`[$-404]e/m/d`,"zh-cn":`yyyy"年"m"月"`,"ja-jp":`[$-411]ge.m.d`,"ko-kr":`yyyy"年" mm"月" dd"日"`},58:{"zh-tw":`[$-404]e"年"m"月"d"日"`,"zh-cn":`m"月"d"日"`,"ja-jp":`[$-411]ggge"年"m"月"d"日"`,"ko-kr":`mm-dd`},59:{"th-th":`t0`},60:{"th-th":`t0.00`},61:{"th-th":`t#,##0`},62:{"th-th":`t#,##0.00`},67:{"th-th":`t0%`},68:{"th-th":`t0.00%`},69:{"th-th":`t# ?/?`},70:{"th-th":`t# ??/??`},81:{"th-th":`d/m/bb`}};function bn(){let e={};return Object.entries(yn).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let xn=bn();var Sn=class extends L{constructor(e,t){super(),this.id=e,this.formatCode=t}get tag(){return`numFmt`}render(e,t){e.leafNode(`numFmt`,{numFmtId:t.id,formatCode:t.formatCode})}parseOpen(e){switch(e.name){case`numFmt`:return this.model={id:parseInt(e.attributes.numFmtId,10),formatCode:e.attributes.formatCode.replace(/[\\](.)/g,`$1`)},!0;default:return!1}}parseText(){}parseClose(){return!1}static getDefaultFmtId(e){return xn[e]}static getDefaultFmtCode(e){return yn[e]&&yn[e].f}};let Cn={ReadingOrder:{LeftToRight:1,RightToLeft:2}},wn={horizontalValues:[`left`,`center`,`right`,`fill`,`centerContinuous`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),horizontal(e){return this.horizontalValues[e]?e:void 0},verticalValues:[`top`,`middle`,`bottom`,`distributed`,`justify`].reduce((e,t)=>(e[t]=!0,e),{}),vertical(e){return e===`middle`?`center`:this.verticalValues[e]?e:void 0},wrapText(e){return e?!0:void 0},shrinkToFit(e){return e?!0:void 0},textRotation(e){switch(e){case`vertical`:return e;default:{let t=ze(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=ze(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Cn.ReadingOrder.LeftToRight;case`rtl`:return Cn.ReadingOrder.RightToLeft;default:return}}},Tn={toXml(e){let t=wn.textRotation(e);if(t){if(t===`vertical`)return 255;let e=Math.round(t);if(e>=0&&e<=90)return e;if(e<0&&e>=-90)return 90-e}},toModel(e){let t=ze(e);if(t!==void 0){if(t===255)return`vertical`;if(t>=0&&t<=90)return t;if(t>90&&t<=180)return 90-t}}};var En=class extends L{get tag(){return`alignment`}render(e,t){e.addRollback(),e.openNode(`alignment`);let n=!1;function r(t,r){r&&(e.addAttribute(t,r),n=!0)}r(`horizontal`,wn.horizontal(t.horizontal)),r(`vertical`,wn.vertical(t.vertical)),r(`wrapText`,wn.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,wn.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,wn.indent(t.indent)),r(`textRotation`,Tn.toXml(t.textRotation)),r(`readingOrder`,wn.readingOrder(t.readingOrder)),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={},n=!1;function r(e,r,i){e&&(t[r]=i,n=!0)}r(e.attributes.horizontal,`horizontal`,e.attributes.horizontal),r(e.attributes.vertical,`vertical`,e.attributes.vertical===`center`?`middle`:e.attributes.vertical),r(e.attributes.wrapText,`wrapText`,j(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,j(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,Tn.toModel(e.attributes.textRotation)),r(e.attributes.readingOrder,`readingOrder`,e.attributes.readingOrder===`2`?`rtl`:`ltr`),this.model=n?t:null}parseText(){}parseClose(){return!1}};let Dn={boolean(e,t){return e===void 0?t:e}};var On=class extends L{get tag(){return`protection`}render(e,t){e.addRollback(),e.openNode(`protection`);let n=!1;function r(t,r){r!==void 0&&(e.addAttribute(t,r),n=!0)}r(`locked`,Dn.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,Dn.boolean(t.hidden,!1)?`1`:void 0),e.closeNode(),n?e.commit():e.rollback()}parseOpen(e){let t={locked:e.attributes.locked!==`0`,hidden:e.attributes.hidden===`1`};this.model=!t.locked||t.hidden?t:null}parseText(){}parseClose(){return!1}},kn=class extends L{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new En,protection:new On}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId??0,fontId:t.fontId??0,fillId:t.fillId??0,borderId:t.borderId??0}),this.xfId&&e.addAttribute(`xfId`,t.xfId??0),(t.applyNumberFormat||t.numFmtId)&&e.addAttribute(`applyNumberFormat`,`1`),(t.applyFont||t.fontId)&&e.addAttribute(`applyFont`,`1`),(t.applyFill||t.fillId)&&e.addAttribute(`applyFill`,`1`),(t.applyBorder||t.borderId)&&e.addAttribute(`applyBorder`,`1`),(t.applyAlignment||t.alignment)&&e.addAttribute(`applyAlignment`,`1`),(t.applyProtection||t.protection)&&e.addAttribute(`applyProtection`,`1`),t.pivotButton&&e.addAttribute(`pivotButton`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),t.checkbox&&t.xfComplementIndex!==void 0&&(e.openNode(`extLst`),e.openNode(`ext`,{"xmlns:xfpb":`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`,uri:`{C7286773-470A-42A8-94C5-96B5CB345126}`}),e.leafNode(`xfpb:xfComplement`,{i:t.xfComplementIndex}),e.closeNode(),e.closeNode()),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),e.attributes.pivotButton===`1`&&(this.model.pivotButton=!0);for(let t of[`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e.attributes[t]===`1`&&(this.model[t]=!0);return!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},An=class extends L{constructor(){super(),this.map={alignment:new En,border:new vn,fill:new gn,font:new fn,numFmt:new Sn,protection:new On}}get tag(){return`dxf`}render(e,t){if(e.openNode(this.tag),t.font&&this.map.font.render(e,t.font),t.numFmt&&t.numFmtId){let n={id:t.numFmtId,formatCode:t.numFmt};this.map.numFmt.render(e,n)}t.fill&&this.map.fill.render(e,t.fill),t.alignment&&this.map.alignment.render(e,t.alignment),t.border&&this.map.border.render(e,t.border),t.protection&&this.map.protection.render(e,t.protection),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.reset(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):e===this.tag?(this.model={alignment:this.map.alignment.model,border:this.map.border.model,fill:this.map.fill.model,font:this.map.font.model,numFmt:this.map.numFmt.model,protection:this.map.protection.model},!1):!0}},jn=class e extends L{constructor(t){super(),this.map={numFmts:new R({tag:`numFmts`,count:!0,childXform:new Sn}),fonts:new R({tag:`fonts`,count:!0,childXform:new fn,$:{"x14ac:knownFonts":1}}),fills:new R({tag:`fills`,count:!0,childXform:new gn}),borders:new R({tag:`borders`,count:!0,childXform:new vn}),cellStyleXfs:new R({tag:`cellStyleXfs`,count:!0,childXform:new kn}),cellXfs:new R({tag:`cellXfs`,count:!0,childXform:new kn({xfId:!0})}),dxfs:new R({tag:`dxfs`,always:!0,count:!0,childXform:new An}),numFmt:new Sn,font:new fn,fill:new gn,border:new vn,style:new kn({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap,this._hasCheckboxes=!1}setDefaultFont(e){this.defaultFont=e}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(`styleSheet`,e.STYLESHEET_ATTRIBUTES),this.index?(r.numFmts&&r.numFmts.length&&(t.openNode(`numFmts`,{count:r.numFmts.length}),r.numFmts.forEach(e=>{t.writeXml(e)}),t.closeNode()),r.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeXml(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeXml(e)}),t.closeNode(),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),t.openNode(`cellXfs`,{count:r.styles.length}),r.styles.forEach(e=>{t.writeXml(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.map.fonts.model&&this.map.fonts.model.length>0&&(this.defaultFont=this.map.fonts.model[0]),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;this.model.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`});let n=t||u.ValueType.Number;if(n!==u.ValueType.Checkbox&&this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let r={};if(e.numFmt)r.numFmtId=this._addNumFmtStr(e.numFmt);else switch(n){case u.ValueType.Number:r.numFmtId=this._addNumFmtStr(`General`);break;case u.ValueType.Date:r.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(r.fontId=this._addFont(e.font)),e.border&&(r.borderId=this._addBorder(e.border)),e.fill&&(r.fillId=this._addFill(e.fill)),e.alignment&&(r.alignment=e.alignment),e.protection&&(r.protection=e.protection);for(let t of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e[t]&&(r[t]=!0);n===u.ValueType.Checkbox&&(this._hasCheckboxes=!0,r.alignment=r.alignment||{},r.checkbox=!0,r.xfComplementIndex=0);let i=this._addStyle(r);return n!==u.ValueType.Checkbox&&this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||Sn.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection);for(let e of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])t[e]&&(n[e]=!0);return n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}get hasCheckboxes(){return!!this._hasCheckboxes}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=Sn.getDefaultFmtId(e);if(t!==void 0||(t=this.index.numFmt[e],t!==void 0))return t;t=this.index.numFmt[e]=164+this.model.numFmts.length;let n=this.map.numFmt.toXml({id:t,formatCode:e});return this.model.numFmts.push(n),t}_addFont(e){let t=this.map.font.toXml(e),n=this.index.font[t];return n===void 0&&(n=this.index.font[t]=this.model.fonts.length,this.model.fonts.push(t)),n}_addBorder(e){let t=this.map.border.toXml(e),n=this.index.border[t];return n===void 0&&(n=this.index.border[t]=this.model.borders.length,this.model.borders.push(t)),n}_addFill(e){let t=this.map.fill.toXml(e),n=this.index.fill[t];return n===void 0&&(n=this.index.fill[t]=this.model.fills.length,this.model.fills.push(t)),n}static{this.STYLESHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x14ac x16r2`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"xmlns:x16r2":`http://schemas.microsoft.com/office/spreadsheetml/2015/02/main`}}static{this.STATIC_XFORMS={cellStyles:new cn({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new cn({tag:`dxfs`,$:{count:0}}),tableStyles:new cn({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new cn({tag:`extLst`,c:[{tag:`ext`,$:{uri:`{EB79DEF2-80B8-43e5-95BD-54CBDDF9020C}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`},c:[{tag:`x14:slicerStyles`,$:{defaultSlicerStyle:`SlicerStyleLight1`}}]},{tag:`ext`,$:{uri:`{9260A510-F301-46a8-8635-F512D64BE5F5}`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`},c:[{tag:`x15:timelineStyles`,$:{defaultTimelineStyle:`TimeSlicerStyleLight1`}}]}]})}}};jn.Mock=class extends jn{constructor(){super(),this.model={styles:[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}],numFmts:[],fonts:[{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}],borders:[{}],fills:[{type:`pattern`,pattern:`none`},{type:`pattern`,pattern:`gray125`}]}}parseStream(e){return e.autodrain(),Promise.resolve()}addStyleModel(e,t){switch(t){case u.ValueType.Checkbox:throw Error(`Checkbox cells require styles to be enabled (useStyles: true)`);case u.ValueType.Date:return this.dateStyleId;default:return 0}}get hasCheckboxes(){return!1}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:Sn.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var Mn=class extends L{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}};let V={creator:`dc:creator`,title:`dc:title`,subject:`dc:subject`,description:`dc:description`,identifier:`dc:identifier`,language:`dc:language`,keywords:`cp:keywords`,category:`cp:category`,lastModifiedBy:`cp:lastModifiedBy`,lastPrinted:`cp:lastPrinted`,revision:`cp:revision`,version:`cp:version`,contentStatus:`cp:contentStatus`,contentType:`cp:contentType`,created:`dcterms:created`,modified:`dcterms:modified`};var Nn=class e extends L{constructor(){super(),this.map={creator:new B({tag:V.creator}),title:new B({tag:V.title}),subject:new B({tag:V.subject}),description:new B({tag:V.description}),identifier:new B({tag:V.identifier}),language:new B({tag:V.language}),keywords:new B({tag:V.keywords}),category:new B({tag:V.category}),lastModifiedBy:new B({tag:V.lastModifiedBy}),lastPrinted:new Mn({tag:V.lastPrinted,format:e.DateFormat}),revision:new un({tag:V.revision}),version:new B({tag:V.version}),contentStatus:new B({tag:V.contentStatus}),contentType:new B({tag:V.contentType}),created:new Mn({tag:V.created,attrs:e.DateAttrs,format:e.DateFormat}),modified:new Mn({tag:V.modified,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES);for(let e of Object.keys(V))this.map[e].render(t,n[e]);t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):(e.name!==`coreProperties`&&(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`coreProperties`){this.model={};for(let e of Object.keys(V)){let t=this.map[e].model;t!==void 0&&t!==``&&(this.model[e]=t)}return!1}return!0}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},Pn=class extends L{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(t),e.closeNode()}parseOpen(e){return e.name===`t`?(this._text=[],this.model=``,!0):!1}parseText(e){this._text.push(e),this.model=this._text.join(``).replace(/_x([0-9A-F]{4})_/g,(e,t)=>String.fromCharCode(parseInt(t,16)))}parseClose(){return!1}},Fn=class e extends L{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new Pn}get fontXform(){return this._fontXform||=new fn(e.FONT_OPTIONS)}render(e,t){let n=t||this.model;e.openNode(`r`),n.font&&this.fontXform.render(e,n.font),this.textXform.render(e,n.text),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`r`:return this.model={},!0;case`t`:return this.parser=this.textXform,this.parser.parseOpen(e),!0;case`rPr`:return this.parser=this.fontXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`r`:return!1;case`t`:return this.model.text=this.parser.model,this.parser=void 0,!0;case`rPr`:return this.model.font=this.parser.model,this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.FONT_OPTIONS={tagName:`rPr`,fontNameTag:`rFont`}}},In=class extends L{constructor(){super(),this.map={r:new Fn,t:new Pn}}get tag(){return`rPh`}render(e,t){if(e.openNode(this.tag,{sb:t.sb??0,eb:t.eb??0}),t&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText){let{r:n}=this.map;t.richText.forEach(t=>{n.render(e,t)})}else t&&this.map.t.render(e,t.text);e.closeNode()}parseOpen(e){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={sb:parseInt(e.attributes.sb,10),eb:parseInt(e.attributes.eb,10)},!0):(this.parser=this.map[t],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model.text=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Ln=class extends L{constructor(e){super(),this.model=e,this.map={r:new Fn,t:new Pn,rPh:new In}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model={},!0):(this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Rn=class extends L{constructor(e){super(),this.model=e||{values:[],count:0},this.hash=Object.create(null),this.rich=Object.create(null)}get sharedStringXform(){return this._sharedStringXform||=new Ln}get values(){return this.model.values}get uniqueCount(){return this.model.values.length}get count(){return this.model.count}getString(e){return this.model.values[e]}add(e){return e.richText?this.addRichText(e):this.addText(e)}addText(e){let t=this.hash[e];return t===void 0&&(t=this.hash[e]=this.model.values.length,this.model.values.push(e)),this.model.count++,t}addRichText(e){let t=this.sharedStringXform.toXml(e),n=this.rich[t];return n===void 0&&(n=this.rich[t]=this.model.values.length,this.model.values.push(e)),this.model.count++,n}render(e,t){let n=t||this._values;e.openXml(F.StdDocAttributes),e.openNode(`sst`,{xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,count:n.count,uniqueCount:n.values.length});let r=this.sharedStringXform;n.values.forEach(t=>{r.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`sst`:return!0;case`si`:return this.parser=this.sharedStringXform,this.parser.parseOpen(e),!0;default:throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.values.push(this.parser.model),this.model.count++,this.parser=void 0),!0;switch(e){case`sst`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},zn=class extends L{render(e,t){e.leafNode(`Relationship`,t)}parseOpen(e){switch(e.name){case`Relationship`:return this.model=e.attributes,!0;default:return!1}}parseText(){}parseClose(){return!1}},H=class e extends L{constructor(){super(),this.map={Relationship:new zn}}render(t,n){let r=n||this._values;t.openXml(F.StdDocAttributes),t.openNode(`Relationships`,e.RELATIONSHIPS_ATTRIBUTES),r.forEach(e=>{this.map.Relationship.render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Relationships`:return this.model=[],!0;default:if(this.parser=this.map[e.name],this.parser)return this.parser.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.push(this.parser.model),this.parser=void 0),!0;switch(e){case`Relationships`:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}};let U={contentTypes:`[Content_Types].xml`,rootRels:`_rels/.rels`,docPropsApp:`docProps/app.xml`,docPropsCore:`docProps/core.xml`,xlWorkbook:`xl/workbook.xml`,xlWorkbookRels:`xl/_rels/workbook.xml.rels`,xlSharedStrings:`xl/sharedStrings.xml`,xlStyles:`xl/styles.xml`,xlTheme1:`xl/theme/theme1.xml`,xlFeaturePropertyBag:`xl/featurePropertyBag/featurePropertyBag.xml`},Bn=/^xl\/worksheets\/sheet(\d+)[.]xml$/,Vn=/^xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels$/,Hn=/^xl\/theme\/[a-zA-Z0-9]+[.]xml$/,Un=/^xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/,Wn=/^xl\/drawings\/(drawing\d+)[.]xml$/,Gn=/^xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels$/,Kn=/^xl\/drawings\/(vmlDrawing\d+)[.]vml$/,qn=/^xl\/comments(\d+)[.]xml$/,Jn=/^xl\/tables\/(table\d+)[.]xml$/,Yn=/^xl\/pivotTables\/(pivotTable\d+)[.]xml$/,Xn=/^xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels$/,Zn=/^xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml$/,Qn=/^xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels$/,$n=/^xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml$/;function er(e){return e.startsWith(`/`)?e.slice(1):e}function tr(e){let t=Bn.exec(e);if(t)return parseInt(t[1],10)}function nr(e){let t=Vn.exec(e);if(t)return parseInt(t[1],10)}function rr(e){return e.startsWith(`xl/media/`)}function ir(e){let t=Un.exec(e);return t?t[1]:void 0}function ar(e){return Hn.test(e)}function or(e){let t=/^xl\/theme\/([a-zA-Z0-9]+)[.]xml$/.exec(e);return t?t[1]:void 0}function sr(e){return rr(e)||ar(e)}function cr(e){let t=Wn.exec(e);return t?t[1]:void 0}function lr(e){let t=Gn.exec(e);return t?t[1]:void 0}function ur(e){let t=Kn.exec(e);return t?t[1]:void 0}function dr(e){let t=qn.exec(e);return t?t[1]:void 0}function fr(e){let t=Jn.exec(e);return t?t[1]:void 0}function pr(e){let t=Yn.exec(e);return t?t[1]:void 0}function mr(e){let t=Xn.exec(e);return t?t[1]:void 0}function hr(e){let t=Zn.exec(e);return t?t[1]:void 0}function gr(e){let t=Qn.exec(e);return t?t[1]:void 0}function _r(e){let t=$n.exec(e);return t?t[1]:void 0}function W(e){return e.startsWith(`/`)?e:`/${e}`}function vr(e){return`xl/theme/${e}.xml`}function yr(e){return`xl/media/${e}`}function br(e){return`xl/worksheets/sheet${e}.xml`}function xr(e){return`xl/worksheets/_rels/sheet${e}.xml.rels`}function Sr(e){return`worksheets/sheet${e}.xml`}function Cr(e){return`xl/comments${e}.xml`}function wr(e){return`xl/${e}.xml`}function Tr(e){return`xl/drawings/vmlDrawing${e}.vml`}function Er(e){return`xl/tables/${e}`}function Dr(e){return`xl/drawings/${e}.xml`}function Or(e){return`xl/drawings/_rels/${e}.xml.rels`}function kr(e){return`xl/pivotCache/pivotCacheDefinition${e}.xml`}function Ar(e){return`xl/pivotCache/_rels/pivotCacheDefinition${e}.xml.rels`}function jr(e){return`xl/pivotCache/pivotCacheRecords${e}.xml`}function Mr(e){return`pivotCacheRecords${e}.xml`}function Nr(e){return`xl/pivotTables/pivotTable${e}.xml`}function Pr(e){return`xl/pivotTables/_rels/pivotTable${e}.xml.rels`}function Fr(e){return`../pivotCache/pivotCacheDefinition${e}.xml`}let Ir={workbookStyles:`styles.xml`,workbookSharedStrings:`sharedStrings.xml`,workbookTheme1:`theme/theme1.xml`,workbookFeaturePropertyBag:`featurePropertyBag/featurePropertyBag.xml`};function Lr(e){return`pivotCache/pivotCacheDefinition${e}.xml`}function Rr(e){return`../comments${e}.xml`}function zr(e){return`../drawings/vmlDrawing${e}.vml`}function Br(e){return`../drawings/${e}.xml`}function Vr(e){return`../drawings/${e}.vml`}function Hr(e){return`../${e}.xml`}function Ur(e){return`../pivotTables/pivotTable${e}.xml`}function Wr(e){return`../pivotTables/${e}.xml`}function Gr(e){return`../tables/${e}`}function Kr(e){return`../tables/${e}.xml`}function qr(e){return`../media/${e}`}function Jr(e){return`xl/ctrlProps/ctrlProp${e}.xml`}function Yr(e){return`../ctrlProps/ctrlProp${e}.xml`}var Xr=class e extends L{render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};if((n.media??[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:W(U.xlWorkbook),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{t.leafNode(`Override`,{PartName:W(br(e.fileIndex)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables??[]).length){let e=new Set;(n.pivotTables??[]).forEach(n=>{let r=n.tableNumber,i=n.cacheId;e.has(i)||(e.add(i),t.leafNode(`Override`,{PartName:W(kr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),(!n.isLoaded||n.cacheRecords)&&t.leafNode(`Override`,{PartName:W(jr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`})),t.leafNode(`Override`,{PartName:W(Nr(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})})}t.leafNode(`Override`,{PartName:W(U.xlTheme1),ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:W(U.xlStyles),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.hasCheckboxes&&t.leafNode(`Override`,{PartName:W(U.xlFeaturePropertyBag),ContentType:`application/vnd.ms-excel.featurepropertybag+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:W(U.xlSharedStrings),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:W(Er(e.target)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:W(Dr(e.name)),ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})});let i=n.commentRefs&&n.commentRefs.length>0,a=n.formControlRefs&&n.formControlRefs.length>0;if((i||a)&&t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),i&&n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:W(wr(e)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})}),a)for(let e of n.formControlRefs)t.leafNode(`Override`,{PartName:W(Jr(e)),ContentType:`application/vnd.ms-excel.controlproperties+xml`});if(n.passthroughContentTypes)for(let{partName:e,contentType:r}of n.passthroughContentTypes)t.leafNode(`Override`,{PartName:W(e),ContentType:r});t.leafNode(`Override`,{PartName:W(U.docPropsCore),ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:W(U.docPropsApp),ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},Zr=class extends L{render(e,t){e.openNode(`HeadingPairs`),e.openNode(`vt:vector`,{size:2,baseType:`variant`}),e.openNode(`vt:variant`),e.leafNode(`vt:lpstr`,void 0,`Worksheets`),e.closeNode(),e.openNode(`vt:variant`),e.leafNode(`vt:i4`,void 0,t.length),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`HeadingPairs`}parseText(){}parseClose(e){return e!==`HeadingPairs`}},Qr=class extends L{render(e,t){e.openNode(`TitlesOfParts`),e.openNode(`vt:vector`,{size:t.length,baseType:`lpstr`}),t.forEach(t=>{e.leafNode(`vt:lpstr`,void 0,t.name)}),e.closeNode(),e.closeNode()}parseOpen(e){return e.name===`TitlesOfParts`}parseText(){}parseClose(e){return e!==`TitlesOfParts`}},$r=class e extends L{constructor(){super(),this.map={Company:new B({tag:`Company`}),Manager:new B({tag:`Manager`}),HeadingPairs:new Zr,TitlesOfParts:new Qr}}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitlesOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company??``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitlesOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},ei=class extends L{constructor(){super(),this._parsedText=[]}render(e,t){e.openNode(`definedName`,{name:t.name,localSheetId:t.localSheetId}),e.writeText(t.ranges.join(`,`)),e.closeNode()}parseOpen(e){switch(e.name){case`definedName`:return this._parsedName=e.attributes.name,this._parsedLocalSheetId=e.attributes.localSheetId,this._parsedText=[],!0;default:return!1}}parseText(e){this._parsedText.push(e)}parseClose(){return this.model={name:this._parsedName,ranges:ai(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};let ti=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,ni=/^[$]?\d+:[$]?\d+$/,ri=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function ii(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let t=e.split(`!`).pop()??``;if(!ti.test(t)&&!ni.test(t)&&!ri.test(t))return!1;try{let t=n.decodeEx(e);return`row`in t&&typeof t.row==`number`||`top`in t&&typeof t.top==`number`||`left`in t&&typeof t.left==`number`}catch{return!1}}function ai(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)??[]).length;if(!t){r?i+=`${e},`:ii(e)&&n.push(e);return}let a=t%2==0;!r&&a&&ii(e)?n.push(e):r&&!a?(r=!1,ii(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}var oi=class extends L{render(e,t){e.leafNode(`sheet`,{name:t.name,sheetId:t.id,state:t.state===`visible`?void 0:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:Le(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},si=class extends L{render(e,t){let n={xWindow:t.x??0,yWindow:t.y??0,windowWidth:t.width??12e3,windowHeight:t.height??24e3,firstSheet:t.firstSheet,activeTab:t.activeTab};t.visibility&&t.visibility!==`visible`&&(n.visibility=t.visibility),e.leafNode(`workbookView`,n)}parseOpen(e){if(e.name===`workbookView`){let t=this.model={},n=function(e,n,r){t[e]=n===void 0?r:n},r=function(e,n,r){let i=n===void 0?r:parseInt(n,10);i!==void 0&&(t[e]=i)};return r(`x`,e.attributes.xWindow,0),r(`y`,e.attributes.yWindow,0),r(`width`,e.attributes.windowWidth,25e3),r(`height`,e.attributes.windowHeight,1e4),n(`visibility`,e.attributes.visibility,`visible`),r(`activeTab`,e.attributes.activeTab,void 0),r(`firstSheet`,e.attributes.firstSheet,void 0),!0}return!1}parseText(){}parseClose(){return!1}},ci=class extends L{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},li=class extends L{render(e,t){e.leafNode(`calcPr`,{calcId:171027,fullCalcOnLoad:t.fullCalcOnLoad?1:void 0})}parseOpen(e){return e.name===`calcPr`?(this.model={},!0):!1}parseText(){}parseClose(){return!1}},ui=class extends L{render(e,t){e.leafNode(`pivotCache`,{cacheId:t.cacheId,"r:id":t.rId})}parseOpen(e){return e.name===`pivotCache`?(this.model={cacheId:e.attributes.cacheId,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},di=class e extends L{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new ci,bookViews:new R({tag:`bookViews`,count:!1,childXform:new si}),sheets:new R({tag:`sheets`,count:!1,childXform:new oi}),definedNames:new R({tag:`definedNames`,count:!1,childXform:new ei}),calcPr:new li,pivotCaches:new R({tag:`pivotCaches`,count:!1,childXform:new ui})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a=i[0],o=i[1]??a,s={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${a}:$${o}`],localSheetId:n};t.push(s)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media??[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties);let r=n.pivotTables??[],i=new Set,a=r.filter(e=>i.has(e.cacheId)?!1:(i.add(e.cacheId),!0));this.map.pivotCaches.render(t,a),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let t=(e.workbookRels??[]).reduce((e,t)=>(e[t.Id]=t,e),{}),r=[],i,a=0;(e.sheets??[]).forEach(n=>{let o=t[n.rId];o&&(i=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],i&&(i.name=n.name,i.id=n.id,i.state=n.state,r[a++]=i))});let o=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(i=r[e.localSheetId],i&&e.ranges?.length>0){i.pageSetup||={};let t=n.decodeEx(e.ranges[0]);i.pageSetup.printArea=i.pageSetup.printArea?`${i.pageSetup.printArea}&&${t.dimensions}`:t.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(i=r[e.localSheetId],i&&e.ranges?.length>0){i.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,r=t.match(/\$\d+:\$\d+/);if(r&&r.length){let e=r[0];i.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];i.pageSetup.printTitlesColumn=e.replace(n,``)}}}else o.push(e)}),e.definedNames=o,e.media.forEach((e,t)=>{e.index=t})}static{this.WORKBOOK_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`x15`,"xmlns:x15":`http://schemas.microsoft.com/office/spreadsheetml/2010/11/main`}}static{this.STATIC_XFORMS={fileVersion:new cn({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let G={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`,FeaturePropertyBag:`http://schemas.microsoft.com/office/2022/11/relationships/FeaturePropertyBag`,CtrlProp:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp`};var fi=class{constructor(){this.merges={}}add(e){if(this.merges[e.master])this.merges[e.master].expandToAddress(e.address);else{let t=`${e.master}:${e.address}`;this.merges[e.master]=new r(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let r=n.decode(e);for(let e=r.top;e<=r.bottom;e++){let i=t[e-1];for(let t=r.left;t<=r.right;t++){let a=i.cells[t-1];a?a.type===u.ValueType.Merge&&(a.master=r.tl):i.cells[t]={type:u.ValueType.Null,address:n.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function pi(e){if(e==null)return u.ValueType.Null;if(e instanceof String||typeof e==`string`)return u.ValueType.String;if(typeof e==`number`)return u.ValueType.Number;if(typeof e==`boolean`)return u.ValueType.Boolean;if(e instanceof Date)return u.ValueType.Date;if(e.text&&e.hyperlink)return u.ValueType.Hyperlink;if(e.formula)return u.ValueType.Formula;if(e.error)return u.ValueType.Error;throw Error(`I could not understand type of value`)}function mi(e){switch(e.type){case u.ValueType.Formula:return pi(e.result);default:return e.type}}var hi=class extends L{constructor(){super(),this.richTextXform=new Fn}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},mi(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case u.ValueType.String:case u.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case u.ValueType.Date:t.date1904&&(e.date1904=!0);break;case u.ValueType.Hyperlink:t.sharedStrings&&e.text!==void 0&&e.text!==null&&(e.ssId=t.sharedStrings.add(e.text)),t.hyperlinks.push({address:e.address,target:e.hyperlink,tooltip:e.tooltip});break;case u.ValueType.Merge:t.merges.add(e);break;case u.ValueType.Formula:if(t.date1904&&(e.date1904=!0),e.shareType===`shared`&&(e.si=t.siFormulae++),e.formula)t.formulae[e.address]=e;else if(e.sharedFormula){let n=t.formulae[e.sharedFormula];if(!n)throw Error(`Shared Formula master must exist above and or left of clone for cell ${e.address}`);n.si===void 0?(n.shareType=`shared`,n.si=t.siFormulae++,n.range=new r(n.address,e.address)):n.range&&n.range.expandToAddress(e.address),e.si=n.si}break;default:break}}renderFormula(e,t){let n=null;switch(t.shareType){case`shared`:n={t:`shared`,ref:t.ref||t.range.range,si:t.si};break;case`array`:n={t:`array`,ref:t.ref};break;default:t.si!==void 0&&(n={t:`shared`,si:t.si});break}switch(pi(t.result)){case u.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case u.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case u.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case u.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case u.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case u.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,Ne(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===u.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case u.ValueType.Null:break;case u.ValueType.Number:e.leafNode(`v`,null,t.value);break;case u.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case u.ValueType.Checkbox:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case u.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case u.ValueType.String:case u.ValueType.RichText:t.ssId===void 0?t.value&&t.value.richText?(e.addAttribute(`t`,`inlineStr`),e.openNode(`is`),t.value.richText.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(`is`)):(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.value)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case u.ValueType.Date:e.leafNode(`v`,null,Ne(t.value,t.date1904));break;case u.ValueType.Hyperlink:t.ssId===void 0?(e.addAttribute(`t`,`str`),e.leafNode(`v`,null,t.text)):(e.addAttribute(`t`,`s`),e.leafNode(`v`,null,t.ssId));break;case u.ValueType.Formula:this.renderFormula(e,t);break;case u.ValueType.Merge:break;default:break}e.closeNode()}}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`c`:return this.model={address:e.attributes.r},this.t=e.attributes.t,e.attributes.s&&(this.model.styleId=parseInt(e.attributes.s,10)),!0;case`f`:return this.currentNode=`f`,this.model.si=e.attributes.si,this.model.shareType=e.attributes.t,this.model.ref=e.attributes.ref,!0;case`v`:return this.currentNode=`v`,!0;case`t`:return this.currentNode=`t`,!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){if(this.parser){this.parser.parseText(e);return}switch(this.currentNode){case`f`:this.model.formula=this.model.formula?this.model.formula+e:e;break;case`v`:case`t`:this.model.value&&this.model.value.richText?this.model.value.richText.text=this.model.value.richText.text?this.model.value.richText.text+e:e:this.model.value=this.model.value?this.model.value+e:e;break;default:break}}parseClose(e){switch(e){case`c`:{let{model:e}=this;if(e.formula||e.shareType)e.type=u.ValueType.Formula,e.value&&=(this.t===`str`?e.result=Le(e.value):this.t===`b`?e.result=parseInt(e.value,10)!==0:this.t===`e`?e.result={error:e.value}:e.result=parseFloat(e.value),void 0);else if(e.value!==void 0)switch(this.t){case`s`:e.type=u.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=u.ValueType.String,e.value=Le(e.value);break;case`inlineStr`:e.type=u.ValueType.String;break;case`b`:e.type=u.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=u.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=u.ValueType.Date,e.value=new Date(e.value);break;default:e.type=u.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=u.ValueType.Null:e.type=u.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText??[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId!==void 0&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case u.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=u.ValueType.RichText);break;case u.ValueType.Number:n&&Ue(n.numFmt)&&(e.type=u.ValueType.Date,e.value=Pe(e.value,t.date1904));break;case u.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&Ue(n.numFmt)&&(e.result=Pe(e.result,t.date1904)),e.shareType===`shared`&&(e.ref?t.formulae[e.si]=e.address:(e.sharedFormula=t.formulae[e.si],delete e.shareType),delete e.si);break;default:break}let r=t.hyperlinkMap[e.address];r&&(e.type===u.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=u.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},gi=class extends L{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new hi}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height!=null&&t.height>0?(e.addAttribute(`ht`,t.height),t.customHeight!==!1&&e.addAttribute(`customHeight`,`1`)):t.height===0&&e.addAttribute(`ht`,1),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),t.dyDescent!==void 0&&e.addAttribute(`x14ac:dyDescent`,t.dyDescent),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),j(e.attributes.hidden)&&(n.hidden=!0),j(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),j(e.attributes.customHeight)&&(n.customHeight=!0),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),j(e.attributes.collapsed)&&(n.collapsed=!0),e.attributes[`x14ac:dyDescent`]!==void 0&&(n.dyDescent=parseFloat(e.attributes[`x14ac:dyDescent`])),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=n.decodeAddress(e.address).col:(this.lastCellCol+=1,e.address=n.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw Error(`Max column count (${this.maxItems}) exceeded`);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId===void 0?{}:t.styles.getStyleModel(e.styleId),e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},_i=class extends L{get tag(){return`col`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{});n&&(e.styleId=n)}render(e,t){e.openNode(`col`),e.addAttribute(`min`,t.min),e.addAttribute(`max`,t.max),t.width&&e.addAttribute(`width`,t.width),t.styleId&&e.addAttribute(`style`,t.styleId),t.hidden&&e.addAttribute(`hidden`,`1`),t.bestFit&&e.addAttribute(`bestFit`,`1`),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`),e.addAttribute(`customWidth`,`1`),e.closeNode()}parseOpen(e){if(e.name===`col`){let t=this.model={min:parseInt(e.attributes.min??`0`,10),max:parseInt(e.attributes.max??`0`,10),width:e.attributes.width===void 0?void 0:parseFloat(e.attributes.width??`0`)};return e.attributes.style&&(t.styleId=parseInt(e.attributes.style,10)),j(e.attributes.hidden)&&(t.hidden=!0),j(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),j(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId!==void 0&&(e.style=t.styles.getStyleModel(e.styleId))}},vi=class extends L{get tag(){return`dimension`}render(e,t){t&&e.leafNode(`dimension`,{ref:t})}parseOpen(e){return e.name===`dimension`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},yi=class extends L{get tag(){return`hyperlink`}render(e,t){this.isInternalLink(t)?e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip,location:t.target}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){return e.name===`hyperlink`?(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location&&(this.model.target=e.attributes.location),!0):!1}parseText(){}parseClose(){return!1}isInternalLink(e){return!!(e.target&&/^[^!]+![a-zA-Z]+[\d]+$/.test(e.target))}},bi=class extends L{get tag(){return`mergeCell`}render(e,t){e.leafNode(`mergeCell`,{ref:t})}parseOpen(e){return e.name===`mergeCell`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}};function xi(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function Si(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=j(i)}function Ci(e){if(!e)return[];let t=[],r={};for(let[n,i]of Object.entries(e))if(i!=null)if(n.startsWith(`range:`)){let e=n.slice(6),{sqref:r,...a}=i;t.push({...a,sqref:e})}else r[n]=i;if(Object.keys(r).length===0)return t;let i=Object.entries(r).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),a=Object.fromEntries(i.map(e=>[e.address,e])),o=(e,t,i)=>{for(let a=0;a<t;a++){let t=n.encodeAddress(e.row+a,i);if(!r[t]||!p(r[e.address],r[t]))return!1}return!0},s=i.map(e=>{if(!e.marked){let t=n.decodeEx(e.address);if(t.dimensions)return a[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let i=1,s=n.encodeAddress(t.row+i,t.col);for(;r[s]&&p(e.dataValidation,r[s]);)i++,s=n.encodeAddress(t.row+i,t.col);let c=1;for(;o(t,i,t.col+c);)c++;for(let e=0;e<i;e++)for(let r=0;r<c;r++)s=n.encodeAddress(t.row+e,t.col+r),a[s].marked=!0;if(i>1||c>1){let r=t.row+(i-1),a=t.col+(c-1);return{...e.dataValidation,sqref:`${e.address}:${n.encodeAddress(r,a)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...s]}var wi=class extends L{get tag(){return`dataValidations`}render(e,t){let n=Ci(t);n.length&&(e.openNode(`dataValidations`,{count:n.length}),n.forEach(t=>{e.openNode(`dataValidation`),t.type!==`any`&&(e.addAttribute(`type`,t.type),t.operator&&t.type!==`list`&&t.operator!==`between`&&e.addAttribute(`operator`,t.operator),t.allowBlank&&e.addAttribute(`allowBlank`,`1`)),t.showInputMessage&&e.addAttribute(`showInputMessage`,`1`),t.promptTitle&&e.addAttribute(`promptTitle`,t.promptTitle),t.prompt&&e.addAttribute(`prompt`,t.prompt),t.showErrorMessage&&e.addAttribute(`showErrorMessage`,`1`),t.errorStyle&&e.addAttribute(`errorStyle`,t.errorStyle),t.errorTitle&&e.addAttribute(`errorTitle`,t.errorTitle),t.error&&e.addAttribute(`error`,t.error),e.addAttribute(`sqref`,t.sqref),(t.formulae??[]).forEach((n,r)=>{e.openNode(`formula${r+1}`),t.type===`date`?e.writeText(Ne(new Date(n))):e.writeText(n),e.closeNode()}),e.closeNode()}),e.closeNode())}parseOpen(e){switch(e.name){case`dataValidations`:return this.model={},!0;case`dataValidation`:{this._address=e.attributes.sqref;let t={type:e.attributes.type??`any`,formulae:[]};switch(e.attributes.type&&Si(t,e.attributes,`allowBlank`),Si(t,e.attributes,`showInputMessage`),Si(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:xi(t,e.attributes,`operator`,`between`);break}return xi(t,e.attributes,`promptTitle`),xi(t,e.attributes,`prompt`),xi(t,e.attributes,`errorStyle`),xi(t,e.attributes,`errorTitle`),xi(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),this._address.split(/\s+/g).forEach(e=>{e.includes(`:`)?this.model[`range:${e}`]=this._dataValidation:this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=Pe(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},Ti=class extends L{get tag(){return`pageSetUpPr`}render(e,t){return t&&t.fitToPage?(e.leafNode(this.tag,{fitToPage:t.fitToPage?`1`:void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={fitToPage:e.attributes.fitToPage===`1`},!0):!1}parseText(){}parseClose(){return!1}};let Ei=e=>e!==void 0;var Di=class extends L{get tag(){return`outlinePr`}render(e,t){return t&&(Ei(t.summaryBelow)||Ei(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:Ei(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:Ei(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:Ei(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:Ei(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},Oi=class extends L{constructor(){super(),this.map={tabColor:new z(`tabColor`),pageSetUpPr:new Ti,outlinePr:new Di}}get tag(){return`sheetPr`}render(e,t){if(t){e.addRollback(),e.openNode(`sheetPr`);let n=!1;n=this.map.tabColor.render(e,t.tabColor)||n,n=this.map.pageSetUpPr.render(e,t.pageSetup)||n,n=this.map.outlinePr.render(e,t.outlineProperties)||n,n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.reset(),!0):this.map[e.name]?(this.parser=this.map[e.name],this.parser.parseOpen(e),!0):!1}parseText(e){return this.parser?(this.parser.parseText(e),!0):!1}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.parser=void 0),!0):(this.map.tabColor.model||this.map.pageSetUpPr.model||this.map.outlinePr.model?(this.model={},this.map.tabColor.model&&(this.model.tabColor=this.map.tabColor.model),this.map.pageSetUpPr.model&&(this.model.pageSetup=this.map.pageSetUpPr.model),this.map.outlinePr.model&&(this.model.outlineProperties=this.map.outlinePr.model)):this.model=null,!1)}},ki=class extends L{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow||void 0,outlineLevelCol:t.outlineLevelCol||void 0,"x14ac:dyDescent":t.dyDescent!==void 0&&t.dyDescent!==0?t.dyDescent:void 0};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),t.customHeight&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight??`0`),dyDescent:e.attributes[`x14ac:dyDescent`]===void 0?void 0:parseFloat(e.attributes[`x14ac:dyDescent`]),outlineLevelRow:parseInt(e.attributes.outlineLevelRow??`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol??`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),e.attributes.customHeight===`1`&&(this.model.customHeight=!0),!0):!1}parseText(){}parseClose(){return!1}};let Ai={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var ji=class extends L{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){let r={};t.tabSelected&&(r.tabSelected=`1`),r.workbookViewId=t.workbookViewId??0,e.openNode(`sheetView`,r);let i=function(t,n,r){r&&e.addAttribute(t,n)};i(`rightToLeft`,`1`,t.rightToLeft===!0),i(`showRuler`,`0`,t.showRuler===!1),i(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),i(`showGridLines`,`0`,t.showGridLines===!1),i(`zoomScale`,t.zoomScale,t.zoomScale!==void 0&&t.zoomScale!==100),i(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal!==void 0&&t.zoomScaleNormal!==100),i(`view`,t.style,t.style);let a,o,s,c;switch(t.state){case`frozen`:o=t.xSplit??0,s=t.ySplit??0,a=t.topLeftCell||n.getAddress(s+1,o+1).address,c=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:a,activePane:c,state:`frozen`}),e.leafNode(`selection`,{pane:c,activeCell:t.activeCell,sqref:t.activeCell});break;case`split`:t.activePane===`topLeft`&&(t.activePane=void 0),e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode(`selection`,{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case`normal`:t.activeCell&&e.leafNode(`selection`,{activeCell:t.activeCell,sqref:t.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale??`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal??`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit??`0`,10),ySplit:parseInt(e.attributes.ySplit??`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane??`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane??`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:Ai[this.pane.state]??`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function K(e,t){return e?t:void 0}function q(e,t){return e===t?!0:void 0}var Mi=class extends L{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:K(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:K(t.formatCells,`0`),formatColumns:K(t.formatColumns,`0`),formatRows:K(t.formatRows,`0`),insertColumns:K(t.insertColumns,`0`),insertRows:K(t.insertRows,`0`),insertHyperlinks:K(t.insertHyperlinks,`0`),deleteColumns:K(t.deleteColumns,`0`),deleteRows:K(t.deleteRows,`0`),sort:K(t.sort,`0`),autoFilter:K(t.autoFilter,`0`),pivotTables:K(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=K(t.objects===!1,`1`),n.scenarios=K(t.scenarios===!1,`1`)),Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={sheet:q(e.attributes.sheet,`1`),objects:e.attributes.objects===`1`?!1:void 0,scenarios:e.attributes.scenarios===`1`?!1:void 0,selectLockedCells:e.attributes.selectLockedCells===`1`?!1:void 0,selectUnlockedCells:e.attributes.selectUnlockedCells===`1`?!1:void 0,formatCells:q(e.attributes.formatCells,`0`),formatColumns:q(e.attributes.formatColumns,`0`),formatRows:q(e.attributes.formatRows,`0`),insertColumns:q(e.attributes.insertColumns,`0`),insertRows:q(e.attributes.insertRows,`0`),insertHyperlinks:q(e.attributes.insertHyperlinks,`0`),deleteColumns:q(e.attributes.deleteColumns,`0`),deleteRows:q(e.attributes.deleteRows,`0`),sort:q(e.attributes.sort,`0`),autoFilter:q(e.attributes.autoFilter,`0`),pivotTables:q(e.attributes.pivotTables,`0`)},e.attributes.algorithmName&&(this.model.algorithmName=e.attributes.algorithmName,this.model.hashValue=e.attributes.hashValue,this.model.saltValue=e.attributes.saltValue,this.model.spinCount=parseInt(e.attributes.spinCount,10)),!0;default:return!1}}parseText(){}parseClose(){return!1}},Ni=class extends L{get tag(){return`pageMargins`}render(e,t){if(t){let n={left:t.left,right:t.right,top:t.top,bottom:t.bottom,header:t.header,footer:t.footer};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={left:parseFloat(e.attributes.left||.7),right:parseFloat(e.attributes.right||.7),top:parseFloat(e.attributes.top||.75),bottom:parseFloat(e.attributes.bottom||.75),header:parseFloat(e.attributes.header||.3),footer:parseFloat(e.attributes.footer||.3)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Pi(e){return e?`1`:void 0}function Fi(e){switch(e){case`overThenDown`:return e;default:return}}function Ii(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function Li(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Ri(e){return e===void 0?void 0:parseInt(e,10)}var zi=class extends L{get tag(){return`pageSetup`}_dpiToXml(e){if(e!==void 0&&Number.isFinite(e)&&e!==4294967295)return e}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:this._dpiToXml(t.horizontalDpi),verticalDpi:this._dpiToXml(t.verticalDpi),pageOrder:Fi(t.pageOrder),blackAndWhite:Pi(t.blackAndWhite),draft:Pi(t.draft),cellComments:Ii(t.cellComments),errors:Li(t.errors),scale:t.scale===100?void 0:t.scale,fitToWidth:t.fitToWidth===1?void 0:t.fitToWidth,fitToHeight:t.fitToHeight===1?void 0:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Pi(!!t.firstPageNumber),usePrinterDefaults:Pi(t.usePrinterDefaults),copies:t.copies};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={paperSize:Ri(e.attributes.paperSize),orientation:e.attributes.orientation??`portrait`,horizontalDpi:parseInt(e.attributes.horizontalDpi??`4294967295`,10),verticalDpi:parseInt(e.attributes.verticalDpi??`4294967295`,10),pageOrder:e.attributes.pageOrder??`downThenOver`,blackAndWhite:e.attributes.blackAndWhite===`1`,draft:e.attributes.draft===`1`,cellComments:e.attributes.cellComments??`None`,errors:e.attributes.errors??`displayed`,scale:parseInt(e.attributes.scale??`100`,10),fitToWidth:parseInt(e.attributes.fitToWidth??`1`,10),fitToHeight:parseInt(e.attributes.fitToHeight??`1`,10),firstPageNumber:parseInt(e.attributes.firstPageNumber??`1`,10),useFirstPageNumber:e.attributes.useFirstPageNumber===`1`,usePrinterDefaults:e.attributes.usePrinterDefaults===`1`,copies:parseInt(e.attributes.copies??`1`,10)},!0;default:return!1}}parseText(){}parseClose(){return!1}};function Bi(e){return e?`1`:void 0}var Vi=class extends L{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:Bi(t.showRowColHeaders),gridLines:Bi(t.showGridLines),horizontalCentered:Bi(t.horizontalCentered),verticalCentered:Bi(t.verticalCentered)};Object.values(n).some(e=>e!==void 0)&&e.leafNode(this.tag,n)}}parseOpen(e){switch(e.name){case this.tag:return this.model={showRowColHeaders:e.attributes.headings===`1`,showGridLines:e.attributes.gridLines===`1`,horizontalCentered:e.attributes.horizontalCentered===`1`,verticalCentered:e.attributes.verticalCentered===`1`},!0;default:return!1}}parseText(){}parseClose(){return!1}},Hi=class extends L{get tag(){return`autoFilter`}render(e,t){if(t)if(typeof t==`string`)e.leafNode(`autoFilter`,{ref:t});else{let r=function(e){return typeof e==`string`?e:n.getAddress(e.row,e.column).address},i=r(t.from),a=r(t.to);i&&a&&e.leafNode(`autoFilter`,{ref:`${i}:${a}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},Ui=class extends L{get tag(){return`picture`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Wi=class extends L{get tag(){return`drawing`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Gi=class extends L{get tag(){return`tablePart`}render(e,t){t&&e.leafNode(this.tag,{"r:id":t.rId})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:id`]},!0;default:return!1}}parseText(){}parseClose(){return!1}},Ki=class extends L{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){if(e.name===`brk`){let{id:t,max:n,man:r,min:i}=e.attributes;return this.model={id:+t,max:+n,man:+r},i!==void 0&&(this.model.min=+i),!0}return!1}parseText(){}parseClose(){return!1}},qi=class extends R{constructor(){super({tag:`rowBreaks`,count:!0,childXform:new Ki})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Ji=class extends R{constructor(){super({tag:`colBreaks`,count:!0,childXform:new Ki})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Yi=class extends L{get tag(){return`headerFooter`}render(e,t){if(t){e.addRollback();let n=!1;e.openNode(`headerFooter`),t.differentFirst&&(e.addAttribute(`differentFirst`,`1`),n=!0),t.differentOddEven&&(e.addAttribute(`differentOddEven`,`1`),n=!0),t.oddHeader&&typeof t.oddHeader==`string`&&(e.leafNode(`oddHeader`,null,t.oddHeader),n=!0),t.oddFooter&&typeof t.oddFooter==`string`&&(e.leafNode(`oddFooter`,null,t.oddFooter),n=!0),t.evenHeader&&typeof t.evenHeader==`string`&&(e.leafNode(`evenHeader`,null,t.evenHeader),n=!0),t.evenFooter&&typeof t.evenFooter==`string`&&(e.leafNode(`evenFooter`,null,t.evenFooter),n=!0),t.firstHeader&&typeof t.firstHeader==`string`&&(e.leafNode(`firstHeader`,null,t.firstHeader),n=!0),t.firstFooter&&typeof t.firstFooter==`string`&&(e.leafNode(`firstFooter`,null,t.firstFooter),n=!0),n?(e.closeNode(),e.commit()):e.rollback()}}parseOpen(e){switch(e.name){case`headerFooter`:return this.model={},e.attributes.differentFirst&&(this.model.differentFirst=parseInt(e.attributes.differentFirst,0)===1),e.attributes.differentOddEven&&(this.model.differentOddEven=parseInt(e.attributes.differentOddEven,0)===1),!0;case`oddHeader`:return this.currentNode=`oddHeader`,!0;case`oddFooter`:return this.currentNode=`oddFooter`,!0;case`evenHeader`:return this.currentNode=`evenHeader`,!0;case`evenFooter`:return this.currentNode=`evenFooter`,!0;case`firstHeader`:return this.currentNode=`firstHeader`,!0;case`firstFooter`:return this.currentNode=`firstFooter`,!0;default:return!1}}parseText(e){switch(this.currentNode){case`oddHeader`:this.model.oddHeader=(this.model.oddHeader??``)+e;break;case`oddFooter`:this.model.oddFooter=(this.model.oddFooter??``)+e;break;case`evenHeader`:this.model.evenHeader=(this.model.evenHeader??``)+e;break;case`evenFooter`:this.model.evenFooter=(this.model.evenFooter??``)+e;break;case`firstHeader`:this.model.firstHeader=(this.model.firstHeader??``)+e;break;case`firstFooter`:this.model.firstFooter=(this.model.firstFooter??``)+e;break;default:break}}parseClose(){switch(this.currentNode){case`oddHeader`:case`oddFooter`:case`evenHeader`:case`evenFooter`:case`firstHeader`:case`firstFooter`:return this.currentNode=void 0,!0;default:return!1}}},J=class extends L{createNewModel(e){return{}}parseOpen(e){return this.parser=this.parser||this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=this.createNewModel(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}onParserClose(e,t){this.model[e]=t.model}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.onParserClose(e,this.parser),this.parser=void 0),!0):e!==this.tag}get tag(){return``}},Xi=class extends L{get tag(){return`cfvo`}render(e,t){e.leafNode(this.tag,{type:t.type,val:t.value})}parseOpen(e){this.model={type:e.attributes.type,value:L.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},Zi=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Xi,color:this.colorXform=new z}}get tag(){return`dataBar`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.colorXform.render(e,t.color),e.closeNode()}createNewModel(){return{cfvo:[]}}onParserClose(e,t){switch(e){case`cfvo`:this.model.cfvo.push(t.model);break;case`color`:this.model.color=t.model;break}}},Qi=class extends L{get tag(){return`x14:id`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},$i=class extends J{constructor(){super(),this.map={"x14:id":this.idXform=new Qi}}get tag(){return`ext`}render(e,t){e.openNode(this.tag,{uri:`{B025F937-C7B1-47D3-B67F-A62EFF666E3E}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.idXform.render(e,t.x14Id),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model.x14Id=t.model}},ea=class extends J{constructor(){super(),this.map={ext:new $i}}get tag(){return`extLst`}render(e,t){e.openNode(this.tag),this.map.ext.render(e,t),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){Object.assign(this.model,t.model)}},ta=class extends L{get tag(){return`formula`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},na=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Xi,color:this.colorXform=new z}}get tag(){return`colorScale`}render(e,t){e.openNode(this.tag),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.color.forEach(t=>{this.colorXform.render(e,t)}),e.closeNode()}createNewModel(e){return{cfvo:[],color:[]}}onParserClose(e,t){this.model[e].push(t.model)}},ra=class extends J{constructor(){super(),this.map={cfvo:this.cfvoXform=new Xi}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:L.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:L.toBoolAttribute(t.reverse,!1),showValue:L.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:L.toStringValue(e.iconSet,`3TrafficLights`),reverse:L.toBoolValue(e.reverse),showValue:L.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let ia={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},aa=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new r(e.ref);switch(e.operator){case`containsText`:return`NOT(ISERROR(SEARCH("${e.text}",${t})))`;case`containsBlanks`:return`LEN(TRIM(${t}))=0`;case`notContainsBlanks`:return`LEN(TRIM(${t}))>0`;case`containsErrors`:return`ISERROR(${t})`;case`notContainsErrors`:return`NOT(ISERROR(${t}))`;default:return}},oa=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new r(e.ref);switch(e.timePeriod){case`thisWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)<=WEEKDAY(TODAY())-1,ROUNDDOWN(${t},0)-TODAY()<=7-WEEKDAY(TODAY()))`;case`lastWeek`:return`AND(TODAY()-ROUNDDOWN(${t},0)>=(WEEKDAY(TODAY())),TODAY()-ROUNDDOWN(${t},0)<(WEEKDAY(TODAY())+7))`;case`nextWeek`:return`AND(ROUNDDOWN(${t},0)-TODAY()>(7-WEEKDAY(TODAY())),ROUNDDOWN(${t},0)-TODAY()<(15-WEEKDAY(TODAY())))`;case`yesterday`:return`FLOOR(${t},1)=TODAY()-1`;case`today`:return`FLOOR(${t},1)=TODAY()`;case`tomorrow`:return`FLOOR(${t},1)=TODAY()+1`;case`last7Days`:return`AND(TODAY()-FLOOR(${t},1)<=6,FLOOR(${t},1)<=TODAY())`;case`lastMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0-1)),YEAR(${t})=YEAR(EDATE(TODAY(),0-1)))`;case`thisMonth`:return`AND(MONTH(${t})=MONTH(TODAY()),YEAR(${t})=YEAR(TODAY()))`;case`nextMonth`:return`AND(MONTH(${t})=MONTH(EDATE(TODAY(),0+1)),YEAR(${t})=YEAR(EDATE(TODAY(),0+1)))`;default:return}},sa=e=>{let{type:t,operator:n}=e;switch(t){case`containsText`:case`containsBlanks`:case`notContainsBlanks`:case`containsErrors`:case`notContainsErrors`:return{type:`containsText`,operator:t};default:return{type:t,operator:n}}};var ca=class e extends J{constructor(){super(),this.map={dataBar:this.databarXform=new Zi,extLst:this.extLstRefXform=new ea,formula:this.formulaXform=new ta,colorScale:this.colorScaleXform=new na,iconSet:this.iconSetXform=new ra}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||ia[e.iconSet]))}render(e,t){switch(t.type){case`expression`:this.renderExpression(e,t);break;case`cellIs`:this.renderCellIs(e,t);break;case`top10`:this.renderTop10(e,t);break;case`aboveAverage`:this.renderAboveAverage(e,t);break;case`dataBar`:this.renderDataBar(e,t);break;case`colorScale`:this.renderColorScale(e,t);break;case`iconSet`:this.renderIconSet(e,t);break;case`containsText`:this.renderText(e,t);break;case`timePeriod`:this.renderTimePeriod(e,t);break}}renderExpression(e,t){e.openNode(this.tag,{type:`expression`,dxfId:t.dxfId,priority:t.priority}),this.formulaXform.render(e,t.formulae[0]),e.closeNode()}renderCellIs(e,t){e.openNode(this.tag,{type:`cellIs`,dxfId:t.dxfId,priority:t.priority,operator:t.operator}),t.formulae.forEach(t=>{this.formulaXform.render(e,t)}),e.closeNode()}renderTop10(e,t){e.leafNode(this.tag,{type:`top10`,dxfId:t.dxfId,priority:t.priority,percent:L.toBoolAttribute(t.percent,!1),bottom:L.toBoolAttribute(t.bottom,!1),rank:L.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:L.toBoolAttribute(t.aboveAverage,!0)})}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,priority:t.priority}),this.databarXform.render(e,t),this.extLstRefXform.render(e,t),e.closeNode()}renderColorScale(e,t){e.openNode(this.tag,{type:`colorScale`,priority:t.priority}),this.colorScaleXform.render(e,t),e.closeNode()}renderIconSet(t,n){e.isPrimitive(n)&&(t.openNode(this.tag,{type:`iconSet`,priority:n.priority}),this.iconSetXform.render(t,n),t.closeNode())}renderText(e,t){e.openNode(this.tag,{type:t.operator,dxfId:t.dxfId,priority:t.priority,operator:L.toStringAttribute(t.operator,`containsText`)});let n=aa(t);n&&this.formulaXform.render(e,n),e.closeNode()}renderTimePeriod(e,t){e.openNode(this.tag,{type:`timePeriod`,dxfId:t.dxfId,priority:t.priority,timePeriod:t.timePeriod});let n=oa(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...sa(e),dxfId:L.toIntValue(e.dxfId),priority:L.toIntValue(e.priority),timePeriod:e.timePeriod,percent:L.toBoolValue(e.percent),bottom:L.toBoolValue(e.bottom),rank:L.toIntValue(e.rank),aboveAverage:L.toBoolValue(e.aboveAverage)}}onParserClose(e,t){switch(e){case`dataBar`:case`extLst`:case`colorScale`:case`iconSet`:Object.assign(this.model,t.model);break;case`formula`:this.model.formulae=this.model.formulae??[],this.model.formulae.push(t.model);break}}},la=class extends J{constructor(){super(),this.map={cfRule:new ca}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(ca.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{ca.isPrimitive(n)&&(n.ref=t.ref,this.map.cfRule.render(e,n))}),e.closeNode())}createNewModel({attributes:e}){return{ref:e.sqref,rules:[]}}onParserClose(e,t){this.model.rules.push(t.model)}},ua=class extends L{constructor(){super(),this.cfXform=new la}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority??0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style)),e.type===`dataBar`&&((!e.cfvo||e.cfvo.length<2)&&(e.cfvo=[{type:`min`},{type:`max`}]),e.color||={argb:`FF638EC6`})})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},da=class extends L{get tag(){return`xm:f`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},fa=class extends J{constructor(){super(),this.map={"xm:f":this.fExtXform=new da}}get tag(){return`x14:cfvo`}render(e,t){e.openNode(this.tag,{type:t.type}),t.value!==void 0&&this.fExtXform.render(e,t.value),e.closeNode()}createNewModel(e){return{type:e.attributes.type}}onParserClose(e,t){switch(e){case`xm:f`:this.model.value=t.model?parseFloat(t.model):0;break}}},pa=class extends J{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new fa,"x14:borderColor":this.borderColorXform=new z(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new z(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new z(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new z(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:L.toIntAttribute(t.minLength,0,!0),maxLength:L.toIntAttribute(t.maxLength,100,!0),border:L.toBoolAttribute(t.border,!1),gradient:L.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:L.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:L.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:L.toAttribute(t.axisPosition,`auto`),direction:L.toAttribute(t.direction,`leftToRight`)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),this.borderColorXform.render(e,t.borderColor),this.negativeBorderColorXform.render(e,t.negativeBorderColor),this.negativeFillColorXform.render(e,t.negativeFillColor),this.axisColorXform.render(e,t.axisColor),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],minLength:L.toIntValue(e.minLength,0),maxLength:L.toIntValue(e.maxLength,100),border:L.toBoolValue(e.border,!1),gradient:L.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:L.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:L.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:L.toStringValue(e.axisPosition,`auto`),direction:L.toStringValue(e.direction,`leftToRight`)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;default:this.model[n]=t.model;break}}},ma=class extends L{get tag(){return`x14:cfIcon`}render(e,t){e.leafNode(this.tag,{iconSet:t.iconSet,iconId:t.iconId})}parseOpen({attributes:e}){this.model={iconSet:e.iconSet,iconId:L.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},ha=class extends J{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new fa,"x14:cfIcon":this.cfIconXform=new ma}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:L.toStringAttribute(t.iconSet),reverse:L.toBoolAttribute(t.reverse,!1),showValue:L.toBoolAttribute(t.showValue,!0),custom:L.toBoolAttribute(t.icons,!1)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),t.icons&&t.icons.forEach((t,n)=>{t.iconId=n,this.cfIconXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{cfvo:[],iconSet:L.toStringValue(e.iconSet,`3TrafficLights`),reverse:L.toBoolValue(e.reverse,!1),showValue:L.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};function Y(e){return e.toString(16).padStart(2,`0`)}function ga(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=e;return Y(t[0])+Y(t[1])+Y(t[2])+Y(t[3])+`-`+Y(t[4])+Y(t[5])+`-`+Y(t[6])+Y(t[7])+`-`+Y(t[8])+Y(t[9])+`-`+Y(t[10])+Y(t[11])+Y(t[12])+Y(t[13])+Y(t[14])+Y(t[15])}function _a(){let e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();let t=new Uint8Array(16);if(e?.getRandomValues)return e.getRandomValues(t),ga(t);for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return ga(t)}let va={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var ya=class e extends J{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new pa,"x14:iconSet":this.iconSetXform=new ha}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?pa.isExt(e):!!(e.type===`iconSet`&&(e.custom||va[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${_a()}}`.toUpperCase())}render(t,n){if(e.isExt(n))switch(n.type){case`dataBar`:this.renderDataBar(t,n);break;case`iconSet`:this.renderIconSet(t,n);break}}renderDataBar(e,t){e.openNode(this.tag,{type:`dataBar`,id:t.x14Id}),this.databarXform.render(e,t),e.closeNode()}renderIconSet(e,t){e.openNode(this.tag,{type:`iconSet`,priority:t.priority,id:t.x14Id??`{${_a()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:L.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},ba=class extends L{get tag(){return`xm:sqref`}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(){this.model=``}parseText(e){this.model+=e}parseClose(e){return e!==this.tag}},xa=class extends J{constructor(){super(),this.map={"xm:sqref":this.sqRef=new ba,"x14:cfRule":this.cfRule=new ya}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(ya.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(ya.isExt).forEach(t=>this.cfRule.render(e,t)),this.sqRef.render(e,t.ref),e.closeNode())}createNewModel(){return{rules:[]}}onParserClose(e,t){switch(e){case`xm:sqref`:this.model.ref=t.model;break;case`x14:cfRule`:this.model.rules.push(t.model);break}}},Sa=class extends J{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new xa}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(ya.isExt))),e.hasExtContent}prepare(e){e.forEach(e=>{this.cfXform.prepare(e)})}render(e,t){this.hasContent(t)&&(e.openNode(this.tag),t.forEach(t=>this.cfXform.render(e,t)),e.closeNode())}createNewModel(){return[]}onParserClose(e,t){this.model.push(t.model)}},Ca=class extends J{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new Sa}}get tag(){return`ext`}hasContent(e){return this.conditionalFormattings.hasContent(e.conditionalFormattings)}prepare(e){this.conditionalFormattings.prepare(e.conditionalFormattings)}render(e,t){e.openNode(`ext`,{uri:`{78C0D931-6437-407d-A8EE-F0AAD7539E65}`,"xmlns:x14":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`}),this.conditionalFormattings.render(e,t.conditionalFormattings),e.closeNode()}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}},wa=class extends J{constructor(){super(),this.map={ext:this.ext=new Ca}}get tag(){return`extLst`}prepare(e,t){this.ext.prepare(e)}hasContent(e){return this.ext.hasContent(e)}render(e,t){this.hasContent(t)&&(e.openNode(`extLst`),this.ext.render(e,t),e.closeNode())}createNewModel(){return{}}onParserClose(e,t){this.model[e]=t.model}};let Ta=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},Ea=(e,t)=>{if(!t||!t.length)return e;if(!e||!e.length)return t;let n={},r={};return e.forEach(e=>{n[e.ref]=e,e.rules.forEach(e=>{let{x14Id:t}=e;t&&(r[t]=e)})}),t.forEach(t=>{t.rules.forEach(i=>{let a=r[i.x14Id];a?Ta(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var Da=class e extends L{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"mc:Ignorable":`x14ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r??[],this.map={sheetPr:new Oi,dimension:new vi,sheetViews:new R({tag:`sheetViews`,count:!1,childXform:new ji}),sheetFormatPr:new ki,cols:new R({tag:`cols`,count:!1,childXform:new _i}),sheetData:new R({tag:`sheetData`,count:!1,empty:!0,childXform:new gi({maxItems:n}),maxItems:t}),autoFilter:new Hi,mergeCells:new R({tag:`mergeCells`,count:!0,childXform:new bi}),rowBreaks:new qi,colBreaks:new Ji,hyperlinks:new R({tag:`hyperlinks`,count:!1,childXform:new yi}),pageMargins:new Ni,dataValidations:new wi,pageSetup:new zi,headerFooter:new Yi,printOptions:new Vi,picture:new Ui,drawing:new Wi,sheetProtection:new Mi,tableParts:new R({tag:`tableParts`,count:!0,childXform:new Gi}),conditionalFormatting:new ua,extLst:new wa}}prepare(e,t){t.merges=new fi,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],e.formControls&&e.formControls.length>0&&(!e.views||e.views.length===0)&&(e.views=[{workbookViewId:0}]),t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;let r=e.rels=[];function i(e){return`rId${e.length+1}`}e.hyperlinks.forEach(e=>{let t=i(r);e.rId=t,r.push({Id:t,Type:G.Hyperlink,Target:e.target,TargetMode:`External`})});let{fileIndex:a}=e;if(e.comments.length>0){let o={Id:i(r),Type:G.Comments,Target:Rr(a)};r.push(o);let s={Id:i(r),Type:G.VmlDrawing,Target:zr(a)};r.push(s),e.comments.forEach(e=>{e.refAddress=n.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${a}`,vmlDrawing:`vmlDrawing${a}`})}if(e.drawing&&e.drawing.anchors){let n=e.drawing;n.rId=i(r),n.name||=`drawing${++t.drawingsCount}`;let a=(n.rels??[]).some(e=>e.Target&&e.Target.includes(`/charts/`));n.anchors=[],a||(n.rels=[]),t.drawings.push(n),r.push({Id:n.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Br(n.name)})}let o=[],s;if(e.media.forEach(n=>{if(n.type===`background`){let a=i(r);s=t.media[n.imageId],r.push({Id:a,Type:G.Image,Target:qr(`${s.name}.${s.extension}`)}),e.background={rId:a},e.image=t.media[n.imageId]}else if(n.type===`image`){let{drawing:a}=e;s=t.media[n.imageId],a||(a=e.drawing={rId:i(r),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(a),r.push({Id:a.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Br(a.name)}));let c=this.preImageId===n.imageId?o[n.imageId]:o[a.rels.length];c||(c=i(a.rels),o[a.rels.length]=c,a.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:qr(`${s.name}.${s.extension}`)}));let l={picture:{rId:c},range:n.range};if(n.hyperlinks&&n.hyperlinks.hyperlink){let e=i(a.rels);o[a.rels.length]=e,l.picture.hyperlinks={tooltip:n.hyperlinks.tooltip,rId:e},a.rels.push({Id:e,Type:G.Hyperlink,Target:n.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=n.imageId,a.anchors.push(l)}}),e.tables.forEach(e=>{let n=i(r);e.rId=n,r.push({Id:n,Type:G.Table,Target:Gr(e.target)}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables??[]).forEach(e=>{r.push({Id:i(r),Type:G.PivotTable,Target:Ur(e.tableNumber)})}),e.formControls&&e.formControls.length>0){let{drawing:n}=e;n||(n=e.drawing={rId:i(r),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(n),r.push({Id:n.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:Br(n.name)})),e.comments.length===0&&r.push({Id:i(r),Type:G.VmlDrawing,Target:zr(a)});let o=e=>({nativeCol:e.col,nativeColOff:e.colOff,nativeRow:e.row,nativeRowOff:e.rowOff});for(let a of e.formControls){let e=t.formControlRefs.length+1;a.ctrlPropId=e;let s=i(r);a.ctrlPropRelId=s,r.push({Id:s,Type:G.CtrlProp,Target:Yr(e)}),t.formControlRefs.push(e);let c=`Check Box ${Math.max(1,a.shapeId-1024)}`;n.anchors.push({range:{editAs:`absolute`,tl:o(a.tl),br:o(a.br)},alternateContent:{requires:`a14`},shape:{cNvPrId:a.shapeId,name:a.name||c,hidden:!0,spid:`_x0000_s${a.shapeId}`,text:a.text}})}}this.map.extLst.prepare(e,t)}render(t,n){t.openXml(F.StdDocAttributes);let r={...e.WORKSHEET_ATTRIBUTES};n.formControls&&n.formControls.length>0&&(r[`xmlns:x14`]=`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,r[`xmlns:xdr`]=`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,r[`mc:Ignorable`]=`${r[`mc:Ignorable`]} x14`),t.openNode(`worksheet`,r);let i=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow,customHeight:n.properties.customHeight}:void 0;n.properties&&n.properties.defaultColWidth&&(i.defaultColWidth=n.properties.defaultColWidth);let a={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},o=n.pageSetup&&n.pageSetup.margins,s={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},c=n.sheetProtection;if(this.map.sheetPr.render(t,a),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,i),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,c),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,s),this.map.pageMargins.render(t,o),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.colBreaks.render(t,n.colBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),n.rels&&n.rels.forEach(e=>{e.Type===G.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),n.formControls&&n.formControls.length>0){t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`controls`);for(let e of n.formControls){if(!e.ctrlPropRelId)continue;let n=`Check Box ${Math.max(1,e.shapeId-1024)}`;t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`control`,{shapeId:e.shapeId,"r:id":e.ctrlPropRelId,name:e.name||n}),t.openNode(`controlPr`,{locked:0,defaultSize:0,print:e.print?1:0,autoFill:0,autoLine:0,autoPict:0}),t.openNode(`anchor`),t.openNode(`from`),t.leafNode(`xdr:col`,void 0,e.tl.col),t.leafNode(`xdr:colOff`,void 0,e.tl.colOff),t.leafNode(`xdr:row`,void 0,e.tl.row),t.leafNode(`xdr:rowOff`,void 0,e.tl.rowOff),t.closeNode(),t.openNode(`to`),t.leafNode(`xdr:col`,void 0,e.br.col),t.leafNode(`xdr:colOff`,void 0,e.br.colOff),t.leafNode(`xdr:row`,void 0,e.br.row),t.leafNode(`xdr:rowOff`,void 0,e.br.rowOff),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=Ea(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r,rowBreaks:this.map.rowBreaks.model??[],colBreaks:this.map.colBreaks.model??[]},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships??[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===G.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===G.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings[r.Target].comments;e.comments.forEach((e,t)=>{e.note=Object.assign({},e.note,n[t])})}return n},{});if(t.commentsMap=(e.comments??[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks??[]).reduce((e,t)=>(t.rId&&(e[t.address]=n[t.rId].Target),e),{}),t.formulae={},e.rows=e.rows?.filter(Boolean)??[],e.rows.forEach(e=>{e.cells=e.cells?.filter(Boolean)??[]}),this.map.cols.reconcile(e.cols,t),this.map.sheetData.reconcile(e.rows,t),this.map.conditionalFormatting.reconcile(e.conditionalFormattings,t),e.media=[],e.drawing){let r=n[e.drawing.rId].Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(r){let n=r[1],i=t.drawings[n];i&&(e.drawing={...i,name:n,rels:t.drawingRels?.[n]??i.rels??[]},i.anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}}))}}let r=e.background&&n[e.background.rId];if(r){let n=r.Target.split(`/media/`)[1],i=t.mediaIndex&&t.mediaIndex[n];i!==void 0&&e.media.push({type:`background`,imageId:i})}e.tables=(e.tables??[]).map(e=>{let r=n[e.rId];return t.tables[r.Target]}),e.pivotTables=[],(e.relationships??[]).forEach(n=>{if(n.Type===G.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},Oa=class extends L{render(e){e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.openNode(`FeaturePropertyBags`,{xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`}),e.leafNode(`bag`,{type:`Checkbox`}),e.openNode(`bag`,{type:`XFControls`}),e.leafNode(`bagId`,{k:`CellControl`},`0`),e.closeNode(),e.openNode(`bag`,{type:`XFComplement`}),e.leafNode(`bagId`,{k:`XFControls`},`1`),e.closeNode(),e.openNode(`bag`,{type:`XFComplements`,extRef:`XFComplementsMapperExtRef`}),e.openNode(`a`,{k:`MappedFeaturePropertyBags`}),e.leafNode(`bagId`,{},`2`),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}},ka=class extends L{parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={range:{editAs:e.attributes.editAs??`oneCell`}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}reconcilePicture(e,t){if(e&&e.rId){let n=t.rels[e.rId].Target.match(/.*\/media\/(.+[.][a-zA-Z]{3,4})/);if(n){let e=n[1],r=t.mediaIndex[e];return t.media[r]}}}},Aa=class extends L{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new un({tag:`xdr:col`,zero:!0}),"xdr:colOff":new un({tag:`xdr:colOff`,zero:!0}),"xdr:row":new un({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new un({tag:`xdr:rowOff`,zero:!0})},this.model={nativeCol:0,nativeColOff:0,nativeRow:0,nativeRowOff:0}}render(e,t){e.openNode(this.tag),this.map[`xdr:col`].render(e,t.nativeCol),this.map[`xdr:colOff`].render(e,t.nativeColOff),this.map[`xdr:row`].render(e,t.nativeRow),this.map[`xdr:rowOff`].render(e,t.nativeRowOff),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model={nativeCol:this.map[`xdr:col`].model,nativeColOff:this.map[`xdr:colOff`].model,nativeRow:this.map[`xdr:row`].model,nativeRowOff:this.map[`xdr:rowOff`].model},!1;default:return!0}}},ja=class extends L{constructor(){super(),this.model={rId:``}}get tag(){return`a:blip`}render(e,t){e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:embed":t.rId,cstate:`print`})}parseOpen(e){switch(e.name){case this.tag:return this.model={rId:e.attributes[`r:embed`]},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Ma=class extends L{constructor(){super(),this.map={"a:blip":new ja}}get tag(){return`xdr:blipFill`}render(e,t){e.openNode(this.tag),this.map[`a:blip`].render(e,t),e.openNode(`a:stretch`),e.leafNode(`a:fillRect`),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:blip`].model,!1;default:return!0}}},Na=class extends L{constructor(){super(),this.model={}}get tag(){return`a:hlinkClick`}render(e,t){t.hyperlinks&&t.hyperlinks.rId&&e.leafNode(this.tag,{"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"r:id":t.hyperlinks.rId,tooltip:t.hyperlinks.tooltip})}parseOpen(e){switch(e.name){case this.tag:return this.model={hyperlinks:{rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip}},!0;default:return!0}}parseText(){}parseClose(){return!1}},Pa=class extends L{get tag(){return`a:extLst`}render(e){e.openNode(this.tag),e.openNode(`a:ext`,{uri:`{FF2B5EF4-FFF2-40B4-BE49-F238E27FC236}`}),e.leafNode(`a16:creationId`,{"xmlns:a16":`http://schemas.microsoft.com/office/drawing/2014/main`,id:`{00000000-0008-0000-0000-000002000000}`}),e.closeNode(),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},Fa=class extends L{constructor(){super(),this.map={"a:hlinkClick":new Na,"a:extLst":new Pa}}get tag(){return`xdr:cNvPr`}render(e,t){e.openNode(this.tag,{id:t.index,name:`Picture ${t.index}`}),this.map[`a:hlinkClick`].render(e,t),this.map[`a:extLst`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`a:hlinkClick`].model,!1;default:return!0}}},Ia=class extends L{get tag(){return`xdr:cNvPicPr`}render(e){e.openNode(this.tag),e.leafNode(`a:picLocks`,{noChangeAspect:`1`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},La=class extends L{constructor(){super(),this.map={"xdr:cNvPr":new Fa,"xdr:cNvPicPr":new Ia}}get tag(){return`xdr:nvPicPr`}render(e,t){e.openNode(this.tag),this.map[`xdr:cNvPr`].render(e,t),this.map[`xdr:cNvPicPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model=this.map[`xdr:cNvPr`].model,!1;default:return!0}}};let Ra={tag:`xdr:spPr`,c:[{tag:`a:xfrm`,c:[{tag:`a:off`,$:{x:`0`,y:`0`}},{tag:`a:ext`,$:{cx:`0`,cy:`0`}}]},{tag:`a:prstGeom`,$:{prst:`rect`},c:[{tag:`a:avLst`}]}]};var za=class extends L{constructor(){super(),this.map={"xdr:nvPicPr":new La,"xdr:blipFill":new Ma,"xdr:spPr":new cn(Ra)}}get tag(){return`xdr:pic`}prepare(e,t){e.index=t.index+1}render(e,t){e.openNode(this.tag),this.map[`xdr:nvPicPr`].render(e,t),this.map[`xdr:blipFill`].render(e,t),this.map[`xdr:spPr`].render(e,t),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset();break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.mergeModel(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}},Ba=class extends L{get tag(){return`xdr:sp`}render(e,t){t&&(e.openNode(this.tag,{macro:``,textlink:``}),e.openNode(`xdr:nvSpPr`),e.openNode(`xdr:cNvPr`,{id:t.cNvPrId,name:t.name,hidden:t.hidden?`1`:void 0}),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{63B3BB69-23CF-44E3-9099-C40C66FF867C}`}),e.leafNode(`a14:compatExt`,{spid:t.spid,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`},void 0),e.closeNode(),e.closeNode(),e.closeNode(),e.leafNode(`xdr:cNvSpPr`),e.closeNode(),e.openNode(`xdr:spPr`,{bwMode:`auto`}),e.openNode(`a:xfrm`),e.leafNode(`a:off`,{x:0,y:0}),e.leafNode(`a:ext`,{cx:0,cy:0}),e.closeNode(),e.openNode(`a:prstGeom`,{prst:`rect`}),e.leafNode(`a:avLst`),e.closeNode(),e.leafNode(`a:noFill`),e.openNode(`a:ln`),e.leafNode(`a:noFill`),e.closeNode(),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{909E8E84-426E-40DD-AFC4-6F175D3DCCD1}`}),e.openNode(`a14:hiddenFill`,{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`F0F0F0`}),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`a:ext`,{uri:`{91240B29-F687-4F45-9708-019B960494DF}`}),e.openNode(`a14:hiddenLine`,{w:9525,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:miter`,{lim:8e5}),e.leafNode(`a:headEnd`),e.leafNode(`a:tailEnd`),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`xdr:txBody`),e.leafNode(`a:bodyPr`,{vertOverflow:`clip`,wrap:`square`,lIns:18288,tIns:18288,rIns:0,bIns:18288,anchor:`ctr`,upright:1}),e.leafNode(`a:lstStyle`),e.openNode(`a:p`),e.openNode(`a:pPr`,{algn:`l`,rtl:0}),e.leafNode(`a:defRPr`,{sz:1e3}),e.closeNode(),e.openNode(`a:r`),e.openNode(`a:rPr`,{lang:`en-US`,sz:800,b:0,i:0,u:`none`,strike:`noStrike`,baseline:0}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:latin`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:ea`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:cs`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.closeNode(),e.openNode(`a:t`),e.writeText(t.text??``),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode())}},Va=class extends ka{constructor(){super(),this.map={"xdr:from":new Aa({tag:`xdr:from`}),"xdr:to":new Aa({tag:`xdr:to`}),"xdr:pic":new za,"xdr:sp":new Ba,"xdr:clientData":new cn({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){e.picture&&this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){let n=!!t.alternateContent;n&&(e.openNode(`mc:AlternateContent`,{"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`}),e.openNode(`mc:Choice`,{Requires:t.alternateContent?.requires,...t.alternateContent?.requires===`a14`?{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}:{}})),e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),t.picture?this.map[`xdr:pic`].render(e,t.picture):t.shape&&this.map[`xdr:sp`].render(e,t.shape),this.map[`xdr:clientData`].render(e,{}),e.closeNode(),n&&(e.closeNode(),e.leafNode(`mc:Fallback`),e.closeNode())}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};let Ha=9525;var Ua=class extends L{constructor(e){super(),this.tag=e.tag,this.map={},this.model={width:0,height:0}}render(e,t){e.openNode(this.tag);let n=Math.floor(t.width*Ha),r=Math.floor(t.height*Ha);e.addAttribute(`cx`,n),e.addAttribute(`cy`,r),e.closeNode()}parseOpen(e){return e.name===this.tag?(this.model={width:parseInt(e.attributes.cx??`0`,10)/Ha,height:parseInt(e.attributes.cy??`0`,10)/Ha},!0):!1}parseText(e){}parseClose(e){return!1}},Wa=class extends ka{constructor(){super(),this.map={"xdr:from":new Aa({tag:`xdr:from`}),"xdr:ext":new Ua({tag:`xdr:ext`}),"xdr:pic":new za,"xdr:clientData":new cn({tag:`xdr:clientData`})}}get tag(){return`xdr:oneCellAnchor`}prepare(e,t){this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:ext`].render(e,t.range.ext),this.map[`xdr:pic`].render(e,t.picture),this.map[`xdr:clientData`].render(e,{}),e.closeNode()}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.ext=this.map[`xdr:ext`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};function Ga(e){return(typeof e.range==`string`?n.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Ka=class e extends L{constructor(){super(),this.map={"xdr:twoCellAnchor":new Va,"xdr:oneCellAnchor":new Wa},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Ga(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),r.anchors.forEach(e=>{this.map[e.anchorType].render(t,e)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={anchors:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.anchors.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:xdr":`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,"xmlns:a":`http://schemas.openxmlformats.org/drawingml/2006/main`}}},qa=class extends L{constructor(){super(),this.model={val:``}}get tag(){return`customFilter`}render(e,t){e.leafNode(this.tag,{val:t.val,operator:t.operator})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val,operator:e.attributes.operator},!0):!1}parseText(){}parseClose(){return!1}},Ja=class extends L{constructor(){super(),this.model={val:``}}get tag(){return`filter`}render(e,t){e.leafNode(this.tag,{val:t.val})}parseOpen(e){return e.name===this.tag?(this.model={val:e.attributes.val},!0):!1}parseText(){}parseClose(){return!1}},Ya=class extends L{constructor(){super(),this.map={customFilters:new R({tag:`customFilters`,count:!1,empty:!0,childXform:new qa}),filters:new R({tag:`filters`,count:!1,empty:!0,childXform:new Ja})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(){}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.customFilters=this.map.customFilters.model,!1;default:return!0}}},Xa=class extends L{constructor(){super(),this.map={filterColumn:new Ya},this.model={autoFilterRef:``,columns:[]}}get tag(){return`autoFilter`}prepare(e){e.columns.forEach((e,t)=>{this.map.filterColumn.prepare(e,{index:t})})}render(e,t){e.openNode(this.tag,{ref:t.autoFilterRef}),t.columns.forEach(t=>{this.map.filterColumn.render(e,t)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model={autoFilterRef:e.attributes.ref,columns:[]},!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw Error(`Unexpected xml node in parseOpen: ${JSON.stringify(e)}`)}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.columns.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}},Za=class extends L{constructor(){super(),this._childText=``,this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}_renderAttributes(e){return{id:e.id.toString(),name:e.name,totalsRowLabel:e.totalsRowLabel,totalsRowFunction:e.totalsRowFunction===`none`?void 0:e.totalsRowFunction,dxfId:e.dxfId}}render(e,t){t.calculatedColumnFormula||t.totalsRowFormula?(e.openNode(this.tag,this._renderAttributes(t)),t.calculatedColumnFormula&&e.leafNode(`calculatedColumnFormula`,void 0,t.calculatedColumnFormula),t.totalsRowFormula&&e.leafNode(`totalsRowFormula`,void 0,t.totalsRowFormula),e.closeNode()):e.leafNode(this.tag,this._renderAttributes(t))}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return(e.name===`calculatedColumnFormula`||e.name===`totalsRowFormula`)&&(this._childTag=e.name,this._childText=``),!0}parseText(e){this._childTag&&(this._childText+=e)}parseClose(e){return e===this.tag?!1:(this._childTag&&e===this._childTag&&(this.model[this._childTag]=this._childText,this._childTag=void 0),!0)}},Qa=class extends L{constructor(){super(),this.model={theme:null,showFirstColumn:!1,showLastColumn:!1,showRowStripes:!1,showColumnStripes:!1}}get tag(){return`tableStyleInfo`}render(e,t){e.leafNode(this.tag,{name:t.theme?t.theme:void 0,showFirstColumn:t.showFirstColumn?`1`:`0`,showLastColumn:t.showLastColumn?`1`:`0`,showRowStripes:t.showRowStripes?`1`:`0`,showColumnStripes:t.showColumnStripes?`1`:`0`})}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={theme:t.name?t.name:null,showFirstColumn:t.showFirstColumn===`1`,showLastColumn:t.showLastColumn===`1`,showRowStripes:t.showRowStripes===`1`,showColumnStripes:t.showColumnStripes===`1`},!0}return!1}parseText(){}parseClose(){return!1}},$a=class e extends L{constructor(){super(),this.map={autoFilter:new Xa,tableColumns:new R({tag:`tableColumns`,count:!0,empty:!0,childXform:new Za}),tableStyleInfo:new Qa},this.model={id:0,name:``,tableRef:``,columns:[]}}prepare(e,t){this.map.autoFilter.prepare(e),this.map.tableColumns.prepare(e.columns,t)}get tag(){return`table`}render(t,n){t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,headerRowCount:n.headerRow?void 0:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount!==`0`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}};function eo(e){return isNaN(e.getTime())?``:e.toISOString().replace(/\.\d{3}Z$/,``)}function to(e){let t=A(e.name),n=e.numFmtId??`0`,r=ro(e.extraAttrs),i=e.fieldGroupXml?`\n ${e.fieldGroupXml}`:``;if(e.sharedItems===null){if(e.isLoaded)return i?`<cacheField name="${t}" numFmtId="${n}"${r}>${i}\n </cacheField>`:`<cacheField name="${t}" numFmtId="${n}"${r} />`;let a;return a=e.minValue!==void 0&&e.maxValue!==void 0?` containsSemiMixedTypes="0" containsString="0" containsNumber="1"${e.containsInteger?` containsInteger="1"`:``} minValue="${e.minValue}" maxValue="${e.maxValue}"`:``,`<cacheField name="${t}" numFmtId="${n}"${r}>
11
11
  <sharedItems${a} />${i}
12
12
  </cacheField>`}if(e.isLoaded&&e.sharedItems.length===0)return`<cacheField name="${t}" numFmtId="${n}"${r}>
13
- <sharedItems${eo(e)} />${i}
14
- </cacheField>`;if(e.isLoaded){let a=Qa(e.sharedItems);return`<cacheField name="${t}" numFmtId="${n}"${r}>
15
- <sharedItems${eo(e)} count="${e.sharedItems.length}">
13
+ <sharedItems${io(e)} />${i}
14
+ </cacheField>`;if(e.isLoaded){let a=no(e.sharedItems);return`<cacheField name="${t}" numFmtId="${n}"${r}>
15
+ <sharedItems${io(e)} count="${e.sharedItems.length}">
16
16
  ${a}
17
17
  </sharedItems>${i}
18
- </cacheField>`}let a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!0,f=1/0,p=-1/0;for(let t of e.sharedItems)t===null?l=!0:t instanceof bt?u=!0:typeof t==`string`?a=!0:typeof t==`number`?Number.isFinite(t)?(o=!0,t<f&&(f=t),t>p&&(p=t),Number.isInteger(t)||(d=!1)):l=!0:typeof t==`boolean`?s=!0:t instanceof Date&&(c=!0);let m=[];a||(m.push(`containsSemiMixedTypes="0"`),m.push(`containsString="0"`)),(a?1:0)+(o?1:0)+(s?1:0)+(c?1:0)+(u?1:0)>1&&m.push(`containsMixedTypes="1"`),o&&(m.push(`containsNumber="1"`),d&&m.push(`containsInteger="1"`),m.push(`minValue="${f}"`),m.push(`maxValue="${p}"`)),c&&m.push(`containsDate="1"`),l&&m.push(`containsBlank="1"`);let h=Qa(e.sharedItems);return`<cacheField name="${t}" numFmtId="${n}"${r}>
18
+ </cacheField>`}let a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!0,f=1/0,p=-1/0;for(let t of e.sharedItems)t===null?l=!0:t instanceof wt?u=!0:typeof t==`string`?a=!0:typeof t==`number`?Number.isFinite(t)?(o=!0,t<f&&(f=t),t>p&&(p=t),Number.isInteger(t)||(d=!1)):l=!0:typeof t==`boolean`?s=!0:t instanceof Date&&(c=!0);let m=[];a||(m.push(`containsSemiMixedTypes="0"`),m.push(`containsString="0"`)),(a?1:0)+(o?1:0)+(s?1:0)+(c?1:0)+(u?1:0)>1&&m.push(`containsMixedTypes="1"`),o&&(m.push(`containsNumber="1"`),d&&m.push(`containsInteger="1"`),m.push(`minValue="${f}"`),m.push(`maxValue="${p}"`)),c&&m.push(`containsDate="1"`),l&&m.push(`containsBlank="1"`);let h=no(e.sharedItems);return`<cacheField name="${t}" numFmtId="${n}"${r}>
19
19
  <sharedItems${m.length>0?` ${m.join(` `)}`:``} count="${e.sharedItems.length}">
20
20
  ${h}
21
21
  </sharedItems>${i}
22
- </cacheField>`}function Qa(e){let t=[];for(let n of e)n===null?t.push(`<m />`):n instanceof bt?t.push(`<e v="${A(n.code)}" />`):typeof n==`number`?Number.isFinite(n)?t.push(`<n v="${n}" />`):t.push(`<m />`):typeof n==`boolean`?t.push(`<b v="${n?`1`:`0`}" />`):n instanceof Date?t.push(`<d v="${Xa(n)}" />`):t.push(`<s v="${A(n)}" />`);return t.join(``)}function $a(e){return e?Object.entries(e).map(([e,t])=>` ${e}="${A(t)}"`).join(``):``}function eo(e){let t=[];return e.containsSemiMixedTypes!==void 0&&t.push(`containsSemiMixedTypes="${e.containsSemiMixedTypes}"`),e.containsNonDate!==void 0&&t.push(`containsNonDate="${e.containsNonDate}"`),e.containsString!==void 0&&t.push(`containsString="${e.containsString}"`),e.containsBlank!==void 0&&t.push(`containsBlank="${e.containsBlank}"`),e.containsMixedTypes!==void 0&&t.push(`containsMixedTypes="${e.containsMixedTypes}"`),e.containsNumber!==void 0&&t.push(`containsNumber="${e.containsNumber}"`),e.containsInteger!==void 0&&t.push(`containsInteger="${e.containsInteger}"`),e.minValue!==void 0&&t.push(`minValue="${e.minValue}"`),e.maxValue!==void 0&&t.push(`maxValue="${e.maxValue}"`),e.containsDate!==void 0&&t.push(`containsDate="${e.containsDate}"`),t.length>0?` ${t.join(` `)}`:``}let to=new Set([`xmlns`,`xmlns:r`,`count`]);var no=class e extends L{constructor(){super(),this.model=null,this.currentRecord=null}get tag(){return`pivotCacheRecords`}reset(){this.model=null,this.currentRecord=null}render(e,t){`isLoaded`in t&&t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2).filter(Array.isArray);t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(this.renderTableNew(a,i)),t.closeNode()}renderLoaded(t,n){t.openXml(F.StdDocAttributes);let r={xmlns:e.PIVOT_CACHE_RECORDS_ATTRIBUTES.xmlns,"xmlns:r":e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:r`]};if(n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))r[e]=t;else r[`xmlns:mc`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:mc`],r[`mc:Ignorable`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`mc:Ignorable`],r[`xmlns:xr`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:xr`];r.count=n.records.length,t.openNode(this.tag,r);for(let e of n.records){t.writeXml(`
22
+ </cacheField>`}function no(e){let t=[];for(let n of e)n===null?t.push(`<m />`):n instanceof wt?t.push(`<e v="${A(n.code)}" />`):typeof n==`number`?Number.isFinite(n)?t.push(`<n v="${n}" />`):t.push(`<m />`):typeof n==`boolean`?t.push(`<b v="${n?`1`:`0`}" />`):n instanceof Date?t.push(`<d v="${eo(n)}" />`):t.push(`<s v="${A(n)}" />`);return t.join(``)}function ro(e){return e?Object.entries(e).map(([e,t])=>` ${e}="${A(t)}"`).join(``):``}function io(e){let t=[];return e.containsSemiMixedTypes!==void 0&&t.push(`containsSemiMixedTypes="${e.containsSemiMixedTypes}"`),e.containsNonDate!==void 0&&t.push(`containsNonDate="${e.containsNonDate}"`),e.containsString!==void 0&&t.push(`containsString="${e.containsString}"`),e.containsBlank!==void 0&&t.push(`containsBlank="${e.containsBlank}"`),e.containsMixedTypes!==void 0&&t.push(`containsMixedTypes="${e.containsMixedTypes}"`),e.containsNumber!==void 0&&t.push(`containsNumber="${e.containsNumber}"`),e.containsInteger!==void 0&&t.push(`containsInteger="${e.containsInteger}"`),e.minValue!==void 0&&t.push(`minValue="${e.minValue}"`),e.maxValue!==void 0&&t.push(`maxValue="${e.maxValue}"`),e.containsDate!==void 0&&t.push(`containsDate="${e.containsDate}"`),t.length>0?` ${t.join(` `)}`:``}let ao=new Set([`xmlns`,`xmlns:r`,`count`]);var oo=class e extends L{constructor(){super(),this.model=null,this.currentRecord=null}get tag(){return`pivotCacheRecords`}reset(){this.model=null,this.currentRecord=null}render(e,t){`isLoaded`in t&&t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2).filter(Array.isArray);t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(this.renderTableNew(a,i)),t.closeNode()}renderLoaded(t,n){t.openXml(F.StdDocAttributes);let r={xmlns:e.PIVOT_CACHE_RECORDS_ATTRIBUTES.xmlns,"xmlns:r":e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:r`]};if(n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))r[e]=t;else r[`xmlns:mc`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:mc`],r[`mc:Ignorable`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`mc:Ignorable`],r[`xmlns:xr`]=e.PIVOT_CACHE_RECORDS_ATTRIBUTES[`xmlns:xr`];r.count=n.records.length,t.openNode(this.tag,r);for(let e of n.records){t.writeXml(`
23
23
  <r>`);for(let n of e)t.writeXml(`
24
24
  `),t.writeXml(this.renderRecordValue(n));t.writeXml(`
25
- </r>`)}t.closeNode()}renderRecordValue(e){switch(e.type){case`x`:return`<x v="${e.value}" />`;case`n`:return Number.isFinite(e.value)?`<n v="${e.value}" />`:`<m />`;case`s`:return`<s v="${A(e.value)}" />`;case`b`:return`<b v="${e.value?`1`:`0`}" />`;case`m`:return`<m />`;case`d`:return`<d v="${Xa(e.value)}" />`;case`e`:return`<e v="${A(e.value)}" />`;default:{let t=e;throw Error(`Unhandled record value type: ${t.type}`)}}}renderTableNew(e,t){let n=[];for(let r of e){let e=r.slice(1);n.push(`
25
+ </r>`)}t.closeNode()}renderRecordValue(e){switch(e.type){case`x`:return`<x v="${e.value}" />`;case`n`:return Number.isFinite(e.value)?`<n v="${e.value}" />`:`<m />`;case`s`:return`<s v="${A(e.value)}" />`;case`b`:return`<b v="${e.value?`1`:`0`}" />`;case`m`:return`<m />`;case`d`:return`<d v="${eo(e.value)}" />`;case`e`:return`<e v="${A(e.value)}" />`;default:{let t=e;throw Error(`Unhandled record value type: ${t.type}`)}}}renderTableNew(e,t){let n=[];for(let r of e){let e=r.slice(1);n.push(`
26
26
  <r>`);let i=Math.min(e.length,t.length);for(let r=0;r<i;r++)n.push(`
27
27
  `),n.push(this.renderCellNew(e[r],t[r].sharedItems));for(let e=i;e<t.length;e++)n.push(`
28
28
  <m />`);n.push(`
29
- </r>`)}return n.join(``)}renderCellNew(e,t){if(e==null||typeof e==`number`&&!Number.isFinite(e)){if(t===null)return`<m />`;let e=t.indexOf(null);return e>=0?`<x v="${e}" />`:`<m />`}if(t===null)return e instanceof bt?`<e v="${A(e.code)}" />`:typeof e==`boolean`?`<b v="${e?`1`:`0`}" />`:e instanceof Date?`<d v="${Xa(e)}" />`:Number.isFinite(e)?`<n v="${e}" />`:`<s v="${A(String(e))}" />`;let n=ro(t,e);if(n<0)throw Error(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))to.has(t)||(e[t]=String(r));this.model={records:[],count:parseInt(n.count??`0`,10),isLoaded:!0,extraRootAttrs:Object.keys(e).length>0?e:void 0};break}case`r`:this.currentRecord=[];break;case`x`:this.currentRecord&&this.currentRecord.push({type:`x`,value:parseInt(n.v??`0`,10)});break;case`n`:this.currentRecord&&(n.v===void 0||n.v===``?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`n`,value:parseFloat(n.v)}));break;case`s`:this.currentRecord&&this.currentRecord.push({type:`s`,value:n.v??``});break;case`b`:this.currentRecord&&this.currentRecord.push({type:`b`,value:n.v===`1`});break;case`m`:this.currentRecord&&this.currentRecord.push({type:`m`});break;case`d`:if(this.currentRecord)if(!n.v)this.currentRecord.push({type:`m`});else{let e=je(n.v);isNaN(e.getTime())?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`d`,value:e})}break;case`e`:this.currentRecord&&this.currentRecord.push({type:`e`,value:n.v??``});break}return!0}parseText(e){}parseClose(e){switch(e){case this.tag:return!1;case`r`:this.model&&this.currentRecord&&(this.model.records.push(this.currentRecord),this.currentRecord=null);break}return!0}static{this.PIVOT_CACHE_RECORDS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function ro(e,t){if(t instanceof Date){let n=t.getTime();for(let t=0;t<e.length;t++){let r=e[t];if(r instanceof Date&&r.getTime()===n)return t}return-1}if(t instanceof bt){for(let n=0;n<e.length;n++){let r=e[n];if(r instanceof bt&&r.code===t.code)return n}return-1}return e.indexOf(t)}var io=class{constructor(e){this.active=!1,this.depth=0,this.buffer=[],this.lastOpenIndex=-1,this.rootTag=e}start(e){this.active=!0,this.depth=0;let t=ao(e);this.buffer=[`<${this.rootTag}${t?` `+t:``}>`]}startAs(e,t){this.rootTag=e,this.start(t)}reset(){this.active=!1,this.depth=0,this.buffer.length=0,this.lastOpenIndex=-1}feedOpen(e,t){let n=ao(t);this.buffer.push(`<${e}${n?` `+n:``}>`),this.depth++,this.lastOpenIndex=this.buffer.length-1}feedText(e){this.buffer.push(A(e)),this.lastOpenIndex=-1}feedClose(e){if(e===this.rootTag&&this.depth===0)return this.buffer.push(`</${e}>`),this.active=!1,this.lastOpenIndex=-1,!0;if(this.depth>0&&this.depth--,this.lastOpenIndex>=0&&this.lastOpenIndex===this.buffer.length-1){let e=this.buffer[this.lastOpenIndex];return this.buffer[this.lastOpenIndex]=e.slice(0,-1)+` />`,this.lastOpenIndex=-1,!1}return this.lastOpenIndex=-1,this.buffer.push(`</${e}>`),!1}get result(){return this.buffer.join(``)}};function ao(e){if(!e)return``;let t=Object.entries(e);return t.length===0?``:t.filter(([,e])=>e!=null).map(([e,t])=>`${e}="${A(String(t))}"`).join(` `)}let oo=new Set([`name`,`numFmtId`]);var so=class extends L{constructor(){super(),this.inSharedItems=!1,this.fieldGroupCollector=new io(`fieldGroup`),this.model=null}get tag(){return`cacheField`}reset(){this.model=null,this.inSharedItems=!1,this.fieldGroupCollector.reset()}parseOpen(e){let{name:t,attributes:n}=e;if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedOpen(t,n),!0;switch(t){case`cacheField`:{let e={};for(let[t,r]of Object.entries(n))oo.has(t)||(e[t]=String(r));this.model={name:n.name??``,sharedItems:null,numFmtId:n.numFmtId,isLoaded:!0,extraAttrs:Object.keys(e).length>0?e:void 0};break}case`fieldGroup`:this.model&&this.fieldGroupCollector.start(n);break;case`sharedItems`:if(this.inSharedItems=!0,this.model){if(n.containsNumber!==void 0&&(this.model.containsNumber=n.containsNumber),n.containsInteger!==void 0&&(this.model.containsInteger=n.containsInteger),n.minValue!==void 0){let e=parseFloat(n.minValue);Number.isFinite(e)&&(this.model.minValue=e)}if(n.maxValue!==void 0){let e=parseFloat(n.maxValue);Number.isFinite(e)&&(this.model.maxValue=e)}n.containsSemiMixedTypes!==void 0&&(this.model.containsSemiMixedTypes=n.containsSemiMixedTypes),n.containsNonDate!==void 0&&(this.model.containsNonDate=n.containsNonDate),n.containsString!==void 0&&(this.model.containsString=n.containsString),n.containsBlank!==void 0&&(this.model.containsBlank=n.containsBlank),n.containsDate!==void 0&&(this.model.containsDate=n.containsDate),n.containsMixedTypes!==void 0&&(this.model.containsMixedTypes=n.containsMixedTypes),this.model.sharedItems=[]}break;case`s`:case`n`:case`b`:case`e`:case`m`:case`d`:this.inSharedItems&&this.model&&this.model.sharedItems!==null&&this.model.sharedItems.push(co(t,n));break}return!0}parseText(e){this.fieldGroupCollector.active&&this.fieldGroupCollector.feedText(e)}parseClose(e){if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedClose(e)&&(this.model&&(this.model.fieldGroupXml=this.fieldGroupCollector.result),this.fieldGroupCollector.reset()),!0;switch(e){case`cacheField`:return!1;case`sharedItems`:this.inSharedItems=!1;break}return!0}};function co(e,t){switch(e){case`s`:return t.v??``;case`n`:return t.v===void 0||t.v===``?null:parseFloat(t.v);case`b`:return t.v===`1`;case`e`:return new bt(t.v??``);case`m`:return null;case`d`:{if(!t.v)return null;let e=je(t.v);return isNaN(e.getTime())?null:e}default:return null}}let lo=new Set([`xmlns`,`xmlns:r`,`r:id`,`refreshOnLoad`,`createdVersion`,`refreshedVersion`,`minRefreshableVersion`,`recordCount`,`backgroundQuery`,`supportSubquery`,`supportAdvancedDrill`]);var uo=class e extends L{constructor(){super(),this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector=new io(`extLst`),this.unknownCollector=new io(``),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector=new io(``),this.cacheSourceXmlParts=[],this.model=null}get tag(){return`pivotCacheDefinition`}reset(){this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector.reset(),this.cacheSourceXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2).filter(Array.isArray).length;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:a}),t.openNode(`cacheSource`,{type:`worksheet`});let o=r.tableName?{name:r.tableName}:{ref:r.dimensions.shortRange,sheet:r.name};t.leafNode(`worksheetSource`,o),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(e.renderCacheFieldsXml(i)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,sourceTableName:o,recordCount:s}=n;t.openXml(F.StdDocAttributes);let c={...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":n.rId??`rId1`};if(n.refreshOnLoad&&(c.refreshOnLoad=n.refreshOnLoad),c.createdVersion=n.createdVersion??`8`,c.refreshedVersion=n.refreshedVersion??`8`,c.minRefreshableVersion=n.minRefreshableVersion??`3`,s!==void 0&&(c.recordCount=s),n.backgroundQuery&&(c.backgroundQuery=n.backgroundQuery),n.supportSubquery&&(c.supportSubquery=n.supportSubquery),n.supportAdvancedDrill&&(c.supportAdvancedDrill=n.supportAdvancedDrill),n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))c[e]=t;if(t.openNode(this.tag,c),t.openNode(`cacheSource`,{type:n.cacheSourceType??`worksheet`}),!n.cacheSourceType||n.cacheSourceType===`worksheet`){let e=o?{name:o}:{ref:i,sheet:a};n.worksheetSourceRId&&(e[`r:id`]=n.worksheetSourceRId),Object.values(e).some(e=>e!==void 0)&&t.leafNode(`worksheetSource`,e)}n.cacheSourceXml&&t.writeXml(n.cacheSourceXml),t.closeNode(),t.openNode(`cacheFields`,{count:r.length}),t.writeXml(e.renderCacheFieldsXml(r)),t.closeNode(),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml),n.extLstXml&&t.writeXml(n.extLstXml),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedOpen(t,n),!0;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))lo.has(t)||(e[t]=String(r));this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,backgroundQuery:n.backgroundQuery,supportSubquery:n.supportSubquery,supportAdvancedDrill:n.supportAdvancedDrill,extraRootAttrs:Object.keys(e).length>0?e:void 0,isLoaded:!0};break}case`cacheSource`:this.inCacheSource=!0,this.model&&(this.model.cacheSourceType=n.type);break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet,this.model.sourceTableName=n.name,n[`r:id`]&&(this.model.worksheetSourceRId=n[`r:id`]));break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new so,this.currentCacheField.parseOpen(e));break;case`extLst`:this.model&&this.extLstCollector.start(n);break;default:if(this.inCacheSource&&this.model){this.cacheSourceChildCollector.startAs(t,n);break}this.model&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){if(this.extLstCollector.active){this.extLstCollector.feedText(e);return}if(this.unknownCollector.active){this.unknownCollector.feedText(e);return}if(this.cacheSourceChildCollector.active){this.cacheSourceChildCollector.feedText(e);return}this.currentCacheField&&this.currentCacheField.parseText(e)}parseClose(e){if(this.extLstCollector.active)return this.extLstCollector.feedClose(e)&&(this.model&&(this.model.extLstXml=this.extLstCollector.result),this.extLstCollector.reset()),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedClose(e)&&(this.cacheSourceXmlParts.push(this.cacheSourceChildCollector.result),this.cacheSourceChildCollector.reset()),!0;if(this.currentCacheField)return this.currentCacheField.parseClose(e)||(this.model&&this.currentCacheField.model&&this.model.cacheFields.push(this.currentCacheField.model),this.currentCacheField=null),!0;switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`cacheSource`:this.inCacheSource=!1,this.model&&this.cacheSourceXmlParts.length>0&&(this.model.cacheSourceXml=this.cacheSourceXmlParts.join(``));break;case`cacheFields`:this.inCacheFields=!1;break}return!0}static renderCacheFieldsXml(e){return`
30
- `+e.map(e=>Za(e)).join(`
31
- `)}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`}}};let fo=`PivotStyleLight16`,po=new Set([`axisRow`,`axisCol`,`axisPage`,`axisValues`]),mo=[`x`,`t`,`h`,`sd`,`f`,`m`,`c`,`d`];function ho(){return{currentSection:null,inPivotArea:!1,inAutoSortScope:!1}}let go=new Set([`axis`,`dataField`,`compact`,`outline`,`showAll`,`defaultSubtotal`,`numFmtId`,`sortType`,`subtotalTop`,`insertBlankRow`,`multipleItemSelectionAllowed`]);var _o=class e extends L{constructor(){super(),this.state=ho(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector=new io(`extLst`),this.formatsCollector=new io(`formats`),this.conditionalFormatsCollector=new io(`conditionalFormats`),this.filtersCollector=new io(`filters`),this.unknownCollector=new io(``),this.unknownElementsXmlParts=[],this.model=null}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.state=ho(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector.reset(),this.formatsCollector.reset(),this.conditionalFormatsCollector.reset(),this.filtersCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,r){let{rows:i,columns:a,values:o,pages:s=[],cacheFields:c,cacheId:l,tableNumber:u,applyWidthHeightFormats:d}=r,f=a.length===0&&o.length>1,p=s.length,m=p>0?p+1:0,h=i.length,g=3+m,_=g+1,v=h+(f?o.length:1),y=`A${g}:${n.n2l(v)}${_}`;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,name:`PivotTable${u}`,cacheId:l,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:d,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`});let b={ref:y,firstHeaderRow:1,firstDataRow:1,firstDataCol:h};p>0&&(b.rowPageCount=p,b.colPageCount=1),t.leafNode(`location`,b),bo(t,r),t.openNode(`rowFields`,{count:i.length});for(let e of i)t.leafNode(`field`,{x:e});if(t.closeNode(),t.openNode(`rowItems`,{count:1}),t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode(),a.length>0){let e=o.length>1?a.length+1:a.length;t.openNode(`colFields`,{count:e});for(let e of a)t.leafNode(`field`,{x:e});o.length>1&&t.leafNode(`field`,{x:-2}),t.closeNode()}else f&&(t.openNode(`colFields`,{count:1}),t.leafNode(`field`,{x:-2}),t.closeNode());if(f){t.openNode(`colItems`,{count:o.length+1});for(let e=0;e<o.length;e++)t.openNode(`i`),t.leafNode(`x`,e===0?void 0:{v:e}),t.closeNode();t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode()}else t.openNode(`colItems`,{count:1}),t.leafNode(`i`),t.closeNode();if(p>0){t.openNode(`pageFields`,{count:p});for(let e of s)t.leafNode(`pageField`,{fld:e,hier:-1});t.closeNode()}yo(t,c,o,r.valueMetrics),t.leafNode(`pivotTableStyleInfo`,{name:fo,showRowHeaders:`1`,showColHeaders:`1`,showRowStripes:`0`,showColStripes:`0`,showLastColumn:`1`}),t.writeXml(e.EXTLST_XML),t.closeNode()}renderLoaded(t,n){let r=this.buildLoadedRootAttributes(n);if(t.openXml(F.StdDocAttributes),t.openNode(this.tag,r),n.location){let e={ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol};n.location.rowPageCount!==void 0&&(e.rowPageCount=n.location.rowPageCount),n.location.colPageCount!==void 0&&(e.colPageCount=n.location.colPageCount),t.leafNode(`location`,e)}if(n.pivotFields.length>0){t.openNode(`pivotFields`,{count:n.pivotFields.length});for(let e of n.pivotFields)this.renderPivotFieldLoaded(t,e);t.closeNode()}if(n.rowFields.length>0){t.openNode(`rowFields`,{count:n.rowFields.length});for(let e of n.rowFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.rowItems&&n.rowItems.length>0){t.openNode(`rowItems`,{count:n.rowItems.length});for(let e of n.rowItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasRowItems&&t.writeXml(`<rowItems count="1"><i t="grand"><x/></i></rowItems>`);if(n.hasColFields||n.colFields.length>0)if(n.colFields.length===0&&n.dataFields.length<=1)t.leafNode(`colFields`,{count:0});else{let e=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:e}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.colItems&&n.colItems.length>0){t.openNode(`colItems`,{count:n.colItems.length});for(let e of n.colItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasColItems&&t.writeXml(`<colItems count="1"><i t="grand"><x/></i></colItems>`);if(n.pageFields&&n.pageFields.length>0){t.openNode(`pageFields`,{count:n.pageFields.length});for(let e of n.pageFields){let n={fld:e.fld};e.item!==void 0&&(n.item=e.item),e.hier!==void 0&&(n.hier=e.hier),e.name!==void 0&&(n.name=e.name),t.leafNode(`pageField`,n)}t.closeNode()}if(n.dataFields.length>0){t.openNode(`dataFields`,{count:n.dataFields.length});for(let e of n.dataFields){let n={name:e.name,fld:e.fld};e.baseField!==void 0&&(n.baseField=e.baseField),e.baseItem!==void 0&&(n.baseItem=e.baseItem),e.subtotal!==void 0&&e.subtotal!==`sum`&&(n.subtotal=e.subtotal),e.numFmtId!==void 0&&(n.numFmtId=e.numFmtId),t.leafNode(`dataField`,n)}t.closeNode()}n.formatsXml&&t.writeXml(n.formatsXml),n.conditionalFormatsXml&&t.writeXml(n.conditionalFormatsXml),n.chartFormats&&n.chartFormats.length>0&&this.renderChartFormats(t,n.chartFormats);let i=n.styleInfo;t.leafNode(`pivotTableStyleInfo`,{name:i?.name??n.styleName??fo,showRowHeaders:i?.showRowHeaders??`1`,showColHeaders:i?.showColHeaders??`1`,showRowStripes:i?.showRowStripes??`0`,showColStripes:i?.showColStripes??`0`,showLastColumn:i?.showLastColumn??`1`}),n.filtersXml&&t.writeXml(n.filtersXml),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml);let a=n.extLstXml??(n.isLoaded?``:e.EXTLST_XML);a&&t.writeXml(a),t.closeNode()}buildLoadedRootAttributes(t){let n={...e.PIVOT_TABLE_ATTRIBUTES,name:t.name??`PivotTable1`,cacheId:String(t.cacheId),applyNumberFormats:t.applyNumberFormats??`0`,applyBorderFormats:t.applyBorderFormats??`0`,applyFontFormats:t.applyFontFormats??`0`,applyPatternFormats:t.applyPatternFormats??`0`,applyAlignmentFormats:t.applyAlignmentFormats??`0`,applyWidthHeightFormats:t.applyWidthHeightFormats??`0`,dataCaption:t.dataCaption??`Values`,updatedVersion:t.updatedVersion??`8`,minRefreshableVersion:t.minRefreshableVersion??`3`};return t.useAutoFormatting!==void 0&&(n.useAutoFormatting=t.useAutoFormatting),t.itemPrintTitles!==void 0&&(n.itemPrintTitles=t.itemPrintTitles),t.multipleFieldFilters!==void 0&&(n.multipleFieldFilters=t.multipleFieldFilters),n.createdVersion=t.createdVersion??`8`,t.indent!==void 0&&(n.indent=String(t.indent)),t.uid&&(n[`xmlns:xr`]=`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,n[`xr:uid`]=t.uid),t.outline&&(n.outline=`1`),t.outlineData&&(n.outlineData=`1`),t.chartFormat!==void 0&&(n.chartFormat=String(t.chartFormat)),t.colGrandTotals!==void 0&&(n.colGrandTotals=t.colGrandTotals),t.rowGrandTotals!==void 0&&(n.rowGrandTotals=t.rowGrandTotals),t.showError!==void 0&&(n.showError=t.showError),t.errorCaption!==void 0&&(n.errorCaption=t.errorCaption),t.showMissing!==void 0&&(n.showMissing=t.showMissing),t.missingCaption!==void 0&&(n.missingCaption=t.missingCaption),t.grandTotalCaption!==void 0&&(n.grandTotalCaption=t.grandTotalCaption),t.compact===!1&&(n.compact=`0`),t.compactData===!1&&(n.compactData=`0`),n}renderChartFormats(e,t){e.openNode(`chartFormats`,{count:t.length});for(let n of t)e.openNode(`chartFormat`,{chart:n.chart,format:n.format,series:n.series===!0?`1`:n.series===!1?`0`:void 0}),n.pivotAreaXml?e.writeXml(n.pivotAreaXml):e.writeXml(`<pivotArea type="data" outline="0" fieldPosition="0"><references count="1"><reference field="4294967294" count="1" selected="0"><x v="0"/></reference></references></pivotArea>`),e.closeNode();e.closeNode()}renderRowColItem(e,t){let n={};if(t.t!==void 0&&(n.t=t.t),t.r!==void 0&&(n.r=t.r),t.i!==void 0&&(n.i=t.i),t.x.length>0){e.openNode(`i`,n);for(let n of t.x)n.v===0?e.leafNode(`x`):e.leafNode(`x`,{v:n.v});e.closeNode()}else e.leafNode(`i`,n)}renderPivotFieldLoaded(e,t){let n={};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.numFmtId!==void 0&&(n.numFmtId=String(t.numFmtId)),t.sortType&&(n.sortType=t.sortType),t.compact===!1&&(n.compact=`0`),t.outline===!1&&(n.outline=`0`),n.showAll=t.showAll?`1`:`0`,t.defaultSubtotal===!1&&(n.defaultSubtotal=`0`),t.subtotalTop===!1&&(n.subtotalTop=`0`),t.insertBlankRow===!0&&(n.insertBlankRow=`1`),t.multipleItemSelectionAllowed===!0&&(n.multipleItemSelectionAllowed=`1`),t.extraAttrs)for(let[e,r]of Object.entries(t.extraAttrs))n[e]=r;if(t.items!==void 0&&t.items.length>0||t.autoSortScopeXml!==void 0){if(e.openNode(`pivotField`,n),t.items!==void 0&&t.items.length>0){e.openNode(`items`,{count:t.items.length});for(let n of t.items){let t={};for(let e of mo)n[e]!==void 0&&(t[e]=n[e]);e.leafNode(`item`,t)}e.closeNode()}t.autoSortScopeXml&&e.writeXml(t.autoSortScopeXml),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.formatsCollector.active)return this.formatsCollector.feedOpen(t,n),!0;if(this.conditionalFormatsCollector.active)return this.conditionalFormatsCollector.feedOpen(t,n),!0;if(this.filtersCollector.active)return this.filtersCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId??`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],pageFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting,itemPrintTitles:n.itemPrintTitles,indent:n.indent===void 0?void 0:parseInt(n.indent,10),compact:n.compact!==`0`,compactData:n.compactData!==`0`,multipleFieldFilters:n.multipleFieldFilters,outline:n.outline===`1`,outlineData:n.outlineData===`1`,chartFormat:n.chartFormat===void 0?void 0:parseInt(n.chartFormat,10),colGrandTotals:n.colGrandTotals,rowGrandTotals:n.rowGrandTotals,showError:n.showError,errorCaption:n.errorCaption,showMissing:n.showMissing,missingCaption:n.missingCaption,grandTotalCaption:n.grandTotalCaption,rowItems:[],colItems:[],chartFormats:[],isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow===void 0?void 0:parseInt(n.firstHeaderRow,10),firstDataRow:n.firstDataRow===void 0?void 0:parseInt(n.firstDataRow,10),firstDataCol:n.firstDataCol===void 0?void 0:parseInt(n.firstDataCol,10),rowPageCount:n.rowPageCount===void 0?void 0:parseInt(n.rowPageCount,10),colPageCount:n.colPageCount===void 0?void 0:parseInt(n.colPageCount,10)});break;case`pivotFields`:this.state.currentSection=`pivotFields`;break;case`pivotField`:if(this.state.currentSection===`pivotFields`){let e={};for(let[t,r]of Object.entries(n))go.has(t)||(e[t]=String(r));this.currentPivotField={axis:po.has(n.axis)?n.axis:void 0,dataField:n.dataField===`1`,items:[],compact:n.compact!==`0`,outline:n.outline!==`0`,showAll:n.showAll!==`0`,defaultSubtotal:n.defaultSubtotal!==`0`,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10),sortType:n.sortType,subtotalTop:n.subtotalTop===void 0?void 0:n.subtotalTop===`1`,insertBlankRow:n.insertBlankRow===`1`?!0:void 0,multipleItemSelectionAllowed:n.multipleItemSelectionAllowed===`1`?!0:void 0,extraAttrs:Object.keys(e).length>0?e:void 0}}break;case`items`:break;case`item`:if(this.currentPivotField){let e={};n.x!==void 0&&(e.x=parseInt(n.x,10));for(let t of mo)t!==`x`&&n[t]!==void 0&&(e[t]=n[t]);this.currentPivotField.items.push(e)}break;case`autoSortScope`:this.currentPivotField&&(this.state.inAutoSortScope=!0,this.autoSortScopeXmlBuffer=[`<autoSortScope>`]);break;case`rowFields`:this.state.currentSection=`rowFields`;break;case`colFields`:this.state.currentSection=`colFields`,this.model&&(this.model.hasColFields=!0);break;case`dataFields`:this.state.currentSection=`dataFields`;break;case`pageFields`:this.state.currentSection=`pageFields`;break;case`pageField`:this.state.currentSection===`pageFields`&&this.model&&this.model.pageFields.push({fld:parseInt(n.fld??`0`,10),item:n.item===void 0?void 0:parseInt(n.item,10),hier:n.hier===void 0?void 0:parseInt(n.hier,10),name:n.name});break;case`rowItems`:this.state.currentSection=`rowItems`,this.model&&(this.model.hasRowItems=!0);break;case`colItems`:this.state.currentSection=`colItems`,this.model&&(this.model.hasColItems=!0);break;case`i`:if(this.model){let e=this.state.currentSection===`rowItems`||this.state.currentSection===`colItems`?vo(n):null;this.state.currentSection===`rowItems`?this.currentRowItem=e:this.state.currentSection===`colItems`&&(this.currentColItem=e)}break;case`x`:if(this.state.inPivotArea){let e=ao(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(e?`<x ${e}/>`:`<x/>`):this.pivotAreaXmlBuffer.push(e?`<x ${e}/>`:`<x/>`)}else this.currentRowItem?this.currentRowItem.x.push({v:parseInt(n.v??`0`,10)}):this.currentColItem&&this.currentColItem.x.push({v:parseInt(n.v??`0`,10)});break;case`chartFormats`:this.state.currentSection=`chartFormats`;break;case`chartFormat`:this.state.currentSection===`chartFormats`&&this.model&&(this.currentChartFormat={chart:parseInt(n.chart??`0`,10),format:parseInt(n.format??`0`,10),series:n.series===void 0?void 0:n.series===`1`});break;case`pivotArea`:if(this.currentChartFormat){this.state.inPivotArea=!0;let e=ao(n);this.pivotAreaXmlBuffer=[e?`<pivotArea ${e}>`:`<pivotArea>`]}else if(this.state.inAutoSortScope){this.state.inPivotArea=!0;let e=ao(n);this.autoSortScopeXmlBuffer.push(e?`<pivotArea ${e}>`:`<pivotArea>`)}break;case`references`:case`reference`:if(this.state.inPivotArea){let e=ao(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`<${t}${e?` `+e:``}>`):this.pivotAreaXmlBuffer.push(`<${t}${e?` `+e:``}>`)}break;case`field`:if(this.model){let e=parseInt(n.x??`0`,10);this.state.currentSection===`rowFields`?this.model.rowFields.push(e):this.state.currentSection===`colFields`&&this.model.colFields.push(e)}break;case`dataField`:this.state.currentSection===`dataFields`&&this.model&&this.model.dataFields.push({name:n.name??``,fld:parseInt(n.fld??`0`,10),baseField:n.baseField===void 0?void 0:parseInt(n.baseField,10),baseItem:n.baseItem===void 0?void 0:parseInt(n.baseItem,10),subtotal:St.has(n.subtotal)?n.subtotal:void 0,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10)});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name,this.model.styleInfo={name:n.name,showRowHeaders:n.showRowHeaders,showColHeaders:n.showColHeaders,showRowStripes:n.showRowStripes,showColStripes:n.showColStripes,showLastColumn:n.showLastColumn});break;case`extLst`:this.model&&this.extLstCollector.start(n);break;case`formats`:this.model&&this.formatsCollector.start(n);break;case`conditionalFormats`:this.model&&this.conditionalFormatsCollector.start(n);break;case`filters`:this.model&&this.filtersCollector.start(n);break;default:this.model&&this.state.currentSection===null&&!this.state.inPivotArea&&!this.state.inAutoSortScope&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){this.extLstCollector.active?this.extLstCollector.feedText(e):this.formatsCollector.active?this.formatsCollector.feedText(e):this.conditionalFormatsCollector.active?this.conditionalFormatsCollector.feedText(e):this.filtersCollector.active?this.filtersCollector.feedText(e):this.unknownCollector.active&&this.unknownCollector.feedText(e)}tryCloseCollector(e,t,n){e.feedClose(t)&&(this.model&&(this.model[n]=e.result),e.reset())}parseClose(e){if(this.extLstCollector.active)return this.tryCloseCollector(this.extLstCollector,e,`extLstXml`),!0;if(this.formatsCollector.active)return this.tryCloseCollector(this.formatsCollector,e,`formatsXml`),!0;if(this.conditionalFormatsCollector.active)return this.tryCloseCollector(this.conditionalFormatsCollector,e,`conditionalFormatsXml`),!0;if(this.filtersCollector.active)return this.tryCloseCollector(this.filtersCollector,e,`filtersXml`),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.state.inPivotArea)return e===`pivotArea`?(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</pivotArea>`):(this.pivotAreaXmlBuffer.push(`</pivotArea>`),this.currentChartFormat&&(this.currentChartFormat.pivotAreaXml=this.pivotAreaXmlBuffer.join(``)),this.pivotAreaXmlBuffer=[]),this.state.inPivotArea=!1,!0):((e===`references`||e===`reference`)&&(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</${e}>`):this.pivotAreaXmlBuffer.push(`</${e}>`)),!0);switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`pivotFields`:case`rowFields`:case`colFields`:case`dataFields`:case`pageFields`:case`rowItems`:case`colItems`:case`chartFormats`:this.state.currentSection=null;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:break;case`autoSortScope`:this.state.inAutoSortScope&&this.currentPivotField&&(this.autoSortScopeXmlBuffer.push(`</autoSortScope>`),this.currentPivotField.autoSortScopeXml=this.autoSortScopeXmlBuffer.join(``),this.autoSortScopeXmlBuffer=[],this.state.inAutoSortScope=!1);break;case`i`:this.currentRowItem&&this.model?(this.model.rowItems?.push(this.currentRowItem),this.currentRowItem=null):this.currentColItem&&this.model&&(this.model.colItems?.push(this.currentColItem),this.currentColItem=null);break;case`chartFormat`:this.currentChartFormat&&this.model&&(this.model.chartFormats?.push(this.currentChartFormat),this.currentChartFormat=null);break}return!0}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}static{this.EXTLST_XML=`<extLst><ext uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:pivotTableDefinition hideValuesRow="1" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"/></ext><ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}" xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout"><xpdl:pivotTableDefinition16 EnabledSubtotalsDefault="0" SubtotalsOnTopDefault="0"/></ext></extLst>`}};function vo(e){return{t:e.t,r:e.r===void 0?void 0:parseInt(e.r,10),i:e.i===void 0?void 0:parseInt(e.i,10),x:[]}}function yo(e,t,n,r){e.openNode(`dataFields`,{count:n.length});for(let i=0;i<n.length;i++){let a=n[i],o=r[i]??`sum`,s=xt[o],c=t[a];if(!c)throw Error(`Value field index ${a} is out of bounds (cacheFields has ${t.length} entries)`);let l={name:`${s} of ${c.name}`,fld:a,baseField:0,baseItem:0};o!==`sum`&&(l.subtotal=o),e.leafNode(`dataField`,l)}e.closeNode()}function bo(e,t){let n=new Set(t.rows),r=new Set(t.columns),i=new Set(t.values),a=new Set(t.pages??[]);e.openNode(`pivotFields`,{count:t.cacheFields.length});for(let o=0;o<t.cacheFields.length;o++){let s=t.cacheFields[o];xo(e,n.has(o),r.has(o),i.has(o),a.has(o),s.sharedItems)}e.closeNode()}function xo(e,t,n,r,i,a){if(t||n||i){if(!a)throw Error(`sharedItems is required for axis field (row/column/page)`);let i={axis:t?`axisRow`:n?`axisCol`:`axisPage`};r&&(i.dataField=`1`),i.compact=`0`,i.outline=`0`,i.showAll=`0`,e.openNode(`pivotField`,i),e.openNode(`items`,{count:a.length+1});for(let t=0;t<a.length;t++)e.leafNode(`item`,{x:t});e.leafNode(`item`,{t:`default`}),e.closeNode(),e.closeNode();return}let o={};r&&(o.dataField=`1`),o.compact=`0`,o.outline=`0`,o.showAll=`0`,o.defaultSubtotal=`0`,e.leafNode(`pivotField`,o)}var So=class extends L{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new jn,this._richTextXform}render(e,t){let n=t||this.model;e.openNode(`comment`,{ref:n.ref,authorId:0}),e.openNode(`text`),n&&n.note&&n.note.texts&&n.note.texts.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`comment`:return this.model={type:`note`,note:{texts:[]},...e.attributes},!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`comment`:return!1;case`r`:return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}},Co=class e extends L{constructor(){super(),this.map={comment:new So},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(`comments`,e.COMMENTS_ATTRIBUTES),t.openNode(`authors`),t.leafNode(`author`,null,`Author`),t.closeNode(),t.openNode(`commentList`),r.comments.forEach(e=>{this.map.comment.render(t,e)}),t.closeNode(),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`commentList`:return this.model={comments:[]},!0;case`comment`:return this.parser=this.map.comment,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`commentList`:return!1;case`comment`:return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.COMMENTS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}},wo=class extends L{constructor(){super(),this.model={}}get tag(){return`v:textbox`}conversionUnit(e,t,n){return`${(parseFloat(e.toString())*t).toFixed(2)}${n}`}reverseConversionUnit(e){return(e??``).split(`,`).map(e=>Number(parseFloat(this.conversionUnit(parseFloat(e),.1,``)).toFixed(2)))}render(e,t){let n={style:`mso-direction-alt:auto`};if(t&&t.note){let{inset:e}=t.note&&t.note.margins||{};Array.isArray(e)&&(e=e.map(e=>this.conversionUnit(e,10,`mm`)).join(`,`)),e&&(n.inset=e)}e.openNode(`v:textbox`,n),e.leafNode(`div`,{style:`text-align:left`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return this.model={inset:this.reverseConversionUnit(e.attributes.inset)},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},To=class extends L{constructor(){super(),this.text=``}get tag(){return`x:Anchor`}getAnchorRect(e){let t=Math.floor(e.left),n=Math.floor((e.left-t)*68),r=Math.floor(e.top),i=Math.floor((e.top-r)*18),a=Math.floor(e.right),o=Math.floor((e.right-a)*68),s=Math.floor(e.bottom);return[t,n,r,i,a,o,s,Math.floor((e.bottom-s)*18)]}getDefaultRect(e){let t=e.col,n=Math.max(e.row-2,0);return[t,6,n,14,t+2,2,n+4,16]}render(e,t){let n=t.anchor?this.getAnchorRect(t.anchor):this.getDefaultRect(t.refAddress);e.leafNode(`x:Anchor`,null,n.join(`, `))}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},Eo=class extends L{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model?.tag??``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},Do=class extends L{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model?.tag??``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};let Oo=[`twoCells`,`oneCells`,`absolute`];var ko=class extends L{constructor(){super(),this.map={"x:Anchor":new To,"x:Locked":new Eo({tag:`x:Locked`}),"x:LockText":new Eo({tag:`x:LockText`}),"x:SizeWithCells":new Do({tag:`x:SizeWithCells`}),"x:MoveWithCells":new Do({tag:`x:MoveWithCells`})},this.model={anchor:[],protection:{},editAs:``}}get tag(){return`x:ClientData`}render(e,t){let{protection:n,editAs:r}=t.note;e.openNode(this.tag,{ObjectType:`Note`}),this.map[`x:MoveWithCells`].render(e,r,Oo),this.map[`x:SizeWithCells`].render(e,r,Oo),this.map[`x:Anchor`].render(e,t),this.map[`x:Locked`].render(e,n.locked),e.leafNode(`x:AutoFill`,null,`False`),this.map[`x:LockText`].render(e,n.lockText),e.leafNode(`x:Row`,null,t.refAddress.row-1),e.leafNode(`x:Column`,null,t.refAddress.col-1),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:this.reset(),this.model={anchor:[],protection:{},editAs:``};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.normalizeModel(),!1;default:return!0}}normalizeModel(){let e=Object.assign({},this.map[`x:MoveWithCells`].model,this.map[`x:SizeWithCells`].model),t=Object.keys(e).length;this.model.editAs=Oo[t],this.model.anchor=this.map[`x:Anchor`].text,this.model.protection.locked=this.map[`x:Locked`].text,this.model.protection.lockText=this.map[`x:LockText`].text}},Ao=class e extends L{constructor(){super(),this.map={"v:textbox":new wo,"x:ClientData":new ko}}get tag(){return`v:shape`}render(t,n,r){t.openNode(`v:shape`,e.V_SHAPE_ATTRIBUTES(n,r??0)),t.leafNode(`v:fill`,{color2:`infoBackground [80]`}),t.leafNode(`v:shadow`,{color:`none [81]`,obscured:`t`}),t.leafNode(`v:path`,{"o:connecttype":`none`}),this.map[`v:textbox`].render(t,n),this.map[`x:ClientData`].render(t,n),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={margins:{insetmode:e.attributes[`o:insetmode`]},anchor:``,editAs:``,protection:{}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.margins.inset=this.map[`v:textbox`].model&&this.map[`v:textbox`].model.inset,this.model.protection=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.protection,this.model.anchor=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.anchor,this.model.editAs=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.editAs,!1;default:return!0}}static{this.V_SHAPE_ATTRIBUTES=(e,t)=>({id:`_x0000_s${1025+t}`,type:`#_x0000_t202`,style:`position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden`,fillcolor:`infoBackground [80]`,strokecolor:`none [81]`,"o:insetmode":e.note.margins&&e.note.margins.insetmode})}},jo=class e extends L{constructor(){super(),this.map={"v:shape":new Ao},this.model={comments:[],formControls:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model,i=r.comments&&r.comments.length>0,a=r.formControls&&r.formControls.length>0;if(t.openXml(F.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),i&&(t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode()),a&&(t.openNode(`v:shapetype`,{id:`_x0000_t201`,coordsize:`21600,21600`,"o:spt":`201`,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{shadowok:`f`,"o:extrusionok":`f`,strokeok:`f`,fillok:`f`,"o:connecttype":`rect`}),t.leafNode(`o:lock`,{"v:ext":`edit`,shapetype:`t`}),t.closeNode()),i){let e=r.comments;for(let n=0;n<e.length;n++)this.map[`v:shape`].render(t,e[n],n)}if(a)for(let e of r.formControls)this._renderCheckboxShape(t,e);t.closeNode()}_renderCheckboxShape(e,t){let n={id:`_x0000_s${t.shapeId}`,type:`#_x0000_t201`,style:Ee.getVmlStyle(t),"o:insetmode":`auto`,fillcolor:`buttonFace [67]`,strokecolor:`windowText [64]`,"o:preferrelative":`t`,filled:`f`,stroked:`f`};e.openNode(`v:shape`,n),e.leafNode(`v:fill`,{"o:detectmouseclick":`t`}),e.leafNode(`o:lock`,{"v:ext":`edit`,text:`t`}),t.text&&(e.openNode(`v:textbox`,{style:`mso-direction-alt:auto`,"o:singleclick":`t`}),e.openNode(`div`,{style:`text-align:left`}),e.openNode(`font`,{face:`Tahoma`,size:`160`,color:`auto`}),e.writeText(t.text),e.closeNode(),e.closeNode(),e.closeNode()),e.openNode(`x:ClientData`,{ObjectType:`Checkbox`}),e.leafNode(`x:MoveWithCells`),e.leafNode(`x:SizeWithCells`),e.openNode(`x:Anchor`),e.writeText(Ee.getVmlAnchor(t)),e.closeNode(),e.leafNode(`x:Locked`,void 0,`False`),e.leafNode(`x:LockText`,void 0,`True`),e.leafNode(`x:PrintObject`,void 0,t.print?`True`:`False`),e.leafNode(`x:AutoFill`,void 0,`False`),e.leafNode(`x:AutoLine`,void 0,`False`),e.leafNode(`x:TextHAlign`,void 0,`Left`),e.leafNode(`x:TextVAlign`,void 0,`Center`),t.link&&e.leafNode(`x:FmlaLink`,void 0,t.link),t.noThreeD&&e.leafNode(`x:NoThreeD`),e.leafNode(`x:Checked`,void 0,String(Ee.getVmlCheckedValue(t))),e.leafNode(`x:Row`,void 0,String(t.tl.row)),e.leafNode(`x:Column`,void 0,String(t.tl.col)),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[],formControls:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},Mo=class extends L{_checkedToXmlValue(e){switch(e){case`Checked`:return`1`;case`Mixed`:return`2`;default:return`0`}}get tag(){return`formControlPr`}render(e,t){let n=t||this.model,r={xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,objectType:`CheckBox`,checked:this._checkedToXmlValue(n.checked),lockText:`1`};n.link&&(r.fmlaLink=n.link),n.noThreeD&&(r.noThreeD=`1`),e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.leafNode(this.tag,r)}toXml(e){let t=new F;return this.render(t,e),t.xml}parseOpen(){return!0}parseText(){}parseClose(){return!1}};let No=`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
32
- <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <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:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`,Po=new TextEncoder;var Fo=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||=this._buf.slice(0,this._inPos),this._buffer}reset(e){e??=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=Po.encode(e),n=this._inPos+t.length;n>this._buf.length-4&&this._grow(n),this._buf.set(t,this._inPos),this._inPos+=t.length}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}},Io=class{constructor(e){this._data=e}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=new TextEncoder().encode(this._data),this._buffer}},Lo=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Ro=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},zo=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.slice(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.slice(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,t+r),this.iWrite+=r,r}},Bo=class extends M{constructor(e){super(),this._writableStream=null,this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),this.bufSize=e?.bufSize||1024*1024,this.buffers=[],this.batch=e?.batch??!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this._ended=!1}get writable(){return!this._ended}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new zo(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){typeof t==`function`&&(n=t),n||=()=>{};let r;if(e instanceof Fo||e&&e.constructor?.name===`StringBuf`)r=new Lo(e);else if(e instanceof Uint8Array)r=new Ro(e);else if(ArrayBuffer.isView(e))r=new Ro(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Ro(new Uint8Array(e));else if(typeof e==`string`)r=new Io(e);else throw Error(`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;){let e=this.buffers.shift();await this._pipeChunk(new Ro(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer(),t=!1;!this.paused&&this.listenerCount(`data`)>0&&(this.emit(`data`,e),t=!0),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e)),t=!0),t||(this._writeToBuffers(r),this.emit(`readable`))}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Ro(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`)}).catch(e=>{this.emit(`error`,e)}):this.emit(`finish`)};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return Vo(t)}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],Vo(t)}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return typeof Buffer<`u`&&n instanceof Buffer?n.toString(t):new TextDecoder(t).decode(n)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}pipeTo(e){this._writableStream=e,this._writableStreamWriter=e.getWriter()}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw Error(`Not Implemented`)}wrap(){throw Error(`Not Implemented`)}push(e){return e!==null&&this.write(e),!0}};function Vo(e){if(typeof Buffer<`u`&&typeof Buffer.concat==`function`)return Buffer.concat(e);if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let Ho=null;function Uo(){if(Ho)return Ho;let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return Ho=e,e}function Wo(e,t){let n=Uo();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function Go(e){return(e^4294967295)>>>0}function Ko(e){return Go(Wo(4294967295,e))}function qo(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}function Jo(e){let t=e.length;if(t===0)return new Uint8Array;if(t===1)return e[0];let n=qo(e),r=new Uint8Array(n),i=0;for(let n=0;n<t;n++){let t=e[n];r.set(t,i),i+=t.length}return r}function Yo(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}let Xo=new Uint8Array(288);for(let e=0;e<=143;e++)Xo[e]=8;for(let e=144;e<=255;e++)Xo[e]=9;for(let e=256;e<=279;e++)Xo[e]=7;for(let e=280;e<=287;e++)Xo[e]=8;let Zo=new Uint8Array(32).fill(5),Qo=[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],$o=[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],es=[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],ts=[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],ns=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function rs(e,t){let n=new Uint16Array(16);for(let r=0;r<t;r++)e[r]>0&&n[e[r]]++;let r=new Uint16Array(16),i=0;for(let e=1;e<=15;e++)i=i+n[e-1]<<1,r[e]=i;let a={};for(let n=0;n<t;n++){let t=e[n];if(t===0)continue;i=r[t]++;let o=a;for(let e=t-1;e>=0;e--)i>>e&1?(o.right||={},o=o.right):(o.left||={},o=o.left);o.symbol=n}return a}var is=class{constructor(e){this.data=e,this.pos=0,this.bitBuf=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.pos>=this.data.length)throw Error(`Unexpected end of DEFLATE data`);this.bitBuf|=this.data[this.pos++]<<this.bitCount,this.bitCount+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>=e,this.bitCount-=e,t}decodeSymbol(e){let t=e;for(;t.symbol===void 0;)if(t=this.readBits(1)===0?t.left:t.right,!t)throw Error(`Invalid Huffman code`);return t.symbol}alignToByte(){this.bitBuf=0,this.bitCount=0}readByte(){if(this.pos>=this.data.length)throw Error(`Unexpected end of data`);return this.data[this.pos++]}readUint16(){return this.readByte()|this.readByte()<<8}};function as(e){let t=new is(e),n=[],r=!1;for(;!r;){r=t.readBits(1)===1;let e=t.readBits(2);if(e===0){t.alignToByte();let e=t.readUint16();if((e^t.readUint16())!==65535)throw Error(`Invalid stored block length`);for(let r=0;r<e;r++)n.push(t.readByte())}else if(e===1||e===2){let r,i;if(e===1)r=rs(Xo,288),i=rs(Zo,32);else{let e=t.readBits(5)+257,n=t.readBits(5)+1,a=t.readBits(4)+4,o=new Uint8Array(19);for(let e=0;e<a;e++)o[ns[e]]=t.readBits(3);let s=rs(o,19),c=new Uint8Array(e+n),l=0;for(;l<e+n;){let e=t.decodeSymbol(s);if(e<16)c[l++]=e;else if(e===16){let e=t.readBits(2)+3,n=c[l-1];for(let t=0;t<e;t++)c[l++]=n}else if(e===17){let e=t.readBits(3)+3;for(let t=0;t<e;t++)c[l++]=0}else if(e===18){let e=t.readBits(7)+11;for(let t=0;t<e;t++)c[l++]=0}}r=rs(c.subarray(0,e),e),i=rs(c.subarray(e),n)}for(;;){let e=t.decodeSymbol(r);if(e<256)n.push(e);else if(e===256)break;else{let r=e-257,a=Qo[r]+t.readBits($o[r]),o=t.decodeSymbol(i),s=es[o]+t.readBits(ts[o]),c=n.length-s;for(let e=0;e<a;e++)n.push(n[c+e])}}}else throw Error(`Invalid DEFLATE block type: `+e)}return new Uint8Array(n)}function os(e){let t=65535,n=Math.ceil(e.length/t)||1,r=n*5+e.length,i=new Uint8Array(r),a=0,o=0;for(let r=0;r<n;r++){let s=r===n-1,c=Math.min(t,e.length-o);i[a++]=s?1:0,i[a++]=c&255,i[a++]=c>>8&255,i[a++]=~c&255,i[a++]=~c>>8&255,i.set(e.subarray(o,o+c),a),a+=c,o+=c}return i.subarray(0,a)}function ss(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return os(e);let t=new cs;t.writeBits(1,1),t.writeBits(1,2);let n=new Map,r=0;for(;r<e.length;){let i=0,a=0;if(r+2<e.length){let t=e[r]<<16|e[r+1]<<8|e[r+2],o=n.get(t);if(o!==void 0&&r-o<=32768){let t=r-o,n=0,s=Math.min(258,e.length-r);for(;n<s&&e[o+n]===e[r+n];)n++;n>=3&&(i=n,a=t)}n.set(t,r)}i>=3?(fs(t,i),ps(t,a),r+=i):(ds(t,e[r]),r++)}return ds(t,256),t.finish()}var cs=class{constructor(){this.chunks=[],this.buffer=[],this.bitBuf=0,this.bitCount=0}writeBits(e,t){for(this.bitBuf|=e<<this.bitCount,this.bitCount+=t;this.bitCount>=8;)this.buffer.push(this.bitBuf&255),this.bitBuf>>=8,this.bitCount-=8,this.buffer.length>=65536&&(this.chunks.push(new Uint8Array(this.buffer)),this.buffer=[])}writeBitsReverse(e,t){let n=0;for(let r=0;r<t;r++)n=n<<1|e>>r&1;this.writeBits(n,t)}finish(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),Jo(this.chunks))}};let ls=[],us=[];for(let e=0;e<=287;e++){let t,n;e<=143?(t=48+e,n=8):e<=255?(t=400+(e-144),n=9):e<=279?(t=e-256,n=7):(t=192+(e-280),n=8),ls[e]=[t,n],us[e]=n}function ds(e,t){let[n,r]=ls[t];e.writeBitsReverse(n,r)}function fs(e,t){let n,r,i;if(t<=10)n=257+t-3,r=0,i=0;else if(t<=18){let e=t-11;n=265+Math.floor(e/2),r=1,i=e%2}else if(t<=34){let e=t-19;n=269+Math.floor(e/4),r=2,i=e%4}else if(t<=66){let e=t-35;n=273+Math.floor(e/8),r=3,i=e%8}else if(t<=130){let e=t-67;n=277+Math.floor(e/16),r=4,i=e%16}else if(t<=257){let e=t-131;n=281+Math.floor(e/32),r=5,i=e%32}else n=285,r=0,i=0;ds(e,n),r>0&&e.writeBits(i,r)}function ps(e,t){let n=[[1,0,0],[2,1,0],[3,2,0],[4,3,0],[6,4,1],[8,5,1],[12,6,2],[16,7,2],[24,8,3],[32,9,3],[48,10,4],[64,11,4],[96,12,5],[128,13,5],[192,14,6],[256,15,6],[384,16,7],[512,17,7],[768,18,8],[1024,19,8],[1536,20,9],[2048,21,9],[3072,22,10],[4096,23,10],[6144,24,11],[8192,25,11],[12288,26,12],[16384,27,12],[24576,28,13],[32768,29,13]],r=0,i=0,a=1;for(let[e,o,s]of n){if(t<=e){r=o,i=s;break}a=e+1}let o=t-a;e.writeBitsReverse(r,5),i>0&&e.writeBits(o,i)}var ms=class e{static{this.EMPTY=new Uint8Array}constructor(e){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return e.EMPTY;if(this._chunks.length===1)return this._chunks[0].subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let t=new Uint8Array(this._length),n=0;for(let e=0;e<this._chunks.length;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=e===this._chunks.length-1?i+(this._length-n):r.length;if(t.set(r.subarray(i,a),n),n+=a-i,n>=t.length)break}return this._cachedView=t,this._cachedLength=this._length,t}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return new Uint8Array;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._chunks.length===1){let t=this._chunks[0],n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._headOffset=0):this._headOffset>=t.length&&(this._chunks.shift(),this._headOffset=0),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._chunks[0],i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}return this._length===0&&(this._chunks=[],this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._chunks.length===1){let t=this._chunks[0],n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=0;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._chunks[0],n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}this._length===0&&(this._chunks=[],this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._chunks.length===1){let t=this._chunks[0],a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):Yo(o,e,i)}if(n>4)return Yo(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},d=0;for(let e=0;e<l.length;e++){let t=l[e],f=e===0?this._headOffset:0,p=t.length-f;if(p<=0)continue;let m=d,h=m+p,g=i<=m?f:i>=h?t.length:f+(i-m);if(g>t.length-1){d+=p;continue}let _=t.length-1,v=t.indexOf(a,g);for(;v!==-1&&v<=_;){let i=m+(v-f);if(i>r-n)return-1;if(n===1)return i;if(v+n<=t.length){if(t[v+1]!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;if(t[v+2]!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;if(t[v+3]!==c){v=t.indexOf(a,v+1);continue}return i}let l=u(e,v+1);if(l===null||l!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;let d=u(e,v+2);if(d===null||d!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;let p=u(e,v+3);if(p===null||p!==c){v=t.indexOf(a,v+1);continue}return i}d+=p}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=0;e<n.length;e++){let t=n[e],i=e===0?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=0;e<this._chunks.length;e++){let t=this._chunks[e],r=e===0?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function hs(){return typeof CompressionStream<`u`}function gs(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function _s(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let vs=null,ys=null;function bs(){return typeof CompressionStream>`u`?!1:(vs===null&&(vs=gs()),vs)}function xs(){return typeof DecompressionStream>`u`?!1:(ys===null&&(ys=_s()),ys)}function Ss(){return bs()&&xs()}async function Cs(e){let t=new ms;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function ws(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=Cs(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function Ts(e){return ws(e,new CompressionStream(`deflate-raw`))}async function Es(e){return ws(e,new DecompressionStream(`deflate-raw`))}function Ds(e){return e instanceof Error?e:Error(String(e))}function Os(){return!0}function ks(){return Ss()}var As=class extends M{constructor(e,t){super(),this.ended=!1,this.writer=e,this.reader=t,this.readPromise=this._startReading()}async _startReading(){try{for(;;){let{value:e,done:t}=await this.reader.read();if(t)break;e&&this.emit(`data`,e)}this.emit(`end`)}catch(e){this.emit(`error`,Ds(e))}}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.writer.write(e).then(()=>{t&&t()}).catch(e=>{let n=Ds(e);t?t(n):this.emit(`error`,n)}),!0}end(e){if(this.ended){e&&e();return}this.ended=!0,this.writer.close().then(()=>this.readPromise).then(()=>{e&&e()}).catch(t=>{let n=Ds(t);e?e(n):this.emit(`error`,n)})}destroy(e){this.ended=!0,e&&this.emit(`error`,e);try{this.reader.cancel(e)}catch{}try{this.writer.abort(e)}catch{}}},js=class extends M{constructor(e){super();let t=new CompressionStream(`deflate-raw`);this.codec=new As(t.writable.getWriter(),t.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Ms=class extends M{constructor(e){super(),this.codec=new Ns(ss),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Ns=class extends M{constructor(e){super(),this.process=e,this.chunks=[],this.ended=!1}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.chunks.push(e),t&&queueMicrotask(()=>t()),!0}end(e){if(this.ended){e&&e();return}this.ended=!0;try{let t=Jo(this.chunks),n=this.process(t);this.emit(`data`,n),this.emit(`end`),e&&e()}catch(t){let n=Ds(t);this.emit(`error`,n),e&&e(n)}}destroy(e){this.ended=!0,e&&this.emit(`error`,e)}};function Ps(e={}){let t=e.level??6;return ks()?new js(t):new Ms(t)}var Fs=class extends M{constructor(){super();let e=new DecompressionStream(`deflate-raw`);this.codec=new As(e.writable.getWriter(),e.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Is=class extends M{constructor(){super(),this.codec=new Ns(as),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}};function Ls(){return ks()?new Fs:new Is}let Rs=new TextEncoder,zs=new TextDecoder(`utf-8`);function Bs(e){return Rs.encode(e)}function Vs(e){return zs.decode(e)}function Hs(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n){let i=e.subarray(r,r+n);t+=String.fromCharCode(...i)}return t}function Us(e){return!Number.isFinite(e)||e<=0?0:e>=4294967295?4294967295:e>>>0}function Ws(e){return Us(Math.floor(e.getTime()/1e3))}function Gs(e){let t=Us(e),n=new Uint8Array(9),r=new DataView(n.buffer);return r.setUint16(0,21589,!0),r.setUint16(2,5,!0),n[4]=1,r.setUint32(5,t,!0),n}function Ks(e){return Gs(Ws(e))}function qs(e){return[(e.getHours()&31)<<11|(e.getMinutes()&63)<<5|e.getSeconds()>>1&31,(e.getFullYear()-1980&127)<<9|(e.getMonth()+1&15)<<5|e.getDate()&31]}function Js(e,t){let n=e&31,r=e>>5&15,i=(e>>9&127)+1980,a=t?(t&31)*2:0,o=t?t>>5&63:0,s=t?t>>11:0;return new Date(Date.UTC(i,r-1,n,s,o,a))}function Ys(e,t,n){return n===void 0?Js(e,t):new Date(n*1e3)}function Xs(e,t){return t===`dos+utc`?Ks(e):new Uint8Array}function Zs(e){let[t,n]=qs(e);return{dosTime:t,dosDate:n}}let Qs=67324752,$s=33639248,ec=101010256,tc=134695760,nc=101075792,rc=2048;function ic(e,t,n,r){let i=r.versionNeeded??20;return t.setUint32(n+0,Qs,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,r.flags,!0),t.setUint16(n+8,r.compressionMethod,!0),t.setUint16(n+10,r.dosTime,!0),t.setUint16(n+12,r.dosDate,!0),t.setUint32(n+14,r.crc32,!0),t.setUint32(n+18,r.compressedSize,!0),t.setUint32(n+22,r.uncompressedSize,!0),t.setUint16(n+26,r.fileName.length,!0),t.setUint16(n+28,r.extraField.length,!0),e.set(r.fileName,n+30),r.extraField.length>0&&e.set(r.extraField,n+30+r.fileName.length),30+r.fileName.length+r.extraField.length}function ac(e){let t=new Uint8Array(30+e.fileName.length+e.extraField.length);return ic(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function oc(e,t,n,r){let i=r.versionMadeBy??20,a=r.versionNeeded??20,o=r.externalAttributes??0;return t.setUint32(n+0,$s,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,a,!0),t.setUint16(n+8,r.flags,!0),t.setUint16(n+10,r.compressionMethod,!0),t.setUint16(n+12,r.dosTime,!0),t.setUint16(n+14,r.dosDate,!0),t.setUint32(n+16,r.crc32,!0),t.setUint32(n+20,r.compressedSize,!0),t.setUint32(n+24,r.uncompressedSize,!0),t.setUint16(n+28,r.fileName.length,!0),t.setUint16(n+30,r.extraField.length,!0),t.setUint16(n+32,r.comment.length,!0),t.setUint16(n+34,0,!0),t.setUint16(n+36,0,!0),t.setUint32(n+38,o,!0),t.setUint32(n+42,r.localHeaderOffset,!0),e.set(r.fileName,n+46),r.extraField.length>0&&e.set(r.extraField,n+46+r.fileName.length),r.comment.length>0&&e.set(r.comment,n+46+r.fileName.length+r.extraField.length),46+r.fileName.length+r.extraField.length+r.comment.length}function sc(e){let t=new Uint8Array(46+e.fileName.length+e.extraField.length+e.comment.length);return oc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function cc(e,t,n,r){return t.setUint32(n+0,ec,!0),t.setUint16(n+4,0,!0),t.setUint16(n+6,0,!0),t.setUint16(n+8,r.entryCount,!0),t.setUint16(n+10,r.entryCount,!0),t.setUint32(n+12,r.centralDirSize,!0),t.setUint32(n+16,r.centralDirOffset,!0),t.setUint16(n+20,r.comment.length,!0),r.comment.length>0&&e.set(r.comment,n+22),22+r.comment.length}function lc(e){let t=new Uint8Array(22+e.comment.length);return cc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function uc(e,t,n){let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setUint32(0,tc,!0),i.setUint32(4,e,!0),i.setUint32(8,t,!0),i.setUint32(12,n,!0),r}function dc(e){return e?8:0}function fc(e){return e?rc|8:rc}function pc(e){let t=Bs(e.name),n=Bs(e.comment??``),{dosTime:r,dosDate:i}=Zs(e.modTime);return{nameBytes:t,commentBytes:n,dosTime:r,dosDate:i,extraField:Xs(e.modTime,e.timestamps),compressionMethod:dc(e.deflate),flags:fc(e.useDataDescriptor)}}function mc(e){return Math.log(e)/Math.LN2}function hc(e){let t=new Uint32Array(256);for(let n=0;n<e.length;n++)t[e[n]]+=1;let n=0,r=e.length;for(let e=0;e<256;e++){let i=t[e];if(i===0)continue;let a=i/r;n-=a*mc(a)}return n}function gc(e,t={}){let n=t.sampleBytes??65536,r=t.minDecisionBytes??16384,i=Math.min(e.length,n);if(i<r)return!1;let a=e.subarray(0,i),o=new Uint8Array(256),s=0;for(let e=0;e<a.length;e++){let t=a[e];if(o[t]===0&&(o[t]=1,s+=1,s>=200))break}return s<200?!1:hc(a)>=7.95}var _c=class{constructor(e,t){this._deflate=null,this._crc=4294967295,this._uncompressedSize=0,this._compressedSize=0,this._finalized=!1,this._headerEmitted=!1,this._ondata=null,this._onerror=null,this._centralDirEntryInfo=null,this._pendingEnd=!1,this._emittedDataDescriptor=!1,this._localHeader=null,this._deflateWanted=null,this._pendingChunks=[],this._sampleLen=0,this._completeResolve=null,this._completeReject=null,this._completePromise=null,this._completeError=null,this._dataQueue=[],this._finalQueued=!1,this._pushChain=Promise.resolve(),this.name=e;let n=t?.modTime??new Date;this._modTime=n,this.level=t?.level??6,this._smartStore=t?.smartStore??!0,this._sampleBuffer=this._smartStore?new Uint8Array(64*1024):new Uint8Array;let r=pc({name:e,comment:t?.comment??``,modTime:n,timestamps:t?.timestamps??`dos`,useDataDescriptor:!0,deflate:!1});if(this.nameBytes=r.nameBytes,this.commentBytes=r.commentBytes,this.dosTime=r.dosTime,this.dosDate=r.dosDate,this.extraField=r.extraField,this._flags=r.flags,this._compressionMethod=r.compressionMethod,!this._smartStore){let e=this.level>0;this._deflateWanted=e,this._compressionMethod=this._buildCompressionMethod(e),e&&this._initDeflateStream();return}this.level===0&&(this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1))}_buildCompressionMethod(e){return dc(e)}_initDeflateStream(){this._deflate||(this._deflate=Ps({level:this.level}),this._deflate.on(`error`,e=>{this._rejectComplete(e)}),this._deflate.on(`data`,e=>{this._compressedSize+=e.length,this._enqueueData(e,!1)}),this._deflate.on(`end`,()=>{this._pendingEnd&&!this._emittedDataDescriptor&&(this._emittedDataDescriptor=!0,this._emitDataDescriptor())}))}_buildLocalHeader(){return ac({fileName:this.nameBytes,extraField:this.extraField,flags:this._flags,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,crc32:0,compressedSize:0,uncompressedSize:0,versionNeeded:20})}_accumulateSample(e){if(this._deflateWanted!==null||this._sampleLen>=this._sampleBuffer.length)return;let t=Math.min(this._sampleBuffer.length-this._sampleLen,e.length);t<=0||(this._sampleBuffer.set(e.subarray(0,t),this._sampleLen),this._sampleLen+=t)}_shouldDecide(e){return this._deflateWanted===null?e||this._sampleLen>=16*1024:!1}_decideCompressionIfNeeded(e){if(this._deflateWanted===null){if(e&&this._sampleLen===0){this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1),this._localHeader=null;return}this._deflateWanted=!gc(this._sampleBuffer.subarray(0,this._sampleLen)),this._compressionMethod=this._buildCompressionMethod(this._deflateWanted),this._localHeader=null,this._deflateWanted&&this._initDeflateStream()}}_emitHeaderIfNeeded(){this._headerEmitted||=(this._emitHeader(),!0)}async _flushPendingChunks(){if(this._pendingChunks.length!==0){for(let e of this._pendingChunks)await this._writeData(e);this._pendingChunks=[]}}_enqueueData(e,t){this._ondata?this._ondata(e,t):(this._dataQueue.push(e),t&&(this._finalQueued=!0))}_flushQueue(){if(!this._ondata)return;let e=this._dataQueue.length,t=this._finalQueued?e-1:-1;for(let n=0;n<e;n++)this._ondata(this._dataQueue[n],n===t);this._dataQueue=[],this._finalQueued=!1}get ondata(){return this._ondata??void 0}set ondata(e){this._ondata=e,this._flushQueue()}get onerror(){return this._onerror??void 0}set onerror(e){this._onerror=e,this._completeError&&e(this._completeError)}_resolveComplete(){this._completeResolve&&this._completeResolve()}_rejectComplete(e){this._completeError||(this._completeError=e,this._onerror&&this._onerror(e),this._completeReject&&this._completeReject(e))}_ensureCompletePromise(){return this._completeError?Promise.reject(this._completeError):this._emittedDataDescriptor?Promise.resolve():(this._completePromise||=new Promise((e,t)=>{this._completeResolve=e,this._completeReject=t}),this._completePromise)}_tapCallback(e,t){t&&e.then(()=>t()).catch(e=>t(e))}_writeData(e){return e.length===0?Promise.resolve():(this._crc=Wo(this._crc,e),this._uncompressedSize+=e.length,this._deflate?new Promise((t,n)=>{this._deflate.write(e,e=>{e?n(e):t()})}):(this._compressedSize+=e.length,this._enqueueData(e,!1),Promise.resolve()))}_endDeflateAndWait(){return new Promise((e,t)=>{let n=this._deflate,r=e=>{a(),t(e)},i=()=>{a(),e()},a=()=>{n.off(`error`,r),n.off(`end`,i)};n.once(`error`,r),n.once(`end`,i),n.end()})}_finalizeAfterWrite(e){this._finalized=!0,this._pendingEnd=!0;let t=this._ensureCompletePromise();return this._deflate?e.then(()=>this._endDeflateAndWait()).then(()=>t):(this._emittedDataDescriptor=!0,this._emitDataDescriptor(),t)}_pushUnchained(e,t,n){if(this._finalized){let e=Promise.reject(Error(`Cannot push to finalized ZipDeflateFile`));return this._tapCallback(e,n),e}if(this._deflateWanted===null){if(this._accumulateSample(e),!this._shouldDecide(t)){e.length>0&&this._pendingChunks.push(e);let t=Promise.resolve();return this._tapCallback(t,n),t}this._decideCompressionIfNeeded(t),this._emitHeaderIfNeeded();let r=this._pendingChunks.length>0,i=this._flushPendingChunks(),a=i;e.length>0&&(a=r?i.then(()=>this._writeData(e)):this._writeData(e));let o=t?this._finalizeAfterWrite(a):a;return this._tapCallback(o,n),o}this._emitHeaderIfNeeded();let r=this._writeData(e),i=t?this._finalizeAfterWrite(r):r;return this._tapCallback(i,n),i}push(e,t=!1,n){let r=this._pushChain=this._pushChain.then(()=>this._pushUnchained(e,t,n));return r.catch(()=>{}),r}_emitHeader(){this._localHeader||=this._buildLocalHeader(),this._enqueueData(this._localHeader,!1)}_emitDataDescriptor(){let e=Go(this._crc),t=uc(e,this._compressedSize,this._uncompressedSize);this._centralDirEntryInfo={name:this.nameBytes,extraField:this.extraField,comment:this.commentBytes,flags:this._flags,crc:e,compressedSize:this._compressedSize,uncompressedSize:this._uncompressedSize,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,offset:-1},this._enqueueData(t,!0),this._resolveComplete()}complete(){return this._ensureCompletePromise()}getEntryInfo(){if(!this._centralDirEntryInfo)return null;let e=this.name;return{path:e,isDirectory:e.endsWith(`/`)||e.endsWith(`\\`),compressedSize:this._centralDirEntryInfo.compressedSize,uncompressedSize:this._centralDirEntryInfo.uncompressedSize,compressionMethod:this._centralDirEntryInfo.compressionMethod,crc32:this._centralDirEntryInfo.crc,lastModified:this._modTime,localHeaderOffset:this._centralDirEntryInfo.offset,comment:Vs(this._centralDirEntryInfo.comment),externalAttributes:0,isEncrypted:!1}}getCentralDirectoryEntryInfo(){return this._centralDirEntryInfo}isComplete(){return this._emittedDataDescriptor&&this._centralDirEntryInfo!==null}},vc=class{constructor(e,t){this.entries=[],this.currentOffset=0,this.ended=!1,this.endPending=!1,this.fileQueue=[],this.fileQueueIndex=0,this.activeFile=null,this.callback=e,this.zipComment=t?.comment?Bs(t.comment):new Uint8Array}add(e){if(this.ended)throw Error(`Cannot add files after calling end() `);this.fileQueue.push(e),this.activeFile||this._processNextFile()}_processNextFile(){if(this.fileQueueIndex>=this.fileQueue.length){this.activeFile=null,this.fileQueue=[],this.fileQueueIndex=0,this.endPending&&this._finalize();return}let e=this.fileQueue[this.fileQueueIndex++];this.activeFile=e;let t=this.currentOffset,n=new Uint8Array;e.onerror=e=>{this.ended||(this.ended=!0,this.callback(e,n,!0))},e.ondata=(n,r)=>{if(!this.ended&&(this.currentOffset+=n.length,this.callback(null,n,!1),r)){let n=e.getCentralDirectoryEntryInfo();n&&(n.offset=t,this.entries.push(n)),this._processNextFile()}}}_finalize(){if(this.ended)return;this.ended=!0;let e=this.currentOffset,t=0,n=new Uint8Array;for(let e of this.entries){let r=sc({fileName:e.name,extraField:e.extraField,comment:e.comment??n,flags:e.flags,compressionMethod:e.compressionMethod,dosTime:e.dosTime,dosDate:e.dosDate,crc32:e.crc,compressedSize:e.compressedSize,uncompressedSize:e.uncompressedSize,localHeaderOffset:e.offset,versionMadeBy:20,versionNeeded:20});t+=r.length,this.callback(null,r,!1)}let r=lc({entryCount:this.entries.length,centralDirSize:t,centralDirOffset:e,comment:this.zipComment});this.callback(null,r,!0)}end(){this.endPending||this.ended||(this.endPending=!0,this.activeFile||this._finalize())}};async function yc(e,t={}){return(t.level??6)===0?e:bs()?Ts(e):ss(e)}function bc(e,t={}){return(t.level??6)===0?e:ss(e)}async function xc(e,t={}){return xs()?Es(e):as(e)}function Sc(e){return as(e)}function Cc(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}function wc(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!0)}var Tc=class{constructor(e,t=0){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.offset=t}get position(){return this.offset}set position(e){this.offset=e}get remaining(){return this.data.length-this.offset}readUint8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readUint16(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readBigUint64(){let e=this.view.getBigUint64(this.offset,!0);return this.offset+=8,e}readBytes(e){let t=this.data.subarray(this.offset,this.offset+e);return this.offset+=e,t}readString(e,t=!0){let n=this.readBytes(e);return t?Vs(n):Hs(n)}skip(e){this.offset+=e}slice(e,t){return this.data.subarray(e,t)}peekUint32(e){return this.view.getUint32(e,!0)}};function Ec(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0;for(;n+4<=e.length;){let r=t.getUint16(n,!0),i=t.getUint16(n+2,!0),a=n+4,o=a+i;if(o>e.length)break;if(r===21589&&i>=1&&e[a]&1&&i>=5)return t.getUint32(a+1,!0)>>>0;n=o}}function Dc(e,t){let n=e.getUint32(t,!0);return e.getUint32(t+4,!0)*4294967296+n}function Oc(e,t){let n={};if(e.length<4)return n;let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(;i+4<=e.length;){let a=r.getUint16(i,!0),o=r.getUint16(i+2,!0),s=i+4,c=s+o;if(c>e.length)break;if(a===1){let e=s;t.uncompressedSize===4294967295&&e+8<=c&&(n.uncompressedSize=Dc(r,e),e+=8),t.compressedSize===4294967295&&e+8<=c&&(n.compressedSize=Dc(r,e),e+=8),t.offsetToLocalFileHeader===4294967295&&e+8<=c&&(n.offsetToLocalFileHeader=Dc(r,e))}else if(a===21589){let t=Ec(e.subarray(i,c));t!==void 0&&(n.mtimeUnixSeconds=t)}i=c}return t.compressedSize===4294967295&&(t.compressedSize=n.compressedSize),t.uncompressedSize===4294967295&&(t.uncompressedSize=n.uncompressedSize),t.offsetToLocalFileHeader===4294967295&&(t.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}function kc(e){let t=Math.max(0,e.length-65557);for(let n=e.length-22;n>=t;n--)if(e[n]===80&&e[n+1]===75&&e[n+2]===5&&e[n+3]===6)return n;return-1}function Ac(e,t){let n=t-20;return n<0?-1:e[n]===80&&e[n+1]===75&&e[n+2]===6&&e[n+3]===7?n:-1}function jc(e,t={}){let{decodeStrings:n=!0}=t,r=[],i=kc(e);if(i===-1)throw Error(`Invalid ZIP file: End of Central Directory not found`);let a=new Tc(e,i);a.skip(4),a.skip(2),a.skip(2),a.skip(2);let o=a.readUint16();a.skip(4);let s=a.readUint32(),c=Ac(e,i);if(c!==-1){let t=new Tc(e,c);t.skip(4),t.skip(4);let n=new Tc(e,Number(t.readBigUint64()));if(n.readUint32()===nc){n.skip(8),n.skip(2),n.skip(2),n.skip(4),n.skip(4);let e=Number(n.readBigUint64());n.skip(8);let t=Number(n.readBigUint64());o===65535&&(o=e),s===4294967295&&(s=t)}}o>0&&(r=Array(o));let l=new Tc(e,s);for(let e=0;e<o;e++){if(l.readUint32()!==$s)throw Error(`Invalid Central Directory header signature at entry ${e}`);l.skip(2),l.skip(2);let t=l.readUint16(),i=l.readUint16(),a=l.readUint16(),o=l.readUint16(),s=l.readUint32(),c=l.readUint32(),u=l.readUint32(),d=l.readUint16(),f=l.readUint16(),p=l.readUint16();l.skip(2),l.skip(2);let m=l.readUint32(),h=l.readUint32(),g=(t&2048)!=0,_=n&&g,v=d>0?l.readString(d,_):``,y={};if(f>0){let e=l.readBytes(f),t={compressedSize:c,uncompressedSize:u,offsetToLocalFileHeader:h};y=Oc(e,t),c=t.compressedSize,u=t.uncompressedSize,h=t.offsetToLocalFileHeader??h}let b=p>0?l.readString(p,_):``,x=v.endsWith(`/`)||(m&16)!=0,S=(t&1)!=0,ee=y.mtimeUnixSeconds,te=Ys(o,a,ee);r[e]={path:v,isDirectory:x,compressedSize:c,uncompressedSize:u,compressionMethod:i,crc32:s,lastModified:te,localHeaderOffset:h,comment:b,externalAttributes:m,isEncrypted:S}}return r}async function Mc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Pc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return xc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Nc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Pc(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return Sc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Pc(e,t){let n=new Tc(e,t.localHeaderOffset);if(n.readUint32()!==Qs)throw Error(`Invalid local file header signature for "${t.path}"`);n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(4),n.skip(4),n.skip(4);let r=n.readUint16(),i=n.readUint16();return n.skip(r),n.skip(i),n.readBytes(t.compressedSize)}var Fc=class{constructor(e,t={}){this.data=e instanceof ArrayBuffer?new Uint8Array(e):e,this.entries=jc(this.data,t),this.entryMap=new Map(this.entries.map(e=>[e.path,e]))}getEntries(){return this.entries}getEntry(e){return this.entryMap.get(e)}hasEntry(e){return this.entryMap.has(e)}listFiles(){return this.entries.map(e=>e.path)}async extract(e){let t=this.entryMap.get(e);return t?Mc(this.data,t):null}extractSync(e){let t=this.entryMap.get(e);return t?Nc(this.data,t):null}async extractAll(){let e=new Map;for(let t of this.entries){let n=await Mc(this.data,t);e.set(t.path,n)}return e}extractAllSync(){let e={};for(let t of this.entries)e[t.path]=Nc(this.data,t);return e}async forEach(e){for(let t of this.entries){let n=null;if(await e(t,()=>(n||=Mc(this.data,t),n))===!1)break}}};let Ic=new Map([[/^xl\/charts\/chart\d+\.xml$/,`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`],[/^xl\/charts\/style\d+\.xml$/,`application/vnd.ms-office.chartstyle+xml`],[/^xl\/charts\/colors\d+\.xml$/,`application/vnd.ms-office.chartcolorstyle+xml`]]),Lc=[`xl/charts/`];var Rc=class e{constructor(){this.files=new Map}static isPassthroughPath(e){return Lc.some(t=>e.startsWith(t))}static getContentType(e){if(!e.startsWith(`xl/charts/_rels/`)){for(let[t,n]of Ic)if(t.test(e))return n}}add(e,t){this.files.set(e,t)}get(e){return this.files.get(e)}has(e){return this.files.has(e)}getPaths(){return[...this.files.keys()]}toRecord(){let e={};for(let[t,n]of this.files)e[t]=n;return e}fromRecord(e){this.files.clear();for(let[t,n]of Object.entries(e))this.files.set(t,n)}getContentTypes(){let t=[];for(let n of this.files.keys()){let r=e.getContentType(n);r&&t.push({partName:n,contentType:r})}return t}writeToZip(e){for(let[t,n]of this.files)e.append(n,{name:t})}clear(){this.files.clear()}get size(){return this.files.size}},zc=class e{static{this.textEncoder=new TextEncoder}constructor(e){this.events=new Map,this.pipedStream=null,this.finalized=!1,this.level=e?.level??6,this.modTime=e?.modTime,this.timestamps=e?.timestamps,this.zip=new vc((e,t,n)=>{if(e){this._emit(`error`,e);return}t&&t.length>0&&(this._emit(`data`,t),this.pipedStream&&this.pipedStream.write(t)),n&&(this.pipedStream&&this.pipedStream.end(),this._emit(`finish`))})}_emit(e,...t){let n=this.events.get(e);if(n)for(let e of n)e(...t)}on(e,t){let n=this.events.get(e)||new Set;return n.add(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e);return n?(n.delete(t),n.size===0&&this.events.delete(e),this):this}pipe(e){this.pipedStream=e}append(t,n){if(this.finalized)throw Error(`Cannot append after finalize`);let r;r=n.base64?Oe(typeof t==`string`?t:String(t)):typeof t==`string`?e.textEncoder.encode(t):t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):t;let i=new _c(n.name,{level:this.level,modTime:this.modTime,timestamps:this.timestamps});this.zip.add(i),i.push(r,!0)}finalize(){this.finalized||(this.finalized=!0,this.zip.end())}},Bc=class e{static{this.RelType=G}constructor(e){this.workbook=e}createBinaryStream(e){let t=new pt;return t.end(e),t}createTextStream(e){let t=new pt;return t.end(e),t}createStreamBuf(){return new Bo}bufferToString(e){return Ge(e)}createZipWriter(e){return new zc(e)}async writeToZip(e,t){let{model:n}=this.workbook;this.prepareModel(n,t),await this.addContentTypes(e,n),await this.addOfficeRels(e,n),await this.addWorkbookRels(e,n),await this.addWorksheets(e,n),await this.addSharedStrings(e,n),this.addDrawings(e,n),this.addTables(e,n),this.addPivotTables(e,n),this.addPassthrough(e,n),await Promise.all([this.addThemes(e,n),this.addStyles(e,n)]),await this.addFeaturePropertyBag(e,n),await this.addMedia(e,n),await Promise.all([this.addApp(e,n),this.addCore(e,n)]),await this.addWorkbook(e,n)}async read(e,t){let n=[];return await new Promise((t,r)=>{let i=e=>{n.push(e)},a=()=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),t()},o=t=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),r(t)};e.on(`data`,i),e.on(`end`,a),e.on(`error`,o)}),this.loadBuffer(et(n),t)}async write(e,t){t||={},t.zip=t.zip||{},t.zip.modTime??=this.workbook.modified??this.workbook.created;let n=this.createZipWriter(t.zip);return n.pipe(e),await this.writeToZip(n,t),this._finalize(n)}async load(e,t){let n,r=typeof Buffer<`u`?Buffer.isBuffer(e):!1;if(!e||typeof e==`object`&&!r&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);return n=t&&t.base64?Oe(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e),this.loadBuffer(n,t)}async loadBuffer(e,t){let n=await new Fc(e).extractAll(),r={};for(let[e,t]of n)r[e]=t;return this.loadFromFiles(r,t)}createEmptyModel(){return{worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},rawDrawings:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheRecords:{},passthrough:{}}}async collectStreamData(e){let t=[];return await new Promise((n,r)=>{e.on(`data`,e=>{typeof e==`string`?t.push(new TextEncoder().encode(e)):e instanceof Uint8Array?t.push(e):t.push(new Uint8Array(e))}),e.on(`end`,()=>n()),e.on(`error`,r)}),et(t)}drawingHasChartReference(e){return e.rels&&e.rels.some(e=>e.Target&&e.Target.includes(`/charts/`))}drawingRelsHasChartReference(e){return Array.isArray(e)&&e.some(e=>typeof e?.Target==`string`&&e.Target.includes(`/charts/`))}async _processKnownEntry(e,t,n,r){let i=Zn(n);if(i!==void 0)return await this._processWorksheetEntry(e,t,i,r,n),!0;switch(n){case U.rootRels:return t.globalRels=await this.parseRels(e),!0;case U.xlWorkbook:{let n=await this.parseWorkbook(e);return t.sheets=n.sheets,t.definedNames=n.definedNames,t.views=n.views,t.properties=n.properties,t.calcProperties=n.calcProperties,t.pivotCaches=n.pivotCaches,!0}case U.xlSharedStrings:return t.sharedStrings=new Pn,await t.sharedStrings.parseStream(e),!0;case U.xlWorkbookRels:return t.workbookRels=await this.parseRels(e),!0;case U.docPropsApp:{let n=await new Yr().parseStream(e);return n&&(t.company=n.company,t.manager=n.manager),!0}case U.docPropsCore:{let n=await new kn().parseStream(e);return Object.assign(t,n),!0}case U.xlStyles:return t.styles=new Dn,await t.styles.parseStream(e),!0;default:return!1}}async loadFromZipEntries(e,t){let n=this.createEmptyModel();for await(let r of e){let e=!1,i=async()=>{e||(e=!0,await r.drain())};if(r.type===`Directory`){await i();continue}let a=Xn(r.name),o=r.stream;try{await this._processKnownEntry(o,n,a,t)||await this._processDefaultEntry(o,n,a)||await i()}finally{try{await i()}catch{}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async writeBuffer(e){e||={},e.zip=e.zip||{},e.zip.modTime??=this.workbook.modified??this.workbook.created;let t=this.createZipWriter(e.zip),n=this.createStreamBuf();return t.pipe(n),await this.writeToZip(t,e),await this._finalize(t),n.read()||new Uint8Array}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type!==`image`)throw Error(`Unsupported media`);let n=hr(`${t.name??`undefined`}.${t.extension}`);if(t.filename){if(this.readFileAsync){let r=await this.readFileAsync(t.filename);return e.append(r,{name:n})}throw Error(`Loading images from filename is not supported in this environment`)}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64.substring(t.base64.indexOf(`,`)+1);return e.append(r,{name:n,base64:!0})}throw Error(`Unsupported media`)}))}parseRels(e){return new H().parseStream(e)}parseWorkbook(e){return new si().parseStream(e)}parseSharedStrings(e){return new Pn().parseStream(e)}reconcile(e,t){let n=new si,r=new Ca(t),i=new Ha,a=new Ya;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};if(Object.keys(e.drawings).forEach(t=>{let n=e.drawings[t],r=e.drawingRels[t];r&&(o.rels=r.reduce((e,t)=>(e[t.Id]=t,e),{}),(n.anchors??[]).forEach(e=>{let t=e.picture&&e.picture.hyperlinks;t&&o.rels[t.rId]&&(t.hyperlink=o.rels[t.rId].Target,delete t.rId)}),i.reconcile(n,o))}),e.rawDrawings&&e.drawingRels)for(let t of Object.keys(e.rawDrawings)){let n=e.drawingRels[t];n&&!this.drawingRelsHasChartReference(n)&&delete e.rawDrawings[t]}let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)}),this._reconcilePivotTables(e);let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,drawingRels:e.drawingRels,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings,pivotTables:e.pivotTablesIndexed};e.worksheets.forEach(t=>{t.relationships=e.worksheetRels[t.sheetNo],r.reconcile(t,c)}),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,e.defaultFont=e.styles?.defaultFont,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels}_reconcilePivotTables(e){let t=e.pivotTables||{};if(typeof t!=`object`||Object.keys(t).length===0){e.pivotTables=[],e.pivotTablesIndexed={};return}let n=this._buildDefinitionToCacheIdMap(e),r=new Map;Object.entries(e.pivotCacheDefinitions||{}).forEach(([t,i])=>{let a=n.get(t);if(a!==void 0){let n=t.replace(`Definition`,`Records`);r.set(a,{definition:i,records:e.pivotCacheRecords?.[n],definitionName:t})}});let i=[],a={};Object.entries(t).forEach(([e,t])=>{let n=this._extractTableNumber(e),o=r.get(t.cacheId),s=this._determineMetric(t.dataFields),c={...t,tableNumber:n,cacheId:String(t.cacheId),cacheDefinition:o?.definition,cacheRecords:o?.records,cacheFields:o?.definition?.cacheFields??[],rows:t.rowFields.filter(e=>e>=0),columns:t.colFields.filter(e=>e>=0&&e!==-2),values:t.dataFields.map(e=>e.fld),pages:t.pageFields.map(e=>e.fld),metric:s,valueMetrics:this._determineValueMetrics(t.dataFields,s),applyWidthHeightFormats:t.applyWidthHeightFormats===`1`?`1`:`0`};i.push(c),a[Br(e)]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a}_extractTableNumber(e){let t=e.match(/pivotTable(\d+)/);return t?parseInt(t[1],10):1}_buildCacheIdMap(e){let t=new Map,n=e.pivotCaches??[];for(let e of n)e.cacheId&&e.rId&&t.set(e.rId,parseInt(e.cacheId,10));return t}_buildDefinitionToCacheIdMap(t){let n=new Map,r=this._buildCacheIdMap(t),i=t.workbookRels??[];for(let t of i)if(t.Type===e.RelType.PivotCacheDefinition&&t.Target){let e=t.Target.match(/pivotCacheDefinition(\d+)\.xml/);if(e){let i=`pivotCacheDefinition${e[1]}`,a=r.get(t.Id);a!==void 0&&n.set(i,a)}}return n}_determineMetric(e){return e.length>0&&e[0].subtotal?e[0].subtotal:`sum`}_determineValueMetrics(e,t){return e.map(e=>e.subtotal||t)}async _processWorksheetEntry(e,t,n,r,i){let a=await new Ca(r).parseStream(e);if(!a)throw Error(`Failed to parse worksheet ${i}`);a.sheetNo=n,t.worksheetHash[i]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,n){let r=await new Co().parseStream(e);t.comments[Rr(n)]=r}async _processTableEntry(e,t,n){let r=await new Ya().parseStream(e);t.tables[Hr(n)]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new H().parseStream(e);t.worksheetRels[n]=r}async _processMediaEntry(e,t,n){let r=n.lastIndexOf(`.`);if(r>=1){let i=n.substr(r+1),a=n.substr(0,r);await new Promise((r,o)=>{let s=this.createStreamBuf(),c=()=>{e.off(`error`,u),s.off(`error`,u),s.off(`finish`,l)},l=()=>{c(),t.mediaIndex[n]=t.media.length,t.mediaIndex[a]=t.media.length;let e={type:`image`,name:a,extension:i,buffer:s.read()};t.media.push(e),r()},u=e=>{c(),o(e)};s.once(`finish`,l),e.on(`error`,u),s.on(`error`,u),e.pipe(s)})}}async _processDrawingEntry(e,t,n,r){let i=r??await this.collectStreamData(e),a=new Ha,o=this.bufferToString(i),s=await a.parseStream(this.createTextStream(o));t.drawings[n]=s,t.rawDrawings[n]=i}async _processDrawingRelsEntry(e,t,n){let r=await new H().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new jo().parseStream(e);t.vmlDrawings[Lr(n)]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.off(`error`,c),a.off(`error`,c),a.off(`finish`,s)},s=()=>{o();let e=a.read();t.themes[n]=e?typeof e==`string`?e:this.bufferToString(e):``,r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async _processPivotTableEntry(e,t,n){let r=await new _o().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new H().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new uo().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheRecordsEntry(e,t,n){let r=await new no().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n=this.createEmptyModel(),r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=Xn(e.name),i=rr(r)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data));await this._processKnownEntry(i,n,r,t)||await this._processDefaultEntry(i,n,r,e.data)}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n,r){let i=Qn(n);if(i!==void 0)return await this._processWorksheetRelsEntry(e,t,i),!0;let a=er(n);if(a)return await this._processMediaEntry(e,t,a),!0;let o=ir(n);if(o)return await this._processDrawingEntry(e,t,o,r),!0;let s=ar(n);if(s)return await this._processDrawingRelsEntry(e,t,s),!0;let c=or(n);if(c)return await this._processVmlDrawingEntry(e,t,c),!0;let l=sr(n);if(l)return await this._processCommentEntry(e,t,`comments${l}`),!0;let u=cr(n);if(u)return await this._processTableEntry(e,t,u),!0;let d=nr(n);if(d)return await this._processThemeEntry(e,t,d),!0;let f=lr(n);if(f)return await this._processPivotTableEntry(e,t,f),!0;let p=ur(n);if(p)return await this._processPivotTableRelsEntry(e,t,p),!0;let m=dr(n);if(m)return await this._processPivotCacheDefinitionEntry(e,t,m),!0;if(fr(n))return!0;let h=pr(n);return h?(await this._processPivotCacheRecordsEntry(e,t,h),!0):Rc.isPassthroughPath(n)?(r?t.passthrough[n]=r:await this._processPassthroughEntry(e,t,n),!0):!1}async _processPassthroughEntry(e,t,n){let r=await this.collectStreamData(e);t.passthrough[n]=r}async addContentTypes(e,t){let n=new Kr().toXml(t);e.append(n,{name:U.contentTypes})}async addApp(e,t){let n=new Yr().toXml(t);e.append(n,{name:U.docPropsApp})}async addCore(e,t){let n=new kn;e.append(n.toXml(t),{name:U.docPropsCore})}async addThemes(e,t){let n=t.themes||{theme1:No};Object.keys(n).forEach(t=>{let r=n[t];e.append(r,{name:mr(t)})})}async addOfficeRels(t,n){let r=new H().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:U.docPropsApp}]);t.append(r,{name:U.rootRels})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:Mr.workbookStyles},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:Mr.workbookTheme1}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:Mr.workbookSharedStrings}),n.hasCheckboxes&&i.push({Id:`rId${r++}`,Type:e.RelType.FeaturePropertyBag,Target:Mr.workbookFeaturePropertyBag});let a=new Map;(n.pivotTables??[]).forEach(t=>{let n=a.get(t.cacheId);n?t.rId=n:(t.rId=`rId${r++}`,a.set(t.cacheId,t.rId),i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:Nr(t.tableNumber)}))}),n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:vr(t.fileIndex)})});let o=new H().toXml(i);t.append(o,{name:U.xlWorkbookRels})}async addFeaturePropertyBag(e,t){if(!t.hasCheckboxes)return;let n=new wa;e.append(n.toXml({}),{name:U.xlFeaturePropertyBag})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:U.xlSharedStrings})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:U.xlStyles})}async addWorkbook(e,t){let n=new si;e.append(n.toXml(t),{name:U.xlWorkbook})}async addWorksheets(e,t){let n=new Ca,r=new H,i=new Co,a=new jo,o=new Mo;t.worksheets.forEach(t=>{let{fileIndex:s}=t,c=new F;n.render(c,t),e.append(c.xml,{name:gr(s)}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:_r(s)})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:yr(s)}));let l=t.comments.length>0,u=t.formControls&&t.formControls.length>0;(l||u)&&(c=new F,a.render(c,{comments:l?t.comments:[],formControls:u?t.formControls:[]}),e.append(c.xml,{name:xr(s)})),u&&t.formControls.forEach(t=>{let n=o.toXml(t);e.append(n,{name:Wr(t.ctrlPropId)})})})}addDrawings(e,t){let n=new Ha,r=new H,i=t.rawDrawings||{};t.worksheets.forEach(t=>{let{drawing:a}=t;if(a){if(this.drawingHasChartReference(a)&&i[a.name])e.append(i[a.name],{name:Cr(a.name)});else{let t=(a.anchors??[]).filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.br&&!e.picture||e.br&&!e.picture&&!e.shape)),r=a.anchors?{...a,anchors:t}:a;n.prepare(r);let i=n.toXml(r);e.append(i,{name:Cr(a.name)})}let t=r.toXml(a.rels);e.append(t,{name:wr(a.name)})}})}addTables(e,t){let n=new Ya;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:Sr(t.target)})})})}addPassthrough(e,t){let n=new Rc;n.fromRecord(t.passthrough||{}),n.writeToZip(e)}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new no,i=new uo,a=new _o,o=new H,s=new Map;n.pivotTables.forEach(n=>{let c=n.tableNumber,l=n.isLoaded,u=n.cacheId;if(!s.has(u)){if(s.set(u,c),l){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:Tr(c)})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:Dr(c)})}}else{let e=r.toXml(n);t.append(e,{name:Dr(c)}),e=i.toXml(n),t.append(e,{name:Tr(c)})}if(!l||n.cacheRecords){let r=(l?n.cacheDefinition?.rId:void 0)??`rId1`,i=o.toXml([{Id:r,Type:e.RelType.PivotCacheRecords,Target:Or(c)}]);t.append(i,{name:Er(c)})}}let d=a.toXml(n);t.append(d,{name:kr(c)});let f=s.get(u);d=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:jr(f)}]),t.append(d,{name:Ar(c)})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator??`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy??`ExcelTS`,e.created=e.created??new Date,e.modified=e.modified??new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Pn;let n=e.defaultFont;e.styles=e.useStyles?new Dn(!0):new Dn.Mock,n&&e.styles.setDefaultFont&&e.styles.setDefaultFont(n);let r=new si,i=new Ca;r.prepare(e);let a={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};a.drawings=e.drawings=[],a.commentRefs=e.commentRefs=[],a.formControlRefs=e.formControlRefs=[];let o=0;e.tables=[],e.worksheets.forEach((t,n)=>{t.fileIndex=n+1,t.tables.forEach(t=>{o++,t.target=`table${o}.xml`,t.id=o,e.tables.push(t)}),i.prepare(t,a)}),e.hasCheckboxes=e.styles.hasCheckboxes;let s=e.passthrough||{},c=new Rc;c.fromRecord(s),e.passthroughContentTypes=c.getContentTypes()}};let X=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Z=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,Vc=(e,t)=>(e.charCodeAt(t)-48)*1e3+(e.charCodeAt(t+1)-48)*100+(e.charCodeAt(t+2)-48)*10+e.charCodeAt(t+3)-48|0,Hc=[0,31,29,31,30,31,30,31,31,30,31,30,31];function Uc(e,t,n){if(t<1||t>12||n<1||n>Hc[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function Wc(e,t,n,r,i,a){return t<1||t>12||n<1||n>Hc[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function Gc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:Uc(Vc(e,0),Z(e,5),Z(e,8))}function Kc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Wc(Vc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function qc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Wc(Vc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Jc(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Yc(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Xc(e){let t=e.charCodeAt(19);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function Zc(e){if(e.charCodeAt(19)!==46)return null;let t=e.charCodeAt(23);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function Qc(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Uc(Vc(e,6),Z(e,0),Z(e,3))}function $c(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Uc(Vc(e,6),Z(e,3),Z(e,0))}function el(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Wc(Vc(e,6),Z(e,0),Z(e,3),Z(e,11),Z(e,14),Z(e,17))}function tl(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Wc(Vc(e,6),Z(e,3),Z(e,0),Z(e,11),Z(e,14),Z(e,17))}let nl={"YYYY-MM-DD":Gc,"YYYY-MM-DD[T]HH:mm:ss":Kc,"YYYY-MM-DD HH:mm:ss":qc,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?Jc(e):e.length===25?Xc(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?Yc(e):e.length===29?Zc(e):null,"MM-DD-YYYY":Qc,"MM-DD-YYYY HH:mm:ss":el,"MM/DD/YYYY HH:mm:ss":el,"DD-MM-YYYY":$c,"DD-MM-YYYY HH:mm:ss":tl,"DD/MM/YYYY HH:mm:ss":tl},rl=[[10,[Gc]],[19,[Kc,qc]],[20,[Jc]],[24,[Yc]],[25,[Xc]],[29,[Zc]]];var il=class e{constructor(e){this.parse=e=>{if(!e)return null;let t=e.trim();if(!t)return null;if(this.single)return this.fn0(t);for(let e=0,n=this.fns.length;e<n;e++){let n=this.fns[e](t);if(n)return n}return null},this.fns=e,this.single=e.length===1,this.fn0=e[0]}static create(t){return new e(t.map(e=>nl[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of rl)t.push(...e);return new e(t)}parseAll(e){let t=e.length,n=Array(t),r=this.parse;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}parseValid(e){let t=[],n=this.parse;for(let r=0,i=e.length;r<i;r++){let i=n(e[r]);i&&t.push(i)}return t}};function al(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${X[r]}:${X[i]}`}var ol=class e{constructor(e){this.format=e=>this.fn(e),this.fn=e}static iso(t=!1){return t?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),a=e.getUTCHours(),o=e.getUTCMinutes(),s=e.getUTCSeconds(),c=e.getUTCMilliseconds();return`${n}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}Z`}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=e.getHours(),o=e.getMinutes(),s=e.getSeconds(),c=e.getMilliseconds();return`${n}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}${al(e)}`})}static create(t,n){let r=n?.utc??!1;if(t===`YYYY-MM-DD`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]}`:``});if(t===`YYYY-MM-DD HH:mm:ss`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]} ${X[e.getUTCHours()]}:${X[e.getUTCMinutes()]}:${X[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]} ${X[e.getHours()]}:${X[e.getMinutes()]}:${X[e.getSeconds()]}`:``});if(t===`MM-DD-YYYY`||t===`MM/DD/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getUTCMonth()+1]}${n}${X[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getMonth()+1]}${n}${X[e.getDate()]}${n}${e.getFullYear()}`:``})}if(t===`DD-MM-YYYY`||t===`DD/MM/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getUTCDate()]}${n}${X[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getDate()]}${n}${X[e.getMonth()+1]}${n}${e.getFullYear()}`:``})}return e.createGeneric(t,r)}static createGeneric(t,n){let r=[],i=t.replace(/\[([^\]]*)\]/g,(e,t)=>(r.push(t),`\x00${r.length-1}\x00`)),a=i.includes(`YYYY`),o=i.includes(`SSS`),s=i.includes(`MM`),c=i.includes(`DD`),l=i.includes(`HH`),u=i.includes(`mm`),d=i.includes(`ss`),f=i.includes(`Z`);return new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let p=i;if(a&&(p=p.replace(/YYYY/g,String(n?e.getUTCFullYear():e.getFullYear()))),o){let t=n?e.getUTCMilliseconds():e.getMilliseconds();p=p.replace(/SSS/g,t<10?`00${t}`:t<100?`0${t}`:String(t))}return s&&(p=p.replace(/MM/g,X[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,X[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,X[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,X[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,X[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:al(e))),r.length&&(p=p.replace(/\x00(\d+)\x00/g,(e,t)=>r[+t])),p})}formatAll(e){let t=e.length,n=Array(t),r=this.fn;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}};function sl(e,t){return t===`,`?String(e).split(`.`).join(`,`):String(e)}function cl(e,t){if(t!==`,`)return Number(e);let n=e.trim();return/^-?\d+(,\d+)?([eE][+-]?\d+)?$/.test(n)?Number(n.replace(`,`,`.`)):Number(e)}function ll(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function ul(e){return e.length===1}function dl(e){return e.length===1}function fl(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function pl(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,b=a||o,x=r!==null&&r!==!1,S=x?String(r):``,ee=i!==null&&i!==!1?String(i):``,te=[],ne=[],C=[],w=``,re=!1,T=0,ie=0,ae=0,oe=0,E=null,se=0,ce=!1,D=!1;u===!0?ce=!0:Array.isArray(u)?(E=u,se=u.filter(e=>e!=null).length,fl(u),ce=!0,d||(D=!0)):typeof u==`function`&&(ce=!0);let le=s||c&&l?e=>e.trim():c?e=>e.trimStart():l?e=>e.trimEnd():e=>e,O=e=>{if(ce&&!D){if(typeof u==`function`){let t=u(e);fl(t),E=t}else Array.isArray(u)||(fl(e),E=e);return se=E.filter(e=>e!=null).length,D=!0,!1}if(oe<h)return oe++,!1;if(E&&E.length>0){let t=se,n=e.length;if(n>t){if(g&&!_)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=E.length}else if(n<t){if(g)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<E.length;)e.push(``)}}return!0},ue=e.length;for(;T<ue;){let t=e[T];if(re&&x)ee&&t===ee&&e[T+1]===S?(w+=S,T+=2):t===S?(re=!1,T++):t===`\r`?(e[T+1]===`
29
+ </r>`)}return n.join(``)}renderCellNew(e,t){if(e==null||typeof e==`number`&&!Number.isFinite(e)){if(t===null)return`<m />`;let e=t.indexOf(null);return e>=0?`<x v="${e}" />`:`<m />`}if(t===null)return e instanceof wt?`<e v="${A(e.code)}" />`:typeof e==`boolean`?`<b v="${e?`1`:`0`}" />`:e instanceof Date?`<d v="${eo(e)}" />`:Number.isFinite(e)?`<n v="${e}" />`:`<s v="${A(String(e))}" />`;let n=so(t,e);if(n<0)throw Error(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))ao.has(t)||(e[t]=String(r));this.model={records:[],count:parseInt(n.count??`0`,10),isLoaded:!0,extraRootAttrs:Object.keys(e).length>0?e:void 0};break}case`r`:this.currentRecord=[];break;case`x`:this.currentRecord&&this.currentRecord.push({type:`x`,value:parseInt(n.v??`0`,10)});break;case`n`:this.currentRecord&&(n.v===void 0||n.v===``?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`n`,value:parseFloat(n.v)}));break;case`s`:this.currentRecord&&this.currentRecord.push({type:`s`,value:n.v??``});break;case`b`:this.currentRecord&&this.currentRecord.push({type:`b`,value:n.v===`1`});break;case`m`:this.currentRecord&&this.currentRecord.push({type:`m`});break;case`d`:if(this.currentRecord)if(!n.v)this.currentRecord.push({type:`m`});else{let e=Fe(n.v);isNaN(e.getTime())?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`d`,value:e})}break;case`e`:this.currentRecord&&this.currentRecord.push({type:`e`,value:n.v??``});break}return!0}parseText(e){}parseClose(e){switch(e){case this.tag:return!1;case`r`:this.model&&this.currentRecord&&(this.model.records.push(this.currentRecord),this.currentRecord=null);break}return!0}static{this.PIVOT_CACHE_RECORDS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function so(e,t){if(t instanceof Date){let n=t.getTime();for(let t=0;t<e.length;t++){let r=e[t];if(r instanceof Date&&r.getTime()===n)return t}return-1}if(t instanceof wt){for(let n=0;n<e.length;n++){let r=e[n];if(r instanceof wt&&r.code===t.code)return n}return-1}return e.indexOf(t)}var co=class{constructor(e){this.active=!1,this.depth=0,this.buffer=[],this.lastOpenIndex=-1,this.rootTag=e}start(e){this.active=!0,this.depth=0;let t=lo(e);this.buffer=[`<${this.rootTag}${t?` `+t:``}>`]}startAs(e,t){this.rootTag=e,this.start(t)}reset(){this.active=!1,this.depth=0,this.buffer.length=0,this.lastOpenIndex=-1}feedOpen(e,t){let n=lo(t);this.buffer.push(`<${e}${n?` `+n:``}>`),this.depth++,this.lastOpenIndex=this.buffer.length-1}feedText(e){this.buffer.push(A(e)),this.lastOpenIndex=-1}feedClose(e){if(e===this.rootTag&&this.depth===0)return this.buffer.push(`</${e}>`),this.active=!1,this.lastOpenIndex=-1,!0;if(this.depth>0&&this.depth--,this.lastOpenIndex>=0&&this.lastOpenIndex===this.buffer.length-1){let e=this.buffer[this.lastOpenIndex];return this.buffer[this.lastOpenIndex]=e.slice(0,-1)+` />`,this.lastOpenIndex=-1,!1}return this.lastOpenIndex=-1,this.buffer.push(`</${e}>`),!1}get result(){return this.buffer.join(``)}};function lo(e){if(!e)return``;let t=Object.entries(e);return t.length===0?``:t.filter(([,e])=>e!=null).map(([e,t])=>`${e}="${A(String(t))}"`).join(` `)}let uo=new Set([`name`,`numFmtId`]);var fo=class extends L{constructor(){super(),this.inSharedItems=!1,this.fieldGroupCollector=new co(`fieldGroup`),this.model=null}get tag(){return`cacheField`}reset(){this.model=null,this.inSharedItems=!1,this.fieldGroupCollector.reset()}parseOpen(e){let{name:t,attributes:n}=e;if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedOpen(t,n),!0;switch(t){case`cacheField`:{let e={};for(let[t,r]of Object.entries(n))uo.has(t)||(e[t]=String(r));this.model={name:n.name??``,sharedItems:null,numFmtId:n.numFmtId,isLoaded:!0,extraAttrs:Object.keys(e).length>0?e:void 0};break}case`fieldGroup`:this.model&&this.fieldGroupCollector.start(n);break;case`sharedItems`:if(this.inSharedItems=!0,this.model){if(n.containsNumber!==void 0&&(this.model.containsNumber=n.containsNumber),n.containsInteger!==void 0&&(this.model.containsInteger=n.containsInteger),n.minValue!==void 0){let e=parseFloat(n.minValue);Number.isFinite(e)&&(this.model.minValue=e)}if(n.maxValue!==void 0){let e=parseFloat(n.maxValue);Number.isFinite(e)&&(this.model.maxValue=e)}n.containsSemiMixedTypes!==void 0&&(this.model.containsSemiMixedTypes=n.containsSemiMixedTypes),n.containsNonDate!==void 0&&(this.model.containsNonDate=n.containsNonDate),n.containsString!==void 0&&(this.model.containsString=n.containsString),n.containsBlank!==void 0&&(this.model.containsBlank=n.containsBlank),n.containsDate!==void 0&&(this.model.containsDate=n.containsDate),n.containsMixedTypes!==void 0&&(this.model.containsMixedTypes=n.containsMixedTypes),this.model.sharedItems=[]}break;case`s`:case`n`:case`b`:case`e`:case`m`:case`d`:this.inSharedItems&&this.model&&this.model.sharedItems!==null&&this.model.sharedItems.push(po(t,n));break}return!0}parseText(e){this.fieldGroupCollector.active&&this.fieldGroupCollector.feedText(e)}parseClose(e){if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedClose(e)&&(this.model&&(this.model.fieldGroupXml=this.fieldGroupCollector.result),this.fieldGroupCollector.reset()),!0;switch(e){case`cacheField`:return!1;case`sharedItems`:this.inSharedItems=!1;break}return!0}};function po(e,t){switch(e){case`s`:return t.v??``;case`n`:return t.v===void 0||t.v===``?null:parseFloat(t.v);case`b`:return t.v===`1`;case`e`:return new wt(t.v??``);case`m`:return null;case`d`:{if(!t.v)return null;let e=Fe(t.v);return isNaN(e.getTime())?null:e}default:return null}}let mo=new Set([`xmlns`,`xmlns:r`,`r:id`,`refreshOnLoad`,`createdVersion`,`refreshedVersion`,`minRefreshableVersion`,`recordCount`,`backgroundQuery`,`supportSubquery`,`supportAdvancedDrill`]);var ho=class e extends L{constructor(){super(),this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector=new co(`extLst`),this.unknownCollector=new co(``),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector=new co(``),this.cacheSourceXmlParts=[],this.model=null}get tag(){return`pivotCacheDefinition`}reset(){this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector.reset(),this.cacheSourceXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2).filter(Array.isArray).length;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:a}),t.openNode(`cacheSource`,{type:`worksheet`});let o=r.tableName?{name:r.tableName}:{ref:r.dimensions.shortRange,sheet:r.name};t.leafNode(`worksheetSource`,o),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(e.renderCacheFieldsXml(i)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,sourceTableName:o,recordCount:s}=n;t.openXml(F.StdDocAttributes);let c={...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":n.rId??`rId1`};if(n.refreshOnLoad&&(c.refreshOnLoad=n.refreshOnLoad),c.createdVersion=n.createdVersion??`8`,c.refreshedVersion=n.refreshedVersion??`8`,c.minRefreshableVersion=n.minRefreshableVersion??`3`,s!==void 0&&(c.recordCount=s),n.backgroundQuery&&(c.backgroundQuery=n.backgroundQuery),n.supportSubquery&&(c.supportSubquery=n.supportSubquery),n.supportAdvancedDrill&&(c.supportAdvancedDrill=n.supportAdvancedDrill),n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))c[e]=t;if(t.openNode(this.tag,c),t.openNode(`cacheSource`,{type:n.cacheSourceType??`worksheet`}),!n.cacheSourceType||n.cacheSourceType===`worksheet`){let e=o?{name:o}:{ref:i,sheet:a};n.worksheetSourceRId&&(e[`r:id`]=n.worksheetSourceRId),Object.values(e).some(e=>e!==void 0)&&t.leafNode(`worksheetSource`,e)}n.cacheSourceXml&&t.writeXml(n.cacheSourceXml),t.closeNode(),t.openNode(`cacheFields`,{count:r.length}),t.writeXml(e.renderCacheFieldsXml(r)),t.closeNode(),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml),n.extLstXml&&t.writeXml(n.extLstXml),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedOpen(t,n),!0;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))mo.has(t)||(e[t]=String(r));this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,backgroundQuery:n.backgroundQuery,supportSubquery:n.supportSubquery,supportAdvancedDrill:n.supportAdvancedDrill,extraRootAttrs:Object.keys(e).length>0?e:void 0,isLoaded:!0};break}case`cacheSource`:this.inCacheSource=!0,this.model&&(this.model.cacheSourceType=n.type);break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet,this.model.sourceTableName=n.name,n[`r:id`]&&(this.model.worksheetSourceRId=n[`r:id`]));break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new fo,this.currentCacheField.parseOpen(e));break;case`extLst`:this.model&&this.extLstCollector.start(n);break;default:if(this.inCacheSource&&this.model){this.cacheSourceChildCollector.startAs(t,n);break}this.model&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){if(this.extLstCollector.active){this.extLstCollector.feedText(e);return}if(this.unknownCollector.active){this.unknownCollector.feedText(e);return}if(this.cacheSourceChildCollector.active){this.cacheSourceChildCollector.feedText(e);return}this.currentCacheField&&this.currentCacheField.parseText(e)}parseClose(e){if(this.extLstCollector.active)return this.extLstCollector.feedClose(e)&&(this.model&&(this.model.extLstXml=this.extLstCollector.result),this.extLstCollector.reset()),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedClose(e)&&(this.cacheSourceXmlParts.push(this.cacheSourceChildCollector.result),this.cacheSourceChildCollector.reset()),!0;if(this.currentCacheField)return this.currentCacheField.parseClose(e)||(this.model&&this.currentCacheField.model&&this.model.cacheFields.push(this.currentCacheField.model),this.currentCacheField=null),!0;switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`cacheSource`:this.inCacheSource=!1,this.model&&this.cacheSourceXmlParts.length>0&&(this.model.cacheSourceXml=this.cacheSourceXmlParts.join(``));break;case`cacheFields`:this.inCacheFields=!1;break}return!0}static renderCacheFieldsXml(e){return`
30
+ `+e.map(e=>to(e)).join(`
31
+ `)}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`}}};let go=`PivotStyleLight16`,_o=new Set([`axisRow`,`axisCol`,`axisPage`,`axisValues`]),vo=[`x`,`t`,`h`,`sd`,`f`,`m`,`c`,`d`];function yo(){return{currentSection:null,inPivotArea:!1,inAutoSortScope:!1}}let bo=new Set([`axis`,`dataField`,`compact`,`outline`,`showAll`,`defaultSubtotal`,`numFmtId`,`sortType`,`subtotalTop`,`insertBlankRow`,`multipleItemSelectionAllowed`]);var xo=class e extends L{constructor(){super(),this.state=yo(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector=new co(`extLst`),this.formatsCollector=new co(`formats`),this.conditionalFormatsCollector=new co(`conditionalFormats`),this.filtersCollector=new co(`filters`),this.unknownCollector=new co(``),this.unknownElementsXmlParts=[],this.model=null}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.state=yo(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector.reset(),this.formatsCollector.reset(),this.conditionalFormatsCollector.reset(),this.filtersCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,r){let{rows:i,columns:a,values:o,pages:s=[],cacheFields:c,cacheId:l,tableNumber:u,applyWidthHeightFormats:d}=r,f=a.length===0&&o.length>1,p=s.length,m=p>0?p+1:0,h=i.length,g=3+m,_=g+1,v=h+(f?o.length:1),y=`A${g}:${n.n2l(v)}${_}`;t.openXml(F.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,name:`PivotTable${u}`,cacheId:l,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:d,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`});let b={ref:y,firstHeaderRow:1,firstDataRow:1,firstDataCol:h};p>0&&(b.rowPageCount=p,b.colPageCount=1),t.leafNode(`location`,b),wo(t,r),t.openNode(`rowFields`,{count:i.length});for(let e of i)t.leafNode(`field`,{x:e});if(t.closeNode(),t.openNode(`rowItems`,{count:1}),t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode(),a.length>0){let e=o.length>1?a.length+1:a.length;t.openNode(`colFields`,{count:e});for(let e of a)t.leafNode(`field`,{x:e});o.length>1&&t.leafNode(`field`,{x:-2}),t.closeNode()}else f&&(t.openNode(`colFields`,{count:1}),t.leafNode(`field`,{x:-2}),t.closeNode());if(f){t.openNode(`colItems`,{count:o.length+1});for(let e=0;e<o.length;e++)t.openNode(`i`),t.leafNode(`x`,e===0?void 0:{v:e}),t.closeNode();t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode()}else t.openNode(`colItems`,{count:1}),t.leafNode(`i`),t.closeNode();if(p>0){t.openNode(`pageFields`,{count:p});for(let e of s)t.leafNode(`pageField`,{fld:e,hier:-1});t.closeNode()}Co(t,c,o,r.valueMetrics),t.leafNode(`pivotTableStyleInfo`,{name:go,showRowHeaders:`1`,showColHeaders:`1`,showRowStripes:`0`,showColStripes:`0`,showLastColumn:`1`}),t.writeXml(e.EXTLST_XML),t.closeNode()}renderLoaded(t,n){let r=this.buildLoadedRootAttributes(n);if(t.openXml(F.StdDocAttributes),t.openNode(this.tag,r),n.location){let e={ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol};n.location.rowPageCount!==void 0&&(e.rowPageCount=n.location.rowPageCount),n.location.colPageCount!==void 0&&(e.colPageCount=n.location.colPageCount),t.leafNode(`location`,e)}if(n.pivotFields.length>0){t.openNode(`pivotFields`,{count:n.pivotFields.length});for(let e of n.pivotFields)this.renderPivotFieldLoaded(t,e);t.closeNode()}if(n.rowFields.length>0){t.openNode(`rowFields`,{count:n.rowFields.length});for(let e of n.rowFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.rowItems&&n.rowItems.length>0){t.openNode(`rowItems`,{count:n.rowItems.length});for(let e of n.rowItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasRowItems&&t.writeXml(`<rowItems count="1"><i t="grand"><x/></i></rowItems>`);if(n.hasColFields||n.colFields.length>0)if(n.colFields.length===0&&n.dataFields.length<=1)t.leafNode(`colFields`,{count:0});else{let e=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:e}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.colItems&&n.colItems.length>0){t.openNode(`colItems`,{count:n.colItems.length});for(let e of n.colItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasColItems&&t.writeXml(`<colItems count="1"><i t="grand"><x/></i></colItems>`);if(n.pageFields&&n.pageFields.length>0){t.openNode(`pageFields`,{count:n.pageFields.length});for(let e of n.pageFields){let n={fld:e.fld};e.item!==void 0&&(n.item=e.item),e.hier!==void 0&&(n.hier=e.hier),e.name!==void 0&&(n.name=e.name),t.leafNode(`pageField`,n)}t.closeNode()}if(n.dataFields.length>0){t.openNode(`dataFields`,{count:n.dataFields.length});for(let e of n.dataFields){let n={name:e.name,fld:e.fld};e.baseField!==void 0&&(n.baseField=e.baseField),e.baseItem!==void 0&&(n.baseItem=e.baseItem),e.subtotal!==void 0&&e.subtotal!==`sum`&&(n.subtotal=e.subtotal),e.numFmtId!==void 0&&(n.numFmtId=e.numFmtId),t.leafNode(`dataField`,n)}t.closeNode()}n.formatsXml&&t.writeXml(n.formatsXml),n.conditionalFormatsXml&&t.writeXml(n.conditionalFormatsXml),n.chartFormats&&n.chartFormats.length>0&&this.renderChartFormats(t,n.chartFormats);let i=n.styleInfo;t.leafNode(`pivotTableStyleInfo`,{name:i?.name??n.styleName??go,showRowHeaders:i?.showRowHeaders??`1`,showColHeaders:i?.showColHeaders??`1`,showRowStripes:i?.showRowStripes??`0`,showColStripes:i?.showColStripes??`0`,showLastColumn:i?.showLastColumn??`1`}),n.filtersXml&&t.writeXml(n.filtersXml),n.unknownElementsXml&&t.writeXml(n.unknownElementsXml);let a=n.extLstXml??(n.isLoaded?``:e.EXTLST_XML);a&&t.writeXml(a),t.closeNode()}buildLoadedRootAttributes(t){let n={...e.PIVOT_TABLE_ATTRIBUTES,name:t.name??`PivotTable1`,cacheId:String(t.cacheId),applyNumberFormats:t.applyNumberFormats??`0`,applyBorderFormats:t.applyBorderFormats??`0`,applyFontFormats:t.applyFontFormats??`0`,applyPatternFormats:t.applyPatternFormats??`0`,applyAlignmentFormats:t.applyAlignmentFormats??`0`,applyWidthHeightFormats:t.applyWidthHeightFormats??`0`,dataCaption:t.dataCaption??`Values`,updatedVersion:t.updatedVersion??`8`,minRefreshableVersion:t.minRefreshableVersion??`3`};return t.useAutoFormatting!==void 0&&(n.useAutoFormatting=t.useAutoFormatting),t.itemPrintTitles!==void 0&&(n.itemPrintTitles=t.itemPrintTitles),t.multipleFieldFilters!==void 0&&(n.multipleFieldFilters=t.multipleFieldFilters),n.createdVersion=t.createdVersion??`8`,t.indent!==void 0&&(n.indent=String(t.indent)),t.uid&&(n[`xmlns:xr`]=`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,n[`xr:uid`]=t.uid),t.outline&&(n.outline=`1`),t.outlineData&&(n.outlineData=`1`),t.chartFormat!==void 0&&(n.chartFormat=String(t.chartFormat)),t.colGrandTotals!==void 0&&(n.colGrandTotals=t.colGrandTotals),t.rowGrandTotals!==void 0&&(n.rowGrandTotals=t.rowGrandTotals),t.showError!==void 0&&(n.showError=t.showError),t.errorCaption!==void 0&&(n.errorCaption=t.errorCaption),t.showMissing!==void 0&&(n.showMissing=t.showMissing),t.missingCaption!==void 0&&(n.missingCaption=t.missingCaption),t.grandTotalCaption!==void 0&&(n.grandTotalCaption=t.grandTotalCaption),t.compact===!1&&(n.compact=`0`),t.compactData===!1&&(n.compactData=`0`),n}renderChartFormats(e,t){e.openNode(`chartFormats`,{count:t.length});for(let n of t)e.openNode(`chartFormat`,{chart:n.chart,format:n.format,series:n.series===!0?`1`:n.series===!1?`0`:void 0}),n.pivotAreaXml?e.writeXml(n.pivotAreaXml):e.writeXml(`<pivotArea type="data" outline="0" fieldPosition="0"><references count="1"><reference field="4294967294" count="1" selected="0"><x v="0"/></reference></references></pivotArea>`),e.closeNode();e.closeNode()}renderRowColItem(e,t){let n={};if(t.t!==void 0&&(n.t=t.t),t.r!==void 0&&(n.r=t.r),t.i!==void 0&&(n.i=t.i),t.x.length>0){e.openNode(`i`,n);for(let n of t.x)n.v===0?e.leafNode(`x`):e.leafNode(`x`,{v:n.v});e.closeNode()}else e.leafNode(`i`,n)}renderPivotFieldLoaded(e,t){let n={};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.numFmtId!==void 0&&(n.numFmtId=String(t.numFmtId)),t.sortType&&(n.sortType=t.sortType),t.compact===!1&&(n.compact=`0`),t.outline===!1&&(n.outline=`0`),n.showAll=t.showAll?`1`:`0`,t.defaultSubtotal===!1&&(n.defaultSubtotal=`0`),t.subtotalTop===!1&&(n.subtotalTop=`0`),t.insertBlankRow===!0&&(n.insertBlankRow=`1`),t.multipleItemSelectionAllowed===!0&&(n.multipleItemSelectionAllowed=`1`),t.extraAttrs)for(let[e,r]of Object.entries(t.extraAttrs))n[e]=r;if(t.items!==void 0&&t.items.length>0||t.autoSortScopeXml!==void 0){if(e.openNode(`pivotField`,n),t.items!==void 0&&t.items.length>0){e.openNode(`items`,{count:t.items.length});for(let n of t.items){let t={};for(let e of vo)n[e]!==void 0&&(t[e]=n[e]);e.leafNode(`item`,t)}e.closeNode()}t.autoSortScopeXml&&e.writeXml(t.autoSortScopeXml),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.formatsCollector.active)return this.formatsCollector.feedOpen(t,n),!0;if(this.conditionalFormatsCollector.active)return this.conditionalFormatsCollector.feedOpen(t,n),!0;if(this.filtersCollector.active)return this.filtersCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId??`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],pageFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting,itemPrintTitles:n.itemPrintTitles,indent:n.indent===void 0?void 0:parseInt(n.indent,10),compact:n.compact!==`0`,compactData:n.compactData!==`0`,multipleFieldFilters:n.multipleFieldFilters,outline:n.outline===`1`,outlineData:n.outlineData===`1`,chartFormat:n.chartFormat===void 0?void 0:parseInt(n.chartFormat,10),colGrandTotals:n.colGrandTotals,rowGrandTotals:n.rowGrandTotals,showError:n.showError,errorCaption:n.errorCaption,showMissing:n.showMissing,missingCaption:n.missingCaption,grandTotalCaption:n.grandTotalCaption,rowItems:[],colItems:[],chartFormats:[],isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow===void 0?void 0:parseInt(n.firstHeaderRow,10),firstDataRow:n.firstDataRow===void 0?void 0:parseInt(n.firstDataRow,10),firstDataCol:n.firstDataCol===void 0?void 0:parseInt(n.firstDataCol,10),rowPageCount:n.rowPageCount===void 0?void 0:parseInt(n.rowPageCount,10),colPageCount:n.colPageCount===void 0?void 0:parseInt(n.colPageCount,10)});break;case`pivotFields`:this.state.currentSection=`pivotFields`;break;case`pivotField`:if(this.state.currentSection===`pivotFields`){let e={};for(let[t,r]of Object.entries(n))bo.has(t)||(e[t]=String(r));this.currentPivotField={axis:_o.has(n.axis)?n.axis:void 0,dataField:n.dataField===`1`,items:[],compact:n.compact!==`0`,outline:n.outline!==`0`,showAll:n.showAll!==`0`,defaultSubtotal:n.defaultSubtotal!==`0`,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10),sortType:n.sortType,subtotalTop:n.subtotalTop===void 0?void 0:n.subtotalTop===`1`,insertBlankRow:n.insertBlankRow===`1`?!0:void 0,multipleItemSelectionAllowed:n.multipleItemSelectionAllowed===`1`?!0:void 0,extraAttrs:Object.keys(e).length>0?e:void 0}}break;case`items`:break;case`item`:if(this.currentPivotField){let e={};n.x!==void 0&&(e.x=parseInt(n.x,10));for(let t of vo)t!==`x`&&n[t]!==void 0&&(e[t]=n[t]);this.currentPivotField.items.push(e)}break;case`autoSortScope`:this.currentPivotField&&(this.state.inAutoSortScope=!0,this.autoSortScopeXmlBuffer=[`<autoSortScope>`]);break;case`rowFields`:this.state.currentSection=`rowFields`;break;case`colFields`:this.state.currentSection=`colFields`,this.model&&(this.model.hasColFields=!0);break;case`dataFields`:this.state.currentSection=`dataFields`;break;case`pageFields`:this.state.currentSection=`pageFields`;break;case`pageField`:this.state.currentSection===`pageFields`&&this.model&&this.model.pageFields.push({fld:parseInt(n.fld??`0`,10),item:n.item===void 0?void 0:parseInt(n.item,10),hier:n.hier===void 0?void 0:parseInt(n.hier,10),name:n.name});break;case`rowItems`:this.state.currentSection=`rowItems`,this.model&&(this.model.hasRowItems=!0);break;case`colItems`:this.state.currentSection=`colItems`,this.model&&(this.model.hasColItems=!0);break;case`i`:if(this.model){let e=this.state.currentSection===`rowItems`||this.state.currentSection===`colItems`?So(n):null;this.state.currentSection===`rowItems`?this.currentRowItem=e:this.state.currentSection===`colItems`&&(this.currentColItem=e)}break;case`x`:if(this.state.inPivotArea){let e=lo(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(e?`<x ${e}/>`:`<x/>`):this.pivotAreaXmlBuffer.push(e?`<x ${e}/>`:`<x/>`)}else this.currentRowItem?this.currentRowItem.x.push({v:parseInt(n.v??`0`,10)}):this.currentColItem&&this.currentColItem.x.push({v:parseInt(n.v??`0`,10)});break;case`chartFormats`:this.state.currentSection=`chartFormats`;break;case`chartFormat`:this.state.currentSection===`chartFormats`&&this.model&&(this.currentChartFormat={chart:parseInt(n.chart??`0`,10),format:parseInt(n.format??`0`,10),series:n.series===void 0?void 0:n.series===`1`});break;case`pivotArea`:if(this.currentChartFormat){this.state.inPivotArea=!0;let e=lo(n);this.pivotAreaXmlBuffer=[e?`<pivotArea ${e}>`:`<pivotArea>`]}else if(this.state.inAutoSortScope){this.state.inPivotArea=!0;let e=lo(n);this.autoSortScopeXmlBuffer.push(e?`<pivotArea ${e}>`:`<pivotArea>`)}break;case`references`:case`reference`:if(this.state.inPivotArea){let e=lo(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`<${t}${e?` `+e:``}>`):this.pivotAreaXmlBuffer.push(`<${t}${e?` `+e:``}>`)}break;case`field`:if(this.model){let e=parseInt(n.x??`0`,10);this.state.currentSection===`rowFields`?this.model.rowFields.push(e):this.state.currentSection===`colFields`&&this.model.colFields.push(e)}break;case`dataField`:this.state.currentSection===`dataFields`&&this.model&&this.model.dataFields.push({name:n.name??``,fld:parseInt(n.fld??`0`,10),baseField:n.baseField===void 0?void 0:parseInt(n.baseField,10),baseItem:n.baseItem===void 0?void 0:parseInt(n.baseItem,10),subtotal:Et.has(n.subtotal)?n.subtotal:void 0,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10)});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name,this.model.styleInfo={name:n.name,showRowHeaders:n.showRowHeaders,showColHeaders:n.showColHeaders,showRowStripes:n.showRowStripes,showColStripes:n.showColStripes,showLastColumn:n.showLastColumn});break;case`extLst`:this.model&&this.extLstCollector.start(n);break;case`formats`:this.model&&this.formatsCollector.start(n);break;case`conditionalFormats`:this.model&&this.conditionalFormatsCollector.start(n);break;case`filters`:this.model&&this.filtersCollector.start(n);break;default:this.model&&this.state.currentSection===null&&!this.state.inPivotArea&&!this.state.inAutoSortScope&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){this.extLstCollector.active?this.extLstCollector.feedText(e):this.formatsCollector.active?this.formatsCollector.feedText(e):this.conditionalFormatsCollector.active?this.conditionalFormatsCollector.feedText(e):this.filtersCollector.active?this.filtersCollector.feedText(e):this.unknownCollector.active&&this.unknownCollector.feedText(e)}tryCloseCollector(e,t,n){e.feedClose(t)&&(this.model&&(this.model[n]=e.result),e.reset())}parseClose(e){if(this.extLstCollector.active)return this.tryCloseCollector(this.extLstCollector,e,`extLstXml`),!0;if(this.formatsCollector.active)return this.tryCloseCollector(this.formatsCollector,e,`formatsXml`),!0;if(this.conditionalFormatsCollector.active)return this.tryCloseCollector(this.conditionalFormatsCollector,e,`conditionalFormatsXml`),!0;if(this.filtersCollector.active)return this.tryCloseCollector(this.filtersCollector,e,`filtersXml`),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.state.inPivotArea)return e===`pivotArea`?(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</pivotArea>`):(this.pivotAreaXmlBuffer.push(`</pivotArea>`),this.currentChartFormat&&(this.currentChartFormat.pivotAreaXml=this.pivotAreaXmlBuffer.join(``)),this.pivotAreaXmlBuffer=[]),this.state.inPivotArea=!1,!0):((e===`references`||e===`reference`)&&(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</${e}>`):this.pivotAreaXmlBuffer.push(`</${e}>`)),!0);switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`pivotFields`:case`rowFields`:case`colFields`:case`dataFields`:case`pageFields`:case`rowItems`:case`colItems`:case`chartFormats`:this.state.currentSection=null;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:break;case`autoSortScope`:this.state.inAutoSortScope&&this.currentPivotField&&(this.autoSortScopeXmlBuffer.push(`</autoSortScope>`),this.currentPivotField.autoSortScopeXml=this.autoSortScopeXmlBuffer.join(``),this.autoSortScopeXmlBuffer=[],this.state.inAutoSortScope=!1);break;case`i`:this.currentRowItem&&this.model?(this.model.rowItems?.push(this.currentRowItem),this.currentRowItem=null):this.currentColItem&&this.model&&(this.model.colItems?.push(this.currentColItem),this.currentColItem=null);break;case`chartFormat`:this.currentChartFormat&&this.model&&(this.model.chartFormats?.push(this.currentChartFormat),this.currentChartFormat=null);break}return!0}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}static{this.EXTLST_XML=`<extLst><ext uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:pivotTableDefinition hideValuesRow="1" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"/></ext><ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}" xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout"><xpdl:pivotTableDefinition16 EnabledSubtotalsDefault="0" SubtotalsOnTopDefault="0"/></ext></extLst>`}};function So(e){return{t:e.t,r:e.r===void 0?void 0:parseInt(e.r,10),i:e.i===void 0?void 0:parseInt(e.i,10),x:[]}}function Co(e,t,n,r){e.openNode(`dataFields`,{count:n.length});for(let i=0;i<n.length;i++){let a=n[i],o=r[i]??`sum`,s=Tt[o],c=t[a];if(!c)throw Error(`Value field index ${a} is out of bounds (cacheFields has ${t.length} entries)`);let l={name:`${s} of ${c.name}`,fld:a,baseField:0,baseItem:0};o!==`sum`&&(l.subtotal=o),e.leafNode(`dataField`,l)}e.closeNode()}function wo(e,t){let n=new Set(t.rows),r=new Set(t.columns),i=new Set(t.values),a=new Set(t.pages??[]);e.openNode(`pivotFields`,{count:t.cacheFields.length});for(let o=0;o<t.cacheFields.length;o++){let s=t.cacheFields[o];To(e,n.has(o),r.has(o),i.has(o),a.has(o),s.sharedItems)}e.closeNode()}function To(e,t,n,r,i,a){if(t||n||i){if(!a)throw Error(`sharedItems is required for axis field (row/column/page)`);let i={axis:t?`axisRow`:n?`axisCol`:`axisPage`};r&&(i.dataField=`1`),i.compact=`0`,i.outline=`0`,i.showAll=`0`,e.openNode(`pivotField`,i),e.openNode(`items`,{count:a.length+1});for(let t=0;t<a.length;t++)e.leafNode(`item`,{x:t});e.leafNode(`item`,{t:`default`}),e.closeNode(),e.closeNode();return}let o={};r&&(o.dataField=`1`),o.compact=`0`,o.outline=`0`,o.showAll=`0`,o.defaultSubtotal=`0`,e.leafNode(`pivotField`,o)}var Eo=class extends L{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Fn,this._richTextXform}render(e,t){let n=t||this.model;e.openNode(`comment`,{ref:n.ref,authorId:0}),e.openNode(`text`),n&&n.note&&n.note.texts&&n.note.texts.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`comment`:return this.model={type:`note`,note:{texts:[]},...e.attributes},!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`comment`:return!1;case`r`:return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}},Do=class e extends L{constructor(){super(),this.map={comment:new Eo},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(`comments`,e.COMMENTS_ATTRIBUTES),t.openNode(`authors`),t.leafNode(`author`,null,`Author`),t.closeNode(),t.openNode(`commentList`),r.comments.forEach(e=>{this.map.comment.render(t,e)}),t.closeNode(),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`commentList`:return this.model={comments:[]},!0;case`comment`:return this.parser=this.map.comment,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`commentList`:return!1;case`comment`:return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.COMMENTS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}},Oo=class extends L{constructor(){super(),this.model={}}get tag(){return`v:textbox`}conversionUnit(e,t,n){return`${(parseFloat(e.toString())*t).toFixed(2)}${n}`}reverseConversionUnit(e){return(e??``).split(`,`).map(e=>Number(parseFloat(this.conversionUnit(parseFloat(e),.1,``)).toFixed(2)))}render(e,t){let n={style:`mso-direction-alt:auto`};if(t&&t.note){let{inset:e}=t.note&&t.note.margins||{};Array.isArray(e)&&(e=e.map(e=>this.conversionUnit(e,10,`mm`)).join(`,`)),e&&(n.inset=e)}e.openNode(`v:textbox`,n),e.leafNode(`div`,{style:`text-align:left`}),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:return this.model={inset:this.reverseConversionUnit(e.attributes.inset)},!0;default:return!0}}parseText(){}parseClose(e){switch(e){case this.tag:return!1;default:return!0}}},ko=class extends L{constructor(){super(),this.text=``}get tag(){return`x:Anchor`}getAnchorRect(e){let t=Math.floor(e.left),n=Math.floor((e.left-t)*68),r=Math.floor(e.top),i=Math.floor((e.top-r)*18),a=Math.floor(e.right),o=Math.floor((e.right-a)*68),s=Math.floor(e.bottom);return[t,n,r,i,a,o,s,Math.floor((e.bottom-s)*18)]}getDefaultRect(e){let t=e.col,n=Math.max(e.row-2,0);return[t,6,n,14,t+2,2,n+4,16]}render(e,t){let n=t.anchor?this.getAnchorRect(t.anchor):this.getDefaultRect(t.refAddress);e.leafNode(`x:Anchor`,null,n.join(`, `))}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},Ao=class extends L{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model?.tag??``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},jo=class extends L{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model?.tag??``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};let Mo=[`twoCells`,`oneCells`,`absolute`];var No=class extends L{constructor(){super(),this.map={"x:Anchor":new ko,"x:Locked":new Ao({tag:`x:Locked`}),"x:LockText":new Ao({tag:`x:LockText`}),"x:SizeWithCells":new jo({tag:`x:SizeWithCells`}),"x:MoveWithCells":new jo({tag:`x:MoveWithCells`})},this.model={anchor:[],protection:{},editAs:``}}get tag(){return`x:ClientData`}render(e,t){let{protection:n,editAs:r}=t.note;e.openNode(this.tag,{ObjectType:`Note`}),this.map[`x:MoveWithCells`].render(e,r,Mo),this.map[`x:SizeWithCells`].render(e,r,Mo),this.map[`x:Anchor`].render(e,t),this.map[`x:Locked`].render(e,n.locked),e.leafNode(`x:AutoFill`,null,`False`),this.map[`x:LockText`].render(e,n.lockText),e.leafNode(`x:Row`,null,t.refAddress.row-1),e.leafNode(`x:Column`,null,t.refAddress.col-1),e.closeNode()}parseOpen(e){switch(e.name){case this.tag:this.reset(),this.model={anchor:[],protection:{},editAs:``};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.normalizeModel(),!1;default:return!0}}normalizeModel(){let e=Object.assign({},this.map[`x:MoveWithCells`].model,this.map[`x:SizeWithCells`].model),t=Object.keys(e).length;this.model.editAs=Mo[t],this.model.anchor=this.map[`x:Anchor`].text,this.model.protection.locked=this.map[`x:Locked`].text,this.model.protection.lockText=this.map[`x:LockText`].text}},Po=class e extends L{constructor(){super(),this.map={"v:textbox":new Oo,"x:ClientData":new No}}get tag(){return`v:shape`}render(t,n,r){t.openNode(`v:shape`,e.V_SHAPE_ATTRIBUTES(n,r??0)),t.leafNode(`v:fill`,{color2:`infoBackground [80]`}),t.leafNode(`v:shadow`,{color:`none [81]`,obscured:`t`}),t.leafNode(`v:path`,{"o:connecttype":`none`}),this.map[`v:textbox`].render(t,n),this.map[`x:ClientData`].render(t,n),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={margins:{insetmode:e.attributes[`o:insetmode`]},anchor:``,editAs:``,protection:{}};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.margins.inset=this.map[`v:textbox`].model&&this.map[`v:textbox`].model.inset,this.model.protection=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.protection,this.model.anchor=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.anchor,this.model.editAs=this.map[`x:ClientData`].model&&this.map[`x:ClientData`].model.editAs,!1;default:return!0}}static{this.V_SHAPE_ATTRIBUTES=(e,t)=>({id:`_x0000_s${1025+t}`,type:`#_x0000_t202`,style:`position:absolute; margin-left:105.3pt;margin-top:10.5pt;width:97.8pt;height:59.1pt;z-index:1;visibility:hidden`,fillcolor:`infoBackground [80]`,strokecolor:`none [81]`,"o:insetmode":e.note.margins&&e.note.margins.insetmode})}},Fo=class e extends L{constructor(){super(),this.map={"v:shape":new Po},this.model={comments:[],formControls:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model,i=r.comments,a=r.formControls,o=i&&i.length>0,s=a&&a.length>0;if(t.openXml(F.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),o&&(t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode()),s&&(t.openNode(`v:shapetype`,{id:`_x0000_t201`,coordsize:`21600,21600`,"o:spt":`201`,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{shadowok:`f`,"o:extrusionok":`f`,strokeok:`f`,fillok:`f`,"o:connecttype":`rect`}),t.leafNode(`o:lock`,{"v:ext":`edit`,shapetype:`t`}),t.closeNode()),o)for(let e=0;e<i.length;e++)this.map[`v:shape`].render(t,i[e],e);if(s)for(let e of a)this._renderCheckboxShape(t,e);t.closeNode()}_renderCheckboxShape(e,t){let n={id:`_x0000_s${t.shapeId}`,type:`#_x0000_t201`,style:Ae.getVmlStyle(t),"o:insetmode":`auto`,fillcolor:`buttonFace [67]`,strokecolor:`windowText [64]`,"o:preferrelative":`t`,filled:`f`,stroked:`f`};e.openNode(`v:shape`,n),e.leafNode(`v:fill`,{"o:detectmouseclick":`t`}),e.leafNode(`o:lock`,{"v:ext":`edit`,text:`t`}),t.text&&(e.openNode(`v:textbox`,{style:`mso-direction-alt:auto`,"o:singleclick":`t`}),e.openNode(`div`,{style:`text-align:left`}),e.openNode(`font`,{face:`Tahoma`,size:`160`,color:`auto`}),e.writeText(t.text),e.closeNode(),e.closeNode(),e.closeNode()),e.openNode(`x:ClientData`,{ObjectType:`Checkbox`}),e.leafNode(`x:MoveWithCells`),e.leafNode(`x:SizeWithCells`),e.openNode(`x:Anchor`),e.writeText(Ae.getVmlAnchor(t)),e.closeNode(),e.leafNode(`x:Locked`,void 0,`False`),e.leafNode(`x:LockText`,void 0,`True`),e.leafNode(`x:PrintObject`,void 0,t.print?`True`:`False`),e.leafNode(`x:AutoFill`,void 0,`False`),e.leafNode(`x:AutoLine`,void 0,`False`),e.leafNode(`x:TextHAlign`,void 0,`Left`),e.leafNode(`x:TextVAlign`,void 0,`Center`),t.link&&e.leafNode(`x:FmlaLink`,void 0,t.link),t.noThreeD&&e.leafNode(`x:NoThreeD`),e.leafNode(`x:Checked`,void 0,String(Ae.getVmlCheckedValue(t))),e.leafNode(`x:Row`,void 0,String(t.tl.row)),e.leafNode(`x:Column`,void 0,String(t.tl.col)),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[],formControls:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},Io=class extends L{_checkedToXmlValue(e){switch(e){case`Checked`:return`1`;case`Mixed`:return`2`;default:return`0`}}get tag(){return`formControlPr`}render(e,t){let n=t||this.model,r={xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,objectType:`CheckBox`,checked:this._checkedToXmlValue(n.checked),lockText:`1`};n.link&&(r.fmlaLink=n.link),n.noThreeD&&(r.noThreeD=`1`),e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.leafNode(this.tag,r)}toXml(e){let t=new F;return this.render(t,e),t.xml}parseOpen(){return!0}parseText(){}parseClose(){return!1}};let Lo=new TextEncoder;var Ro=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||=this._buf.slice(0,this._inPos),this._buffer}reset(e){e??=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=Lo.encode(e),n=this._inPos+t.length;n>this._buf.length-4&&this._grow(n),this._buf.set(t,this._inPos),this._inPos+=t.length}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}},zo=class{constructor(e){this._data=e}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=new TextEncoder().encode(this._data),this._buffer}},Bo=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Vo=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},Ho=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.slice(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.slice(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,t+r),this.iWrite+=r,r}},Uo=class extends M{constructor(e){super(),this._writableStream=null,this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),this.bufSize=e?.bufSize||1024*1024,this.buffers=[],this.batch=e?.batch??!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this._ended=!1}get writable(){return!this._ended}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new Ho(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){typeof t==`function`&&(n=t),n||=()=>{};let r;if(e instanceof Ro||e&&e.constructor?.name===`StringBuf`)r=new Bo(e);else if(e instanceof Uint8Array)r=new Vo(e);else if(ArrayBuffer.isView(e))r=new Vo(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Vo(new Uint8Array(e));else if(typeof e==`string`)r=new zo(e);else throw Error(`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;){let e=this.buffers.shift();await this._pipeChunk(new Vo(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer(),t=!1;!this.paused&&this.listenerCount(`data`)>0&&(this.emit(`data`,e),t=!0),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e)),t=!0),t||(this._writeToBuffers(r),this.emit(`readable`))}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Vo(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`)}).catch(e=>{this.emit(`error`,e)}):this.emit(`finish`)};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return Wo(t)}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],Wo(t)}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return typeof Buffer<`u`&&n instanceof Buffer?n.toString(t):new TextDecoder(t).decode(n)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}pipeTo(e){this._writableStream=e,this._writableStreamWriter=e.getWriter()}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw Error(`Not Implemented`)}wrap(){throw Error(`Not Implemented`)}push(e){return e!==null&&this.write(e),!0}};function Wo(e){if(typeof Buffer<`u`&&typeof Buffer.concat==`function`)return Buffer.concat(e);if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let Go=null;function Ko(){if(Go)return Go;let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return Go=e,e}function qo(e,t){let n=Ko();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function Jo(e){return(e^4294967295)>>>0}function Yo(e){return Jo(qo(4294967295,e))}function Xo(e){let t=0;for(let n=0;n<e.length;n++)t+=e[n].length;return t}function Zo(e){let t=e.length;if(t===0)return new Uint8Array;if(t===1)return e[0];let n=Xo(e),r=new Uint8Array(n),i=0;for(let n=0;n<t;n++){let t=e[n];r.set(t,i),i+=t.length}return r}function Qo(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}let $o=new Uint8Array(288);for(let e=0;e<=143;e++)$o[e]=8;for(let e=144;e<=255;e++)$o[e]=9;for(let e=256;e<=279;e++)$o[e]=7;for(let e=280;e<=287;e++)$o[e]=8;let es=new Uint8Array(32).fill(5),ts=[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],ns=[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],rs=[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],is=[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],as=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function os(e,t){let n=new Uint16Array(16);for(let r=0;r<t;r++)e[r]>0&&n[e[r]]++;let r=new Uint16Array(16),i=0;for(let e=1;e<=15;e++)i=i+n[e-1]<<1,r[e]=i;let a={};for(let n=0;n<t;n++){let t=e[n];if(t===0)continue;i=r[t]++;let o=a;for(let e=t-1;e>=0;e--)i>>e&1?(o.right||={},o=o.right):(o.left||={},o=o.left);o.symbol=n}return a}var ss=class{constructor(e){this.data=e,this.pos=0,this.bitBuf=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.pos>=this.data.length)throw Error(`Unexpected end of DEFLATE data`);this.bitBuf|=this.data[this.pos++]<<this.bitCount,this.bitCount+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>=e,this.bitCount-=e,t}decodeSymbol(e){let t=e;for(;t.symbol===void 0;)if(t=this.readBits(1)===0?t.left:t.right,!t)throw Error(`Invalid Huffman code`);return t.symbol}alignToByte(){this.bitBuf=0,this.bitCount=0}readByte(){if(this.pos>=this.data.length)throw Error(`Unexpected end of data`);return this.data[this.pos++]}readUint16(){return this.readByte()|this.readByte()<<8}};function cs(e){let t=new ss(e),n=[],r=!1;for(;!r;){r=t.readBits(1)===1;let e=t.readBits(2);if(e===0){t.alignToByte();let e=t.readUint16();if((e^t.readUint16())!==65535)throw Error(`Invalid stored block length`);for(let r=0;r<e;r++)n.push(t.readByte())}else if(e===1||e===2){let r,i;if(e===1)r=os($o,288),i=os(es,32);else{let e=t.readBits(5)+257,n=t.readBits(5)+1,a=t.readBits(4)+4,o=new Uint8Array(19);for(let e=0;e<a;e++)o[as[e]]=t.readBits(3);let s=os(o,19),c=new Uint8Array(e+n),l=0;for(;l<e+n;){let e=t.decodeSymbol(s);if(e<16)c[l++]=e;else if(e===16){let e=t.readBits(2)+3,n=c[l-1];for(let t=0;t<e;t++)c[l++]=n}else if(e===17){let e=t.readBits(3)+3;for(let t=0;t<e;t++)c[l++]=0}else if(e===18){let e=t.readBits(7)+11;for(let t=0;t<e;t++)c[l++]=0}}r=os(c.subarray(0,e),e),i=os(c.subarray(e),n)}for(;;){let e=t.decodeSymbol(r);if(e<256)n.push(e);else if(e===256)break;else{let r=e-257,a=ts[r]+t.readBits(ns[r]),o=t.decodeSymbol(i),s=rs[o]+t.readBits(is[o]),c=n.length-s;for(let e=0;e<a;e++)n.push(n[c+e])}}}else throw Error(`Invalid DEFLATE block type: `+e)}return new Uint8Array(n)}function ls(e){let t=65535,n=Math.ceil(e.length/t)||1,r=n*5+e.length,i=new Uint8Array(r),a=0,o=0;for(let r=0;r<n;r++){let s=r===n-1,c=Math.min(t,e.length-o);i[a++]=s?1:0,i[a++]=c&255,i[a++]=c>>8&255,i[a++]=~c&255,i[a++]=~c>>8&255,i.set(e.subarray(o,o+c),a),a+=c,o+=c}return i.subarray(0,a)}function us(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return ls(e);let t=new ds;t.writeBits(1,1),t.writeBits(1,2);let n=new Map,r=0;for(;r<e.length;){let i=0,a=0;if(r+2<e.length){let t=e[r]<<16|e[r+1]<<8|e[r+2],o=n.get(t);if(o!==void 0&&r-o<=32768){let t=r-o,n=0,s=Math.min(258,e.length-r);for(;n<s&&e[o+n]===e[r+n];)n++;n>=3&&(i=n,a=t)}n.set(t,r)}i>=3?(hs(t,i),gs(t,a),r+=i):(ms(t,e[r]),r++)}return ms(t,256),t.finish()}var ds=class{constructor(){this.chunks=[],this.buffer=[],this.bitBuf=0,this.bitCount=0}writeBits(e,t){for(this.bitBuf|=e<<this.bitCount,this.bitCount+=t;this.bitCount>=8;)this.buffer.push(this.bitBuf&255),this.bitBuf>>=8,this.bitCount-=8,this.buffer.length>=65536&&(this.chunks.push(new Uint8Array(this.buffer)),this.buffer=[])}writeBitsReverse(e,t){let n=0;for(let r=0;r<t;r++)n=n<<1|e>>r&1;this.writeBits(n,t)}finish(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),Zo(this.chunks))}};let fs=[],ps=[];for(let e=0;e<=287;e++){let t,n;e<=143?(t=48+e,n=8):e<=255?(t=400+(e-144),n=9):e<=279?(t=e-256,n=7):(t=192+(e-280),n=8),fs[e]=[t,n],ps[e]=n}function ms(e,t){let[n,r]=fs[t];e.writeBitsReverse(n,r)}function hs(e,t){let n,r,i;if(t<=10)n=257+t-3,r=0,i=0;else if(t<=18){let e=t-11;n=265+Math.floor(e/2),r=1,i=e%2}else if(t<=34){let e=t-19;n=269+Math.floor(e/4),r=2,i=e%4}else if(t<=66){let e=t-35;n=273+Math.floor(e/8),r=3,i=e%8}else if(t<=130){let e=t-67;n=277+Math.floor(e/16),r=4,i=e%16}else if(t<=257){let e=t-131;n=281+Math.floor(e/32),r=5,i=e%32}else n=285,r=0,i=0;ms(e,n),r>0&&e.writeBits(i,r)}function gs(e,t){let n=[[1,0,0],[2,1,0],[3,2,0],[4,3,0],[6,4,1],[8,5,1],[12,6,2],[16,7,2],[24,8,3],[32,9,3],[48,10,4],[64,11,4],[96,12,5],[128,13,5],[192,14,6],[256,15,6],[384,16,7],[512,17,7],[768,18,8],[1024,19,8],[1536,20,9],[2048,21,9],[3072,22,10],[4096,23,10],[6144,24,11],[8192,25,11],[12288,26,12],[16384,27,12],[24576,28,13],[32768,29,13]],r=0,i=0,a=1;for(let[e,o,s]of n){if(t<=e){r=o,i=s;break}a=e+1}let o=t-a;e.writeBitsReverse(r,5),i>0&&e.writeBits(o,i)}var _s=class e{static{this.EMPTY=new Uint8Array}constructor(e){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return e.EMPTY;if(this._chunks.length===1)return this._chunks[0].subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let t=new Uint8Array(this._length),n=0;for(let e=0;e<this._chunks.length;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=e===this._chunks.length-1?i+(this._length-n):r.length;if(t.set(r.subarray(i,a),n),n+=a-i,n>=t.length)break}return this._cachedView=t,this._cachedLength=this._length,t}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return new Uint8Array;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._chunks.length===1){let t=this._chunks[0],n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._headOffset=0):this._headOffset>=t.length&&(this._chunks.shift(),this._headOffset=0),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._chunks[0],i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}return this._length===0&&(this._chunks=[],this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._chunks.length===1){let t=this._chunks[0],n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=0;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===0?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._chunks[0],n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&(this._chunks.shift(),this._headOffset=0)}this._length===0&&(this._chunks=[],this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._chunks.length===1){let t=this._chunks[0],a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):Qo(o,e,i)}if(n>4)return Qo(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},d=0;for(let e=0;e<l.length;e++){let t=l[e],f=e===0?this._headOffset:0,p=t.length-f;if(p<=0)continue;let m=d,h=m+p,g=i<=m?f:i>=h?t.length:f+(i-m);if(g>t.length-1){d+=p;continue}let _=t.length-1,v=t.indexOf(a,g);for(;v!==-1&&v<=_;){let i=m+(v-f);if(i>r-n)return-1;if(n===1)return i;if(v+n<=t.length){if(t[v+1]!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;if(t[v+2]!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;if(t[v+3]!==c){v=t.indexOf(a,v+1);continue}return i}let l=u(e,v+1);if(l===null||l!==o){v=t.indexOf(a,v+1);continue}if(n===2)return i;let d=u(e,v+2);if(d===null||d!==s){v=t.indexOf(a,v+1);continue}if(n===3)return i;let p=u(e,v+3);if(p===null||p!==c){v=t.indexOf(a,v+1);continue}return i}d+=p}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=0;e<n.length;e++){let t=n[e],i=e===0?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=0;e<this._chunks.length;e++){let t=this._chunks[e],r=e===0?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function vs(){return typeof CompressionStream<`u`}function ys(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function bs(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let xs=null,Ss=null;function Cs(){return typeof CompressionStream>`u`?!1:(xs===null&&(xs=ys()),xs)}function ws(){return typeof DecompressionStream>`u`?!1:(Ss===null&&(Ss=bs()),Ss)}function Ts(){return Cs()&&ws()}async function Es(e){let t=new _s;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function Ds(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=Es(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function Os(e){return Ds(e,new CompressionStream(`deflate-raw`))}async function ks(e){return Ds(e,new DecompressionStream(`deflate-raw`))}function As(e){return e instanceof Error?e:Error(String(e))}function js(){return!0}function Ms(){return Ts()}var Ns=class extends M{constructor(e,t){super(),this.ended=!1,this.writer=e,this.reader=t,this.readPromise=this._startReading()}async _startReading(){try{for(;;){let{value:e,done:t}=await this.reader.read();if(t)break;e&&this.emit(`data`,e)}this.emit(`end`)}catch(e){this.emit(`error`,As(e))}}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.writer.write(e).then(()=>{t&&t()}).catch(e=>{let n=As(e);t?t(n):this.emit(`error`,n)}),!0}end(e){if(this.ended){e&&e();return}this.ended=!0,this.writer.close().then(()=>this.readPromise).then(()=>{e&&e()}).catch(t=>{let n=As(t);e?e(n):this.emit(`error`,n)})}destroy(e){this.ended=!0,e&&this.emit(`error`,e);try{this.reader.cancel(e)}catch{}try{this.writer.abort(e)}catch{}}},Ps=class extends M{constructor(e){super();let t=new CompressionStream(`deflate-raw`);this.codec=new Ns(t.writable.getWriter(),t.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Fs=class extends M{constructor(e){super(),this.codec=new Is(us),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},Is=class extends M{constructor(e){super(),this.process=e,this.chunks=[],this.ended=!1}write(e,t){if(this.ended){let e=Error(`write after end`);return t?t(e):this.emit(`error`,e),!1}return this.chunks.push(e),t&&queueMicrotask(()=>t()),!0}end(e){if(this.ended){e&&e();return}this.ended=!0;try{let t=Zo(this.chunks),n=this.process(t);this.emit(`data`,n),this.emit(`end`),e&&e()}catch(t){let n=As(t);this.emit(`error`,n),e&&e(n)}}destroy(e){this.ended=!0,e&&this.emit(`error`,e)}};function Ls(e={}){let t=e.level??6;return Ms()?new Ps(t):new Fs(t)}var Rs=class extends M{constructor(){super();let e=new DecompressionStream(`deflate-raw`);this.codec=new Ns(e.writable.getWriter(),e.readable.getReader()),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}},zs=class extends M{constructor(){super(),this.codec=new Is(cs),this.codec.on(`data`,e=>this.emit(`data`,e)),this.codec.on(`end`,()=>this.emit(`end`)),this.codec.on(`error`,e=>this.emit(`error`,e))}write(e,t){return this.codec.write(e,t)}end(e){this.codec.end(e)}destroy(e){this.codec.destroy(e)}};function Bs(){return Ms()?new Rs:new zs}let Vs=new TextEncoder,Hs=new TextDecoder(`utf-8`);function Us(e){return Vs.encode(e)}function Ws(e){return Hs.decode(e)}function Gs(e){let t=``,n=32768;for(let r=0;r<e.length;r+=n){let i=e.subarray(r,r+n);t+=String.fromCharCode(...i)}return t}function Ks(e){return!Number.isFinite(e)||e<=0?0:e>=4294967295?4294967295:e>>>0}function qs(e){return Ks(Math.floor(e.getTime()/1e3))}function Js(e){let t=Ks(e),n=new Uint8Array(9),r=new DataView(n.buffer);return r.setUint16(0,21589,!0),r.setUint16(2,5,!0),n[4]=1,r.setUint32(5,t,!0),n}function Ys(e){return Js(qs(e))}function Xs(e){return[(e.getHours()&31)<<11|(e.getMinutes()&63)<<5|e.getSeconds()>>1&31,(e.getFullYear()-1980&127)<<9|(e.getMonth()+1&15)<<5|e.getDate()&31]}function Zs(e,t){let n=e&31,r=e>>5&15,i=(e>>9&127)+1980,a=t?(t&31)*2:0,o=t?t>>5&63:0,s=t?t>>11:0;return new Date(Date.UTC(i,r-1,n,s,o,a))}function Qs(e,t,n){return n===void 0?Zs(e,t):new Date(n*1e3)}function $s(e,t){return t===`dos+utc`?Ys(e):new Uint8Array}function ec(e){let[t,n]=Xs(e);return{dosTime:t,dosDate:n}}let tc=67324752,nc=33639248,rc=101010256,ic=134695760,ac=2048;function oc(e,t,n,r){let i=r.versionNeeded??20;return t.setUint32(n+0,tc,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,r.flags,!0),t.setUint16(n+8,r.compressionMethod,!0),t.setUint16(n+10,r.dosTime,!0),t.setUint16(n+12,r.dosDate,!0),t.setUint32(n+14,r.crc32,!0),t.setUint32(n+18,r.compressedSize,!0),t.setUint32(n+22,r.uncompressedSize,!0),t.setUint16(n+26,r.fileName.length,!0),t.setUint16(n+28,r.extraField.length,!0),e.set(r.fileName,n+30),r.extraField.length>0&&e.set(r.extraField,n+30+r.fileName.length),30+r.fileName.length+r.extraField.length}function sc(e){let t=new Uint8Array(30+e.fileName.length+e.extraField.length);return oc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function cc(e,t,n,r){let i=r.versionMadeBy??20,a=r.versionNeeded??20,o=r.externalAttributes??0;return t.setUint32(n+0,nc,!0),t.setUint16(n+4,i,!0),t.setUint16(n+6,a,!0),t.setUint16(n+8,r.flags,!0),t.setUint16(n+10,r.compressionMethod,!0),t.setUint16(n+12,r.dosTime,!0),t.setUint16(n+14,r.dosDate,!0),t.setUint32(n+16,r.crc32,!0),t.setUint32(n+20,r.compressedSize,!0),t.setUint32(n+24,r.uncompressedSize,!0),t.setUint16(n+28,r.fileName.length,!0),t.setUint16(n+30,r.extraField.length,!0),t.setUint16(n+32,r.comment.length,!0),t.setUint16(n+34,0,!0),t.setUint16(n+36,0,!0),t.setUint32(n+38,o,!0),t.setUint32(n+42,r.localHeaderOffset,!0),e.set(r.fileName,n+46),r.extraField.length>0&&e.set(r.extraField,n+46+r.fileName.length),r.comment.length>0&&e.set(r.comment,n+46+r.fileName.length+r.extraField.length),46+r.fileName.length+r.extraField.length+r.comment.length}function lc(e){let t=new Uint8Array(46+e.fileName.length+e.extraField.length+e.comment.length);return cc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function uc(e,t,n,r){return t.setUint32(n+0,rc,!0),t.setUint16(n+4,0,!0),t.setUint16(n+6,0,!0),t.setUint16(n+8,r.entryCount,!0),t.setUint16(n+10,r.entryCount,!0),t.setUint32(n+12,r.centralDirSize,!0),t.setUint32(n+16,r.centralDirOffset,!0),t.setUint16(n+20,r.comment.length,!0),r.comment.length>0&&e.set(r.comment,n+22),22+r.comment.length}function dc(e){let t=new Uint8Array(22+e.comment.length);return uc(t,new DataView(t.buffer,t.byteOffset,t.byteLength),0,e),t}function fc(e,t,n){let r=new Uint8Array(16),i=new DataView(r.buffer);return i.setUint32(0,ic,!0),i.setUint32(4,e,!0),i.setUint32(8,t,!0),i.setUint32(12,n,!0),r}function pc(e){return e?8:0}function mc(e){return e?ac|8:ac}function hc(e){let t=Us(e.name),n=Us(e.comment??``),{dosTime:r,dosDate:i}=ec(e.modTime);return{nameBytes:t,commentBytes:n,dosTime:r,dosDate:i,extraField:$s(e.modTime,e.timestamps),compressionMethod:pc(e.deflate),flags:mc(e.useDataDescriptor)}}function gc(e){return Math.log(e)/Math.LN2}function _c(e){let t=new Uint32Array(256);for(let n=0;n<e.length;n++)t[e[n]]+=1;let n=0,r=e.length;for(let e=0;e<256;e++){let i=t[e];if(i===0)continue;let a=i/r;n-=a*gc(a)}return n}function vc(e,t={}){let n=t.sampleBytes??65536,r=t.minDecisionBytes??16384,i=Math.min(e.length,n);if(i<r)return!1;let a=e.subarray(0,i),o=new Uint8Array(256),s=0;for(let e=0;e<a.length;e++){let t=a[e];if(o[t]===0&&(o[t]=1,s+=1,s>=200))break}return s<200?!1:_c(a)>=7.95}var yc=class{constructor(e,t){this._deflate=null,this._crc=4294967295,this._uncompressedSize=0,this._compressedSize=0,this._finalized=!1,this._headerEmitted=!1,this._ondata=null,this._onerror=null,this._centralDirEntryInfo=null,this._pendingEnd=!1,this._emittedDataDescriptor=!1,this._localHeader=null,this._deflateWanted=null,this._pendingChunks=[],this._sampleLen=0,this._completeResolve=null,this._completeReject=null,this._completePromise=null,this._completeError=null,this._dataQueue=[],this._finalQueued=!1,this._pushChain=Promise.resolve(),this.name=e;let n=t?.modTime??new Date;this._modTime=n,this.level=t?.level??6,this._smartStore=t?.smartStore??!0,this._sampleBuffer=this._smartStore?new Uint8Array(64*1024):new Uint8Array;let r=hc({name:e,comment:t?.comment??``,modTime:n,timestamps:t?.timestamps??`dos`,useDataDescriptor:!0,deflate:!1});if(this.nameBytes=r.nameBytes,this.commentBytes=r.commentBytes,this.dosTime=r.dosTime,this.dosDate=r.dosDate,this.extraField=r.extraField,this._flags=r.flags,this._compressionMethod=r.compressionMethod,!this._smartStore){let e=this.level>0;this._deflateWanted=e,this._compressionMethod=this._buildCompressionMethod(e),e&&this._initDeflateStream();return}this.level===0&&(this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1))}_buildCompressionMethod(e){return pc(e)}_initDeflateStream(){this._deflate||(this._deflate=Ls({level:this.level}),this._deflate.on(`error`,e=>{this._rejectComplete(e)}),this._deflate.on(`data`,e=>{this._compressedSize+=e.length,this._enqueueData(e,!1)}),this._deflate.on(`end`,()=>{this._pendingEnd&&!this._emittedDataDescriptor&&(this._emittedDataDescriptor=!0,this._emitDataDescriptor())}))}_buildLocalHeader(){return sc({fileName:this.nameBytes,extraField:this.extraField,flags:this._flags,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,crc32:0,compressedSize:0,uncompressedSize:0,versionNeeded:20})}_accumulateSample(e){if(this._deflateWanted!==null||this._sampleLen>=this._sampleBuffer.length)return;let t=Math.min(this._sampleBuffer.length-this._sampleLen,e.length);t<=0||(this._sampleBuffer.set(e.subarray(0,t),this._sampleLen),this._sampleLen+=t)}_shouldDecide(e){return this._deflateWanted===null?e||this._sampleLen>=16*1024:!1}_decideCompressionIfNeeded(e){if(this._deflateWanted===null){if(e&&this._sampleLen===0){this._deflateWanted=!1,this._compressionMethod=this._buildCompressionMethod(!1),this._localHeader=null;return}this._deflateWanted=!vc(this._sampleBuffer.subarray(0,this._sampleLen)),this._compressionMethod=this._buildCompressionMethod(this._deflateWanted),this._localHeader=null,this._deflateWanted&&this._initDeflateStream()}}_emitHeaderIfNeeded(){this._headerEmitted||=(this._emitHeader(),!0)}async _flushPendingChunks(){if(this._pendingChunks.length!==0){for(let e of this._pendingChunks)await this._writeData(e);this._pendingChunks=[]}}_enqueueData(e,t){this._ondata?this._ondata(e,t):(this._dataQueue.push(e),t&&(this._finalQueued=!0))}_flushQueue(){if(!this._ondata)return;let e=this._dataQueue.length,t=this._finalQueued?e-1:-1;for(let n=0;n<e;n++)this._ondata(this._dataQueue[n],n===t);this._dataQueue=[],this._finalQueued=!1}get ondata(){return this._ondata??void 0}set ondata(e){this._ondata=e,this._flushQueue()}get onerror(){return this._onerror??void 0}set onerror(e){this._onerror=e,this._completeError&&e(this._completeError)}_resolveComplete(){this._completeResolve&&this._completeResolve()}_rejectComplete(e){this._completeError||(this._completeError=e,this._onerror&&this._onerror(e),this._completeReject&&this._completeReject(e))}_ensureCompletePromise(){return this._completeError?Promise.reject(this._completeError):this._emittedDataDescriptor?Promise.resolve():(this._completePromise||=new Promise((e,t)=>{this._completeResolve=e,this._completeReject=t}),this._completePromise)}_tapCallback(e,t){t&&e.then(()=>t()).catch(e=>t(e))}_writeData(e){return e.length===0?Promise.resolve():(this._crc=qo(this._crc,e),this._uncompressedSize+=e.length,this._deflate?new Promise((t,n)=>{this._deflate.write(e,e=>{e?n(e):t()})}):(this._compressedSize+=e.length,this._enqueueData(e,!1),Promise.resolve()))}_endDeflateAndWait(){return new Promise((e,t)=>{let n=this._deflate,r=e=>{a(),t(e)},i=()=>{a(),e()},a=()=>{n.off(`error`,r),n.off(`end`,i)};n.once(`error`,r),n.once(`end`,i),n.end()})}_finalizeAfterWrite(e){this._finalized=!0,this._pendingEnd=!0;let t=this._ensureCompletePromise();return this._deflate?e.then(()=>this._endDeflateAndWait()).then(()=>t):(this._emittedDataDescriptor=!0,this._emitDataDescriptor(),t)}_pushUnchained(e,t,n){if(this._finalized){let e=Promise.reject(Error(`Cannot push to finalized ZipDeflateFile`));return this._tapCallback(e,n),e}if(this._deflateWanted===null){if(this._accumulateSample(e),!this._shouldDecide(t)){e.length>0&&this._pendingChunks.push(e);let t=Promise.resolve();return this._tapCallback(t,n),t}this._decideCompressionIfNeeded(t),this._emitHeaderIfNeeded();let r=this._pendingChunks.length>0,i=this._flushPendingChunks(),a=i;e.length>0&&(a=r?i.then(()=>this._writeData(e)):this._writeData(e));let o=t?this._finalizeAfterWrite(a):a;return this._tapCallback(o,n),o}this._emitHeaderIfNeeded();let r=this._writeData(e),i=t?this._finalizeAfterWrite(r):r;return this._tapCallback(i,n),i}push(e,t=!1,n){let r=this._pushChain=this._pushChain.then(()=>this._pushUnchained(e,t,n));return r.catch(()=>{}),r}_emitHeader(){this._localHeader||=this._buildLocalHeader(),this._enqueueData(this._localHeader,!1)}_emitDataDescriptor(){let e=Jo(this._crc),t=fc(e,this._compressedSize,this._uncompressedSize);this._centralDirEntryInfo={name:this.nameBytes,extraField:this.extraField,comment:this.commentBytes,flags:this._flags,crc:e,compressedSize:this._compressedSize,uncompressedSize:this._uncompressedSize,compressionMethod:this._compressionMethod,dosTime:this.dosTime,dosDate:this.dosDate,offset:-1},this._enqueueData(t,!0),this._resolveComplete()}complete(){return this._ensureCompletePromise()}getEntryInfo(){if(!this._centralDirEntryInfo)return null;let e=this.name;return{path:e,isDirectory:e.endsWith(`/`)||e.endsWith(`\\`),compressedSize:this._centralDirEntryInfo.compressedSize,uncompressedSize:this._centralDirEntryInfo.uncompressedSize,compressionMethod:this._centralDirEntryInfo.compressionMethod,crc32:this._centralDirEntryInfo.crc,lastModified:this._modTime,localHeaderOffset:this._centralDirEntryInfo.offset,comment:Ws(this._centralDirEntryInfo.comment),externalAttributes:0,isEncrypted:!1}}getCentralDirectoryEntryInfo(){return this._centralDirEntryInfo}isComplete(){return this._emittedDataDescriptor&&this._centralDirEntryInfo!==null}},bc=class{constructor(e,t){this.entries=[],this.currentOffset=0,this.ended=!1,this.endPending=!1,this.fileQueue=[],this.fileQueueIndex=0,this.activeFile=null,this.callback=e,this.zipComment=t?.comment?Us(t.comment):new Uint8Array}add(e){if(this.ended)throw Error(`Cannot add files after calling end() `);this.fileQueue.push(e),this.activeFile||this._processNextFile()}_processNextFile(){if(this.fileQueueIndex>=this.fileQueue.length){this.activeFile=null,this.fileQueue=[],this.fileQueueIndex=0,this.endPending&&this._finalize();return}let e=this.fileQueue[this.fileQueueIndex++];this.activeFile=e;let t=this.currentOffset,n=new Uint8Array;e.onerror=e=>{this.ended||(this.ended=!0,this.callback(e,n,!0))},e.ondata=(n,r)=>{if(!this.ended&&(this.currentOffset+=n.length,this.callback(null,n,!1),r)){let n=e.getCentralDirectoryEntryInfo();n&&(n.offset=t,this.entries.push(n)),this._processNextFile()}}}_finalize(){if(this.ended)return;this.ended=!0;let e=this.currentOffset,t=0,n=new Uint8Array;for(let e of this.entries){let r=lc({fileName:e.name,extraField:e.extraField,comment:e.comment??n,flags:e.flags,compressionMethod:e.compressionMethod,dosTime:e.dosTime,dosDate:e.dosDate,crc32:e.crc,compressedSize:e.compressedSize,uncompressedSize:e.uncompressedSize,localHeaderOffset:e.offset,versionMadeBy:20,versionNeeded:20});t+=r.length,this.callback(null,r,!1)}let r=dc({entryCount:this.entries.length,centralDirSize:t,centralDirOffset:e,comment:this.zipComment});this.callback(null,r,!0)}end(){this.endPending||this.ended||(this.endPending=!0,this.activeFile||this._finalize())}};async function xc(e,t={}){return(t.level??6)===0?e:Cs()?Os(e):us(e)}function Sc(e,t={}){return(t.level??6)===0?e:us(e)}async function Cc(e,t={}){return ws()?ks(e):cs(e)}function wc(e){return cs(e)}function Tc(e){let t=new Uint8Array(4);return new DataView(t.buffer).setUint32(0,e>>>0,!0),t}function Ec(e,t){return new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!0)}var Dc=class{constructor(e,t=0){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.offset=t}get position(){return this.offset}set position(e){this.offset=e}get remaining(){return this.data.length-this.offset}readUint8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}readUint16(){let e=this.view.getUint16(this.offset,!0);return this.offset+=2,e}readUint32(){let e=this.view.getUint32(this.offset,!0);return this.offset+=4,e}readBigUint64(){let e=this.view.getBigUint64(this.offset,!0);return this.offset+=8,e}readBytes(e){let t=this.data.subarray(this.offset,this.offset+e);return this.offset+=e,t}readString(e,t=!0){let n=this.readBytes(e);return t?Ws(n):Gs(n)}skip(e){this.offset+=e}slice(e,t){return this.data.subarray(e,t)}peekUint32(e){return this.view.getUint32(e,!0)}};function Oc(e){let t=new DataView(e.buffer,e.byteOffset,e.byteLength),n=0;for(;n+4<=e.length;){let r=t.getUint16(n,!0),i=t.getUint16(n+2,!0),a=n+4,o=a+i;if(o>e.length)break;if(r===21589&&i>=1&&e[a]&1&&i>=5)return t.getUint32(a+1,!0)>>>0;n=o}}function kc(e,t){let n=e.getUint32(t,!0);return e.getUint32(t+4,!0)*4294967296+n}function Ac(e,t){let n={};if(e.length<4)return n;let r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(;i+4<=e.length;){let a=r.getUint16(i,!0),o=r.getUint16(i+2,!0),s=i+4,c=s+o;if(c>e.length)break;if(a===1){let e=s;t.uncompressedSize===4294967295&&e+8<=c&&(n.uncompressedSize=kc(r,e),e+=8),t.compressedSize===4294967295&&e+8<=c&&(n.compressedSize=kc(r,e),e+=8),t.offsetToLocalFileHeader===4294967295&&e+8<=c&&(n.offsetToLocalFileHeader=kc(r,e))}else if(a===21589){let t=Oc(e.subarray(i,c));t!==void 0&&(n.mtimeUnixSeconds=t)}i=c}return t.compressedSize===4294967295&&(t.compressedSize=n.compressedSize),t.uncompressedSize===4294967295&&(t.uncompressedSize=n.uncompressedSize),t.offsetToLocalFileHeader===4294967295&&(t.offsetToLocalFileHeader=n.offsetToLocalFileHeader),n}function jc(e){let t=Math.max(0,e.length-65557);for(let n=e.length-22;n>=t;n--)if(e[n]===80&&e[n+1]===75&&e[n+2]===5&&e[n+3]===6)return n;return-1}function Mc(e,t){let n=t-20;return n<0?-1:e[n]===80&&e[n+1]===75&&e[n+2]===6&&e[n+3]===7?n:-1}function Nc(e,t={}){let{decodeStrings:n=!0}=t,r=[],i=jc(e);if(i===-1)throw Error(`Invalid ZIP file: End of Central Directory not found`);let a=new Dc(e,i);a.skip(4),a.skip(2),a.skip(2),a.skip(2);let o=a.readUint16();a.skip(4);let s=a.readUint32(),c=Mc(e,i);if(c!==-1){let t=new Dc(e,c);t.skip(4),t.skip(4);let n=new Dc(e,Number(t.readBigUint64()));if(n.readUint32()===101075792){n.skip(8),n.skip(2),n.skip(2),n.skip(4),n.skip(4);let e=Number(n.readBigUint64());n.skip(8);let t=Number(n.readBigUint64());o===65535&&(o=e),s===4294967295&&(s=t)}}o>0&&(r=Array(o));let l=new Dc(e,s);for(let e=0;e<o;e++){if(l.readUint32()!==33639248)throw Error(`Invalid Central Directory header signature at entry ${e}`);l.skip(2),l.skip(2);let t=l.readUint16(),i=l.readUint16(),a=l.readUint16(),o=l.readUint16(),s=l.readUint32(),c=l.readUint32(),u=l.readUint32(),d=l.readUint16(),f=l.readUint16(),p=l.readUint16();l.skip(2),l.skip(2);let m=l.readUint32(),h=l.readUint32(),g=(t&2048)!=0,_=n&&g,v=d>0?l.readString(d,_):``,y={};if(f>0){let e=l.readBytes(f),t={compressedSize:c,uncompressedSize:u,offsetToLocalFileHeader:h};y=Ac(e,t),c=t.compressedSize,u=t.uncompressedSize,h=t.offsetToLocalFileHeader??h}let b=p>0?l.readString(p,_):``,x=v.endsWith(`/`)||(m&16)!=0,S=(t&1)!=0,ee=y.mtimeUnixSeconds,te=Qs(o,a,ee);r[e]={path:v,isDirectory:x,compressedSize:c,uncompressedSize:u,compressionMethod:i,crc32:s,lastModified:te,localHeaderOffset:h,comment:b,externalAttributes:m,isEncrypted:S}}return r}async function Pc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Ic(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return Cc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Fc(e,t){if(t.isDirectory)return new Uint8Array;if(t.isEncrypted)throw Error(`File "${t.path}" is encrypted and cannot be extracted`);let n=Ic(e,t);if(t.compressionMethod===0)return n;if(t.compressionMethod===8)return wc(n);throw Error(`Unsupported compression method: ${t.compressionMethod}`)}function Ic(e,t){let n=new Dc(e,t.localHeaderOffset);if(n.readUint32()!==67324752)throw Error(`Invalid local file header signature for "${t.path}"`);n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(2),n.skip(4),n.skip(4),n.skip(4);let r=n.readUint16(),i=n.readUint16();return n.skip(r),n.skip(i),n.readBytes(t.compressedSize)}var Lc=class{constructor(e,t={}){this.data=e instanceof ArrayBuffer?new Uint8Array(e):e,this.entries=Nc(this.data,t),this.entryMap=new Map(this.entries.map(e=>[e.path,e]))}getEntries(){return this.entries}getEntry(e){return this.entryMap.get(e)}hasEntry(e){return this.entryMap.has(e)}listFiles(){return this.entries.map(e=>e.path)}async extract(e){let t=this.entryMap.get(e);return t?Pc(this.data,t):null}extractSync(e){let t=this.entryMap.get(e);return t?Fc(this.data,t):null}async extractAll(){let e=new Map;for(let t of this.entries){let n=await Pc(this.data,t);e.set(t.path,n)}return e}extractAllSync(){let e={};for(let t of this.entries)e[t.path]=Fc(this.data,t);return e}async forEach(e){for(let t of this.entries){let n=null;if(await e(t,()=>(n||=Pc(this.data,t),n))===!1)break}}};let Rc=new Map([[/^xl\/charts\/chart\d+\.xml$/,`application/vnd.openxmlformats-officedocument.drawingml.chart+xml`],[/^xl\/charts\/style\d+\.xml$/,`application/vnd.ms-office.chartstyle+xml`],[/^xl\/charts\/colors\d+\.xml$/,`application/vnd.ms-office.chartcolorstyle+xml`]]),zc=[`xl/charts/`];var Bc=class e{constructor(){this.files=new Map}static isPassthroughPath(e){return zc.some(t=>e.startsWith(t))}static getContentType(e){if(!e.startsWith(`xl/charts/_rels/`)){for(let[t,n]of Rc)if(t.test(e))return n}}add(e,t){this.files.set(e,t)}get(e){return this.files.get(e)}has(e){return this.files.has(e)}getPaths(){return[...this.files.keys()]}toRecord(){let e={};for(let[t,n]of this.files)e[t]=n;return e}fromRecord(e){this.files.clear();for(let[t,n]of Object.entries(e))this.files.set(t,n)}getContentTypes(){let t=[];for(let n of this.files.keys()){let r=e.getContentType(n);r&&t.push({partName:n,contentType:r})}return t}writeToZip(e){for(let[t,n]of this.files)e.append(n,{name:t})}clear(){this.files.clear()}get size(){return this.files.size}},Vc=class e{static{this.textEncoder=new TextEncoder}constructor(e){this.events=new Map,this.pipedStream=null,this.finalized=!1,this.level=e?.level??6,this.modTime=e?.modTime,this.timestamps=e?.timestamps,this.zip=new bc((e,t,n)=>{if(e){this._emit(`error`,e);return}t&&t.length>0&&(this._emit(`data`,t),this.pipedStream&&this.pipedStream.write(t)),n&&(this.pipedStream&&this.pipedStream.end(),this._emit(`finish`))})}_emit(e,...t){let n=this.events.get(e);if(n)for(let e of n)e(...t)}on(e,t){let n=this.events.get(e)||new Set;return n.add(t),this.events.set(e,n),this}once(e,t){let n=(...r)=>{this.off(e,n),t(...r)};return this.on(e,n)}off(e,t){let n=this.events.get(e);return n?(n.delete(t),n.size===0&&this.events.delete(e),this):this}pipe(e){this.pipedStream=e}append(t,n){if(this.finalized)throw Error(`Cannot append after finalize`);let r;r=n.base64?Me(typeof t==`string`?t:String(t)):typeof t==`string`?e.textEncoder.encode(t):t instanceof Uint8Array?t:ArrayBuffer.isView(t)?new Uint8Array(t.buffer,t.byteOffset,t.byteLength):t instanceof ArrayBuffer?new Uint8Array(t):t;let i=new yc(n.name,{level:this.level,modTime:this.modTime,timestamps:this.timestamps});this.zip.add(i),i.push(r,!0)}finalize(){this.finalized||(this.finalized=!0,this.zip.end())}},Hc=class e{static{this.RelType=G}constructor(e){this.workbook=e}createBinaryStream(e){let t=new _t;return t.end(e),t}createTextStream(e){let t=new _t;return t.end(e),t}createStreamBuf(){return new Uo}bufferToString(e){return Ye(e)}createZipWriter(e){return new Vc(e)}async writeToZip(e,t){let{model:n}=this.workbook;this.prepareModel(n,t),await this.addContentTypes(e,n),await this.addOfficeRels(e,n),await this.addWorkbookRels(e,n),await this.addWorksheets(e,n),await this.addSharedStrings(e,n),this.addDrawings(e,n),this.addTables(e,n),this.addPivotTables(e,n),this.addPassthrough(e,n),await Promise.all([this.addThemes(e,n),this.addStyles(e,n)]),await this.addFeaturePropertyBag(e,n),await this.addMedia(e,n),await Promise.all([this.addApp(e,n),this.addCore(e,n)]),await this.addWorkbook(e,n)}async read(e,t){let n=[];return await new Promise((t,r)=>{let i=e=>{n.push(e)},a=()=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),t()},o=t=>{e.off(`data`,i),e.off(`end`,a),e.off(`error`,o),r(t)};e.on(`data`,i),e.on(`end`,a),e.on(`error`,o)}),this.loadBuffer(it(n),t)}async write(e,t){t||={},t.zip=t.zip||{},t.zip.modTime??=this.workbook.modified??this.workbook.created;let n=this.createZipWriter(t.zip);return n.pipe(e),await this.writeToZip(n,t),this._finalize(n)}async load(e,t){let n,r=typeof Buffer<`u`?Buffer.isBuffer(e):!1;if(!e||typeof e==`object`&&!r&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);return n=t&&t.base64?Me(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e),this.loadBuffer(n,t)}async loadBuffer(e,t){let n=await new Lc(e).extractAll(),r={};for(let[e,t]of n)r[e]=t;return this.loadFromFiles(r,t)}createEmptyModel(){return{worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},rawDrawings:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheRecords:{},passthrough:{}}}async collectStreamData(e){let t=[];return await new Promise((n,r)=>{e.on(`data`,e=>{typeof e==`string`?t.push(new TextEncoder().encode(e)):e instanceof Uint8Array?t.push(e):t.push(new Uint8Array(e))}),e.on(`end`,()=>n()),e.on(`error`,r)}),it(t)}drawingHasChartReference(e){return e.rels&&e.rels.some(e=>e.Target&&e.Target.includes(`/charts/`))}drawingRelsHasChartReference(e){return Array.isArray(e)&&e.some(e=>typeof e?.Target==`string`&&e.Target.includes(`/charts/`))}async _processKnownEntry(e,t,n,r){let i=tr(n);if(i!==void 0)return await this._processWorksheetEntry(e,t,i,r,n),!0;switch(n){case U.rootRels:return t.globalRels=await this.parseRels(e),!0;case U.xlWorkbook:{let n=await this.parseWorkbook(e);return t.sheets=n.sheets,t.definedNames=n.definedNames,t.views=n.views,t.properties=n.properties,t.calcProperties=n.calcProperties,t.pivotCaches=n.pivotCaches,!0}case U.xlSharedStrings:return t.sharedStrings=new Rn,await t.sharedStrings.parseStream(e),!0;case U.xlWorkbookRels:return t.workbookRels=await this.parseRels(e),!0;case U.docPropsApp:{let n=await new $r().parseStream(e);return n&&(t.company=n.company,t.manager=n.manager),!0}case U.docPropsCore:{let n=await new Nn().parseStream(e);return Object.assign(t,n),!0}case U.xlStyles:return t.styles=new jn,await t.styles.parseStream(e),!0;default:return!1}}async loadFromZipEntries(e,t){let n=this.createEmptyModel();for await(let r of e){let e=!1,i=async()=>{e||(e=!0,await r.drain())};if(r.type===`Directory`){await i();continue}let a=er(r.name),o=r.stream;try{await this._processKnownEntry(o,n,a,t)||await this._processDefaultEntry(o,n,a)||await i()}finally{try{await i()}catch{}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async writeBuffer(e){e||={},e.zip=e.zip||{},e.zip.modTime??=this.workbook.modified??this.workbook.created;let t=this.createZipWriter(e.zip),n=this.createStreamBuf();return t.pipe(n),await this.writeToZip(t,e),await this._finalize(t),n.read()||new Uint8Array}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type!==`image`)throw Error(`Unsupported media`);let n=yr(`${t.name??`undefined`}.${t.extension}`);if(t.filename){if(this.readFileAsync){let r=await this.readFileAsync(t.filename);return e.append(r,{name:n})}throw Error(`Loading images from filename is not supported in this environment`)}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64.substring(t.base64.indexOf(`,`)+1);return e.append(r,{name:n,base64:!0})}throw Error(`Unsupported media`)}))}parseRels(e){return new H().parseStream(e)}parseWorkbook(e){return new di().parseStream(e)}parseSharedStrings(e){return new Rn().parseStream(e)}reconcile(e,t){let n=new di,r=new Da(t),i=new Ka,a=new $a;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};if(Object.keys(e.drawings).forEach(t=>{let n=e.drawings[t],r=e.drawingRels[t];r&&(o.rels=r.reduce((e,t)=>(e[t.Id]=t,e),{}),(n.anchors??[]).forEach(e=>{let t=e.picture&&e.picture.hyperlinks;t&&o.rels[t.rId]&&(t.hyperlink=o.rels[t.rId].Target,delete t.rId)}),i.reconcile(n,o))}),e.rawDrawings&&e.drawingRels)for(let t of Object.keys(e.rawDrawings)){let n=e.drawingRels[t];n&&!this.drawingRelsHasChartReference(n)&&delete e.rawDrawings[t]}let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)}),this._reconcilePivotTables(e);let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,drawingRels:e.drawingRels,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings,pivotTables:e.pivotTablesIndexed};e.worksheets.forEach(t=>{t.relationships=e.worksheetRels[t.sheetNo],r.reconcile(t,c)}),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,e.defaultFont=e.styles?.defaultFont,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels}_reconcilePivotTables(e){let t=e.pivotTables||{};if(typeof t!=`object`||Object.keys(t).length===0){e.pivotTables=[],e.pivotTablesIndexed={};return}let n=this._buildDefinitionToCacheIdMap(e),r=new Map;Object.entries(e.pivotCacheDefinitions||{}).forEach(([t,i])=>{let a=n.get(t);if(a!==void 0){let n=t.replace(`Definition`,`Records`);r.set(a,{definition:i,records:e.pivotCacheRecords?.[n],definitionName:t})}});let i=[],a={};Object.entries(t).forEach(([e,t])=>{let n=this._extractTableNumber(e),o=r.get(t.cacheId),s=this._determineMetric(t.dataFields),c={...t,tableNumber:n,cacheId:String(t.cacheId),cacheDefinition:o?.definition,cacheRecords:o?.records,cacheFields:o?.definition?.cacheFields??[],rows:t.rowFields.filter(e=>e>=0),columns:t.colFields.filter(e=>e>=0&&e!==-2),values:t.dataFields.map(e=>e.fld),pages:t.pageFields.map(e=>e.fld),metric:s,valueMetrics:this._determineValueMetrics(t.dataFields,s),applyWidthHeightFormats:t.applyWidthHeightFormats===`1`?`1`:`0`};i.push(c),a[Wr(e)]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a}_extractTableNumber(e){let t=e.match(/pivotTable(\d+)/);return t?parseInt(t[1],10):1}_buildCacheIdMap(e){let t=new Map,n=e.pivotCaches??[];for(let e of n)e.cacheId&&e.rId&&t.set(e.rId,parseInt(e.cacheId,10));return t}_buildDefinitionToCacheIdMap(t){let n=new Map,r=this._buildCacheIdMap(t),i=t.workbookRels??[];for(let t of i)if(t.Type===e.RelType.PivotCacheDefinition&&t.Target){let e=t.Target.match(/pivotCacheDefinition(\d+)\.xml/);if(e){let i=`pivotCacheDefinition${e[1]}`,a=r.get(t.Id);a!==void 0&&n.set(i,a)}}return n}_determineMetric(e){return e.length>0&&e[0].subtotal?e[0].subtotal:`sum`}_determineValueMetrics(e,t){return e.map(e=>e.subtotal||t)}async _processWorksheetEntry(e,t,n,r,i){let a=await new Da(r).parseStream(e);if(!a)throw Error(`Failed to parse worksheet ${i}`);a.sheetNo=n,t.worksheetHash[i]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,n){let r=await new Do().parseStream(e);t.comments[Hr(n)]=r}async _processTableEntry(e,t,n){let r=await new $a().parseStream(e);t.tables[Kr(n)]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new H().parseStream(e);t.worksheetRels[n]=r}async _processMediaEntry(e,t,n){let r=n.lastIndexOf(`.`);if(r>=1){let i=n.substr(r+1),a=n.substr(0,r);await new Promise((r,o)=>{let s=this.createStreamBuf(),c=()=>{e.off(`error`,u),s.off(`error`,u),s.off(`finish`,l)},l=()=>{c(),t.mediaIndex[n]=t.media.length,t.mediaIndex[a]=t.media.length;let e={type:`image`,name:a,extension:i,buffer:s.read()};t.media.push(e),r()},u=e=>{c(),o(e)};s.once(`finish`,l),e.on(`error`,u),s.on(`error`,u),e.pipe(s)})}}async _processDrawingEntry(e,t,n,r){let i=r??await this.collectStreamData(e),a=new Ka,o=this.bufferToString(i),s=await a.parseStream(this.createTextStream(o));t.drawings[n]=s,t.rawDrawings[n]=i}async _processDrawingRelsEntry(e,t,n){let r=await new H().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new Fo().parseStream(e);t.vmlDrawings[Vr(n)]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.off(`error`,c),a.off(`error`,c),a.off(`finish`,s)},s=()=>{o();let e=a.read();t.themes[n]=e?typeof e==`string`?e:this.bufferToString(e):``,r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async _processPivotTableEntry(e,t,n){let r=await new xo().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new H().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new ho().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheRecordsEntry(e,t,n){let r=await new oo().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n=this.createEmptyModel(),r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=er(e.name),i=sr(r)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data));await this._processKnownEntry(i,n,r,t)||await this._processDefaultEntry(i,n,r,e.data)}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n,r){let i=nr(n);if(i!==void 0)return await this._processWorksheetRelsEntry(e,t,i),!0;let a=ir(n);if(a)return await this._processMediaEntry(e,t,a),!0;let o=cr(n);if(o)return await this._processDrawingEntry(e,t,o,r),!0;let s=lr(n);if(s)return await this._processDrawingRelsEntry(e,t,s),!0;let c=ur(n);if(c)return await this._processVmlDrawingEntry(e,t,c),!0;let l=dr(n);if(l)return await this._processCommentEntry(e,t,`comments${l}`),!0;let u=fr(n);if(u)return await this._processTableEntry(e,t,u),!0;let d=or(n);if(d)return await this._processThemeEntry(e,t,d),!0;let f=pr(n);if(f)return await this._processPivotTableEntry(e,t,f),!0;let p=mr(n);if(p)return await this._processPivotTableRelsEntry(e,t,p),!0;let m=hr(n);if(m)return await this._processPivotCacheDefinitionEntry(e,t,m),!0;if(gr(n))return!0;let h=_r(n);return h?(await this._processPivotCacheRecordsEntry(e,t,h),!0):Bc.isPassthroughPath(n)?(r?t.passthrough[n]=r:await this._processPassthroughEntry(e,t,n),!0):!1}async _processPassthroughEntry(e,t,n){let r=await this.collectStreamData(e);t.passthrough[n]=r}async addContentTypes(e,t){let n=new Xr().toXml(t);e.append(n,{name:U.contentTypes})}async addApp(e,t){let n=new $r().toXml(t);e.append(n,{name:U.docPropsApp})}async addCore(e,t){let n=new Nn;e.append(n.toXml(t),{name:U.docPropsCore})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
32
+ <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <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:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`};Object.keys(n).forEach(t=>{let r=n[t];e.append(r,{name:vr(t)})})}async addOfficeRels(t,n){let r=new H().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:U.docPropsApp}]);t.append(r,{name:U.rootRels})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:Ir.workbookStyles},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:Ir.workbookTheme1}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:Ir.workbookSharedStrings}),n.hasCheckboxes&&i.push({Id:`rId${r++}`,Type:e.RelType.FeaturePropertyBag,Target:Ir.workbookFeaturePropertyBag});let a=new Map;(n.pivotTables??[]).forEach(t=>{let n=a.get(t.cacheId);n?t.rId=n:(t.rId=`rId${r++}`,a.set(t.cacheId,t.rId),i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:Lr(t.tableNumber)}))}),n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:Sr(t.fileIndex)})});let o=new H().toXml(i);t.append(o,{name:U.xlWorkbookRels})}async addFeaturePropertyBag(e,t){if(!t.hasCheckboxes)return;let n=new Oa;e.append(n.toXml({}),{name:U.xlFeaturePropertyBag})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:U.xlSharedStrings})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:U.xlStyles})}async addWorkbook(e,t){let n=new di;e.append(n.toXml(t),{name:U.xlWorkbook})}async addWorksheets(e,t){let n=new Da,r=new H,i=new Do,a=new Fo,o=new Io;t.worksheets.forEach(t=>{let{fileIndex:s}=t,c=new F;n.render(c,t),e.append(c.xml,{name:br(s)}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:xr(s)})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:Cr(s)}));let l=t.comments.length>0,u=t.formControls&&t.formControls.length>0;(l||u)&&(c=new F,a.render(c,{comments:l?t.comments:[],formControls:u?t.formControls:[]}),e.append(c.xml,{name:Tr(s)})),u&&t.formControls.forEach(t=>{let n=o.toXml(t);e.append(n,{name:Jr(t.ctrlPropId)})})})}addDrawings(e,t){let n=new Ka,r=new H,i=t.rawDrawings||{};t.worksheets.forEach(t=>{let{drawing:a}=t;if(a){if(this.drawingHasChartReference(a)&&i[a.name])e.append(i[a.name],{name:Dr(a.name)});else{let t=(a.anchors??[]).filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.br&&!e.picture||e.br&&!e.picture&&!e.shape)),r=a.anchors?{...a,anchors:t}:a;n.prepare(r);let i=n.toXml(r);e.append(i,{name:Dr(a.name)})}let t=r.toXml(a.rels);e.append(t,{name:Or(a.name)})}})}addTables(e,t){let n=new $a;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:Er(t.target)})})})}addPassthrough(e,t){let n=new Bc;n.fromRecord(t.passthrough||{}),n.writeToZip(e)}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new oo,i=new ho,a=new xo,o=new H,s=new Map;n.pivotTables.forEach(n=>{let c=n.tableNumber,l=n.isLoaded,u=n.cacheId;if(!s.has(u)){if(s.set(u,c),l){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:kr(c)})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:jr(c)})}}else{let e=r.toXml(n);t.append(e,{name:jr(c)}),e=i.toXml(n),t.append(e,{name:kr(c)})}if(!l||n.cacheRecords){let r=(l?n.cacheDefinition?.rId:void 0)??`rId1`,i=o.toXml([{Id:r,Type:e.RelType.PivotCacheRecords,Target:Mr(c)}]);t.append(i,{name:Ar(c)})}}let d=a.toXml(n);t.append(d,{name:Nr(c)});let f=s.get(u);d=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:Fr(f)}]),t.append(d,{name:Pr(c)})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator??`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy??`ExcelTS`,e.created=e.created??new Date,e.modified=e.modified??new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Rn;let n=e.defaultFont;e.styles=e.useStyles?new jn(!0):new jn.Mock,n&&e.styles.setDefaultFont&&e.styles.setDefaultFont(n);let r=new di,i=new Da;r.prepare(e);let a={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};a.drawings=e.drawings=[],a.commentRefs=e.commentRefs=[],a.formControlRefs=e.formControlRefs=[];let o=0;e.tables=[],e.worksheets.forEach((t,n)=>{t.fileIndex=n+1,t.tables.forEach(t=>{o++,t.target=`table${o}.xml`,t.id=o,e.tables.push(t)}),i.prepare(t,a)}),e.hasCheckboxes=e.styles.hasCheckboxes;let s=e.passthrough||{},c=new Bc;c.fromRecord(s),e.passthroughContentTypes=c.getContentTypes()}};let X=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Z=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,Uc=(e,t)=>(e.charCodeAt(t)-48)*1e3+(e.charCodeAt(t+1)-48)*100+(e.charCodeAt(t+2)-48)*10+e.charCodeAt(t+3)-48|0,Wc=[0,31,29,31,30,31,30,31,31,30,31,30,31];function Gc(e,t,n){if(t<1||t>12||n<1||n>Wc[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function Kc(e,t,n,r,i,a){return t<1||t>12||n<1||n>Wc[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function qc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:Gc(Uc(e,0),Z(e,5),Z(e,8))}function Jc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Kc(Uc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Yc(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Kc(Uc(e,0),Z(e,5),Z(e,8),Z(e,11),Z(e,14),Z(e,17))}function Xc(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Zc(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function Qc(e){let t=e.charCodeAt(19);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function $c(e){if(e.charCodeAt(19)!==46)return null;let t=e.charCodeAt(23);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function el(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Gc(Uc(e,6),Z(e,0),Z(e,3))}function tl(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:Gc(Uc(e,6),Z(e,3),Z(e,0))}function nl(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Kc(Uc(e,6),Z(e,0),Z(e,3),Z(e,11),Z(e,14),Z(e,17))}function rl(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:Kc(Uc(e,6),Z(e,3),Z(e,0),Z(e,11),Z(e,14),Z(e,17))}let il={"YYYY-MM-DD":qc,"YYYY-MM-DD[T]HH:mm:ss":Jc,"YYYY-MM-DD HH:mm:ss":Yc,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?Xc(e):e.length===25?Qc(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?Zc(e):e.length===29?$c(e):null,"MM-DD-YYYY":el,"MM-DD-YYYY HH:mm:ss":nl,"MM/DD/YYYY HH:mm:ss":nl,"DD-MM-YYYY":tl,"DD-MM-YYYY HH:mm:ss":rl,"DD/MM/YYYY HH:mm:ss":rl},al=[[10,[qc]],[19,[Jc,Yc]],[20,[Xc]],[24,[Zc]],[25,[Qc]],[29,[$c]]];var ol=class e{constructor(e){this.parse=e=>{if(!e)return null;let t=e.trim();if(!t)return null;if(this.single)return this.fn0(t);for(let e=0,n=this.fns.length;e<n;e++){let n=this.fns[e](t);if(n)return n}return null},this.fns=e,this.single=e.length===1,this.fn0=e[0]}static create(t){return new e(t.map(e=>il[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of al)t.push(...e);return new e(t)}parseAll(e){let t=e.length,n=Array(t),r=this.parse;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}parseValid(e){let t=[],n=this.parse;for(let r=0,i=e.length;r<i;r++){let i=n(e[r]);i&&t.push(i)}return t}};function sl(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${X[r]}:${X[i]}`}var cl=class e{constructor(e){this.format=e=>this.fn(e),this.fn=e}static iso(t=!1){return t?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),a=e.getUTCHours(),o=e.getUTCMinutes(),s=e.getUTCSeconds(),c=e.getUTCMilliseconds();return`${n}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}Z`}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=e.getHours(),o=e.getMinutes(),s=e.getSeconds(),c=e.getMilliseconds();return`${n}-${X[r]}-${X[i]}T${X[a]}:${X[o]}:${X[s]}.${c<10?`00`+c:c<100?`0`+c:c}${sl(e)}`})}static create(t,n){let r=n?.utc??!1;if(t===`YYYY-MM-DD`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]}`:``});if(t===`YYYY-MM-DD HH:mm:ss`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${X[e.getUTCMonth()+1]}-${X[e.getUTCDate()]} ${X[e.getUTCHours()]}:${X[e.getUTCMinutes()]}:${X[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${X[e.getMonth()+1]}-${X[e.getDate()]} ${X[e.getHours()]}:${X[e.getMinutes()]}:${X[e.getSeconds()]}`:``});if(t===`MM-DD-YYYY`||t===`MM/DD/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getUTCMonth()+1]}${n}${X[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getMonth()+1]}${n}${X[e.getDate()]}${n}${e.getFullYear()}`:``})}if(t===`DD-MM-YYYY`||t===`DD/MM/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getUTCDate()]}${n}${X[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${X[e.getDate()]}${n}${X[e.getMonth()+1]}${n}${e.getFullYear()}`:``})}return e.createGeneric(t,r)}static createGeneric(t,n){let r=[],i=t.replace(/\[([^\]]*)\]/g,(e,t)=>(r.push(t),`\x00${r.length-1}\x00`)),a=i.includes(`YYYY`),o=i.includes(`SSS`),s=i.includes(`MM`),c=i.includes(`DD`),l=i.includes(`HH`),u=i.includes(`mm`),d=i.includes(`ss`),f=i.includes(`Z`);return new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let p=i;if(a&&(p=p.replace(/YYYY/g,String(n?e.getUTCFullYear():e.getFullYear()))),o){let t=n?e.getUTCMilliseconds():e.getMilliseconds();p=p.replace(/SSS/g,t<10?`00${t}`:t<100?`0${t}`:String(t))}return s&&(p=p.replace(/MM/g,X[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,X[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,X[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,X[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,X[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:sl(e))),r.length&&(p=p.replace(/\x00(\d+)\x00/g,(e,t)=>r[+t])),p})}formatAll(e){let t=e.length,n=Array(t),r=this.fn;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}};function ll(e,t){return t===`,`?String(e).split(`.`).join(`,`):String(e)}function ul(e,t){if(t!==`,`)return Number(e);let n=e.trim();return/^-?\d+(,\d+)?([eE][+-]?\d+)?$/.test(n)?Number(n.replace(`,`,`.`)):Number(e)}function dl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function fl(e){return e.length===1}function pl(e){return e.length===1}function ml(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function hl(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,b=a||o,x=r!==null&&r!==!1,S=x?String(r):``,ee=i!==null&&i!==!1?String(i):``,te=[],ne=[],C=[],w=``,re=!1,T=0,ie=0,ae=0,oe=0,E=null,se=0,ce=!1,D=!1;u===!0?ce=!0:Array.isArray(u)?(E=u,se=u.filter(e=>e!=null).length,ml(u),ce=!0,d||(D=!0)):typeof u==`function`&&(ce=!0);let le=s||c&&l?e=>e.trim():c?e=>e.trimStart():l?e=>e.trimEnd():e=>e,O=e=>{if(ce&&!D){if(typeof u==`function`){let t=u(e);ml(t),E=t}else Array.isArray(u)||(ml(e),E=e);return se=E.filter(e=>e!=null).length,D=!0,!1}if(oe<h)return oe++,!1;if(E&&E.length>0){let t=se,n=e.length;if(n>t){if(g&&!_)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=E.length}else if(n<t){if(g)return ne.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<E.length;)e.push(``)}}return!0},ue=e.length;for(;T<ue;){let t=e[T];if(re&&x)ee&&t===ee&&e[T+1]===S?(w+=S,T+=2):t===S?(re=!1,T++):t===`\r`?(e[T+1]===`
33
33
  `||(w+=`
34
34
  `),T++):(w+=t,T++);else if(x&&t===S&&w===``)re=!0,T++;else if(t===n)C.push(le(w)),w=``,T++;else if(t===`
35
35
  `||t===`\r`){if(t===`\r`&&e[T+1]===`
36
- `&&T++,C.push(le(w)),w=``,ie++,ie<=m){C=[],T++;continue}if(f&&C[0]?.startsWith(f)){C=[],T++;continue}let n=C.length===1&&C[0]===``;if(b&&n){C=[],T++;continue}if(O(C)&&(te.push(C),ae++),C=[],T++,p!==void 0&&ae>=p)break}else w+=t,T++}if((w!==``||C.length>0)&&(C.push(le(w)),ie>=m&&!(f&&C[0]?.startsWith(f)))){let e=C.length===1&&C[0]===``;b&&e||p!==void 0&&ae>=p||O(C)&&te.push(C)}if(ce&&E){let e=te.map(e=>{let t={};return E.forEach((n,r)=>{n!=null&&(t[n]=e[r]??``)}),t});if(v&&(e=e.map(e=>v(e)).filter(e=>e!=null)),y){let t=[];for(let n of e){let e=y(n);typeof e==`boolean`?e?t.push(n):ne.push({row:Object.values(n),reason:`Validation failed`}):e.isValid?t.push(n):ne.push({row:Object.values(n),reason:e.reason??`Validation failed`})}e=t}return(g||y)&&ne.length>0?{headers:E.filter(e=>e!=null),rows:e,invalidRows:ne}:{headers:E.filter(e=>e!=null),rows:e}}let k=te;if(v&&(k=k.map(e=>v(e)).filter(e=>e!=null)),y){let e=[],t=[];for(let n of k){let r=y(n);typeof r==`boolean`?r?e.push(n):t.push({row:n,reason:`Validation failed`}):r.isValid?e.push(n):t.push({row:n,reason:r.reason??`Validation failed`})}if(k=e,t.length>0)return{rows:k,invalidRows:t}}return k}function ml(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i,rowDelimiter:a=`
37
- `,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m,decimalSeparator:h=`.`}=t,g=u??!0,_=r!==!1&&r!==null,v=_?String(r):``,y=i!==void 0&&i!==!1&&i!==null?String(i):v,b=_?RegExp(`[${ll(n)}${ll(v)}\r\n]`):null,x=_?new RegExp(ll(v),`g`):null,S=y+v,ee=[],te=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},ne=(e,t,n,r=!1)=>{if(e==null)return``;let i=typeof e==`number`?sl(e,h):String(e);return _&&(o||te(t,n,r)||b.test(i))?v+i.replace(x,S)+v:i},C=(e,t,r=!1)=>e.map((e,n)=>ne(e,n,t?.[n],r)).join(n),w=null,re=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;w=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,w&&g&&ee.push(C(w,w,!0));for(let e of t){let t=re(e);if(t==null)continue;let n=w?w.map(e=>t[e]):Object.values(t);ee.push(C(n,w??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(w=l,g&&ee.push(C(l,l,!0)));for(let e of t){let t=re(e);t!=null&&ee.push(C(t,w??void 0))}}else p&&Array.isArray(l)&&g&&ee.push(C(l,l,!0));let T=ee.join(a);return T.length>0&&f&&(T+=a),d&&(T=``+T),T}var hl=class extends dt{constructor(e={}){super({objectMode:e.objectMode!==!1}),this.buffer=``,this.currentRow=[],this.currentField=``,this.currentFieldParts=null,this.currentFieldLength=0,this.inQuotes=!1,this.lineNumber=0,this.rowCount=0,this.skippedDataRows=0,this.headerRow=null,this.headersEmitted=!1,this._rowTransform=null,this._rowValidator=null,this.options=e,this.decoder=new TextDecoder;let t=e.quote??`"`;this.quoteEnabled=t!==null&&t!==!1,this.quote=this.quoteEnabled?String(t):``;let n=e.escape??`"`;this.escape=n!==null&&n!==!1?String(n):this.quote,this.delimiter=e.delimiter??`,`;let{trim:r=!1,ltrim:i=!1,rtrim:a=!1}=e;this.trimField=r||i&&a?e=>e.trim():i?e=>e.trimStart():a?e=>e.trimEnd():e=>e}transform(e){if(typeof e!=`function`)throw TypeError(`The transform should be a function`);return ul(e)?this._rowTransform=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowTransform=e,this}validate(e){if(typeof e!=`function`)throw TypeError(`The validate should be a function`);return dl(e)?this._rowValidator=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowValidator=e,this}_transform(e,t,n){try{let t=typeof e==`string`?e:this.decoder.decode(e,{stream:!0});this.buffer+=t,this.processBuffer(n)}catch(e){n(e)}}_flush(e){try{let t=this.decoder.decode();if(t&&(this.buffer+=t),this.buffer){this.processBuffer(t=>{if(t){e(t);return}this.flushCurrentRow(e)});return}this.flushCurrentRow(e)}catch(t){e(t)}}flushCurrentRow(e){if(this.currentFieldLength!==0||this.currentRow.length>0){this.currentRow.push(this.trimField(this.takeCurrentField())),this.emitRow(e);return}e()}appendToField(e){if(e.length===0)return;let t=this.currentFieldLength+e.length;if(!this.currentFieldParts&&t<=1024){this.currentField+=e,this.currentFieldLength=t;return}if(!this.currentFieldParts){this.currentFieldParts=this.currentFieldLength===0?[e]:[this.currentField,e],this.currentField=``,this.currentFieldLength=t;return}this.currentFieldParts.push(e),this.currentFieldLength=t}takeCurrentField(){if(this.currentFieldLength===0)return``;let e=this.currentFieldParts?this.currentFieldParts.join(``):this.currentField;return this.currentField=``,this.currentFieldParts=null,this.currentFieldLength=0,e}processBuffer(e){let{skipEmptyLines:t=!1,ignoreEmpty:n=!1,headers:r=!1,renameHeaders:i=!1,comment:a,maxRows:o,skipLines:s=0,skipRows:c=0,strictColumnHandling:l=!1,discardUnmappedColumns:u=!1}=this.options,d=t||n,f=0,p=this.buffer.length,m=[];for(;f<p;){let t=this.buffer[f];if(this.inQuotes&&this.quoteEnabled)if(this.escape&&t===this.escape&&this.buffer[f+1]===this.quote)this.appendToField(this.quote),f+=2;else if(t===this.quote)this.inQuotes=!1,f++;else if(f===p-1){this.buffer=this.buffer.slice(f),this.processPendingRows(m,e);return}else t===`\r`?(this.buffer[f+1]===`
36
+ `&&T++,C.push(le(w)),w=``,ie++,ie<=m){C=[],T++;continue}if(f&&C[0]?.startsWith(f)){C=[],T++;continue}let n=C.length===1&&C[0]===``;if(b&&n){C=[],T++;continue}if(O(C)&&(te.push(C),ae++),C=[],T++,p!==void 0&&ae>=p)break}else w+=t,T++}if((w!==``||C.length>0)&&(C.push(le(w)),ie>=m&&!(f&&C[0]?.startsWith(f)))){let e=C.length===1&&C[0]===``;b&&e||p!==void 0&&ae>=p||O(C)&&te.push(C)}if(ce&&E){let e=te.map(e=>{let t={};return E.forEach((n,r)=>{n!=null&&(t[n]=e[r]??``)}),t});if(v&&(e=e.map(e=>v(e)).filter(e=>e!=null)),y){let t=[];for(let n of e){let e=y(n);typeof e==`boolean`?e?t.push(n):ne.push({row:Object.values(n),reason:`Validation failed`}):e.isValid?t.push(n):ne.push({row:Object.values(n),reason:e.reason??`Validation failed`})}e=t}return(g||y)&&ne.length>0?{headers:E.filter(e=>e!=null),rows:e,invalidRows:ne}:{headers:E.filter(e=>e!=null),rows:e}}let k=te;if(v&&(k=k.map(e=>v(e)).filter(e=>e!=null)),y){let e=[],t=[];for(let n of k){let r=y(n);typeof r==`boolean`?r?e.push(n):t.push({row:n,reason:`Validation failed`}):r.isValid?e.push(n):t.push({row:n,reason:r.reason??`Validation failed`})}if(k=e,t.length>0)return{rows:k,invalidRows:t}}return k}function gl(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i,rowDelimiter:a=`
37
+ `,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m,decimalSeparator:h=`.`}=t,g=u??!0,_=r!==!1&&r!==null,v=_?String(r):``,y=i!==void 0&&i!==!1&&i!==null?String(i):v,b=_?RegExp(`[${dl(n)}${dl(v)}\r\n]`):null,x=_?new RegExp(dl(v),`g`):null,S=y+v,ee=[],te=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},ne=(e,t,n,r=!1)=>{if(e==null)return``;let i=typeof e==`number`?ll(e,h):String(e);return _&&(o||te(t,n,r)||b.test(i))?v+i.replace(x,S)+v:i},C=(e,t,r=!1)=>e.map((e,n)=>ne(e,n,t?.[n],r)).join(n),w=null,re=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;w=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,w&&g&&ee.push(C(w,w,!0));for(let e of t){let t=re(e);if(t==null)continue;let n=w?w.map(e=>t[e]):Object.values(t);ee.push(C(n,w??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(w=l,g&&ee.push(C(l,l,!0)));for(let e of t){let t=re(e);t!=null&&ee.push(C(t,w??void 0))}}else p&&Array.isArray(l)&&g&&ee.push(C(l,l,!0));let T=ee.join(a);return T.length>0&&f&&(T+=a),d&&(T=``+T),T}var _l=class extends ht{constructor(e={}){super({objectMode:e.objectMode!==!1}),this.buffer=``,this.currentRow=[],this.currentField=``,this.currentFieldParts=null,this.currentFieldLength=0,this.inQuotes=!1,this.lineNumber=0,this.rowCount=0,this.skippedDataRows=0,this.headerRow=null,this.headersEmitted=!1,this._rowTransform=null,this._rowValidator=null,this.options=e,this.decoder=new TextDecoder;let t=e.quote??`"`;this.quoteEnabled=t!==null&&t!==!1,this.quote=this.quoteEnabled?String(t):``;let n=e.escape??`"`;this.escape=n!==null&&n!==!1?String(n):this.quote,this.delimiter=e.delimiter??`,`;let{trim:r=!1,ltrim:i=!1,rtrim:a=!1}=e;this.trimField=r||i&&a?e=>e.trim():i?e=>e.trimStart():a?e=>e.trimEnd():e=>e}transform(e){if(typeof e!=`function`)throw TypeError(`The transform should be a function`);return fl(e)?this._rowTransform=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowTransform=e,this}validate(e){if(typeof e!=`function`)throw TypeError(`The validate should be a function`);return pl(e)?this._rowValidator=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowValidator=e,this}_transform(e,t,n){try{let t=typeof e==`string`?e:this.decoder.decode(e,{stream:!0});this.buffer+=t,this.processBuffer(n)}catch(e){n(e)}}_flush(e){try{let t=this.decoder.decode();if(t&&(this.buffer+=t),this.buffer){this.processBuffer(t=>{if(t){e(t);return}this.flushCurrentRow(e)});return}this.flushCurrentRow(e)}catch(t){e(t)}}flushCurrentRow(e){if(this.currentFieldLength!==0||this.currentRow.length>0){this.currentRow.push(this.trimField(this.takeCurrentField())),this.emitRow(e);return}e()}appendToField(e){if(e.length===0)return;let t=this.currentFieldLength+e.length;if(!this.currentFieldParts&&t<=1024){this.currentField+=e,this.currentFieldLength=t;return}if(!this.currentFieldParts){this.currentFieldParts=this.currentFieldLength===0?[e]:[this.currentField,e],this.currentField=``,this.currentFieldLength=t;return}this.currentFieldParts.push(e),this.currentFieldLength=t}takeCurrentField(){if(this.currentFieldLength===0)return``;let e=this.currentFieldParts?this.currentFieldParts.join(``):this.currentField;return this.currentField=``,this.currentFieldParts=null,this.currentFieldLength=0,e}processBuffer(e){let{skipEmptyLines:t=!1,ignoreEmpty:n=!1,headers:r=!1,renameHeaders:i=!1,comment:a,maxRows:o,skipLines:s=0,skipRows:c=0,strictColumnHandling:l=!1,discardUnmappedColumns:u=!1}=this.options,d=t||n,f=0,p=this.buffer.length,m=[];for(;f<p;){let t=this.buffer[f];if(this.inQuotes&&this.quoteEnabled)if(this.escape&&t===this.escape&&this.buffer[f+1]===this.quote)this.appendToField(this.quote),f+=2;else if(t===this.quote)this.inQuotes=!1,f++;else if(f===p-1){this.buffer=this.buffer.slice(f),this.processPendingRows(m,e);return}else t===`\r`?(this.buffer[f+1]===`
38
38
  `||this.appendToField(`
39
39
  `),f++):(this.appendToField(t),f++);else if(this.quoteEnabled&&t===this.quote&&this.currentFieldLength===0)this.inQuotes=!0,f++;else if(t===this.delimiter)this.currentRow.push(this.trimField(this.takeCurrentField())),f++;else if(t===`
40
40
  `||t===`\r`){if(t===`\r`&&this.buffer[f+1]===`
41
- `&&f++,this.currentRow.push(this.trimField(this.takeCurrentField())),this.lineNumber++,this.lineNumber<=s){this.currentRow=[],f++;continue}if(a&&this.currentRow[0]?.startsWith(a)){this.currentRow=[],f++;continue}let n=this.currentRow.length===1&&this.currentRow[0]===``;if(d&&n){this.currentRow=[],f++;continue}if((r===!0||typeof r==`function`||Array.isArray(r)&&i)&&this.headerRow===null){typeof r==`function`?this.headerRow=r(this.currentRow).filter(e=>e!=null):Array.isArray(r)&&i?this.headerRow=r.filter(e=>e!=null):this.headerRow=this.currentRow,this.headersEmitted||(this.headersEmitted=!0,this.emit(`headers`,this.headerRow)),this.currentRow=[],f++;continue}if(Array.isArray(r)&&!i&&this.headerRow===null&&(this.headerRow=r.filter(e=>e!=null),this.headersEmitted||(this.headersEmitted=!0,this.emit(`headers`,this.headerRow))),this.skippedDataRows<c){this.skippedDataRows++,this.currentRow=[],f++;continue}if(this.headerRow&&this.headerRow.length>0){let e=this.headerRow.length,t=this.currentRow.length;if(t>e)if(l&&!u){this.emit(`data-invalid`,this.currentRow,`Column mismatch: expected ${e}, got ${t}`),this.currentRow=[],f++;continue}else this.currentRow.length=e;else if(t<e){if(l){this.emit(`data-invalid`,this.currentRow,`Column mismatch: expected ${e}, got ${t}`),this.currentRow=[],f++;continue}for(;this.currentRow.length<e;)this.currentRow.push(``)}}if(this.rowCount++,o!==void 0&&this.rowCount>o){this.buffer=``,this.processPendingRows(m,e);return}let p=this.currentRow;this.currentRow=[],m.push(this.buildRow(p)),f++}else this.appendToField(t),f++}this.buffer=``,this.processPendingRows(m,e)}buildRow(e){if(this.options.headers&&this.headerRow){let t={};for(let n=0;n<this.headerRow.length;n++){let r=this.headerRow[n];t[r]=e[n]??``}return t}return e}processPendingRows(e,t){if(e.length===0){t();return}let n=0,r=()=>{if(n>=e.length){t();return}let i=e[n];n++,this.transformAndValidateRow(i,(e,i)=>{if(e){t(e);return}i&&i.isValid&&i.row!==null?this.options.objectMode===!1?this.push(JSON.stringify(i.row)):this.push(i.row):i&&!i.isValid&&this.emit(`data-invalid`,i.row,i.reason),n%1e3==0?setTimeout(r,0):r()})};r()}transformAndValidateRow(e,t){this._rowTransform?this._rowTransform(e,(e,n)=>{if(e){t(e);return}if(n==null){t(null,{row:null,isValid:!0});return}this.validateRow(n,t)}):this.validateRow(e,t)}validateRow(e,t){this._rowValidator?this._rowValidator(e,(n,r,i)=>{if(n){t(n);return}t(null,{row:e,isValid:r??!1,reason:i})}):t(null,{row:e,isValid:!0})}emitRow(e){let t=this.buildRow(this.currentRow);this.transformAndValidateRow(t,(t,n)=>{if(t){e&&e(t);return}n&&n.isValid&&n.row!==null?this.options.objectMode===!1?this.push(JSON.stringify(n.row)):this.push(n.row):n&&!n.isValid&&this.emit(`data-invalid`,n.row,n.reason),e&&e()})}},gl=class extends dt{constructor(e={}){super({objectMode:e.objectMode!==!1,writableObjectMode:e.objectMode!==!1}),this.headerWritten=!1,this.headers=null,this.rowCount=0,this._rowTransform=null,this.escapeQuoteRegex=null,this.escapedQuote=``,this.options=e;let t=e.quote??`"`;this.quoteEnabled=t!==null&&t!==!1,this.quote=this.quoteEnabled?String(t):``;let n=e.escape;this.escape=n!=null&&n!==!1?String(n):this.quote,this.delimiter=e.delimiter??`,`,this.rowDelimiter=e.rowDelimiter??`
42
- `,this.alwaysQuote=e.alwaysQuote??!1,this.decimalSeparator=e.decimalSeparator??`.`,this.shouldWriteHeaders=e.writeHeaders??!0,this.quoteEnabled&&(this.escapeQuoteRegex=new RegExp(_l(this.quote),`g`),this.escapedQuote=this.escape+this.quote),Array.isArray(e.headers)&&(this.headers=e.headers),e.transform&&this.transform(e.transform)}transform(e){if(typeof e!=`function`)throw TypeError(`The transform should be a function`);return ul(e)?this._rowTransform=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowTransform=e,this}_transform(e,t,n){try{!this.headerWritten&&this.options.writeBOM&&this.push(``),!this.headerWritten&&this.headers&&this.shouldWriteHeaders?(this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0):!this.headerWritten&&this.options.headers===!0&&!Array.isArray(e)&&this.shouldWriteHeaders?(this.headers=Object.keys(e),this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0):this.headerWritten||=(this.options.headers===!0&&!Array.isArray(e)&&(this.headers=Object.keys(e)),!0),this._rowTransform?this._rowTransform(e,(e,t)=>{if(e){n(e);return}if(t==null){n();return}this.formatAndPush(t),n()}):(this.formatAndPush(e),n())}catch(e){n(e)}}_flush(e){!this.headerWritten&&this.options.alwaysWriteHeaders&&this.headers&&this.shouldWriteHeaders&&(this.options.writeBOM&&this.push(``),this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0),this.options.includeEndRowDelimiter&&this.rowCount>0&&this.push(this.rowDelimiter),e()}formatAndPush(e){let t;t=Array.isArray(e)?e:typeof e==`object`&&e?this.headers?this.headers.map(t=>e[t]):Object.values(e):[e],this.push(this.formatRow(t,!1))}formatRow(e,t=!1){let{quoteColumns:n,quoteHeaders:r}=this.options,i=t?r:n,a=e.map((e,t)=>{let n=this.headers?.[t],r=this.shouldQuoteField(t,n,i);return this.formatField(e,r)}).join(this.delimiter);return this.rowCount===0?(this.rowCount++,a):(this.rowCount++,this.rowDelimiter+a)}shouldQuoteField(e,t,n){return n===!0?!0:n===!1||n===void 0?!1:Array.isArray(n)?n[e]===!0:typeof n==`object`&&t?n[t]===!0:!1}formatField(e,t=!1){if(e==null)return``;let n=typeof e==`number`?sl(e,this.decimalSeparator):String(e);if(!this.quoteEnabled)return n;if(this.alwaysQuote||t||n.includes(this.delimiter)||n.includes(this.quote)||n.includes(`\r`)||n.includes(`
43
- `)){let e=n.replace(this.escapeQuoteRegex,this.escapedQuote);return this.quote+e+this.quote}return n}};function _l(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}let vl=[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],yl={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function bl(e,t){let n=il.create(e),r=t?.decimalSeparator??`.`;return function(e){if(e===``)return null;if(typeof e==`string`){let t=cl(e,r);if(!Number.isNaN(t)&&t!==1/0)return t}else{let t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t}let t=n.parse(e);if(t)return t;let i=yl[e];return i===void 0?e:i}}function xl(e,t){let n=e?ol.create(e,{utc:t}):ol.iso(t);return function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink??e.text??``;if(e.formula||e.result)return e.result??``;if(e instanceof Date)return n.format(e);if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}}var Sl=class{constructor(e){this.workbook=e}load(e,t){let n;n=typeof e==`string`?e:e instanceof ArrayBuffer||e instanceof Uint8Array?new TextDecoder().decode(e):String(e);let r=this.workbook.addWorksheet(t?.sheetName),i=t?.dateFormats??vl,a=t?.map||bl(i,{decimalSeparator:t?.valueMapperOptions?.decimalSeparator}),o=pl(n,t?.parserOptions);for(let e of o)r.addRow(e.map(a));return r}writeString(e){let t=this.workbook.getWorksheet(e?.sheetName||e?.sheetId);if(!t)return``;let{dateFormat:n,dateUTC:r}=e||{},i=e?.map||xl(n,r),a=e?.includeEmptyRows!==!1,o=[],s=1;return t.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),ml(o,e?.formatterOptions)}async writeBuffer(e){return new TextEncoder().encode(this.writeString(e))}async read(e,t){let n=this.workbook.addWorksheet(t?.sheetName),r=t?.dateFormats??vl,i=t?.map||bl(r,{decimalSeparator:t?.valueMapperOptions?.decimalSeparator}),a=new hl(t?.parserOptions);return new Promise((t,r)=>{a.on(`data`,e=>n.addRow(e.map(i))),gt(e,a).then(()=>t(n)).catch(r)})}async write(e,t){let n=this.workbook.getWorksheet(t?.sheetName||t?.sheetId);if(!n){e.end();return}let{dateFormat:r,dateUTC:i}=t||{},a=t?.map||xl(r,i),o=t?.includeEmptyRows!==!1,s=new gl({...t?.formatterOptions}),c=gt(s,e),l=1;n.eachRow((e,t)=>{if(o)for(;l++<t-1;)s.write([]);let{values:n}=e;n.shift(),s.write(n.map(a)),l=t}),s.end(),await c}createReadStream(e){let t=this.workbook.getWorksheet(e?.sheetName||e?.sheetId),{dateFormat:n,dateUTC:r}=e||{},i=e?.map||xl(n,r),a=e?.includeEmptyRows!==!1,o=new gl({...e?.formatterOptions});return t?setTimeout(()=>{let e=1;t.eachRow((t,n)=>{if(a)for(;e++<n-1;)o.write([]);let{values:r}=t;r.shift(),o.write(r.map(i)),e=n}),o.end()},0):setTimeout(()=>o.end(),0),o}createWriteStream(e){let t=this.workbook.addWorksheet(e?.sheetName),n=e?.dateFormats??vl,r=e?.map||bl(n,{decimalSeparator:e?.valueMapperOptions?.decimalSeparator}),i=new hl(e?.parserOptions);return i.on(`data`,e=>t.addRow(e.map(r))),i}async readFile(e,t){throw Error(`csv.readFile() is not available in browser.
41
+ `&&f++,this.currentRow.push(this.trimField(this.takeCurrentField())),this.lineNumber++,this.lineNumber<=s){this.currentRow=[],f++;continue}if(a&&this.currentRow[0]?.startsWith(a)){this.currentRow=[],f++;continue}let n=this.currentRow.length===1&&this.currentRow[0]===``;if(d&&n){this.currentRow=[],f++;continue}if((r===!0||typeof r==`function`||Array.isArray(r)&&i)&&this.headerRow===null){typeof r==`function`?this.headerRow=r(this.currentRow).filter(e=>e!=null):Array.isArray(r)&&i?this.headerRow=r.filter(e=>e!=null):this.headerRow=this.currentRow,this.headersEmitted||(this.headersEmitted=!0,this.emit(`headers`,this.headerRow)),this.currentRow=[],f++;continue}if(Array.isArray(r)&&!i&&this.headerRow===null&&(this.headerRow=r.filter(e=>e!=null),this.headersEmitted||(this.headersEmitted=!0,this.emit(`headers`,this.headerRow))),this.skippedDataRows<c){this.skippedDataRows++,this.currentRow=[],f++;continue}if(this.headerRow&&this.headerRow.length>0){let e=this.headerRow.length,t=this.currentRow.length;if(t>e)if(l&&!u){this.emit(`data-invalid`,this.currentRow,`Column mismatch: expected ${e}, got ${t}`),this.currentRow=[],f++;continue}else this.currentRow.length=e;else if(t<e){if(l){this.emit(`data-invalid`,this.currentRow,`Column mismatch: expected ${e}, got ${t}`),this.currentRow=[],f++;continue}for(;this.currentRow.length<e;)this.currentRow.push(``)}}if(this.rowCount++,o!==void 0&&this.rowCount>o){this.buffer=``,this.processPendingRows(m,e);return}let p=this.currentRow;this.currentRow=[],m.push(this.buildRow(p)),f++}else this.appendToField(t),f++}this.buffer=``,this.processPendingRows(m,e)}buildRow(e){if(this.options.headers&&this.headerRow){let t={};for(let n=0;n<this.headerRow.length;n++){let r=this.headerRow[n];t[r]=e[n]??``}return t}return e}processPendingRows(e,t){if(e.length===0){t();return}let n=0,r=()=>{if(n>=e.length){t();return}let i=e[n];n++,this.transformAndValidateRow(i,(e,i)=>{if(e){t(e);return}i&&i.isValid&&i.row!==null?this.options.objectMode===!1?this.push(JSON.stringify(i.row)):this.push(i.row):i&&!i.isValid&&this.emit(`data-invalid`,i.row,i.reason),n%1e3==0?setTimeout(r,0):r()})};r()}transformAndValidateRow(e,t){this._rowTransform?this._rowTransform(e,(e,n)=>{if(e){t(e);return}if(n==null){t(null,{row:null,isValid:!0});return}this.validateRow(n,t)}):this.validateRow(e,t)}validateRow(e,t){this._rowValidator?this._rowValidator(e,(n,r,i)=>{if(n){t(n);return}t(null,{row:e,isValid:r??!1,reason:i})}):t(null,{row:e,isValid:!0})}emitRow(e){let t=this.buildRow(this.currentRow);this.transformAndValidateRow(t,(t,n)=>{if(t){e&&e(t);return}n&&n.isValid&&n.row!==null?this.options.objectMode===!1?this.push(JSON.stringify(n.row)):this.push(n.row):n&&!n.isValid&&this.emit(`data-invalid`,n.row,n.reason),e&&e()})}},vl=class extends ht{constructor(e={}){super({objectMode:e.objectMode!==!1,writableObjectMode:e.objectMode!==!1}),this.headerWritten=!1,this.headers=null,this.rowCount=0,this._rowTransform=null,this.escapeQuoteRegex=null,this.escapedQuote=``,this.options=e;let t=e.quote??`"`;this.quoteEnabled=t!==null&&t!==!1,this.quote=this.quoteEnabled?String(t):``;let n=e.escape;this.escape=n!=null&&n!==!1?String(n):this.quote,this.delimiter=e.delimiter??`,`,this.rowDelimiter=e.rowDelimiter??`
42
+ `,this.alwaysQuote=e.alwaysQuote??!1,this.decimalSeparator=e.decimalSeparator??`.`,this.shouldWriteHeaders=e.writeHeaders??!0,this.quoteEnabled&&(this.escapeQuoteRegex=new RegExp(yl(this.quote),`g`),this.escapedQuote=this.escape+this.quote),Array.isArray(e.headers)&&(this.headers=e.headers),e.transform&&this.transform(e.transform)}transform(e){if(typeof e!=`function`)throw TypeError(`The transform should be a function`);return fl(e)?this._rowTransform=(t,n)=>{try{n(null,e(t))}catch(e){n(e)}}:this._rowTransform=e,this}_transform(e,t,n){try{!this.headerWritten&&this.options.writeBOM&&this.push(``),!this.headerWritten&&this.headers&&this.shouldWriteHeaders?(this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0):!this.headerWritten&&this.options.headers===!0&&!Array.isArray(e)&&this.shouldWriteHeaders?(this.headers=Object.keys(e),this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0):this.headerWritten||=(this.options.headers===!0&&!Array.isArray(e)&&(this.headers=Object.keys(e)),!0),this._rowTransform?this._rowTransform(e,(e,t)=>{if(e){n(e);return}if(t==null){n();return}this.formatAndPush(t),n()}):(this.formatAndPush(e),n())}catch(e){n(e)}}_flush(e){!this.headerWritten&&this.options.alwaysWriteHeaders&&this.headers&&this.shouldWriteHeaders&&(this.options.writeBOM&&this.push(``),this.push(this.formatRow(this.headers,!0)),this.headerWritten=!0),this.options.includeEndRowDelimiter&&this.rowCount>0&&this.push(this.rowDelimiter),e()}formatAndPush(e){let t;t=Array.isArray(e)?e:typeof e==`object`&&e?this.headers?this.headers.map(t=>e[t]):Object.values(e):[e],this.push(this.formatRow(t,!1))}formatRow(e,t=!1){let{quoteColumns:n,quoteHeaders:r}=this.options,i=t?r:n,a=e.map((e,t)=>{let n=this.headers?.[t],r=this.shouldQuoteField(t,n,i);return this.formatField(e,r)}).join(this.delimiter);return this.rowCount===0?(this.rowCount++,a):(this.rowCount++,this.rowDelimiter+a)}shouldQuoteField(e,t,n){return n===!0?!0:n===!1||n===void 0?!1:Array.isArray(n)?n[e]===!0:typeof n==`object`&&t?n[t]===!0:!1}formatField(e,t=!1){if(e==null)return``;let n=typeof e==`number`?ll(e,this.decimalSeparator):String(e);if(!this.quoteEnabled)return n;if(this.alwaysQuote||t||n.includes(this.delimiter)||n.includes(this.quote)||n.includes(`\r`)||n.includes(`
43
+ `)){let e=n.replace(this.escapeQuoteRegex,this.escapedQuote);return this.quote+e+this.quote}return n}};function yl(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}let bl=[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],xl={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function Sl(e,t){let n=ol.create(e),r=t?.decimalSeparator??`.`;return function(e){if(e===``)return null;if(typeof e==`string`){let t=ul(e,r);if(!Number.isNaN(t)&&t!==1/0)return t}else{let t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t}let t=n.parse(e);if(t)return t;let i=xl[e];return i===void 0?e:i}}function Cl(e,t){let n=e?cl.create(e,{utc:t}):cl.iso(t);return function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink??e.text??``;if(e.formula||e.result)return e.result??``;if(e instanceof Date)return n.format(e);if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}}var wl=class{constructor(e){this.workbook=e}load(e,t){let n;n=typeof e==`string`?e:e instanceof ArrayBuffer||e instanceof Uint8Array?new TextDecoder().decode(e):String(e);let r=this.workbook.addWorksheet(t?.sheetName),i=t?.dateFormats??bl,a=t?.map||Sl(i,{decimalSeparator:t?.valueMapperOptions?.decimalSeparator}),o=hl(n,t?.parserOptions);for(let e of o)r.addRow(e.map(a));return r}writeString(e){let t=this.workbook.getWorksheet(e?.sheetName||e?.sheetId);if(!t)return``;let{dateFormat:n,dateUTC:r}=e||{},i=e?.map||Cl(n,r),a=e?.includeEmptyRows!==!1,o=[],s=1;return t.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),gl(o,e?.formatterOptions)}async writeBuffer(e){return new TextEncoder().encode(this.writeString(e))}async read(e,t){let n=this.workbook.addWorksheet(t?.sheetName),r=t?.dateFormats??bl,i=t?.map||Sl(r,{decimalSeparator:t?.valueMapperOptions?.decimalSeparator}),a=new _l(t?.parserOptions);return new Promise((t,r)=>{a.on(`data`,e=>n.addRow(e.map(i))),bt(e,a).then(()=>t(n)).catch(r)})}async write(e,t){let n=this.workbook.getWorksheet(t?.sheetName||t?.sheetId);if(!n){e.end();return}let{dateFormat:r,dateUTC:i}=t||{},a=t?.map||Cl(r,i),o=t?.includeEmptyRows!==!1,s=new vl({...t?.formatterOptions}),c=bt(s,e),l=1;n.eachRow((e,t)=>{if(o)for(;l++<t-1;)s.write([]);let{values:n}=e;n.shift(),s.write(n.map(a)),l=t}),s.end(),await c}createReadStream(e){let t=this.workbook.getWorksheet(e?.sheetName||e?.sheetId),{dateFormat:n,dateUTC:r}=e||{},i=e?.map||Cl(n,r),a=e?.includeEmptyRows!==!1,o=new vl({...e?.formatterOptions});return t?setTimeout(()=>{let e=1;t.eachRow((t,n)=>{if(a)for(;e++<n-1;)o.write([]);let{values:r}=t;r.shift(),o.write(r.map(i)),e=n}),o.end()},0):setTimeout(()=>o.end(),0),o}createWriteStream(e){let t=this.workbook.addWorksheet(e?.sheetName),n=e?.dateFormats??bl,r=e?.map||Sl(n,{decimalSeparator:e?.valueMapperOptions?.decimalSeparator}),i=new _l(e?.parserOptions);return i.on(`data`,e=>t.addRow(e.map(r))),i}async readFile(e,t){throw Error(`csv.readFile() is not available in browser.
44
44
  Use csv.load(csvString) or csv.read(stream) instead.
45
45
  Example: const response = await fetch('/data.csv');
46
46
  workbook.csv.load(await response.text());`)}async writeFile(e,t){throw Error(`csv.writeFile() is not available in browser.
47
47
  Use csv.writeBuffer() and trigger a download instead.
48
48
  Example: const buffer = await workbook.csv.writeBuffer();
49
- download(new Blob([buffer]), 'output.csv');`)}},Cl=class{constructor(){this._values=[],this._totalRefs=0,this._hash=Object.create(null)}get count(){return this._values.length}get values(){return this._values}get totalRefs(){return this._totalRefs}getString(e){return this._values[e]}add(e){let t=this._hash[e];return t===void 0&&(t=this._hash[e]=this._values.length,this._values.push(e)),this._totalRefs++,t}},wl=class{constructor(e){this.writer=e}push(e){this.writer.addHyperlink(e)}},Tl=class{constructor(e){this.id=e.id,this.count=0,this._hyperlinks=[],this._workbook=e.workbook}get stream(){return this._stream||=this._workbook._openStream(_r(this.id)),this._stream}get length(){return this._hyperlinks.length}each(e){return this._hyperlinks.forEach(e)}get hyperlinksProxy(){return this._hyperlinksProxy||=new wl(this)}addHyperlink(e){let t={Target:e.target,Type:G.Hyperlink,TargetMode:`External`},n=this._writeRelationship(t);this._hyperlinks.push({rId:n,address:e.address})}addMedia(e){return this._writeRelationship(e)}addRelationship(e){return this._writeRelationship(e)}commit(){this.count&&(this._writeClose(),this.stream.end())}_writeOpen(){this.stream.write(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
50
- <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship(e){this.count||this._writeOpen();let t=`rId${++this.count}`;return e.TargetMode?this.stream.write(`<Relationship Id="${t}" Type="${e.Type}" Target="${A(e.Target)}" TargetMode="${e.TargetMode}"/>`):this.stream.write(`<Relationship Id="${t}" Type="${e.Type}" Target="${e.Target}"/>`),t}_writeClose(){this.stream.write(`</Relationships>`)}},El=class{constructor(e,t,n){this.id=n.id,this.count=0,this._worksheet=e,this._workbook=n.workbook,this._sheetRelsWriter=t}get commentsStream(){return this._commentsStream||=this._workbook._openStream(yr(this.id)),this._commentsStream}get vmlStream(){return this._vmlStream||=this._workbook._openStream(xr(this.id)),this._vmlStream}_addRelationships(){let e={Type:G.Comments,Target:Pr(this.id)};this._sheetRelsWriter.addRelationship(e);let t={Type:G.VmlDrawing,Target:Fr(this.id)};this.vmlRelId=this._sheetRelsWriter.addRelationship(t)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>`),this.vmlStream.write(`<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><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>`)}_writeComment(e,t){let n=new So,r=new F;n.render(r,e),this.commentsStream.write(r.xml);let i=new Ao,a=new F;i.render(a,e,t),this.vmlStream.write(a.xml)}_writeClose(){this.commentsStream.write(`</commentList></comments>`),this.vmlStream.write(`</xml>`)}addComments(e){e&&e.length&&(this.startedData||=(this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),!0),e.forEach(e=>{e.refAddress=n.decodeAddress(e.ref)}),e.forEach(e=>{this._writeComment(e,this.count),this.count+=1}))}commit(){this.count&&(this._writeClose(),this.commentsStream.end(),this.vmlStream.end())}};let Q=new Fo,$={dataValidations:new bi,sheetProperties:new wi,sheetFormatProperties:new Ti,columns:new R({tag:`cols`,count:!1,childXform:new pi}),row:new fi,hyperlinks:new R({tag:`hyperlinks`,count:!1,childXform:new hi}),sheetViews:new R({tag:`sheetViews`,count:!1,childXform:new Di}),sheetProtection:new Oi,pageMargins:new ki,pageSeteup:new Fi,autoFilter:new Ri,picture:new zi,conditionalFormattings:new oa,headerFooter:new Gi,rowBreaks:new Ui,colBreaks:new Wi};var Dl=class{constructor(e){this.id=e.id,this.name=e.name||`Sheet${this.id}`,this.state=e.state??`visible`,this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new Tl(e),this._sheetCommentsWriter=new El(this,this._sheetRelsWriter,e),this._dimensions=new r,this._rowZero=1,this._rowOffset=0,this.committed=!1,this.dataValidations=new ye,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.colBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.useSharedStrings=e.useSharedStrings??!1,this._workbook=e.workbook,this.hasComments=!1,this._views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get workbook(){return this._workbook}get stream(){return this._stream||=this._workbook._openStream(gr(this.id)),this._stream}destroy(){throw Error(`Invalid Operation: destroy`)}commit(){if(!this.committed){for(let e=this._rowOffset;e<this._rows.length;e++){let t=this._rows[e];t&&this._writeRow(t)}this._rows=null,this.startedData||this._writeOpenSheetData(),this._writeCloseSheetData(),this._writeSheetProtection(),this._writeAutoFilter(),this._writeMergeCells(),this._writeHyperlinks(),this._writeConditionalFormatting(),this._writeDataValidations(),this._writePageMargins(),this._writePageSetup(),this._writeBackground(),this._writeHeaderFooter(),this._writeRowBreaks(),this._writeColBreaks(),this._writeLegacyData(),this._writeCloseWorksheet(),this.stream.end(),this._sheetCommentsWriter.commit(),this._sheetRelsWriter.commit(),this.committed=!0}}get dimensions(){return this._dimensions}get views(){return this._views}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=t.header&&1||t.headers&&t.headers.length||0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new fe(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){if(typeof e==`string`){let t=this._keys[e];if(t)return t;e=n.l2n(e)}if(this._columns||=[],e>this._columns.length){let t=this._columns.length+1;for(;t<=e;)this._columns.push(new fe(this,t++))}return this._columns[e-1]}get _nextRow(){return this._rowZero+(this._rows.length-this._rowOffset)}eachRow(e,t){let n,r;if(typeof e==`function`?(n=e,r=void 0):(n=t,r=e),r&&r.includeEmpty){let e=this._nextRow;for(let t=this._rowZero;t<e;t++)n(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&n(e,e.number)})}_commitRow(e){let t=!1,n=this._rows;for(;this._rowOffset<n.length&&!t;){let r=n[this._rowOffset];n[this._rowOffset]=void 0,this._rowOffset++,this._rowZero++,r&&(this._writeRow(r),t=r.number===e.number,this._rowZero=r.number+1),this._rowOffset>1024&&this._rowOffset>n.length>>1&&(n.splice(0,this._rowOffset),this._rowOffset=0)}}get lastRow(){let e=this._rows;for(let t=e.length-1;t>=this._rowOffset;t--){let n=e[t];if(n)return n}}findRow(e){let t=e-this._rowZero+this._rowOffset;return this._rows[t]}getRow(e){let t=e-this._rowZero+this._rowOffset;if(t<this._rowOffset)throw Error(`Out of bounds: this row has been committed`);let n=this._rows[t];return n||(this._rows[t]=n=new de(this,e)),n}addRow(e){let t=new de(this,this._nextRow);return this._rows[t.number-this._rowZero+this._rowOffset]=t,t.values=e,t}findCell(e,t){let r=n.getAddress(e,t),i=this.findRow(r.row);return i?i.findCell(r.column):void 0}getCell(e,t){let r=n.getAddress(e,t);return this.getRow(r.row).getCellEx(r)}mergeCells(...e){let t=new r(e);this._merges.forEach(e=>{if(e.intersects(t))throw Error(`Cannot merge already merged cells`)});let{top:n,left:i,bottom:a,right:o}=t,s=jt(n,i,a,o,(e,t)=>this.findCell(e,t)),c=this.getCell(n,i);for(let e=n;e<=a;e++)for(let t=i;t<=o;t++)(e>n||t>i)&&this.getCell(e,t).merge(c);s&&Mt(n,i,a,o,s,(e,t)=>this.getCell(e,t)),this._merges.push(t)}addConditionalFormatting(e){this.conditionalFormatting.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormatting.splice(e,1):e instanceof Function?this.conditionalFormatting=this.conditionalFormatting.filter(e):this.conditionalFormatting=[]}addBackgroundImage(e){this._background={imageId:e}}getBackgroundImageId(){return this._background&&this._background.imageId}async protect(e,t){this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=Ke(yt.randomBytes(16)),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=await yt.convertPasswordToHash(e,`SHA-512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount)}unprotect(){this.sheetProtection=null}_write(e){Q.reset(),Q.addText(e),this.stream.write(Q)}_writeSheetProperties(e,t,n){let r={outlineProperties:t&&t.outlineProperties,tabColor:t&&t.tabColor,pageSetup:n&&n.fitToPage?{fitToPage:n.fitToPage}:void 0};e.addText($.sheetProperties.toXml(r))}_writeSheetFormatProperties(e,t){let n=t?{defaultRowHeight:t.defaultRowHeight,dyDescent:t.dyDescent,outlineLevelCol:t.outlineLevelCol,outlineLevelRow:t.outlineLevelRow}:void 0;t&&t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),e.addText($.sheetFormatProperties.toXml(n))}_writeOpenWorksheet(){Q.reset(),Q.addText(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`),Q.addText(`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">`),this._writeSheetProperties(Q,this.properties,this.pageSetup),Q.addText($.sheetViews.toXml(this.views)),this._writeSheetFormatProperties(Q,this.properties),this.stream.write(Q)}_writeColumns(){let e=fe.toModel(this.columns);e&&($.columns.prepare(e,{styles:this._workbook.styles}),this.stream.write($.columns.toXml(e)))}_writeOpenSheetData(){this._write(`<sheetData>`)}_writeRow(e){if(this.startedData||=(this._writeColumns(),this._writeOpenSheetData(),!0),e.hasValues||e.height!=null){let{model:t}=e,n={styles:this._workbook.styles,sharedStrings:this.useSharedStrings?this._workbook.sharedStrings:void 0,hyperlinks:this._sheetRelsWriter.hyperlinksProxy,merges:this._merges,formulae:this._formulae,siFormulae:this._siFormulae,comments:[]};$.row.prepare(t,n),this.stream.write($.row.toXml(t)),n.comments.length&&(this.hasComments=!0,this._sheetCommentsWriter.addComments(n.comments))}}_writeCloseSheetData(){this._write(`</sheetData>`)}_writeMergeCells(){this._merges.length&&(Q.reset(),Q.addText(`<mergeCells count="${this._merges.length}">`),this._merges.forEach(e=>{Q.addText(`<mergeCell ref="${e}"/>`)}),Q.addText(`</mergeCells>`),this.stream.write(Q))}_writeHyperlinks(){this.stream.write($.hyperlinks.toXml(this._sheetRelsWriter._hyperlinks))}_writeConditionalFormatting(){let e={styles:this._workbook.styles};$.conditionalFormattings.prepare(this.conditionalFormatting,e),this.stream.write($.conditionalFormattings.toXml(this.conditionalFormatting))}_writeRowBreaks(){this.stream.write($.rowBreaks.toXml(this.rowBreaks))}_writeColBreaks(){this.stream.write($.colBreaks.toXml(this.colBreaks))}_writeDataValidations(){this.stream.write($.dataValidations.toXml(this.dataValidations.model))}_writeSheetProtection(){this.stream.write($.sheetProtection.toXml(this.sheetProtection))}_writePageMargins(){this.stream.write($.pageMargins.toXml(this.pageSetup.margins))}_writePageSetup(){this.stream.write($.pageSeteup.toXml(this.pageSetup))}_writeHeaderFooter(){this.stream.write($.headerFooter.toXml(this.headerFooter))}_writeAutoFilter(){this.stream.write($.autoFilter.toXml(this.autoFilter))}_writeBackground(){if(this._background){if(this._background.imageId!==void 0){let e=this._workbook.getImage(this._background.imageId),t=this._sheetRelsWriter.addMedia({Target:Ur(e.name),Type:G.Image});this._background={...this._background,rId:t}}this.stream.write($.picture.toXml({rId:this._background.rId}))}}_writeLegacyData(){this.hasComments&&(Q.reset(),Q.addText(`<legacyDrawing r:id="${this._sheetCommentsWriter.vmlRelId}"/>`),this.stream.write(Q))}_writeDimensions(){}_writeCloseWorksheet(){this._write(`</worksheet>`)}};let Ol=new Uint8Array,kl=new TextDecoder;var Al=class{constructor(e,t){this.WorksheetWriterClass=t,this.created=e.created||new Date,this.modified=e.modified||this.created,this.creator=e.creator??`ExcelTS`,this.lastModifiedBy=e.lastModifiedBy??`ExcelTS`,this.lastPrinted=e.lastPrinted,this.useSharedStrings=e.useSharedStrings??!1,this.sharedStrings=new Cl,this.styles=e.useStyles?new Dn(!0):new Dn.Mock(!0),this._definedNames=new Rt,this._worksheets=[],this.views=[],this.zipOptions=e.zip;let n=e.zip?.zlib?.level??e.zip?.compressionOptions?.level??1;this.compressionLevel=Math.max(0,Math.min(9,n)),this.media=[],this.commentRefs=[],this._trueStreaming=e.trueStreaming??!1,this.zip=new vc((e,t,n)=>{e?this.stream.emit(`error`,e):(this.stream.write(t),n&&this.stream.end())}),this.stream=this._createOutputStream(e),this.promise=Promise.all([this.addThemes(),this.addOfficeRels()])}_createOutputStream(e){return e.stream?ut(e.stream):new Bo}get definedNames(){return this._definedNames}_openStream(e){let t=new Bo({bufSize:this._trueStreaming?4096:65536,batch:!this._trueStreaming}),n=new _c(e,{level:this.compressionLevel});this.zip.add(n);let r=e=>n.push(e);return t.on(`data`,r),t.once(`finish`,()=>{t.removeListener(`data`,r),n.push(Ol,!0),t.emit(`zipped`)}),t}_addFile(e,t,n){let r=new _c(t,{level:this.compressionLevel});this.zip.add(r);let i;i=n?Oe(typeof e==`string`?e:kl.decode(e)):typeof e==`string`?$e(e):e,r.push(i,!0)}_commitWorksheets(){let e=this._worksheets.map(e=>e.committed?Promise.resolve():new Promise(t=>{e.stream.once(`zipped`,()=>t()),e.commit()}));return e.length?Promise.all(e).then(()=>{}):Promise.resolve()}async commit(){await this.promise,await this._commitWorksheets(),await this.addMedia(),await Promise.all([this.addContentTypes(),this.addApp(),this.addCore(),this.addSharedStrings(),this.addStyles(),this.addFeaturePropertyBag(),this.addWorkbookRels()]),await this.addWorkbook(),await this._finalize()}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addImage(e){let t=this.media.length,n={...e,type:`image`,name:`image${t}.${e.extension}`};return this.media.push(n),t}getImage(e){return this.media[e]}addWorksheet(e,t){let n=t||{},r=n.useSharedStrings===void 0?this.useSharedStrings:n.useSharedStrings;n.tabColor&&(console.trace(`tabColor option has moved to { properties: tabColor: {...} }`),n.properties={tabColor:n.tabColor,...n.properties});let i=this.nextId;e??=`sheet${i}`;let a=new this.WorksheetWriterClass({id:i,name:e,workbook:this,useSharedStrings:r,properties:n.properties,state:n.state,pageSetup:n.pageSetup,views:n.views,autoFilter:n.autoFilter,headerFooter:n.headerFooter});return this._worksheets[i]=a,a}getWorksheet(e){if(e===void 0)return this._worksheets.find(()=>!0);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t?.name===e)}addStyles(){return new Promise(e=>{this._addFile(this.styles.xml,U.xlStyles),e()})}addThemes(){return new Promise(e=>{this._addFile(No,U.xlTheme1),e()})}addOfficeRels(){return new Promise(e=>{let t=new H().toXml([{Id:`rId1`,Type:G.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:G.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:G.ExtenderProperties,Target:U.docPropsApp}]);this._addFile(t,U.rootRels),e()})}addContentTypes(){return new Promise(e=>{let t=this._worksheets.filter(Boolean);t.forEach(e=>{e.fileIndex=e.id});let n={worksheets:t,sharedStrings:this.sharedStrings,commentRefs:this.commentRefs,media:this.media,hasCheckboxes:this.styles.hasCheckboxes},r=new Kr;this._addFile(r.toXml(n),U.contentTypes),e()})}addMedia(){return Promise.all(this.media.map(async e=>{if(e.type===`image`){let t=hr(e.name);if(e.buffer){this._addFile(e.buffer,t);return}if(e.base64){let n=e.base64.substring(e.base64.indexOf(`,`)+1);this._addFile(n,t,!0);return}if(e.filename)throw Error(`Loading images from filename is not supported in browser. Use buffer or base64.`)}throw Error(`Unsupported media`)}))}addApp(){return new Promise(e=>{let t=new Yr;this._addFile(t.toXml({worksheets:this._worksheets.filter(Boolean)}),U.docPropsApp),e()})}addCore(){return new Promise(e=>{let t=new kn;this._addFile(t.toXml(this),U.docPropsCore),e()})}addSharedStrings(){return this.sharedStrings.count?new Promise(e=>{let t=new Pn;this._addFile(t.toXml(this.sharedStrings),U.xlSharedStrings),e()}):Promise.resolve()}addFeaturePropertyBag(){if(this.styles.hasCheckboxes){let e=new wa;this._addFile(e.toXml({}),U.xlFeaturePropertyBag)}return Promise.resolve()}addWorkbookRels(){let e=1,t=[{Id:`rId${e++}`,Type:G.Styles,Target:Mr.workbookStyles},{Id:`rId${e++}`,Type:G.Theme,Target:Mr.workbookTheme1}];return this.sharedStrings.count&&t.push({Id:`rId${e++}`,Type:G.SharedStrings,Target:Mr.workbookSharedStrings}),this.styles.hasCheckboxes&&t.push({Id:`rId${e++}`,Type:G.FeaturePropertyBag,Target:Mr.workbookFeaturePropertyBag}),this._worksheets.forEach(n=>{n&&(n.rId=`rId${e++}`,t.push({Id:n.rId,Type:G.Worksheet,Target:vr(n.id)}))}),new Promise(e=>{let n=new H;this._addFile(n.toXml(t),U.xlWorkbookRels),e()})}addWorkbook(){let e={worksheets:this._worksheets.filter(Boolean),definedNames:this._definedNames.model,views:this.views,properties:{},calcProperties:{}};return new Promise(t=>{let n=new si;n.prepare(e),this._addFile(n.toXml(e),U.xlWorkbook),t()})}_finalize(){return new Promise((e,t)=>{let n=e=>{this.stream.removeListener(`finish`,r),t(e)},r=()=>{this.stream.removeListener(`error`,n),e(this)};this.stream.once(`error`,n),this.stream.once(`finish`,r),this.zip.end()})}},jl=class extends Al{constructor(e={}){super(e,Dl)}};function Ml(e,t){let n={},r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(let[a,o]of t){if(e.length>=i+o)switch(o){case 1:n[a]=r.getUint8(i);break;case 2:n[a]=r.getUint16(i,!0);break;case 4:n[a]=r.getUint32(i,!0);break;case 8:{let e=r.getUint32(i,!0);n[a]=r.getUint32(i+4,!0)*4294967296+e;break}default:throw Error(`Unsupported UInt LE size!`)}else n[a]=null;i+=o}return n}function Nl(e,t){return Ml(e,t)}var Pl=class{constructor(e){this.searchFrom=0,this.pattern=e,this.overlap=Math.max(0,e.length-1)}find(e){return e.indexOfPattern(this.pattern,this.searchFrom)}onConsume(e){e>0&&(this.searchFrom=Math.max(0,this.searchFrom-e))}onNoMatch(e){this.searchFrom=Math.max(this.searchFrom,Math.max(0,e-this.overlap))}};let Fl=Cc(tc),Il=256*1024,Ll=[[`version`,4],[`pubKeyLength`,4],[`signatureLength`,4]],Rl=[[`versionsNeededToExtract`,2],[`flags`,2],[`compressionMethod`,2],[`lastModifiedTime`,2],[`lastModifiedDate`,2],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4],[`fileNameLength`,2],[`extraFieldLength`,2]],zl=[[`dataDescriptorSignature`,4],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4]],Bl=[[`versionMadeBy`,2],[`versionsNeededToExtract`,2],[`flags`,2],[`compressionMethod`,2],[`lastModifiedTime`,2],[`lastModifiedDate`,2],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4],[`fileNameLength`,2],[`extraFieldLength`,2],[`fileCommentLength`,2],[`diskNumber`,2],[`internalFileAttributes`,2],[`externalFileAttributes`,4],[`offsetToLocalFileHeader`,4]],Vl=[[`diskNumber`,2],[`diskStart`,2],[`numberOfRecordsOnDisk`,2],[`numberOfRecords`,2],[`sizeOfCentralDirectory`,4],[`offsetToStartOfCentralDirectory`,4],[`commentLength`,2]],Hl=new TextDecoder;new TextEncoder;function Ul(e){return Hl.decode(e)}function Wl(e){return((e??0)&2048)!=0}function Gl(e){if(e.length===0)return!1;let t=e.charCodeAt(e.length-1);return t===47||t===92}function Kl(e,t){return t===0&&Gl(e)?`Directory`:`File`}function ql(e,t,n){return{path:e,pathBuffer:t,flags:{isUnicode:Wl(n)}}}function Jl(e,t){let n=e.lastModifiedDate??0,r=e.lastModifiedTime??0,i=Js(n,r),a=t.mtimeUnixSeconds;return a===void 0?i:Ys(n,r,a)}let Yl=Oc;function Xl(e){return((e??0)&8)!=0}function Zl(e,t){return!Xl(e)||(t??0)>0}function Ql(e){let t=e.pipe(new dt({transform(e,t,n){n()}}));return t.promise=()=>new Promise((e,n)=>{t.on(`finish`,e),t.on(`error`,n)}),t}function $l(e){return new Promise((t,n)=>{let r=[],i=new dt({transform(e,t,n){r.push(e),n()}});i.on(`finish`,()=>{t(r.length===1?r[0]:et(r))}),i.on(`error`,n),e.on(`error`,n).pipe(i)})}async function eu(e){let t=await e(12),n=t.length>=12?cu(t):Nl(t,Ll),r=n.pubKeyLength??0,i=await e(r+(n.signatureLength??0));return n.publicKey=i.subarray(0,r),n.signature=i.subarray(r),n}async function tu(e){let t=await e(26),n=t.length>=26?lu(t):Nl(t,Rl);return{vars:n,fileNameBuffer:await e(n.fileNameLength??0),extraFieldData:await e(n.extraFieldLength??0)}}async function nu(e){let t=await e(16);return t.length>=16?uu(t):Nl(t,zl)}async function ru(e){let t=Nl(await e(42),Bl);await e(t.fileNameLength??0),await e(t.extraFieldLength??0),await e(t.fileCommentLength??0)}async function iu(e){await e(Nl(await e(18),Vl).commentLength??0)}function au(e){switch(e){case Qs:case $s:case ec:case nc:case 117853008:return!0;default:return!1}}function ou(e,t){return(e[t]|0|(e[t+1]|0)<<8|(e[t+2]|0)<<16|(e[t+3]|0)<<24)>>>0}function su(e,t){return(e[t]|(e[t+1]|0)<<8)>>>0}function cu(e){return{version:ou(e,0),pubKeyLength:ou(e,4),signatureLength:ou(e,8)}}function lu(e){return{versionsNeededToExtract:su(e,0),flags:su(e,2),compressionMethod:su(e,4),lastModifiedTime:su(e,6),lastModifiedDate:su(e,8),crc32:ou(e,10),compressedSize:ou(e,14),uncompressedSize:ou(e,18),fileNameLength:su(e,22),extraFieldLength:su(e,24)}}function uu(e){return{dataDescriptorSignature:ou(e,0),crc32:ou(e,4),compressedSize:ou(e,8),uncompressedSize:ou(e,12)}}function du(e){let{source:t,dataDescriptorSignature:n}=e,r=e.keepTailBytes??20,i=e.errorMessage??`FILE_ENDED: Data descriptor not found`,a=new pt({highWaterMark:Il}),o=!1,s=!1,c=0,l=new Pl(n),u,d=()=>{u&&=(u(),void 0)},f=()=>{if(o||s)return;let e=t.getLength();for(e===0&&t.maybeReleaseWriteCallback?.();e>0;){for(;;){let n=l.find(t);if(n===-1)break;let r=n+16;if(r+4<=e){let i=t.peekUint32LE(r),u=t.peekUint32LE(n+8),p=c+n>>>0;if(i!==null&&u!==null&&au(i)&&u===p){if(n>0)if(t.peekChunks&&t.discard){let r=t.peekChunks(n),i=0;for(let e of r){let t=a.write(e);if(i+=e.length,!t){s=!0,a.once(`drain`,()=>{s=!1,f()});break}}if(i>0&&(t.discard(i),c+=i,e-=i,l.onConsume(i)),s)return}else{let r=a.write(t.read(n));if(c+=n,e-=n,l.onConsume(n),!r){s=!0,a.once(`drain`,()=>{s=!1,f()});return}}o=!0,t.maybeReleaseWriteCallback?.(),d(),a.end();return}l.searchFrom=n+1;continue}l.searchFrom=n;break}l.onNoMatch(e);let n=Math.max(0,e-r);if(n>0){if(t.peekChunks&&t.discard){let i=t.peekChunks(n),o=0;for(let e of i){let t=a.write(e);if(o+=e.length,!t){s=!0,a.once(`drain`,()=>{s=!1,f()});break}}o>0&&(t.discard(o),c+=o,e-=o,l.onConsume(o)),e<=r&&t.maybeReleaseWriteCallback?.();return}let i=a.write(t.read(n));c+=n,e-=n,l.onConsume(n),e<=r&&t.maybeReleaseWriteCallback?.(),i||(s=!0,a.once(`drain`,()=>{s=!1,f()}));return}t.maybeReleaseWriteCallback?.();break}!o&&t.isFinished()&&(o=!0,d(),a.destroy(Error(i)))};return u=t.onDataAvailable(f),queueMicrotask(f),a}let fu=Cc(ec);async function pu(e,t,n,r,i,a){let o=e.thresholdBytes??5242880;for(;;){let s=await t.pull(4);if(s.length===0){n.emitClose();return}let c=wc(s,0);if(c===875721283){i.crxHeader=await eu(async e=>t.pull(e)),n.emitCrxHeader(i.crxHeader);continue}if(c===Qs){await hu(e,t,n,r,i,o,a);continue}if(c===$s){i.reachedCD=!0,await ru(async e=>t.pull(e));continue}if(c===ec){await iu(async e=>t.pull(e)),t.setDone(),n.emitClose();return}if(i.reachedCD){await t.pullUntil(fu,!0),await iu(async e=>t.pull(e)),t.setDone(),n.emitClose();return}n.emitError(Error(`invalid signature: 0x`+c.toString(16))),n.emitClose();return}}async function mu(e,t,n,r){let i=r,a=null,o=e=>{a=e};t.once(`error`,o),n.once(`error`,o);let s=!1,c=async()=>{await new Promise(e=>{let r=t,i=()=>{try{r?.removeListener?.(`drain`,a)}catch{}try{n.removeListener(`__autodrain`,o)}catch{}try{n.removeListener(`close`,s)}catch{}},a=()=>{i(),e()},o=()=>{i(),e()},s=()=>{i(),e()};typeof r?.once==`function`&&r.once(`drain`,a),n.once(`__autodrain`,o),n.once(`close`,s)})},l=async()=>{if(!s){s=!0;try{let e=t;typeof e.unpipe==`function`&&e.unpipe(n)}catch{}try{!n.writableEnded&&!n.destroyed&&n.end()}catch{}try{let e=t;typeof e.destroy==`function`&&e.destroy()}catch{}}};try{for(t.pipe(n);i>0;){if(a)throw a;!s&&(n.__autodraining||n.destroyed)&&await l();let r=Math.min(262144,i),o=await e.pull(r);if(o.length!==r)throw Error(`FILE_ENDED`);i-=o.length,s||t.write(o)||await c()}s||t.end(),await _t(n,{readable:!1})}finally{t.removeListener(`error`,o),n.removeListener(`error`,o)}}async function hu(e,t,n,r,i,a,o){let{vars:s,fileNameBuffer:c,extraFieldData:l}=await tu(async e=>t.pull(e)),u=s;i.crxHeader&&(u.crxHeader=i.crxHeader);let d=Ul(c),f=new pt({highWaterMark:Il}),p=!1;f.autodrain=function(){return p=!0,f.__autodraining=!0,f.emit(`__autodrain`),Ql(f)},f.buffer=function(){return $l(f)},f.path=d,f.props=ql(d,c,u.flags),f.type=Kl(d,u.uncompressedSize??0),e.verbose&&(f.type===`Directory`?console.log(` creating:`,d):f.type===`File`&&(u.compressionMethod===0?console.log(` extracting:`,d):console.log(` inflating:`,d)));let m=Yl(l,u);u.lastModifiedDateTime=Jl(u,m),f.vars=u,f.extraFields=m,f.__autodraining=p;let h=Zl(u.flags,u.compressedSize);h&&(f.size=u.uncompressedSize??0),e.forceStream?n.pushEntry(f):(n.emitEntry(f),n.pushEntryIfPiped(f)),e.verbose&&console.log({filename:d,vars:u,extraFields:f.extraFields});let g=!Xl(u.flags),_=u.compressedSize??0,v=u.uncompressedSize??0;if(g&&h&&o&&u.compressionMethod!==0&&!p&&_<=a&&v<=a){let e=o(await t.pull(_));f.end(e),await _t(f,{readable:!1});return}let y=u.compressionMethod&&!p?r():new pt({highWaterMark:Il});if(h){await mu(t,y,f,u.compressedSize??0);return}await gt(t.streamUntilDataDescriptor(),y,f),f.size=(await nu(async e=>t.pull(e))).uncompressedSize??0}let gu=256*1024;var _u=class extends ft{constructor(){super({writableHighWaterMark:512*1024,readableHighWaterMark:512*1024,write:(e,t,n)=>{this._doWrite(e,n)},final:e=>{this._closeWriter(()=>{e()})}}),this.reading=!1,this.writeClosed=!1,this._junkError=!1,this._bytesIn=0,this._bytesOut=0,this._readingDone=!1,this._pendingWrites=0,this._writeFinishedPromise=null,this._resolveWriteFinished=null,this.decompressionStream=new DecompressionStream(`deflate-raw`),this.writer=this.decompressionStream.writable.getWriter(),this.reader=this.decompressionStream.readable.getReader(),this._readingDonePromise=new Promise(e=>{this._resolveReadingDone=e}),this._startReading()}_doWrite(e,t){if(this._junkError){t&&t();return}this._bytesIn+=e.length,this._pendingWrites++,this.writer.write(e).then(()=>{this._pendingWrites--,this._pendingWrites===0&&this._resolveWriteFinished&&this._resolveWriteFinished(),t&&t()}).catch(e=>{this._pendingWrites--,this._pendingWrites===0&&this._resolveWriteFinished&&this._resolveWriteFinished();let n=e instanceof Error?e.message:String(e);n.includes(`Junk`)||n.includes(`junk`)?(this._junkError=!0,t&&t()):t?t(e):this.emit(`error`,e)})}async _startReading(){if(!this.reading){this.reading=!0;try{for(;;){let{done:e,value:t}=await this.reader.read();if(e)break;this._bytesOut+=t.length,this.push(t)}}catch(e){let t=e instanceof Error?e.message:String(e);t.includes(`Junk`)||t.includes(`junk`)?this._junkError=!0:this.emit(`error`,e)}finally{this._readingDone=!0,this._resolveReadingDone(),this.push(null)}}}_closeWriter(e){if(this.writeClosed){this._readingDonePromise.then(()=>{e&&e()});return}this.writeClosed=!0,(this._pendingWrites>0?new Promise(e=>{this._writeFinishedPromise=new Promise(e=>{this._resolveWriteFinished=e}),this._writeFinishedPromise.then(e)}):Promise.resolve()).then(()=>this.writer.close()).catch(()=>{}).finally(()=>{this._readingDonePromise.then(()=>{e&&e()})})}destroy(e){return this.writeClosed||this.writer.abort(e??void 0).catch(()=>{}),this.reader.cancel(e??void 0).catch(()=>{}),super.destroy(e)}};let vu=null;function yu(e){if(typeof e==`string`&&e.length>0)return e;if(vu)return vu;let t=new Blob([`
49
+ download(new Blob([buffer]), 'output.csv');`)}},Tl=class{constructor(){this._values=[],this._totalRefs=0,this._hash=Object.create(null)}get count(){return this._values.length}get values(){return this._values}get totalRefs(){return this._totalRefs}getString(e){return this._values[e]}add(e){let t=this._hash[e];return t===void 0&&(t=this._hash[e]=this._values.length,this._values.push(e)),this._totalRefs++,t}},El=class{constructor(e){this.writer=e}push(e){this.writer.addHyperlink(e)}},Dl=class{constructor(e){this.id=e.id,this.count=0,this._hyperlinks=[],this._workbook=e.workbook}get stream(){return this._stream||=this._workbook._openStream(xr(this.id)),this._stream}get length(){return this._hyperlinks.length}each(e){return this._hyperlinks.forEach(e)}get hyperlinksProxy(){return this._hyperlinksProxy||=new El(this)}addHyperlink(e){let t={Target:e.target,Type:G.Hyperlink,TargetMode:`External`},n=this._writeRelationship(t);this._hyperlinks.push({rId:n,address:e.address})}addMedia(e){return this._writeRelationship(e)}addRelationship(e){return this._writeRelationship(e)}commit(){this.count&&(this._writeClose(),this.stream.end())}_writeOpen(){this.stream.write(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
50
+ <Relationships xmlns="http://schemas.openxmlformats.org/package/2006/relationships">`)}_writeRelationship(e){this.count||this._writeOpen();let t=`rId${++this.count}`;return e.TargetMode?this.stream.write(`<Relationship Id="${t}" Type="${e.Type}" Target="${A(e.Target)}" TargetMode="${e.TargetMode}"/>`):this.stream.write(`<Relationship Id="${t}" Type="${e.Type}" Target="${e.Target}"/>`),t}_writeClose(){this.stream.write(`</Relationships>`)}},Ol=class{constructor(e,t,n){this.id=n.id,this.count=0,this._worksheet=e,this._workbook=n.workbook,this._sheetRelsWriter=t}get commentsStream(){return this._commentsStream||=this._workbook._openStream(Cr(this.id)),this._commentsStream}get vmlStream(){return this._vmlStream||=this._workbook._openStream(Tr(this.id)),this._vmlStream}_addRelationships(){let e={Type:G.Comments,Target:Rr(this.id)};this._sheetRelsWriter.addRelationship(e);let t={Type:G.VmlDrawing,Target:zr(this.id)};this.vmlRelId=this._sheetRelsWriter.addRelationship(t)}_addCommentRefs(){this._workbook.commentRefs.push({commentName:`comments${this.id}`,vmlDrawing:`vmlDrawing${this.id}`})}_writeOpen(){this.commentsStream.write(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?><comments xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main"><authors><author>Author</author></authors><commentList>`),this.vmlStream.write(`<?xml version="1.0" encoding="UTF-8"?><xml xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:v="urn:schemas-microsoft-com:vml" xmlns:x="urn:schemas-microsoft-com:office:excel"><o:shapelayout v:ext="edit"><o:idmap v:ext="edit" data="1" /></o:shapelayout><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>`)}_writeComment(e,t){let n=new Eo,r=new F;n.render(r,e),this.commentsStream.write(r.xml);let i=new Po,a=new F;i.render(a,e,t),this.vmlStream.write(a.xml)}_writeClose(){this.commentsStream.write(`</commentList></comments>`),this.vmlStream.write(`</xml>`)}addComments(e){e&&e.length&&(this.startedData||=(this._worksheet.comments=[],this._writeOpen(),this._addRelationships(),this._addCommentRefs(),!0),e.forEach(e=>{e.refAddress=n.decodeAddress(e.ref)}),e.forEach(e=>{this._writeComment(e,this.count),this.count+=1}))}commit(){this.count&&(this._writeClose(),this.commentsStream.end(),this.vmlStream.end())}};let Q=new Ro,$={dataValidations:new wi,sheetProperties:new Oi,sheetFormatProperties:new ki,columns:new R({tag:`cols`,count:!1,childXform:new _i}),row:new gi,hyperlinks:new R({tag:`hyperlinks`,count:!1,childXform:new yi}),sheetViews:new R({tag:`sheetViews`,count:!1,childXform:new ji}),sheetProtection:new Mi,pageMargins:new Ni,pageSeteup:new zi,autoFilter:new Hi,picture:new Ui,conditionalFormattings:new ua,headerFooter:new Yi,rowBreaks:new qi,colBreaks:new Ji};var kl=class{constructor(e){this.id=e.id,this.name=e.name||`Sheet${this.id}`,this.state=e.state??`visible`,this._rows=[],this._columns=null,this._keys={},this._merges=[],this._merges.add=function(){},this._sheetRelsWriter=new Dl(e),this._sheetCommentsWriter=new Ol(this,this._sheetRelsWriter,e),this._dimensions=new r,this._rowZero=1,this._rowOffset=0,this.committed=!1,this.dataValidations=new Ce,this._formulae={},this._siFormulae=0,this.conditionalFormatting=[],this.rowBreaks=[],this.colBreaks=[],this.properties=Object.assign({},{defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0},e.properties),this.headerFooter=Object.assign({},{differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null},e.headerFooter),this.pageSetup=Object.assign({},{margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:4294967295,verticalDpi:4294967295,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null},e.pageSetup),this.useSharedStrings=e.useSharedStrings??!1,this._workbook=e.workbook,this.hasComments=!1,this._views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this._writeOpenWorksheet(),this.startedData=!1}get workbook(){return this._workbook}get stream(){return this._stream||=this._workbook._openStream(br(this.id)),this._stream}destroy(){throw Error(`Invalid Operation: destroy`)}commit(){if(!this.committed){for(let e=this._rowOffset;e<this._rows.length;e++){let t=this._rows[e];t&&this._writeRow(t)}this._rows=null,this.startedData||this._writeOpenSheetData(),this._writeCloseSheetData(),this._writeSheetProtection(),this._writeAutoFilter(),this._writeMergeCells(),this._writeHyperlinks(),this._writeConditionalFormatting(),this._writeDataValidations(),this._writePageMargins(),this._writePageSetup(),this._writeBackground(),this._writeHeaderFooter(),this._writeRowBreaks(),this._writeColBreaks(),this._writeLegacyData(),this._writeCloseWorksheet(),this.stream.end(),this._sheetCommentsWriter.commit(),this._sheetRelsWriter.commit(),this.committed=!0}}get dimensions(){return this._dimensions}get views(){return this._views}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=t.header&&1||t.headers&&t.headers.length||0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new fe(this,t++,!1);n.push(r),r.defn=e})}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){Object.keys(this._keys).forEach(t=>e(this._keys[t],t))}getColumn(e){if(typeof e==`string`){let t=this._keys[e];if(t)return t;e=n.l2n(e)}if(this._columns||=[],e>this._columns.length){let t=this._columns.length+1;for(;t<=e;)this._columns.push(new fe(this,t++))}return this._columns[e-1]}get _nextRow(){return this._rowZero+(this._rows.length-this._rowOffset)}eachRow(e,t){let n,r;if(typeof e==`function`?(n=e,r=void 0):(n=t,r=e),r&&r.includeEmpty){let e=this._nextRow;for(let t=this._rowZero;t<e;t++)n(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&n(e,e.number)})}_commitRow(e){let t=!1,n=this._rows;for(;this._rowOffset<n.length&&!t;){let r=n[this._rowOffset];n[this._rowOffset]=void 0,this._rowOffset++,this._rowZero++,r&&(this._writeRow(r),t=r.number===e.number,this._rowZero=r.number+1),this._rowOffset>1024&&this._rowOffset>n.length>>1&&(n.splice(0,this._rowOffset),this._rowOffset=0)}}get lastRow(){let e=this._rows;for(let t=e.length-1;t>=this._rowOffset;t--){let n=e[t];if(n)return n}}findRow(e){let t=e-this._rowZero+this._rowOffset;return this._rows[t]}getRow(e){let t=e-this._rowZero+this._rowOffset;if(t<this._rowOffset)throw Error(`Out of bounds: this row has been committed`);let n=this._rows[t];return n||(this._rows[t]=n=new de(this,e)),n}addRow(e){let t=new de(this,this._nextRow);return this._rows[t.number-this._rowZero+this._rowOffset]=t,t.values=e,t}findCell(e,t){let r=n.getAddress(e,t),i=this.findRow(r.row);return i?i.findCell(r.column):void 0}getCell(e,t){let r=n.getAddress(e,t);return this.getRow(r.row).getCellEx(r)}mergeCells(...e){let t=new r(e);this._merges.forEach(e=>{if(e.intersects(t))throw Error(`Cannot merge already merged cells`)});let{top:n,left:i,bottom:a,right:o}=t,s=Ft(n,i,a,o,(e,t)=>this.findCell(e,t)),c=this.getCell(n,i);for(let e=n;e<=a;e++)for(let t=i;t<=o;t++)(e>n||t>i)&&this.getCell(e,t).merge(c);s&&It(n,i,a,o,s,(e,t)=>this.getCell(e,t)),this._merges.push(t)}addConditionalFormatting(e){this.conditionalFormatting.push(e)}removeConditionalFormatting(e){typeof e==`number`?this.conditionalFormatting.splice(e,1):e instanceof Function?this.conditionalFormatting=this.conditionalFormatting.filter(e):this.conditionalFormatting=[]}addBackgroundImage(e){this._background={imageId:e}}getBackgroundImageId(){return this._background&&this._background.imageId}async protect(e,t){this.sheetProtection={sheet:!0},t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(this.sheetProtection.algorithmName=`SHA-512`,this.sheetProtection.saltValue=Xe(Ct.randomBytes(16)),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=await Ct.convertPasswordToHash(e,`SHA-512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount)}unprotect(){this.sheetProtection=null}_write(e){Q.reset(),Q.addText(e),this.stream.write(Q)}_writeSheetProperties(e,t,n){let r={outlineProperties:t&&t.outlineProperties,tabColor:t&&t.tabColor,pageSetup:n&&n.fitToPage?{fitToPage:n.fitToPage}:void 0};e.addText($.sheetProperties.toXml(r))}_writeSheetFormatProperties(e,t){let n=t?{defaultRowHeight:t.defaultRowHeight,dyDescent:t.dyDescent,outlineLevelCol:t.outlineLevelCol,outlineLevelRow:t.outlineLevelRow}:void 0;t&&t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),e.addText($.sheetFormatProperties.toXml(n))}_writeOpenWorksheet(){Q.reset(),Q.addText(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>`),Q.addText(`<worksheet xmlns="http://schemas.openxmlformats.org/spreadsheetml/2006/main" xmlns:r="http://schemas.openxmlformats.org/officeDocument/2006/relationships" xmlns:mc="http://schemas.openxmlformats.org/markup-compatibility/2006" mc:Ignorable="x14ac" xmlns:x14ac="http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac">`),this._writeSheetProperties(Q,this.properties,this.pageSetup),Q.addText($.sheetViews.toXml(this.views)),this._writeSheetFormatProperties(Q,this.properties),this.stream.write(Q)}_writeColumns(){let e=fe.toModel(this.columns);e&&($.columns.prepare(e,{styles:this._workbook.styles}),this.stream.write($.columns.toXml(e)))}_writeOpenSheetData(){this._write(`<sheetData>`)}_writeRow(e){if(this.startedData||=(this._writeColumns(),this._writeOpenSheetData(),!0),e.hasValues||e.height!=null){let{model:t}=e,n={styles:this._workbook.styles,sharedStrings:this.useSharedStrings?this._workbook.sharedStrings:void 0,hyperlinks:this._sheetRelsWriter.hyperlinksProxy,merges:this._merges,formulae:this._formulae,siFormulae:this._siFormulae,comments:[]};$.row.prepare(t,n),this.stream.write($.row.toXml(t)),n.comments.length&&(this.hasComments=!0,this._sheetCommentsWriter.addComments(n.comments))}}_writeCloseSheetData(){this._write(`</sheetData>`)}_writeMergeCells(){this._merges.length&&(Q.reset(),Q.addText(`<mergeCells count="${this._merges.length}">`),this._merges.forEach(e=>{Q.addText(`<mergeCell ref="${e}"/>`)}),Q.addText(`</mergeCells>`),this.stream.write(Q))}_writeHyperlinks(){this.stream.write($.hyperlinks.toXml(this._sheetRelsWriter._hyperlinks))}_writeConditionalFormatting(){let e={styles:this._workbook.styles};$.conditionalFormattings.prepare(this.conditionalFormatting,e),this.stream.write($.conditionalFormattings.toXml(this.conditionalFormatting))}_writeRowBreaks(){this.stream.write($.rowBreaks.toXml(this.rowBreaks))}_writeColBreaks(){this.stream.write($.colBreaks.toXml(this.colBreaks))}_writeDataValidations(){this.stream.write($.dataValidations.toXml(this.dataValidations.model))}_writeSheetProtection(){this.stream.write($.sheetProtection.toXml(this.sheetProtection))}_writePageMargins(){this.stream.write($.pageMargins.toXml(this.pageSetup.margins))}_writePageSetup(){this.stream.write($.pageSeteup.toXml(this.pageSetup))}_writeHeaderFooter(){this.stream.write($.headerFooter.toXml(this.headerFooter))}_writeAutoFilter(){this.stream.write($.autoFilter.toXml(this.autoFilter))}_writeBackground(){if(this._background){if(this._background.imageId!==void 0){let e=this._workbook.getImage(this._background.imageId),t=this._sheetRelsWriter.addMedia({Target:qr(e.name),Type:G.Image});this._background={...this._background,rId:t}}this.stream.write($.picture.toXml({rId:this._background.rId}))}}_writeLegacyData(){this.hasComments&&(Q.reset(),Q.addText(`<legacyDrawing r:id="${this._sheetCommentsWriter.vmlRelId}"/>`),this.stream.write(Q))}_writeDimensions(){}_writeCloseWorksheet(){this._write(`</worksheet>`)}};let Al=new Uint8Array,jl=new TextDecoder;var Ml=class{constructor(e,t){this.WorksheetWriterClass=t,this.created=e.created||new Date,this.modified=e.modified||this.created,this.creator=e.creator??`ExcelTS`,this.lastModifiedBy=e.lastModifiedBy??`ExcelTS`,this.lastPrinted=e.lastPrinted,this.useSharedStrings=e.useSharedStrings??!1,this.sharedStrings=new Tl,this.styles=e.useStyles?new jn(!0):new jn.Mock(!0),this._definedNames=new Ht,this._worksheets=[],this.views=[],this.zipOptions=e.zip;let n=e.zip?.zlib?.level??e.zip?.compressionOptions?.level??1;this.compressionLevel=Math.max(0,Math.min(9,n)),this.media=[],this.commentRefs=[],this._trueStreaming=e.trueStreaming??!1,this.zip=new bc((e,t,n)=>{e?this.stream.emit(`error`,e):(this.stream.write(t),n&&this.stream.end())}),this.stream=this._createOutputStream(e),this.promise=Promise.all([this.addThemes(),this.addOfficeRels()])}_createOutputStream(e){return e.stream?mt(e.stream):new Uo}get definedNames(){return this._definedNames}_openStream(e){let t=new Uo({bufSize:this._trueStreaming?4096:65536,batch:!this._trueStreaming}),n=new yc(e,{level:this.compressionLevel});this.zip.add(n);let r=e=>n.push(e);return t.on(`data`,r),t.once(`finish`,()=>{t.removeListener(`data`,r),n.push(Al,!0),t.emit(`zipped`)}),t}_addFile(e,t,n){let r=new yc(t,{level:this.compressionLevel});this.zip.add(r);let i;i=n?Me(typeof e==`string`?e:jl.decode(e)):typeof e==`string`?rt(e):e,r.push(i,!0)}_commitWorksheets(){let e=this._worksheets.map(e=>e.committed?Promise.resolve():new Promise(t=>{e.stream.once(`zipped`,()=>t()),e.commit()}));return e.length?Promise.all(e).then(()=>{}):Promise.resolve()}async commit(){await this.promise,await this._commitWorksheets(),await this.addMedia(),await Promise.all([this.addContentTypes(),this.addApp(),this.addCore(),this.addSharedStrings(),this.addStyles(),this.addFeaturePropertyBag(),this.addWorkbookRels()]),await this.addWorkbook(),await this._finalize()}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addImage(e){let t=this.media.length,n={...e,type:`image`,name:`image${t}.${e.extension}`};return this.media.push(n),t}getImage(e){return this.media[e]}addWorksheet(e,t){let n=t||{},r=n.useSharedStrings===void 0?this.useSharedStrings:n.useSharedStrings;n.tabColor&&(console.trace(`tabColor option has moved to { properties: tabColor: {...} }`),n.properties={tabColor:n.tabColor,...n.properties});let i=this.nextId;e??=`sheet${i}`;let a=new this.WorksheetWriterClass({id:i,name:e,workbook:this,useSharedStrings:r,properties:n.properties,state:n.state,pageSetup:n.pageSetup,views:n.views,autoFilter:n.autoFilter,headerFooter:n.headerFooter});return this._worksheets[i]=a,a}getWorksheet(e){if(e===void 0)return this._worksheets.find(()=>!0);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t?.name===e)}addStyles(){return new Promise(e=>{this._addFile(this.styles.xml,U.xlStyles),e()})}addThemes(){return new Promise(e=>{this._addFile(`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
51
+ <a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <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:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`,U.xlTheme1),e()})}addOfficeRels(){return new Promise(e=>{let t=new H().toXml([{Id:`rId1`,Type:G.OfficeDocument,Target:U.xlWorkbook},{Id:`rId2`,Type:G.CoreProperties,Target:U.docPropsCore},{Id:`rId3`,Type:G.ExtenderProperties,Target:U.docPropsApp}]);this._addFile(t,U.rootRels),e()})}addContentTypes(){return new Promise(e=>{let t=this._worksheets.filter(Boolean);t.forEach(e=>{e.fileIndex=e.id});let n={worksheets:t,sharedStrings:this.sharedStrings,commentRefs:this.commentRefs,media:this.media,hasCheckboxes:this.styles.hasCheckboxes},r=new Xr;this._addFile(r.toXml(n),U.contentTypes),e()})}addMedia(){return Promise.all(this.media.map(async e=>{if(e.type===`image`){let t=yr(e.name);if(e.buffer){this._addFile(e.buffer,t);return}if(e.base64){let n=e.base64.substring(e.base64.indexOf(`,`)+1);this._addFile(n,t,!0);return}if(e.filename)throw Error(`Loading images from filename is not supported in browser. Use buffer or base64.`)}throw Error(`Unsupported media`)}))}addApp(){return new Promise(e=>{let t=new $r;this._addFile(t.toXml({worksheets:this._worksheets.filter(Boolean)}),U.docPropsApp),e()})}addCore(){return new Promise(e=>{let t=new Nn;this._addFile(t.toXml(this),U.docPropsCore),e()})}addSharedStrings(){return this.sharedStrings.count?new Promise(e=>{let t=new Rn;this._addFile(t.toXml(this.sharedStrings),U.xlSharedStrings),e()}):Promise.resolve()}addFeaturePropertyBag(){if(this.styles.hasCheckboxes){let e=new Oa;this._addFile(e.toXml({}),U.xlFeaturePropertyBag)}return Promise.resolve()}addWorkbookRels(){let e=1,t=[{Id:`rId${e++}`,Type:G.Styles,Target:Ir.workbookStyles},{Id:`rId${e++}`,Type:G.Theme,Target:Ir.workbookTheme1}];return this.sharedStrings.count&&t.push({Id:`rId${e++}`,Type:G.SharedStrings,Target:Ir.workbookSharedStrings}),this.styles.hasCheckboxes&&t.push({Id:`rId${e++}`,Type:G.FeaturePropertyBag,Target:Ir.workbookFeaturePropertyBag}),this._worksheets.forEach(n=>{n&&(n.rId=`rId${e++}`,t.push({Id:n.rId,Type:G.Worksheet,Target:Sr(n.id)}))}),new Promise(e=>{let n=new H;this._addFile(n.toXml(t),U.xlWorkbookRels),e()})}addWorkbook(){let e={worksheets:this._worksheets.filter(Boolean),definedNames:this._definedNames.model,views:this.views,properties:{},calcProperties:{}};return new Promise(t=>{let n=new di;n.prepare(e),this._addFile(n.toXml(e),U.xlWorkbook),t()})}_finalize(){return new Promise((e,t)=>{let n=e=>{this.stream.removeListener(`finish`,r),t(e)},r=()=>{this.stream.removeListener(`error`,n),e(this)};this.stream.once(`error`,n),this.stream.once(`finish`,r),this.zip.end()})}},Nl=class extends Ml{constructor(e={}){super(e,kl)}};function Pl(e,t){let n={},r=new DataView(e.buffer,e.byteOffset,e.byteLength),i=0;for(let[a,o]of t){if(e.length>=i+o)switch(o){case 1:n[a]=r.getUint8(i);break;case 2:n[a]=r.getUint16(i,!0);break;case 4:n[a]=r.getUint32(i,!0);break;case 8:{let e=r.getUint32(i,!0);n[a]=r.getUint32(i+4,!0)*4294967296+e;break}default:throw Error(`Unsupported UInt LE size!`)}else n[a]=null;i+=o}return n}function Fl(e,t){return Pl(e,t)}var Il=class{constructor(e){this.searchFrom=0,this.pattern=e,this.overlap=Math.max(0,e.length-1)}find(e){return e.indexOfPattern(this.pattern,this.searchFrom)}onConsume(e){e>0&&(this.searchFrom=Math.max(0,this.searchFrom-e))}onNoMatch(e){this.searchFrom=Math.max(this.searchFrom,Math.max(0,e-this.overlap))}};let Ll=Tc(ic),Rl=256*1024,zl=[[`version`,4],[`pubKeyLength`,4],[`signatureLength`,4]],Bl=[[`versionsNeededToExtract`,2],[`flags`,2],[`compressionMethod`,2],[`lastModifiedTime`,2],[`lastModifiedDate`,2],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4],[`fileNameLength`,2],[`extraFieldLength`,2]],Vl=[[`dataDescriptorSignature`,4],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4]],Hl=[[`versionMadeBy`,2],[`versionsNeededToExtract`,2],[`flags`,2],[`compressionMethod`,2],[`lastModifiedTime`,2],[`lastModifiedDate`,2],[`crc32`,4],[`compressedSize`,4],[`uncompressedSize`,4],[`fileNameLength`,2],[`extraFieldLength`,2],[`fileCommentLength`,2],[`diskNumber`,2],[`internalFileAttributes`,2],[`externalFileAttributes`,4],[`offsetToLocalFileHeader`,4]],Ul=[[`diskNumber`,2],[`diskStart`,2],[`numberOfRecordsOnDisk`,2],[`numberOfRecords`,2],[`sizeOfCentralDirectory`,4],[`offsetToStartOfCentralDirectory`,4],[`commentLength`,2]],Wl=new TextDecoder;new TextEncoder;function Gl(e){return Wl.decode(e)}function Kl(e){return((e??0)&2048)!=0}function ql(e){if(e.length===0)return!1;let t=e.charCodeAt(e.length-1);return t===47||t===92}function Jl(e,t){return t===0&&ql(e)?`Directory`:`File`}function Yl(e,t,n){return{path:e,pathBuffer:t,flags:{isUnicode:Kl(n)}}}function Xl(e,t){let n=e.lastModifiedDate??0,r=e.lastModifiedTime??0,i=Zs(n,r),a=t.mtimeUnixSeconds;return a===void 0?i:Qs(n,r,a)}let Zl=Ac;function Ql(e){return((e??0)&8)!=0}function $l(e,t){return!Ql(e)||(t??0)>0}function eu(e){let t=e.pipe(new ht({transform(e,t,n){n()}}));return t.promise=()=>new Promise((e,n)=>{t.on(`finish`,e),t.on(`error`,n)}),t}function tu(e){return new Promise((t,n)=>{let r=[],i=new ht({transform(e,t,n){r.push(e),n()}});i.on(`finish`,()=>{t(r.length===1?r[0]:it(r))}),i.on(`error`,n),e.on(`error`,n).pipe(i)})}async function nu(e){let t=await e(12),n=t.length>=12?uu(t):Fl(t,zl),r=n.pubKeyLength??0,i=await e(r+(n.signatureLength??0));return n.publicKey=i.subarray(0,r),n.signature=i.subarray(r),n}async function ru(e){let t=await e(26),n=t.length>=26?du(t):Fl(t,Bl);return{vars:n,fileNameBuffer:await e(n.fileNameLength??0),extraFieldData:await e(n.extraFieldLength??0)}}async function iu(e){let t=await e(16);return t.length>=16?fu(t):Fl(t,Vl)}async function au(e){let t=Fl(await e(42),Hl);await e(t.fileNameLength??0),await e(t.extraFieldLength??0),await e(t.fileCommentLength??0)}async function ou(e){await e(Fl(await e(18),Ul).commentLength??0)}function su(e){switch(e){case tc:case nc:case rc:case 101075792:case 117853008:return!0;default:return!1}}function cu(e,t){return(e[t]|0|(e[t+1]|0)<<8|(e[t+2]|0)<<16|(e[t+3]|0)<<24)>>>0}function lu(e,t){return(e[t]|(e[t+1]|0)<<8)>>>0}function uu(e){return{version:cu(e,0),pubKeyLength:cu(e,4),signatureLength:cu(e,8)}}function du(e){return{versionsNeededToExtract:lu(e,0),flags:lu(e,2),compressionMethod:lu(e,4),lastModifiedTime:lu(e,6),lastModifiedDate:lu(e,8),crc32:cu(e,10),compressedSize:cu(e,14),uncompressedSize:cu(e,18),fileNameLength:lu(e,22),extraFieldLength:lu(e,24)}}function fu(e){return{dataDescriptorSignature:cu(e,0),crc32:cu(e,4),compressedSize:cu(e,8),uncompressedSize:cu(e,12)}}function pu(e){let{source:t,dataDescriptorSignature:n}=e,r=e.keepTailBytes??20,i=e.errorMessage??`FILE_ENDED: Data descriptor not found`,a=new _t({highWaterMark:Rl}),o=!1,s=!1,c=0,l=new Il(n),u,d=()=>{u&&=(u(),void 0)},f=()=>{if(o||s)return;let e=t.getLength();for(e===0&&t.maybeReleaseWriteCallback?.();e>0;){for(;;){let n=l.find(t);if(n===-1)break;let r=n+16;if(r+4<=e){let e=t.peekUint32LE(r),i=t.peekUint32LE(n+8),u=c+n>>>0;if(e!==null&&i!==null&&su(e)&&i===u){if(n>0)if(t.peekChunks&&t.discard){let e=t.peekChunks(n),r=0;for(let t of e){let e=a.write(t);if(r+=t.length,!e){s=!0,a.once(`drain`,()=>{s=!1,f()});break}}if(r>0&&(t.discard(r),c+=r,l.onConsume(r)),s)return}else{let e=a.write(t.read(n));if(c+=n,l.onConsume(n),!e){s=!0,a.once(`drain`,()=>{s=!1,f()});return}}o=!0,t.maybeReleaseWriteCallback?.(),d(),a.end();return}l.searchFrom=n+1;continue}l.searchFrom=n;break}l.onNoMatch(e);let n=Math.max(0,e-r);if(n>0){if(t.peekChunks&&t.discard){let i=t.peekChunks(n),o=0;for(let e of i){let t=a.write(e);if(o+=e.length,!t){s=!0,a.once(`drain`,()=>{s=!1,f()});break}}o>0&&(t.discard(o),c+=o,e-=o,l.onConsume(o)),e<=r&&t.maybeReleaseWriteCallback?.();return}let i=a.write(t.read(n));c+=n,e-=n,l.onConsume(n),e<=r&&t.maybeReleaseWriteCallback?.(),i||(s=!0,a.once(`drain`,()=>{s=!1,f()}));return}t.maybeReleaseWriteCallback?.();break}!o&&t.isFinished()&&(o=!0,d(),a.destroy(Error(i)))};return u=t.onDataAvailable(f),queueMicrotask(f),a}let mu=Tc(rc);async function hu(e,t,n,r,i,a){let o=e.thresholdBytes??5242880;for(;;){let s=await t.pull(4);if(s.length===0){n.emitClose();return}let c=Ec(s,0);if(c===875721283){i.crxHeader=await nu(async e=>t.pull(e)),n.emitCrxHeader(i.crxHeader);continue}if(c===67324752){await _u(e,t,n,r,i,o,a);continue}if(c===33639248){i.reachedCD=!0,await au(async e=>t.pull(e));continue}if(c===101010256){await ou(async e=>t.pull(e)),t.setDone(),n.emitClose();return}if(i.reachedCD){await t.pullUntil(mu,!0),await ou(async e=>t.pull(e)),t.setDone(),n.emitClose();return}n.emitError(Error(`invalid signature: 0x`+c.toString(16))),n.emitClose();return}}async function gu(e,t,n,r){let i=r,a=null,o=e=>{a=e};t.once(`error`,o),n.once(`error`,o);let s=!1,c=async()=>{await new Promise(e=>{let r=t,i=()=>{try{r?.removeListener?.(`drain`,a)}catch{}try{n.removeListener(`__autodrain`,o)}catch{}try{n.removeListener(`close`,s)}catch{}},a=()=>{i(),e()},o=()=>{i(),e()},s=()=>{i(),e()};typeof r?.once==`function`&&r.once(`drain`,a),n.once(`__autodrain`,o),n.once(`close`,s)})},l=async()=>{if(!s){s=!0;try{let e=t;typeof e.unpipe==`function`&&e.unpipe(n)}catch{}try{!n.writableEnded&&!n.destroyed&&n.end()}catch{}try{let e=t;typeof e.destroy==`function`&&e.destroy()}catch{}}};try{for(t.pipe(n);i>0;){if(a)throw a;!s&&(n.__autodraining||n.destroyed)&&await l();let r=Math.min(262144,i),o=await e.pull(r);if(o.length!==r)throw Error(`FILE_ENDED`);i-=o.length,s||t.write(o)||await c()}s||t.end(),await xt(n,{readable:!1})}finally{t.removeListener(`error`,o),n.removeListener(`error`,o)}}async function _u(e,t,n,r,i,a,o){let{vars:s,fileNameBuffer:c,extraFieldData:l}=await ru(async e=>t.pull(e)),u=s;i.crxHeader&&(u.crxHeader=i.crxHeader);let d=Gl(c),f=new _t({highWaterMark:Rl}),p=!1;f.autodrain=function(){return p=!0,f.__autodraining=!0,f.emit(`__autodrain`),eu(f)},f.buffer=function(){return tu(f)},f.path=d,f.props=Yl(d,c,u.flags),f.type=Jl(d,u.uncompressedSize??0),e.verbose&&(f.type===`Directory`?console.log(` creating:`,d):f.type===`File`&&(u.compressionMethod===0?console.log(` extracting:`,d):console.log(` inflating:`,d)));let m={uncompressedSize:u.uncompressedSize??0,compressedSize:u.compressedSize??0},h=Zl(l,m);u.lastModifiedDateTime=Xl({flags:u.flags,uncompressedSize:m.uncompressedSize,lastModifiedDate:u.lastModifiedDate,lastModifiedTime:u.lastModifiedTime},h),f.vars=u,f.extraFields=h,f.__autodraining=p;let g=$l(u.flags,u.compressedSize);g&&(f.size=u.uncompressedSize??0),e.forceStream?n.pushEntry(f):(n.emitEntry(f),n.pushEntryIfPiped(f)),e.verbose&&console.log({filename:d,vars:u,extraFields:f.extraFields});let _=!Ql(u.flags),v=u.compressedSize??0,y=u.uncompressedSize??0;if(_&&g&&o&&u.compressionMethod!==0&&!p&&v<=a&&y<=a){let e=o(await t.pull(v));f.end(e),await xt(f,{readable:!1});return}let b=u.compressionMethod&&!p?r():new _t({highWaterMark:Rl});if(g){await gu(t,b,f,u.compressedSize??0);return}await bt(t.streamUntilDataDescriptor(),b,f),f.size=(await iu(async e=>t.pull(e))).uncompressedSize??0}let vu=256*1024;var yu=class extends gt{constructor(){super({writableHighWaterMark:512*1024,readableHighWaterMark:512*1024,write:(e,t,n)=>{this._doWrite(e,n)},final:e=>{this._closeWriter(()=>{e()})}}),this.reading=!1,this.writeClosed=!1,this._junkError=!1,this._bytesIn=0,this._bytesOut=0,this._readingDone=!1,this._pendingWrites=0,this._writeFinishedPromise=null,this._resolveWriteFinished=null,this.decompressionStream=new DecompressionStream(`deflate-raw`),this.writer=this.decompressionStream.writable.getWriter(),this.reader=this.decompressionStream.readable.getReader(),this._readingDonePromise=new Promise(e=>{this._resolveReadingDone=e}),this._startReading()}_doWrite(e,t){if(this._junkError){t&&t();return}this._bytesIn+=e.length,this._pendingWrites++,this.writer.write(e).then(()=>{this._pendingWrites--,this._pendingWrites===0&&this._resolveWriteFinished&&this._resolveWriteFinished(),t&&t()}).catch(e=>{this._pendingWrites--,this._pendingWrites===0&&this._resolveWriteFinished&&this._resolveWriteFinished();let n=e instanceof Error?e.message:String(e);n.includes(`Junk`)||n.includes(`junk`)?(this._junkError=!0,t&&t()):t?t(e):this.emit(`error`,e)})}async _startReading(){if(!this.reading){this.reading=!0;try{for(;;){let{done:e,value:t}=await this.reader.read();if(e)break;this._bytesOut+=t.length,this.push(t)}}catch(e){let t=e instanceof Error?e.message:String(e);t.includes(`Junk`)||t.includes(`junk`)?this._junkError=!0:this.emit(`error`,e)}finally{this._readingDone=!0,this._resolveReadingDone(),this.push(null)}}}_closeWriter(e){if(this.writeClosed){this._readingDonePromise.then(()=>{e&&e()});return}this.writeClosed=!0,(this._pendingWrites>0?new Promise(e=>{this._writeFinishedPromise=new Promise(e=>{this._resolveWriteFinished=e}),this._writeFinishedPromise.then(e)}):Promise.resolve()).then(()=>this.writer.close()).catch(()=>{}).finally(()=>{this._readingDonePromise.then(()=>{e&&e()})})}destroy(e){return this.writeClosed||this.writer.abort(e??void 0).catch(()=>{}),this.reader.cancel(e??void 0).catch(()=>{}),super.destroy(e??void 0)}};let bu=null;function xu(e){if(typeof e==`string`&&e.length>0)return e;if(bu)return bu;let t=new Blob([`
51
52
  let ds;
52
53
  let writer;
53
54
  let reader;
@@ -119,6 +120,6 @@ onmessage = async (ev) => {
119
120
  postMessage({ t: 'error', message: m, id: msg && msg.id });
120
121
  }
121
122
  };
122
- `],{type:`text/javascript`});return vu=URL.createObjectURL(t),vu}var bu=class extends ft{constructor(e){super({write:(e,t,n)=>{this._doWrite(e,n)},final:e=>{this._doClose(e)}}),this._nextId=1,this._pendingAcks=new Map,this._closed=!1,this._junkError=!1,this._terminated=!1;let t=yu(e);this.worker=new Worker(t),this.worker.onmessage=e=>{let t=e.data;if(!(!t||typeof t.t!=`string`)){if(t.t===`data`){let e=t.chunk;this.push(e);return}if(t.t===`end`){this.push(null),this._terminateWorker();return}if(t.t===`aborted`){this._terminateWorker();return}if(t.t===`ack`){let e=t.id,n=this._pendingAcks.get(e);n&&(this._pendingAcks.delete(e),n());return}if(t.t===`error`){let e=typeof t.message==`string`?t.message:`Worker inflate error`;if(e.includes(`Junk`)||e.includes(`junk`)){this._junkError=!0,this.push(null),this._terminateWorker();for(let e of this._pendingAcks.values())e();this._pendingAcks.clear();return}let n=Error(e);for(let e of this._pendingAcks.values())e(n);this._pendingAcks.clear(),this.emit(`error`,n),this._terminateWorker();return}}},this.worker.onerror=e=>{let t=Error(e.message??`Worker error`);for(let e of this._pendingAcks.values())e(t);this._pendingAcks.clear(),this.emit(`error`,t),this._terminateWorker()}}_terminateWorker(){if(!this._terminated){this._terminated=!0;try{this.worker.terminate()}catch{}}}_doWrite(e,t){if(this._closed||this._junkError){t();return}let n=this._nextId++;this._pendingAcks.set(n,t);let r=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e:e.slice();this.worker.postMessage({t:`write`,id:n,chunk:r},[r.buffer])}_doClose(e){if(this._closed){e();return}this._closed=!0,this.worker.postMessage({t:`close`}),e()}destroy(e){if(!this._closed){this._closed=!0;try{this.worker.postMessage({t:`abort`})}catch{}}return this._terminateWorker(),super.destroy(e)}},xu=class extends ft{constructor(){super({write:(e,t,n)=>{if(this._finished){n(Error(`write after end`));return}this.chunks.push(e),n()},final:e=>{this._decompress(e)}}),this.chunks=[],this._finished=!1}_decompress(e){try{let t=as(et(this.chunks));this.push(t),this.push(null),this._finished=!0,e()}catch(t){e(t instanceof Error?t:Error(String(t)))}}destroy(e){return this._finished=!0,this.chunks=[],super.destroy(e)}};function Su(){return xs()?new _u:new xu}let Cu=Fl;function wu(e){return class extends ft{constructor(t={}){super({objectMode:!0,write:(e,t,n)=>{this._handleWrite(e,n)},final:e=>{this.finished=!0,this._maybeReleaseWriteCallback(),this._wakeUp(),this.emit(`data-available`),this.emit(`chunk`,!1),this._parsingDone.then(()=>e()).catch(e)}}),this._buffer=new ms,this.finished=!1,this._driverState={},this._parsingDone=Promise.resolve(),this._opts=t;let n=Math.max(64*1024,t.inputHighWaterMarkBytes??2*1024*1024),r=Math.max(32*1024,t.inputLowWaterMarkBytes??Math.floor(n/4));this._inputHighWaterMarkBytes=n,this._inputLowWaterMarkBytes=Math.min(r,n);let i={pull:e=>this.pull(e),pullUntil:(e,t)=>this.pullUntil(e,t),stream:e=>this.stream(e),streamUntilDataDescriptor:()=>this._streamUntilDataDescriptor(),setDone:()=>{this.push(null)}},a={emitEntry:e=>{this.emit(`entry`,e)},pushEntry:e=>{this.push(e)},pushEntryIfPiped:e=>{},emitCrxHeader:e=>{this.crxHeader=e,this.emit(`crx-header`,e)},emitError:e=>{if(this.__emittedError=e,this._writeCb){let t=this._writeCb;this._writeCb=void 0,t(e)}this.emit(`error`,e)},emitClose:()=>{this.emit(`close`)}};queueMicrotask(()=>{this._parsingDone=pu(this._opts,i,a,()=>{if(this._opts.useWorkerInflate&&typeof Worker<`u`&&xs())try{return new bu(this._opts.workerInflateUrl)}catch{return e()}return e()},this._driverState),this._parsingDone.catch(e=>{(!this.__emittedError||this.__emittedError!==e)&&(this.__emittedError=e,this.emit(`error`,e)),this.emit(`close`)})})}_handleWrite(e,t){this._buffer.append(e),this._buffer.length>=this._inputHighWaterMarkBytes?this._writeCb=t:t(),this._wakeUp(),this.emit(`data-available`),this.emit(`chunk`)}get buffer(){return this._buffer.view()}set buffer(e){this._buffer.reset(e)}_wakeUp(){if(this._pendingResolve){let e=this._pendingResolve;this._pendingResolve=void 0,e()}}_maybeReleaseWriteCallback(){if(!this._writeCb||this._buffer.length>this._inputLowWaterMarkBytes)return;let e=this._writeCb;this._writeCb=void 0,e()}_waitForData(){return new Promise(e=>{this._pendingResolve=e})}async _pullInternal(e){if(e===0)return new Uint8Array;for(;this._buffer.length<e;){if(this.finished){if(this._buffer.length>0){let e=this._buffer.read(this._buffer.length);return this._maybeReleaseWriteCallback(),e}throw Error(`FILE_ENDED`)}await this._waitForData()}let t=this._buffer.read(e);return this._maybeReleaseWriteCallback(),t}async _pullUntilInternal(e,t=!1){let n=[],r=new Pl(e);for(;;){let i=this._buffer.length,a=r.find(this._buffer);if(a!==-1){this.match=a;let r=a+(t?e.length:0);return r>0&&(n.push(this._buffer.read(r)),this._maybeReleaseWriteCallback()),n.length===1?n[0]:et(n)}if(r.onNoMatch(i),this.finished)throw Error(`FILE_ENDED`);let o=Math.max(0,this._buffer.length-e.length);o>0&&(n.push(this._buffer.read(o)),r.onConsume(o),this._maybeReleaseWriteCallback()),await this._waitForData()}}_streamFixedLength(e){let t=new pt({highWaterMark:gu}),n=e,r=!1,i=!1,a=()=>{if(!r&&!i){for(;n>0&&this._buffer.length>0;){let e=Math.min(n,this._buffer.length),r=this._buffer.read(e);n-=e;let o=t.write(r);if(this._maybeReleaseWriteCallback(),!o){i=!0,t.once(`drain`,()=>{i=!1,a()});return}}n===0?(r=!0,this.removeListener(`data-available`,a),t.end()):this.finished&&(r=!0,this.removeListener(`data-available`,a),t.destroy(Error(`FILE_ENDED`)))}};return this.on(`data-available`,a),queueMicrotask(()=>a()),t}_streamUntilPattern(e,t=!1){let n=new pt({highWaterMark:gu}),r=!1,i=e.length,a=new Pl(e),o=!1,s=()=>{if(!(r||o))for(;!(this._buffer.length<=0);){let e=this._buffer.length,c=a.find(this._buffer);if(c!==-1){this.match=c;let e=t?c+i:c;if(e>0){let t=n.write(this._buffer.read(e));if(a.onConsume(e),this._maybeReleaseWriteCallback(),!t){o=!0,n.once(`drain`,()=>{o=!1,s()});return}}r=!0,this.removeListener(`data-available`,s),n.end();return}if(a.onNoMatch(e),this.finished){r=!0,this.removeListener(`data-available`,s),n.destroy(Error(`FILE_ENDED`));return}let l=e-i;if(l<=0){this._buffer.length<=i&&this._maybeReleaseWriteCallback();break}let u=n.write(this._buffer.read(l));if(a.onConsume(l),this._maybeReleaseWriteCallback(),!u){o=!0,n.once(`drain`,()=>{o=!1,s()});return}}};return this.on(`data-available`,s),queueMicrotask(()=>s()),n}stream(e,t){return typeof e==`number`?this._streamFixedLength(e):this._streamUntilPattern(e,t??!1)}pull(e,t){return e===0?Promise.resolve(new Uint8Array):typeof e==`number`?this.finished&&this._buffer.length<e?Promise.reject(Error(`FILE_ENDED`)):this._buffer.length>=e?Promise.resolve(this._buffer.read(e)):this._pullInternal(e):this.finished?Promise.reject(Error(`FILE_ENDED`)):this._pullUntilInternal(e,t??!1)}pullUntil(e,t){return this.pull(e,t)}_streamUntilDataDescriptor(){return du({source:{getLength:()=>this._buffer.length,read:e=>this._buffer.read(e),peekChunks:e=>this._buffer.peekChunks(e),discard:e=>this._buffer.discard(e),indexOfPattern:(e,t)=>this._buffer.indexOfPattern(e,t),peekUint32LE:e=>this._buffer.peekUint32LE(e),isFinished:()=>this.finished,onDataAvailable:e=>(this.on(`data-available`,e),()=>this.removeListener(`data-available`,e)),maybeReleaseWriteCallback:()=>this._maybeReleaseWriteCallback()},dataDescriptorSignature:Cu})}promise(){return new Promise((e,t)=>{this.on(`finish`,e),this.on(`end`,e),this.on(`error`,t)})}}}let Tu=wu(Su);var Eu=class extends Tu{};function Du(e){return new Eu(e)}async function*Ou(e){let t=[],n=null,r=e=>{t.push(e),n&&=(n(),null)};e.on(`data`,r);let i=!1,a=()=>{i=!0,n&&=(n(),null)};e.on(`end`,a);let o=!1,s=e=>{o=e,n&&=(n(),null)};e.on(`error`,s);try{for(;!i||t.length>0;)if(t.length===0?(e.resume(),await new Promise(e=>{n=e})):(e.pause(),yield t.shift()),o)throw o}finally{e.removeListener(`data`,r),e.removeListener(`end`,a),e.removeListener(`error`,s)}}var ku=class extends M{constructor({workbook:e,id:t,iterator:n,options:i}){super(),this.workbook=e,this.id=t,this.sheetNo=typeof t==`number`?t:parseInt(String(t),10),this.iterator=n,this.options=i||{},this.name=`Sheet${this.id}`,this._columns=null,this._keys=Object.create(null),this._dimensions=new r}destroy(){throw Error(`Invalid Operation: destroy`)}get dimensions(){return this._dimensions}get columns(){return this._columns}getColumn(e){if(typeof e==`string`){let t=this._keys[e];if(t)return t;e=n.l2n(e)}if(this._columns||=[],e>this._columns.length){let t=this._columns.length+1;for(;t<=e;)this._columns.push(new fe(this,t++))}return this._columns[e-1]}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){let t=this._keys;for(let n in t)e(t[n],n)}async read(){try{for await(let e of this.parse())for(let t=0;t<e.length;t++){let n=e[t];this.emit(n.eventType,n.value)}this.emit(`finished`)}catch(e){this.emit(`error`,e)}}async*[Symbol.asyncIterator](){for await(let e of this.parse())for(let t=0;t<e.length;t++){let n=e[t];n.eventType===`row`&&(yield n.value)}}async*parse(){let{iterator:e,options:t}=this,r=!1,i=!1,a=null;switch(t.worksheets){case`emit`:r=!0;break;case`prep`:break;default:break}switch(t.hyperlinks){case`emit`:i=!0;break;case`cache`:this.hyperlinks=a=Object.create(null);break;default:break}if(!r&&!i&&!a)return;let o=i||a!==null,{sharedStrings:s,styles:c,properties:l}=this.workbook,u=!1,d=!1,f=!1,p=null,m=null,h=null,g=null;for await(let t of Qt(e)){let e=null;for(let _=0;_<t.length;_++){let v=t[_],y=v.eventType,b=v.value;if(y===`opentag`){let t=b;if(r)switch(t.name){case`cols`:u=!0,p=[];break;case`sheetData`:d=!0;break;case`col`:u&&p.push({min:parseInt(t.attributes.min,10),max:parseInt(t.attributes.max,10),width:parseFloat(t.attributes.width),styleId:parseInt(t.attributes.style??`0`,10)});break;case`row`:if(d){let e=parseInt(t.attributes.r,10);if(m=new de(this,e),t.attributes.ht&&(m.height=parseFloat(t.attributes.ht)),t.attributes.customHeight===`1`&&(m.customHeight=!0),t.attributes.s!==void 0){let e=parseInt(t.attributes.s,10),n=c.getStyleModel(e);n&&(m.style=n)}}break;case`c`:if(m){let e=t.attributes.s;h={ref:t.attributes.r,s:e===void 0?void 0:parseInt(e,10),t:t.attributes.t}}break;case`f`:h&&(g=h.f={text:``});break;case`v`:h&&(g=h.v={text:``});break;case`is`:case`t`:h&&(g=h.v={text:``});break;case`mergeCell`:break;default:break}if(o)switch(t.name){case`hyperlinks`:f=!0;break;case`hyperlink`:if(f){let n={ref:t.attributes.ref,rId:t.attributes[`r:id`]};i?(e||=[]).push({eventType:`hyperlink`,value:n}):a[n.ref]=n}break;default:break}}else if(y===`text`)r&&g&&(g.text+=b);else if(y===`closetag`){let t=b;if(r)switch(t.name){case`cols`:u=!1,this._columns=fe.fromModel(p);break;case`sheetData`:d=!1;break;case`row`:m&&(this._dimensions.expandRow(m),(e||=[]).push({eventType:`row`,value:m})),m=null;break;case`c`:if(m&&h){let e=n.decodeAddress(h.ref),t=m.getCell(e.col);if(h.s!==void 0){let e=c.getStyleModel(h.s);e&&(t.style=e)}if(h.f){let e={formula:h.f.text};h.v&&(h.t===`str`?e.result=Ne(h.v.text):e.result=parseFloat(h.v.text)),t.value=e}else if(h.v)switch(h.t){case`s`:{let e=parseInt(h.v.text,10);s?t.value=s[e]:t.value={sharedString:e};break}case`inlineStr`:case`str`:t.value=Ne(h.v.text);break;case`e`:t.value={error:h.v.text};break;case`b`:t.value=parseInt(h.v.text,10)!==0;break;default:{let e=typeof t.numFmt==`string`?t.numFmt:t.numFmt?.formatCode;e&&ze(e)?t.value=Ae(parseFloat(h.v.text),l?.model?.date1904):t.value=parseFloat(h.v.text);break}}if(a){let e=a[h.ref];e&&(t.text=t.value,t.value=void 0,t.hyperlink=e)}h=null,g=null}break;default:break}if(o)switch(t.name){case`hyperlinks`:f=!1;break;default:break}}}e&&e.length>0&&(yield e)}}},Au=class extends M{constructor({workbook:e,id:t,iterator:n,options:r}){super(),this._hyperlinkCount=0,this.workbook=e,this.id=t,this.iterator=n,this.options=r}get count(){return this.hyperlinks?this._hyperlinkCount:0}each(e){let t=this.hyperlinks;if(t)for(let n in t)e(t[n],n)}async read(){let{iterator:e}=this,t=this.options.hyperlinks,n=t===`emit`,r=t===`cache`,i=null;if(r&&(this._hyperlinkCount=0,this.hyperlinks=i=Object.create(null)),!n&&!r){this.emit(`finished`);return}try{for await(let t of Qt(e))for(let{eventType:e,value:r}of t){if(e!==`opentag`)continue;let t=r;if(t.name!==`Relationship`)continue;let a=t.attributes;if(a.Type!==G.Hyperlink)continue;let o={type:u.RelationshipType.Hyperlink,rId:a.Id,target:a.Target,targetMode:a.TargetMode};if(n){this.emit(`hyperlink`,o);continue}let s=o.rId;i&&i[s]===void 0&&(this._hyperlinkCount+=1),i[s]=o}this.emit(`finished`)}catch(e){this.emit(`error`,e)}}},ju=class extends M{getHyperlinkReader(e){return this._hyperlinkReadersBySheetNo?.[String(e)]}getHyperlink(e,t){return this.getHyperlinkReader(e)?.hyperlinks?.[t]}getHyperlinkTarget(e,t){return this.getHyperlink(e,t)?.target}constructor(e,t,n,r){super(),this.input=e,this.WorksheetReaderClass=n,this.HyperlinkReaderClass=r,this.options={worksheets:`emit`,sharedStrings:`cache`,hyperlinks:`ignore`,styles:`ignore`,entries:`ignore`,...t},this.styles=new Dn,this.styles.init()}_getStream(e){if(e instanceof N)return e;if(e&&typeof e==`object`&&typeof e.getReader==`function`){let t=N.fromWeb;if(typeof t==`function`)return t(e);try{return new N({stream:e})}catch{throw Error(`Could not recognise input: ReadableStream`)}}let t=e;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array)return N.from([t]);throw Error(`Could not recognise input: ${e}`)}_cleanupWaitingWorksheets(e){for(let t of e)t&&typeof t.cleanup==`function`&&t.cleanup()}_createWorksheetReader(e){return new this.WorksheetReaderClass({workbook:this,id:e.id,iterator:e.iterator,options:e.options})}_createHyperlinkReader(e){return new this.HyperlinkReaderClass({workbook:this,id:e.id,iterator:e.iterator,options:e.options})}async read(e,t){try{for await(let{eventType:n,value:r}of this.parse(e,t))switch(n){case`shared-strings`:this.emit(n,r);break;case`worksheet`:this.emit(n,r),await r.read();break;case`hyperlinks`:this.emit(n,r);break}this.emit(`end`),this.emit(`finished`)}catch(e){this.emit(`error`,e)}}async*[Symbol.asyncIterator](){for await(let{eventType:e,value:t}of this.parse())e===`worksheet`&&(yield t)}async*parse(e,t){t&&(this.options=t);let n=this.stream=this._getStream(e||this.input),r=[];try{for await(let e of this._parseEntries(n))if(e.eventType===`waiting-worksheet`){let t=await this._storeWaitingWorksheet(e.sheetNo,e.entry);r.push(t)}else yield e;yield*this._processWaitingWorksheets(r)}catch(e){throw this._cleanupWaitingWorksheets(r),e}}_emitEntry(e){this.options.entries===`emit`&&this.emit(`entry`,e)}async _parseRels(e){this.workbookRels=await new H().parseStream(Ou(e)),this._workbookRelIdByTarget=Object.create(null);for(let e of this.workbookRels??[])e?.Target&&e?.Id&&(this._workbookRelIdByTarget[e.Target]=e.Id)}async _parseWorkbook(e){this._emitEntry({type:`workbook`});let t=new si;this.model=await t.parseStream(Ou(e)),this.properties=t.map?.workbookPr,this._sheetByRelId=Object.create(null);for(let e of this.model?.sheets??[])this._sheetByRelId[e.rId]=e}async*_parseSharedStrings(e){switch(this._emitEntry({type:`shared-strings`}),this.options.sharedStrings){case`cache`:this.sharedStrings=[];break;case`emit`:break;default:return}let t=null,n=[],r=0,i=null,a=!1;for await(let o of Qt(Ou(e)))for(let{eventType:e,value:s}of o)if(e===`opentag`){let e=s;switch(e.name){case`b`:i||={},i.bold=!0;break;case`charset`:i||={},i.charset=parseInt(e.attributes.charset,10);break;case`color`:i||={},i.color={},e.attributes.rgb&&(i.color.argb=e.attributes.rgb),e.attributes.val&&(i.color.argb=e.attributes.val),e.attributes.theme&&(i.color.theme=e.attributes.theme);break;case`family`:i||={},i.family=parseInt(e.attributes.val,10);break;case`i`:i||={},i.italic=!0;break;case`outline`:i||={},i.outline=!0;break;case`rFont`:i||={},i.name=e.attributes.val;break;case`r`:a=!0;break;case`si`:i=null,n=[],t=null,a=!1;break;case`sz`:i||={},i.size=parseInt(e.attributes.val,10);break;case`strike`:i||={},i.strike=!0;break;case`t`:t=null;break;case`u`:i||={},i.underline=!0;break;case`vertAlign`:i||={},i.vertAlign=e.attributes.val;break}}else if(e===`text`)t=t?t+s:s;else if(e===`closetag`)switch(s.name){case`r`:a&&(n.push({font:i,text:t}),i=null,t=null);break;case`si`:this.options.sharedStrings===`cache`?this.sharedStrings.push(n.length?{richText:n}:t??``):this.options.sharedStrings===`emit`&&(yield{index:r++,text:n.length?{richText:n}:t??``}),n=[],i=null,t=null,a=!1;break}}async _parseStyles(e){this._emitEntry({type:`styles`}),this.options.styles===`cache`&&(this.styles=new Dn,await this.styles.parseStream(Ou(e)))}*_parseWorksheet(e,t){this._emitEntry({type:`worksheet`,id:t});let n=parseInt(t,10),r=this._createWorksheetReader({id:n,iterator:e,options:this.options});r.sheetNo=n;let i=this._workbookRelIdByTarget?.[vr(t)],a=i?this._sheetByRelId?.[i]:void 0;a&&(r.id=a.id,r.name=a.name,r.state=a.state),this.options.worksheets===`emit`&&(yield{eventType:`worksheet`,value:r})}async*_parseHyperlinks(e,t){this._emitEntry({type:`hyperlinks`,id:t});let n=this._createHyperlinkReader({id:parseInt(t,10),iterator:e,options:this.options});if(this.options.hyperlinks===`cache`){this._hyperlinkReadersBySheetNo||=Object.create(null),this._hyperlinkReadersBySheetNo[t]=n;let e=n.read;typeof e==`function`&&await e.call(n);return}this.options.hyperlinks===`emit`&&(yield{eventType:`hyperlinks`,value:n})}async*_parseEntries(e){let t=Du({forceStream:!0});e.on(`error`,e=>t.emit(`error`,e)),e.pipe(t);for await(let e of Ou(t)){let t,n=Xn(e.path);switch(n){case U.rootRels:break;case U.xlWorkbookRels:await this._parseRels(e);break;case U.xlWorkbook:await this._parseWorkbook(e);break;case U.xlSharedStrings:for await(let t of this._parseSharedStrings(e))yield{eventType:`shared-strings`,value:t};break;case U.xlStyles:await this._parseStyles(e);break;default:if(t=Zn(n)?.toString(),t)if(this.workbookRels&&(this.options.sharedStrings!==`cache`||this.sharedStrings)){yield*this._parseWorksheet(Ou(e),t);continue}else{yield{eventType:`waiting-worksheet`,sheetNo:t,entry:e};continue}if(t=Qn(n)?.toString(),t){yield*this._parseHyperlinks(Ou(e),t);continue}break}e.autodrain()}}},Mu=class extends ju{constructor(e,t={}){super(e,t,ku,Au)}async _storeWaitingWorksheet(e,t){let n=[],r=new TextEncoder;for await(let e of Ou(t))e instanceof Uint8Array?n.push(e):typeof e==`string`&&n.push(r.encode(e));return{sheetNo:e,data:n}}async*_processWaitingWorksheets(e){for(let t of e){let e=(async function*(){for(let e of t.data)yield e})();yield*this._parseWorksheet(e,t.sheetNo)}}},Nu=class{static{this.Writer=jl}static{this.Reader=Mu}constructor(){this.category=``,this.company=``,this.created=new Date,this.description=``,this.keywords=``,this.manager=``,this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject=``,this.title=``,this.views=[],this.media=[],this.pivotTables=[],this._passthrough={},this._rawDrawings={},this._definedNames=new Rt}get xlsx(){return this._xlsx||=new Bc(this),this._xlsx}get csv(){return this._csv||=new Sl(this),this._csv}static createStreamWriter(e){return new jl(e)}static createStreamReader(e,t){return new Mu(e,t)}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,t){let n=this.nextId,r=this._worksheets.reduce((e,t)=>(t&&t.orderNo)>e?t.orderNo:e,0),i=new Nt({...t,id:n,name:e,orderNo:r+1,workbook:this});return this._worksheets[n]=i,i}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){let t=this.getWorksheet(e);t&&t.destroy()}getWorksheet(e){if(e===void 0)return this._worksheets.find(Boolean);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t&&t.name===e)}get worksheets(){return this._worksheets.slice(1).sort((e,t)=>e.orderNo-t.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(t=>{e(t,t.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){let t=this.media.length;return this.media.push({...e,type:`image`}),t}getImage(e){return this.media[Number(e)]}get model(){return{creator:this.creator??`Unknown`,lastModifiedBy:this.lastModifiedBy??`Unknown`,lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,pivotTables:this.pivotTables,calcProperties:this.calcProperties,passthrough:this._passthrough,rawDrawings:this._rawDrawings,defaultFont:this._defaultFont}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(t=>{let{id:n,name:r,state:i}=t,a=e.sheets&&e.sheets.findIndex(e=>e.id===n),o=this._worksheets[n]=new Nt({id:n,name:r,orderNo:a===-1?void 0:a,state:i,workbook:this});o.model=t}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media??[],this.pivotTables=e.pivotTables??[],this._passthrough=e.passthrough||{},this._rawDrawings=e.rawDrawings||{},this._defaultFont=e.defaultFont}};let Pu=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function Fu(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function Iu(e){if(e.length<=3)return e;let t=e.length%3,n=e.substring(0,t);for(let r=t;r<e.length;r+=3)n+=(n.length>0?`,`:``)+e.substring(r,r+3);return n}function Lu(e,t){let n=10**t;return Math.round(e*n)/n}function Ru(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function zu(e){return/^General$/i.test(e.trim())}function Bu(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let Vu=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Hu=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Uu=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],Wu=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Gu=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Ku(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=Ae(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=Ru(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,Uu[c]).replace(/\x00MN4\x00/g,Hu[c]).replace(/\x00MN3\x00/g,Vu[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,Gu[u]).replace(/\x00DN3\x00/g,Wu[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function qu(e){return typeof e==`boolean`?e?`TRUE`:`FALSE`:typeof e==`string`?e:Number.isInteger(e)?e.toString():e.toPrecision(11).replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)}function Ju(e,t){let n=(t.match(/%/g)??[]).length;return $u(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function Yu(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(r===0){let e=t.match(/\.([0#]+)E/i),n=e?e[1].length:2;return`0.`+`0`.repeat(n)+`E+00`}let i=t.match(/\.([0#]+)E/i),a=i?i[1].length:2,o=t.includes(`E+`),s=Math.floor(Math.log10(r)),c=Lu(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=Fu(Math.abs(s),2);return n+c+`E`+l+u}function Xu(e,t){let n=e<0?-1:1,r=Math.abs(e),i=Math.floor(r);if(r-=i,r<1e-10)return[n*i,0,1];let a=0,o=1,s=1,c=0,l=Math.floor(r),u=l,d=1;for(;c<t&&(l=Math.floor(r),u=l*o+a,d=l*c+s,!(r-l<1e-10));)r=1/(r-l),a=o,o=u,s=c,c=d;return d>t&&(d=c,u=o),[n*i,n*u,d]}function Zu(e,t){let n=e<0?`-`:``,r=Math.abs(e),i=t.match(/\?+\s*\/\s*(\d+)/);if(i){let e=parseInt(i[1],10),a=Math.floor(r),o=r-a,s=Math.round(o*e);return t.includes(`#`)||t.includes(`0`)?s===0?n+a.toString():n+(a>0?a+` `:``)+s+`/`+e:n+(a*e+s)+`/`+e}let a=t.match(/\/\s*(\?+)/),[o,s,c]=Xu(r,10**(a?a[1].length:2)-1);return t.includes(`#`)&&o!==0?s===0?n+Math.abs(o).toString():n+Math.abs(o)+` `+Math.abs(s)+`/`+c:s===0?o===0?`0`:n+Math.abs(o).toString():n+(Math.abs(o)*c+Math.abs(s))+`/`+c}function Qu(e,t){let n=Math.round(e*86400),r=Math.floor(n/60),i=Math.floor(r/60),a=n%60,o=r%60,s=i,c=t;return/\[h+\]/i.test(c)&&(c=c.replace(/\[h+\]/gi,s.toString())),/\[m+\]/i.test(c)&&(c=c.replace(/\[m+\]/gi,r.toString())),/\[s+\]/i.test(c)&&(c=c.replace(/\[s+\]/gi,n.toString())),c=c.replace(/mm/gi,o.toString().padStart(2,`0`)),c=c.replace(/ss/gi,a.toString().padStart(2,`0`)),c}function $u(e,t){let n=Math.abs(e),r=e<0?`-`:``,i=0,a=t;for(;a.endsWith(`,`);)i++,a=a.slice(0,-1);let o=n/1e3**i,s=a.indexOf(`.`),c=a,l=``;s!==-1&&(c=a.substring(0,s),l=a.substring(s+1));let u=l.replace(/[^0#?]/g,``).length,[d,f=``]=Lu(o,u).toString().split(`.`),p=/[0#?][^0#?,.\s][0#?]/.test(c),m;if(p){let e=c.replace(/[^0#?]/g,``).length,t=d;t.length<e&&(t=`0`.repeat(e-t.length)+t),m=``;let n=t.length-e;for(let e=0;e<c.length;e++){let r=c[e];r===`0`||r===`#`||r===`?`?n<t.length&&(m+=t[n],n++):r!==`,`&&(m+=r)}}else{m=d,c.includes(`,`)&&(m=Iu(d));let e=(c.match(/0/g)??[]).length;m.length<e&&(m=`0`.repeat(e-m.length)+m)}let h=``;return u>0&&(h=`.`+(f+`0`.repeat(u)).substring(0,u)),r+m+h}function ed(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)t+=e[n],n++;n++}else e[n]===`\\`&&n+1<e.length?(n++,t+=e[n],n++):(t+=e[n],n++);return t}function td(e,t){let n=t.match(/\[(=|>|<|>=|<=|<>)(-?\d+(?:\.\d*)?)\]/);if(!n)return!1;let r=n[1],i=parseFloat(n[2]);switch(r){case`=`:return e===i;case`>`:return e>i;case`<`:return e<i;case`>=`:return e>=i;case`<=`:return e<=i;case`<>`:return e!==i;default:return!1}}function nd(e,t){if(typeof t==`string`){let n=Ie(e);return n.length>=4&&n[3]?ed(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=Ie(e),r=/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/;if((n[0]&&r.test(n[0])||n[1]&&r.test(n[1]))&&n.length>=2){for(let e=0;e<Math.min(n.length,2);e++){let r=n[e].match(/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/);if(r&&td(t,r[0]))return n[e]}return n[n.length>2?2:1]}return n.length===1?n[0]:n.length===2?t>=0?n[0]:n[1]:t>0?n[0]:t<0?n[1]:n[2]||n[0]}function rd(e,t){let n=Ie(e);return n.length>=2&&n[1]===t}function id(e,t){if(t==null)return``;if(zu(e))return qu(t);if(typeof t==`string`)return nd(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=nd(e,n);n<0&&rd(e,r)&&(n=Math.abs(n));let i=r.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);if(i=i.replace(/\[(>|<|>=|<=|=|<>)-?\d+(\.\d+)?\]/g,``),i=i.replace(/\[\$[^\]]*\]/g,``),i=Ru(i),i=ed(i),/\[[hms]+\]/i.test(i))return Qu(n,i);if(Bu(i))return Ku(n,i);if(i.includes(`%`))return Ju(n,i);if(/E[+-]?/i.test(i))return Yu(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return Zu(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+$u(-n,e)+`)`}if(i===`@`)return n.toString();let a=``,o=``,s=i.match(/^([^#0?.,]+)/);s&&(a=s[1],i=i.substring(s[0].length));let c=i.match(/([^#0?.,]+)$/);c&&!c[1].includes(`%`)&&(o=c[1],i=i.substring(0,i.length-c[0].length));let l=$u(n,i);return a+l+o}function ad(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function od(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function sd(e,t,n){if(e instanceof Date){let r=ke(e);return ad(t)?(r%=1,r<0&&(r+=1),id(t,r)):id(n&&od(t)?n:t,r)}return id(t,e)}function cd(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return sd(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return sd(e,i,t)}return e.text}function ld(e){return n.l2n(e.toUpperCase())-1}function ud(e){return n.n2l(e+1)}function dd(e){return parseInt(e,10)-1}function fd(e){return String(e+1)}function pd(e){let t=n.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function md(e){return n.encodeAddress(e.r+1,e.c+1)}function hd(e){let t=e.indexOf(`:`);if(t===-1){let t=pd(e);return{s:t,e:{...t}}}return{s:pd(e.slice(0,t)),e:pd(e.slice(t+1))}}function gd(e,t){if(t===void 0){let t=e;return gd(t.s,t.e)}let n=md(e),r=md(t);return n===r?n:`${n}:${r}`}function _d(e,t){let n=t||{},r=new Nu().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function vd(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=pd(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function yd(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=hd(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?cd(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?cd(a,n.dateFormat).trim():a.value,s=ud(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?cd(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?cd(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function bd(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
123
+ `],{type:`text/javascript`});return bu=URL.createObjectURL(t),bu}var Su=class extends gt{constructor(e){super({write:(e,t,n)=>{this._doWrite(e,n)},final:e=>{this._doClose(e)}}),this._nextId=1,this._pendingAcks=new Map,this._closed=!1,this._junkError=!1,this._terminated=!1;let t=xu(e);this.worker=new Worker(t),this.worker.onmessage=e=>{let t=e.data;if(!(!t||typeof t.t!=`string`)){if(t.t===`data`){let e=t.chunk;this.push(e);return}if(t.t===`end`){this.push(null),this._terminateWorker();return}if(t.t===`aborted`){this._terminateWorker();return}if(t.t===`ack`){let e=t.id,n=this._pendingAcks.get(e);n&&(this._pendingAcks.delete(e),n());return}if(t.t===`error`){let e=typeof t.message==`string`?t.message:`Worker inflate error`;if(e.includes(`Junk`)||e.includes(`junk`)){this._junkError=!0,this.push(null),this._terminateWorker();for(let e of this._pendingAcks.values())e();this._pendingAcks.clear();return}let n=Error(e);for(let e of this._pendingAcks.values())e(n);this._pendingAcks.clear(),this.emit(`error`,n),this._terminateWorker();return}}},this.worker.onerror=e=>{let t=Error(e.message??`Worker error`);for(let e of this._pendingAcks.values())e(t);this._pendingAcks.clear(),this.emit(`error`,t),this._terminateWorker()}}_terminateWorker(){if(!this._terminated){this._terminated=!0;try{this.worker.terminate()}catch{}}}_doWrite(e,t){if(this._closed||this._junkError){t();return}let n=this._nextId++;this._pendingAcks.set(n,t);let r=e.byteOffset===0&&e.byteLength===e.buffer.byteLength?e:e.slice();this.worker.postMessage({t:`write`,id:n,chunk:r},[r.buffer])}_doClose(e){if(this._closed){e();return}this._closed=!0,this.worker.postMessage({t:`close`}),e()}destroy(e){if(!this._closed){this._closed=!0;try{this.worker.postMessage({t:`abort`})}catch{}}return this._terminateWorker(),super.destroy(e??void 0)}},Cu=class extends gt{constructor(){super({write:(e,t,n)=>{if(this._finished){n(Error(`write after end`));return}this.chunks.push(e),n()},final:e=>{this._decompress(e)}}),this.chunks=[],this._finished=!1}_decompress(e){try{let t=cs(it(this.chunks));this.push(t),this.push(null),this._finished=!0,e()}catch(t){e(t instanceof Error?t:Error(String(t)))}}destroy(e){return this._finished=!0,this.chunks=[],super.destroy(e??void 0)}};function wu(){return ws()?new yu:new Cu}let Tu=Ll;function Eu(e){return class extends gt{constructor(t={}){super({objectMode:!0,write:(e,t,n)=>{this._handleWrite(e,n)},final:e=>{this.finished=!0,this._maybeReleaseWriteCallback(),this._wakeUp(),this.emit(`data-available`),this.emit(`chunk`,!1),this._parsingDone.then(()=>e()).catch(e)}}),this._buffer=new _s,this.finished=!1,this._driverState={},this._parsingDone=Promise.resolve(),this._opts=t;let n=Math.max(64*1024,t.inputHighWaterMarkBytes??2*1024*1024),r=Math.max(32*1024,t.inputLowWaterMarkBytes??Math.floor(n/4));this._inputHighWaterMarkBytes=n,this._inputLowWaterMarkBytes=Math.min(r,n);let i={pull:e=>this.pull(e),pullUntil:(e,t)=>this.pullUntil(e,t),stream:e=>this.stream(e),streamUntilDataDescriptor:()=>this._streamUntilDataDescriptor(),setDone:()=>{this.push(null)}},a={emitEntry:e=>{this.emit(`entry`,e)},pushEntry:e=>{this.push(e)},pushEntryIfPiped:e=>{},emitCrxHeader:e=>{this.crxHeader=e,this.emit(`crx-header`,e)},emitError:e=>{if(this.__emittedError=e,this._writeCb){let t=this._writeCb;this._writeCb=void 0,t(e)}this.emit(`error`,e)},emitClose:()=>{this.emit(`close`)}};queueMicrotask(()=>{this._parsingDone=hu(this._opts,i,a,()=>{if(this._opts.useWorkerInflate&&typeof Worker<`u`&&ws())try{return new Su(this._opts.workerInflateUrl)}catch{return e()}return e()},this._driverState),this._parsingDone.catch(e=>{(!this.__emittedError||this.__emittedError!==e)&&(this.__emittedError=e,this.emit(`error`,e)),this.emit(`close`)})})}_handleWrite(e,t){this._buffer.append(e),this._buffer.length>=this._inputHighWaterMarkBytes?this._writeCb=t:t(),this._wakeUp(),this.emit(`data-available`),this.emit(`chunk`)}get buffer(){return this._buffer.view()}set buffer(e){this._buffer.reset(e)}_wakeUp(){if(this._pendingResolve){let e=this._pendingResolve;this._pendingResolve=void 0,e()}}_maybeReleaseWriteCallback(){if(!this._writeCb||this._buffer.length>this._inputLowWaterMarkBytes)return;let e=this._writeCb;this._writeCb=void 0,e()}_waitForData(){return new Promise(e=>{this._pendingResolve=e})}async _pullInternal(e){if(e===0)return new Uint8Array;for(;this._buffer.length<e;){if(this.finished){if(this._buffer.length>0){let e=this._buffer.read(this._buffer.length);return this._maybeReleaseWriteCallback(),e}throw Error(`FILE_ENDED`)}await this._waitForData()}let t=this._buffer.read(e);return this._maybeReleaseWriteCallback(),t}async _pullUntilInternal(e,t=!1){let n=[],r=new Il(e);for(;;){let i=this._buffer.length,a=r.find(this._buffer);if(a!==-1){this.match=a;let r=a+(t?e.length:0);return r>0&&(n.push(this._buffer.read(r)),this._maybeReleaseWriteCallback()),n.length===1?n[0]:it(n)}if(r.onNoMatch(i),this.finished)throw Error(`FILE_ENDED`);let o=Math.max(0,this._buffer.length-e.length);o>0&&(n.push(this._buffer.read(o)),r.onConsume(o),this._maybeReleaseWriteCallback()),await this._waitForData()}}_streamFixedLength(e){let t=new _t({highWaterMark:vu}),n=e,r=!1,i=!1,a=()=>{if(!r&&!i){for(;n>0&&this._buffer.length>0;){let e=Math.min(n,this._buffer.length),r=this._buffer.read(e);n-=e;let o=t.write(r);if(this._maybeReleaseWriteCallback(),!o){i=!0,t.once(`drain`,()=>{i=!1,a()});return}}n===0?(r=!0,this.removeListener(`data-available`,a),t.end()):this.finished&&(r=!0,this.removeListener(`data-available`,a),t.destroy(Error(`FILE_ENDED`)))}};return this.on(`data-available`,a),queueMicrotask(()=>a()),t}_streamUntilPattern(e,t=!1){let n=new _t({highWaterMark:vu}),r=!1,i=e.length,a=new Il(e),o=!1,s=()=>{if(!(r||o))for(;!(this._buffer.length<=0);){let e=this._buffer.length,c=a.find(this._buffer);if(c!==-1){this.match=c;let e=t?c+i:c;if(e>0){let t=n.write(this._buffer.read(e));if(a.onConsume(e),this._maybeReleaseWriteCallback(),!t){o=!0,n.once(`drain`,()=>{o=!1,s()});return}}r=!0,this.removeListener(`data-available`,s),n.end();return}if(a.onNoMatch(e),this.finished){r=!0,this.removeListener(`data-available`,s),n.destroy(Error(`FILE_ENDED`));return}let l=e-i;if(l<=0){this._buffer.length<=i&&this._maybeReleaseWriteCallback();break}let u=n.write(this._buffer.read(l));if(a.onConsume(l),this._maybeReleaseWriteCallback(),!u){o=!0,n.once(`drain`,()=>{o=!1,s()});return}}};return this.on(`data-available`,s),queueMicrotask(()=>s()),n}stream(e,t){return typeof e==`number`?this._streamFixedLength(e):this._streamUntilPattern(e,t??!1)}pull(e,t){return e===0?Promise.resolve(new Uint8Array):typeof e==`number`?this.finished&&this._buffer.length<e?Promise.reject(Error(`FILE_ENDED`)):this._buffer.length>=e?Promise.resolve(this._buffer.read(e)):this._pullInternal(e):this.finished?Promise.reject(Error(`FILE_ENDED`)):this._pullUntilInternal(e,t??!1)}pullUntil(e,t){return this.pull(e,t)}_streamUntilDataDescriptor(){return pu({source:{getLength:()=>this._buffer.length,read:e=>this._buffer.read(e),peekChunks:e=>this._buffer.peekChunks(e),discard:e=>this._buffer.discard(e),indexOfPattern:(e,t)=>this._buffer.indexOfPattern(e,t),peekUint32LE:e=>this._buffer.peekUint32LE(e),isFinished:()=>this.finished,onDataAvailable:e=>(this.on(`data-available`,e),()=>this.removeListener(`data-available`,e)),maybeReleaseWriteCallback:()=>this._maybeReleaseWriteCallback()},dataDescriptorSignature:Tu})}promise(){return new Promise((e,t)=>{this.on(`finish`,e),this.on(`end`,e),this.on(`error`,t)})}}}let Du=Eu(wu);var Ou=class extends Du{};function ku(e){return new Ou(e)}async function*Au(e){let t=[],n=null,r=e=>{t.push(e),n&&=(n(),null)};e.on(`data`,r);let i=!1,a=()=>{i=!0,n&&=(n(),null)};e.on(`end`,a);let o=!1,s=e=>{o=e,n&&=(n(),null)};e.on(`error`,s);try{for(;!i||t.length>0;)if(t.length===0?(e.resume(),await new Promise(e=>{n=e})):(e.pause(),yield t.shift()),o)throw o}finally{e.removeListener(`data`,r),e.removeListener(`end`,a),e.removeListener(`error`,s)}}var ju=class extends M{constructor({workbook:e,id:t,iterator:n,options:i}){super(),this.workbook=e,this.id=t,this.sheetNo=typeof t==`number`?t:parseInt(String(t),10),this.iterator=n,this.options=i||{},this.name=`Sheet${this.id}`,this._columns=null,this._keys=Object.create(null),this._dimensions=new r}destroy(){throw Error(`Invalid Operation: destroy`)}get dimensions(){return this._dimensions}get columns(){return this._columns}getColumn(e){if(typeof e==`string`){let t=this._keys[e];if(t)return t;e=n.l2n(e)}if(this._columns||=[],e>this._columns.length){let t=this._columns.length+1;for(;t<=e;)this._columns.push(new fe(this,t++))}return this._columns[e-1]}getColumnKey(e){return this._keys[e]}setColumnKey(e,t){this._keys[e]=t}deleteColumnKey(e){delete this._keys[e]}eachColumnKey(e){let t=this._keys;for(let n in t)e(t[n],n)}async read(){try{for await(let e of this.parse())for(let t=0;t<e.length;t++){let n=e[t];this.emit(n.eventType,n.value)}this.emit(`finished`)}catch(e){this.emit(`error`,e)}}async*[Symbol.asyncIterator](){for await(let e of this.parse())for(let t=0;t<e.length;t++){let n=e[t];n.eventType===`row`&&(yield n.value)}}async*parse(){let{iterator:e,options:t}=this,r=!1,i=!1,a=null;switch(t.worksheets){case`emit`:r=!0;break;case`prep`:break;default:break}switch(t.hyperlinks){case`emit`:i=!0;break;case`cache`:this.hyperlinks=a=Object.create(null);break;default:break}if(!r&&!i&&!a)return;let o=i||a!==null,{sharedStrings:s,styles:c,properties:l}=this.workbook,u=!1,d=!1,f=!1,p=null,m=null,h=null,g=null;for await(let t of nn(e)){let e=null;for(let _=0;_<t.length;_++){let v=t[_],y=v.eventType,b=v.value;if(y===`opentag`){let t=b;if(r)switch(t.name){case`cols`:u=!0,p=[];break;case`sheetData`:d=!0;break;case`col`:u&&p.push({min:parseInt(t.attributes.min,10),max:parseInt(t.attributes.max,10),width:parseFloat(t.attributes.width),styleId:parseInt(t.attributes.style??`0`,10)});break;case`row`:if(d){let e=parseInt(t.attributes.r,10);if(m=new de(this,e),t.attributes.ht&&(m.height=parseFloat(t.attributes.ht)),t.attributes.customHeight===`1`&&(m.customHeight=!0),t.attributes.s!==void 0){let e=parseInt(t.attributes.s,10),n=c.getStyleModel(e);n&&(m.style=n)}}break;case`c`:if(m){let e=t.attributes.s;h={ref:t.attributes.r,s:e===void 0?void 0:parseInt(e,10),t:t.attributes.t}}break;case`f`:h&&(g=h.f={text:``});break;case`v`:h&&(g=h.v={text:``});break;case`is`:case`t`:h&&(g=h.v={text:``});break;case`mergeCell`:break;default:break}if(o)switch(t.name){case`hyperlinks`:f=!0;break;case`hyperlink`:if(f){let n={ref:t.attributes.ref,rId:t.attributes[`r:id`]};i?(e||=[]).push({eventType:`hyperlink`,value:n}):a[n.ref]=n}break;default:break}}else if(y===`text`)r&&g&&(g.text+=b);else if(y===`closetag`){let t=b;if(r)switch(t.name){case`cols`:u=!1,this._columns=fe.fromModel(p);break;case`sheetData`:d=!1;break;case`row`:m&&(this._dimensions.expandRow({number:m.number,dimensions:m.dimensions??void 0}),(e||=[]).push({eventType:`row`,value:m})),m=null;break;case`c`:if(m&&h){let e=n.decodeAddress(h.ref),t=m.getCell(e.col);if(h.s!==void 0){let e=c.getStyleModel(h.s);e&&(t.style=e)}if(h.f){let e={formula:h.f.text};h.v&&(h.t===`str`?e.result=Le(h.v.text):e.result=parseFloat(h.v.text)),t.value=e}else if(h.v)switch(h.t){case`s`:{let e=parseInt(h.v.text,10);s?t.value=s[e]:t.value={sharedString:e};break}case`inlineStr`:case`str`:t.value=Le(h.v.text);break;case`e`:t.value={error:h.v.text};break;case`b`:t.value=parseInt(h.v.text,10)!==0;break;default:{let e=typeof t.numFmt==`string`?t.numFmt:t.numFmt?.formatCode;e&&Ue(e)?t.value=Pe(parseFloat(h.v.text),l?.model?.date1904):t.value=parseFloat(h.v.text);break}}if(a){let e=a[h.ref];e&&(t.text=t.value,t.value=void 0,t.hyperlink=e)}h=null,g=null}break;default:break}if(o)switch(t.name){case`hyperlinks`:f=!1;break;default:break}}}e&&e.length>0&&(yield e)}}},Mu=class extends M{constructor({workbook:e,id:t,iterator:n,options:r}){super(),this._hyperlinkCount=0,this.workbook=e,this.id=t,this.iterator=n,this.options=r}get count(){return this.hyperlinks?this._hyperlinkCount:0}each(e){let t=this.hyperlinks;if(t)for(let n in t)e(t[n],n)}async read(){let{iterator:e}=this,t=this.options.hyperlinks,n=t===`emit`,r=t===`cache`,i=null;if(r&&(this._hyperlinkCount=0,this.hyperlinks=i=Object.create(null)),!n&&!r){this.emit(`finished`);return}try{for await(let t of nn(e))for(let{eventType:e,value:r}of t){if(e!==`opentag`)continue;let t=r;if(t.name!==`Relationship`)continue;let a=t.attributes;if(a.Type!==G.Hyperlink)continue;let o={type:u.RelationshipType.Hyperlink,rId:a.Id,target:a.Target,targetMode:a.TargetMode};if(n){this.emit(`hyperlink`,o);continue}let s=o.rId;i&&i[s]===void 0&&(this._hyperlinkCount+=1),i[s]=o}this.emit(`finished`)}catch(e){this.emit(`error`,e)}}},Nu=class extends M{getHyperlinkReader(e){return this._hyperlinkReadersBySheetNo?.[String(e)]}getHyperlink(e,t){return this.getHyperlinkReader(e)?.hyperlinks?.[t]}getHyperlinkTarget(e,t){return this.getHyperlink(e,t)?.target}constructor(e,t,n,r){super(),this.input=e,this.WorksheetReaderClass=n,this.HyperlinkReaderClass=r,this.options={worksheets:`emit`,sharedStrings:`cache`,hyperlinks:`ignore`,styles:`ignore`,entries:`ignore`,...t},this.styles=new jn,this.styles.init()}_getStream(e){if(e instanceof N)return e;if(e&&typeof e==`object`&&typeof e.getReader==`function`){let t=N.fromWeb;if(typeof t==`function`)return t(e);try{return new N({stream:e})}catch{throw Error(`Could not recognise input: ReadableStream`)}}let t=e;if(t instanceof ArrayBuffer&&(t=new Uint8Array(t)),t instanceof Uint8Array)return N.from([t]);throw Error(`Could not recognise input: ${e}`)}_cleanupWaitingWorksheets(e){for(let t of e)t&&typeof t.cleanup==`function`&&t.cleanup()}_createWorksheetReader(e){return new this.WorksheetReaderClass({workbook:this,id:e.id,iterator:e.iterator,options:e.options})}_createHyperlinkReader(e){return new this.HyperlinkReaderClass({workbook:this,id:e.id,iterator:e.iterator,options:e.options})}async read(e,t){try{for await(let{eventType:n,value:r}of this.parse(e,t))switch(n){case`shared-strings`:this.emit(n,r);break;case`worksheet`:this.emit(n,r),await r.read();break;case`hyperlinks`:this.emit(n,r);break}this.emit(`end`),this.emit(`finished`)}catch(e){this.emit(`error`,e)}}async*[Symbol.asyncIterator](){for await(let{eventType:e,value:t}of this.parse())e===`worksheet`&&(yield t)}async*parse(e,t){t&&(this.options=t);let n=this.stream=this._getStream(e||this.input),r=[];try{for await(let e of this._parseEntries(n))if(e.eventType===`waiting-worksheet`){let t=await this._storeWaitingWorksheet(e.sheetNo,e.entry);r.push(t)}else yield e;yield*this._processWaitingWorksheets(r)}catch(e){throw this._cleanupWaitingWorksheets(r),e}}_emitEntry(e){this.options.entries===`emit`&&this.emit(`entry`,e)}async _parseRels(e){this.workbookRels=await new H().parseStream(Au(e)),this._workbookRelIdByTarget=Object.create(null);for(let e of this.workbookRels??[])e?.Target&&e?.Id&&(this._workbookRelIdByTarget[e.Target]=e.Id)}async _parseWorkbook(e){this._emitEntry({type:`workbook`});let t=new di;this.model=await t.parseStream(Au(e)),this.properties=t.map?.workbookPr,this._sheetByRelId=Object.create(null);for(let e of this.model?.sheets??[])this._sheetByRelId[e.rId]=e}async*_parseSharedStrings(e){switch(this._emitEntry({type:`shared-strings`}),this.options.sharedStrings){case`cache`:this.sharedStrings=[];break;case`emit`:break;default:return}let t=null,n=[],r=0,i=null,a=!1;for await(let o of nn(Au(e)))for(let{eventType:e,value:s}of o)if(e===`opentag`){let e=s;switch(e.name){case`b`:i||={},i.bold=!0;break;case`charset`:i||={},i.charset=parseInt(e.attributes.charset,10);break;case`color`:i||={},i.color={},e.attributes.rgb&&(i.color.argb=e.attributes.rgb),e.attributes.val&&(i.color.argb=e.attributes.val),e.attributes.theme&&(i.color.theme=e.attributes.theme);break;case`family`:i||={},i.family=parseInt(e.attributes.val,10);break;case`i`:i||={},i.italic=!0;break;case`outline`:i||={},i.outline=!0;break;case`rFont`:i||={},i.name=e.attributes.val;break;case`r`:a=!0;break;case`si`:i=null,n=[],t=null,a=!1;break;case`sz`:i||={},i.size=parseInt(e.attributes.val,10);break;case`strike`:i||={},i.strike=!0;break;case`t`:t=null;break;case`u`:i||={},i.underline=!0;break;case`vertAlign`:i||={},i.vertAlign=e.attributes.val;break}}else if(e===`text`)t=t?t+s:s;else if(e===`closetag`)switch(s.name){case`r`:a&&(n.push({font:i,text:t}),i=null,t=null);break;case`si`:this.options.sharedStrings===`cache`?this.sharedStrings.push(n.length?{richText:n}:t??``):this.options.sharedStrings===`emit`&&(yield{index:r++,text:n.length?{richText:n}:t??``}),n=[],i=null,t=null,a=!1;break}}async _parseStyles(e){this._emitEntry({type:`styles`}),this.options.styles===`cache`&&(this.styles=new jn,await this.styles.parseStream(Au(e)))}*_parseWorksheet(e,t){this._emitEntry({type:`worksheet`,id:t});let n=parseInt(t,10),r=this._createWorksheetReader({id:n,iterator:e,options:this.options});r.sheetNo=n;let i=this._workbookRelIdByTarget?.[Sr(t)],a=i?this._sheetByRelId?.[i]:void 0;a&&(r.id=a.id,r.name=a.name,r.state=a.state),this.options.worksheets===`emit`&&(yield{eventType:`worksheet`,value:r})}async*_parseHyperlinks(e,t){this._emitEntry({type:`hyperlinks`,id:t});let n=this._createHyperlinkReader({id:parseInt(t,10),iterator:e,options:this.options});if(this.options.hyperlinks===`cache`){this._hyperlinkReadersBySheetNo||=Object.create(null),this._hyperlinkReadersBySheetNo[t]=n;let e=n.read;typeof e==`function`&&await e.call(n);return}this.options.hyperlinks===`emit`&&(yield{eventType:`hyperlinks`,value:n})}async*_parseEntries(e){let t=ku({forceStream:!0});e.on(`error`,e=>t.emit(`error`,e)),e.pipe(t);for await(let e of Au(t)){let t,n=er(e.path);switch(n){case U.rootRels:break;case U.xlWorkbookRels:await this._parseRels(e);break;case U.xlWorkbook:await this._parseWorkbook(e);break;case U.xlSharedStrings:for await(let t of this._parseSharedStrings(e))yield{eventType:`shared-strings`,value:t};break;case U.xlStyles:await this._parseStyles(e);break;default:if(t=tr(n)?.toString(),t)if(this.workbookRels&&(this.options.sharedStrings!==`cache`||this.sharedStrings)){yield*this._parseWorksheet(Au(e),t);continue}else{yield{eventType:`waiting-worksheet`,sheetNo:t,entry:e};continue}if(t=nr(n)?.toString(),t){yield*this._parseHyperlinks(Au(e),t);continue}break}e.autodrain()}}},Pu=class extends Nu{constructor(e,t={}){super(e,t,ju,Mu)}async _storeWaitingWorksheet(e,t){let n=[],r=new TextEncoder;for await(let e of Au(t))e instanceof Uint8Array?n.push(e):typeof e==`string`&&n.push(r.encode(e));return{sheetNo:e,data:n}}async*_processWaitingWorksheets(e){for(let t of e){let e=(async function*(){for(let e of t.data)yield e})();yield*this._parseWorksheet(e,t.sheetNo)}}},Fu=class{static{this.Writer=Nl}static{this.Reader=Pu}constructor(){this.category=``,this.company=``,this.created=new Date,this.description=``,this.keywords=``,this.manager=``,this.modified=this.created,this.properties={},this.calcProperties={},this._worksheets=[],this.subject=``,this.title=``,this.views=[],this.media=[],this.pivotTables=[],this._passthrough={},this._rawDrawings={},this._definedNames=new Ht}get xlsx(){return this._xlsx||=new Hc(this),this._xlsx}get csv(){return this._csv||=new wl(this),this._csv}static createStreamWriter(e){return new Nl(e)}static createStreamReader(e,t){return new Pu(e,t)}get nextId(){for(let e=1;e<this._worksheets.length;e++)if(!this._worksheets[e])return e;return this._worksheets.length||1}addWorksheet(e,t){let n=this.nextId,r=this._worksheets.reduce((e,t)=>(t&&t.orderNo)>e?t.orderNo:e,0),i=new Lt({...t,id:n,name:e,orderNo:r+1,workbook:this});return this._worksheets[n]=i,i}removeWorksheetEx(e){delete this._worksheets[e.id]}removeWorksheet(e){let t=this.getWorksheet(e);t&&t.destroy()}getWorksheet(e){if(e===void 0)return this._worksheets.find(Boolean);if(typeof e==`number`)return this._worksheets[e];if(typeof e==`string`)return this._worksheets.find(t=>t&&t.name===e)}get worksheets(){return this._worksheets.slice(1).sort((e,t)=>e.orderNo-t.orderNo).filter(Boolean)}eachSheet(e){this.worksheets.forEach(t=>{e(t,t.id)})}get definedNames(){return this._definedNames}clearThemes(){this._themes=void 0}addImage(e){let t=this.media.length;return this.media.push({...e,type:`image`}),t}getImage(e){return this.media[Number(e)]}get model(){return{creator:this.creator??`Unknown`,lastModifiedBy:this.lastModifiedBy??`Unknown`,lastPrinted:this.lastPrinted,created:this.created,modified:this.modified,properties:this.properties,worksheets:this.worksheets.map(e=>e.model),sheets:this.worksheets.map(e=>e.model).filter(Boolean),definedNames:this._definedNames.model,views:this.views,company:this.company,manager:this.manager,title:this.title,subject:this.subject,keywords:this.keywords,category:this.category,description:this.description,language:this.language,revision:this.revision,contentStatus:this.contentStatus,themes:this._themes,media:this.media,pivotTables:this.pivotTables,calcProperties:this.calcProperties,passthrough:this._passthrough,rawDrawings:this._rawDrawings,defaultFont:this._defaultFont}}set model(e){this.creator=e.creator,this.lastModifiedBy=e.lastModifiedBy,this.lastPrinted=e.lastPrinted,this.created=e.created,this.modified=e.modified,this.company=e.company,this.manager=e.manager,this.title=e.title,this.subject=e.subject,this.keywords=e.keywords,this.category=e.category,this.description=e.description,this.language=e.language,this.revision=e.revision,this.contentStatus=e.contentStatus,this.properties=e.properties,this.calcProperties=e.calcProperties,this._worksheets=[],e.worksheets.forEach(t=>{let{id:n,name:r,state:i}=t,a=e.sheets&&e.sheets.findIndex(e=>e.id===n),o=this._worksheets[n]=new Lt({id:n,name:r,orderNo:a===-1?void 0:a,state:i,workbook:this});o.model=t}),this._definedNames.model=e.definedNames,this.views=e.views,this._themes=e.themes,this.media=e.media??[],this.pivotTables=e.pivotTables??[],this._passthrough=e.passthrough||{},this._rawDrawings=e.rawDrawings||{},this._defaultFont=e.defaultFont}};let Iu=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function Lu(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function Ru(e){if(e.length<=3)return e;let t=e.length%3,n=e.substring(0,t);for(let r=t;r<e.length;r+=3)n+=(n.length>0?`,`:``)+e.substring(r,r+3);return n}function zu(e,t){let n=10**t;return Math.round(e*n)/n}function Bu(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function Vu(e){return/^General$/i.test(e.trim())}function Hu(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let Uu=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],Wu=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Gu=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],Ku=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],qu=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Ju(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=Pe(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=Bu(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,Gu[c]).replace(/\x00MN4\x00/g,Wu[c]).replace(/\x00MN3\x00/g,Uu[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,qu[u]).replace(/\x00DN3\x00/g,Ku[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function Yu(e){return typeof e==`boolean`?e?`TRUE`:`FALSE`:typeof e==`string`?e:Number.isInteger(e)?e.toString():e.toPrecision(11).replace(/\.?0+$/,``).replace(/\.?0+e/,`e`)}function Xu(e,t){let n=(t.match(/%/g)??[]).length;return td(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function Zu(e,t){let n=e<0?`-`:``,r=Math.abs(e);if(r===0){let e=t.match(/\.([0#]+)E/i),n=e?e[1].length:2;return`0.`+`0`.repeat(n)+`E+00`}let i=t.match(/\.([0#]+)E/i),a=i?i[1].length:2,o=t.includes(`E+`),s=Math.floor(Math.log10(r)),c=zu(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=Lu(Math.abs(s),2);return n+c+`E`+l+u}function Qu(e,t){let n=e<0?-1:1,r=Math.abs(e),i=Math.floor(r);if(r-=i,r<1e-10)return[n*i,0,1];let a=0,o=1,s=1,c=0,l=Math.floor(r),u=l,d=1;for(;c<t&&(l=Math.floor(r),u=l*o+a,d=l*c+s,!(r-l<1e-10));)r=1/(r-l),a=o,o=u,s=c,c=d;return d>t&&(d=c,u=o),[n*i,n*u,d]}function $u(e,t){let n=e<0?`-`:``,r=Math.abs(e),i=t.match(/\?+\s*\/\s*(\d+)/);if(i){let e=parseInt(i[1],10),a=Math.floor(r),o=r-a,s=Math.round(o*e);return t.includes(`#`)||t.includes(`0`)?s===0?n+a.toString():n+(a>0?a+` `:``)+s+`/`+e:n+(a*e+s)+`/`+e}let a=t.match(/\/\s*(\?+)/),[o,s,c]=Qu(r,10**(a?a[1].length:2)-1);return t.includes(`#`)&&o!==0?s===0?n+Math.abs(o).toString():n+Math.abs(o)+` `+Math.abs(s)+`/`+c:s===0?o===0?`0`:n+Math.abs(o).toString():n+(Math.abs(o)*c+Math.abs(s))+`/`+c}function ed(e,t){let n=Math.round(e*86400),r=Math.floor(n/60),i=Math.floor(r/60),a=n%60,o=r%60,s=i,c=t;return/\[h+\]/i.test(c)&&(c=c.replace(/\[h+\]/gi,s.toString())),/\[m+\]/i.test(c)&&(c=c.replace(/\[m+\]/gi,r.toString())),/\[s+\]/i.test(c)&&(c=c.replace(/\[s+\]/gi,n.toString())),c=c.replace(/mm/gi,o.toString().padStart(2,`0`)),c=c.replace(/ss/gi,a.toString().padStart(2,`0`)),c}function td(e,t){let n=Math.abs(e),r=e<0?`-`:``,i=0,a=t;for(;a.endsWith(`,`);)i++,a=a.slice(0,-1);let o=n/1e3**i,s=a.indexOf(`.`),c=a,l=``;s!==-1&&(c=a.substring(0,s),l=a.substring(s+1));let u=l.replace(/[^0#?]/g,``).length,[d,f=``]=zu(o,u).toString().split(`.`),p=/[0#?][^0#?,.\s][0#?]/.test(c),m;if(p){let e=c.replace(/[^0#?]/g,``).length,t=d;t.length<e&&(t=`0`.repeat(e-t.length)+t),m=``;let n=t.length-e;for(let e=0;e<c.length;e++){let r=c[e];r===`0`||r===`#`||r===`?`?n<t.length&&(m+=t[n],n++):r!==`,`&&(m+=r)}}else{m=d,c.includes(`,`)&&(m=Ru(d));let e=(c.match(/0/g)??[]).length;m.length<e&&(m=`0`.repeat(e-m.length)+m)}let h=``;return u>0&&(h=`.`+(f+`0`.repeat(u)).substring(0,u)),r+m+h}function nd(e){let t=``,n=0;for(;n<e.length;)if(e[n]===`"`){for(n++;n<e.length&&e[n]!==`"`;)t+=e[n],n++;n++}else e[n]===`\\`&&n+1<e.length?(n++,t+=e[n],n++):(t+=e[n],n++);return t}function rd(e,t){let n=t.match(/\[(=|>|<|>=|<=|<>)(-?\d+(?:\.\d*)?)\]/);if(!n)return!1;let r=n[1],i=parseFloat(n[2]);switch(r){case`=`:return e===i;case`>`:return e>i;case`<`:return e<i;case`>=`:return e>=i;case`<=`:return e<=i;case`<>`:return e!==i;default:return!1}}function id(e,t){if(typeof t==`string`){let n=Be(e);return n.length>=4&&n[3]?nd(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=Be(e),r=/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/;if((n[0]&&r.test(n[0])||n[1]&&r.test(n[1]))&&n.length>=2){for(let e=0;e<Math.min(n.length,2);e++){let r=n[e].match(/\[(=|>|<|>=|<=|<>)-?\d+(?:\.\d*)?\]/);if(r&&rd(t,r[0]))return n[e]}return n[n.length>2?2:1]}return n.length===1?n[0]:n.length===2?t>=0?n[0]:n[1]:t>0?n[0]:t<0?n[1]:n[2]||n[0]}function ad(e,t){let n=Be(e);return n.length>=2&&n[1]===t}function od(e,t){if(t==null)return``;if(Vu(e))return Yu(t);if(typeof t==`string`)return id(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=id(e,n);n<0&&ad(e,r)&&(n=Math.abs(n));let i=r.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);if(i=i.replace(/\[(>|<|>=|<=|=|<>)-?\d+(\.\d+)?\]/g,``),i=i.replace(/\[\$[^\]]*\]/g,``),i=Bu(i),i=nd(i),/\[[hms]+\]/i.test(i))return ed(n,i);if(Hu(i))return Ju(n,i);if(i.includes(`%`))return Xu(n,i);if(/E[+-]?/i.test(i))return Zu(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return $u(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+td(-n,e)+`)`}if(i===`@`)return n.toString();let a=``,o=``,s=i.match(/^([^#0?.,]+)/);s&&(a=s[1],i=i.substring(s[0].length));let c=i.match(/([^#0?.,]+)$/);c&&!c[1].includes(`%`)&&(o=c[1],i=i.substring(0,i.length-c[0].length));let l=td(n,i);return a+l+o}function sd(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function cd(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function ld(e,t,n){if(e instanceof Date){let r=Ne(e);return sd(t)?(r%=1,r<0&&(r+=1),od(t,r)):od(n&&cd(t)?n:t,r)}return od(t,e)}function ud(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return ld(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return ld(e,i,t)}return e.text}function dd(e){return n.l2n(e.toUpperCase())-1}function fd(e){return n.n2l(e+1)}function pd(e){return parseInt(e,10)-1}function md(e){return String(e+1)}function hd(e){let t=n.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function gd(e){return n.encodeAddress(e.r+1,e.c+1)}function _d(e){let t=e.indexOf(`:`);if(t===-1){let t=hd(e);return{s:t,e:{...t}}}return{s:hd(e.slice(0,t)),e:hd(e.slice(t+1))}}function vd(e,t){if(t===void 0){let t=e;return vd(t.s,t.e)}let n=gd(e),r=gd(t);return n===r?n:`${n}:${r}`}function yd(e,t){let n=t||{},r=new Fu().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function bd(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=hd(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function xd(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=_d(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?ud(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?ud(a,n.dateFormat).trim():a.value,s=fd(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?ud(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?ud(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function Sd(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
123
124
  `,a=[];return e.eachRow({includeEmpty:n.blankrows!==!1},(t,i)=>{let o=[],s=!0;for(t.eachCell({includeEmpty:!0},(e,t)=>{let i=``;e.value!=null&&(i=e.value instanceof Date?e.value.toISOString():typeof e.value==`object`?`result`in e.value?String(e.value.result??``):`text`in e.value?String(e.value.text??``):`richText`in e.value?e.value.richText.map(e=>e.text).join(``):String(e.value):String(e.value),s=!1),(n.forceQuotes||i.includes(r)||i.includes(`"`)||i.includes(`
124
- `)||i.includes(`\r`))&&(i=`"${i.replace(/"/g,`""`)}"`),o.push(i)});o.length<e.columnCount;)o.push(``);(!s||n.blankrows!==!1)&&a.push(o.join(r))}),a.join(i)}function xd(){return new Nu}function Sd(e,t,n){let r=e.addWorksheet(n);t.eachRow({includeEmpty:!0},(e,t)=>{e.eachCell({includeEmpty:!0},(e,n)=>{let i=r.getCell(t,n);i.value=e.value,e.style&&(i.style=e.style)})}),t.columns?.forEach((e,t)=>{e&&r.columns[t]&&e.width&&(r.getColumn(t+1).width=e.width)})}function Cd(e,t){let n=new Nu().addWorksheet(`Sheet1`);if(e.length===0)return n;let r=1,i=1;if(t?.origin!==void 0)if(typeof t.origin==`string`){let e=pd(t.origin);r=e.r+1,i=e.c+1}else typeof t.origin==`number`?r=t.origin+1:(r=t.origin.r+1,i=t.origin.c+1);return e.forEach((e,t)=>{e&&e.forEach((e,a)=>{e!=null&&(n.getCell(r+t,i+a).value=e)})}),n}function wd(e,t,n){if(t.length===0)return e;let r=1,i=1;if(n?.origin!==void 0)if(typeof n.origin==`string`){let e=pd(n.origin);r=e.r+1,i=e.c+1}else typeof n.origin==`number`?r=n.origin===-1?e.rowCount+1:n.origin+1:(r=n.origin.r+1,i=n.origin.c+1);return t.forEach((t,n)=>{t&&t.forEach((t,a)=>{t!=null&&(e.getCell(r+n,i+a).value=t)})}),e}function Td(e){let t=[];return e.eachRow({includeEmpty:!0},(e,n)=>{let r=[];e.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),t[n-1]=r}),t}let Ed=new Date(1980,0,1,0,0,0);function Dd(e){return e?Bs(e):new Uint8Array}function Od(e,t){return e>0&&t.length>0}async function kd(e,t,n,r){if(!Od(t,e.data))return{compressedData:e.data,deflate:!1};if(!r)return{compressedData:await yc(e.data,n),deflate:!0};if(gc(e.data))return{compressedData:e.data,deflate:!1};let i=await yc(e.data,n);return i.length>=e.data.length?{compressedData:e.data,deflate:!1}:{compressedData:i,deflate:!0}}function Ad(e,t,n,r){if(!Od(t,e.data))return{compressedData:e.data,deflate:!1};if(!r)return{compressedData:bc(e.data,n),deflate:!0};if(gc(e.data))return{compressedData:e.data,deflate:!1};let i=bc(e.data,n);return i.length>=e.data.length?{compressedData:e.data,deflate:!1}:{compressedData:i,deflate:!0}}function jd(e){return 30+e.name.length+e.extraField.length+e.compressedData.length}function Md(e){return 46+e.name.length+e.extraField.length+e.comment.length}function Nd(e,t,n,r,i){let a=e.modTime??n.defaultModTime,o=pc({name:e.name,comment:e.comment,modTime:a,timestamps:n.timestamps,useDataDescriptor:!1,deflate:i});return{name:o.nameBytes,uncompressedSize:e.data.length,compressedData:r,crc:Ko(e.data),compressionMethod:dc(i),modTime:o.dosTime,modDate:o.dosDate,extraField:o.extraField,comment:o.commentBytes,offset:t}}function Pd(e,t,n,r,i,a){let o=Nd(t,i,a,n,r);return e.push(o),{processedEntry:o,nextOffset:i+jd(o)}}function Fd(e,t){let n=0,r=0;for(let t of e)n+=jd(t),r+=Md(t);let i=n,a=n+r+22+t.length,o=new Uint8Array(a),s=new DataView(o.buffer,o.byteOffset,o.byteLength),c=0;for(let t of e)c+=ic(o,s,c,{fileName:t.name,extraField:t.extraField,flags:rc,compressionMethod:t.compressionMethod,dosTime:t.modTime,dosDate:t.modDate,crc32:t.crc,compressedSize:t.compressedData.length,uncompressedSize:t.uncompressedSize}),o.set(t.compressedData,c),c+=t.compressedData.length;for(let t of e)c+=oc(o,s,c,{fileName:t.name,extraField:t.extraField,comment:t.comment,flags:rc,compressionMethod:t.compressionMethod,dosTime:t.modTime,dosDate:t.modDate,crc32:t.crc,compressedSize:t.compressedData.length,uncompressedSize:t.uncompressedSize,localHeaderOffset:t.offset});return cc(o,s,c,{entryCount:e.length,centralDirSize:r,centralDirOffset:i,comment:t}),o}async function Id(e,t={}){let n=t.reproducible??!1,r=t.level??6,i=t.smartStore??!0,a=t.concurrency??4,o=t.timestamps??`dos`,s=Dd(t.comment),c={level:r,timestamps:o,defaultModTime:t.modTime??(n?Ed:new Date)},l=t.thresholdBytes,u=Math.max(1,Math.floor(a)),d=Array(e.length);if(e.length>0){let t=0,n=Math.min(u,e.length),a=Array.from({length:n},async()=>{for(;;){let n=t++;if(n>=e.length)return;let a=e[n],o=a.level??r,{compressedData:s,deflate:u}=await kd(a,o,{level:o,thresholdBytes:l},i);d[n]=Nd(a,0,c,s,u)}});await Promise.all(a)}let f=0;for(let e=0;e<d.length;e++){let t=d[e];t.offset=f,f+=jd(t)}return Fd(d,s)}function Ld(e,t={}){let n=t.reproducible??!1,r=t.level??6,i=t.smartStore??!0,a=t.timestamps??`dos`,o=Dd(t.comment),s={level:r,timestamps:a,defaultModTime:t.modTime??(n?Ed:new Date)},c=t.thresholdBytes,l=[],u=0;for(let t of e){let e=t.level??r,{compressedData:n,deflate:a}=Ad(t,e,{level:e,thresholdBytes:c},i);u=Pd(l,t,n,a,u,s).nextOffset}return Fd(l,o)}function Rd(e,t,n){typeof e.off==`function`?e.off(t,n):typeof e.removeListener==`function`&&e.removeListener(t,n)}function zd(e,t){return new Promise((n,r)=>{let i=e=>{o(),r(e instanceof Error?e:Error(String(e)))},a=()=>{o(),n()},o=()=>{Rd(e,`error`,i),Rd(e,t,a)};if(typeof e.once==`function`){e.once(`error`,i),e.once(t,a);return}e.on?.(`error`,i),e.on?.(t,a)})}async function Bd(e,t){if(nt(t)){let n=t.getWriter();try{for await(let t of e)await n.write(t);await n.close()}finally{try{n.releaseLock()}catch{}}return}for await(let n of e)t.write(n)===!1&&typeof t.once==`function`&&await zd(t,`drain`);typeof t.end==`function`&&t.end(),typeof t.once==`function`&&await Promise.race([zd(t,`finish`),zd(t,`close`)])}async function Vd(e){let t=[],n=0;for await(let r of e)t.push(r),n+=r.length;return et(t,n)}function Hd(e){if(!e)return null;if(e instanceof Uint8Array)return e.length?e:null;if(typeof e==`string`){let t=Bs(e);return t.length?t:null}return e instanceof ArrayBuffer?e.byteLength?new Uint8Array(e):null:ArrayBuffer.isView(e)?e.byteLength?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null:typeof e.length==`number`&&e.length?e:null}function Ud(e){return e instanceof Uint8Array?e:typeof e==`string`?Bs(e):new Uint8Array(e)}async function Wd(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`)return Bs(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=await e.arrayBuffer();return new Uint8Array(t)}async function*Gd(e){if(e instanceof Uint8Array){yield e;return}if(typeof e==`string`){yield Bs(e);return}if(e instanceof ArrayBuffer){yield new Uint8Array(e);return}if(typeof Blob<`u`&&e instanceof Blob){yield await Wd(e);return}if(tt(e)){let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;let r=Hd(n);r&&(yield r)}}finally{try{t.releaseLock()}catch{}}}if(rt(e)){for await(let t of e){let e=Hd(t);e&&(yield e)}return}throw Error(`Unsupported archive source`)}function Kd(){let e=[],t=0,n=[],r=0,i=!1,a=null,o=()=>{t>1024&&t*2>e.length&&(e.splice(0,t),t=0),r>1024&&r*2>n.length&&(n.splice(0,r),r=0)},s=()=>{for(;r<n.length;){let e=n[r];if(n[r]=void 0,r++,e)return o(),e}o()},c=()=>{for(;t<e.length;){let n=e[t];if(e[t]=void 0,t++,n!==void 0)return o(),n}o()};return{push:t=>{if(i||a)return;let n=s();n?n.resolve({value:t,done:!1}):e.push(t)},fail:e=>{if(!(i||a))for(a=e;;){let t=s();if(!t)break;t.reject(e)}},close:()=>{if(!(i||a))for(i=!0;;){let e=s();if(!e)break;e.resolve({value:void 0,done:!0})}},iterable:{[Symbol.asyncIterator](){return{next(){if(a)return Promise.reject(a);let e=c();return e===void 0?i?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>n.push({resolve:e,reject:t})):Promise.resolve({value:e,done:!1})}}}}}}let qd=new Date(1980,0,1,0,0,0);var Jd=class{constructor(e={}){this._entries=[],this._sealed=!1;let t=e.reproducible??!1;this._options={level:e.level??6,timestamps:e.timestamps??`dos`,comment:e.comment,modTime:e.modTime??(t?qd:new Date),smartStore:e.smartStore??!0}}add(e,t,n){if(this._sealed)throw Error(`Cannot add entries after output has started`);if(!e)throw Error(`Entry name is required`);return this._entries.push({name:e,source:t,options:n}),this}stream(){this._sealed=!0;let e=Kd(),t=new vc((t,n,r)=>{if(t){e.fail(t);return}n.length&&e.push(n),r&&e.close()},{comment:this._options.comment});return(async()=>{try{for(let e of this._entries){let n=e.options?.level??this._options.level,r=new _c(e.name,{level:n,modTime:e.options?.modTime??this._options.modTime,timestamps:this._options.timestamps,comment:e.options?.comment,smartStore:this._options.smartStore});if(t.add(r),e.source instanceof Uint8Array||e.source instanceof ArrayBuffer||typeof e.source==`string`||typeof Blob<`u`&&e.source instanceof Blob){let t=await Wd(e.source);await r.push(t,!0)}else{for await(let t of Gd(e.source))await r.push(t,!1);await r.push(new Uint8Array,!0)}await r.complete()}t.end()}catch(t){e.fail(t instanceof Error?t:Error(String(t)))}})(),e.iterable}async bytes(){this._sealed=!0;let e=this._entries.every(e=>e.source instanceof Uint8Array||e.source instanceof ArrayBuffer||typeof e.source==`string`||typeof Blob<`u`&&e.source instanceof Blob),t=this._entries.some(e=>typeof Blob<`u`&&e.source instanceof Blob);return e?t?Id(await Promise.all(this._entries.map(async e=>({name:e.name,data:await Wd(e.source),level:e.options?.level,modTime:e.options?.modTime,comment:e.options?.comment}))),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore}):Ld(this._entries.map(e=>({name:e.name,data:Ud(e.source),level:e.options?.level,modTime:e.options?.modTime,comment:e.options?.comment})),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore}):Vd(this.stream())}bytesSync(){return this._sealed=!0,Ld(this._entries.map(e=>{if(!(e.source instanceof Uint8Array)&&!(e.source instanceof ArrayBuffer)&&typeof e.source!=`string`)throw Error(`bytesSync() only supports Uint8Array/ArrayBuffer/string sources`);return{name:e.name,data:Ud(e.source),modTime:e.options?.modTime,comment:e.options?.comment}}),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore})}async pipeTo(e){await Bd(this.stream(),e)}};function Yd(e){return new Jd(e)}let Xd=new Map;function Zd(e){let t=e??`utf-8`,n=Xd.get(t);if(n)return n;let r=new TextDecoder(t);return Xd.set(t,r),r}var Qd=class{constructor(e){e.kind===`buffer`?(this._parser=e.parser,this._info=e.info,this.path=e.info.path,this.isDirectory=e.info.isDirectory):(this._parseEntry=e.entry,this.path=e.entry.path,this.isDirectory=e.entry.type===`Directory`)}async bytes(){if(this._parser&&this._info)return await this._parser.extract(this._info.path)??new Uint8Array;if(this._parseEntry){let e=await this._parseEntry.buffer();return typeof Buffer<`u`&&e instanceof Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}return new Uint8Array}async*stream(){if(this._parser&&this._info){let e=await this.bytes();e.length&&(yield e);return}if(this._parseEntry)for await(let e of this._parseEntry)yield e}async pipeTo(e){await Bd(this.stream(),e)}async text(e){let t=await this.bytes();return Zd(e).decode(t)}discard(){this._parseEntry&&this._parseEntry.autodrain()}},$d=class{constructor(e,t={}){this._bufferParser=null,this._source=e,this._options=t}async _ensureBufferParser(){if(this._bufferParser)return this._bufferParser;if(this._source instanceof Uint8Array||this._source instanceof ArrayBuffer||typeof this._source==`string`||typeof Blob<`u`&&this._source instanceof Blob)return this._bufferParser=new Fc(await Wd(this._source),{decodeStrings:this._options.decodeStrings}),this._bufferParser;throw Error(`This ZIP source is streaming; random access is not available`)}async get(e){let t=await this._ensureBufferParser(),n=t.getEntry(e);return n?new Qd({kind:`buffer`,parser:t,info:n}):null}async*entries(){if(this._source instanceof Uint8Array||this._source instanceof ArrayBuffer||typeof this._source==`string`||typeof Blob<`u`&&this._source instanceof Blob){let e=await this._ensureBufferParser();for(let t of e.getEntries())yield new Qd({kind:`buffer`,parser:e,info:t});return}let e=Du({...this._options.parse??{},forceStream:!0}),t=(async()=>{try{for await(let t of Gd(this._source))await new Promise((n,r)=>{e.write(t,e=>{e?r(e):n()})});e.end(),await e.promise()}catch(t){throw e.destroy(t instanceof Error?t:Error(String(t))),t}})();try{for await(let t of e)yield new Qd({kind:`stream`,entry:t});await t}finally{await t.catch(()=>{})}}async bytes(e){let t=await this.get(e);return t?t.bytes():null}async close(){}};function ef(e,t){return new $d(e,t)}return e.Anchor=he,e.Cell=S,e.Column=fe,e.CsvFormatterStream=gl,e.CsvParserStream=hl,e.DataValidations=ye,e.DocumentType=s,e.Enums=u,e.ErrorValue=l,e.FormCheckbox=Ee,e.FormulaType=a,e.Image=ge,e.PaperSize=Pu,e.Range=r,e.ReadingOrder=c,e.RelationshipType=o,e.Row=de,e.Table=ve,e.UnzipEntry=Qd,e.ValueType=i,e.Workbook=Nu,e.WorkbookReader=Mu,e.WorkbookWriter=jl,e.Worksheet=Nt,e.WorksheetReader=ku,e.WorksheetWriter=Dl,e.ZipArchive=Jd,e.ZipReader=$d,e.aoaToSheet=Cd,e.bookAppendSheet=Sd,e.bookNew=xd,e.compress=yc,e.compressSync=bc,e.crc32=Ko,e.crc32Finalize=Go,e.crc32Update=Wo,e.createDeflateStream=Ps,e.createInflateStream=Ls,e.decodeCell=pd,e.decodeCol=ld,e.decodeRange=hd,e.decodeRow=dd,e.decompress=xc,e.decompressSync=Sc,e.encodeCell=md,e.encodeCol=ud,e.encodeRange=gd,e.encodeRow=fd,e.hasCompressionStream=hs,e.hasDeflateRaw=Os,e.jsonToSheet=_d,e.sheetAddAoa=wd,e.sheetAddJson=vd,e.sheetToAoa=Td,e.sheetToCsv=bd,e.sheetToJson=yd,e.unzip=ef,e.zip=Yd,e})({});
125
+ `)||i.includes(`\r`))&&(i=`"${i.replace(/"/g,`""`)}"`),o.push(i)});o.length<e.columnCount;)o.push(``);(!s||n.blankrows!==!1)&&a.push(o.join(r))}),a.join(i)}function Cd(){return new Fu}function wd(e,t,n){let r=e.addWorksheet(n);t.eachRow({includeEmpty:!0},(e,t)=>{e.eachCell({includeEmpty:!0},(e,n)=>{let i=r.getCell(t,n);i.value=e.value,e.style&&(i.style=e.style)})}),t.columns?.forEach((e,t)=>{e&&r.columns?.[t]&&e.width&&(r.getColumn(t+1).width=e.width)})}function Td(e,t){let n=new Fu().addWorksheet(`Sheet1`);if(e.length===0)return n;let r=1,i=1;if(t?.origin!==void 0)if(typeof t.origin==`string`){let e=hd(t.origin);r=e.r+1,i=e.c+1}else typeof t.origin==`number`?r=t.origin+1:(r=t.origin.r+1,i=t.origin.c+1);return e.forEach((e,t)=>{e&&e.forEach((e,a)=>{e!=null&&(n.getCell(r+t,i+a).value=e)})}),n}function Ed(e,t,n){if(t.length===0)return e;let r=1,i=1;if(n?.origin!==void 0)if(typeof n.origin==`string`){let e=hd(n.origin);r=e.r+1,i=e.c+1}else typeof n.origin==`number`?r=n.origin===-1?e.rowCount+1:n.origin+1:(r=n.origin.r+1,i=n.origin.c+1);return t.forEach((t,n)=>{t&&t.forEach((t,a)=>{t!=null&&(e.getCell(r+n,i+a).value=t)})}),e}function Dd(e){let t=[];return e.eachRow({includeEmpty:!0},(e,n)=>{let r=[];e.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),t[n-1]=r}),t}let Od=new Date(1980,0,1,0,0,0);function kd(e){return e?Us(e):new Uint8Array}function Ad(e,t){return e>0&&t.length>0}async function jd(e,t,n,r){if(!Ad(t,e.data))return{compressedData:e.data,deflate:!1};if(!r)return{compressedData:await xc(e.data,n),deflate:!0};if(vc(e.data))return{compressedData:e.data,deflate:!1};let i=await xc(e.data,n);return i.length>=e.data.length?{compressedData:e.data,deflate:!1}:{compressedData:i,deflate:!0}}function Md(e,t,n,r){if(!Ad(t,e.data))return{compressedData:e.data,deflate:!1};if(!r)return{compressedData:Sc(e.data,n),deflate:!0};if(vc(e.data))return{compressedData:e.data,deflate:!1};let i=Sc(e.data,n);return i.length>=e.data.length?{compressedData:e.data,deflate:!1}:{compressedData:i,deflate:!0}}function Nd(e){return 30+e.name.length+e.extraField.length+e.compressedData.length}function Pd(e){return 46+e.name.length+e.extraField.length+e.comment.length}function Fd(e,t,n,r,i){let a=e.modTime??n.defaultModTime,o=hc({name:e.name,comment:e.comment,modTime:a,timestamps:n.timestamps,useDataDescriptor:!1,deflate:i});return{name:o.nameBytes,uncompressedSize:e.data.length,compressedData:r,crc:Yo(e.data),compressionMethod:pc(i),modTime:o.dosTime,modDate:o.dosDate,extraField:o.extraField,comment:o.commentBytes,offset:t}}function Id(e,t,n,r,i,a){let o=Fd(t,i,a,n,r);return e.push(o),{processedEntry:o,nextOffset:i+Nd(o)}}function Ld(e,t){let n=0,r=0;for(let t of e)n+=Nd(t),r+=Pd(t);let i=n,a=n+r+22+t.length,o=new Uint8Array(a),s=new DataView(o.buffer,o.byteOffset,o.byteLength),c=0;for(let t of e)c+=oc(o,s,c,{fileName:t.name,extraField:t.extraField,flags:ac,compressionMethod:t.compressionMethod,dosTime:t.modTime,dosDate:t.modDate,crc32:t.crc,compressedSize:t.compressedData.length,uncompressedSize:t.uncompressedSize}),o.set(t.compressedData,c),c+=t.compressedData.length;for(let t of e)c+=cc(o,s,c,{fileName:t.name,extraField:t.extraField,comment:t.comment,flags:ac,compressionMethod:t.compressionMethod,dosTime:t.modTime,dosDate:t.modDate,crc32:t.crc,compressedSize:t.compressedData.length,uncompressedSize:t.uncompressedSize,localHeaderOffset:t.offset});return uc(o,s,c,{entryCount:e.length,centralDirSize:r,centralDirOffset:i,comment:t}),o}async function Rd(e,t={}){let n=t.reproducible??!1,r=t.level??6,i=t.smartStore??!0,a=t.concurrency??4,o=t.timestamps??`dos`,s=kd(t.comment),c={level:r,timestamps:o,defaultModTime:t.modTime??(n?Od:new Date)},l=t.thresholdBytes,u=Math.max(1,Math.floor(a)),d=Array(e.length);if(e.length>0){let t=0,n=Math.min(u,e.length),a=Array.from({length:n},async()=>{for(;;){let n=t++;if(n>=e.length)return;let a=e[n],o=a.level??r,{compressedData:s,deflate:u}=await jd(a,o,{level:o,thresholdBytes:l},i);d[n]=Fd(a,0,c,s,u)}});await Promise.all(a)}let f=0;for(let e=0;e<d.length;e++){let t=d[e];t.offset=f,f+=Nd(t)}return Ld(d,s)}function zd(e,t={}){let n=t.reproducible??!1,r=t.level??6,i=t.smartStore??!0,a=t.timestamps??`dos`,o=kd(t.comment),s={level:r,timestamps:a,defaultModTime:t.modTime??(n?Od:new Date)},c=t.thresholdBytes,l=[],u=0;for(let t of e){let e=t.level??r,{compressedData:n,deflate:a}=Md(t,e,{level:e,thresholdBytes:c},i);u=Id(l,t,n,a,u,s).nextOffset}return Ld(l,o)}function Bd(e,t,n){typeof e.off==`function`?e.off(t,n):typeof e.removeListener==`function`&&e.removeListener(t,n)}function Vd(e,t){return new Promise((n,r)=>{let i=e=>{o(),r(e instanceof Error?e:Error(String(e)))},a=()=>{o(),n()},o=()=>{Bd(e,`error`,i),Bd(e,t,a)};if(typeof e.once==`function`){e.once(`error`,i),e.once(t,a);return}e.on?.(`error`,i),e.on?.(t,a)})}async function Hd(e,t){if(ot(t)){let n=t.getWriter();try{for await(let t of e)await n.write(t);await n.close()}finally{try{n.releaseLock()}catch{}}return}for await(let n of e)t.write(n)===!1&&typeof t.once==`function`&&await Vd(t,`drain`);typeof t.end==`function`&&t.end(),typeof t.once==`function`&&await Promise.race([Vd(t,`finish`),Vd(t,`close`)])}async function Ud(e){let t=[],n=0;for await(let r of e)t.push(r),n+=r.length;return it(t,n)}function Wd(e){if(!e)return null;if(e instanceof Uint8Array)return e.length?e:null;if(typeof e==`string`){let t=Us(e);return t.length?t:null}return e instanceof ArrayBuffer?e.byteLength?new Uint8Array(e):null:ArrayBuffer.isView(e)?e.byteLength?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):null:typeof e.length==`number`&&e.length?e:null}function Gd(e){return e instanceof Uint8Array?e:typeof e==`string`?Us(e):new Uint8Array(e)}async function Kd(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`)return Us(e);if(e instanceof ArrayBuffer)return new Uint8Array(e);let t=await e.arrayBuffer();return new Uint8Array(t)}async function*qd(e){if(e instanceof Uint8Array){yield e;return}if(typeof e==`string`){yield Us(e);return}if(e instanceof ArrayBuffer){yield new Uint8Array(e);return}if(typeof Blob<`u`&&e instanceof Blob){yield await Kd(e);return}if(at(e)){let t=e.getReader();try{for(;;){let{done:e,value:n}=await t.read();if(e)return;let r=Wd(n);r&&(yield r)}}finally{try{t.releaseLock()}catch{}}}if(st(e)){for await(let t of e){let e=Wd(t);e&&(yield e)}return}throw Error(`Unsupported archive source`)}function Jd(){let e=[],t=0,n=[],r=0,i=!1,a=null,o=()=>{t>1024&&t*2>e.length&&(e.splice(0,t),t=0),r>1024&&r*2>n.length&&(n.splice(0,r),r=0)},s=()=>{for(;r<n.length;){let e=n[r];if(n[r]=void 0,r++,e)return o(),e}o()},c=()=>{for(;t<e.length;){let n=e[t];if(e[t]=void 0,t++,n!==void 0)return o(),n}o()};return{push:t=>{if(i||a)return;let n=s();n?n.resolve({value:t,done:!1}):e.push(t)},fail:e=>{if(!(i||a))for(a=e;;){let t=s();if(!t)break;t.reject(e)}},close:()=>{if(!(i||a))for(i=!0;;){let e=s();if(!e)break;e.resolve({value:void 0,done:!0})}},iterable:{[Symbol.asyncIterator](){return{next(){if(a)return Promise.reject(a);let e=c();return e===void 0?i?Promise.resolve({value:void 0,done:!0}):new Promise((e,t)=>n.push({resolve:e,reject:t})):Promise.resolve({value:e,done:!1})}}}}}}let Yd=new Date(1980,0,1,0,0,0);var Xd=class{constructor(e={}){this._entries=[],this._sealed=!1;let t=e.reproducible??!1;this._options={level:e.level??6,timestamps:e.timestamps??`dos`,comment:e.comment,modTime:e.modTime??(t?Yd:new Date),smartStore:e.smartStore??!0}}add(e,t,n){if(this._sealed)throw Error(`Cannot add entries after output has started`);if(!e)throw Error(`Entry name is required`);return this._entries.push({name:e,source:t,options:n}),this}stream(){this._sealed=!0;let e=Jd(),t=new bc((t,n,r)=>{if(t){e.fail(t);return}n.length&&e.push(n),r&&e.close()},{comment:this._options.comment});return(async()=>{try{for(let e of this._entries){let n=e.options?.level??this._options.level,r=new yc(e.name,{level:n,modTime:e.options?.modTime??this._options.modTime,timestamps:this._options.timestamps,comment:e.options?.comment,smartStore:this._options.smartStore});if(t.add(r),e.source instanceof Uint8Array||e.source instanceof ArrayBuffer||typeof e.source==`string`||typeof Blob<`u`&&e.source instanceof Blob){let t=await Kd(e.source);await r.push(t,!0)}else{for await(let t of qd(e.source))await r.push(t,!1);await r.push(new Uint8Array,!0)}await r.complete()}t.end()}catch(t){e.fail(t instanceof Error?t:Error(String(t)))}})(),e.iterable}async bytes(){this._sealed=!0;let e=this._entries.every(e=>e.source instanceof Uint8Array||e.source instanceof ArrayBuffer||typeof e.source==`string`||typeof Blob<`u`&&e.source instanceof Blob),t=this._entries.some(e=>typeof Blob<`u`&&e.source instanceof Blob);return e?t?Rd(await Promise.all(this._entries.map(async e=>({name:e.name,data:await Kd(e.source),level:e.options?.level,modTime:e.options?.modTime,comment:e.options?.comment}))),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore}):zd(this._entries.map(e=>({name:e.name,data:Gd(e.source),level:e.options?.level,modTime:e.options?.modTime,comment:e.options?.comment})),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore}):Ud(this.stream())}bytesSync(){return this._sealed=!0,zd(this._entries.map(e=>{if(!(e.source instanceof Uint8Array)&&!(e.source instanceof ArrayBuffer)&&typeof e.source!=`string`)throw Error(`bytesSync() only supports Uint8Array/ArrayBuffer/string sources`);return{name:e.name,data:Gd(e.source),modTime:e.options?.modTime,comment:e.options?.comment}}),{level:this._options.level,timestamps:this._options.timestamps,modTime:this._options.modTime,comment:this._options.comment,smartStore:this._options.smartStore})}async pipeTo(e){await Hd(this.stream(),e)}};function Zd(e){return new Xd(e)}let Qd=new Map;function $d(e){let t=e??`utf-8`,n=Qd.get(t);if(n)return n;let r=new TextDecoder(t);return Qd.set(t,r),r}var ef=class{constructor(e){e.kind===`buffer`?(this._parser=e.parser,this._info=e.info,this.path=e.info.path,this.isDirectory=e.info.isDirectory):(this._parseEntry=e.entry,this.path=e.entry.path,this.isDirectory=e.entry.type===`Directory`)}async bytes(){if(this._parser&&this._info)return await this._parser.extract(this._info.path)??new Uint8Array;if(this._parseEntry){let e=await this._parseEntry.buffer();return typeof Buffer<`u`&&e instanceof Buffer?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e}return new Uint8Array}async*stream(){if(this._parser&&this._info){let e=await this.bytes();e.length&&(yield e);return}if(this._parseEntry)for await(let e of this._parseEntry)yield e}async pipeTo(e){await Hd(this.stream(),e)}async text(e){let t=await this.bytes();return $d(e).decode(t)}discard(){this._parseEntry&&this._parseEntry.autodrain()}},tf=class{constructor(e,t={}){this._bufferParser=null,this._source=e,this._options=t}async _ensureBufferParser(){if(this._bufferParser)return this._bufferParser;if(this._source instanceof Uint8Array||this._source instanceof ArrayBuffer||typeof this._source==`string`||typeof Blob<`u`&&this._source instanceof Blob)return this._bufferParser=new Lc(await Kd(this._source),{decodeStrings:this._options.decodeStrings}),this._bufferParser;throw Error(`This ZIP source is streaming; random access is not available`)}async get(e){let t=await this._ensureBufferParser(),n=t.getEntry(e);return n?new ef({kind:`buffer`,parser:t,info:n}):null}async*entries(){if(this._source instanceof Uint8Array||this._source instanceof ArrayBuffer||typeof this._source==`string`||typeof Blob<`u`&&this._source instanceof Blob){let e=await this._ensureBufferParser();for(let t of e.getEntries())yield new ef({kind:`buffer`,parser:e,info:t});return}let e=ku({...this._options.parse??{},forceStream:!0}),t=(async()=>{try{for await(let t of qd(this._source))await new Promise((n,r)=>{e.write(t,e=>{e?r(e):n()})});e.end(),await e.promise()}catch(t){throw e.destroy(t instanceof Error?t:Error(String(t))),t}})();try{for await(let t of e)yield new ef({kind:`stream`,entry:t});await t}finally{await t.catch(()=>{})}}async bytes(e){let t=await this.get(e);return t?t.bytes():null}async close(){}};function nf(e,t){return new tf(e,t)}return e.Anchor=he,e.Cell=S,e.Column=fe,e.CsvFormatterStream=vl,e.CsvParserStream=_l,e.DataValidations=Ce,e.DocumentType=s,e.Enums=u,e.ErrorValue=l,e.FormCheckbox=Ae,e.FormulaType=a,e.Image=ge,e.PaperSize=Iu,e.Range=r,e.ReadingOrder=c,e.RelationshipType=o,e.Row=de,e.Table=Se,e.UnzipEntry=ef,e.ValueType=i,e.Workbook=Fu,e.WorkbookReader=Pu,e.WorkbookWriter=Nl,e.Worksheet=Lt,e.WorksheetReader=ju,e.WorksheetWriter=kl,e.ZipArchive=Xd,e.ZipReader=tf,e.aoaToSheet=Td,e.bookAppendSheet=wd,e.bookNew=Cd,e.compress=xc,e.compressSync=Sc,e.crc32=Yo,e.crc32Finalize=Jo,e.crc32Update=qo,e.createDeflateStream=Ls,e.createInflateStream=Bs,e.decodeCell=hd,e.decodeCol=dd,e.decodeRange=_d,e.decodeRow=pd,e.decompress=Cc,e.decompressSync=wc,e.encodeCell=gd,e.encodeCol=fd,e.encodeRange=vd,e.encodeRow=md,e.hasCompressionStream=vs,e.hasDeflateRaw=js,e.jsonToSheet=yd,e.sheetAddAoa=Ed,e.sheetAddJson=bd,e.sheetToAoa=Dd,e.sheetToCsv=Sd,e.sheetToJson=xd,e.unzip=nf,e.zip=Zd,e})({});