@cj-tech-master/excelts 1.1.0 → 1.4.1

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 (41) hide show
  1. package/dist/browser/excelts.iife.js +1089 -568
  2. package/dist/browser/excelts.iife.js.map +1 -1
  3. package/dist/browser/excelts.iife.min.js +18 -18
  4. package/dist/cjs/doc/data-validations.js +29 -1
  5. package/dist/cjs/index.js +1 -1
  6. package/dist/cjs/utils/cell-format.js +815 -0
  7. package/dist/cjs/utils/parse-sax.js +2 -2
  8. package/dist/cjs/utils/{extra-utils.js → sheet-utils.js} +114 -89
  9. package/dist/cjs/utils/stream-buf.js +15 -4
  10. package/dist/cjs/utils/unzip/parse.js +82 -1
  11. package/dist/cjs/utils/utils.js +13 -17
  12. package/dist/cjs/utils/zip-stream.js +20 -32
  13. package/dist/cjs/xlsx/xform/sheet/data-validations-xform.js +46 -7
  14. package/dist/cjs/xlsx/xlsx.js +1 -2
  15. package/dist/esm/doc/data-validations.js +29 -1
  16. package/dist/esm/index.browser.js +1 -1
  17. package/dist/esm/index.js +1 -1
  18. package/dist/esm/utils/cell-format.js +810 -0
  19. package/dist/esm/utils/parse-sax.js +1 -1
  20. package/dist/esm/utils/{extra-utils.js → sheet-utils.js} +97 -72
  21. package/dist/esm/utils/stream-buf.js +15 -4
  22. package/dist/esm/utils/unzip/parse.js +83 -2
  23. package/dist/esm/utils/utils.js +12 -16
  24. package/dist/esm/utils/zip-stream.js +20 -32
  25. package/dist/esm/xlsx/xform/sheet/data-validations-xform.js +46 -7
  26. package/dist/esm/xlsx/xlsx.js +1 -2
  27. package/dist/types/index.browser.d.ts +1 -1
  28. package/dist/types/index.d.ts +1 -1
  29. package/dist/types/utils/cell-format.d.ts +32 -0
  30. package/dist/types/utils/{extra-utils.d.ts → sheet-utils.d.ts} +51 -52
  31. package/dist/types/utils/utils.d.ts +5 -2
  32. package/package.json +5 -5
  33. package/dist/cjs/utils/browser-buffer-decode.js +0 -13
  34. package/dist/cjs/utils/browser-buffer-encode.js +0 -13
  35. package/dist/cjs/utils/browser.js +0 -6
  36. package/dist/esm/utils/browser-buffer-decode.js +0 -11
  37. package/dist/esm/utils/browser-buffer-encode.js +0 -11
  38. package/dist/esm/utils/browser.js +0 -3
  39. package/dist/types/utils/browser-buffer-decode.d.ts +0 -2
  40. package/dist/types/utils/browser-buffer-encode.d.ts +0 -2
  41. package/dist/types/utils/browser.d.ts +0 -1
@@ -1,10 +1,10 @@
1
1
  /*!
2
- * @cj-tech-master/excelts v1.1.0
2
+ * @cj-tech-master/excelts v1.4.1
3
3
  * TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
4
4
  * (c) 2025 cjnoname
5
5
  * Released under the MIT License
6
6
  */
7
- var ExcelTS=(function(e){var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t&&n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>o.call(e,`module.exports`)?e[`module.exports`]:u(n({},`__esModule`,{value:!0}),e);let p=/^[A-Z]+\d+$/,m={_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(!p.test(e))throw Error(`Invalid Address: ${e}`);return!0},decodeAddress(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){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){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 m.n2l(t)+e},encode(...e){switch(e.length){case 2:return m.encodeAddress(e[0],e[1]);case 4:return`${m.encodeAddress(e[0],e[1])}:${m.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 h=class e{constructor(...e){this.decode(e)}setTLBR(e,t,n,r,i){if(arguments.length<4){let r=m.decodeAddress(e),a=m.decodeAddress(t);this.model={top:Math.min(r.row,a.row),left:Math.min(r.col,a.col),bottom:Math.max(r.row,a.row),right:Math.max(r.col,a.col),sheetName:n},this.setTLBR(r.row,r.col,a.row,a.col,i)}else this.model={top:Math.min(e,n),left:Math.min(t,r),bottom:Math.max(e,n),right:Math.max(t,r),sheetName:i}}decode(t){switch(t.length){case 5:this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:this.setTLBR(t[0],t[1],t[2]);break;case 2:this.setTLBR(t[0],t[1]);break;case 1:{let n=t[0];if(n instanceof e)this.model={top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right,sheetName:n.sheetName};else if(n instanceof Array)this.decode(n);else if(n.top&&n.left&&n.bottom&&n.right)this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName};else{let e=m.decodeEx(n);e.top?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}: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=m.decodeEx(e);this.expand(t.row,t.col,t.row,t.col)}get tl(){return m.n2l(this.left)+this.top}get $t$l(){return`$${m.n2l(this.left)}$${this.top}`}get br(){return m.n2l(this.right)+this.bottom}get $b$r(){return`$${m.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=m.decodeEx(e);return this.containsEx(t)}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 n=this.top;n<=this.bottom;n++)e(m.encodeAddress(n,t),n,t)}};let g=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}({}),_=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),v=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}({}),y=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),b=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),x={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},S={ValueType:g,FormulaType:_,RelationshipType:v,DocumentType:y,ReadingOrder:b,ErrorValue:x},{toString:C}=Object.prototype,w=/["&<>]/;function T(e,t){let n=typeof e,r=typeof t,i=Array.isArray(e),a=Array.isArray(t),o;if(n!==r)return!1;switch(typeof e){case`object`:if(i||a)return i&&a?e.length===t.length&&e.every((e,n)=>{let r=t[n];return T(e,r)}):!1;if(e===null||t===null)return e===t;if(o=Object.keys(e),Object.keys(t).length!==o.length)return!1;for(let e of o)if(!Object.prototype.hasOwnProperty.call(t,e))return!1;return o.every(n=>{let r=e[n],i=t[n];return T(r,i)});default:return e===t}}function E(e){let t=w.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){switch(e.charAt(a)){case`"`:r=`&quot;`;break;case`&`:r=`&amp;`;break;case`<`:r=`&lt;`;break;case`>`:r=`&gt;`;break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=r}return i===a?n:n+e.substring(i,a)}function D(e){return C.call(e)===`[object Undefined]`}function O(e){return C.call(e)===`[object Object]`}function k(...e){let t=e[0]||{},{length:n}=e,r,i,a;function o(e,n){r=t[n],a=Array.isArray(e),O(e)||a?(a?(a=!1,i=r&&Array.isArray(r)?r:[]):i=r&&O(r)?r:{},t[n]=k(i,e)):D(e)||(t[n]=e)}for(let t=0;t<n;t++){let n=e[t];n&&(Array.isArray(n)?n.forEach((e,t)=>o(e,t)):Object.entries(n).forEach(([e,t])=>{e===`__proto__`||e===`constructor`||e===`prototype`||o(t,e)}))}return t}var A=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 k({},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 ee=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,j=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function M(e,t,n){let r=m.decode(t),i=m.decode(n);return e.replace(ee,(e,t,n,a,o)=>{if(o)return e;let s=j.exec(a);if(s){let n=s[1],a=s[2].toUpperCase(),o=s[3],c=s[4];if(a.length>3||a.length===3&&a>`XFD`)return e;let l=m.l2n(a),u=parseInt(c,10);return n||(l+=i.col-r.col),o||(u+=i.row-r.row),(t||``)+(n||``)+m.n2l(l)+(o||``)+u}return e})}var N=class e{static{this.Types=S.ValueType}constructor(t,n,r){if(!t||!n)throw Error(`A Cell needs a Row`);this._row=t,this._column=n,m.validateAddress(r),this._address=r,this._value=H.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,n.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&&e.font||t&&t.font;i&&(n.font=i);let a=e&&e.alignment||t&&t.alignment;a&&(n.alignment=a);let o=e&&e.border||t&&t.border;o&&(n.border=o);let s=e&&e.fill||t&&t.fill;s&&(n.fill=s);let c=e&&e.protection||t&&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=H.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=H.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.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=H.create(H.getType(t),this,t)}get note(){return this._comment&&this._comment.note}set note(e){this._comment=new A(e)}get text(){return this._value.toString()}get html(){return E(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=H.create(e.Types.Hyperlink,this,{text: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=H.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=A.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},P=class{constructor(e){this.model={address:e.address,type:N.Types.Null}}get value(){return null}set value(e){}get type(){return N.Types.Null}get effectiveType(){return N.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},F=class{constructor(e,t){this.model={address:e.address,type:N.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Number}get effectiveType(){return N.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()}},te=class{constructor(e,t){this.model={address:e.address,type:N.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.String}get effectiveType(){return N.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}},I=class{constructor(e,t){this.model={address:e.address,type:N.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 N.Types.RichText}get effectiveType(){return N.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(){}},L=class{constructor(e,t){this.model={address:e.address,type:N.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Date}get effectiveType(){return N.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()}},ne=class{constructor(e,t){this.model={address:e.address,type:N.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){let e={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(e.tooltip=this.model.tooltip),e}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 N.Types.Hyperlink}get effectiveType(){return N.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||``}},R=class{constructor(e,t){this.model={address:e.address,type:N.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 N?(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 N.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()}},z=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:N.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={},n=n=>{let r=e[n];r&&(t[n]=r)};return n(`formula`),n(`result`),n(`ref`),n(`shareType`),n(`sharedFormula`),t}get value(){return this._copyModel(this.model)}set value(e){this.model=this._copyModel(e)}validate(e){switch(H.getType(e)){case N.Types.Null:case N.Types.String:case N.Types.Number:case N.Types.Date:break;case N.Types.Hyperlink:case N.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?S.FormulaType.Master:this.model.sharedFormula?S.FormulaType.Shared:S.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return N.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?S.ValueType.Null:e instanceof String||typeof e==`string`?S.ValueType.String:typeof e==`number`?S.ValueType.Number:e instanceof Date?S.ValueType.Date:e.text&&e.hyperlink?S.ValueType.Hyperlink:e.formula?S.ValueType.Formula:S.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&&M(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():``}},re=class{constructor(e,t){this.model={address:e.address,type:N.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.SharedString}get effectiveType(){return N.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()}},B=class{constructor(e,t){this.model={address:e.address,type:N.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Boolean}get effectiveType(){return N.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()}},V=class{constructor(e,t){this.model={address:e.address,type:N.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Error}get effectiveType(){return N.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()}},ie=class{constructor(e,t){this.model={address:e.address,type:N.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 N.Types.String}get effectiveType(){return N.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 H={getType(e){return e==null?N.Types.Null:e instanceof String||typeof e==`string`?N.Types.String:typeof e==`number`?N.Types.Number:typeof e==`boolean`?N.Types.Boolean:e instanceof Date?N.Types.Date:e.text&&e.hyperlink?N.Types.Hyperlink:e.formula||e.sharedFormula?N.Types.Formula:e.richText?N.Types.RichText:e.sharedString?N.Types.SharedString:e.error?N.Types.Error:N.Types.JSON},types:[{t:N.Types.Null,f:P},{t:N.Types.Number,f:F},{t:N.Types.String,f:te},{t:N.Types.Date,f:L},{t:N.Types.Hyperlink,f:ne},{t:N.Types.Formula,f:z},{t:N.Types.Merge,f:R},{t:N.Types.JSON,f:ie},{t:N.Types.SharedString,f:re},{t:N.Types.RichText,f:I},{t:N.Types.Boolean,f:B},{t:N.Types.Error,f:V}].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)}};var U=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 N(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let t;if(typeof e==`string`){let n=this._worksheet.getColumnKey(e);t=n?n.number:m.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:m.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=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=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){if(t||(t=e,e=null),e&&e.includeEmpty){let e=this._cells.length;for(let n=1;n<=e;n++)t(this.getCell(n),n)}else this._cells.forEach((e,n)=>{e&&e.type!==S.ValueType.Null&&t(e,n+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!==S.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,n)=>{e!==void 0&&(this.getCellEx({address:m.encodeAddress(this._number,n+t),row:this._number,col:n+t}).value=e)})}else this._worksheet.eachColumnKey((t,n)=>{e[n]!==void 0&&(this.getCellEx({address:m.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}get hasValues(){return this._cells.some(e=>e&&e.type!==S.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!==S.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){return this.style[e]=t,this._cells.forEach(n=>{n&&(n[e]=t)}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){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||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}: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 N.Types.Merge:break;default:{let n;if(e.address)n=m.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:m.encodeAddress(e,r),$col$row:`$${m.n2l(r)}$${e}`}}t=n;let r=this.getCellEx(n);r.model=e;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},ae=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 m.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}}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):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[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&&T(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)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;t||(t=e,e=null),this._worksheet.eachRow(e,(e,r)=>{t(e.getCell(n),r)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==S.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})}_applyStyle(e,t){return this.style[e]=t,this.eachCell(n=>{n[e]=t}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){this._applyStyle(`fill`,e)}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentTo(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},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){n||=[];let r=[],i=1,a=0;for(n=n.sort(function(e,t){return e.min-t.min});a<n.length;){let o=n[a++];for(;i<o.min;)r.push(new e(t,i++));for(;i<=o.max;)r.push(new e(t,i++,o))}return r.length?r:null}},W=class e{constructor(e,t,n=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=m.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else if(t.nativeCol!==void 0){let e=t;this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0}else if(t.col!==void 0){let e=t;this.col=e.col+n,this.row=e.row+n}else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(t){return t instanceof e||t==null?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}},G=class{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:n,hyperlinks:r}){if(this.type=e,this.imageId=t,e===`image`)if(typeof n==`string`){let e=m.decode(n);this.range={tl:new W(this.worksheet,{col:e.left,row:e.top},-1),br:new W(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`}}else this.range={tl:new W(this.worksheet,n.tl,0),br:n.br&&new W(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:r||n.hyperlinks}}},oe=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)}},K=class{constructor(e,t){this.worksheet=e,t&&(this.table=t,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 n=(e,t)=>{if(!e)throw Error(t)};n(!!e.ref,`Table must have ref`),n(!!e.columns,`Table must have column definitions`),n(!!e.rows,`Table must have row definitions`),e.tl=m.decodeAddress(e.ref);let{row:r,col:i}=e.tl;n(r>0,`Table must be on valid row`),n(i>0,`Table must be on valid col`);let{width:a,filterHeight:o,tableHeight:s}=this;e.autoFilterRef=m.encode(r,i,r+o-1,i+a-1),e.tableRef=m.encode(r,i,r+s-1,i+a-1),e.columns.forEach((e,r)=>{n(!!e.name,`Column ${r} must have a name`),r===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)||void 0)})}store(){let e=(e,t)=>{t&&Object.keys(t).forEach(n=>{e.style[n]=t[n]})},{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);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=m.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()}addRow(e,t){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e)}removeRows(e,t=1){this.cacheState(),this.table.rows.splice(e,t)}getColumn(e){let t=this.table.columns[e];return new oe(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.name}set theme(e){this.table.style.name=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}},se=class{constructor(e){this.model=e||{}}add(e,t){return this.model[e]=t}find(e){return this.model[e]}remove(e){this.model[e]=void 0}},ce=c((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),le=c((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),q=c((e=>{var t=ce(),n=le(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ae(e,ArrayBuffer)||e&&ae(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(ae(e,SharedArrayBuffer)||e&&ae(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);var r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);var i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);var n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){for(var t=e.length<0?0:_(e.length)|0,n=o(t),r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(ae(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);var r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n);return Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){var t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||W(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(ae(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),ae(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(ae(a,Uint8Array))i+a.length>r.length?s.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else if(s.isBuffer(a))a.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=a.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ae(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);var n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;for(var i=!1;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return B(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return H(e).length;default:if(i)return r?-1:B(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return F(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(var t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(var t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(var t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){var t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(ae(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n),d=0;d<c;++d)if(l[d]!==u[d]){a=l[d],o=u[d];break}return a<o?-1:o<a?1:0};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,W(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){var a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}var l;if(i){var u=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===s)return u*a}else u!==-1&&(l-=l-u),u=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){for(var d=!0,f=0;f<s;f++)if(c(e,l+f)!==c(t,f)){d=!1;break}if(d)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(o*2,2),16);if(W(s))return o;e[n+o]=s}return o}function T(e,t,n,r){return U(B(t,e.length-n),e,n,r)}function E(e,t,n,r){return U(V(t),e,n,r)}function D(e,t,n,r){return U(H(t),e,n,r)}function O(e,t,n,r){return U(ie(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;for(var a=!1;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,d;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],(c&192)==128&&(d=(a&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)==128&&(l&192)==128&&(d=(a&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],(c&192)==128&&(l&192)==128&&(u&192)==128&&(d=(a&15)<<18|(c&63)<<12|(l&63)<<6|u&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=s}return j(r)}var ee=4096;function j(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function M(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i=``,a=t;a<n;++a)i+=G[e[a]];return i}function F(e,t,n){for(var r=e.slice(t,n),i=``,a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function te(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||te(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||te(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||te(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||te(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||te(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||te(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||te(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||te(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||te(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||te(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||te(e,8,this.length),n.read(this,e,!1,52,8)};function I(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=2**(8*n)-1;I(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=2**(8*n)-1;I(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=2**(8*n-1);I(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=2**(8*n-1);I(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function L(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ne(e,t,r,i,a){return t=+t,r>>>=0,a||L(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ne(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ne(this,e,t,!1,n)};function R(e,t,r,i,a){return t=+t,r>>>=0,a||L(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return R(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return R(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){var i=e.charCodeAt(0);(r===`utf8`&&i<128||r===`latin1`)&&(e=i)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;var a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{var o=s.isBuffer(e)?e:s.from(e,r),c=o.length;if(c===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(a=0;a<n-t;++a)this[a+t]=o[a%c]}return this};var z=/[^+/0-9A-Za-z-_]/g;function re(e){if(e=e.split(`=`)[0],e=e.trim().replace(z,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function B(e,t){t||=1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function V(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ie(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function H(e){return t.toByteArray(re(e))}function U(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ae(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function W(e){return e!==e}var G=(function(){for(var e=`0123456789abcdef`,t=Array(256),n=0;n<16;++n)for(var r=n*16,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t})()}));function ue(){throw Error(`setTimeout has not been defined`)}function de(){throw Error(`clearTimeout has not been defined`)}function fe(e){if(Z===setTimeout)return setTimeout(e,0);if((Z===ue||!Z)&&setTimeout)return Z=setTimeout,setTimeout(e,0);try{return Z(e,0)}catch{try{return Z.call(null,e,0)}catch{return Z.call(this,e,0)}}}function pe(e){if(ve===clearTimeout)return clearTimeout(e);if((ve===de||!ve)&&clearTimeout)return ve=clearTimeout,clearTimeout(e);try{return ve(e)}catch{try{return ve.call(null,e)}catch{return ve.call(this,e)}}}function me(){!be||!xe||(be=!1,xe.length?ye=xe.concat(ye):Se=-1,ye.length&&he())}function he(){if(!be){var e=fe(me);be=!0;for(var t=ye.length;t;){for(xe=ye,ye=[];++Se<t;)xe&&xe[Se].run();Se=-1,t=ye.length}xe=null,be=!1,pe(e)}}function ge(e,t){this.fun=e,this.array=t}function J(){}function Y(){}var _e,X,Z,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Q,Re=s((()=>{_e={exports:{}},X=_e.exports={},(function(){try{Z=typeof setTimeout==`function`?setTimeout:ue}catch{Z=ue}try{ve=typeof clearTimeout==`function`?clearTimeout:de}catch{ve=de}})(),ye=[],be=!1,Se=-1,X.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ye.push(new ge(e,t)),ye.length===1&&!be&&fe(he)},ge.prototype.run=function(){this.fun.apply(null,this.array)},X.title=`browser`,X.browser=!0,X.env={},X.argv=[],X.version=``,X.versions={},X.on=J,X.addListener=J,X.once=J,X.off=J,X.removeListener=J,X.removeAllListeners=J,X.emit=J,X.prependListener=J,X.prependOnceListener=J,X.listeners=function(e){return[]},X.binding=function(e){throw Error(`process.binding is not supported`)},X.cwd=function(){return`/`},X.chdir=function(e){throw Error(`process.chdir is not supported`)},X.umask=function(){return 0},Ce=_e.exports.browser,we=Y,Te=_e.exports.binding,Ee=Y,De=1,Oe={},ke=Y,Ae=Y,je=Y,Me=Y,Ne=Y,Pe=`browser`,Fe=`browser`,Ie=`browser`,Le=[],Q={nextTick:_e.exports.nextTick,title:_e.exports.title,browser:Ce,env:_e.exports.env,argv:_e.exports.argv,version:_e.exports.version,versions:_e.exports.versions,on:_e.exports.on,addListener:_e.exports.addListener,once:_e.exports.once,off:_e.exports.off,removeListener:_e.exports.removeListener,removeAllListeners:_e.exports.removeAllListeners,emit:_e.exports.emit,emitWarning:we,prependListener:_e.exports.prependListener,prependOnceListener:_e.exports.prependOnceListener,listeners:_e.exports.listeners,binding:Te,cwd:_e.exports.cwd,chdir:_e.exports.chdir,umask:_e.exports.umask,exit:Ee,pid:De,features:Oe,kill:ke,dlopen:Ae,uptime:je,memoryUsage:Me,uvCounters:Ne,platform:Pe,arch:Fe,execPath:Ie,execArgv:Le},_e.exports.addListener,_e.exports.argv,_e.exports.chdir,_e.exports.cwd,_e.exports.emit,_e.exports.env,_e.exports.listeners,_e.exports.nextTick,_e.exports.off,_e.exports.on,_e.exports.once,_e.exports.prependListener,_e.exports.prependOnceListener,_e.exports.removeAllListeners,_e.exports.removeListener,_e.exports.title,_e.exports.umask,_e.exports.version,_e.exports.versions})),ze=c(((e,t)=>{
7
+ var ExcelTS=(function(e){var t=Object.create,n=Object.defineProperty,r=Object.getOwnPropertyDescriptor,i=Object.getOwnPropertyNames,a=Object.getPrototypeOf,o=Object.prototype.hasOwnProperty,s=(e,t)=>()=>(e&&(t=e(e=0)),t),c=(e,t)=>()=>(t||e((t={exports:{}}).exports,t),t.exports),l=(e,t)=>{let r={};for(var i in e)n(r,i,{get:e[i],enumerable:!0});return t&&n(r,Symbol.toStringTag,{value:`Module`}),r},u=(e,t,a,s)=>{if(t&&typeof t==`object`||typeof t==`function`)for(var c=i(t),l=0,u=c.length,d;l<u;l++)d=c[l],!o.call(e,d)&&d!==a&&n(e,d,{get:(e=>t[e]).bind(null,d),enumerable:!(s=r(t,d))||s.enumerable});return e},d=(e,r,i)=>(i=e==null?{}:t(a(e)),u(r||!e||!e.__esModule?n(i,`default`,{value:e,enumerable:!0}):i,e)),f=e=>o.call(e,`module.exports`)?e[`module.exports`]:u(n({},`__esModule`,{value:!0}),e);let p=/^[A-Z]+\d+$/,m={_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(!p.test(e))throw Error(`Invalid Address: ${e}`);return!0},decodeAddress(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){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){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 m.n2l(t)+e},encode(...e){switch(e.length){case 2:return m.encodeAddress(e[0],e[1]);case 4:return`${m.encodeAddress(e[0],e[1])}:${m.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 h=class e{constructor(...e){this.decode(e)}setTLBR(e,t,n,r,i){if(arguments.length<4){let r=m.decodeAddress(e),a=m.decodeAddress(t);this.model={top:Math.min(r.row,a.row),left:Math.min(r.col,a.col),bottom:Math.max(r.row,a.row),right:Math.max(r.col,a.col),sheetName:n},this.setTLBR(r.row,r.col,a.row,a.col,i)}else this.model={top:Math.min(e,n),left:Math.min(t,r),bottom:Math.max(e,n),right:Math.max(t,r),sheetName:i}}decode(t){switch(t.length){case 5:this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:this.setTLBR(t[0],t[1],t[2]);break;case 2:this.setTLBR(t[0],t[1]);break;case 1:{let n=t[0];if(n instanceof e)this.model={top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right,sheetName:n.sheetName};else if(n instanceof Array)this.decode(n);else if(n.top&&n.left&&n.bottom&&n.right)this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName};else{let e=m.decodeEx(n);e.top?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}: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=m.decodeEx(e);this.expand(t.row,t.col,t.row,t.col)}get tl(){return m.n2l(this.left)+this.top}get $t$l(){return`$${m.n2l(this.left)}$${this.top}`}get br(){return m.n2l(this.right)+this.bottom}get $b$r(){return`$${m.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=m.decodeEx(e);return this.containsEx(t)}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 n=this.top;n<=this.bottom;n++)e(m.encodeAddress(n,t),n,t)}};let g=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}({}),_=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),v=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}({}),y=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),b=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),x={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},S={ValueType:g,FormulaType:_,RelationshipType:v,DocumentType:y,ReadingOrder:b,ErrorValue:x},{toString:C}=Object.prototype,w=/["&<>]/;function T(e,t){let n=typeof e,r=typeof t,i=Array.isArray(e),a=Array.isArray(t),o;if(n!==r)return!1;switch(typeof e){case`object`:if(i||a)return i&&a?e.length===t.length&&e.every((e,n)=>{let r=t[n];return T(e,r)}):!1;if(e===null||t===null)return e===t;if(o=Object.keys(e),Object.keys(t).length!==o.length)return!1;for(let e of o)if(!Object.prototype.hasOwnProperty.call(t,e))return!1;return o.every(n=>{let r=e[n],i=t[n];return T(r,i)});default:return e===t}}function E(e){let t=w.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){switch(e.charAt(a)){case`"`:r=`&quot;`;break;case`&`:r=`&amp;`;break;case`<`:r=`&lt;`;break;case`>`:r=`&gt;`;break;default:continue}i!==a&&(n+=e.substring(i,a)),i=a+1,n+=r}return i===a?n:n+e.substring(i,a)}function D(e){return C.call(e)===`[object Undefined]`}function O(e){return C.call(e)===`[object Object]`}function k(...e){let t=e[0]||{},{length:n}=e,r,i,a;function o(e,n){r=t[n],a=Array.isArray(e),O(e)||a?(a?(a=!1,i=r&&Array.isArray(r)?r:[]):i=r&&O(r)?r:{},t[n]=k(i,e)):D(e)||(t[n]=e)}for(let t=0;t<n;t++){let n=e[t];n&&(Array.isArray(n)?n.forEach((e,t)=>o(e,t)):Object.entries(n).forEach(([e,t])=>{e===`__proto__`||e===`constructor`||e===`prototype`||o(t,e)}))}return t}var A=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 k({},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 ee=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,j=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function M(e,t,n){let r=m.decode(t),i=m.decode(n);return e.replace(ee,(e,t,n,a,o)=>{if(o)return e;let s=j.exec(a);if(s){let n=s[1],a=s[2].toUpperCase(),o=s[3],c=s[4];if(a.length>3||a.length===3&&a>`XFD`)return e;let l=m.l2n(a),u=parseInt(c,10);return n||(l+=i.col-r.col),o||(u+=i.row-r.row),(t||``)+(n||``)+m.n2l(l)+(o||``)+u}return e})}var N=class e{static{this.Types=S.ValueType}constructor(t,n,r){if(!t||!n)throw Error(`A Cell needs a Row`);this._row=t,this._column=n,m.validateAddress(r),this._address=r,this._value=H.create(e.Types.Null,this),this.style=this._mergeStyle(t.style,n.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&&e.font||t&&t.font;i&&(n.font=i);let a=e&&e.alignment||t&&t.alignment;a&&(n.alignment=a);let o=e&&e.border||t&&t.border;o&&(n.border=o);let s=e&&e.fill||t&&t.fill;s&&(n.fill=s);let c=e&&e.protection||t&&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=H.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=H.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.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=H.create(H.getType(t),this,t)}get note(){return this._comment&&this._comment.note}set note(e){this._comment=new A(e)}get text(){return this._value.toString()}get html(){return E(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=H.create(e.Types.Hyperlink,this,{text: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=H.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=A.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},P=class{constructor(e){this.model={address:e.address,type:N.Types.Null}}get value(){return null}set value(e){}get type(){return N.Types.Null}get effectiveType(){return N.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},F=class{constructor(e,t){this.model={address:e.address,type:N.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Number}get effectiveType(){return N.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()}},te=class{constructor(e,t){this.model={address:e.address,type:N.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.String}get effectiveType(){return N.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}},I=class{constructor(e,t){this.model={address:e.address,type:N.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 N.Types.RichText}get effectiveType(){return N.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(){}},L=class{constructor(e,t){this.model={address:e.address,type:N.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Date}get effectiveType(){return N.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()}},ne=class{constructor(e,t){this.model={address:e.address,type:N.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){let e={text:this.model.text,hyperlink:this.model.hyperlink};return this.model.tooltip&&(e.tooltip=this.model.tooltip),e}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 N.Types.Hyperlink}get effectiveType(){return N.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||``}},R=class{constructor(e,t){this.model={address:e.address,type:N.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 N?(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 N.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()}},z=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:N.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={},n=n=>{let r=e[n];r&&(t[n]=r)};return n(`formula`),n(`result`),n(`ref`),n(`shareType`),n(`sharedFormula`),t}get value(){return this._copyModel(this.model)}set value(e){this.model=this._copyModel(e)}validate(e){switch(H.getType(e)){case N.Types.Null:case N.Types.String:case N.Types.Number:case N.Types.Date:break;case N.Types.Hyperlink:case N.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?S.FormulaType.Master:this.model.sharedFormula?S.FormulaType.Shared:S.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return N.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?S.ValueType.Null:e instanceof String||typeof e==`string`?S.ValueType.String:typeof e==`number`?S.ValueType.Number:e instanceof Date?S.ValueType.Date:e.text&&e.hyperlink?S.ValueType.Hyperlink:e.formula?S.ValueType.Formula:S.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&&M(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():``}},re=class{constructor(e,t){this.model={address:e.address,type:N.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.SharedString}get effectiveType(){return N.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()}},B=class{constructor(e,t){this.model={address:e.address,type:N.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Boolean}get effectiveType(){return N.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()}},V=class{constructor(e,t){this.model={address:e.address,type:N.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return N.Types.Error}get effectiveType(){return N.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()}},ie=class{constructor(e,t){this.model={address:e.address,type:N.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 N.Types.String}get effectiveType(){return N.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 H={getType(e){return e==null?N.Types.Null:e instanceof String||typeof e==`string`?N.Types.String:typeof e==`number`?N.Types.Number:typeof e==`boolean`?N.Types.Boolean:e instanceof Date?N.Types.Date:e.text&&e.hyperlink?N.Types.Hyperlink:e.formula||e.sharedFormula?N.Types.Formula:e.richText?N.Types.RichText:e.sharedString?N.Types.SharedString:e.error?N.Types.Error:N.Types.JSON},types:[{t:N.Types.Null,f:P},{t:N.Types.Number,f:F},{t:N.Types.String,f:te},{t:N.Types.Date,f:L},{t:N.Types.Hyperlink,f:ne},{t:N.Types.Formula,f:z},{t:N.Types.Merge,f:R},{t:N.Types.JSON,f:ie},{t:N.Types.SharedString,f:re},{t:N.Types.RichText,f:I},{t:N.Types.Boolean,f:B},{t:N.Types.Error,f:V}].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)}};var U=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 N(this,n,e.address),this._cells[e.col-1]=t}return t}getCell(e){let t;if(typeof e==`string`){let n=this._worksheet.getColumnKey(e);t=n?n.number:m.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:m.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=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=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){if(t||(t=e,e=null),e&&e.includeEmpty){let e=this._cells.length;for(let n=1;n<=e;n++)t(this.getCell(n),n)}else this._cells.forEach((e,n)=>{e&&e.type!==S.ValueType.Null&&t(e,n+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!==S.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,n)=>{e!==void 0&&(this.getCellEx({address:m.encodeAddress(this._number,n+t),row:this._number,col:n+t}).value=e)})}else this._worksheet.eachColumnKey((t,n)=>{e[n]!==void 0&&(this.getCellEx({address:m.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}get hasValues(){return this._cells.some(e=>e&&e.type!==S.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!==S.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){return this.style[e]=t,this._cells.forEach(n=>{n&&(n[e]=t)}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){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||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed}: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 N.Types.Merge:break;default:{let n;if(e.address)n=m.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:m.encodeAddress(e,r),$col$row:`$${m.n2l(r)}$${e}`}}t=n;let r=this.getCellEx(n);r.model=e;break}}}),e.height?this.height=e.height:delete this.height,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel||0,this.style=e.style&&JSON.parse(JSON.stringify(e.style))||{}}},ae=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 m.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}}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):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0)}get headers(){return this._header&&this._header instanceof Array?this._header:[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&&T(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel)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;t||(t=e,e=null),this._worksheet.eachRow(e,(e,r)=>{t(e.getCell(n),r)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==S.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})}_applyStyle(e,t){return this.style[e]=t,this.eachCell(n=>{n[e]=t}),t}get numFmt(){return this.style.numFmt}set numFmt(e){this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){this._applyStyle(`fill`,e)}static toModel(e){let t=[],n=null;return e&&e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentTo(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},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){n||=[];let r=[],i=1,a=0;for(n=n.sort(function(e,t){return e.min-t.min});a<n.length;){let o=n[a++];for(;i<o.min;)r.push(new e(t,i++));for(;i<=o.max;)r.push(new e(t,i++,o))}return r.length?r:null}},W=class e{constructor(e,t,n=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=m.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else if(t.nativeCol!==void 0){let e=t;this.nativeCol=e.nativeCol||0,this.nativeColOff=e.nativeColOff||0,this.nativeRow=e.nativeRow||0,this.nativeRowOff=e.nativeRowOff||0}else if(t.col!==void 0){let e=t;this.col=e.col+n,this.row=e.row+n}else this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0}static asInstance(t){return t instanceof e||t==null?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}},G=class{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:n,hyperlinks:r}){if(this.type=e,this.imageId=t,e===`image`)if(typeof n==`string`){let e=m.decode(n);this.range={tl:new W(this.worksheet,{col:e.left,row:e.top},-1),br:new W(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`}}else this.range={tl:new W(this.worksheet,n.tl,0),br:n.br&&new W(this.worksheet,n.br,0),ext:n.ext,editAs:n.editAs,hyperlinks:r||n.hyperlinks}}},oe=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)}},K=class{constructor(e,t){this.worksheet=e,t&&(this.table=t,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 n=(e,t)=>{if(!e)throw Error(t)};n(!!e.ref,`Table must have ref`),n(!!e.columns,`Table must have column definitions`),n(!!e.rows,`Table must have row definitions`),e.tl=m.decodeAddress(e.ref);let{row:r,col:i}=e.tl;n(r>0,`Table must be on valid row`),n(i>0,`Table must be on valid col`);let{width:a,filterHeight:o,tableHeight:s}=this;e.autoFilterRef=m.encode(r,i,r+o-1,i+a-1),e.tableRef=m.encode(r,i,r+s-1,i+a-1),e.columns.forEach((e,r)=>{n(!!e.name,`Column ${r} must have a name`),r===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)||void 0)})}store(){let e=(e,t)=>{t&&Object.keys(t).forEach(n=>{e.style[n]=t[n]})},{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);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=m.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()}addRow(e,t){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e)}removeRows(e,t=1){this.cacheState(),this.table.rows.splice(e,t)}getColumn(e){let t=this.table.columns[e];return new oe(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.name}set theme(e){this.table.style.name=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}},se=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 n=Object.keys(this.model).filter(e=>e.startsWith(`range:`));if(n.length===0)return;let r=m.decodeAddress(e);for(let e of n){let t=e.slice(6),n=m.decodeEx(t);if(n.dimensions){let t=n.tl,i=n.br;if(r.row>=t.row&&r.row<=i.row&&r.col>=t.col&&r.col<=i.col)return this.model[e]}}}remove(e){this.model[e]=void 0}},ce=c((e=>{e.byteLength=c,e.toByteArray=u,e.fromByteArray=p;for(var t=[],n=[],r=typeof Uint8Array<`u`?Uint8Array:Array,i=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,a=0,o=i.length;a<o;++a)t[a]=i[a],n[i.charCodeAt(a)]=a;n[45]=62,n[95]=63;function s(e){var t=e.length;if(t%4>0)throw Error(`Invalid string. Length must be a multiple of 4`);var n=e.indexOf(`=`);n===-1&&(n=t);var r=n===t?0:4-n%4;return[n,r]}function c(e){var t=s(e),n=t[0],r=t[1];return(n+r)*3/4-r}function l(e,t,n){return(t+n)*3/4-n}function u(e){var t,i=s(e),a=i[0],o=i[1],c=new r(l(e,a,o)),u=0,d=o>0?a-4:a,f;for(f=0;f<d;f+=4)t=n[e.charCodeAt(f)]<<18|n[e.charCodeAt(f+1)]<<12|n[e.charCodeAt(f+2)]<<6|n[e.charCodeAt(f+3)],c[u++]=t>>16&255,c[u++]=t>>8&255,c[u++]=t&255;return o===2&&(t=n[e.charCodeAt(f)]<<2|n[e.charCodeAt(f+1)]>>4,c[u++]=t&255),o===1&&(t=n[e.charCodeAt(f)]<<10|n[e.charCodeAt(f+1)]<<4|n[e.charCodeAt(f+2)]>>2,c[u++]=t>>8&255,c[u++]=t&255),c}function d(e){return t[e>>18&63]+t[e>>12&63]+t[e>>6&63]+t[e&63]}function f(e,t,n){for(var r,i=[],a=t;a<n;a+=3)r=(e[a]<<16&16711680)+(e[a+1]<<8&65280)+(e[a+2]&255),i.push(d(r));return i.join(``)}function p(e){for(var n,r=e.length,i=r%3,a=[],o=16383,s=0,c=r-i;s<c;s+=o)a.push(f(e,s,s+o>c?c:s+o));return i===1?(n=e[r-1],a.push(t[n>>2]+t[n<<4&63]+`==`)):i===2&&(n=(e[r-2]<<8)+e[r-1],a.push(t[n>>10]+t[n>>4&63]+t[n<<2&63]+`=`)),a.join(``)}})),le=c((e=>{e.read=function(e,t,n,r,i){var a,o,s=i*8-r-1,c=(1<<s)-1,l=c>>1,u=-7,d=n?i-1:0,f=n?-1:1,p=e[t+d];for(d+=f,a=p&(1<<-u)-1,p>>=-u,u+=s;u>0;a=a*256+e[t+d],d+=f,u-=8);for(o=a&(1<<-u)-1,a>>=-u,u+=r;u>0;o=o*256+e[t+d],d+=f,u-=8);if(a===0)a=1-l;else if(a===c)return o?NaN:(p?-1:1)*(1/0);else o+=2**r,a-=l;return(p?-1:1)*o*2**(a-r)},e.write=function(e,t,n,r,i,a){var o,s,c,l=a*8-i-1,u=(1<<l)-1,d=u>>1,f=i===23?2**-24-2**-77:0,p=r?0:a-1,m=r?1:-1,h=t<0||t===0&&1/t<0?1:0;for(t=Math.abs(t),isNaN(t)||t===1/0?(s=isNaN(t)?1:0,o=u):(o=Math.floor(Math.log(t)/Math.LN2),t*(c=2**-o)<1&&(o--,c*=2),o+d>=1?t+=f/c:t+=f*2**(1-d),t*c>=2&&(o++,c/=2),o+d>=u?(s=0,o=u):o+d>=1?(s=(t*c-1)*2**i,o+=d):(s=t*2**(d-1)*2**i,o=0));i>=8;e[n+p]=s&255,p+=m,s/=256,i-=8);for(o=o<<i|s,l+=i;l>0;e[n+p]=o&255,p+=m,o/=256,l-=8);e[n+p-m]|=h*128}})),q=c((e=>{var t=ce(),n=le(),r=typeof Symbol==`function`&&typeof Symbol.for==`function`?Symbol.for(`nodejs.util.inspect.custom`):null;e.Buffer=s,e.SlowBuffer=v,e.INSPECT_MAX_BYTES=50;var i=2147483647;e.kMaxLength=i,s.TYPED_ARRAY_SUPPORT=a(),!s.TYPED_ARRAY_SUPPORT&&typeof console<`u`&&typeof console.error==`function`&&console.error("This browser lacks typed array (Uint8Array) support which is required by `buffer` v5.x. Use `buffer` v4.x if you require old browser support.");function a(){try{var e=new Uint8Array(1),t={foo:function(){return 42}};return Object.setPrototypeOf(t,Uint8Array.prototype),Object.setPrototypeOf(e,t),e.foo()===42}catch{return!1}}Object.defineProperty(s.prototype,`parent`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.buffer}}),Object.defineProperty(s.prototype,`offset`,{enumerable:!0,get:function(){if(s.isBuffer(this))return this.byteOffset}});function o(e){if(e>i)throw RangeError(`The value "`+e+`" is invalid for option "size"`);var t=new Uint8Array(e);return Object.setPrototypeOf(t,s.prototype),t}function s(e,t,n){if(typeof e==`number`){if(typeof t==`string`)throw TypeError(`The "string" argument must be of type string. Received type number`);return d(e)}return c(e,t,n)}s.poolSize=8192;function c(e,t,n){if(typeof e==`string`)return f(e,t);if(ArrayBuffer.isView(e))return m(e);if(e==null)throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e);if(ae(e,ArrayBuffer)||e&&ae(e.buffer,ArrayBuffer)||typeof SharedArrayBuffer<`u`&&(ae(e,SharedArrayBuffer)||e&&ae(e.buffer,SharedArrayBuffer)))return h(e,t,n);if(typeof e==`number`)throw TypeError(`The "value" argument must not be of type number. Received type number`);var r=e.valueOf&&e.valueOf();if(r!=null&&r!==e)return s.from(r,t,n);var i=g(e);if(i)return i;if(typeof Symbol<`u`&&Symbol.toPrimitive!=null&&typeof e[Symbol.toPrimitive]==`function`)return s.from(e[Symbol.toPrimitive](`string`),t,n);throw TypeError(`The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type `+typeof e)}s.from=function(e,t,n){return c(e,t,n)},Object.setPrototypeOf(s.prototype,Uint8Array.prototype),Object.setPrototypeOf(s,Uint8Array);function l(e){if(typeof e!=`number`)throw TypeError(`"size" argument must be of type number`);if(e<0)throw RangeError(`The value "`+e+`" is invalid for option "size"`)}function u(e,t,n){return l(e),e<=0||t===void 0?o(e):typeof n==`string`?o(e).fill(t,n):o(e).fill(t)}s.alloc=function(e,t,n){return u(e,t,n)};function d(e){return l(e),o(e<0?0:_(e)|0)}s.allocUnsafe=function(e){return d(e)},s.allocUnsafeSlow=function(e){return d(e)};function f(e,t){if((typeof t!=`string`||t===``)&&(t=`utf8`),!s.isEncoding(t))throw TypeError(`Unknown encoding: `+t);var n=y(e,t)|0,r=o(n),i=r.write(e,t);return i!==n&&(r=r.slice(0,i)),r}function p(e){for(var t=e.length<0?0:_(e.length)|0,n=o(t),r=0;r<t;r+=1)n[r]=e[r]&255;return n}function m(e){if(ae(e,Uint8Array)){var t=new Uint8Array(e);return h(t.buffer,t.byteOffset,t.byteLength)}return p(e)}function h(e,t,n){if(t<0||e.byteLength<t)throw RangeError(`"offset" is outside of buffer bounds`);if(e.byteLength<t+(n||0))throw RangeError(`"length" is outside of buffer bounds`);var r=t===void 0&&n===void 0?new Uint8Array(e):n===void 0?new Uint8Array(e,t):new Uint8Array(e,t,n);return Object.setPrototypeOf(r,s.prototype),r}function g(e){if(s.isBuffer(e)){var t=_(e.length)|0,n=o(t);return n.length===0||e.copy(n,0,0,t),n}if(e.length!==void 0)return typeof e.length!=`number`||W(e.length)?o(0):p(e);if(e.type===`Buffer`&&Array.isArray(e.data))return p(e.data)}function _(e){if(e>=i)throw RangeError(`Attempt to allocate Buffer larger than maximum size: 0x`+i.toString(16)+` bytes`);return e|0}function v(e){return+e!=e&&(e=0),s.alloc(+e)}s.isBuffer=function(e){return e!=null&&e._isBuffer===!0&&e!==s.prototype},s.compare=function(e,t){if(ae(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),ae(t,Uint8Array)&&(t=s.from(t,t.offset,t.byteLength)),!s.isBuffer(e)||!s.isBuffer(t))throw TypeError(`The "buf1", "buf2" arguments must be one of type Buffer or Uint8Array`);if(e===t)return 0;for(var n=e.length,r=t.length,i=0,a=Math.min(n,r);i<a;++i)if(e[i]!==t[i]){n=e[i],r=t[i];break}return n<r?-1:r<n?1:0},s.isEncoding=function(e){switch(String(e).toLowerCase()){case`hex`:case`utf8`:case`utf-8`:case`ascii`:case`latin1`:case`binary`:case`base64`:case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return!0;default:return!1}},s.concat=function(e,t){if(!Array.isArray(e))throw TypeError(`"list" argument must be an Array of Buffers`);if(e.length===0)return s.alloc(0);var n;if(t===void 0)for(t=0,n=0;n<e.length;++n)t+=e[n].length;var r=s.allocUnsafe(t),i=0;for(n=0;n<e.length;++n){var a=e[n];if(ae(a,Uint8Array))i+a.length>r.length?s.from(a).copy(r,i):Uint8Array.prototype.set.call(r,a,i);else if(s.isBuffer(a))a.copy(r,i);else throw TypeError(`"list" argument must be an Array of Buffers`);i+=a.length}return r};function y(e,t){if(s.isBuffer(e))return e.length;if(ArrayBuffer.isView(e)||ae(e,ArrayBuffer))return e.byteLength;if(typeof e!=`string`)throw TypeError(`The "string" argument must be one of type string, Buffer, or ArrayBuffer. Received type `+typeof e);var n=e.length,r=arguments.length>2&&arguments[2]===!0;if(!r&&n===0)return 0;for(var i=!1;;)switch(t){case`ascii`:case`latin1`:case`binary`:return n;case`utf8`:case`utf-8`:return B(e).length;case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return n*2;case`hex`:return n>>>1;case`base64`:return H(e).length;default:if(i)return r?-1:B(e).length;t=(``+t).toLowerCase(),i=!0}}s.byteLength=y;function b(e,t,n){var r=!1;if((t===void 0||t<0)&&(t=0),t>this.length||((n===void 0||n>this.length)&&(n=this.length),n<=0)||(n>>>=0,t>>>=0,n<=t))return``;for(e||=`utf8`;;)switch(e){case`hex`:return P(this,t,n);case`utf8`:case`utf-8`:return A(this,t,n);case`ascii`:return M(this,t,n);case`latin1`:case`binary`:return N(this,t,n);case`base64`:return k(this,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return F(this,t,n);default:if(r)throw TypeError(`Unknown encoding: `+e);e=(e+``).toLowerCase(),r=!0}}s.prototype._isBuffer=!0;function x(e,t,n){var r=e[t];e[t]=e[n],e[n]=r}s.prototype.swap16=function(){var e=this.length;if(e%2!=0)throw RangeError(`Buffer size must be a multiple of 16-bits`);for(var t=0;t<e;t+=2)x(this,t,t+1);return this},s.prototype.swap32=function(){var e=this.length;if(e%4!=0)throw RangeError(`Buffer size must be a multiple of 32-bits`);for(var t=0;t<e;t+=4)x(this,t,t+3),x(this,t+1,t+2);return this},s.prototype.swap64=function(){var e=this.length;if(e%8!=0)throw RangeError(`Buffer size must be a multiple of 64-bits`);for(var t=0;t<e;t+=8)x(this,t,t+7),x(this,t+1,t+6),x(this,t+2,t+5),x(this,t+3,t+4);return this},s.prototype.toString=function(){var e=this.length;return e===0?``:arguments.length===0?A(this,0,e):b.apply(this,arguments)},s.prototype.toLocaleString=s.prototype.toString,s.prototype.equals=function(e){if(!s.isBuffer(e))throw TypeError(`Argument must be a Buffer`);return this===e?!0:s.compare(this,e)===0},s.prototype.inspect=function(){var t=``,n=e.INSPECT_MAX_BYTES;return t=this.toString(`hex`,0,n).replace(/(.{2})/g,`$1 `).trim(),this.length>n&&(t+=` ... `),`<Buffer `+t+`>`},r&&(s.prototype[r]=s.prototype.inspect),s.prototype.compare=function(e,t,n,r,i){if(ae(e,Uint8Array)&&(e=s.from(e,e.offset,e.byteLength)),!s.isBuffer(e))throw TypeError(`The "target" argument must be one of type Buffer or Uint8Array. Received type `+typeof e);if(t===void 0&&(t=0),n===void 0&&(n=e?e.length:0),r===void 0&&(r=0),i===void 0&&(i=this.length),t<0||n>e.length||r<0||i>this.length)throw RangeError(`out of range index`);if(r>=i&&t>=n)return 0;if(r>=i)return-1;if(t>=n)return 1;if(t>>>=0,n>>>=0,r>>>=0,i>>>=0,this===e)return 0;for(var a=i-r,o=n-t,c=Math.min(a,o),l=this.slice(r,i),u=e.slice(t,n),d=0;d<c;++d)if(l[d]!==u[d]){a=l[d],o=u[d];break}return a<o?-1:o<a?1:0};function S(e,t,n,r,i){if(e.length===0)return-1;if(typeof n==`string`?(r=n,n=0):n>2147483647?n=2147483647:n<-2147483648&&(n=-2147483648),n=+n,W(n)&&(n=i?0:e.length-1),n<0&&(n=e.length+n),n>=e.length){if(i)return-1;n=e.length-1}else if(n<0)if(i)n=0;else return-1;if(typeof t==`string`&&(t=s.from(t,r)),s.isBuffer(t))return t.length===0?-1:C(e,t,n,r,i);if(typeof t==`number`)return t&=255,typeof Uint8Array.prototype.indexOf==`function`?i?Uint8Array.prototype.indexOf.call(e,t,n):Uint8Array.prototype.lastIndexOf.call(e,t,n):C(e,[t],n,r,i);throw TypeError(`val must be string, number or Buffer`)}function C(e,t,n,r,i){var a=1,o=e.length,s=t.length;if(r!==void 0&&(r=String(r).toLowerCase(),r===`ucs2`||r===`ucs-2`||r===`utf16le`||r===`utf-16le`)){if(e.length<2||t.length<2)return-1;a=2,o/=2,s/=2,n/=2}function c(e,t){return a===1?e[t]:e.readUInt16BE(t*a)}var l;if(i){var u=-1;for(l=n;l<o;l++)if(c(e,l)===c(t,u===-1?0:l-u)){if(u===-1&&(u=l),l-u+1===s)return u*a}else u!==-1&&(l-=l-u),u=-1}else for(n+s>o&&(n=o-s),l=n;l>=0;l--){for(var d=!0,f=0;f<s;f++)if(c(e,l+f)!==c(t,f)){d=!1;break}if(d)return l}return-1}s.prototype.includes=function(e,t,n){return this.indexOf(e,t,n)!==-1},s.prototype.indexOf=function(e,t,n){return S(this,e,t,n,!0)},s.prototype.lastIndexOf=function(e,t,n){return S(this,e,t,n,!1)};function w(e,t,n,r){n=Number(n)||0;var i=e.length-n;r?(r=Number(r),r>i&&(r=i)):r=i;var a=t.length;r>a/2&&(r=a/2);for(var o=0;o<r;++o){var s=parseInt(t.substr(o*2,2),16);if(W(s))return o;e[n+o]=s}return o}function T(e,t,n,r){return U(B(t,e.length-n),e,n,r)}function E(e,t,n,r){return U(V(t),e,n,r)}function D(e,t,n,r){return U(H(t),e,n,r)}function O(e,t,n,r){return U(ie(t,e.length-n),e,n,r)}s.prototype.write=function(e,t,n,r){if(t===void 0)r=`utf8`,n=this.length,t=0;else if(n===void 0&&typeof t==`string`)r=t,n=this.length,t=0;else if(isFinite(t))t>>>=0,isFinite(n)?(n>>>=0,r===void 0&&(r=`utf8`)):(r=n,n=void 0);else throw Error(`Buffer.write(string, encoding, offset[, length]) is no longer supported`);var i=this.length-t;if((n===void 0||n>i)&&(n=i),e.length>0&&(n<0||t<0)||t>this.length)throw RangeError(`Attempt to write outside buffer bounds`);r||=`utf8`;for(var a=!1;;)switch(r){case`hex`:return w(this,e,t,n);case`utf8`:case`utf-8`:return T(this,e,t,n);case`ascii`:case`latin1`:case`binary`:return E(this,e,t,n);case`base64`:return D(this,e,t,n);case`ucs2`:case`ucs-2`:case`utf16le`:case`utf-16le`:return O(this,e,t,n);default:if(a)throw TypeError(`Unknown encoding: `+r);r=(``+r).toLowerCase(),a=!0}},s.prototype.toJSON=function(){return{type:`Buffer`,data:Array.prototype.slice.call(this._arr||this,0)}};function k(e,n,r){return n===0&&r===e.length?t.fromByteArray(e):t.fromByteArray(e.slice(n,r))}function A(e,t,n){n=Math.min(e.length,n);for(var r=[],i=t;i<n;){var a=e[i],o=null,s=a>239?4:a>223?3:a>191?2:1;if(i+s<=n){var c,l,u,d;switch(s){case 1:a<128&&(o=a);break;case 2:c=e[i+1],(c&192)==128&&(d=(a&31)<<6|c&63,d>127&&(o=d));break;case 3:c=e[i+1],l=e[i+2],(c&192)==128&&(l&192)==128&&(d=(a&15)<<12|(c&63)<<6|l&63,d>2047&&(d<55296||d>57343)&&(o=d));break;case 4:c=e[i+1],l=e[i+2],u=e[i+3],(c&192)==128&&(l&192)==128&&(u&192)==128&&(d=(a&15)<<18|(c&63)<<12|(l&63)<<6|u&63,d>65535&&d<1114112&&(o=d))}}o===null?(o=65533,s=1):o>65535&&(o-=65536,r.push(o>>>10&1023|55296),o=56320|o&1023),r.push(o),i+=s}return j(r)}var ee=4096;function j(e){var t=e.length;if(t<=ee)return String.fromCharCode.apply(String,e);for(var n=``,r=0;r<t;)n+=String.fromCharCode.apply(String,e.slice(r,r+=ee));return n}function M(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]&127);return r}function N(e,t,n){var r=``;n=Math.min(e.length,n);for(var i=t;i<n;++i)r+=String.fromCharCode(e[i]);return r}function P(e,t,n){var r=e.length;(!t||t<0)&&(t=0),(!n||n<0||n>r)&&(n=r);for(var i=``,a=t;a<n;++a)i+=G[e[a]];return i}function F(e,t,n){for(var r=e.slice(t,n),i=``,a=0;a<r.length-1;a+=2)i+=String.fromCharCode(r[a]+r[a+1]*256);return i}s.prototype.slice=function(e,t){var n=this.length;e=~~e,t=t===void 0?n:~~t,e<0?(e+=n,e<0&&(e=0)):e>n&&(e=n),t<0?(t+=n,t<0&&(t=0)):t>n&&(t=n),t<e&&(t=e);var r=this.subarray(e,t);return Object.setPrototypeOf(r,s.prototype),r};function te(e,t,n){if(e%1!=0||e<0)throw RangeError(`offset is not uint`);if(e+t>n)throw RangeError(`Trying to access beyond buffer length`)}s.prototype.readUintLE=s.prototype.readUIntLE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return r},s.prototype.readUintBE=s.prototype.readUIntBE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e+--t],i=1;t>0&&(i*=256);)r+=this[e+--t]*i;return r},s.prototype.readUint8=s.prototype.readUInt8=function(e,t){return e>>>=0,t||te(e,1,this.length),this[e]},s.prototype.readUint16LE=s.prototype.readUInt16LE=function(e,t){return e>>>=0,t||te(e,2,this.length),this[e]|this[e+1]<<8},s.prototype.readUint16BE=s.prototype.readUInt16BE=function(e,t){return e>>>=0,t||te(e,2,this.length),this[e]<<8|this[e+1]},s.prototype.readUint32LE=s.prototype.readUInt32LE=function(e,t){return e>>>=0,t||te(e,4,this.length),(this[e]|this[e+1]<<8|this[e+2]<<16)+this[e+3]*16777216},s.prototype.readUint32BE=s.prototype.readUInt32BE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]*16777216+(this[e+1]<<16|this[e+2]<<8|this[e+3])},s.prototype.readIntLE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=this[e],i=1,a=0;++a<t&&(i*=256);)r+=this[e+a]*i;return i*=128,r>=i&&(r-=2**(8*t)),r},s.prototype.readIntBE=function(e,t,n){e>>>=0,t>>>=0,n||te(e,t,this.length);for(var r=t,i=1,a=this[e+--r];r>0&&(i*=256);)a+=this[e+--r]*i;return i*=128,a>=i&&(a-=2**(8*t)),a},s.prototype.readInt8=function(e,t){return e>>>=0,t||te(e,1,this.length),this[e]&128?(255-this[e]+1)*-1:this[e]},s.prototype.readInt16LE=function(e,t){e>>>=0,t||te(e,2,this.length);var n=this[e]|this[e+1]<<8;return n&32768?n|4294901760:n},s.prototype.readInt16BE=function(e,t){e>>>=0,t||te(e,2,this.length);var n=this[e+1]|this[e]<<8;return n&32768?n|4294901760:n},s.prototype.readInt32LE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]|this[e+1]<<8|this[e+2]<<16|this[e+3]<<24},s.prototype.readInt32BE=function(e,t){return e>>>=0,t||te(e,4,this.length),this[e]<<24|this[e+1]<<16|this[e+2]<<8|this[e+3]},s.prototype.readFloatLE=function(e,t){return e>>>=0,t||te(e,4,this.length),n.read(this,e,!0,23,4)},s.prototype.readFloatBE=function(e,t){return e>>>=0,t||te(e,4,this.length),n.read(this,e,!1,23,4)},s.prototype.readDoubleLE=function(e,t){return e>>>=0,t||te(e,8,this.length),n.read(this,e,!0,52,8)},s.prototype.readDoubleBE=function(e,t){return e>>>=0,t||te(e,8,this.length),n.read(this,e,!1,52,8)};function I(e,t,n,r,i,a){if(!s.isBuffer(e))throw TypeError(`"buffer" argument must be a Buffer instance`);if(t>i||t<a)throw RangeError(`"value" argument is out of bounds`);if(n+r>e.length)throw RangeError(`Index out of range`)}s.prototype.writeUintLE=s.prototype.writeUIntLE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=2**(8*n)-1;I(this,e,t,n,i,0)}var a=1,o=0;for(this[t]=e&255;++o<n&&(a*=256);)this[t+o]=e/a&255;return t+n},s.prototype.writeUintBE=s.prototype.writeUIntBE=function(e,t,n,r){if(e=+e,t>>>=0,n>>>=0,!r){var i=2**(8*n)-1;I(this,e,t,n,i,0)}var a=n-1,o=1;for(this[t+a]=e&255;--a>=0&&(o*=256);)this[t+a]=e/o&255;return t+n},s.prototype.writeUint8=s.prototype.writeUInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,255,0),this[t]=e&255,t+1},s.prototype.writeUint16LE=s.prototype.writeUInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeUint16BE=s.prototype.writeUInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,65535,0),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeUint32LE=s.prototype.writeUInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t+3]=e>>>24,this[t+2]=e>>>16,this[t+1]=e>>>8,this[t]=e&255,t+4},s.prototype.writeUint32BE=s.prototype.writeUInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,4294967295,0),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4},s.prototype.writeIntLE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=2**(8*n-1);I(this,e,t,n,i-1,-i)}var a=0,o=1,s=0;for(this[t]=e&255;++a<n&&(o*=256);)e<0&&s===0&&this[t+a-1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeIntBE=function(e,t,n,r){if(e=+e,t>>>=0,!r){var i=2**(8*n-1);I(this,e,t,n,i-1,-i)}var a=n-1,o=1,s=0;for(this[t+a]=e&255;--a>=0&&(o*=256);)e<0&&s===0&&this[t+a+1]!==0&&(s=1),this[t+a]=(e/o>>0)-s&255;return t+n},s.prototype.writeInt8=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,1,127,-128),e<0&&(e=255+e+1),this[t]=e&255,t+1},s.prototype.writeInt16LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e&255,this[t+1]=e>>>8,t+2},s.prototype.writeInt16BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,2,32767,-32768),this[t]=e>>>8,this[t+1]=e&255,t+2},s.prototype.writeInt32LE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),this[t]=e&255,this[t+1]=e>>>8,this[t+2]=e>>>16,this[t+3]=e>>>24,t+4},s.prototype.writeInt32BE=function(e,t,n){return e=+e,t>>>=0,n||I(this,e,t,4,2147483647,-2147483648),e<0&&(e=4294967295+e+1),this[t]=e>>>24,this[t+1]=e>>>16,this[t+2]=e>>>8,this[t+3]=e&255,t+4};function L(e,t,n,r,i,a){if(n+r>e.length||n<0)throw RangeError(`Index out of range`)}function ne(e,t,r,i,a){return t=+t,r>>>=0,a||L(e,t,r,4,34028234663852886e22,-34028234663852886e22),n.write(e,t,r,i,23,4),r+4}s.prototype.writeFloatLE=function(e,t,n){return ne(this,e,t,!0,n)},s.prototype.writeFloatBE=function(e,t,n){return ne(this,e,t,!1,n)};function R(e,t,r,i,a){return t=+t,r>>>=0,a||L(e,t,r,8,17976931348623157e292,-17976931348623157e292),n.write(e,t,r,i,52,8),r+8}s.prototype.writeDoubleLE=function(e,t,n){return R(this,e,t,!0,n)},s.prototype.writeDoubleBE=function(e,t,n){return R(this,e,t,!1,n)},s.prototype.copy=function(e,t,n,r){if(!s.isBuffer(e))throw TypeError(`argument should be a Buffer`);if(n||=0,!r&&r!==0&&(r=this.length),t>=e.length&&(t=e.length),t||=0,r>0&&r<n&&(r=n),r===n||e.length===0||this.length===0)return 0;if(t<0)throw RangeError(`targetStart out of bounds`);if(n<0||n>=this.length)throw RangeError(`Index out of range`);if(r<0)throw RangeError(`sourceEnd out of bounds`);r>this.length&&(r=this.length),e.length-t<r-n&&(r=e.length-t+n);var i=r-n;return this===e&&typeof Uint8Array.prototype.copyWithin==`function`?this.copyWithin(t,n,r):Uint8Array.prototype.set.call(e,this.subarray(n,r),t),i},s.prototype.fill=function(e,t,n,r){if(typeof e==`string`){if(typeof t==`string`?(r=t,t=0,n=this.length):typeof n==`string`&&(r=n,n=this.length),r!==void 0&&typeof r!=`string`)throw TypeError(`encoding must be a string`);if(typeof r==`string`&&!s.isEncoding(r))throw TypeError(`Unknown encoding: `+r);if(e.length===1){var i=e.charCodeAt(0);(r===`utf8`&&i<128||r===`latin1`)&&(e=i)}}else typeof e==`number`?e&=255:typeof e==`boolean`&&(e=Number(e));if(t<0||this.length<t||this.length<n)throw RangeError(`Out of range index`);if(n<=t)return this;t>>>=0,n=n===void 0?this.length:n>>>0,e||=0;var a;if(typeof e==`number`)for(a=t;a<n;++a)this[a]=e;else{var o=s.isBuffer(e)?e:s.from(e,r),c=o.length;if(c===0)throw TypeError(`The value "`+e+`" is invalid for argument "value"`);for(a=0;a<n-t;++a)this[a+t]=o[a%c]}return this};var z=/[^+/0-9A-Za-z-_]/g;function re(e){if(e=e.split(`=`)[0],e=e.trim().replace(z,``),e.length<2)return``;for(;e.length%4!=0;)e+=`=`;return e}function B(e,t){t||=1/0;for(var n,r=e.length,i=null,a=[],o=0;o<r;++o){if(n=e.charCodeAt(o),n>55295&&n<57344){if(!i){if(n>56319){(t-=3)>-1&&a.push(239,191,189);continue}else if(o+1===r){(t-=3)>-1&&a.push(239,191,189);continue}i=n;continue}if(n<56320){(t-=3)>-1&&a.push(239,191,189),i=n;continue}n=(i-55296<<10|n-56320)+65536}else i&&(t-=3)>-1&&a.push(239,191,189);if(i=null,n<128){if(--t<0)break;a.push(n)}else if(n<2048){if((t-=2)<0)break;a.push(n>>6|192,n&63|128)}else if(n<65536){if((t-=3)<0)break;a.push(n>>12|224,n>>6&63|128,n&63|128)}else if(n<1114112){if((t-=4)<0)break;a.push(n>>18|240,n>>12&63|128,n>>6&63|128,n&63|128)}else throw Error(`Invalid code point`)}return a}function V(e){for(var t=[],n=0;n<e.length;++n)t.push(e.charCodeAt(n)&255);return t}function ie(e,t){for(var n,r,i,a=[],o=0;o<e.length&&!((t-=2)<0);++o)n=e.charCodeAt(o),r=n>>8,i=n%256,a.push(i),a.push(r);return a}function H(e){return t.toByteArray(re(e))}function U(e,t,n,r){for(var i=0;i<r&&!(i+n>=t.length||i>=e.length);++i)t[i+n]=e[i];return i}function ae(e,t){return e instanceof t||e!=null&&e.constructor!=null&&e.constructor.name!=null&&e.constructor.name===t.name}function W(e){return e!==e}var G=(function(){for(var e=`0123456789abcdef`,t=Array(256),n=0;n<16;++n)for(var r=n*16,i=0;i<16;++i)t[r+i]=e[n]+e[i];return t})()}));function ue(){throw Error(`setTimeout has not been defined`)}function de(){throw Error(`clearTimeout has not been defined`)}function fe(e){if(Z===setTimeout)return setTimeout(e,0);if((Z===ue||!Z)&&setTimeout)return Z=setTimeout,setTimeout(e,0);try{return Z(e,0)}catch{try{return Z.call(null,e,0)}catch{return Z.call(this,e,0)}}}function pe(e){if(ve===clearTimeout)return clearTimeout(e);if((ve===de||!ve)&&clearTimeout)return ve=clearTimeout,clearTimeout(e);try{return ve(e)}catch{try{return ve.call(null,e)}catch{return ve.call(this,e)}}}function me(){!be||!xe||(be=!1,xe.length?ye=xe.concat(ye):Se=-1,ye.length&&he())}function he(){if(!be){var e=fe(me);be=!0;for(var t=ye.length;t;){for(xe=ye,ye=[];++Se<t;)xe&&xe[Se].run();Se=-1,t=ye.length}xe=null,be=!1,pe(e)}}function ge(e,t){this.fun=e,this.array=t}function J(){}function Y(){}var _e,X,Z,ve,ye,be,xe,Se,Ce,we,Te,Ee,De,Oe,ke,Ae,je,Me,Ne,Pe,Fe,Ie,Le,Q,Re=s((()=>{_e={exports:{}},X=_e.exports={},(function(){try{Z=typeof setTimeout==`function`?setTimeout:ue}catch{Z=ue}try{ve=typeof clearTimeout==`function`?clearTimeout:de}catch{ve=de}})(),ye=[],be=!1,Se=-1,X.nextTick=function(e){var t=Array(arguments.length-1);if(arguments.length>1)for(var n=1;n<arguments.length;n++)t[n-1]=arguments[n];ye.push(new ge(e,t)),ye.length===1&&!be&&fe(he)},ge.prototype.run=function(){this.fun.apply(null,this.array)},X.title=`browser`,X.browser=!0,X.env={},X.argv=[],X.version=``,X.versions={},X.on=J,X.addListener=J,X.once=J,X.off=J,X.removeListener=J,X.removeAllListeners=J,X.emit=J,X.prependListener=J,X.prependOnceListener=J,X.listeners=function(e){return[]},X.binding=function(e){throw Error(`process.binding is not supported`)},X.cwd=function(){return`/`},X.chdir=function(e){throw Error(`process.chdir is not supported`)},X.umask=function(){return 0},Ce=_e.exports.browser,we=Y,Te=_e.exports.binding,Ee=Y,De=1,Oe={},ke=Y,Ae=Y,je=Y,Me=Y,Ne=Y,Pe=`browser`,Fe=`browser`,Ie=`browser`,Le=[],Q={nextTick:_e.exports.nextTick,title:_e.exports.title,browser:Ce,env:_e.exports.env,argv:_e.exports.argv,version:_e.exports.version,versions:_e.exports.versions,on:_e.exports.on,addListener:_e.exports.addListener,once:_e.exports.once,off:_e.exports.off,removeListener:_e.exports.removeListener,removeAllListeners:_e.exports.removeAllListeners,emit:_e.exports.emit,emitWarning:we,prependListener:_e.exports.prependListener,prependOnceListener:_e.exports.prependOnceListener,listeners:_e.exports.listeners,binding:Te,cwd:_e.exports.cwd,chdir:_e.exports.chdir,umask:_e.exports.umask,exit:Ee,pid:De,features:Oe,kill:ke,dlopen:Ae,uptime:je,memoryUsage:Me,uvCounters:Ne,platform:Pe,arch:Fe,execPath:Ie,execArgv:Le},_e.exports.addListener,_e.exports.argv,_e.exports.chdir,_e.exports.cwd,_e.exports.emit,_e.exports.env,_e.exports.listeners,_e.exports.nextTick,_e.exports.off,_e.exports.on,_e.exports.once,_e.exports.prependListener,_e.exports.prependOnceListener,_e.exports.removeAllListeners,_e.exports.removeListener,_e.exports.title,_e.exports.umask,_e.exports.version,_e.exports.versions})),ze=c(((e,t)=>{
8
8
  /*! safe-buffer. MIT License. Feross Aboukhadijeh <https://feross.org/opensource> */
9
9
  var n=q(),r=n.Buffer;function i(e,t){for(var n in e)t[n]=e[n]}r.from&&r.alloc&&r.allocUnsafe&&r.allocUnsafeSlow?t.exports=n:(i(n,e),e.Buffer=a);function a(e,t,n){return r(e,t,n)}a.prototype=Object.create(r.prototype),i(r,a),a.from=function(e,t,n){if(typeof e==`number`)throw TypeError(`Argument must not be a number`);return r(e,t,n)},a.alloc=function(e,t,n){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);var i=r(e);return t===void 0?i.fill(0):typeof n==`string`?i.fill(t,n):i.fill(t),i},a.allocUnsafe=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return r(e)},a.allocUnsafeSlow=function(e){if(typeof e!=`number`)throw TypeError(`Argument must be a number`);return n.SlowBuffer(e)}})),Be=c(((e,t)=>{Re();var n=65536,r=4294967295;function i(){throw Error(`Secure random number generation is not supported by this browser.
10
10
  Use Chrome, Firefox or Internet Explorer 11`)}var a=ze().Buffer,o=global.crypto||global.msCrypto;o&&o.getRandomValues?t.exports=s:t.exports=i;function s(e,t){if(e>r)throw RangeError(`requested too many random bytes`);var i=a.allocUnsafe(e);if(e>0)if(e>n)for(var s=0;s<e;s+=n)o.getRandomValues(i.slice(s,s+n));else o.getRandomValues(i);return typeof t==`function`?Q.nextTick(function(){t(null,i)}):i}})),Ve=c(((e,t)=>{typeof Object.create==`function`?t.exports=function(e,t){t&&(e.super_=t,e.prototype=Object.create(t.prototype,{constructor:{value:e,enumerable:!1,writable:!0,configurable:!0}}))}:t.exports=function(e,t){if(t){e.super_=t;var n=function(){};n.prototype=t.prototype,e.prototype=new n,e.prototype.constructor=e}}})),He=c(((e,t)=>{var n=typeof Reflect==`object`?Reflect:null,r=n&&typeof n.apply==`function`?n.apply:function(e,t,n){return Function.prototype.apply.call(e,t,n)},i=n&&typeof n.ownKeys==`function`?n.ownKeys:Object.getOwnPropertySymbols?function(e){return Object.getOwnPropertyNames(e).concat(Object.getOwnPropertySymbols(e))}:function(e){return Object.getOwnPropertyNames(e)};function a(e){console&&console.warn&&console.warn(e)}var o=Number.isNaN||function(e){return e!==e};function s(){s.init.call(this)}t.exports=s,t.exports.once=y,s.EventEmitter=s,s.prototype._events=void 0,s.prototype._eventsCount=0,s.prototype._maxListeners=void 0;var c=10;function l(e){if(typeof e!=`function`)throw TypeError(`The "listener" argument must be of type Function. Received type `+typeof e)}Object.defineProperty(s,`defaultMaxListeners`,{enumerable:!0,get:function(){return c},set:function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "defaultMaxListeners" is out of range. It must be a non-negative number. Received `+e+`.`);c=e}}),s.init=function(){(this._events===void 0||this._events===Object.getPrototypeOf(this)._events)&&(this._events=Object.create(null),this._eventsCount=0),this._maxListeners=this._maxListeners||void 0},s.prototype.setMaxListeners=function(e){if(typeof e!=`number`||e<0||o(e))throw RangeError(`The value of "n" is out of range. It must be a non-negative number. Received `+e+`.`);return this._maxListeners=e,this};function u(e){return e._maxListeners===void 0?s.defaultMaxListeners:e._maxListeners}s.prototype.getMaxListeners=function(){return u(this)},s.prototype.emit=function(e){for(var t=[],n=1;n<arguments.length;n++)t.push(arguments[n]);var i=e===`error`,a=this._events;if(a!==void 0)i&&=a.error===void 0;else if(!i)return!1;if(i){var o;if(t.length>0&&(o=t[0]),o instanceof Error)throw o;var s=Error(`Unhandled error.`+(o?` (`+o.message+`)`:``));throw s.context=o,s}var c=a[e];if(c===void 0)return!1;if(typeof c==`function`)r(c,this,t);else for(var l=c.length,u=g(c,l),n=0;n<l;++n)r(u[n],this,t);return!0};function d(e,t,n,r){var i,o,s;if(l(n),o=e._events,o===void 0?(o=e._events=Object.create(null),e._eventsCount=0):(o.newListener!==void 0&&(e.emit(`newListener`,t,n.listener?n.listener:n),o=e._events),s=o[t]),s===void 0)s=o[t]=n,++e._eventsCount;else if(typeof s==`function`?s=o[t]=r?[n,s]:[s,n]:r?s.unshift(n):s.push(n),i=u(e),i>0&&s.length>i&&!s.warned){s.warned=!0;var c=Error(`Possible EventEmitter memory leak detected. `+s.length+` `+String(t)+` listeners added. Use emitter.setMaxListeners() to increase limit`);c.name=`MaxListenersExceededWarning`,c.emitter=e,c.type=t,c.count=s.length,a(c)}return e}s.prototype.addListener=function(e,t){return d(this,e,t,!1)},s.prototype.on=s.prototype.addListener,s.prototype.prependListener=function(e,t){return d(this,e,t,!0)};function f(){if(!this.fired)return this.target.removeListener(this.type,this.wrapFn),this.fired=!0,arguments.length===0?this.listener.call(this.target):this.listener.apply(this.target,arguments)}function p(e,t,n){var r={fired:!1,wrapFn:void 0,target:e,type:t,listener:n},i=f.bind(r);return i.listener=n,r.wrapFn=i,i}s.prototype.once=function(e,t){return l(t),this.on(e,p(this,e,t)),this},s.prototype.prependOnceListener=function(e,t){return l(t),this.prependListener(e,p(this,e,t)),this},s.prototype.removeListener=function(e,t){var n,r,i,a,o;if(l(t),r=this._events,r===void 0||(n=r[e],n===void 0))return this;if(n===t||n.listener===t)--this._eventsCount===0?this._events=Object.create(null):(delete r[e],r.removeListener&&this.emit(`removeListener`,e,n.listener||t));else if(typeof n!=`function`){for(i=-1,a=n.length-1;a>=0;a--)if(n[a]===t||n[a].listener===t){o=n[a].listener,i=a;break}if(i<0)return this;i===0?n.shift():_(n,i),n.length===1&&(r[e]=n[0]),r.removeListener!==void 0&&this.emit(`removeListener`,e,o||t)}return this},s.prototype.off=s.prototype.removeListener,s.prototype.removeAllListeners=function(e){var t,n=this._events,r;if(n===void 0)return this;if(n.removeListener===void 0)return arguments.length===0?(this._events=Object.create(null),this._eventsCount=0):n[e]!==void 0&&(--this._eventsCount===0?this._events=Object.create(null):delete n[e]),this;if(arguments.length===0){var i=Object.keys(n),a;for(r=0;r<i.length;++r)a=i[r],a!==`removeListener`&&this.removeAllListeners(a);return this.removeAllListeners(`removeListener`),this._events=Object.create(null),this._eventsCount=0,this}if(t=n[e],typeof t==`function`)this.removeListener(e,t);else if(t!==void 0)for(r=t.length-1;r>=0;r--)this.removeListener(e,t[r]);return this};function m(e,t,n){var r=e._events;if(r===void 0)return[];var i=r[t];return i===void 0?[]:typeof i==`function`?n?[i.listener||i]:[i]:n?v(i):g(i,i.length)}s.prototype.listeners=function(e){return m(this,e,!0)},s.prototype.rawListeners=function(e){return m(this,e,!1)},s.listenerCount=function(e,t){return typeof e.listenerCount==`function`?e.listenerCount(t):h.call(e,t)},s.prototype.listenerCount=h;function h(e){var t=this._events;if(t!==void 0){var n=t[e];if(typeof n==`function`)return 1;if(n!==void 0)return n.length}return 0}s.prototype.eventNames=function(){return this._eventsCount>0?i(this._events):[]};function g(e,t){for(var n=Array(t),r=0;r<t;++r)n[r]=e[r];return n}function _(e,t){for(;t+1<e.length;t++)e[t]=e[t+1];e.pop()}function v(e){for(var t=Array(e.length),n=0;n<t.length;++n)t[n]=e[n].listener||e[n];return t}function y(e,t){return new Promise(function(n,r){function i(n){e.removeListener(t,a),r(n)}function a(){typeof e.removeListener==`function`&&e.removeListener(`error`,i),n([].slice.call(arguments))}x(e,t,a,{once:!0}),t!==`error`&&b(e,i,{once:!0})})}function b(e,t,n){typeof e.on==`function`&&x(e,`error`,t,n)}function x(e,t,n,r){if(typeof e.on==`function`)r.once?e.once(t,n):e.on(t,n);else if(typeof e.addEventListener==`function`)e.addEventListener(t,function i(a){r.once&&e.removeEventListener(t,i),n(a)});else throw TypeError(`The "emitter" argument must be of type EventEmitter. Received type `+typeof e)}})),Ue=c(((e,t)=>{t.exports=He().EventEmitter})),We=c(((e,t)=>{t.exports=function(){if(typeof Symbol!=`function`||typeof Object.getOwnPropertySymbols!=`function`)return!1;if(typeof Symbol.iterator==`symbol`)return!0;var e={},t=Symbol(`test`),n=Object(t);if(typeof t==`string`||Object.prototype.toString.call(t)!==`[object Symbol]`||Object.prototype.toString.call(n)!==`[object Symbol]`)return!1;var r=42;for(var i in e[t]=r,e)return!1;if(typeof Object.keys==`function`&&Object.keys(e).length!==0||typeof Object.getOwnPropertyNames==`function`&&Object.getOwnPropertyNames(e).length!==0)return!1;var a=Object.getOwnPropertySymbols(e);if(a.length!==1||a[0]!==t||!Object.prototype.propertyIsEnumerable.call(e,t))return!1;if(typeof Object.getOwnPropertyDescriptor==`function`){var o=Object.getOwnPropertyDescriptor(e,t);if(o.value!==r||o.enumerable!==!0)return!1}return!0}})),Ge=c(((e,t)=>{var n=We();t.exports=function(){return n()&&!!Symbol.toStringTag}})),Ke=c(((e,t)=>{t.exports=Object})),qe=c(((e,t)=>{t.exports=Error})),Je=c(((e,t)=>{t.exports=EvalError})),Ye=c(((e,t)=>{t.exports=RangeError})),Xe=c(((e,t)=>{t.exports=ReferenceError})),Ze=c(((e,t)=>{t.exports=SyntaxError})),Qe=c(((e,t)=>{t.exports=TypeError})),$e=c(((e,t)=>{t.exports=URIError})),et=c(((e,t)=>{t.exports=Math.abs})),tt=c(((e,t)=>{t.exports=Math.floor})),nt=c(((e,t)=>{t.exports=Math.max})),rt=c(((e,t)=>{t.exports=Math.min})),it=c(((e,t)=>{t.exports=Math.pow})),at=c(((e,t)=>{t.exports=Math.round})),ot=c(((e,t)=>{t.exports=Number.isNaN||function(e){return e!==e}})),st=c(((e,t)=>{var n=ot();t.exports=function(e){return n(e)||e===0?e:e<0?-1:1}})),ct=c(((e,t)=>{t.exports=Object.getOwnPropertyDescriptor})),lt=c(((e,t)=>{var n=ct();if(n)try{n([],`length`)}catch{n=null}t.exports=n})),ut=c(((e,t)=>{var n=Object.defineProperty||!1;if(n)try{n({},`a`,{value:1})}catch{n=!1}t.exports=n})),dt=c(((e,t)=>{var n=typeof Symbol<`u`&&Symbol,r=We();t.exports=function(){return typeof n!=`function`||typeof Symbol!=`function`||typeof n(`foo`)!=`symbol`||typeof Symbol(`bar`)!=`symbol`?!1:r()}})),ft=c(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect.getPrototypeOf||null})),pt=c(((e,t)=>{t.exports=Ke().getPrototypeOf||null})),mt=c(((e,t)=>{var n=`Function.prototype.bind called on incompatible `,r=Object.prototype.toString,i=Math.max,a=`[object Function]`,o=function(e,t){for(var n=[],r=0;r<e.length;r+=1)n[r]=e[r];for(var i=0;i<t.length;i+=1)n[i+e.length]=t[i];return n},s=function(e,t){for(var n=[],r=t||0,i=0;r<e.length;r+=1,i+=1)n[i]=e[r];return n},c=function(e,t){for(var n=``,r=0;r<e.length;r+=1)n+=e[r],r+1<e.length&&(n+=t);return n};t.exports=function(e){var t=this;if(typeof t!=`function`||r.apply(t)!==a)throw TypeError(n+t);for(var l=s(arguments,1),u,d=function(){if(this instanceof u){var n=t.apply(this,o(l,arguments));return Object(n)===n?n:this}return t.apply(e,o(l,arguments))},f=i(0,t.length-l.length),p=[],m=0;m<f;m++)p[m]=`$`+m;if(u=Function(`binder`,`return function (`+c(p,`,`)+`){ return binder.apply(this,arguments); }`)(d),t.prototype){var h=function(){};h.prototype=t.prototype,u.prototype=new h,h.prototype=null}return u}})),ht=c(((e,t)=>{var n=mt();t.exports=Function.prototype.bind||n})),gt=c(((e,t)=>{t.exports=Function.prototype.call})),_t=c(((e,t)=>{t.exports=Function.prototype.apply})),vt=c(((e,t)=>{t.exports=typeof Reflect<`u`&&Reflect&&Reflect.apply})),yt=c(((e,t)=>{var n=ht(),r=_t(),i=gt();t.exports=vt()||n.call(i,r)})),bt=c(((e,t)=>{var n=ht(),r=Qe(),i=gt(),a=yt();t.exports=function(e){if(e.length<1||typeof e[0]!=`function`)throw new r(`a function is required`);return a(n,i,e)}})),xt=c(((e,t)=>{var n=bt(),r=lt(),i;try{i=[].__proto__===Array.prototype}catch(e){if(!e||typeof e!=`object`||!(`code`in e)||e.code!==`ERR_PROTO_ACCESS`)throw e}var a=!!i&&r&&r(Object.prototype,`__proto__`),o=Object,s=o.getPrototypeOf;t.exports=a&&typeof a.get==`function`?n([a.get]):typeof s==`function`?function(e){return s(e==null?e:o(e))}:!1})),St=c(((e,t)=>{var n=ft(),r=pt(),i=xt();t.exports=n?function(e){return n(e)}:r?function(e){if(!e||typeof e!=`object`&&typeof e!=`function`)throw TypeError(`getProto: not an object`);return r(e)}:i?function(e){return i(e)}:null})),Ct=c(((e,t)=>{var n=Function.prototype.call,r=Object.prototype.hasOwnProperty;t.exports=ht().call(n,r)})),wt=c(((e,t)=>{var n,r=Ke(),i=qe(),a=Je(),o=Ye(),s=Xe(),c=Ze(),l=Qe(),u=$e(),d=et(),f=tt(),p=nt(),m=rt(),h=it(),g=at(),_=st(),v=Function,y=function(e){try{return v(`"use strict"; return (`+e+`).constructor;`)()}catch{}},b=lt(),x=ut(),S=function(){throw new l},C=b?function(){try{return arguments.callee,S}catch{try{return b(arguments,`callee`).get}catch{return S}}}():S,w=dt()(),T=St(),E=pt(),D=ft(),O=_t(),k=gt(),A={},ee=typeof Uint8Array>`u`||!T?n:T(Uint8Array),j={__proto__:null,"%AggregateError%":typeof AggregateError>`u`?n:AggregateError,"%Array%":Array,"%ArrayBuffer%":typeof ArrayBuffer>`u`?n:ArrayBuffer,"%ArrayIteratorPrototype%":w&&T?T([][Symbol.iterator]()):n,"%AsyncFromSyncIteratorPrototype%":n,"%AsyncFunction%":A,"%AsyncGenerator%":A,"%AsyncGeneratorFunction%":A,"%AsyncIteratorPrototype%":A,"%Atomics%":typeof Atomics>`u`?n:Atomics,"%BigInt%":typeof BigInt>`u`?n:BigInt,"%BigInt64Array%":typeof BigInt64Array>`u`?n:BigInt64Array,"%BigUint64Array%":typeof BigUint64Array>`u`?n:BigUint64Array,"%Boolean%":Boolean,"%DataView%":typeof DataView>`u`?n:DataView,"%Date%":Date,"%decodeURI%":decodeURI,"%decodeURIComponent%":decodeURIComponent,"%encodeURI%":encodeURI,"%encodeURIComponent%":encodeURIComponent,"%Error%":i,"%eval%":eval,"%EvalError%":a,"%Float16Array%":typeof Float16Array>`u`?n:Float16Array,"%Float32Array%":typeof Float32Array>`u`?n:Float32Array,"%Float64Array%":typeof Float64Array>`u`?n:Float64Array,"%FinalizationRegistry%":typeof FinalizationRegistry>`u`?n:FinalizationRegistry,"%Function%":v,"%GeneratorFunction%":A,"%Int8Array%":typeof Int8Array>`u`?n:Int8Array,"%Int16Array%":typeof Int16Array>`u`?n:Int16Array,"%Int32Array%":typeof Int32Array>`u`?n:Int32Array,"%isFinite%":isFinite,"%isNaN%":isNaN,"%IteratorPrototype%":w&&T?T(T([][Symbol.iterator]())):n,"%JSON%":typeof JSON==`object`?JSON:n,"%Map%":typeof Map>`u`?n:Map,"%MapIteratorPrototype%":typeof Map>`u`||!w||!T?n:T(new Map()[Symbol.iterator]()),"%Math%":Math,"%Number%":Number,"%Object%":r,"%Object.getOwnPropertyDescriptor%":b,"%parseFloat%":parseFloat,"%parseInt%":parseInt,"%Promise%":typeof Promise>`u`?n:Promise,"%Proxy%":typeof Proxy>`u`?n:Proxy,"%RangeError%":o,"%ReferenceError%":s,"%Reflect%":typeof Reflect>`u`?n:Reflect,"%RegExp%":RegExp,"%Set%":typeof Set>`u`?n:Set,"%SetIteratorPrototype%":typeof Set>`u`||!w||!T?n:T(new Set()[Symbol.iterator]()),"%SharedArrayBuffer%":typeof SharedArrayBuffer>`u`?n:SharedArrayBuffer,"%String%":String,"%StringIteratorPrototype%":w&&T?T(``[Symbol.iterator]()):n,"%Symbol%":w?Symbol:n,"%SyntaxError%":c,"%ThrowTypeError%":C,"%TypedArray%":ee,"%TypeError%":l,"%Uint8Array%":typeof Uint8Array>`u`?n:Uint8Array,"%Uint8ClampedArray%":typeof Uint8ClampedArray>`u`?n:Uint8ClampedArray,"%Uint16Array%":typeof Uint16Array>`u`?n:Uint16Array,"%Uint32Array%":typeof Uint32Array>`u`?n:Uint32Array,"%URIError%":u,"%WeakMap%":typeof WeakMap>`u`?n:WeakMap,"%WeakRef%":typeof WeakRef>`u`?n:WeakRef,"%WeakSet%":typeof WeakSet>`u`?n:WeakSet,"%Function.prototype.call%":k,"%Function.prototype.apply%":O,"%Object.defineProperty%":x,"%Object.getPrototypeOf%":E,"%Math.abs%":d,"%Math.floor%":f,"%Math.max%":p,"%Math.min%":m,"%Math.pow%":h,"%Math.round%":g,"%Math.sign%":_,"%Reflect.getPrototypeOf%":D};if(T)try{null.error}catch(e){j[`%Error.prototype%`]=T(T(e))}var M=function e(t){var n;if(t===`%AsyncFunction%`)n=y(`async function () {}`);else if(t===`%GeneratorFunction%`)n=y(`function* () {}`);else if(t===`%AsyncGeneratorFunction%`)n=y(`async function* () {}`);else if(t===`%AsyncGenerator%`){var r=e(`%AsyncGeneratorFunction%`);r&&(n=r.prototype)}else if(t===`%AsyncIteratorPrototype%`){var i=e(`%AsyncGenerator%`);i&&T&&(n=T(i.prototype))}return j[t]=n,n},N={__proto__:null,"%ArrayBufferPrototype%":[`ArrayBuffer`,`prototype`],"%ArrayPrototype%":[`Array`,`prototype`],"%ArrayProto_entries%":[`Array`,`prototype`,`entries`],"%ArrayProto_forEach%":[`Array`,`prototype`,`forEach`],"%ArrayProto_keys%":[`Array`,`prototype`,`keys`],"%ArrayProto_values%":[`Array`,`prototype`,`values`],"%AsyncFunctionPrototype%":[`AsyncFunction`,`prototype`],"%AsyncGenerator%":[`AsyncGeneratorFunction`,`prototype`],"%AsyncGeneratorPrototype%":[`AsyncGeneratorFunction`,`prototype`,`prototype`],"%BooleanPrototype%":[`Boolean`,`prototype`],"%DataViewPrototype%":[`DataView`,`prototype`],"%DatePrototype%":[`Date`,`prototype`],"%ErrorPrototype%":[`Error`,`prototype`],"%EvalErrorPrototype%":[`EvalError`,`prototype`],"%Float32ArrayPrototype%":[`Float32Array`,`prototype`],"%Float64ArrayPrototype%":[`Float64Array`,`prototype`],"%FunctionPrototype%":[`Function`,`prototype`],"%Generator%":[`GeneratorFunction`,`prototype`],"%GeneratorPrototype%":[`GeneratorFunction`,`prototype`,`prototype`],"%Int8ArrayPrototype%":[`Int8Array`,`prototype`],"%Int16ArrayPrototype%":[`Int16Array`,`prototype`],"%Int32ArrayPrototype%":[`Int32Array`,`prototype`],"%JSONParse%":[`JSON`,`parse`],"%JSONStringify%":[`JSON`,`stringify`],"%MapPrototype%":[`Map`,`prototype`],"%NumberPrototype%":[`Number`,`prototype`],"%ObjectPrototype%":[`Object`,`prototype`],"%ObjProto_toString%":[`Object`,`prototype`,`toString`],"%ObjProto_valueOf%":[`Object`,`prototype`,`valueOf`],"%PromisePrototype%":[`Promise`,`prototype`],"%PromiseProto_then%":[`Promise`,`prototype`,`then`],"%Promise_all%":[`Promise`,`all`],"%Promise_reject%":[`Promise`,`reject`],"%Promise_resolve%":[`Promise`,`resolve`],"%RangeErrorPrototype%":[`RangeError`,`prototype`],"%ReferenceErrorPrototype%":[`ReferenceError`,`prototype`],"%RegExpPrototype%":[`RegExp`,`prototype`],"%SetPrototype%":[`Set`,`prototype`],"%SharedArrayBufferPrototype%":[`SharedArrayBuffer`,`prototype`],"%StringPrototype%":[`String`,`prototype`],"%SymbolPrototype%":[`Symbol`,`prototype`],"%SyntaxErrorPrototype%":[`SyntaxError`,`prototype`],"%TypedArrayPrototype%":[`TypedArray`,`prototype`],"%TypeErrorPrototype%":[`TypeError`,`prototype`],"%Uint8ArrayPrototype%":[`Uint8Array`,`prototype`],"%Uint8ClampedArrayPrototype%":[`Uint8ClampedArray`,`prototype`],"%Uint16ArrayPrototype%":[`Uint16Array`,`prototype`],"%Uint32ArrayPrototype%":[`Uint32Array`,`prototype`],"%URIErrorPrototype%":[`URIError`,`prototype`],"%WeakMapPrototype%":[`WeakMap`,`prototype`],"%WeakSetPrototype%":[`WeakSet`,`prototype`]},P=ht(),F=Ct(),te=P.call(k,Array.prototype.concat),I=P.call(O,Array.prototype.splice),L=P.call(k,String.prototype.replace),ne=P.call(k,String.prototype.slice),R=P.call(k,RegExp.prototype.exec),z=/[^%.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|%$))/g,re=/\\(\\)?/g,B=function(e){var t=ne(e,0,1),n=ne(e,-1);if(t===`%`&&n!==`%`)throw new c("invalid intrinsic syntax, expected closing `%`");if(n===`%`&&t!==`%`)throw new c("invalid intrinsic syntax, expected opening `%`");var r=[];return L(e,z,function(e,t,n,i){r[r.length]=n?L(i,re,`$1`):t||e}),r},V=function(e,t){var n=e,r;if(F(N,n)&&(r=N[n],n=`%`+r[0]+`%`),F(j,n)){var i=j[n];if(i===A&&(i=M(n)),i===void 0&&!t)throw new l(`intrinsic `+e+` exists, but is not available. Please file an issue!`);return{alias:r,name:n,value:i}}throw new c(`intrinsic `+e+` does not exist!`)};t.exports=function(e,t){if(typeof e!=`string`||e.length===0)throw new l(`intrinsic name must be a non-empty string`);if(arguments.length>1&&typeof t!=`boolean`)throw new l(`"allowMissing" argument must be a boolean`);if(R(/^%?[^%]*%?$/,e)===null)throw new c("`%` may not be present anywhere but at the beginning and end of the intrinsic name");var n=B(e),r=n.length>0?n[0]:``,i=V(`%`+r+`%`,t),a=i.name,o=i.value,s=!1,u=i.alias;u&&(r=u[0],I(n,te([0,1],u)));for(var d=1,f=!0;d<n.length;d+=1){var p=n[d],m=ne(p,0,1),h=ne(p,-1);if((m===`"`||m===`'`||m==="`"||h===`"`||h===`'`||h==="`")&&m!==h)throw new c(`property names with quotes must have matching quotes`);if((p===`constructor`||!f)&&(s=!0),r+=`.`+p,a=`%`+r+`%`,F(j,a))o=j[a];else if(o!=null){if(!(p in o)){if(!t)throw new l(`base intrinsic for `+e+` exists, but the property is not available.`);return}if(b&&d+1>=n.length){var g=b(o,p);f=!!g,o=f&&`get`in g&&!(`originalValue`in g.get)?g.get:o[p]}else f=F(o,p),o=o[p];f&&!s&&(j[a]=o)}}return o}})),Tt=c(((e,t)=>{var n=wt(),r=bt(),i=r([n(`%String.prototype.indexOf%`)]);t.exports=function(e,t){var a=n(e,!!t);return typeof a==`function`&&i(e,`.prototype.`)>-1?r([a]):a}})),Et=c(((e,t)=>{var n=Ge()(),r=Tt()(`Object.prototype.toString`),i=function(e){return n&&e&&typeof e==`object`&&Symbol.toStringTag in e?!1:r(e)===`[object Arguments]`},a=function(e){return i(e)?!0:typeof e==`object`&&!!e&&`length`in e&&typeof e.length==`number`&&e.length>=0&&r(e)!==`[object Array]`&&`callee`in e&&r(e.callee)===`[object Function]`},o=function(){return i(arguments)}();i.isLegacyArguments=a,t.exports=o?i:a})),Dt=c(((e,t)=>{var n=Tt(),r=Ge()(),i=Ct(),a=lt(),o;if(r){var s=n(`RegExp.prototype.exec`),c={},l=function(){throw c},u={toString:l,valueOf:l};typeof Symbol.toPrimitive==`symbol`&&(u[Symbol.toPrimitive]=l),o=function(e){if(!e||typeof e!=`object`)return!1;var t=a(e,`lastIndex`);if(!(t&&i(t,`value`)))return!1;try{s(e,u)}catch(e){return e===c}}}else{var d=n(`Object.prototype.toString`),f=`[object RegExp]`;o=function(e){return!e||typeof e!=`object`&&typeof e!=`function`?!1:d(e)===f}}t.exports=o})),Ot=c(((e,t)=>{var n=Tt(),r=Dt(),i=n(`RegExp.prototype.exec`),a=Qe();t.exports=function(e){if(!r(e))throw new a("`regex` must be a RegExp");return function(t){return i(e,t)!==null}}})),kt=c(((e,t)=>{let n=function*(){}.constructor;t.exports=()=>n})),At=c(((e,t)=>{var n=Tt(),r=Ot()(/^\s*(?:function)?\*/),i=Ge()(),a=St(),o=n(`Object.prototype.toString`),s=n(`Function.prototype.toString`),c=kt();t.exports=function(e){if(typeof e!=`function`)return!1;if(r(s(e)))return!0;if(!i)return o(e)===`[object GeneratorFunction]`;if(!a)return!1;var t=c();return t&&a(e)===t.prototype}})),jt=c(((e,t)=>{var n=Function.prototype.toString,r=typeof Reflect==`object`&&Reflect!==null&&Reflect.apply,i,a;if(typeof r==`function`&&typeof Object.defineProperty==`function`)try{i=Object.defineProperty({},`length`,{get:function(){throw a}}),a={},r(function(){throw 42},null,i)}catch(e){e!==a&&(r=null)}else r=null;var o=/^\s*class\b/,s=function(e){try{var t=n.call(e);return o.test(t)}catch{return!1}},c=function(e){try{return s(e)?!1:(n.call(e),!0)}catch{return!1}},l=Object.prototype.toString,u=`[object Object]`,d=`[object Function]`,f=`[object GeneratorFunction]`,p=`[object HTMLAllCollection]`,m=`[object HTML document.all class]`,h=`[object HTMLCollection]`,g=typeof Symbol==`function`&&!!Symbol.toStringTag,_=!(0 in[,]),v=function(){return!1};if(typeof document==`object`){var y=document.all;l.call(y)===l.call(document.all)&&(v=function(e){if((_||!e)&&(e===void 0||typeof e==`object`))try{var t=l.call(e);return(t===p||t===m||t===h||t===u)&&e(``)==null}catch{}return!1})}t.exports=r?function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;try{r(e,null,i)}catch(e){if(e!==a)return!1}return!s(e)&&c(e)}:function(e){if(v(e))return!0;if(!e||typeof e!=`function`&&typeof e!=`object`)return!1;if(g)return c(e);if(s(e))return!1;var t=l.call(e);return t!==d&&t!==f&&!/^\[object HTML/.test(t)?!1:c(e)}})),Mt=c(((e,t)=>{var n=jt(),r=Object.prototype.toString,i=Object.prototype.hasOwnProperty,a=function(e,t,n){for(var r=0,a=e.length;r<a;r++)i.call(e,r)&&(n==null?t(e[r],r,e):t.call(n,e[r],r,e))},o=function(e,t,n){for(var r=0,i=e.length;r<i;r++)n==null?t(e.charAt(r),r,e):t.call(n,e.charAt(r),r,e)},s=function(e,t,n){for(var r in e)i.call(e,r)&&(n==null?t(e[r],r,e):t.call(n,e[r],r,e))};function c(e){return r.call(e)===`[object Array]`}t.exports=function(e,t,r){if(!n(t))throw TypeError(`iterator must be a function`);var i;arguments.length>=3&&(i=r),c(e)?a(e,t,i):typeof e==`string`?o(e,t,i):s(e,t,i)}})),Nt=c(((e,t)=>{t.exports=[`Float16Array`,`Float32Array`,`Float64Array`,`Int8Array`,`Int16Array`,`Int32Array`,`Uint8Array`,`Uint8ClampedArray`,`Uint16Array`,`Uint32Array`,`BigInt64Array`,`BigUint64Array`]})),Pt=c(((e,t)=>{var n=Nt(),r=typeof globalThis>`u`?global:globalThis;t.exports=function(){for(var e=[],t=0;t<n.length;t++)typeof r[n[t]]==`function`&&(e[e.length]=n[t]);return e}})),Ft=c(((e,t)=>{var n=ut(),r=Ze(),i=Qe(),a=lt();t.exports=function(e,t,o){if(!e||typeof e!=`object`&&typeof e!=`function`)throw new i("`obj` must be an object or a function`");if(typeof t!=`string`&&typeof t!=`symbol`)throw new i("`property` must be a string or a symbol`");if(arguments.length>3&&typeof arguments[3]!=`boolean`&&arguments[3]!==null)throw new i("`nonEnumerable`, if provided, must be a boolean or null");if(arguments.length>4&&typeof arguments[4]!=`boolean`&&arguments[4]!==null)throw new i("`nonWritable`, if provided, must be a boolean or null");if(arguments.length>5&&typeof arguments[5]!=`boolean`&&arguments[5]!==null)throw new i("`nonConfigurable`, if provided, must be a boolean or null");if(arguments.length>6&&typeof arguments[6]!=`boolean`)throw new i("`loose`, if provided, must be a boolean");var s=arguments.length>3?arguments[3]:null,c=arguments.length>4?arguments[4]:null,l=arguments.length>5?arguments[5]:null,u=arguments.length>6?arguments[6]:!1,d=!!a&&a(e,t);if(n)n(e,t,{configurable:l===null&&d?d.configurable:!l,enumerable:s===null&&d?d.enumerable:!s,value:o,writable:c===null&&d?d.writable:!c});else if(u||!s&&!c&&!l)e[t]=o;else throw new r(`This environment does not support defining a property as non-configurable, non-writable, or non-enumerable.`)}})),It=c(((e,t)=>{var n=ut(),r=function(){return!!n};r.hasArrayLengthDefineBug=function(){if(!n)return null;try{return n([],`length`,{value:1}).length!==1}catch{return!0}},t.exports=r})),Lt=c(((e,t)=>{var n=wt(),r=Ft(),i=It()(),a=lt(),o=Qe(),s=n(`%Math.floor%`);t.exports=function(e,t){if(typeof e!=`function`)throw new o("`fn` is not a function");if(typeof t!=`number`||t<0||t>4294967295||s(t)!==t)throw new o("`length` must be a positive 32-bit integer");var n=arguments.length>2&&!!arguments[2],c=!0,l=!0;if(`length`in e&&a){var u=a(e,`length`);u&&!u.configurable&&(c=!1),u&&!u.writable&&(l=!1)}return(c||l||!n)&&(i?r(e,`length`,t,!0,!0):r(e,`length`,t)),e}})),Rt=c(((e,t)=>{var n=ht(),r=_t(),i=yt();t.exports=function(){return i(n,r,arguments)}})),zt=c(((e,t)=>{var n=Lt(),r=ut(),i=bt(),a=Rt();t.exports=function(e){var t=i(arguments),r=e.length-(arguments.length-1);return n(t,1+(r>0?r:0),!0)},r?r(t.exports,`apply`,{value:a}):t.exports.apply=a})),Bt=c(((e,t)=>{var n=Mt(),r=Pt(),i=zt(),a=Tt(),o=lt(),s=St(),c=a(`Object.prototype.toString`),l=Ge()(),u=typeof globalThis>`u`?global:globalThis,d=r(),f=a(`String.prototype.slice`),p=a(`Array.prototype.indexOf`,!0)||function(e,t){for(var n=0;n<e.length;n+=1)if(e[n]===t)return n;return-1},m={__proto__:null};l&&o&&s?n(d,function(e){var t=new u[e];if(Symbol.toStringTag in t&&s){var n=s(t),r=o(n,Symbol.toStringTag);!r&&n&&(r=o(s(n),Symbol.toStringTag)),m[`$`+e]=i(r.get)}}):n(d,function(e){var t=new u[e],n=t.slice||t.set;n&&(m[`$`+e]=i(n))});var h=function(e){var t=!1;return n(m,function(n,r){if(!t)try{`$`+n(e)===r&&(t=f(r,1))}catch{}}),t},g=function(e){var t=!1;return n(m,function(n,r){if(!t)try{n(e),t=f(r,1)}catch{}}),t};t.exports=function(e){if(!e||typeof e!=`object`)return!1;if(!l){var t=f(c(e),8,-1);return p(d,t)>-1?t:t===`Object`?g(e):!1}return o?h(e):null}})),Vt=c(((e,t)=>{var n=Bt();t.exports=function(e){return!!n(e)}})),Ht=c((e=>{var t=Et(),n=At(),r=Bt(),i=Vt();function a(e){return e.call.bind(e)}var o=typeof BigInt<`u`,s=typeof Symbol<`u`,c=a(Object.prototype.toString),l=a(Number.prototype.valueOf),u=a(String.prototype.valueOf),d=a(Boolean.prototype.valueOf);if(o)var f=a(BigInt.prototype.valueOf);if(s)var p=a(Symbol.prototype.valueOf);function m(e,t){if(typeof e!=`object`)return!1;try{return t(e),!0}catch{return!1}}e.isArgumentsObject=t,e.isGeneratorFunction=n,e.isTypedArray=i;function h(e){return typeof Promise<`u`&&e instanceof Promise||typeof e==`object`&&!!e&&typeof e.then==`function`&&typeof e.catch==`function`}e.isPromise=h;function g(e){return typeof ArrayBuffer<`u`&&ArrayBuffer.isView?ArrayBuffer.isView(e):i(e)||L(e)}e.isArrayBufferView=g;function _(e){return r(e)===`Uint8Array`}e.isUint8Array=_;function v(e){return r(e)===`Uint8ClampedArray`}e.isUint8ClampedArray=v;function y(e){return r(e)===`Uint16Array`}e.isUint16Array=y;function b(e){return r(e)===`Uint32Array`}e.isUint32Array=b;function x(e){return r(e)===`Int8Array`}e.isInt8Array=x;function S(e){return r(e)===`Int16Array`}e.isInt16Array=S;function C(e){return r(e)===`Int32Array`}e.isInt32Array=C;function w(e){return r(e)===`Float32Array`}e.isFloat32Array=w;function T(e){return r(e)===`Float64Array`}e.isFloat64Array=T;function E(e){return r(e)===`BigInt64Array`}e.isBigInt64Array=E;function D(e){return r(e)===`BigUint64Array`}e.isBigUint64Array=D;function O(e){return c(e)===`[object Map]`}O.working=typeof Map<`u`&&O(new Map);function k(e){return typeof Map>`u`?!1:O.working?O(e):e instanceof Map}e.isMap=k;function A(e){return c(e)===`[object Set]`}A.working=typeof Set<`u`&&A(new Set);function ee(e){return typeof Set>`u`?!1:A.working?A(e):e instanceof Set}e.isSet=ee;function j(e){return c(e)===`[object WeakMap]`}j.working=typeof WeakMap<`u`&&j(new WeakMap);function M(e){return typeof WeakMap>`u`?!1:j.working?j(e):e instanceof WeakMap}e.isWeakMap=M;function N(e){return c(e)===`[object WeakSet]`}N.working=typeof WeakSet<`u`&&N(new WeakSet);function P(e){return N(e)}e.isWeakSet=P;function F(e){return c(e)===`[object ArrayBuffer]`}F.working=typeof ArrayBuffer<`u`&&F(new ArrayBuffer);function te(e){return typeof ArrayBuffer>`u`?!1:F.working?F(e):e instanceof ArrayBuffer}e.isArrayBuffer=te;function I(e){return c(e)===`[object DataView]`}I.working=typeof ArrayBuffer<`u`&&typeof DataView<`u`&&I(new DataView(new ArrayBuffer(1),0,1));function L(e){return typeof DataView>`u`?!1:I.working?I(e):e instanceof DataView}e.isDataView=L;var ne=typeof SharedArrayBuffer<`u`?SharedArrayBuffer:void 0;function R(e){return c(e)===`[object SharedArrayBuffer]`}function z(e){return ne===void 0?!1:(R.working===void 0&&(R.working=R(new ne)),R.working?R(e):e instanceof ne)}e.isSharedArrayBuffer=z;function re(e){return c(e)===`[object AsyncFunction]`}e.isAsyncFunction=re;function B(e){return c(e)===`[object Map Iterator]`}e.isMapIterator=B;function V(e){return c(e)===`[object Set Iterator]`}e.isSetIterator=V;function ie(e){return c(e)===`[object Generator]`}e.isGeneratorObject=ie;function H(e){return c(e)===`[object WebAssembly.Module]`}e.isWebAssemblyCompiledModule=H;function U(e){return m(e,l)}e.isNumberObject=U;function ae(e){return m(e,u)}e.isStringObject=ae;function W(e){return m(e,d)}e.isBooleanObject=W;function G(e){return o&&m(e,f)}e.isBigIntObject=G;function oe(e){return s&&m(e,p)}e.isSymbolObject=oe;function K(e){return U(e)||ae(e)||W(e)||G(e)||oe(e)}e.isBoxedPrimitive=K;function se(e){return typeof Uint8Array<`u`&&(te(e)||z(e))}e.isAnyArrayBuffer=se,[`isProxy`,`isExternal`,`isModuleNamespaceObject`].forEach(function(t){Object.defineProperty(e,t,{enumerable:!1,value:function(){throw Error(t+` is not supported in userland`)}})})})),Ut=c(((e,t)=>{t.exports=function(e){return e&&typeof e==`object`&&typeof e.copy==`function`&&typeof e.fill==`function`&&typeof e.readUInt8==`function`}})),Wt=c((e=>{Re();var t=Object.getOwnPropertyDescriptors||function(e){for(var t=Object.keys(e),n={},r=0;r<t.length;r++)n[t[r]]=Object.getOwnPropertyDescriptor(e,t[r]);return n},n=/%[sdj%]/g;e.format=function(e){if(!x(e)){for(var t=[],r=0;r<arguments.length;r++)t.push(o(arguments[r]));return t.join(` `)}for(var r=1,i=arguments,a=i.length,s=String(e).replace(n,function(e){if(e===`%%`)return`%`;if(r>=a)return e;switch(e){case`%s`:return String(i[r++]);case`%d`:return Number(i[r++]);case`%j`:try{return JSON.stringify(i[r++])}catch{return`[Circular]`}default:return e}}),c=i[r];r<a;c=i[++r])v(c)||!T(c)?s+=` `+c:s+=` `+o(c);return s},e.deprecate=function(t,n){if(Q!==void 0&&Q.noDeprecation===!0)return t;if(Q===void 0)return function(){return e.deprecate(t,n).apply(this,arguments)};var r=!1;function i(){if(!r){if(Q.throwDeprecation)throw Error(n);Q.traceDeprecation?console.trace(n):console.error(n),r=!0}return t.apply(this,arguments)}return i};var r={},i=/^$/;if(Q.env.NODE_DEBUG){var a=Q.env.NODE_DEBUG;a=a.replace(/[|\\{}()[\]^$+?.]/g,`\\$&`).replace(/\*/g,`.*`).replace(/,/g,`$|^`).toUpperCase(),i=RegExp(`^`+a+`$`,`i`)}e.debuglog=function(t){if(t=t.toUpperCase(),!r[t])if(i.test(t)){var n=Q.pid;r[t]=function(){var r=e.format.apply(e,arguments);console.error(`%s %d: %s`,t,n,r)}}else r[t]=function(){};return r[t]};function o(t,n){var r={seen:[],stylize:c};return arguments.length>=3&&(r.depth=arguments[2]),arguments.length>=4&&(r.colors=arguments[3]),_(n)?r.showHidden=n:n&&e._extend(r,n),C(r.showHidden)&&(r.showHidden=!1),C(r.depth)&&(r.depth=2),C(r.colors)&&(r.colors=!1),C(r.customInspect)&&(r.customInspect=!0),r.colors&&(r.stylize=s),u(r,t,r.depth)}e.inspect=o,o.colors={bold:[1,22],italic:[3,23],underline:[4,24],inverse:[7,27],white:[37,39],grey:[90,39],black:[30,39],blue:[34,39],cyan:[36,39],green:[32,39],magenta:[35,39],red:[31,39],yellow:[33,39]},o.styles={special:`cyan`,number:`yellow`,boolean:`yellow`,undefined:`grey`,null:`bold`,string:`green`,date:`magenta`,regexp:`red`};function s(e,t){var n=o.styles[t];return n?`\x1B[`+o.colors[n][0]+`m`+e+`\x1B[`+o.colors[n][1]+`m`:e}function c(e,t){return e}function l(e){var t={};return e.forEach(function(e,n){t[e]=!0}),t}function u(t,n,r){if(t.customInspect&&n&&O(n.inspect)&&n.inspect!==e.inspect&&!(n.constructor&&n.constructor.prototype===n)){var i=n.inspect(r,t);return x(i)||(i=u(t,i,r)),i}var a=d(t,n);if(a)return a;var o=Object.keys(n),s=l(o);if(t.showHidden&&(o=Object.getOwnPropertyNames(n)),D(n)&&(o.indexOf(`message`)>=0||o.indexOf(`description`)>=0))return f(n);if(o.length===0){if(O(n)){var c=n.name?`: `+n.name:``;return t.stylize(`[Function`+c+`]`,`special`)}if(w(n))return t.stylize(RegExp.prototype.toString.call(n),`regexp`);if(E(n))return t.stylize(Date.prototype.toString.call(n),`date`);if(D(n))return f(n)}var _=``,v=!1,y=[`{`,`}`];if(g(n)&&(v=!0,y=[`[`,`]`]),O(n)&&(_=` [Function`+(n.name?`: `+n.name:``)+`]`),w(n)&&(_=` `+RegExp.prototype.toString.call(n)),E(n)&&(_=` `+Date.prototype.toUTCString.call(n)),D(n)&&(_=` `+f(n)),o.length===0&&(!v||n.length==0))return y[0]+_+y[1];if(r<0)return w(n)?t.stylize(RegExp.prototype.toString.call(n),`regexp`):t.stylize(`[Object]`,`special`);t.seen.push(n);var b=v?p(t,n,r,s,o):o.map(function(e){return m(t,n,r,s,e,v)});return t.seen.pop(),h(b,_,y)}function d(e,t){if(C(t))return e.stylize(`undefined`,`undefined`);if(x(t)){var n=`'`+JSON.stringify(t).replace(/^"|"$/g,``).replace(/'/g,`\\'`).replace(/\\"/g,`"`)+`'`;return e.stylize(n,`string`)}if(b(t))return e.stylize(``+t,`number`);if(_(t))return e.stylize(``+t,`boolean`);if(v(t))return e.stylize(`null`,`null`)}function f(e){return`[`+Error.prototype.toString.call(e)+`]`}function p(e,t,n,r,i){for(var a=[],o=0,s=t.length;o<s;++o)N(t,String(o))?a.push(m(e,t,n,r,String(o),!0)):a.push(``);return i.forEach(function(i){i.match(/^\d+$/)||a.push(m(e,t,n,r,i,!0))}),a}function m(e,t,n,r,i,a){var o,s,c=Object.getOwnPropertyDescriptor(t,i)||{value:t[i]};if(c.get?s=c.set?e.stylize(`[Getter/Setter]`,`special`):e.stylize(`[Getter]`,`special`):c.set&&(s=e.stylize(`[Setter]`,`special`)),N(r,i)||(o=`[`+i+`]`),s||(e.seen.indexOf(c.value)<0?(s=v(n)?u(e,c.value,null):u(e,c.value,n-1),s.indexOf(`
@@ -22,26 +22,26 @@ Use Chrome, Firefox or Internet Explorer 11`)}var a=ze().Buffer,o=global.crypto|
22
22
  `)}})),Ci=c((e=>{var t=e;t.der=xi(),t.pem=Si()})),wi=c((e=>{var t=e;t.bignum=Tr(),t.define=di().define,t.base=hi(),t.constants=_i(),t.decoders=bi(),t.encoders=Ci()})),Ti=c(((e,t)=>{var n=wi(),r=n.define(`Time`,function(){this.choice({utcTime:this.utctime(),generalTime:this.gentime()})}),i=n.define(`AttributeTypeValue`,function(){this.seq().obj(this.key(`type`).objid(),this.key(`value`).any())}),a=n.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`parameters`).optional(),this.key(`curve`).objid().optional())}),o=n.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(a),this.key(`subjectPublicKey`).bitstr())}),s=n.define(`RelativeDistinguishedName`,function(){this.setof(i)}),c=n.define(`RDNSequence`,function(){this.seqof(s)}),l=n.define(`Name`,function(){this.choice({rdnSequence:this.use(c)})}),u=n.define(`Validity`,function(){this.seq().obj(this.key(`notBefore`).use(r),this.key(`notAfter`).use(r))}),d=n.define(`Extension`,function(){this.seq().obj(this.key(`extnID`).objid(),this.key(`critical`).bool().def(!1),this.key(`extnValue`).octstr())}),f=n.define(`TBSCertificate`,function(){this.seq().obj(this.key(`version`).explicit(0).int().optional(),this.key(`serialNumber`).int(),this.key(`signature`).use(a),this.key(`issuer`).use(l),this.key(`validity`).use(u),this.key(`subject`).use(l),this.key(`subjectPublicKeyInfo`).use(o),this.key(`issuerUniqueID`).implicit(1).bitstr().optional(),this.key(`subjectUniqueID`).implicit(2).bitstr().optional(),this.key(`extensions`).explicit(3).seqof(d).optional())});t.exports=n.define(`X509Certificate`,function(){this.seq().obj(this.key(`tbsCertificate`).use(f),this.key(`signatureAlgorithm`).use(a),this.key(`signatureValue`).bitstr())})})),Ei=c((e=>{var t=wi();e.certificate=Ti(),e.RSAPrivateKey=t.define(`RSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`modulus`).int(),this.key(`publicExponent`).int(),this.key(`privateExponent`).int(),this.key(`prime1`).int(),this.key(`prime2`).int(),this.key(`exponent1`).int(),this.key(`exponent2`).int(),this.key(`coefficient`).int())}),e.RSAPublicKey=t.define(`RSAPublicKey`,function(){this.seq().obj(this.key(`modulus`).int(),this.key(`publicExponent`).int())});var n=t.define(`AlgorithmIdentifier`,function(){this.seq().obj(this.key(`algorithm`).objid(),this.key(`none`).null_().optional(),this.key(`curve`).objid().optional(),this.key(`params`).seq().obj(this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int()).optional())});e.PublicKey=t.define(`SubjectPublicKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).use(n),this.key(`subjectPublicKey`).bitstr())}),e.PrivateKey=t.define(`PrivateKeyInfo`,function(){this.seq().obj(this.key(`version`).int(),this.key(`algorithm`).use(n),this.key(`subjectPrivateKey`).octstr())}),e.EncryptedPrivateKey=t.define(`EncryptedPrivateKeyInfo`,function(){this.seq().obj(this.key(`algorithm`).seq().obj(this.key(`id`).objid(),this.key(`decrypt`).seq().obj(this.key(`kde`).seq().obj(this.key(`id`).objid(),this.key(`kdeparams`).seq().obj(this.key(`salt`).octstr(),this.key(`iters`).int())),this.key(`cipher`).seq().obj(this.key(`algo`).objid(),this.key(`iv`).octstr()))),this.key(`subjectPrivateKey`).octstr())}),e.DSAPrivateKey=t.define(`DSAPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`p`).int(),this.key(`q`).int(),this.key(`g`).int(),this.key(`pub_key`).int(),this.key(`priv_key`).int())}),e.DSAparam=t.define(`DSAparam`,function(){this.int()});var r=t.define(`ECParameters`,function(){this.choice({namedCurve:this.objid()})});e.ECPrivateKey=t.define(`ECPrivateKey`,function(){this.seq().obj(this.key(`version`).int(),this.key(`privateKey`).octstr(),this.key(`parameters`).optional().explicit(0).use(r),this.key(`publicKey`).optional().explicit(1).bitstr())}),e.signature=t.define(`signature`,function(){this.seq().obj(this.key(`r`).int(),this.key(`s`).int())})})),Di=c(((e,t)=>{t.exports={"2.16.840.1.101.3.4.1.1":`aes-128-ecb`,"2.16.840.1.101.3.4.1.2":`aes-128-cbc`,"2.16.840.1.101.3.4.1.3":`aes-128-ofb`,"2.16.840.1.101.3.4.1.4":`aes-128-cfb`,"2.16.840.1.101.3.4.1.21":`aes-192-ecb`,"2.16.840.1.101.3.4.1.22":`aes-192-cbc`,"2.16.840.1.101.3.4.1.23":`aes-192-ofb`,"2.16.840.1.101.3.4.1.24":`aes-192-cfb`,"2.16.840.1.101.3.4.1.41":`aes-256-ecb`,"2.16.840.1.101.3.4.1.42":`aes-256-cbc`,"2.16.840.1.101.3.4.1.43":`aes-256-ofb`,"2.16.840.1.101.3.4.1.44":`aes-256-cfb`}})),Oi=c(((e,t)=>{var n=/Proc-Type: 4,ENCRYPTED[\n\r]+DEK-Info: AES-((?:128)|(?:192)|(?:256))-CBC,([0-9A-H]+)[\n\r]+([0-9A-z\n\r+/=]+)[\n\r]+/m,r=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----/m,i=/^-----BEGIN ((?:.*? KEY)|CERTIFICATE)-----([0-9A-z\n\r+/=]+)-----END \1-----$/m,a=yr(),o=Sr(),s=ze().Buffer;t.exports=function(e,t){var c=e.toString(),l=c.match(n),u;if(l){var d=`aes`+l[1],f=s.from(l[2],`hex`),p=s.from(l[3].replace(/[\r\n]/g,``),`base64`),m=a(t,f.slice(0,8),parseInt(l[1],10)).key,h=[],g=o.createDecipheriv(d,m,f);h.push(g.update(p)),h.push(g.final()),u=s.concat(h)}else{var _=c.match(i);u=s.from(_[2].replace(/[\r\n]/g,``),`base64`)}return{tag:c.match(r)[1],data:u}}})),ki=c(((e,t)=>{var n=Ei(),r=Di(),i=Oi(),a=Sr(),o=Yn().pbkdf2Sync,s=ze().Buffer;function c(e,t){var n=e.algorithm.decrypt.kde.kdeparams.salt,i=parseInt(e.algorithm.decrypt.kde.kdeparams.iters.toString(),10),c=r[e.algorithm.decrypt.cipher.algo.join(`.`)],l=e.algorithm.decrypt.cipher.iv,u=e.subjectPrivateKey,d=o(t,n,i,parseInt(c.split(`-`)[1],10)/8,`sha1`),f=a.createDecipheriv(c,d,l),p=[];return p.push(f.update(u)),p.push(f.final()),s.concat(p)}function l(e){var t;typeof e==`object`&&!s.isBuffer(e)&&(t=e.passphrase,e=e.key),typeof e==`string`&&(e=s.from(e));var r=i(e,t),a=r.tag,o=r.data,l,u;switch(a){case`CERTIFICATE`:u=n.certificate.decode(o,`der`).tbsCertificate.subjectPublicKeyInfo;case`PUBLIC KEY`:switch(u||=n.PublicKey.decode(o,`der`),l=u.algorithm.algorithm.join(`.`),l){case`1.2.840.113549.1.1.1`:return n.RSAPublicKey.decode(u.subjectPublicKey.data,`der`);case`1.2.840.10045.2.1`:return u.subjectPrivateKey=u.subjectPublicKey,{type:`ec`,data:u};case`1.2.840.10040.4.1`:return u.algorithm.params.pub_key=n.DSAparam.decode(u.subjectPublicKey.data,`der`),{type:`dsa`,data:u.algorithm.params};default:throw Error(`unknown key id `+l)}case`ENCRYPTED PRIVATE KEY`:o=n.EncryptedPrivateKey.decode(o,`der`),o=c(o,t);case`PRIVATE KEY`:switch(u=n.PrivateKey.decode(o,`der`),l=u.algorithm.algorithm.join(`.`),l){case`1.2.840.113549.1.1.1`:return n.RSAPrivateKey.decode(u.subjectPrivateKey,`der`);case`1.2.840.10045.2.1`:return{curve:u.algorithm.curve,privateKey:n.ECPrivateKey.decode(u.subjectPrivateKey,`der`).privateKey};case`1.2.840.10040.4.1`:return u.algorithm.params.priv_key=n.DSAparam.decode(u.subjectPrivateKey,`der`),{type:`dsa`,params:u.algorithm.params};default:throw Error(`unknown key id `+l)}case`RSA PUBLIC KEY`:return n.RSAPublicKey.decode(o,`der`);case`RSA PRIVATE KEY`:return n.RSAPrivateKey.decode(o,`der`);case`DSA PRIVATE KEY`:return{type:`dsa`,params:n.DSAPrivateKey.decode(o,`der`)};case`EC PRIVATE KEY`:return o=n.ECPrivateKey.decode(o,`der`),{curve:o.parameters.value,privateKey:o.privateKey};default:throw Error(`unknown key type `+a)}}l.signature=n.signature,t.exports=l})),Ai=c(((e,t)=>{t.exports={"1.3.132.0.10":`secp256k1`,"1.3.132.0.33":`p224`,"1.2.840.10045.3.1.1":`p192`,"1.2.840.10045.3.1.7":`p256`,"1.3.132.0.34":`p384`,"1.3.132.0.35":`p521`}})),ji=c(((e,t)=>{var n=ze().Buffer,r=Vn(),i=Nr(),a=li().ec,o=Mr(),s=ki(),c=Ai(),l=1;function u(e,t,r,a,o){var c=s(t);if(c.curve){if(a!==`ecdsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);return d(e,c)}else if(c.type===`dsa`){if(a!==`dsa`)throw Error(`wrong private key type`);return f(e,c,r)}if(a!==`rsa`&&a!==`ecdsa/rsa`)throw Error(`wrong private key type`);if(t.padding!==void 0&&t.padding!==l)throw Error(`illegal or unsupported padding mode`);e=n.concat([o,e]);for(var u=c.modulus.byteLength(),p=[0,1];e.length+p.length+1<u;)p.push(255);p.push(0);for(var m=-1;++m<e.length;)p.push(e[m]);return i(p,c)}function d(e,t){var r=c[t.curve.join(`.`)];if(!r)throw Error(`unknown curve `+t.curve.join(`.`));var i=new a(r).keyFromPrivate(t.privateKey).sign(e);return n.from(i.toDER())}function f(e,t,n){for(var r=t.params.priv_key,i=t.params.p,a=t.params.q,s=t.params.g,c=new o(0),l,u=h(e,a).mod(a),d=!1,f=m(r,a,e,n);d===!1;)l=_(a,f,n),c=v(s,l,i,a),d=l.invm(a).imul(u.add(r.mul(c))).mod(a),d.cmpn(0)===0&&(d=!1,c=new o(0));return p(c,d)}function p(e,t){e=e.toArray(),t=t.toArray(),e[0]&128&&(e=[0].concat(e)),t[0]&128&&(t=[0].concat(t));var r=[48,e.length+t.length+4,2,e.length];return r=r.concat(e,[2,t.length],t),n.from(r)}function m(e,t,i,a){if(e=n.from(e.toArray()),e.length<t.byteLength()){var o=n.alloc(t.byteLength()-e.length);e=n.concat([o,e])}var s=i.length,c=g(i,t),l=n.alloc(s);l.fill(1);var u=n.alloc(s);return u=r(a,u).update(l).update(n.from([0])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),u=r(a,u).update(l).update(n.from([1])).update(e).update(c).digest(),l=r(a,u).update(l).digest(),{k:u,v:l}}function h(e,t){var n=new o(e),r=(e.length<<3)-t.bitLength();return r>0&&n.ishrn(r),n}function g(e,t){e=h(e,t),e=e.mod(t);var r=n.from(e.toArray());if(r.length<t.byteLength()){var i=n.alloc(t.byteLength()-r.length);r=n.concat([i,r])}return r}function _(e,t,i){var a,o;do{for(a=n.alloc(0);a.length*8<e.bitLength();)t.v=r(i,t.k).update(t.v).digest(),a=n.concat([a,t.v]);o=h(a,e),t.k=r(i,t.k).update(t.v).update(n.from([0])).digest(),t.v=r(i,t.k).update(t.v).digest()}while(o.cmp(e)!==-1);return o}function v(e,t,n,r){return e.toRed(o.mont(n)).redPow(t).fromRed().mod(r)}t.exports=u,t.exports.getKey=m,t.exports.makeKey=_})),Mi=c(((e,t)=>{var n=ze().Buffer,r=Mr(),i=li().ec,a=ki(),o=Ai();function s(e,t,i,o,s){var u=a(i);if(u.type===`ec`){if(o!==`ecdsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);return c(e,t,u)}else if(u.type===`dsa`){if(o!==`dsa`)throw Error(`wrong public key type`);return l(e,t,u)}if(o!==`rsa`&&o!==`ecdsa/rsa`)throw Error(`wrong public key type`);t=n.concat([s,t]);for(var d=u.modulus.byteLength(),f=[1],p=0;t.length+f.length+2<d;)f.push(255),p+=1;f.push(0);for(var m=-1;++m<t.length;)f.push(t[m]);f=n.from(f);var h=r.mont(u.modulus);e=new r(e).toRed(h),e=e.redPow(new r(u.publicExponent)),e=n.from(e.fromRed().toArray());var g=p<8?1:0;for(d=Math.min(e.length,f.length),e.length!==f.length&&(g=1),m=-1;++m<d;)g|=e[m]^f[m];return g===0}function c(e,t,n){var r=o[n.data.algorithm.curve.join(`.`)];if(!r)throw Error(`unknown curve `+n.data.algorithm.curve.join(`.`));var a=new i(r),s=n.data.subjectPrivateKey.data;return a.verify(t,e,s)}function l(e,t,n){var i=n.data.p,o=n.data.q,s=n.data.g,c=n.data.pub_key,l=a.signature.decode(e,`der`),d=l.s,f=l.r;u(d,o),u(f,o);var p=r.mont(i),m=d.invm(o);return s.toRed(p).redPow(new r(t).mul(m).mod(o)).fromRed().mul(c.toRed(p).redPow(f.mul(m).mod(o)).fromRed()).mod(i).mod(o).cmp(f)===0}function u(e,t){if(e.cmpn(0)<=0||e.cmp(t)>=0)throw Error(`invalid sig`)}t.exports=s})),Ni=c(((e,t)=>{var n=ze().Buffer,r=Rn(),i=En(),a=Ve(),o=ji(),s=Mi(),c=Hn();Object.keys(c).forEach(function(e){c[e].id=n.from(c[e].id,`hex`),c[e.toLowerCase()]=c[e]});function l(e){i.Writable.call(this);var t=c[e];if(!t)throw Error(`Unknown message digest`);this._hashType=t.hash,this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(l,i.Writable),l.prototype._write=function(e,t,n){this._hash.update(e),n()},l.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},l.prototype.sign=function(e,t){this.end();var n=o(this._hash.digest(),e,this._hashType,this._signType,this._tag);return t?n.toString(t):n};function u(e){i.Writable.call(this);var t=c[e];if(!t)throw Error(`Unknown message digest`);this._hash=r(t.hash),this._tag=t.id,this._signType=t.sign}a(u,i.Writable),u.prototype._write=function(e,t,n){this._hash.update(e),n()},u.prototype.update=function(e,t){return this._hash.update(typeof e==`string`?n.from(e,t):e),this},u.prototype.verify=function(e,t,r){var i=typeof t==`string`?n.from(t,r):t;return this.end(),s(i,this._hash.digest(),e,this._signType,this._tag)};function d(e){return new l(e)}function f(e){return new u(e)}t.exports={Sign:d,Verify:f,createSign:d,createVerify:f}})),Pi=c(((e,t)=>{var n=q(),r=li(),i=Tr();t.exports=function(e){return new o(e)};var a={secp256k1:{name:`secp256k1`,byteLength:32},secp224r1:{name:`p224`,byteLength:28},prime256v1:{name:`p256`,byteLength:32},prime192v1:{name:`p192`,byteLength:24},ed25519:{name:`ed25519`,byteLength:32},secp384r1:{name:`p384`,byteLength:48},secp521r1:{name:`p521`,byteLength:66}};a.p224=a.secp224r1,a.p256=a.secp256r1=a.prime256v1,a.p192=a.secp192r1=a.prime192v1,a.p384=a.secp384r1,a.p521=a.secp521r1;function o(e){this.curveType=a[e],this.curveType||={name:e},this.curve=new r.ec(this.curveType.name),this.keys=void 0}o.prototype.generateKeys=function(e,t){return this.keys=this.curve.genKeyPair(),this.getPublicKey(e,t)},o.prototype.computeSecret=function(e,t,r){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),s(this.curve.keyFromPublic(e).getPublic().mul(this.keys.getPrivate()).getX(),r,this.curveType.byteLength)},o.prototype.getPublicKey=function(e,t){var n=this.keys.getPublic(t===`compressed`,!0);return t===`hybrid`&&(n[n.length-1]%2?n[0]=7:n[0]=6),s(n,e)},o.prototype.getPrivateKey=function(e){return s(this.keys.getPrivate(),e)},o.prototype.setPublicKey=function(e,t){return t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t)),this.keys._importPublic(e),this},o.prototype.setPrivateKey=function(e,t){t||=`utf8`,n.Buffer.isBuffer(e)||(e=new n.Buffer(e,t));var r=new i(e);return r=r.toString(16),this.keys=this.curve.genKeyPair(),this.keys._importPrivate(r),this};function s(e,t,r){Array.isArray(e)||(e=e.toArray());var i=new n.Buffer(e);if(r&&i.length<r){var a=new n.Buffer(r-i.length);a.fill(0),i=n.Buffer.concat([a,i])}return t?i.toString(t):i}})),Fi=c(((e,t)=>{var n=Rn(),r=ze().Buffer;t.exports=function(e,t){for(var a=r.alloc(0),o=0,s;a.length<t;)s=i(o++),a=r.concat([a,n(`sha1`).update(e).update(s).digest()]);return a.slice(0,t)};function i(e){var t=r.allocUnsafe(4);return t.writeUInt32BE(e,0),t}})),Ii=c(((e,t)=>{t.exports=function(e,t){for(var n=e.length,r=-1;++r<n;)e[r]^=t[r];return e}})),Li=c(((e,t)=>{var n=Tr(),r=ze().Buffer;function i(e,t){return r.from(e.toRed(n.mont(t.modulus)).redPow(new n(t.publicExponent)).fromRed().toArray())}t.exports=i})),Ri=c(((e,t)=>{var n=ki(),r=Be(),i=Rn(),a=Fi(),o=Ii(),s=Tr(),c=Li(),l=Nr(),u=ze().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,a=n(e),o;if(i===4)o=d(a,t);else if(i===1)o=f(a,t,r);else if(i===3){if(o=new s(t),o.cmp(a.modulus)>=0)throw Error(`data too long for modulus`)}else throw Error(`unknown padding`);return r?l(o,a):c(o,a)};function d(e,t){var n=e.modulus.byteLength(),c=t.length,l=i(`sha1`).update(u.alloc(0)).digest(),d=l.length,f=2*d;if(c>n-f-2)throw Error(`message too long`);var p=u.alloc(n-c-f-2),m=n-d-1,h=r(d),g=o(u.concat([l,p,u.alloc(1,1),t],m),a(h,m)),_=o(h,a(g,d));return new s(u.concat([u.alloc(1),_,g],n))}function f(e,t,n){var r=t.length,i=e.modulus.byteLength();if(r>i-11)throw Error(`message too long`);var a=n?u.alloc(i-r-3,255):p(i-r-3);return new s(u.concat([u.from([0,n?1:2]),a,u.alloc(1),t],i))}function p(e){for(var t=u.allocUnsafe(e),n=0,i=r(e*2),a=0,o;n<e;)a===i.length&&(i=r(e*2),a=0),o=i[a++],o&&(t[n++]=o);return t}})),zi=c(((e,t)=>{var n=ki(),r=Fi(),i=Ii(),a=Tr(),o=Nr(),s=Rn(),c=Li(),l=ze().Buffer;t.exports=function(e,t,r){var i=e.padding?e.padding:r?1:4,s=n(e),f=s.modulus.byteLength();if(t.length>f||new a(t).cmp(s.modulus)>=0)throw Error(`decryption error`);var p=r?c(new a(t),s):o(t,s),m=l.alloc(f-p.length);if(p=l.concat([m,p],f),i===4)return u(s,p);if(i===1)return d(s,p,r);if(i===3)return p;throw Error(`unknown padding`)};function u(e,t){var n=e.modulus.byteLength(),a=s(`sha1`).update(l.alloc(0)).digest(),o=a.length;if(t[0]!==0)throw Error(`decryption error`);var c=t.slice(1,o+1),u=t.slice(o+1),d=i(u,r(i(c,r(u,o)),n-o-1));if(f(a,d.slice(0,o)))throw Error(`decryption error`);for(var p=o;d[p]===0;)p++;if(d[p++]!==1)throw Error(`decryption error`);return d.slice(p)}function d(e,t,n){for(var r=t.slice(0,2),i=2,a=0;t[i++]!==0;)if(i>=t.length){a++;break}var o=t.slice(2,i-1);if((r.toString(`hex`)!==`0002`&&!n||r.toString(`hex`)!==`0001`&&n)&&a++,o.length<8&&a++,a)throw Error(`decryption error`);return t.slice(i)}function f(e,t){e=l.from(e),t=l.from(t);var n=0,r=e.length;e.length!==t.length&&(n++,r=Math.min(e.length,t.length));for(var i=-1;++i<r;)n+=e[i]^t[i];return n}})),Bi=c((e=>{e.publicEncrypt=Ri(),e.privateDecrypt=zi(),e.privateEncrypt=function(t,n){return e.publicEncrypt(t,n,!0)},e.publicDecrypt=function(t,n){return e.privateDecrypt(t,n,!0)}})),Vi=c((e=>{Re();function t(){throw Error(`secure random number generation not supported by this browser
23
23
  use chrome, FireFox or Internet Explorer 11`)}var n=ze(),r=Be(),i=n.Buffer,a=n.kMaxLength,o=global.crypto||global.msCrypto,s=2**32-1;function c(e,t){if(typeof e!=`number`||e!==e)throw TypeError(`offset must be a number`);if(e>s||e<0)throw TypeError(`offset must be a uint32`);if(e>a||e>t)throw RangeError(`offset out of range`)}function l(e,t,n){if(typeof e!=`number`||e!==e)throw TypeError(`size must be a number`);if(e>s||e<0)throw TypeError(`size must be a uint32`);if(e+t>n||e>a)throw RangeError(`buffer too small`)}o&&o.getRandomValues||!Q.browser?(e.randomFill=u,e.randomFillSync=f):(e.randomFill=t,e.randomFillSync=t);function u(e,t,n,r){if(!i.isBuffer(e)&&!(e instanceof global.Uint8Array))throw TypeError(`"buf" argument must be a Buffer or Uint8Array`);if(typeof t==`function`)r=t,t=0,n=e.length;else if(typeof n==`function`)r=n,n=e.length-t;else if(typeof r!=`function`)throw TypeError(`"cb" argument must be a function`);return c(t,e.length),l(n,t,e.length),d(e,t,n,r)}function d(e,t,n,i){if(Q.browser){var a=e.buffer,s=new Uint8Array(a,t,n);if(o.getRandomValues(s),i){Q.nextTick(function(){i(null,e)});return}return e}if(i){r(n,function(n,r){if(n)return i(n);r.copy(e,t),i(null,e)});return}return r(n).copy(e,t),e}function f(e,t,n){if(t===void 0&&(t=0),!i.isBuffer(e)&&!(e instanceof global.Uint8Array))throw TypeError(`"buf" argument must be a Buffer or Uint8Array`);return c(t,e.length),n===void 0&&(n=e.length-t),l(n,t,e.length),d(e,t,n)}})),Hi=c((e=>{e.randomBytes=e.rng=e.pseudoRandomBytes=e.prng=Be(),e.createHash=e.Hash=Rn(),e.createHmac=e.Hmac=Vn();var t=Un(),n=Object.keys(t),r=[`sha1`,`sha224`,`sha256`,`sha384`,`sha512`,`md5`,`rmd160`].concat(n);e.getHashes=function(){return r};var i=Yn();e.pbkdf2=i.pbkdf2,e.pbkdf2Sync=i.pbkdf2Sync;var a=wr();e.Cipher=a.Cipher,e.createCipher=a.createCipher,e.Cipheriv=a.Cipheriv,e.createCipheriv=a.createCipheriv,e.Decipher=a.Decipher,e.createDecipher=a.createDecipher,e.Decipheriv=a.Decipheriv,e.createDecipheriv=a.createDecipheriv,e.getCiphers=a.getCiphers,e.listCiphers=a.listCiphers;var o=jr();e.DiffieHellmanGroup=o.DiffieHellmanGroup,e.createDiffieHellmanGroup=o.createDiffieHellmanGroup,e.getDiffieHellman=o.getDiffieHellman,e.createDiffieHellman=o.createDiffieHellman,e.DiffieHellman=o.DiffieHellman;var s=Ni();e.createSign=s.createSign,e.Sign=s.Sign,e.createVerify=s.createVerify,e.Verify=s.Verify,e.createECDH=Pi();var c=Bi();e.publicEncrypt=c.publicEncrypt,e.privateEncrypt=c.privateEncrypt,e.publicDecrypt=c.publicDecrypt,e.privateDecrypt=c.privateDecrypt;var l=Vi();e.randomFill=l.randomFill,e.randomFillSync=l.randomFillSync,e.createCredentials=function(){throw Error(`sorry, createCredentials is not implemented yet
24
24
  we accept pull requests
25
- https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),Ui=q(),Wi=d(Hi(),1);let Gi={hash(e,...t){let n=Wi.createHash(e);return n.update(Ui.Buffer.concat(t)),n.digest()},convertPasswordToHash(e,t,n,r){if(t=t.toLowerCase(),Wi.getHashes().indexOf(t)<0)throw Error(`Hash algorithm '${t}' not supported!`);let i=Ui.Buffer.from(e,`utf16le`),a=this.hash(t,Ui.Buffer.from(n,`base64`),i);for(let e=0;e<r;e++){let n=Ui.Buffer.alloc(4);n.writeUInt32LE(e,0),a=this.hash(t,a,n)}return a.toString(`base64`)},randomBytes(e){return Wi.randomBytes(e)}};var Ki=l({default:()=>qi}),qi,Ji=s((()=>{qi=null}));Ji();function Yi(){}let Xi=function(e,t,n,r){e.super_=t,r||(r=n,n=null),n&&Object.keys(n).forEach(t=>{Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))});let i={constructor:{value:e,enumerable:!1,writable:!1,configurable:!0}};r&&Object.keys(r).forEach(e=>{i[e]=Object.getOwnPropertyDescriptor(r,e)}),e.prototype=Object.create(t.prototype,i)};function Zi(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function Qi(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}let $i=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/;function ea(e){let t=$i.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){let t=e.charCodeAt(a);switch(t){case 34:r=`&quot;`;break;case 38:r=`&amp;`;break;case 39:r=`&apos;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;break;case 127:r=``;break;default:if(t<=31&&(t<=8||t>=11&&t!==13)){r=``;break}continue}i!==a&&(n+=e.substring(i,a)),i=a+1,r&&(n+=r)}return i===a?n:n+e.substring(i,a)}function ta(e){return e.replace(/&([a-z]*);/g,e=>{switch(e){case`&lt;`:return`<`;case`&gt;`:return`>`;case`&amp;`:return`&`;case`&apos;`:return`'`;case`&quot;`:return`"`;default:return e}})}function na(e){let t=parseInt(e,10);return Number.isNaN(t)?0:t}function ra(e){return e?(e=e.replace(/\[[^\]]*]/g,``),e=e.replace(/"[^"]*"/g,``),e.match(/[ymdhMsb]+/)!==null):!1}function ia(e){return new Promise(t=>{qi.access(e,qi.constants.F_OK,e=>{t(!e)})})}function aa(e){return e===!0||e===`true`||e===1||e===`1`}function*oa(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 sa(e){let t=Array.from(e);return t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.sort()}function ca(e,t=null){return e.reduce((e,n)=>(e[n]=t,e),{})}function la(e,t){ua(e,t);let{sourceSheet:n}=t,{rows:r,columns:i,values:a}=t,o=da(n,[...r,...i]),s=o.reduce((e,t,n)=>(e[t.name]=n,e),{});return{sourceSheet:n,rows:r.map(e=>s[e]),columns:i.map(e=>s[e]),values:a.map(e=>s[e]),metric:`sum`,cacheFields:o,cacheId:`10`}}function ua(e,t){if(e.workbook.pivotTables.length===1)throw Error(`A pivot table was already added. At this time, ExcelTS supports at most one pivot table per file.`);if(t.metric&&t.metric!==`sum`)throw Error(`Only the "sum" metric is supported at this time.`);let n=ca(t.sourceSheet.getRow(1).values.slice(1),!0);for(let e of[...t.rows,...t.columns,...t.values])if(!n[e])throw Error(`The header name "${e}" was not found in ${t.sourceSheet.name}.`);if(!t.rows.length)throw Error(`No pivot table rows specified.`);if(!t.columns.length)throw Error(`No pivot table columns specified.`);if(t.values.length!==1)throw Error(`Exactly 1 value needs to be specified at this time.`)}function da(e,t){let n=e.getRow(1).values,r=ca(t,!0),i=t=>{let n=e.getColumn(t).values.splice(2);return sa(new Set(n))},a=[];for(let e of oa(1,n.length)){let t=n[e],o=r[t]?i(e):null;a.push({name:t,sharedItems:o})}return a}let fa=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),pa=(e,t,n,r=[])=>{e[n]&&(t[n]=fa(e[n],r))},ma=e=>Object.keys(e).length===0,ha=e=>{if(!e)return e;if(ma(e))return{};let t={...e};return pa(e,t,`font`,[`color`]),pa(e,t,`alignment`),pa(e,t,`protection`),e.border&&(pa(e,t,`border`),pa(e.border,t.border,`top`,[`color`]),pa(e.border,t.border,`left`,[`color`]),pa(e.border,t.border,`bottom`,[`color`]),pa(e.border,t.border,`right`,[`color`]),pa(e.border,t.border,`diagonal`,[`color`])),e.fill&&(pa(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>fa(e,[`color`])))),t};var ga=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.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,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: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,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 se,this.views=e.views||[],this.autoFilter=e.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[]}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 h;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=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 ae(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 n=this._keys[e];if(n)return n;t=m.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 ae(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=[e,t];n.forEach(e=>{r.push(e[i]||null)}),this.getRow(i+1).splice(...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=null;this.workbook.definedNames.spliceColumns(this.name,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 U(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=ha(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=ha(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);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=r.style,t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=e.style})}}spliceRows(e,t,...n){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=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=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=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{if(e.getCell(n).style=t.style,t._value.constructor.name===`MergeValue`){let e=this.getRow(t._row._number+i).getCell(n),r=t._value._master,a=this.getRow(r._row._number+i).getCell(r._column._number);e.merge(a)}})}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]}this.workbook.definedNames.spliceRows(this.name,e,t,i)}eachRow(e,t){if(t||(t=e,e=void 0),e&&e.includeEmpty){let e=this._rows.length;for(let n=1;n<=e;n++)t(this.getRow(n),n)}else this._rows.forEach(e=>{e&&e.hasValues&&t(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=m.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,t){let n=m.getAddress(e,t);return this.getRow(n.row).getCellEx(n)}mergeCells(...e){let t=new h(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new h(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 n=this.getCell(e.top,e.left);for(let r=e.top;r<=e.bottom;r++)for(let i=e.left;i<=e.right;i++)(r>e.top||i>e.left)&&this.getCell(r,i).merge(n,t);this._merges[n.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]}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new h(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===S.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,t,n,r=`shared`){let{top:i,left:a,bottom:o,right:s}=m.decode(e),c=s-a+1,l=m.encodeAddress(i,a),u=r===`shared`,d;d=typeof n==`function`?n:Array.isArray(n)?Array.isArray(n[0])?(e,t)=>n[e-i][t-a]:(e,t)=>n[(e-i)*c+(t-a)]:()=>void 0;let f=!0;for(let n=i;n<=o;n++)for(let i=a;i<=s;i++)f?(this.getCell(n,i).value={shareType:r,formula:t,ref:e,result:d(n,i)},f=!1):this.getCell(n,i).value=u?{sharedFormula:l,result:d(n,i)}:d(n,i)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new G(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new G(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}protect(e,t){return new Promise(n=>{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=Gi.randomBytes(16).toString(`base64`),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=Gi.convertPasswordToHash(e,`SHA512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount),n()})}unprotect(){this.sheetProtection=null}addTable(e){let t=new K(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){console.warn(`Warning: Pivot Table support is experimental.
26
- Please leave feedback at https://github.com/excelts/excelts/discussions/2575`);let t=la(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,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};e.cols=ae.toModel(this.columns);let t=e.rows=[],n=e.dimensions=new h;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 U(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=ae.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new se(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new G(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new K(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings}};function _a(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function va(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>va(e));let t={};for(let n of Object.keys(e))_a(n)&&(t[n]=va(e[n]));return t}var ya=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(m.decodeEx(e))}getCell(e){return this.findCellEx(m.decodeEx(e),!0)}findCell(e){return this.findCellEx(m.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,n){if(!_a(e))throw Error(`Invalid sheet name: ${e}`);let r=this.sheets[e]||(this.sheets[e]=[]),i=r[t]||(r[t]=[]);return i[n]||(i[n]={sheetName:e,address:m.n2l(n)+t,row:t,col:n})}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(!_a(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(!_a(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(!_a(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...va(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 ba=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var xa=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new ya)}add(e,t){let n=m.decodeEx(e);this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(e.top)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let i={sheetName:e.sheetName,address:m.n2l(t)+r,row:r,col:t};n.addCellEx(i)}else n.addCellEx(e)}remove(e,t){let n=m.decodeEx(e);this.removeEx(n,t)}removeEx(e,t){this.getMatrix(t).removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){return this.getNamesEx(m.decodeEx(e))}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(Boolean)}_explore(e,t){t.mark=!1;let{sheetName:n}=t,r=new h(t.row,t.col,t.row,t.col,n),i,a;function o(i,a){let o=e.findCellAt(n,i,t.col);return!o||!o.mark?!1:(r[a]=i,o.mark=!1,!0)}for(a=t.row-1;o(a,`top`);a--);for(a=t.row+1;o(a,`bottom`);a++);function s(t,i){let o=[];for(a=r.top;a<=r.bottom;a++){let r=e.findCellAt(n,a,t);if(r&&r.mark)o.push(r);else return!1}r[i]=t;for(let e=0;e<o.length;e++)o[e].mark=!1;return!0}for(i=t.col-1;s(i,`left`);i--);for(i=t.col+1;s(i,`right`);i++);return r}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,n)=>{e&&(e.row!==t||e.col!==n)&&(e.row=t,e.col=n,e.address=m.n2l(n)+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 ya;e.ranges.forEach(e=>{ba.test(e.split(`!`).pop()||``)&&n.addCell(e)})})}},Sa=Uint8Array,Ca=Uint16Array,wa=Int32Array,Ta=new Sa([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Ea=new Sa([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,0,0]),Da=new Sa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Oa=function(e,t){for(var n=new Ca(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new wa(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},ka=Oa(Ta,2),Aa=ka.b,ja=ka.r;Aa[28]=258,ja[258]=28;for(var Ma=Oa(Ea,0),Na=Ma.b,Pa=Ma.r,Fa=new Ca(32768),Ia=0;Ia<32768;++Ia){var La=(Ia&43690)>>1|(Ia&21845)<<1;La=(La&52428)>>2|(La&13107)<<2,La=(La&61680)>>4|(La&3855)<<4,Fa[Ia]=((La&65280)>>8|(La&255)<<8)>>1}for(var Ra=(function(e,t,n){for(var r=e.length,i=0,a=new Ca(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ca(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ca(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[Fa[d]>>c]=l}else for(s=new Ca(r),i=0;i<r;++i)e[i]&&(s[i]=Fa[o[e[i]-1]++]>>15-e[i]);return s}),za=new Sa(288),Ia=0;Ia<144;++Ia)za[Ia]=8;for(var Ia=144;Ia<256;++Ia)za[Ia]=9;for(var Ia=256;Ia<280;++Ia)za[Ia]=7;for(var Ia=280;Ia<288;++Ia)za[Ia]=8;for(var Ba=new Sa(32),Ia=0;Ia<32;++Ia)Ba[Ia]=5;var Va=Ra(za,9,0),Ha=Ra(za,9,1),Ua=Ra(Ba,5,0),Wa=Ra(Ba,5,1),Ga=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ka=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},qa=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Ja=function(e){return(e+7)/8|0},Ya=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new Sa(e.subarray(t,n))},Xa=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],Za=function(e,t,n){var r=Error(t||Xa[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,Za),!n)throw r;return r},Qa=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new Sa(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new Sa(i*3));var l=function(e){var t=n.length;if(e>t){var r=new Sa(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Ka(e,d,1);var v=Ka(e,d+1,3);if(d+=3,v)if(v==1)p=Ha,m=Wa,h=9,g=5;else if(v==2){var y=Ka(e,d,31)+257,b=Ka(e,d+10,15)+4,x=y+Ka(e,d+5,31)+1;d+=14;for(var S=new Sa(x),C=new Sa(19),w=0;w<b;++w)C[Da[w]]=Ka(e,d+w*3,7);d+=b*3;for(var T=Ga(C),E=(1<<T)-1,D=Ra(C,T,1),w=0;w<x;){var O=D[Ka(e,d,E)];d+=O&15;var k=O>>4;if(k<16)S[w++]=k;else{var A=0,ee=0;for(k==16?(ee=3+Ka(e,d,3),d+=2,A=S[w-1]):k==17?(ee=3+Ka(e,d,7),d+=3):k==18&&(ee=11+Ka(e,d,127),d+=7);ee--;)S[w++]=A}}var j=S.subarray(0,y),M=S.subarray(y);h=Ga(j),g=Ga(M),p=Ra(j,h,1),m=Ra(M,g,1)}else Za(1);else{var k=Ja(d)+4,N=e[k-4]|e[k-3]<<8,P=k+N;if(P>i){c&&Za(0);break}s&&l(f+N),n.set(e.subarray(k,P),f),t.b=f+=N,t.p=d=P*8,t.f=u;continue}if(d>_){c&&Za(0);break}}s&&l(f+131072);for(var F=(1<<h)-1,te=(1<<g)-1,I=d;;I=d){var A=p[qa(e,d)&F],L=A>>4;if(d+=A&15,d>_){c&&Za(0);break}if(A||Za(2),L<256)n[f++]=L;else if(L==256){I=d,p=null;break}else{var ne=L-254;if(L>264){var w=L-257,R=Ta[w];ne=Ka(e,d,(1<<R)-1)+Aa[w],d+=R}var z=m[qa(e,d)&te],re=z>>4;z||Za(3),d+=z&15;var M=Na[re];if(re>3){var R=Ea[re];M+=qa(e,d)&(1<<R)-1,d+=R}if(d>_){c&&Za(0);break}s&&l(f+131072);var B=f+ne;if(f<M){var V=a-M,ie=Math.min(M,B);for(V+f<0&&Za(3);f<ie;++f)n[f]=r[V+f]}for(;f<B;++f)n[f]=n[f-M]}}t.l=p,t.p=I,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Ya(n,0,f):n.subarray(0,f)},$a=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},eo=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},to=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:co,l:0};if(i==1){var o=new Sa(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Ca(f+1),m=no(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new Sa(p),l:m}},no=function(e,t,n){return e.s==-1?Math.max(no(e.l,t,n+1),no(e.r,t,n+1)):t[e.s]=n},ro=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ca(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},io=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},ao=function(e,t,n){var r=n.length,i=Ja(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},oo=function(e,t,n,r,i,a,o,s,c,l,u){$a(t,u++,n),++i[256];for(var d=to(i,15),f=d.t,p=d.l,m=to(a,15),h=m.t,g=m.l,_=ro(f),v=_.c,y=_.n,b=ro(h),x=b.c,S=b.n,C=new Ca(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=to(C,7),E=T.t,D=T.l,O=19;O>4&&!E[Da[O-1]];--O);var k=l+5<<3,A=io(i,za)+io(a,Ba)+o,ee=io(i,f)+io(a,h)+o+14+3*O+io(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=ee)return ao(t,u,e.subarray(c,c+l));var j,M,N,P;if($a(t,u,1+(ee<A)),u+=2,ee<A){j=Ra(f,p,0),M=f,N=Ra(h,g,0),P=h;var F=Ra(E,D,0);$a(t,u,y-257),$a(t,u+5,S-1),$a(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)$a(t,u+3*w,E[Da[w]]);u+=3*O;for(var te=[v,x],I=0;I<2;++I)for(var L=te[I],w=0;w<L.length;++w){var ne=L[w]&31;$a(t,u,F[ne]),u+=E[ne],ne>15&&($a(t,u,L[w]>>5&127),u+=L[w]>>12)}}else j=Va,M=za,N=Ua,P=Ba;for(var w=0;w<s;++w){var R=r[w];if(R>255){var ne=R>>18&31;eo(t,u,j[ne+257]),u+=M[ne+257],ne>7&&($a(t,u,R>>23&31),u+=Ta[ne]);var z=R&31;eo(t,u,N[z]),u+=P[z],z>3&&(eo(t,u,R>>5&8191),u+=Ea[z])}else eo(t,u,j[R]),u+=M[R]}return eo(t,u,j[256]),u+M[256]},so=new wa([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),co=new Sa(0),lo=function(e,t,n,r,i,a){var o=a.z||e.length,s=new Sa(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=so[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Ca(32768),g=a.h||new Ca(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new wa(25e3),x=new Ca(288),S=new Ca(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,ee=g[k];if(h[A]=ee,g[k]=A,D<=T){var j=o-T;if((C>7e3||E>24576)&&(j>423||!l)){u=oo(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var M=0;M<286;++M)x[M]=0;for(var M=0;M<30;++M)S[M]=0}var N=2,P=0,F=p,te=A-ee&32767;if(j>2&&k==y(T-te))for(var I=Math.min(f,j)-1,L=Math.min(32767,T),ne=Math.min(258,j);te<=L&&--F&&A!=ee;){if(e[T+N]==e[T+N-te]){for(var R=0;R<ne&&e[T+R]==e[T+R-te];++R);if(R>N){if(N=R,P=te,R>I)break;for(var z=Math.min(te,R-2),re=0,M=0;M<z;++M){var B=T-te+M&32767,V=B-h[B]&32767;V>re&&(re=V,ee=B)}}}A=ee,ee=h[A],te+=A-ee&32767}if(P){b[E++]=268435456|ja[N]<<18|Pa[P];var ie=ja[N]&31,H=Pa[P]&31;w+=Ta[ie]+Ea[H],++x[257+ie],++S[H],D=T+N,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=oo(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var U=T+65535;U>=o&&(c[u/8|0]=l,U=o),u=ao(c,u+1,e.subarray(T,U))}a.i=o}return Ya(s,0,r+Ja(u)+i)},uo=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),fo=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=uo[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},po=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new Sa(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return lo(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},mo=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},ho=function(e,t){return e[t]|e[t+1]<<8},go=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},_o=function(e,t){return go(e,t)+go(e,t+4)*4294967296},vo=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},yo=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new Sa(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(po(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||Za(5),this.s.l&&Za(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new Sa(n&-32768);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||Za(5),this.s.l&&Za(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),bo=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new Sa(32768),this.p=new Sa(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||Za(5),this.d&&Za(4),!this.p.length)this.p=e;else if(e.length){var t=new Sa(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=Qa(this.p,this.s,this.o);this.ondata(Ya(n,t,this.s.b),this.d),this.o=Ya(n,this.s.b-32768),this.s.b=this.o.length,this.p=Ya(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),xo=typeof TextEncoder<`u`&&new TextEncoder,So=typeof TextDecoder<`u`&&new TextDecoder;try{So.decode(co,{stream:!0})}catch{}var Co=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Ya(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function wo(e,t){if(t){for(var n=new Sa(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(xo)return xo.encode(e);for(var i=e.length,a=new Sa(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new Sa(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return Ya(a,0,o)}function To(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(So)return So.decode(e);else{var i=Co(e),a=i.s,n=i.r;return n.length&&Za(8),a}}var Eo=function(e){return e==1?3:e<6?2:e==9?1:0},Do=function(e,t){for(;ho(e,t)!=1;t+=4+ho(e,t+2));return[_o(e,t+12),_o(e,t+4),_o(e,t+20)]},Oo=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&Za(9),t+=r+4}return t},ko=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Oo(l);vo(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&Za(10),vo(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(vo(e,t,n.crc),vo(e,t+4,a<0?-a-2:a),vo(e,t+8,n.size)),vo(e,t+12,c),vo(e,t+14,d),t+=16,o!=null&&(vo(e,t,u),vo(e,t+6,n.attrs),vo(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;vo(e,t,+m),vo(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Ao=function(e,t,n,r,i){vo(e,t,101010256),vo(e,t+8,n),vo(e,t+10,n),vo(e,t+12,r),vo(e,t+16,i)},jo=function(){function e(e){this.filename=e,this.c=fo(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||Za(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),Mo=function(){function e(e,t){var n=this;t||={},jo.call(this,e),this.d=new yo(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=Eo(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){jo.prototype.push.call(this,e,t)},e}(),No=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||Za(5),this.d&2)this.ondata(Za(4+(this.d&1)*8,0,1),null,!1);else{var n=wo(e.filename),r=n.length,i=e.comment,a=i&&wo(i),o=r!=e.filename.length||a&&i.length!=a.length,s=r+Oo(e.extra)+30;r>65535&&this.ondata(Za(11,0,1),null,!1);var c=new Sa(s);ko(c,0,e,n,o,-1);var l=[c],u=function(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]},d=this.d;this.d=0;var f=this.u.length,p=mo(e,{f:n,u:o,o:a,t:function(){e.terminate&&e.terminate()},r:function(){if(u(),d){var e=t.u[f+1];e?e.r():t.d=1}d=1}}),m=0;e.ondata=function(n,r,i){if(n)t.ondata(n,r,i),t.terminate();else if(m+=r.length,l.push(r),i){var a=new Sa(16);vo(a,0,134695760),vo(a,4,e.crc),vo(a,8,m),vo(a,12,e.size),l.push(a),p.c=m,p.b=s+m+16,p.crc=e.crc,p.size=e.size,d&&p.r(),d=1}else d&&u()},this.u.push(p)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata(Za(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,r=0,i=this.u;r<i.length;r++){var a=i[r];n+=46+a.f.length+Oo(a.extra)+(a.o?a.o.length:0)}for(var o=new Sa(n+22),s=0,c=this.u;s<c.length;s++){var a=c[s];ko(o,e,a,a.f,a.u,-a.c-2,t,a.o),e+=46+a.f.length+Oo(a.extra)+(a.o?a.o.length:0),t+=a.b}Ao(o,e,this.u.length,n,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),Po=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Fo=function(){function e(){var e=this;this.i=new bo(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),Io=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Po},this.p=co}return e.prototype.push=function(e,t){var n=this;if(this.onfile||Za(5),this.p||Za(4),this.c>0){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),e=e.subarray(r),e.length)return this.push(e,t)}else{var a=0,o=0,s=void 0,c=void 0;this.p.length?e.length?(c=new Sa(this.p.length+e.length),c.set(this.p),c.set(e,this.p.length)):c=this.p:c=e;for(var l=c.length,u=this.c,d=u&&this.d,f=function(){var e,t=go(c,o);if(t==67324752){a=1,s=o,p.d=null,p.c=0;var r=ho(c,o+6),i=ho(c,o+8),d=r&2048,f=r&8,m=ho(c,o+26),h=ho(c,o+28);if(l>o+30+m+h){var g=[];p.k.unshift(g),a=2;var _=go(c,o+18),v=go(c,o+22),y=To(c.subarray(o+30,o+=30+m),!d);_==4294967295?(e=f?[-2]:Do(c,o),_=e[0],v=e[1]):f&&(_=-1),o+=h,p.c=_;var b,x={name:y,compression:i,start:function(){if(x.ondata||Za(5),!_)x.ondata(null,co,!0);else{var e=n.o[i];e||x.ondata(Za(14,`unknown compression type `+i,1),null,!1),b=_<0?new e(y):new e(y,_,v),b.ondata=function(e,t,n){x.ondata(e,t,n)};for(var t=0,r=g;t<r.length;t++){var a=r[t];b.push(a,!1)}n.k[0]==g&&n.c?n.d=b:b.push(co,!0)}},terminate:function(){b&&b.terminate&&b.terminate()}};_>=0&&(x.size=_,x.originalSize=v),p.onfile(x)}return`break`}else if(u){if(t==134695760)return s=o+=12+(u==-2&&8),a=3,p.c=0,`break`;if(t==33639248)return s=o-=4,a=3,p.c=0,`break`}},p=this;o<l-4&&f()!==`break`;++o);if(this.p=co,u<0){var m=a?c.subarray(0,s-12-(u==-2&&8)-(go(c,s-16)==134695760&&4)):c.subarray(0,o);d?d.push(m,!!a):this.k[+(a==2)].push(m)}if(a&2)return this.push(c.subarray(o),t);this.p=c.subarray(o)}t&&(this.c&&Za(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}(),Lo=sn(),Ro=d(He(),1),zo=q(),Bo=class{constructor(e){this._buf=zo.Buffer.alloc(e&&e.size||16384),this._encoding=e&&e.encoding||`utf8`,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._buffer=zo.Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),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=zo.Buffer.alloc(t);this._buf.copy(n,0),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+this._buf.write(e,this._inPos,this._encoding);for(;t>=this._buf.length-4;)this._grow(this._inPos+e.length),t=this._inPos+this._buf.write(e,this._inPos,this._encoding);this._inPos=t}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),e._buf.copy(this._buf,this._inPos,0,e.length),this._inPos+=e.length)}},Vo=q();Re();var Ho=class{constructor(e,t){this._data=e,this._encoding=t}get length(){return this.toBuffer().length}copy(e,t,n,r){return this.toBuffer().copy(e,t,n,r)}toBuffer(){return this._buffer||=Vo.Buffer.from(this._data,this._encoding),this._buffer}},Uo=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){return this._data._buf.copy(e,t,n,r)}toBuffer(){return this._data.toBuffer()}},Wo=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){this._data.copy(e,t,n,r)}toBuffer(){return this._data}},Go=class{constructor(e){this.size=e,this.buffer=Vo.Buffer.alloc(e),this.iRead=0,this.iWrite=0}toBuffer(){if(this.iRead===0&&this.iWrite===this.size)return this.buffer;let e=Vo.Buffer.alloc(this.iWrite-this.iRead);return this.buffer.copy(e,0,this.iRead,this.iWrite),e}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){let t;return e===0?null:e===void 0||e>=this.length?(t=this.toBuffer(),this.iRead=this.iWrite,t):(t=Vo.Buffer.alloc(e),this.buffer.copy(t,0,this.iRead,e),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}};let Ko=function(e){if(!(this instanceof Ko))return new Ko(e);Lo.Duplex.call(this,e),e||={},this.bufSize=e.bufSize||1024*1024,this.buffers=[],this.batch=e.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};Xi(Ko,Lo.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return Vo.Buffer.concat(this.buffers.map(e=>e.toBuffer()))}},_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new Go(this.bufSize);return this.buffers.push(e),e},async _pipe(e){await Promise.all(this.pipes.map(function(t){return new Promise(n=>{t.write(e.toBuffer(),()=>{n()})})}))},_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){t instanceof Function&&(n=t,t=`utf8`),n||=Yi;let r;if(e instanceof Bo||e&&e.constructor?.name===`StringBuf`)r=new Uo(e);else if(e instanceof Vo.Buffer)r=new Wo(e);else if(typeof e==`string`||e instanceof String||e instanceof ArrayBuffer)r=new Ho(String(e),t);else throw Error(`Chunk must be one of type String, Buffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(r),Q.nextTick(n)):(await this._pipe(r),n());else this.paused||this.emit(`data`,r.toBuffer()),this._writeToBuffers(r),this.emit(`readable`);return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(e,t,n){let r=e=>{e?n(e):(this._flush(),this.pipes.forEach(e=>{e.end()}),this.emit(`finish`))};e?this.write(e,t,r):r()},read(e){let t;if(e){for(t=[];e&&this.buffers.length&&!this.buffers[0].eod;){let n=this.buffers[0],r=n.read(e);e-=r.length,t.push(r),n.eod&&n.full&&this.buffers.shift()}return Vo.Buffer.concat(t)}return t=this.buffers.map(e=>e.toBuffer()).filter(Boolean),this.buffers=[],Vo.Buffer.concat(t)},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},unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)},unshift(){throw Error(`Not Implemented`)},wrap(){throw Error(`Not Implemented`)}});var qo=q();let Jo=typeof TextEncoder>`u`?null:new TextEncoder;function Yo(e){return typeof e==`string`?Jo?qo.Buffer.from(Jo.encode(e).buffer):qo.Buffer.from(e):e}let Xo=typeof window<`u`&&typeof document<`u`&&typeof navigator<`u`;var Zo=q(),Qo=class extends Ro.default.EventEmitter{constructor(e){super(),this.options=Object.assign({type:`nodebuffer`,compression:`DEFLATE`},e);let t=this.options.compressionOptions?.level??6;this.compressionLevel=Math.max(0,Math.min(9,t)),this.files={},this.stream=new Ko,this.finalized=!1,this.zip=new No((e,t,n)=>{e?this.stream.emit(`error`,e):(this.stream.write(Zo.Buffer.from(t)),n&&this.stream.end())})}append(e,t){let n;if(Object.prototype.hasOwnProperty.call(t,`base64`)&&t.base64){let t=typeof e==`string`?e:e.toString();if(Xo){let e=atob(t),r=e.length;n=new Uint8Array(r);for(let t=0;t<r;t++)n[t]=e.charCodeAt(t)}else n=Zo.Buffer.from(t,`base64`)}else n=typeof e==`string`?Xo?Yo(e):Zo.Buffer.from(e,`utf8`):Zo.Buffer.isBuffer(e)?new Uint8Array(e):e;let r=this.options.compression===`STORE`?new jo(t.name):new Mo(t.name,{level:this.compressionLevel});this.zip.add(r),r.push(n,!0)}push(e){return this.stream.push(e)}async finalize(){this.finalized||(this.finalized=!0,this.zip.end(),this.emit(`finish`))}read(e){return this.stream.read(e)}setEncoding(e){return this.stream.setEncoding(e)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(e,t){return this.stream.pipe(e,t)}unpipe(e){return this.stream.unpipe(e)}unshift(e){return this.stream.unshift(e)}wrap(e){return this.stream.wrap(e)}};function $o(e,t,n){e.push(` ${t}="${ea(n.toString())}"`)}function es(e,t){if(t){let n=[];Object.entries(t).forEach(([e,t])=>{t!==void 0&&$o(n,e,t)}),e.push(n.join(``))}}var ts=class{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),es(t,e),t.push(`?>
27
- `)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),es(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&&$o(this._xml,e,t)}addAttributes(e){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);es(this._xml,e)}writeText(e){let t=this._xml;this.open&&=(t.push(`>`),!1),this.leaf=!1,t.push(ea(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}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,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let e=this._rollbacks.pop();this._xml.length>e.xml&&this._xml.splice(e.xml,this._xml.length-e.xml),this._stack.length>e.stack&&this._stack.splice(e.stack,this._stack.length-e.stack),this.leaf=e.leaf,this.open=e.open}get xml(){return this.closeAll(),this._xml.join(``)}static{this.StdDocAttributes={version:`1.0`,encoding:`UTF-8`,standalone:`yes`}}};let ns=typeof TextDecoder>`u`?null:new TextDecoder(`utf-8`);function rs(e){return typeof e==`string`?e:ns?ns.decode(e):String.fromCharCode(...new Uint8Array(e))}var is=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`
25
+ https://github.com/browserify/crypto-browserify`)},e.constants={DH_CHECK_P_NOT_SAFE_PRIME:2,DH_CHECK_P_NOT_PRIME:1,DH_UNABLE_TO_CHECK_GENERATOR:4,DH_NOT_SUITABLE_GENERATOR:8,NPN_ENABLED:1,ALPN_ENABLED:1,RSA_PKCS1_PADDING:1,RSA_SSLV23_PADDING:2,RSA_NO_PADDING:3,RSA_PKCS1_OAEP_PADDING:4,RSA_X931_PADDING:5,RSA_PKCS1_PSS_PADDING:6,POINT_CONVERSION_COMPRESSED:2,POINT_CONVERSION_UNCOMPRESSED:4,POINT_CONVERSION_HYBRID:6}})),Ui=q(),Wi=d(Hi(),1);let Gi={hash(e,...t){let n=Wi.createHash(e);return n.update(Ui.Buffer.concat(t)),n.digest()},convertPasswordToHash(e,t,n,r){if(t=t.toLowerCase(),Wi.getHashes().indexOf(t)<0)throw Error(`Hash algorithm '${t}' not supported!`);let i=Ui.Buffer.from(e,`utf16le`),a=this.hash(t,Ui.Buffer.from(n,`base64`),i);for(let e=0;e<r;e++){let n=Ui.Buffer.alloc(4);n.writeUInt32LE(e,0),a=this.hash(t,a,n)}return a.toString(`base64`)},randomBytes(e){return Wi.randomBytes(e)}};var Ki=l({default:()=>qi}),qi,Ji=s((()=>{qi=null}));Ji();function Yi(){}let Xi=function(e,t,n,r){e.super_=t,r||(r=n,n=null),n&&Object.keys(n).forEach(t=>{Object.defineProperty(e,t,Object.getOwnPropertyDescriptor(n,t))});let i={constructor:{value:e,enumerable:!1,writable:!1,configurable:!0}};r&&Object.keys(r).forEach(e=>{i[e]=Object.getOwnPropertyDescriptor(r,e)}),e.prototype=Object.create(t.prototype,i)};function Zi(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function Qi(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}let $i=/[<>&'"\x7F\x00-\x08\x0B-\x0C\x0E-\x1F]/;function ea(e){let t=$i.exec(e);if(!t)return e;let n=``,r=``,i=0,a=t.index;for(;a<e.length;a++){let t=e.charCodeAt(a);switch(t){case 34:r=`&quot;`;break;case 38:r=`&amp;`;break;case 39:r=`&apos;`;break;case 60:r=`&lt;`;break;case 62:r=`&gt;`;break;case 127:r=``;break;default:if(t<=31&&(t<=8||t>=11&&t!==13)){r=``;break}continue}i!==a&&(n+=e.substring(i,a)),i=a+1,r&&(n+=r)}return i===a?n:n+e.substring(i,a)}function ta(e){return e.replace(/&([a-z]*);/g,e=>{switch(e){case`&lt;`:return`<`;case`&gt;`:return`>`;case`&amp;`:return`&`;case`&apos;`:return`'`;case`&quot;`:return`"`;default:return e}})}function na(e){let t=parseInt(e,10);return Number.isNaN(t)?0:t}function ra(e){return e?(e=e.replace(/\[[^\]]*]/g,``),e=e.replace(/"[^"]*"/g,``),e.match(/[ymdhMsb]+/)!==null):!1}function ia(e){return new Promise(t=>{qi.access(e,qi.constants.F_OK,e=>{t(!e)})})}function aa(e){return e===!0||e===`true`||e===1||e===`1`}function*oa(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 sa(e){let t=Array.from(e);return t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.sort()}function ca(e,t=null){return e.reduce((e,n)=>(e[n]=t,e),{})}let la=new TextDecoder(`utf-8`);function ua(e){return typeof e==`string`?e:la.decode(e)}function da(e,t){fa(e,t);let{sourceSheet:n}=t,{rows:r,columns:i,values:a}=t,o=pa(n,[...r,...i]),s=o.reduce((e,t,n)=>(e[t.name]=n,e),{});return{sourceSheet:n,rows:r.map(e=>s[e]),columns:i.map(e=>s[e]),values:a.map(e=>s[e]),metric:`sum`,cacheFields:o,cacheId:`10`}}function fa(e,t){if(e.workbook.pivotTables.length===1)throw Error(`A pivot table was already added. At this time, ExcelTS supports at most one pivot table per file.`);if(t.metric&&t.metric!==`sum`)throw Error(`Only the "sum" metric is supported at this time.`);let n=ca(t.sourceSheet.getRow(1).values.slice(1),!0);for(let e of[...t.rows,...t.columns,...t.values])if(!n[e])throw Error(`The header name "${e}" was not found in ${t.sourceSheet.name}.`);if(!t.rows.length)throw Error(`No pivot table rows specified.`);if(!t.columns.length)throw Error(`No pivot table columns specified.`);if(t.values.length!==1)throw Error(`Exactly 1 value needs to be specified at this time.`)}function pa(e,t){let n=e.getRow(1).values,r=ca(t,!0),i=t=>{let n=e.getColumn(t).values.splice(2);return sa(new Set(n))},a=[];for(let e of oa(1,n.length)){let t=n[e],o=r[t]?i(e):null;a.push({name:t,sharedItems:o})}return a}let ma=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),ha=(e,t,n,r=[])=>{e[n]&&(t[n]=ma(e[n],r))},ga=e=>Object.keys(e).length===0,_a=e=>{if(!e)return e;if(ga(e))return{};let t={...e};return ha(e,t,`font`,[`color`]),ha(e,t,`alignment`),ha(e,t,`protection`),e.border&&(ha(e,t,`border`),ha(e.border,t.border,`top`,[`color`]),ha(e.border,t.border,`left`,[`color`]),ha(e.border,t.border,`bottom`,[`color`]),ha(e.border,t.border,`right`,[`color`]),ha(e.border,t.border,`diagonal`,[`color`])),e.fill&&(ha(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>ma(e,[`color`])))),t};var va=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.properties=Object.assign({},{defaultRowHeight:15,dyDescent:55,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: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,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 se,this.views=e.views||[],this.autoFilter=e.autoFilter||null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[]}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 h;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=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 ae(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 n=this._keys[e];if(n)return n;t=m.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 ae(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=[e,t];n.forEach(e=>{r.push(e[i]||null)}),this.getRow(i+1).splice(...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=null;this.workbook.definedNames.spliceColumns(this.name,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 U(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=_a(r.style),r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=_a(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);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=r.style,t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=e.style})}}spliceRows(e,t,...n){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=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=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=c.style,e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{if(e.getCell(n).style=t.style,t._value.constructor.name===`MergeValue`){let e=this.getRow(t._row._number+i).getCell(n),r=t._value._master,a=this.getRow(r._row._number+i).getCell(r._column._number);e.merge(a)}})}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]}this.workbook.definedNames.spliceRows(this.name,e,t,i)}eachRow(e,t){if(t||(t=e,e=void 0),e&&e.includeEmpty){let e=this._rows.length;for(let n=1;n<=e;n++)t(this.getRow(n),n)}else this._rows.forEach(e=>{e&&e.hasValues&&t(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=m.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,t){let n=m.getAddress(e,t);return this.getRow(n.row).getCellEx(n)}mergeCells(...e){let t=new h(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new h(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 n=this.getCell(e.top,e.left);for(let r=e.top;r<=e.bottom;r++)for(let i=e.left;i<=e.right;i++)(r>e.top||i>e.left)&&this.getCell(r,i).merge(n,t);this._merges[n.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]}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new h(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===S.ValueType.Merge?this._unMergeMaster(t.master):this._merges[t.address]&&this._unMergeMaster(t))}}fillFormula(e,t,n,r=`shared`){let{top:i,left:a,bottom:o,right:s}=m.decode(e),c=s-a+1,l=m.encodeAddress(i,a),u=r===`shared`,d;d=typeof n==`function`?n:Array.isArray(n)?Array.isArray(n[0])?(e,t)=>n[e-i][t-a]:(e,t)=>n[(e-i)*c+(t-a)]:()=>void 0;let f=!0;for(let n=i;n<=o;n++)for(let i=a;i<=s;i++)f?(this.getCell(n,i).value={shareType:r,formula:t,ref:e,result:d(n,i)},f=!1):this.getCell(n,i).value=u?{sharedFormula:l,result:d(n,i)}:d(n,i)}addImage(e,t){let n={type:`image`,imageId:String(e),range:t};this._media.push(new G(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new G(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}protect(e,t){return new Promise(n=>{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=Gi.randomBytes(16).toString(`base64`),this.sheetProtection.spinCount=t&&`spinCount`in t?t.spinCount:1e5,this.sheetProtection.hashValue=Gi.convertPasswordToHash(e,`SHA512`,this.sheetProtection.saltValue,this.sheetProtection.spinCount)),t&&(this.sheetProtection=Object.assign(this.sheetProtection,t),!e&&`spinCount`in t&&delete this.sheetProtection.spinCount),n()})}unprotect(){this.sheetProtection=null}addTable(e){let t=new K(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){console.warn(`Warning: Pivot Table support is experimental.
26
+ Please leave feedback at https://github.com/excelts/excelts/discussions/2575`);let t=da(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,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};e.cols=ae.toModel(this.columns);let t=e.rows=[],n=e.dimensions=new h;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 U(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=ae.fromModel(this,e.cols),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new se(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new G(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new K(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings}};function ya(e){return typeof e==`number`?!0:e!==`__proto__`&&e!==`constructor`&&e!==`prototype`}function ba(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>ba(e));let t={};for(let n of Object.keys(e))ya(n)&&(t[n]=ba(e[n]));return t}var xa=class{constructor(e){this.template=e,this.sheets={}}addCell(e){this.addCellEx(m.decodeEx(e))}getCell(e){return this.findCellEx(m.decodeEx(e),!0)}findCell(e){return this.findCellEx(m.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,n){if(!ya(e))throw Error(`Invalid sheet name: ${e}`);let r=this.sheets[e]||(this.sheets[e]=[]),i=r[t]||(r[t]=[]);return i[n]||(i[n]={sheetName:e,address:m.n2l(n)+t,row:t,col:n})}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(!ya(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(!ya(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(!ya(r))throw Error(`Invalid column: ${r}`);if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...ba(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 Sa=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var Ca=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new xa)}add(e,t){let n=m.decodeEx(e);this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(e.top)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let i={sheetName:e.sheetName,address:m.n2l(t)+r,row:r,col:t};n.addCellEx(i)}else n.addCellEx(e)}remove(e,t){let n=m.decodeEx(e);this.removeEx(n,t)}removeEx(e,t){this.getMatrix(t).removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){return this.getNamesEx(m.decodeEx(e))}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(Boolean)}_explore(e,t){t.mark=!1;let{sheetName:n}=t,r=new h(t.row,t.col,t.row,t.col,n),i,a;function o(i,a){let o=e.findCellAt(n,i,t.col);return!o||!o.mark?!1:(r[a]=i,o.mark=!1,!0)}for(a=t.row-1;o(a,`top`);a--);for(a=t.row+1;o(a,`bottom`);a++);function s(t,i){let o=[];for(a=r.top;a<=r.bottom;a++){let r=e.findCellAt(n,a,t);if(r&&r.mark)o.push(r);else return!1}r[i]=t;for(let e=0;e<o.length;e++)o[e].mark=!1;return!0}for(i=t.col-1;s(i,`left`);i--);for(i=t.col+1;s(i,`right`);i++);return r}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,n)=>{e&&(e.row!==t||e.col!==n)&&(e.row=t,e.col=n,e.address=m.n2l(n)+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 xa;e.ranges.forEach(e=>{Sa.test(e.split(`!`).pop()||``)&&n.addCell(e)})})}},wa=Uint8Array,Ta=Uint16Array,Ea=Int32Array,Da=new wa([0,0,0,0,0,0,0,0,1,1,1,1,2,2,2,2,3,3,3,3,4,4,4,4,5,5,5,5,0,0,0,0]),Oa=new wa([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,0,0]),ka=new wa([16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15]),Aa=function(e,t){for(var n=new Ta(31),r=0;r<31;++r)n[r]=t+=1<<e[r-1];for(var i=new Ea(n[30]),r=1;r<30;++r)for(var a=n[r];a<n[r+1];++a)i[a]=a-n[r]<<5|r;return{b:n,r:i}},ja=Aa(Da,2),Ma=ja.b,Na=ja.r;Ma[28]=258,Na[258]=28;for(var Pa=Aa(Oa,0),Fa=Pa.b,Ia=Pa.r,La=new Ta(32768),Ra=0;Ra<32768;++Ra){var za=(Ra&43690)>>1|(Ra&21845)<<1;za=(za&52428)>>2|(za&13107)<<2,za=(za&61680)>>4|(za&3855)<<4,La[Ra]=((za&65280)>>8|(za&255)<<8)>>1}for(var Ba=(function(e,t,n){for(var r=e.length,i=0,a=new Ta(t);i<r;++i)e[i]&&++a[e[i]-1];var o=new Ta(t);for(i=1;i<t;++i)o[i]=o[i-1]+a[i-1]<<1;var s;if(n){s=new Ta(1<<t);var c=15-t;for(i=0;i<r;++i)if(e[i])for(var l=i<<4|e[i],u=t-e[i],d=o[e[i]-1]++<<u,f=d|(1<<u)-1;d<=f;++d)s[La[d]>>c]=l}else for(s=new Ta(r),i=0;i<r;++i)e[i]&&(s[i]=La[o[e[i]-1]++]>>15-e[i]);return s}),Va=new wa(288),Ra=0;Ra<144;++Ra)Va[Ra]=8;for(var Ra=144;Ra<256;++Ra)Va[Ra]=9;for(var Ra=256;Ra<280;++Ra)Va[Ra]=7;for(var Ra=280;Ra<288;++Ra)Va[Ra]=8;for(var Ha=new wa(32),Ra=0;Ra<32;++Ra)Ha[Ra]=5;var Ua=Ba(Va,9,0),Wa=Ba(Va,9,1),Ga=Ba(Ha,5,0),Ka=Ba(Ha,5,1),qa=function(e){for(var t=e[0],n=1;n<e.length;++n)e[n]>t&&(t=e[n]);return t},Ja=function(e,t,n){var r=t/8|0;return(e[r]|e[r+1]<<8)>>(t&7)&n},Ya=function(e,t){var n=t/8|0;return(e[n]|e[n+1]<<8|e[n+2]<<16)>>(t&7)},Xa=function(e){return(e+7)/8|0},Za=function(e,t,n){return(t==null||t<0)&&(t=0),(n==null||n>e.length)&&(n=e.length),new wa(e.subarray(t,n))},Qa=[`unexpected EOF`,`invalid block type`,`invalid length/literal`,`invalid distance`,`stream finished`,`no stream handler`,,`no callback`,`invalid UTF-8 data`,`extra field too long`,`date not in range 1980-2099`,`filename too long`,`stream finishing`,`invalid zip data`],$a=function(e,t,n){var r=Error(t||Qa[e]);if(r.code=e,Error.captureStackTrace&&Error.captureStackTrace(r,$a),!n)throw r;return r},eo=function(e,t,n,r){var i=e.length,a=r?r.length:0;if(!i||t.f&&!t.l)return n||new wa(0);var o=!n,s=o||t.i!=2,c=t.i;o&&(n=new wa(i*3));var l=function(e){var t=n.length;if(e>t){var r=new wa(Math.max(t*2,e));r.set(n),n=r}},u=t.f||0,d=t.p||0,f=t.b||0,p=t.l,m=t.d,h=t.m,g=t.n,_=i*8;do{if(!p){u=Ja(e,d,1);var v=Ja(e,d+1,3);if(d+=3,v)if(v==1)p=Wa,m=Ka,h=9,g=5;else if(v==2){var y=Ja(e,d,31)+257,b=Ja(e,d+10,15)+4,x=y+Ja(e,d+5,31)+1;d+=14;for(var S=new wa(x),C=new wa(19),w=0;w<b;++w)C[ka[w]]=Ja(e,d+w*3,7);d+=b*3;for(var T=qa(C),E=(1<<T)-1,D=Ba(C,T,1),w=0;w<x;){var O=D[Ja(e,d,E)];d+=O&15;var k=O>>4;if(k<16)S[w++]=k;else{var A=0,ee=0;for(k==16?(ee=3+Ja(e,d,3),d+=2,A=S[w-1]):k==17?(ee=3+Ja(e,d,7),d+=3):k==18&&(ee=11+Ja(e,d,127),d+=7);ee--;)S[w++]=A}}var j=S.subarray(0,y),M=S.subarray(y);h=qa(j),g=qa(M),p=Ba(j,h,1),m=Ba(M,g,1)}else $a(1);else{var k=Xa(d)+4,N=e[k-4]|e[k-3]<<8,P=k+N;if(P>i){c&&$a(0);break}s&&l(f+N),n.set(e.subarray(k,P),f),t.b=f+=N,t.p=d=P*8,t.f=u;continue}if(d>_){c&&$a(0);break}}s&&l(f+131072);for(var F=(1<<h)-1,te=(1<<g)-1,I=d;;I=d){var A=p[Ya(e,d)&F],L=A>>4;if(d+=A&15,d>_){c&&$a(0);break}if(A||$a(2),L<256)n[f++]=L;else if(L==256){I=d,p=null;break}else{var ne=L-254;if(L>264){var w=L-257,R=Da[w];ne=Ja(e,d,(1<<R)-1)+Ma[w],d+=R}var z=m[Ya(e,d)&te],re=z>>4;z||$a(3),d+=z&15;var M=Fa[re];if(re>3){var R=Oa[re];M+=Ya(e,d)&(1<<R)-1,d+=R}if(d>_){c&&$a(0);break}s&&l(f+131072);var B=f+ne;if(f<M){var V=a-M,ie=Math.min(M,B);for(V+f<0&&$a(3);f<ie;++f)n[f]=r[V+f]}for(;f<B;++f)n[f]=n[f-M]}}t.l=p,t.p=I,t.b=f,t.f=u,p&&(u=1,t.m=h,t.d=m,t.n=g)}while(!u);return f!=n.length&&o?Za(n,0,f):n.subarray(0,f)},to=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8},no=function(e,t,n){n<<=t&7;var r=t/8|0;e[r]|=n,e[r+1]|=n>>8,e[r+2]|=n>>16},ro=function(e,t){for(var n=[],r=0;r<e.length;++r)e[r]&&n.push({s:r,f:e[r]});var i=n.length,a=n.slice();if(!i)return{t:uo,l:0};if(i==1){var o=new wa(n[0].s+1);return o[n[0].s]=1,{t:o,l:1}}n.sort(function(e,t){return e.f-t.f}),n.push({s:-1,f:25001});var s=n[0],c=n[1],l=0,u=1,d=2;for(n[0]={s:-1,f:s.f+c.f,l:s,r:c};u!=i-1;)s=n[n[l].f<n[d].f?l++:d++],c=n[l!=u&&n[l].f<n[d].f?l++:d++],n[u++]={s:-1,f:s.f+c.f,l:s,r:c};for(var f=a[0].s,r=1;r<i;++r)a[r].s>f&&(f=a[r].s);var p=new Ta(f+1),m=io(n[u-1],p,0);if(m>t){var r=0,h=0,g=m-t,_=1<<g;for(a.sort(function(e,t){return p[t.s]-p[e.s]||e.f-t.f});r<i;++r){var v=a[r].s;if(p[v]>t)h+=_-(1<<m-p[v]),p[v]=t;else break}for(h>>=g;h>0;){var y=a[r].s;p[y]<t?h-=1<<t-p[y]++-1:++r}for(;r>=0&&h;--r){var b=a[r].s;p[b]==t&&(--p[b],++h)}m=t}return{t:new wa(p),l:m}},io=function(e,t,n){return e.s==-1?Math.max(io(e.l,t,n+1),io(e.r,t,n+1)):t[e.s]=n},ao=function(e){for(var t=e.length;t&&!e[--t];);for(var n=new Ta(++t),r=0,i=e[0],a=1,o=function(e){n[r++]=e},s=1;s<=t;++s)if(e[s]==i&&s!=t)++a;else{if(!i&&a>2){for(;a>138;a-=138)o(32754);a>2&&(o(a>10?a-11<<5|28690:a-3<<5|12305),a=0)}else if(a>3){for(o(i),--a;a>6;a-=6)o(8304);a>2&&(o(a-3<<5|8208),a=0)}for(;a--;)o(i);a=1,i=e[s]}return{c:n.subarray(0,r),n:t}},oo=function(e,t){for(var n=0,r=0;r<t.length;++r)n+=e[r]*t[r];return n},so=function(e,t,n){var r=n.length,i=Xa(t+2);e[i]=r&255,e[i+1]=r>>8,e[i+2]=e[i]^255,e[i+3]=e[i+1]^255;for(var a=0;a<r;++a)e[i+a+4]=n[a];return(i+4+r)*8},co=function(e,t,n,r,i,a,o,s,c,l,u){to(t,u++,n),++i[256];for(var d=ro(i,15),f=d.t,p=d.l,m=ro(a,15),h=m.t,g=m.l,_=ao(f),v=_.c,y=_.n,b=ao(h),x=b.c,S=b.n,C=new Ta(19),w=0;w<v.length;++w)++C[v[w]&31];for(var w=0;w<x.length;++w)++C[x[w]&31];for(var T=ro(C,7),E=T.t,D=T.l,O=19;O>4&&!E[ka[O-1]];--O);var k=l+5<<3,A=oo(i,Va)+oo(a,Ha)+o,ee=oo(i,f)+oo(a,h)+o+14+3*O+oo(C,E)+2*C[16]+3*C[17]+7*C[18];if(c>=0&&k<=A&&k<=ee)return so(t,u,e.subarray(c,c+l));var j,M,N,P;if(to(t,u,1+(ee<A)),u+=2,ee<A){j=Ba(f,p,0),M=f,N=Ba(h,g,0),P=h;var F=Ba(E,D,0);to(t,u,y-257),to(t,u+5,S-1),to(t,u+10,O-4),u+=14;for(var w=0;w<O;++w)to(t,u+3*w,E[ka[w]]);u+=3*O;for(var te=[v,x],I=0;I<2;++I)for(var L=te[I],w=0;w<L.length;++w){var ne=L[w]&31;to(t,u,F[ne]),u+=E[ne],ne>15&&(to(t,u,L[w]>>5&127),u+=L[w]>>12)}}else j=Ua,M=Va,N=Ga,P=Ha;for(var w=0;w<s;++w){var R=r[w];if(R>255){var ne=R>>18&31;no(t,u,j[ne+257]),u+=M[ne+257],ne>7&&(to(t,u,R>>23&31),u+=Da[ne]);var z=R&31;no(t,u,N[z]),u+=P[z],z>3&&(no(t,u,R>>5&8191),u+=Oa[z])}else no(t,u,j[R]),u+=M[R]}return no(t,u,j[256]),u+M[256]},lo=new Ea([65540,131080,131088,131104,262176,1048704,1048832,2114560,2117632]),uo=new wa(0),fo=function(e,t,n,r,i,a){var o=a.z||e.length,s=new wa(r+o+5*(1+Math.ceil(o/7e3))+i),c=s.subarray(r,s.length-i),l=a.l,u=(a.r||0)&7;if(t){u&&(c[0]=a.r>>3);for(var d=lo[t-1],f=d>>13,p=d&8191,m=(1<<n)-1,h=a.p||new Ta(32768),g=a.h||new Ta(m+1),_=Math.ceil(n/3),v=2*_,y=function(t){return(e[t]^e[t+1]<<_^e[t+2]<<v)&m},b=new Ea(25e3),x=new Ta(288),S=new Ta(32),C=0,w=0,T=a.i||0,E=0,D=a.w||0,O=0;T+2<o;++T){var k=y(T),A=T&32767,ee=g[k];if(h[A]=ee,g[k]=A,D<=T){var j=o-T;if((C>7e3||E>24576)&&(j>423||!l)){u=co(e,c,0,b,x,S,w,E,O,T-O,u),E=C=w=0,O=T;for(var M=0;M<286;++M)x[M]=0;for(var M=0;M<30;++M)S[M]=0}var N=2,P=0,F=p,te=A-ee&32767;if(j>2&&k==y(T-te))for(var I=Math.min(f,j)-1,L=Math.min(32767,T),ne=Math.min(258,j);te<=L&&--F&&A!=ee;){if(e[T+N]==e[T+N-te]){for(var R=0;R<ne&&e[T+R]==e[T+R-te];++R);if(R>N){if(N=R,P=te,R>I)break;for(var z=Math.min(te,R-2),re=0,M=0;M<z;++M){var B=T-te+M&32767,V=B-h[B]&32767;V>re&&(re=V,ee=B)}}}A=ee,ee=h[A],te+=A-ee&32767}if(P){b[E++]=268435456|Na[N]<<18|Ia[P];var ie=Na[N]&31,H=Ia[P]&31;w+=Da[ie]+Oa[H],++x[257+ie],++S[H],D=T+N,++C}else b[E++]=e[T],++x[e[T]]}}for(T=Math.max(T,D);T<o;++T)b[E++]=e[T],++x[e[T]];u=co(e,c,l,b,x,S,w,E,O,T-O,u),l||(a.r=u&7|c[u/8|0]<<3,u-=7,a.h=g,a.p=h,a.i=T,a.w=D)}else{for(var T=a.w||0;T<o+l;T+=65535){var U=T+65535;U>=o&&(c[u/8|0]=l,U=o),u=so(c,u+1,e.subarray(T,U))}a.i=o}return Za(s,0,r+Xa(u)+i)},po=(function(){for(var e=new Int32Array(256),t=0;t<256;++t){for(var n=t,r=9;--r;)n=(n&1&&-306674912)^n>>>1;e[t]=n}return e})(),mo=function(){var e=-1;return{p:function(t){for(var n=e,r=0;r<t.length;++r)n=po[n&255^t[r]]^n>>>8;e=n},d:function(){return~e}}},ho=function(e,t,n,r,i){if(!i&&(i={l:1},t.dictionary)){var a=t.dictionary.subarray(-32768),o=new wa(a.length+e.length);o.set(a),o.set(e,a.length),e=o,i.w=a.length}return fo(e,t.level==null?6:t.level,t.mem==null?i.l?Math.ceil(Math.max(8,Math.min(13,Math.log(e.length)))*1.5):20:12+t.mem,n,r,i)},go=function(e,t){var n={};for(var r in e)n[r]=e[r];for(var r in t)n[r]=t[r];return n},_o=function(e,t){return e[t]|e[t+1]<<8},vo=function(e,t){return(e[t]|e[t+1]<<8|e[t+2]<<16|e[t+3]<<24)>>>0},yo=function(e,t){return vo(e,t)+vo(e,t+4)*4294967296},bo=function(e,t,n){for(;n;++t)e[t]=n,n>>>=8},xo=function(){function e(e,t){if(typeof e==`function`&&(t=e,e={}),this.ondata=t,this.o=e||{},this.s={l:0,i:32768,w:32768,z:32768},this.b=new wa(98304),this.o.dictionary){var n=this.o.dictionary.subarray(-32768);this.b.set(n,32768-n.length),this.s.i=32768-n.length}}return e.prototype.p=function(e,t){this.ondata(ho(e,this.o,0,0,this.s),t)},e.prototype.push=function(e,t){this.ondata||$a(5),this.s.l&&$a(4);var n=e.length+this.s.z;if(n>this.b.length){if(n>2*this.b.length-32768){var r=new wa(n&-32768);r.set(this.b.subarray(0,this.s.z)),this.b=r}var i=this.b.length-this.s.z;this.b.set(e.subarray(0,i),this.s.z),this.s.z=this.b.length,this.p(this.b,!1),this.b.set(this.b.subarray(-32768)),this.b.set(e.subarray(i),32768),this.s.z=e.length-i+32768,this.s.i=32766,this.s.w=32768}else this.b.set(e,this.s.z),this.s.z+=e.length;this.s.l=t&1,(this.s.z>this.s.w+8191||t)&&(this.p(this.b,t||!1),this.s.w=this.s.i,this.s.i-=2)},e.prototype.flush=function(){this.ondata||$a(5),this.s.l&&$a(4),this.p(this.b,!1),this.s.w=this.s.i,this.s.i-=2},e}(),So=function(){function e(e,t){typeof e==`function`&&(t=e,e={}),this.ondata=t;var n=e&&e.dictionary&&e.dictionary.subarray(-32768);this.s={i:0,b:n?n.length:0},this.o=new wa(32768),this.p=new wa(0),n&&this.o.set(n)}return e.prototype.e=function(e){if(this.ondata||$a(5),this.d&&$a(4),!this.p.length)this.p=e;else if(e.length){var t=new wa(this.p.length+e.length);t.set(this.p),t.set(e,this.p.length),this.p=t}},e.prototype.c=function(e){this.s.i=+(this.d=e||!1);var t=this.s.b,n=eo(this.p,this.s,this.o);this.ondata(Za(n,t,this.s.b),this.d),this.o=Za(n,this.s.b-32768),this.s.b=this.o.length,this.p=Za(this.p,this.s.p/8|0),this.s.p&=7},e.prototype.push=function(e,t){this.e(e),this.c(t)},e}(),Co=typeof TextEncoder<`u`&&new TextEncoder,wo=typeof TextDecoder<`u`&&new TextDecoder;try{wo.decode(uo,{stream:!0})}catch{}var To=function(e){for(var t=``,n=0;;){var r=e[n++],i=(r>127)+(r>223)+(r>239);if(n+i>e.length)return{s:t,r:Za(e,n-1)};i?i==3?(r=((r&15)<<18|(e[n++]&63)<<12|(e[n++]&63)<<6|e[n++]&63)-65536,t+=String.fromCharCode(55296|r>>10,56320|r&1023)):i&1?t+=String.fromCharCode((r&31)<<6|e[n++]&63):t+=String.fromCharCode((r&15)<<12|(e[n++]&63)<<6|e[n++]&63):t+=String.fromCharCode(r)}};function Eo(e,t){if(t){for(var n=new wa(e.length),r=0;r<e.length;++r)n[r]=e.charCodeAt(r);return n}if(Co)return Co.encode(e);for(var i=e.length,a=new wa(e.length+(e.length>>1)),o=0,s=function(e){a[o++]=e},r=0;r<i;++r){if(o+5>a.length){var c=new wa(o+8+(i-r<<1));c.set(a),a=c}var l=e.charCodeAt(r);l<128||t?s(l):l<2048?(s(192|l>>6),s(128|l&63)):l>55295&&l<57344?(l=65536+(l&1047552)|e.charCodeAt(++r)&1023,s(240|l>>18),s(128|l>>12&63),s(128|l>>6&63),s(128|l&63)):(s(224|l>>12),s(128|l>>6&63),s(128|l&63))}return Za(a,0,o)}function Do(e,t){if(t){for(var n=``,r=0;r<e.length;r+=16384)n+=String.fromCharCode.apply(null,e.subarray(r,r+16384));return n}else if(wo)return wo.decode(e);else{var i=To(e),a=i.s,n=i.r;return n.length&&$a(8),a}}var Oo=function(e){return e==1?3:e<6?2:e==9?1:0},ko=function(e,t){for(;_o(e,t)!=1;t+=4+_o(e,t+2));return[yo(e,t+12),yo(e,t+4),yo(e,t+20)]},Ao=function(e){var t=0;if(e)for(var n in e){var r=e[n].length;r>65535&&$a(9),t+=r+4}return t},jo=function(e,t,n,r,i,a,o,s){var c=r.length,l=n.extra,u=s&&s.length,d=Ao(l);bo(e,t,o==null?67324752:33639248),t+=4,o!=null&&(e[t++]=20,e[t++]=n.os),e[t]=20,t+=2,e[t++]=n.flag<<1|(a<0&&8),e[t++]=i&&8,e[t++]=n.compression&255,e[t++]=n.compression>>8;var f=new Date(n.mtime==null?Date.now():n.mtime),p=f.getFullYear()-1980;if((p<0||p>119)&&$a(10),bo(e,t,p<<25|f.getMonth()+1<<21|f.getDate()<<16|f.getHours()<<11|f.getMinutes()<<5|f.getSeconds()>>1),t+=4,a!=-1&&(bo(e,t,n.crc),bo(e,t+4,a<0?-a-2:a),bo(e,t+8,n.size)),bo(e,t+12,c),bo(e,t+14,d),t+=16,o!=null&&(bo(e,t,u),bo(e,t+6,n.attrs),bo(e,t+10,o),t+=14),e.set(r,t),t+=c,d)for(var m in l){var h=l[m],g=h.length;bo(e,t,+m),bo(e,t+2,g),e.set(h,t+4),t+=4+g}return u&&(e.set(s,t),t+=u),t},Mo=function(e,t,n,r,i){bo(e,t,101010256),bo(e,t+8,n),bo(e,t+10,n),bo(e,t+12,r),bo(e,t+16,i)},No=function(){function e(e){this.filename=e,this.c=mo(),this.size=0,this.compression=0}return e.prototype.process=function(e,t){this.ondata(null,e,t)},e.prototype.push=function(e,t){this.ondata||$a(5),this.c.p(e),this.size+=e.length,t&&(this.crc=this.c.d()),this.process(e,t||!1)},e}(),Po=function(){function e(e,t){var n=this;t||={},No.call(this,e),this.d=new xo(t,function(e,t){n.ondata(null,e,t)}),this.compression=8,this.flag=Oo(t.level)}return e.prototype.process=function(e,t){try{this.d.push(e,t)}catch(e){this.ondata(e,null,t)}},e.prototype.push=function(e,t){No.prototype.push.call(this,e,t)},e}(),Fo=function(){function e(e){this.ondata=e,this.u=[],this.d=1}return e.prototype.add=function(e){var t=this;if(this.ondata||$a(5),this.d&2)this.ondata($a(4+(this.d&1)*8,0,1),null,!1);else{var n=Eo(e.filename),r=n.length,i=e.comment,a=i&&Eo(i),o=r!=e.filename.length||a&&i.length!=a.length,s=r+Ao(e.extra)+30;r>65535&&this.ondata($a(11,0,1),null,!1);var c=new wa(s);jo(c,0,e,n,o,-1);var l=[c],u=function(){for(var e=0,n=l;e<n.length;e++){var r=n[e];t.ondata(null,r,!1)}l=[]},d=this.d;this.d=0;var f=this.u.length,p=go(e,{f:n,u:o,o:a,t:function(){e.terminate&&e.terminate()},r:function(){if(u(),d){var e=t.u[f+1];e?e.r():t.d=1}d=1}}),m=0;e.ondata=function(n,r,i){if(n)t.ondata(n,r,i),t.terminate();else if(m+=r.length,l.push(r),i){var a=new wa(16);bo(a,0,134695760),bo(a,4,e.crc),bo(a,8,m),bo(a,12,e.size),l.push(a),p.c=m,p.b=s+m+16,p.crc=e.crc,p.size=e.size,d&&p.r(),d=1}else d&&u()},this.u.push(p)}},e.prototype.end=function(){var e=this;if(this.d&2){this.ondata($a(4+(this.d&1)*8,0,1),null,!0);return}this.d?this.e():this.u.push({r:function(){e.d&1&&(e.u.splice(-1,1),e.e())},t:function(){}}),this.d=3},e.prototype.e=function(){for(var e=0,t=0,n=0,r=0,i=this.u;r<i.length;r++){var a=i[r];n+=46+a.f.length+Ao(a.extra)+(a.o?a.o.length:0)}for(var o=new wa(n+22),s=0,c=this.u;s<c.length;s++){var a=c[s];jo(o,e,a,a.f,a.u,-a.c-2,t,a.o),e+=46+a.f.length+Ao(a.extra)+(a.o?a.o.length:0),t+=a.b}Mo(o,e,this.u.length,n,t),this.ondata(null,o,!0),this.d=2},e.prototype.terminate=function(){for(var e=0,t=this.u;e<t.length;e++)t[e].t();this.d=2},e}(),Io=function(){function e(){}return e.prototype.push=function(e,t){this.ondata(null,e,t)},e.compression=0,e}(),Lo=function(){function e(){var e=this;this.i=new So(function(t,n){e.ondata(null,t,n)})}return e.prototype.push=function(e,t){try{this.i.push(e,t)}catch(e){this.ondata(e,null,t)}},e.compression=8,e}(),Ro=function(){function e(e){this.onfile=e,this.k=[],this.o={0:Io},this.p=uo}return e.prototype.push=function(e,t){var n=this;if(this.onfile||$a(5),this.p||$a(4),this.c>0){var r=Math.min(this.c,e.length),i=e.subarray(0,r);if(this.c-=r,this.d?this.d.push(i,!this.c):this.k[0].push(i),e=e.subarray(r),e.length)return this.push(e,t)}else{var a=0,o=0,s=void 0,c=void 0;this.p.length?e.length?(c=new wa(this.p.length+e.length),c.set(this.p),c.set(e,this.p.length)):c=this.p:c=e;for(var l=c.length,u=this.c,d=u&&this.d,f=function(){var e,t=vo(c,o);if(t==67324752){a=1,s=o,p.d=null,p.c=0;var r=_o(c,o+6),i=_o(c,o+8),d=r&2048,f=r&8,m=_o(c,o+26),h=_o(c,o+28);if(l>o+30+m+h){var g=[];p.k.unshift(g),a=2;var _=vo(c,o+18),v=vo(c,o+22),y=Do(c.subarray(o+30,o+=30+m),!d);_==4294967295?(e=f?[-2]:ko(c,o),_=e[0],v=e[1]):f&&(_=-1),o+=h,p.c=_;var b,x={name:y,compression:i,start:function(){if(x.ondata||$a(5),!_)x.ondata(null,uo,!0);else{var e=n.o[i];e||x.ondata($a(14,`unknown compression type `+i,1),null,!1),b=_<0?new e(y):new e(y,_,v),b.ondata=function(e,t,n){x.ondata(e,t,n)};for(var t=0,r=g;t<r.length;t++){var a=r[t];b.push(a,!1)}n.k[0]==g&&n.c?n.d=b:b.push(uo,!0)}},terminate:function(){b&&b.terminate&&b.terminate()}};_>=0&&(x.size=_,x.originalSize=v),p.onfile(x)}return`break`}else if(u){if(t==134695760)return s=o+=12+(u==-2&&8),a=3,p.c=0,`break`;if(t==33639248)return s=o-=4,a=3,p.c=0,`break`}},p=this;o<l-4&&f()!==`break`;++o);if(this.p=uo,u<0){var m=a?c.subarray(0,s-12-(u==-2&&8)-(vo(c,s-16)==134695760&&4)):c.subarray(0,o);d?d.push(m,!!a):this.k[+(a==2)].push(m)}if(a&2)return this.push(c.subarray(o),t);this.p=c.subarray(o)}t&&(this.c&&$a(13),this.p=null)},e.prototype.register=function(e){this.o[e.compression]=e},e}(),zo=sn(),Bo=d(He(),1),Vo=q(),Ho=class{constructor(e){this._buf=Vo.Buffer.alloc(e&&e.size||16384),this._encoding=e&&e.encoding||`utf8`,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._buffer=Vo.Buffer.alloc(this.length),this._buf.copy(this._buffer,0,0,this.length)),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=Vo.Buffer.alloc(t);this._buf.copy(n,0),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+this._buf.write(e,this._inPos,this._encoding);for(;t>=this._buf.length-4;)this._grow(this._inPos+e.length),t=this._inPos+this._buf.write(e,this._inPos,this._encoding);this._inPos=t}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),e._buf.copy(this._buf,this._inPos,0,e.length),this._inPos+=e.length)}},Uo=q(),Wo=class{constructor(e,t){this._data=e,this._encoding=t}get length(){return this.toBuffer().length}copy(e,t,n,r){return this.toBuffer().copy(e,t,n,r)}toBuffer(){return this._buffer||=Uo.Buffer.from(this._data,this._encoding),this._buffer}},Go=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){return this._data._buf.copy(e,t,n,r)}toBuffer(){return this._data.toBuffer()}},Ko=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){this._data.copy(e,t,n,r)}toBuffer(){return this._data}},qo=class{constructor(e){this.size=e,this.buffer=Uo.Buffer.alloc(e),this.iRead=0,this.iWrite=0}toBuffer(){if(this.iRead===0&&this.iWrite===this.size)return this.buffer;let e=Uo.Buffer.alloc(this.iWrite-this.iRead);return this.buffer.copy(e,0,this.iRead,this.iWrite),e}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){let t;return e===0?null:e===void 0||e>=this.length?(t=this.toBuffer(),this.iRead=this.iWrite,t):(t=Uo.Buffer.alloc(e),this.buffer.copy(t,0,this.iRead,e),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}};let Jo=function(e){if(!(this instanceof Jo))return new Jo(e);zo.Duplex.call(this,e),e||={},this.bufSize=e.bufSize||1024*1024,this.buffers=[],this.batch=e.batch||!1,this.corked=!1,this.inPos=0,this.outPos=0,this.pipes=[],this.paused=!1,this.encoding=null};Xi(Jo,zo.Duplex,{toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:return Uo.Buffer.concat(this.buffers.map(e=>e.toBuffer()))}},_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new qo(this.bufSize);return this.buffers.push(e),e},async _pipe(e){await Promise.all(this.pipes.map(function(t){return new Promise(n=>{t.write(e.toBuffer(),()=>{n()})})}))},_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){t instanceof Function&&(n=t,t=`utf8`),n||=Yi;let r;if(e instanceof Ho||e&&e.constructor?.name===`StringBuf`)r=new Go(e);else if(Uo.Buffer.isBuffer(e))r=new Ko(e);else if(ArrayBuffer.isView(e))r=new Ko(Uo.Buffer.from(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Ko(Uo.Buffer.from(e));else if(typeof e==`string`||e instanceof String)r=new Wo(String(e),t);else throw Error(`Chunk must be one of type String, Buffer, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;)this._pipe(this.buffers.shift());else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipe(r),n());else this.paused||this.emit(`data`,r.toBuffer()),this._writeToBuffers(r),this.emit(`readable`);return!0},cork(){this.corked=!0},_flush(){if(this.pipes.length)for(;this.buffers.length;)this._pipe(this.buffers.shift())},uncork(){this.corked=!1,this._flush()},end(e,t,n){let r=e=>{e?n(e):(this._flush(),this.pipes.forEach(e=>{e.end()}),this.emit(`finish`))};e?this.write(e,t,r):r()},read(e){let t;if(e){for(t=[];e&&this.buffers.length&&!this.buffers[0].eod;){let n=this.buffers[0],r=n.read(e);e-=r.length,t.push(r),n.eod&&n.full&&this.buffers.shift()}return Uo.Buffer.concat(t)}return t=this.buffers.map(e=>e.toBuffer()).filter(Boolean),this.buffers=[],Uo.Buffer.concat(t)},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},unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)},unshift(){throw Error(`Not Implemented`)},wrap(){throw Error(`Not Implemented`)}});var Yo=q(),Xo=class extends Bo.default.EventEmitter{constructor(e){super(),this.options=Object.assign({type:`nodebuffer`,compression:`DEFLATE`},e);let t=this.options.compressionOptions?.level??6;this.compressionLevel=Math.max(0,Math.min(9,t)),this.files={},this.stream=new Jo,this.finalized=!1,this.zip=new Fo((e,t,n)=>{e?this.stream.emit(`error`,e):(this.stream.write(Yo.Buffer.from(t)),n&&this.stream.end())})}append(e,t){let n;if(Object.prototype.hasOwnProperty.call(t,`base64`)&&t.base64){let t=typeof e==`string`?e:e.toString();n=Yo.Buffer.from(t,`base64`)}else n=typeof e==`string`?Yo.Buffer.from(e,`utf8`):Yo.Buffer.isBuffer(e)?e:ArrayBuffer.isView(e)?new Uint8Array(e.buffer,e.byteOffset,e.byteLength):e instanceof ArrayBuffer?new Uint8Array(e):e;let r=this.options.compression===`STORE`?new No(t.name):new Po(t.name,{level:this.compressionLevel});this.zip.add(r),r.push(n,!0)}push(e){return this.stream.push(e)}async finalize(){this.finalized||(this.finalized=!0,this.zip.end(),this.emit(`finish`))}read(e){return this.stream.read(e)}setEncoding(e){return this.stream.setEncoding(e)}pause(){return this.stream.pause()}resume(){return this.stream.resume()}isPaused(){return this.stream.isPaused()}pipe(e,t){return this.stream.pipe(e,t)}unpipe(e){return this.stream.unpipe(e)}unshift(e){return this.stream.unshift(e)}wrap(e){return this.stream.wrap(e)}};function Zo(e,t,n){e.push(` ${t}="${ea(n.toString())}"`)}function Qo(e,t){if(t){let n=[];Object.entries(t).forEach(([e,t])=>{t!==void 0&&Zo(n,e,t)}),e.push(n.join(``))}}var $o=class{constructor(){this._xml=[],this._stack=[],this._rollbacks=[]}get tos(){return this._stack.length?this._stack[this._stack.length-1]:void 0}get cursor(){return this._xml.length}openXml(e){let t=this._xml;t.push(`<?xml`),Qo(t,e),t.push(`?>
27
+ `)}openNode(e,t){let n=this.tos,r=this._xml;n&&this.open&&r.push(`>`),this._stack.push(e),r.push(`<`),r.push(e),Qo(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&&Zo(this._xml,e,t)}addAttributes(e){if(!this.open)throw Error(`Cannot write attributes to node if it is not open`);Qo(this._xml,e)}writeText(e){let t=this._xml;this.open&&=(t.push(`>`),!1),this.leaf=!1,t.push(ea(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}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,open:this.open}),this.cursor}commit(){this._rollbacks.pop()}rollback(){let e=this._rollbacks.pop();this._xml.length>e.xml&&this._xml.splice(e.xml,this._xml.length-e.xml),this._stack.length>e.stack&&this._stack.splice(e.stack,this._stack.length-e.stack),this.leaf=e.leaf,this.open=e.open}get xml(){return this.closeAll(),this._xml.join(``)}static{this.StdDocAttributes={version:`1.0`,encoding:`UTF-8`,standalone:`yes`}}},es=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`
28
28
  \r -퟿-�𐀀-􏿿`,e.S=` \r
29
- `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),as=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`-퟿-�𐀀-􏿿`,e.RESTRICTED_CHAR=`-\b\v\f--„†-Ÿ`,e.S=` \r
30
- `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),os=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||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}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),ss=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SaxesParser=e.EVENTS=void 0;let t=is(),n=as(),r=os();var i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE;let m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=8232,y=e=>e===34||e===39,b=[34,39],x=[...b,91,62],S=[...b,60,93],C=[61,63,...c],w=[...c,62,38,60];function T(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
31
- ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function E(e,t){for(let n of Object.keys(t))T(e,n,t[n])}let D=e=>p.test(e),O=e=>l.test(e);e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];let k={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=D,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(E(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=O,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?13:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[k[e]]=t}off(e){this[k[e]]=void 0}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),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===13||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){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(this.column++,n<55296){if(n>=32||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:return e.charCodeAt(t+1)===10&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){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(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==v||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:{let n=e.charCodeAt(t+1);(n===10||n===133)&&(this.i=t+2)}case 133:case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===-2?10:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===-2,a=i?10:r;if(a===-1||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case-2:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=10;break;case-1:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===-1)return this.name+=e.slice(t),-1;if(!s(n))return this.name+=e.slice(t,this.prevI),n===-2?10:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===-1||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case 60:if(this.state=15,this.text.length!==0)throw Error(`no-empty text at start`);break;case-1:break;default:this.unget(),this.state=13,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(x);switch(t){case 62:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=13,this.doctype=!0;break;case-1:break;default:this.text+=String.fromCodePoint(t),t===91?this.state=4:y(t)&&(this.state=3,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){let e=this.captureTo(S);e!==-1&&(this.text+=String.fromCodePoint(e),e===93?this.state=2:e===60?this.state=6:y(e)&&(this.state=5,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang=``;break;case 63:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?8:4,this.openWakaBang=``)}sDTDComment(){this.captureToChar(45)&&(this.text+=`-`,this.state=9)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===45?10:8}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62?this.state=4:(this.fail(`malformed comment.`),this.state=8)}sDTDPI(){this.captureToChar(63)&&(this.text+=`?`,this.state=12)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62&&(this.state=4)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case-2:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==13||this.textHandler!==void 0)&&(this.text+=i);break loop}case-1:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case 63:this.state=23;break;default:this.fail(`disallowed character in tag name`),this.state=13,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!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),this.state=20,this.openWakaBang=``;break;case`--`:this.state=17,this.openWakaBang=``;break;case`DOCTYPE`:this.state=2,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var e;let t=this.getCodeNorm();t===45?(this.state=19,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=17)}sCommentEnded(){let e=this.getCodeNorm();e===62?this.state=13:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=17)}sCData(){this.captureToChar(93)&&(this.state=21)}sCDataEnding(){let e=this.getCodeNorm();e===93?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case 62:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=13;break;case 93:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=20}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===63||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===63?26:25):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===-1){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===63;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?33:27):this.state=r?26:25:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===63?this.state=26:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(63)&&(this.state=26)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===62){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=13}else t===63?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===63){this.state=33;return}e!==-1&&(this.state=28,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(C);if(e===63){this.state=33,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===61){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===61?30:29}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==61&&this.fail(`value required.`),this.state=30)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(y(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=32),this.state=31)}sXMLDeclValue(){let e=this.captureTo([this.q,63]);if(e===63){this.state=33,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===-1)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=32}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===63){this.state=33;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=27}sXMLDeclEnding(){var e;this.getCodeNorm()===62?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=13):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===-1)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case 62:this.openTag();break;case 47:this.state=35;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=36}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=36)}sAttrib(){let e=this.skipSpaces();e!==-1&&(o(e)?(this.unget(),this.state=37):e===62?this.openTag():e===47?this.state=35:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===61?this.state=39:i(e)?this.state=38:e===62?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==-1&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case-1:return;case 61:this.state=39;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===62?this.openTag():o(e)?(this.unget(),this.state=37):(this.fail(`disallowed character in attribute name.`),this.state=36)}}sAttribValue(){let e=this.getCodeNorm();y(e)?(this.q=e,this.state=40):i(e)||(this.fail(`unquoted attribute value.`),this.state=42,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=41;return;case 38:this.text+=t.slice(n,this.prevI),this.state=14,this.entityReturnState=40;return;case 10:case-2:case 9:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case 60:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case-1:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=36:e===62?this.openTag():e===47?this.state=35:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=37):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(w);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case 60:this.fail(`disallowed character.`);break;case-1:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===62?this.openTag():this.state=36}}sCloseTag(){let e=this.captureNameChars();e===62?this.closeTag():i(e)?this.state=44:e!==-1&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case 62:this.closeTag();break;case-1:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case 60:if(this.state=15,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=0;break scanLoop;case 38:this.state=14,this.entityReturnState=13,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=0;break scanLoop;case 93:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw Error(`impossible state`)}break;case 62:t===2&&this.fail(`the string "]]>" is disallowed in char data.`),t=0;break;case-2:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case-1:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case 60:if(this.state=15,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case 38:this.state=14,this.entityReturnState=13,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case-2:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case-1:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(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))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,T(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,T(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==0&&this.state!==13&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=13,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=13,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=13,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}}))();async function*cs(e){let t=new ss.SaxesParser({xmlns:!1,defaultXMLVersion:`1.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){if(t.write(rs(i)),n)throw n;yield r,r=[]}}var $=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=null,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){for await(let t of e)for(let{eventType:e,value:n}of t)if(e===`opentag`)this.parseOpen(n);else if(e===`text`)this.parseText(n);else if(e===`closetag`&&!this.parseClose(n.name))return this.model;return this.model}async parseStream(e){return this.parse(cs(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new ts;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 ls(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{ls(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var us=class extends ${constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new ts;ls(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}}},ds=class extends ${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&&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){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model=[],!0;default:return 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)})}}},fs=class extends ${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}},ps=class extends ${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}},ms=class extends ${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}},hs=class extends ${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}},gs=class e extends ${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}},_s=class e extends ${constructor(t){super(),this.options=t||e.OPTIONS,this.map={b:{prop:`bold`,xform:new ps({tag:`b`,attr:`val`})},i:{prop:`italic`,xform:new ps({tag:`i`,attr:`val`})},u:{prop:`underline`,xform:new gs},charset:{prop:`charset`,xform:new ms({tag:`charset`,attr:`val`})},color:{prop:`color`,xform:new fs},condense:{prop:`condense`,xform:new ps({tag:`condense`,attr:`val`})},extend:{prop:`extend`,xform:new ps({tag:`extend`,attr:`val`})},family:{prop:`family`,xform:new ms({tag:`family`,attr:`val`})},outline:{prop:`outline`,xform:new ps({tag:`outline`,attr:`val`})},vertAlign:{prop:`vertAlign`,xform:new hs({tag:`vertAlign`,attr:`val`})},scheme:{prop:`scheme`,xform:new hs({tag:`scheme`,attr:`val`})},shadow:{prop:`shadow`,xform:new ps({tag:`shadow`,attr:`val`})},strike:{prop:`strike`,xform:new ps({tag:`strike`,attr:`val`})},sz:{prop:`size`,xform:new ms({tag:`sz`,attr:`val`})}},this.map[this.options.fontNameTag]={prop:`name`,xform:new hs({tag:this.options.fontNameTag,attr:`val`})}}get tag(){return this.options.tagName}render(e,t){let{map:n}=this;e.openNode(this.options.tagName),Object.entries(this.map).forEach(([r,i])=>{n[r].xform.render(e,t[i.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`}}},vs=class extends ${constructor(){super(),this.map={color:new fs}}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}},ys=class extends ${constructor(){super(),this.map={fgColor:new fs(`fgColor`),bgColor:new fs(`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}},bs=class extends ${constructor(){super(),this.map={stop:new vs}}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}},xs=class e extends ${constructor(){super(),this.map={patternFill:new ys,gradientFill:new bs}}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=vs}static{this.PatternFillXform=ys}static{this.GradientFillXform=bs}},Ss=class e extends ${constructor(e){super(),this.name=e,this.map={color:new fs}}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),{})}},Cs=class extends ${constructor(){super(),this.map={top:new Ss(`top`),left:new Ss(`left`),bottom:new Ss(`bottom`),right:new Ss(`right`),diagonal:new Ss(`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=aa(e.attributes.diagonalUp),this.diagonalDown=aa(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 ws={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 Ts(){let e={};return Object.entries(ws).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let Es=Ts();var Ds=class extends ${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 Es[e]}static getDefaultFmtCode(e){return ws[e]&&ws[e].f}};let Os={ReadingOrder:{LeftToRight:1,RightToLeft:2}},ks={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=na(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=na(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Os.ReadingOrder.LeftToRight;case`rtl`:return Os.ReadingOrder.RightToLeft;default:return}}},As={toXml(e){let t=ks.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=na(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 js=class extends ${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`,ks.horizontal(t.horizontal)),r(`vertical`,ks.vertical(t.vertical)),r(`wrapText`,ks.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,ks.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,ks.indent(t.indent)),r(`textRotation`,As.toXml(t.textRotation)),r(`readingOrder`,ks.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`,aa(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,aa(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,As.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 Ms={boolean(e,t){return e===void 0?t:e}};var Ns=class extends ${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`,Ms.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,Ms.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}},Ps=class extends ${constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new js,protection:new Ns}}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.numFmtId&&e.addAttribute(`applyNumberFormat`,`1`),t.fontId&&e.addAttribute(`applyFont`,`1`),t.fillId&&e.addAttribute(`applyFill`,`1`),t.borderId&&e.addAttribute(`applyBorder`,`1`),t.alignment&&e.addAttribute(`applyAlignment`,`1`),t.protection&&e.addAttribute(`applyProtection`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),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`xf`:return 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)),!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`}},Fs=class extends ${constructor(){super(),this.map={alignment:new js,border:new Cs,fill:new xs,font:new _s,numFmt:new Ds,protection:new Ns}}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}},Is=class e extends ${constructor(t){super(),this.map={numFmts:new ds({tag:`numFmts`,count:!0,childXform:new Ds}),fonts:new ds({tag:`fonts`,count:!0,childXform:new _s,$:{"x14ac:knownFonts":1}}),fills:new ds({tag:`fills`,count:!0,childXform:new xs}),borders:new ds({tag:`borders`,count:!0,childXform:new Cs}),cellStyleXfs:new ds({tag:`cellStyleXfs`,count:!0,childXform:new Ps}),cellXfs:new ds({tag:`cellXfs`,count:!0,childXform:new Ps({xfId:!0})}),dxfs:new ds({tag:`dxfs`,always:!0,count:!0,childXform:new Fs}),numFmt:new Ds,font:new _s,fill:new xs,border:new Cs,style:new Ps({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}render(t,n){let r=n||this.model;t.openXml(ts.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({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.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;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let n={},r=t||S.ValueType.Number;if(e.numFmt)n.numFmtId=this._addNumFmtStr(e.numFmt);else switch(r){case S.ValueType.Number:n.numFmtId=this._addNumFmtStr(`General`);break;case S.ValueType.Date:n.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(n.fontId=this._addFont(e.font)),e.border&&(n.borderId=this._addBorder(e.border)),e.fill&&(n.fillId=this._addFill(e.fill)),e.alignment&&(n.alignment=e.alignment),e.protection&&(n.protection=e.protection);let i=this._addStyle(n);return 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]||Ds.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}return 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),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]}_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=Ds.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 us({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new us({tag:`dxfs`,$:{count:0}}),tableStyles:new us({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new us({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`}}]}]})}}};Is.Mock=class extends Is{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 S.ValueType.Date:return this.dateStyleId;default:return 0}}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:Ds.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var Ls=class extends ${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}},Rs=class e extends ${constructor(){super(),this.map={"dc:creator":new hs({tag:`dc:creator`}),"dc:title":new hs({tag:`dc:title`}),"dc:subject":new hs({tag:`dc:subject`}),"dc:description":new hs({tag:`dc:description`}),"dc:identifier":new hs({tag:`dc:identifier`}),"dc:language":new hs({tag:`dc:language`}),"cp:keywords":new hs({tag:`cp:keywords`}),"cp:category":new hs({tag:`cp:category`}),"cp:lastModifiedBy":new hs({tag:`cp:lastModifiedBy`}),"cp:lastPrinted":new Ls({tag:`cp:lastPrinted`,format:e.DateFormat}),"cp:revision":new ms({tag:`cp:revision`}),"cp:version":new hs({tag:`cp:version`}),"cp:contentStatus":new hs({tag:`cp:contentStatus`}),"cp:contentType":new hs({tag:`cp:contentType`}),"dcterms:created":new Ls({tag:`dcterms:created`,attrs:e.DateAttrs,format:e.DateFormat}),"dcterms:modified":new Ls({tag:`dcterms:modified`,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(ts.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES),this.map[`dc:creator`].render(t,n.creator),this.map[`dc:title`].render(t,n.title),this.map[`dc:subject`].render(t,n.subject),this.map[`dc:description`].render(t,n.description),this.map[`dc:identifier`].render(t,n.identifier),this.map[`dc:language`].render(t,n.language),this.map[`cp:keywords`].render(t,n.keywords),this.map[`cp:category`].render(t,n.category),this.map[`cp:lastModifiedBy`].render(t,n.lastModifiedBy),this.map[`cp:lastPrinted`].render(t,n.lastPrinted),this.map[`cp:revision`].render(t,n.revision),this.map[`cp:version`].render(t,n.version),this.map[`cp:contentStatus`].render(t,n.contentStatus),this.map[`cp:contentType`].render(t,n.contentType),this.map[`dcterms:created`].render(t,n.created),this.map[`dcterms:modified`].render(t,n.modified),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`cp:coreProperties`:case`coreProperties`:return!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.parser=void 0),!0;switch(e){case`cp:coreProperties`:case`coreProperties`:return this.model={creator:this.map[`dc:creator`].model,title:this.map[`dc:title`].model,subject:this.map[`dc:subject`].model,description:this.map[`dc:description`].model,identifier:this.map[`dc:identifier`].model,language:this.map[`dc:language`].model,keywords:this.map[`cp:keywords`].model,category:this.map[`cp:category`].model,lastModifiedBy:this.map[`cp:lastModifiedBy`].model,lastPrinted:this.map[`cp:lastPrinted`].model,revision:this.map[`cp:revision`].model,contentStatus:this.map[`cp:contentStatus`].model,contentType:this.map[`cp:contentType`].model,created:this.map[`dcterms:created`].model,modified:this.map[`dcterms:modified`].model},!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}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`}}},zs=class extends ${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){switch(e.name){case`t`:return this._text=[],this.model=``,!0;default:return!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}},Bs=class e extends ${constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new zs}get fontXform(){return this._fontXform||=new _s(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`}}},Vs=class extends ${constructor(){super(),this.map={r:new Bs,t:new zs}}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}}},Hs=class extends ${constructor(e){super(),this.model=e,this.map={r:new Bs,t:new zs,rPh:new Vs}}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){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={},!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=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},Us=class extends ${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 Hs}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(ts.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}`)}}},Ws=class extends ${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}},Gs=class e extends ${constructor(){super(),this.map={Relationship:new Ws}}render(t,n){let r=n||this._values;t.openXml(ts.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`}}},Ks=class e extends ${render(t,n){t.openXml(ts.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};(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:`/xl/workbook.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{let n=`/xl/worksheets/sheet${e.id}.xml`;t.leafNode(`Override`,{PartName:n,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables||[]).length&&(t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheDefinition1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheRecords1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotTables/pivotTable1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})),t.leafNode(`Override`,{PartName:`/xl/theme/theme1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:`/xl/styles.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:`/xl/sharedStrings.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/tables/${e.target}`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/drawings/${e.name}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})}),n.commentRefs&&(t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:`/xl/${e}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})})),t.leafNode(`Override`,{PartName:`/docProps/core.xml`,ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:`/docProps/app.xml`,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`}}},qs=class extends ${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`}},Js=class extends ${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`}},Ys=class e extends ${constructor(){super(),this.map={Company:new hs({tag:`Company`}),Manager:new hs({tag:`Manager`}),HeadingPairs:new qs,TitleOfParts:new Js}}render(t,n){t.openXml(ts.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.TitleOfParts.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.TitleOfParts.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`}}},Xs=class extends ${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:Qs(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};function Zs(e){try{return m.decodeEx(e),!0}catch{return!1}}function Qs(e){let t=[],n=!1,r=``;return e.split(`,`).forEach(e=>{if(!e)return;let i=(e.match(/'/g)||[]).length;if(!i){n?r+=`${e},`:Zs(e)&&t.push(e);return}let a=i%2==0;!n&&a&&Zs(e)?t.push(e):n&&!a?(n=!1,Zs(r+e)&&t.push(r+e),r=``):(n=!0,r+=`${e},`)}),t}var $s=class extends ${render(e,t){e.leafNode(`sheet`,{sheetId:t.id,name:t.name,state:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:ta(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},ec=class extends ${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}},tc=class extends ${render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,defaultThemeVersion:164011,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},nc=class extends ${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}},rc=class extends ${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}},ic=class e extends ${constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new tc,bookViews:new ds({tag:`bookViews`,count:!1,childXform:new ec}),sheets:new ds({tag:`sheets`,count:!1,childXform:new $s}),definedNames:new ds({tag:`definedNames`,count:!1,childXform:new Xs}),calcPr:new nc,pivotCaches:new ds({tag:`pivotCaches`,count:!1,childXform:new rc})}}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={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${i[0]}:$${i[1]}`],localSheetId:n};t.push(a)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}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(ts.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),this.map.pivotCaches.render(t,n.pivotTables),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),!1;default:return!0}}reconcile(e){let t=(e.workbookRels||[]).reduce((e,t)=>(e[t.Id]=t,e),{}),n=[],r,i=0;(e.sheets||[]).forEach(a=>{let o=t[a.rId];o&&(r=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],r&&(r.name=a.name,r.id=a.id,r.state=a.state,n[i++]=r))});let a=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=m.decodeEx(e.ranges[0]);r.pageSetup.printArea=r.pageSetup.printArea?`${r.pageSetup.printArea}&&${t.dimensions}`:t.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,i=t.match(/\$\d+:\$\d+/);if(i&&i.length){let e=i[0];r.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];r.pageSetup.printTitlesColumn=e.replace(n,``)}}}else a.push(e)}),e.definedNames=a,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 us({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let ac={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`};var oc=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 h(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let n=m.decode(e);for(let e=n.top;e<=n.bottom;e++){let r=t[e-1];for(let t=n.left;t<=n.right;t++){let i=r.cells[t-1];i?i.type===S.ValueType.Merge&&(i.master=n.tl):r.cells[t]={type:S.ValueType.Null,address:m.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function sc(e){if(e==null)return S.ValueType.Null;if(e instanceof String||typeof e==`string`)return S.ValueType.String;if(typeof e==`number`)return S.ValueType.Number;if(typeof e==`boolean`)return S.ValueType.Boolean;if(e instanceof Date)return S.ValueType.Date;if(e.text&&e.hyperlink)return S.ValueType.Hyperlink;if(e.formula)return S.ValueType.Formula;if(e.error)return S.ValueType.Error;throw Error(`I could not understand type of value`)}function cc(e){switch(e.type){case S.ValueType.Formula:return sc(e.result);default:return e.type}}var lc=class extends ${constructor(){super(),this.richTextXform=new Bs}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},cc(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case S.ValueType.String:case S.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case S.ValueType.Date:t.date1904&&(e.date1904=!0);break;case S.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 S.ValueType.Merge:t.merges.add(e);break;case S.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 h(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(sc(t.result)){case S.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case S.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case S.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case S.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case S.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case S.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,Zi(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===S.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case S.ValueType.Null:break;case S.ValueType.Number:e.leafNode(`v`,null,t.value);break;case S.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case S.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case S.ValueType.String:case S.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 S.ValueType.Date:e.leafNode(`v`,null,Zi(t.value,t.date1904));break;case S.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 S.ValueType.Formula:this.renderFormula(e,t);break;case S.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=S.ValueType.Formula,e.value&&=(this.t===`str`?e.result=ta(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=S.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=S.ValueType.String,e.value=ta(e.value);break;case`inlineStr`:e.type=S.ValueType.String;break;case`b`:e.type=S.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=S.ValueType.Error,e.value={error:e.value};break;default:e.type=S.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=S.ValueType.Null:e.type=S.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&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case S.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=S.ValueType.RichText);break;case S.ValueType.Number:n&&ra(n.numFmt)&&(e.type=S.ValueType.Date,e.value=Qi(e.value,t.date1904));break;case S.ValueType.Formula:e.result!==void 0&&n&&ra(n.numFmt)&&(e.result=Qi(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===S.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=S.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},uc=class extends ${constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new lc}}get tag(){return`row`}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&&(e.addAttribute(`ht`,t.height),e.addAttribute(`customHeight`,`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`)),e.addAttribute(`x14ac:dyDescent`,`0.25`),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;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:parseInt(e.attributes.r,10),min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),aa(e.attributes.hidden)&&(n.hidden=!0),aa(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),aa(e.attributes.collapsed)&&(n.collapsed=!0),!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)){if(this.model.cells.push(this.parser.model),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?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)})}},dc=class extends ${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)),aa(e.attributes.hidden)&&(t.hidden=!0),aa(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),aa(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId&&(e.style=t.styles.getStyleModel(e.styleId))}},fc=class extends ${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}},pc=class extends ${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))}},mc=class extends ${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 hc(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function gc(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=aa(i)}function _c(e){if(!e)return[];let t=Object.entries(e).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),n=Object.fromEntries(t.map(e=>[e.address,e])),r=(t,n,r)=>{for(let i=0;i<n;i++){let n=m.encodeAddress(t.row+i,r);if(!e[n]||!T(e[t.address],e[n]))return!1}return!0};return t.map(t=>{if(!t.marked){let i=m.decodeEx(t.address);if(i.dimensions)return n[i.dimensions].marked=!0,{...t.dataValidation,sqref:t.address};let a=1,o=m.encodeAddress(i.row+a,i.col);for(;e[o]&&T(t.dataValidation,e[o]);)a++,o=m.encodeAddress(i.row+a,i.col);let s=1;for(;r(i,a,i.col+s);)s++;for(let e=0;e<a;e++)for(let t=0;t<s;t++)o=m.encodeAddress(i.row+e,i.col+t),n[o].marked=!0;if(a>1||s>1){let e=i.row+(a-1),n=i.col+(s-1);return{...t.dataValidation,sqref:`${t.address}:${m.encodeAddress(e,n)}`}}return{...t.dataValidation,sqref:t.address}}return null}).filter(Boolean)}var vc=class extends ${get tag(){return`dataValidations`}render(e,t){let n=_c(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(Zi(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&&gc(t,e.attributes,`allowBlank`),gc(t,e.attributes,`showInputMessage`),gc(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:hc(t,e.attributes,`operator`,`between`);break}return hc(t,e.attributes,`promptTitle`),hc(t,e.attributes,`prompt`),hc(t,e.attributes,`errorStyle`),hc(t,e.attributes,`errorTitle`),hc(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(`:`)?new h(e).forEachAddress(e=>{this.model[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=Qi(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},yc=class extends ${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 bc=e=>e!==void 0;var xc=class extends ${get tag(){return`outlinePr`}render(e,t){return t&&(bc(t.summaryBelow)||bc(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:bc(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:bc(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:bc(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:bc(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},Sc=class extends ${constructor(){super(),this.map={tabColor:new fs(`tabColor`),pageSetUpPr:new yc,outlinePr:new xc}}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)}},Cc=class extends ${get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow,outlineLevelCol:t.outlineLevelCol,"x14ac:dyDescent":t.dyDescent};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),(!t.defaultRowHeight||t.defaultRowHeight!==15)&&(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:parseFloat(e.attributes[`x14ac:dyDescent`]||`0`),outlineLevelRow:parseInt(e.attributes.outlineLevelRow||`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol||`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),!0):!1}parseText(){}parseClose(){return!1}};let wc={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var Tc=class extends ${get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){e.openNode(`sheetView`,{workbookViewId:t.workbookViewId||0});let n=function(t,n,r){r&&e.addAttribute(t,n)};n(`rightToLeft`,`1`,t.rightToLeft===!0),n(`tabSelected`,`1`,t.tabSelected),n(`showRuler`,`0`,t.showRuler===!1),n(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),n(`showGridLines`,`0`,t.showGridLines===!1),n(`zoomScale`,t.zoomScale,t.zoomScale),n(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal),n(`view`,t.style,t.style);let r,i,a,o;switch(t.state){case`frozen`:i=t.xSplit||0,a=t.ySplit||0,r=t.topLeftCell||m.getAddress(a+1,i+1).address,o=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:r,activePane:o,state:`frozen`}),e.leafNode(`selection`,{pane:o,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,state:wc[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,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 Ec(e,t){return e?t:void 0}function Dc(e,t){return e===t?!0:void 0}var Oc=class extends ${get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:Ec(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:Ec(t.formatCells,`0`),formatColumns:Ec(t.formatColumns,`0`),formatRows:Ec(t.formatRows,`0`),insertColumns:Ec(t.insertColumns,`0`),insertRows:Ec(t.insertRows,`0`),insertHyperlinks:Ec(t.insertHyperlinks,`0`),deleteColumns:Ec(t.deleteColumns,`0`),deleteRows:Ec(t.deleteRows,`0`),sort:Ec(t.sort,`0`),autoFilter:Ec(t.autoFilter,`0`),pivotTables:Ec(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=Ec(t.objects===!1,`1`),n.scenarios=Ec(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:Dc(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:Dc(e.attributes.formatCells,`0`),formatColumns:Dc(e.attributes.formatColumns,`0`),formatRows:Dc(e.attributes.formatRows,`0`),insertColumns:Dc(e.attributes.insertColumns,`0`),insertRows:Dc(e.attributes.insertRows,`0`),insertHyperlinks:Dc(e.attributes.insertHyperlinks,`0`),deleteColumns:Dc(e.attributes.deleteColumns,`0`),deleteRows:Dc(e.attributes.deleteRows,`0`),sort:Dc(e.attributes.sort,`0`),autoFilter:Dc(e.attributes.autoFilter,`0`),pivotTables:Dc(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}},kc=class extends ${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 Ac(e){return e?`1`:void 0}function jc(e){switch(e){case`overThenDown`:return e;default:return}}function Mc(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function Nc(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Pc(e){return e===void 0?void 0:parseInt(e,10)}var Fc=class extends ${get tag(){return`pageSetup`}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:t.horizontalDpi,verticalDpi:t.verticalDpi,pageOrder:jc(t.pageOrder),blackAndWhite:Ac(t.blackAndWhite),draft:Ac(t.draft),cellComments:Mc(t.cellComments),errors:Nc(t.errors),scale:t.scale,fitToWidth:t.fitToWidth,fitToHeight:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Ac(!!t.firstPageNumber),usePrinterDefaults:Ac(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:Pc(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 Ic(e){return e?`1`:void 0}var Lc=class extends ${get tag(){return`printOptions`}render(e,t){if(t){let n={headings:Ic(t.showRowColHeaders),gridLines:Ic(t.showGridLines),horizontalCentered:Ic(t.horizontalCentered),verticalCentered:Ic(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}},Rc=class extends ${get tag(){return`autoFilter`}render(e,t){if(t)if(typeof t==`string`)e.leafNode(`autoFilter`,{ref:t});else{let n=function(e){return typeof e==`string`?e:m.getAddress(e.row,e.column).address},r=n(t.from),i=n(t.to);r&&i&&e.leafNode(`autoFilter`,{ref:`${r}:${i}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},zc=class extends ${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}},Bc=class extends ${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}},Vc=class extends ${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}},Hc=class extends ${get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){return e.name===`brk`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},Uc=class extends ds{constructor(){let e={tag:`rowBreaks`,count:!0,childXform:new Hc};super(e)}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),this.count&&(e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length));let{childXform:n}=this;t.forEach(t=>{n.render(e,t)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}},Wc=class extends ${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}}},Gc=class extends ${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``}},Kc=class extends ${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:$.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},qc=class extends Gc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Kc,color:this.colorXform=new fs}}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}}},Jc=class extends ${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}},Yc=class extends Gc{constructor(){super(),this.map={"x14:id":this.idXform=new Jc}}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}},Xc=class extends Gc{constructor(){super(),this.map={ext:new Yc}}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)}},Zc=class extends ${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}},Qc=class extends Gc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Kc,color:this.colorXform=new fs}}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)}},$c=class extends Gc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Kc}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:$.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:$.toBoolAttribute(t.reverse,!1),showValue:$.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:$.toStringValue(e.iconSet,`3TrafficLights`),reverse:$.toBoolValue(e.reverse),showValue:$.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let el={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},tl=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new h(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}},nl=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new h(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}},rl=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 il=class e extends Gc{constructor(){super(),this.map={dataBar:this.databarXform=new qc,extLst:this.extLstRefXform=new Xc,formula:this.formulaXform=new Zc,colorScale:this.colorScaleXform=new Qc,iconSet:this.iconSetXform=new $c}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||el[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:$.toBoolAttribute(t.percent,!1),bottom:$.toBoolAttribute(t.bottom,!1),rank:$.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:$.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:$.toStringAttribute(t.operator,`containsText`)});let n=tl(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=nl(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...rl(e),dxfId:$.toIntValue(e.dxfId),priority:$.toIntValue(e.priority),timePeriod:e.timePeriod,percent:$.toBoolValue(e.percent),bottom:$.toBoolValue(e.bottom),rank:$.toIntValue(e.rank),aboveAverage:$.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}}},al=class extends Gc{constructor(){super(),this.map={cfRule:new il}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(il.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{il.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)}},ol=class extends ${constructor(){super(),this.cfXform=new al}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))})})}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)})})}};let sl=[];for(let e=0;e<256;++e)sl.push((e+256).toString(16).slice(1));function cl(e,t=0){return(sl[e[t+0]]+sl[e[t+1]]+sl[e[t+2]]+sl[e[t+3]]+`-`+sl[e[t+4]]+sl[e[t+5]]+`-`+sl[e[t+6]]+sl[e[t+7]]+`-`+sl[e[t+8]]+sl[e[t+9]]+`-`+sl[e[t+10]]+sl[e[t+11]]+sl[e[t+12]]+sl[e[t+13]]+sl[e[t+14]]+sl[e[t+15]]).toLowerCase()}let ll,ul=new Uint8Array(16);function dl(){if(!ll){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);ll=crypto.getRandomValues.bind(crypto)}return ll(ul)}var fl={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function pl(e,t,n){e||={};let r=e.random??e.rng?.()??dl();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return cl(r)}function ml(e,t,n){return fl.randomUUID&&!t&&!e?fl.randomUUID():pl(e,t,n)}var hl=ml,gl=class extends ${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}},_l=class extends Gc{constructor(){super(),this.map={"xm:f":this.fExtXform=new gl}}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}}},vl=class extends Gc{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new _l,"x14:borderColor":this.borderColorXform=new fs(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new fs(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new fs(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new fs(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:$.toIntAttribute(t.minLength,0,!0),maxLength:$.toIntAttribute(t.maxLength,100,!0),border:$.toBoolAttribute(t.border,!1),gradient:$.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:$.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:$.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:$.toAttribute(t.axisPosition,`auto`),direction:$.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:$.toIntValue(e.minLength,0),maxLength:$.toIntValue(e.maxLength,100),border:$.toBoolValue(e.border,!1),gradient:$.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:$.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:$.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:$.toStringValue(e.axisPosition,`auto`),direction:$.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}}},yl=class extends ${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:$.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},bl=class extends Gc{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new _l,"x14:cfIcon":this.cfIconXform=new yl}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:$.toStringAttribute(t.iconSet),reverse:$.toBoolAttribute(t.reverse,!1),showValue:$.toBoolAttribute(t.showValue,!0),custom:$.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:$.toStringValue(e.iconSet,`3TrafficLights`),reverse:$.toBoolValue(e.reverse,!1),showValue:$.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}}};let xl={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var Sl=class e extends Gc{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new vl,"x14:iconSet":this.iconSetXform=new bl}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?vl.isExt(e):!!(e.type===`iconSet`&&(e.custom||xl[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${hl()}}`.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||`{${hl()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:$.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},Cl=class extends ${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}},wl=class extends Gc{constructor(){super(),this.map={"xm:sqref":this.sqRef=new Cl,"x14:cfRule":this.cfRule=new Sl}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(Sl.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(Sl.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}}},Tl=class extends Gc{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new wl}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(Sl.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)}},El=class extends Gc{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new Tl}}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}},Dl=class extends Gc{constructor(){super(),this.map={ext:this.ext=new El}}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 Ol=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},kl=(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?Ol(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var Al=class e extends ${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`,"mc:Ignorable":`x14ac`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r||[],this.map={sheetPr:new Sc,dimension:new fc,sheetViews:new ds({tag:`sheetViews`,count:!1,childXform:new Tc}),sheetFormatPr:new Cc,cols:new ds({tag:`cols`,count:!1,childXform:new dc}),sheetData:new ds({tag:`sheetData`,count:!1,empty:!0,childXform:new uc({maxItems:n}),maxItems:t}),autoFilter:new Rc,mergeCells:new ds({tag:`mergeCells`,count:!0,childXform:new mc}),rowBreaks:new Uc,hyperlinks:new ds({tag:`hyperlinks`,count:!1,childXform:new pc}),pageMargins:new kc,dataValidations:new vc,pageSetup:new Fc,headerFooter:new Wc,printOptions:new Lc,picture:new zc,drawing:new Bc,sheetProtection:new Oc,tableParts:new ds({tag:`tableParts`,count:!0,childXform:new Vc}),conditionalFormatting:new ol,extLst:new Dl}}prepare(e,t){t.merges=new oc,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],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 n=e.rels=[];function r(e){return`rId${e.length+1}`}if(e.hyperlinks.forEach(e=>{let t=r(n);e.rId=t,n.push({Id:t,Type:ac.Hyperlink,Target:e.target,TargetMode:`External`})}),e.comments.length>0){let i={Id:r(n),Type:ac.Comments,Target:`../comments${e.id}.xml`};n.push(i);let a={Id:r(n),Type:ac.VmlDrawing,Target:`../drawings/vmlDrawing${e.id}.vml`};n.push(a),e.comments.forEach(e=>{e.refAddress=m.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${e.id}`,vmlDrawing:`vmlDrawing${e.id}`})}let i=[],a;e.media.forEach(o=>{if(o.type===`background`){let i=r(n);a=t.media[o.imageId],n.push({Id:i,Type:ac.Image,Target:`../media/${a.name}.${a.extension}`}),e.background={rId:i},e.image=t.media[o.imageId]}else if(o.type===`image`){let{drawing:s}=e;a=t.media[o.imageId],s||(s=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(s),n.push({Id:s.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:`../drawings/${s.name}.xml`}));let c=this.preImageId===o.imageId?i[o.imageId]:i[s.rels.length];c||(c=r(s.rels),i[s.rels.length]=c,s.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:`../media/${a.name}.${a.extension}`}));let l={picture:{rId:c},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){let e=r(s.rels);i[s.rels.length]=e,l.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:e},s.rels.push({Id:e,Type:ac.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=o.imageId,s.anchors.push(l)}}),e.tables.forEach(e=>{let i=r(n);e.rId=i,n.push({Id:i,Type:ac.Table,Target:`../tables/${e.target}`}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables||[]).length&&n.push({Id:r(n),Type:ac.PivotTable,Target:`../pivotTables/pivotTable1.xml`}),this.map.extLst.prepare(e,t)}render(t,n){t.openXml(ts.StdDocAttributes),t.openNode(`worksheet`,e.WORKSHEET_ATTRIBUTES);let r=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow}:void 0;n.properties&&n.properties.defaultColWidth&&(r.defaultColWidth=n.properties.defaultColWidth);let i={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},a=n.pageSetup&&n.pageSetup.margins,o={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},s=n.sheetProtection;this.map.sheetPr.render(t,i),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,r),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,s),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,o),this.map.pageMargins.render(t,a),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),n.rels&&n.rels.forEach(e=>{e.Type===ac.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),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=kl(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},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===ac.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===ac.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&&e.rows.filter(Boolean)||[],e.rows.forEach(e=>{e.cells=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];t.drawings[n].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]}),delete e.relationships,delete e.hyperlinks,delete e.comments}},jl=class extends ${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]}}}},Ml=class extends ${constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new ms({tag:`xdr:col`,zero:!0}),"xdr:colOff":new ms({tag:`xdr:colOff`,zero:!0}),"xdr:row":new ms({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new ms({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}}},Nl=class extends ${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}}},Pl=class extends ${constructor(){super(),this.map={"a:blip":new Nl}}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}}},Fl=class extends ${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}},Il=class extends ${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}}},Ll=class extends ${constructor(){super(),this.map={"a:hlinkClick":new Fl,"a:extLst":new Il}}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}}},Rl=class extends ${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}}},zl=class extends ${constructor(){super(),this.map={"xdr:cNvPr":new Ll,"xdr:cNvPicPr":new Rl}}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 Bl={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 Vl=class extends ${constructor(){super(),this.map={"xdr:nvPicPr":new zl,"xdr:blipFill":new Pl,"xdr:spPr":new us(Bl)}}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}}},Hl=class extends jl{constructor(){super(),this.map={"xdr:from":new Ml({tag:`xdr:from`}),"xdr:to":new Ml({tag:`xdr:to`}),"xdr:pic":new Vl,"xdr:clientData":new us({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}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:to`].render(e,t.range.br),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.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 Ul=9525;var Wl=class extends ${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*Ul),r=Math.floor(t.height*Ul);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)/Ul,height:parseInt(e.attributes.cy||`0`,10)/Ul},!0):!1}parseText(e){}parseClose(e){return!1}},Gl=class extends jl{constructor(){super(),this.map={"xdr:from":new Ml({tag:`xdr:from`}),"xdr:ext":new Wl({tag:`xdr:ext`}),"xdr:pic":new Vl,"xdr:clientData":new us({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 Kl(e){return(typeof e.range==`string`?m.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var ql=class e extends ${constructor(){super(),this.map={"xdr:twoCellAnchor":new Hl,"xdr:oneCellAnchor":new Gl},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Kl(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(ts.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`}}},Jl=class extends ${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}},Yl=class extends ${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}},Xl=class extends ${constructor(){super(),this.map={customFilters:new ds({tag:`customFilters`,count:!1,empty:!0,childXform:new Jl}),filters:new ds({tag:`filters`,count:!1,empty:!0,childXform:new Yl})},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;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}}},Zl=class extends ${constructor(){super(),this.map={filterColumn:new Xl},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}`)}}},Ql=class extends ${constructor(){super(),this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}render(e,t){e.leafNode(this.tag,{id:t.id.toString(),name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId})}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!1}parseText(){}parseClose(){return!1}},$l=class extends ${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}},eu=class e extends ${constructor(){super(),this.map={autoFilter:new Zl,tableColumns:new ds({tag:`tableColumns`,count:!0,empty:!0,childXform:new Ql}),tableStyleInfo:new $l},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(ts.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,totalsRowShown:n.totalsRow?void 0:`1`,headerRowCount:n.headerRow?`1`:`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===`1`};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`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr xr3`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,"xmlns:xr3":`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`}}},tu=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotCacheRecords`}render(t,n){let{sourceSheet:r,cacheFields:i}=n,a=r.getSheetValues().slice(2);t.openXml(ts.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(o()),t.closeNode();function o(){return a.map(e=>[...s(e.slice(1))].join(``)).join(``)}function*s(e){yield`
29
+ `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=i&&e<=55295||e===n||e===r||e===t||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e===i||e===n||e===r||e===t}e.isS=o;function s(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=s;function c(e){return s(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=c})),ts=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CHAR=`-퟿-�𐀀-􏿿`,e.RESTRICTED_CHAR=`-\b\v\f--„†-Ÿ`,e.S=` \r
30
+ `,e.NAME_START_CHAR=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NAME_CHAR=`-`+e.NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.CHAR_RE=RegExp(`^[`+e.CHAR+`]$`,`u`),e.RESTRICTED_CHAR_RE=RegExp(`^[`+e.RESTRICTED_CHAR+`]$`,`u`),e.S_RE=RegExp(`^[`+e.S+`]+$`,`u`),e.NAME_START_CHAR_RE=RegExp(`^[`+e.NAME_START_CHAR+`]$`,`u`),e.NAME_CHAR_RE=RegExp(`^[`+e.NAME_CHAR+`]$`,`u`),e.NAME_RE=RegExp(`^[`+e.NAME_START_CHAR+`][`+e.NAME_CHAR+`]*$`,`u`),e.NMTOKEN_RE=RegExp(`^[`+e.NAME_CHAR+`]+$`,`u`);var t=9,n=10,r=13,i=32;e.S_LIST=[i,n,r,t];function a(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isChar=a;function o(e){return e>=1&&e<=8||e===11||e===12||e>=14&&e<=31||e>=127&&e<=132||e>=134&&e<=159}e.isRestrictedChar=o;function s(e){return e===9||e===10||e===13||e>31&&e<127||e===133||e>159&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111}e.isCharAndNotRestricted=s;function c(e){return e===i||e===n||e===r||e===t}e.isS=c;function l(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}e.isNameStartChar=l;function u(e){return l(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNameChar=u})),ns=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NC_NAME_START_CHAR=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-῿‌-‍⁰-↏Ⰰ-⿯、-퟿豈-﷏ﷰ-�𐀀-󯿿`,e.NC_NAME_CHAR=`-`+e.NC_NAME_START_CHAR+`.0-9·̀-ͯ‿-⁀`,e.NC_NAME_START_CHAR_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`]$`,`u`),e.NC_NAME_CHAR_RE=RegExp(`^[`+e.NC_NAME_CHAR+`]$`,`u`),e.NC_NAME_RE=RegExp(`^[`+e.NC_NAME_START_CHAR+`][`+e.NC_NAME_CHAR+`]*$`,`u`);function t(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||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}e.isNCNameStartChar=t;function n(e){return t(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256}e.isNCNameChar=n})),rs=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.SaxesParser=e.EVENTS=void 0;let t=es(),n=ts(),r=ns();var i=t.isS,a=t.isChar,o=t.isNameStartChar,s=t.isNameChar,c=t.S_LIST,l=t.NAME_RE,u=n.isChar,d=r.isNCNameStartChar,f=r.isNCNameChar,p=r.NC_NAME_RE;let m=`http://www.w3.org/XML/1998/namespace`,h=`http://www.w3.org/2000/xmlns/`,g={__proto__:null,xml:m,xmlns:h},_={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},v=8232,y=e=>e===34||e===39,b=[34,39],x=[...b,91,62],S=[...b,60,93],C=[61,63,...c],w=[...c,62,38,60];function T(e,t,n){switch(t){case`xml`:n!==m&&e.fail(`xml prefix must be bound to ${m}.`);break;case`xmlns`:n!==h&&e.fail(`xmlns prefix must be bound to ${h}.`);break;default:}switch(n){case h:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI \
31
+ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}break;default:}}function E(e,t){for(let n of Object.keys(t))T(e,n,t[n])}let D=e=>p.test(e),O=e=>l.test(e);e.EVENTS=[`xmldecl`,`text`,`processinginstruction`,`doctype`,`comment`,`opentagstart`,`attribute`,`opentag`,`closetag`,`cdata`,`error`,`end`,`ready`];let k={xmldecl:`xmldeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`};e.SaxesParser=class{constructor(e){this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=this.opt.position!==!1,this.fileName=this.opt.fileName,t){this.nameStartCheck=d,this.nameCheck=f,this.isName=D,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns=Object.assign({__proto__:null},g);let e=this.opt.additionalNamespaces;e!=null&&(E(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=o,this.nameCheck=s,this.isName=O,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}get closed(){return this._closed}_init(){var e;this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];let{fragmentOpt:t}=this;this.state=t?13:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=t,this.xmlDeclPossible=!t,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:n}=this.opt;if(n===void 0){if(this.opt.forceXMLVersion===!0)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);n=`1.0`}this.setXMLVersion(n),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(_),(e=this.readyHandler)==null||e.call(this)}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[k[e]]=t}off(e){this[k[e]]=void 0}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),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close; assign an onready handler.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===13||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){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(this.column++,n<55296){if(n>=32||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:return e.charCodeAt(t+1)===10&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){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(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==v||n===9)return n;switch(n){case 10:return this.line++,this.column=0,this.positionAtNewLine=this.position,10;case 13:{let n=e.charCodeAt(t+1);(n===10||n===133)&&(this.i=t+2)}case 133:case v:return this.line++,this.column=0,this.positionAtNewLine=this.position,-2;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+(n-55296)*1024+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===-2?10:e}unget(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===-2,a=i?10:r;if(a===-1||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case-2:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=10;break;case-1:return this.text+=n.slice(t),!1;default:}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===-1)return this.name+=e.slice(t),-1;if(!s(n))return this.name+=e.slice(t,this.prevI),n===-2?10:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===-1||!i(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=a,this.getCode=this.getCode10):(this.isChar=u,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case 60:if(this.state=15,this.text.length!==0)throw Error(`no-empty text at start`);break;case-1:break;default:this.unget(),this.state=13,this.xmlDeclPossible=!1}}sDoctype(){var e;let t=this.captureTo(x);switch(t){case 62:(e=this.doctypeHandler)==null||e.call(this,this.text),this.text=``,this.state=13,this.doctype=!0;break;case-1:break;default:this.text+=String.fromCodePoint(t),t===91?this.state=4:y(t)&&(this.state=3,this.q=t)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){let e=this.captureTo(S);e!==-1&&(this.text+=String.fromCodePoint(e),e===93?this.state=2:e===60?this.state=6:y(e)&&(this.state=5,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang=``;break;case 63:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?8:4,this.openWakaBang=``)}sDTDComment(){this.captureToChar(45)&&(this.text+=`-`,this.state=9)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===45?10:8}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62?this.state=4:(this.fail(`malformed comment.`),this.state=8)}sDTDPI(){this.captureToChar(63)&&(this.text+=`?`,this.state=12)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===62&&(this.state=4)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;loop:for(;;)switch(this.getCode()){case-2:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI);this.state=n;let i;r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),(n!==13||this.textHandler!==void 0)&&(this.text+=i);break loop}case-1:this.entity+=t.slice(e);break loop;default:}}sOpenWaka(){let e=this.getCode();if(o(e))this.state=34,this.unget(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case 63:this.state=23;break;default:this.fail(`disallowed character in tag name`),this.state=13,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:!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),this.state=20,this.openWakaBang=``;break;case`--`:this.state=17,this.openWakaBang=``;break;case`DOCTYPE`:this.state=2,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){var e;let t=this.getCodeNorm();t===45?(this.state=19,(e=this.commentHandler)==null||e.call(this,this.text),this.text=``):(this.text+=`-${String.fromCodePoint(t)}`,this.state=17)}sCommentEnded(){let e=this.getCodeNorm();e===62?this.state=13:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=17)}sCData(){this.captureToChar(93)&&(this.state=21)}sCDataEnding(){let e=this.getCodeNorm();e===93?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){var e;let t=this.getCodeNorm();switch(t){case 62:(e=this.cdataHandler)==null||e.call(this,this.text),this.text=``,this.state=13;break;case 93:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(t)}`,this.state=20}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===63||i(e)?(this.fail(`processing instruction without a target.`),this.state=e===63?26:25):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===-1){this.piTarget+=e.slice(t);return}if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===63;r||i(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?33:27):this.state=r?26:25:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===63?this.state=26:i(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(63)&&(this.state=26)}sPIEnding(){var e;let t=this.getCodeNorm();if(t===62){let{piTarget:t}=this;t.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),(e=this.piHandler)==null||e.call(this,{target:t,body:this.text}),this.piTarget=this.text=``,this.state=13}else t===63?this.text+=`?`:(this.text+=`?${String.fromCodePoint(t)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();if(e===63){this.state=33;return}e!==-1&&(this.state=28,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(C);if(e===63){this.state=33,this.name+=this.text,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(i(e)||e===61){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===61?30:29}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(e!==61&&this.fail(`value required.`),this.state=30)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===63){this.state=33,this.fail(`XML declaration is incomplete.`);return}i(e)||(y(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=32),this.state=31)}sXMLDeclValue(){let e=this.captureTo([this.q,63]);if(e===63){this.state=33,this.text=``,this.fail(`XML declaration is incomplete.`);return}if(e===-1)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t;break;default:}this.name=``,this.state=32}sXMLDeclSeparator(){let e=this.getCodeNorm();if(e===63){this.state=33;return}i(e)||(this.fail(`whitespace required.`),this.unget()),this.state=27}sXMLDeclEnding(){var e;this.getCodeNorm()===62?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),(e=this.xmldeclHandler)==null||e.call(this,this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=13):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){var e;let t=this.captureNameChars();if(t===-1)return;let n=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=n.ns=Object.create(null)),(e=this.openTagStartHandler)==null||e.call(this,n),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),t){case 62:this.openTag();break;case 47:this.state=35;break;default:i(t)||this.fail(`disallowed character in tag name.`),this.state=36}}sOpenTagSlash(){this.getCode()===62?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=36)}sAttrib(){let e=this.skipSpaces();e!==-1&&(o(e)?(this.unget(),this.state=37):e===62?this.openTag():e===47?this.state=35:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===61?this.state=39:i(e)?this.state=38:e===62?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==-1&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case-1:return;case 61:this.state=39;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===62?this.openTag():o(e)?(this.unget(),this.state=37):(this.fail(`disallowed character in attribute name.`),this.state=36)}}sAttribValue(){let e=this.getCodeNorm();y(e)?(this.q=e,this.state=40):i(e)||(this.fail(`unquoted attribute value.`),this.state=42,this.unget())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=41;return;case 38:this.text+=t.slice(n,this.prevI),this.state=14,this.entityReturnState=40;return;case 10:case-2:case 9:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case 60:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case-1:this.text+=t.slice(n);return;default:}}sAttribValueClosed(){let e=this.getCodeNorm();i(e)?this.state=36:e===62?this.openTag():e===47?this.state=35:o(e)?(this.fail(`no whitespace between attributes.`),this.unget(),this.state=37):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(w);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case 60:this.fail(`disallowed character.`);break;case-1:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===62?this.openTag():this.state=36}}sCloseTag(){let e=this.captureNameChars();e===62?this.closeTag():i(e)?this.state=44:e!==-1&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case 62:this.closeTag();break;case-1:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;scanLoop:for(;;)switch(this.getCode()){case 60:if(this.state=15,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=0;break scanLoop;case 38:this.state=14,this.entityReturnState=13,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=0;break scanLoop;case 93:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw Error(`impossible state`)}break;case 62:t===2&&this.fail(`the string "]]>" is disallowed in char data.`),t=0;break;case-2:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case-1:r!==void 0&&(this.text+=n.slice(e));break scanLoop;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;outRootLoop:for(;;){let a=this.getCode();switch(a){case 60:if(this.state=15,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break outRootLoop;case 38:this.state=14,this.entityReturnState=13,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break outRootLoop;case-2:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case-1:n!==void 0&&(this.text+=t.slice(e));break outRootLoop;default:i(a)||(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))}pushAttribNS(e,t){var n;let{prefix:r,local:i}=this.qname(e),a={name:e,prefix:r,local:i,value:t};if(this.attribList.push(a),(n=this.attributeHandler)==null||n.call(this,a),r===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[i]=e,T(this,i,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,T(this,``,e)}}pushAttribPlain(e,t){var n;let r={name:e,value:t};this.attribList.push(r),(n=this.attributeHandler)==null||n.call(this,r)}end(){var e,t;this.sawRoot||this.fail(`document must contain a root element.`);let{tags:n}=this;for(;n.length>0;){let e=n.pop();this.fail(`unclosed tag: ${e.name}`)}this.state!==0&&this.state!==13&&this.fail(`unexpected end.`);let{text:r}=this;return r.length!==0&&((e=this.textHandler)==null||e.call(this,r),this.text=``),this._closed=!0,(t=this.endHandler)==null||t.call(this),this._init(),this}resolve(e){var t;let n=this.topNS[e];if(n!==void 0)return n;let{tags:r}=this;for(let t=r.length-1;t>=0;t--)if(n=r[t].ns[e],n!==void 0)return n;return n=this.ns[e],n===void 0?(t=this.opt).resolvePrefix?.call(t,e):n}qname(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qname(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?h:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){var e;this.processAttribs();let{tags:t}=this,n=this.tag;n.isSelfClosing=!1,(e=this.openTagHandler)==null||e.call(this,n),t.push(n),this.state=13,this.name=``}openSelfClosingTag(){var e,t;this.processAttribs();let{tags:n}=this,r=this.tag;r.isSelfClosing=!0,(e=this.openTagHandler)==null||e.call(this,r),(t=this.closeTagHandler)==null||t.call(this,r),(this.tag=n[n.length-1]??null)===null&&(this.closedRoot=!0),this.state=13,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=13,this.name=``,t===``){this.fail(`weird empty close tag.`),this.text+=`</>`;return}let n=this.closeTagHandler,r=e.length;for(;r-- >0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}}}))();async function*is(e){let t=new rs.SaxesParser({xmlns:!1,defaultXMLVersion:`1.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){if(t.write(ua(i)),n)throw n;yield r,r=[]}}var $=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=null,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){for await(let t of e)for(let{eventType:e,value:n}of t)if(e===`opentag`)this.parseOpen(n);else if(e===`text`)this.parseText(n);else if(e===`closetag`&&!this.parseClose(n.name))return this.model;return this.model}async parseStream(e){return this.parse(is(e))}get xml(){return this.toXml(this.model)}toXml(e){let t=new $o;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 as(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{as(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var os=class extends ${constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new $o;as(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}}},ss=class extends ${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&&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){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:return this.model=[],!0;default:return 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)})}}},cs=class extends ${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}},ls=class extends ${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}},us=class extends ${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}},ds=class extends ${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}},fs=class e extends ${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}},ps=class e extends ${constructor(t){super(),this.options=t||e.OPTIONS,this.map={b:{prop:`bold`,xform:new ls({tag:`b`,attr:`val`})},i:{prop:`italic`,xform:new ls({tag:`i`,attr:`val`})},u:{prop:`underline`,xform:new fs},charset:{prop:`charset`,xform:new us({tag:`charset`,attr:`val`})},color:{prop:`color`,xform:new cs},condense:{prop:`condense`,xform:new ls({tag:`condense`,attr:`val`})},extend:{prop:`extend`,xform:new ls({tag:`extend`,attr:`val`})},family:{prop:`family`,xform:new us({tag:`family`,attr:`val`})},outline:{prop:`outline`,xform:new ls({tag:`outline`,attr:`val`})},vertAlign:{prop:`vertAlign`,xform:new ds({tag:`vertAlign`,attr:`val`})},scheme:{prop:`scheme`,xform:new ds({tag:`scheme`,attr:`val`})},shadow:{prop:`shadow`,xform:new ls({tag:`shadow`,attr:`val`})},strike:{prop:`strike`,xform:new ls({tag:`strike`,attr:`val`})},sz:{prop:`size`,xform:new us({tag:`sz`,attr:`val`})}},this.map[this.options.fontNameTag]={prop:`name`,xform:new ds({tag:this.options.fontNameTag,attr:`val`})}}get tag(){return this.options.tagName}render(e,t){let{map:n}=this;e.openNode(this.options.tagName),Object.entries(this.map).forEach(([r,i])=>{n[r].xform.render(e,t[i.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`}}},ms=class extends ${constructor(){super(),this.map={color:new cs}}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}},hs=class extends ${constructor(){super(),this.map={fgColor:new cs(`fgColor`),bgColor:new cs(`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}},gs=class extends ${constructor(){super(),this.map={stop:new ms}}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}},_s=class e extends ${constructor(){super(),this.map={patternFill:new hs,gradientFill:new gs}}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=ms}static{this.PatternFillXform=hs}static{this.GradientFillXform=gs}},vs=class e extends ${constructor(e){super(),this.name=e,this.map={color:new cs}}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),{})}},ys=class extends ${constructor(){super(),this.map={top:new vs(`top`),left:new vs(`left`),bottom:new vs(`bottom`),right:new vs(`right`),diagonal:new vs(`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=aa(e.attributes.diagonalUp),this.diagonalDown=aa(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 bs={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 xs(){let e={};return Object.entries(bs).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let Ss=xs();var Cs=class extends ${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 Ss[e]}static getDefaultFmtCode(e){return bs[e]&&bs[e].f}};let ws={ReadingOrder:{LeftToRight:1,RightToLeft:2}},Ts={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=na(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=na(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return ws.ReadingOrder.LeftToRight;case`rtl`:return ws.ReadingOrder.RightToLeft;default:return}}},Es={toXml(e){let t=Ts.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=na(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 Ds=class extends ${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`,Ts.horizontal(t.horizontal)),r(`vertical`,Ts.vertical(t.vertical)),r(`wrapText`,Ts.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,Ts.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,Ts.indent(t.indent)),r(`textRotation`,Es.toXml(t.textRotation)),r(`readingOrder`,Ts.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`,aa(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,aa(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,Es.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 Os={boolean(e,t){return e===void 0?t:e}};var ks=class extends ${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`,Os.boolean(t.locked,!0)?void 0:`0`),r(`hidden`,Os.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}},As=class extends ${constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new Ds,protection:new ks}}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.numFmtId&&e.addAttribute(`applyNumberFormat`,`1`),t.fontId&&e.addAttribute(`applyFont`,`1`),t.fillId&&e.addAttribute(`applyFill`,`1`),t.borderId&&e.addAttribute(`applyBorder`,`1`),t.alignment&&e.addAttribute(`applyAlignment`,`1`),t.protection&&e.addAttribute(`applyProtection`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),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`xf`:return 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)),!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`}},js=class extends ${constructor(){super(),this.map={alignment:new Ds,border:new ys,fill:new _s,font:new ps,numFmt:new Cs,protection:new ks}}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}},Ms=class e extends ${constructor(t){super(),this.map={numFmts:new ss({tag:`numFmts`,count:!0,childXform:new Cs}),fonts:new ss({tag:`fonts`,count:!0,childXform:new ps,$:{"x14ac:knownFonts":1}}),fills:new ss({tag:`fills`,count:!0,childXform:new _s}),borders:new ss({tag:`borders`,count:!0,childXform:new ys}),cellStyleXfs:new ss({tag:`cellStyleXfs`,count:!0,childXform:new As}),cellXfs:new ss({tag:`cellXfs`,count:!0,childXform:new As({xfId:!0})}),dxfs:new ss({tag:`dxfs`,always:!0,count:!0,childXform:new js}),numFmt:new Cs,font:new ps,fill:new _s,border:new ys,style:new As({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}render(t,n){let r=n||this.model;t.openXml($o.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({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.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;if(this.model.fonts.length||this._addFont({size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let n={},r=t||S.ValueType.Number;if(e.numFmt)n.numFmtId=this._addNumFmtStr(e.numFmt);else switch(r){case S.ValueType.Number:n.numFmtId=this._addNumFmtStr(`General`);break;case S.ValueType.Date:n.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(n.fontId=this._addFont(e.font)),e.border&&(n.borderId=this._addBorder(e.border)),e.fill&&(n.fillId=this._addFill(e.fill)),e.alignment&&(n.alignment=e.alignment),e.protection&&(n.protection=e.protection);let i=this._addStyle(n);return 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]||Cs.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}return 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),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]}_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=Cs.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 os({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new os({tag:`dxfs`,$:{count:0}}),tableStyles:new os({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new os({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`}}]}]})}}};Ms.Mock=class extends Ms{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 S.ValueType.Date:return this.dateStyleId;default:return 0}}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:Cs.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var Ns=class extends ${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}},Ps=class e extends ${constructor(){super(),this.map={"dc:creator":new ds({tag:`dc:creator`}),"dc:title":new ds({tag:`dc:title`}),"dc:subject":new ds({tag:`dc:subject`}),"dc:description":new ds({tag:`dc:description`}),"dc:identifier":new ds({tag:`dc:identifier`}),"dc:language":new ds({tag:`dc:language`}),"cp:keywords":new ds({tag:`cp:keywords`}),"cp:category":new ds({tag:`cp:category`}),"cp:lastModifiedBy":new ds({tag:`cp:lastModifiedBy`}),"cp:lastPrinted":new Ns({tag:`cp:lastPrinted`,format:e.DateFormat}),"cp:revision":new us({tag:`cp:revision`}),"cp:version":new ds({tag:`cp:version`}),"cp:contentStatus":new ds({tag:`cp:contentStatus`}),"cp:contentType":new ds({tag:`cp:contentType`}),"dcterms:created":new Ns({tag:`dcterms:created`,attrs:e.DateAttrs,format:e.DateFormat}),"dcterms:modified":new Ns({tag:`dcterms:modified`,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml($o.StdDocAttributes),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES),this.map[`dc:creator`].render(t,n.creator),this.map[`dc:title`].render(t,n.title),this.map[`dc:subject`].render(t,n.subject),this.map[`dc:description`].render(t,n.description),this.map[`dc:identifier`].render(t,n.identifier),this.map[`dc:language`].render(t,n.language),this.map[`cp:keywords`].render(t,n.keywords),this.map[`cp:category`].render(t,n.category),this.map[`cp:lastModifiedBy`].render(t,n.lastModifiedBy),this.map[`cp:lastPrinted`].render(t,n.lastPrinted),this.map[`cp:revision`].render(t,n.revision),this.map[`cp:version`].render(t,n.version),this.map[`cp:contentStatus`].render(t,n.contentStatus),this.map[`cp:contentType`].render(t,n.contentType),this.map[`dcterms:created`].render(t,n.created),this.map[`dcterms:modified`].render(t,n.modified),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`cp:coreProperties`:case`coreProperties`:return!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.parser=void 0),!0;switch(e){case`cp:coreProperties`:case`coreProperties`:return this.model={creator:this.map[`dc:creator`].model,title:this.map[`dc:title`].model,subject:this.map[`dc:subject`].model,description:this.map[`dc:description`].model,identifier:this.map[`dc:identifier`].model,language:this.map[`dc:language`].model,keywords:this.map[`cp:keywords`].model,category:this.map[`cp:category`].model,lastModifiedBy:this.map[`cp:lastModifiedBy`].model,lastPrinted:this.map[`cp:lastPrinted`].model,revision:this.map[`cp:revision`].model,contentStatus:this.map[`cp:contentStatus`].model,contentType:this.map[`cp:contentType`].model,created:this.map[`dcterms:created`].model,modified:this.map[`dcterms:modified`].model},!1;default:throw Error(`Unexpected xml node in parseClose: ${e}`)}}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`}}},Fs=class extends ${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){switch(e.name){case`t`:return this._text=[],this.model=``,!0;default:return!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}},Is=class e extends ${constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new Fs}get fontXform(){return this._fontXform||=new ps(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`}}},Ls=class extends ${constructor(){super(),this.map={r:new Is,t:new Fs}}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}}},Rs=class extends ${constructor(e){super(),this.model=e,this.map={r:new Is,t:new Fs,rPh:new Ls}}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){let{name:t}=e;return this.parser?(this.parser.parseOpen(e),!0):t===this.tag?(this.model={},!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=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},zs=class extends ${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 Rs}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($o.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}`)}}},Bs=class extends ${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}},Vs=class e extends ${constructor(){super(),this.map={Relationship:new Bs}}render(t,n){let r=n||this._values;t.openXml($o.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`}}},Hs=class e extends ${render(t,n){t.openXml($o.StdDocAttributes),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};(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:`/xl/workbook.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{let n=`/xl/worksheets/sheet${e.id}.xml`;t.leafNode(`Override`,{PartName:n,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables||[]).length&&(t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheDefinition1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotCache/pivotCacheRecords1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`}),t.leafNode(`Override`,{PartName:`/xl/pivotTables/pivotTable1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})),t.leafNode(`Override`,{PartName:`/xl/theme/theme1.xml`,ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:`/xl/styles.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:`/xl/sharedStrings.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/tables/${e.target}`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:`/xl/drawings/${e.name}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})}),n.commentRefs&&(t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:`/xl/${e}.xml`,ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})})),t.leafNode(`Override`,{PartName:`/docProps/core.xml`,ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:`/docProps/app.xml`,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`}}},Us=class extends ${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`}},Ws=class extends ${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`}},Gs=class e extends ${constructor(){super(),this.map={Company:new ds({tag:`Company`}),Manager:new ds({tag:`Manager`}),HeadingPairs:new Us,TitleOfParts:new Ws}}render(t,n){t.openXml($o.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.TitleOfParts.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.TitleOfParts.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`}}},Ks=class extends ${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:Js(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};function qs(e){try{return m.decodeEx(e),!0}catch{return!1}}function Js(e){let t=[],n=!1,r=``;return e.split(`,`).forEach(e=>{if(!e)return;let i=(e.match(/'/g)||[]).length;if(!i){n?r+=`${e},`:qs(e)&&t.push(e);return}let a=i%2==0;!n&&a&&qs(e)?t.push(e):n&&!a?(n=!1,qs(r+e)&&t.push(r+e),r=``):(n=!0,r+=`${e},`)}),t}var Ys=class extends ${render(e,t){e.leafNode(`sheet`,{sheetId:t.id,name:t.name,state:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:ta(e.attributes.name),id:parseInt(e.attributes.sheetId,10),state:e.attributes.state,rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},Xs=class extends ${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}},Zs=class extends ${render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,defaultThemeVersion:164011,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},Qs=class extends ${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}},$s=class extends ${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}},ec=class e extends ${constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new Zs,bookViews:new ss({tag:`bookViews`,count:!1,childXform:new Xs}),sheets:new ss({tag:`sheets`,count:!1,childXform:new Ys}),definedNames:new ss({tag:`definedNames`,count:!1,childXform:new Ks}),calcPr:new Qs,pivotCaches:new ss({tag:`pivotCaches`,count:!1,childXform:new $s})}}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={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${i[0]}:$${i[1]}`],localSheetId:n};t.push(a)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`);r.push(`'${e.name}'!$${t[0]}:$${t[1]}`)}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($o.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),this.map.pivotCaches.render(t,n.pivotTables),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),!1;default:return!0}}reconcile(e){let t=(e.workbookRels||[]).reduce((e,t)=>(e[t.Id]=t,e),{}),n=[],r,i=0;(e.sheets||[]).forEach(a=>{let o=t[a.rId];o&&(r=e.worksheetHash[`xl/${o.Target.replace(/^(\s|\/xl\/)+/,``)}`],r&&(r.name=a.name,r.id=a.id,r.state=a.state,n[i++]=r))});let a=[];e.definedNames&&e.definedNames.forEach(e=>{if(e.name===`_xlnm.Print_Area`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=m.decodeEx(e.ranges[0]);r.pageSetup.printArea=r.pageSetup.printArea?`${r.pageSetup.printArea}&&${t.dimensions}`:t.dimensions}}else if(e.name===`_xlnm.Print_Titles`){if(r=n[e.localSheetId],r){r.pageSetup||={};let t=e.ranges.join(`,`),n=/\$/g,i=t.match(/\$\d+:\$\d+/);if(i&&i.length){let e=i[0];r.pageSetup.printTitlesRow=e.replace(n,``)}let a=t.match(/\$[A-Z]+:\$[A-Z]+/);if(a&&a.length){let e=a[0];r.pageSetup.printTitlesColumn=e.replace(n,``)}}}else a.push(e)}),e.definedNames=a,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 os({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let tc={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`};var nc=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 h(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let n=m.decode(e);for(let e=n.top;e<=n.bottom;e++){let r=t[e-1];for(let t=n.left;t<=n.right;t++){let i=r.cells[t-1];i?i.type===S.ValueType.Merge&&(i.master=n.tl):r.cells[t]={type:S.ValueType.Null,address:m.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}};function rc(e){if(e==null)return S.ValueType.Null;if(e instanceof String||typeof e==`string`)return S.ValueType.String;if(typeof e==`number`)return S.ValueType.Number;if(typeof e==`boolean`)return S.ValueType.Boolean;if(e instanceof Date)return S.ValueType.Date;if(e.text&&e.hyperlink)return S.ValueType.Hyperlink;if(e.formula)return S.ValueType.Formula;if(e.error)return S.ValueType.Error;throw Error(`I could not understand type of value`)}function ic(e){switch(e.type){case S.ValueType.Formula:return rc(e.result);default:return e.type}}var ac=class extends ${constructor(){super(),this.richTextXform=new Is}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},ic(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case S.ValueType.String:case S.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case S.ValueType.Date:t.date1904&&(e.date1904=!0);break;case S.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 S.ValueType.Merge:t.merges.add(e);break;case S.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 h(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(rc(t.result)){case S.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case S.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case S.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case S.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case S.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case S.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,Zi(t.result,t.date1904));break;default:throw Error(`I could not understand type of value`)}}render(e,t){if(!(t.type===S.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case S.ValueType.Null:break;case S.ValueType.Number:e.leafNode(`v`,null,t.value);break;case S.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case S.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case S.ValueType.String:case S.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 S.ValueType.Date:e.leafNode(`v`,null,Zi(t.value,t.date1904));break;case S.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 S.ValueType.Formula:this.renderFormula(e,t);break;case S.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=S.ValueType.Formula,e.value&&=(this.t===`str`?e.result=ta(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=S.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=S.ValueType.String,e.value=ta(e.value);break;case`inlineStr`:e.type=S.ValueType.String;break;case`b`:e.type=S.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=S.ValueType.Error,e.value={error:e.value};break;default:e.type=S.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=S.ValueType.Null:e.type=S.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&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case S.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=S.ValueType.RichText);break;case S.ValueType.Number:n&&ra(n.numFmt)&&(e.type=S.ValueType.Date,e.value=Qi(e.value,t.date1904));break;case S.ValueType.Formula:e.result!==void 0&&n&&ra(n.numFmt)&&(e.result=Qi(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===S.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=S.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},oc=class extends ${constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new ac}}get tag(){return`row`}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&&(e.addAttribute(`ht`,t.height),e.addAttribute(`customHeight`,`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`)),e.addAttribute(`x14ac:dyDescent`,`0.25`),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;let t=e.attributes.spans?e.attributes.spans.split(`:`).map(e=>parseInt(e,10)):[void 0,void 0],n=this.model={number:parseInt(e.attributes.r,10),min:t[0],max:t[1],cells:[]};return e.attributes.s&&(n.styleId=parseInt(e.attributes.s,10)),aa(e.attributes.hidden)&&(n.hidden=!0),aa(e.attributes.bestFit)&&(n.bestFit=!0),e.attributes.ht&&(n.height=parseFloat(e.attributes.ht)),e.attributes.outlineLevel&&(n.outlineLevel=parseInt(e.attributes.outlineLevel,10)),aa(e.attributes.collapsed)&&(n.collapsed=!0),!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)){if(this.model.cells.push(this.parser.model),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?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)})}},sc=class extends ${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)),aa(e.attributes.hidden)&&(t.hidden=!0),aa(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),aa(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId&&(e.style=t.styles.getStyleModel(e.styleId))}},cc=class extends ${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}},lc=class extends ${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))}},uc=class extends ${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 dc(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function fc(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=aa(i)}function pc(e){if(!e)return[];let t=[],n={};for(let[r,i]of Object.entries(e))if(i!=null)if(r.startsWith(`range:`)){let e=r.slice(6),{sqref:n,...a}=i;t.push({...a,sqref:e})}else n[r]=i;if(Object.keys(n).length===0)return t;let r=Object.entries(n).map(([e,t])=>({address:e,dataValidation:t,marked:!1})).sort((e,t)=>e.address.localeCompare(t.address)),i=Object.fromEntries(r.map(e=>[e.address,e])),a=(e,t,r)=>{for(let i=0;i<t;i++){let t=m.encodeAddress(e.row+i,r);if(!n[t]||!T(n[e.address],n[t]))return!1}return!0},o=r.map(e=>{if(!e.marked){let t=m.decodeEx(e.address);if(t.dimensions)return i[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let r=1,o=m.encodeAddress(t.row+r,t.col);for(;n[o]&&T(e.dataValidation,n[o]);)r++,o=m.encodeAddress(t.row+r,t.col);let s=1;for(;a(t,r,t.col+s);)s++;for(let e=0;e<r;e++)for(let n=0;n<s;n++)o=m.encodeAddress(t.row+e,t.col+n),i[o].marked=!0;if(r>1||s>1){let n=t.row+(r-1),i=t.col+(s-1);return{...e.dataValidation,sqref:`${e.address}:${m.encodeAddress(n,i)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...o]}var mc=class extends ${get tag(){return`dataValidations`}render(e,t){let n=pc(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(Zi(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&&fc(t,e.attributes,`allowBlank`),fc(t,e.attributes,`showInputMessage`),fc(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:dc(t,e.attributes,`operator`,`between`);break}return dc(t,e.attributes,`promptTitle`),dc(t,e.attributes,`prompt`),dc(t,e.attributes,`errorStyle`),dc(t,e.attributes,`errorTitle`),dc(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=>{if(e.includes(`:`)){let t=new h(e);(t.bottom-t.top+1)*(t.right-t.left+1)<=1e3?t.forEachAddress(e=>{this.model[e]=this._dataValidation}):this.model[`range:${e}`]=this._dataValidation}else 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=Qi(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},hc=class extends ${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 gc=e=>e!==void 0;var _c=class extends ${get tag(){return`outlinePr`}render(e,t){return t&&(gc(t.summaryBelow)||gc(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:gc(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:gc(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:gc(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:gc(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},vc=class extends ${constructor(){super(),this.map={tabColor:new cs(`tabColor`),pageSetUpPr:new hc,outlinePr:new _c}}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)}},yc=class extends ${get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow,outlineLevelCol:t.outlineLevelCol,"x14ac:dyDescent":t.dyDescent};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),(!t.defaultRowHeight||t.defaultRowHeight!==15)&&(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:parseFloat(e.attributes[`x14ac:dyDescent`]||`0`),outlineLevelRow:parseInt(e.attributes.outlineLevelRow||`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol||`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),!0):!1}parseText(){}parseClose(){return!1}};let bc={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var xc=class extends ${get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){e.openNode(`sheetView`,{workbookViewId:t.workbookViewId||0});let n=function(t,n,r){r&&e.addAttribute(t,n)};n(`rightToLeft`,`1`,t.rightToLeft===!0),n(`tabSelected`,`1`,t.tabSelected),n(`showRuler`,`0`,t.showRuler===!1),n(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),n(`showGridLines`,`0`,t.showGridLines===!1),n(`zoomScale`,t.zoomScale,t.zoomScale),n(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal),n(`view`,t.style,t.style);let r,i,a,o;switch(t.state){case`frozen`:i=t.xSplit||0,a=t.ySplit||0,r=t.topLeftCell||m.getAddress(a+1,i+1).address,o=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:r,activePane:o,state:`frozen`}),e.leafNode(`selection`,{pane:o,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,state:bc[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,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 Sc(e,t){return e?t:void 0}function Cc(e,t){return e===t?!0:void 0}var wc=class extends ${get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:Sc(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:Sc(t.formatCells,`0`),formatColumns:Sc(t.formatColumns,`0`),formatRows:Sc(t.formatRows,`0`),insertColumns:Sc(t.insertColumns,`0`),insertRows:Sc(t.insertRows,`0`),insertHyperlinks:Sc(t.insertHyperlinks,`0`),deleteColumns:Sc(t.deleteColumns,`0`),deleteRows:Sc(t.deleteRows,`0`),sort:Sc(t.sort,`0`),autoFilter:Sc(t.autoFilter,`0`),pivotTables:Sc(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=Sc(t.objects===!1,`1`),n.scenarios=Sc(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:Cc(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:Cc(e.attributes.formatCells,`0`),formatColumns:Cc(e.attributes.formatColumns,`0`),formatRows:Cc(e.attributes.formatRows,`0`),insertColumns:Cc(e.attributes.insertColumns,`0`),insertRows:Cc(e.attributes.insertRows,`0`),insertHyperlinks:Cc(e.attributes.insertHyperlinks,`0`),deleteColumns:Cc(e.attributes.deleteColumns,`0`),deleteRows:Cc(e.attributes.deleteRows,`0`),sort:Cc(e.attributes.sort,`0`),autoFilter:Cc(e.attributes.autoFilter,`0`),pivotTables:Cc(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}},Tc=class extends ${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 Ec(e){return e?`1`:void 0}function Dc(e){switch(e){case`overThenDown`:return e;default:return}}function Oc(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function kc(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function Ac(e){return e===void 0?void 0:parseInt(e,10)}var jc=class extends ${get tag(){return`pageSetup`}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:t.horizontalDpi,verticalDpi:t.verticalDpi,pageOrder:Dc(t.pageOrder),blackAndWhite:Ec(t.blackAndWhite),draft:Ec(t.draft),cellComments:Oc(t.cellComments),errors:kc(t.errors),scale:t.scale,fitToWidth:t.fitToWidth,fitToHeight:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:Ec(!!t.firstPageNumber),usePrinterDefaults:Ec(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:Ac(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 Mc(e){return e?`1`:void 0}var Nc=class extends ${get tag(){return`printOptions`}render(e,t){if(t){let n={headings:Mc(t.showRowColHeaders),gridLines:Mc(t.showGridLines),horizontalCentered:Mc(t.horizontalCentered),verticalCentered:Mc(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}},Pc=class extends ${get tag(){return`autoFilter`}render(e,t){if(t)if(typeof t==`string`)e.leafNode(`autoFilter`,{ref:t});else{let n=function(e){return typeof e==`string`?e:m.getAddress(e.row,e.column).address},r=n(t.from),i=n(t.to);r&&i&&e.leafNode(`autoFilter`,{ref:`${r}:${i}`})}}parseOpen(e){e.name===`autoFilter`&&(this.model=e.attributes.ref)}},Fc=class extends ${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}},Ic=class extends ${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}},Lc=class extends ${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}},Rc=class extends ${get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){return e.name===`brk`?(this.model=e.attributes.ref,!0):!1}parseText(){}parseClose(){return!1}},zc=class extends ss{constructor(){let e={tag:`rowBreaks`,count:!0,childXform:new Rc};super(e)}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),this.count&&(e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length));let{childXform:n}=this;t.forEach(t=>{n.render(e,t)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}},Bc=class extends ${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}}},Vc=class extends ${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``}},Hc=class extends ${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:$.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},Uc=class extends Vc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Hc,color:this.colorXform=new cs}}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}}},Wc=class extends ${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}},Gc=class extends Vc{constructor(){super(),this.map={"x14:id":this.idXform=new Wc}}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}},Kc=class extends Vc{constructor(){super(),this.map={ext:new Gc}}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)}},qc=class extends ${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}},Jc=class extends Vc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Hc,color:this.colorXform=new cs}}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)}},Yc=class extends Vc{constructor(){super(),this.map={cfvo:this.cfvoXform=new Hc}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:$.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:$.toBoolAttribute(t.reverse,!1),showValue:$.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:$.toStringValue(e.iconSet,`3TrafficLights`),reverse:$.toBoolValue(e.reverse),showValue:$.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let Xc={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},Zc=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new h(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}},Qc=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new h(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}},$c=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 el=class e extends Vc{constructor(){super(),this.map={dataBar:this.databarXform=new Uc,extLst:this.extLstRefXform=new Kc,formula:this.formulaXform=new qc,colorScale:this.colorScaleXform=new Jc,iconSet:this.iconSetXform=new Yc}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||Xc[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:$.toBoolAttribute(t.percent,!1),bottom:$.toBoolAttribute(t.bottom,!1),rank:$.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:$.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:$.toStringAttribute(t.operator,`containsText`)});let n=Zc(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=Qc(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...$c(e),dxfId:$.toIntValue(e.dxfId),priority:$.toIntValue(e.priority),timePeriod:e.timePeriod,percent:$.toBoolValue(e.percent),bottom:$.toBoolValue(e.bottom),rank:$.toIntValue(e.rank),aboveAverage:$.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}}},tl=class extends Vc{constructor(){super(),this.map={cfRule:new el}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(el.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{el.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)}},nl=class extends ${constructor(){super(),this.cfXform=new tl}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))})})}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)})})}};let rl=[];for(let e=0;e<256;++e)rl.push((e+256).toString(16).slice(1));function il(e,t=0){return(rl[e[t+0]]+rl[e[t+1]]+rl[e[t+2]]+rl[e[t+3]]+`-`+rl[e[t+4]]+rl[e[t+5]]+`-`+rl[e[t+6]]+rl[e[t+7]]+`-`+rl[e[t+8]]+rl[e[t+9]]+`-`+rl[e[t+10]]+rl[e[t+11]]+rl[e[t+12]]+rl[e[t+13]]+rl[e[t+14]]+rl[e[t+15]]).toLowerCase()}let al,ol=new Uint8Array(16);function sl(){if(!al){if(typeof crypto>`u`||!crypto.getRandomValues)throw Error(`crypto.getRandomValues() not supported. See https://github.com/uuidjs/uuid#getrandomvalues-not-supported`);al=crypto.getRandomValues.bind(crypto)}return al(ol)}var cl={randomUUID:typeof crypto<`u`&&crypto.randomUUID&&crypto.randomUUID.bind(crypto)};function ll(e,t,n){e||={};let r=e.random??e.rng?.()??sl();if(r.length<16)throw Error(`Random bytes length must be >= 16`);if(r[6]=r[6]&15|64,r[8]=r[8]&63|128,t){if(n||=0,n<0||n+16>t.length)throw RangeError(`UUID byte range ${n}:${n+15} is out of buffer bounds`);for(let e=0;e<16;++e)t[n+e]=r[e];return t}return il(r)}function ul(e,t,n){return cl.randomUUID&&!t&&!e?cl.randomUUID():ll(e,t,n)}var dl=ul,fl=class extends ${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}},pl=class extends Vc{constructor(){super(),this.map={"xm:f":this.fExtXform=new fl}}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}}},ml=class extends Vc{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new pl,"x14:borderColor":this.borderColorXform=new cs(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new cs(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new cs(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new cs(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:$.toIntAttribute(t.minLength,0,!0),maxLength:$.toIntAttribute(t.maxLength,100,!0),border:$.toBoolAttribute(t.border,!1),gradient:$.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:$.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:$.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:$.toAttribute(t.axisPosition,`auto`),direction:$.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:$.toIntValue(e.minLength,0),maxLength:$.toIntValue(e.maxLength,100),border:$.toBoolValue(e.border,!1),gradient:$.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:$.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:$.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:$.toStringValue(e.axisPosition,`auto`),direction:$.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}}},hl=class extends ${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:$.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},gl=class extends Vc{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new pl,"x14:cfIcon":this.cfIconXform=new hl}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:$.toStringAttribute(t.iconSet),reverse:$.toBoolAttribute(t.reverse,!1),showValue:$.toBoolAttribute(t.showValue,!0),custom:$.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:$.toStringValue(e.iconSet,`3TrafficLights`),reverse:$.toBoolValue(e.reverse,!1),showValue:$.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}}};let _l={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var vl=class e extends Vc{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new ml,"x14:iconSet":this.iconSetXform=new gl}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?ml.isExt(e):!!(e.type===`iconSet`&&(e.custom||_l[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${dl()}}`.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||`{${dl()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:$.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},yl=class extends ${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}},bl=class extends Vc{constructor(){super(),this.map={"xm:sqref":this.sqRef=new yl,"x14:cfRule":this.cfRule=new vl}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(vl.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(vl.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}}},xl=class extends Vc{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new bl}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(vl.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)}},Sl=class extends Vc{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new xl}}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}},Cl=class extends Vc{constructor(){super(),this.map={ext:this.ext=new Sl}}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 wl=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},Tl=(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?wl(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var El=class e extends ${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`,"mc:Ignorable":`x14ac`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r||[],this.map={sheetPr:new vc,dimension:new cc,sheetViews:new ss({tag:`sheetViews`,count:!1,childXform:new xc}),sheetFormatPr:new yc,cols:new ss({tag:`cols`,count:!1,childXform:new sc}),sheetData:new ss({tag:`sheetData`,count:!1,empty:!0,childXform:new oc({maxItems:n}),maxItems:t}),autoFilter:new Pc,mergeCells:new ss({tag:`mergeCells`,count:!0,childXform:new uc}),rowBreaks:new zc,hyperlinks:new ss({tag:`hyperlinks`,count:!1,childXform:new lc}),pageMargins:new Tc,dataValidations:new mc,pageSetup:new jc,headerFooter:new Bc,printOptions:new Nc,picture:new Fc,drawing:new Ic,sheetProtection:new wc,tableParts:new ss({tag:`tableParts`,count:!0,childXform:new Lc}),conditionalFormatting:new nl,extLst:new Cl}}prepare(e,t){t.merges=new nc,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],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 n=e.rels=[];function r(e){return`rId${e.length+1}`}if(e.hyperlinks.forEach(e=>{let t=r(n);e.rId=t,n.push({Id:t,Type:tc.Hyperlink,Target:e.target,TargetMode:`External`})}),e.comments.length>0){let i={Id:r(n),Type:tc.Comments,Target:`../comments${e.id}.xml`};n.push(i);let a={Id:r(n),Type:tc.VmlDrawing,Target:`../drawings/vmlDrawing${e.id}.vml`};n.push(a),e.comments.forEach(e=>{e.refAddress=m.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${e.id}`,vmlDrawing:`vmlDrawing${e.id}`})}let i=[],a;e.media.forEach(o=>{if(o.type===`background`){let i=r(n);a=t.media[o.imageId],n.push({Id:i,Type:tc.Image,Target:`../media/${a.name}.${a.extension}`}),e.background={rId:i},e.image=t.media[o.imageId]}else if(o.type===`image`){let{drawing:s}=e;a=t.media[o.imageId],s||(s=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(s),n.push({Id:s.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:`../drawings/${s.name}.xml`}));let c=this.preImageId===o.imageId?i[o.imageId]:i[s.rels.length];c||(c=r(s.rels),i[s.rels.length]=c,s.rels.push({Id:c,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:`../media/${a.name}.${a.extension}`}));let l={picture:{rId:c},range:o.range};if(o.hyperlinks&&o.hyperlinks.hyperlink){let e=r(s.rels);i[s.rels.length]=e,l.picture.hyperlinks={tooltip:o.hyperlinks.tooltip,rId:e},s.rels.push({Id:e,Type:tc.Hyperlink,Target:o.hyperlinks.hyperlink,TargetMode:`External`})}this.preImageId=o.imageId,s.anchors.push(l)}}),e.tables.forEach(e=>{let i=r(n);e.rId=i,n.push({Id:i,Type:tc.Table,Target:`../tables/${e.target}`}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables||[]).length&&n.push({Id:r(n),Type:tc.PivotTable,Target:`../pivotTables/pivotTable1.xml`}),this.map.extLst.prepare(e,t)}render(t,n){t.openXml($o.StdDocAttributes),t.openNode(`worksheet`,e.WORKSHEET_ATTRIBUTES);let r=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow}:void 0;n.properties&&n.properties.defaultColWidth&&(r.defaultColWidth=n.properties.defaultColWidth);let i={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},a=n.pageSetup&&n.pageSetup.margins,o={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},s=n.sheetProtection;this.map.sheetPr.render(t,i),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,r),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,s),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,o),this.map.pageMargins.render(t,a),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),n.rels&&n.rels.forEach(e=>{e.Type===tc.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),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=Tl(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},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===tc.Comments&&(e.comments=t.comments[r.Target].comments),r.Type===tc.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&&e.rows.filter(Boolean)||[],e.rows.forEach(e=>{e.cells=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];t.drawings[n].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]}),delete e.relationships,delete e.hyperlinks,delete e.comments}},Dl=class extends ${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]}}}},Ol=class extends ${constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new us({tag:`xdr:col`,zero:!0}),"xdr:colOff":new us({tag:`xdr:colOff`,zero:!0}),"xdr:row":new us({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new us({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}}},kl=class extends ${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}}},Al=class extends ${constructor(){super(),this.map={"a:blip":new kl}}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}}},jl=class extends ${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}},Ml=class extends ${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}}},Nl=class extends ${constructor(){super(),this.map={"a:hlinkClick":new jl,"a:extLst":new Ml}}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}}},Pl=class extends ${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}}},Fl=class extends ${constructor(){super(),this.map={"xdr:cNvPr":new Nl,"xdr:cNvPicPr":new Pl}}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 Il={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 Ll=class extends ${constructor(){super(),this.map={"xdr:nvPicPr":new Fl,"xdr:blipFill":new Al,"xdr:spPr":new os(Il)}}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}}},Rl=class extends Dl{constructor(){super(),this.map={"xdr:from":new Ol({tag:`xdr:from`}),"xdr:to":new Ol({tag:`xdr:to`}),"xdr:pic":new Ll,"xdr:clientData":new os({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}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:to`].render(e,t.range.br),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.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 zl=9525;var Bl=class extends ${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*zl),r=Math.floor(t.height*zl);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)/zl,height:parseInt(e.attributes.cy||`0`,10)/zl},!0):!1}parseText(e){}parseClose(e){return!1}},Vl=class extends Dl{constructor(){super(),this.map={"xdr:from":new Ol({tag:`xdr:from`}),"xdr:ext":new Bl({tag:`xdr:ext`}),"xdr:pic":new Ll,"xdr:clientData":new os({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 Hl(e){return(typeof e.range==`string`?m.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Ul=class e extends ${constructor(){super(),this.map={"xdr:twoCellAnchor":new Rl,"xdr:oneCellAnchor":new Vl},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Hl(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml($o.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`}}},Wl=class extends ${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}},Gl=class extends ${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}},Kl=class extends ${constructor(){super(),this.map={customFilters:new ss({tag:`customFilters`,count:!1,empty:!0,childXform:new Wl}),filters:new ss({tag:`filters`,count:!1,empty:!0,childXform:new Gl})},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;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}}},ql=class extends ${constructor(){super(),this.map={filterColumn:new Kl},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}`)}}},Jl=class extends ${constructor(){super(),this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}render(e,t){e.leafNode(this.tag,{id:t.id.toString(),name:t.name,totalsRowLabel:t.totalsRowLabel,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId})}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!1}parseText(){}parseClose(){return!1}},Yl=class extends ${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}},Xl=class e extends ${constructor(){super(),this.map={autoFilter:new ql,tableColumns:new ss({tag:`tableColumns`,count:!0,empty:!0,childXform:new Jl}),tableStyleInfo:new Yl},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($o.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,totalsRowShown:n.totalsRow?void 0:`1`,headerRowCount:n.headerRow?`1`:`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===`1`};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`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr xr3`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,"xmlns:xr3":`http://schemas.microsoft.com/office/spreadsheetml/2016/revision3`}}},Zl=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotCacheRecords`}render(t,n){let{sourceSheet:r,cacheFields:i}=n,a=r.getSheetValues().slice(2);t.openXml($o.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_RECORDS_ATTRIBUTES,count:a.length}),t.writeXml(o()),t.closeNode();function o(){return a.map(e=>[...s(e.slice(1))].join(``)).join(``)}function*s(e){yield`
32
32
  <r>`;for(let[t,n]of e.entries())yield`
33
33
  `,yield c(n,i[t].sharedItems);yield`
34
- </r>`}function c(e,t){if(t===null)return Number.isFinite(e)?`<n v="${e}" />`:`<s v="${e}" />`;let n=t.indexOf(e);if(n<0)throw Error(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}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`}}},nu=class{constructor({name:e,sharedItems:t}){this.name=e,this.sharedItems=t}render(){return this.sharedItems===null?`<cacheField name="${this.name}" numFmtId="0">
34
+ </r>`}function c(e,t){if(t===null)return Number.isFinite(e)?`<n v="${e}" />`:`<s v="${e}" />`;let n=t.indexOf(e);if(n<0)throw Error(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}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`}}},Ql=class{constructor({name:e,sharedItems:t}){this.name=e,this.sharedItems=t}render(){return this.sharedItems===null?`<cacheField name="${this.name}" numFmtId="0">
35
35
  <sharedItems containsSemiMixedTypes="0" containsString="0" containsNumber="1" containsInteger="1" />
36
36
  </cacheField>`:`<cacheField name="${this.name}" numFmtId="0">
37
37
  <sharedItems count="${this.sharedItems.length}">
38
38
  ${this.sharedItems.map(e=>`<s v="${e}" />`).join(``)}
39
39
  </sharedItems>
40
- </cacheField>`}},ru=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotCacheDefinition`}render(t,n){let{sourceSheet:r,cacheFields:i}=n;t.openXml(ts.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,refreshedBy:`Author`,refreshedDate:`45125.026046874998`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:i.length+1}),t.openNode(`cacheSource`,{type:`worksheet`}),t.leafNode(`worksheetSource`,{ref:r.dimensions.shortRange,sheet:r.name}),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(i.map(e=>new nu(e).render()).join(`
41
- `)),t.closeNode(),t.closeNode()}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}static{this.PIVOT_CACHE_DEFINITION_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`}}},iu=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotTableDefinition`}render(t,n){let{rows:r,columns:i,values:a,cacheFields:o,cacheId:s}=n;t.openXml(ts.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,"xr:uid":`{267EE50F-B116-784D-8DC2-BA77DE3F4F4A}`,name:`PivotTable2`,cacheId:s,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:`1`,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`}),t.writeXml(`
40
+ </cacheField>`}},$l=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotCacheDefinition`}render(t,n){let{sourceSheet:r,cacheFields:i}=n;t.openXml($o.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,refreshedBy:`Author`,refreshedDate:`45125.026046874998`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:i.length+1}),t.openNode(`cacheSource`,{type:`worksheet`}),t.leafNode(`worksheetSource`,{ref:r.dimensions.shortRange,sheet:r.name}),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeXml(i.map(e=>new Ql(e).render()).join(`
41
+ `)),t.closeNode(),t.closeNode()}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}static{this.PIVOT_CACHE_DEFINITION_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`}}},eu=class e extends ${constructor(){super(),this.map={}}prepare(e){}get tag(){return`pivotTableDefinition`}render(t,n){let{rows:r,columns:i,values:a,cacheFields:o,cacheId:s}=n;t.openXml($o.StdDocAttributes),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,"xr:uid":`{267EE50F-B116-784D-8DC2-BA77DE3F4F4A}`,name:`PivotTable2`,cacheId:s,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:`1`,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`}),t.writeXml(`
42
42
  <location ref="A3:E15" firstHeaderRow="1" firstDataRow="2" firstDataCol="1" />
43
43
  <pivotFields count="${o.length}">
44
- ${au(n)}
44
+ ${tu(n)}
45
45
  </pivotFields>
46
46
  <rowFields count="${r.length}">
47
47
  ${r.map(e=>`<field x="${e}" />`).join(`
@@ -93,7 +93,7 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
93
93
  />
94
94
  </ext>
95
95
  </extLst>
96
- `),t.closeNode()}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function au(e){return e.cacheFields.map((t,n)=>ou(e.rows.indexOf(n)>=0?`row`:e.columns.indexOf(n)>=0?`column`:e.values.indexOf(n)>=0?`value`:null,t.sharedItems)).join(``)}function ou(e,t){let n=`compact="0" outline="0" showAll="0" defaultSubtotal="0"`;return e===`row`||e===`column`?`
96
+ `),t.closeNode()}parseOpen(e){return!1}parseText(e){}parseClose(e){return!1}reconcile(e,t){}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function tu(e){return e.cacheFields.map((t,n)=>nu(e.rows.indexOf(n)>=0?`row`:e.columns.indexOf(n)>=0?`column`:e.values.indexOf(n)>=0?`value`:null,t.sharedItems)).join(``)}function nu(e,t){let n=`compact="0" outline="0" showAll="0" defaultSubtotal="0"`;return e===`row`||e===`column`?`
97
97
  <pivotField axis="${e===`row`?`axisRow`:`axisCol`}" ${n}>
98
98
  <items count="${t.length+1}">
99
99
  ${t.map((e,t)=>`<item x="${t}" />`).join(`
@@ -105,10 +105,10 @@ ${h}.`);break;case m:switch(t){case`xml`:break;case``:e.fail(`the default namesp
105
105
  ${e===`value`?`dataField="1"`:``}
106
106
  ${n}
107
107
  />
108
- `}var su=class extends ${constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Bs,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}}},cu=class e extends ${constructor(){super(),this.map={comment:new su},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(ts.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`}}},lu=class extends ${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}}},uu=class extends ${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}},du=class extends ${constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model&&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}},fu=class extends ${constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model&&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 pu=[`twoCells`,`oneCells`,`absolute`];var mu=class extends ${constructor(){super(),this.map={"x:Anchor":new uu,"x:Locked":new du({tag:`x:Locked`}),"x:LockText":new du({tag:`x:LockText`}),"x:SizeWithCells":new fu({tag:`x:SizeWithCells`}),"x:MoveWithCells":new fu({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,pu),this.map[`x:SizeWithCells`].render(e,r,pu),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=pu[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}},hu=class e extends ${constructor(){super(),this.map={"v:textbox":new lu,"x:ClientData":new mu}}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})}},gu=class e extends ${constructor(){super(),this.map={"v:shape":new hu},this.model={comments:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model;t.openXml(ts.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(),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(),r.comments.forEach((e,n)=>{this.map[`v:shape`].render(t,e,n)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[]};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}}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:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},_u=q();Ji();var vu=sn();function yu(e,t){return new Promise((n,r)=>{qi.readFile(e,t,(e,t)=>{e?r(e):n(t)})})}var bu=class e{constructor(e){this.workbook=e}async readFile(e,t){if(!await ia(e))throw Error(`File not found: ${e}`);let n=qi.createReadStream(e);try{let e=await this.read(n,t);return n.close(),e}catch(e){throw n.close(),e}}parseRels(e){return new Gs().parseStream(e)}parseWorkbook(e){return new ic().parseStream(e)}parseSharedStrings(e){return new Us().parseStream(e)}reconcile(e,t){let n=new ic,r=new Al(t),i=new ql,a=new eu;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};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))});let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)});let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings};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,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings}async _processWorksheetEntry(e,t,n,r,i){let a=await new Al(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 cu().parseStream(e);t.comments[`../${n}.xml`]=r}async _processTableEntry(e,t,n){let r=await new eu().parseStream(e);t.tables[`../tables/${n}.xml`]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new Gs().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=new Ko,c=()=>{e.removeListener(`error`,u),s.removeListener(`error`,u),s.removeListener(`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.toBuffer()};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){let r=await new ql().parseStream(e);t.drawings[n]=r}async _processDrawingRelsEntry(e,t,n){let r=await new Gs().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new gu().parseStream(e);t.vmlDrawings[`../drawings/${n}.vml`]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=new Ko,o=()=>{e.removeListener(`error`,c),a.removeListener(`error`,c),a.removeListener(`finish`,s)},s=()=>{o(),t.themes[n]=a.read().toString(),r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async read(e,t){let n={};return await new Promise((t,r)=>{let i=0,a=!1,o=0,s=()=>{e.removeListener(`data`,u),e.removeListener(`end`,d),e.removeListener(`error`,f)},c=()=>{a&&i===o&&(s(),t())},l=new Io(e=>{o++;let t=[],a=0;e.ondata=(o,l,u)=>{if(o){s(),r(o);return}if(l&&(t.push(l),a+=l.length),u){if(t.length===1)n[e.name]=t[0];else if(t.length>1){let r=new Uint8Array(a),i=0;for(let e of t)r.set(e,i),i+=e.length;n[e.name]=r}else n[e.name]=new Uint8Array;i++,t.length=0,c()}},e.start()});l.register(Fo);let u=e=>{l.push(e)},d=()=>{l.push(new Uint8Array,!0),a=!0,c()},f=e=>{s(),r(e)};e.on(`data`,u),e.on(`end`,d),e.on(`error`,f)}),this.loadFromFiles(n,t)}async load(e,t){let n;if(!e||typeof e==`object`&&!_u.Buffer.isBuffer(e)&&!(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) ?`);n=t&&t.base64?_u.Buffer.from(e.toString(),`base64`):e;let r=new vu.PassThrough;return r.end(n),this.read(r,t)}async loadFromFiles(e,t){let n={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=e.name;r[0]===`/`&&(r=r.substr(1));let i;if(r.match(/xl\/media\//)||r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/))i=new vu.PassThrough,i.end(_u.Buffer.from(e.data));else{i=new vu.PassThrough({readableObjectMode:!0,writableObjectMode:!0});let t=rs(_u.Buffer.from(e.data));i.end(t)}let a;if(a=r.match(/xl\/worksheets\/sheet(\d+)[.]xml/),a){let e=parseInt(a[1],10);await this._processWorksheetEntry(i,n,e,t,r)}else switch(r){case`_rels/.rels`:n.globalRels=await this.parseRels(i);break;case`xl/workbook.xml`:{let e=await this.parseWorkbook(i);n.sheets=e.sheets,n.definedNames=e.definedNames,n.views=e.views,n.properties=e.properties,n.calcProperties=e.calcProperties;break}case`xl/sharedStrings.xml`:n.sharedStrings=new Us,await n.sharedStrings.parseStream(i);break;case`xl/_rels/workbook.xml.rels`:n.workbookRels=await this.parseRels(i);break;case`docProps/app.xml`:{let e=await new Ys().parseStream(i);n.company=e.company,n.manager=e.manager;break}case`docProps/core.xml`:{let e=await new Rs().parseStream(i);Object.assign(n,e);break}case`xl/styles.xml`:n.styles=new Is,await n.styles.parseStream(i);break;default:if(a=r.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels/),a){let e=parseInt(a[1],10);await this._processWorksheetRelsEntry(i,n,e);break}if(a=r.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),a){await this._processMediaEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/(drawing\d+)[.]xml/),a){await this._processDrawingEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels/),a){await this._processDrawingRelsEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),a){await this._processVmlDrawingEntry(i,n,a[1]);break}if(a=r.match(/xl\/comments(\d+)[.]xml/),a){await this._processCommentEntry(i,n,`comments${a[1]}`);break}if(a=r.match(/xl\/tables\/(table\d+)[.]xml/),a){await this._processTableEntry(i,n,a[1]);break}if(a=r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),a){await this._processThemeEntry(i,n,a[1]);break}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async addContentTypes(e,t){let n=new Ks().toXml(t);e.append(n,{name:`[Content_Types].xml`})}async addApp(e,t){let n=new Ys().toXml(t);e.append(n,{name:`docProps/app.xml`})}async addCore(e,t){let n=new Rs;e.append(n.toXml(t),{name:`docProps/core.xml`})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
109
- <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],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new Gs().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];if(n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).length){let t=n.pivotTables[0];t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition1.xml`})}n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.id}.xml`})});let a=new Gs().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new ic;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new Al,r=new Gs,i=new cu,a=new gu;t.worksheets.forEach(t=>{let o=new ts;n.render(o,t),e.append(o.xml,{name:`xl/worksheets/sheet${t.id}.xml`}),t.rels&&t.rels.length&&(o=new ts,r.render(o,t.rels),e.append(o.xml,{name:`xl/worksheets/_rels/sheet${t.id}.xml.rels`})),t.comments.length>0&&(o=new ts,i.render(o,t),e.append(o.xml,{name:`xl/comments${t.id}.xml`}),o=new ts,a.render(o,t),e.append(o.xml,{name:`xl/drawings/vmlDrawing${t.id}.vml`}))})}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.filename){let r=await yu(t.filename);return e.append(r,{name:n})}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}}throw Error(`Unsupported media`)}))}addDrawings(e,t){let n=new ql,r=new Gs;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new eu;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=n.pivotTables[0],i=new tu,a=new ru,o=new iu,s=new Gs,c=i.toXml(r);t.append(c,{name:`xl/pivotCache/pivotCacheRecords1.xml`}),c=a.toXml(r),t.append(c,{name:`xl/pivotCache/pivotCacheDefinition1.xml`}),c=s.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords1.xml`}]),t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition1.xml.rels`}),c=o.toXml(r),t.append(c,{name:`xl/pivotTables/pivotTable1.xml`}),c=s.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition1.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable1.xml.rels`})}_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 Us,e.styles=e.useStyles?new Is(!0):new Is.Mock;let n=new ic,r=new Al;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}async write(e,t){t||={};let{model:n}=this.workbook,r=new Qo(t.zip);return r.pipe(e),this.prepareModel(n,t),await this.addContentTypes(r,n),await this.addOfficeRels(r,n),await this.addWorkbookRels(r,n),await this.addWorksheets(r,n),await this.addSharedStrings(r,n),this.addDrawings(r,n),this.addTables(r,n),this.addPivotTables(r,n),await Promise.all([this.addThemes(r,n),this.addStyles(r,n)]),await this.addMedia(r,n),await Promise.all([this.addApp(r,n),this.addCore(r,n)]),await this.addWorkbook(r,n),this._finalize(r)}writeFile(e,t){let n=qi.createWriteStream(e);return new Promise((e,r)=>{let i=()=>{n.removeListener(`finish`,a),n.removeListener(`error`,o)},a=()=>{i(),e()},o=e=>{i(),r(e)};n.once(`finish`,a),n.on(`error`,o),this.write(n,t).then(()=>{n.end()}).catch(e=>{i(),r(e)})})}async writeBuffer(e){let t=new Ko;return await this.write(t,e),t.read()}static{this.RelType=ac}},xu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FormatterOptions=void 0,e.FormatterOptions=class{objectMode=!0;delimiter=`,`;rowDelimiter=`
110
- `;quote=`"`;escape=this.quote;quoteColumns=!1;quoteHeaders=this.quoteColumns;headers=null;includeEndRowDelimiter=!1;transform;shouldWriteHeaders;writeBOM=!1;escapedQuote;BOM=``;alwaysWriteHeaders=!1;constructor(e={}){Object.assign(this,e||{}),e?.quoteHeaders===void 0&&(this.quoteHeaders=this.quoteColumns),e?.quote===!0?this.quote=`"`:e?.quote===!1&&(this.quote=``),typeof e?.escape!=`string`&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&(e.writeHeaders??!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}})),Su=c(((e,t)=>{var n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Null]`,o=`[object Proxy]`,s=`[object Undefined]`,c=typeof global==`object`&&global&&global.Object===Object&&global,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype,f=d.hasOwnProperty,p=d.toString,m=u.Symbol,h=m?m.toStringTag:void 0;function g(e){return e==null?e===void 0?s:a:h&&h in Object(e)?_(e):v(e)}function _(e){var t=f.call(e,h),n=e[h];try{e[h]=void 0;var r=!0}catch{}var i=p.call(e);return r&&(t?e[h]=n:delete e[h]),i}function v(e){return p.call(e)}function y(e){if(!b(e))return!1;var t=g(e);return t==r||t==i||t==n||t==o}function b(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=y})),Cu=c(((e,t)=>{var n=`[object Boolean]`,r=Object.prototype.toString;function i(e){return e===!0||e===!1||a(e)&&r.call(e)==n}function a(e){return!!e&&typeof e==`object`}t.exports=i})),wu=c(((e,t)=>{function n(e){return e==null}t.exports=n})),Tu=c(((e,t)=>{var n=1/0,r=`[object Symbol]`,i=/[\\^$.*+?()[\]{}|]/g,a=RegExp(i.source),o=typeof global==`object`&&global&&global.Object===Object&&global,s=typeof self==`object`&&self&&self.Object===Object&&self,c=o||s||Function(`return this`)(),l=Object.prototype.toString,u=c.Symbol,d=u?u.prototype:void 0,f=d?d.toString:void 0;function p(e){if(typeof e==`string`)return e;if(h(e))return f?f.call(e):``;var t=e+``;return t==`0`&&1/e==-n?`-0`:t}function m(e){return!!e&&typeof e==`object`}function h(e){return typeof e==`symbol`||m(e)&&l.call(e)==r}function g(e){return e==null?``:p(e)}function _(e){return e=g(e),e&&a.test(e)?e.replace(i,`\\$&`):e}t.exports=_})),Eu=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.FieldFormatter=void 0;let n=t(Cu()),r=t(wu()),i=t(Tu());e.FieldFormatter=class{formatterOptions;_headers=null;REPLACE_REGEXP;ESCAPE_REGEXP;constructor(e){this.formatterOptions=e,e.headers!==null&&(this.headers=e.headers),this.REPLACE_REGEXP=new RegExp(e.quote,`g`);let t=`[${e.delimiter}${(0,i.default)(e.rowDelimiter)}|\r|\n]`;this.ESCAPE_REGEXP=new RegExp(t)}set headers(e){this._headers=e}shouldQuote(e,t){let r=t?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;return(0,n.default)(r)?r:Array.isArray(r)?r[e]:this._headers===null?!1:r[this._headers[e]]}format(e,t,n){let i=`${(0,r.default)(e)?``:e}`.replace(/\0/g,``),{formatterOptions:a}=this;return a.quote!==``&&i.indexOf(a.quote)!==-1?this.quoteField(i.replace(this.REPLACE_REGEXP,a.escapedQuote)):i.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(t,n)?this.quoteField(i):i}quoteField(e){let{quote:t}=this.formatterOptions;return`${t}${e}${t}`}}})),Du=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isSyncTransform=void 0,e.isSyncTransform=e=>e.length===1})),Ou=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.RowFormatter=void 0;let n=t(Su()),r=Eu(),i=Du();e.RowFormatter=class e{static isRowHashArray(e){return Array.isArray(e)?Array.isArray(e[0])&&e[0].length===2:!1}static isRowArray(e){return Array.isArray(e)&&!this.isRowHashArray(e)}static gatherHeaders(t){return e.isRowHashArray(t)?t.map(e=>e[0]):Array.isArray(t)?t:Object.keys(t)}static createTransform(e){return(0,i.isSyncTransform)(e)?(t,n)=>{let r=null;try{r=e(t)}catch(e){return n(e)}return n(null,r)}:(t,n)=>{e(t,n)}}formatterOptions;fieldFormatter;shouldWriteHeaders;_rowTransform;headers;hasWrittenHeaders;rowCount=0;constructor(e){this.formatterOptions=e,this.fieldFormatter=new r.FieldFormatter(e),this.headers=e.headers,this.shouldWriteHeaders=e.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null&&(this.fieldFormatter.headers=this.headers),e.transform&&(this.rowTransform=e.transform)}set rowTransform(t){if(!(0,n.default)(t))throw TypeError(`The transform should be a function`);this._rowTransform=e.createTransform(t)}format(e,t){this.callTransformer(e,(n,r)=>{if(n)return t(n);if(!e)return t(null);let i=[];if(r){let{shouldFormatColumns:e,headers:t}=this.checkHeaders(r);if(this.shouldWriteHeaders&&t&&!this.hasWrittenHeaders&&(i.push(this.formatColumns(t,!0)),this.hasWrittenHeaders=!0),e){let e=this.gatherColumns(r);i.push(this.formatColumns(e,!1))}}return t(null,i)})}finish(e){let t=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return e(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));t.push(this.formatColumns(this.headers,!0))}return this.formatterOptions.includeEndRowDelimiter&&t.push(this.formatterOptions.rowDelimiter),e(null,t)}checkHeaders(t){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let n=e.gatherHeaders(t);return this.headers=n,this.fieldFormatter.headers=n,this.shouldWriteHeaders?Array.isArray(t)&&n.every((e,n)=>e===t[n])?{shouldFormatColumns:!1,headers:n}:{shouldFormatColumns:!0,headers:n}:{shouldFormatColumns:!0,headers:null}}gatherColumns(t){if(this.headers===null)throw Error(`Headers is currently null`);return Array.isArray(t)?e.isRowHashArray(t)?this.headers.map((e,n)=>{let r=t[n];return r?r[1]:``}):e.isRowArray(t)&&!this.shouldWriteHeaders?t:this.headers.map((e,n)=>t[n]):this.headers.map(e=>t[e])}callTransformer(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}formatColumns(e,t){let n=e.map((e,n)=>this.fieldFormatter.format(e,n,t)).join(this.formatterOptions.delimiter),{rowCount:r}=this;return this.rowCount+=1,r?[this.formatterOptions.rowDelimiter,n].join(``):n}}})),ku=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FieldFormatter=e.RowFormatter=void 0;var t=Ou();Object.defineProperty(e,`RowFormatter`,{enumerable:!0,get:function(){return t.RowFormatter}});var n=Eu();Object.defineProperty(e,`FieldFormatter`,{enumerable:!0,get:function(){return n.FieldFormatter}})})),Au=c((e=>{var t=q();Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvFormatterStream=void 0;let n=sn(),r=ku();e.CsvFormatterStream=class extends n.Transform{formatterOptions;rowFormatter;hasWrittenBOM=!1;constructor(e){super({writableObjectMode:e.objectMode}),this.formatterOptions=e,this.rowFormatter=new r.RowFormatter(e),this.hasWrittenBOM=!e.writeBOM}transform(e){return this.rowFormatter.rowTransform=e,this}_transform(e,n,r){let i=!1;try{this.hasWrittenBOM||=(this.push(this.formatterOptions.BOM),!0),this.rowFormatter.format(e,(e,n)=>e?(i=!0,r(e)):(n&&n.forEach(e=>{this.push(t.Buffer.from(e,`utf8`))}),i=!0,r()))}catch(e){if(i)throw e;r(e)}}_flush(e){this.rowFormatter.finish((n,r)=>n?e(n):(r&&r.forEach(e=>{this.push(t.Buffer.from(e,`utf8`))}),e()))}}})),ju=c((e=>{var t=q(),n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=e&&e.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.writeToPath=e.writeToString=e.writeToBuffer=e.writeToStream=e.write=e.format=e.FormatterOptions=e.CsvFormatterStream=void 0;let o=Wt(),s=sn(),c=i((Ji(),f(Ki))),l=xu(),u=Au();a(Du(),e);var d=Au();Object.defineProperty(e,`CsvFormatterStream`,{enumerable:!0,get:function(){return d.CsvFormatterStream}});var p=xu();Object.defineProperty(e,`FormatterOptions`,{enumerable:!0,get:function(){return p.FormatterOptions}}),e.format=e=>new u.CsvFormatterStream(new l.FormatterOptions(e)),e.write=(t,n)=>{let r=(0,e.format)(n),i=(0,o.promisify)((e,t)=>{r.write(e,void 0,t)});return t.reduce((e,t)=>e.then(()=>i(t)),Promise.resolve()).then(()=>{r.end()}).catch(e=>{r.emit(`error`,e)}),r},e.writeToStream=(t,n,r)=>(0,e.write)(n,r).pipe(t),e.writeToBuffer=(n,r={})=>{let i=[],a=new s.Writable({write(e,t,n){i.push(e),n()}});return new Promise((o,s)=>{a.on(`error`,s).on(`finish`,()=>o(t.Buffer.concat(i))),(0,e.write)(n,r).pipe(a)})},e.writeToString=(t,n)=>(0,e.writeToBuffer)(t,n).then(e=>e.toString()),e.writeToPath=(t,n,r)=>{let i=c.createWriteStream(t,{encoding:`utf8`});return(0,e.write)(n,r).pipe(i)}})),Mu=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.ParserOptions=void 0;let n=t(Tu()),r=t(wu());e.ParserOptions=class{escapedDelimiter;objectMode=!0;delimiter=`,`;ignoreEmpty=!1;quote=`"`;escape=null;escapeChar=this.quote;comment=null;supportsComments=!1;ltrim=!1;rtrim=!1;trim=!1;headers=null;renameHeaders=!1;strictColumnHandling=!1;discardUnmappedColumns=!1;carriageReturn=`\r`;NEXT_TOKEN_REGEXP;encoding=`utf8`;limitRows=!1;maxRows=0;skipLines=0;skipRows=0;constructor(e){if(Object.assign(this,e||{}),this.delimiter.length>1)throw Error(`delimiter option must be one character long`);this.escapedDelimiter=(0,n.default)(this.delimiter),this.escapeChar=this.escape??this.quote,this.supportsComments=!(0,r.default)(this.comment),this.NEXT_TOKEN_REGEXP=RegExp(`([^\\s]|\\r\\n|\\n|\\r|${this.escapedDelimiter})`),this.maxRows>0&&(this.limitRows=!0)}}})),Nu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isSyncValidate=e.isSyncTransform=void 0,e.isSyncTransform=e=>e.length===1,e.isSyncValidate=e=>e.length===1})),Pu=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.RowTransformerValidator=void 0;let n=t(Su()),r=Nu();e.RowTransformerValidator=class e{static createTransform(e){return(0,r.isSyncTransform)(e)?(t,n)=>{let r=null;try{r=e(t)}catch(e){return n(e)}return n(null,r)}:e}static createValidator(e){return(0,r.isSyncValidate)(e)?(t,n)=>{n(null,{row:t,isValid:e(t)})}:(t,n)=>{e(t,(e,r,i)=>e?n(e):r?n(null,{row:t,isValid:r,reason:i}):n(null,{row:t,isValid:!1,reason:i}))}}_rowTransform=null;_rowValidator=null;set rowTransform(t){if(!(0,n.default)(t))throw TypeError(`The transform should be a function`);this._rowTransform=e.createTransform(t)}set rowValidator(t){if(!(0,n.default)(t))throw TypeError(`The validate should be a function`);this._rowValidator=e.createValidator(t)}transformAndValidate(e,t){return this.callTransformer(e,(e,n)=>e?t(e):n?this.callValidator(n,(e,r)=>e?t(e):r&&!r.isValid?t(null,{row:n,isValid:!1,reason:r.reason}):t(null,{row:n,isValid:!0})):t(null,{row:null,isValid:!0}))}callTransformer(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}callValidator(e,t){return this._rowValidator?this._rowValidator(e,t):t(null,{row:e,isValid:!0})}}})),Fu=c(((e,t)=>{function n(e){return e===void 0}t.exports=n})),Iu=c(((e,t)=>{var n=200,r=`__lodash_hash_undefined__`,i=1/0,a=`[object Function]`,o=`[object GeneratorFunction]`,s=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=typeof global==`object`&&global&&global.Object===Object&&global,u=typeof self==`object`&&self&&self.Object===Object&&self,d=l||u||Function(`return this`)();function f(e,t){return!!(e&&e.length)&&h(e,t,0)>-1}function p(e,t,n){for(var r=-1,i=e?e.length:0;++r<i;)if(n(t,e[r]))return!0;return!1}function m(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function h(e,t,n){if(t!==t)return m(e,g,n);for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function g(e){return e!==e}function _(e,t){return e.has(t)}function v(e,t){return e?.[t]}function y(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function b(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var x=Array.prototype,S=Function.prototype,C=Object.prototype,w=d[`__core-js_shared__`],T=function(){var e=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),E=S.toString,D=C.hasOwnProperty,O=C.toString,k=RegExp(`^`+E.call(D).replace(s,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),A=x.splice,ee=fe(d,`Map`),j=fe(d,`Set`),M=fe(Object,`create`);function N(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function P(){this.__data__=M?M(null):{}}function F(e){return this.has(e)&&delete this.__data__[e]}function te(e){var t=this.__data__;if(M){var n=t[e];return n===r?void 0:n}return D.call(t,e)?t[e]:void 0}function I(e){var t=this.__data__;return M?t[e]!==void 0:D.call(t,e)}function L(e,t){var n=this.__data__;return n[e]=M&&t===void 0?r:t,this}N.prototype.clear=P,N.prototype.delete=F,N.prototype.get=te,N.prototype.has=I,N.prototype.set=L;function ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function R(){this.__data__=[]}function z(e){var t=this.__data__,n=ce(t,e);return n<0?!1:(n==t.length-1?t.pop():A.call(t,n,1),!0)}function re(e){var t=this.__data__,n=ce(t,e);return n<0?void 0:t[n][1]}function B(e){return ce(this.__data__,e)>-1}function V(e,t){var n=this.__data__,r=ce(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}ne.prototype.clear=R,ne.prototype.delete=z,ne.prototype.get=re,ne.prototype.has=B,ne.prototype.set=V;function ie(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function H(){this.__data__={hash:new N,map:new(ee||ne),string:new N}}function U(e){return de(this,e).delete(e)}function ae(e){return de(this,e).get(e)}function W(e){return de(this,e).has(e)}function G(e,t){return de(this,e).set(e,t),this}ie.prototype.clear=H,ie.prototype.delete=U,ie.prototype.get=ae,ie.prototype.has=W,ie.prototype.set=G;function oe(e){var t=-1,n=e?e.length:0;for(this.__data__=new ie;++t<n;)this.add(e[t])}function K(e){return this.__data__.set(e,r),this}function se(e){return this.__data__.has(e)}oe.prototype.add=oe.prototype.push=K,oe.prototype.has=se;function ce(e,t){for(var n=e.length;n--;)if(J(e[n][0],t))return n;return-1}function le(e){return!_e(e)||me(e)?!1:(Y(e)||y(e)?k:c).test(he(e))}function q(e,t,r){var i=-1,a=f,o=e.length,s=!0,c=[],l=c;if(r)s=!1,a=p;else if(o>=n){var u=t?null:ue(e);if(u)return b(u);s=!1,a=_,l=new oe}else l=t?[]:c;outer:for(;++i<o;){var d=e[i],m=t?t(d):d;if(d=r||d!==0?d:0,s&&m===m){for(var h=l.length;h--;)if(l[h]===m)continue outer;t&&l.push(m),c.push(d)}else a(l,m,r)||(l!==c&&l.push(m),c.push(d))}return c}var ue=j&&1/b(new j([,-0]))[1]==i?function(e){return new j(e)}:X;function de(e,t){var n=e.__data__;return pe(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function fe(e,t){var n=v(e,t);return le(n)?n:void 0}function pe(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function me(e){return!!T&&T in e}function he(e){if(e!=null){try{return E.call(e)}catch{}try{return e+``}catch{}}return``}function ge(e){return e&&e.length?q(e):[]}function J(e,t){return e===t||e!==e&&t!==t}function Y(e){var t=_e(e)?O.call(e):``;return t==a||t==o}function _e(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function X(){}t.exports=ge})),Lu=c(((e,t)=>{var n=200,r=`Expected a function`,i=`__lodash_hash_undefined__`,a=1,o=2,s=1/0,c=9007199254740991,l=`[object Arguments]`,u=`[object Array]`,d=`[object Boolean]`,f=`[object Date]`,p=`[object Error]`,m=`[object Function]`,h=`[object GeneratorFunction]`,g=`[object Map]`,_=`[object Number]`,v=`[object Object]`,y=`[object Promise]`,b=`[object RegExp]`,x=`[object Set]`,S=`[object String]`,C=`[object Symbol]`,w=`[object WeakMap]`,T=`[object ArrayBuffer]`,E=`[object DataView]`,D=`[object Float32Array]`,O=`[object Float64Array]`,k=`[object Int8Array]`,A=`[object Int16Array]`,ee=`[object Int32Array]`,j=`[object Uint8Array]`,M=`[object Uint8ClampedArray]`,N=`[object Uint16Array]`,P=`[object Uint32Array]`,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,I=/^\./,L=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,R=/\\(\\)?/g,z=/^\[object .+?Constructor\]$/,re=/^(?:0|[1-9]\d*)$/,B={};B[D]=B[O]=B[k]=B[A]=B[ee]=B[j]=B[M]=B[N]=B[P]=!0,B[l]=B[u]=B[T]=B[d]=B[E]=B[f]=B[p]=B[m]=B[g]=B[_]=B[v]=B[b]=B[x]=B[S]=B[w]=!1;var V=typeof global==`object`&&global&&global.Object===Object&&global,ie=typeof self==`object`&&self&&self.Object===Object&&self,H=V||ie||Function(`return this`)(),U=typeof e==`object`&&e&&!e.nodeType&&e,ae=U&&typeof t==`object`&&t&&!t.nodeType&&t,W=ae&&ae.exports===U&&V.process,G=function(){try{return W&&W.binding(`util`)}catch{}}(),oe=G&&G.isTypedArray;function K(e,t,n,r){for(var i=-1,a=e?e.length:0;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function se(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}function ce(e){return function(t){return t?.[e]}}function le(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function q(e){return function(t){return e(t)}}function ue(e,t){return e?.[t]}function de(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function fe(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function pe(e,t){return function(n){return e(t(n))}}function me(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var he=Array.prototype,ge=Function.prototype,J=Object.prototype,Y=H[`__core-js_shared__`],_e=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),X=ge.toString,Z=J.hasOwnProperty,ve=J.toString,ye=RegExp(`^`+X.call(Z).replace(ne,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),be=H.Symbol,xe=H.Uint8Array,Se=J.propertyIsEnumerable,Ce=he.splice,we=pe(Object.keys,Object),Te=Bt(H,`DataView`),Ee=Bt(H,`Map`),De=Bt(H,`Promise`),Oe=Bt(H,`Set`),ke=Bt(H,`WeakMap`),Ae=Bt(Object,`create`),je=Qt(Te),Me=Qt(Ee),Ne=Qt(De),Pe=Qt(Oe),Fe=Qt(ke),Ie=be?be.prototype:void 0,Le=Ie?Ie.valueOf:void 0,Q=Ie?Ie.toString:void 0;function Re(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ze(){this.__data__=Ae?Ae(null):{}}function Be(e){return this.has(e)&&delete this.__data__[e]}function Ve(e){var t=this.__data__;if(Ae){var n=t[e];return n===i?void 0:n}return Z.call(t,e)?t[e]:void 0}function He(e){var t=this.__data__;return Ae?t[e]!==void 0:Z.call(t,e)}function Ue(e,t){var n=this.__data__;return n[e]=Ae&&t===void 0?i:t,this}Re.prototype.clear=ze,Re.prototype.delete=Be,Re.prototype.get=Ve,Re.prototype.has=He,Re.prototype.set=Ue;function We(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ge(){this.__data__=[]}function Ke(e){var t=this.__data__,n=ft(t,e);return n<0?!1:(n==t.length-1?t.pop():Ce.call(t,n,1),!0)}function qe(e){var t=this.__data__,n=ft(t,e);return n<0?void 0:t[n][1]}function Je(e){return ft(this.__data__,e)>-1}function Ye(e,t){var n=this.__data__,r=ft(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}We.prototype.clear=Ge,We.prototype.delete=Ke,We.prototype.get=qe,We.prototype.has=Je,We.prototype.set=Ye;function Xe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ze(){this.__data__={hash:new Re,map:new(Ee||We),string:new Re}}function Qe(e){return Rt(this,e).delete(e)}function $e(e){return Rt(this,e).get(e)}function et(e){return Rt(this,e).has(e)}function tt(e,t){return Rt(this,e).set(e,t),this}Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=$e,Xe.prototype.has=et,Xe.prototype.set=tt;function nt(e){var t=-1,n=e?e.length:0;for(this.__data__=new Xe;++t<n;)this.add(e[t])}function rt(e){return this.__data__.set(e,i),this}function it(e){return this.__data__.has(e)}nt.prototype.add=nt.prototype.push=rt,nt.prototype.has=it;function at(e){this.__data__=new We(e)}function ot(){this.__data__=new We}function st(e){return this.__data__.delete(e)}function ct(e){return this.__data__.get(e)}function lt(e){return this.__data__.has(e)}function ut(e,t){var r=this.__data__;if(r instanceof We){var i=r.__data__;if(!Ee||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Xe(i)}return r.set(e,t),this}at.prototype.clear=ot,at.prototype.delete=st,at.prototype.get=ct,at.prototype.has=lt,at.prototype.set=ut;function dt(e,t){var n=rn(e)||nn(e)?le(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||Z.call(e,a))&&!(i&&(a==`length`||Ut(a,r)))&&n.push(a);return n}function ft(e,t){for(var n=e.length;n--;)if(tn(e[n][0],t))return n;return-1}function pt(e,t,n,r){return mt(e,function(e,i,a){t(r,e,n(e),a)}),r}var mt=Nt(gt),ht=Pt();function gt(e,t){return e&&ht(e,t,gn)}function _t(e,t){t=Wt(t,e)?[t]:jt(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Zt(t[n++])];return n&&n==r?e:void 0}function vt(e){return ve.call(e)}function yt(e,t){return e!=null&&t in Object(e)}function bt(e,t,n,r,i){return e===t?!0:e==null||t==null||!ln(e)&&!un(t)?e!==e&&t!==t:xt(e,t,bt,n,r,i)}function xt(e,t,n,r,i,a){var s=rn(e),c=rn(t),d=u,f=u;s||(d=Vt(e),d=d==l?v:d),c||(f=Vt(t),f=f==l?v:f);var p=d==v&&!de(e),m=f==v&&!de(t),h=d==f;if(h&&!p)return a||=new at,s||fn(e)?Ft(e,t,n,r,i,a):It(e,t,d,n,r,i,a);if(!(i&o)){var g=p&&Z.call(e,`__wrapped__`),_=m&&Z.call(t,`__wrapped__`);if(g||_){var y=g?e.value():e,b=_?t.value():t;return a||=new at,n(y,b,r,i,a)}}return h?(a||=new at,Lt(e,t,n,r,i,a)):!1}function St(e,t,n,r){var i=n.length,s=i,c=!r;if(e==null)return!s;for(e=Object(e);i--;){var l=n[i];if(c&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){l=n[i];var u=l[0],d=e[u],f=l[1];if(c&&l[2]){if(d===void 0&&!(u in e))return!1}else{var p=new at;if(r)var m=r(d,f,u,e,t,p);if(!(m===void 0?bt(f,d,r,a|o,p):m))return!1}}return!0}function Ct(e){return!ln(e)||Kt(e)?!1:(sn(e)||de(e)?ye:z).test(Qt(e))}function wt(e){return un(e)&&cn(e.length)&&!!B[ve.call(e)]}function Tt(e){return typeof e==`function`?e:e==null?_n:typeof e==`object`?rn(e)?Ot(e[0],e[1]):Dt(e):vn(e)}function Et(e){if(!qt(e))return we(e);var t=[];for(var n in Object(e))Z.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Dt(e){var t=zt(e);return t.length==1&&t[0][2]?Yt(t[0][0],t[0][1]):function(n){return n===e||St(n,e,t)}}function Ot(e,t){return Wt(e)&&Jt(t)?Yt(Zt(e),t):function(n){var r=mn(n,e);return r===void 0&&r===t?hn(n,e):bt(t,r,void 0,a|o)}}function kt(e){return function(t){return _t(t,e)}}function At(e){if(typeof e==`string`)return e;if(dn(e))return Q?Q.call(e):``;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}function jt(e){return rn(e)?e:Xt(e)}function Mt(e,t){return function(n,r){var i=rn(n)?K:pt,a=t?t():{};return i(n,e,Tt(r,2),a)}}function Nt(e,t){return function(n,r){if(n==null)return n;if(!an(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}function Pt(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function Ft(e,t,n,r,i,s){var c=i&o,l=e.length,u=t.length;if(l!=u&&!(c&&u>l))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var f=-1,p=!0,m=i&a?new nt:void 0;for(s.set(e,t),s.set(t,e);++f<l;){var h=e[f],g=t[f];if(r)var _=c?r(g,h,f,t,e,s):r(h,g,f,e,t,s);if(_!==void 0){if(_)continue;p=!1;break}if(m){if(!se(t,function(e,t){if(!m.has(t)&&(h===e||n(h,e,r,i,s)))return m.add(t)})){p=!1;break}}else if(!(h===g||n(h,g,r,i,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function It(e,t,n,r,i,s,c){switch(n){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!r(new xe(e),new xe(t)));case d:case f:case _:return tn(+e,+t);case p:return e.name==t.name&&e.message==t.message;case b:case S:return e==t+``;case g:var l=fe;case x:var u=s&o;if(l||=me,e.size!=t.size&&!u)return!1;var m=c.get(e);if(m)return m==t;s|=a,c.set(e,t);var h=Ft(l(e),l(t),r,i,s,c);return c.delete(e),h;case C:if(Le)return Le.call(e)==Le.call(t)}return!1}function Lt(e,t,n,r,i,a){var s=i&o,c=gn(e),l=c.length;if(l!=gn(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:Z.call(t,d)))return!1}var f=a.get(e);if(f&&a.get(t))return f==t;var p=!0;a.set(e,t),a.set(t,e);for(var m=s;++u<l;){d=c[u];var h=e[d],g=t[d];if(r)var _=s?r(g,h,d,t,e,a):r(h,g,d,e,t,a);if(!(_===void 0?h===g||n(h,g,r,i,a):_)){p=!1;break}m||=d==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}function Rt(e,t){var n=e.__data__;return Gt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function zt(e){for(var t=gn(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Jt(i)]}return t}function Bt(e,t){var n=ue(e,t);return Ct(n)?n:void 0}var Vt=vt;(Te&&Vt(new Te(new ArrayBuffer(1)))!=E||Ee&&Vt(new Ee)!=g||De&&Vt(De.resolve())!=y||Oe&&Vt(new Oe)!=x||ke&&Vt(new ke)!=w)&&(Vt=function(e){var t=ve.call(e),n=t==v?e.constructor:void 0,r=n?Qt(n):void 0;if(r)switch(r){case je:return E;case Me:return g;case Ne:return y;case Pe:return x;case Fe:return w}return t});function Ht(e,t,n){t=Wt(t,e)?[t]:jt(t);for(var r,i=-1,a=t.length;++i<a;){var o=Zt(t[i]);if(!(r=e!=null&&n(e,o)))break;e=e[o]}if(r)return r;var a=e?e.length:0;return!!a&&cn(a)&&Ut(o,a)&&(rn(e)||nn(e))}function Ut(e,t){return t??=c,!!t&&(typeof e==`number`||re.test(e))&&e>-1&&e%1==0&&e<t}function Wt(e,t){if(rn(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||dn(e)?!0:te.test(e)||!F.test(e)||t!=null&&e in Object(t)}function Gt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Kt(e){return!!_e&&_e in e}function qt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||J)}function Jt(e){return e===e&&!ln(e)}function Yt(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Xt=en(function(e){e=pn(e);var t=[];return I.test(e)&&t.push(``),e.replace(L,function(e,n,r,i){t.push(r?i.replace(R,`$1`):n||e)}),t});function Zt(e){if(typeof e==`string`||dn(e))return e;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}function Qt(e){if(e!=null){try{return X.call(e)}catch{}try{return e+``}catch{}}return``}var $t=Mt(function(e,t,n){Z.call(e,n)?e[n].push(t):e[n]=[t]});function en(e,t){if(typeof e!=`function`||t&&typeof t!=`function`)throw TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o),o};return n.cache=new(en.Cache||Xe),n}en.Cache=Xe;function tn(e,t){return e===t||e!==e&&t!==t}function nn(e){return on(e)&&Z.call(e,`callee`)&&(!Se.call(e,`callee`)||ve.call(e)==l)}var rn=Array.isArray;function an(e){return e!=null&&cn(e.length)&&!sn(e)}function on(e){return un(e)&&an(e)}function sn(e){var t=ln(e)?ve.call(e):``;return t==m||t==h}function cn(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=c}function ln(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function un(e){return!!e&&typeof e==`object`}function dn(e){return typeof e==`symbol`||un(e)&&ve.call(e)==C}var fn=oe?q(oe):wt;function pn(e){return e==null?``:At(e)}function mn(e,t,n){var r=e==null?void 0:_t(e,t);return r===void 0?n:r}function hn(e,t){return e!=null&&Ht(e,t,yt)}function gn(e){return an(e)?dt(e):Et(e)}function _n(e){return e}function vn(e){return Wt(e)?ce(Zt(e)):kt(e)}t.exports=$t})),Ru=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.HeaderTransformer=void 0;let n=t(Fu()),r=t(Su()),i=t(Iu()),a=t(Lu());e.HeaderTransformer=class{parserOptions;headers=null;receivedHeaders=!1;shouldUseFirstRow=!1;processedFirstRow=!1;headersLength=0;headersTransform;constructor(e){this.parserOptions=e,e.headers===!0?this.shouldUseFirstRow=!0:Array.isArray(e.headers)?this.setHeaders(e.headers):(0,r.default)(e.headers)&&(this.headersTransform=e.headers)}transform(e,t){return this.shouldMapRow(e)?t(null,this.processRow(e)):t(null,{row:null,isValid:!0})}shouldMapRow(e){let{parserOptions:t}=this;if(!this.headersTransform&&t.renameHeaders&&!this.processedFirstRow){if(!this.receivedHeaders)throw Error(`Error renaming headers: new headers must be provided in an array`);return this.processedFirstRow=!0,!1}if(!this.receivedHeaders&&Array.isArray(e)){if(this.headersTransform)this.setHeaders(this.headersTransform(e));else if(this.shouldUseFirstRow)this.setHeaders(e);else return!0;return!1}return!0}processRow(e){if(!this.headers)return{row:e,isValid:!0};let{parserOptions:t}=this;if(!t.discardUnmappedColumns&&e.length>this.headersLength){if(!t.strictColumnHandling)throw Error(`Unexpected Error: column header mismatch expected: ${this.headersLength} columns got: ${e.length}`);return{row:e,isValid:!1,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}}return t.strictColumnHandling&&e.length<this.headersLength?{row:e,isValid:!1,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}:{row:this.mapHeaders(e),isValid:!0}}mapHeaders(e){let t={},{headers:r,headersLength:i}=this;for(let a=0;a<i;a+=1){let i=r[a];if(!(0,n.default)(i)){let r=e[a];(0,n.default)(r)?t[i]=``:t[i]=r}}return t}setHeaders(e){let t=e.filter(e=>!!e);if((0,i.default)(t).length!==t.length){let e=(0,a.default)(t),n=Object.keys(e).filter(t=>e[t].length>1);throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}this.headers=e,this.receivedHeaders=!0,this.headersLength=this.headers?.length||0}}})),zu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HeaderTransformer=e.RowTransformerValidator=void 0;var t=Pu();Object.defineProperty(e,`RowTransformerValidator`,{enumerable:!0,get:function(){return t.RowTransformerValidator}});var n=Ru();Object.defineProperty(e,`HeaderTransformer`,{enumerable:!0,get:function(){return n.HeaderTransformer}})})),Bu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Token=void 0,e.Token=class{static isTokenRowDelimiter(e){let t=e.token;return t===`\r`||t===`
108
+ `}var ru=class extends ${constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Is,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}}},iu=class e extends ${constructor(){super(),this.map={comment:new ru},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml($o.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`}}},au=class extends ${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}}},ou=class extends ${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}},su=class extends ${constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model&&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}},cu=class extends ${constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model&&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 lu=[`twoCells`,`oneCells`,`absolute`];var uu=class extends ${constructor(){super(),this.map={"x:Anchor":new ou,"x:Locked":new su({tag:`x:Locked`}),"x:LockText":new su({tag:`x:LockText`}),"x:SizeWithCells":new cu({tag:`x:SizeWithCells`}),"x:MoveWithCells":new cu({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,lu),this.map[`x:SizeWithCells`].render(e,r,lu),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=lu[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}},du=class e extends ${constructor(){super(),this.map={"v:textbox":new au,"x:ClientData":new uu}}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})}},fu=class e extends ${constructor(){super(),this.map={"v:shape":new du},this.model={comments:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model;t.openXml($o.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(),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(),r.comments.forEach((e,n)=>{this.map[`v:shape`].render(t,e,n)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[]};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}}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:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},pu=q();Ji();var mu=sn();function hu(e,t){return new Promise((n,r)=>{qi.readFile(e,t,(e,t)=>{e?r(e):n(t)})})}var gu=class e{constructor(e){this.workbook=e}async readFile(e,t){if(!await ia(e))throw Error(`File not found: ${e}`);let n=qi.createReadStream(e);try{let e=await this.read(n,t);return n.close(),e}catch(e){throw n.close(),e}}parseRels(e){return new Vs().parseStream(e)}parseWorkbook(e){return new ec().parseStream(e)}parseSharedStrings(e){return new zs().parseStream(e)}reconcile(e,t){let n=new ec,r=new El(t),i=new Ul,a=new Xl;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};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))});let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)});let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings};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,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings}async _processWorksheetEntry(e,t,n,r,i){let a=await new El(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 iu().parseStream(e);t.comments[`../${n}.xml`]=r}async _processTableEntry(e,t,n){let r=await new Xl().parseStream(e);t.tables[`../tables/${n}.xml`]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new Vs().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=new Jo,c=()=>{e.removeListener(`error`,u),s.removeListener(`error`,u),s.removeListener(`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.toBuffer()};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){let r=await new Ul().parseStream(e);t.drawings[n]=r}async _processDrawingRelsEntry(e,t,n){let r=await new Vs().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new fu().parseStream(e);t.vmlDrawings[`../drawings/${n}.vml`]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=new Jo,o=()=>{e.removeListener(`error`,c),a.removeListener(`error`,c),a.removeListener(`finish`,s)},s=()=>{o(),t.themes[n]=a.read().toString(),r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async read(e,t){let n={};return await new Promise((t,r)=>{let i=0,a=!1,o=0,s=()=>{e.removeListener(`data`,u),e.removeListener(`end`,d),e.removeListener(`error`,f)},c=()=>{a&&i===o&&(s(),t())},l=new Ro(e=>{o++;let t=[],a=0;e.ondata=(o,l,u)=>{if(o){s(),r(o);return}if(l&&(t.push(l),a+=l.length),u){if(t.length===1)n[e.name]=t[0];else if(t.length>1){let r=new Uint8Array(a),i=0;for(let e of t)r.set(e,i),i+=e.length;n[e.name]=r}else n[e.name]=new Uint8Array;i++,t.length=0,c()}},e.start()});l.register(Lo);let u=e=>{l.push(e)},d=()=>{l.push(new Uint8Array,!0),a=!0,c()},f=e=>{s(),r(e)};e.on(`data`,u),e.on(`end`,d),e.on(`error`,f)}),this.loadFromFiles(n,t)}async load(e,t){let n;if(!e||typeof e==`object`&&!pu.Buffer.isBuffer(e)&&!(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) ?`);n=t&&t.base64?pu.Buffer.from(e.toString(),`base64`):e;let r=new mu.PassThrough;return r.end(n),this.read(r,t)}async loadFromFiles(e,t){let n={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{}},r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=e.name;r[0]===`/`&&(r=r.substr(1));let i;if(r.match(/xl\/media\//)||r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/))i=new mu.PassThrough,i.end(pu.Buffer.from(e.data));else{i=new mu.PassThrough({readableObjectMode:!0,writableObjectMode:!0});let t=ua(pu.Buffer.from(e.data));i.end(t)}let a;if(a=r.match(/xl\/worksheets\/sheet(\d+)[.]xml/),a){let e=parseInt(a[1],10);await this._processWorksheetEntry(i,n,e,t,r)}else switch(r){case`_rels/.rels`:n.globalRels=await this.parseRels(i);break;case`xl/workbook.xml`:{let e=await this.parseWorkbook(i);n.sheets=e.sheets,n.definedNames=e.definedNames,n.views=e.views,n.properties=e.properties,n.calcProperties=e.calcProperties;break}case`xl/sharedStrings.xml`:n.sharedStrings=new zs,await n.sharedStrings.parseStream(i);break;case`xl/_rels/workbook.xml.rels`:n.workbookRels=await this.parseRels(i);break;case`docProps/app.xml`:{let e=await new Gs().parseStream(i);n.company=e.company,n.manager=e.manager;break}case`docProps/core.xml`:{let e=await new Ps().parseStream(i);Object.assign(n,e);break}case`xl/styles.xml`:n.styles=new Ms,await n.styles.parseStream(i);break;default:if(a=r.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels/),a){let e=parseInt(a[1],10);await this._processWorksheetRelsEntry(i,n,e);break}if(a=r.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),a){await this._processMediaEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/(drawing\d+)[.]xml/),a){await this._processDrawingEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels/),a){await this._processDrawingRelsEntry(i,n,a[1]);break}if(a=r.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),a){await this._processVmlDrawingEntry(i,n,a[1]);break}if(a=r.match(/xl\/comments(\d+)[.]xml/),a){await this._processCommentEntry(i,n,`comments${a[1]}`);break}if(a=r.match(/xl\/tables\/(table\d+)[.]xml/),a){await this._processTableEntry(i,n,a[1]);break}if(a=r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),a){await this._processThemeEntry(i,n,a[1]);break}}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async addContentTypes(e,t){let n=new Hs().toXml(t);e.append(n,{name:`[Content_Types].xml`})}async addApp(e,t){let n=new Gs().toXml(t);e.append(n,{name:`docProps/app.xml`})}async addCore(e,t){let n=new Ps;e.append(n.toXml(t),{name:`docProps/core.xml`})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
109
+ <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],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new Vs().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];if(n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).length){let t=n.pivotTables[0];t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition1.xml`})}n.worksheets.forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.id}.xml`})});let a=new Vs().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new ec;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new El,r=new Vs,i=new iu,a=new fu;t.worksheets.forEach(t=>{let o=new $o;n.render(o,t),e.append(o.xml,{name:`xl/worksheets/sheet${t.id}.xml`}),t.rels&&t.rels.length&&(o=new $o,r.render(o,t.rels),e.append(o.xml,{name:`xl/worksheets/_rels/sheet${t.id}.xml.rels`})),t.comments.length>0&&(o=new $o,i.render(o,t),e.append(o.xml,{name:`xl/comments${t.id}.xml`}),o=new $o,a.render(o,t),e.append(o.xml,{name:`xl/drawings/vmlDrawing${t.id}.vml`}))})}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.filename){let r=await hu(t.filename);return e.append(r,{name:n})}if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}}throw Error(`Unsupported media`)}))}addDrawings(e,t){let n=new Ul,r=new Vs;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new Xl;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=n.pivotTables[0],i=new Zl,a=new $l,o=new eu,s=new Vs,c=i.toXml(r);t.append(c,{name:`xl/pivotCache/pivotCacheRecords1.xml`}),c=a.toXml(r),t.append(c,{name:`xl/pivotCache/pivotCacheDefinition1.xml`}),c=s.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords1.xml`}]),t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition1.xml.rels`}),c=o.toXml(r),t.append(c,{name:`xl/pivotTables/pivotTable1.xml`}),c=s.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition1.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable1.xml.rels`})}_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 zs,e.styles=e.useStyles?new Ms(!0):new Ms.Mock;let n=new ec,r=new El;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}async write(e,t){t||={};let{model:n}=this.workbook,r=new Xo(t.zip);return r.pipe(e),this.prepareModel(n,t),await this.addContentTypes(r,n),await this.addOfficeRels(r,n),await this.addWorkbookRels(r,n),await this.addWorksheets(r,n),await this.addSharedStrings(r,n),this.addDrawings(r,n),this.addTables(r,n),this.addPivotTables(r,n),await Promise.all([this.addThemes(r,n),this.addStyles(r,n)]),await this.addMedia(r,n),await Promise.all([this.addApp(r,n),this.addCore(r,n)]),await this.addWorkbook(r,n),this._finalize(r)}writeFile(e,t){let n=qi.createWriteStream(e);return new Promise((e,r)=>{let i=()=>{n.removeListener(`finish`,a),n.removeListener(`error`,o)},a=()=>{i(),e()},o=e=>{i(),r(e)};n.once(`finish`,a),n.on(`error`,o),this.write(n,t).then(()=>{n.end()}).catch(e=>{i(),r(e)})})}async writeBuffer(e){let t=new Jo;return await this.write(t,e),t.read()}static{this.RelType=tc}},_u=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FormatterOptions=void 0,e.FormatterOptions=class{objectMode=!0;delimiter=`,`;rowDelimiter=`
110
+ `;quote=`"`;escape=this.quote;quoteColumns=!1;quoteHeaders=this.quoteColumns;headers=null;includeEndRowDelimiter=!1;transform;shouldWriteHeaders;writeBOM=!1;escapedQuote;BOM=``;alwaysWriteHeaders=!1;constructor(e={}){Object.assign(this,e||{}),e?.quoteHeaders===void 0&&(this.quoteHeaders=this.quoteColumns),e?.quote===!0?this.quote=`"`:e?.quote===!1&&(this.quote=``),typeof e?.escape!=`string`&&(this.escape=this.quote),this.shouldWriteHeaders=!!this.headers&&(e.writeHeaders??!0),this.headers=Array.isArray(this.headers)?this.headers:null,this.escapedQuote=`${this.escape}${this.quote}`}}})),vu=c(((e,t)=>{var n=`[object AsyncFunction]`,r=`[object Function]`,i=`[object GeneratorFunction]`,a=`[object Null]`,o=`[object Proxy]`,s=`[object Undefined]`,c=typeof global==`object`&&global&&global.Object===Object&&global,l=typeof self==`object`&&self&&self.Object===Object&&self,u=c||l||Function(`return this`)(),d=Object.prototype,f=d.hasOwnProperty,p=d.toString,m=u.Symbol,h=m?m.toStringTag:void 0;function g(e){return e==null?e===void 0?s:a:h&&h in Object(e)?_(e):v(e)}function _(e){var t=f.call(e,h),n=e[h];try{e[h]=void 0;var r=!0}catch{}var i=p.call(e);return r&&(t?e[h]=n:delete e[h]),i}function v(e){return p.call(e)}function y(e){if(!b(e))return!1;var t=g(e);return t==r||t==i||t==n||t==o}function b(e){var t=typeof e;return e!=null&&(t==`object`||t==`function`)}t.exports=y})),yu=c(((e,t)=>{var n=`[object Boolean]`,r=Object.prototype.toString;function i(e){return e===!0||e===!1||a(e)&&r.call(e)==n}function a(e){return!!e&&typeof e==`object`}t.exports=i})),bu=c(((e,t)=>{function n(e){return e==null}t.exports=n})),xu=c(((e,t)=>{var n=1/0,r=`[object Symbol]`,i=/[\\^$.*+?()[\]{}|]/g,a=RegExp(i.source),o=typeof global==`object`&&global&&global.Object===Object&&global,s=typeof self==`object`&&self&&self.Object===Object&&self,c=o||s||Function(`return this`)(),l=Object.prototype.toString,u=c.Symbol,d=u?u.prototype:void 0,f=d?d.toString:void 0;function p(e){if(typeof e==`string`)return e;if(h(e))return f?f.call(e):``;var t=e+``;return t==`0`&&1/e==-n?`-0`:t}function m(e){return!!e&&typeof e==`object`}function h(e){return typeof e==`symbol`||m(e)&&l.call(e)==r}function g(e){return e==null?``:p(e)}function _(e){return e=g(e),e&&a.test(e)?e.replace(i,`\\$&`):e}t.exports=_})),Su=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.FieldFormatter=void 0;let n=t(yu()),r=t(bu()),i=t(xu());e.FieldFormatter=class{formatterOptions;_headers=null;REPLACE_REGEXP;ESCAPE_REGEXP;constructor(e){this.formatterOptions=e,e.headers!==null&&(this.headers=e.headers),this.REPLACE_REGEXP=new RegExp(e.quote,`g`);let t=`[${e.delimiter}${(0,i.default)(e.rowDelimiter)}|\r|\n]`;this.ESCAPE_REGEXP=new RegExp(t)}set headers(e){this._headers=e}shouldQuote(e,t){let r=t?this.formatterOptions.quoteHeaders:this.formatterOptions.quoteColumns;return(0,n.default)(r)?r:Array.isArray(r)?r[e]:this._headers===null?!1:r[this._headers[e]]}format(e,t,n){let i=`${(0,r.default)(e)?``:e}`.replace(/\0/g,``),{formatterOptions:a}=this;return a.quote!==``&&i.indexOf(a.quote)!==-1?this.quoteField(i.replace(this.REPLACE_REGEXP,a.escapedQuote)):i.search(this.ESCAPE_REGEXP)!==-1||this.shouldQuote(t,n)?this.quoteField(i):i}quoteField(e){let{quote:t}=this.formatterOptions;return`${t}${e}${t}`}}})),Cu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isSyncTransform=void 0,e.isSyncTransform=e=>e.length===1})),wu=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.RowFormatter=void 0;let n=t(vu()),r=Su(),i=Cu();e.RowFormatter=class e{static isRowHashArray(e){return Array.isArray(e)?Array.isArray(e[0])&&e[0].length===2:!1}static isRowArray(e){return Array.isArray(e)&&!this.isRowHashArray(e)}static gatherHeaders(t){return e.isRowHashArray(t)?t.map(e=>e[0]):Array.isArray(t)?t:Object.keys(t)}static createTransform(e){return(0,i.isSyncTransform)(e)?(t,n)=>{let r=null;try{r=e(t)}catch(e){return n(e)}return n(null,r)}:(t,n)=>{e(t,n)}}formatterOptions;fieldFormatter;shouldWriteHeaders;_rowTransform;headers;hasWrittenHeaders;rowCount=0;constructor(e){this.formatterOptions=e,this.fieldFormatter=new r.FieldFormatter(e),this.headers=e.headers,this.shouldWriteHeaders=e.shouldWriteHeaders,this.hasWrittenHeaders=!1,this.headers!==null&&(this.fieldFormatter.headers=this.headers),e.transform&&(this.rowTransform=e.transform)}set rowTransform(t){if(!(0,n.default)(t))throw TypeError(`The transform should be a function`);this._rowTransform=e.createTransform(t)}format(e,t){this.callTransformer(e,(n,r)=>{if(n)return t(n);if(!e)return t(null);let i=[];if(r){let{shouldFormatColumns:e,headers:t}=this.checkHeaders(r);if(this.shouldWriteHeaders&&t&&!this.hasWrittenHeaders&&(i.push(this.formatColumns(t,!0)),this.hasWrittenHeaders=!0),e){let e=this.gatherColumns(r);i.push(this.formatColumns(e,!1))}}return t(null,i)})}finish(e){let t=[];if(this.formatterOptions.alwaysWriteHeaders&&this.rowCount===0){if(!this.headers)return e(Error("`alwaysWriteHeaders` option is set to true but `headers` option not provided."));t.push(this.formatColumns(this.headers,!0))}return this.formatterOptions.includeEndRowDelimiter&&t.push(this.formatterOptions.rowDelimiter),e(null,t)}checkHeaders(t){if(this.headers)return{shouldFormatColumns:!0,headers:this.headers};let n=e.gatherHeaders(t);return this.headers=n,this.fieldFormatter.headers=n,this.shouldWriteHeaders?Array.isArray(t)&&n.every((e,n)=>e===t[n])?{shouldFormatColumns:!1,headers:n}:{shouldFormatColumns:!0,headers:n}:{shouldFormatColumns:!0,headers:null}}gatherColumns(t){if(this.headers===null)throw Error(`Headers is currently null`);return Array.isArray(t)?e.isRowHashArray(t)?this.headers.map((e,n)=>{let r=t[n];return r?r[1]:``}):e.isRowArray(t)&&!this.shouldWriteHeaders?t:this.headers.map((e,n)=>t[n]):this.headers.map(e=>t[e])}callTransformer(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}formatColumns(e,t){let n=e.map((e,n)=>this.fieldFormatter.format(e,n,t)).join(this.formatterOptions.delimiter),{rowCount:r}=this;return this.rowCount+=1,r?[this.formatterOptions.rowDelimiter,n].join(``):n}}})),Tu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.FieldFormatter=e.RowFormatter=void 0;var t=wu();Object.defineProperty(e,`RowFormatter`,{enumerable:!0,get:function(){return t.RowFormatter}});var n=Su();Object.defineProperty(e,`FieldFormatter`,{enumerable:!0,get:function(){return n.FieldFormatter}})})),Eu=c((e=>{var t=q();Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvFormatterStream=void 0;let n=sn(),r=Tu();e.CsvFormatterStream=class extends n.Transform{formatterOptions;rowFormatter;hasWrittenBOM=!1;constructor(e){super({writableObjectMode:e.objectMode}),this.formatterOptions=e,this.rowFormatter=new r.RowFormatter(e),this.hasWrittenBOM=!e.writeBOM}transform(e){return this.rowFormatter.rowTransform=e,this}_transform(e,n,r){let i=!1;try{this.hasWrittenBOM||=(this.push(this.formatterOptions.BOM),!0),this.rowFormatter.format(e,(e,n)=>e?(i=!0,r(e)):(n&&n.forEach(e=>{this.push(t.Buffer.from(e,`utf8`))}),i=!0,r()))}catch(e){if(i)throw e;r(e)}}_flush(e){this.rowFormatter.finish((n,r)=>n?e(n):(r&&r.forEach(e=>{this.push(t.Buffer.from(e,`utf8`))}),e()))}}})),Du=c((e=>{var t=q(),n=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),r=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),i=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var t={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&n(t,e,i);return r(t,e),t},a=e&&e.__exportStar||function(e,t){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(t,r)&&n(t,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.writeToPath=e.writeToString=e.writeToBuffer=e.writeToStream=e.write=e.format=e.FormatterOptions=e.CsvFormatterStream=void 0;let o=Wt(),s=sn(),c=i((Ji(),f(Ki))),l=_u(),u=Eu();a(Cu(),e);var d=Eu();Object.defineProperty(e,`CsvFormatterStream`,{enumerable:!0,get:function(){return d.CsvFormatterStream}});var p=_u();Object.defineProperty(e,`FormatterOptions`,{enumerable:!0,get:function(){return p.FormatterOptions}}),e.format=e=>new u.CsvFormatterStream(new l.FormatterOptions(e)),e.write=(t,n)=>{let r=(0,e.format)(n),i=(0,o.promisify)((e,t)=>{r.write(e,void 0,t)});return t.reduce((e,t)=>e.then(()=>i(t)),Promise.resolve()).then(()=>{r.end()}).catch(e=>{r.emit(`error`,e)}),r},e.writeToStream=(t,n,r)=>(0,e.write)(n,r).pipe(t),e.writeToBuffer=(n,r={})=>{let i=[],a=new s.Writable({write(e,t,n){i.push(e),n()}});return new Promise((o,s)=>{a.on(`error`,s).on(`finish`,()=>o(t.Buffer.concat(i))),(0,e.write)(n,r).pipe(a)})},e.writeToString=(t,n)=>(0,e.writeToBuffer)(t,n).then(e=>e.toString()),e.writeToPath=(t,n,r)=>{let i=c.createWriteStream(t,{encoding:`utf8`});return(0,e.write)(n,r).pipe(i)}})),Ou=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.ParserOptions=void 0;let n=t(xu()),r=t(bu());e.ParserOptions=class{escapedDelimiter;objectMode=!0;delimiter=`,`;ignoreEmpty=!1;quote=`"`;escape=null;escapeChar=this.quote;comment=null;supportsComments=!1;ltrim=!1;rtrim=!1;trim=!1;headers=null;renameHeaders=!1;strictColumnHandling=!1;discardUnmappedColumns=!1;carriageReturn=`\r`;NEXT_TOKEN_REGEXP;encoding=`utf8`;limitRows=!1;maxRows=0;skipLines=0;skipRows=0;constructor(e){if(Object.assign(this,e||{}),this.delimiter.length>1)throw Error(`delimiter option must be one character long`);this.escapedDelimiter=(0,n.default)(this.delimiter),this.escapeChar=this.escape??this.quote,this.supportsComments=!(0,r.default)(this.comment),this.NEXT_TOKEN_REGEXP=RegExp(`([^\\s]|\\r\\n|\\n|\\r|${this.escapedDelimiter})`),this.maxRows>0&&(this.limitRows=!0)}}})),ku=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.isSyncValidate=e.isSyncTransform=void 0,e.isSyncTransform=e=>e.length===1,e.isSyncValidate=e=>e.length===1})),Au=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.RowTransformerValidator=void 0;let n=t(vu()),r=ku();e.RowTransformerValidator=class e{static createTransform(e){return(0,r.isSyncTransform)(e)?(t,n)=>{let r=null;try{r=e(t)}catch(e){return n(e)}return n(null,r)}:e}static createValidator(e){return(0,r.isSyncValidate)(e)?(t,n)=>{n(null,{row:t,isValid:e(t)})}:(t,n)=>{e(t,(e,r,i)=>e?n(e):r?n(null,{row:t,isValid:r,reason:i}):n(null,{row:t,isValid:!1,reason:i}))}}_rowTransform=null;_rowValidator=null;set rowTransform(t){if(!(0,n.default)(t))throw TypeError(`The transform should be a function`);this._rowTransform=e.createTransform(t)}set rowValidator(t){if(!(0,n.default)(t))throw TypeError(`The validate should be a function`);this._rowValidator=e.createValidator(t)}transformAndValidate(e,t){return this.callTransformer(e,(e,n)=>e?t(e):n?this.callValidator(n,(e,r)=>e?t(e):r&&!r.isValid?t(null,{row:n,isValid:!1,reason:r.reason}):t(null,{row:n,isValid:!0})):t(null,{row:null,isValid:!0}))}callTransformer(e,t){return this._rowTransform?this._rowTransform(e,t):t(null,e)}callValidator(e,t){return this._rowValidator?this._rowValidator(e,t):t(null,{row:e,isValid:!0})}}})),ju=c(((e,t)=>{function n(e){return e===void 0}t.exports=n})),Mu=c(((e,t)=>{var n=200,r=`__lodash_hash_undefined__`,i=1/0,a=`[object Function]`,o=`[object GeneratorFunction]`,s=/[\\^$.*+?()[\]{}|]/g,c=/^\[object .+?Constructor\]$/,l=typeof global==`object`&&global&&global.Object===Object&&global,u=typeof self==`object`&&self&&self.Object===Object&&self,d=l||u||Function(`return this`)();function f(e,t){return!!(e&&e.length)&&h(e,t,0)>-1}function p(e,t,n){for(var r=-1,i=e?e.length:0;++r<i;)if(n(t,e[r]))return!0;return!1}function m(e,t,n,r){for(var i=e.length,a=n+(r?1:-1);r?a--:++a<i;)if(t(e[a],a,e))return a;return-1}function h(e,t,n){if(t!==t)return m(e,g,n);for(var r=n-1,i=e.length;++r<i;)if(e[r]===t)return r;return-1}function g(e){return e!==e}function _(e,t){return e.has(t)}function v(e,t){return e?.[t]}function y(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function b(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var x=Array.prototype,S=Function.prototype,C=Object.prototype,w=d[`__core-js_shared__`],T=function(){var e=/[^.]+$/.exec(w&&w.keys&&w.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),E=S.toString,D=C.hasOwnProperty,O=C.toString,k=RegExp(`^`+E.call(D).replace(s,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),A=x.splice,ee=fe(d,`Map`),j=fe(d,`Set`),M=fe(Object,`create`);function N(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function P(){this.__data__=M?M(null):{}}function F(e){return this.has(e)&&delete this.__data__[e]}function te(e){var t=this.__data__;if(M){var n=t[e];return n===r?void 0:n}return D.call(t,e)?t[e]:void 0}function I(e){var t=this.__data__;return M?t[e]!==void 0:D.call(t,e)}function L(e,t){var n=this.__data__;return n[e]=M&&t===void 0?r:t,this}N.prototype.clear=P,N.prototype.delete=F,N.prototype.get=te,N.prototype.has=I,N.prototype.set=L;function ne(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function R(){this.__data__=[]}function z(e){var t=this.__data__,n=ce(t,e);return n<0?!1:(n==t.length-1?t.pop():A.call(t,n,1),!0)}function re(e){var t=this.__data__,n=ce(t,e);return n<0?void 0:t[n][1]}function B(e){return ce(this.__data__,e)>-1}function V(e,t){var n=this.__data__,r=ce(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}ne.prototype.clear=R,ne.prototype.delete=z,ne.prototype.get=re,ne.prototype.has=B,ne.prototype.set=V;function ie(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function H(){this.__data__={hash:new N,map:new(ee||ne),string:new N}}function U(e){return de(this,e).delete(e)}function ae(e){return de(this,e).get(e)}function W(e){return de(this,e).has(e)}function G(e,t){return de(this,e).set(e,t),this}ie.prototype.clear=H,ie.prototype.delete=U,ie.prototype.get=ae,ie.prototype.has=W,ie.prototype.set=G;function oe(e){var t=-1,n=e?e.length:0;for(this.__data__=new ie;++t<n;)this.add(e[t])}function K(e){return this.__data__.set(e,r),this}function se(e){return this.__data__.has(e)}oe.prototype.add=oe.prototype.push=K,oe.prototype.has=se;function ce(e,t){for(var n=e.length;n--;)if(J(e[n][0],t))return n;return-1}function le(e){return!_e(e)||me(e)?!1:(Y(e)||y(e)?k:c).test(he(e))}function q(e,t,r){var i=-1,a=f,o=e.length,s=!0,c=[],l=c;if(r)s=!1,a=p;else if(o>=n){var u=t?null:ue(e);if(u)return b(u);s=!1,a=_,l=new oe}else l=t?[]:c;outer:for(;++i<o;){var d=e[i],m=t?t(d):d;if(d=r||d!==0?d:0,s&&m===m){for(var h=l.length;h--;)if(l[h]===m)continue outer;t&&l.push(m),c.push(d)}else a(l,m,r)||(l!==c&&l.push(m),c.push(d))}return c}var ue=j&&1/b(new j([,-0]))[1]==i?function(e){return new j(e)}:X;function de(e,t){var n=e.__data__;return pe(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function fe(e,t){var n=v(e,t);return le(n)?n:void 0}function pe(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function me(e){return!!T&&T in e}function he(e){if(e!=null){try{return E.call(e)}catch{}try{return e+``}catch{}}return``}function ge(e){return e&&e.length?q(e):[]}function J(e,t){return e===t||e!==e&&t!==t}function Y(e){var t=_e(e)?O.call(e):``;return t==a||t==o}function _e(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function X(){}t.exports=ge})),Nu=c(((e,t)=>{var n=200,r=`Expected a function`,i=`__lodash_hash_undefined__`,a=1,o=2,s=1/0,c=9007199254740991,l=`[object Arguments]`,u=`[object Array]`,d=`[object Boolean]`,f=`[object Date]`,p=`[object Error]`,m=`[object Function]`,h=`[object GeneratorFunction]`,g=`[object Map]`,_=`[object Number]`,v=`[object Object]`,y=`[object Promise]`,b=`[object RegExp]`,x=`[object Set]`,S=`[object String]`,C=`[object Symbol]`,w=`[object WeakMap]`,T=`[object ArrayBuffer]`,E=`[object DataView]`,D=`[object Float32Array]`,O=`[object Float64Array]`,k=`[object Int8Array]`,A=`[object Int16Array]`,ee=`[object Int32Array]`,j=`[object Uint8Array]`,M=`[object Uint8ClampedArray]`,N=`[object Uint16Array]`,P=`[object Uint32Array]`,F=/\.|\[(?:[^[\]]*|(["'])(?:(?!\1)[^\\]|\\.)*?\1)\]/,te=/^\w*$/,I=/^\./,L=/[^.[\]]+|\[(?:(-?\d+(?:\.\d+)?)|(["'])((?:(?!\2)[^\\]|\\.)*?)\2)\]|(?=(?:\.|\[\])(?:\.|\[\]|$))/g,ne=/[\\^$.*+?()[\]{}|]/g,R=/\\(\\)?/g,z=/^\[object .+?Constructor\]$/,re=/^(?:0|[1-9]\d*)$/,B={};B[D]=B[O]=B[k]=B[A]=B[ee]=B[j]=B[M]=B[N]=B[P]=!0,B[l]=B[u]=B[T]=B[d]=B[E]=B[f]=B[p]=B[m]=B[g]=B[_]=B[v]=B[b]=B[x]=B[S]=B[w]=!1;var V=typeof global==`object`&&global&&global.Object===Object&&global,ie=typeof self==`object`&&self&&self.Object===Object&&self,H=V||ie||Function(`return this`)(),U=typeof e==`object`&&e&&!e.nodeType&&e,ae=U&&typeof t==`object`&&t&&!t.nodeType&&t,W=ae&&ae.exports===U&&V.process,G=function(){try{return W&&W.binding(`util`)}catch{}}(),oe=G&&G.isTypedArray;function K(e,t,n,r){for(var i=-1,a=e?e.length:0;++i<a;){var o=e[i];t(r,o,n(o),e)}return r}function se(e,t){for(var n=-1,r=e?e.length:0;++n<r;)if(t(e[n],n,e))return!0;return!1}function ce(e){return function(t){return t?.[e]}}function le(e,t){for(var n=-1,r=Array(e);++n<e;)r[n]=t(n);return r}function q(e){return function(t){return e(t)}}function ue(e,t){return e?.[t]}function de(e){var t=!1;if(e!=null&&typeof e.toString!=`function`)try{t=!!(e+``)}catch{}return t}function fe(e){var t=-1,n=Array(e.size);return e.forEach(function(e,r){n[++t]=[r,e]}),n}function pe(e,t){return function(n){return e(t(n))}}function me(e){var t=-1,n=Array(e.size);return e.forEach(function(e){n[++t]=e}),n}var he=Array.prototype,ge=Function.prototype,J=Object.prototype,Y=H[`__core-js_shared__`],_e=function(){var e=/[^.]+$/.exec(Y&&Y.keys&&Y.keys.IE_PROTO||``);return e?`Symbol(src)_1.`+e:``}(),X=ge.toString,Z=J.hasOwnProperty,ve=J.toString,ye=RegExp(`^`+X.call(Z).replace(ne,`\\$&`).replace(/hasOwnProperty|(function).*?(?=\\\()| for .+?(?=\\\])/g,`$1.*?`)+`$`),be=H.Symbol,xe=H.Uint8Array,Se=J.propertyIsEnumerable,Ce=he.splice,we=pe(Object.keys,Object),Te=Bt(H,`DataView`),Ee=Bt(H,`Map`),De=Bt(H,`Promise`),Oe=Bt(H,`Set`),ke=Bt(H,`WeakMap`),Ae=Bt(Object,`create`),je=Qt(Te),Me=Qt(Ee),Ne=Qt(De),Pe=Qt(Oe),Fe=Qt(ke),Ie=be?be.prototype:void 0,Le=Ie?Ie.valueOf:void 0,Q=Ie?Ie.toString:void 0;function Re(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function ze(){this.__data__=Ae?Ae(null):{}}function Be(e){return this.has(e)&&delete this.__data__[e]}function Ve(e){var t=this.__data__;if(Ae){var n=t[e];return n===i?void 0:n}return Z.call(t,e)?t[e]:void 0}function He(e){var t=this.__data__;return Ae?t[e]!==void 0:Z.call(t,e)}function Ue(e,t){var n=this.__data__;return n[e]=Ae&&t===void 0?i:t,this}Re.prototype.clear=ze,Re.prototype.delete=Be,Re.prototype.get=Ve,Re.prototype.has=He,Re.prototype.set=Ue;function We(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ge(){this.__data__=[]}function Ke(e){var t=this.__data__,n=ft(t,e);return n<0?!1:(n==t.length-1?t.pop():Ce.call(t,n,1),!0)}function qe(e){var t=this.__data__,n=ft(t,e);return n<0?void 0:t[n][1]}function Je(e){return ft(this.__data__,e)>-1}function Ye(e,t){var n=this.__data__,r=ft(n,e);return r<0?n.push([e,t]):n[r][1]=t,this}We.prototype.clear=Ge,We.prototype.delete=Ke,We.prototype.get=qe,We.prototype.has=Je,We.prototype.set=Ye;function Xe(e){var t=-1,n=e?e.length:0;for(this.clear();++t<n;){var r=e[t];this.set(r[0],r[1])}}function Ze(){this.__data__={hash:new Re,map:new(Ee||We),string:new Re}}function Qe(e){return Rt(this,e).delete(e)}function $e(e){return Rt(this,e).get(e)}function et(e){return Rt(this,e).has(e)}function tt(e,t){return Rt(this,e).set(e,t),this}Xe.prototype.clear=Ze,Xe.prototype.delete=Qe,Xe.prototype.get=$e,Xe.prototype.has=et,Xe.prototype.set=tt;function nt(e){var t=-1,n=e?e.length:0;for(this.__data__=new Xe;++t<n;)this.add(e[t])}function rt(e){return this.__data__.set(e,i),this}function it(e){return this.__data__.has(e)}nt.prototype.add=nt.prototype.push=rt,nt.prototype.has=it;function at(e){this.__data__=new We(e)}function ot(){this.__data__=new We}function st(e){return this.__data__.delete(e)}function ct(e){return this.__data__.get(e)}function lt(e){return this.__data__.has(e)}function ut(e,t){var r=this.__data__;if(r instanceof We){var i=r.__data__;if(!Ee||i.length<n-1)return i.push([e,t]),this;r=this.__data__=new Xe(i)}return r.set(e,t),this}at.prototype.clear=ot,at.prototype.delete=st,at.prototype.get=ct,at.prototype.has=lt,at.prototype.set=ut;function dt(e,t){var n=rn(e)||nn(e)?le(e.length,String):[],r=n.length,i=!!r;for(var a in e)(t||Z.call(e,a))&&!(i&&(a==`length`||Ut(a,r)))&&n.push(a);return n}function ft(e,t){for(var n=e.length;n--;)if(tn(e[n][0],t))return n;return-1}function pt(e,t,n,r){return mt(e,function(e,i,a){t(r,e,n(e),a)}),r}var mt=Nt(gt),ht=Pt();function gt(e,t){return e&&ht(e,t,gn)}function _t(e,t){t=Wt(t,e)?[t]:jt(t);for(var n=0,r=t.length;e!=null&&n<r;)e=e[Zt(t[n++])];return n&&n==r?e:void 0}function vt(e){return ve.call(e)}function yt(e,t){return e!=null&&t in Object(e)}function bt(e,t,n,r,i){return e===t?!0:e==null||t==null||!ln(e)&&!un(t)?e!==e&&t!==t:xt(e,t,bt,n,r,i)}function xt(e,t,n,r,i,a){var s=rn(e),c=rn(t),d=u,f=u;s||(d=Vt(e),d=d==l?v:d),c||(f=Vt(t),f=f==l?v:f);var p=d==v&&!de(e),m=f==v&&!de(t),h=d==f;if(h&&!p)return a||=new at,s||fn(e)?Ft(e,t,n,r,i,a):It(e,t,d,n,r,i,a);if(!(i&o)){var g=p&&Z.call(e,`__wrapped__`),_=m&&Z.call(t,`__wrapped__`);if(g||_){var y=g?e.value():e,b=_?t.value():t;return a||=new at,n(y,b,r,i,a)}}return h?(a||=new at,Lt(e,t,n,r,i,a)):!1}function St(e,t,n,r){var i=n.length,s=i,c=!r;if(e==null)return!s;for(e=Object(e);i--;){var l=n[i];if(c&&l[2]?l[1]!==e[l[0]]:!(l[0]in e))return!1}for(;++i<s;){l=n[i];var u=l[0],d=e[u],f=l[1];if(c&&l[2]){if(d===void 0&&!(u in e))return!1}else{var p=new at;if(r)var m=r(d,f,u,e,t,p);if(!(m===void 0?bt(f,d,r,a|o,p):m))return!1}}return!0}function Ct(e){return!ln(e)||Kt(e)?!1:(sn(e)||de(e)?ye:z).test(Qt(e))}function wt(e){return un(e)&&cn(e.length)&&!!B[ve.call(e)]}function Tt(e){return typeof e==`function`?e:e==null?_n:typeof e==`object`?rn(e)?Ot(e[0],e[1]):Dt(e):vn(e)}function Et(e){if(!qt(e))return we(e);var t=[];for(var n in Object(e))Z.call(e,n)&&n!=`constructor`&&t.push(n);return t}function Dt(e){var t=zt(e);return t.length==1&&t[0][2]?Yt(t[0][0],t[0][1]):function(n){return n===e||St(n,e,t)}}function Ot(e,t){return Wt(e)&&Jt(t)?Yt(Zt(e),t):function(n){var r=mn(n,e);return r===void 0&&r===t?hn(n,e):bt(t,r,void 0,a|o)}}function kt(e){return function(t){return _t(t,e)}}function At(e){if(typeof e==`string`)return e;if(dn(e))return Q?Q.call(e):``;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}function jt(e){return rn(e)?e:Xt(e)}function Mt(e,t){return function(n,r){var i=rn(n)?K:pt,a=t?t():{};return i(n,e,Tt(r,2),a)}}function Nt(e,t){return function(n,r){if(n==null)return n;if(!an(n))return e(n,r);for(var i=n.length,a=t?i:-1,o=Object(n);(t?a--:++a<i)&&r(o[a],a,o)!==!1;);return n}}function Pt(e){return function(t,n,r){for(var i=-1,a=Object(t),o=r(t),s=o.length;s--;){var c=o[e?s:++i];if(n(a[c],c,a)===!1)break}return t}}function Ft(e,t,n,r,i,s){var c=i&o,l=e.length,u=t.length;if(l!=u&&!(c&&u>l))return!1;var d=s.get(e);if(d&&s.get(t))return d==t;var f=-1,p=!0,m=i&a?new nt:void 0;for(s.set(e,t),s.set(t,e);++f<l;){var h=e[f],g=t[f];if(r)var _=c?r(g,h,f,t,e,s):r(h,g,f,e,t,s);if(_!==void 0){if(_)continue;p=!1;break}if(m){if(!se(t,function(e,t){if(!m.has(t)&&(h===e||n(h,e,r,i,s)))return m.add(t)})){p=!1;break}}else if(!(h===g||n(h,g,r,i,s))){p=!1;break}}return s.delete(e),s.delete(t),p}function It(e,t,n,r,i,s,c){switch(n){case E:if(e.byteLength!=t.byteLength||e.byteOffset!=t.byteOffset)return!1;e=e.buffer,t=t.buffer;case T:return!(e.byteLength!=t.byteLength||!r(new xe(e),new xe(t)));case d:case f:case _:return tn(+e,+t);case p:return e.name==t.name&&e.message==t.message;case b:case S:return e==t+``;case g:var l=fe;case x:var u=s&o;if(l||=me,e.size!=t.size&&!u)return!1;var m=c.get(e);if(m)return m==t;s|=a,c.set(e,t);var h=Ft(l(e),l(t),r,i,s,c);return c.delete(e),h;case C:if(Le)return Le.call(e)==Le.call(t)}return!1}function Lt(e,t,n,r,i,a){var s=i&o,c=gn(e),l=c.length;if(l!=gn(t).length&&!s)return!1;for(var u=l;u--;){var d=c[u];if(!(s?d in t:Z.call(t,d)))return!1}var f=a.get(e);if(f&&a.get(t))return f==t;var p=!0;a.set(e,t),a.set(t,e);for(var m=s;++u<l;){d=c[u];var h=e[d],g=t[d];if(r)var _=s?r(g,h,d,t,e,a):r(h,g,d,e,t,a);if(!(_===void 0?h===g||n(h,g,r,i,a):_)){p=!1;break}m||=d==`constructor`}if(p&&!m){var v=e.constructor,y=t.constructor;v!=y&&`constructor`in e&&`constructor`in t&&!(typeof v==`function`&&v instanceof v&&typeof y==`function`&&y instanceof y)&&(p=!1)}return a.delete(e),a.delete(t),p}function Rt(e,t){var n=e.__data__;return Gt(t)?n[typeof t==`string`?`string`:`hash`]:n.map}function zt(e){for(var t=gn(e),n=t.length;n--;){var r=t[n],i=e[r];t[n]=[r,i,Jt(i)]}return t}function Bt(e,t){var n=ue(e,t);return Ct(n)?n:void 0}var Vt=vt;(Te&&Vt(new Te(new ArrayBuffer(1)))!=E||Ee&&Vt(new Ee)!=g||De&&Vt(De.resolve())!=y||Oe&&Vt(new Oe)!=x||ke&&Vt(new ke)!=w)&&(Vt=function(e){var t=ve.call(e),n=t==v?e.constructor:void 0,r=n?Qt(n):void 0;if(r)switch(r){case je:return E;case Me:return g;case Ne:return y;case Pe:return x;case Fe:return w}return t});function Ht(e,t,n){t=Wt(t,e)?[t]:jt(t);for(var r,i=-1,a=t.length;++i<a;){var o=Zt(t[i]);if(!(r=e!=null&&n(e,o)))break;e=e[o]}if(r)return r;var a=e?e.length:0;return!!a&&cn(a)&&Ut(o,a)&&(rn(e)||nn(e))}function Ut(e,t){return t??=c,!!t&&(typeof e==`number`||re.test(e))&&e>-1&&e%1==0&&e<t}function Wt(e,t){if(rn(e))return!1;var n=typeof e;return n==`number`||n==`symbol`||n==`boolean`||e==null||dn(e)?!0:te.test(e)||!F.test(e)||t!=null&&e in Object(t)}function Gt(e){var t=typeof e;return t==`string`||t==`number`||t==`symbol`||t==`boolean`?e!==`__proto__`:e===null}function Kt(e){return!!_e&&_e in e}function qt(e){var t=e&&e.constructor;return e===(typeof t==`function`&&t.prototype||J)}function Jt(e){return e===e&&!ln(e)}function Yt(e,t){return function(n){return n==null?!1:n[e]===t&&(t!==void 0||e in Object(n))}}var Xt=en(function(e){e=pn(e);var t=[];return I.test(e)&&t.push(``),e.replace(L,function(e,n,r,i){t.push(r?i.replace(R,`$1`):n||e)}),t});function Zt(e){if(typeof e==`string`||dn(e))return e;var t=e+``;return t==`0`&&1/e==-s?`-0`:t}function Qt(e){if(e!=null){try{return X.call(e)}catch{}try{return e+``}catch{}}return``}var $t=Mt(function(e,t,n){Z.call(e,n)?e[n].push(t):e[n]=[t]});function en(e,t){if(typeof e!=`function`||t&&typeof t!=`function`)throw TypeError(r);var n=function(){var r=arguments,i=t?t.apply(this,r):r[0],a=n.cache;if(a.has(i))return a.get(i);var o=e.apply(this,r);return n.cache=a.set(i,o),o};return n.cache=new(en.Cache||Xe),n}en.Cache=Xe;function tn(e,t){return e===t||e!==e&&t!==t}function nn(e){return on(e)&&Z.call(e,`callee`)&&(!Se.call(e,`callee`)||ve.call(e)==l)}var rn=Array.isArray;function an(e){return e!=null&&cn(e.length)&&!sn(e)}function on(e){return un(e)&&an(e)}function sn(e){var t=ln(e)?ve.call(e):``;return t==m||t==h}function cn(e){return typeof e==`number`&&e>-1&&e%1==0&&e<=c}function ln(e){var t=typeof e;return!!e&&(t==`object`||t==`function`)}function un(e){return!!e&&typeof e==`object`}function dn(e){return typeof e==`symbol`||un(e)&&ve.call(e)==C}var fn=oe?q(oe):wt;function pn(e){return e==null?``:At(e)}function mn(e,t,n){var r=e==null?void 0:_t(e,t);return r===void 0?n:r}function hn(e,t){return e!=null&&Ht(e,t,yt)}function gn(e){return an(e)?dt(e):Et(e)}function _n(e){return e}function vn(e){return Wt(e)?ce(Zt(e)):kt(e)}t.exports=$t})),Pu=c((e=>{var t=e&&e.__importDefault||function(e){return e&&e.__esModule?e:{default:e}};Object.defineProperty(e,`__esModule`,{value:!0}),e.HeaderTransformer=void 0;let n=t(ju()),r=t(vu()),i=t(Mu()),a=t(Nu());e.HeaderTransformer=class{parserOptions;headers=null;receivedHeaders=!1;shouldUseFirstRow=!1;processedFirstRow=!1;headersLength=0;headersTransform;constructor(e){this.parserOptions=e,e.headers===!0?this.shouldUseFirstRow=!0:Array.isArray(e.headers)?this.setHeaders(e.headers):(0,r.default)(e.headers)&&(this.headersTransform=e.headers)}transform(e,t){return this.shouldMapRow(e)?t(null,this.processRow(e)):t(null,{row:null,isValid:!0})}shouldMapRow(e){let{parserOptions:t}=this;if(!this.headersTransform&&t.renameHeaders&&!this.processedFirstRow){if(!this.receivedHeaders)throw Error(`Error renaming headers: new headers must be provided in an array`);return this.processedFirstRow=!0,!1}if(!this.receivedHeaders&&Array.isArray(e)){if(this.headersTransform)this.setHeaders(this.headersTransform(e));else if(this.shouldUseFirstRow)this.setHeaders(e);else return!0;return!1}return!0}processRow(e){if(!this.headers)return{row:e,isValid:!0};let{parserOptions:t}=this;if(!t.discardUnmappedColumns&&e.length>this.headersLength){if(!t.strictColumnHandling)throw Error(`Unexpected Error: column header mismatch expected: ${this.headersLength} columns got: ${e.length}`);return{row:e,isValid:!1,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}}return t.strictColumnHandling&&e.length<this.headersLength?{row:e,isValid:!1,reason:`Column header mismatch expected: ${this.headersLength} columns got: ${e.length}`}:{row:this.mapHeaders(e),isValid:!0}}mapHeaders(e){let t={},{headers:r,headersLength:i}=this;for(let a=0;a<i;a+=1){let i=r[a];if(!(0,n.default)(i)){let r=e[a];(0,n.default)(r)?t[i]=``:t[i]=r}}return t}setHeaders(e){let t=e.filter(e=>!!e);if((0,i.default)(t).length!==t.length){let e=(0,a.default)(t),n=Object.keys(e).filter(t=>e[t].length>1);throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}this.headers=e,this.receivedHeaders=!0,this.headersLength=this.headers?.length||0}}})),Fu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.HeaderTransformer=e.RowTransformerValidator=void 0;var t=Au();Object.defineProperty(e,`RowTransformerValidator`,{enumerable:!0,get:function(){return t.RowTransformerValidator}});var n=Pu();Object.defineProperty(e,`HeaderTransformer`,{enumerable:!0,get:function(){return n.HeaderTransformer}})})),Iu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Token=void 0,e.Token=class{static isTokenRowDelimiter(e){let t=e.token;return t===`\r`||t===`
111
111
  `||t===`\r
112
- `}static isTokenCarriageReturn(e,t){return e.token===t.carriageReturn}static isTokenComment(e,t){return t.supportsComments&&!!e&&e.token===t.comment}static isTokenEscapeCharacter(e,t){return e.token===t.escapeChar}static isTokenQuote(e,t){return e.token===t.quote}static isTokenDelimiter(e,t){return e.token===t.delimiter}token;startCursor;endCursor;constructor(e){this.token=e.token,this.startCursor=e.startCursor,this.endCursor=e.endCursor}}})),Vu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Scanner=void 0;let t=Bu(),n=/((?:\r\n)|\n|\r)/;e.Scanner=class{line;parserOptions;lineLength;hasMoreData;cursor=0;constructor(e){this.line=e.line,this.lineLength=this.line.length,this.parserOptions=e.parserOptions,this.hasMoreData=e.hasMoreData,this.cursor=e.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:e}=this,n=this.parserOptions.NEXT_TOKEN_REGEXP;if(e.search(n)===-1)return null;let r=n.exec(e);if(r==null)return null;let i=r[1],a=this.cursor+(r.index||0);return new t.Token({token:i,startCursor:a,endCursor:a+i.length-1})}get nextCharacterToken(){let{cursor:e,lineLength:n}=this;return n<=e?null:new t.Token({token:this.line[e],startCursor:e,endCursor:e})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let e=n.exec(this.lineFromCursor);return e?(this.cursor+=(e.index||0)+e[0].length,this):this.hasMoreData?null:(this.cursor=this.lineLength,this)}advanceTo(e){return this.cursor=e,this}advanceToToken(e){return this.cursor=e.startCursor,this}advancePastToken(e){return this.cursor=e.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}})),Hu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnFormatter=void 0,e.ColumnFormatter=class{format;constructor(e){e.trim?this.format=e=>e.trim():e.ltrim?this.format=e=>e.trimLeft():e.rtrim?this.format=e=>e.trimRight():this.format=e=>e}}})),Uu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NonQuotedColumnParser=void 0;let t=Hu(),n=Bu();e.NonQuotedColumnParser=class{parserOptions;columnFormatter;constructor(e){this.parserOptions=e,this.columnFormatter=new t.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters)return null;let{parserOptions:t}=this,r=[],i=e.nextCharacterToken;for(;i&&!(n.Token.isTokenDelimiter(i,t)||n.Token.isTokenRowDelimiter(i));i=e.nextCharacterToken)r.push(i.token),e.advancePastToken(i);return this.columnFormatter.format(r.join(``))}}})),Wu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QuotedColumnParser=void 0;let t=Hu(),n=Bu();e.QuotedColumnParser=class{parserOptions;columnFormatter;constructor(e){this.parserOptions=e,this.columnFormatter=new t.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters)return null;let t=e.cursor,{foundClosingQuote:n,col:r}=this.gatherDataBetweenQuotes(e);if(!n){if(e.advanceTo(t),!e.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||``}' in line: at '${e.lineFromCursor.replace(/[\r\n]/g,`\\n'`)}'`);return null}return this.checkForMalformedColumn(e),r}gatherDataBetweenQuotes(e){let{parserOptions:t}=this,r=!1,i=!1,a=[],o=e.nextCharacterToken;for(;!i&&o!==null;o=e.nextCharacterToken){let s=n.Token.isTokenQuote(o,t);if(!r&&s)r=!0;else if(r)if(n.Token.isTokenEscapeCharacter(o,t)){e.advancePastToken(o);let r=e.nextCharacterToken;r!==null&&(n.Token.isTokenQuote(r,t)||n.Token.isTokenEscapeCharacter(r,t))?(a.push(r.token),o=r):s?i=!0:a.push(o.token)}else s?i=!0:a.push(o.token);e.advancePastToken(o)}return{col:this.columnFormatter.format(a.join(``)),foundClosingQuote:i}}checkForMalformedColumn(e){let{parserOptions:t}=this,{nextNonSpaceToken:r}=e;if(r){let i=n.Token.isTokenDelimiter(r,t),a=n.Token.isTokenRowDelimiter(r);if(!(i||a)){let n=e.lineFromCursor.substr(0,10).replace(/[\r\n]/g,`\\n'`);throw Error(`Parse Error: expected: '${t.escapedDelimiter}' OR new line got: '${r.token}'. at '${n}'`)}e.advanceToToken(r)}else e.hasMoreData||e.advancePastLine()}}})),Gu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnParser=void 0;let t=Uu(),n=Wu(),r=Bu();e.ColumnParser=class{parserOptions;nonQuotedColumnParser;quotedColumnParser;constructor(e){this.parserOptions=e,this.quotedColumnParser=new n.QuotedColumnParser(e),this.nonQuotedColumnParser=new t.NonQuotedColumnParser(e)}parse(e){let{nextNonSpaceToken:t}=e;return t!==null&&r.Token.isTokenQuote(t,this.parserOptions)?(e.advanceToToken(t),this.quotedColumnParser.parse(e)):this.nonQuotedColumnParser.parse(e)}}})),Ku=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnFormatter=e.QuotedColumnParser=e.NonQuotedColumnParser=e.ColumnParser=void 0;var t=Gu();Object.defineProperty(e,`ColumnParser`,{enumerable:!0,get:function(){return t.ColumnParser}});var n=Uu();Object.defineProperty(e,`NonQuotedColumnParser`,{enumerable:!0,get:function(){return n.NonQuotedColumnParser}});var r=Wu();Object.defineProperty(e,`QuotedColumnParser`,{enumerable:!0,get:function(){return r.QuotedColumnParser}});var i=Hu();Object.defineProperty(e,`ColumnFormatter`,{enumerable:!0,get:function(){return i.ColumnFormatter}})})),qu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RowParser=void 0;let t=Ku(),n=Bu();e.RowParser=class{static isEmptyRow(e){return e.join(``).replace(/\s+/g,``)===``}parserOptions;columnParser;constructor(e){this.parserOptions=e,this.columnParser=new t.ColumnParser(e)}parse(e){let{parserOptions:t}=this,{hasMoreData:r}=e,i=e,a=[],o=this.getStartToken(i,a);for(;o;){if(n.Token.isTokenRowDelimiter(o))return i.advancePastToken(o),!i.hasMoreCharacters&&n.Token.isTokenCarriageReturn(o,t)&&r?null:(i.truncateToCursor(),a);if(!this.shouldSkipColumnParse(i,o,a)){let e=this.columnParser.parse(i);if(e===null)return null;a.push(e)}o=i.nextNonSpaceToken}return r?null:(i.truncateToCursor(),a)}getStartToken(e,t){let r=e.nextNonSpaceToken;return r!==null&&n.Token.isTokenDelimiter(r,this.parserOptions)?(t.push(``),e.nextNonSpaceToken):r}shouldSkipColumnParse(e,t,r){let{parserOptions:i}=this;if(n.Token.isTokenDelimiter(t,i)){e.advancePastToken(t);let a=e.nextCharacterToken;if(!e.hasMoreCharacters||a!==null&&n.Token.isTokenRowDelimiter(a)||a!==null&&n.Token.isTokenDelimiter(a,i))return r.push(``),!0}return!1}}})),Ju=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Parser=void 0;let t=Vu(),n=qu(),r=Bu();e.Parser=class e{static removeBOM(e){return e&&e.charCodeAt(0)===65279?e.slice(1):e}parserOptions;rowParser;constructor(e){this.parserOptions=e,this.rowParser=new n.RowParser(this.parserOptions)}parse(n,r){let i=new t.Scanner({line:e.removeBOM(n),parserOptions:this.parserOptions,hasMoreData:r});return this.parserOptions.supportsComments?this.parseWithComments(i):this.parseWithoutComments(i)}parseWithoutComments(e){let t=[],n=!0;for(;n;)n=this.parseRow(e,t);return{line:e.line,rows:t}}parseWithComments(e){let{parserOptions:t}=this,n=[];for(let i=e.nextCharacterToken;i!==null;i=e.nextCharacterToken)if(r.Token.isTokenComment(i,t)){if(e.advancePastLine()===null||!e.hasMoreCharacters)return{line:e.lineFromCursor,rows:n};e.truncateToCursor()}else if(!this.parseRow(e,n))break;return{line:e.line,rows:n}}parseRow(e,t){if(!e.nextNonSpaceToken)return!1;let r=this.rowParser.parse(e);return r===null?!1:(this.parserOptions.ignoreEmpty&&n.RowParser.isEmptyRow(r)||t.push(r),!0)}}})),Yu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QuotedColumnParser=e.NonQuotedColumnParser=e.ColumnParser=e.Token=e.Scanner=e.RowParser=e.Parser=void 0;var t=Ju();Object.defineProperty(e,`Parser`,{enumerable:!0,get:function(){return t.Parser}});var n=qu();Object.defineProperty(e,`RowParser`,{enumerable:!0,get:function(){return n.RowParser}});var r=Vu();Object.defineProperty(e,`Scanner`,{enumerable:!0,get:function(){return r.Scanner}});var i=Bu();Object.defineProperty(e,`Token`,{enumerable:!0,get:function(){return i.Token}});var a=Ku();Object.defineProperty(e,`ColumnParser`,{enumerable:!0,get:function(){return a.ColumnParser}}),Object.defineProperty(e,`NonQuotedColumnParser`,{enumerable:!0,get:function(){return a.NonQuotedColumnParser}}),Object.defineProperty(e,`QuotedColumnParser`,{enumerable:!0,get:function(){return a.QuotedColumnParser}})})),Xu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvParserStream=void 0;let t=Qt(),n=sn(),r=zu(),i=Yu();e.CsvParserStream=class e extends n.Transform{parserOptions;decoder;parser;headerTransformer;rowTransformerValidator;lines=``;rowCount=0;parsedRowCount=0;parsedLineCount=0;endEmitted=!1;headersEmitted=!1;constructor(e){super({objectMode:e.objectMode}),this.parserOptions=e,this.parser=new i.Parser(e),this.headerTransformer=new r.HeaderTransformer(e),this.decoder=new t.StringDecoder(e.encoding),this.rowTransformerValidator=new r.RowTransformerValidator}get hasHitRowLimit(){return this.parserOptions.limitRows&&this.rowCount>=this.parserOptions.maxRows}get shouldEmitRows(){return this.parsedRowCount>this.parserOptions.skipRows}get shouldSkipLine(){return this.parsedLineCount<=this.parserOptions.skipLines}transform(e){return this.rowTransformerValidator.rowTransform=e,this}validate(e){return this.rowTransformerValidator.rowValidator=e,this}emit(e,...t){return e===`end`?(this.endEmitted||(this.endEmitted=!0,super.emit(`end`,this.rowCount)),!1):super.emit(e,...t)}_transform(t,n,r){if(this.hasHitRowLimit)return r();let i=e.wrapDoneCallback(r);try{let{lines:e}=this,n=e+this.decoder.write(t),r=this.parse(n,!0);return this.processRows(r,i)}catch(e){return i(e)}}_flush(t){let n=e.wrapDoneCallback(t);if(this.hasHitRowLimit)return n();try{let e=this.lines+this.decoder.end(),t=this.parse(e,!1);return this.processRows(t,n)}catch(e){return n(e)}}parse(e,t){if(!e)return[];let{line:n,rows:r}=this.parser.parse(e,t);return this.lines=n,r}processRows(e,t){let n=e.length,r=i=>{let a=e=>{if(e)return t(e);if(i%100==0){setImmediate(()=>r(i+1));return}return r(i+1)};if(this.checkAndEmitHeaders(),i>=n||this.hasHitRowLimit)return t();if(this.parsedLineCount+=1,this.shouldSkipLine)return a();let o=e[i];this.rowCount+=1,this.parsedRowCount+=1;let s=this.rowCount;return this.transformRow(o,(e,t)=>{if(e)return--this.rowCount,a(e);if(!t)return a(Error(`expected transform result`));if(!t.isValid)this.emit(`data-invalid`,t.row,s,t.reason);else if(t.row)return this.pushRow(t.row,a);return a()})};r(0)}transformRow(e,t){try{this.headerTransformer.transform(e,(n,r)=>n?t(n):r?r.isValid?r.row?this.shouldEmitRows?this.rowTransformerValidator.transformAndValidate(r.row,t):this.skipRow(t):(--this.rowCount,--this.parsedRowCount,t(null,{row:null,isValid:!0})):this.shouldEmitRows?t(null,{isValid:!1,row:e}):this.skipRow(t):t(Error(`Expected result from header transform`)))}catch(e){t(e)}}checkAndEmitHeaders(){!this.headersEmitted&&this.headerTransformer.headers&&(this.headersEmitted=!0,this.emit(`headers`,this.headerTransformer.headers))}skipRow(e){return--this.rowCount,e(null,{row:null,isValid:!0})}pushRow(e,t){try{this.parserOptions.objectMode?this.push(e):this.push(JSON.stringify(e)),t()}catch(e){t(e)}}static wrapDoneCallback(e){let t=!1;return(n,...r)=>{if(n){if(t)throw n;t=!0,e(n);return}e(...r)}}}})),Zu=c((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.parseString=e.parseFile=e.parseStream=e.parse=e.ParserOptions=e.CsvParserStream=void 0;let a=r((Ji(),f(Ki))),o=sn(),s=Mu(),c=Xu();i(Nu(),e);var l=Xu();Object.defineProperty(e,`CsvParserStream`,{enumerable:!0,get:function(){return l.CsvParserStream}});var u=Mu();Object.defineProperty(e,`ParserOptions`,{enumerable:!0,get:function(){return u.ParserOptions}}),e.parse=e=>new c.CsvParserStream(new s.ParserOptions(e)),e.parseStream=(e,t)=>e.pipe(new c.CsvParserStream(new s.ParserOptions(t))),e.parseFile=(e,t={})=>a.createReadStream(e).pipe(new c.CsvParserStream(new s.ParserOptions(t))),e.parseString=(e,t)=>{let n=new o.Readable;return n.push(e),n.push(null),n.pipe(new c.CsvParserStream(new s.ParserOptions(t)))}})),Qu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvParserStream=e.ParserOptions=e.parseFile=e.parseStream=e.parseString=e.parse=e.FormatterOptions=e.CsvFormatterStream=e.writeToPath=e.writeToString=e.writeToBuffer=e.writeToStream=e.write=e.format=void 0;var t=ju();Object.defineProperty(e,`format`,{enumerable:!0,get:function(){return t.format}}),Object.defineProperty(e,`write`,{enumerable:!0,get:function(){return t.write}}),Object.defineProperty(e,`writeToStream`,{enumerable:!0,get:function(){return t.writeToStream}}),Object.defineProperty(e,`writeToBuffer`,{enumerable:!0,get:function(){return t.writeToBuffer}}),Object.defineProperty(e,`writeToString`,{enumerable:!0,get:function(){return t.writeToString}}),Object.defineProperty(e,`writeToPath`,{enumerable:!0,get:function(){return t.writeToPath}}),Object.defineProperty(e,`CsvFormatterStream`,{enumerable:!0,get:function(){return t.CsvFormatterStream}}),Object.defineProperty(e,`FormatterOptions`,{enumerable:!0,get:function(){return t.FormatterOptions}});var n=Zu();Object.defineProperty(e,`parse`,{enumerable:!0,get:function(){return n.parse}}),Object.defineProperty(e,`parseString`,{enumerable:!0,get:function(){return n.parseString}}),Object.defineProperty(e,`parseStream`,{enumerable:!0,get:function(){return n.parseStream}}),Object.defineProperty(e,`parseFile`,{enumerable:!0,get:function(){return n.parseFile}}),Object.defineProperty(e,`ParserOptions`,{enumerable:!0,get:function(){return n.ParserOptions}}),Object.defineProperty(e,`CsvParserStream`,{enumerable:!0,get:function(){return n.CsvParserStream}})})),$u=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_customParseFormat=r()})(e,(function(){"use strict";var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return(e=+e)+(e>68?1900:2e3)},c=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||={}).offset=function(e){if(!e||e===`Z`)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return n===0?0:t[0]===`+`?-n:n}(e)}],u=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?`pm`:`PM`);return n},f={A:[a,function(e){this.afternoon=d(e,!1)}],a:[a,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*e}],SS:[r,function(e){this.milliseconds=10*e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[i,c(`seconds`)],ss:[i,c(`seconds`)],m:[i,c(`minutes`)],mm:[i,c(`minutes`)],H:[i,c(`hours`)],h:[i,c(`hours`)],HH:[i,c(`hours`)],hh:[i,c(`hours`)],D:[i,c(`day`)],DD:[r,c(`day`)],Do:[a,function(e){var t=o.ordinal;if(this.day=e.match(/\d+/)[0],t)for(var n=1;n<=31;n+=1)t(n).replace(/\[|\]/g,``)===e&&(this.day=n)}],w:[i,c(`week`)],ww:[r,c(`week`)],M:[i,c(`month`)],MM:[r,c(`month`)],MMM:[a,function(e){var t=u(`months`),n=(u(`monthsShort`)||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw Error();this.month=n%12||n}],MMMM:[a,function(e){var t=u(`months`).indexOf(e)+1;if(t<1)throw Error();this.month=t%12||t}],Y:[/[+-]?\d+/,c(`year`)],YY:[r,function(e){this.year=s(e)}],YYYY:[/\d{4}/,c(`year`)],Z:l,ZZ:l};function p(n){for(var r=n,i=o&&o.formats,a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),s=a.length,c=0;c<s;c+=1){var l=a[c],u=f[l],d=u&&u[0],p=u&&u[1];a[c]=p?{regex:d,parser:p}:l.replace(/^\[|\]$/g,``)}return function(e){for(var t={},n=0,r=0;n<s;n+=1){var i=a[n];if(typeof i==`string`)r+=i.length;else{var o=i.regex,c=i.parser,l=e.slice(r),u=o.exec(l)[0];c.call(t,u),e=e.replace(u,``)}}return function(e){var t=e.afternoon;if(t!==void 0){var n=e.hours;t?n<12&&(e.hours+=12):n===12&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,a=e.args;this.$u=r;var s=a[1];if(typeof s==`string`){var c=!0===a[2],l=!0===a[3],u=c||l,d=a[2];l&&(d=a[2]),o=this.$locale(),!c&&d&&(o=n.Ls[d]),this.$d=function(e,t,n,r){try{if([`x`,`X`].indexOf(t)>-1)return new Date((t===`X`?1e3:1)*e);var i=p(t)(e),a=i.year,o=i.month,s=i.day,c=i.hours,l=i.minutes,u=i.seconds,d=i.milliseconds,f=i.zone,m=i.week,h=new Date,g=s||(a||o?1:h.getDate()),_=a||h.getFullYear(),v=0;a&&!o||(v=o>0?o-1:h.getMonth());var y,b=c||0,x=l||0,S=u||0,C=d||0;return f?new Date(Date.UTC(_,v,g,b,x,S,C+60*f.offset*1e3)):n?new Date(Date.UTC(_,v,g,b,x,S,C)):(y=new Date(_,v,g,b,x,S,C),m&&(y=r(y).week(m).toDate()),y)}catch{return new Date(``)}}(t,s,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(s)&&(this.$d=new Date(``)),o={}}else if(s instanceof Array)for(var f=s.length,m=1;m<=f;m+=1){a[1]=s[m-1];var h=n.apply(this,a);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}m===f&&(this.$d=new Date(``))}else i.call(this,e)}}}))})),ed=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_utc=r()})(e,(function(){"use strict";var e=`minute`,t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,a){var o=i.prototype;a.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var n=a(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},o.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var s=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var c=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var l=o.utcOffset;o.utcOffset=function(r,i){var a=this.$utils().u;if(a(r))return this.$u?0:a(this.$offset)?l.call(this):this.$offset;if(typeof r==`string`&&(r=function(e){e===void 0&&(e=``);var r=e.match(t);if(!r)return null;var i=(``+r[0]).match(n)||[`-`,0,0],a=i[0],o=60*i[1]+ +i[2];return o===0?0:a===`+`?o:-o}(r),r===null))return this;var o=Math.abs(r)<=16?60*r:r;if(o===0)return this.utc(i);var s=this.clone();if(i)return s.$offset=o,s.$u=!1,s;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(o+c,e)).$offset=o,s.$x.$localOffset=c,s};var u=o.format;o.format=function(e){var t=e||(this.$u?`YYYY-MM-DDTHH:mm:ss[Z]`:``);return u.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var d=o.toDate;o.toDate=function(e){return e===`s`&&this.$offset?a(this.format(`YYYY-MM-DD HH:mm:ss:SSS`)).toDate():d.call(this)};var f=o.diff;o.diff=function(e,t,n){if(e&&this.$u===e.$u)return f.call(this,e,t,n);var r=this.local(),i=a(e).local();return f.call(r,i,t,n)}}}))})),td=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}));Ji();var nd=Qu(),rd=d($u(),1),id=d(ed(),1),ad=d(td(),1);let od={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!`}};ad.default.extend(rd.default),ad.default.extend(id.default);var sd=class{constructor(e){this.workbook=e,this.worksheet=null}async readFile(e,t){if(t||={},!await ia(e))throw Error(`File not found: ${e}`);let n=qi.createReadStream(e);try{let e=await this.read(n,t);return n.close(),e}catch(e){throw n.close(),e}}read(e,t){return t||={},new Promise((n,r)=>{let i=this.workbook.addWorksheet(t.sheetName),a=t.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],o=t.map||function(e){if(e===``)return null;let t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t;let n=a.reduce((t,n)=>{if(t)return t;let r=(0,ad.default)(e,n,!0);return r.isValid()?r:null},null);if(n)return new Date(n.valueOf());let r=od[e];return r===void 0?e:r},s=e=>{i.addRow(e.map(o))},c=()=>{f.emit(`worksheet`,i)},l=()=>{f.removeListener(`data`,s),f.removeListener(`end`,c),f.removeListener(`worksheet`,u),f.removeListener(`error`,d)},u=e=>{l(),n(e)},d=e=>{l(),r(e)},f=(0,nd.parse)(t.parserOptions).on(`data`,s).on(`end`,c);f.once(`worksheet`,u).on(`error`,d),e.pipe(f)})}write(e,t){return new Promise((n,r)=>{t||={};let i=this.workbook.getWorksheet(t.sheetName||t.sheetId),a=(0,nd.format)(t.formatterOptions),o=()=>{e.removeListener(`finish`,s),a.removeListener(`error`,c)},s=()=>{o(),n()},c=e=>{o(),r(e)};e.once(`finish`,s),a.on(`error`,c),a.pipe(e);let{dateFormat:l,dateUTC:u}=t,d=t.map||(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 l?u?ad.default.utc(e).format(l):(0,ad.default)(e).format(l):u?ad.default.utc(e).format():(0,ad.default)(e).format();if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}),f=t.includeEmptyRows===void 0||t.includeEmptyRows,p=1;i&&i.eachRow((e,t)=>{if(f)for(;p++<t-1;)a.write([]);let{values:n}=e;n.shift(),a.write(n.map(d)),p=t}),a.end()})}writeFile(e,t){t||={};let n={encoding:t.encoding||`utf8`},r=qi.createWriteStream(e,n);return this.write(r,t)}async writeBuffer(e){let t=new Ko;return await this.write(t,e),t.read()}},cd=class{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._definedNames=new xa}get xlsx(){return this._xlsx||=new bu(this),this._xlsx}get csv(){return this._csv||=new sd(this),this._csv}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 ga(Object.assign({},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(Object.assign({},e,{type:`image`})),t}getImage(e){return this.media[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}}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 ga({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||[]}};let ld=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 ud(e){return m.l2n(e.toUpperCase())-1}function dd(e){return m.n2l(e+1)}function fd(e){return parseInt(e,10)-1}function pd(e){return String(e+1)}function md(e){let t=m.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function hd(e){return m.encodeAddress(e.r+1,e.c+1)}function gd(e){let t=e.indexOf(`:`);if(t===-1){let t=md(e);return{s:t,e:{...t}}}return{s:md(e.slice(0,t)),e:md(e.slice(t+1))}}function _d(e,t){if(t===void 0){let t=e;return _d(t.s,t.e)}let n=hd(e),r=hd(t);return n===r?n:`${n}:${r}`}function vd(e,t){let n=t||{},r=new cd().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 yd(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=md(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 bd(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=gd(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).value;o==null?n.defval===void 0?r[t-a]=null:r[t-a]=n.defval:(r[t-a]=o,i=!1)}(!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).value,o=dd(t-1);a==null?n.defval!==void 0&&(r[o]=n.defval):(r[o]=a,i=!1)}(!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).value;u==null?n.defval!==void 0&&(r[c]=n.defval):(r[c]=u,i=!1)}(!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).value,l=c[s-a];o==null?n.defval!==void 0&&(r[l]=n.defval):(r[l]=o,i=!1)}(!i||f)&&u.push(r)}return u}function xd(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
112
+ `}static isTokenCarriageReturn(e,t){return e.token===t.carriageReturn}static isTokenComment(e,t){return t.supportsComments&&!!e&&e.token===t.comment}static isTokenEscapeCharacter(e,t){return e.token===t.escapeChar}static isTokenQuote(e,t){return e.token===t.quote}static isTokenDelimiter(e,t){return e.token===t.delimiter}token;startCursor;endCursor;constructor(e){this.token=e.token,this.startCursor=e.startCursor,this.endCursor=e.endCursor}}})),Lu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Scanner=void 0;let t=Iu(),n=/((?:\r\n)|\n|\r)/;e.Scanner=class{line;parserOptions;lineLength;hasMoreData;cursor=0;constructor(e){this.line=e.line,this.lineLength=this.line.length,this.parserOptions=e.parserOptions,this.hasMoreData=e.hasMoreData,this.cursor=e.cursor||0}get hasMoreCharacters(){return this.lineLength>this.cursor}get nextNonSpaceToken(){let{lineFromCursor:e}=this,n=this.parserOptions.NEXT_TOKEN_REGEXP;if(e.search(n)===-1)return null;let r=n.exec(e);if(r==null)return null;let i=r[1],a=this.cursor+(r.index||0);return new t.Token({token:i,startCursor:a,endCursor:a+i.length-1})}get nextCharacterToken(){let{cursor:e,lineLength:n}=this;return n<=e?null:new t.Token({token:this.line[e],startCursor:e,endCursor:e})}get lineFromCursor(){return this.line.substr(this.cursor)}advancePastLine(){let e=n.exec(this.lineFromCursor);return e?(this.cursor+=(e.index||0)+e[0].length,this):this.hasMoreData?null:(this.cursor=this.lineLength,this)}advanceTo(e){return this.cursor=e,this}advanceToToken(e){return this.cursor=e.startCursor,this}advancePastToken(e){return this.cursor=e.endCursor+1,this}truncateToCursor(){return this.line=this.lineFromCursor,this.lineLength=this.line.length,this.cursor=0,this}}})),Ru=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnFormatter=void 0,e.ColumnFormatter=class{format;constructor(e){e.trim?this.format=e=>e.trim():e.ltrim?this.format=e=>e.trimLeft():e.rtrim?this.format=e=>e.trimRight():this.format=e=>e}}})),zu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.NonQuotedColumnParser=void 0;let t=Ru(),n=Iu();e.NonQuotedColumnParser=class{parserOptions;columnFormatter;constructor(e){this.parserOptions=e,this.columnFormatter=new t.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters)return null;let{parserOptions:t}=this,r=[],i=e.nextCharacterToken;for(;i&&!(n.Token.isTokenDelimiter(i,t)||n.Token.isTokenRowDelimiter(i));i=e.nextCharacterToken)r.push(i.token),e.advancePastToken(i);return this.columnFormatter.format(r.join(``))}}})),Bu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QuotedColumnParser=void 0;let t=Ru(),n=Iu();e.QuotedColumnParser=class{parserOptions;columnFormatter;constructor(e){this.parserOptions=e,this.columnFormatter=new t.ColumnFormatter(e)}parse(e){if(!e.hasMoreCharacters)return null;let t=e.cursor,{foundClosingQuote:n,col:r}=this.gatherDataBetweenQuotes(e);if(!n){if(e.advanceTo(t),!e.hasMoreData)throw Error(`Parse Error: missing closing: '${this.parserOptions.quote||``}' in line: at '${e.lineFromCursor.replace(/[\r\n]/g,`\\n'`)}'`);return null}return this.checkForMalformedColumn(e),r}gatherDataBetweenQuotes(e){let{parserOptions:t}=this,r=!1,i=!1,a=[],o=e.nextCharacterToken;for(;!i&&o!==null;o=e.nextCharacterToken){let s=n.Token.isTokenQuote(o,t);if(!r&&s)r=!0;else if(r)if(n.Token.isTokenEscapeCharacter(o,t)){e.advancePastToken(o);let r=e.nextCharacterToken;r!==null&&(n.Token.isTokenQuote(r,t)||n.Token.isTokenEscapeCharacter(r,t))?(a.push(r.token),o=r):s?i=!0:a.push(o.token)}else s?i=!0:a.push(o.token);e.advancePastToken(o)}return{col:this.columnFormatter.format(a.join(``)),foundClosingQuote:i}}checkForMalformedColumn(e){let{parserOptions:t}=this,{nextNonSpaceToken:r}=e;if(r){let i=n.Token.isTokenDelimiter(r,t),a=n.Token.isTokenRowDelimiter(r);if(!(i||a)){let n=e.lineFromCursor.substr(0,10).replace(/[\r\n]/g,`\\n'`);throw Error(`Parse Error: expected: '${t.escapedDelimiter}' OR new line got: '${r.token}'. at '${n}'`)}e.advanceToToken(r)}else e.hasMoreData||e.advancePastLine()}}})),Vu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnParser=void 0;let t=zu(),n=Bu(),r=Iu();e.ColumnParser=class{parserOptions;nonQuotedColumnParser;quotedColumnParser;constructor(e){this.parserOptions=e,this.quotedColumnParser=new n.QuotedColumnParser(e),this.nonQuotedColumnParser=new t.NonQuotedColumnParser(e)}parse(e){let{nextNonSpaceToken:t}=e;return t!==null&&r.Token.isTokenQuote(t,this.parserOptions)?(e.advanceToToken(t),this.quotedColumnParser.parse(e)):this.nonQuotedColumnParser.parse(e)}}})),Hu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.ColumnFormatter=e.QuotedColumnParser=e.NonQuotedColumnParser=e.ColumnParser=void 0;var t=Vu();Object.defineProperty(e,`ColumnParser`,{enumerable:!0,get:function(){return t.ColumnParser}});var n=zu();Object.defineProperty(e,`NonQuotedColumnParser`,{enumerable:!0,get:function(){return n.NonQuotedColumnParser}});var r=Bu();Object.defineProperty(e,`QuotedColumnParser`,{enumerable:!0,get:function(){return r.QuotedColumnParser}});var i=Ru();Object.defineProperty(e,`ColumnFormatter`,{enumerable:!0,get:function(){return i.ColumnFormatter}})})),Uu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.RowParser=void 0;let t=Hu(),n=Iu();e.RowParser=class{static isEmptyRow(e){return e.join(``).replace(/\s+/g,``)===``}parserOptions;columnParser;constructor(e){this.parserOptions=e,this.columnParser=new t.ColumnParser(e)}parse(e){let{parserOptions:t}=this,{hasMoreData:r}=e,i=e,a=[],o=this.getStartToken(i,a);for(;o;){if(n.Token.isTokenRowDelimiter(o))return i.advancePastToken(o),!i.hasMoreCharacters&&n.Token.isTokenCarriageReturn(o,t)&&r?null:(i.truncateToCursor(),a);if(!this.shouldSkipColumnParse(i,o,a)){let e=this.columnParser.parse(i);if(e===null)return null;a.push(e)}o=i.nextNonSpaceToken}return r?null:(i.truncateToCursor(),a)}getStartToken(e,t){let r=e.nextNonSpaceToken;return r!==null&&n.Token.isTokenDelimiter(r,this.parserOptions)?(t.push(``),e.nextNonSpaceToken):r}shouldSkipColumnParse(e,t,r){let{parserOptions:i}=this;if(n.Token.isTokenDelimiter(t,i)){e.advancePastToken(t);let a=e.nextCharacterToken;if(!e.hasMoreCharacters||a!==null&&n.Token.isTokenRowDelimiter(a)||a!==null&&n.Token.isTokenDelimiter(a,i))return r.push(``),!0}return!1}}})),Wu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.Parser=void 0;let t=Lu(),n=Uu(),r=Iu();e.Parser=class e{static removeBOM(e){return e&&e.charCodeAt(0)===65279?e.slice(1):e}parserOptions;rowParser;constructor(e){this.parserOptions=e,this.rowParser=new n.RowParser(this.parserOptions)}parse(n,r){let i=new t.Scanner({line:e.removeBOM(n),parserOptions:this.parserOptions,hasMoreData:r});return this.parserOptions.supportsComments?this.parseWithComments(i):this.parseWithoutComments(i)}parseWithoutComments(e){let t=[],n=!0;for(;n;)n=this.parseRow(e,t);return{line:e.line,rows:t}}parseWithComments(e){let{parserOptions:t}=this,n=[];for(let i=e.nextCharacterToken;i!==null;i=e.nextCharacterToken)if(r.Token.isTokenComment(i,t)){if(e.advancePastLine()===null||!e.hasMoreCharacters)return{line:e.lineFromCursor,rows:n};e.truncateToCursor()}else if(!this.parseRow(e,n))break;return{line:e.line,rows:n}}parseRow(e,t){if(!e.nextNonSpaceToken)return!1;let r=this.rowParser.parse(e);return r===null?!1:(this.parserOptions.ignoreEmpty&&n.RowParser.isEmptyRow(r)||t.push(r),!0)}}})),Gu=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.QuotedColumnParser=e.NonQuotedColumnParser=e.ColumnParser=e.Token=e.Scanner=e.RowParser=e.Parser=void 0;var t=Wu();Object.defineProperty(e,`Parser`,{enumerable:!0,get:function(){return t.Parser}});var n=Uu();Object.defineProperty(e,`RowParser`,{enumerable:!0,get:function(){return n.RowParser}});var r=Lu();Object.defineProperty(e,`Scanner`,{enumerable:!0,get:function(){return r.Scanner}});var i=Iu();Object.defineProperty(e,`Token`,{enumerable:!0,get:function(){return i.Token}});var a=Hu();Object.defineProperty(e,`ColumnParser`,{enumerable:!0,get:function(){return a.ColumnParser}}),Object.defineProperty(e,`NonQuotedColumnParser`,{enumerable:!0,get:function(){return a.NonQuotedColumnParser}}),Object.defineProperty(e,`QuotedColumnParser`,{enumerable:!0,get:function(){return a.QuotedColumnParser}})})),Ku=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvParserStream=void 0;let t=Qt(),n=sn(),r=Fu(),i=Gu();e.CsvParserStream=class e extends n.Transform{parserOptions;decoder;parser;headerTransformer;rowTransformerValidator;lines=``;rowCount=0;parsedRowCount=0;parsedLineCount=0;endEmitted=!1;headersEmitted=!1;constructor(e){super({objectMode:e.objectMode}),this.parserOptions=e,this.parser=new i.Parser(e),this.headerTransformer=new r.HeaderTransformer(e),this.decoder=new t.StringDecoder(e.encoding),this.rowTransformerValidator=new r.RowTransformerValidator}get hasHitRowLimit(){return this.parserOptions.limitRows&&this.rowCount>=this.parserOptions.maxRows}get shouldEmitRows(){return this.parsedRowCount>this.parserOptions.skipRows}get shouldSkipLine(){return this.parsedLineCount<=this.parserOptions.skipLines}transform(e){return this.rowTransformerValidator.rowTransform=e,this}validate(e){return this.rowTransformerValidator.rowValidator=e,this}emit(e,...t){return e===`end`?(this.endEmitted||(this.endEmitted=!0,super.emit(`end`,this.rowCount)),!1):super.emit(e,...t)}_transform(t,n,r){if(this.hasHitRowLimit)return r();let i=e.wrapDoneCallback(r);try{let{lines:e}=this,n=e+this.decoder.write(t),r=this.parse(n,!0);return this.processRows(r,i)}catch(e){return i(e)}}_flush(t){let n=e.wrapDoneCallback(t);if(this.hasHitRowLimit)return n();try{let e=this.lines+this.decoder.end(),t=this.parse(e,!1);return this.processRows(t,n)}catch(e){return n(e)}}parse(e,t){if(!e)return[];let{line:n,rows:r}=this.parser.parse(e,t);return this.lines=n,r}processRows(e,t){let n=e.length,r=i=>{let a=e=>{if(e)return t(e);if(i%100==0){setImmediate(()=>r(i+1));return}return r(i+1)};if(this.checkAndEmitHeaders(),i>=n||this.hasHitRowLimit)return t();if(this.parsedLineCount+=1,this.shouldSkipLine)return a();let o=e[i];this.rowCount+=1,this.parsedRowCount+=1;let s=this.rowCount;return this.transformRow(o,(e,t)=>{if(e)return--this.rowCount,a(e);if(!t)return a(Error(`expected transform result`));if(!t.isValid)this.emit(`data-invalid`,t.row,s,t.reason);else if(t.row)return this.pushRow(t.row,a);return a()})};r(0)}transformRow(e,t){try{this.headerTransformer.transform(e,(n,r)=>n?t(n):r?r.isValid?r.row?this.shouldEmitRows?this.rowTransformerValidator.transformAndValidate(r.row,t):this.skipRow(t):(--this.rowCount,--this.parsedRowCount,t(null,{row:null,isValid:!0})):this.shouldEmitRows?t(null,{isValid:!1,row:e}):this.skipRow(t):t(Error(`Expected result from header transform`)))}catch(e){t(e)}}checkAndEmitHeaders(){!this.headersEmitted&&this.headerTransformer.headers&&(this.headersEmitted=!0,this.emit(`headers`,this.headerTransformer.headers))}skipRow(e){return--this.rowCount,e(null,{row:null,isValid:!0})}pushRow(e,t){try{this.parserOptions.objectMode?this.push(e):this.push(JSON.stringify(e)),t()}catch(e){t(e)}}static wrapDoneCallback(e){let t=!1;return(n,...r)=>{if(n){if(t)throw n;t=!0,e(n);return}e(...r)}}}})),qu=c((e=>{var t=e&&e.__createBinding||(Object.create?(function(e,t,n,r){r===void 0&&(r=n);var i=Object.getOwnPropertyDescriptor(t,n);(!i||(`get`in i?!t.__esModule:i.writable||i.configurable))&&(i={enumerable:!0,get:function(){return t[n]}}),Object.defineProperty(e,r,i)}):(function(e,t,n,r){r===void 0&&(r=n),e[r]=t[n]})),n=e&&e.__setModuleDefault||(Object.create?(function(e,t){Object.defineProperty(e,`default`,{enumerable:!0,value:t})}):function(e,t){e.default=t}),r=e&&e.__importStar||function(e){if(e&&e.__esModule)return e;var r={};if(e!=null)for(var i in e)i!==`default`&&Object.prototype.hasOwnProperty.call(e,i)&&t(r,e,i);return n(r,e),r},i=e&&e.__exportStar||function(e,n){for(var r in e)r!==`default`&&!Object.prototype.hasOwnProperty.call(n,r)&&t(n,e,r)};Object.defineProperty(e,`__esModule`,{value:!0}),e.parseString=e.parseFile=e.parseStream=e.parse=e.ParserOptions=e.CsvParserStream=void 0;let a=r((Ji(),f(Ki))),o=sn(),s=Ou(),c=Ku();i(ku(),e);var l=Ku();Object.defineProperty(e,`CsvParserStream`,{enumerable:!0,get:function(){return l.CsvParserStream}});var u=Ou();Object.defineProperty(e,`ParserOptions`,{enumerable:!0,get:function(){return u.ParserOptions}}),e.parse=e=>new c.CsvParserStream(new s.ParserOptions(e)),e.parseStream=(e,t)=>e.pipe(new c.CsvParserStream(new s.ParserOptions(t))),e.parseFile=(e,t={})=>a.createReadStream(e).pipe(new c.CsvParserStream(new s.ParserOptions(t))),e.parseString=(e,t)=>{let n=new o.Readable;return n.push(e),n.push(null),n.pipe(new c.CsvParserStream(new s.ParserOptions(t)))}})),Ju=c((e=>{Object.defineProperty(e,`__esModule`,{value:!0}),e.CsvParserStream=e.ParserOptions=e.parseFile=e.parseStream=e.parseString=e.parse=e.FormatterOptions=e.CsvFormatterStream=e.writeToPath=e.writeToString=e.writeToBuffer=e.writeToStream=e.write=e.format=void 0;var t=Du();Object.defineProperty(e,`format`,{enumerable:!0,get:function(){return t.format}}),Object.defineProperty(e,`write`,{enumerable:!0,get:function(){return t.write}}),Object.defineProperty(e,`writeToStream`,{enumerable:!0,get:function(){return t.writeToStream}}),Object.defineProperty(e,`writeToBuffer`,{enumerable:!0,get:function(){return t.writeToBuffer}}),Object.defineProperty(e,`writeToString`,{enumerable:!0,get:function(){return t.writeToString}}),Object.defineProperty(e,`writeToPath`,{enumerable:!0,get:function(){return t.writeToPath}}),Object.defineProperty(e,`CsvFormatterStream`,{enumerable:!0,get:function(){return t.CsvFormatterStream}}),Object.defineProperty(e,`FormatterOptions`,{enumerable:!0,get:function(){return t.FormatterOptions}});var n=qu();Object.defineProperty(e,`parse`,{enumerable:!0,get:function(){return n.parse}}),Object.defineProperty(e,`parseString`,{enumerable:!0,get:function(){return n.parseString}}),Object.defineProperty(e,`parseStream`,{enumerable:!0,get:function(){return n.parseStream}}),Object.defineProperty(e,`parseFile`,{enumerable:!0,get:function(){return n.parseFile}}),Object.defineProperty(e,`ParserOptions`,{enumerable:!0,get:function(){return n.ParserOptions}}),Object.defineProperty(e,`CsvParserStream`,{enumerable:!0,get:function(){return n.CsvParserStream}})})),Yu=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_customParseFormat=r()})(e,(function(){"use strict";var e={LTS:`h:mm:ss A`,LT:`h:mm A`,L:`MM/DD/YYYY`,LL:`MMMM D, YYYY`,LLL:`MMMM D, YYYY h:mm A`,LLLL:`dddd, MMMM D, YYYY h:mm A`},t=/(\[[^[]*\])|([-_:/.,()\s]+)|(A|a|Q|YYYY|YY?|ww?|MM?M?M?|Do|DD?|hh?|HH?|mm?|ss?|S{1,3}|z|ZZ?)/g,n=/\d/,r=/\d\d/,i=/\d\d?/,a=/\d*[^-_:/,()\s\d]+/,o={},s=function(e){return(e=+e)+(e>68?1900:2e3)},c=function(e){return function(t){this[e]=+t}},l=[/[+-]\d\d:?(\d\d)?|Z/,function(e){(this.zone||={}).offset=function(e){if(!e||e===`Z`)return 0;var t=e.match(/([+-]|\d\d)/g),n=60*t[1]+(+t[2]||0);return n===0?0:t[0]===`+`?-n:n}(e)}],u=function(e){var t=o[e];return t&&(t.indexOf?t:t.s.concat(t.f))},d=function(e,t){var n,r=o.meridiem;if(r){for(var i=1;i<=24;i+=1)if(e.indexOf(r(i,0,t))>-1){n=i>12;break}}else n=e===(t?`pm`:`PM`);return n},f={A:[a,function(e){this.afternoon=d(e,!1)}],a:[a,function(e){this.afternoon=d(e,!0)}],Q:[n,function(e){this.month=3*(e-1)+1}],S:[n,function(e){this.milliseconds=100*e}],SS:[r,function(e){this.milliseconds=10*e}],SSS:[/\d{3}/,function(e){this.milliseconds=+e}],s:[i,c(`seconds`)],ss:[i,c(`seconds`)],m:[i,c(`minutes`)],mm:[i,c(`minutes`)],H:[i,c(`hours`)],h:[i,c(`hours`)],HH:[i,c(`hours`)],hh:[i,c(`hours`)],D:[i,c(`day`)],DD:[r,c(`day`)],Do:[a,function(e){var t=o.ordinal;if(this.day=e.match(/\d+/)[0],t)for(var n=1;n<=31;n+=1)t(n).replace(/\[|\]/g,``)===e&&(this.day=n)}],w:[i,c(`week`)],ww:[r,c(`week`)],M:[i,c(`month`)],MM:[r,c(`month`)],MMM:[a,function(e){var t=u(`months`),n=(u(`monthsShort`)||t.map((function(e){return e.slice(0,3)}))).indexOf(e)+1;if(n<1)throw Error();this.month=n%12||n}],MMMM:[a,function(e){var t=u(`months`).indexOf(e)+1;if(t<1)throw Error();this.month=t%12||t}],Y:[/[+-]?\d+/,c(`year`)],YY:[r,function(e){this.year=s(e)}],YYYY:[/\d{4}/,c(`year`)],Z:l,ZZ:l};function p(n){for(var r=n,i=o&&o.formats,a=(n=r.replace(/(\[[^\]]+])|(LTS?|l{1,4}|L{1,4})/g,(function(t,n,r){var a=r&&r.toUpperCase();return n||i[r]||e[r]||i[a].replace(/(\[[^\]]+])|(MMMM|MM|DD|dddd)/g,(function(e,t,n){return t||n.slice(1)}))}))).match(t),s=a.length,c=0;c<s;c+=1){var l=a[c],u=f[l],d=u&&u[0],p=u&&u[1];a[c]=p?{regex:d,parser:p}:l.replace(/^\[|\]$/g,``)}return function(e){for(var t={},n=0,r=0;n<s;n+=1){var i=a[n];if(typeof i==`string`)r+=i.length;else{var o=i.regex,c=i.parser,l=e.slice(r),u=o.exec(l)[0];c.call(t,u),e=e.replace(u,``)}}return function(e){var t=e.afternoon;if(t!==void 0){var n=e.hours;t?n<12&&(e.hours+=12):n===12&&(e.hours=0),delete e.afternoon}}(t),t}}return function(e,t,n){n.p.customParseFormat=!0,e&&e.parseTwoDigitYear&&(s=e.parseTwoDigitYear);var r=t.prototype,i=r.parse;r.parse=function(e){var t=e.date,r=e.utc,a=e.args;this.$u=r;var s=a[1];if(typeof s==`string`){var c=!0===a[2],l=!0===a[3],u=c||l,d=a[2];l&&(d=a[2]),o=this.$locale(),!c&&d&&(o=n.Ls[d]),this.$d=function(e,t,n,r){try{if([`x`,`X`].indexOf(t)>-1)return new Date((t===`X`?1e3:1)*e);var i=p(t)(e),a=i.year,o=i.month,s=i.day,c=i.hours,l=i.minutes,u=i.seconds,d=i.milliseconds,f=i.zone,m=i.week,h=new Date,g=s||(a||o?1:h.getDate()),_=a||h.getFullYear(),v=0;a&&!o||(v=o>0?o-1:h.getMonth());var y,b=c||0,x=l||0,S=u||0,C=d||0;return f?new Date(Date.UTC(_,v,g,b,x,S,C+60*f.offset*1e3)):n?new Date(Date.UTC(_,v,g,b,x,S,C)):(y=new Date(_,v,g,b,x,S,C),m&&(y=r(y).week(m).toDate()),y)}catch{return new Date(``)}}(t,s,r,n),this.init(),d&&!0!==d&&(this.$L=this.locale(d).$L),u&&t!=this.format(s)&&(this.$d=new Date(``)),o={}}else if(s instanceof Array)for(var f=s.length,m=1;m<=f;m+=1){a[1]=s[m-1];var h=n.apply(this,a);if(h.isValid()){this.$d=h.$d,this.$L=h.$L,this.init();break}m===f&&(this.$d=new Date(``))}else i.call(this,e)}}}))})),Xu=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs_plugin_utc=r()})(e,(function(){"use strict";var e=`minute`,t=/[+-]\d\d(?::?\d\d)?/g,n=/([+-]|\d\d)/g;return function(r,i,a){var o=i.prototype;a.utc=function(e){return new i({date:e,utc:!0,args:arguments})},o.utc=function(t){var n=a(this.toDate(),{locale:this.$L,utc:!0});return t?n.add(this.utcOffset(),e):n},o.local=function(){return a(this.toDate(),{locale:this.$L,utc:!1})};var s=o.parse;o.parse=function(e){e.utc&&(this.$u=!0),this.$utils().u(e.$offset)||(this.$offset=e.$offset),s.call(this,e)};var c=o.init;o.init=function(){if(this.$u){var e=this.$d;this.$y=e.getUTCFullYear(),this.$M=e.getUTCMonth(),this.$D=e.getUTCDate(),this.$W=e.getUTCDay(),this.$H=e.getUTCHours(),this.$m=e.getUTCMinutes(),this.$s=e.getUTCSeconds(),this.$ms=e.getUTCMilliseconds()}else c.call(this)};var l=o.utcOffset;o.utcOffset=function(r,i){var a=this.$utils().u;if(a(r))return this.$u?0:a(this.$offset)?l.call(this):this.$offset;if(typeof r==`string`&&(r=function(e){e===void 0&&(e=``);var r=e.match(t);if(!r)return null;var i=(``+r[0]).match(n)||[`-`,0,0],a=i[0],o=60*i[1]+ +i[2];return o===0?0:a===`+`?o:-o}(r),r===null))return this;var o=Math.abs(r)<=16?60*r:r;if(o===0)return this.utc(i);var s=this.clone();if(i)return s.$offset=o,s.$u=!1,s;var c=this.$u?this.toDate().getTimezoneOffset():-1*this.utcOffset();return(s=this.local().add(o+c,e)).$offset=o,s.$x.$localOffset=c,s};var u=o.format;o.format=function(e){var t=e||(this.$u?`YYYY-MM-DDTHH:mm:ss[Z]`:``);return u.call(this,t)},o.valueOf=function(){var e=this.$utils().u(this.$offset)?0:this.$offset+(this.$x.$localOffset||this.$d.getTimezoneOffset());return this.$d.valueOf()-6e4*e},o.isUTC=function(){return!!this.$u},o.toISOString=function(){return this.toDate().toISOString()},o.toString=function(){return this.toDate().toUTCString()};var d=o.toDate;o.toDate=function(e){return e===`s`&&this.$offset?a(this.format(`YYYY-MM-DD HH:mm:ss:SSS`)).toDate():d.call(this)};var f=o.diff;o.diff=function(e,t,n){if(e&&this.$u===e.$u)return f.call(this,e,t,n);var r=this.local(),i=a(e).local();return f.call(r,i,t,n)}}}))})),Zu=c(((e,t)=>{(function(n,r){typeof e==`object`&&t!==void 0?t.exports=r():typeof define==`function`&&define.amd?define(r):(n=typeof globalThis<`u`?globalThis:n||self).dayjs=r()})(e,(function(){"use strict";var e=1e3,t=6e4,n=36e5,r=`millisecond`,i=`second`,a=`minute`,o=`hour`,s=`day`,c=`week`,l=`month`,u=`quarter`,d=`year`,f=`date`,p=`Invalid Date`,m=/^(\d{4})[-/]?(\d{1,2})?[-/]?(\d{0,2})[Tt\s]*(\d{1,2})?:?(\d{1,2})?:?(\d{1,2})?[.:]?(\d+)?$/,h=/\[([^\]]+)]|Y{1,4}|M{1,4}|D{1,2}|d{1,4}|H{1,2}|h{1,2}|a|A|m{1,2}|s{1,2}|Z{1,2}|SSS/g,g={name:`en`,weekdays:`Sunday_Monday_Tuesday_Wednesday_Thursday_Friday_Saturday`.split(`_`),months:`January_February_March_April_May_June_July_August_September_October_November_December`.split(`_`),ordinal:function(e){var t=[`th`,`st`,`nd`,`rd`],n=e%100;return`[`+e+(t[(n-20)%10]||t[n]||t[0])+`]`}},_=function(e,t,n){var r=String(e);return!r||r.length>=t?e:``+Array(t+1-r.length).join(n)+e},v={s:_,z:function(e){var t=-e.utcOffset(),n=Math.abs(t),r=Math.floor(n/60),i=n%60;return(t<=0?`+`:`-`)+_(r,2,`0`)+`:`+_(i,2,`0`)},m:function e(t,n){if(t.date()<n.date())return-e(n,t);var r=12*(n.year()-t.year())+(n.month()-t.month()),i=t.clone().add(r,l),a=n-i<0,o=t.clone().add(r+(a?-1:1),l);return+(-(r+(n-i)/(a?i-o:o-i))||0)},a:function(e){return e<0?Math.ceil(e)||0:Math.floor(e)},p:function(e){return{M:l,y:d,w:c,d:s,D:f,h:o,m:a,s:i,ms:r,Q:u}[e]||String(e||``).toLowerCase().replace(/s$/,``)},u:function(e){return e===void 0}},y=`en`,b={};b[y]=g;var x=`$isDayjsObject`,S=function(e){return e instanceof E||!(!e||!e[x])},C=function e(t,n,r){var i;if(!t)return y;if(typeof t==`string`){var a=t.toLowerCase();b[a]&&(i=a),n&&(b[a]=n,i=a);var o=t.split(`-`);if(!i&&o.length>1)return e(o[0])}else{var s=t.name;b[s]=t,i=s}return!r&&i&&(y=i),i||!r&&y},w=function(e,t){if(S(e))return e.clone();var n=typeof t==`object`?t:{};return n.date=e,n.args=arguments,new E(n)},T=v;T.l=C,T.i=S,T.w=function(e,t){return w(e,{locale:t.$L,utc:t.$u,x:t.$x,$offset:t.$offset})};var E=function(){function g(e){this.$L=C(e.locale,null,!0),this.parse(e),this.$x=this.$x||e.x||{},this[x]=!0}var _=g.prototype;return _.parse=function(e){this.$d=function(e){var t=e.date,n=e.utc;if(t===null)return new Date(NaN);if(T.u(t))return new Date;if(t instanceof Date)return new Date(t);if(typeof t==`string`&&!/Z$/i.test(t)){var r=t.match(m);if(r){var i=r[2]-1||0,a=(r[7]||`0`).substring(0,3);return n?new Date(Date.UTC(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)):new Date(r[1],i,r[3]||1,r[4]||0,r[5]||0,r[6]||0,a)}}return new Date(t)}(e),this.init()},_.init=function(){var e=this.$d;this.$y=e.getFullYear(),this.$M=e.getMonth(),this.$D=e.getDate(),this.$W=e.getDay(),this.$H=e.getHours(),this.$m=e.getMinutes(),this.$s=e.getSeconds(),this.$ms=e.getMilliseconds()},_.$utils=function(){return T},_.isValid=function(){return this.$d.toString()!==p},_.isSame=function(e,t){var n=w(e);return this.startOf(t)<=n&&n<=this.endOf(t)},_.isAfter=function(e,t){return w(e)<this.startOf(t)},_.isBefore=function(e,t){return this.endOf(t)<w(e)},_.$g=function(e,t,n){return T.u(e)?this[t]:this.set(n,e)},_.unix=function(){return Math.floor(this.valueOf()/1e3)},_.valueOf=function(){return this.$d.getTime()},_.startOf=function(e,t){var n=this,r=!!T.u(t)||t,u=T.p(e),p=function(e,t){var i=T.w(n.$u?Date.UTC(n.$y,t,e):new Date(n.$y,t,e),n);return r?i:i.endOf(s)},m=function(e,t){return T.w(n.toDate()[e].apply(n.toDate(`s`),(r?[0,0,0,0]:[23,59,59,999]).slice(t)),n)},h=this.$W,g=this.$M,_=this.$D,v=`set`+(this.$u?`UTC`:``);switch(u){case d:return r?p(1,0):p(31,11);case l:return r?p(1,g):p(0,g+1);case c:var y=this.$locale().weekStart||0,b=(h<y?h+7:h)-y;return p(r?_-b:_+(6-b),g);case s:case f:return m(v+`Hours`,0);case o:return m(v+`Minutes`,1);case a:return m(v+`Seconds`,2);case i:return m(v+`Milliseconds`,3);default:return this.clone()}},_.endOf=function(e){return this.startOf(e,!1)},_.$set=function(e,t){var n,c=T.p(e),u=`set`+(this.$u?`UTC`:``),p=(n={},n[s]=u+`Date`,n[f]=u+`Date`,n[l]=u+`Month`,n[d]=u+`FullYear`,n[o]=u+`Hours`,n[a]=u+`Minutes`,n[i]=u+`Seconds`,n[r]=u+`Milliseconds`,n)[c],m=c===s?this.$D+(t-this.$W):t;if(c===l||c===d){var h=this.clone().set(f,1);h.$d[p](m),h.init(),this.$d=h.set(f,Math.min(this.$D,h.daysInMonth())).$d}else p&&this.$d[p](m);return this.init(),this},_.set=function(e,t){return this.clone().$set(e,t)},_.get=function(e){return this[T.p(e)]()},_.add=function(r,u){var f,p=this;r=Number(r);var m=T.p(u),h=function(e){var t=w(p);return T.w(t.date(t.date()+Math.round(e*r)),p)};if(m===l)return this.set(l,this.$M+r);if(m===d)return this.set(d,this.$y+r);if(m===s)return h(1);if(m===c)return h(7);var g=(f={},f[a]=t,f[o]=n,f[i]=e,f)[m]||1,_=this.$d.getTime()+r*g;return T.w(_,this)},_.subtract=function(e,t){return this.add(-1*e,t)},_.format=function(e){var t=this,n=this.$locale();if(!this.isValid())return n.invalidDate||p;var r=e||`YYYY-MM-DDTHH:mm:ssZ`,i=T.z(this),a=this.$H,o=this.$m,s=this.$M,c=n.weekdays,l=n.months,u=n.meridiem,d=function(e,n,i,a){return e&&(e[n]||e(t,r))||i[n].slice(0,a)},f=function(e){return T.s(a%12||12,e,`0`)},m=u||function(e,t,n){var r=e<12?`AM`:`PM`;return n?r.toLowerCase():r};return r.replace(h,(function(e,r){return r||function(e){switch(e){case`YY`:return String(t.$y).slice(-2);case`YYYY`:return T.s(t.$y,4,`0`);case`M`:return s+1;case`MM`:return T.s(s+1,2,`0`);case`MMM`:return d(n.monthsShort,s,l,3);case`MMMM`:return d(l,s);case`D`:return t.$D;case`DD`:return T.s(t.$D,2,`0`);case`d`:return String(t.$W);case`dd`:return d(n.weekdaysMin,t.$W,c,2);case`ddd`:return d(n.weekdaysShort,t.$W,c,3);case`dddd`:return c[t.$W];case`H`:return String(a);case`HH`:return T.s(a,2,`0`);case`h`:return f(1);case`hh`:return f(2);case`a`:return m(a,o,!0);case`A`:return m(a,o,!1);case`m`:return String(o);case`mm`:return T.s(o,2,`0`);case`s`:return String(t.$s);case`ss`:return T.s(t.$s,2,`0`);case`SSS`:return T.s(t.$ms,3,`0`);case`Z`:return i}return null}(e)||i.replace(`:`,``)}))},_.utcOffset=function(){return 15*-Math.round(this.$d.getTimezoneOffset()/15)},_.diff=function(r,f,p){var m,h=this,g=T.p(f),_=w(r),v=(_.utcOffset()-this.utcOffset())*t,y=this-_,b=function(){return T.m(h,_)};switch(g){case d:m=b()/12;break;case l:m=b();break;case u:m=b()/3;break;case c:m=(y-v)/6048e5;break;case s:m=(y-v)/864e5;break;case o:m=y/n;break;case a:m=y/t;break;case i:m=y/e;break;default:m=y}return p?m:T.a(m)},_.daysInMonth=function(){return this.endOf(l).$D},_.$locale=function(){return b[this.$L]},_.locale=function(e,t){if(!e)return this.$L;var n=this.clone(),r=C(e,t,!0);return r&&(n.$L=r),n},_.clone=function(){return T.w(this.$d,this)},_.toDate=function(){return new Date(this.valueOf())},_.toJSON=function(){return this.isValid()?this.toISOString():null},_.toISOString=function(){return this.$d.toISOString()},_.toString=function(){return this.$d.toUTCString()},g}(),D=E.prototype;return w.prototype=D,[[`$ms`,r],[`$s`,i],[`$m`,a],[`$H`,o],[`$W`,s],[`$M`,l],[`$y`,d],[`$D`,f]].forEach((function(e){D[e[1]]=function(t){return this.$g(t,e[0],e[1])}})),w.extend=function(e,t){return e.$i||=(e(t,E,w),!0),w},w.locale=C,w.isDayjs=S,w.unix=function(e){return w(1e3*e)},w.en=b[y],w.Ls=b,w.p={},w}))}));Ji();var Qu=Ju(),$u=d(Yu(),1),ed=d(Xu(),1),td=d(Zu(),1);let nd={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!`}};td.default.extend($u.default),td.default.extend(ed.default);var rd=class{constructor(e){this.workbook=e,this.worksheet=null}async readFile(e,t){if(t||={},!await ia(e))throw Error(`File not found: ${e}`);let n=qi.createReadStream(e);try{let e=await this.read(n,t);return n.close(),e}catch(e){throw n.close(),e}}read(e,t){return t||={},new Promise((n,r)=>{let i=this.workbook.addWorksheet(t.sheetName),a=t.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`MM-DD-YYYY`,`YYYY-MM-DD`],o=t.map||function(e){if(e===``)return null;let t=Number(e);if(!Number.isNaN(t)&&t!==1/0)return t;let n=a.reduce((t,n)=>{if(t)return t;let r=(0,td.default)(e,n,!0);return r.isValid()?r:null},null);if(n)return new Date(n.valueOf());let r=nd[e];return r===void 0?e:r},s=e=>{i.addRow(e.map(o))},c=()=>{f.emit(`worksheet`,i)},l=()=>{f.removeListener(`data`,s),f.removeListener(`end`,c),f.removeListener(`worksheet`,u),f.removeListener(`error`,d)},u=e=>{l(),n(e)},d=e=>{l(),r(e)},f=(0,Qu.parse)(t.parserOptions).on(`data`,s).on(`end`,c);f.once(`worksheet`,u).on(`error`,d),e.pipe(f)})}write(e,t){return new Promise((n,r)=>{t||={};let i=this.workbook.getWorksheet(t.sheetName||t.sheetId),a=(0,Qu.format)(t.formatterOptions),o=()=>{e.removeListener(`finish`,s),a.removeListener(`error`,c)},s=()=>{o(),n()},c=e=>{o(),r(e)};e.once(`finish`,s),a.on(`error`,c),a.pipe(e);let{dateFormat:l,dateUTC:u}=t,d=t.map||(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 l?u?td.default.utc(e).format(l):(0,td.default)(e).format(l):u?td.default.utc(e).format():(0,td.default)(e).format();if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}),f=t.includeEmptyRows===void 0||t.includeEmptyRows,p=1;i&&i.eachRow((e,t)=>{if(f)for(;p++<t-1;)a.write([]);let{values:n}=e;n.shift(),a.write(n.map(d)),p=t}),a.end()})}writeFile(e,t){t||={};let n={encoding:t.encoding||`utf8`},r=qi.createWriteStream(e,n);return this.write(r,t)}async writeBuffer(e){let t=new Jo;return await this.write(t,e),t.read()}},id=class{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._definedNames=new Ca}get xlsx(){return this._xlsx||=new gu(this),this._xlsx}get csv(){return this._csv||=new rd(this),this._csv}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 va(Object.assign({},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(Object.assign({},e,{type:`image`})),t}getImage(e){return this.media[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}}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 va({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||[]}};let ad=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 od(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function sd(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 cd(e,t){let n=10**t;return Math.round(e*n)/n}function ld(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function ud(e){return/^General$/i.test(e.trim())}function dd(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let fd=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],pd=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],md=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],hd=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],gd=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function _d(e,t){let n=Qi(e,!1),r=n.getFullYear(),i=n.getMonth(),a=n.getDate(),o=n.getHours(),s=n.getMinutes(),c=n.getSeconds(),l=n.getDay(),u=e*86400,d=u-Math.floor(u),f=/AM\/PM|A\/P/i.test(t),p=o>=12,m=o%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=ld(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:o;return h=h.replace(/\x00Y4\x00/g,r.toString()).replace(/\x00Y2\x00/g,(r%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,md[i]).replace(/\x00MN4\x00/g,pd[i]).replace(/\x00MN3\x00/g,fd[i]).replace(/\x00M2\x00/g,(i+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(i+1).toString()).replace(/\x00DN4\x00/g,gd[l]).replace(/\x00DN3\x00/g,hd[l]).replace(/\x00D2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,a.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,s.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,c.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,c.toString()).replace(/\x00SF\x00/g,c.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function vd(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 yd(e,t){let n=(t.match(/%/g)||[]).length;return wd(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function bd(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=cd(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=od(Math.abs(s),2);return n+c+`E`+l+u}function xd(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 Sd(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]=xd(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 Cd(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 wd(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=``]=cd(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=sd(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 Td(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 Ed(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 Dd(e,t){if(typeof t==`string`){let n=kd(e);return n.length>=4&&n[3]?Td(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=kd(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&&Ed(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 Od(e,t){let n=kd(e);return n.length>=2&&n[1]===t}function kd(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}function Ad(e,t){if(t==null)return``;if(ud(e))return vd(t);if(typeof t==`string`)return Dd(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=Dd(e,n);n<0&&Od(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=ld(i),i=Td(i),/\[[hms]+\]/i.test(i))return Cd(n,i);if(dd(i))return _d(n,i);if(i.includes(`%`))return yd(n,i);if(/E[+-]?/i.test(i))return bd(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return Sd(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+wd(-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=wd(n,i);return a+l+o}function jd(e){let t=e.value,n=e.numFmt||`General`;return t==null?``:t instanceof Date?Ad(n,Zi(t,!1)):typeof t==`number`||typeof t==`boolean`||typeof t==`string`?Ad(n,t):e.text}function Md(e){return m.l2n(e.toUpperCase())-1}function Nd(e){return m.n2l(e+1)}function Pd(e){return parseInt(e,10)-1}function Fd(e){return String(e+1)}function Id(e){let t=m.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function Ld(e){return m.encodeAddress(e.r+1,e.c+1)}function Rd(e){let t=e.indexOf(`:`);if(t===-1){let t=Id(e);return{s:t,e:{...t}}}return{s:Id(e.slice(0,t)),e:Id(e.slice(t+1))}}function zd(e,t){if(t===void 0){let t=e;return zd(t.s,t.e)}let n=Ld(e),r=Ld(t);return n===r?n:`${n}:${r}`}function Bd(e,t){let n=t||{},r=new id().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=Id(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 Hd(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=Rd(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?jd(o).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?jd(a).trim():a.value,s=Nd(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?jd(u).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?jd(o).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 Ud(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
113
113
  `,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(`
114
- `)||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 Sd(){return new cd}function Cd(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 wd(e,t){let n=new cd().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=md(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 Td(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=md(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 Ed(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 Dd={decode_col:ud,encode_col:dd,decode_row:fd,encode_row:pd,decode_cell:md,encode_cell:hd,decode_range:gd,encode_range:_d,json_to_sheet:vd,sheet_add_json:yd,sheet_to_json:bd,sheet_to_csv:xd,aoa_to_sheet:wd,sheet_add_aoa:Td,sheet_to_aoa:Ed,book_new:Sd,book_append_sheet:Cd};return e.DocumentType=y,e.Enums=S,e.ErrorValue=x,e.FormulaType=_,e.PaperSize=ld,e.ReadingOrder=b,e.RelationshipType=v,e.ValueType=g,e.Workbook=cd,e.aoa_to_sheet=wd,e.book_append_sheet=Cd,e.book_new=Sd,e.decode_cell=md,e.decode_col=ud,e.decode_range=gd,e.decode_row=fd,e.encode_cell=hd,e.encode_col=dd,e.encode_range=_d,e.encode_row=pd,e.json_to_sheet=vd,e.sheet_add_aoa=Td,e.sheet_add_json=yd,e.sheet_to_aoa=Ed,e.sheet_to_csv=xd,e.sheet_to_json=bd,e.utils=Dd,e})({});
114
+ `)||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 Wd(){return new id}function Gd(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 Kd(e,t){let n=new id().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=Id(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 qd(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=Id(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 Jd(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 Yd={decodeCol:Md,encodeCol:Nd,decodeRow:Pd,encodeRow:Fd,decodeCell:Id,encodeCell:Ld,decodeRange:Rd,encodeRange:zd,jsonToSheet:Bd,sheetAddJson:Vd,sheetToJson:Hd,sheetToCsv:Ud,aoaToSheet:Kd,sheetAddAoa:qd,sheetToAoa:Jd,bookNew:Wd,bookAppendSheet:Gd};return e.DocumentType=y,e.Enums=S,e.ErrorValue=x,e.FormulaType=_,e.PaperSize=ad,e.ReadingOrder=b,e.RelationshipType=v,e.ValueType=g,e.Workbook=id,e.aoaToSheet=Kd,e.bookAppendSheet=Gd,e.bookNew=Wd,e.decodeCell=Id,e.decodeCol=Md,e.decodeRange=Rd,e.decodeRow=Pd,e.encodeCell=Ld,e.encodeCol=Nd,e.encodeRange=zd,e.encodeRow=Fd,e.jsonToSheet=Bd,e.sheetAddAoa=qd,e.sheetAddJson=Vd,e.sheetToAoa=Jd,e.sheetToCsv=Ud,e.sheetToJson=Hd,e.utils=Yd,e})({});