@cj-tech-master/excelts 7.1.1 → 7.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v7.
|
|
2
|
+
* @cj-tech-master/excelts v7.2.0
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2026 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
6
6
|
*/
|
|
7
|
-
var ExcelTS=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=class extends Error{constructor(e,t){super(e,t),this.name=`BaseError`,Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,stack:this.stack,cause:this.cause instanceof Error?o(this.cause):this.cause}}},n=class extends t{constructor(e){super(`The operation was aborted`,e===void 0?void 0:{cause:e}),this.name=`AbortError`,this.code=`ABORT_ERR`}};function r(e){return e instanceof n?e:new n(e)}function i(e){return!!e&&typeof e==`object`&&e.name===`AbortError`}function a(e){return e instanceof Error?e:Error(String(e))}function o(e){return e instanceof t?e.toJSON():{name:e.name,message:e.message,stack:e.stack,cause:e.cause instanceof Error?o(e.cause):e.cause}}function s(e){let t=[e],n=e.cause;for(;n instanceof Error;)t.push(n),n=n.cause;return t}function c(e){let t=e;for(;t.cause instanceof Error;)t=t.cause;return t}var l=class extends t{constructor(e,t){super(e,t),this.name=`ExcelError`}};function u(e){return e instanceof l}var d=class extends l{constructor(...e){super(...e),this.name=`WorksheetNameError`}},f=class extends l{constructor(e,t,n){super(t?`Invalid address "${e}": ${t}`:`Invalid address: ${e}`,n),this.address=e,this.name=`InvalidAddressError`}},p=class extends l{constructor(e,t,n){super(t?`Column ${e} is out of bounds: ${t}`:`Column ${e} is out of bounds. Excel supports columns from 1 to 16384`,n),this.column=e,this.name=`ColumnOutOfBoundsError`}},m=class extends l{constructor(e,t,n){super(t?`Row ${e} is out of bounds: ${t}`:`Row ${e} is out of bounds`,n),this.row=e,this.name=`RowOutOfBoundsError`}},h=class extends l{constructor(e,t){super(e??`Cannot merge already merged cells`,t),this.name=`MergeConflictError`}},g=class extends l{constructor(e,t,n){super(t??`Cannot process value of type: ${e}`,n),this.valueType=e,this.name=`InvalidValueTypeError`}},_=class extends l{constructor(e,t,n){super(t??`Unexpected XML content in ${e}`,n),this.context=e,this.name=`XmlParseError`}},v=class extends l{constructor(e,t,n){super(t?`${e}: ${t}`:`${e} is not supported`,n),this.operation=e,this.reason=t,this.name=`ExcelNotSupportedError`}},y=class extends l{constructor(e,t,n,r){super(n?`Failed to ${t} Excel file "${e}": ${n}`:`Failed to ${t} Excel file "${e}"`,r),this.path=e,this.operation=t,this.name=`ExcelFileError`}},b=class extends l{constructor(e,t,n){super(`Cannot ${e}: ${t}`,n),this.operation=e,this.state=t,this.name=`ExcelStreamStateError`}},x=class extends l{constructor(e,t,n,r){super(`Failed to download from "${e}": HTTP ${t} ${n}`,r),this.url=e,this.status=t,this.statusText=n,this.name=`ExcelDownloadError`}},S=class extends l{constructor(...e){super(...e),this.name=`PivotTableError`}},ee=class extends l{constructor(...e){super(...e),this.name=`TableError`}},C=class extends l{constructor(...e){super(...e),this.name=`ImageError`}},te=class extends l{constructor(e,t,n){super(`Max ${e} count (${t}) exceeded`,n),this.itemType=e,this.maxItems=t,this.name=`MaxItemsExceededError`}};let ne=/^[A-Z]+\d+$/,w={_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 new p(e,`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 new p(e,`Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw new p(e);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},decodeCol(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=65&&r<=90)t=t*26+r-64;else break}return t},validateAddress(e){if(!ne.test(e))throw new f(e);return!0},decodeAddress(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.length<5&&this._hash[e];if(t)return t;let n=0,r=0,i=!1,a=!1,o=0,s=0;for(let t=0;t<e.length;t++){let c=e.charCodeAt(t);if(c===36){!i&&!a&&(s=t+1);continue}if(!a&&c>=65&&c<=90)i=!0,n=n*26+c-64,o=t+1;else if(c>=48&&c<=57)a=!0,r=r*10+c-48;else if(a&&i)break}if(!i)n=void 0;else if(n>16384){let t=e.slice(0,o);throw new p(t,`Invalid column letter: ${t}`)}a||(r=void 0);let c=i?e.slice(s,o):``,l=a?String(r):``,u=c+l,d={address:u,col:n,row:r,$col$row:`$${c}$${l}`};return n<=100&&r<=100&&(this._hash[u]=d,this._hash[d.$col$row]=d),d},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,t){return w.n2l(t)+e},encode(...e){switch(e.length){case 2:return w.encodeAddress(e[0],e[1]);case 4:return`${w.encodeAddress(e[0],e[1])}:${w.encodeAddress(e[2],e[3])}`;default:throw new f(String(e.length),`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 T=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,t,n,r,i){if(typeof e==`string`&&typeof t==`string`){let r=w.decodeAddress(e),i=w.decodeAddress(t);this.model={top:Math.min(r.row,i.row),left:Math.min(r.col,i.col),bottom:Math.max(r.row,i.row),right:Math.max(r.col,i.col),sheetName:typeof n==`string`?n:void 0}}else typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`&&(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:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&typeof t[4]==`string`&&this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:typeof t[0]==`string`&&typeof t[1]==`string`&&typeof t[2]==`string`&&this.setTLBR(t[0],t[1],t[2]);break;case 2:typeof t[0]==`string`&&typeof t[1]==`string`&&this.setTLBR(t[0],t[1]);break;case 1:{let 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(Array.isArray(n))this.decode(n);else if(typeof n==`object`&&`top`in n&&`left`in n&&`bottom`in n&&`right`in n)this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName};else if(typeof n==`string`){let e=w.decodeEx(n);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new l(`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=w.decodeEx(e);`row`in t&&`col`in t&&this.expand(t.row,t.col,t.row,t.col)}get tl(){return w.n2l(this.left)+this.top}get $t$l(){return`$${w.n2l(this.left)}$${this.top}`}get br(){return w.n2l(this.right)+this.bottom}get $b$r(){return`$${w.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=w.decodeEx(e);return`row`in t&&`col`in t?this.containsEx(t):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let n=this.top;n<=this.bottom;n++)e(w.encodeAddress(n,t),n,t)}};let E=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e[e.Checkbox=12]=`Checkbox`,e}({}),re=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),ie=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}({}),ae=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),oe=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),se={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},D={ValueType:E,FormulaType:re,RelationshipType:ie,DocumentType:ae,ReadingOrder:oe,ErrorValue:se},ce={'"':`"`,"&":`&`,"<":`<`,">":`>`},le=/["&<>]/g;function ue(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;let n=typeof e;if(n!==typeof t||n!==`object`)return!1;let r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!ue(e[r],t[r]))return!1;return!0}let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!Object.prototype.hasOwnProperty.call(t,r)||!ue(e[r],t[r]))return!1}return!0}function de(e){return e.replace(le,e=>ce[e])}function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(...e){let t=e[0]||{},n=e.length;for(let r=1;r<n;r++){let n=e[r];if(n)if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){let r=n[e];if(r===void 0)continue;let i=t[e];Array.isArray(r)?t[e]=pe(Array.isArray(i)?i:[],r):fe(r)?t[e]=pe(fe(i)?i:{},r):t[e]=r}else{let e=Object.keys(n);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=n[i];if(a===void 0)continue;let o=t[i];Array.isArray(a)?t[i]=pe(Array.isArray(o)?o:[],a):fe(a)?t[i]=pe(fe(o)?o:{},a):t[i]=a}}}return t}var me=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note??{}};break}return pe({},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 he=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,ge=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function _e(e,t,n){let r=w.decode(t),i=w.decode(n);return e.replace(he,(e,t,n,a,o)=>{if(o)return e;let s=ge.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=w.l2n(a),u=parseInt(c,10);return n||(l+=i.col-r.col),o||(u+=i.row-r.row),(t??``)+(n??``)+w.n2l(l)+(o??``)+u}return e})}let ve=e=>!!e&&(typeof e!=`object`||Object.keys(e).length>0);var O=class e{static{this.Types=D.ValueType}constructor(t,n,r){if(!t||!n)throw new l(`A Cell needs a Row`);this._row=t,this._column=n,w.validateAddress(r),this._address=r,this._value=Me.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(){this.style=void 0,this._value=void 0,this._row=void 0,this._column=void 0,this._address=void 0}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&ve(e.font)&&e.font||t&&ve(t.font)&&t.font;i&&(n.font=i);let a=e&&ve(e.alignment)&&e.alignment||t&&ve(t.alignment)&&t.alignment;a&&(n.alignment=a);let o=e&&ve(e.border)&&e.border||t&&ve(t.border)&&t.border;o&&(n.border=o);let s=e&&ve(e.fill)&&e.fill||t&&ve(t.fill)&&t.fill;s&&(n.fill=s);let c=e&&ve(e.protection)&&e.protection||t&&ve(t.protection)&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=Me.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=Me.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{...this.style}))}isMergedTo(t){return this._value.type===e.Types.Merge&&this._value.isMergedTo?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=Me.create(Me.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new me(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof me?this._comment=e:this._comment=new me(e)}get text(){return this._value.toString()}get html(){return de(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=Me.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType??D.FormulaType.None}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=Me.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=me.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},ye=class{constructor(e){this.model={address:e.address,type:O.Types.Null}}get value(){return null}set value(e){}get type(){return O.Types.Null}get effectiveType(){return O.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},be=class{constructor(e,t){this.model={address:e.address,type:O.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Number}get effectiveType(){return O.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()}},xe=class{constructor(e,t){this.model={address:e.address,type:O.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.String}get effectiveType(){return O.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}},Se=class{constructor(e,t){this.model={address:e.address,type:O.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 O.Types.RichText}get effectiveType(){return O.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(){}},Ce=class{constructor(e,t){this.model={address:e.address,type:O.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Date}get effectiveType(){return O.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()}},we=class{constructor(e,t){this.model={address:e.address,type:O.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text??``,hyperlink:this.model.hyperlink??``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return O.Types.Hyperlink}get effectiveType(){return O.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??``}},Te=class{constructor(e,t){this.model={address:e.address,type:O.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 O?(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 O.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value==null?``:this.value.toString()}},Ee=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:O.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(Me.getType(e)){case O.Types.Null:case O.Types.String:case O.Types.Number:case O.Types.Date:break;case O.Types.Hyperlink:case O.Types.Formula:default:throw new g(String(Me.getType(e)),`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?D.FormulaType.Master:this.model.sharedFormula?D.FormulaType.Shared:D.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return O.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?D.ValueType.Null:typeof e==`string`?D.ValueType.String:typeof e==`number`?D.ValueType.Number:e instanceof Date?D.ValueType.Date:typeof e==`object`&&`error`in e?D.ValueType.Error:D.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&t.formula?_e(t.formula,t.address,this.model.address):void 0}return this._translatedFormula}toCsvString(){return`${this.model.result??``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},De=class{constructor(e,t){this.model={address:e.address,type:O.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.SharedString}get effectiveType(){return O.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},Oe=class{constructor(e,t){this.model={address:e.address,type:O.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Boolean}get effectiveType(){return O.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()}},ke=class{constructor(e,t){this.model={address:e.address,type:O.Types.Checkbox,value:t.checkbox}}get value(){return{checkbox:this.model.value}}set value(e){this.model.value=e.checkbox}get type(){return O.Types.Checkbox}get effectiveType(){return O.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()}},Ae=class{constructor(e,t){this.model={address:e.address,type:O.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Error}get effectiveType(){return O.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()}},je=class{constructor(e,t){this.model={address:e.address,type:O.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 O.Types.String}get effectiveType(){return O.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 Me={getType(e){if(e==null)return O.Types.Null;if(typeof e==`string`)return O.Types.String;if(typeof e==`number`)return O.Types.Number;if(typeof e==`boolean`)return O.Types.Boolean;if(e instanceof Date)return O.Types.Date;if(typeof e==`object`){if(`checkbox`in e&&typeof e.checkbox==`boolean`)return O.Types.Checkbox;if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return O.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return O.Types.Formula;if(`richText`in e&&e.richText)return O.Types.RichText;if(`sharedString`in e&&e.sharedString)return O.Types.SharedString;if(`error`in e&&e.error)return O.Types.Error}return O.Types.JSON},types:[{t:O.Types.Null,f:ye},{t:O.Types.Number,f:be},{t:O.Types.String,f:xe},{t:O.Types.Date,f:Ce},{t:O.Types.Hyperlink,f:we},{t:O.Types.Formula,f:Ee},{t:O.Types.Merge,f:Te},{t:O.Types.JSON,f:je},{t:O.Types.SharedString,f:De},{t:O.Types.RichText,f:Se},{t:O.Types.Boolean,f:Oe},{t:O.Types.Error,f:Ae},{t:O.Types.Checkbox,f:ke}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw new g(String(e),`Could not create Value`);return new r(t,n)}},Ne=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),Pe=(e,t,n,r=[])=>{e[n]&&(t[n]=Ne(e[n],r))},Fe=e=>Object.keys(e).length===0,Ie=e=>{if(!e)return e;if(Fe(e))return{};let t={...e};return Pe(e,t,`font`,[`color`]),Pe(e,t,`alignment`),Pe(e,t,`protection`),e.border&&(Pe(e,t,`border`),Pe(e.border,t.border,`top`,[`color`]),Pe(e.border,t.border,`left`,[`color`]),Pe(e.border,t.border,`bottom`,[`color`]),Pe(e.border,t.border,`right`,[`color`]),Pe(e.border,t.border,`diagonal`,[`color`])),e.fill&&(Pe(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>Ne(e,[`color`])))),t};var Le=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){this._worksheet=void 0,this._cells=void 0,this.style=void 0}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new O(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:w.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:w.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=Ie(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=Ie(s.style)??{},c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==D.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==D.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:w.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:w.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}getValues(){let e=[];return this._cells.forEach(t=>{t&&t.type!==D.ValueType.Null&&(e[t.col-1]=t.value)}),e}valuesToString(e=`,`){return this.getValues().join(e)}get hasValues(){return this._cells.some(e=>e&&e.type!==D.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!==D.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelRow??0))}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height!=null||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,customHeight:this.customHeight,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed,dyDescent:this.dyDescent}:null}set model(e){if(e.number!==this._number)throw new l(`Invalid row number in model`);this._cells=[];let t;e.cells.forEach(e=>{switch(e.type){case O.Types.Merge:break;default:{let n;if(e.address)n=w.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:w.encodeAddress(e,r),$col$row:`$${w.n2l(r)}$${e}`}}if(t=n,!n)break;let r=this.getCellEx(n);r.model=e;break}}}),e.height==null?delete this.height:this.height=e.height,e.customHeight==null?delete this.customHeight:this.customHeight=e.customHeight,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel??0,this.dyDescent=e.dyDescent,this.style=e.style?structuredClone(e.style):{}}},Re=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 w.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,bestFit:this.bestFit}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden,this.bestFit=e.bestFit):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0,delete this.bestFit)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(e,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelCol??0))}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&ue(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&this.bestFit===e.bestFit&&ue(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel||this.bestFit)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==D.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||1048575,a={id:this._number,max:i,man:1};r&&(a.min=r),n.colBreaks.push(a)}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed,bestFit:e.bestFit},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){let r=t,i=Array.isArray(t)?t:n??[];i??=[];let a=[],o=1,s=0;for(i=i.sort((e,t)=>e.min-t.min);s<i.length;){let t=i[s++];for(;o<t.min;)a.push(new e(r,o++));for(;o<=t.max;)a.push(new e(r,o++,t))}return a}};function ze(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function Be(e){return typeof e==`object`&&`col`in e&&`row`in e}var Ve=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=w.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else ze(t)?(this.nativeCol=t.nativeCol??0,this.nativeColOff=t.nativeColOff??0,this.nativeRow=t.nativeRow??0,this.nativeRowOff=t.nativeRowOff??0):Be(t)?(this.col=t.col+n,this.row=t.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeColOff===0?this.nativeCol:this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e);let t=e-this.nativeCol;this.nativeColOff=t===0?0:Math.floor(t*this.colWidth)}get row(){return this.nativeRowOff===0?this.nativeRow:this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e);let t=e-this.nativeRow;this.nativeRowOff=t===0?0:Math.floor(t*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){let e=this.worksheet?.getRow(this.nativeRow+1)?.height;return e?Math.floor(e*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}clone(t){return new e(t??this.worksheet,this.model)}},He=class e{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId??``};case`image`:{let e=this.range;if(!e)throw new C(`Image has no range`);return{type:this.type,imageId:this.imageId??``,hyperlinks:e.hyperlinks,range:{tl:e.tl.model,br:e.br?.model,ext:e.ext,editAs:e.editAs}}}default:throw new C(`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=w.decode(n);`top`in e&&(this.range={tl:new Ve(this.worksheet,{col:e.left,row:e.top},-1),br:new Ve(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else n&&(this.range={tl:new Ve(this.worksheet,n.tl,0),br:n.br?new Ve(this.worksheet,n.br,0):void 0,ext:n.ext,editAs:n.editAs,hyperlinks:r||(`hyperlinks`in n?n.hyperlinks:void 0)})}clone(t){let n=t??this.worksheet,r=new e(n);return r.type=this.type,r.imageId=this.imageId,this.range&&(r.range={tl:this.range.tl.clone(n),br:this.range.br?this.range.br.clone(n):void 0,ext:this.range.ext?{...this.range.ext}:void 0,editAs:this.range.editAs,hyperlinks:this.range.hyperlinks?{...this.range.hyperlinks}:void 0}),r}};let Ue=/^[A-Za-z]{1,3}\d+$/,We=/^[Rr]\d+[Cc]\d+$/,Ge=new Set([`C`,`c`,`R`,`r`]),Ke=/\s/g,qe=/[^\p{L}\p{N}_.]/gu,Je=/^[\p{L}_\\]/u;function Ye(e){let t=e.replace(Ke,`_`),n=!1;return t.startsWith(`\\`)&&(n=!0,t=t.slice(1)),t=t.replace(qe,``),n&&(t=`\\${t}`),t.length>0&&!Je.test(t)&&(t=`_${t}`),t.length===0?`_Table`:(t.length===1&&Ge.has(t)&&(t=`_${t}`),(Ue.test(t)||We.test(t))&&(t=`_${t}`),t.length>255&&(t=t.slice(0,255)),t)}var Xe=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},Ze=class e{constructor(e,t){if(this.worksheet=e,t){if(this.table=t,Array.isArray(t.rows)&&t.rows.length===0&&t.tableRef){let n=w.decode(t.tableRef);if(`dimensions`in n){let r=n.top+(t.headerRow===!1?0:1),i=n.bottom-(t.totalsRow===!0?1:0);if(i>=r)for(let a=r;a<=i;a++){let r=e.getRow(a),i=[];for(let e=n.left;e<=n.right;e++)i.push(r.getCell(e).value);t.rows.push(i)}}}this.validate(),this.store()}}static{this.SUBTOTAL_FUNCTIONS={average:101,countNums:102,count:103,max:104,min:105,stdDev:106,var:107,sum:109}}getFormula(t){if(t.totalsRowFunction===`none`)return null;if(t.totalsRowFunction===`custom`)return t.totalsRowFormula??null;let n=t.totalsRowFunction?e.SUBTOTAL_FUNCTIONS[t.totalsRowFunction]:void 0;if(n!==void 0)return`SUBTOTAL(${n},${this.table.name}[${t.name}])`;throw new ee(`Invalid Totals Row Function: ${t.totalsRowFunction}`)}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+(this.table.headerRow?1:0)}get tableHeight(){return this.filterHeight+(this.table.totalsRow?1:0)}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{});let n=e.style;t(n,`theme`,`TableStyleMedium2`),t(n,`showFirstColumn`,!1),t(n,`showLastColumn`,!1),t(n,`showRowStripes`,!1),t(n,`showColumnStripes`,!1),e.name&&=Ye(e.name),e.displayName&&=Ye(e.displayName);let r=(e,t)=>{if(!e)throw new ee(t)};r(!!e.name,`Table must have a name`),r(!!e.ref,`Table must have ref`),r(!!e.columns,`Table must have column definitions`),r(!!e.rows,`Table must have row definitions`),e.tl=w.decodeAddress(e.ref);let{row:i,col:a}=e.tl;r(i>0,`Table must be on valid row`),r(a>0,`Table must be on valid col`);let{width:o,tableHeight:s}=this;e.autoFilterRef=w.encode(i,a,i,a+o-1),e.tableRef=w.encode(i,a,i+s-1,a+o-1),e.columns.forEach((e,n)=>{r(!!e.name,`Column ${n} must have a name`),n===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)??void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r);if(typeof t==`object`&&t&&`formula`in t&&typeof t.formula==`string`){let e=t,r=n.qualifyImplicitStructuredReferences===!0;a.value={...e,formula:r?e.formula.replace(/(^|[^A-Za-z0-9_])\[@\[?([^\[\]]+?)\]?\]/g,`$1${n.name}[[#This Row],[$2]]`):e.formula}}else a.value=t;e(a,n.columns[r]?.style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);if(n===0)r.value=t.totalsRowLabel;else{let e=this.getFormula(t);e?r.value={formula:e,result:t.totalsRowResult}:r.value=null}e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);if(t===0)n.value=e.totalsRowLabel;else{let t=this.getFormula(e);t&&(n.value={formula:t,result:e.totalsRowResult})}})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=w.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store(),this._cache=void 0}addRow(e,t,n){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e),n?.commit!==!1&&this.commit()}removeRows(e,t=1,n){this.cacheState(),this.table.rows.splice(e,t),n?.commit!==!1&&this.commit()}getColumn(e){let t=this.table.columns[e];return new Xe(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.cacheState(),this.table.name=Ye(e)}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.cacheState(),this.table.displayName=Ye(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)}_ensureStyle(){return this.table.style||(this.table.style={}),this.table.style}get theme(){return this.table.style?.theme}set theme(e){this._ensureStyle().theme=e}get showFirstColumn(){return this.table.style?.showFirstColumn}set showFirstColumn(e){this._ensureStyle().showFirstColumn=e}get showLastColumn(){return this.table.style?.showLastColumn}set showLastColumn(e){this._ensureStyle().showLastColumn=e}get showRowStripes(){return this.table.style?.showRowStripes}set showRowStripes(e){this._ensureStyle().showRowStripes=e}get showColumnStripes(){return this.table.style?.showColumnStripes}set showColumnStripes(e){this._ensureStyle().showColumnStripes=e}},Qe=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;for(let t of Object.keys(this.model)){if(!t.startsWith(`range:`))continue;n||=w.decodeAddress(e);let r=t.slice(6),i=w.decodeEx(r);if(!(`dimensions`in i))continue;let{tl:a,br:o}=i,s=typeof a==`string`?w.decodeAddress(a):a,c=typeof o==`string`?w.decodeAddress(o):o;if(n.row>=s.row&&n.row<=c.row&&n.col>=s.col&&n.col<=c.col)return this.model[t]}}remove(e){this.model[e]=void 0}};let $e=9525,et=12700,tt=142875,nt=28575,rt=276225,it=190500;var at=class e{constructor(e,t,n){this.worksheet=e;let{tl:r,br:i}=this._parseRange(t),a=1025+(e.formControls?.length??0),o;n?.link&&(o=this._toAbsoluteRef(n.link)),this.model={shapeId:a,ctrlPropId:0,tl:r,br:i,link:o,checked:n?.checked?`Checked`:`Unchecked`,text:n?.text??``,noThreeD:n?.noThreeD??!0,print:n?.print??!1}}get checked(){return this.model.checked===`Checked`}set checked(e){this.model.checked=e?`Checked`:`Unchecked`}get link(){return this.model.link}set link(e){this.model.link=e?this._toAbsoluteRef(e):void 0}get text(){return this.model.text}set text(e){this.model.text=e}_toAbsoluteRef(e){if(e.includes(`$`))return e;let t=w.decodeAddress(e);return`$${w.n2l(t.col)}$${t.row}`}_parseRange(e){let t,n;if(typeof e==`string`)if(e.includes(`:`)){let r=w.decode(e);if(`top`in r)if(r.left===r.right&&r.top===r.bottom){let e=r.left-1,i=r.top-1;t={col:e,colOff:tt,row:i,rowOff:nt},n={col:e+2,colOff:rt,row:i+1,rowOff:it}}else t={col:r.left-1,colOff:tt,row:r.top-1,rowOff:nt},n={col:r.right-1,colOff:rt,row:r.bottom-1,rowOff:it};else t={col:r.col-1,colOff:tt,row:r.row-1,rowOff:nt},n={col:r.col+1,colOff:rt,row:r.row,rowOff:it}}else{let r=w.decodeAddress(e);t={col:r.col-1,colOff:tt,row:r.row-1,rowOff:nt},n={col:r.col+1,colOff:rt,row:r.row,rowOff:it}}else if(`startCol`in e)t={col:e.startCol,colOff:e.startColOff??tt,row:e.startRow,rowOff:e.startRowOff??nt},n={col:e.endCol,colOff:e.endColOff??rt,row:e.endRow,rowOff:e.endRowOff??it};else{if(typeof e.tl==`string`){let n=w.decodeAddress(e.tl);t={col:n.col-1,colOff:tt,row:n.row-1,rowOff:nt}}else t={col:e.tl.col,colOff:e.tl.colOff??tt,row:e.tl.row,rowOff:e.tl.rowOff??nt};if(e.br)if(typeof e.br==`string`){let t=w.decodeAddress(e.br);n={col:t.col-1,colOff:rt,row:t.row-1,rowOff:it}}else n={col:e.br.col,colOff:e.br.colOff??rt,row:e.br.row,rowOff:e.br.rowOff??it};else n={col:t.col+2,colOff:rt,row:t.row+1,rowOff:it}}return{tl:t,br:n}}getVmlAnchor(){return e.getVmlAnchor(this.model)}getVmlStyle(){return e.getVmlStyle(this.model)}getVmlCheckedValue(){return e.getVmlCheckedValue(this.model)}static getVmlAnchor(e){let{tl:t,br:n}=e,r=Math.round(t.colOff/$e),i=Math.round(t.rowOff/$e),a=Math.round(n.colOff/$e),o=Math.round(n.rowOff/$e);return`${t.col}, ${r}, ${t.row}, ${i}, ${n.col}, ${a}, ${n.row}, ${o}`}static getVmlStyle(e){return`position:absolute;margin-left:${Math.round(e.tl.colOff/et)}pt;margin-top:${Math.round(e.tl.rowOff/et)}pt;width:96pt;height:18pt;z-index:1;visibility:visible`}static getVmlCheckedValue(e){switch(e.checked){case`Checked`:return 1;case`Mixed`:return 2;default:return 0}}};function ot(){return typeof process<`u`&&!!process.versions?.node}var st=class extends t{constructor(...e){super(...e),this.name=`XmlError`}},ct=class extends st{constructor(e,t,n){let r=[];t?.fileName&&r.push(t.fileName),t?.line!==void 0&&r.push(`${t.line}:${t.column??0}`);let i=r.length>0?`${r.join(`:`)}: `:``;super(`${i}${e}`,n),this.name=`XmlParseError`,this.line=t?.line,this.column=t?.column,this.fileName=t?.fileName}},lt=class extends st{constructor(e,t,n){super(`Cannot ${e}: ${t}`,n),this.name=`XmlWriteError`,this.operation=e,this.state=t}};let ut={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`},dt=/&(#\d+|#[xX][0-9A-Fa-f]+|\w+);/g,ft=(()=>{let e=new Uint8Array(128);for(let t=0;t<=8;t++)e[t]=2;e[11]=2,e[12]=2;for(let t=14;t<=31;t++)e[t]=2;return e[127]=2,e[34]=1,e[38]=1,e[39]=1,e[60]=1,e[62]=1,e})(),pt={34:`"`,38:`&`,39:`'`,60:`<`,62:`>`};function mt(e){return e.indexOf(`&`)===-1?e:e.replace(dt,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isNaN(n)||n<1||n>=55296&&n<=57343||n>1114111?e:String.fromCodePoint(n)}return ut[t]??e})}function k(e){let t=e.length,n=-1;for(let r=0;r<t;r++){let t=e.charCodeAt(r);if(t<128){if(ft[t]!==0){n=r;break}}else if(t>=55296&&t<=57343){if(t<=56319){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343){r++;continue}}n=r;break}else if(t===65534||t===65535){n=r;break}}if(n===-1)return e;let r=[],i=0;for(let a=n;a<t;a++){let t=e.charCodeAt(a);if(t<128){let n=ft[t];if(n===0)continue;i<a&&r.push(e.substring(i,a)),n===1&&r.push(pt[t]),i=a+1}else if(t>=55296&&t<=56319){let t=e.charCodeAt(a+1);if(t>=56320&&t<=57343){a++;continue}i<a&&r.push(e.substring(i,a)),i=a+1}else (t>=56320&&t<=57343||t===65534||t===65535)&&(i<a&&r.push(e.substring(i,a)),i=a+1)}return i<t&&r.push(e.substring(i)),r.length===1?r[0]:r.join(``)}function ht(e){return k(e)}let gt=/[\s<>"'\/=&]/;function _t(e){if(!e)throw new st(`XML name must not be empty`);if(gt.test(e))throw new st(`Invalid XML name: contains forbidden character in "${e}"`);let t=e.charCodeAt(0);if(t>=48&&t<=57||t===45||t===46)throw new st(`Invalid XML name: "${e}" starts with forbidden character`)}function vt(e){return`<![CDATA[`+e.split(`]]>`).join(`]]]]><![CDATA[>`)+`]]>`}function yt(e){if(e.includes(`--`)||e.endsWith(`-`))throw new st(`Invalid comment: must not contain "--" or end with "-"`)}let A={version:`1.0`,encoding:`UTF-8`,standalone:`yes`};function bt(e){if(ot())return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function xt(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function St(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}function Ct(e){return new Date(e.endsWith(`Z`)?e:e+`Z`)}let wt=/_x([0-9A-Fa-f]{4})_/g;function Tt(e){return e.replace(wt,(e,t)=>{let n=parseInt(t,16);return n===0||n>=1&&n<=8||n===11||n===12||n>=14&&n<=31||n===127||n>=55296&&n<=57343||n===65534||n===65535?e:String.fromCharCode(n)})}function Et(e){return e.replace(wt,`_x005F_x$1_`)}let Dt=/[\t\n\r]/g,Ot={" ":`_x0009_`,"\n":`_x000A_`,"\r":`_x000D_`};function kt(e){let t=e.replace(wt,`_x005F_x$1_`);return t=t.replace(Dt,e=>Ot[e]),t}function At(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function jt(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}let Mt=/[ymdhMsb]/,Nt=/\[[^\]]*\]|"[^"]*"/g,Pt=new Map;function Ft(e){if(!e)return!1;let t=Pt.get(e);if(t!==void 0)return t;let n=jt(e)[0].replace(Nt,``),r;return r=n.indexOf(`@`)>-1?!1:Mt.test(n),Pt.set(e,r),r}function It(e){return e===!0||e===`true`||e===1||e===`1`}function*Lt(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 Rt(e){let t=Array.from(e);return t.length<=1?t:t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.every(e=>e instanceof Date)?t.sort((e,t)=>e.getTime()-t.getTime()):t.sort((e,t)=>{let n=zt(e),r=zt(t);return n===r?n===0?e-t:n===1?e.getTime()-t.getTime():String(e).localeCompare(String(t)):n-r})}function zt(e){return Number.isFinite(e)?0:e instanceof Date?1:2}let Bt=new TextDecoder(`utf-8`),Vt,Ht=!1;function Ut(){if(!Ht){Ht=!0;try{Vt=new TextDecoder(`latin1`)}catch{Vt=void 0}}return Vt}function Wt(e){return typeof e==`string`?e:Bt.decode(e)}function Gt(e){if(ot())return Buffer.from(e).toString(`base64`);if(Ut())try{return btoa(Vt.decode(e))}catch{}let t=32768,n=[];for(let r=0;r<e.length;r+=t)n.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return btoa(n.join(``))}function Kt(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}var qt=class{constructor(e){this.code=e}toString(){return`#${this.code}`}};let Jt={sum:`Sum`,count:`Count`,average:`Average`,max:`Max`,min:`Min`,product:`Product`,countNums:`Count Numbers`,stdDev:`StdDev`,stdDevP:`StdDevP`,var:`Var`,varP:`VarP`},Yt=new Set(Object.keys(Jt));function Xt(e){let t=e.model;if(t.headerRow===!1)throw new S(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!t.rows||t.rows.length===0)throw new S(`Cannot create pivot table from an empty table. Add data rows to the table.`);let n=t.columns.map(e=>e.name),r=new Set;for(let e of n){if(r.has(e))throw new S(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);r.add(e)}let i=[void 0,...n],a=t.rows.map(e=>[void 0,...e]),o=t.tl;if(!o)throw Error(`Table "${t.name}" is missing top-left cell address (tl)`);let s=o.row,c=o.col,l=s+t.rows.length,u=c+n.length-1,d=w.encode(s,c,l,u);return{name:e.worksheet.name,tableName:t.name,getRow(e){if(e===1)return{values:i};let t=e-2;return t>=0&&t<a.length?{values:a[t]}:{values:[]}},getColumn(e){if(e<1||e>n.length)return{values:[]};let r=[];r[1]=n[e-1];for(let n=0;n<t.rows.length;n++)r[n+2]=t.rows[n][e-1];return{values:r}},getSheetValues(){let e=[];e[1]=i;for(let t=0;t<a.length;t++)e[t+2]=a[t];return e},dimensions:{shortRange:d}}}function Zt(e){if(e.sourceSheet&&e.sourceTable)throw new S(`Cannot specify both sourceSheet and sourceTable. Choose one.`);if(e.sourceTable)return Xt(e.sourceTable);if(!e.sourceSheet)throw Error(`Either sourceSheet or sourceTable must be provided.`);return e.sourceSheet}function Qt(e){return typeof e==`string`?e:e.name}function $t(e){return typeof e==`string`?void 0:e.metric}function en(e,t){let n=Zt(t);tn(t,n);let{rows:r}=t,i=t.columns??[],a=t.pages??[],o=t.values.map(Qt),s=t.metric??`sum`,c=t.values.map(e=>$t(e)??s),l=rn(n,[...r,...i,...a],o),u={};for(let e=0;e<l.length;e++)u[l[e].name]=e;let d=(e,t)=>{let n=u[e];if(n===void 0)throw Error(`${t} field "${e}" not found in cache fields`);return n},f=r.map(e=>d(e,`Row`)),p=i.map(e=>d(e,`Column`)),m=o.map(e=>d(e,`Value`)),h=a.map(e=>d(e,`Page`)),g=e.workbook.pivotTables.map(e=>e.tableNumber).filter(e=>Number.isFinite(e)),_=g.length>0?g.reduce((e,t)=>e>t?e:t,-1/0)+1:1,v=e.workbook.pivotTables.map(e=>parseInt(e.cacheId,10)).filter(e=>Number.isFinite(e)),y=v.length>0?v.reduce((e,t)=>e>t?e:t,-1/0)+1:10+_-1;return{source:n,rows:f,columns:p,values:m,pages:h,metric:s,valueMetrics:c,cacheFields:l,cacheId:String(y),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:_}}function tn(e,t){let n=e.columns??[],r=e.pages??[],i=e.values.map(Qt),a=t.getRow(1).values.slice(1);for(let e=0;e<a.length;e++){let n=a[e];if(n==null||n===``||typeof n==`string`&&n.trim()===``)throw Error(`Empty or missing header name at column ${e+1} in ${t.name}. Pivot tables require all columns to have non-empty headers.`)}let o=new Set;for(let e of a){let n=String(e);if(o.has(n))throw Error(`Duplicate header name "${n}" found in ${t.name}. Pivot tables require unique column names.`);o.add(n)}let s=new Set(a.map(String)),c=e=>{if(!s.has(e))throw new S(`The header name "${e}" was not found in ${t.name}.`)};for(let t of e.rows)c(t);for(let e of n)c(e);for(let e of i)c(e);for(let e of r)c(e);let l=new Map,u=[{name:`rows`,fields:e.rows},{name:`columns`,fields:n},{name:`pages`,fields:r}];for(let e of u)for(let t of e.fields){let n=l.get(t);if(n===e.name)throw Error(`Duplicate field "${t}" in ${e.name}. Each field can only appear once per axis area.`);if(n)throw Error(`Field "${t}" cannot appear in both ${n} and ${e.name}. Each field can only be assigned to one axis area.`);l.set(t,e.name)}if(!e.rows.length)throw new S(`No pivot table rows specified.`);if(e.values.length<1)throw new S(`Must have at least one value.`);if(e.metric!==void 0&&!Yt.has(e.metric))throw Error(`Invalid metric "${e.metric}". Must be one of: ${[...Yt].join(`, `)}.`);for(let t of e.values){let e=$t(t);if(e!==void 0&&!Yt.has(e))throw Error(`Invalid metric "${e}" on value field "${Qt(t)}". Must be one of: ${[...Yt].join(`, `)}.`)}let d=new Set;for(let e of i){if(d.has(e))throw Error(`Duplicate value field "${e}". Each value field name must be unique.`);d.add(e)}}function nn(e){if(e==null)return null;if(typeof e!=`object`||e instanceof Date||e instanceof qt)return e;let t=e;if(typeof t.error==`string`){let e=t.error;return new qt(e.startsWith(`#`)?e.slice(1):e)}if(`formula`in t||`sharedFormula`in t){let e=t.result;return e==null?null:nn(e)}return Array.isArray(t.richText)?t.richText.map(e=>e.text??``).join(``):typeof t.text==`string`&&typeof t.hyperlink==`string`?t.text:typeof t.checkbox==`boolean`?t.checkbox:String(e)}function rn(e,t,n){let r=e.getRow(1).values,i=new Set(t),a=new Set(n),o=t=>{let n=e.getColumn(t).values,r=new Set,i=new Map,a=!1;for(let e=2;e<n.length;e++){let t=nn(n[e]);t===null||typeof t==`number`&&isNaN(t)?a=!0:t instanceof qt?i.has(t.code)||(i.set(t.code,t),r.add(t)):r.add(t)}let o=Rt(r);return a&&o.push(null),o},s=t=>{let n=e.getColumn(t).values,r=1/0,i=-1/0,a=!1,o=!0;for(let e=2;e<n.length;e++){let t=nn(n[e]);typeof t==`number`&&!isNaN(t)&&(a=!0,t<r&&(r=t),t>i&&(i=t),Number.isInteger(t)||(o=!1))}return a?{minValue:r,maxValue:i,allInteger:o}:null},c=[];for(let e of Lt(1,r.length)){let t=r[e],n=String(t);if(i.has(n))c.push({name:n,sharedItems:o(e)});else if(a.has(n)){let t=s(e);c.push({name:n,sharedItems:null,containsNumber:t?`1`:void 0,minValue:t?.minValue,maxValue:t?.maxValue,containsInteger:t?.allInteger?`1`:void 0})}else c.push({name:n,sharedItems:null})}return c}function an(e,t,n,r,i){let a=i(e,t)?.style?.border,o=r-t+1,s=n-e+1,c=Array(o),l=Array(o),u=Array(s),d=Array(s),f=!1;for(let o=t;o<=r;o++){let r=o-t,s=i(e,o)?.style?.border;c[r]=s?.top||a?.top,n===e?l[r]=s?.bottom||a?.bottom:l[r]=i(n,o)?.style?.border?.bottom||a?.bottom,(c[r]||l[r])&&(f=!0)}for(let o=e;o<=n;o++){let n=o-e,s=i(o,t)?.style?.border;u[n]=s?.left||a?.left,r===t?d[n]=s?.right||a?.right:d[n]=i(o,r)?.style?.border?.right||a?.right,(u[n]||d[n])&&(f=!0)}let p=a?.diagonal,m=a?.color;if(!(!f&&!p))return{topEdges:c,bottomEdges:l,leftEdges:u,rightEdges:d,diagonal:p,color:m}}function on(e,t,n,r,i,a){let{topEdges:o,bottomEdges:s,leftEdges:c,rightEdges:l,diagonal:u,color:d}=i,f=a(e,t).style;for(let i=e;i<=n;i++)for(let p=t;p<=r;p++){let m=a(i,p),h=Ie(f)||{},g={},_=!1;i===e&&o[p-t]&&(g.top=o[p-t],_=!0),i===n&&s[p-t]&&(g.bottom=s[p-t],_=!0),p===t&&c[i-e]&&(g.left=c[i-e],_=!0),p===r&&l[i-e]&&(g.right=l[i-e],_=!0),u&&(g.diagonal=u,_=!0),_?(d&&(g.color=d),h.border=g):delete h.border,m.style=h}}function sn(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function cn(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 ln(e,t){let n=10**t;return Math.round(e*n)/n}function un(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function dn(e){return/^General$/i.test(e.trim())}function fn(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let pn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],mn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],hn=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],gn=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],_n=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function vn(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=St(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=un(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,hn[c]).replace(/\x00MN4\x00/g,mn[c]).replace(/\x00MN3\x00/g,pn[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,_n[u]).replace(/\x00DN3\x00/g,gn[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function yn(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 bn(e,t){let n=(t.match(/%/g)??[]).length;return Tn(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function xn(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=ln(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=sn(Math.abs(s),2);return n+c+`E`+l+u}function Sn(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 Cn(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]=Sn(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 wn(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 Tn(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=``]=ln(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=cn(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 En(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 Dn(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 On(e,t){if(typeof t==`string`){let n=jt(e);return n.length>=4&&n[3]?En(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=jt(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&&Dn(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 kn(e,t){let n=jt(e);return n.length>=2&&n[1]===t}function An(e,t){if(t==null)return``;if(dn(e))return yn(t);if(typeof t==`string`)return On(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=On(e,n);n<0&&kn(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=un(i),i=En(i),/\[[hms]+\]/i.test(i))return wn(n,i);if(fn(i))return vn(n,i);if(i.includes(`%`))return bn(n,i);if(/E[+-]?/i.test(i))return xn(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return Cn(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+Tn(-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=Tn(n,i);return a+l+o}function jn(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function Mn(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function Nn(e,t,n){if(e instanceof Date){let r=xt(e);return jn(t)?(r%=1,r<0&&(r+=1),An(t,r)):An(n&&Mn(t)?n:t,r)}return An(t,e)}function Pn(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return Nn(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return Nn(e,i,t)}return e.text}let Fn=new TextEncoder,In=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ln=new Map;function Rn(e){let t=(e??`utf-8`).trim().toLowerCase();return t===``||t===`utf8`||t===`utf-8`?`utf-8`:t===`utf16le`||t===`utf-16le`||t===`ucs2`||t===`ucs-2`?`utf-16le`:t===`binary`?`latin1`:t}function zn(e){let t=Rn(e);if(t===`utf-8`)return In;let n=Ln.get(t);return n||(n=Bn(t),Ln.set(t,n)),n}function Bn(e,t){try{return new TextDecoder(e,t)}catch(t){throw TypeError(`Unsupported text encoding: ${e}`,{cause:t})}}function Vn(e){let t=Rn(e);switch(t){case`hex`:return new Hn;case`base64`:return new Kn(!1);case`base64url`:return new Kn(!0);case`ascii`:return new qn;default:return Bn(t,{ignoreBOM:!0})}}var Hn=class{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=Un[e[n]];return t}};let Un=(()=>{let e=Array(256);for(let t=0;t<256;t++)e[t]=t.toString(16).padStart(2,`0`);return e})(),Wn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Gn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`;var Kn=class{constructor(e){this._remainder=null,this._chars=e?Gn:Wn}decode(e,t){let n;if(this._remainder){let t=new Uint8Array(this._remainder.length+e.length);t.set(this._remainder),t.set(e,this._remainder.length),n=t}else n=e;if(t?.stream??!1){let e=n.length%3,t=n.length-e;return this._remainder=e>0?n.slice(t):null,t>0?this._encodeBytes(n,t):``}return this._remainder=null,n.length>0?this._encodeBytes(n,n.length):``}_encodeBytes(e,t){let n=this._chars,r=n===Gn,i=``,a=0;for(;a+2<t;a+=3){let t=e[a],r=e[a+1],o=e[a+2];i+=n[t>>>2]+n[(t&3)<<4|r>>>4]+n[(r&15)<<2|o>>>6]+n[o&63]}let o=t-a;if(o===1){let t=e[a];i+=n[t>>>2]+n[(t&3)<<4],r||(i+=`==`)}else if(o===2){let t=e[a],o=e[a+1];i+=n[t>>>2]+n[(t&3)<<4|o>>>4]+n[(o&15)<<2],r||(i+=`=`)}return i}},qn=class{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]&127);return t}};function Jn(e){let t=``;for(let n=0;n<e.length;n++)t+=Un[e[n]];return t}function Yn(e,t){let n=t?Gn:Wn,r=``,i=0;for(;i+2<e.length;i+=3){let t=e[i],a=e[i+1],o=e[i+2];r+=n[t>>>2]+n[(t&3)<<4|a>>>4]+n[(a&15)<<2|o>>>6]+n[o&63]}let a=e.length-i;if(a===1){let a=e[i];r+=n[a>>>2]+n[(a&3)<<4],t||(r+=`==`)}else if(a===2){let a=e[i],o=e[i+1];r+=n[a>>>2]+n[(a&3)<<4|o>>>4]+n[(o&15)<<2],t||(r+=`=`)}return r}function Xn(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]&127);return t}function Zn(e,t){let n=Rn(t);switch(n){case`hex`:return Jn(e);case`base64`:return Yn(e,!1);case`base64url`:return Yn(e,!0);case`ascii`:return Xn(e);default:return zn(n).decode(e)}}function Qn(e){return Fn.encode(e)}function $n(e,t){return zn(t).decode(e)}function j(e,t){let n=e.length;if(n===0)return new Uint8Array;if(n===1){let t=e[0];return t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(t===void 0){let r=0;for(let t=0;t<n;t++)r+=e[t].length;t=r}let r=new Uint8Array(t),i=0;for(let t=0;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r}function er(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`)return Fn.encode(e);if(e instanceof ArrayBuffer||Array.isArray(e))return new Uint8Array(e);throw TypeError(`Expected Uint8Array, got ${typeof e}`)}function tr(e){let t=globalThis.Buffer;return t?t.from(e.buffer,e.byteOffset,e.byteLength):e}function nr(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}let rr={async hash(e,...t){let n=j(t),r=await crypto.subtle.digest(e,new Uint8Array(n));return new Uint8Array(r)},async convertPasswordToHash(e,t,n,r){let i=Kt(e),a=bt(n),o=await this.hash(t,a,i);for(let e=0;e<r;e++)o=await this.hash(t,o,nr(e));return Gt(o)},randomBytes(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}};async function ir(e,t){let n={sheet:!0};return t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(n.algorithmName=`SHA-512`,n.saltValue=Gt(rr.randomBytes(16)),n.spinCount=t&&`spinCount`in t?t.spinCount:1e5,n.hashValue=await rr.convertPasswordToHash(e,`SHA-512`,n.saltValue,n.spinCount)),t&&(Object.assign(n,t),!e&&`spinCount`in t&&delete n.spinCount),n}let ar={32:3,33:5,34:6,35:7,36:7,37:11,38:10,39:3,40:5,41:5,42:7,43:7,44:4,45:5,46:4,47:6,48:7,49:7,50:7,51:7,52:7,53:7,54:7,55:7,56:7,57:7,58:4,59:4,60:7,61:7,62:7,63:7,64:13,65:9,66:8,67:8,68:9,69:7,70:7,71:9,72:9,73:4,74:5,75:8,76:6,77:12,78:10,79:10,80:8,81:10,82:8,83:7,84:7,85:9,86:9,87:13,88:8,89:7,90:7,91:5,92:6,93:5,94:7,95:7,96:4,97:7,98:8,99:6,100:8,101:8,102:5,103:7,104:8,105:4,106:4,107:7,108:4,109:12,110:8,111:8,112:8,113:8,114:5,115:6,116:5,117:8,118:7,119:11,120:7,121:7,122:6,123:5,124:7,125:5,126:7},or={header:{unitsPerEm:2048,usWinAscent:1950,usWinDescent:550,maxDigitAdvance:1038,sTypoAscender:1536,sTypoDescender:-512,sTypoLineGap:452},defaultAdvance:1e3,cjkAdvance:2048,advances:[[32,1,463],[33,1,667],[34,1,821],[35,1,1020],[36,1,1038],[37,1,1464],[38,1,1397],[39,1,452],[40,2,621],[42,2,1020],[44,1,511],[45,1,627],[46,1,517],[47,1,791],[48,10,1038],[58,2,548],[60,3,1020],[63,1,949],[64,1,1831],[65,1,1185],[66,1,1114],[67,1,1092],[68,1,1260],[69,1,1e3],[70,1,941],[71,1,1292],[72,1,1276],[73,1,516],[74,1,653],[75,1,1064],[76,1,861],[77,1,1751],[78,1,1322],[79,1,1356],[80,1,1058],[81,1,1378],[82,1,1112],[83,1,941],[84,1,998],[85,1,1314],[86,1,1162],[87,1,1822],[88,1,1063],[89,1,998],[90,1,959],[91,1,628],[92,1,791],[93,1,628],[94,2,1020],[96,1,596],[97,1,981],[98,1,1076],[99,1,866],[100,1,1076],[101,1,1019],[102,1,625],[103,1,964],[104,1,1076],[105,1,470],[106,1,490],[107,1,931],[108,1,470],[109,1,1636],[110,1,1076],[111,1,1080],[112,2,1076],[114,1,714],[115,1,801],[116,1,686],[117,1,1076],[118,1,925],[119,1,1464],[120,1,887],[121,1,927],[122,1,809],[123,1,644],[124,1,943],[125,1,644],[126,1,1020]]},sr={header:{unitsPerEm:2048,usWinAscent:1854,usWinDescent:434,maxDigitAdvance:1139,sTypoAscender:1491,sTypoDescender:-431,sTypoLineGap:307},defaultAdvance:1024,cjkAdvance:2048,advances:[[32,1,569],[33,1,569],[34,1,727],[35,1,1139],[36,1,1139],[37,1,1821],[38,1,1366],[39,1,391],[40,1,682],[41,1,682],[42,1,797],[43,1,1196],[44,1,569],[45,1,682],[46,1,569],[47,1,569],[48,10,1139],[58,1,569],[59,1,569],[60,1,1196],[61,1,1196],[62,1,1196],[63,1,1139],[64,1,2079],[65,1,1366],[66,1,1366],[67,1,1479],[68,1,1479],[69,1,1366],[70,1,1251],[71,1,1593],[72,1,1479],[73,1,569],[74,1,1024],[75,1,1366],[76,1,1139],[77,1,1706],[78,1,1479],[79,1,1593],[80,1,1366],[81,1,1593],[82,1,1479],[83,1,1366],[84,1,1251],[85,1,1479],[86,1,1366],[87,1,1933],[88,1,1366],[89,1,1366],[90,1,1251],[91,1,569],[92,1,569],[93,1,569],[94,1,961],[95,1,1139],[96,1,682],[97,1,1139],[98,1,1139],[99,1,1024],[100,1,1139],[101,1,1139],[102,1,569],[103,1,1139],[104,1,1139],[105,1,455],[106,1,455],[107,1,1024],[108,1,455],[109,1,1706],[110,1,1139],[111,1,1139],[112,1,1139],[113,1,1139],[114,1,682],[115,1,1024],[116,1,569],[117,1,1139],[118,1,1024],[119,1,1479],[120,1,1024],[121,1,1024],[122,1,1024],[123,1,684],[124,1,532],[125,1,684],[126,1,1196]]},cr={header:{unitsPerEm:2048,usWinAscent:1854,usWinDescent:434,maxDigitAdvance:1139,sTypoAscender:1491,sTypoDescender:-431,sTypoLineGap:307},defaultAdvance:1070,cjkAdvance:2048,advances:[[32,1,569],[33,1,682],[34,1,974],[35,1,1139],[36,1,1139],[37,1,1821],[38,1,1479],[39,1,569],[40,1,682],[41,1,682],[42,1,797],[43,1,1196],[44,1,569],[45,1,682],[46,1,569],[47,1,569],[48,10,1139],[58,1,682],[59,1,682],[60,1,1196],[61,1,1196],[62,1,1196],[63,1,1251],[64,1,1991],[65,1,1479],[66,1,1479],[67,1,1479],[68,1,1479],[69,1,1366],[70,1,1251],[71,1,1593],[72,1,1479],[73,1,682],[74,1,1139],[75,1,1479],[76,1,1251],[77,1,1706],[78,1,1479],[79,1,1593],[80,1,1366],[81,1,1593],[82,1,1479],[83,1,1366],[84,1,1251],[85,1,1479],[86,1,1366],[87,1,1933],[88,1,1366],[89,1,1366],[90,1,1251],[91,1,682],[92,1,569],[93,1,682],[94,1,1196],[95,1,1139],[96,1,682],[97,1,1139],[98,1,1251],[99,1,1024],[100,1,1251],[101,1,1139],[102,1,682],[103,1,1251],[104,1,1251],[105,1,569],[106,1,569],[107,1,1139],[108,1,569],[109,1,1821],[110,1,1251],[111,1,1251],[112,1,1251],[113,1,1251],[114,1,797],[115,1,1024],[116,1,682],[117,1,1251],[118,1,1139],[119,1,1593],[120,1,1139],[121,1,1139],[122,1,1024],[123,1,797],[124,1,569],[125,1,797],[126,1,1196]]},lr={header:{unitsPerEm:2048,usWinAscent:1825,usWinDescent:443,maxDigitAdvance:1024,sTypoAscender:1420,sTypoDescender:-442,sTypoLineGap:307},defaultAdvance:900,cjkAdvance:2048,advances:[[32,1,512],[33,1,682],[34,1,836],[35,1,1024],[36,1,1024],[37,1,1706],[38,1,1593],[39,1,369],[40,1,682],[41,1,682],[42,1,1024],[43,1,1155],[44,1,512],[45,1,682],[46,1,512],[47,1,569],[48,10,1024],[58,1,569],[59,1,569],[60,1,1155],[61,1,1155],[62,1,1155],[63,1,909],[64,1,1886],[65,1,1479],[66,1,1366],[67,1,1366],[68,1,1479],[69,1,1251],[70,1,1139],[71,1,1479],[72,1,1479],[73,1,682],[74,1,797],[75,1,1479],[76,1,1251],[77,1,1821],[78,1,1479],[79,1,1479],[80,1,1139],[81,1,1479],[82,1,1366],[83,1,1139],[84,1,1251],[85,1,1479],[86,1,1479],[87,1,1933],[88,1,1479],[89,1,1479],[90,1,1251],[91,1,682],[92,1,569],[93,1,682],[94,1,961],[95,1,1024],[96,1,682],[97,1,909],[98,1,1024],[99,1,909],[100,1,1024],[101,1,909],[102,1,682],[103,1,1024],[104,1,1024],[105,1,569],[106,1,569],[107,1,1024],[108,1,569],[109,1,1479],[110,1,1024],[111,1,1024],[112,1,1024],[113,1,1024],[114,1,682],[115,1,797],[116,1,569],[117,1,1024],[118,1,1024],[119,1,1479],[120,1,1024],[121,1,1024],[122,1,909],[123,1,983],[124,1,410],[125,1,983],[126,1,1073]]},ur={header:{unitsPerEm:2048,usWinAscent:1705,usWinDescent:615,maxDigitAdvance:1229,sTypoAscender:1255,sTypoDescender:-386,sTypoLineGap:0},defaultAdvance:1229,cjkAdvance:2048,advances:[[32,95,1229]]},dr={header:{unitsPerEm:2048,usWinAscent:2059,usWinDescent:430,maxDigitAdvance:1302,sTypoAscender:1566,sTypoDescender:-423,sTypoLineGap:202},defaultAdvance:1200,cjkAdvance:2048,advances:[[32,1,720],[33,1,756],[34,1,933],[35,1,1521],[36,1,1198],[37,1,1807],[38,1,1487],[39,1,510],[40,1,756],[41,1,756],[42,1,1198],[43,1,1521],[44,1,643],[45,1,811],[46,1,643],[47,1,899],[48,10,1302],[58,1,756],[59,1,756],[60,1,1521],[61,1,1521],[62,1,1521],[63,1,1151],[64,1,1937],[65,1,1362],[66,1,1382],[67,1,1279],[68,1,1490],[69,1,1279],[70,1,1186],[71,1,1458],[72,1,1498],[73,1,924],[74,1,922],[75,1,1362],[76,1,1145],[77,1,1728],[78,1,1498],[79,1,1476],[80,1,1262],[81,1,1476],[82,1,1396],[83,1,1300],[84,1,1185],[85,1,1448],[86,1,1362],[87,1,1864],[88,1,1244],[89,1,1183],[90,1,1204],[91,1,756],[92,1,899],[93,1,756],[94,1,1521],[95,1,1198],[96,1,1198],[97,1,1224],[98,1,1302],[99,1,1075],[100,1,1302],[101,1,1218],[102,1,756],[103,1,1302],[104,1,1317],[105,1,643],[106,1,700],[107,1,1183],[108,1,643],[109,1,1937],[110,1,1317],[111,1,1271],[112,1,1302],[113,1,1302],[114,1,899],[115,1,1075],[116,1,811],[117,1,1317],[118,1,1183],[119,1,1728],[120,1,1183],[121,1,1183],[122,1,1031],[123,1,787],[124,1,756],[125,1,787],[126,1,1521]]},fr={header:{unitsPerEm:2048,usWinAscent:1878,usWinDescent:449,maxDigitAdvance:1257,sTypoAscender:1549,sTypoDescender:-444,sTypoLineGap:198},defaultAdvance:1100,cjkAdvance:2048,advances:[[32,1,504],[33,1,614],[34,1,679],[35,1,1257],[36,1,1024],[37,1,1539],[38,1,1350],[39,1,391],[40,1,614],[41,1,614],[42,1,842],[43,1,1257],[44,1,504],[45,1,751],[46,1,504],[47,1,797],[48,10,1257],[58,1,569],[59,1,569],[60,1,1257],[61,1,1257],[62,1,1257],[63,1,885],[64,1,1614],[65,1,1350],[66,1,1273],[67,1,1161],[68,1,1427],[69,1,1163],[70,1,1074],[71,1,1314],[72,1,1517],[73,1,721],[74,1,772],[75,1,1397],[76,1,1176],[77,1,1770],[78,1,1462],[79,1,1392],[80,1,1118],[81,1,1392],[82,1,1321],[83,1,1019],[84,1,1163],[85,1,1456],[86,1,1321],[87,1,1887],[88,1,1314],[89,1,1220],[90,1,1055],[91,1,614],[92,1,797],[93,1,614],[94,1,1257],[95,1,1024],[96,1,682],[97,1,1019],[98,1,1100],[99,1,866],[100,1,1106],[101,1,958],[102,1,654],[103,1,1006],[104,1,1152],[105,1,606],[106,1,606],[107,1,1048],[108,1,606],[109,1,1700],[110,1,1131],[111,1,1042],[112,1,1100],[113,1,1100],[114,1,772],[115,1,820],[116,1,688],[117,1,1117],[118,1,1019],[119,1,1559],[120,1,1007],[121,1,1012],[122,1,880],[123,1,637],[124,1,583],[125,1,637],[126,1,1257]]},pr={header:{unitsPerEm:2048,usWinAscent:2049,usWinDescent:423,maxDigitAdvance:1118,sTypoAscender:1566,sTypoDescender:-423,sTypoLineGap:59},defaultAdvance:1050,cjkAdvance:2048,advances:[[32,1,461],[33,1,536],[34,1,717],[35,1,1232],[36,1,1014],[37,1,1625],[38,1,1327],[39,1,428],[40,1,616],[41,1,616],[42,1,900],[43,1,1232],[44,1,504],[45,1,700],[46,1,504],[47,1,753],[48,10,1118],[58,1,567],[59,1,567],[60,1,1232],[61,1,1232],[62,1,1232],[63,1,974],[64,1,1810],[65,1,1205],[66,1,1200],[67,1,1130],[68,1,1327],[69,1,1117],[70,1,1032],[71,1,1306],[72,1,1308],[73,1,614],[74,1,794],[75,1,1195],[76,1,1003],[77,1,1500],[78,1,1308],[79,1,1381],[80,1,1103],[81,1,1381],[82,1,1200],[83,1,1117],[84,1,1100],[85,1,1300],[86,1,1205],[87,1,1723],[88,1,1119],[89,1,1130],[90,1,1068],[91,1,616],[92,1,753],[93,1,616],[94,1,1232],[95,1,893],[96,1,1118],[97,1,1066],[98,1,1141],[99,1,942],[100,1,1141],[101,1,1086],[102,1,639],[103,1,1141],[104,1,1126],[105,1,500],[106,1,548],[107,1,1023],[108,1,500],[109,1,1705],[110,1,1126],[111,1,1103],[112,1,1141],[113,1,1141],[114,1,714],[115,1,918],[116,1,700],[117,1,1126],[118,1,1e3],[119,1,1500],[120,1,1e3],[121,1,1e3],[122,1,880],[123,1,616],[124,1,540],[125,1,616],[126,1,1232]]},mr={header:{unitsPerEm:2048,usWinAscent:1923,usWinDescent:455,maxDigitAdvance:1074,sTypoAscender:1510,sTypoDescender:-420,sTypoLineGap:0},defaultAdvance:1e3,cjkAdvance:2048,advances:[[32,1,453],[33,1,545],[34,1,613],[35,1,1107],[36,1,1074],[37,1,1341],[38,1,1213],[39,1,360],[40,1,616],[41,1,616],[42,1,860],[43,1,1107],[44,1,453],[45,1,697],[46,1,453],[47,1,766],[48,10,1074],[58,1,453],[59,1,453],[60,1,1107],[61,1,1107],[62,1,1107],[63,1,860],[64,1,1648],[65,1,1227],[66,1,1227],[67,1,1139],[68,1,1309],[69,1,1139],[70,1,1057],[71,1,1309],[72,1,1395],[73,1,627],[74,1,791],[75,1,1260],[76,1,1057],[77,1,1456],[78,1,1350],[79,1,1395],[80,1,1139],[81,1,1395],[82,1,1215],[83,1,1057],[84,1,1139],[85,1,1350],[86,1,1227],[87,1,1730],[88,1,1260],[89,1,1139],[90,1,1139],[91,1,616],[92,1,766],[93,1,616],[94,1,1107],[95,1,1074],[96,1,860],[97,1,1013],[98,1,1074],[99,1,936],[100,1,1074],[101,1,1013],[102,1,627],[103,1,1074],[104,1,1074],[105,1,545],[106,1,538],[107,1,1013],[108,1,545],[109,1,1539],[110,1,1074],[111,1,1074],[112,1,1074],[113,1,1074],[114,1,715],[115,1,860],[116,1,627],[117,1,1074],[118,1,936],[119,1,1481],[120,1,936],[121,1,936],[122,1,860],[123,1,616],[124,1,604],[125,1,616],[126,1,1107]]},hr={},gr={};function _r(e,t,n){hr[e.toLowerCase()]=t,n&&(gr[e.toLowerCase()]=n)}_r(`calibri`,or),_r(`arial`,sr,cr),_r(`times new roman`,lr),_r(`courier new`,ur),_r(`verdana`,dr),_r(`georgia`,fr),_r(`tahoma`,pr),_r(`trebuchet ms`,mr);let vr={aptos:[1.03,1.37,1],"aptos display":[.96,1.31,1],"aptos narrow":[.82,1.07,1],"aptos serif":[.98,1.31,1],"calibri light":[.98,1.19,1],cambria:[1.07,1.28,1],"century gothic":[1.19,1.36,1],"comic sans ms":[1.14,1.46,1],consolas:[1.21,1.21,1],constantia:[1.05,1.34,1],corbel:[.97,1.2,1],garamond:[1.16,1.39,1],impact:[.96,1.01,1],"lucida console":[1.21,1.21,1],"lucida sans unicode":[1.16,1.4,1],"microsoft sans serif":[1.07,1.35,1],"palatino linotype":[1.12,1.44,1],"segoe ui":[1.08,1.31,1],"book antiqua":[1.12,1.44,1],candara:[1.02,1.25,1],"franklin gothic medium":[1.08,1.33,1],"goudy old style":[1.02,1.34,1],rockwell:[1.14,1.35,1],"tw cen mt":[.95,1.17,1],"microsoft yahei":[1.18,1.3,1.18],"microsoft yahei ui":[1.18,1.3,1.18],simsun:[1.1,1.1,1.1],宋体:[1.1,1.1,1.1],simhei:[1.1,1.1,1.1],黑体:[1.1,1.1,1.1],nsimsun:[1.1,1.1,1.1],新宋体:[1.1,1.1,1.1],dengxian:[1.05,1.28,1.08],等线:[1.05,1.28,1.08],fangsong:[1.1,1.1,1.1],仿宋:[1.1,1.1,1.1],kaiti:[1.1,1.1,1.1],楷体:[1.1,1.1,1.1],meiryo:[1.18,1.3,1.18],"meiryo ui":[1.1,1.2,1.18],"ms gothic":[1.21,1.21,1.1],"MS ゴシック":[1.21,1.21,1.1],"ms pgothic":[1.07,1.33,1.1],"ms mincho":[1.21,1.21,1.1],"yu gothic":[1.17,1.32,1.18],"yu gothic ui":[1.08,1.22,1.18],"yu mincho":[1.1,1.28,1.18],"malgun gothic":[1.12,1.28,1.14],"맑은 고딕":[1.12,1.28,1.14],batang:[1.1,1.1,1.1],gulim:[1.1,1.1,1.1],dotum:[1.1,1.1,1.1]},yr=new Map;function br(e){let t=yr.get(e);if(t)return t;t=new Map;for(let[n,r,i]of e.advances)for(let e=0;e<r;e++)t.set(n+e,i);return yr.set(e,t),t}function xr(e,t){let n=e.toLowerCase();return t?gr[n]??hr[n]:hr[n]}function Sr(e){return Object.hasOwn(gr,e.toLowerCase())}function Cr(){return or}function wr(e,t){return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=63744&&t<=64255||t>=131072&&t<=205743||t>=12288&&t<=12543||t>=44032&&t<=55215||t>=65281&&t<=65376||t>=11904&&t<=12255||t>=12544&&t<=13311?e.cjkAdvance:br(e).get(t)??e.defaultAdvance}function Tr(e){return ar[e]}function Er(e){return vr[e.toLowerCase()]}function Dr(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=63744&&e<=64255||e>=65281&&e<=65376||e>=12288&&e<=12543||e>=11904&&e<=12255||e>=12544&&e<=13311||e>=44032&&e<=55215||e>=131072&&e<=205743}let Or=`Calibri`,kr=1790;function Ar(e,t,n,r,i){if(t===`calibri`&&n===11){let t=Tr(e);if(t!==void 0)return t}if(i){let t=wr(i,e),r=Math.round(n/72*96);return Math.round(t/i.header.unitsPerEm*r)}}function jr(e){return{name:(e?.name??Or).toLowerCase(),size:e?.size??11,bold:e?.bold??!1,italic:e?.italic??!1,vertAlign:e?.vertAlign}}function Mr(e,t){if(!e)return 0;let n=jr(t),r=xr(n.name,n.bold),i=e.split(/\r\n|\r|\n/),a=0;for(let e of i){let t=Nr(e,n,r);t>a&&(a=t)}return a}function Nr(e,t,n){return e?n||t.name===`calibri`&&t.size===11?Pr(e,t,n):Fr(e,t):0}function Pr(e,t,n){let r=0;for(let i of e)r+=Gr(i.codePointAt(0),t,n);return t.vertAlign&&(r=Math.ceil(r*.6)),r}function Fr(e,t){let n=Er(t.name),r=n?.[0]??1,i=n?.[1]??1.3,a=n?.[2]??1,o=0,s=0,c=0;for(let t of e)Dr(t.codePointAt(0))?c+=2:t>=`A`&&t<=`Z`?s++:o++;let l=(o*r+s*i+c*a)*(t.size/11);t.bold&&(l*=1.05),t.italic&&(l*=1.02),t.vertAlign&&(l*=.6);let u=Lr({name:t.name,size:t.size});return Math.ceil(l*u)}function Ir(e,t){let n=0,r=0;for(let i of e){let e=i.font?{...t,...i.font}:t,a=i.text.split(/\r\n|\r|\n/);for(let t=0;t<a.length;t++)t>0&&(r>n&&(n=r),r=0),a[t]&&(r+=Mr(a[t],e))}return r>n&&(n=r),n}function Lr(e){let t=(e?.name??Or).toLowerCase(),n=e?.size??11;if(t===`calibri`&&n===11)return 7;let r=xr(t);if(r){let e=Math.round(n/72*96);return Math.round(r.header.maxDigitAdvance/r.header.unitsPerEm*e)}return Math.max(1,Math.round(n/11*7))}function Rr(e){return 2*Math.ceil(e/4)+1}function zr(e,t){return t<=0?0:Math.trunc(e/t*256)/256}function Br(e,t){if(t<=0)return 0;let n=Rr(t);return e===0?0:e<1?Math.round(e*(t+n)):Math.round(e*t)+n}function Vr(e){return e*72/96}function Hr(e,t,n){if(e<=0)return 0;let r=e+2*Math.ceil(e*.03+t/4)+1;n&&(r+=16),r>kr&&(r=kr);let i=zr(r,t);return Math.min(i,255)}function Ur(e){let t=(e?.name??Or).toLowerCase(),n=e?.size??11,r=Math.round(n/72*96),i=xr(t);if(i){let{unitsPerEm:e,usWinDescent:t}=i.header;return(e+t)/e*r}return r*1.3}function Wr(e,t,n){if(!e||t<=0)return 1;let r=jr(n),i=xr(r.name,r.bold),a=e.split(/\r\n|\r|\n/),o=0;for(let e of a){if(!e){o++;continue}o+=Kr(e,t,r,i)}return o}function Gr(e,t,n){let r;if(n||t.name===`calibri`&&t.size===11){let i=n??Cr();r=Ar(e,t.name,t.size,t.bold,i)??Math.round(i.defaultAdvance/i.header.unitsPerEm*Math.round(t.size/72*96))}else r=Math.ceil(t.size/11*Lr({name:t.name,size:t.size})*(Dr(e)?2:1));return t.bold&&!Sr(t.name)&&(r=Math.ceil(r*1.05)),t.italic&&(r=Math.ceil(r*1.02)),r}function Kr(e,t,n,r){let i=qr(e);if(i.length===0)return 1;let a=1,o=0;for(let e of i){let i=0;for(let t of e)i+=Gr(t.codePointAt(0),n,r);o===0?o=i:o+i>t?(a++,o=i):o+=i}return a}function qr(e){let t=[],n=``;for(let r of e)n+=r,(r===` `||r===`-`||r===` `)&&(t.push(n),n=``);return n&&t.push(n),t}function Jr(e,t,n,r){if(!e)return Vr(Ur(t));let i=Ur(t),a;return a=n?.wrapText&&r&&r>0?Wr(e,r,t):e.split(/\r\n|\r|\n/).length,Vr(i*a)}function Yr(e,t,n,r){let i=t?.size??11,a=t;for(let n of e){let e=n.font?.size??t?.size??11;e>i&&(i=e,a=n.font?{...t,...n.font}:t)}return Jr(e.map(e=>e.text).join(``),a,n,r)}function Xr(e,t){let n=Br(e,t),r=Rr(t);return Math.max(0,n-r)}function Zr(e){let t=e.effectiveType,n=e.font;if(t===E.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t)return Ir(t.richText,n)}let r=Pn(e);return r?Mr(r,n):0}function Qr(e,t,n){let r=e.font,i=e.alignment;if(e.effectiveType===E.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t)return Yr(t.richText,r,i,n)}let a=Pn(e);return a?Jr(a,r,i,i?.wrapText?n:void 0):0}function $r(e){return w.l2n(e.toUpperCase())-1}function ei(e){return w.n2l(e+1)}function ti(e){return parseInt(e,10)-1}function ni(e){return String(e+1)}function ri(e){let t=w.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function ii(e){return w.encodeAddress(e.r+1,e.c+1)}function ai(e){let t=e.indexOf(`:`);if(t===-1){let t=ri(e);return{s:t,e:{...t}}}return{s:ri(e.slice(0,t)),e:ri(e.slice(t+1))}}function oi(e,t){if(t===void 0){let t=e;return oi(t.s,t.e)}let n=ii(e),r=ii(t);return n===r?n:`${n}:${r}`}var si=class{constructor(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=[],this._keys={},this._merges={},this.rowBreaks=[],this.colBreaks=[],this.properties={defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0,...e.properties},this.pageSetup={margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:void 0,verticalDpi:void 0,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null,...e.pageSetup},this.headerFooter={differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null,...e.headerFooter},this.dataValidations=new Qe,this.views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[],this.formControls=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name===e)return;if(typeof e!=`string`)throw new d(`The name has to be a string.`);if(e===``)throw new d(`The name can't be empty.`);if(e===`History`)throw new d(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw new d(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw new d(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);e.length>31&&(e=e.substring(0,31));let t=e.toLowerCase();if(this._workbook.worksheets.find(e=>e&&e!==this&&e.name.toLowerCase()===t))throw new d(`Worksheet name already exists: ${e}`);this._name=e}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new T;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:t.header?1:0;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new Re(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=w.l2n(e)}else t=e;if(t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new Re(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===D.ValueType.Merge&&e.unmerge()}let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]??null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns.length;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;if(this.workbook.definedNames.spliceColumns(this.name,e,t,n.length),i!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeCol>=e-1&&(n.nativeCol=Math.max(0,n.nativeCol+i)),r&&r.nativeCol>=e-1&&(r.nativeCol=Math.max(0,r.nativeCol+i))}}this._spliceMerges(`col`,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new Le(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=Ie(r.style)??{},r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=Ie(e.style)??{}}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this.getRow(e),i=Array.from({length:t}).fill(r.values),a=[];for(let t of Object.values(this._merges))t.top===e&&t.bottom===e&&a.push(t);let o=[],s=e-1;for(let e of this._media)e.type===`image`&&e.range&&e.range.tl.nativeRow===s&&o.push(e);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=Ie(r.style)??{},t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=Ie(e.style)??{}})}if(a.length>0)for(let r=0;r<t;r++){let t=e+1+r;if(!n){let e=[];for(let[n,r]of Object.entries(this._merges))r.top<=t&&r.bottom>=t&&e.push(n);for(let t of e)this._unMergeMaster(this.getCell(t))}for(let e of a)this.mergeCellsWithoutStyle(t,e.left,t,e.right)}if(!n){let n=e,r=e+t-1;this._media=this._media.filter(e=>{if(e.type===`image`&&e.range){let t=e.range.tl.nativeRow;return t<n||t>r}return!0})}for(let e=0;e<t;e++){let t=e+1;for(let e of o){let n=e.clone();if(n.range.tl.nativeRow=s+t,n.range.br){let r=e.range.br.nativeRow-s;n.range.br.nativeRow=s+t+r}this._media.push(n)}}}spliceRows(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===D.ValueType.Merge&&e.unmerge()}let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=Ie(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=Ie(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=Ie(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=Ie(t.style)??{}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}if(this.workbook.definedNames.spliceRows(this.name,e,t,i),a!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeRow>=e-1&&(n.nativeRow=Math.max(0,n.nativeRow+a)),r&&r.nativeRow>=e-1&&(r.nativeRow=Math.max(0,r.nativeRow+a))}}this._spliceMerges(`row`,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=w.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,t){let n=w.getAddress(e,t);return this.getRow(n.row).getCellEx(n)}mergeCells(...e){let t=new T(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new T(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw new h});let{top:n,left:r,bottom:i,right:a}=e,o=t?void 0:an(n,r,i,a,(e,t)=>this.findCell(e,t)),s=this.getCell(e.top,e.left);for(let e=n;e<=i;e++)for(let i=r;i<=a;i++)(e>n||i>r)&&this.getCell(e,i).merge(s,t);o&&on(n,r,i,a,o,(e,t)=>this.getCell(e,t)),this._merges[s.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}_spliceMerges(e,t,n,r){let i=r-n;if(i===0&&n===0)return;let a=t+n,o=e===`row`,s={};for(let e of Object.values(this._merges)){let{top:r,left:c,bottom:l,right:u}=e.model,d=o?r:c,f=o?l:u;if(i<=0&&n>0){let n=a-1;if(d>n){let e=o?new T(r+i,c,l+i,u):new T(r,c+i,l,u+i);s[w.encodeAddress(e.top,e.left)]=e}else if(f<t)s[w.encodeAddress(r,c)]=e;else if(!(d>=t&&f<=n)){let e=r,n=c,a=l,d=u;o?(e=r<t?r:t,a=Math.max(e,l+i)):(n=c<t?c:t,d=Math.max(n,u+i));let f=new T(e,n,a,d);e===a&&n===d||(s[w.encodeAddress(f.top,f.left)]=f)}}else if(d>=a){let e=o?new T(r+i,c,l+i,u):new T(r,c+i,l,u+i);s[w.encodeAddress(e.top,e.left)]=e}else f<a||(o?e.model.bottom=l+i:e.model.right=u+i),s[w.encodeAddress(r,c)]=e}this._merges=s;for(let e of Object.values(s)){let t=this.getCell(e.top,e.left);for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++)(n>e.top||r>e.left)&&this.getCell(n,r).merge(t,!0)}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new T(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===D.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}=w.decode(e),c=s-a+1,l=w.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++)if(f){let a=this.getCell(n,i);a.value={shareType:r,formula:t,ref:e,result:d(n,i)},f=!1}else 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 He(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new He(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}addFormCheckbox(e,t){let n=new at(this,e,t);return this.formControls.push(n),n}getFormCheckboxes(){return this.formControls}async protect(e,t){this.sheetProtection=await ir(e,t)}unprotect(){this.sheetProtection=null}addTable(e){let t=new Ze(this,e);return this.tables[t.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=en(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=[]}autoFitColumn(e){let t=typeof e==`string`?w.l2n(e):e;return this._autoFitColumnImpl(t),this}autoFitColumns(e,t){let n=this.dimensions;if(!n||n.left===void 0)return this;let r=e==null?n.left:typeof e==`string`?w.l2n(e):e,i=t==null?n.right:typeof t==`string`?w.l2n(t):t;for(let e=r;e<=i;e++)this._autoFitColumnImpl(e);return this}autoFitRow(e){return this._autoFitRowImpl(e),this}autoFitRows(e,t){let n=this.dimensions;if(!n||n.top===void 0)return this;let r=e??n.top,i=t??n.bottom;for(let e=r;e<=i;e++)this._autoFitRowImpl(e);return this}_autoFitColumnImpl(e){let t=Lr(),n=this._isColumnInAutoFilter(e),r=0;if(this._rows.forEach(n=>{if(!n||n.hidden)return;let i=n.findCell(e);if(!i||i.type===D.ValueType.Merge)return;if(i.isMerged){let e=this._merges[i.address];if(e&&e.left!==e.right)return}if(i.alignment?.shrinkToFit)return;let a=Zr(i),o=i.alignment?.indent;o&&o>0&&(a+=o*3*t),a>r&&(r=a)}),r>0){let i=Hr(r,t,n);if(i>0){let t=this.getColumn(e);t.width=i,t.bestFit=!0}}}_autoFitRowImpl(e){let t=this._rows[e-1];if(!t)return;let n=Lr(),r=0;t.eachCell(e=>{if(e.type===D.ValueType.Merge)return;if(e.isMerged){let t=this._merges[e.address];if(t&&t.top!==t.bottom)return}if(this._columns[e.col-1]?.hidden)return;let t=Qr(e,n,this._getColumnContentWidthForCell(e,n));t>r&&(r=t)}),r>0&&(t.height=Math.ceil(r*4)/4,t.customHeight=!0)}_getColumnContentWidthForCell(e,t){if(e.alignment?.wrapText)return Xr(this._columns[e.col-1]?.width??this.properties.defaultColWidth??9,t)}_isColumnInAutoFilter(e){if(!this.autoFilter)return!1;if(typeof this.autoFilter==`string`){let t=w.decode(this.autoFilter);return e>=t.left&&e<=t.right}let{from:t,to:n}=this.autoFilter,r=typeof t==`string`?w.decode(t).col:t.col,i=typeof n==`string`?w.decode(n).col:n.col;return e>=r&&e<=i}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,colBreaks:this.colBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings,formControls:this.formControls.map(e=>e.model),drawing:this._drawing};e.cols=Re.toModel(this.columns);let t=e.rows=[],n=e.dimensions=new T;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.mergeCells=Object.values(this._merges).map(e=>e.range),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new Le(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.state=e.state,this._columns=Re.fromModel(this,e.cols??[]),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new Qe(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.rowBreaks=e.rowBreaks??[],this.colBreaks=e.colBreaks??[],this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new He(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new Ze(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings,this.formControls=[],this._drawing=e.drawing}toJSON(e){let t=e||{},n=1,r=this.rowCount,i=1,a=this.columnCount;if(t.range!==void 0){if(typeof t.range==`number`)n=t.range+1;else if(typeof t.range==`string`){let e=ai(t.range);n=e.s.r+1,r=e.e.r+1,i=e.s.c+1,a=e.e.c+1}}if(r<n||a<i)return[];let o=t.header;if(o===1){let e=[],o=t.blankRows!==!1;for(let s=n;s<=r;s++){let n=[],r=!0;for(let e=i;e<=a;e++){let a=this.getCell(s,e),o=t.raw===!1?Pn(a,t.dateFormat).trim():a.value;o!=null&&o!==``?(n[e-i]=o,r=!1):t.defaultValue===void 0?n[e-i]=null:n[e-i]=t.defaultValue}(!r||o)&&e.push(n)}return e}if(o===`A`){let e=[],o=t.blankRows===!0;for(let s=n;s<=r;s++){let n={},r=!0;for(let e=i;e<=a;e++){let i=this.getCell(s,e),a=t.raw===!1?Pn(i,t.dateFormat).trim():i.value,o=ei(e-1);a!=null&&a!==``?(n[o]=a,r=!1):t.defaultValue!==void 0&&(n[o]=t.defaultValue)}(!r||o)&&e.push(n)}return e}if(Array.isArray(o)){let e=[],s=t.blankRows===!0;for(let c=n;c<=r;c++){let n={},r=!0;for(let e=i;e<=a;e++){let a=e-i,s=o[a]??`__EMPTY_${a}`,l=this.getCell(c,e),u=t.raw===!1?Pn(l,t.dateFormat).trim():l.value;u!=null&&u!==``?(n[s]=u,r=!1):t.defaultValue!==void 0&&(n[s]=t.defaultValue)}(!r||s)&&e.push(n)}return e}let s=[],c={};for(let e=i;e<=a;e++){let t=this.getCell(n,e).value,r=t==null?`__EMPTY_${e-i}`:String(t);c[r]===void 0?c[r]=0:(c[r]++,r=`${r}_${c[r]}`),s.push(r)}let l=[],u=n+1,d=t.blankRows===!0;for(let e=u;e<=r;e++){let n={},r=!0;for(let o=i;o<=a;o++){let a=this.getCell(e,o),c=t.raw===!1?Pn(a,t.dateFormat).trim():a.value,l=s[o-i];c!=null&&c!==``?(n[l]=c,r=!1):t.defaultValue!==void 0&&(n[l]=t.defaultValue)}(!r||d)&&l.push(n)}return l}addJSON(e,t){if(e.length===0)return this;let n=t||{},r=1,i=1;if(n.origin!==void 0){let e=ci(n.origin,this.rowCount);r=e.row,i=e.col}let a=new Set;e.forEach(e=>Object.keys(e).forEach(e=>a.add(e)));let o=n.header?[...n.header]:[...a];n.header&&a.forEach(e=>{o.includes(e)||o.push(e)});let s=r;n.skipHeader||(o.forEach((e,t)=>{this.getCell(s,i+t).value=e}),s++);for(let t of e)o.forEach((e,r)=>{let a=t[e];a===null&&n.nullError?this.getCell(s,i+r).value={error:`#NULL!`}:a!=null&&(this.getCell(s,i+r).value=a)}),s++;return this}toAOA(){let e=[];return this.eachRow({includeEmpty:!0},(t,n)=>{let r=[];t.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),e[n-1]=r}),e}addAOA(e,t){if(e.length===0)return this;let n=1,r=1;if(t?.origin!==void 0){let e=ci(t.origin,this.rowCount);n=e.row,r=e.col}return e.forEach((e,t)=>{e&&e.forEach((e,i)=>{e!=null&&(this.getCell(n+t,r+i).value=e)})}),this}};function ci(e,t){if(typeof e==`string`){let t=ri(e);return{row:t.r+1,col:t.c+1}}return typeof e==`number`?e===-1?{row:t+1,col:1}:{row:e+1,col:1}:{row:e.r+1,col:e.c+1}}function li(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>li(e));let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=li(e[n]));return t}var ui=class{constructor(e){this.template=e,this.sheets=new Map}addCell(e){this.addCellEx(w.decodeEx(e))}getCell(e){return this.findCellEx(w.decodeEx(e),!0)}findCell(e){return this.findCellEx(w.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets.get(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){let r=this.sheets.get(e);r||(r=[],this.sheets.set(e,r));let i=t>>>0,a=n>>>0,o=r[i]||(r[i]=[]);return o[a]||(o[a]={sheetName:e,address:w.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>>>0]}forEachInSheet(e,t){let n=this.sheets.get(e);n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){for(let t of this.sheets.keys())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(this.sheets.has(n))return this.sheets.get(n);if(t){let e=[];return this.sheets.set(n,e),e}}findSheetRow(e,t,n){let r=t.row>>>0;if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let r=t.col>>>0;if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...li(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets.get(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.get(e);if(i){let e=[];for(let t=0;t<r;t++)e.push(null);i.forEach(r=>{r.splice(t,n,...e)})}}};let di=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var fi=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new ui)}add(e,t){let n=w.decodeEx(e);`error`in n||this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let i={sheetName:e.sheetName,address:w.n2l(t)+r,row:r,col:t};n.addCellEx(i)}else n.addCellEx(e)}remove(e,t){let n=w.decodeEx(e);`error`in n||this.removeEx(n,t)}removeEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++)n.removeCellEx({sheetName:e.sheetName,address:w.n2l(t)+r,row:r,col:t});else n.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{if(`top`in e)for(let n=e.left;n<=e.right;n++)for(let r=e.top;r<=e.bottom;r++)t.removeCellEx({sheetName:e.sheetName,address:w.n2l(n)+r,row:r,col:n});else t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let t=w.decodeEx(e);return`error`in t||`top`in t?[]:this.getNamesEx(t)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let n=t.sheetName,r=new T(t.row,t.col,t.row,t.col,n),i,a,o=(t,r)=>e.findCellAt(n,t,r);function s(e,n){let i=o(e,t.col);return!i||!i.mark?!1:(r[n]=e,i.mark=!1,!0)}for(a=t.row-1;s(a,`top`);a--);for(a=t.row+1;s(a,`bottom`);a++);function c(e,t){let n=[];for(a=r.top;a<=r.bottom;a++){let t=o(a,e);if(t&&t.mark)n.push(t);else return!1}r[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(i=t.col-1;c(i,`left`);i--);for(i=t.col+1;c(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(e=>!!e).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=w.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 ui;e.ranges.forEach(e=>{di.test(e.split(`!`).pop()??``)&&n.addCell(e)})})}},pi=class{constructor(e){this._stack=[],this._leaf=!1,this._open=!1,this._pending=``,this._target=e}get depth(){return this._stack.length}get currentElement(){return this._stack.length>0?this._stack[this._stack.length-1]:void 0}_flushOpen(e){this._target.write(this._pending+e),this._pending=``,this._open=!1}openXml(e){let t=e?{...A,...e}:A,n=`<?xml`;for(let e in t){let r=t[e];r!==void 0&&(_t(e),n+=` ${e}="${ht(String(r))}"`)}this._target.write(n+`?>
|
|
7
|
+
var ExcelTS=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Module`});var t=class extends Error{constructor(e,t){super(e,t),this.name=`BaseError`,Object.setPrototypeOf(this,new.target.prototype),Error.captureStackTrace&&Error.captureStackTrace(this,this.constructor)}toJSON(){return{name:this.name,message:this.message,stack:this.stack,cause:this.cause instanceof Error?o(this.cause):this.cause}}},n=class extends t{constructor(e){super(`The operation was aborted`,e===void 0?void 0:{cause:e}),this.name=`AbortError`,this.code=`ABORT_ERR`}};function r(e){return e instanceof n?e:new n(e)}function i(e){return!!e&&typeof e==`object`&&e.name===`AbortError`}function a(e){return e instanceof Error?e:Error(String(e))}function o(e){return e instanceof t?e.toJSON():{name:e.name,message:e.message,stack:e.stack,cause:e.cause instanceof Error?o(e.cause):e.cause}}function s(e){let t=[e],n=e.cause;for(;n instanceof Error;)t.push(n),n=n.cause;return t}function c(e){let t=e;for(;t.cause instanceof Error;)t=t.cause;return t}var l=class extends t{constructor(e,t){super(e,t),this.name=`ExcelError`}};function u(e){return e instanceof l}var d=class extends l{constructor(...e){super(...e),this.name=`WorksheetNameError`}},f=class extends l{constructor(e,t,n){super(t?`Invalid address "${e}": ${t}`:`Invalid address: ${e}`,n),this.address=e,this.name=`InvalidAddressError`}},p=class extends l{constructor(e,t,n){super(t?`Column ${e} is out of bounds: ${t}`:`Column ${e} is out of bounds. Excel supports columns from 1 to 16384`,n),this.column=e,this.name=`ColumnOutOfBoundsError`}},m=class extends l{constructor(e,t,n){super(t?`Row ${e} is out of bounds: ${t}`:`Row ${e} is out of bounds`,n),this.row=e,this.name=`RowOutOfBoundsError`}},h=class extends l{constructor(e,t){super(e??`Cannot merge already merged cells`,t),this.name=`MergeConflictError`}},g=class extends l{constructor(e,t,n){super(t??`Cannot process value of type: ${e}`,n),this.valueType=e,this.name=`InvalidValueTypeError`}},_=class extends l{constructor(e,t,n){super(t??`Unexpected XML content in ${e}`,n),this.context=e,this.name=`XmlParseError`}},v=class extends l{constructor(e,t,n){super(t?`${e}: ${t}`:`${e} is not supported`,n),this.operation=e,this.reason=t,this.name=`ExcelNotSupportedError`}},y=class extends l{constructor(e,t,n,r){super(n?`Failed to ${t} Excel file "${e}": ${n}`:`Failed to ${t} Excel file "${e}"`,r),this.path=e,this.operation=t,this.name=`ExcelFileError`}},b=class extends l{constructor(e,t,n){super(`Cannot ${e}: ${t}`,n),this.operation=e,this.state=t,this.name=`ExcelStreamStateError`}},x=class extends l{constructor(e,t,n,r){super(`Failed to download from "${e}": HTTP ${t} ${n}`,r),this.url=e,this.status=t,this.statusText=n,this.name=`ExcelDownloadError`}},S=class extends l{constructor(...e){super(...e),this.name=`PivotTableError`}},ee=class extends l{constructor(...e){super(...e),this.name=`TableError`}},C=class extends l{constructor(...e){super(...e),this.name=`ImageError`}},te=class extends l{constructor(e,t,n){super(`Max ${e} count (${t}) exceeded`,n),this.itemType=e,this.maxItems=t,this.name=`MaxItemsExceededError`}};let ne=/^[A-Z]+\d+$/,w={_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 new p(e,`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 new p(e,`Invalid column letter: ${e}`);return this._l2n[e]},n2l(e){if(e<1||e>16384)throw new p(e);return this._n2l[e]||this._fill(this._level(e)),this._n2l[e]},_hash:{},decodeCol(e){let t=0;for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);if(r>=65&&r<=90)t=t*26+r-64;else break}return t},validateAddress(e){if(!ne.test(e))throw new f(e);return!0},decodeAddress(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.length<5&&this._hash[e];if(t)return t;let n=0,r=0,i=!1,a=!1,o=0,s=0;for(let t=0;t<e.length;t++){let c=e.charCodeAt(t);if(c===36){!i&&!a&&(s=t+1);continue}if(!a&&c>=65&&c<=90)i=!0,n=n*26+c-64,o=t+1;else if(c>=48&&c<=57)a=!0,r=r*10+c-48;else if(a&&i)break}if(!i)n=void 0;else if(n>16384){let t=e.slice(0,o);throw new p(t,`Invalid column letter: ${t}`)}a||(r=void 0);let c=i?e.slice(s,o):``,l=a?String(r):``,u=c+l,d={address:u,col:n,row:r,$col$row:`$${c}$${l}`};return n<=100&&r<=100&&(this._hash[u]=d,this._hash[d.$col$row]=d),d},getAddress(e,t){if(t){let n=this.n2l(t)+e;return this.decodeAddress(n)}return this.decodeAddress(e)},decode(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.split(`:`);if(t.length===2){let e=this.decodeAddress(t[0]),n=this.decodeAddress(t[1]),r={top:Math.min(e.row,n.row),left:Math.min(e.col,n.col),bottom:Math.max(e.row,n.row),right:Math.max(e.col,n.col),tl:``,br:``,dimensions:``};return r.tl=this.n2l(r.left)+r.top,r.br=this.n2l(r.right)+r.bottom,r.dimensions=`${r.tl}:${r.br}`,r}return this.decodeAddress(e)},decodeEx(e){if(!e||typeof e!=`string`)throw Error(`Invalid Address: ${e}`);let t=e.match(/^(?:(?:(?:'((?:[^']|'')+?)')|([^'^ !]+?))!)?(.*)$/),n=t[1]||t[2],r=t[3],i=r.split(`:`);if(i.length>1){let e=this.decodeAddress(i[0]),t=this.decodeAddress(i[1]),r=Math.min(e.row,t.row),a=Math.min(e.col,t.col),o=Math.max(e.row,t.row),s=Math.max(e.col,t.col),c=this.n2l(a)+r,l=this.n2l(s)+o;return{top:r,left:a,bottom:o,right:s,sheetName:n,tl:{address:c,col:a,row:r,$col$row:`$${this.n2l(a)}$${r}`,sheetName:n},br:{address:l,col:s,row:o,$col$row:`$${this.n2l(s)}$${o}`,sheetName:n},dimensions:`${c}:${l}`}}if(r.indexOf(`#`)===0)return n?{sheetName:n,error:r}:{error:r};let a=this.decodeAddress(r);return n?{sheetName:n,...a}:a},encodeAddress(e,t){return w.n2l(t)+e},encode(...e){switch(e.length){case 2:return w.encodeAddress(e[0],e[1]);case 4:return`${w.encodeAddress(e[0],e[1])}:${w.encodeAddress(e[2],e[3])}`;default:throw new f(String(e.length),`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 T=class e{constructor(...e){this.model={top:0,left:0,bottom:0,right:0},this.decode(e)}setTLBR(e,t,n,r,i){if(typeof e==`string`&&typeof t==`string`){let r=w.decodeAddress(e),i=w.decodeAddress(t);this.model={top:Math.min(r.row,i.row),left:Math.min(r.col,i.col),bottom:Math.max(r.row,i.row),right:Math.max(r.col,i.col),sheetName:typeof n==`string`?n:void 0}}else typeof e==`number`&&typeof t==`number`&&typeof n==`number`&&typeof r==`number`&&(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:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&typeof t[4]==`string`&&this.setTLBR(t[0],t[1],t[2],t[3],t[4]);break;case 4:typeof t[0]==`number`&&typeof t[1]==`number`&&typeof t[2]==`number`&&typeof t[3]==`number`&&this.setTLBR(t[0],t[1],t[2],t[3]);break;case 3:typeof t[0]==`string`&&typeof t[1]==`string`&&typeof t[2]==`string`&&this.setTLBR(t[0],t[1],t[2]);break;case 2:typeof t[0]==`string`&&typeof t[1]==`string`&&this.setTLBR(t[0],t[1]);break;case 1:{let 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(Array.isArray(n))this.decode(n);else if(typeof n==`object`&&`top`in n&&`left`in n&&`bottom`in n&&`right`in n)this.model={top:n.top,left:n.left,bottom:n.bottom,right:n.right,sheetName:n.sheetName};else if(typeof n==`string`){let e=w.decodeEx(n);`top`in e?this.model={top:e.top,left:e.left,bottom:e.bottom,right:e.right,sheetName:e.sheetName}:`row`in e&&(this.model={top:e.row,left:e.col,bottom:e.row,right:e.col,sheetName:e.sheetName})}break}case 0:this.model={top:0,left:0,bottom:0,right:0};break;default:throw new l(`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=w.decodeEx(e);`row`in t&&`col`in t&&this.expand(t.row,t.col,t.row,t.col)}get tl(){return w.n2l(this.left)+this.top}get $t$l(){return`$${w.n2l(this.left)}$${this.top}`}get br(){return w.n2l(this.right)+this.bottom}get $b$r(){return`$${w.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=w.decodeEx(e);return`row`in t&&`col`in t?this.containsEx(t):!1}containsEx(e){return e.sheetName&&this.sheetName&&e.sheetName!==this.sheetName?!1:e.row>=this.top&&e.row<=this.bottom&&e.col>=this.left&&e.col<=this.right}forEachAddress(e){for(let t=this.left;t<=this.right;t++)for(let n=this.top;n<=this.bottom;n++)e(w.encodeAddress(n,t),n,t)}};let E=function(e){return e[e.Null=0]=`Null`,e[e.Merge=1]=`Merge`,e[e.Number=2]=`Number`,e[e.String=3]=`String`,e[e.Date=4]=`Date`,e[e.Hyperlink=5]=`Hyperlink`,e[e.Formula=6]=`Formula`,e[e.SharedString=7]=`SharedString`,e[e.RichText=8]=`RichText`,e[e.Boolean=9]=`Boolean`,e[e.Error=10]=`Error`,e[e.JSON=11]=`JSON`,e[e.Checkbox=12]=`Checkbox`,e}({}),re=function(e){return e[e.None=0]=`None`,e[e.Master=1]=`Master`,e[e.Shared=2]=`Shared`,e}({}),ie=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}({}),ae=function(e){return e[e.Xlsx=1]=`Xlsx`,e}({}),oe=function(e){return e[e.LeftToRight=1]=`LeftToRight`,e[e.RightToLeft=2]=`RightToLeft`,e}({}),se={NotApplicable:`#N/A`,Ref:`#REF!`,Name:`#NAME?`,DivZero:`#DIV/0!`,Null:`#NULL!`,Value:`#VALUE!`,Num:`#NUM!`},D={ValueType:E,FormulaType:re,RelationshipType:ie,DocumentType:ae,ReadingOrder:oe,ErrorValue:se},ce={'"':`"`,"&":`&`,"<":`<`,">":`>`},le=/["&<>]/g;function ue(e,t){if(e===t)return!0;if(e==null||t==null)return e===t;let n=typeof e;if(n!==typeof t||n!==`object`)return!1;let r=Array.isArray(e);if(r!==Array.isArray(t))return!1;if(r){let n=e.length;if(n!==t.length)return!1;for(let r=0;r<n;r++)if(!ue(e[r],t[r]))return!1;return!0}let i=Object.keys(e),a=Object.keys(t);if(i.length!==a.length)return!1;for(let n=0,r=i.length;n<r;n++){let r=i[n];if(!Object.prototype.hasOwnProperty.call(t,r)||!ue(e[r],t[r]))return!1}return!0}function de(e){return e.replace(le,e=>ce[e])}function fe(e){return typeof e==`object`&&!!e&&!Array.isArray(e)}function pe(...e){let t=e[0]||{},n=e.length;for(let r=1;r<n;r++){let n=e[r];if(n)if(Array.isArray(n))for(let e=0,r=n.length;e<r;e++){let r=n[e];if(r===void 0)continue;let i=t[e];Array.isArray(r)?t[e]=pe(Array.isArray(i)?i:[],r):fe(r)?t[e]=pe(fe(i)?i:{},r):t[e]=r}else{let e=Object.keys(n);for(let r=0,i=e.length;r<i;r++){let i=e[r];if(i===`__proto__`||i===`constructor`||i===`prototype`)continue;let a=n[i];if(a===void 0)continue;let o=t[i];Array.isArray(a)?t[i]=pe(Array.isArray(o)?o:[],a):fe(a)?t[i]=pe(fe(o)?o:{},a):t[i]=a}}}return t}var me=class e{static{this.DEFAULT_CONFIGS={note:{margins:{insetmode:`auto`,inset:[.13,.13,.25,.25]},protection:{locked:`True`,lockText:`True`},editAs:`absolute`},type:`note`}}constructor(e){this.note=e}get model(){let t;switch(typeof this.note){case`string`:t={type:`note`,note:{texts:[{text:this.note}]}};break;default:t={type:`note`,note:this.note??{}};break}return pe({},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 he=/(([a-z_\-0-9]*)!)?([a-z0-9_$]{2,})([(])?/gi,ge=/^([$])?([a-z]+)([$])?([1-9][0-9]*)$/i;function _e(e,t,n){let r=w.decode(t),i=w.decode(n);return e.replace(he,(e,t,n,a,o)=>{if(o)return e;let s=ge.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=w.l2n(a),u=parseInt(c,10);return n||(l+=i.col-r.col),o||(u+=i.row-r.row),(t??``)+(n??``)+w.n2l(l)+(o??``)+u}return e})}let ve=e=>!!e&&(typeof e!=`object`||Object.keys(e).length>0);var O=class e{static{this.Types=D.ValueType}constructor(t,n,r){if(!t||!n)throw new l(`A Cell needs a Row`);this._row=t,this._column=n,w.validateAddress(r),this._address=r,this._value=Me.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(){this.style=void 0,this._value=void 0,this._row=void 0,this._column=void 0,this._address=void 0}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e}get font(){return this.style.font}set font(e){this.style.font=e}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e}get border(){return this.style.border}set border(e){this.style.border=e}get fill(){return this.style.fill}set fill(e){this.style.fill=e}get protection(){return this.style.protection}set protection(e){this.style.protection=e}_mergeStyle(e,t,n){let r=e&&e.numFmt||t&&t.numFmt;r&&(n.numFmt=r);let i=e&&ve(e.font)&&e.font||t&&ve(t.font)&&t.font;i&&(n.font=i);let a=e&&ve(e.alignment)&&e.alignment||t&&ve(t.alignment)&&t.alignment;a&&(n.alignment=a);let o=e&&ve(e.border)&&e.border||t&&ve(t.border)&&t.border;o&&(n.border=o);let s=e&&ve(e.fill)&&e.fill||t&&ve(t.fill)&&t.fill;s&&(n.fill=s);let c=e&&ve(e.protection)&&e.protection||t&&ve(t.protection)&&t.protection;return c&&(n.protection=c),n}get address(){return this._address}get row(){return this._row.number}get col(){return this._column.number}get $col$row(){return`$${this._column.letter}$${this.row}`}get type(){return this._value.type}get effectiveType(){return this._value.effectiveType}toCsvString(){return this._value.toCsvString()}addMergeRef(){this._mergeCount++}releaseMergeRef(){this._mergeCount--}get isMerged(){return this._mergeCount>0||this.type===e.Types.Merge}merge(t,n){this._value.release(),this._value=Me.create(e.Types.Merge,this,t),n||(this.style=t.style)}unmerge(){this.type===e.Types.Merge&&(this._value.release(),this._value=Me.create(e.Types.Null,this),this.style=this._mergeStyle(this._row.style,this._column.style,{...this.style}))}isMergedTo(t){return this._value.type===e.Types.Merge&&this._value.isMergedTo?this._value.isMergedTo(t):!1}get master(){return this.type===e.Types.Merge?this._value.master:this}get isHyperlink(){return this._value.type===e.Types.Hyperlink}get hyperlink(){return this._value.hyperlink}get value(){return this._value.value}set value(t){if(this.type===e.Types.Merge){this._value.master.value=t;return}this._value.release(),this._value=Me.create(Me.getType(t),this,t)}get note(){if(this._comment)return this._comment.note}set note(e){this._comment=new me(e)}get comment(){return this._comment}set comment(e){e===void 0?this._comment=void 0:e instanceof me?this._comment=e:this._comment=new me(e)}get text(){return this._value.toString()}get html(){return de(this.text)}toString(){return this.text}_upgradeToHyperlink(t){this.type===e.Types.String&&(this._value=Me.create(e.Types.Hyperlink,this,{text:String(this._value.value),hyperlink:t}))}get formula(){return this._value.formula}get result(){return this._value.result}get formulaType(){return this._value.formulaType??D.FormulaType.None}get fullAddress(){let{worksheet:e}=this._row;return{sheetName:e.name,address:this.address,row:this.row,col:this.col}}get name(){return this.names[0]}set name(e){this.names=[e]}get names(){return this.workbook.definedNames.getNamesEx(this.fullAddress)}set names(e){let{definedNames:t}=this.workbook;t.removeAllNames(this.fullAddress),e.forEach(e=>{t.addEx(this.fullAddress,e)})}addName(e){this.workbook.definedNames.addEx(this.fullAddress,e)}removeName(e){this.workbook.definedNames.removeEx(this.fullAddress,e)}removeAllNames(){this.workbook.definedNames.removeAllNames(this.fullAddress)}get _dataValidations(){return this.worksheet.dataValidations}get dataValidation(){return this._dataValidations.find(this.address)}set dataValidation(e){this._dataValidations.add(this.address,e)}get model(){let{model:e}=this._value;return e.style=this.style,this._comment&&(e.comment=this._comment.model),e}set model(e){if(this._value.release(),this._value=Me.create(e.type,this),this._value.model=e,e.comment)switch(e.comment.type){case`note`:this._comment=me.fromModel(e.comment);break}e.style?this.style=e.style:this.style={}}},ye=class{constructor(e){this.model={address:e.address,type:O.Types.Null}}get value(){return null}set value(e){}get type(){return O.Types.Null}get effectiveType(){return O.Types.Null}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){}toString(){return``}},be=class{constructor(e,t){this.model={address:e.address,type:O.Types.Number,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Number}get effectiveType(){return O.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()}},xe=class{constructor(e,t){this.model={address:e.address,type:O.Types.String,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.String}get effectiveType(){return O.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}},Se=class{constructor(e,t){this.model={address:e.address,type:O.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 O.Types.RichText}get effectiveType(){return O.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(){}},Ce=class{constructor(e,t){this.model={address:e.address,type:O.Types.Date,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Date}get effectiveType(){return O.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()}},we=class{constructor(e,t){this.model={address:e.address,type:O.Types.Hyperlink,text:t?t.text:void 0,hyperlink:t?t.hyperlink:void 0},t&&t.tooltip&&(this.model.tooltip=t.tooltip)}get value(){return{text:this.model.text??``,hyperlink:this.model.hyperlink??``,tooltip:this.model.tooltip}}set value(e){this.model.text=e.text,this.model.hyperlink=e.hyperlink,e.tooltip&&(this.model.tooltip=e.tooltip)}get text(){return this.model.text}set text(e){this.model.text=e}get hyperlink(){return this.model.hyperlink}set hyperlink(e){this.model.hyperlink=e}get type(){return O.Types.Hyperlink}get effectiveType(){return O.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??``}},Te=class{constructor(e,t){this.model={address:e.address,type:O.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 O?(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 O.Types.Merge}get effectiveType(){return this._master.effectiveType}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return``}release(){this._master.releaseMergeRef()}toString(){return this.value==null?``:this.value.toString()}},Ee=class{constructor(e,t){this.cell=e,this.model={address:e.address,type:O.Types.Formula,shareType:t?t.shareType:void 0,ref:t?t.ref:void 0,formula:t?t.formula:void 0,sharedFormula:t?t.sharedFormula:void 0,result:t?t.result:void 0}}_copyModel(e){let t={};return e.formula&&(t.formula=e.formula),e.result!==void 0&&(t.result=e.result),e.ref&&(t.ref=e.ref),e.shareType&&(t.shareType=e.shareType),e.sharedFormula&&(t.sharedFormula=e.sharedFormula),t}get value(){return this._copyModel(this.model)}set value(e){e.formula&&(this.model.formula=e.formula),e.result!==void 0&&(this.model.result=e.result),e.ref&&(this.model.ref=e.ref),e.shareType&&(this.model.shareType=e.shareType),e.sharedFormula&&(this.model.sharedFormula=e.sharedFormula)}validate(e){switch(Me.getType(e)){case O.Types.Null:case O.Types.String:case O.Types.Number:case O.Types.Date:break;case O.Types.Hyperlink:case O.Types.Formula:default:throw new g(String(Me.getType(e)),`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?D.FormulaType.Master:this.model.sharedFormula?D.FormulaType.Shared:D.FormulaType.None}get result(){return this.model.result}set result(e){this.model.result=e}get type(){return O.Types.Formula}get effectiveType(){let e=this.model.result;return e==null?D.ValueType.Null:typeof e==`string`?D.ValueType.String:typeof e==`number`?D.ValueType.Number:e instanceof Date?D.ValueType.Date:typeof e==`object`&&`error`in e?D.ValueType.Error:D.ValueType.Null}get address(){return this.model.address}set address(e){this.model.address=e}_getTranslatedFormula(){if(!this._translatedFormula&&this.model.sharedFormula){let{worksheet:e}=this.cell,t=e.findCell(this.model.sharedFormula);this._translatedFormula=t&&t.formula?_e(t.formula,t.address,this.model.address):void 0}return this._translatedFormula}toCsvString(){return`${this.model.result??``}`}release(){}toString(){return this.model.result?this.model.result.toString():``}},De=class{constructor(e,t){this.model={address:e.address,type:O.Types.SharedString,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.SharedString}get effectiveType(){return O.Types.SharedString}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return this.model.value.toString()}release(){}toString(){return this.model.value.toString()}},Oe=class{constructor(e,t){this.model={address:e.address,type:O.Types.Boolean,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Boolean}get effectiveType(){return O.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return+!!this.model.value}release(){}toString(){return this.model.value.toString()}},ke=class{constructor(e,t){this.model={address:e.address,type:O.Types.Checkbox,value:t.checkbox}}get value(){return{checkbox:this.model.value}}set value(e){this.model.value=e.checkbox}get type(){return O.Types.Checkbox}get effectiveType(){return O.Types.Boolean}get address(){return this.model.address}set address(e){this.model.address=e}toCsvString(){return+!!this.model.value}release(){}toString(){return this.model.value.toString()}},Ae=class{constructor(e,t){this.model={address:e.address,type:O.Types.Error,value:t}}get value(){return this.model.value}set value(e){this.model.value=e}get type(){return O.Types.Error}get effectiveType(){return O.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()}},je=class{constructor(e,t){this.model={address:e.address,type:O.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 O.Types.String}get effectiveType(){return O.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 Me={getType(e){if(e==null)return O.Types.Null;if(typeof e==`string`)return O.Types.String;if(typeof e==`number`)return O.Types.Number;if(typeof e==`boolean`)return O.Types.Boolean;if(e instanceof Date)return O.Types.Date;if(typeof e==`object`){if(`checkbox`in e&&typeof e.checkbox==`boolean`)return O.Types.Checkbox;if(`text`in e&&e.text&&`hyperlink`in e&&e.hyperlink)return O.Types.Hyperlink;if(`formula`in e&&e.formula||`sharedFormula`in e&&e.sharedFormula)return O.Types.Formula;if(`richText`in e&&e.richText)return O.Types.RichText;if(`sharedString`in e&&e.sharedString)return O.Types.SharedString;if(`error`in e&&e.error)return O.Types.Error}return O.Types.JSON},types:[{t:O.Types.Null,f:ye},{t:O.Types.Number,f:be},{t:O.Types.String,f:xe},{t:O.Types.Date,f:Ce},{t:O.Types.Hyperlink,f:we},{t:O.Types.Formula,f:Ee},{t:O.Types.Merge,f:Te},{t:O.Types.JSON,f:je},{t:O.Types.SharedString,f:De},{t:O.Types.RichText,f:Se},{t:O.Types.Boolean,f:Oe},{t:O.Types.Error,f:Ae},{t:O.Types.Checkbox,f:ke}].reduce((e,t)=>(e[t.t]=t.f,e),[]),create(e,t,n){let r=this.types[e];if(!r)throw new g(String(e),`Could not create Value`);return new r(t,n)}},Ne=(e,t)=>({...e,...t.reduce((t,n)=>(e[n]&&(t[n]={...e[n]}),t),{})}),Pe=(e,t,n,r=[])=>{e[n]&&(t[n]=Ne(e[n],r))},Fe=e=>Object.keys(e).length===0,Ie=e=>{if(!e)return e;if(Fe(e))return{};let t={...e};return Pe(e,t,`font`,[`color`]),Pe(e,t,`alignment`),Pe(e,t,`protection`),e.border&&(Pe(e,t,`border`),Pe(e.border,t.border,`top`,[`color`]),Pe(e.border,t.border,`left`,[`color`]),Pe(e.border,t.border,`bottom`,[`color`]),Pe(e.border,t.border,`right`,[`color`]),Pe(e.border,t.border,`diagonal`,[`color`])),e.fill&&(Pe(e,t,`fill`,[`fgColor`,`bgColor`,`center`]),e.fill.stops&&(t.fill.stops=e.fill.stops.map(e=>Ne(e,[`color`])))),t};var Le=class{constructor(e,t){this._worksheet=e,this._number=t,this._cells=[],this.style={},this.outlineLevel=0}get number(){return this._number}get worksheet(){return this._worksheet}commit(){this._worksheet._commitRow(this)}destroy(){this._worksheet=void 0,this._cells=void 0,this.style=void 0}findCell(e){return this._cells[e-1]}getCellEx(e){let t=this._cells[e.col-1];if(!t){let n=this._worksheet.getColumn(e.col);t=new O(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:w.l2n(e)}else t=e;return this._cells[t-1]||this.getCellEx({address:w.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=Ie(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=Ie(s.style)??{},c.comment=s.comment):this._cells[o+i-1]=void 0;for(o=0;o<n.length;o++)c=this.getCell(e+o),c.value=n[o],c.style={},c.comment=void 0}eachCell(e,t){let n=null,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._cells.length;for(let t=1;t<=e;t++)r(this.getCell(t),t)}else this._cells.forEach((e,t)=>{e&&e.type!==D.ValueType.Null&&r(e,t+1)})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||16838,a={id:this._number,max:i,man:1};r&&(a.min=r),n.rowBreaks.push(a)}get values(){let e=[];return this._cells.forEach(t=>{t&&t.type!==D.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:w.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:w.encodeAddress(this._number,t.number),row:this._number,col:t.number}).value=e[n])})}getValues(){let e=[];return this._cells.forEach(t=>{t&&t.type!==D.ValueType.Null&&(e[t.col-1]=t.value)}),e}valuesToString(e=`,`){return this.getValues().join(e)}get hasValues(){return this._cells.some(e=>e&&e.type!==D.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!==D.ValueType.Null&&((!e||e>n.col)&&(e=n.col),t<n.col&&(t=n.col))}),e>0?{min:e,max:t}:null}_applyStyle(e,t){this.style[e]=t,this._cells.forEach(n=>{n&&(n.style[e]=t)})}get numFmt(){return this.style.numFmt}set numFmt(e){e!==void 0&&this._applyStyle(`numFmt`,e)}get font(){return this.style.font}set font(e){e!==void 0&&this._applyStyle(`font`,e)}get alignment(){return this.style.alignment}set alignment(e){e!==void 0&&this._applyStyle(`alignment`,e)}get protection(){return this.style.protection}set protection(e){e!==void 0&&this._applyStyle(`protection`,e)}get border(){return this.style.border}set border(e){e!==void 0&&this._applyStyle(`border`,e)}get fill(){return this.style.fill}set fill(e){e!==void 0&&this._applyStyle(`fill`,e)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelRow??0))}get model(){let e=[],t=0,n=0;return this._cells.forEach(r=>{if(r){let i=r.model;i&&((!t||t>r.col)&&(t=r.col),n<r.col&&(n=r.col),e.push(i))}}),this.height!=null||e.length?{cells:e,number:this.number,min:t,max:n,height:this.height,customHeight:this.customHeight,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,collapsed:this.collapsed,dyDescent:this.dyDescent}:null}set model(e){if(e.number!==this._number)throw new l(`Invalid row number in model`);this._cells=[];let t;e.cells.forEach(e=>{switch(e.type){case O.Types.Merge:break;default:{let n;if(e.address)n=w.decodeAddress(e.address);else if(t){let{row:e}=t,r=t.col+1;n={row:e,col:r,address:w.encodeAddress(e,r),$col$row:`$${w.n2l(r)}$${e}`}}if(t=n,!n)break;let r=this.getCellEx(n);r.model=e;break}}}),e.height==null?delete this.height:this.height=e.height,e.customHeight==null?delete this.customHeight:this.customHeight=e.customHeight,this.hidden=e.hidden,this.outlineLevel=e.outlineLevel??0,this.dyDescent=e.dyDescent,this.style=e.style?structuredClone(e.style):{}}},Re=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 w.n2l(this._number)}get isCustomWidth(){return this.width!==void 0&&this.width!==9}get defn(){return{header:this._header,key:this.key,width:this.width,style:this.style,hidden:this.hidden,outlineLevel:this.outlineLevel,bestFit:this.bestFit}}set defn(e){e?(this.key=e.key,this.width=e.width===void 0?9:e.width,this.outlineLevel=e.outlineLevel,e.style?this.style=e.style:this.style={},this.header=e.header,this._hidden=!!e.hidden,this.bestFit=e.bestFit):(delete this._header,delete this._key,delete this.width,this.style={},this.outlineLevel=0,delete this.bestFit)}get headers(){return Array.isArray(this._header)?this._header:this._header===void 0?[]:[this._header]}get header(){return this._header}set header(e){e===void 0?this._header=void 0:(this._header=e,this.headers.forEach((e,t)=>{this._worksheet.getCell(t+1,this.number).value=e}))}get key(){return this._key}set key(e){(this._key&&this._worksheet.getColumnKey(this._key))===this&&this._worksheet.deleteColumnKey(this._key),this._key=e,e&&this._worksheet.setColumnKey(e,this)}get hidden(){return!!this._hidden}set hidden(e){this._hidden=e}get outlineLevel(){return this._outlineLevel??0}set outlineLevel(e){this._outlineLevel=e}get collapsed(){return!!(this._outlineLevel&&this._outlineLevel>=(this._worksheet.properties.outlineLevelCol??0))}toString(){return JSON.stringify({key:this.key,width:this.width,headers:this.headers.length?this.headers:void 0})}equivalentTo(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&ue(this.style,e.style)}equivalentToModel(e){return this.width===e.width&&this.hidden===e.hidden&&this.outlineLevel===e.outlineLevel&&this.bestFit===e.bestFit&&ue(this.style,e.style)}get isDefault(){if(this.isCustomWidth||this.hidden||this.outlineLevel||this.bestFit)return!1;let e=this.style;return!(e&&(e.font||e.numFmt||e.alignment||e.border||e.fill||e.protection))}get headerCount(){return this.headers.length}eachCell(e,t){let n=this.number,r,i;typeof e==`function`?(r={},i=e):(r=e,i=t),this._worksheet.eachRow(r,(e,t)=>{i(e.getCell(n),t)})}get values(){let e=[];return this.eachCell((t,n)=>{t&&t.type!==D.ValueType.Null&&(e[n]=t.value)}),e}set values(e){if(!e)return;let t=this.number,n=0;Object.prototype.hasOwnProperty.call(e,`0`)&&(n=1),e.forEach((e,r)=>{this._worksheet.getCell(r+n,t).value=e})}addPageBreak(e,t){let n=this._worksheet,r=Math.max(0,(e??0)-1)||0,i=Math.max(0,(t??0)-1)||1048575,a={id:this._number,max:i,man:1};r&&(a.min=r),n.colBreaks.push(a)}get numFmt(){return this.style.numFmt}set numFmt(e){this.style.numFmt=e,this.eachCell(t=>{t.numFmt=e})}get font(){return this.style.font}set font(e){this.style.font=e,this.eachCell(t=>{t.font=e})}get alignment(){return this.style.alignment}set alignment(e){this.style.alignment=e,this.eachCell(t=>{t.alignment=e})}get protection(){return this.style.protection}set protection(e){this.style.protection=e,this.eachCell(t=>{t.protection=e})}get border(){return this.style.border}set border(e){this.style.border=e,this.eachCell(t=>{t.border=e})}get fill(){return this.style.fill}set fill(e){this.style.fill=e,this.eachCell(t=>{t.fill=e})}static toModel(e){let t=[],n=null;return e.forEach((e,r)=>{e.isDefault?n&&=null:!n||!e.equivalentToModel(n)?(n={min:r+1,max:r+1,width:e.width===void 0?9:e.width,style:e.style,isCustomWidth:e.isCustomWidth,hidden:e.hidden,outlineLevel:e.outlineLevel,collapsed:e.collapsed,bestFit:e.bestFit},t.push(n)):n.max=r+1}),t.length?t:void 0}static fromModel(t,n){let r=t,i=Array.isArray(t)?t:n??[];i??=[];let a=[],o=1,s=0;for(i=i.sort((e,t)=>e.min-t.min);s<i.length;){let t=i[s++];for(;o<t.min;)a.push(new e(r,o++));for(;o<=t.max;)a.push(new e(r,o++,t))}return a}};function ze(e){return typeof e==`object`&&`nativeCol`in e&&`nativeRow`in e&&`nativeColOff`in e&&`nativeRowOff`in e}function Be(e){return typeof e==`object`&&`col`in e&&`row`in e}var Ve=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=w.decodeAddress(t);this.nativeCol=e.col+n,this.nativeColOff=0,this.nativeRow=e.row+n,this.nativeRowOff=0}else ze(t)?(this.nativeCol=t.nativeCol??0,this.nativeColOff=t.nativeColOff??0,this.nativeRow=t.nativeRow??0,this.nativeRowOff=t.nativeRowOff??0):Be(t)?(this.col=t.col+n,this.row=t.row+n):(this.nativeCol=0,this.nativeColOff=0,this.nativeRow=0,this.nativeRowOff=0)}static asInstance(t){return t==null?null:t instanceof e?t:new e(void 0,t)}get col(){return this.nativeColOff===0?this.nativeCol:this.nativeCol+Math.min(this.colWidth-1,this.nativeColOff)/this.colWidth}set col(e){this.nativeCol=Math.floor(e);let t=e-this.nativeCol;this.nativeColOff=t===0?0:Math.floor(t*this.colWidth)}get row(){return this.nativeRowOff===0?this.nativeRow:this.nativeRow+Math.min(this.rowHeight-1,this.nativeRowOff)/this.rowHeight}set row(e){this.nativeRow=Math.floor(e);let t=e-this.nativeRow;this.nativeRowOff=t===0?0:Math.floor(t*this.rowHeight)}get colWidth(){return this.worksheet&&this.worksheet.getColumn(this.nativeCol+1)&&this.worksheet.getColumn(this.nativeCol+1).isCustomWidth?Math.floor(this.worksheet.getColumn(this.nativeCol+1).width*1e4):64e4}get rowHeight(){let e=this.worksheet?.getRow(this.nativeRow+1)?.height;return e?Math.floor(e*1e4):18e4}get model(){return{nativeCol:this.nativeCol,nativeColOff:this.nativeColOff,nativeRow:this.nativeRow,nativeRowOff:this.nativeRowOff}}set model(e){this.nativeCol=e.nativeCol,this.nativeColOff=e.nativeColOff,this.nativeRow=e.nativeRow,this.nativeRowOff=e.nativeRowOff}clone(t){return new e(t??this.worksheet,this.model)}},He=class e{constructor(e,t){this.worksheet=e,t&&(this.model=t)}get model(){switch(this.type){case`background`:return{type:this.type,imageId:this.imageId??``};case`image`:{let e=this.range;if(!e)throw new C(`Image has no range`);return{type:this.type,imageId:this.imageId??``,hyperlinks:e.hyperlinks,range:{tl:e.tl.model,br:e.br?.model,ext:e.ext,editAs:e.editAs}}}default:throw new C(`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=w.decode(n);`top`in e&&(this.range={tl:new Ve(this.worksheet,{col:e.left,row:e.top},-1),br:new Ve(this.worksheet,{col:e.right,row:e.bottom},0),editAs:`oneCell`})}else n&&(this.range={tl:new Ve(this.worksheet,n.tl,0),br:n.br?new Ve(this.worksheet,n.br,0):void 0,ext:n.ext,editAs:n.editAs,hyperlinks:r||(`hyperlinks`in n?n.hyperlinks:void 0)})}clone(t){let n=t??this.worksheet,r=new e(n);return r.type=this.type,r.imageId=this.imageId,this.range&&(r.range={tl:this.range.tl.clone(n),br:this.range.br?this.range.br.clone(n):void 0,ext:this.range.ext?{...this.range.ext}:void 0,editAs:this.range.editAs,hyperlinks:this.range.hyperlinks?{...this.range.hyperlinks}:void 0}),r}};let Ue=/^[A-Za-z]{1,3}\d+$/,We=/^[Rr]\d+[Cc]\d+$/,Ge=new Set([`C`,`c`,`R`,`r`]),Ke=/\s/g,qe=/[^\p{L}\p{N}_.]/gu,Je=/^[\p{L}_\\]/u;function Ye(e){let t=e.replace(Ke,`_`),n=!1;return t.startsWith(`\\`)&&(n=!0,t=t.slice(1)),t=t.replace(qe,``),n&&(t=`\\${t}`),t.length>0&&!Je.test(t)&&(t=`_${t}`),t.length===0?`_Table`:(t.length===1&&Ge.has(t)&&(t=`_${t}`),(Ue.test(t)||We.test(t))&&(t=`_${t}`),t.length>255&&(t=t.slice(0,255)),t)}var Xe=class{constructor(e,t,n){this.table=e,this.column=t,this.index=n}_set(e,t){this.table.cacheState(),this.column[e]=t}get name(){return this.column.name}set name(e){this._set(`name`,e)}get filterButton(){return this.column.filterButton}set filterButton(e){this.column.filterButton=e}get style(){return this.column.style}set style(e){this.column.style=e}get totalsRowLabel(){return this.column.totalsRowLabel}set totalsRowLabel(e){this._set(`totalsRowLabel`,e)}get totalsRowFunction(){return this.column.totalsRowFunction}set totalsRowFunction(e){this._set(`totalsRowFunction`,e)}get totalsRowResult(){return this.column.totalsRowResult}set totalsRowResult(e){this._set(`totalsRowResult`,e)}get totalsRowFormula(){return this.column.totalsRowFormula}set totalsRowFormula(e){this._set(`totalsRowFormula`,e)}},Ze=class e{constructor(e,t){if(this.worksheet=e,t){if(this.table=t,Array.isArray(t.rows)&&t.rows.length===0&&t.tableRef){let n=w.decode(t.tableRef);if(`dimensions`in n){let r=n.top+(t.headerRow===!1?0:1),i=n.bottom-+(t.totalsRow===!0);if(i>=r)for(let a=r;a<=i;a++){let r=e.getRow(a),i=[];for(let e=n.left;e<=n.right;e++)i.push(r.getCell(e).value);t.rows.push(i)}}}this.validate(),this.store()}}static{this.SUBTOTAL_FUNCTIONS={average:101,countNums:102,count:103,max:104,min:105,stdDev:106,var:107,sum:109}}getFormula(t){if(t.totalsRowFunction===`none`)return null;if(t.totalsRowFunction===`custom`)return t.totalsRowFormula??null;let n=t.totalsRowFunction?e.SUBTOTAL_FUNCTIONS[t.totalsRowFunction]:void 0;if(n!==void 0)return`SUBTOTAL(${n},${this.table.name}[${t.name}])`;throw new ee(`Invalid Totals Row Function: ${t.totalsRowFunction}`)}get width(){return this.table.columns.length}get height(){return this.table.rows.length}get filterHeight(){return this.height+ +!!this.table.headerRow}get tableHeight(){return this.filterHeight+ +!!this.table.totalsRow}validate(){let{table:e}=this,t=(e,t,n)=>{e[t]===void 0&&(e[t]=n)};t(e,`headerRow`,!0),t(e,`totalsRow`,!1),t(e,`style`,{});let n=e.style;t(n,`theme`,`TableStyleMedium2`),t(n,`showFirstColumn`,!1),t(n,`showLastColumn`,!1),t(n,`showRowStripes`,!1),t(n,`showColumnStripes`,!1),e.name&&=Ye(e.name),e.displayName&&=Ye(e.displayName);let r=(e,t)=>{if(!e)throw new ee(t)};r(!!e.name,`Table must have a name`),r(!!e.ref,`Table must have ref`),r(!!e.columns,`Table must have column definitions`),r(!!e.rows,`Table must have row definitions`),e.tl=w.decodeAddress(e.ref);let{row:i,col:a}=e.tl;r(i>0,`Table must be on valid row`),r(a>0,`Table must be on valid col`);let{width:o,tableHeight:s}=this;e.autoFilterRef=w.encode(i,a,i,a+o-1),e.tableRef=w.encode(i,a,i+s-1,a+o-1),e.columns.forEach((e,n)=>{r(!!e.name,`Column ${n} must have a name`),n===0?t(e,`totalsRowLabel`,`Total`):(t(e,`totalsRowFunction`,`none`),e.totalsRowFormula=this.getFormula(e)??void 0)})}store(){let e=(e,t)=>{t&&Object.assign(e.style,t)},{worksheet:t,table:n}=this,{row:r,col:i}=n.tl,a=0;if(n.headerRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let{style:r,name:a}=t,s=o.getCell(i+n);s.value=a,e(s,r)})}if(n.rows.forEach(o=>{let s=t.getRow(r+ a++);o.forEach((t,r)=>{let a=s.getCell(i+r);if(typeof t==`object`&&t&&`formula`in t&&typeof t.formula==`string`){let e=t,r=n.qualifyImplicitStructuredReferences===!0;a.value={...e,formula:r?e.formula.replace(/(^|[^A-Za-z0-9_])\[@\[?([^\[\]]+?)\]?\]/g,`$1${n.name}[[#This Row],[$2]]`):e.formula}}else a.value=t;e(a,n.columns[r]?.style)})}),n.totalsRow){let o=t.getRow(r+ a++);n.columns.forEach((t,n)=>{let r=o.getCell(i+n);if(n===0)r.value=t.totalsRowLabel;else{let e=this.getFormula(t);e?r.value={formula:e,result:t.totalsRowResult}:r.value=null}e(r,t.style)})}}load(e){let{table:t}=this,{row:n,col:r}=t.tl,i=0;if(t.headerRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e.name})}if(t.rows.forEach(t=>{let a=e.getRow(n+ i++);t.forEach((e,t)=>{let n=a.getCell(r+t);n.value=e})}),t.totalsRow){let a=e.getRow(n+ i++);t.columns.forEach((e,t)=>{let n=a.getCell(r+t);if(t===0)n.value=e.totalsRowLabel;else{let t=this.getFormula(e);t&&(n.value={formula:t,result:e.totalsRowResult})}})}}get model(){return this.table}set model(e){this.table=e}cacheState(){this._cache||={ref:this.ref,width:this.width,tableHeight:this.tableHeight}}commit(){if(!this._cache)return;this.validate();let e=w.decodeAddress(this._cache.ref);if(this.ref!==this._cache.ref)for(let t=0;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}else{for(let t=this.tableHeight;t<this._cache.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=0;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}for(let t=0;t<this.tableHeight;t++){let n=this.worksheet.getRow(e.row+t);for(let t=this.width;t<this._cache.width;t++){let r=n.getCell(e.col+t);r.value=null}}}this.store(),this._cache=void 0}addRow(e,t,n){this.cacheState(),t===void 0?this.table.rows.push(e):this.table.rows.splice(t,0,e),n?.commit!==!1&&this.commit()}removeRows(e,t=1,n){this.cacheState(),this.table.rows.splice(e,t),n?.commit!==!1&&this.commit()}getColumn(e){let t=this.table.columns[e];return new Xe(this,t,e)}addColumn(e,t,n){this.cacheState(),n===void 0?(this.table.columns.push(e),this.table.rows.forEach((e,n)=>{e.push(t[n])})):(this.table.columns.splice(n,0,e),this.table.rows.forEach((e,r)=>{e.splice(n,0,t[r])}))}removeColumns(e,t=1){this.cacheState(),this.table.columns.splice(e,t),this.table.rows.forEach(n=>{n.splice(e,t)})}_assign(e,t,n){this.cacheState(),e[t]=n}get ref(){return this.table.ref}set ref(e){this._assign(this.table,`ref`,e)}get name(){return this.table.name}set name(e){this.cacheState(),this.table.name=Ye(e)}get displayName(){return this.table.displayName||this.table.name}set displayName(e){this.cacheState(),this.table.displayName=Ye(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)}_ensureStyle(){return this.table.style||(this.table.style={}),this.table.style}get theme(){return this.table.style?.theme}set theme(e){this._ensureStyle().theme=e}get showFirstColumn(){return this.table.style?.showFirstColumn}set showFirstColumn(e){this._ensureStyle().showFirstColumn=e}get showLastColumn(){return this.table.style?.showLastColumn}set showLastColumn(e){this._ensureStyle().showLastColumn=e}get showRowStripes(){return this.table.style?.showRowStripes}set showRowStripes(e){this._ensureStyle().showRowStripes=e}get showColumnStripes(){return this.table.style?.showColumnStripes}set showColumnStripes(e){this._ensureStyle().showColumnStripes=e}},Qe=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;for(let t of Object.keys(this.model)){if(!t.startsWith(`range:`))continue;n||=w.decodeAddress(e);let r=t.slice(6),i=w.decodeEx(r);if(!(`dimensions`in i))continue;let{tl:a,br:o}=i,s=typeof a==`string`?w.decodeAddress(a):a,c=typeof o==`string`?w.decodeAddress(o):o;if(n.row>=s.row&&n.row<=c.row&&n.col>=s.col&&n.col<=c.col)return this.model[t]}}remove(e){this.model[e]=void 0}};let $e=9525,et=12700,tt=142875,nt=28575,rt=276225,it=190500;var at=class e{constructor(e,t,n){this.worksheet=e;let{tl:r,br:i}=this._parseRange(t),a=1025+(e.formControls?.length??0),o;n?.link&&(o=this._toAbsoluteRef(n.link)),this.model={shapeId:a,ctrlPropId:0,tl:r,br:i,link:o,checked:n?.checked?`Checked`:`Unchecked`,text:n?.text??``,noThreeD:n?.noThreeD??!0,print:n?.print??!1}}get checked(){return this.model.checked===`Checked`}set checked(e){this.model.checked=e?`Checked`:`Unchecked`}get link(){return this.model.link}set link(e){this.model.link=e?this._toAbsoluteRef(e):void 0}get text(){return this.model.text}set text(e){this.model.text=e}_toAbsoluteRef(e){if(e.includes(`$`))return e;let t=w.decodeAddress(e);return`$${w.n2l(t.col)}$${t.row}`}_parseRange(e){let t,n;if(typeof e==`string`)if(e.includes(`:`)){let r=w.decode(e);if(`top`in r)if(r.left===r.right&&r.top===r.bottom){let e=r.left-1,i=r.top-1;t={col:e,colOff:tt,row:i,rowOff:nt},n={col:e+2,colOff:rt,row:i+1,rowOff:it}}else t={col:r.left-1,colOff:tt,row:r.top-1,rowOff:nt},n={col:r.right-1,colOff:rt,row:r.bottom-1,rowOff:it};else t={col:r.col-1,colOff:tt,row:r.row-1,rowOff:nt},n={col:r.col+1,colOff:rt,row:r.row,rowOff:it}}else{let r=w.decodeAddress(e);t={col:r.col-1,colOff:tt,row:r.row-1,rowOff:nt},n={col:r.col+1,colOff:rt,row:r.row,rowOff:it}}else if(`startCol`in e)t={col:e.startCol,colOff:e.startColOff??tt,row:e.startRow,rowOff:e.startRowOff??nt},n={col:e.endCol,colOff:e.endColOff??rt,row:e.endRow,rowOff:e.endRowOff??it};else{if(typeof e.tl==`string`){let n=w.decodeAddress(e.tl);t={col:n.col-1,colOff:tt,row:n.row-1,rowOff:nt}}else t={col:e.tl.col,colOff:e.tl.colOff??tt,row:e.tl.row,rowOff:e.tl.rowOff??nt};if(e.br)if(typeof e.br==`string`){let t=w.decodeAddress(e.br);n={col:t.col-1,colOff:rt,row:t.row-1,rowOff:it}}else n={col:e.br.col,colOff:e.br.colOff??rt,row:e.br.row,rowOff:e.br.rowOff??it};else n={col:t.col+2,colOff:rt,row:t.row+1,rowOff:it}}return{tl:t,br:n}}getVmlAnchor(){return e.getVmlAnchor(this.model)}getVmlStyle(){return e.getVmlStyle(this.model)}getVmlCheckedValue(){return e.getVmlCheckedValue(this.model)}static getVmlAnchor(e){let{tl:t,br:n}=e,r=Math.round(t.colOff/$e),i=Math.round(t.rowOff/$e),a=Math.round(n.colOff/$e),o=Math.round(n.rowOff/$e);return`${t.col}, ${r}, ${t.row}, ${i}, ${n.col}, ${a}, ${n.row}, ${o}`}static getVmlStyle(e){return`position:absolute;margin-left:${Math.round(e.tl.colOff/et)}pt;margin-top:${Math.round(e.tl.rowOff/et)}pt;width:96pt;height:18pt;z-index:1;visibility:visible`}static getVmlCheckedValue(e){switch(e.checked){case`Checked`:return 1;case`Mixed`:return 2;default:return 0}}};function ot(){return typeof process<`u`&&!!process.versions?.node}var st=class extends t{constructor(...e){super(...e),this.name=`XmlError`}},ct=class extends st{constructor(e,t,n){let r=[];t?.fileName&&r.push(t.fileName),t?.line!==void 0&&r.push(`${t.line}:${t.column??0}`);let i=r.length>0?`${r.join(`:`)}: `:``;super(`${i}${e}`,n),this.name=`XmlParseError`,this.line=t?.line,this.column=t?.column,this.fileName=t?.fileName}},lt=class extends st{constructor(e,t,n){super(`Cannot ${e}: ${t}`,n),this.name=`XmlWriteError`,this.operation=e,this.state=t}};let ut={lt:`<`,gt:`>`,amp:`&`,quot:`"`,apos:`'`},dt=/&(#\d+|#[xX][0-9A-Fa-f]+|\w+);/g,ft=(()=>{let e=new Uint8Array(128);for(let t=0;t<=8;t++)e[t]=2;e[11]=2,e[12]=2;for(let t=14;t<=31;t++)e[t]=2;return e[127]=2,e[34]=1,e[38]=1,e[39]=1,e[60]=1,e[62]=1,e})(),pt={34:`"`,38:`&`,39:`'`,60:`<`,62:`>`};function mt(e){return e.indexOf(`&`)===-1?e:e.replace(dt,(e,t)=>{if(t[0]===`#`){let n=t[1]===`x`||t[1]===`X`?parseInt(t.slice(2),16):parseInt(t.slice(1),10);return Number.isNaN(n)||n<1||n>=55296&&n<=57343||n>1114111?e:String.fromCodePoint(n)}return ut[t]??e})}function k(e){let t=e.length,n=-1;for(let r=0;r<t;r++){let t=e.charCodeAt(r);if(t<128){if(ft[t]!==0){n=r;break}}else if(t>=55296&&t<=57343){if(t<=56319){let t=e.charCodeAt(r+1);if(t>=56320&&t<=57343){r++;continue}}n=r;break}else if(t===65534||t===65535){n=r;break}}if(n===-1)return e;let r=[],i=0;for(let a=n;a<t;a++){let t=e.charCodeAt(a);if(t<128){let n=ft[t];if(n===0)continue;i<a&&r.push(e.substring(i,a)),n===1&&r.push(pt[t]),i=a+1}else if(t>=55296&&t<=56319){let t=e.charCodeAt(a+1);if(t>=56320&&t<=57343){a++;continue}i<a&&r.push(e.substring(i,a)),i=a+1}else (t>=56320&&t<=57343||t===65534||t===65535)&&(i<a&&r.push(e.substring(i,a)),i=a+1)}return i<t&&r.push(e.substring(i)),r.length===1?r[0]:r.join(``)}function ht(e){return k(e)}let gt=/[\s<>"'\/=&]/;function _t(e){if(!e)throw new st(`XML name must not be empty`);if(gt.test(e))throw new st(`Invalid XML name: contains forbidden character in "${e}"`);let t=e.charCodeAt(0);if(t>=48&&t<=57||t===45||t===46)throw new st(`Invalid XML name: "${e}" starts with forbidden character`)}function vt(e){return`<![CDATA[`+e.split(`]]>`).join(`]]]]><![CDATA[>`)+`]]>`}function yt(e){if(e.includes(`--`)||e.endsWith(`-`))throw new st(`Invalid comment: must not contain "--" or end with "-"`)}let A={version:`1.0`,encoding:`UTF-8`,standalone:`yes`};function bt(e){if(ot())return Buffer.from(e,`base64`);let t=atob(e),n=new Uint8Array(t.length);for(let e=0;e<t.length;e++)n[e]=t.charCodeAt(e);return n}function xt(e,t){return 25569+e.getTime()/(24*3600*1e3)-(t?1462:0)}function St(e,t){let n=Math.round((e-25569+(t?1462:0))*24*3600*1e3);return new Date(n)}function Ct(e){return new Date(e.endsWith(`Z`)?e:e+`Z`)}let wt=/_x([0-9A-Fa-f]{4})_/g;function Tt(e){return e.replace(wt,(e,t)=>{let n=parseInt(t,16);return n===0||n>=1&&n<=8||n===11||n===12||n>=14&&n<=31||n===127||n>=55296&&n<=57343||n===65534||n===65535?e:String.fromCharCode(n)})}function Et(e){return e.replace(wt,`_x005F_x$1_`)}let Dt=/[\t\n\r]/g,Ot={" ":`_x0009_`,"\n":`_x000A_`,"\r":`_x000D_`};function kt(e){let t=e.replace(wt,`_x005F_x$1_`);return t=t.replace(Dt,e=>Ot[e]),t}function At(e){let t=typeof e==`number`?e:parseInt(e,10);return Number.isNaN(t)?0:t}function jt(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}let Mt=/[ymdhMsb]/,Nt=/\[[^\]]*\]|"[^"]*"/g,Pt=new Map;function Ft(e){if(!e)return!1;let t=Pt.get(e);if(t!==void 0)return t;let n=jt(e)[0].replace(Nt,``),r;return r=n.indexOf(`@`)>-1?!1:Mt.test(n),Pt.set(e,r),r}function It(e){return e===!0||e===`true`||e===1||e===`1`}function*Lt(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 Rt(e){let t=Array.from(e);return t.length<=1?t:t.every(e=>Number.isFinite(e))?t.sort((e,t)=>e-t):t.every(e=>e instanceof Date)?t.sort((e,t)=>e.getTime()-t.getTime()):t.sort((e,t)=>{let n=zt(e),r=zt(t);return n===r?n===0?e-t:n===1?e.getTime()-t.getTime():String(e).localeCompare(String(t)):n-r})}function zt(e){return Number.isFinite(e)?0:e instanceof Date?1:2}let Bt=new TextDecoder(`utf-8`),Vt,Ht=!1;function Ut(){if(!Ht){Ht=!0;try{Vt=new TextDecoder(`latin1`)}catch{Vt=void 0}}return Vt}function Wt(e){return typeof e==`string`?e:Bt.decode(e)}function Gt(e){if(ot())return Buffer.from(e).toString(`base64`);if(Ut())try{return btoa(Vt.decode(e))}catch{}let t=32768,n=[];for(let r=0;r<e.length;r+=t)n.push(String.fromCharCode.apply(null,e.subarray(r,r+t)));return btoa(n.join(``))}function Kt(e){let t=new Uint8Array(e.length*2);for(let n=0;n<e.length;n++){let r=e.charCodeAt(n);t[n*2]=r&255,t[n*2+1]=r>>8&255}return t}var qt=class{constructor(e){this.code=e}toString(){return`#${this.code}`}};let Jt={sum:`Sum`,count:`Count`,average:`Average`,max:`Max`,min:`Min`,product:`Product`,countNums:`Count Numbers`,stdDev:`StdDev`,stdDevP:`StdDevP`,var:`Var`,varP:`VarP`},Yt=new Set(Object.keys(Jt));function Xt(e){let t=e.model;if(t.headerRow===!1)throw new S(`Cannot create pivot table from a table without headers. Set headerRow: true on the table.`);if(!t.rows||t.rows.length===0)throw new S(`Cannot create pivot table from an empty table. Add data rows to the table.`);let n=t.columns.map(e=>e.name),r=new Set;for(let e of n){if(r.has(e))throw new S(`Duplicate column name "${e}" found in table. Pivot tables require unique column names.`);r.add(e)}let i=[void 0,...n],a=t.rows.map(e=>[void 0,...e]),o=t.tl;if(!o)throw Error(`Table "${t.name}" is missing top-left cell address (tl)`);let s=o.row,c=o.col,l=s+t.rows.length,u=c+n.length-1,d=w.encode(s,c,l,u);return{name:e.worksheet.name,tableName:t.name,getRow(e){if(e===1)return{values:i};let t=e-2;return t>=0&&t<a.length?{values:a[t]}:{values:[]}},getColumn(e){if(e<1||e>n.length)return{values:[]};let r=[];r[1]=n[e-1];for(let n=0;n<t.rows.length;n++)r[n+2]=t.rows[n][e-1];return{values:r}},getSheetValues(){let e=[];e[1]=i;for(let t=0;t<a.length;t++)e[t+2]=a[t];return e},dimensions:{shortRange:d}}}function Zt(e){if(e.sourceSheet&&e.sourceTable)throw new S(`Cannot specify both sourceSheet and sourceTable. Choose one.`);if(e.sourceTable)return Xt(e.sourceTable);if(!e.sourceSheet)throw Error(`Either sourceSheet or sourceTable must be provided.`);return e.sourceSheet}function Qt(e){return typeof e==`string`?e:e.name}function $t(e){return typeof e==`string`?void 0:e.metric}function en(e,t){let n=Zt(t);tn(t,n);let{rows:r}=t,i=t.columns??[],a=t.pages??[],o=t.values.map(Qt),s=t.metric??`sum`,c=t.values.map(e=>$t(e)??s),l=rn(n,[...r,...i,...a],o),u={};for(let e=0;e<l.length;e++)u[l[e].name]=e;let d=(e,t)=>{let n=u[e];if(n===void 0)throw Error(`${t} field "${e}" not found in cache fields`);return n},f=r.map(e=>d(e,`Row`)),p=i.map(e=>d(e,`Column`)),m=o.map(e=>d(e,`Value`)),h=a.map(e=>d(e,`Page`)),g=e.workbook.pivotTables.map(e=>e.tableNumber).filter(e=>Number.isFinite(e)),_=g.length>0?g.reduce((e,t)=>e>t?e:t,-1/0)+1:1,v=e.workbook.pivotTables.map(e=>parseInt(e.cacheId,10)).filter(e=>Number.isFinite(e)),y=v.length>0?v.reduce((e,t)=>e>t?e:t,-1/0)+1:10+_-1;return{source:n,rows:f,columns:p,values:m,pages:h,metric:s,valueMetrics:c,cacheFields:l,cacheId:String(y),applyWidthHeightFormats:t.applyWidthHeightFormats??`1`,tableNumber:_}}function tn(e,t){let n=e.columns??[],r=e.pages??[],i=e.values.map(Qt),a=t.getRow(1).values.slice(1);for(let e=0;e<a.length;e++){let n=a[e];if(n==null||n===``||typeof n==`string`&&n.trim()===``)throw Error(`Empty or missing header name at column ${e+1} in ${t.name}. Pivot tables require all columns to have non-empty headers.`)}let o=new Set;for(let e of a){let n=String(e);if(o.has(n))throw Error(`Duplicate header name "${n}" found in ${t.name}. Pivot tables require unique column names.`);o.add(n)}let s=new Set(a.map(String)),c=e=>{if(!s.has(e))throw new S(`The header name "${e}" was not found in ${t.name}.`)};for(let t of e.rows)c(t);for(let e of n)c(e);for(let e of i)c(e);for(let e of r)c(e);let l=new Map,u=[{name:`rows`,fields:e.rows},{name:`columns`,fields:n},{name:`pages`,fields:r}];for(let e of u)for(let t of e.fields){let n=l.get(t);if(n===e.name)throw Error(`Duplicate field "${t}" in ${e.name}. Each field can only appear once per axis area.`);if(n)throw Error(`Field "${t}" cannot appear in both ${n} and ${e.name}. Each field can only be assigned to one axis area.`);l.set(t,e.name)}if(!e.rows.length)throw new S(`No pivot table rows specified.`);if(e.values.length<1)throw new S(`Must have at least one value.`);if(e.metric!==void 0&&!Yt.has(e.metric))throw Error(`Invalid metric "${e.metric}". Must be one of: ${[...Yt].join(`, `)}.`);for(let t of e.values){let e=$t(t);if(e!==void 0&&!Yt.has(e))throw Error(`Invalid metric "${e}" on value field "${Qt(t)}". Must be one of: ${[...Yt].join(`, `)}.`)}let d=new Set;for(let e of i){if(d.has(e))throw Error(`Duplicate value field "${e}". Each value field name must be unique.`);d.add(e)}}function nn(e){if(e==null)return null;if(typeof e!=`object`||e instanceof Date||e instanceof qt)return e;let t=e;if(typeof t.error==`string`){let e=t.error;return new qt(e.startsWith(`#`)?e.slice(1):e)}if(`formula`in t||`sharedFormula`in t){let e=t.result;return e==null?null:nn(e)}return Array.isArray(t.richText)?t.richText.map(e=>e.text??``).join(``):typeof t.text==`string`&&typeof t.hyperlink==`string`?t.text:typeof t.checkbox==`boolean`?t.checkbox:String(e)}function rn(e,t,n){let r=e.getRow(1).values,i=new Set(t),a=new Set(n),o=t=>{let n=e.getColumn(t).values,r=new Set,i=new Map,a=!1;for(let e=2;e<n.length;e++){let t=nn(n[e]);t===null||typeof t==`number`&&isNaN(t)?a=!0:t instanceof qt?i.has(t.code)||(i.set(t.code,t),r.add(t)):r.add(t)}let o=Rt(r);return a&&o.push(null),o},s=t=>{let n=e.getColumn(t).values,r=1/0,i=-1/0,a=!1,o=!0;for(let e=2;e<n.length;e++){let t=nn(n[e]);typeof t==`number`&&!isNaN(t)&&(a=!0,t<r&&(r=t),t>i&&(i=t),Number.isInteger(t)||(o=!1))}return a?{minValue:r,maxValue:i,allInteger:o}:null},c=[];for(let e of Lt(1,r.length)){let t=r[e],n=String(t);if(i.has(n))c.push({name:n,sharedItems:o(e)});else if(a.has(n)){let t=s(e);c.push({name:n,sharedItems:null,containsNumber:t?`1`:void 0,minValue:t?.minValue,maxValue:t?.maxValue,containsInteger:t?.allInteger?`1`:void 0})}else c.push({name:n,sharedItems:null})}return c}function an(e,t,n,r,i){let a=i(e,t)?.style?.border,o=r-t+1,s=n-e+1,c=Array(o),l=Array(o),u=Array(s),d=Array(s),f=!1;for(let o=t;o<=r;o++){let r=o-t,s=i(e,o)?.style?.border;c[r]=s?.top||a?.top,n===e?l[r]=s?.bottom||a?.bottom:l[r]=i(n,o)?.style?.border?.bottom||a?.bottom,(c[r]||l[r])&&(f=!0)}for(let o=e;o<=n;o++){let n=o-e,s=i(o,t)?.style?.border;u[n]=s?.left||a?.left,r===t?d[n]=s?.right||a?.right:d[n]=i(o,r)?.style?.border?.right||a?.right,(u[n]||d[n])&&(f=!0)}let p=a?.diagonal,m=a?.color;if(!(!f&&!p))return{topEdges:c,bottomEdges:l,leftEdges:u,rightEdges:d,diagonal:p,color:m}}function on(e,t,n,r,i,a){let{topEdges:o,bottomEdges:s,leftEdges:c,rightEdges:l,diagonal:u,color:d}=i,f=a(e,t).style;for(let i=e;i<=n;i++)for(let p=t;p<=r;p++){let m=a(i,p),h=Ie(f)||{},g={},_=!1;i===e&&o[p-t]&&(g.top=o[p-t],_=!0),i===n&&s[p-t]&&(g.bottom=s[p-t],_=!0),p===t&&c[i-e]&&(g.left=c[i-e],_=!0),p===r&&l[i-e]&&(g.right=l[i-e],_=!0),u&&(g.diagonal=u,_=!0),_?(d&&(g.color=d),h.border=g):delete h.border,m.style=h}}function sn(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function cn(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 ln(e,t){let n=10**t;return Math.round(e*n)/n}function un(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function dn(e){return/^General$/i.test(e.trim())}function fn(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let pn=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],mn=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],hn=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],gn=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],_n=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function vn(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=St(e,!1),s=o.getUTCFullYear(),c=o.getUTCMonth(),l=o.getUTCDate(),u=o.getUTCDay(),d=e*86400-Math.floor(e*86400),f=/AM\/PM|A\/P/i.test(t),p=r>=12,m=r%12||12,h=t.replace(/\[(Red|Green|Blue|Yellow|Magenta|Cyan|White|Black|Color\d+)\]/gi,``);h=un(h);let g=h.match(/ss\.(0+)/i),_=``;if(g){let e=g[1].length;_=Math.round(d*10**e).toString().padStart(e,`0`),h=h.replace(/ss\.0+/gi,`\0SF\0`)}h=h.replace(/yyyy/gi,`\0Y4\0`),h=h.replace(/yy/gi,`\0Y2\0`),h=h.replace(/mmmmm/gi,`\0MN5\0`),h=h.replace(/mmmm/gi,`\0MN4\0`),h=h.replace(/mmm/gi,`\0MN3\0`),h=h.replace(/dddd/gi,`\0DN4\0`),h=h.replace(/ddd/gi,`\0DN3\0`),h=h.replace(/dd/gi,`\0D2\0`),h=h.replace(/\bd\b/gi,`\0D1\0`),h=h.replace(/hh/gi,`\0H2\0`),h=h.replace(/\bh\b/gi,`\0H1\0`),h=h.replace(/ss/gi,`\0S2\0`),h=h.replace(/\bs\b/gi,`\0S1\0`),h=/\x00H[12]\x00.*mm|mm.*\x00S[12]\x00/i.test(h)?h.replace(/mm/gi,`\0MI2\0`):h.replace(/mm/gi,`\0M2\0`),h=h.replace(/\bm\b/gi,`\0M1\0`),h=h.replace(/AM\/PM/gi,`\0AMPM\0`),h=h.replace(/A\/P/gi,`\0AP\0`);let v=f?m:r;return h=h.replace(/\x00Y4\x00/g,s.toString()).replace(/\x00Y2\x00/g,(s%100).toString().padStart(2,`0`)).replace(/\x00MN5\x00/g,hn[c]).replace(/\x00MN4\x00/g,mn[c]).replace(/\x00MN3\x00/g,pn[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,_n[u]).replace(/\x00DN3\x00/g,gn[u]).replace(/\x00D2\x00/g,l.toString().padStart(2,`0`)).replace(/\x00D1\x00/g,l.toString()).replace(/\x00H2\x00/g,v.toString().padStart(2,`0`)).replace(/\x00H1\x00/g,v.toString()).replace(/\x00MI2\x00/g,i.toString().padStart(2,`0`)).replace(/\x00S2\x00/g,a.toString().padStart(2,`0`)).replace(/\x00S1\x00/g,a.toString()).replace(/\x00SF\x00/g,a.toString().padStart(2,`0`)+`.`+_).replace(/\x00AMPM\x00/g,p?`PM`:`AM`).replace(/\x00AP\x00/g,p?`P`:`A`),h=h.replace(/\\/g,``),h}function yn(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 bn(e,t){let n=(t.match(/%/g)??[]).length;return Tn(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function xn(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=ln(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=sn(Math.abs(s),2);return n+c+`E`+l+u}function Sn(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 Cn(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]=Sn(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 wn(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 Tn(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=``]=ln(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=cn(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 En(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 Dn(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 On(e,t){if(typeof t==`string`){let n=jt(e);return n.length>=4&&n[3]?En(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=jt(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&&Dn(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 kn(e,t){let n=jt(e);return n.length>=2&&n[1]===t}function An(e,t){if(t==null)return``;if(dn(e))return yn(t);if(typeof t==`string`)return On(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=On(e,n);n<0&&kn(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=un(i),i=En(i),/\[[hms]+\]/i.test(i))return wn(n,i);if(fn(i))return vn(n,i);if(i.includes(`%`))return bn(n,i);if(/E[+-]?/i.test(i))return xn(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return Cn(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+Tn(-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=Tn(n,i);return a+l+o}function jn(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``),r=/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n);return/[yd]/i.test(n)||/m/i.test(n)&&!r?!1:r}function Mn(e){let t=e.replace(/"[^"]*"/g,``);if(/\[[hms]\]/i.test(t))return!1;let n=t.replace(/\[[^\]]*\]/g,``);return!!(/[yd]/i.test(n)||/m/i.test(n)&&!(/[hs]/i.test(n)||/AM\/PM|A\/P/i.test(n)))}function Nn(e,t,n){if(e instanceof Date){let r=xt(e);return jn(t)?(r%=1,r<0&&(r+=1),An(t,r)):An(n&&Mn(t)?n:t,r)}return An(t,e)}function Pn(e,t){let n=e.value,r=e.numFmt,i=typeof r==`string`?r:r?.formatCode??`General`;if(n==null)return``;if(n instanceof Date||typeof n==`number`||typeof n==`boolean`||typeof n==`string`)return Nn(n,i,t);if(typeof n==`object`&&`formula`in n){let e=n.result;if(e==null)return``;if(e instanceof Date||typeof e==`number`||typeof e==`boolean`||typeof e==`string`)return Nn(e,i,t)}return e.text}let Fn=new TextEncoder,In=new TextDecoder(`utf-8`,{ignoreBOM:!0}),Ln=new Map;function Rn(e){let t=(e??`utf-8`).trim().toLowerCase();return t===``||t===`utf8`||t===`utf-8`?`utf-8`:t===`utf16le`||t===`utf-16le`||t===`ucs2`||t===`ucs-2`?`utf-16le`:t===`binary`?`latin1`:t}function zn(e){let t=Rn(e);if(t===`utf-8`)return In;let n=Ln.get(t);return n||(n=Bn(t),Ln.set(t,n)),n}function Bn(e,t){try{return new TextDecoder(e,t)}catch(t){throw TypeError(`Unsupported text encoding: ${e}`,{cause:t})}}function Vn(e){let t=Rn(e);switch(t){case`hex`:return new Hn;case`base64`:return new Kn(!1);case`base64url`:return new Kn(!0);case`ascii`:return new qn;default:return Bn(t,{ignoreBOM:!0})}}var Hn=class{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=Un[e[n]];return t}};let Un=(()=>{let e=Array(256);for(let t=0;t<256;t++)e[t]=t.toString(16).padStart(2,`0`);return e})(),Wn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/`,Gn=`ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789-_`;var Kn=class{constructor(e){this._remainder=null,this._chars=e?Gn:Wn}decode(e,t){let n;if(this._remainder){let t=new Uint8Array(this._remainder.length+e.length);t.set(this._remainder),t.set(e,this._remainder.length),n=t}else n=e;if(t?.stream??!1){let e=n.length%3,t=n.length-e;return this._remainder=e>0?n.slice(t):null,t>0?this._encodeBytes(n,t):``}return this._remainder=null,n.length>0?this._encodeBytes(n,n.length):``}_encodeBytes(e,t){let n=this._chars,r=n===Gn,i=``,a=0;for(;a+2<t;a+=3){let t=e[a],r=e[a+1],o=e[a+2];i+=n[t>>>2]+n[(t&3)<<4|r>>>4]+n[(r&15)<<2|o>>>6]+n[o&63]}let o=t-a;if(o===1){let t=e[a];i+=n[t>>>2]+n[(t&3)<<4],r||(i+=`==`)}else if(o===2){let t=e[a],o=e[a+1];i+=n[t>>>2]+n[(t&3)<<4|o>>>4]+n[(o&15)<<2],r||(i+=`=`)}return i}},qn=class{decode(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]&127);return t}};function Jn(e){let t=``;for(let n=0;n<e.length;n++)t+=Un[e[n]];return t}function Yn(e,t){let n=t?Gn:Wn,r=``,i=0;for(;i+2<e.length;i+=3){let t=e[i],a=e[i+1],o=e[i+2];r+=n[t>>>2]+n[(t&3)<<4|a>>>4]+n[(a&15)<<2|o>>>6]+n[o&63]}let a=e.length-i;if(a===1){let a=e[i];r+=n[a>>>2]+n[(a&3)<<4],t||(r+=`==`)}else if(a===2){let a=e[i],o=e[i+1];r+=n[a>>>2]+n[(a&3)<<4|o>>>4]+n[(o&15)<<2],t||(r+=`=`)}return r}function Xn(e){let t=``;for(let n=0;n<e.length;n++)t+=String.fromCharCode(e[n]&127);return t}function Zn(e,t){let n=Rn(t);switch(n){case`hex`:return Jn(e);case`base64`:return Yn(e,!1);case`base64url`:return Yn(e,!0);case`ascii`:return Xn(e);default:return zn(n).decode(e)}}function Qn(e){return Fn.encode(e)}function $n(e,t){return zn(t).decode(e)}function j(e,t){let n=e.length;if(n===0)return new Uint8Array;if(n===1){let t=e[0];return t.constructor===Uint8Array?t:new Uint8Array(t.buffer,t.byteOffset,t.byteLength)}if(t===void 0){let r=0;for(let t=0;t<n;t++)r+=e[t].length;t=r}let r=new Uint8Array(t),i=0;for(let t=0;t<n;t++){let n=e[t];r.set(n,i),i+=n.length}return r}function er(e){if(e instanceof Uint8Array)return e;if(typeof e==`string`)return Fn.encode(e);if(e instanceof ArrayBuffer||Array.isArray(e))return new Uint8Array(e);throw TypeError(`Expected Uint8Array, got ${typeof e}`)}function tr(e){let t=globalThis.Buffer;return t?t.from(e.buffer,e.byteOffset,e.byteLength):e}function nr(e){let t=new Uint8Array(4);return t[0]=e&255,t[1]=e>>8&255,t[2]=e>>16&255,t[3]=e>>24&255,t}let rr={async hash(e,...t){let n=j(t),r=await crypto.subtle.digest(e,new Uint8Array(n));return new Uint8Array(r)},async convertPasswordToHash(e,t,n,r){let i=Kt(e),a=bt(n),o=await this.hash(t,a,i);for(let e=0;e<r;e++)o=await this.hash(t,o,nr(e));return Gt(o)},randomBytes(e){let t=new Uint8Array(e);return crypto.getRandomValues(t),t}};async function ir(e,t){let n={sheet:!0};return t&&`spinCount`in t&&(t.spinCount=Number.isFinite(t.spinCount)?Math.round(Math.max(0,t.spinCount)):1e5),e&&(n.algorithmName=`SHA-512`,n.saltValue=Gt(rr.randomBytes(16)),n.spinCount=t&&`spinCount`in t?t.spinCount:1e5,n.hashValue=await rr.convertPasswordToHash(e,`SHA-512`,n.saltValue,n.spinCount)),t&&(Object.assign(n,t),!e&&`spinCount`in t&&delete n.spinCount),n}let ar={32:3,33:5,34:6,35:7,36:7,37:11,38:10,39:3,40:5,41:5,42:7,43:7,44:4,45:5,46:4,47:6,48:7,49:7,50:7,51:7,52:7,53:7,54:7,55:7,56:7,57:7,58:4,59:4,60:7,61:7,62:7,63:7,64:13,65:9,66:8,67:8,68:9,69:7,70:7,71:9,72:9,73:4,74:5,75:8,76:6,77:12,78:10,79:10,80:8,81:10,82:8,83:7,84:7,85:9,86:9,87:13,88:8,89:7,90:7,91:5,92:6,93:5,94:7,95:7,96:4,97:7,98:8,99:6,100:8,101:8,102:5,103:7,104:8,105:4,106:4,107:7,108:4,109:12,110:8,111:8,112:8,113:8,114:5,115:6,116:5,117:8,118:7,119:11,120:7,121:7,122:6,123:5,124:7,125:5,126:7},or={header:{unitsPerEm:2048,usWinAscent:1950,usWinDescent:550,maxDigitAdvance:1038,sTypoAscender:1536,sTypoDescender:-512,sTypoLineGap:452},defaultAdvance:1e3,cjkAdvance:2048,advances:[[32,1,463],[33,1,667],[34,1,821],[35,1,1020],[36,1,1038],[37,1,1464],[38,1,1397],[39,1,452],[40,2,621],[42,2,1020],[44,1,511],[45,1,627],[46,1,517],[47,1,791],[48,10,1038],[58,2,548],[60,3,1020],[63,1,949],[64,1,1831],[65,1,1185],[66,1,1114],[67,1,1092],[68,1,1260],[69,1,1e3],[70,1,941],[71,1,1292],[72,1,1276],[73,1,516],[74,1,653],[75,1,1064],[76,1,861],[77,1,1751],[78,1,1322],[79,1,1356],[80,1,1058],[81,1,1378],[82,1,1112],[83,1,941],[84,1,998],[85,1,1314],[86,1,1162],[87,1,1822],[88,1,1063],[89,1,998],[90,1,959],[91,1,628],[92,1,791],[93,1,628],[94,2,1020],[96,1,596],[97,1,981],[98,1,1076],[99,1,866],[100,1,1076],[101,1,1019],[102,1,625],[103,1,964],[104,1,1076],[105,1,470],[106,1,490],[107,1,931],[108,1,470],[109,1,1636],[110,1,1076],[111,1,1080],[112,2,1076],[114,1,714],[115,1,801],[116,1,686],[117,1,1076],[118,1,925],[119,1,1464],[120,1,887],[121,1,927],[122,1,809],[123,1,644],[124,1,943],[125,1,644],[126,1,1020]]},sr={header:{unitsPerEm:2048,usWinAscent:1854,usWinDescent:434,maxDigitAdvance:1139,sTypoAscender:1491,sTypoDescender:-431,sTypoLineGap:307},defaultAdvance:1024,cjkAdvance:2048,advances:[[32,1,569],[33,1,569],[34,1,727],[35,1,1139],[36,1,1139],[37,1,1821],[38,1,1366],[39,1,391],[40,1,682],[41,1,682],[42,1,797],[43,1,1196],[44,1,569],[45,1,682],[46,1,569],[47,1,569],[48,10,1139],[58,1,569],[59,1,569],[60,1,1196],[61,1,1196],[62,1,1196],[63,1,1139],[64,1,2079],[65,1,1366],[66,1,1366],[67,1,1479],[68,1,1479],[69,1,1366],[70,1,1251],[71,1,1593],[72,1,1479],[73,1,569],[74,1,1024],[75,1,1366],[76,1,1139],[77,1,1706],[78,1,1479],[79,1,1593],[80,1,1366],[81,1,1593],[82,1,1479],[83,1,1366],[84,1,1251],[85,1,1479],[86,1,1366],[87,1,1933],[88,1,1366],[89,1,1366],[90,1,1251],[91,1,569],[92,1,569],[93,1,569],[94,1,961],[95,1,1139],[96,1,682],[97,1,1139],[98,1,1139],[99,1,1024],[100,1,1139],[101,1,1139],[102,1,569],[103,1,1139],[104,1,1139],[105,1,455],[106,1,455],[107,1,1024],[108,1,455],[109,1,1706],[110,1,1139],[111,1,1139],[112,1,1139],[113,1,1139],[114,1,682],[115,1,1024],[116,1,569],[117,1,1139],[118,1,1024],[119,1,1479],[120,1,1024],[121,1,1024],[122,1,1024],[123,1,684],[124,1,532],[125,1,684],[126,1,1196]]},cr={header:{unitsPerEm:2048,usWinAscent:1854,usWinDescent:434,maxDigitAdvance:1139,sTypoAscender:1491,sTypoDescender:-431,sTypoLineGap:307},defaultAdvance:1070,cjkAdvance:2048,advances:[[32,1,569],[33,1,682],[34,1,974],[35,1,1139],[36,1,1139],[37,1,1821],[38,1,1479],[39,1,569],[40,1,682],[41,1,682],[42,1,797],[43,1,1196],[44,1,569],[45,1,682],[46,1,569],[47,1,569],[48,10,1139],[58,1,682],[59,1,682],[60,1,1196],[61,1,1196],[62,1,1196],[63,1,1251],[64,1,1991],[65,1,1479],[66,1,1479],[67,1,1479],[68,1,1479],[69,1,1366],[70,1,1251],[71,1,1593],[72,1,1479],[73,1,682],[74,1,1139],[75,1,1479],[76,1,1251],[77,1,1706],[78,1,1479],[79,1,1593],[80,1,1366],[81,1,1593],[82,1,1479],[83,1,1366],[84,1,1251],[85,1,1479],[86,1,1366],[87,1,1933],[88,1,1366],[89,1,1366],[90,1,1251],[91,1,682],[92,1,569],[93,1,682],[94,1,1196],[95,1,1139],[96,1,682],[97,1,1139],[98,1,1251],[99,1,1024],[100,1,1251],[101,1,1139],[102,1,682],[103,1,1251],[104,1,1251],[105,1,569],[106,1,569],[107,1,1139],[108,1,569],[109,1,1821],[110,1,1251],[111,1,1251],[112,1,1251],[113,1,1251],[114,1,797],[115,1,1024],[116,1,682],[117,1,1251],[118,1,1139],[119,1,1593],[120,1,1139],[121,1,1139],[122,1,1024],[123,1,797],[124,1,569],[125,1,797],[126,1,1196]]},lr={header:{unitsPerEm:2048,usWinAscent:1825,usWinDescent:443,maxDigitAdvance:1024,sTypoAscender:1420,sTypoDescender:-442,sTypoLineGap:307},defaultAdvance:900,cjkAdvance:2048,advances:[[32,1,512],[33,1,682],[34,1,836],[35,1,1024],[36,1,1024],[37,1,1706],[38,1,1593],[39,1,369],[40,1,682],[41,1,682],[42,1,1024],[43,1,1155],[44,1,512],[45,1,682],[46,1,512],[47,1,569],[48,10,1024],[58,1,569],[59,1,569],[60,1,1155],[61,1,1155],[62,1,1155],[63,1,909],[64,1,1886],[65,1,1479],[66,1,1366],[67,1,1366],[68,1,1479],[69,1,1251],[70,1,1139],[71,1,1479],[72,1,1479],[73,1,682],[74,1,797],[75,1,1479],[76,1,1251],[77,1,1821],[78,1,1479],[79,1,1479],[80,1,1139],[81,1,1479],[82,1,1366],[83,1,1139],[84,1,1251],[85,1,1479],[86,1,1479],[87,1,1933],[88,1,1479],[89,1,1479],[90,1,1251],[91,1,682],[92,1,569],[93,1,682],[94,1,961],[95,1,1024],[96,1,682],[97,1,909],[98,1,1024],[99,1,909],[100,1,1024],[101,1,909],[102,1,682],[103,1,1024],[104,1,1024],[105,1,569],[106,1,569],[107,1,1024],[108,1,569],[109,1,1479],[110,1,1024],[111,1,1024],[112,1,1024],[113,1,1024],[114,1,682],[115,1,797],[116,1,569],[117,1,1024],[118,1,1024],[119,1,1479],[120,1,1024],[121,1,1024],[122,1,909],[123,1,983],[124,1,410],[125,1,983],[126,1,1073]]},ur={header:{unitsPerEm:2048,usWinAscent:1705,usWinDescent:615,maxDigitAdvance:1229,sTypoAscender:1255,sTypoDescender:-386,sTypoLineGap:0},defaultAdvance:1229,cjkAdvance:2048,advances:[[32,95,1229]]},dr={header:{unitsPerEm:2048,usWinAscent:2059,usWinDescent:430,maxDigitAdvance:1302,sTypoAscender:1566,sTypoDescender:-423,sTypoLineGap:202},defaultAdvance:1200,cjkAdvance:2048,advances:[[32,1,720],[33,1,756],[34,1,933],[35,1,1521],[36,1,1198],[37,1,1807],[38,1,1487],[39,1,510],[40,1,756],[41,1,756],[42,1,1198],[43,1,1521],[44,1,643],[45,1,811],[46,1,643],[47,1,899],[48,10,1302],[58,1,756],[59,1,756],[60,1,1521],[61,1,1521],[62,1,1521],[63,1,1151],[64,1,1937],[65,1,1362],[66,1,1382],[67,1,1279],[68,1,1490],[69,1,1279],[70,1,1186],[71,1,1458],[72,1,1498],[73,1,924],[74,1,922],[75,1,1362],[76,1,1145],[77,1,1728],[78,1,1498],[79,1,1476],[80,1,1262],[81,1,1476],[82,1,1396],[83,1,1300],[84,1,1185],[85,1,1448],[86,1,1362],[87,1,1864],[88,1,1244],[89,1,1183],[90,1,1204],[91,1,756],[92,1,899],[93,1,756],[94,1,1521],[95,1,1198],[96,1,1198],[97,1,1224],[98,1,1302],[99,1,1075],[100,1,1302],[101,1,1218],[102,1,756],[103,1,1302],[104,1,1317],[105,1,643],[106,1,700],[107,1,1183],[108,1,643],[109,1,1937],[110,1,1317],[111,1,1271],[112,1,1302],[113,1,1302],[114,1,899],[115,1,1075],[116,1,811],[117,1,1317],[118,1,1183],[119,1,1728],[120,1,1183],[121,1,1183],[122,1,1031],[123,1,787],[124,1,756],[125,1,787],[126,1,1521]]},fr={header:{unitsPerEm:2048,usWinAscent:1878,usWinDescent:449,maxDigitAdvance:1257,sTypoAscender:1549,sTypoDescender:-444,sTypoLineGap:198},defaultAdvance:1100,cjkAdvance:2048,advances:[[32,1,504],[33,1,614],[34,1,679],[35,1,1257],[36,1,1024],[37,1,1539],[38,1,1350],[39,1,391],[40,1,614],[41,1,614],[42,1,842],[43,1,1257],[44,1,504],[45,1,751],[46,1,504],[47,1,797],[48,10,1257],[58,1,569],[59,1,569],[60,1,1257],[61,1,1257],[62,1,1257],[63,1,885],[64,1,1614],[65,1,1350],[66,1,1273],[67,1,1161],[68,1,1427],[69,1,1163],[70,1,1074],[71,1,1314],[72,1,1517],[73,1,721],[74,1,772],[75,1,1397],[76,1,1176],[77,1,1770],[78,1,1462],[79,1,1392],[80,1,1118],[81,1,1392],[82,1,1321],[83,1,1019],[84,1,1163],[85,1,1456],[86,1,1321],[87,1,1887],[88,1,1314],[89,1,1220],[90,1,1055],[91,1,614],[92,1,797],[93,1,614],[94,1,1257],[95,1,1024],[96,1,682],[97,1,1019],[98,1,1100],[99,1,866],[100,1,1106],[101,1,958],[102,1,654],[103,1,1006],[104,1,1152],[105,1,606],[106,1,606],[107,1,1048],[108,1,606],[109,1,1700],[110,1,1131],[111,1,1042],[112,1,1100],[113,1,1100],[114,1,772],[115,1,820],[116,1,688],[117,1,1117],[118,1,1019],[119,1,1559],[120,1,1007],[121,1,1012],[122,1,880],[123,1,637],[124,1,583],[125,1,637],[126,1,1257]]},pr={header:{unitsPerEm:2048,usWinAscent:2049,usWinDescent:423,maxDigitAdvance:1118,sTypoAscender:1566,sTypoDescender:-423,sTypoLineGap:59},defaultAdvance:1050,cjkAdvance:2048,advances:[[32,1,461],[33,1,536],[34,1,717],[35,1,1232],[36,1,1014],[37,1,1625],[38,1,1327],[39,1,428],[40,1,616],[41,1,616],[42,1,900],[43,1,1232],[44,1,504],[45,1,700],[46,1,504],[47,1,753],[48,10,1118],[58,1,567],[59,1,567],[60,1,1232],[61,1,1232],[62,1,1232],[63,1,974],[64,1,1810],[65,1,1205],[66,1,1200],[67,1,1130],[68,1,1327],[69,1,1117],[70,1,1032],[71,1,1306],[72,1,1308],[73,1,614],[74,1,794],[75,1,1195],[76,1,1003],[77,1,1500],[78,1,1308],[79,1,1381],[80,1,1103],[81,1,1381],[82,1,1200],[83,1,1117],[84,1,1100],[85,1,1300],[86,1,1205],[87,1,1723],[88,1,1119],[89,1,1130],[90,1,1068],[91,1,616],[92,1,753],[93,1,616],[94,1,1232],[95,1,893],[96,1,1118],[97,1,1066],[98,1,1141],[99,1,942],[100,1,1141],[101,1,1086],[102,1,639],[103,1,1141],[104,1,1126],[105,1,500],[106,1,548],[107,1,1023],[108,1,500],[109,1,1705],[110,1,1126],[111,1,1103],[112,1,1141],[113,1,1141],[114,1,714],[115,1,918],[116,1,700],[117,1,1126],[118,1,1e3],[119,1,1500],[120,1,1e3],[121,1,1e3],[122,1,880],[123,1,616],[124,1,540],[125,1,616],[126,1,1232]]},mr={header:{unitsPerEm:2048,usWinAscent:1923,usWinDescent:455,maxDigitAdvance:1074,sTypoAscender:1510,sTypoDescender:-420,sTypoLineGap:0},defaultAdvance:1e3,cjkAdvance:2048,advances:[[32,1,453],[33,1,545],[34,1,613],[35,1,1107],[36,1,1074],[37,1,1341],[38,1,1213],[39,1,360],[40,1,616],[41,1,616],[42,1,860],[43,1,1107],[44,1,453],[45,1,697],[46,1,453],[47,1,766],[48,10,1074],[58,1,453],[59,1,453],[60,1,1107],[61,1,1107],[62,1,1107],[63,1,860],[64,1,1648],[65,1,1227],[66,1,1227],[67,1,1139],[68,1,1309],[69,1,1139],[70,1,1057],[71,1,1309],[72,1,1395],[73,1,627],[74,1,791],[75,1,1260],[76,1,1057],[77,1,1456],[78,1,1350],[79,1,1395],[80,1,1139],[81,1,1395],[82,1,1215],[83,1,1057],[84,1,1139],[85,1,1350],[86,1,1227],[87,1,1730],[88,1,1260],[89,1,1139],[90,1,1139],[91,1,616],[92,1,766],[93,1,616],[94,1,1107],[95,1,1074],[96,1,860],[97,1,1013],[98,1,1074],[99,1,936],[100,1,1074],[101,1,1013],[102,1,627],[103,1,1074],[104,1,1074],[105,1,545],[106,1,538],[107,1,1013],[108,1,545],[109,1,1539],[110,1,1074],[111,1,1074],[112,1,1074],[113,1,1074],[114,1,715],[115,1,860],[116,1,627],[117,1,1074],[118,1,936],[119,1,1481],[120,1,936],[121,1,936],[122,1,860],[123,1,616],[124,1,604],[125,1,616],[126,1,1107]]},hr={},gr={};function _r(e,t,n){hr[e.toLowerCase()]=t,n&&(gr[e.toLowerCase()]=n)}_r(`calibri`,or),_r(`arial`,sr,cr),_r(`times new roman`,lr),_r(`courier new`,ur),_r(`verdana`,dr),_r(`georgia`,fr),_r(`tahoma`,pr),_r(`trebuchet ms`,mr);let vr={aptos:[1.03,1.37,1],"aptos display":[.96,1.31,1],"aptos narrow":[.82,1.07,1],"aptos serif":[.98,1.31,1],"calibri light":[.98,1.19,1],cambria:[1.07,1.28,1],"century gothic":[1.19,1.36,1],"comic sans ms":[1.14,1.46,1],consolas:[1.21,1.21,1],constantia:[1.05,1.34,1],corbel:[.97,1.2,1],garamond:[1.16,1.39,1],impact:[.96,1.01,1],"lucida console":[1.21,1.21,1],"lucida sans unicode":[1.16,1.4,1],"microsoft sans serif":[1.07,1.35,1],"palatino linotype":[1.12,1.44,1],"segoe ui":[1.08,1.31,1],"book antiqua":[1.12,1.44,1],candara:[1.02,1.25,1],"franklin gothic medium":[1.08,1.33,1],"goudy old style":[1.02,1.34,1],rockwell:[1.14,1.35,1],"tw cen mt":[.95,1.17,1],"microsoft yahei":[1.18,1.3,1.18],"microsoft yahei ui":[1.18,1.3,1.18],simsun:[1.1,1.1,1.1],宋体:[1.1,1.1,1.1],simhei:[1.1,1.1,1.1],黑体:[1.1,1.1,1.1],nsimsun:[1.1,1.1,1.1],新宋体:[1.1,1.1,1.1],dengxian:[1.05,1.28,1.08],等线:[1.05,1.28,1.08],fangsong:[1.1,1.1,1.1],仿宋:[1.1,1.1,1.1],kaiti:[1.1,1.1,1.1],楷体:[1.1,1.1,1.1],meiryo:[1.18,1.3,1.18],"meiryo ui":[1.1,1.2,1.18],"ms gothic":[1.21,1.21,1.1],"MS ゴシック":[1.21,1.21,1.1],"ms pgothic":[1.07,1.33,1.1],"ms mincho":[1.21,1.21,1.1],"yu gothic":[1.17,1.32,1.18],"yu gothic ui":[1.08,1.22,1.18],"yu mincho":[1.1,1.28,1.18],"malgun gothic":[1.12,1.28,1.14],"맑은 고딕":[1.12,1.28,1.14],batang:[1.1,1.1,1.1],gulim:[1.1,1.1,1.1],dotum:[1.1,1.1,1.1]},yr=new Map;function br(e){let t=yr.get(e);if(t)return t;t=new Map;for(let[n,r,i]of e.advances)for(let e=0;e<r;e++)t.set(n+e,i);return yr.set(e,t),t}function xr(e,t){let n=e.toLowerCase();return t?gr[n]??hr[n]:hr[n]}function Sr(e){return Object.hasOwn(gr,e.toLowerCase())}function Cr(){return or}function wr(e,t){return t>=19968&&t<=40959||t>=13312&&t<=19903||t>=63744&&t<=64255||t>=131072&&t<=205743||t>=12288&&t<=12543||t>=44032&&t<=55215||t>=65281&&t<=65376||t>=11904&&t<=12255||t>=12544&&t<=13311?e.cjkAdvance:br(e).get(t)??e.defaultAdvance}function Tr(e){return ar[e]}function Er(e){return vr[e.toLowerCase()]}function Dr(e){return e>=19968&&e<=40959||e>=13312&&e<=19903||e>=63744&&e<=64255||e>=65281&&e<=65376||e>=12288&&e<=12543||e>=11904&&e<=12255||e>=12544&&e<=13311||e>=44032&&e<=55215||e>=131072&&e<=205743}let Or=`Calibri`,kr=1790;function Ar(e,t,n,r,i){if(t===`calibri`&&n===11){let t=Tr(e);if(t!==void 0)return t}if(i){let t=wr(i,e),r=Math.round(n/72*96);return Math.round(t/i.header.unitsPerEm*r)}}function jr(e){return{name:(e?.name??Or).toLowerCase(),size:e?.size??11,bold:e?.bold??!1,italic:e?.italic??!1,vertAlign:e?.vertAlign}}function Mr(e,t){if(!e)return 0;let n=jr(t),r=xr(n.name,n.bold),i=e.split(/\r\n|\r|\n/),a=0;for(let e of i){let t=Nr(e,n,r);t>a&&(a=t)}return a}function Nr(e,t,n){return e?n||t.name===`calibri`&&t.size===11?Pr(e,t,n):Fr(e,t):0}function Pr(e,t,n){let r=0;for(let i of e)r+=Gr(i.codePointAt(0),t,n);return t.vertAlign&&(r=Math.ceil(r*.6)),r}function Fr(e,t){let n=Er(t.name),r=n?.[0]??1,i=n?.[1]??1.3,a=n?.[2]??1,o=0,s=0,c=0;for(let t of e)Dr(t.codePointAt(0))?c+=2:t>=`A`&&t<=`Z`?s++:o++;let l=(o*r+s*i+c*a)*(t.size/11);t.bold&&(l*=1.05),t.italic&&(l*=1.02),t.vertAlign&&(l*=.6);let u=Lr({name:t.name,size:t.size});return Math.ceil(l*u)}function Ir(e,t){let n=0,r=0;for(let i of e){let e=i.font?{...t,...i.font}:t,a=i.text.split(/\r\n|\r|\n/);for(let t=0;t<a.length;t++)t>0&&(r>n&&(n=r),r=0),a[t]&&(r+=Mr(a[t],e))}return r>n&&(n=r),n}function Lr(e){let t=(e?.name??Or).toLowerCase(),n=e?.size??11;if(t===`calibri`&&n===11)return 7;let r=xr(t);if(r){let e=Math.round(n/72*96);return Math.round(r.header.maxDigitAdvance/r.header.unitsPerEm*e)}return Math.max(1,Math.round(n/11*7))}function Rr(e){return 2*Math.ceil(e/4)+1}function zr(e,t){return t<=0?0:Math.trunc(e/t*256)/256}function Br(e,t){if(t<=0)return 0;let n=Rr(t);return e===0?0:e<1?Math.round(e*(t+n)):Math.round(e*t)+n}function Vr(e){return e*72/96}function Hr(e,t,n){if(e<=0)return 0;let r=e+2*Math.ceil(e*.03+t/4)+1;n&&(r+=16),r>kr&&(r=kr);let i=zr(r,t);return Math.min(i,255)}function Ur(e){let t=(e?.name??Or).toLowerCase(),n=e?.size??11,r=Math.round(n/72*96),i=xr(t);if(i){let{unitsPerEm:e,usWinDescent:t}=i.header;return(e+t)/e*r}return r*1.3}function Wr(e,t,n){if(!e||t<=0)return 1;let r=jr(n),i=xr(r.name,r.bold),a=e.split(/\r\n|\r|\n/),o=0;for(let e of a){if(!e){o++;continue}o+=Kr(e,t,r,i)}return o}function Gr(e,t,n){let r;if(n||t.name===`calibri`&&t.size===11){let i=n??Cr();r=Ar(e,t.name,t.size,t.bold,i)??Math.round(i.defaultAdvance/i.header.unitsPerEm*Math.round(t.size/72*96))}else r=Math.ceil(t.size/11*Lr({name:t.name,size:t.size})*(Dr(e)?2:1));return t.bold&&!Sr(t.name)&&(r=Math.ceil(r*1.05)),t.italic&&(r=Math.ceil(r*1.02)),r}function Kr(e,t,n,r){let i=qr(e);if(i.length===0)return 1;let a=1,o=0;for(let e of i){let i=0;for(let t of e)i+=Gr(t.codePointAt(0),n,r);o===0?o=i:o+i>t?(a++,o=i):o+=i}return a}function qr(e){let t=[],n=``;for(let r of e)n+=r,(r===` `||r===`-`||r===` `)&&(t.push(n),n=``);return n&&t.push(n),t}function Jr(e,t,n,r){if(!e)return Vr(Ur(t));let i=Ur(t),a;return a=n?.wrapText&&r&&r>0?Wr(e,r,t):e.split(/\r\n|\r|\n/).length,Vr(i*a)}function Yr(e,t,n,r){let i=t?.size??11,a=t;for(let n of e){let e=n.font?.size??t?.size??11;e>i&&(i=e,a=n.font?{...t,...n.font}:t)}return Jr(e.map(e=>e.text).join(``),a,n,r)}function Xr(e,t){let n=Br(e,t),r=Rr(t);return Math.max(0,n-r)}function Zr(e){let t=e.effectiveType,n=e.font;if(t===E.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t)return Ir(t.richText,n)}let r=Pn(e);return r?Mr(r,n):0}function Qr(e,t,n){let r=e.font,i=e.alignment;if(e.effectiveType===E.RichText){let t=e.value;if(t&&typeof t==`object`&&`richText`in t)return Yr(t.richText,r,i,n)}let a=Pn(e);return a?Jr(a,r,i,i?.wrapText?n:void 0):0}function $r(e){return w.l2n(e.toUpperCase())-1}function ei(e){return w.n2l(e+1)}function ti(e){return parseInt(e,10)-1}function ni(e){return String(e+1)}function ri(e){let t=w.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function ii(e){return w.encodeAddress(e.r+1,e.c+1)}function ai(e){let t=e.indexOf(`:`);if(t===-1){let t=ri(e);return{s:t,e:{...t}}}return{s:ri(e.slice(0,t)),e:ri(e.slice(t+1))}}function oi(e,t){if(t===void 0){let t=e;return oi(t.s,t.e)}let n=ii(e),r=ii(t);return n===r?n:`${n}:${r}`}var si=class{constructor(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=[],this._keys={},this._merges={},this.rowBreaks=[],this.colBreaks=[],this.properties={defaultRowHeight:15,outlineLevelCol:0,outlineLevelRow:0,...e.properties},this.pageSetup={margins:{left:.7,right:.7,top:.75,bottom:.75,header:.3,footer:.3},orientation:`portrait`,horizontalDpi:void 0,verticalDpi:void 0,fitToPage:!!(e.pageSetup&&(e.pageSetup.fitToWidth||e.pageSetup.fitToHeight)&&!e.pageSetup.scale),pageOrder:`downThenOver`,blackAndWhite:!1,draft:!1,cellComments:`None`,errors:`displayed`,scale:100,fitToWidth:1,fitToHeight:1,paperSize:void 0,showRowColHeaders:!1,showGridLines:!1,firstPageNumber:void 0,horizontalCentered:!1,verticalCentered:!1,rowBreaks:null,colBreaks:null,...e.pageSetup},this.headerFooter={differentFirst:!1,differentOddEven:!1,oddHeader:null,oddFooter:null,evenHeader:null,evenFooter:null,firstHeader:null,firstFooter:null,...e.headerFooter},this.dataValidations=new Qe,this.views=e.views??[],this.autoFilter=e.autoFilter??null,this._media=[],this.sheetProtection=null,this.tables={},this.pivotTables=[],this.conditionalFormattings=[],this.formControls=[]}get name(){return this._name}set name(e){if(e===void 0&&(e=`sheet${this.id}`),this._name===e)return;if(typeof e!=`string`)throw new d(`The name has to be a string.`);if(e===``)throw new d(`The name can't be empty.`);if(e===`History`)throw new d(`The name "History" is protected. Please use a different name.`);if(/[*?:/\\[\]]/.test(e))throw new d(`Worksheet name ${e} cannot include any of the following characters: * ? : \\ / [ ]`);if(/(^')|('$)/.test(e))throw new d(`The first or last character of worksheet name cannot be a single quotation mark: ${e}`);e.length>31&&(e=e.substring(0,31));let t=e.toLowerCase();if(this._workbook.worksheets.find(e=>e&&e!==this&&e.name.toLowerCase()===t))throw new d(`Worksheet name already exists: ${e}`);this._name=e}get workbook(){return this._workbook}destroy(){this._workbook.removeWorksheetEx(this)}get dimensions(){let e=new T;return this._rows.forEach(t=>{if(t){let n=t.dimensions;n&&e.expand(t.number,n.min,t.number,n.max)}}),e}get columns(){return this._columns}set columns(e){this._headerRowCount=e.reduce((e,t)=>{let n=Array.isArray(t.header)?t.header.length:+!!t.header;return Math.max(e,n)},0);let t=1,n=this._columns=[];e.forEach(e=>{let r=new Re(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=w.l2n(e)}else t=e;if(t>this._columns.length){let e=this._columns.length+1;for(;e<=t;)this._columns.push(new Re(this,e++))}return this._columns[t-1]}spliceColumns(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===D.ValueType.Merge&&e.unmerge()}let r=this._rows.length;if(n.length>0)for(let i=0;i<r;i++){let r=n.map(e=>e[i]??null);this.getRow(i+1).splice(e,t,...r)}else this._rows.forEach(n=>{n&&n.splice(e,t)});let i=n.length-t,a=e+t,o=this._columns.length;if(i<0)for(let t=e+n.length;t<=o;t++)this.getColumn(t).defn=this.getColumn(t-i).defn;else if(i>0)for(let e=o;e>=a;e--)this.getColumn(e+i).defn=this.getColumn(e).defn;for(let t=e;t<e+n.length;t++)this.getColumn(t).defn=void 0;if(this.workbook.definedNames.spliceColumns(this.name,e,t,n.length),i!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeCol>=e-1&&(n.nativeCol=Math.max(0,n.nativeCol+i)),r&&r.nativeCol>=e-1&&(r.nativeCol=Math.max(0,r.nativeCol+i))}}this._spliceMerges(`col`,e,t,n.length)}get lastColumn(){return this.getColumn(this.columnCount)}get columnCount(){let e=0;return this.eachRow(t=>{e=Math.max(e,t.cellCount)}),e}get actualColumnCount(){let e=[],t=0;return this.eachRow(n=>{n.eachCell(({col:n})=>{e[n]||(e[n]=!0,t++)})}),t}_commitRow(e){}get _lastRowNumber(){let e=this._rows,t=e.length;for(;t>0&&e[t-1]===void 0;)t--;return t}get _nextRow(){return this._lastRowNumber+1}get lastRow(){if(this._rows.length)return this._rows[this._rows.length-1]}findRow(e){return this._rows[e-1]}findRows(e,t){return this._rows.slice(e-1,e-1+t)}get rowCount(){return this._lastRowNumber}get actualRowCount(){let e=0;return this.eachRow(()=>{e++}),e}getRow(e){let t=this._rows[e-1];return t||=this._rows[e-1]=new Le(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=Ie(r.style)??{},r.eachCell({includeEmpty:n},(e,t)=>{i.getCell(t).style=Ie(e.style)??{}}),i.height=r.height}duplicateRow(e,t,n=!1){let r=this.getRow(e),i=Array.from({length:t}).fill(r.values),a=[];for(let t of Object.values(this._merges))t.top===e&&t.bottom===e&&a.push(t);let o=[],s=e-1;for(let e of this._media)e.type===`image`&&e.range&&e.range.tl.nativeRow===s&&o.push(e);this.spliceRows(e+1,n?0:t,...i);for(let n=0;n<t;n++){let t=this._rows[e+n];t.style=Ie(r.style)??{},t.height=r.height,r.eachCell({includeEmpty:!0},(e,n)=>{t.getCell(n).style=Ie(e.style)??{}})}if(a.length>0)for(let r=0;r<t;r++){let t=e+1+r;if(!n){let e=[];for(let[n,r]of Object.entries(this._merges))r.top<=t&&r.bottom>=t&&e.push(n);for(let t of e)this._unMergeMaster(this.getCell(t))}for(let e of a)this.mergeCellsWithoutStyle(t,e.left,t,e.right)}if(!n){let n=e,r=e+t-1;this._media=this._media.filter(e=>{if(e.type===`image`&&e.range){let t=e.range.tl.nativeRow;return t<n||t>r}return!0})}for(let e=0;e<t;e++){let t=e+1;for(let e of o){let n=e.clone();if(n.range.tl.nativeRow=s+t,n.range.br){let r=e.range.br.nativeRow-s;n.range.br.nativeRow=s+t+r}this._media.push(n)}}}spliceRows(e,t,...n){for(let e of Object.values(this._merges))for(let t=e.top;t<=e.bottom;t++)for(let n=e.left;n<=e.right;n++){let e=this.findCell(t,n);e&&e.type===D.ValueType.Merge&&e.unmerge()}let r=e+t,i=n.length,a=i-t,o=this._rows.length,s,c;if(a<0)for(e===o&&(this._rows[o-1]=void 0),s=r;s<=o;s++)if(c=this._rows[s-1],c){let e=this.getRow(s+a);e.values=c.values,e.style=Ie(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=Ie(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=Ie(c.style)??{},e.height=c.height,c.eachCell({includeEmpty:!0},(t,n)=>{e.getCell(n).style=Ie(t.style)??{}})}else this._rows[s+a-1]=void 0;for(s=0;s<i;s++){let t=this.getRow(e+s);t.style={},t.values=n[s]}if(this.workbook.definedNames.spliceRows(this.name,e,t,i),a!==0){for(let t of this._media)if(t.type===`image`&&t.range){let{tl:n,br:r}=t.range;n&&n.nativeRow>=e-1&&(n.nativeRow=Math.max(0,n.nativeRow+a)),r&&r.nativeRow>=e-1&&(r.nativeRow=Math.max(0,r.nativeRow+a))}}this._spliceMerges(`row`,e,t,i)}eachRow(e,t){let n,r;if(typeof e==`function`?r=e:(n=e,r=t),n&&n.includeEmpty){let e=this._rows.length;for(let t=1;t<=e;t++)r(this.getRow(t),t)}else this._rows.forEach(e=>{e&&e.hasValues&&r(e,e.number)})}getSheetValues(){let e=[];return this._rows.forEach(t=>{t&&(e[t.number]=t.values)}),e}findCell(e,t){let n=w.getAddress(e,t),r=this._rows[n.row-1];return r?r.findCell(n.col):void 0}getCell(e,t){let n=w.getAddress(e,t);return this.getRow(n.row).getCellEx(n)}mergeCells(...e){let t=new T(e);this._mergeCellsInternal(t)}mergeCellsWithoutStyle(...e){let t=new T(e);this._mergeCellsInternal(t,!0)}_mergeCellsInternal(e,t){Object.values(this._merges).forEach(t=>{if(t.intersects(e))throw new h});let{top:n,left:r,bottom:i,right:a}=e,o=t?void 0:an(n,r,i,a,(e,t)=>this.findCell(e,t)),s=this.getCell(e.top,e.left);for(let e=n;e<=i;e++)for(let i=r;i<=a;i++)(e>n||i>r)&&this.getCell(e,i).merge(s,t);o&&on(n,r,i,a,o,(e,t)=>this.getCell(e,t)),this._merges[s.address]=e}_unMergeMaster(e){let t=this._merges[e.address];if(t){for(let e=t.top;e<=t.bottom;e++)for(let n=t.left;n<=t.right;n++)this.getCell(e,n).unmerge();delete this._merges[e.address]}}_spliceMerges(e,t,n,r){let i=r-n;if(i===0&&n===0)return;let a=t+n,o=e===`row`,s={};for(let e of Object.values(this._merges)){let{top:r,left:c,bottom:l,right:u}=e.model,d=o?r:c,f=o?l:u;if(i<=0&&n>0){let n=a-1;if(d>n){let e=o?new T(r+i,c,l+i,u):new T(r,c+i,l,u+i);s[w.encodeAddress(e.top,e.left)]=e}else if(f<t)s[w.encodeAddress(r,c)]=e;else if(!(d>=t&&f<=n)){let e=r,n=c,a=l,d=u;o?(e=r<t?r:t,a=Math.max(e,l+i)):(n=c<t?c:t,d=Math.max(n,u+i));let f=new T(e,n,a,d);e===a&&n===d||(s[w.encodeAddress(f.top,f.left)]=f)}}else if(d>=a){let e=o?new T(r+i,c,l+i,u):new T(r,c+i,l,u+i);s[w.encodeAddress(e.top,e.left)]=e}else f<a||(o?e.model.bottom=l+i:e.model.right=u+i),s[w.encodeAddress(r,c)]=e}this._merges=s;for(let e of Object.values(s)){let t=this.getCell(e.top,e.left);for(let n=e.top;n<=e.bottom;n++)for(let r=e.left;r<=e.right;r++)(n>e.top||r>e.left)&&this.getCell(n,r).merge(t,!0)}}get hasMerges(){return Object.values(this._merges).some(Boolean)}unMergeCells(...e){let t=new T(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===D.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}=w.decode(e),c=s-a+1,l=w.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++)if(f){let a=this.getCell(n,i);a.value={shareType:r,formula:t,ref:e,result:d(n,i)},f=!1}else 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 He(this,n))}getImages(){return this._media.filter(e=>e.type===`image`)}addBackgroundImage(e){let t={type:`background`,imageId:String(e)};this._media.push(new He(this,t))}getBackgroundImageId(){let e=this._media.find(e=>e.type===`background`);return e&&e.imageId}addFormCheckbox(e,t){let n=new at(this,e,t);return this.formControls.push(n),n}getFormCheckboxes(){return this.formControls}async protect(e,t){this.sheetProtection=await ir(e,t)}unprotect(){this.sheetProtection=null}addTable(e){let t=new Ze(this,e);return this.tables[t.name]=t,t}getTable(e){return this.tables[e]}removeTable(e){delete this.tables[e]}getTables(){return Object.values(this.tables)}addPivotTable(e){let t=en(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=[]}autoFitColumn(e){let t=typeof e==`string`?w.l2n(e):e;return this._autoFitColumnImpl(t),this}autoFitColumns(e,t){let n=this.dimensions;if(!n||n.left===void 0)return this;let r=e==null?n.left:typeof e==`string`?w.l2n(e):e,i=t==null?n.right:typeof t==`string`?w.l2n(t):t;for(let e=r;e<=i;e++)this._autoFitColumnImpl(e);return this}autoFitRow(e){return this._autoFitRowImpl(e),this}autoFitRows(e,t){let n=this.dimensions;if(!n||n.top===void 0)return this;let r=e??n.top,i=t??n.bottom;for(let e=r;e<=i;e++)this._autoFitRowImpl(e);return this}_autoFitColumnImpl(e){let t=Lr(),n=this._isColumnInAutoFilter(e),r=0;if(this._rows.forEach(n=>{if(!n||n.hidden)return;let i=n.findCell(e);if(!i||i.type===D.ValueType.Merge)return;if(i.isMerged){let e=this._merges[i.address];if(e&&e.left!==e.right)return}if(i.alignment?.shrinkToFit)return;let a=Zr(i),o=i.alignment?.indent;o&&o>0&&(a+=o*3*t),a>r&&(r=a)}),r>0){let i=Hr(r,t,n);if(i>0){let t=this.getColumn(e);t.width=i,t.bestFit=!0}}}_autoFitRowImpl(e){let t=this._rows[e-1];if(!t)return;let n=Lr(),r=0;t.eachCell(e=>{if(e.type===D.ValueType.Merge)return;if(e.isMerged){let t=this._merges[e.address];if(t&&t.top!==t.bottom)return}if(this._columns[e.col-1]?.hidden)return;let t=Qr(e,n,this._getColumnContentWidthForCell(e,n));t>r&&(r=t)}),r>0&&(t.height=Math.ceil(r*4)/4,t.customHeight=!0)}_getColumnContentWidthForCell(e,t){if(e.alignment?.wrapText)return Xr(this._columns[e.col-1]?.width??this.properties.defaultColWidth??9,t)}_isColumnInAutoFilter(e){if(!this.autoFilter)return!1;if(typeof this.autoFilter==`string`){let t=w.decode(this.autoFilter);return e>=t.left&&e<=t.right}let{from:t,to:n}=this.autoFilter,r=typeof t==`string`?w.decode(t).col:t.col,i=typeof n==`string`?w.decode(n).col:n.col;return e>=r&&e<=i}get model(){let e={id:this.id,name:this.name,dataValidations:this.dataValidations.model,properties:this.properties,state:this.state,pageSetup:this.pageSetup,headerFooter:this.headerFooter,rowBreaks:this.rowBreaks,colBreaks:this.colBreaks,views:this.views,autoFilter:this.autoFilter,media:this._media.map(e=>e.model),sheetProtection:this.sheetProtection,tables:Object.values(this.tables).map(e=>e.model),pivotTables:this.pivotTables,conditionalFormattings:this.conditionalFormattings,formControls:this.formControls.map(e=>e.model),drawing:this._drawing};e.cols=Re.toModel(this.columns);let t=e.rows=[],n=e.dimensions=new T;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.mergeCells=Object.values(this._merges).map(e=>e.range),e}_parseRows(e){this._rows=[],e.rows&&e.rows.forEach(e=>{let t=new Le(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.state=e.state,this._columns=Re.fromModel(this,e.cols??[]),this._parseRows(e),this._parseMergeCells(e),this.dataValidations=new Qe(e.dataValidations),this.properties=e.properties,this.pageSetup=e.pageSetup,this.headerFooter=e.headerFooter,this.rowBreaks=e.rowBreaks??[],this.colBreaks=e.colBreaks??[],this.views=e.views,this.autoFilter=e.autoFilter,this._media=e.media.map(e=>new He(this,e)),this.sheetProtection=e.sheetProtection,this.tables=e.tables.reduce((e,t)=>{let n=new Ze(this,t);return n.model=t,e[t.name]=n,e},{}),this.pivotTables=e.pivotTables,this.conditionalFormattings=e.conditionalFormattings,this.formControls=[],this._drawing=e.drawing}toJSON(e){let t=e||{},n=1,r=this.rowCount,i=1,a=this.columnCount;if(t.range!==void 0){if(typeof t.range==`number`)n=t.range+1;else if(typeof t.range==`string`){let e=ai(t.range);n=e.s.r+1,r=e.e.r+1,i=e.s.c+1,a=e.e.c+1}}if(r<n||a<i)return[];let o=t.header;if(o===1){let e=[],o=t.blankRows!==!1;for(let s=n;s<=r;s++){let n=[],r=!0;for(let e=i;e<=a;e++){let a=this.getCell(s,e),o=t.raw===!1?Pn(a,t.dateFormat).trim():a.value;o!=null&&o!==``?(n[e-i]=o,r=!1):t.defaultValue===void 0?n[e-i]=null:n[e-i]=t.defaultValue}(!r||o)&&e.push(n)}return e}if(o===`A`){let e=[],o=t.blankRows===!0;for(let s=n;s<=r;s++){let n={},r=!0;for(let e=i;e<=a;e++){let i=this.getCell(s,e),a=t.raw===!1?Pn(i,t.dateFormat).trim():i.value,o=ei(e-1);a!=null&&a!==``?(n[o]=a,r=!1):t.defaultValue!==void 0&&(n[o]=t.defaultValue)}(!r||o)&&e.push(n)}return e}if(Array.isArray(o)){let e=[],s=t.blankRows===!0;for(let c=n;c<=r;c++){let n={},r=!0;for(let e=i;e<=a;e++){let a=e-i,s=o[a]??`__EMPTY_${a}`,l=this.getCell(c,e),u=t.raw===!1?Pn(l,t.dateFormat).trim():l.value;u!=null&&u!==``?(n[s]=u,r=!1):t.defaultValue!==void 0&&(n[s]=t.defaultValue)}(!r||s)&&e.push(n)}return e}let s=[],c={};for(let e=i;e<=a;e++){let t=this.getCell(n,e).value,r=t==null?`__EMPTY_${e-i}`:String(t);c[r]===void 0?c[r]=0:(c[r]++,r=`${r}_${c[r]}`),s.push(r)}let l=[],u=n+1,d=t.blankRows===!0;for(let e=u;e<=r;e++){let n={},r=!0;for(let o=i;o<=a;o++){let a=this.getCell(e,o),c=t.raw===!1?Pn(a,t.dateFormat).trim():a.value,l=s[o-i];c!=null&&c!==``?(n[l]=c,r=!1):t.defaultValue!==void 0&&(n[l]=t.defaultValue)}(!r||d)&&l.push(n)}return l}addJSON(e,t){if(e.length===0)return this;let n=t||{},r=1,i=1;if(n.origin!==void 0){let e=ci(n.origin,this.rowCount);r=e.row,i=e.col}let a=new Set;e.forEach(e=>Object.keys(e).forEach(e=>a.add(e)));let o=n.header?[...n.header]:[...a];n.header&&a.forEach(e=>{o.includes(e)||o.push(e)});let s=r;n.skipHeader||(o.forEach((e,t)=>{this.getCell(s,i+t).value=e}),s++);for(let t of e)o.forEach((e,r)=>{let a=t[e];a===null&&n.nullError?this.getCell(s,i+r).value={error:`#NULL!`}:a!=null&&(this.getCell(s,i+r).value=a)}),s++;return this}toAOA(){let e=[];return this.eachRow({includeEmpty:!0},(t,n)=>{let r=[];t.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),e[n-1]=r}),e}addAOA(e,t){if(e.length===0)return this;let n=1,r=1;if(t?.origin!==void 0){let e=ci(t.origin,this.rowCount);n=e.row,r=e.col}return e.forEach((e,t)=>{e&&e.forEach((e,i)=>{e!=null&&(this.getCell(n+t,r+i).value=e)})}),this}};function ci(e,t){if(typeof e==`string`){let t=ri(e);return{row:t.r+1,col:t.c+1}}return typeof e==`number`?e===-1?{row:t+1,col:1}:{row:e+1,col:1}:{row:e.r+1,col:e.c+1}}function li(e){if(typeof e!=`object`||!e)return e;if(Array.isArray(e))return e.map(e=>li(e));let t={};for(let n of Object.keys(e))n!==`__proto__`&&n!==`constructor`&&n!==`prototype`&&(t[n]=li(e[n]));return t}var ui=class{constructor(e){this.template=e,this.sheets=new Map}addCell(e){this.addCellEx(w.decodeEx(e))}getCell(e){return this.findCellEx(w.decodeEx(e),!0)}findCell(e){return this.findCellEx(w.decodeEx(e),!1)}findCellAt(e,t,n){let r=this.sheets.get(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){let r=this.sheets.get(e);r||(r=[],this.sheets.set(e,r));let i=t>>>0,a=n>>>0,o=r[i]||(r[i]=[]);return o[a]||(o[a]={sheetName:e,address:w.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>>>0]}forEachInSheet(e,t){let n=this.sheets.get(e);n&&n.forEach((e,n)=>{e&&e.forEach((e,r)=>{e&&t(e,n,r)})})}forEach(e){for(let t of this.sheets.keys())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(this.sheets.has(n))return this.sheets.get(n);if(t){let e=[];return this.sheets.set(n,e),e}}findSheetRow(e,t,n){let r=t.row>>>0;if(e&&e[r])return e[r];if(n)return e[r]=[]}findRowCell(e,t,n){let r=t.col>>>0;if(e&&e[r])return e[r];if(n)return e[r]=this.template?{...t,...li(this.template)}:t}spliceRows(e,t,n,r){let i=this.sheets.get(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.get(e);if(i){let e=[];for(let t=0;t<r;t++)e.push(null);i.forEach(r=>{r.splice(t,n,...e)})}}};let di=/[$](\w+)[$](\d+)(:[$](\w+)[$](\d+))?/;var fi=class{constructor(){this.matrixMap={}}getMatrix(e){return this.matrixMap[e]||(this.matrixMap[e]=new ui)}add(e,t){let n=w.decodeEx(e);`error`in n||this.addEx(n,t)}addEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++){let i={sheetName:e.sheetName,address:w.n2l(t)+r,row:r,col:t};n.addCellEx(i)}else n.addCellEx(e)}remove(e,t){let n=w.decodeEx(e);`error`in n||this.removeEx(n,t)}removeEx(e,t){let n=this.getMatrix(t);if(`top`in e)for(let t=e.left;t<=e.right;t++)for(let r=e.top;r<=e.bottom;r++)n.removeCellEx({sheetName:e.sheetName,address:w.n2l(t)+r,row:r,col:t});else n.removeCellEx(e)}removeAllNames(e){Object.values(this.matrixMap).forEach(t=>{if(`top`in e)for(let n=e.left;n<=e.right;n++)for(let r=e.top;r<=e.bottom;r++)t.removeCellEx({sheetName:e.sheetName,address:w.n2l(n)+r,row:r,col:n});else t.removeCellEx(e)})}forEach(e){Object.entries(this.matrixMap).forEach(([t,n])=>{n.forEach(n=>{e(t,n)})})}getNames(e){let t=w.decodeEx(e);return`error`in t||`top`in t?[]:this.getNamesEx(t)}getNamesEx(e){return Object.entries(this.matrixMap).map(([t,n])=>n.findCellEx(e,!1)&&t).filter(e=>!!e)}_explore(e,t){t.mark=!1;let n=t.sheetName,r=new T(t.row,t.col,t.row,t.col,n),i,a,o=(t,r)=>e.findCellAt(n,t,r);function s(e,n){let i=o(e,t.col);return!i||!i.mark?!1:(r[n]=e,i.mark=!1,!0)}for(a=t.row-1;s(a,`top`);a--);for(a=t.row+1;s(a,`bottom`);a++);function c(e,t){let n=[];for(a=r.top;a<=r.bottom;a++){let t=o(a,e);if(t&&t.mark)n.push(t);else return!1}r[t]=e;for(let e=0;e<n.length;e++)n[e].mark=!1;return!0}for(i=t.col-1;c(i,`left`);i--);for(i=t.col+1;c(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(e=>!!e).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=w.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 ui;e.ranges.forEach(e=>{di.test(e.split(`!`).pop()??``)&&n.addCell(e)})})}},pi=class{constructor(e){this._stack=[],this._leaf=!1,this._open=!1,this._pending=``,this._target=e}get depth(){return this._stack.length}get currentElement(){return this._stack.length>0?this._stack[this._stack.length-1]:void 0}_flushOpen(e){this._target.write(this._pending+e),this._pending=``,this._open=!1}openXml(e){let t=e?{...A,...e}:A,n=`<?xml`;for(let e in t){let r=t[e];r!==void 0&&(_t(e),n+=` ${e}="${ht(String(r))}"`)}this._target.write(n+`?>
|
|
8
8
|
`)}openNode(e,t){_t(e),this._open&&this._flushOpen(`>`);let n=`<${e}`;if(t)for(let e in t){let r=t[e];r!==void 0&&(_t(e),n+=` ${e}="${ht(String(r))}"`)}this._pending=n,this._stack.push(e),this._leaf=!0,this._open=!0}addAttribute(e,t){if(!this._open)throw new lt(`add attribute`,`no element is open`);_t(e),this._pending+=` ${e}="${ht(String(t))}"`}addAttributes(e){if(!this._open)throw new lt(`add attributes`,`no element is open`);if(e)for(let t in e){let n=e[t];n!==void 0&&(_t(t),this._pending+=` ${t}="${ht(String(n))}"`)}}writeText(e){this._open&&this._flushOpen(`>`),this._leaf=!1,this._target.write(k(String(e)))}writeRaw(e){this._open&&this._flushOpen(`>`),this._leaf=!1,this._target.write(e)}writeCData(e){this._open&&this._flushOpen(`>`),this._leaf=!1,this._target.write(vt(e))}writeComment(e){this._open&&this._flushOpen(`>`),this._leaf=!1,yt(e),this._target.write(`<!--${e}-->`)}closeNode(){let e=this._stack.pop();if(e===void 0)throw new lt(`close node`,`no element is open`);this._leaf&&this._open?this._flushOpen(`/>`):(this._open&&this._flushOpen(`>`),this._target.write(`</${e}>`)),this._open=!1,this._leaf=!1}leafNode(e,t,n){_t(e),this._open&&this._flushOpen(`>`);let r=`<${e}`;if(t)for(let e in t){let n=t[e];n!==void 0&&(_t(e),r+=` ${e}="${ht(String(n))}"`)}n===void 0?r+=`/>`:r+=`>${k(String(n))}</${e}>`,this._target.write(r),this._leaf=!1}closeAll(){for(;this._stack.length>0;)this.closeNode()}};function mi(e,t){if(t)for(let n in t){let r=t[n];r!==void 0&&(_t(n),e.push(` ${n}="${ht(String(r))}"`))}}var hi=class{constructor(){this._parts=[],this._chunks=[],this._stack=[],this._snapshots=[],this._leaf=!1,this._open=!1}_consolidate(){this._snapshots.length>0||this._parts.length>=1e4&&(this._chunks.push(this._parts.join(``)),this._parts.length=0)}get depth(){return this._stack.length}get currentElement(){return this._stack.length>0?this._stack[this._stack.length-1]:void 0}get cursor(){return this._chunks.length*1e4+this._parts.length}openXml(e){let t=e?{...A,...e}:A;this._parts.push(`<?xml`),mi(this._parts,t),this._parts.push(`?>
|
|
9
9
|
`)}openNode(e,t){_t(e),this._open&&this._parts.push(`>`),this._stack.push(e);let n=`<`+e;if(t)for(let e in t){let r=t[e];r!==void 0&&(_t(e),n+=` ${e}="${ht(String(r))}"`)}this._parts.push(n),this._leaf=!0,this._open=!0}addAttribute(e,t){if(!this._open)throw new lt(`add attribute`,`no element is open`);_t(e),this._parts.push(` ${e}="${ht(String(t))}"`)}addAttributes(e){if(!this._open)throw new lt(`add attributes`,`no element is open`);mi(this._parts,e)}writeText(e){this._open&&=(this._parts.push(`>`),!1),this._leaf=!1,this._parts.push(k(String(e)))}writeRaw(e){this._open&&=(this._parts.push(`>`),!1),this._leaf=!1,this._parts.push(e)}writeCData(e){this._open&&=(this._parts.push(`>`),!1),this._leaf=!1,this._parts.push(vt(e))}writeComment(e){this._open&&=(this._parts.push(`>`),!1),this._leaf=!1,yt(e),this._parts.push(`<!--${e}-->`)}closeNode(){let e=this._stack.pop();if(e===void 0)throw new lt(`close node`,`no element is open`);this._leaf?this._parts.push(`/>`):this._parts.push(`</${e}>`),this._open=!1,this._leaf=!1,this._consolidate()}leafNode(e,t,n){_t(e),this._open&&=(this._parts.push(`>`),!1);let r=`<`+e;if(t)for(let e in t){let n=t[e];n!==void 0&&(_t(e),r+=` ${e}="${ht(String(n))}"`)}n===void 0?r+=`/>`:r+=`>`+k(String(n))+`</`+e+`>`,this._parts.push(r),this._leaf=!1}closeAll(){for(;this._stack.length>0;)this.closeNode()}toString(){return this._chunks.length===0?this._parts.join(``):this._chunks.join(``)+this._parts.join(``)}get xml(){return this.toString()}save(){this._snapshots.push({partsLength:this._parts.length,chunksLength:this._chunks.length,stackLength:this._stack.length,leaf:this._leaf,open:this._open})}commit(){if(this._snapshots.length===0)throw new lt(`commit`,`no snapshot to commit`);this._snapshots.pop()}rollback(){if(this._snapshots.length===0)throw new lt(`rollback`,`no snapshot to rollback`);let e=this._snapshots.pop();this._parts.length=e.partsLength,this._chunks.length=e.chunksLength,this._stack.length=e.stackLength,this._leaf=e.leaf,this._open=e.open}reset(){this._parts=[],this._chunks=[],this._stack=[],this._snapshots=[],this._leaf=!1,this._open=!1}};let gi=(()=>{let e=Array(128);for(let t=0;t<128;t++)e[t]=String.fromCharCode(t);return e})();function M(e){return e<128?gi[e]:String.fromCodePoint(e)}let _i=(()=>{let e=new Uint8Array(128);for(let t=97;t<=122;t++)e[t]=1;for(let t=65;t<=90;t++)e[t]=1;return e[95]=1,e[58]=1,e})(),vi=(()=>{let e=new Uint8Array(128);for(let t=97;t<=122;t++)e[t]=1;for(let t=65;t<=90;t++)e[t]=1;for(let t=48;t<=57;t++)e[t]=1;return e[95]=1,e[58]=1,e[45]=1,e[46]=1,e})();function yi(e){return e===32||e===10||e===13||e===9}function bi(e){return e===34||e===39}function xi(e){return e<128?_i[e]===1:e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Si(e){return e<128?vi[e]===1:e===183||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=768&&e<=879||e>=880&&e<=893||e>=895&&e<=8191||e===8204||e===8205||e>=8255&&e<=8256||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}function Ci(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111}let wi={amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`};var Ti=class{constructor(e){this._entityExpansionCount=0,this._nsStack=[],this.state=0,this.chunk=``,this.i=0,this.prevI=0,this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.entityReturnState=0,this.openWakaBang=``,this.sawRoot=!1,this.closedRoot=!1,this._bomStripped=!1,this._closed=!1,this.reportedTextBeforeRoot=!1,this.reportedTextAfterRoot=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.ENTITIES={...wi},this._handlers={},this.trackPosition=e?.position!==!1,this.fileName=e?.fileName,this.fragment=e?.fragment??!1,this.xmlns=e?.xmlns??!1,this.maxDepth=e?.maxDepth===void 0?256:e.maxDepth,this.maxEntityExpansions=e?.maxEntityExpansions===void 0?1e4:e.maxEntityExpansions,this._init()}get closed(){return this._closed}get position(){return this.chunkPosition+this.i}_init(){this.state=0,this.text=``,this.name=``,this.q=null,this.tags=[],this.tag=null,this.attribList=[],this.entity=``,this.openWakaBang=``,this.sawRoot=this.fragment,this.closedRoot=this.fragment,this.reportedTextBeforeRoot=this.fragment,this.reportedTextAfterRoot=this.fragment,this.carriedFromPrevious=void 0,this._bomStripped=!1,this.line=1,this.column=0,this.positionAtNewLine=0,this.chunkPosition=0,this.chunk=``,this.i=0,this.prevI=0,this._nsStack=this.xmlns?[{xml:`http://www.w3.org/XML/1998/namespace`,xmlns:`http://www.w3.org/2000/xmlns/`}]:[],this._entityExpansionCount=0}on(e,t){this._handlers[e]=t}off(e){delete this._handlers[e]}makeError(e){return new ct(e,{line:this.trackPosition?this.line:void 0,column:this.trackPosition?this.column:void 0,fileName:this.fileName})}fail(e){let t=this.makeError(e);if(this._handlers.error)this._handlers.error(t);else throw t;return this}write(e){if(this._closed){if(e===null)return this;this._closed=!1,this._init()}let t=!1;e===null&&(t=!0,e=``),this.carriedFromPrevious!==void 0&&(e=this.carriedFromPrevious+e,this.carriedFromPrevious=void 0),this._bomStripped||(this._bomStripped=!0,e.length>0&&e.charCodeAt(0)===65279&&(e=e.slice(1)));let n=e.length;if(!t&&n>0){let t=e.charCodeAt(n-1);(t===13||t>=55296&&t<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n))}for(this.chunk=e,this.i=0;this.i<n;)this.processState();return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return-1;let n=e.charCodeAt(t);if(n>=32&&n<=126||n===9)return this.trackPosition&&this.column++,n;if(n===13)return e.charCodeAt(t+1)===10&&(this.i=t+2),this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),10;if(n===10)return this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),10;if(n>=55296&&n<=56319){let r=e.charCodeAt(t+1);if(r>=56320&&r<=57343)return this.i=t+2,this.trackPosition&&this.column++,65536+((n-55296)*1024+(r-56320));this.fail(`invalid XML character: lone surrogate 0x`+n.toString(16))}return n>=56320&&n<=57343&&this.fail(`invalid XML character: lone surrogate 0x`+n.toString(16)),n>=128?(this.trackPosition&&this.column++,(n===65534||n===65535)&&this.fail(`invalid XML character: 0x`+n.toString(16)),n):(this.trackPosition&&this.column++,this.fail(`invalid XML character: 0x`+n.toString(16)),n)}unget(){this.i=this.prevI,this.trackPosition&&this.column--}processState(){switch(this.state){case 0:this.sText();break;case 1:this.sOpenWaka();break;case 2:this.sOpenWakaBang();break;case 3:this.sOpenTag();break;case 4:this.sOpenTagSlash();break;case 5:this.sAttrib();break;case 6:this.sAttribName();break;case 7:this.sAttribNameSawWhite();break;case 8:this.sAttribValue();break;case 9:this.sAttribValueQuoted();break;case 10:this.sAttribValueClosed();break;case 11:this.sCloseTag();break;case 12:this.sCloseTagSawWhite();break;case 13:this.sComment();break;case 14:this.sCommentEnding();break;case 15:this.sCommentEnded();break;case 16:this.sCData();break;case 17:this.sCDataEnding();break;case 18:this.sCDataEnding2();break;case 19:this.sPI();break;case 20:this.sPIEnding();break;case 21:this.sDoctype();break;case 22:this.sDoctypeQuote();break;case 23:this.sDoctypeDTD();break;case 24:this.sDoctypeDTDQuoted();break;case 25:this.sEntity();break}}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}handleTextInRoot(){let{chunk:e}=this,{i:t}=this,n=this._handlers.text,r=e.length;for(;this.i<r;){let r=e.charCodeAt(this.i);if(r>=32&&r<=126&&r!==60&&r!==38){this.i++,this.trackPosition&&this.column++;continue}if(r===9){this.i++,this.trackPosition&&this.column++;continue}if(r===60){if(this.prevI=this.i,this.i++,this.trackPosition&&this.column++,n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;return}if(r===38){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``;return}if(r===10){this.prevI=this.i,this.i++,this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),n&&(this.text+=e.slice(t,this.prevI)+`
|
|
10
10
|
`),t=this.i;continue}if(r===13){this.prevI=this.i,this.i++,e.charCodeAt(this.i)===10&&this.i++,this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),n&&(this.text+=e.slice(t,this.prevI)+`
|
|
11
11
|
`),t=this.i;continue}if(r>=128){if(this.prevI=this.i,r>=55296&&r<=56319){let t=e.charCodeAt(this.i+1);t>=56320&&t<=57343?this.i+=2:(this.i++,this.fail(`invalid XML character: lone surrogate 0x`+r.toString(16)))}else r>=56320&&r<=57343?(this.i++,this.fail(`invalid XML character: lone surrogate 0x`+r.toString(16))):r===65534||r===65535?(this.i++,this.fail(`invalid XML character: 0x`+r.toString(16))):this.i++;this.trackPosition&&this.column++;continue}this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.fail(`invalid XML character: 0x`+r.toString(16))}n&&t<this.i&&(this.text+=e.slice(t,this.i))}handleTextOutsideRoot(){let{chunk:e}=this,{i:t}=this,n=this._handlers.text,r=!1;for(;;){let i=this.getCode();if(i===-1){n&&t<this.i&&(this.text+=e.slice(t,this.i));break}if(i===60){if(n){let r=e.slice(t,this.prevI);this.text.length>0?(n(this.text+r),this.text=``):r.length>0&&n(r)}this.state=1;break}if(i===38){n&&(this.text+=e.slice(t,this.prevI)),this.state=25,this.entityReturnState=0,this.entity=``,r=!0;break}i===10?(n&&(this.text+=e.slice(t,this.prevI)+`
|
|
12
|
-
`),t=this.i):yi(i)||(r=!0)}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}sOpenWaka(){let e=this.getCode();if(e!==-1){if(xi(e)){this.closedRoot&&!this.fragment&&this.fail(`documents may contain only one root element`),this.state=3,this.name=M(e);return}switch(e){case 47:this.state=11,this.name=``;break;case 33:this.state=2,this.openWakaBang=``;break;case 63:this.state=19,this.text=``;break;default:this.fail(`unexpected character in tag`),this.state=0}}}sOpenWakaBang(){let e=this.getCode();if(e!==-1)switch(this.openWakaBang+=M(e),this.openWakaBang){case`[CDATA[`:this.state=16,this.text=``,this.openWakaBang=``;break;case`--`:this.state=13,this.text=``,this.openWakaBang=``;break;case`DOCTYPE`:this.state=21,this.text=``,this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&(this.fail(`incorrect syntax`),this.state=0)}}sOpenTag(){let{chunk:e}=this,t=this.i,n=this.i;for(;n<e.length;){let t=e.charCodeAt(n);if(t<128?vi[t]===1:Si(t))n++;else break}if(n>=e.length){this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);return}this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);let r=this.getCode();r!==-1&&(this.tag={name:this.name,attributes:Object.create(null),isSelfClosing:!1},this.attribList=[],this.sawRoot=!0,r===62?this.openTag():r===47?this.state=4:(yi(r)||this.fail(`unexpected character in tag`),this.state=5))}sOpenTagSlash(){let e=this.getCode();e!==-1&&(e===62?this.openSelfClosingTag():(this.fail(`expected >`),this.state=5))}sAttrib(){let e=this.skipSpaces();e!==-1&&(xi(e)?(this.name=M(e),this.state=6):e===62?this.openTag():e===47?this.state=4:this.fail(`unexpected character in attribute`))}sAttribName(){let{chunk:e}=this,t=this.i,n=this.i;for(;n<e.length;){let t=e.charCodeAt(n);if(t<128?vi[t]===1:Si(t))n++;else break}if(n>=e.length){this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);return}this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);let r=this.getCode();r!==-1&&(r===61?this.state=8:yi(r)?this.state=7:r===62?(this.fail(`attribute without value`),this.attribList.push({name:this.name,value:this.name}),this.name=``,this.openTag()):this.fail(`unexpected character in attribute name`))}sAttribNameSawWhite(){let e=this.skipSpaces();e!==-1&&(e===61?this.state=8:(this.fail(`attribute without value`),this.name=``,this.text=``,e===62?this.openTag():xi(e)?(this.name=M(e),this.state=6):(this.fail(`unexpected character`),this.state=5)))}sAttribValue(){let e=this.skipSpaces();e!==-1&&(bi(e)?(this.q=e,this.text=``,this.state=9):(this.fail(`unquoted attribute value`),this.state=0))}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this,r=t.length;for(;this.i<r;){let r=t.charCodeAt(this.i);if(r>=32&&r<=126&&r!==e&&r!==38&&r!==60){this.i++,this.trackPosition&&this.column++;continue}if(r===e){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.attribList.push({name:this.name,value:this.text+t.slice(n,this.prevI)}),this.name=``,this.text=``,this.q=null,this.state=10;return}if(r===38){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI),this.state=25,this.entityReturnState=9,this.entity=``;return}if(r===60){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI),this.fail(`< not allowed in attribute value`),this.attribList.push({name:this.name,value:this.text}),this.name=``,this.text=``,this.q=null,this.unget(),this.state=0;return}if(r===9||r===10){this.prevI=this.i,this.i++,r===10&&this.trackPosition?(this.line++,this.column=0,this.positionAtNewLine=this.position):this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI)+` `,n=this.i;continue}if(r===13){this.prevI=this.i,this.i++,t.charCodeAt(this.i)===10&&this.i++,this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),this.text+=t.slice(n,this.prevI)+` `,n=this.i;continue}if(this.getCode()===-1){this.text+=t.slice(n,this.i);return}}this.text+=t.slice(n,this.i)}sAttribValueClosed(){let e=this.getCode();e!==-1&&(yi(e)?this.state=5:e===62?this.openTag():e===47?this.state=4:xi(e)?(this.fail(`no whitespace between attributes`),this.name=M(e),this.state=6):this.fail(`unexpected character after attribute`))}sCloseTag(){let{chunk:e}=this,t=this.i;if(this.name===``){if(t>=e.length){let e=this.getCode();if(e===-1)return;xi(e)?this.name=M(e):this.fail(`unexpected character in close tag`);return}let n=e.charCodeAt(t);if(n<128?_i[n]!==1:!xi(n)){this.i=t,this.getCode()!==-1&&this.fail(`unexpected character in close tag`);return}this.name=e[t],t++,this.trackPosition&&this.column++}let n=t;for(;t<e.length;){let n=e.charCodeAt(t);if(n<128?vi[n]===1:Si(n))t++;else break}if(t>n&&(this.name+=e.slice(n,t)),this.trackPosition&&(this.column+=t-n),t>=e.length){this.i=t;return}this.i=t;let r=this.getCode();r!==-1&&(r===62?this.closeTag():yi(r)?this.state=12:this.fail(`unexpected character in close tag`))}sCloseTagSawWhite(){let e=this.skipSpaces();e!==-1&&(e===62?this.closeTag():this.fail(`unexpected character in close tag`))}sComment(){let e=this.getCode();e!==-1&&(e===45?this.state=14:this.text+=M(e))}sCommentEnding(){let e=this.getCode();e!==-1&&(e===45?this.state=15:(this.text+=`-`+M(e),this.state=13))}sCommentEnded(){let e=this.getCode();e!==-1&&(e===62?(this._handlers.comment?.(this.text),this.text=``,this.state=0):e===45?this.text+=`-`:(this.fail(`malformed comment`),this.text+=`--`+M(e),this.state=13))}sCData(){let e=this.getCode();e!==-1&&(e===93?this.state=17:this.text+=M(e))}sCDataEnding(){let e=this.getCode();e!==-1&&(e===93?this.state=18:(this.text+=`]`+M(e),this.state=16))}sCDataEnding2(){let e=this.getCode();e!==-1&&(e===62?(this._handlers.cdata?this._handlers.cdata(this.text):this._handlers.text&&this.text.length>0&&this._handlers.text(this.text),this.text=``,this.state=0):e===93?this.text+=`]`:(this.text+=`]]`+M(e),this.state=16))}sPI(){let e=this.getCode();e!==-1&&(e===63?this.state=20:this.text+=M(e))}sPIEnding(){let e=this.getCode();if(e!==-1)if(e===62){let e=this.text,t=e.indexOf(` `);t>=0?this._handlers.pi?.(e.slice(0,t),e.slice(t+1)):this._handlers.pi?.(e,``),this.text=``,this.state=0}else e===63?this.text+=`?`:(this.text+=`?`+M(e),this.state=19)}sDoctype(){let e=this.getCode();e!==-1&&(e===62?(this.text=``,this.state=0):bi(e)?(this.q=e,this.state=22):e===91?this.state=23:this.text+=M(e))}sDoctypeQuote(){let e=this.getCode();e!==-1&&(e===this.q?(this.q=null,this.state=21):this.text+=M(e))}sDoctypeDTD(){let e=this.getCode();e!==-1&&(e===93?this.state=21:bi(e)&&(this.q=e,this.state=24))}sDoctypeDTDQuoted(){let e=this.getCode();e!==-1&&e===this.q&&(this.q=null,this.state=23)}sEntity(){let e=this.getCode();if(e!==-1)if(e===59){let e=this.entity,t;e===``?(this.fail(`empty entity`),t=`&;`):t=this.parseEntity(e),this.text+=t,this.state=this.entityReturnState,this.entity=``}else Si(e)||e===35?(this.entity+=M(e),this.entity.length>64&&(this.fail(`entity name too long`),this.text+=`&`+this.entity,this.state=this.entityReturnState,this.entity=``)):(this.fail(`invalid entity character`),this.text+=`&`+this.entity+M(e),this.state=this.entityReturnState,this.entity=``)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(`undefined entity: `+e),`&`+e+`;`):this.maxEntityExpansions>0&&e!==`lt`&&e!==`gt`&&e!==`amp`&&e!==`quot`&&e!==`apos`&&(this._entityExpansionCount++,this._entityExpansionCount>this.maxEntityExpansions)?(this.fail(`entity expansion limit (${this.maxEntityExpansions}) exceeded — possible XML bomb`),``):t}let t;return t=e[1]===`x`||e[1]===`X`?parseInt(e.slice(2),16):parseInt(e.slice(1),10),isNaN(t)||t<1||t>=55296&&t<=57343||t>1114111?(this.fail(`invalid character entity: &#`+e.slice(1)+`;`),``):Ci(t)?String.fromCodePoint(t):(this.fail(`invalid character entity`),``)}skipSpaces(){for(;;){let e=this.getCode();if(e===-1||!yi(e))return e}}splitQName(e){let t=e.indexOf(`:`);return t<0?[``,e]:[e.slice(0,t),e.slice(t+1)]}resolveNs(e){for(let t=this._nsStack.length-1;t>=0;t--){let n=this._nsStack[t][e];if(n!==void 0)return n}return``}applyNamespaces(e){let t=`http://www.w3.org/XML/1998/namespace`,n=`http://www.w3.org/2000/xmlns/`,r={},i=e.attributes;for(let e in i)if(Object.prototype.hasOwnProperty.call(i,e)){if(e===`xmlns`)r[``]=i[e];else if(e.startsWith(`xmlns:`)){let a=e.slice(6),o=i[e];a===`xmlns`?this.fail(`the "xmlns" prefix must not be declared`):a===`xml`&&o!==t?this.fail(`the "xml" prefix must be bound to "${t}"`):o===t&&a!==`xml`?this.fail(`namespace "${t}" must only be bound to the "xml" prefix`):o===n&&this.fail(`namespace "${n}" must not be bound to any prefix`),r[a]=o}}this._nsStack.push(r),Object.keys(r).length>0&&(e.ns=r);let[a,o]=this.splitQName(e.name);o.includes(`:`)&&this.fail(`invalid QName "${e.name}": local part must not contain ":"`),e.prefix=a,e.local=o,e.uri=this.resolveNs(a),a!==``&&e.uri===``&&this.fail(`unbound namespace prefix: "${a}"`);let s=new Set;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e)||e===`xmlns`||e.startsWith(`xmlns:`))continue;let[t,n]=this.splitQName(e);if(n.includes(`:`)&&this.fail(`invalid attribute QName "${e}": local part must not contain ":"`),t!==``){let e=this.resolveNs(t);e===``&&this.fail(`unbound namespace prefix on attribute: "${t}"`);let r=e+`\0`+n;s.has(r)&&this.fail(`duplicate attribute by expanded name: {${e}}${n}`),s.add(r)}}}openTag(){let e=this.tag;e.isSelfClosing=!1;for(let{name:t,value:n}of this.attribList)t in e.attributes&&this.fail(`duplicate attribute: ${t}`),e.attributes[t]=n;this.attribList=[],this.xmlns&&this.applyNamespaces(e),this.maxDepth>0&&this.tags.length>=this.maxDepth&&this.fail(`maximum element nesting depth (${this.maxDepth}) exceeded`),this._handlers.opentag?.(e),this.tags.push(e),this.name=``,this.state=0}openSelfClosingTag(){let e=this.tag;e.isSelfClosing=!0;for(let{name:t,value:n}of this.attribList)t in e.attributes&&this.fail(`duplicate attribute: ${t}`),e.attributes[t]=n;this.attribList=[],this.xmlns&&this.applyNamespaces(e),this.maxDepth>0&&this.tags.length>=this.maxDepth&&this.fail(`maximum element nesting depth (${this.maxDepth}) exceeded`),this._handlers.opentag?.(e),this._handlers.closetag?.(e),this.xmlns&&this._nsStack.pop(),this.tags.length===0&&(this.closedRoot=!0),this.name=``,this.state=0}closeTag(){let{tags:e,name:t}=this;if(this.state=0,this.name=``,t===``){this.fail(`empty close tag`),this.text+=`</>`;return}let n=!1;for(let r=e.length-1;r>=0;r--)if(e[r].name===t){for(;e.length>r;){let t=e.pop();this._handlers.closetag?.(t),this.xmlns&&this._nsStack.pop(),e.length>r&&this.fail(`unclosed tag: `+t.name)}n=!0;break}n||(this.fail(`unmatched close tag: `+t),this.text+=`</`+t+`>`),e.length===0&&(this.closedRoot=!0)}end(){for(this.sawRoot||this.fail(`document must contain a root element`);this.tags.length>0;){let e=this.tags.pop();this.fail(`unclosed tag: `+e.name)}return this.text.length>0&&this._handlers.text&&(this._handlers.text(this.text),this.text=``),this._closed=!0,this._init(),this}};async function Ei(e,t){let n=new TextDecoder(`utf-8`,{fatal:!0}),r,i=e._handlers?.error;e.on(`error`,e=>{r=e,i?.(e)});for await(let i of t){let t=typeof i==`string`?i:n.decode(i,{stream:!0});if(e.write(t),r)throw r}let a=n.decode();if(a&&e.write(a),e.close(),r)throw r}let Di=new Set([`ep`,`cp`,`dc`,`dcterms`,`dcmitype`,`vt`]);function Oi(e,t){let n=!1;for(let e in t)if(e.length>6&&e.startsWith(`xmlns:`)){let r=e.slice(6);if(t[e]===`http://schemas.openxmlformats.org/spreadsheetml/2006/main`)return r;Di.has(r)&&(n=!0)}if(n)return null;let r=e.indexOf(`:`);return r!==-1&&Di.has(e.slice(0,r))?null:void 0}function ki(e,t){let n=e.indexOf(`:`);if(n===-1)return e;let r=e.slice(0,n);return r===t||Di.has(r)?e.slice(n+1):e}var N=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=void 0,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){let t=!1,n,r=0,i=null;for await(let a of e)if(!t){for(let{eventType:e,value:o}of a)if(e===`opentag`){if(r===1){this.parseOpen(o);continue}if(r===0){let e=Oi(o.name,o.attributes);if(e===void 0){r=1,this.parseOpen(o);continue}r=2,i=e}let e=ki(o.name,i);e===o.name?this.parseOpen(o):this.parseOpen({name:e,attributes:o.attributes,isSelfClosing:o.isSelfClosing})}else if(e===`text`)this.parseText(o);else if(e===`closetag`){if(r===1){if(!this.parseClose(o.name)){t=!0,n=this.model;break}continue}if(!this.parseClose(ki(o.name,i))){t=!0,n=this.model;break}}}return t?n:this.model}async parseStreamDirect(e){let t=new Ti,n=new TextDecoder(`utf-8`,{fatal:!0}),r=!1,i,a=0,o=null,s;t.on(`error`,e=>{r||(s=e)}),t.on(`opentag`,e=>{if(r)return;if(a===1){this.parseOpen(e);return}if(a===0){let t=Oi(e.name,e.attributes);if(t===void 0){a=1,this.parseOpen(e);return}a=2,o=t}let t=ki(e.name,o);t===e.name?this.parseOpen(e):this.parseOpen({name:t,attributes:e.attributes,isSelfClosing:e.isSelfClosing})}),t.on(`text`,e=>{r||this.parseText(e)}),t.on(`closetag`,e=>{if(r)return;let t=a===2?ki(e.name,o):e.name;this.parseClose(t)||(r=!0,i=this.model)});for await(let i of e){if(r)continue;let e=typeof i==`string`?i:n.decode(i,{stream:!0});if(t.write(e),s)throw s}if(!r){let e=n.decode();if(e&&(t.write(e),s)||(t.close(),s))throw s}return r?i:this.model}async parseStream(e){return this.parseStreamDirect(e)}get xml(){return this.toXml(this.model)}toXml(e){let t=new hi;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 Ai(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{Ai(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var ji=class extends N{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new hi;Ai(e,this._model),this._xml=e.xml}e.writeRaw(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},P=class extends N{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count??`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t?.length??0);let{childXform:n}=this;(t??[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=[],!0):this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw new te(this.childXform.tag,this.maxItems);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},Mi=class extends N{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}},Ni=class extends N{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}},Pi=class extends N{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}},F=class extends N{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}},Fi=class e extends N{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}},Ii=class e extends N{constructor(t){super(),this.options=t||e.OPTIONS;let n=[{tag:`b`,prop:`bold`,xform:new Ni({tag:`b`,attr:`val`})},{tag:`i`,prop:`italic`,xform:new Ni({tag:`i`,attr:`val`})},{tag:`u`,prop:`underline`,xform:new Fi},{tag:`strike`,prop:`strike`,xform:new Ni({tag:`strike`,attr:`val`})},{tag:`condense`,prop:`condense`,xform:new Ni({tag:`condense`,attr:`val`})},{tag:`extend`,prop:`extend`,xform:new Ni({tag:`extend`,attr:`val`})},{tag:`outline`,prop:`outline`,xform:new Ni({tag:`outline`,attr:`val`})},{tag:`shadow`,prop:`shadow`,xform:new Ni({tag:`shadow`,attr:`val`})},{tag:`sz`,prop:`size`,xform:new Pi({tag:`sz`,attr:`val`})},{tag:`color`,prop:`color`,xform:new Mi},{tag:this.options.fontNameTag,prop:`name`,xform:new F({tag:this.options.fontNameTag,attr:`val`})},{tag:`family`,prop:`family`,xform:new Pi({tag:`family`,attr:`val`})},{tag:`scheme`,prop:`scheme`,xform:new F({tag:`scheme`,attr:`val`})},{tag:`charset`,prop:`charset`,xform:new Pi({tag:`charset`,attr:`val`})},{tag:`vertAlign`,prop:`vertAlign`,xform:new F({tag:`vertAlign`,attr:`val`})}];this.map=Object.fromEntries(n.map(e=>[e.tag,{prop:e.prop,xform:e.xform}])),this.renderOrder=n.map(e=>e.tag)}get tag(){return this.options.tagName}render(e,t){let{map:n,renderOrder:r}=this;e.openNode(this.options.tagName),r.forEach(r=>{n[r].xform.render(e,t[n[r].prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},Li=class extends N{constructor(){super(),this.map={color:new Mi}}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}},Ri=class extends N{constructor(){super(),this.map={fgColor:new Mi(`fgColor`),bgColor:new Mi(`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}},zi=class extends N{constructor(){super(),this.map={stop:new Li}}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}},Bi=class e extends N{constructor(){super(),this.map={patternFill:new Ri,gradientFill:new zi}}get tag(){return`fill`}render(e,t){t.type!==`pattern`&&t.type!==`gradient`||(e.openNode(`fill`),t.type===`pattern`?this.map.patternFill.render(e,t):this.map.gradientFill.render(e,t),e.closeNode())}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=Li}static{this.PatternFillXform=Ri}static{this.GradientFillXform=zi}},Vi=class e extends N{constructor(e){super(),this.name=e,this.map={color:new Mi}}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),{})}},Hi=class extends N{constructor(){super(),this.map={top:new Vi(`top`),left:new Vi(`left`),bottom:new Vi(`bottom`),right:new Vi(`right`),diagonal:new Vi(`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=It(e.attributes.diagonalUp),this.diagonalDown=It(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 Ui={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 Wi(){let e={};return Object.entries(Ui).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let Gi=null;function Ki(){return Gi||=Wi(),Gi}var qi=class extends N{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 Ki()[e]}static getDefaultFmtCode(e){return Ui[e]&&Ui[e].f}};let Ji={ReadingOrder:{LeftToRight:1,RightToLeft:2}},Yi={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=At(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=At(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Ji.ReadingOrder.LeftToRight;case`rtl`:return Ji.ReadingOrder.RightToLeft;default:return}}},Xi={toXml(e){let t=Yi.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=At(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 Zi=class extends N{get tag(){return`alignment`}render(e,t){let n={};function r(e,t){t&&(n[e]=t)}r(`horizontal`,Yi.horizontal(t.horizontal)),r(`vertical`,Yi.vertical(t.vertical)),r(`wrapText`,Yi.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,Yi.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,Yi.indent(t.indent)),r(`textRotation`,Xi.toXml(t.textRotation)),r(`readingOrder`,Yi.readingOrder(t.readingOrder)),Object.keys(n).length>0&&e.leafNode(`alignment`,n)}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`,It(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,It(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,Xi.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 Qi={boolean(e,t){return e===void 0?t:e}};var $i=class extends N{get tag(){return`protection`}render(e,t){let n={},r=Qi.boolean(t.locked,!0)?void 0:`0`,i=Qi.boolean(t.hidden,!1)?`1`:void 0;r!==void 0&&(n.locked=r),i!==void 0&&(n.hidden=i),Object.keys(n).length>0&&e.leafNode(`protection`,n)}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}},ea=class extends N{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new Zi,protection:new $i}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId??0,fontId:t.fontId??0,fillId:t.fillId??0,borderId:t.borderId??0}),this.xfId&&e.addAttribute(`xfId`,t.xfId??0),(t.applyNumberFormat||t.numFmtId)&&e.addAttribute(`applyNumberFormat`,`1`),(t.applyFont||t.fontId)&&e.addAttribute(`applyFont`,`1`),(t.applyFill||t.fillId)&&e.addAttribute(`applyFill`,`1`),(t.applyBorder||t.borderId)&&e.addAttribute(`applyBorder`,`1`),(t.applyAlignment||t.alignment)&&e.addAttribute(`applyAlignment`,`1`),(t.applyProtection||t.protection)&&e.addAttribute(`applyProtection`,`1`),t.pivotButton&&e.addAttribute(`pivotButton`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),t.checkbox&&t.xfComplementIndex!==void 0&&(e.openNode(`extLst`),e.openNode(`ext`,{"xmlns:xfpb":`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`,uri:`{C7286773-470A-42A8-94C5-96B5CB345126}`}),e.leafNode(`xfpb:xfComplement`,{i:t.xfComplementIndex}),e.closeNode(),e.closeNode()),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),e.attributes.pivotButton===`1`&&(this.model.pivotButton=!0);for(let t of[`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e.attributes[t]===`1`&&(this.model[t]=!0);return!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},ta=class extends N{constructor(){super(),this.map={alignment:new Zi,border:new Hi,fill:new Bi,font:new Ii,numFmt:new qi,protection:new $i}}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}},na=class e extends N{constructor(t){super(),this.map={numFmts:new P({tag:`numFmts`,count:!0,childXform:new qi}),fonts:new P({tag:`fonts`,count:!0,childXform:new Ii,$:{"x14ac:knownFonts":1}}),fills:new P({tag:`fills`,count:!0,childXform:new Bi}),borders:new P({tag:`borders`,count:!0,childXform:new Hi}),cellStyleXfs:new P({tag:`cellStyleXfs`,count:!0,childXform:new ea}),cellXfs:new P({tag:`cellXfs`,count:!0,childXform:new ea({xfId:!0})}),dxfs:new P({tag:`dxfs`,always:!0,count:!0,childXform:new ta}),numFmt:new qi,font:new Ii,fill:new Bi,border:new Hi,style:new ea({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap,this._hasCheckboxes=!1}setDefaultFont(e){this.defaultFont=e}render(t,n){let r=n||this.model;t.openXml(A),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.writeRaw(e)}),t.closeNode()),r.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeRaw(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeRaw(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeRaw(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.writeRaw(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.map.fonts.model&&this.map.fonts.model.length>0&&(this.defaultFont=this.map.fonts.model[0]),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;this.model.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`});let n=t||D.ValueType.Number;if(n!==D.ValueType.Checkbox&&this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let r={};if(e.numFmt)r.numFmtId=this._addNumFmtStr(e.numFmt);else switch(n){case D.ValueType.Number:r.numFmtId=this._addNumFmtStr(`General`);break;case D.ValueType.Date:r.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(r.fontId=this._addFont(e.font)),e.border&&(r.borderId=this._addBorder(e.border)),e.fill&&(r.fillId=this._addFill(e.fill)),e.alignment&&(r.alignment=e.alignment),e.protection&&(r.protection=e.protection);for(let t of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e[t]&&(r[t]=!0);n===D.ValueType.Checkbox&&(this._hasCheckboxes=!0,r.alignment=r.alignment||{},r.checkbox=!0,r.xfComplementIndex=0);let i=this._addStyle(r);return n!==D.ValueType.Checkbox&&this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||qi.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection);for(let e of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])t[e]&&(n[e]=!0);return n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}get hasCheckboxes(){return!!this._hasCheckboxes}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=qi.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 ji({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new ji({tag:`dxfs`,$:{count:0}}),tableStyles:new ji({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new ji({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`}}]}]})}}};na.Mock=class extends na{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 D.ValueType.Checkbox:throw new v(`Checkbox cells`,`require styles to be enabled (useStyles: true)`);case D.ValueType.Date:return this.dateStyleId;default:return 0}}get hasCheckboxes(){return!1}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:qi.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var ra=class extends N{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}};let I={creator:`dc:creator`,title:`dc:title`,subject:`dc:subject`,description:`dc:description`,identifier:`dc:identifier`,language:`dc:language`,keywords:`cp:keywords`,category:`cp:category`,lastModifiedBy:`cp:lastModifiedBy`,lastPrinted:`cp:lastPrinted`,revision:`cp:revision`,version:`cp:version`,contentStatus:`cp:contentStatus`,contentType:`cp:contentType`,created:`dcterms:created`,modified:`dcterms:modified`};var ia=class e extends N{constructor(){super(),this.map={creator:new F({tag:I.creator}),title:new F({tag:I.title}),subject:new F({tag:I.subject}),description:new F({tag:I.description}),identifier:new F({tag:I.identifier}),language:new F({tag:I.language}),keywords:new F({tag:I.keywords}),category:new F({tag:I.category}),lastModifiedBy:new F({tag:I.lastModifiedBy}),lastPrinted:new ra({tag:I.lastPrinted,format:e.DateFormat}),revision:new Pi({tag:I.revision}),version:new F({tag:I.version}),contentStatus:new F({tag:I.contentStatus}),contentType:new F({tag:I.contentType}),created:new ra({tag:I.created,attrs:e.DateAttrs,format:e.DateFormat}),modified:new ra({tag:I.modified,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(A),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES);for(let e of Object.keys(I))this.map[e].render(t,n[e]);t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):(e.name!==`coreProperties`&&(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`coreProperties`){this.model={};for(let e of Object.keys(I)){let t=this.map[e].model;t!==void 0&&t!==``&&(this.model[e]=t)}return!1}return!0}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},aa=class extends N{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(Et(t)),e.closeNode()}parseOpen(e){return e.name===`t`?(this.model=``,!0):!1}parseText(e){this.model=this.model?this.model+e:e}parseClose(){let e=this.model;return e.includes(`_x`)&&(this.model=Tt(e)),!1}},oa=class e extends N{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new aa}get fontXform(){return this._fontXform||=new Ii(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`}}},sa=class extends N{constructor(){super(),this.map={r:new oa,t:new aa}}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}}},ca=class extends N{constructor(e){super(),this.model=e,this.map={r:new oa,t:new aa,rPh:new sa}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model={},!0):(this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},la=class extends N{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 ca}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(A),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 new _(`sharedStrings`,`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 new _(`sharedStrings`,`Unexpected xml node in parseClose: ${e}`)}}},ua=class extends N{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}},da=class e extends N{constructor(){super(),this.map={Relationship:new ua}}render(t,n){let r=n||this._values;t.openXml(A),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 new _(`Relationships`,`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 new _(`Relationships`,`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}};let L={contentTypes:`[Content_Types].xml`,rootRels:`_rels/.rels`,docPropsApp:`docProps/app.xml`,docPropsCore:`docProps/core.xml`,xlWorkbook:`xl/workbook.xml`,xlWorkbookRels:`xl/_rels/workbook.xml.rels`,xlSharedStrings:`xl/sharedStrings.xml`,xlStyles:`xl/styles.xml`,xlTheme1:`xl/theme/theme1.xml`,xlFeaturePropertyBag:`xl/featurePropertyBag/featurePropertyBag.xml`},fa=/^xl\/worksheets\/sheet(\d+)[.]xml$/,pa=/^xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels$/,ma=/^xl\/theme\/[a-zA-Z0-9]+[.]xml$/,ha=/^xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/,ga=/^xl\/drawings\/(drawing\d+)[.]xml$/,_a=/^xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels$/,va=/^xl\/drawings\/(vmlDrawing\d+)[.]vml$/,ya=/^xl\/comments(\d+)[.]xml$/,ba=/^xl\/tables\/(table\d+)[.]xml$/,xa=/^xl\/pivotTables\/(pivotTable\d+)[.]xml$/,Sa=/^xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels$/,Ca=/^xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml$/,wa=/^xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels$/,Ta=/^xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml$/;function Ea(e){return e.startsWith(`/`)?e.slice(1):e}function Da(e){let t=fa.exec(e);if(t)return parseInt(t[1],10)}function Oa(e){let t=pa.exec(e);if(t)return parseInt(t[1],10)}function ka(e){return e.startsWith(`xl/media/`)}function Aa(e){let t=ha.exec(e);return t?t[1]:void 0}function ja(e){return ma.test(e)}function Ma(e){let t=/^xl\/theme\/([a-zA-Z0-9]+)[.]xml$/.exec(e);return t?t[1]:void 0}function Na(e){return ka(e)||ja(e)}function Pa(e){let t=ga.exec(e);return t?t[1]:void 0}function Fa(e){let t=_a.exec(e);return t?t[1]:void 0}function Ia(e){let t=va.exec(e);return t?t[1]:void 0}function La(e){let t=ya.exec(e);return t?t[1]:void 0}function Ra(e){let t=ba.exec(e);return t?t[1]:void 0}function za(e){let t=xa.exec(e);return t?t[1]:void 0}function Ba(e){let t=Sa.exec(e);return t?t[1]:void 0}function Va(e){let t=Ca.exec(e);return t?t[1]:void 0}function Ha(e){let t=wa.exec(e);return t?t[1]:void 0}function Ua(e){let t=Ta.exec(e);return t?t[1]:void 0}function R(e){return e.startsWith(`/`)?e:`/${e}`}function Wa(e){return`xl/theme/${e}.xml`}function Ga(e){return`xl/media/${e}`}function Ka(e){return`xl/worksheets/sheet${e}.xml`}function qa(e){return`xl/worksheets/_rels/sheet${e}.xml.rels`}function Ja(e){return`worksheets/sheet${e}.xml`}function Ya(e){return`xl/comments${e}.xml`}function Xa(e){return`xl/${e}.xml`}function Za(e){return`xl/drawings/vmlDrawing${e}.vml`}function Qa(e){return`xl/tables/${e}`}function $a(e){return`xl/drawings/${e}.xml`}function eo(e){return`xl/drawings/_rels/${e}.xml.rels`}function to(e){return`xl/pivotCache/pivotCacheDefinition${e}.xml`}function no(e){return`xl/pivotCache/_rels/pivotCacheDefinition${e}.xml.rels`}function ro(e){return`xl/pivotCache/pivotCacheRecords${e}.xml`}function io(e){return`pivotCacheRecords${e}.xml`}function ao(e){return`xl/pivotTables/pivotTable${e}.xml`}function oo(e){return`xl/pivotTables/_rels/pivotTable${e}.xml.rels`}function so(e){return`../pivotCache/pivotCacheDefinition${e}.xml`}let co={workbookStyles:`styles.xml`,workbookSharedStrings:`sharedStrings.xml`,workbookTheme1:`theme/theme1.xml`,workbookFeaturePropertyBag:`featurePropertyBag/featurePropertyBag.xml`};function lo(e){return`pivotCache/pivotCacheDefinition${e}.xml`}function uo(e){return`../comments${e}.xml`}function fo(e){return`../drawings/vmlDrawing${e}.vml`}function po(e){return`../drawings/${e}.xml`}function mo(e){return`../drawings/${e}.vml`}function ho(e){return`../${e}.xml`}function go(e){return`../pivotTables/pivotTable${e}.xml`}function _o(e){return`../pivotTables/${e}.xml`}function vo(e){return`../tables/${e}`}function yo(e){return`../tables/${e}.xml`}function bo(e){return`../media/${e}`}function xo(e){return`xl/ctrlProps/ctrlProp${e}.xml`}function So(e){return`../ctrlProps/ctrlProp${e}.xml`}var Co=class e extends N{render(t,n){t.openXml(A),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};if((n.media??[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:R(L.xlWorkbook),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{t.leafNode(`Override`,{PartName:R(Ka(e.fileIndex)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables??[]).length){let e=new Set;(n.pivotTables??[]).forEach(n=>{let r=n.tableNumber,i=n.cacheId;e.has(i)||(e.add(i),t.leafNode(`Override`,{PartName:R(to(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),(!n.isLoaded||n.cacheRecords)&&t.leafNode(`Override`,{PartName:R(ro(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`})),t.leafNode(`Override`,{PartName:R(ao(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})})}t.leafNode(`Override`,{PartName:R(L.xlTheme1),ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:R(L.xlStyles),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.hasCheckboxes&&t.leafNode(`Override`,{PartName:R(L.xlFeaturePropertyBag),ContentType:`application/vnd.ms-excel.featurepropertybag+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:R(L.xlSharedStrings),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:R(Qa(e.target)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:R($a(e.name)),ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})});let i=n.commentRefs&&n.commentRefs.length>0,a=n.formControlRefs&&n.formControlRefs.length>0;if((i||a)&&t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),i&&n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:R(Xa(e)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})}),a)for(let e of n.formControlRefs)t.leafNode(`Override`,{PartName:R(xo(e)),ContentType:`application/vnd.ms-excel.controlproperties+xml`});if(n.passthroughContentTypes)for(let{partName:e,contentType:r}of n.passthroughContentTypes)t.leafNode(`Override`,{PartName:R(e),ContentType:r});t.leafNode(`Override`,{PartName:R(L.docPropsCore),ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:R(L.docPropsApp),ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},wo=class extends N{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`}},To=class extends N{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`}},Eo=class e extends N{constructor(){super(),this.map={Company:new F({tag:`Company`}),Manager:new F({tag:`Manager`}),HeadingPairs:new wo,TitlesOfParts:new To}}render(t,n){t.openXml(A),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitlesOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company??``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitlesOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},Do=class extends N{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:Mo(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};let Oo=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,ko=/^[$]?\d+:[$]?\d+$/,Ao=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function jo(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let t=e.split(`!`).pop()??``;if(!Oo.test(t)&&!ko.test(t)&&!Ao.test(t))return!1;try{let t=w.decodeEx(e);return`row`in t&&typeof t.row==`number`||`top`in t&&typeof t.top==`number`||`left`in t&&typeof t.left==`number`}catch{return!1}}function Mo(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)??[]).length;if(!t){r?i+=`${e},`:jo(e)&&n.push(e);return}let a=t%2==0;!r&&a&&jo(e)?n.push(e):r&&!a?(r=!1,jo(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}let No=new Set([`visible`,`hidden`,`veryHidden`]);function Po(e){let t=e||`visible`;return No.has(t)?t:`visible`}var Fo=class extends N{render(e,t){e.leafNode(`sheet`,{name:t.name,sheetId:t.id,state:t.state===`visible`?void 0:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:e.attributes.name,id:parseInt(e.attributes.sheetId,10),state:Po(e.attributes.state),rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},Io=class extends N{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}},Lo=class extends N{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},Ro=class extends N{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}},zo=class extends N{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}},Bo=class e extends N{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new Lo,bookViews:new P({tag:`bookViews`,count:!1,childXform:new Io}),sheets:new P({tag:`sheets`,count:!1,childXform:new Fo}),definedNames:new P({tag:`definedNames`,count:!1,childXform:new Do}),calcPr:new Ro,pivotCaches:new P({tag:`pivotCaches`,count:!1,childXform:new zo})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a=i[0],o=i[1]??a,s={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${a}:$${o}`],localSheetId:n};t.push(s)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media??[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(A),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties);let r=n.pivotTables??[],i=new Set,a=r.filter(e=>i.has(e.cacheId)?!1:(i.add(e.cacheId),!0));this.map.pivotCaches.render(t,a),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let t=(e.workbookRels??[]).reduce((e,t)=>(e[t.Id]=t,e),{}),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&&e.ranges?.length>0){r.pageSetup||={};let t=w.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&&e.ranges?.length>0){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 ji({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let z={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`,FeaturePropertyBag:`http://schemas.microsoft.com/office/2022/11/relationships/FeaturePropertyBag`,CtrlProp:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp`};var Vo=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 T(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let n=w.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===D.ValueType.Merge&&(i.master=n.tl):r.cells[t]={type:D.ValueType.Null,address:w.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}},Ho=class extends N{get tag(){return`hyperlink`}render(e,t){t.target&&Uo(t.target)?e.leafNode(`hyperlink`,{ref:t.address,tooltip:t.tooltip,location:t.target.slice(1)}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){if(e.name===`hyperlink`){if(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location){let t=e.attributes.location;this.model.target=t.startsWith(`#`)?t:`#${t}`}return!0}return!1}parseText(){}parseClose(){return!1}};function Uo(e){return e.startsWith(`#`)}function Wo(e){if(e==null)return D.ValueType.Null;if(e instanceof String||typeof e==`string`)return D.ValueType.String;if(typeof e==`number`)return D.ValueType.Number;if(typeof e==`boolean`)return D.ValueType.Boolean;if(e instanceof Date)return D.ValueType.Date;if(e.text&&e.hyperlink)return D.ValueType.Hyperlink;if(e.formula)return D.ValueType.Formula;if(e.error)return D.ValueType.Error;throw new g(typeof e,`Could not understand type of value`)}function Go(e){switch(e.type){case D.ValueType.Formula:return Wo(e.result);default:return e.type}}var Ko=class extends N{constructor(){super(),this.richTextXform=new oa}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},Go(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case D.ValueType.String:case D.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case D.ValueType.Date:t.date1904&&(e.date1904=!0);break;case D.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 D.ValueType.Merge:t.merges.add(e);break;case D.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 new l(`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 T(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(Wo(t.result)){case D.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case D.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case D.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case D.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result?1:0);break;case D.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case D.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,xt(t.result,t.date1904));break;default:throw new g(String(Wo(t.result)),`Could not understand type of value`)}}render(e,t){if(!(t.type===D.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case D.ValueType.Null:break;case D.ValueType.Number:e.leafNode(`v`,null,t.value);break;case D.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case D.ValueType.Checkbox:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case D.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case D.ValueType.String:case D.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 D.ValueType.Date:e.leafNode(`v`,null,xt(t.value,t.date1904));break;case D.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 D.ValueType.Formula:this.renderFormula(e,t);break;case D.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=D.ValueType.Formula,e.value&&=(this.t===`str`?e.result=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=D.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=D.ValueType.String;break;case`inlineStr`:e.type=D.ValueType.String,typeof e.value==`string`&&e.value.includes(`_x`)&&(e.value=Tt(e.value));break;case`b`:e.type=D.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=D.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=D.ValueType.Date,e.value=new Date(e.value);break;default:e.type=D.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=D.ValueType.Null:e.type=D.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText??[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId!==void 0&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case D.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=D.ValueType.RichText);break;case D.ValueType.Number:n&&Ft(n.numFmt)&&(e.type=D.ValueType.Date,e.value=St(e.value,t.date1904));break;case D.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&Ft(n.numFmt)&&(e.result=St(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===D.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=D.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},qo=class extends N{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new Ko}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height!=null&&t.height>0?(e.addAttribute(`ht`,t.height),t.customHeight!==!1&&e.addAttribute(`customHeight`,`1`)):t.height===0&&e.addAttribute(`ht`,1),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),t.dyDescent!==void 0&&e.addAttribute(`x14ac:dyDescent`,t.dyDescent),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans,n,r;if(t){let e=t.indexOf(`:`);n=parseInt(t,10),r=e>-1?parseInt(t.substring(e+1),10):void 0}let i=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:n,max:r,cells:[]};return e.attributes.s&&(i.styleId=parseInt(e.attributes.s,10)),It(e.attributes.hidden)&&(i.hidden=!0),It(e.attributes.bestFit)&&(i.bestFit=!0),e.attributes.ht&&(i.height=parseFloat(e.attributes.ht)),It(e.attributes.customHeight)&&(i.customHeight=!0),e.attributes.outlineLevel&&(i.outlineLevel=parseInt(e.attributes.outlineLevel,10)),It(e.attributes.collapsed)&&(i.collapsed=!0),e.attributes[`x14ac:dyDescent`]!==void 0&&(i.dyDescent=parseFloat(e.attributes[`x14ac:dyDescent`])),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=w.decodeCol(e.address):(this.lastCellCol+=1,e.address=w.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw new te(`column`,this.maxItems);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId===void 0?{}:t.styles.getStyleModel(e.styleId),e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},Jo=class extends N{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)),It(e.attributes.hidden)&&(t.hidden=!0),It(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),It(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId!==void 0&&(e.style=t.styles.getStyleModel(e.styleId))}},Yo=class extends N{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}},Xo=class extends N{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 Zo(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function Qo(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=It(i)}function $o(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=w.encodeAddress(e.row+i,r);if(!n[t]||!ue(n[e.address],n[t]))return!1}return!0},o=r.map(e=>{if(!e.marked){let t=w.decodeEx(e.address);if(t.dimensions)return i[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let r=1,o=w.encodeAddress(t.row+r,t.col);for(;n[o]&&ue(e.dataValidation,n[o]);)r++,o=w.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=w.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}:${w.encodeAddress(n,i)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...o]}var es=class extends N{get tag(){return`dataValidations`}render(e,t){let n=$o(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(xt(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&&Qo(t,e.attributes,`allowBlank`),Qo(t,e.attributes,`showInputMessage`),Qo(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:Zo(t,e.attributes,`operator`,`between`);break}return Zo(t,e.attributes,`promptTitle`),Zo(t,e.attributes,`prompt`),Zo(t,e.attributes,`errorStyle`),Zo(t,e.attributes,`errorTitle`),Zo(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),this._address.split(/\s+/g).forEach(e=>{e.includes(`:`)?this.model[`range:${e}`]=this._dataValidation:this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=St(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},ts=class extends N{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 ns=e=>e!==void 0;var rs=class extends N{get tag(){return`outlinePr`}render(e,t){return t&&(ns(t.summaryBelow)||ns(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:ns(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:ns(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:ns(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:ns(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},is=class extends N{constructor(){super(),this.map={tabColor:new Mi(`tabColor`),pageSetUpPr:new ts,outlinePr:new rs}}get tag(){return`sheetPr`}render(e,t){if(!t)return;let n=!!t.tabColor,r=!!(t.pageSetup&&t.pageSetup.fitToPage),i=t.outlineProperties!==void 0&&t.outlineProperties!==null&&(t.outlineProperties.summaryBelow!==void 0||t.outlineProperties.summaryRight!==void 0);(n||r||i)&&(e.openNode(`sheetPr`),this.map.tabColor.render(e,t.tabColor),this.map.pageSetUpPr.render(e,t.pageSetup),this.map.outlinePr.render(e,t.outlineProperties),e.closeNode())}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)}},as=class extends N{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow||void 0,outlineLevelCol:t.outlineLevelCol||void 0,"x14ac:dyDescent":t.dyDescent!==void 0&&t.dyDescent!==0?t.dyDescent:void 0};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),t.customHeight&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight??`0`),dyDescent:e.attributes[`x14ac:dyDescent`]===void 0?void 0:parseFloat(e.attributes[`x14ac:dyDescent`]),outlineLevelRow:parseInt(e.attributes.outlineLevelRow??`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol??`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),e.attributes.customHeight===`1`&&(this.model.customHeight=!0),!0):!1}parseText(){}parseClose(){return!1}};let os={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var ss=class extends N{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){let n={};t.tabSelected&&(n.tabSelected=`1`),n.workbookViewId=t.workbookViewId??0,e.openNode(`sheetView`,n);let r=function(t,n,r){r&&e.addAttribute(t,n)};r(`rightToLeft`,`1`,t.rightToLeft===!0),r(`showRuler`,`0`,t.showRuler===!1),r(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),r(`showGridLines`,`0`,t.showGridLines===!1),r(`zoomScale`,t.zoomScale,t.zoomScale!==void 0&&t.zoomScale!==100),r(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal!==void 0&&t.zoomScaleNormal!==100),r(`view`,t.style,t.style);let i,a,o,s;switch(t.state){case`frozen`:a=t.xSplit??0,o=t.ySplit??0,i=t.topLeftCell||w.getAddress(o+1,a+1).address,s=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:i,activePane:s,state:`frozen`}),e.leafNode(`selection`,{pane:s,activeCell:t.activeCell,sqref:t.activeCell});break;case`split`:t.activePane===`topLeft`&&(t.activePane=void 0),e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode(`selection`,{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case`normal`:t.activeCell&&e.leafNode(`selection`,{activeCell:t.activeCell,sqref:t.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale??`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal??`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit??`0`,10),ySplit:parseInt(e.attributes.ySplit??`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane??`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane??`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:os[this.pane.state]??`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function cs(e,t){return e?t:void 0}function ls(e,t){return e===t?!0:void 0}var us=class extends N{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:cs(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:cs(t.formatCells,`0`),formatColumns:cs(t.formatColumns,`0`),formatRows:cs(t.formatRows,`0`),insertColumns:cs(t.insertColumns,`0`),insertRows:cs(t.insertRows,`0`),insertHyperlinks:cs(t.insertHyperlinks,`0`),deleteColumns:cs(t.deleteColumns,`0`),deleteRows:cs(t.deleteRows,`0`),sort:cs(t.sort,`0`),autoFilter:cs(t.autoFilter,`0`),pivotTables:cs(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=cs(t.objects===!1,`1`),n.scenarios=cs(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:ls(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:ls(e.attributes.formatCells,`0`),formatColumns:ls(e.attributes.formatColumns,`0`),formatRows:ls(e.attributes.formatRows,`0`),insertColumns:ls(e.attributes.insertColumns,`0`),insertRows:ls(e.attributes.insertRows,`0`),insertHyperlinks:ls(e.attributes.insertHyperlinks,`0`),deleteColumns:ls(e.attributes.deleteColumns,`0`),deleteRows:ls(e.attributes.deleteRows,`0`),sort:ls(e.attributes.sort,`0`),autoFilter:ls(e.attributes.autoFilter,`0`),pivotTables:ls(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}},ds=class extends N{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 fs(e){return e?`1`:void 0}function ps(e){switch(e){case`overThenDown`:return e;default:return}}function ms(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function hs(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function gs(e){return e===void 0?void 0:parseInt(e,10)}var _s=class extends N{get tag(){return`pageSetup`}_dpiToXml(e){if(e!==void 0&&Number.isFinite(e)&&e!==4294967295)return e}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:this._dpiToXml(t.horizontalDpi),verticalDpi:this._dpiToXml(t.verticalDpi),pageOrder:ps(t.pageOrder),blackAndWhite:fs(t.blackAndWhite),draft:fs(t.draft),cellComments:ms(t.cellComments),errors:hs(t.errors),scale:t.scale===100?void 0:t.scale,fitToWidth:t.fitToWidth===1?void 0:t.fitToWidth,fitToHeight:t.fitToHeight===1?void 0:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:fs(!!t.firstPageNumber),usePrinterDefaults:fs(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:gs(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 vs(e){return e?`1`:void 0}var ys=class extends N{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:vs(t.showRowColHeaders),gridLines:vs(t.showGridLines),horizontalCentered:vs(t.horizontalCentered),verticalCentered:vs(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}},bs=class extends N{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:w.getAddress(e.row,e.col).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)}},xs=class extends N{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}},Ss=class extends N{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}},Cs=class extends N{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}},ws=class extends N{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){if(e.name===`brk`){let{id:t,max:n,man:r,min:i}=e.attributes;return this.model={id:+t,max:+n,man:+r},i!==void 0&&(this.model.min=+i),!0}return!1}parseText(){}parseClose(){return!1}},Ts=class extends P{constructor(){super({tag:`rowBreaks`,count:!0,childXform:new ws})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Es=class extends P{constructor(){super({tag:`colBreaks`,count:!0,childXform:new ws})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Ds=class extends N{get tag(){return`headerFooter`}render(e,t){if(!t)return;let n={},r=[];if(t.differentFirst&&(n.differentFirst=`1`),t.differentOddEven&&(n.differentOddEven=`1`),t.oddHeader&&typeof t.oddHeader==`string`&&r.push({name:`oddHeader`,text:t.oddHeader}),t.oddFooter&&typeof t.oddFooter==`string`&&r.push({name:`oddFooter`,text:t.oddFooter}),t.evenHeader&&typeof t.evenHeader==`string`&&r.push({name:`evenHeader`,text:t.evenHeader}),t.evenFooter&&typeof t.evenFooter==`string`&&r.push({name:`evenFooter`,text:t.evenFooter}),t.firstHeader&&typeof t.firstHeader==`string`&&r.push({name:`firstHeader`,text:t.firstHeader}),t.firstFooter&&typeof t.firstFooter==`string`&&r.push({name:`firstFooter`,text:t.firstFooter}),Object.keys(n).length>0||r.length>0){e.openNode(`headerFooter`,n);for(let t of r)e.leafNode(t.name,null,t.text);e.closeNode()}}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}}},B=class extends N{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``}},Os=class extends N{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:N.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},ks=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os,color:this.colorXform=new Mi}}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}}},As=class extends N{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}},js=class extends B{constructor(){super(),this.map={"x14:id":this.idXform=new As}}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}},Ms=class extends B{constructor(){super(),this.map={ext:new js}}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)}},Ns=class extends N{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}},Ps=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os,color:this.colorXform=new Mi}}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)}},Fs=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:N.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:N.toBoolAttribute(t.reverse,!1),showValue:N.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:N.toStringValue(e.iconSet,`3TrafficLights`),reverse:N.toBoolValue(e.reverse),showValue:N.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let Is={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},Ls=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new T(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}},Rs=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new T(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}},zs=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 Bs=class e extends B{constructor(){super(),this.map={dataBar:this.databarXform=new ks,extLst:this.extLstRefXform=new Ms,formula:this.formulaXform=new Ns,colorScale:this.colorScaleXform=new Ps,iconSet:this.iconSetXform=new Fs}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||Is[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:N.toBoolAttribute(t.percent,!1),bottom:N.toBoolAttribute(t.bottom,!1),rank:N.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:N.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:N.toStringAttribute(t.operator,`containsText`)});let n=Ls(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=Rs(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...zs(e),dxfId:N.toIntValue(e.dxfId),priority:N.toIntValue(e.priority),timePeriod:e.timePeriod,percent:N.toBoolValue(e.percent),bottom:N.toBoolValue(e.bottom),rank:N.toIntValue(e.rank),aboveAverage:N.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}}},Vs=class extends B{constructor(){super(),this.map={cfRule:new Bs}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(Bs.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{Bs.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)}},Hs=class extends N{constructor(){super(),this.cfXform=new Vs}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority??0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style)),e.type===`dataBar`&&((!e.cfvo||e.cfvo.length<2)&&(e.cfvo=[{type:`min`},{type:`max`}]),e.color||={argb:`FF638EC6`})})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},Us=class extends N{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}},Ws=class extends B{constructor(){super(),this.map={"xm:f":this.fExtXform=new Us}}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}}},Gs=class extends B{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new Ws,"x14:borderColor":this.borderColorXform=new Mi(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new Mi(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new Mi(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new Mi(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:N.toIntAttribute(t.minLength,0,!0),maxLength:N.toIntAttribute(t.maxLength,100,!0),border:N.toBoolAttribute(t.border,!1),gradient:N.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:N.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:N.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:N.toAttribute(t.axisPosition,`auto`),direction:N.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:N.toIntValue(e.minLength,0),maxLength:N.toIntValue(e.maxLength,100),border:N.toBoolValue(e.border,!1),gradient:N.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:N.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:N.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:N.toStringValue(e.axisPosition,`auto`),direction:N.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}}},Ks=class extends N{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:N.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},qs=class extends B{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new Ws,"x14:cfIcon":this.cfIconXform=new Ks}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:N.toStringAttribute(t.iconSet),reverse:N.toBoolAttribute(t.reverse,!1),showValue:N.toBoolAttribute(t.showValue,!0),custom:N.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:N.toStringValue(e.iconSet,`3TrafficLights`),reverse:N.toBoolValue(e.reverse,!1),showValue:N.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};function V(e){return e.toString(16).padStart(2,`0`)}function Js(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=e;return V(t[0])+V(t[1])+V(t[2])+V(t[3])+`-`+V(t[4])+V(t[5])+`-`+V(t[6])+V(t[7])+`-`+V(t[8])+V(t[9])+`-`+V(t[10])+V(t[11])+V(t[12])+V(t[13])+V(t[14])+V(t[15])}function Ys(){let e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();let t=new Uint8Array(16);if(e?.getRandomValues)return e.getRandomValues(t),Js(t);for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return Js(t)}let Xs={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var Zs=class e extends B{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new Gs,"x14:iconSet":this.iconSetXform=new qs}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?Gs.isExt(e):!!(e.type===`iconSet`&&(e.custom||Xs[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${Ys()}}`.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??`{${Ys()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:N.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},Qs=class extends N{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}},$s=class extends B{constructor(){super(),this.map={"xm:sqref":this.sqRef=new Qs,"x14:cfRule":this.cfRule=new Zs}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(Zs.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(Zs.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}}},ec=class extends B{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new $s}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(Zs.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)}},tc=class extends B{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new ec}}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}},nc=class extends B{constructor(){super(),this.map={ext:this.ext=new tc}}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}};function rc(e){return bo(e.name&&e.extension&&e.name.endsWith(`.${e.extension}`)?e.name:`${e.name}.${e.extension}`)}function ic(e,t,n){let r=[],i=[...t],a={};for(let t of e){let e=String(t.imageId),o=n.getBookImage(t.imageId);if(!o)continue;let s=a[e];s||(s=n.nextRId(i),a[e]=s,i.push({Id:s,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:rc(o)}));let c={picture:{rId:s},range:t.range};if(t.hyperlinks&&t.hyperlinks.hyperlink){let e=n.nextRId(i);c.picture.hyperlinks={tooltip:t.hyperlinks.tooltip,rId:e},i.push({Id:e,Type:z.Hyperlink,Target:t.hyperlinks.hyperlink,TargetMode:`External`})}r.push(c)}return{anchors:r,rels:i}}function ac(e){return e.filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.range?.br&&!e.picture||e.range?.br&&!e.picture&&!e.shape))}let oc=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},sc=(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?oc(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var cc=class e extends N{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"mc:Ignorable":`x14ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r??[],this.map={sheetPr:new is,dimension:new Yo,sheetViews:new P({tag:`sheetViews`,count:!1,childXform:new ss}),sheetFormatPr:new as,cols:new P({tag:`cols`,count:!1,childXform:new Jo}),sheetData:new P({tag:`sheetData`,count:!1,empty:!0,childXform:new qo({maxItems:n}),maxItems:t}),autoFilter:new bs,mergeCells:new P({tag:`mergeCells`,count:!0,childXform:new Xo}),rowBreaks:new Ts,colBreaks:new Es,hyperlinks:new P({tag:`hyperlinks`,count:!1,childXform:new Ho}),pageMargins:new ds,dataValidations:new es,pageSetup:new _s,headerFooter:new Ds,printOptions:new ys,picture:new xs,drawing:new Ss,sheetProtection:new us,tableParts:new P({tag:`tableParts`,count:!0,childXform:new Cs}),conditionalFormatting:new Hs,extLst:new nc}}prepare(e,t){t.merges=new Vo,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],e.formControls&&e.formControls.length>0&&(!e.views||e.views.length===0)&&(e.views=[{workbookViewId:0}]),t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;let n=e.rels=[];function r(e){return`rId${e.length+1}`}e.hyperlinks.forEach(e=>{if(Uo(e.target))return;let t=r(n);e.rId=t,n.push({Id:t,Type:z.Hyperlink,Target:e.target,TargetMode:`External`})});let{fileIndex:i}=e;if(e.comments.length>0){let a={Id:r(n),Type:z.Comments,Target:uo(i)};n.push(a);let o={Id:r(n),Type:z.VmlDrawing,Target:fo(i)};n.push(o),e.comments.forEach(e=>{e.refAddress=w.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${i}`,vmlDrawing:`vmlDrawing${i}`})}if(e.drawing&&e.drawing.anchors){let i=e.drawing;i.rId=r(n),i.name||=`drawing${++t.drawingsCount}`;let a=(i.rels??[]).some(e=>e.Target&&e.Target.includes(`/charts/`));i.anchors=[],a||(i.rels=[]),t.drawings.push(i),n.push({Id:i.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(i.name)})}let a=[],o=[];if(e.media.forEach(e=>{e.type===`background`?a.push(e):e.type===`image`&&o.push(e)}),a.forEach(i=>{let a=r(n),o=t.media[i.imageId];n.push({Id:a,Type:z.Image,Target:rc(o)}),e.background={rId:a},e.image=t.media[i.imageId]}),o.length>0){let{drawing:i}=e;i||(i=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(i),n.push({Id:i.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(i.name)}));let a=ic(o,i.rels,{getBookImage:e=>t.media[e],nextRId:e=>r(e)});i.anchors.push(...a.anchors),i.rels=a.rels}if(e.tables.forEach(e=>{let i=r(n);e.rId=i,n.push({Id:i,Type:z.Table,Target:vo(e.target)}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables??[]).forEach(e=>{n.push({Id:r(n),Type:z.PivotTable,Target:go(e.tableNumber)})}),e.formControls&&e.formControls.length>0){let{drawing:a}=e;a||(a=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(a),n.push({Id:a.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(a.name)})),e.comments.length===0&&n.push({Id:r(n),Type:z.VmlDrawing,Target:fo(i)});let o=e=>({nativeCol:e.col,nativeColOff:e.colOff,nativeRow:e.row,nativeRowOff:e.rowOff});for(let i of e.formControls){let e=t.formControlRefs.length+1;i.ctrlPropId=e;let s=r(n);i.ctrlPropRelId=s,n.push({Id:s,Type:z.CtrlProp,Target:So(e)}),t.formControlRefs.push(e);let c=`Check Box ${Math.max(1,i.shapeId-1024)}`;a.anchors.push({range:{editAs:`absolute`,tl:o(i.tl),br:o(i.br)},alternateContent:{requires:`a14`},shape:{cNvPrId:i.shapeId,name:i.name||c,hidden:!0,spid:`_x0000_s${i.shapeId}`,text:i.text}})}}this.map.extLst.prepare(e,t)}render(t,n){t.openXml(A);let r={...e.WORKSHEET_ATTRIBUTES};n.formControls&&n.formControls.length>0&&(r[`xmlns:x14`]=`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,r[`xmlns:xdr`]=`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,r[`mc:Ignorable`]=`${r[`mc:Ignorable`]} x14`),t.openNode(`worksheet`,r);let i=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow,customHeight:n.properties.customHeight}:void 0;n.properties&&n.properties.defaultColWidth&&(i.defaultColWidth=n.properties.defaultColWidth);let a={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},o=n.pageSetup&&n.pageSetup.margins,s={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},c=n.sheetProtection;if(this.map.sheetPr.render(t,a),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,i),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,c),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,s),this.map.pageMargins.render(t,o),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.colBreaks.render(t,n.colBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),n.rels&&n.rels.forEach(e=>{e.Type===z.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),n.formControls&&n.formControls.length>0){t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`controls`);for(let e of n.formControls){if(!e.ctrlPropRelId)continue;let n=`Check Box ${Math.max(1,e.shapeId-1024)}`;t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`control`,{shapeId:e.shapeId,"r:id":e.ctrlPropRelId,name:e.name||n}),t.openNode(`controlPr`,{locked:0,defaultSize:0,print:e.print?1:0,autoFill:0,autoLine:0,autoPict:0}),t.openNode(`anchor`),t.openNode(`from`),t.leafNode(`xdr:col`,void 0,e.tl.col),t.leafNode(`xdr:colOff`,void 0,e.tl.colOff),t.leafNode(`xdr:row`,void 0,e.tl.row),t.leafNode(`xdr:rowOff`,void 0,e.tl.rowOff),t.closeNode(),t.openNode(`to`),t.leafNode(`xdr:col`,void 0,e.br.col),t.leafNode(`xdr:colOff`,void 0,e.br.colOff),t.leafNode(`xdr:row`,void 0,e.br.row),t.leafNode(`xdr:rowOff`,void 0,e.br.rowOff),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=sc(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r,rowBreaks:this.map.rowBreaks.model??[],colBreaks:this.map.colBreaks.model??[]},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships??[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===z.Comments){let n=t.comments?.[r.Target];n&&(e.comments=n.comments)}if(r.Type===z.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings?.[r.Target];if(n){let t=n.comments;e.comments.forEach((e,n)=>{e.note=Object.assign({},e.note,t[n])})}}return n},{});if(t.commentsMap=(e.comments??[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks??[]).reduce((e,t)=>{if(t.rId){let r=n[t.rId];r&&(e[t.address]=r.Target)}else t.target&&(e[t.address]=t.target);return e},{}),t.formulae={},e.rows){e.rows.includes(void 0)&&(e.rows=e.rows.filter(Boolean));for(let t=0;t<e.rows.length;t++){let n=e.rows[t];n.cells?.includes(void 0)&&(n.cells=n.cells.filter(Boolean))}}else e.rows=[];if(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];if(r){let n=r.Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(n){let r=n[1],i=t.drawings[r];i?(e.drawing={...i,name:r,rels:t.drawingRels?.[r]??i.rels??[]},i.anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}})):e.drawing=void 0}else e.drawing=void 0}else e.drawing=void 0}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})}else e.background&&=void 0;e.tables=(e.tables??[]).reduce((e,r)=>{let i=n[r.rId];if(i){let n=t.tables[i.Target];n&&e.push(n)}return e},[]),e.pivotTables=[],(e.relationships??[]).forEach(n=>{if(n.Type===z.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},lc=class extends N{render(e){e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.openNode(`FeaturePropertyBags`,{xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`}),e.leafNode(`bag`,{type:`Checkbox`}),e.openNode(`bag`,{type:`XFControls`}),e.leafNode(`bagId`,{k:`CellControl`},`0`),e.closeNode(),e.openNode(`bag`,{type:`XFComplement`}),e.leafNode(`bagId`,{k:`XFControls`},`1`),e.closeNode(),e.openNode(`bag`,{type:`XFComplements`,extRef:`XFComplementsMapperExtRef`}),e.openNode(`a`,{k:`MappedFeaturePropertyBags`}),e.leafNode(`bagId`,{},`2`),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}},uc=class extends N{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]}}}},dc=class extends N{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new Pi({tag:`xdr:col`,zero:!0}),"xdr:colOff":new Pi({tag:`xdr:colOff`,zero:!0}),"xdr:row":new Pi({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new Pi({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}}},fc=class extends N{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}}},pc=class extends N{constructor(){super(),this.map={"a:blip":new fc}}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}}},mc=class extends N{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}},hc=class extends N{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}}},gc=class extends N{constructor(){super(),this.map={"a:hlinkClick":new mc,"a:extLst":new hc}}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}}},_c=class extends N{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}}},vc=class extends N{constructor(){super(),this.map={"xdr:cNvPr":new gc,"xdr:cNvPicPr":new _c}}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 yc={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 bc=class extends N{constructor(){super(),this.map={"xdr:nvPicPr":new vc,"xdr:blipFill":new pc,"xdr:spPr":new ji(yc)}}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}}},xc=class extends N{get tag(){return`xdr:sp`}render(e,t){t&&(e.openNode(this.tag,{macro:``,textlink:``}),e.openNode(`xdr:nvSpPr`),e.openNode(`xdr:cNvPr`,{id:t.cNvPrId,name:t.name,hidden:t.hidden?`1`:void 0}),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{63B3BB69-23CF-44E3-9099-C40C66FF867C}`}),e.leafNode(`a14:compatExt`,{spid:t.spid,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`},void 0),e.closeNode(),e.closeNode(),e.closeNode(),e.leafNode(`xdr:cNvSpPr`),e.closeNode(),e.openNode(`xdr:spPr`,{bwMode:`auto`}),e.openNode(`a:xfrm`),e.leafNode(`a:off`,{x:0,y:0}),e.leafNode(`a:ext`,{cx:0,cy:0}),e.closeNode(),e.openNode(`a:prstGeom`,{prst:`rect`}),e.leafNode(`a:avLst`),e.closeNode(),e.leafNode(`a:noFill`),e.openNode(`a:ln`),e.leafNode(`a:noFill`),e.closeNode(),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{909E8E84-426E-40DD-AFC4-6F175D3DCCD1}`}),e.openNode(`a14:hiddenFill`,{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`F0F0F0`}),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`a:ext`,{uri:`{91240B29-F687-4F45-9708-019B960494DF}`}),e.openNode(`a14:hiddenLine`,{w:9525,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:miter`,{lim:8e5}),e.leafNode(`a:headEnd`),e.leafNode(`a:tailEnd`),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`xdr:txBody`),e.leafNode(`a:bodyPr`,{vertOverflow:`clip`,wrap:`square`,lIns:18288,tIns:18288,rIns:0,bIns:18288,anchor:`ctr`,upright:1}),e.leafNode(`a:lstStyle`),e.openNode(`a:p`),e.openNode(`a:pPr`,{algn:`l`,rtl:0}),e.leafNode(`a:defRPr`,{sz:1e3}),e.closeNode(),e.openNode(`a:r`),e.openNode(`a:rPr`,{lang:`en-US`,sz:800,b:0,i:0,u:`none`,strike:`noStrike`,baseline:0}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:latin`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:ea`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:cs`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.closeNode(),e.openNode(`a:t`),e.writeText(t.text??``),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode())}},Sc=class extends uc{constructor(){super(),this.map={"xdr:from":new dc({tag:`xdr:from`}),"xdr:to":new dc({tag:`xdr:to`}),"xdr:pic":new bc,"xdr:sp":new xc,"xdr:clientData":new ji({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){e.picture&&this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){let n=!!t.alternateContent;n&&(e.openNode(`mc:AlternateContent`,{"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`}),e.openNode(`mc:Choice`,{Requires:t.alternateContent?.requires,...t.alternateContent?.requires===`a14`?{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}:{}})),e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),t.picture?this.map[`xdr:pic`].render(e,t.picture):t.shape&&this.map[`xdr:sp`].render(e,t.shape),this.map[`xdr:clientData`].render(e,{}),e.closeNode(),n&&(e.closeNode(),e.leafNode(`mc:Fallback`),e.closeNode())}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};let Cc=9525;var wc=class extends N{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*Cc),r=Math.floor(t.height*Cc);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)/Cc,height:parseInt(e.attributes.cy??`0`,10)/Cc},!0):!1}parseText(e){}parseClose(e){return!1}},Tc=class extends uc{constructor(){super(),this.map={"xdr:from":new dc({tag:`xdr:from`}),"xdr:ext":new wc({tag:`xdr:ext`}),"xdr:pic":new bc,"xdr:clientData":new ji({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 Ec(e){return(typeof e.range==`string`?w.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Dc=class e extends N{constructor(){super(),this.map={"xdr:twoCellAnchor":new Sc,"xdr:oneCellAnchor":new Tc},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Ec(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(A),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`}}},Oc=class extends N{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}},kc=class extends N{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}},Ac=class extends N{constructor(){super(),this.map={customFilters:new P({tag:`customFilters`,count:!1,empty:!0,childXform:new Oc}),filters:new P({tag:`filters`,count:!1,empty:!0,childXform:new kc})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw new _(`filterColumn`,`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}}},jc=class extends N{constructor(){super(),this.map={filterColumn:new Ac},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 new _(`autoFilter`,`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 new _(`autoFilter`,`Unexpected xml node in parseClose: ${e}`)}}},Mc=class extends N{constructor(){super(),this._childText=``,this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}_renderAttributes(e){return{id:e.id.toString(),name:kt(e.name),totalsRowLabel:e.totalsRowLabel?kt(e.totalsRowLabel):void 0,totalsRowFunction:e.totalsRowFunction===`none`?void 0:e.totalsRowFunction,dxfId:e.dxfId}}render(e,t){t.calculatedColumnFormula||t.totalsRowFormula?(e.openNode(this.tag,this._renderAttributes(t)),t.calculatedColumnFormula&&e.leafNode(`calculatedColumnFormula`,void 0,t.calculatedColumnFormula),t.totalsRowFormula&&e.leafNode(`totalsRowFormula`,void 0,t.totalsRowFormula),e.closeNode()):e.leafNode(this.tag,this._renderAttributes(t))}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:Tt(t.name),totalsRowLabel:t.totalsRowLabel?Tt(t.totalsRowLabel):void 0,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return(e.name===`calculatedColumnFormula`||e.name===`totalsRowFormula`)&&(this._childTag=e.name,this._childText=``),!0}parseText(e){this._childTag&&(this._childText+=e)}parseClose(e){return e===this.tag?!1:(this._childTag&&e===this._childTag&&(this.model[this._childTag]=this._childText,this._childTag=void 0),!0)}},Nc=class extends N{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}},Pc=class e extends N{constructor(){super(),this.map={autoFilter:new jc,tableColumns:new P({tag:`tableColumns`,count:!0,empty:!0,childXform:new Mc}),tableStyleInfo:new Nc},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(A),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,headerRowCount:n.headerRow?void 0:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount!==`0`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}};function Fc(e){return isNaN(e.getTime())?``:e.toISOString().replace(/\.\d{3}Z$/,``)}function Ic(e){let t=k(e.name),n=e.numFmtId??`0`,r=Rc(e.extraAttrs),i=e.fieldGroupXml?`\n ${e.fieldGroupXml}`:``;if(e.sharedItems===null){if(e.isLoaded)return i?`<cacheField name="${t}" numFmtId="${n}"${r}>${i}\n </cacheField>`:`<cacheField name="${t}" numFmtId="${n}"${r} />`;let a;return a=e.minValue!==void 0&&e.maxValue!==void 0?` containsSemiMixedTypes="0" containsString="0" containsNumber="1"${e.containsInteger?` containsInteger="1"`:``} minValue="${e.minValue}" maxValue="${e.maxValue}"`:``,`<cacheField name="${t}" numFmtId="${n}"${r}>
|
|
12
|
+
`),t=this.i):yi(i)||(r=!0)}r&&(!this.sawRoot&&!this.reportedTextBeforeRoot&&(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}sOpenWaka(){let e=this.getCode();if(e!==-1){if(xi(e)){this.closedRoot&&!this.fragment&&this.fail(`documents may contain only one root element`),this.state=3,this.name=M(e);return}switch(e){case 47:this.state=11,this.name=``;break;case 33:this.state=2,this.openWakaBang=``;break;case 63:this.state=19,this.text=``;break;default:this.fail(`unexpected character in tag`),this.state=0}}}sOpenWakaBang(){let e=this.getCode();if(e!==-1)switch(this.openWakaBang+=M(e),this.openWakaBang){case`[CDATA[`:this.state=16,this.text=``,this.openWakaBang=``;break;case`--`:this.state=13,this.text=``,this.openWakaBang=``;break;case`DOCTYPE`:this.state=21,this.text=``,this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&(this.fail(`incorrect syntax`),this.state=0)}}sOpenTag(){let{chunk:e}=this,t=this.i,n=this.i;for(;n<e.length;){let t=e.charCodeAt(n);if(t<128?vi[t]===1:Si(t))n++;else break}if(n>=e.length){this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);return}this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);let r=this.getCode();r!==-1&&(this.tag={name:this.name,attributes:Object.create(null),isSelfClosing:!1},this.attribList=[],this.sawRoot=!0,r===62?this.openTag():r===47?this.state=4:(yi(r)||this.fail(`unexpected character in tag`),this.state=5))}sOpenTagSlash(){let e=this.getCode();e!==-1&&(e===62?this.openSelfClosingTag():(this.fail(`expected >`),this.state=5))}sAttrib(){let e=this.skipSpaces();e!==-1&&(xi(e)?(this.name=M(e),this.state=6):e===62?this.openTag():e===47?this.state=4:this.fail(`unexpected character in attribute`))}sAttribName(){let{chunk:e}=this,t=this.i,n=this.i;for(;n<e.length;){let t=e.charCodeAt(n);if(t<128?vi[t]===1:Si(t))n++;else break}if(n>=e.length){this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);return}this.name+=e.slice(t,n),this.i=n,this.trackPosition&&(this.column+=n-t);let r=this.getCode();r!==-1&&(r===61?this.state=8:yi(r)?this.state=7:r===62?(this.fail(`attribute without value`),this.attribList.push({name:this.name,value:this.name}),this.name=``,this.openTag()):this.fail(`unexpected character in attribute name`))}sAttribNameSawWhite(){let e=this.skipSpaces();e!==-1&&(e===61?this.state=8:(this.fail(`attribute without value`),this.name=``,this.text=``,e===62?this.openTag():xi(e)?(this.name=M(e),this.state=6):(this.fail(`unexpected character`),this.state=5)))}sAttribValue(){let e=this.skipSpaces();e!==-1&&(bi(e)?(this.q=e,this.text=``,this.state=9):(this.fail(`unquoted attribute value`),this.state=0))}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this,r=t.length;for(;this.i<r;){let r=t.charCodeAt(this.i);if(r>=32&&r<=126&&r!==e&&r!==38&&r!==60){this.i++,this.trackPosition&&this.column++;continue}if(r===e){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.attribList.push({name:this.name,value:this.text+t.slice(n,this.prevI)}),this.name=``,this.text=``,this.q=null,this.state=10;return}if(r===38){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI),this.state=25,this.entityReturnState=9,this.entity=``;return}if(r===60){this.prevI=this.i,this.i++,this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI),this.fail(`< not allowed in attribute value`),this.attribList.push({name:this.name,value:this.text}),this.name=``,this.text=``,this.q=null,this.unget(),this.state=0;return}if(r===9||r===10){this.prevI=this.i,this.i++,r===10&&this.trackPosition?(this.line++,this.column=0,this.positionAtNewLine=this.position):this.trackPosition&&this.column++,this.text+=t.slice(n,this.prevI)+` `,n=this.i;continue}if(r===13){this.prevI=this.i,this.i++,t.charCodeAt(this.i)===10&&this.i++,this.trackPosition&&(this.line++,this.column=0,this.positionAtNewLine=this.position),this.text+=t.slice(n,this.prevI)+` `,n=this.i;continue}if(this.getCode()===-1){this.text+=t.slice(n,this.i);return}}this.text+=t.slice(n,this.i)}sAttribValueClosed(){let e=this.getCode();e!==-1&&(yi(e)?this.state=5:e===62?this.openTag():e===47?this.state=4:xi(e)?(this.fail(`no whitespace between attributes`),this.name=M(e),this.state=6):this.fail(`unexpected character after attribute`))}sCloseTag(){let{chunk:e}=this,t=this.i;if(this.name===``){if(t>=e.length){let e=this.getCode();if(e===-1)return;xi(e)?this.name=M(e):this.fail(`unexpected character in close tag`);return}let n=e.charCodeAt(t);if(n<128?_i[n]!==1:!xi(n)){this.i=t,this.getCode()!==-1&&this.fail(`unexpected character in close tag`);return}this.name=e[t],t++,this.trackPosition&&this.column++}let n=t;for(;t<e.length;){let n=e.charCodeAt(t);if(n<128?vi[n]===1:Si(n))t++;else break}if(t>n&&(this.name+=e.slice(n,t)),this.trackPosition&&(this.column+=t-n),t>=e.length){this.i=t;return}this.i=t;let r=this.getCode();r!==-1&&(r===62?this.closeTag():yi(r)?this.state=12:this.fail(`unexpected character in close tag`))}sCloseTagSawWhite(){let e=this.skipSpaces();e!==-1&&(e===62?this.closeTag():this.fail(`unexpected character in close tag`))}sComment(){let e=this.getCode();e!==-1&&(e===45?this.state=14:this.text+=M(e))}sCommentEnding(){let e=this.getCode();e!==-1&&(e===45?this.state=15:(this.text+=`-`+M(e),this.state=13))}sCommentEnded(){let e=this.getCode();e!==-1&&(e===62?(this._handlers.comment?.(this.text),this.text=``,this.state=0):e===45?this.text+=`-`:(this.fail(`malformed comment`),this.text+=`--`+M(e),this.state=13))}sCData(){let e=this.getCode();e!==-1&&(e===93?this.state=17:this.text+=M(e))}sCDataEnding(){let e=this.getCode();e!==-1&&(e===93?this.state=18:(this.text+=`]`+M(e),this.state=16))}sCDataEnding2(){let e=this.getCode();e!==-1&&(e===62?(this._handlers.cdata?this._handlers.cdata(this.text):this._handlers.text&&this.text.length>0&&this._handlers.text(this.text),this.text=``,this.state=0):e===93?this.text+=`]`:(this.text+=`]]`+M(e),this.state=16))}sPI(){let e=this.getCode();e!==-1&&(e===63?this.state=20:this.text+=M(e))}sPIEnding(){let e=this.getCode();if(e!==-1)if(e===62){let e=this.text,t=e.indexOf(` `);t>=0?this._handlers.pi?.(e.slice(0,t),e.slice(t+1)):this._handlers.pi?.(e,``),this.text=``,this.state=0}else e===63?this.text+=`?`:(this.text+=`?`+M(e),this.state=19)}sDoctype(){let e=this.getCode();e!==-1&&(e===62?(this.text=``,this.state=0):bi(e)?(this.q=e,this.state=22):e===91?this.state=23:this.text+=M(e))}sDoctypeQuote(){let e=this.getCode();e!==-1&&(e===this.q?(this.q=null,this.state=21):this.text+=M(e))}sDoctypeDTD(){let e=this.getCode();e!==-1&&(e===93?this.state=21:bi(e)&&(this.q=e,this.state=24))}sDoctypeDTDQuoted(){let e=this.getCode();e!==-1&&e===this.q&&(this.q=null,this.state=23)}sEntity(){let e=this.getCode();if(e!==-1)if(e===59){let e=this.entity,t;e===``?(this.fail(`empty entity`),t=`&;`):t=this.parseEntity(e),this.text+=t,this.state=this.entityReturnState,this.entity=``}else Si(e)||e===35?(this.entity+=M(e),this.entity.length>64&&(this.fail(`entity name too long`),this.text+=`&`+this.entity,this.state=this.entityReturnState,this.entity=``)):(this.fail(`invalid entity character`),this.text+=`&`+this.entity+M(e),this.state=this.entityReturnState,this.entity=``)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(`undefined entity: `+e),`&`+e+`;`):this.maxEntityExpansions>0&&e!==`lt`&&e!==`gt`&&e!==`amp`&&e!==`quot`&&e!==`apos`&&(this._entityExpansionCount++,this._entityExpansionCount>this.maxEntityExpansions)?(this.fail(`entity expansion limit (${this.maxEntityExpansions}) exceeded — possible XML bomb`),``):t}let t;return t=e[1]===`x`||e[1]===`X`?parseInt(e.slice(2),16):parseInt(e.slice(1),10),isNaN(t)||t<1||t>=55296&&t<=57343||t>1114111?(this.fail(`invalid character entity: &#`+e.slice(1)+`;`),``):Ci(t)?String.fromCodePoint(t):(this.fail(`invalid character entity`),``)}skipSpaces(){for(;;){let e=this.getCode();if(e===-1||!yi(e))return e}}splitQName(e){let t=e.indexOf(`:`);return t<0?[``,e]:[e.slice(0,t),e.slice(t+1)]}resolveNs(e){for(let t=this._nsStack.length-1;t>=0;t--){let n=this._nsStack[t][e];if(n!==void 0)return n}return``}applyNamespaces(e){let t=`http://www.w3.org/XML/1998/namespace`,n=`http://www.w3.org/2000/xmlns/`,r={},i=e.attributes;for(let e in i)if(Object.prototype.hasOwnProperty.call(i,e)){if(e===`xmlns`)r[``]=i[e];else if(e.startsWith(`xmlns:`)){let a=e.slice(6),o=i[e];a===`xmlns`?this.fail(`the "xmlns" prefix must not be declared`):a===`xml`&&o!==t?this.fail(`the "xml" prefix must be bound to "${t}"`):o===t&&a!==`xml`?this.fail(`namespace "${t}" must only be bound to the "xml" prefix`):o===n&&this.fail(`namespace "${n}" must not be bound to any prefix`),r[a]=o}}this._nsStack.push(r),Object.keys(r).length>0&&(e.ns=r);let[a,o]=this.splitQName(e.name);o.includes(`:`)&&this.fail(`invalid QName "${e.name}": local part must not contain ":"`),e.prefix=a,e.local=o,e.uri=this.resolveNs(a),a!==``&&e.uri===``&&this.fail(`unbound namespace prefix: "${a}"`);let s=new Set;for(let e in i){if(!Object.prototype.hasOwnProperty.call(i,e)||e===`xmlns`||e.startsWith(`xmlns:`))continue;let[t,n]=this.splitQName(e);if(n.includes(`:`)&&this.fail(`invalid attribute QName "${e}": local part must not contain ":"`),t!==``){let e=this.resolveNs(t);e===``&&this.fail(`unbound namespace prefix on attribute: "${t}"`);let r=e+`\0`+n;s.has(r)&&this.fail(`duplicate attribute by expanded name: {${e}}${n}`),s.add(r)}}}openTag(){let e=this.tag;e.isSelfClosing=!1;for(let{name:t,value:n}of this.attribList)t in e.attributes&&this.fail(`duplicate attribute: ${t}`),e.attributes[t]=n;this.attribList=[],this.xmlns&&this.applyNamespaces(e),this.maxDepth>0&&this.tags.length>=this.maxDepth&&this.fail(`maximum element nesting depth (${this.maxDepth}) exceeded`),this._handlers.opentag?.(e),this.tags.push(e),this.name=``,this.state=0}openSelfClosingTag(){let e=this.tag;e.isSelfClosing=!0;for(let{name:t,value:n}of this.attribList)t in e.attributes&&this.fail(`duplicate attribute: ${t}`),e.attributes[t]=n;this.attribList=[],this.xmlns&&this.applyNamespaces(e),this.maxDepth>0&&this.tags.length>=this.maxDepth&&this.fail(`maximum element nesting depth (${this.maxDepth}) exceeded`),this._handlers.opentag?.(e),this._handlers.closetag?.(e),this.xmlns&&this._nsStack.pop(),this.tags.length===0&&(this.closedRoot=!0),this.name=``,this.state=0}closeTag(){let{tags:e,name:t}=this;if(this.state=0,this.name=``,t===``){this.fail(`empty close tag`),this.text+=`</>`;return}let n=!1;for(let r=e.length-1;r>=0;r--)if(e[r].name===t){for(;e.length>r;){let t=e.pop();this._handlers.closetag?.(t),this.xmlns&&this._nsStack.pop(),e.length>r&&this.fail(`unclosed tag: `+t.name)}n=!0;break}n||(this.fail(`unmatched close tag: `+t),this.text+=`</`+t+`>`),e.length===0&&(this.closedRoot=!0)}end(){for(this.sawRoot||this.fail(`document must contain a root element`);this.tags.length>0;){let e=this.tags.pop();this.fail(`unclosed tag: `+e.name)}return this.text.length>0&&this._handlers.text&&(this._handlers.text(this.text),this.text=``),this._closed=!0,this._init(),this}};async function Ei(e,t){let n=new TextDecoder(`utf-8`,{fatal:!0}),r,i=e._handlers?.error;e.on(`error`,e=>{r=e,i?.(e)});for await(let i of t){let t=typeof i==`string`?i:n.decode(i,{stream:!0});if(e.write(t),r)throw r}let a=n.decode();if(a&&e.write(a),e.close(),r)throw r}let Di=new Set([`ep`,`cp`,`dc`,`dcterms`,`dcmitype`,`vt`]);function Oi(e,t){let n=!1;for(let e in t)if(e.length>6&&e.startsWith(`xmlns:`)){let r=e.slice(6);if(t[e]===`http://schemas.openxmlformats.org/spreadsheetml/2006/main`)return r;Di.has(r)&&(n=!0)}if(n)return null;let r=e.indexOf(`:`);return r!==-1&&Di.has(e.slice(0,r))?null:void 0}function ki(e,t){let n=e.indexOf(`:`);if(n===-1)return e;let r=e.slice(0,n);return r===t||Di.has(r)?e.slice(n+1):e}var N=class e{prepare(e,t){}render(e,t){}parseOpen(e){}parseText(e){}parseClose(e){return!1}reconcile(e,t){}reset(){this.model=void 0,this.map&&Object.values(this.map).forEach(t=>{t instanceof e?t.reset():t.xform&&t.xform.reset()})}mergeModel(e){this.model=Object.assign(this.model||{},e)}async parse(e){let t=!1,n,r=0,i=null;for await(let a of e)if(!t){for(let{eventType:e,value:o}of a)if(e===`opentag`){if(r===1){this.parseOpen(o);continue}if(r===0){let e=Oi(o.name,o.attributes);if(e===void 0){r=1,this.parseOpen(o);continue}r=2,i=e}let e=ki(o.name,i);e===o.name?this.parseOpen(o):this.parseOpen({name:e,attributes:o.attributes,isSelfClosing:o.isSelfClosing})}else if(e===`text`)this.parseText(o);else if(e===`closetag`){if(r===1){if(!this.parseClose(o.name)){t=!0,n=this.model;break}continue}if(!this.parseClose(ki(o.name,i))){t=!0,n=this.model;break}}}return t?n:this.model}async parseStreamDirect(e){let t=new Ti,n=new TextDecoder(`utf-8`,{fatal:!0}),r=!1,i,a=0,o=null,s;t.on(`error`,e=>{r||(s=e)}),t.on(`opentag`,e=>{if(r)return;if(a===1){this.parseOpen(e);return}if(a===0){let t=Oi(e.name,e.attributes);if(t===void 0){a=1,this.parseOpen(e);return}a=2,o=t}let t=ki(e.name,o);t===e.name?this.parseOpen(e):this.parseOpen({name:t,attributes:e.attributes,isSelfClosing:e.isSelfClosing})}),t.on(`text`,e=>{r||this.parseText(e)}),t.on(`closetag`,e=>{if(r)return;let t=a===2?ki(e.name,o):e.name;this.parseClose(t)||(r=!0,i=this.model)});for await(let i of e){if(r)continue;let e=typeof i==`string`?i:n.decode(i,{stream:!0});if(t.write(e),s)throw s}if(!r){let e=n.decode();if(e&&(t.write(e),s)||(t.close(),s))throw s}return r?i:this.model}async parseStream(e){return this.parseStreamDirect(e)}get xml(){return this.toXml(this.model)}toXml(e){let t=new hi;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 Ai(e,t){e.openNode(t.tag,t.$),t.c&&t.c.forEach(t=>{Ai(e,t)}),t.t&&e.writeText(t.t),e.closeNode()}var ji=class extends N{constructor(e){super(),this._model=e}render(e){if(!this._xml){let e=new hi;Ai(e,this._model),this._xml=e.xml}e.writeRaw(this._xml)}parseOpen(){return!0}parseText(){}parseClose(e){switch(e){case this._model.tag:return!1;default:return!0}}},P=class extends N{constructor(e){super(),this.tag=e.tag,this.always=!!e.always,this.count=e.count,this.empty=e.empty,this.$count=e.$count??`count`,this.$=e.$,this.childXform=e.childXform,this.maxItems=e.maxItems}prepare(e,t){let{childXform:n}=this;e&&e.forEach((e,r)=>{t.index=r,n.prepare(e,t)})}render(e,t){if(this.always||t&&t.length){e.openNode(this.tag,this.$),this.count&&e.addAttribute(this.$count,t?.length??0);let{childXform:n}=this;(t??[]).forEach((t,r)=>{n.render(e,t,r)}),e.closeNode()}else this.empty&&e.leafNode(this.tag)}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model=[],!0):this.childXform.parseOpen(e)?(this.parser=this.childXform,!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)&&(this.model.push(this.parser.model),this.parser=void 0,this.maxItems&&this.model.length>this.maxItems))throw new te(this.childXform.tag,this.maxItems);return!0}return!1}reconcile(e,t){if(e){let{childXform:n}=this;e.forEach(e=>{n.reconcile(e,t)})}}reset(){super.reset(),this.childXform&&this.childXform.reset()}},Mi=class extends N{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}},Ni=class extends N{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}},Pi=class extends N{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}},F=class extends N{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}},Fi=class e extends N{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}},Ii=class e extends N{constructor(t){super(),this.options=t||e.OPTIONS;let n=[{tag:`b`,prop:`bold`,xform:new Ni({tag:`b`,attr:`val`})},{tag:`i`,prop:`italic`,xform:new Ni({tag:`i`,attr:`val`})},{tag:`u`,prop:`underline`,xform:new Fi},{tag:`strike`,prop:`strike`,xform:new Ni({tag:`strike`,attr:`val`})},{tag:`condense`,prop:`condense`,xform:new Ni({tag:`condense`,attr:`val`})},{tag:`extend`,prop:`extend`,xform:new Ni({tag:`extend`,attr:`val`})},{tag:`outline`,prop:`outline`,xform:new Ni({tag:`outline`,attr:`val`})},{tag:`shadow`,prop:`shadow`,xform:new Ni({tag:`shadow`,attr:`val`})},{tag:`sz`,prop:`size`,xform:new Pi({tag:`sz`,attr:`val`})},{tag:`color`,prop:`color`,xform:new Mi},{tag:this.options.fontNameTag,prop:`name`,xform:new F({tag:this.options.fontNameTag,attr:`val`})},{tag:`family`,prop:`family`,xform:new Pi({tag:`family`,attr:`val`})},{tag:`scheme`,prop:`scheme`,xform:new F({tag:`scheme`,attr:`val`})},{tag:`charset`,prop:`charset`,xform:new Pi({tag:`charset`,attr:`val`})},{tag:`vertAlign`,prop:`vertAlign`,xform:new F({tag:`vertAlign`,attr:`val`})}];this.map=Object.fromEntries(n.map(e=>[e.tag,{prop:e.prop,xform:e.xform}])),this.renderOrder=n.map(e=>e.tag)}get tag(){return this.options.tagName}render(e,t){let{map:n,renderOrder:r}=this;e.openNode(this.options.tagName),r.forEach(r=>{n[r].xform.render(e,t[n[r].prop])}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(this.map[e.name])return this.parser=this.map[e.name].xform,this.parser.parseOpen(e);switch(e.name){case this.options.tagName:return this.model={},!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser&&!this.parser.parseClose(e)){let t=this.map[e];return this.parser.model&&(this.model[t.prop]=this.parser.model),this.parser=void 0,!0}switch(e){case this.options.tagName:return!1;default:return!0}}static{this.OPTIONS={tagName:`font`,fontNameTag:`name`}}},Li=class extends N{constructor(){super(),this.map={color:new Mi}}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}},Ri=class extends N{constructor(){super(),this.map={fgColor:new Mi(`fgColor`),bgColor:new Mi(`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}},zi=class extends N{constructor(){super(),this.map={stop:new Li}}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}},Bi=class e extends N{constructor(){super(),this.map={patternFill:new Ri,gradientFill:new zi}}get tag(){return`fill`}render(e,t){t.type!==`pattern`&&t.type!==`gradient`||(e.openNode(`fill`),t.type===`pattern`?this.map.patternFill.render(e,t):this.map.gradientFill.render(e,t),e.closeNode())}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=Li}static{this.PatternFillXform=Ri}static{this.GradientFillXform=zi}},Vi=class e extends N{constructor(e){super(),this.name=e,this.map={color:new Mi}}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),{})}},Hi=class extends N{constructor(){super(),this.map={top:new Vi(`top`),left:new Vi(`left`),bottom:new Vi(`bottom`),right:new Vi(`right`),diagonal:new Vi(`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=It(e.attributes.diagonalUp),this.diagonalDown=It(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 Ui={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 Wi(){let e={};return Object.entries(Ui).forEach(([t,n])=>{n.f&&(e[n.f]=parseInt(t,10))}),e}let Gi=null;function Ki(){return Gi||=Wi(),Gi}var qi=class extends N{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 Ki()[e]}static getDefaultFmtCode(e){return Ui[e]&&Ui[e].f}};let Ji={ReadingOrder:{LeftToRight:1,RightToLeft:2}},Yi={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=At(e);return t!==void 0&&t>=-90&&t<=90?t:void 0}}},indent(e){let t=At(e);return Math.max(0,t)},readingOrder(e){switch(e){case`ltr`:return Ji.ReadingOrder.LeftToRight;case`rtl`:return Ji.ReadingOrder.RightToLeft;default:return}}},Xi={toXml(e){let t=Yi.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=At(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 Zi=class extends N{get tag(){return`alignment`}render(e,t){let n={};function r(e,t){t&&(n[e]=t)}r(`horizontal`,Yi.horizontal(t.horizontal)),r(`vertical`,Yi.vertical(t.vertical)),r(`wrapText`,Yi.wrapText(t.wrapText)?`1`:!1),r(`shrinkToFit`,Yi.shrinkToFit(t.shrinkToFit)?`1`:!1),r(`indent`,Yi.indent(t.indent)),r(`textRotation`,Xi.toXml(t.textRotation)),r(`readingOrder`,Yi.readingOrder(t.readingOrder)),Object.keys(n).length>0&&e.leafNode(`alignment`,n)}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`,It(e.attributes.wrapText)),r(e.attributes.shrinkToFit,`shrinkToFit`,It(e.attributes.shrinkToFit)),r(e.attributes.indent,`indent`,parseInt(e.attributes.indent,10)),r(e.attributes.textRotation,`textRotation`,Xi.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 Qi={boolean(e,t){return e===void 0?t:e}};var $i=class extends N{get tag(){return`protection`}render(e,t){let n={},r=Qi.boolean(t.locked,!0)?void 0:`0`,i=Qi.boolean(t.hidden,!1)?`1`:void 0;r!==void 0&&(n.locked=r),i!==void 0&&(n.hidden=i),Object.keys(n).length>0&&e.leafNode(`protection`,n)}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}},ea=class extends N{constructor(e){super(),this.xfId=!!(e&&e.xfId),this.map={alignment:new Zi,protection:new $i}}get tag(){return`xf`}render(e,t){e.openNode(`xf`,{numFmtId:t.numFmtId??0,fontId:t.fontId??0,fillId:t.fillId??0,borderId:t.borderId??0}),this.xfId&&e.addAttribute(`xfId`,t.xfId??0),(t.applyNumberFormat||t.numFmtId)&&e.addAttribute(`applyNumberFormat`,`1`),(t.applyFont||t.fontId)&&e.addAttribute(`applyFont`,`1`),(t.applyFill||t.fillId)&&e.addAttribute(`applyFill`,`1`),(t.applyBorder||t.borderId)&&e.addAttribute(`applyBorder`,`1`),(t.applyAlignment||t.alignment)&&e.addAttribute(`applyAlignment`,`1`),(t.applyProtection||t.protection)&&e.addAttribute(`applyProtection`,`1`),t.pivotButton&&e.addAttribute(`pivotButton`,`1`),t.alignment&&this.map.alignment.render(e,t.alignment),t.protection&&this.map.protection.render(e,t.protection),t.checkbox&&t.xfComplementIndex!==void 0&&(e.openNode(`extLst`),e.openNode(`ext`,{"xmlns:xfpb":`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`,uri:`{C7286773-470A-42A8-94C5-96B5CB345126}`}),e.leafNode(`xfpb:xfComplement`,{i:t.xfComplementIndex}),e.closeNode(),e.closeNode()),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`xf`:this.model={numFmtId:parseInt(e.attributes.numFmtId,10),fontId:parseInt(e.attributes.fontId,10),fillId:parseInt(e.attributes.fillId,10),borderId:parseInt(e.attributes.borderId,10)},this.xfId&&(this.model.xfId=parseInt(e.attributes.xfId,10)),e.attributes.pivotButton===`1`&&(this.model.pivotButton=!0);for(let t of[`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e.attributes[t]===`1`&&(this.model[t]=!0);return!0;case`alignment`:return this.parser=this.map.alignment,this.parser.parseOpen(e),!0;case`protection`:return this.parser=this.map.protection,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?(this.parser.parseClose(e)||(this.map.protection===this.parser?this.model.protection=this.parser.model:this.model.alignment=this.parser.model,this.parser=void 0),!0):e!==`xf`}},ta=class extends N{constructor(){super(),this.map={alignment:new Zi,border:new Hi,fill:new Bi,font:new Ii,numFmt:new qi,protection:new $i}}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}},na=class e extends N{constructor(t){super(),this.map={numFmts:new P({tag:`numFmts`,count:!0,childXform:new qi}),fonts:new P({tag:`fonts`,count:!0,childXform:new Ii,$:{"x14ac:knownFonts":1}}),fills:new P({tag:`fills`,count:!0,childXform:new Bi}),borders:new P({tag:`borders`,count:!0,childXform:new Hi}),cellStyleXfs:new P({tag:`cellStyleXfs`,count:!0,childXform:new ea}),cellXfs:new P({tag:`cellXfs`,count:!0,childXform:new ea({xfId:!0})}),dxfs:new P({tag:`dxfs`,always:!0,count:!0,childXform:new ta}),numFmt:new qi,font:new Ii,fill:new Bi,border:new Hi,style:new ea({xfId:!0}),cellStyles:e.STATIC_XFORMS.cellStyles,tableStyles:e.STATIC_XFORMS.tableStyles,extLst:e.STATIC_XFORMS.extLst},t&&this.init()}initIndex(){this.index={style:{},numFmt:{},numFmtNextId:164,font:{},border:{},fill:{}}}init(){this.model={styles:[],numFmts:[],fonts:[],borders:[],fills:[],dxfs:[]},this.initIndex(),this._addBorder({}),this._addStyle({numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}),this._addFill({type:`pattern`,pattern:`none`}),this._addFill({type:`pattern`,pattern:`gray125`}),this.weakMap=new WeakMap,this._hasCheckboxes=!1}setDefaultFont(e){this.defaultFont=e}render(t,n){let r=n||this.model;t.openXml(A),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.writeRaw(e)}),t.closeNode()),r.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`}),t.openNode(`fonts`,{count:r.fonts.length,"x14ac:knownFonts":1}),r.fonts.forEach(e=>{t.writeRaw(e)}),t.closeNode(),t.openNode(`fills`,{count:r.fills.length}),r.fills.forEach(e=>{t.writeRaw(e)}),t.closeNode(),t.openNode(`borders`,{count:r.borders.length}),r.borders.forEach(e=>{t.writeRaw(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.writeRaw(e)}),t.closeNode()):(this.map.numFmts.render(t,r.numFmts),this.map.fonts.render(t,r.fonts),this.map.fills.render(t,r.fills),this.map.borders.render(t,r.borders),this.map.cellStyleXfs.render(t,[{numFmtId:0,fontId:0,fillId:0,borderId:0,xfId:0}]),this.map.cellXfs.render(t,r.styles)),e.STATIC_XFORMS.cellStyles.render(t),this.map.dxfs.render(t,r.dxfs),e.STATIC_XFORMS.tableStyles.render(t),e.STATIC_XFORMS.extLst.render(t),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`styleSheet`:return this.initIndex(),!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`styleSheet`:{this.model={};let e=(e,t)=>{t.model&&t.model.length&&(this.model[e]=t.model)};if(e(`numFmts`,this.map.numFmts),e(`fonts`,this.map.fonts),e(`fills`,this.map.fills),e(`borders`,this.map.borders),e(`styles`,this.map.cellXfs),e(`dxfs`,this.map.dxfs),this.map.fonts.model&&this.map.fonts.model.length>0&&(this.defaultFont=this.map.fonts.model[0]),this.index={model:[],numFmt:{}},this.model.numFmts){let e=this.index.numFmt;this.model.numFmts.forEach(t=>{e[t.id]=t.formatCode})}return!1}default:return!0}}addStyleModel(e,t){if(!e)return 0;this.model.fonts.length||this._addFont(this.defaultFont||{size:11,color:{theme:1},name:`Calibri`,family:2,scheme:`minor`});let n=t||D.ValueType.Number;if(n!==D.ValueType.Checkbox&&this.weakMap&&this.weakMap.has(e))return this.weakMap.get(e);let r={};if(e.numFmt)r.numFmtId=this._addNumFmtStr(e.numFmt);else switch(n){case D.ValueType.Number:r.numFmtId=this._addNumFmtStr(`General`);break;case D.ValueType.Date:r.numFmtId=this._addNumFmtStr(`mm-dd-yy`);break;default:break}e.font&&(r.fontId=this._addFont(e.font)),e.border&&(r.borderId=this._addBorder(e.border)),e.fill&&(r.fillId=this._addFill(e.fill)),e.alignment&&(r.alignment=e.alignment),e.protection&&(r.protection=e.protection);for(let t of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])e[t]&&(r[t]=!0);n===D.ValueType.Checkbox&&(this._hasCheckboxes=!0,r.alignment=r.alignment||{},r.checkbox=!0,r.xfComplementIndex=0);let i=this._addStyle(r);return n!==D.ValueType.Checkbox&&this.weakMap&&this.weakMap.set(e,i),i}getStyleModel(e){let t=this.model.styles[e];if(!t)return null;let n=this.index.model[e];if(n)return n;if(n=this.index.model[e]={},t.numFmtId){let e=this.index.numFmt[t.numFmtId]||qi.getDefaultFmtCode(t.numFmtId);e&&(n.numFmt=e)}function r(e,t,r){if(r||r===0){let i=t[r];i&&(n[e]=i)}}r(`font`,this.model.fonts,t.fontId),r(`border`,this.model.borders,t.borderId),r(`fill`,this.model.fills,t.fillId),t.alignment&&(n.alignment=t.alignment),t.protection&&(n.protection=t.protection);for(let e of[`pivotButton`,`applyNumberFormat`,`applyFont`,`applyFill`,`applyBorder`,`applyAlignment`,`applyProtection`])t[e]&&(n[e]=!0);return n}addDxfStyle(e){return e.numFmt&&(e.numFmtId=this._addNumFmtStr(e.numFmt)),this.model.dxfs.push(e),this.model.dxfs.length-1}getDxfStyle(e){return this.model.dxfs[e]}get hasCheckboxes(){return!!this._hasCheckboxes}_addStyle(e){let t=this.map.style.toXml(e),n=this.index.style[t];return n===void 0&&(n=this.index.style[t]=this.model.styles.length,this.model.styles.push(t)),n}_addNumFmtStr(e){let t=qi.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 ji({tag:`cellStyles`,$:{count:1},c:[{tag:`cellStyle`,$:{name:`Normal`,xfId:0,builtinId:0}}]}),dxfs:new ji({tag:`dxfs`,$:{count:0}}),tableStyles:new ji({tag:`tableStyles`,$:{count:0,defaultTableStyle:`TableStyleMedium2`,defaultPivotStyle:`PivotStyleLight16`}}),extLst:new ji({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`}}]}]})}}};na.Mock=class extends na{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 D.ValueType.Checkbox:throw new v(`Checkbox cells`,`require styles to be enabled (useStyles: true)`);case D.ValueType.Date:return this.dateStyleId;default:return 0}}get hasCheckboxes(){return!1}get dateStyleId(){if(!this._dateStyleId){let e={numFmtId:qi.getDefaultFmtId(`mm-dd-yy`)};this._dateStyleId=this.model.styles.length,this.model.styles.push(e)}return this._dateStyleId}getStyleModel(){return{}}};var ra=class extends N{constructor(e){super(),this.tag=e.tag,this.attr=e.attr,this.attrs=e.attrs,this.text=[],this._format=e.format||function(e){try{return Number.isNaN(e.getTime())?``:e.toISOString()}catch{return``}},this._parse=e.parse||function(e){return new Date(e)}}render(e,t){t&&(e.openNode(this.tag),this.attrs&&e.addAttributes(this.attrs),this.attr?e.addAttribute(this.attr,this._format(t)):e.writeText(this._format(t)),e.closeNode())}parseOpen(e){e.name===this.tag&&(this.attr?this.model=this._parse(e.attributes[this.attr]):this.text=[])}parseText(e){this.attr||this.text.push(e)}parseClose(){return this.attr||(this.model=this._parse(this.text.join(``))),!1}};let I={creator:`dc:creator`,title:`dc:title`,subject:`dc:subject`,description:`dc:description`,identifier:`dc:identifier`,language:`dc:language`,keywords:`cp:keywords`,category:`cp:category`,lastModifiedBy:`cp:lastModifiedBy`,lastPrinted:`cp:lastPrinted`,revision:`cp:revision`,version:`cp:version`,contentStatus:`cp:contentStatus`,contentType:`cp:contentType`,created:`dcterms:created`,modified:`dcterms:modified`};var ia=class e extends N{constructor(){super(),this.map={creator:new F({tag:I.creator}),title:new F({tag:I.title}),subject:new F({tag:I.subject}),description:new F({tag:I.description}),identifier:new F({tag:I.identifier}),language:new F({tag:I.language}),keywords:new F({tag:I.keywords}),category:new F({tag:I.category}),lastModifiedBy:new F({tag:I.lastModifiedBy}),lastPrinted:new ra({tag:I.lastPrinted,format:e.DateFormat}),revision:new Pi({tag:I.revision}),version:new F({tag:I.version}),contentStatus:new F({tag:I.contentStatus}),contentType:new F({tag:I.contentType}),created:new ra({tag:I.created,attrs:e.DateAttrs,format:e.DateFormat}),modified:new ra({tag:I.modified,attrs:e.DateAttrs,format:e.DateFormat})}}render(t,n){t.openXml(A),t.openNode(`cp:coreProperties`,e.CORE_PROPERTY_ATTRIBUTES);for(let e of Object.keys(I))this.map[e].render(t,n[e]);t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):(e.name!==`coreProperties`&&(this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;if(e===`coreProperties`){this.model={};for(let e of Object.keys(I)){let t=this.map[e].model;t!==void 0&&t!==``&&(this.model[e]=t)}return!1}return!0}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.CORE_PROPERTY_ATTRIBUTES={"xmlns:cp":`http://schemas.openxmlformats.org/package/2006/metadata/core-properties`,"xmlns:dc":`http://purl.org/dc/elements/1.1/`,"xmlns:dcterms":`http://purl.org/dc/terms/`,"xmlns:dcmitype":`http://purl.org/dc/dcmitype/`,"xmlns:xsi":`http://www.w3.org/2001/XMLSchema-instance`}}},aa=class extends N{get tag(){return`t`}render(e,t){e.openNode(`t`),/^\s|\n|\s$/.test(t)&&e.addAttribute(`xml:space`,`preserve`),e.writeText(Et(t)),e.closeNode()}parseOpen(e){return e.name===`t`?(this.model=``,!0):!1}parseText(e){this.model=this.model?this.model+e:e}parseClose(){let e=this.model;return e.includes(`_x`)&&(this.model=Tt(e)),!1}},oa=class e extends N{constructor(e){super(),this.model=e}get tag(){return`r`}get textXform(){return this._textXform||=new aa}get fontXform(){return this._fontXform||=new Ii(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`}}},sa=class extends N{constructor(){super(),this.map={r:new oa,t:new aa}}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}}},ca=class extends N{constructor(e){super(),this.model=e,this.map={r:new oa,t:new aa,rPh:new sa}}get tag(){return`si`}render(e,t){e.openNode(this.tag),t&&typeof t==`object`&&Object.prototype.hasOwnProperty.call(t,`richText`)&&t.richText?t.richText.length?t.richText.forEach(t=>{this.map.r.render(e,t)}):this.map.t.render(e,``):t!=null&&this.map.t.render(e,t),e.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===this.tag?(this.model={},!0):(this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){switch(e){case`r`:{let e=this.model.richText;e||=this.model.richText=[],e.push(this.parser.model);break}case`t`:this.model=this.parser.model;break;default:break}this.parser=void 0}return!0}switch(e){case this.tag:return!1;default:return!0}}},la=class extends N{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 ca}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(A),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 new _(`sharedStrings`,`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 new _(`sharedStrings`,`Unexpected xml node in parseClose: ${e}`)}}},ua=class extends N{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}},da=class e extends N{constructor(){super(),this.map={Relationship:new ua}}render(t,n){let r=n||this._values;t.openXml(A),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 new _(`Relationships`,`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 new _(`Relationships`,`Unexpected xml node in parseClose: ${e}`)}}static{this.RELATIONSHIPS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/relationships`}}};let L={contentTypes:`[Content_Types].xml`,rootRels:`_rels/.rels`,docPropsApp:`docProps/app.xml`,docPropsCore:`docProps/core.xml`,xlWorkbook:`xl/workbook.xml`,xlWorkbookRels:`xl/_rels/workbook.xml.rels`,xlSharedStrings:`xl/sharedStrings.xml`,xlStyles:`xl/styles.xml`,xlTheme1:`xl/theme/theme1.xml`,xlFeaturePropertyBag:`xl/featurePropertyBag/featurePropertyBag.xml`},fa=/^xl\/worksheets\/sheet(\d+)[.]xml$/,pa=/^xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels$/,ma=/^xl\/theme\/[a-zA-Z0-9]+[.]xml$/,ha=/^xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/,ga=/^xl\/drawings\/(drawing\d+)[.]xml$/,_a=/^xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels$/,va=/^xl\/drawings\/(vmlDrawing\d+)[.]vml$/,ya=/^xl\/comments(\d+)[.]xml$/,ba=/^xl\/tables\/(table\d+)[.]xml$/,xa=/^xl\/pivotTables\/(pivotTable\d+)[.]xml$/,Sa=/^xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels$/,Ca=/^xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml$/,wa=/^xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels$/,Ta=/^xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml$/;function Ea(e){return e.startsWith(`/`)?e.slice(1):e}function Da(e){let t=fa.exec(e);if(t)return parseInt(t[1],10)}function Oa(e){let t=pa.exec(e);if(t)return parseInt(t[1],10)}function ka(e){return e.startsWith(`xl/media/`)}function Aa(e){let t=ha.exec(e);return t?t[1]:void 0}function ja(e){return ma.test(e)}function Ma(e){let t=/^xl\/theme\/([a-zA-Z0-9]+)[.]xml$/.exec(e);return t?t[1]:void 0}function Na(e){return ka(e)||ja(e)}function Pa(e){let t=ga.exec(e);return t?t[1]:void 0}function Fa(e){let t=_a.exec(e);return t?t[1]:void 0}function Ia(e){let t=va.exec(e);return t?t[1]:void 0}function La(e){let t=ya.exec(e);return t?t[1]:void 0}function Ra(e){let t=ba.exec(e);return t?t[1]:void 0}function za(e){let t=xa.exec(e);return t?t[1]:void 0}function Ba(e){let t=Sa.exec(e);return t?t[1]:void 0}function Va(e){let t=Ca.exec(e);return t?t[1]:void 0}function Ha(e){let t=wa.exec(e);return t?t[1]:void 0}function Ua(e){let t=Ta.exec(e);return t?t[1]:void 0}function R(e){return e.startsWith(`/`)?e:`/${e}`}function Wa(e){return`xl/theme/${e}.xml`}function Ga(e){return`xl/media/${e}`}function Ka(e){return`xl/worksheets/sheet${e}.xml`}function qa(e){return`xl/worksheets/_rels/sheet${e}.xml.rels`}function Ja(e){return`worksheets/sheet${e}.xml`}function Ya(e){return`xl/comments${e}.xml`}function Xa(e){return`xl/${e}.xml`}function Za(e){return`xl/drawings/vmlDrawing${e}.vml`}function Qa(e){return`xl/tables/${e}`}function $a(e){return`xl/drawings/${e}.xml`}function eo(e){return`xl/drawings/_rels/${e}.xml.rels`}function to(e){return`xl/pivotCache/pivotCacheDefinition${e}.xml`}function no(e){return`xl/pivotCache/_rels/pivotCacheDefinition${e}.xml.rels`}function ro(e){return`xl/pivotCache/pivotCacheRecords${e}.xml`}function io(e){return`pivotCacheRecords${e}.xml`}function ao(e){return`xl/pivotTables/pivotTable${e}.xml`}function oo(e){return`xl/pivotTables/_rels/pivotTable${e}.xml.rels`}function so(e){return`../pivotCache/pivotCacheDefinition${e}.xml`}let co={workbookStyles:`styles.xml`,workbookSharedStrings:`sharedStrings.xml`,workbookTheme1:`theme/theme1.xml`,workbookFeaturePropertyBag:`featurePropertyBag/featurePropertyBag.xml`};function lo(e){return`pivotCache/pivotCacheDefinition${e}.xml`}function uo(e){return`../comments${e}.xml`}function fo(e){return`../drawings/vmlDrawing${e}.vml`}function po(e){return`../drawings/${e}.xml`}function mo(e){return`../drawings/${e}.vml`}function ho(e){return`../${e}.xml`}function go(e){return`../pivotTables/pivotTable${e}.xml`}function _o(e){return`../pivotTables/${e}.xml`}function vo(e){return`../tables/${e}`}function yo(e){return`../tables/${e}.xml`}function bo(e){return`../media/${e}`}function xo(e){return`xl/ctrlProps/ctrlProp${e}.xml`}function So(e){return`../ctrlProps/ctrlProp${e}.xml`}var Co=class e extends N{render(t,n){t.openXml(A),t.openNode(`Types`,e.PROPERTY_ATTRIBUTES);let r={};if((n.media??[]).forEach(e=>{if(e.type===`image`){let n=e.extension;r[n]||(r[n]=!0,t.leafNode(`Default`,{Extension:n,ContentType:`image/${n}`}))}}),t.leafNode(`Default`,{Extension:`rels`,ContentType:`application/vnd.openxmlformats-package.relationships+xml`}),t.leafNode(`Default`,{Extension:`xml`,ContentType:`application/xml`}),t.leafNode(`Override`,{PartName:R(L.xlWorkbook),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml`}),n.worksheets.forEach(e=>{t.leafNode(`Override`,{PartName:R(Ka(e.fileIndex)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml`})}),(n.pivotTables??[]).length){let e=new Set;(n.pivotTables??[]).forEach(n=>{let r=n.tableNumber,i=n.cacheId;e.has(i)||(e.add(i),t.leafNode(`Override`,{PartName:R(to(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheDefinition+xml`}),(!n.isLoaded||n.cacheRecords)&&t.leafNode(`Override`,{PartName:R(ro(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotCacheRecords+xml`})),t.leafNode(`Override`,{PartName:R(ao(r)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.pivotTable+xml`})})}t.leafNode(`Override`,{PartName:R(L.xlTheme1),ContentType:`application/vnd.openxmlformats-officedocument.theme+xml`}),t.leafNode(`Override`,{PartName:R(L.xlStyles),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml`}),n.hasCheckboxes&&t.leafNode(`Override`,{PartName:R(L.xlFeaturePropertyBag),ContentType:`application/vnd.ms-excel.featurepropertybag+xml`}),n.sharedStrings&&n.sharedStrings.count&&t.leafNode(`Override`,{PartName:R(L.xlSharedStrings),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml`}),n.tables&&n.tables.forEach(e=>{t.leafNode(`Override`,{PartName:R(Qa(e.target)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.table+xml`})}),n.drawings&&n.drawings.forEach(e=>{t.leafNode(`Override`,{PartName:R($a(e.name)),ContentType:`application/vnd.openxmlformats-officedocument.drawing+xml`})});let i=n.commentRefs&&n.commentRefs.length>0,a=n.formControlRefs&&n.formControlRefs.length>0;if((i||a)&&t.leafNode(`Default`,{Extension:`vml`,ContentType:`application/vnd.openxmlformats-officedocument.vmlDrawing`}),i&&n.commentRefs.forEach(({commentName:e})=>{t.leafNode(`Override`,{PartName:R(Xa(e)),ContentType:`application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml`})}),a)for(let e of n.formControlRefs)t.leafNode(`Override`,{PartName:R(xo(e)),ContentType:`application/vnd.ms-excel.controlproperties+xml`});if(n.passthroughContentTypes)for(let{partName:e,contentType:r}of n.passthroughContentTypes)t.leafNode(`Override`,{PartName:R(e),ContentType:r});t.leafNode(`Override`,{PartName:R(L.docPropsCore),ContentType:`application/vnd.openxmlformats-package.core-properties+xml`}),t.leafNode(`Override`,{PartName:R(L.docPropsApp),ContentType:`application/vnd.openxmlformats-officedocument.extended-properties+xml`}),t.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/package/2006/content-types`}}},wo=class extends N{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`}},To=class extends N{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`}},Eo=class e extends N{constructor(){super(),this.map={Company:new F({tag:`Company`}),Manager:new F({tag:`Manager`}),HeadingPairs:new wo,TitlesOfParts:new To}}render(t,n){t.openXml(A),t.openNode(`Properties`,e.PROPERTY_ATTRIBUTES),t.leafNode(`Application`,void 0,`Microsoft Excel`),t.leafNode(`DocSecurity`,void 0,`0`),t.leafNode(`ScaleCrop`,void 0,`false`),this.map.HeadingPairs.render(t,n.worksheets),this.map.TitlesOfParts.render(t,n.worksheets),this.map.Company.render(t,n.company??``),this.map.Manager.render(t,n.manager),t.leafNode(`LinksUpToDate`,void 0,`false`),t.leafNode(`SharedDoc`,void 0,`false`),t.leafNode(`HyperlinksChanged`,void 0,`false`),t.leafNode(`AppVersion`,void 0,`16.0300`),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`Properties`:return!0;default:return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`Properties`:return this.model={worksheets:this.map.TitlesOfParts.model,company:this.map.Company.model,manager:this.map.Manager.model},!1;default:return!0}}static{this.DateFormat=function(e){return e.toISOString().replace(/[.]\d{3,6}/,``)}}static{this.DateAttrs={"xsi:type":`dcterms:W3CDTF`}}static{this.PROPERTY_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/officeDocument/2006/extended-properties`,"xmlns:vt":`http://schemas.openxmlformats.org/officeDocument/2006/docPropsVTypes`}}},Do=class extends N{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:Mo(this._parsedText.join(``))},this._parsedLocalSheetId!==void 0&&(this.model.localSheetId=parseInt(this._parsedLocalSheetId,10)),!1}};let Oo=/^[$]?[A-Za-z]{1,3}[$]?\d+(:[$]?[A-Za-z]{1,3}[$]?\d+)?$/,ko=/^[$]?\d+:[$]?\d+$/,Ao=/^[$]?[A-Za-z]{1,3}:[$]?[A-Za-z]{1,3}$/;function jo(e){if(e.startsWith(`{`)||e.endsWith(`}`))return!1;let t=e.split(`!`).pop()??``;if(!Oo.test(t)&&!ko.test(t)&&!Ao.test(t))return!1;try{let t=w.decodeEx(e);return`row`in t&&typeof t.row==`number`||`top`in t&&typeof t.top==`number`||`left`in t&&typeof t.left==`number`}catch{return!1}}function Mo(e){let t=e.trim();if(t.startsWith(`{`)&&t.endsWith(`}`))return[];let n=[],r=!1,i=``;return e.split(`,`).forEach(e=>{if(!e)return;let t=(e.match(/'/g)??[]).length;if(!t){r?i+=`${e},`:jo(e)&&n.push(e);return}let a=t%2==0;!r&&a&&jo(e)?n.push(e):r&&!a?(r=!1,jo(i+e)&&n.push(i+e),i=``):(r=!0,i+=`${e},`)}),n}let No=new Set([`visible`,`hidden`,`veryHidden`]);function Po(e){let t=e||`visible`;return No.has(t)?t:`visible`}var Fo=class extends N{render(e,t){e.leafNode(`sheet`,{name:t.name,sheetId:t.id,state:t.state===`visible`?void 0:t.state,"r:id":t.rId})}parseOpen(e){return e.name===`sheet`?(this.model={name:e.attributes.name,id:parseInt(e.attributes.sheetId,10),state:Po(e.attributes.state),rId:e.attributes[`r:id`]},!0):!1}parseText(){}parseClose(){return!1}},Io=class extends N{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}},Lo=class extends N{render(e,t){e.leafNode(`workbookPr`,{date1904:t.date1904?1:void 0,filterPrivacy:1})}parseOpen(e){return e.name===`workbookPr`?(this.model={date1904:e.attributes.date1904===`1`},!0):!1}parseText(){}parseClose(){return!1}},Ro=class extends N{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}},zo=class extends N{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}},Bo=class e extends N{constructor(){super(),this.map={fileVersion:e.STATIC_XFORMS.fileVersion,workbookPr:new Lo,bookViews:new P({tag:`bookViews`,count:!1,childXform:new Io}),sheets:new P({tag:`sheets`,count:!1,childXform:new Fo}),definedNames:new P({tag:`definedNames`,count:!1,childXform:new Do}),calcPr:new Ro,pivotCaches:new P({tag:`pivotCaches`,count:!1,childXform:new zo})}}prepare(e){e.sheets=e.worksheets;let t=[],n=0;e.sheets.forEach(e=>{if(e.pageSetup&&e.pageSetup.printArea&&e.pageSetup.printArea.split(`&&`).forEach(r=>{let i=r.split(`:`),a=i[0],o=i[1]??a,s={name:`_xlnm.Print_Area`,ranges:[`'${e.name}'!$${a}:$${o}`],localSheetId:n};t.push(s)}),e.pageSetup&&(e.pageSetup.printTitlesRow||e.pageSetup.printTitlesColumn)){let r=[];if(e.pageSetup.printTitlesColumn){let t=e.pageSetup.printTitlesColumn.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}if(e.pageSetup.printTitlesRow){let t=e.pageSetup.printTitlesRow.split(`:`),n=t[0],i=t[1]??n;r.push(`'${e.name}'!$${n}:$${i}`)}let i={name:`_xlnm.Print_Titles`,ranges:r,localSheetId:n};t.push(i)}n++}),t.length&&(e.definedNames=e.definedNames.concat(t)),(e.media??[]).forEach((e,t)=>{e.name=e.type+(t+1)})}render(t,n){t.openXml(A),t.openNode(`workbook`,e.WORKBOOK_ATTRIBUTES),this.map.fileVersion.render(t),this.map.workbookPr.render(t,n.properties),this.map.bookViews.render(t,n.views),this.map.sheets.render(t,n.sheets),this.map.definedNames.render(t,n.definedNames),this.map.calcPr.render(t,n.calcProperties);let r=n.pivotTables??[],i=new Set,a=r.filter(e=>i.has(e.cacheId)?!1:(i.add(e.cacheId),!0));this.map.pivotCaches.render(t,a),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`workbook`:return!0;default:return this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e),!0}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`workbook`:return this.model={sheets:this.map.sheets.model,properties:this.map.workbookPr.model||{},views:this.map.bookViews.model,calcProperties:{}},this.map.definedNames.model&&(this.model.definedNames=this.map.definedNames.model),this.map.pivotCaches.model&&this.map.pivotCaches.model.length>0&&(this.model.pivotCaches=this.map.pivotCaches.model),!1;default:return!0}}reconcile(e){let t=(e.workbookRels??[]).reduce((e,t)=>(e[t.Id]=t,e),{}),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&&e.ranges?.length>0){r.pageSetup||={};let t=w.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&&e.ranges?.length>0){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 ji({tag:`fileVersion`,$:{appName:`xl`,lastEdited:5,lowestEdited:5,rupBuild:9303}})}}};let z={OfficeDocument:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`,Worksheet:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`,CalcChain:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/calcChain`,SharedStrings:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/sharedStrings`,Styles:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/styles`,Theme:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/theme`,Hyperlink:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/hyperlink`,Image:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,CoreProperties:`http://schemas.openxmlformats.org/package/2006/relationships/metadata/core-properties`,ExtenderProperties:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/extended-properties`,Comments:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`,VmlDrawing:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/vmlDrawing`,Table:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/table`,PivotCacheDefinition:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheDefinition`,PivotCacheRecords:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotCacheRecords`,PivotTable:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/pivotTable`,FeaturePropertyBag:`http://schemas.microsoft.com/office/2022/11/relationships/FeaturePropertyBag`,CtrlProp:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/ctrlProp`};var Vo=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 T(t)}}get mergeCells(){return Object.values(this.merges).map(e=>e.range)}reconcile(e,t){e.forEach(e=>{let n=w.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===D.ValueType.Merge&&(i.master=n.tl):r.cells[t]={type:D.ValueType.Null,address:w.encodeAddress(e,t)}}}})}getMasterAddress(e){let t=this.hash[e];return t&&t.tl}},Ho=class extends N{get tag(){return`hyperlink`}render(e,t){t.target&&Uo(t.target)?e.leafNode(`hyperlink`,{ref:t.address,tooltip:t.tooltip,location:t.target.slice(1)}):e.leafNode(`hyperlink`,{ref:t.address,"r:id":t.rId,tooltip:t.tooltip})}parseOpen(e){if(e.name===`hyperlink`){if(this.model={address:e.attributes.ref,rId:e.attributes[`r:id`],tooltip:e.attributes.tooltip},e.attributes.location){let t=e.attributes.location;this.model.target=t.startsWith(`#`)?t:`#${t}`}return!0}return!1}parseText(){}parseClose(){return!1}};function Uo(e){return e.startsWith(`#`)}function Wo(e){if(e==null)return D.ValueType.Null;if(e instanceof String||typeof e==`string`)return D.ValueType.String;if(typeof e==`number`)return D.ValueType.Number;if(typeof e==`boolean`)return D.ValueType.Boolean;if(e instanceof Date)return D.ValueType.Date;if(e.text&&e.hyperlink)return D.ValueType.Hyperlink;if(e.formula)return D.ValueType.Formula;if(e.error)return D.ValueType.Error;throw new g(typeof e,`Could not understand type of value`)}function Go(e){switch(e.type){case D.ValueType.Formula:return Wo(e.result);default:return e.type}}var Ko=class extends N{constructor(){super(),this.richTextXform=new oa}get tag(){return`c`}prepare(e,t){let n=t.styles.addStyleModel(e.style||{},Go(e));switch(n&&(e.styleId=n),e.comment&&t.comments.push({...e.comment,ref:e.address}),e.type){case D.ValueType.String:case D.ValueType.RichText:t.sharedStrings&&(e.ssId=t.sharedStrings.add(e.value));break;case D.ValueType.Date:t.date1904&&(e.date1904=!0);break;case D.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 D.ValueType.Merge:t.merges.add(e);break;case D.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 new l(`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 T(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(Wo(t.result)){case D.ValueType.Null:e.leafNode(`f`,n,t.formula);break;case D.ValueType.String:e.addAttribute(`t`,`str`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case D.ValueType.Number:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result);break;case D.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,+!!t.result);break;case D.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,t.result.error);break;case D.ValueType.Date:e.leafNode(`f`,n,t.formula),e.leafNode(`v`,null,xt(t.result,t.date1904));break;default:throw new g(String(Wo(t.result)),`Could not understand type of value`)}}render(e,t){if(!(t.type===D.ValueType.Null&&!t.styleId)){switch(e.openNode(`c`),e.addAttribute(`r`,t.address),t.styleId&&e.addAttribute(`s`,t.styleId),t.type){case D.ValueType.Null:break;case D.ValueType.Number:e.leafNode(`v`,null,t.value);break;case D.ValueType.Boolean:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case D.ValueType.Checkbox:e.addAttribute(`t`,`b`),e.leafNode(`v`,null,t.value?`1`:`0`);break;case D.ValueType.Error:e.addAttribute(`t`,`e`),e.leafNode(`v`,null,t.value.error);break;case D.ValueType.String:case D.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 D.ValueType.Date:e.leafNode(`v`,null,xt(t.value,t.date1904));break;case D.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 D.ValueType.Formula:this.renderFormula(e,t);break;case D.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=D.ValueType.Formula,e.value&&=(this.t===`str`?e.result=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=D.ValueType.String,e.value=parseInt(e.value,10);break;case`str`:e.type=D.ValueType.String;break;case`inlineStr`:e.type=D.ValueType.String,typeof e.value==`string`&&e.value.includes(`_x`)&&(e.value=Tt(e.value));break;case`b`:e.type=D.ValueType.Boolean,e.value=parseInt(e.value,10)!==0;break;case`e`:e.type=D.ValueType.Error,e.value={error:e.value};break;case`d`:e.type=D.ValueType.Date,e.value=new Date(e.value);break;default:e.type=D.ValueType.Number,e.value=parseFloat(e.value);break}else e.styleId?e.type=D.ValueType.Null:e.type=D.ValueType.Merge;return!1}case`f`:case`v`:case`is`:return this.currentNode=void 0,!0;case`t`:return this.parser?(this.parser.parseClose(e),!0):(this.currentNode=void 0,!0);case`r`:return this.model.value=this.model.value||{},this.model.value.richText=this.model.value.richText??[],this.model.value.richText.push(this.parser.model),this.parser=void 0,this.currentNode=void 0,!0;default:return this.parser?(this.parser.parseClose(e),!0):!1}}reconcile(e,t){let n=e.styleId!==void 0&&t.styles&&t.styles.getStyleModel(e.styleId);switch(n&&(e.style=n),e.styleId!==void 0&&(e.styleId=void 0),e.type){case D.ValueType.String:typeof e.value==`number`&&t.sharedStrings&&(e.value=t.sharedStrings.getString(e.value)),e.value.richText&&(e.type=D.ValueType.RichText);break;case D.ValueType.Number:n&&Ft(n.numFmt)&&(e.type=D.ValueType.Date,e.value=St(e.value,t.date1904));break;case D.ValueType.Formula:e.result!==void 0&&typeof e.result==`number`&&n&&Ft(n.numFmt)&&(e.result=St(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===D.ValueType.Formula?(e.text=e.result,e.result=void 0):(e.text=e.value,e.value=void 0),e.type=D.ValueType.Hyperlink,e.hyperlink=r);let i=t.commentsMap&&t.commentsMap[e.address];i&&(e.comment=i)}},qo=class extends N{constructor(e){super(),this.maxItems=e&&e.maxItems,this.map={c:new Ko}}get tag(){return`row`}reset(){super.reset(),this.numRowsSeen=0,this.lastCellCol=0}prepare(e,t){let n=t.styles.addStyleModel(e.style);n&&(e.styleId=n);let r=this.map.c;e.cells.forEach(e=>{r.prepare(e,t)})}render(e,t,n){if(!t)return;e.openNode(`row`),e.addAttribute(`r`,t.number),t.height!=null&&t.height>0?(e.addAttribute(`ht`,t.height),t.customHeight!==!1&&e.addAttribute(`customHeight`,`1`)):t.height===0&&e.addAttribute(`ht`,1),t.hidden&&e.addAttribute(`hidden`,`1`),t.min>0&&t.max>0&&t.min<=t.max&&e.addAttribute(`spans`,`${t.min}:${t.max}`),t.styleId&&(e.addAttribute(`s`,t.styleId),e.addAttribute(`customFormat`,`1`)),t.dyDescent!==void 0&&e.addAttribute(`x14ac:dyDescent`,t.dyDescent),t.outlineLevel&&e.addAttribute(`outlineLevel`,t.outlineLevel),t.collapsed&&e.addAttribute(`collapsed`,`1`);let r=this.map.c;t.cells.forEach(t=>{r.render(e,t,n)}),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;if(e.name===`row`){this.numRowsSeen+=1,this.lastCellCol=0;let t=e.attributes.spans,n,r;if(t){let e=t.indexOf(`:`);n=parseInt(t,10),r=e>-1?parseInt(t.substring(e+1),10):void 0}let i=this.model={number:e.attributes.r?parseInt(e.attributes.r,10):this.numRowsSeen,min:n,max:r,cells:[]};return e.attributes.s&&(i.styleId=parseInt(e.attributes.s,10)),It(e.attributes.hidden)&&(i.hidden=!0),It(e.attributes.bestFit)&&(i.bestFit=!0),e.attributes.ht&&(i.height=parseFloat(e.attributes.ht)),It(e.attributes.customHeight)&&(i.customHeight=!0),e.attributes.outlineLevel&&(i.outlineLevel=parseInt(e.attributes.outlineLevel,10)),It(e.attributes.collapsed)&&(i.collapsed=!0),e.attributes[`x14ac:dyDescent`]!==void 0&&(i.dyDescent=parseFloat(e.attributes[`x14ac:dyDescent`])),!0}return this.parser=this.map[e.name],this.parser?(this.parser.parseOpen(e),!0):!1}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser){if(!this.parser.parseClose(e)){let e=this.parser.model;if(e.address?this.lastCellCol=w.decodeCol(e.address):(this.lastCellCol+=1,e.address=w.encodeAddress(this.model.number,this.lastCellCol)),this.model.cells.push(e),this.maxItems&&this.model.cells.length>this.maxItems)throw new te(`column`,this.maxItems);this.parser=void 0}return!0}return!1}reconcile(e,t){e.style=e.styleId===void 0?{}:t.styles.getStyleModel(e.styleId),e.styleId!==void 0&&(e.styleId=void 0);let n=this.map.c;e.cells.forEach(e=>{n.reconcile(e,t)})}},Jo=class extends N{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)),It(e.attributes.hidden)&&(t.hidden=!0),It(e.attributes.bestFit)&&(t.bestFit=!0),e.attributes.outlineLevel&&(t.outlineLevel=parseInt(e.attributes.outlineLevel,10)),It(e.attributes.collapsed)&&(t.collapsed=!0),!0}return!1}parseText(){}parseClose(){return!1}reconcile(e,t){e.styleId!==void 0&&(e.style=t.styles.getStyleModel(e.styleId))}},Yo=class extends N{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}},Xo=class extends N{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 Zo(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=i}function Qo(e,t,n,r){let i=t[n];i===void 0?r!==void 0&&(e[n]=r):e[n]=It(i)}function $o(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=w.encodeAddress(e.row+i,r);if(!n[t]||!ue(n[e.address],n[t]))return!1}return!0},o=r.map(e=>{if(!e.marked){let t=w.decodeEx(e.address);if(t.dimensions)return i[t.dimensions].marked=!0,{...e.dataValidation,sqref:e.address};let r=1,o=w.encodeAddress(t.row+r,t.col);for(;n[o]&&ue(e.dataValidation,n[o]);)r++,o=w.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=w.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}:${w.encodeAddress(n,i)}`}}return{...e.dataValidation,sqref:e.address}}return null}).filter(Boolean);return[...t,...o]}var es=class extends N{get tag(){return`dataValidations`}render(e,t){let n=$o(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(xt(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&&Qo(t,e.attributes,`allowBlank`),Qo(t,e.attributes,`showInputMessage`),Qo(t,e.attributes,`showErrorMessage`),t.type){case`any`:case`list`:case`custom`:break;default:Zo(t,e.attributes,`operator`,`between`);break}return Zo(t,e.attributes,`promptTitle`),Zo(t,e.attributes,`prompt`),Zo(t,e.attributes,`errorStyle`),Zo(t,e.attributes,`errorTitle`),Zo(t,e.attributes,`error`),this._dataValidation=t,!0}case`formula1`:case`formula2`:return this._formula=[],!0;default:return!1}}parseText(e){this._formula&&this._formula.push(e)}parseClose(e){switch(e){case`dataValidations`:return!1;case`dataValidation`:return(!this._dataValidation.formulae||!this._dataValidation.formulae.length)&&(delete this._dataValidation.formulae,delete this._dataValidation.operator),this._address.split(/\s+/g).forEach(e=>{e.includes(`:`)?this.model[`range:${e}`]=this._dataValidation:this.model[e]=this._dataValidation}),!0;case`formula1`:case`formula2`:{let e=this._formula.join(``);switch(this._dataValidation.type){case`whole`:case`textLength`:e=parseInt(e,10);break;case`decimal`:e=parseFloat(e);break;case`date`:e=St(parseFloat(e));break;default:break}return this._dataValidation.formulae.push(e),this._formula=void 0,!0}default:return!0}}},ts=class extends N{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 ns=e=>e!==void 0;var rs=class extends N{get tag(){return`outlinePr`}render(e,t){return t&&(ns(t.summaryBelow)||ns(t.summaryRight))?(e.leafNode(this.tag,{summaryBelow:ns(t.summaryBelow)?Number(t.summaryBelow):void 0,summaryRight:ns(t.summaryRight)?Number(t.summaryRight):void 0}),!0):!1}parseOpen(e){return e.name===this.tag?(this.model={summaryBelow:ns(e.attributes.summaryBelow)?!!Number(e.attributes.summaryBelow):void 0,summaryRight:ns(e.attributes.summaryRight)?!!Number(e.attributes.summaryRight):void 0},!0):!1}parseText(){}parseClose(){return!1}},is=class extends N{constructor(){super(),this.map={tabColor:new Mi(`tabColor`),pageSetUpPr:new ts,outlinePr:new rs}}get tag(){return`sheetPr`}render(e,t){if(!t)return;let n=!!t.tabColor,r=!!(t.pageSetup&&t.pageSetup.fitToPage),i=t.outlineProperties!==void 0&&t.outlineProperties!==null&&(t.outlineProperties.summaryBelow!==void 0||t.outlineProperties.summaryRight!==void 0);(n||r||i)&&(e.openNode(`sheetPr`),this.map.tabColor.render(e,t.tabColor),this.map.pageSetUpPr.render(e,t.pageSetup),this.map.outlinePr.render(e,t.outlineProperties),e.closeNode())}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)}},as=class extends N{get tag(){return`sheetFormatPr`}render(e,t){if(t){let n={defaultRowHeight:t.defaultRowHeight,outlineLevelRow:t.outlineLevelRow||void 0,outlineLevelCol:t.outlineLevelCol||void 0,"x14ac:dyDescent":t.dyDescent!==void 0&&t.dyDescent!==0?t.dyDescent:void 0};t.defaultColWidth&&(n.defaultColWidth=t.defaultColWidth),t.customHeight&&(n.customHeight=`1`),Object.values(n).some(e=>e!==void 0)&&e.leafNode(`sheetFormatPr`,n)}}parseOpen(e){return e.name===`sheetFormatPr`?(this.model={defaultRowHeight:parseFloat(e.attributes.defaultRowHeight??`0`),dyDescent:e.attributes[`x14ac:dyDescent`]===void 0?void 0:parseFloat(e.attributes[`x14ac:dyDescent`]),outlineLevelRow:parseInt(e.attributes.outlineLevelRow??`0`,10),outlineLevelCol:parseInt(e.attributes.outlineLevelCol??`0`,10)},e.attributes.defaultColWidth&&(this.model.defaultColWidth=parseFloat(e.attributes.defaultColWidth)),e.attributes.customHeight===`1`&&(this.model.customHeight=!0),!0):!1}parseText(){}parseClose(){return!1}};let os={frozen:`frozen`,frozenSplit:`frozen`,split:`split`};var ss=class extends N{get tag(){return`sheetView`}prepare(e){switch(e.state){case`frozen`:case`split`:break;default:e.state=`normal`;break}}render(e,t){let n={};t.tabSelected&&(n.tabSelected=`1`),n.workbookViewId=t.workbookViewId??0,e.openNode(`sheetView`,n);let r=function(t,n,r){r&&e.addAttribute(t,n)};r(`rightToLeft`,`1`,t.rightToLeft===!0),r(`showRuler`,`0`,t.showRuler===!1),r(`showRowColHeaders`,`0`,t.showRowColHeaders===!1),r(`showGridLines`,`0`,t.showGridLines===!1),r(`zoomScale`,t.zoomScale,t.zoomScale!==void 0&&t.zoomScale!==100),r(`zoomScaleNormal`,t.zoomScaleNormal,t.zoomScaleNormal!==void 0&&t.zoomScaleNormal!==100),r(`view`,t.style,t.style);let i,a,o,s;switch(t.state){case`frozen`:a=t.xSplit??0,o=t.ySplit??0,i=t.topLeftCell||w.getAddress(o+1,a+1).address,s=t.xSplit&&t.ySplit&&`bottomRight`||t.xSplit&&`topRight`||`bottomLeft`,e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:i,activePane:s,state:`frozen`}),e.leafNode(`selection`,{pane:s,activeCell:t.activeCell,sqref:t.activeCell});break;case`split`:t.activePane===`topLeft`&&(t.activePane=void 0),e.leafNode(`pane`,{xSplit:t.xSplit||void 0,ySplit:t.ySplit||void 0,topLeftCell:t.topLeftCell,activePane:t.activePane}),e.leafNode(`selection`,{pane:t.activePane,activeCell:t.activeCell,sqref:t.activeCell});break;case`normal`:t.activeCell&&e.leafNode(`selection`,{activeCell:t.activeCell,sqref:t.activeCell});break;default:break}e.closeNode()}parseOpen(e){switch(e.name){case`sheetView`:return this.sheetView={workbookViewId:parseInt(e.attributes.workbookViewId,10),rightToLeft:e.attributes.rightToLeft===`1`,tabSelected:e.attributes.tabSelected===`1`,showRuler:e.attributes.showRuler!==`0`,showRowColHeaders:e.attributes.showRowColHeaders!==`0`,showGridLines:e.attributes.showGridLines!==`0`,zoomScale:parseInt(e.attributes.zoomScale??`100`,10),zoomScaleNormal:parseInt(e.attributes.zoomScaleNormal??`100`,10),style:e.attributes.view},this.pane=void 0,this.selections={},!0;case`pane`:return this.pane={xSplit:parseInt(e.attributes.xSplit??`0`,10),ySplit:parseInt(e.attributes.ySplit??`0`,10),topLeftCell:e.attributes.topLeftCell,activePane:e.attributes.activePane??`topLeft`,state:e.attributes.state},!0;case`selection`:{let t=e.attributes.pane??`topLeft`;return this.selections[t]={pane:t,activeCell:e.attributes.activeCell},!0}default:return!1}}parseText(){}parseClose(e){let t,n;switch(e){case`sheetView`:return this.sheetView&&this.pane?(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:os[this.pane.state]??`split`,xSplit:this.pane.xSplit,ySplit:this.pane.ySplit,topLeftCell:this.pane.topLeftCell,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},this.model.state===`split`&&(t.activePane=this.pane.activePane),n=this.selections[this.pane.activePane],n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)):(t=this.model={workbookViewId:this.sheetView.workbookViewId,rightToLeft:this.sheetView.rightToLeft,tabSelected:this.sheetView.tabSelected,state:`normal`,showRuler:this.sheetView.showRuler,showRowColHeaders:this.sheetView.showRowColHeaders,showGridLines:this.sheetView.showGridLines,zoomScale:this.sheetView.zoomScale,zoomScaleNormal:this.sheetView.zoomScaleNormal},n=this.selections.topLeft,n&&n.activeCell&&(t.activeCell=n.activeCell),this.sheetView.style&&(t.style=this.sheetView.style)),!1;default:return!0}}reconcile(){}};function cs(e,t){return e?t:void 0}function ls(e,t){return e===t?!0:void 0}var us=class extends N{get tag(){return`sheetProtection`}render(e,t){if(t){let n={sheet:cs(t.sheet,`1`),selectLockedCells:t.selectLockedCells===!1?`1`:void 0,selectUnlockedCells:t.selectUnlockedCells===!1?`1`:void 0,formatCells:cs(t.formatCells,`0`),formatColumns:cs(t.formatColumns,`0`),formatRows:cs(t.formatRows,`0`),insertColumns:cs(t.insertColumns,`0`),insertRows:cs(t.insertRows,`0`),insertHyperlinks:cs(t.insertHyperlinks,`0`),deleteColumns:cs(t.deleteColumns,`0`),deleteRows:cs(t.deleteRows,`0`),sort:cs(t.sort,`0`),autoFilter:cs(t.autoFilter,`0`),pivotTables:cs(t.pivotTables,`0`)};t.sheet&&(n.algorithmName=t.algorithmName,n.hashValue=t.hashValue,n.saltValue=t.saltValue,n.spinCount=t.spinCount,n.objects=cs(t.objects===!1,`1`),n.scenarios=cs(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:ls(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:ls(e.attributes.formatCells,`0`),formatColumns:ls(e.attributes.formatColumns,`0`),formatRows:ls(e.attributes.formatRows,`0`),insertColumns:ls(e.attributes.insertColumns,`0`),insertRows:ls(e.attributes.insertRows,`0`),insertHyperlinks:ls(e.attributes.insertHyperlinks,`0`),deleteColumns:ls(e.attributes.deleteColumns,`0`),deleteRows:ls(e.attributes.deleteRows,`0`),sort:ls(e.attributes.sort,`0`),autoFilter:ls(e.attributes.autoFilter,`0`),pivotTables:ls(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}},ds=class extends N{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 fs(e){return e?`1`:void 0}function ps(e){switch(e){case`overThenDown`:return e;default:return}}function ms(e){switch(e){case`atEnd`:case`asDisplyed`:return e;default:return}}function hs(e){switch(e){case`dash`:case`blank`:case`NA`:return e;default:return}}function gs(e){return e===void 0?void 0:parseInt(e,10)}var _s=class extends N{get tag(){return`pageSetup`}_dpiToXml(e){if(e!==void 0&&Number.isFinite(e)&&e!==4294967295)return e}render(e,t){if(t){let n={paperSize:t.paperSize,orientation:t.orientation,horizontalDpi:this._dpiToXml(t.horizontalDpi),verticalDpi:this._dpiToXml(t.verticalDpi),pageOrder:ps(t.pageOrder),blackAndWhite:fs(t.blackAndWhite),draft:fs(t.draft),cellComments:ms(t.cellComments),errors:hs(t.errors),scale:t.scale===100?void 0:t.scale,fitToWidth:t.fitToWidth===1?void 0:t.fitToWidth,fitToHeight:t.fitToHeight===1?void 0:t.fitToHeight,firstPageNumber:t.firstPageNumber,useFirstPageNumber:fs(!!t.firstPageNumber),usePrinterDefaults:fs(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:gs(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 vs(e){return e?`1`:void 0}var ys=class extends N{get tag(){return`printOptions`}render(e,t){if(t){let n={headings:vs(t.showRowColHeaders),gridLines:vs(t.showGridLines),horizontalCentered:vs(t.horizontalCentered),verticalCentered:vs(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}},bs=class extends N{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:w.getAddress(e.row,e.col).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)}},xs=class extends N{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}},Ss=class extends N{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}},Cs=class extends N{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}},ws=class extends N{get tag(){return`brk`}render(e,t){e.leafNode(`brk`,t)}parseOpen(e){if(e.name===`brk`){let{id:t,max:n,man:r,min:i}=e.attributes;return this.model={id:+t,max:+n,man:+r},i!==void 0&&(this.model.min=+i),!0}return!1}parseText(){}parseClose(){return!1}},Ts=class extends P{constructor(){super({tag:`rowBreaks`,count:!0,childXform:new ws})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Es=class extends P{constructor(){super({tag:`colBreaks`,count:!0,childXform:new ws})}render(e,t){if(t&&t.length){e.openNode(this.tag,this.$),e.addAttribute(this.$count,t.length),e.addAttribute(`manualBreakCount`,t.length);let{childXform:n}=this;for(let r of t)n.render(e,r);e.closeNode()}}},Ds=class extends N{get tag(){return`headerFooter`}render(e,t){if(!t)return;let n={},r=[];if(t.differentFirst&&(n.differentFirst=`1`),t.differentOddEven&&(n.differentOddEven=`1`),t.oddHeader&&typeof t.oddHeader==`string`&&r.push({name:`oddHeader`,text:t.oddHeader}),t.oddFooter&&typeof t.oddFooter==`string`&&r.push({name:`oddFooter`,text:t.oddFooter}),t.evenHeader&&typeof t.evenHeader==`string`&&r.push({name:`evenHeader`,text:t.evenHeader}),t.evenFooter&&typeof t.evenFooter==`string`&&r.push({name:`evenFooter`,text:t.evenFooter}),t.firstHeader&&typeof t.firstHeader==`string`&&r.push({name:`firstHeader`,text:t.firstHeader}),t.firstFooter&&typeof t.firstFooter==`string`&&r.push({name:`firstFooter`,text:t.firstFooter}),Object.keys(n).length>0||r.length>0){e.openNode(`headerFooter`,n);for(let t of r)e.leafNode(t.name,null,t.text);e.closeNode()}}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}}},B=class extends N{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``}},Os=class extends N{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:N.toFloatValue(e.attributes.val)}}parseClose(e){return e!==this.tag}},ks=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os,color:this.colorXform=new Mi}}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}}},As=class extends N{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}},js=class extends B{constructor(){super(),this.map={"x14:id":this.idXform=new As}}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}},Ms=class extends B{constructor(){super(),this.map={ext:new js}}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)}},Ns=class extends N{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}},Ps=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os,color:this.colorXform=new Mi}}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)}},Fs=class extends B{constructor(){super(),this.map={cfvo:this.cfvoXform=new Os}}get tag(){return`iconSet`}render(e,t){e.openNode(this.tag,{iconSet:N.toStringAttribute(t.iconSet,`3TrafficLights`),reverse:N.toBoolAttribute(t.reverse,!1),showValue:N.toBoolAttribute(t.showValue,!0)}),t.cfvo.forEach(t=>{this.cfvoXform.render(e,t)}),e.closeNode()}createNewModel({attributes:e}){return{iconSet:N.toStringValue(e.iconSet,`3TrafficLights`),reverse:N.toBoolValue(e.reverse),showValue:N.toBoolValue(e.showValue),cfvo:[]}}onParserClose(e,t){this.model[e].push(t.model)}};let Is={"3Triangles":!0,"3Stars":!0,"5Boxes":!0},Ls=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new T(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}},Rs=e=>{if(e.formulae&&e.formulae[0])return e.formulae[0];let{tl:t}=new T(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}},zs=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 Bs=class e extends B{constructor(){super(),this.map={dataBar:this.databarXform=new ks,extLst:this.extLstRefXform=new Ms,formula:this.formulaXform=new Ns,colorScale:this.colorScaleXform=new Ps,iconSet:this.iconSetXform=new Fs}}get tag(){return`cfRule`}static isPrimitive(e){return!(e.type===`iconSet`&&(e.custom||Is[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:N.toBoolAttribute(t.percent,!1),bottom:N.toBoolAttribute(t.bottom,!1),rank:N.toIntValue(t.rank,10)})}renderAboveAverage(e,t){e.leafNode(this.tag,{type:`aboveAverage`,dxfId:t.dxfId,priority:t.priority,aboveAverage:N.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:N.toStringAttribute(t.operator,`containsText`)});let n=Ls(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=Rs(t);n&&this.formulaXform.render(e,n),e.closeNode()}createNewModel({attributes:e}){return{...zs(e),dxfId:N.toIntValue(e.dxfId),priority:N.toIntValue(e.priority),timePeriod:e.timePeriod,percent:N.toBoolValue(e.percent),bottom:N.toBoolValue(e.bottom),rank:N.toIntValue(e.rank),aboveAverage:N.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}}},Vs=class extends B{constructor(){super(),this.map={cfRule:new Bs}}get tag(){return`conditionalFormatting`}render(e,t){t.rules.some(Bs.isPrimitive)&&(e.openNode(this.tag,{sqref:t.ref}),t.rules.forEach(n=>{Bs.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)}},Hs=class extends N{constructor(){super(),this.cfXform=new Vs}get tag(){return`conditionalFormatting`}reset(){this.model=[]}prepare(e,t){let n=e.reduce((e,t)=>Math.max(e,...t.rules.map(e=>e.priority??0)),1);e.forEach(e=>{e.rules.forEach(e=>{e.priority||=n++,e.style&&(e.dxfId=t.styles.addDxfStyle(e.style)),e.type===`dataBar`&&((!e.cfvo||e.cfvo.length<2)&&(e.cfvo=[{type:`min`},{type:`max`}]),e.color||={argb:`FF638EC6`})})})}render(e,t){t.forEach(t=>{this.cfXform.render(e,t)})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`conditionalFormatting`:return this.parser=this.cfXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){return this.parser?this.parser.parseClose(e)?!0:(this.model.push(this.parser.model),this.parser=void 0,!1):!1}reconcile(e,t){e.forEach(e=>{e.rules.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId),delete e.dxfId)})})}},Us=class extends N{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}},Ws=class extends B{constructor(){super(),this.map={"xm:f":this.fExtXform=new Us}}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}}},Gs=class extends B{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new Ws,"x14:borderColor":this.borderColorXform=new Mi(`x14:borderColor`),"x14:negativeBorderColor":this.negativeBorderColorXform=new Mi(`x14:negativeBorderColor`),"x14:negativeFillColor":this.negativeFillColorXform=new Mi(`x14:negativeFillColor`),"x14:axisColor":this.axisColorXform=new Mi(`x14:axisColor`)}}static isExt(e){return!e.gradient}get tag(){return`x14:dataBar`}render(e,t){e.openNode(this.tag,{minLength:N.toIntAttribute(t.minLength,0,!0),maxLength:N.toIntAttribute(t.maxLength,100,!0),border:N.toBoolAttribute(t.border,!1),gradient:N.toBoolAttribute(t.gradient,!0),negativeBarColorSameAsPositive:N.toBoolAttribute(t.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:N.toBoolAttribute(t.negativeBarBorderColorSameAsPositive,!0),axisPosition:N.toAttribute(t.axisPosition,`auto`),direction:N.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:N.toIntValue(e.minLength,0),maxLength:N.toIntValue(e.maxLength,100),border:N.toBoolValue(e.border,!1),gradient:N.toBoolValue(e.gradient,!0),negativeBarColorSameAsPositive:N.toBoolValue(e.negativeBarColorSameAsPositive,!0),negativeBarBorderColorSameAsPositive:N.toBoolValue(e.negativeBarBorderColorSameAsPositive,!0),axisPosition:N.toStringValue(e.axisPosition,`auto`),direction:N.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}}},Ks=class extends N{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:N.toIntValue(e.iconId)}}parseClose(e){return e!==this.tag}},qs=class extends B{constructor(){super(),this.map={"x14:cfvo":this.cfvoXform=new Ws,"x14:cfIcon":this.cfIconXform=new Ks}}get tag(){return`x14:iconSet`}render(e,t){e.openNode(this.tag,{iconSet:N.toStringAttribute(t.iconSet),reverse:N.toBoolAttribute(t.reverse,!1),showValue:N.toBoolAttribute(t.showValue,!0),custom:N.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:N.toStringValue(e.iconSet,`3TrafficLights`),reverse:N.toBoolValue(e.reverse,!1),showValue:N.toBoolValue(e.showValue,!0)}}onParserClose(e,t){let[,n]=e.split(`:`);switch(n){case`cfvo`:this.model.cfvo.push(t.model);break;case`cfIcon`:this.model.icons||(this.model.icons=[]),this.model.icons.push(t.model);break;default:this.model[n]=t.model;break}}};function V(e){return e.toString(16).padStart(2,`0`)}function Js(e){e[6]=e[6]&15|64,e[8]=e[8]&63|128;let t=e;return V(t[0])+V(t[1])+V(t[2])+V(t[3])+`-`+V(t[4])+V(t[5])+`-`+V(t[6])+V(t[7])+`-`+V(t[8])+V(t[9])+`-`+V(t[10])+V(t[11])+V(t[12])+V(t[13])+V(t[14])+V(t[15])}function Ys(){let e=globalThis.crypto;if(e?.randomUUID)return e.randomUUID();let t=new Uint8Array(16);if(e?.getRandomValues)return e.getRandomValues(t),Js(t);for(let e=0;e<t.length;e++)t[e]=Math.floor(Math.random()*256);return Js(t)}let Xs={"3Triangles":!0,"3Stars":!0,"5Boxes":!0};var Zs=class e extends B{constructor(){super(),this.map={"x14:dataBar":this.databarXform=new Gs,"x14:iconSet":this.iconSetXform=new qs}}get tag(){return`x14:cfRule`}static isExt(e){return e.type===`dataBar`?Gs.isExt(e):!!(e.type===`iconSet`&&(e.custom||Xs[e.iconSet]))}prepare(t){e.isExt(t)&&(t.x14Id=`{${Ys()}}`.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??`{${Ys()}}`}),this.iconSetXform.render(e,t),e.closeNode()}createNewModel({attributes:e}){return{type:e.type,x14Id:e.id,priority:N.toIntValue(e.priority)}}onParserClose(e,t){Object.assign(this.model,t.model)}},Qs=class extends N{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}},$s=class extends B{constructor(){super(),this.map={"xm:sqref":this.sqRef=new Qs,"x14:cfRule":this.cfRule=new Zs}}get tag(){return`x14:conditionalFormatting`}prepare(e){e.rules.forEach(e=>{this.cfRule.prepare(e)})}render(e,t){t.rules.some(Zs.isExt)&&(e.openNode(this.tag,{"xmlns:xm":`http://schemas.microsoft.com/office/excel/2006/main`}),t.rules.filter(Zs.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}}},ec=class extends B{constructor(){super(),this.map={"x14:conditionalFormatting":this.cfXform=new $s}}get tag(){return`x14:conditionalFormattings`}hasContent(e){return e.hasExtContent===void 0&&(e.hasExtContent=e.some(e=>e.rules.some(Zs.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)}},tc=class extends B{constructor(){super(),this.map={"x14:conditionalFormattings":this.conditionalFormattings=new ec}}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}},nc=class extends B{constructor(){super(),this.map={ext:this.ext=new tc}}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}};function rc(e){return bo(e.name&&e.extension&&e.name.endsWith(`.${e.extension}`)?e.name:`${e.name}.${e.extension}`)}function ic(e,t,n){let r=[],i=[...t],a={};for(let t of e){let e=String(t.imageId),o=n.getBookImage(t.imageId);if(!o)continue;let s=a[e];s||(s=n.nextRId(i),a[e]=s,i.push({Id:s,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/image`,Target:rc(o)}));let c={picture:{rId:s},range:t.range};if(t.hyperlinks&&t.hyperlinks.hyperlink){let e=n.nextRId(i);c.picture.hyperlinks={tooltip:t.hyperlinks.tooltip,rId:e},i.push({Id:e,Type:z.Hyperlink,Target:t.hyperlinks.hyperlink,TargetMode:`External`})}r.push(c)}return{anchors:r,rels:i}}function ac(e){return e.filter(e=>e==null?!1:e.range?.br&&e.shape?!0:!(!e.range?.br&&!e.picture||e.range?.br&&!e.picture&&!e.shape))}let oc=(e,t)=>{Object.keys(t).forEach(n=>{let r=e[n],i=t[n];r===void 0&&i!==void 0&&(e[n]=i)})},sc=(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?oc(a,i):n[t.ref]?n[t.ref].rules.push(i):e.push({ref:t.ref,rules:[i]})})}),e};var cc=class e extends N{static{this.WORKSHEET_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"xmlns:x14ac":`http://schemas.microsoft.com/office/spreadsheetml/2009/9/ac`,"mc:Ignorable":`x14ac`}}constructor(e){super();let{maxRows:t,maxCols:n,ignoreNodes:r}=e||{};this.ignoreNodes=r??[],this.map={sheetPr:new is,dimension:new Yo,sheetViews:new P({tag:`sheetViews`,count:!1,childXform:new ss}),sheetFormatPr:new as,cols:new P({tag:`cols`,count:!1,childXform:new Jo}),sheetData:new P({tag:`sheetData`,count:!1,empty:!0,childXform:new qo({maxItems:n}),maxItems:t}),autoFilter:new bs,mergeCells:new P({tag:`mergeCells`,count:!0,childXform:new Xo}),rowBreaks:new Ts,colBreaks:new Es,hyperlinks:new P({tag:`hyperlinks`,count:!1,childXform:new Ho}),pageMargins:new ds,dataValidations:new es,pageSetup:new _s,headerFooter:new Ds,printOptions:new ys,picture:new xs,drawing:new Ss,sheetProtection:new us,tableParts:new P({tag:`tableParts`,count:!0,childXform:new Cs}),conditionalFormatting:new Hs,extLst:new nc}}prepare(e,t){t.merges=new Vo,e.hyperlinks=t.hyperlinks=[],e.comments=t.comments=[],e.formControls&&e.formControls.length>0&&(!e.views||e.views.length===0)&&(e.views=[{workbookViewId:0}]),t.formulae={},t.siFormulae=0,this.map.cols.prepare(e.cols,t),this.map.sheetData.prepare(e.rows,t),this.map.conditionalFormatting.prepare(e.conditionalFormattings,t),e.mergeCells=t.merges.mergeCells;let n=e.rels=[];function r(e){return`rId${e.length+1}`}e.hyperlinks.forEach(e=>{if(Uo(e.target))return;let t=r(n);e.rId=t,n.push({Id:t,Type:z.Hyperlink,Target:e.target,TargetMode:`External`})});let{fileIndex:i}=e;if(e.comments.length>0){let a={Id:r(n),Type:z.Comments,Target:uo(i)};n.push(a);let o={Id:r(n),Type:z.VmlDrawing,Target:fo(i)};n.push(o),e.comments.forEach(e=>{e.refAddress=w.decodeAddress(e.ref)}),t.commentRefs.push({commentName:`comments${i}`,vmlDrawing:`vmlDrawing${i}`})}if(e.drawing&&e.drawing.anchors){let i=e.drawing;i.rId=r(n),i.name||=`drawing${++t.drawingsCount}`;let a=(i.rels??[]).some(e=>e.Target&&e.Target.includes(`/charts/`));i.anchors=[],a||(i.rels=[]),t.drawings.push(i),n.push({Id:i.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(i.name)})}let a=[],o=[];if(e.media.forEach(e=>{e.type===`background`?a.push(e):e.type===`image`&&o.push(e)}),a.forEach(i=>{let a=r(n),o=t.media[i.imageId];n.push({Id:a,Type:z.Image,Target:rc(o)}),e.background={rId:a},e.image=t.media[i.imageId]}),o.length>0){let{drawing:i}=e;i||(i=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(i),n.push({Id:i.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(i.name)}));let a=ic(o,i.rels,{getBookImage:e=>t.media[e],nextRId:e=>r(e)});i.anchors.push(...a.anchors),i.rels=a.rels}if(e.tables.forEach(e=>{let i=r(n);e.rId=i,n.push({Id:i,Type:z.Table,Target:vo(e.target)}),e.columns.forEach(e=>{let{style:n}=e;n&&(e.dxfId=t.styles.addDxfStyle(n))})}),(e.pivotTables??[]).forEach(e=>{n.push({Id:r(n),Type:z.PivotTable,Target:go(e.tableNumber)})}),e.formControls&&e.formControls.length>0){let{drawing:a}=e;a||(a=e.drawing={rId:r(n),name:`drawing${++t.drawingsCount}`,anchors:[],rels:[]},t.drawings.push(a),n.push({Id:a.rId,Type:`http://schemas.openxmlformats.org/officeDocument/2006/relationships/drawing`,Target:po(a.name)})),e.comments.length===0&&n.push({Id:r(n),Type:z.VmlDrawing,Target:fo(i)});let o=e=>({nativeCol:e.col,nativeColOff:e.colOff,nativeRow:e.row,nativeRowOff:e.rowOff});for(let i of e.formControls){let e=t.formControlRefs.length+1;i.ctrlPropId=e;let s=r(n);i.ctrlPropRelId=s,n.push({Id:s,Type:z.CtrlProp,Target:So(e)}),t.formControlRefs.push(e);let c=`Check Box ${Math.max(1,i.shapeId-1024)}`;a.anchors.push({range:{editAs:`absolute`,tl:o(i.tl),br:o(i.br)},alternateContent:{requires:`a14`},shape:{cNvPrId:i.shapeId,name:i.name||c,hidden:!0,spid:`_x0000_s${i.shapeId}`,text:i.text}})}}this.map.extLst.prepare(e,t)}render(t,n){t.openXml(A);let r={...e.WORKSHEET_ATTRIBUTES};n.formControls&&n.formControls.length>0&&(r[`xmlns:x14`]=`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,r[`xmlns:xdr`]=`http://schemas.openxmlformats.org/drawingml/2006/spreadsheetDrawing`,r[`mc:Ignorable`]=`${r[`mc:Ignorable`]} x14`),t.openNode(`worksheet`,r);let i=n.properties?{defaultRowHeight:n.properties.defaultRowHeight,dyDescent:n.properties.dyDescent,outlineLevelCol:n.properties.outlineLevelCol,outlineLevelRow:n.properties.outlineLevelRow,customHeight:n.properties.customHeight}:void 0;n.properties&&n.properties.defaultColWidth&&(i.defaultColWidth=n.properties.defaultColWidth);let a={outlineProperties:n.properties&&n.properties.outlineProperties,tabColor:n.properties&&n.properties.tabColor,pageSetup:n.pageSetup&&n.pageSetup.fitToPage?{fitToPage:n.pageSetup.fitToPage}:void 0},o=n.pageSetup&&n.pageSetup.margins,s={showRowColHeaders:n.pageSetup&&n.pageSetup.showRowColHeaders,showGridLines:n.pageSetup&&n.pageSetup.showGridLines,horizontalCentered:n.pageSetup&&n.pageSetup.horizontalCentered,verticalCentered:n.pageSetup&&n.pageSetup.verticalCentered},c=n.sheetProtection;if(this.map.sheetPr.render(t,a),this.map.dimension.render(t,n.dimensions),this.map.sheetViews.render(t,n.views),this.map.sheetFormatPr.render(t,i),this.map.cols.render(t,n.cols),this.map.sheetData.render(t,n.rows),this.map.sheetProtection.render(t,c),this.map.autoFilter.render(t,n.autoFilter),this.map.mergeCells.render(t,n.mergeCells),this.map.conditionalFormatting.render(t,n.conditionalFormattings),this.map.dataValidations.render(t,n.dataValidations),this.map.hyperlinks.render(t,n.hyperlinks),this.map.printOptions.render(t,s),this.map.pageMargins.render(t,o),this.map.pageSetup.render(t,n.pageSetup),this.map.headerFooter.render(t,n.headerFooter),this.map.rowBreaks.render(t,n.rowBreaks),this.map.colBreaks.render(t,n.colBreaks),this.map.drawing.render(t,n.drawing),this.map.picture.render(t,n.background),n.rels&&n.rels.forEach(e=>{e.Type===z.VmlDrawing&&t.leafNode(`legacyDrawing`,{"r:id":e.Id})}),n.formControls&&n.formControls.length>0){t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`controls`);for(let e of n.formControls){if(!e.ctrlPropRelId)continue;let n=`Check Box ${Math.max(1,e.shapeId-1024)}`;t.openNode(`mc:AlternateContent`),t.openNode(`mc:Choice`,{Requires:`x14`}),t.openNode(`control`,{shapeId:e.shapeId,"r:id":e.ctrlPropRelId,name:e.name||n}),t.openNode(`controlPr`,{locked:0,defaultSize:0,print:+!!e.print,autoFill:0,autoLine:0,autoPict:0}),t.openNode(`anchor`),t.openNode(`from`),t.leafNode(`xdr:col`,void 0,e.tl.col),t.leafNode(`xdr:colOff`,void 0,e.tl.colOff),t.leafNode(`xdr:row`,void 0,e.tl.row),t.leafNode(`xdr:rowOff`,void 0,e.tl.rowOff),t.closeNode(),t.openNode(`to`),t.leafNode(`xdr:col`,void 0,e.br.col),t.leafNode(`xdr:colOff`,void 0,e.br.colOff),t.leafNode(`xdr:row`,void 0,e.br.row),t.leafNode(`xdr:rowOff`,void 0,e.br.rowOff),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}t.closeNode(),t.closeNode(),t.leafNode(`mc:Fallback`),t.closeNode()}this.map.tableParts.render(t,n.tables),this.map.extLst.render(t,n),t.closeNode()}parseOpen(e){return this.parser?(this.parser.parseOpen(e),!0):e.name===`worksheet`?(Object.values(this.map).forEach(e=>{e.reset()}),!0):(this.map[e.name]&&!this.ignoreNodes.includes(e.name)&&(this.parser=this.map[e.name],this.parser.parseOpen(e)),!0)}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case`worksheet`:{let e=this.map.sheetFormatPr.model||{};this.map.sheetPr.model&&this.map.sheetPr.model.tabColor&&(e.tabColor=this.map.sheetPr.model.tabColor),this.map.sheetPr.model&&this.map.sheetPr.model.outlineProperties&&(e.outlineProperties=this.map.sheetPr.model.outlineProperties);let t={fitToPage:this.map.sheetPr.model&&this.map.sheetPr.model.pageSetup&&this.map.sheetPr.model.pageSetup.fitToPage||!1,margins:this.map.pageMargins.model},n=Object.assign(t,this.map.pageSetup.model,this.map.printOptions.model),r=sc(this.map.conditionalFormatting.model,this.map.extLst.model&&this.map.extLst.model[`x14:conditionalFormattings`]);return this.model={dimensions:this.map.dimension.model,cols:this.map.cols.model,rows:this.map.sheetData.model,mergeCells:this.map.mergeCells.model,hyperlinks:this.map.hyperlinks.model,dataValidations:this.map.dataValidations.model,properties:e,views:this.map.sheetViews.model,pageSetup:n,headerFooter:this.map.headerFooter.model,background:this.map.picture.model,drawing:this.map.drawing.model,tables:this.map.tableParts.model,conditionalFormattings:r,rowBreaks:this.map.rowBreaks.model??[],colBreaks:this.map.colBreaks.model??[]},this.map.autoFilter.model&&(this.model.autoFilter=this.map.autoFilter.model),this.map.sheetProtection.model&&(this.model.sheetProtection=this.map.sheetProtection.model),!1}default:return!0}}reconcile(e,t){let n=(e.relationships??[]).reduce((n,r)=>{if(n[r.Id]=r,r.Type===z.Comments){let n=t.comments?.[r.Target];n&&(e.comments=n.comments)}if(r.Type===z.VmlDrawing&&e.comments&&e.comments.length){let n=t.vmlDrawings?.[r.Target];if(n){let t=n.comments;e.comments.forEach((e,n)=>{e.note=Object.assign({},e.note,t[n])})}}return n},{});if(t.commentsMap=(e.comments??[]).reduce((e,t)=>(t.ref&&(e[t.ref]=t),e),{}),t.hyperlinkMap=(e.hyperlinks??[]).reduce((e,t)=>{if(t.rId){let r=n[t.rId];r&&(e[t.address]=r.Target)}else t.target&&(e[t.address]=t.target);return e},{}),t.formulae={},e.rows){e.rows.includes(void 0)&&(e.rows=e.rows.filter(Boolean));for(let t=0;t<e.rows.length;t++){let n=e.rows[t];n.cells?.includes(void 0)&&(n.cells=n.cells.filter(Boolean))}}else e.rows=[];if(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];if(r){let n=r.Target.match(/\/drawings\/([a-zA-Z0-9]+)[.][a-zA-Z]{3,4}$/);if(n){let r=n[1],i=t.drawings[r];i?(e.drawing={...i,name:r,rels:t.drawingRels?.[r]??i.rels??[]},i.anchors.forEach(t=>{if(t.medium){let n={type:`image`,imageId:t.medium.index,range:t.range,hyperlinks:t.picture.hyperlinks};e.media.push(n)}})):e.drawing=void 0}else e.drawing=void 0}else e.drawing=void 0}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})}else e.background&&=void 0;e.tables=(e.tables??[]).reduce((e,r)=>{let i=n[r.rId];if(i){let n=t.tables[i.Target];n&&e.push(n)}return e},[]),e.pivotTables=[],(e.relationships??[]).forEach(n=>{if(n.Type===z.PivotTable&&t.pivotTables){let r=t.pivotTables[n.Target];r&&e.pivotTables.push(r)}}),delete e.relationships,delete e.hyperlinks,delete e.comments}},lc=class extends N{render(e){e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.openNode(`FeaturePropertyBags`,{xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2022/featurepropertybag`}),e.leafNode(`bag`,{type:`Checkbox`}),e.openNode(`bag`,{type:`XFControls`}),e.leafNode(`bagId`,{k:`CellControl`},`0`),e.closeNode(),e.openNode(`bag`,{type:`XFComplement`}),e.leafNode(`bagId`,{k:`XFControls`},`1`),e.closeNode(),e.openNode(`bag`,{type:`XFComplements`,extRef:`XFComplementsMapperExtRef`}),e.openNode(`a`,{k:`MappedFeaturePropertyBags`}),e.leafNode(`bagId`,{},`2`),e.closeNode(),e.closeNode(),e.closeNode()}parseOpen(){return!1}parseText(){}parseClose(){return!1}},uc=class extends N{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]}}}},dc=class extends N{constructor(e){super(),this.tag=e.tag,this.map={"xdr:col":new Pi({tag:`xdr:col`,zero:!0}),"xdr:colOff":new Pi({tag:`xdr:colOff`,zero:!0}),"xdr:row":new Pi({tag:`xdr:row`,zero:!0}),"xdr:rowOff":new Pi({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}}},fc=class extends N{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}}},pc=class extends N{constructor(){super(),this.map={"a:blip":new fc}}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}}},mc=class extends N{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}},hc=class extends N{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}}},gc=class extends N{constructor(){super(),this.map={"a:hlinkClick":new mc,"a:extLst":new hc}}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}}},_c=class extends N{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}}},vc=class extends N{constructor(){super(),this.map={"xdr:cNvPr":new gc,"xdr:cNvPicPr":new _c}}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 yc={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 bc=class extends N{constructor(){super(),this.map={"xdr:nvPicPr":new vc,"xdr:blipFill":new pc,"xdr:spPr":new ji(yc)}}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}}},xc=class extends N{get tag(){return`xdr:sp`}render(e,t){t&&(e.openNode(this.tag,{macro:``,textlink:``}),e.openNode(`xdr:nvSpPr`),e.openNode(`xdr:cNvPr`,{id:t.cNvPrId,name:t.name,hidden:t.hidden?`1`:void 0}),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{63B3BB69-23CF-44E3-9099-C40C66FF867C}`}),e.leafNode(`a14:compatExt`,{spid:t.spid,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`},void 0),e.closeNode(),e.closeNode(),e.closeNode(),e.leafNode(`xdr:cNvSpPr`),e.closeNode(),e.openNode(`xdr:spPr`,{bwMode:`auto`}),e.openNode(`a:xfrm`),e.leafNode(`a:off`,{x:0,y:0}),e.leafNode(`a:ext`,{cx:0,cy:0}),e.closeNode(),e.openNode(`a:prstGeom`,{prst:`rect`}),e.leafNode(`a:avLst`),e.closeNode(),e.leafNode(`a:noFill`),e.openNode(`a:ln`),e.leafNode(`a:noFill`),e.closeNode(),e.openNode(`a:extLst`),e.openNode(`a:ext`,{uri:`{909E8E84-426E-40DD-AFC4-6F175D3DCCD1}`}),e.openNode(`a14:hiddenFill`,{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`F0F0F0`}),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`a:ext`,{uri:`{91240B29-F687-4F45-9708-019B960494DF}`}),e.openNode(`a14:hiddenLine`,{w:9525,"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:miter`,{lim:8e5}),e.leafNode(`a:headEnd`),e.leafNode(`a:tailEnd`),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.openNode(`xdr:txBody`),e.leafNode(`a:bodyPr`,{vertOverflow:`clip`,wrap:`square`,lIns:18288,tIns:18288,rIns:0,bIns:18288,anchor:`ctr`,upright:1}),e.leafNode(`a:lstStyle`),e.openNode(`a:p`),e.openNode(`a:pPr`,{algn:`l`,rtl:0}),e.leafNode(`a:defRPr`,{sz:1e3}),e.closeNode(),e.openNode(`a:r`),e.openNode(`a:rPr`,{lang:`en-US`,sz:800,b:0,i:0,u:`none`,strike:`noStrike`,baseline:0}),e.openNode(`a:solidFill`),e.leafNode(`a:srgbClr`,{val:`000000`}),e.closeNode(),e.leafNode(`a:latin`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:ea`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.leafNode(`a:cs`,{typeface:`Tahoma`,pitchFamily:2,charset:0}),e.closeNode(),e.openNode(`a:t`),e.writeText(t.text??``),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode(),e.closeNode())}},Sc=class extends uc{constructor(){super(),this.map={"xdr:from":new dc({tag:`xdr:from`}),"xdr:to":new dc({tag:`xdr:to`}),"xdr:pic":new bc,"xdr:sp":new xc,"xdr:clientData":new ji({tag:`xdr:clientData`})}}get tag(){return`xdr:twoCellAnchor`}prepare(e,t){e.picture&&this.map[`xdr:pic`].prepare(e.picture,t)}render(e,t){let n=!!t.alternateContent;n&&(e.openNode(`mc:AlternateContent`,{"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`}),e.openNode(`mc:Choice`,{Requires:t.alternateContent?.requires,...t.alternateContent?.requires===`a14`?{"xmlns:a14":`http://schemas.microsoft.com/office/drawing/2010/main`}:{}})),e.openNode(this.tag,{editAs:t.range.editAs??`oneCell`}),this.map[`xdr:from`].render(e,t.range.tl),this.map[`xdr:to`].render(e,t.range.br),t.picture?this.map[`xdr:pic`].render(e,t.picture):t.shape&&this.map[`xdr:sp`].render(e,t.shape),this.map[`xdr:clientData`].render(e,{}),e.closeNode(),n&&(e.closeNode(),e.leafNode(`mc:Fallback`),e.closeNode())}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.range.tl=this.map[`xdr:from`].model,this.model.range.br=this.map[`xdr:to`].model,this.model.picture=this.map[`xdr:pic`].model,!1;default:return!0}}reconcile(e,t){e.medium=this.reconcilePicture(e.picture,t)}};let Cc=9525;var wc=class extends N{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*Cc),r=Math.floor(t.height*Cc);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)/Cc,height:parseInt(e.attributes.cy??`0`,10)/Cc},!0):!1}parseText(e){}parseClose(e){return!1}},Tc=class extends uc{constructor(){super(),this.map={"xdr:from":new dc({tag:`xdr:from`}),"xdr:ext":new wc({tag:`xdr:ext`}),"xdr:pic":new bc,"xdr:clientData":new ji({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 Ec(e){return(typeof e.range==`string`?w.decode(e.range):e.range).br?`xdr:twoCellAnchor`:`xdr:oneCellAnchor`}var Dc=class e extends N{constructor(){super(),this.map={"xdr:twoCellAnchor":new Sc,"xdr:oneCellAnchor":new Tc},this.model={anchors:[]}}prepare(e){e.anchors.forEach((e,t)=>{e.anchorType=Ec(e),this.map[e.anchorType].prepare(e,{index:t})})}get tag(){return`xdr:wsDr`}render(t,n){let r=n||this.model;t.openXml(A),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`}}},Oc=class extends N{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}},kc=class extends N{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}},Ac=class extends N{constructor(){super(),this.map={customFilters:new P({tag:`customFilters`,count:!1,empty:!0,childXform:new Oc}),filters:new P({tag:`filters`,count:!1,empty:!0,childXform:new kc})},this.model={filterButton:!1}}get tag(){return`filterColumn`}prepare(e,t){e.colId=t.index.toString()}render(e,t){if(t.customFilters){e.openNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`}),this.map.customFilters.render(e,t.customFilters),e.closeNode();return}e.leafNode(this.tag,{colId:t.colId,hiddenButton:t.filterButton?`0`:`1`})}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{attributes:t}=e;switch(e.name){case this.tag:return this.model={filterButton:t.hiddenButton===`0`},!0;case`dynamicFilter`:return!0;default:if(this.parser=this.map[e.name],this.parser)return this.parseOpen(e),!0;throw new _(`filterColumn`,`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}}},jc=class extends N{constructor(){super(),this.map={filterColumn:new Ac},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 new _(`autoFilter`,`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 new _(`autoFilter`,`Unexpected xml node in parseClose: ${e}`)}}},Mc=class extends N{constructor(){super(),this._childText=``,this.model={name:``}}get tag(){return`tableColumn`}prepare(e,t){e.id=t.index+1}_renderAttributes(e){return{id:e.id.toString(),name:kt(e.name),totalsRowLabel:e.totalsRowLabel?kt(e.totalsRowLabel):void 0,totalsRowFunction:e.totalsRowFunction===`none`?void 0:e.totalsRowFunction,dxfId:e.dxfId}}render(e,t){t.calculatedColumnFormula||t.totalsRowFormula?(e.openNode(this.tag,this._renderAttributes(t)),t.calculatedColumnFormula&&e.leafNode(`calculatedColumnFormula`,void 0,t.calculatedColumnFormula),t.totalsRowFormula&&e.leafNode(`totalsRowFormula`,void 0,t.totalsRowFormula),e.closeNode()):e.leafNode(this.tag,this._renderAttributes(t))}parseOpen(e){if(e.name===this.tag){let{attributes:t}=e;return this.model={name:Tt(t.name),totalsRowLabel:t.totalsRowLabel?Tt(t.totalsRowLabel):void 0,totalsRowFunction:t.totalsRowFunction,dxfId:t.dxfId},!0}return(e.name===`calculatedColumnFormula`||e.name===`totalsRowFormula`)&&(this._childTag=e.name,this._childText=``),!0}parseText(e){this._childTag&&(this._childText+=e)}parseClose(e){return e===this.tag?!1:(this._childTag&&e===this._childTag&&(this.model[this._childTag]=this._childText,this._childTag=void 0),!0)}},Nc=class extends N{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}},Pc=class e extends N{constructor(){super(),this.map={autoFilter:new jc,tableColumns:new P({tag:`tableColumns`,count:!0,empty:!0,childXform:new Mc}),tableStyleInfo:new Nc},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(A),t.openNode(this.tag,{...e.TABLE_ATTRIBUTES,id:n.id,name:n.name,displayName:n.displayName||n.name,ref:n.tableRef,totalsRowCount:n.totalsRow?`1`:void 0,headerRowCount:n.headerRow?void 0:`0`}),this.map.autoFilter.render(t,n),this.map.tableColumns.render(t,n.columns),this.map.tableStyleInfo.render(t,n.style),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;let{name:t,attributes:n}=e;switch(t){case this.tag:this.reset(),this.model={name:n.name,displayName:n.displayName||n.name,tableRef:n.ref,totalsRow:n.totalsRowCount===`1`,headerRow:n.headerRowCount!==`0`};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.parser=void 0),!0;switch(e){case this.tag:return this.model.columns=this.map.tableColumns.model,this.map.autoFilter.model&&(this.model.autoFilterRef=this.map.autoFilter.model.autoFilterRef,this.map.autoFilter.model.columns.forEach((e,t)=>{this.model.columns[t].filterButton=e.filterButton})),this.model.style=this.map.tableStyleInfo.model,!1;default:return!0}}reconcile(e,t){e.tableRef&&!e.ref&&(e.ref=e.tableRef),e.rows||=[],e.columns.forEach(e=>{e.dxfId!==void 0&&(e.style=t.styles.getDxfStyle(e.dxfId))})}static{this.TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}};function Fc(e){return isNaN(e.getTime())?``:e.toISOString().replace(/\.\d{3}Z$/,``)}function Ic(e){let t=k(e.name),n=e.numFmtId??`0`,r=Rc(e.extraAttrs),i=e.fieldGroupXml?`\n ${e.fieldGroupXml}`:``;if(e.sharedItems===null){if(e.isLoaded)return i?`<cacheField name="${t}" numFmtId="${n}"${r}>${i}\n </cacheField>`:`<cacheField name="${t}" numFmtId="${n}"${r} />`;let a;return a=e.minValue!==void 0&&e.maxValue!==void 0?` containsSemiMixedTypes="0" containsString="0" containsNumber="1"${e.containsInteger?` containsInteger="1"`:``} minValue="${e.minValue}" maxValue="${e.maxValue}"`:``,`<cacheField name="${t}" numFmtId="${n}"${r}>
|
|
13
13
|
<sharedItems${a} />${i}
|
|
14
14
|
</cacheField>`}if(e.isLoaded&&e.sharedItems.length===0)return`<cacheField name="${t}" numFmtId="${n}"${r}>
|
|
15
15
|
<sharedItems${zc(e)} />${i}
|
|
@@ -17,7 +17,7 @@ var ExcelTS=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
|
|
|
17
17
|
<sharedItems${zc(e)} count="${e.sharedItems.length}">
|
|
18
18
|
${a}
|
|
19
19
|
</sharedItems>${i}
|
|
20
|
-
</cacheField>`}let a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!0,f=1/0,p=-1/0;for(let t of e.sharedItems)t===null?l=!0:t instanceof qt?u=!0:typeof t==`string`?a=!0:typeof t==`number`?Number.isFinite(t)?(o=!0,t<f&&(f=t),t>p&&(p=t),Number.isInteger(t)||(d=!1)):l=!0:typeof t==`boolean`?s=!0:t instanceof Date&&(c=!0);let m=[];a||(m.push(`containsSemiMixedTypes="0"`),m.push(`containsString="0"`))
|
|
20
|
+
</cacheField>`}let a=!1,o=!1,s=!1,c=!1,l=!1,u=!1,d=!0,f=1/0,p=-1/0;for(let t of e.sharedItems)t===null?l=!0:t instanceof qt?u=!0:typeof t==`string`?a=!0:typeof t==`number`?Number.isFinite(t)?(o=!0,t<f&&(f=t),t>p&&(p=t),Number.isInteger(t)||(d=!1)):l=!0:typeof t==`boolean`?s=!0:t instanceof Date&&(c=!0);let m=[];a||(m.push(`containsSemiMixedTypes="0"`),m.push(`containsString="0"`)),+!!a+ +!!o+ +!!s+ +!!c+ +!!u>1&&m.push(`containsMixedTypes="1"`),o&&(m.push(`containsNumber="1"`),d&&m.push(`containsInteger="1"`),m.push(`minValue="${f}"`),m.push(`maxValue="${p}"`)),c&&m.push(`containsDate="1"`),l&&m.push(`containsBlank="1"`);let h=Lc(e.sharedItems);return`<cacheField name="${t}" numFmtId="${n}"${r}>
|
|
21
21
|
<sharedItems${m.length>0?` ${m.join(` `)}`:``} count="${e.sharedItems.length}">
|
|
22
22
|
${h}
|
|
23
23
|
</sharedItems>${i}
|
|
@@ -30,7 +30,7 @@ var ExcelTS=(function(e){Object.defineProperty(e,Symbol.toStringTag,{value:`Modu
|
|
|
30
30
|
<m />`);n.push(`
|
|
31
31
|
</r>`)}return n.join(``)}renderCellNew(e,t){if(e==null||typeof e==`number`&&!Number.isFinite(e)){if(t===null)return`<m />`;let e=t.indexOf(null);return e>=0?`<x v="${e}" />`:`<m />`}if(t===null)return e instanceof qt?`<e v="${k(e.code)}" />`:typeof e==`boolean`?`<b v="${e?`1`:`0`}" />`:e instanceof Date?`<d v="${Fc(e)}" />`:Number.isFinite(e)?`<n v="${e}" />`:`<s v="${k(String(e))}" />`;let n=Hc(t,e);if(n<0)throw new S(`${JSON.stringify(e)} not in sharedItems ${JSON.stringify(t)}`);return`<x v="${n}" />`}parseOpen(e){let{name:t,attributes:n}=e;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))Bc.has(t)||(e[t]=String(r));this.model={records:[],count:parseInt(n.count??`0`,10),isLoaded:!0,extraRootAttrs:Object.keys(e).length>0?e:void 0};break}case`r`:this.currentRecord=[];break;case`x`:this.currentRecord&&this.currentRecord.push({type:`x`,value:parseInt(n.v??`0`,10)});break;case`n`:this.currentRecord&&(n.v===void 0||n.v===``?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`n`,value:parseFloat(n.v)}));break;case`s`:this.currentRecord&&this.currentRecord.push({type:`s`,value:n.v??``});break;case`b`:this.currentRecord&&this.currentRecord.push({type:`b`,value:n.v===`1`});break;case`m`:this.currentRecord&&this.currentRecord.push({type:`m`});break;case`d`:if(this.currentRecord)if(!n.v)this.currentRecord.push({type:`m`});else{let e=Ct(n.v);isNaN(e.getTime())?this.currentRecord.push({type:`m`}):this.currentRecord.push({type:`d`,value:e})}break;case`e`:this.currentRecord&&this.currentRecord.push({type:`e`,value:n.v??``});break}return!0}parseText(e){}parseClose(e){switch(e){case this.tag:return!1;case`r`:this.model&&this.currentRecord&&(this.model.records.push(this.currentRecord),this.currentRecord=null);break}return!0}static{this.PIVOT_CACHE_RECORDS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`,"xmlns:mc":`http://schemas.openxmlformats.org/markup-compatibility/2006`,"mc:Ignorable":`xr`,"xmlns:xr":`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`}}};function Hc(e,t){if(t instanceof Date){let n=t.getTime();for(let t=0;t<e.length;t++){let r=e[t];if(r instanceof Date&&r.getTime()===n)return t}return-1}if(t instanceof qt){for(let n=0;n<e.length;n++){let r=e[n];if(r instanceof qt&&r.code===t.code)return n}return-1}return e.indexOf(t)}var Uc=class{constructor(e){this.active=!1,this.depth=0,this.buffer=[],this.lastOpenIndex=-1,this.rootTag=e}start(e){this.active=!0,this.depth=0;let t=Wc(e);this.buffer=[`<${this.rootTag}${t?` `+t:``}>`]}startAs(e,t){this.rootTag=e,this.start(t)}reset(){this.active=!1,this.depth=0,this.buffer.length=0,this.lastOpenIndex=-1}feedOpen(e,t){let n=Wc(t);this.buffer.push(`<${e}${n?` `+n:``}>`),this.depth++,this.lastOpenIndex=this.buffer.length-1}feedText(e){this.buffer.push(k(e)),this.lastOpenIndex=-1}feedClose(e){if(e===this.rootTag&&this.depth===0)return this.buffer.push(`</${e}>`),this.active=!1,this.lastOpenIndex=-1,!0;if(this.depth>0&&this.depth--,this.lastOpenIndex>=0&&this.lastOpenIndex===this.buffer.length-1){let e=this.buffer[this.lastOpenIndex];return this.buffer[this.lastOpenIndex]=e.slice(0,-1)+` />`,this.lastOpenIndex=-1,!1}return this.lastOpenIndex=-1,this.buffer.push(`</${e}>`),!1}get result(){return this.buffer.join(``)}};function Wc(e){if(!e)return``;let t=Object.entries(e);return t.length===0?``:t.filter(([,e])=>e!=null).map(([e,t])=>`${e}="${k(String(t))}"`).join(` `)}let Gc=new Set([`name`,`numFmtId`]);var Kc=class extends N{constructor(){super(),this.inSharedItems=!1,this.fieldGroupCollector=new Uc(`fieldGroup`),this.model=null}get tag(){return`cacheField`}reset(){this.model=null,this.inSharedItems=!1,this.fieldGroupCollector.reset()}parseOpen(e){let{name:t,attributes:n}=e;if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedOpen(t,n),!0;switch(t){case`cacheField`:{let e={};for(let[t,r]of Object.entries(n))Gc.has(t)||(e[t]=String(r));this.model={name:n.name??``,sharedItems:null,numFmtId:n.numFmtId,isLoaded:!0,extraAttrs:Object.keys(e).length>0?e:void 0};break}case`fieldGroup`:this.model&&this.fieldGroupCollector.start(n);break;case`sharedItems`:if(this.inSharedItems=!0,this.model){if(n.containsNumber!==void 0&&(this.model.containsNumber=n.containsNumber),n.containsInteger!==void 0&&(this.model.containsInteger=n.containsInteger),n.minValue!==void 0){let e=parseFloat(n.minValue);Number.isFinite(e)&&(this.model.minValue=e)}if(n.maxValue!==void 0){let e=parseFloat(n.maxValue);Number.isFinite(e)&&(this.model.maxValue=e)}n.containsSemiMixedTypes!==void 0&&(this.model.containsSemiMixedTypes=n.containsSemiMixedTypes),n.containsNonDate!==void 0&&(this.model.containsNonDate=n.containsNonDate),n.containsString!==void 0&&(this.model.containsString=n.containsString),n.containsBlank!==void 0&&(this.model.containsBlank=n.containsBlank),n.containsDate!==void 0&&(this.model.containsDate=n.containsDate),n.containsMixedTypes!==void 0&&(this.model.containsMixedTypes=n.containsMixedTypes),this.model.sharedItems=[]}break;case`s`:case`n`:case`b`:case`e`:case`m`:case`d`:this.inSharedItems&&this.model&&this.model.sharedItems!==null&&this.model.sharedItems.push(qc(t,n));break}return!0}parseText(e){this.fieldGroupCollector.active&&this.fieldGroupCollector.feedText(e)}parseClose(e){if(this.fieldGroupCollector.active)return this.fieldGroupCollector.feedClose(e)&&(this.model&&(this.model.fieldGroupXml=this.fieldGroupCollector.result),this.fieldGroupCollector.reset()),!0;switch(e){case`cacheField`:return!1;case`sharedItems`:this.inSharedItems=!1;break}return!0}};function qc(e,t){switch(e){case`s`:return t.v??``;case`n`:return t.v===void 0||t.v===``?null:parseFloat(t.v);case`b`:return t.v===`1`;case`e`:return new qt(t.v??``);case`m`:return null;case`d`:{if(!t.v)return null;let e=Ct(t.v);return isNaN(e.getTime())?null:e}default:return null}}let Jc=new Set([`xmlns`,`xmlns:r`,`r:id`,`refreshOnLoad`,`createdVersion`,`refreshedVersion`,`minRefreshableVersion`,`recordCount`,`backgroundQuery`,`supportSubquery`,`supportAdvancedDrill`]);var Yc=class e extends N{constructor(){super(),this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector=new Uc(`extLst`),this.unknownCollector=new Uc(``),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector=new Uc(``),this.cacheSourceXmlParts=[],this.model=null}get tag(){return`pivotCacheDefinition`}reset(){this.model=null,this.currentCacheField=null,this.inCacheFields=!1,this.inCacheSource=!1,this.extLstCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[],this.cacheSourceChildCollector.reset(),this.cacheSourceXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded||!(`source`in t)?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{source:r,cacheFields:i}=n,a=r.getSheetValues().slice(2).filter(Array.isArray).length;t.openXml(A),t.openNode(this.tag,{...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":`rId1`,refreshOnLoad:`1`,createdVersion:`8`,refreshedVersion:`8`,minRefreshableVersion:`3`,recordCount:a}),t.openNode(`cacheSource`,{type:`worksheet`});let o=r.tableName?{name:r.tableName}:{ref:r.dimensions.shortRange,sheet:r.name};t.leafNode(`worksheetSource`,o),t.closeNode(),t.openNode(`cacheFields`,{count:i.length}),t.writeRaw(e.renderCacheFieldsXml(i)),t.closeNode(),t.closeNode()}renderLoaded(t,n){let{cacheFields:r,sourceRef:i,sourceSheet:a,sourceTableName:o,recordCount:s}=n;t.openXml(A);let c={...e.PIVOT_CACHE_DEFINITION_ATTRIBUTES,"r:id":n.rId??`rId1`};if(n.refreshOnLoad&&(c.refreshOnLoad=n.refreshOnLoad),c.createdVersion=n.createdVersion??`8`,c.refreshedVersion=n.refreshedVersion??`8`,c.minRefreshableVersion=n.minRefreshableVersion??`3`,s!==void 0&&(c.recordCount=s),n.backgroundQuery&&(c.backgroundQuery=n.backgroundQuery),n.supportSubquery&&(c.supportSubquery=n.supportSubquery),n.supportAdvancedDrill&&(c.supportAdvancedDrill=n.supportAdvancedDrill),n.extraRootAttrs)for(let[e,t]of Object.entries(n.extraRootAttrs))c[e]=t;if(t.openNode(this.tag,c),t.openNode(`cacheSource`,{type:n.cacheSourceType??`worksheet`}),!n.cacheSourceType||n.cacheSourceType===`worksheet`){let e=o?{name:o}:{ref:i,sheet:a};n.worksheetSourceRId&&(e[`r:id`]=n.worksheetSourceRId),Object.values(e).some(e=>e!==void 0)&&t.leafNode(`worksheetSource`,e)}n.cacheSourceXml&&t.writeRaw(n.cacheSourceXml),t.closeNode(),t.openNode(`cacheFields`,{count:r.length}),t.writeRaw(e.renderCacheFieldsXml(r)),t.closeNode(),n.unknownElementsXml&&t.writeRaw(n.unknownElementsXml),n.extLstXml&&t.writeRaw(n.extLstXml),t.closeNode()}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedOpen(t,n),!0;if(this.currentCacheField)return this.currentCacheField.parseOpen(e),!0;switch(t){case this.tag:{this.reset();let e={};for(let[t,r]of Object.entries(n))Jc.has(t)||(e[t]=String(r));this.model={cacheFields:[],rId:n[`r:id`],refreshOnLoad:n.refreshOnLoad,createdVersion:n.createdVersion,refreshedVersion:n.refreshedVersion,minRefreshableVersion:n.minRefreshableVersion,recordCount:n.recordCount?parseInt(n.recordCount,10):void 0,backgroundQuery:n.backgroundQuery,supportSubquery:n.supportSubquery,supportAdvancedDrill:n.supportAdvancedDrill,extraRootAttrs:Object.keys(e).length>0?e:void 0,isLoaded:!0};break}case`cacheSource`:this.inCacheSource=!0,this.model&&(this.model.cacheSourceType=n.type);break;case`worksheetSource`:this.inCacheSource&&this.model&&(this.model.sourceRef=n.ref,this.model.sourceSheet=n.sheet,this.model.sourceTableName=n.name,n[`r:id`]&&(this.model.worksheetSourceRId=n[`r:id`]));break;case`cacheFields`:this.inCacheFields=!0;break;case`cacheField`:this.inCacheFields&&(this.currentCacheField=new Kc,this.currentCacheField.parseOpen(e));break;case`extLst`:this.model&&this.extLstCollector.start(n);break;default:if(this.inCacheSource&&this.model){this.cacheSourceChildCollector.startAs(t,n);break}this.model&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){if(this.extLstCollector.active){this.extLstCollector.feedText(e);return}if(this.unknownCollector.active){this.unknownCollector.feedText(e);return}if(this.cacheSourceChildCollector.active){this.cacheSourceChildCollector.feedText(e);return}this.currentCacheField&&this.currentCacheField.parseText(e)}parseClose(e){if(this.extLstCollector.active)return this.extLstCollector.feedClose(e)&&(this.model&&(this.model.extLstXml=this.extLstCollector.result),this.extLstCollector.reset()),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.cacheSourceChildCollector.active)return this.cacheSourceChildCollector.feedClose(e)&&(this.cacheSourceXmlParts.push(this.cacheSourceChildCollector.result),this.cacheSourceChildCollector.reset()),!0;if(this.currentCacheField)return this.currentCacheField.parseClose(e)||(this.model&&this.currentCacheField.model&&this.model.cacheFields.push(this.currentCacheField.model),this.currentCacheField=null),!0;switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`cacheSource`:this.inCacheSource=!1,this.model&&this.cacheSourceXmlParts.length>0&&(this.model.cacheSourceXml=this.cacheSourceXmlParts.join(``));break;case`cacheFields`:this.inCacheFields=!1;break}return!0}static renderCacheFieldsXml(e){return`
|
|
32
32
|
`+e.map(e=>Ic(e)).join(`
|
|
33
|
-
`)}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`}}};let Xc=`PivotStyleLight16`,Zc=new Set([`axisRow`,`axisCol`,`axisPage`,`axisValues`]),Qc=[`x`,`t`,`h`,`sd`,`f`,`m`,`c`,`d`];function $c(){return{currentSection:null,inPivotArea:!1,inAutoSortScope:!1}}let el=new Set([`axis`,`dataField`,`compact`,`outline`,`showAll`,`defaultSubtotal`,`numFmtId`,`sortType`,`subtotalTop`,`insertBlankRow`,`multipleItemSelectionAllowed`]);var tl=class e extends N{constructor(){super(),this.state=$c(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector=new Uc(`extLst`),this.formatsCollector=new Uc(`formats`),this.conditionalFormatsCollector=new Uc(`conditionalFormats`),this.filtersCollector=new Uc(`filters`),this.unknownCollector=new Uc(``),this.unknownElementsXmlParts=[],this.model=null}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.state=$c(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector.reset(),this.formatsCollector.reset(),this.conditionalFormatsCollector.reset(),this.filtersCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{rows:r,columns:i,values:a,pages:o=[],cacheFields:s,cacheId:c,tableNumber:l,applyWidthHeightFormats:u}=n,d=i.length===0&&a.length>1,f=o.length,p=f>0?f+1:0,m=r.length,h=3+p,g=h+1,_=m+(d?a.length:1),v=`A${h}:${w.n2l(_)}${g}`;t.openXml(A),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,name:`PivotTable${l}`,cacheId:c,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:u,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`});let y={ref:v,firstHeaderRow:1,firstDataRow:1,firstDataCol:m};f>0&&(y.rowPageCount=f,y.colPageCount=1),t.leafNode(`location`,y),il(t,n),t.openNode(`rowFields`,{count:r.length});for(let e of r)t.leafNode(`field`,{x:e});if(t.closeNode(),t.openNode(`rowItems`,{count:1}),t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode(),i.length>0){let e=a.length>1?i.length+1:i.length;t.openNode(`colFields`,{count:e});for(let e of i)t.leafNode(`field`,{x:e});a.length>1&&t.leafNode(`field`,{x:-2}),t.closeNode()}else d&&(t.openNode(`colFields`,{count:1}),t.leafNode(`field`,{x:-2}),t.closeNode());if(d){t.openNode(`colItems`,{count:a.length+1});for(let e=0;e<a.length;e++)t.openNode(`i`),t.leafNode(`x`,e===0?void 0:{v:e}),t.closeNode();t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode()}else t.openNode(`colItems`,{count:1}),t.leafNode(`i`),t.closeNode();if(f>0){t.openNode(`pageFields`,{count:f});for(let e of o)t.leafNode(`pageField`,{fld:e,hier:-1});t.closeNode()}rl(t,s,a,n.valueMetrics),t.leafNode(`pivotTableStyleInfo`,{name:Xc,showRowHeaders:`1`,showColHeaders:`1`,showRowStripes:`0`,showColStripes:`0`,showLastColumn:`1`}),t.writeRaw(e.EXTLST_XML),t.closeNode()}renderLoaded(t,n){let r=this.buildLoadedRootAttributes(n);if(t.openXml(A),t.openNode(this.tag,r),n.location){let e={ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol};n.location.rowPageCount!==void 0&&(e.rowPageCount=n.location.rowPageCount),n.location.colPageCount!==void 0&&(e.colPageCount=n.location.colPageCount),t.leafNode(`location`,e)}if(n.pivotFields.length>0){t.openNode(`pivotFields`,{count:n.pivotFields.length});for(let e of n.pivotFields)this.renderPivotFieldLoaded(t,e);t.closeNode()}if(n.rowFields.length>0){t.openNode(`rowFields`,{count:n.rowFields.length});for(let e of n.rowFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.rowItems&&n.rowItems.length>0){t.openNode(`rowItems`,{count:n.rowItems.length});for(let e of n.rowItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasRowItems&&t.writeRaw(`<rowItems count="1"><i t="grand"><x/></i></rowItems>`);if(n.hasColFields||n.colFields.length>0)if(n.colFields.length===0&&n.dataFields.length<=1)t.leafNode(`colFields`,{count:0});else{let e=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:e}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.colItems&&n.colItems.length>0){t.openNode(`colItems`,{count:n.colItems.length});for(let e of n.colItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasColItems&&t.writeRaw(`<colItems count="1"><i t="grand"><x/></i></colItems>`);if(n.pageFields&&n.pageFields.length>0){t.openNode(`pageFields`,{count:n.pageFields.length});for(let e of n.pageFields){let n={fld:e.fld};e.item!==void 0&&(n.item=e.item),e.hier!==void 0&&(n.hier=e.hier),e.name!==void 0&&(n.name=e.name),t.leafNode(`pageField`,n)}t.closeNode()}if(n.dataFields.length>0){t.openNode(`dataFields`,{count:n.dataFields.length});for(let e of n.dataFields){let n={name:e.name,fld:e.fld};e.baseField!==void 0&&(n.baseField=e.baseField),e.baseItem!==void 0&&(n.baseItem=e.baseItem),e.subtotal!==void 0&&e.subtotal!==`sum`&&(n.subtotal=e.subtotal),e.numFmtId!==void 0&&(n.numFmtId=e.numFmtId),t.leafNode(`dataField`,n)}t.closeNode()}n.formatsXml&&t.writeRaw(n.formatsXml),n.conditionalFormatsXml&&t.writeRaw(n.conditionalFormatsXml),n.chartFormats&&n.chartFormats.length>0&&this.renderChartFormats(t,n.chartFormats);let i=n.styleInfo;t.leafNode(`pivotTableStyleInfo`,{name:i?.name??n.styleName??Xc,showRowHeaders:i?.showRowHeaders??`1`,showColHeaders:i?.showColHeaders??`1`,showRowStripes:i?.showRowStripes??`0`,showColStripes:i?.showColStripes??`0`,showLastColumn:i?.showLastColumn??`1`}),n.filtersXml&&t.writeRaw(n.filtersXml),n.unknownElementsXml&&t.writeRaw(n.unknownElementsXml);let a=n.extLstXml??(n.isLoaded?``:e.EXTLST_XML);a&&t.writeRaw(a),t.closeNode()}buildLoadedRootAttributes(t){let n={...e.PIVOT_TABLE_ATTRIBUTES,name:t.name??`PivotTable1`,cacheId:String(t.cacheId),applyNumberFormats:t.applyNumberFormats??`0`,applyBorderFormats:t.applyBorderFormats??`0`,applyFontFormats:t.applyFontFormats??`0`,applyPatternFormats:t.applyPatternFormats??`0`,applyAlignmentFormats:t.applyAlignmentFormats??`0`,applyWidthHeightFormats:t.applyWidthHeightFormats??`0`,dataCaption:t.dataCaption??`Values`,updatedVersion:t.updatedVersion??`8`,minRefreshableVersion:t.minRefreshableVersion??`3`};return t.useAutoFormatting!==void 0&&(n.useAutoFormatting=t.useAutoFormatting),t.itemPrintTitles!==void 0&&(n.itemPrintTitles=t.itemPrintTitles),t.multipleFieldFilters!==void 0&&(n.multipleFieldFilters=t.multipleFieldFilters),n.createdVersion=t.createdVersion??`8`,t.indent!==void 0&&(n.indent=String(t.indent)),t.uid&&(n[`xmlns:xr`]=`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,n[`xr:uid`]=t.uid),t.outline&&(n.outline=`1`),t.outlineData&&(n.outlineData=`1`),t.chartFormat!==void 0&&(n.chartFormat=String(t.chartFormat)),t.colGrandTotals!==void 0&&(n.colGrandTotals=t.colGrandTotals),t.rowGrandTotals!==void 0&&(n.rowGrandTotals=t.rowGrandTotals),t.showError!==void 0&&(n.showError=t.showError),t.errorCaption!==void 0&&(n.errorCaption=t.errorCaption),t.showMissing!==void 0&&(n.showMissing=t.showMissing),t.missingCaption!==void 0&&(n.missingCaption=t.missingCaption),t.grandTotalCaption!==void 0&&(n.grandTotalCaption=t.grandTotalCaption),t.compact===!1&&(n.compact=`0`),t.compactData===!1&&(n.compactData=`0`),n}renderChartFormats(e,t){e.openNode(`chartFormats`,{count:t.length});for(let n of t)e.openNode(`chartFormat`,{chart:n.chart,format:n.format,series:n.series===!0?`1`:n.series===!1?`0`:void 0}),n.pivotAreaXml?e.writeRaw(n.pivotAreaXml):e.writeRaw(`<pivotArea type="data" outline="0" fieldPosition="0"><references count="1"><reference field="4294967294" count="1" selected="0"><x v="0"/></reference></references></pivotArea>`),e.closeNode();e.closeNode()}renderRowColItem(e,t){let n={};if(t.t!==void 0&&(n.t=t.t),t.r!==void 0&&(n.r=t.r),t.i!==void 0&&(n.i=t.i),t.x.length>0){e.openNode(`i`,n);for(let n of t.x)n.v===0?e.leafNode(`x`):e.leafNode(`x`,{v:n.v});e.closeNode()}else e.leafNode(`i`,n)}renderPivotFieldLoaded(e,t){let n={};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.numFmtId!==void 0&&(n.numFmtId=String(t.numFmtId)),t.sortType&&(n.sortType=t.sortType),t.compact===!1&&(n.compact=`0`),t.outline===!1&&(n.outline=`0`),n.showAll=t.showAll?`1`:`0`,t.defaultSubtotal===!1&&(n.defaultSubtotal=`0`),t.subtotalTop===!1&&(n.subtotalTop=`0`),t.insertBlankRow===!0&&(n.insertBlankRow=`1`),t.multipleItemSelectionAllowed===!0&&(n.multipleItemSelectionAllowed=`1`),t.extraAttrs)for(let[e,r]of Object.entries(t.extraAttrs))n[e]=r;if(t.items!==void 0&&t.items.length>0||t.autoSortScopeXml!==void 0){if(e.openNode(`pivotField`,n),t.items!==void 0&&t.items.length>0){e.openNode(`items`,{count:t.items.length});for(let n of t.items){let t={};for(let e of Qc)n[e]!==void 0&&(t[e]=n[e]);e.leafNode(`item`,t)}e.closeNode()}t.autoSortScopeXml&&e.writeRaw(t.autoSortScopeXml),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.formatsCollector.active)return this.formatsCollector.feedOpen(t,n),!0;if(this.conditionalFormatsCollector.active)return this.conditionalFormatsCollector.feedOpen(t,n),!0;if(this.filtersCollector.active)return this.filtersCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId??`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],pageFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting,itemPrintTitles:n.itemPrintTitles,indent:n.indent===void 0?void 0:parseInt(n.indent,10),compact:n.compact!==`0`,compactData:n.compactData!==`0`,multipleFieldFilters:n.multipleFieldFilters,outline:n.outline===`1`,outlineData:n.outlineData===`1`,chartFormat:n.chartFormat===void 0?void 0:parseInt(n.chartFormat,10),colGrandTotals:n.colGrandTotals,rowGrandTotals:n.rowGrandTotals,showError:n.showError,errorCaption:n.errorCaption,showMissing:n.showMissing,missingCaption:n.missingCaption,grandTotalCaption:n.grandTotalCaption,rowItems:[],colItems:[],chartFormats:[],isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow===void 0?void 0:parseInt(n.firstHeaderRow,10),firstDataRow:n.firstDataRow===void 0?void 0:parseInt(n.firstDataRow,10),firstDataCol:n.firstDataCol===void 0?void 0:parseInt(n.firstDataCol,10),rowPageCount:n.rowPageCount===void 0?void 0:parseInt(n.rowPageCount,10),colPageCount:n.colPageCount===void 0?void 0:parseInt(n.colPageCount,10)});break;case`pivotFields`:this.state.currentSection=`pivotFields`;break;case`pivotField`:if(this.state.currentSection===`pivotFields`){let e={};for(let[t,r]of Object.entries(n))el.has(t)||(e[t]=String(r));this.currentPivotField={axis:Zc.has(n.axis)?n.axis:void 0,dataField:n.dataField===`1`,items:[],compact:n.compact!==`0`,outline:n.outline!==`0`,showAll:n.showAll!==`0`,defaultSubtotal:n.defaultSubtotal!==`0`,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10),sortType:n.sortType,subtotalTop:n.subtotalTop===void 0?void 0:n.subtotalTop===`1`,insertBlankRow:n.insertBlankRow===`1`?!0:void 0,multipleItemSelectionAllowed:n.multipleItemSelectionAllowed===`1`?!0:void 0,extraAttrs:Object.keys(e).length>0?e:void 0}}break;case`items`:break;case`item`:if(this.currentPivotField){let e={};n.x!==void 0&&(e.x=parseInt(n.x,10));for(let t of Qc)t!==`x`&&n[t]!==void 0&&(e[t]=n[t]);this.currentPivotField.items.push(e)}break;case`autoSortScope`:this.currentPivotField&&(this.state.inAutoSortScope=!0,this.autoSortScopeXmlBuffer=[`<autoSortScope>`]);break;case`rowFields`:this.state.currentSection=`rowFields`;break;case`colFields`:this.state.currentSection=`colFields`,this.model&&(this.model.hasColFields=!0);break;case`dataFields`:this.state.currentSection=`dataFields`;break;case`pageFields`:this.state.currentSection=`pageFields`;break;case`pageField`:this.state.currentSection===`pageFields`&&this.model&&this.model.pageFields.push({fld:parseInt(n.fld??`0`,10),item:n.item===void 0?void 0:parseInt(n.item,10),hier:n.hier===void 0?void 0:parseInt(n.hier,10),name:n.name});break;case`rowItems`:this.state.currentSection=`rowItems`,this.model&&(this.model.hasRowItems=!0);break;case`colItems`:this.state.currentSection=`colItems`,this.model&&(this.model.hasColItems=!0);break;case`i`:if(this.model){let e=this.state.currentSection===`rowItems`||this.state.currentSection===`colItems`?nl(n):null;this.state.currentSection===`rowItems`?this.currentRowItem=e:this.state.currentSection===`colItems`&&(this.currentColItem=e)}break;case`x`:if(this.state.inPivotArea){let e=Wc(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(e?`<x ${e}/>`:`<x/>`):this.pivotAreaXmlBuffer.push(e?`<x ${e}/>`:`<x/>`)}else this.currentRowItem?this.currentRowItem.x.push({v:parseInt(n.v??`0`,10)}):this.currentColItem&&this.currentColItem.x.push({v:parseInt(n.v??`0`,10)});break;case`chartFormats`:this.state.currentSection=`chartFormats`;break;case`chartFormat`:this.state.currentSection===`chartFormats`&&this.model&&(this.currentChartFormat={chart:parseInt(n.chart??`0`,10),format:parseInt(n.format??`0`,10),series:n.series===void 0?void 0:n.series===`1`});break;case`pivotArea`:if(this.currentChartFormat){this.state.inPivotArea=!0;let e=Wc(n);this.pivotAreaXmlBuffer=[e?`<pivotArea ${e}>`:`<pivotArea>`]}else if(this.state.inAutoSortScope){this.state.inPivotArea=!0;let e=Wc(n);this.autoSortScopeXmlBuffer.push(e?`<pivotArea ${e}>`:`<pivotArea>`)}break;case`references`:case`reference`:if(this.state.inPivotArea){let e=Wc(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`<${t}${e?` `+e:``}>`):this.pivotAreaXmlBuffer.push(`<${t}${e?` `+e:``}>`)}break;case`field`:if(this.model){let e=parseInt(n.x??`0`,10);this.state.currentSection===`rowFields`?this.model.rowFields.push(e):this.state.currentSection===`colFields`&&this.model.colFields.push(e)}break;case`dataField`:this.state.currentSection===`dataFields`&&this.model&&this.model.dataFields.push({name:n.name??``,fld:parseInt(n.fld??`0`,10),baseField:n.baseField===void 0?void 0:parseInt(n.baseField,10),baseItem:n.baseItem===void 0?void 0:parseInt(n.baseItem,10),subtotal:Yt.has(n.subtotal)?n.subtotal:void 0,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10)});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name,this.model.styleInfo={name:n.name,showRowHeaders:n.showRowHeaders,showColHeaders:n.showColHeaders,showRowStripes:n.showRowStripes,showColStripes:n.showColStripes,showLastColumn:n.showLastColumn});break;case`extLst`:this.model&&this.extLstCollector.start(n);break;case`formats`:this.model&&this.formatsCollector.start(n);break;case`conditionalFormats`:this.model&&this.conditionalFormatsCollector.start(n);break;case`filters`:this.model&&this.filtersCollector.start(n);break;default:this.model&&this.state.currentSection===null&&!this.state.inPivotArea&&!this.state.inAutoSortScope&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){this.extLstCollector.active?this.extLstCollector.feedText(e):this.formatsCollector.active?this.formatsCollector.feedText(e):this.conditionalFormatsCollector.active?this.conditionalFormatsCollector.feedText(e):this.filtersCollector.active?this.filtersCollector.feedText(e):this.unknownCollector.active&&this.unknownCollector.feedText(e)}tryCloseCollector(e,t,n){e.feedClose(t)&&(this.model&&(this.model[n]=e.result),e.reset())}parseClose(e){if(this.extLstCollector.active)return this.tryCloseCollector(this.extLstCollector,e,`extLstXml`),!0;if(this.formatsCollector.active)return this.tryCloseCollector(this.formatsCollector,e,`formatsXml`),!0;if(this.conditionalFormatsCollector.active)return this.tryCloseCollector(this.conditionalFormatsCollector,e,`conditionalFormatsXml`),!0;if(this.filtersCollector.active)return this.tryCloseCollector(this.filtersCollector,e,`filtersXml`),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.state.inPivotArea)return e===`pivotArea`?(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</pivotArea>`):(this.pivotAreaXmlBuffer.push(`</pivotArea>`),this.currentChartFormat&&(this.currentChartFormat.pivotAreaXml=this.pivotAreaXmlBuffer.join(``)),this.pivotAreaXmlBuffer=[]),this.state.inPivotArea=!1,!0):((e===`references`||e===`reference`)&&(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</${e}>`):this.pivotAreaXmlBuffer.push(`</${e}>`)),!0);switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`pivotFields`:case`rowFields`:case`colFields`:case`dataFields`:case`pageFields`:case`rowItems`:case`colItems`:case`chartFormats`:this.state.currentSection=null;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:break;case`autoSortScope`:this.state.inAutoSortScope&&this.currentPivotField&&(this.autoSortScopeXmlBuffer.push(`</autoSortScope>`),this.currentPivotField.autoSortScopeXml=this.autoSortScopeXmlBuffer.join(``),this.autoSortScopeXmlBuffer=[],this.state.inAutoSortScope=!1);break;case`i`:this.currentRowItem&&this.model?(this.model.rowItems?.push(this.currentRowItem),this.currentRowItem=null):this.currentColItem&&this.model&&(this.model.colItems?.push(this.currentColItem),this.currentColItem=null);break;case`chartFormat`:this.currentChartFormat&&this.model&&(this.model.chartFormats?.push(this.currentChartFormat),this.currentChartFormat=null);break}return!0}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}static{this.EXTLST_XML=`<extLst><ext uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:pivotTableDefinition hideValuesRow="1" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"/></ext><ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}" xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout"><xpdl:pivotTableDefinition16 EnabledSubtotalsDefault="0" SubtotalsOnTopDefault="0"/></ext></extLst>`}};function nl(e){return{t:e.t,r:e.r===void 0?void 0:parseInt(e.r,10),i:e.i===void 0?void 0:parseInt(e.i,10),x:[]}}function rl(e,t,n,r){e.openNode(`dataFields`,{count:n.length});for(let i=0;i<n.length;i++){let a=n[i],o=r[i]??`sum`,s=Jt[o],c=t[a];if(!c)throw Error(`Value field index ${a} is out of bounds (cacheFields has ${t.length} entries)`);let l={name:`${s} of ${c.name}`,fld:a,baseField:0,baseItem:0};o!==`sum`&&(l.subtotal=o),e.leafNode(`dataField`,l)}e.closeNode()}function il(e,t){let n=new Set(t.rows),r=new Set(t.columns),i=new Set(t.values),a=new Set(t.pages??[]);e.openNode(`pivotFields`,{count:t.cacheFields.length});for(let o=0;o<t.cacheFields.length;o++){let s=t.cacheFields[o];al(e,n.has(o),r.has(o),i.has(o),a.has(o),s.sharedItems)}e.closeNode()}function al(e,t,n,r,i,a){if(t||n||i){if(!a)throw Error(`sharedItems is required for axis field (row/column/page)`);let i={axis:t?`axisRow`:n?`axisCol`:`axisPage`};r&&(i.dataField=`1`),i.compact=`0`,i.outline=`0`,i.showAll=`0`,e.openNode(`pivotField`,i),e.openNode(`items`,{count:a.length+1});for(let t=0;t<a.length;t++)e.leafNode(`item`,{x:t});e.leafNode(`item`,{t:`default`}),e.closeNode(),e.closeNode();return}let o={};r&&(o.dataField=`1`),o.compact=`0`,o.outline=`0`,o.showAll=`0`,o.defaultSubtotal=`0`,e.leafNode(`pivotField`,o)}var ol=class extends N{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new oa,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}}},sl=class e extends N{constructor(){super(),this.map={comment:new ol},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(A),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`}}},cl=class extends N{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}}},ll=class extends N{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}},ul=class extends N{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model?.tag??``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},dl=class extends N{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model?.tag??``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};let fl=[`twoCells`,`oneCells`,`absolute`];var pl=class extends N{constructor(){super(),this.map={"x:Anchor":new ll,"x:Locked":new ul({tag:`x:Locked`}),"x:LockText":new ul({tag:`x:LockText`}),"x:SizeWithCells":new dl({tag:`x:SizeWithCells`}),"x:MoveWithCells":new dl({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,fl),this.map[`x:SizeWithCells`].render(e,r,fl),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=fl[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}},ml=class e extends N{constructor(){super(),this.map={"v:textbox":new cl,"x:ClientData":new pl}}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})}},hl=class e extends N{constructor(){super(),this.map={"v:shape":new ml},this.model={comments:[],formControls:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model,i=r.comments,a=r.formControls,o=i&&i.length>0,s=a&&a.length>0;if(t.openXml(A),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),o&&(t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode()),s&&(t.openNode(`v:shapetype`,{id:`_x0000_t201`,coordsize:`21600,21600`,"o:spt":`201`,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{shadowok:`f`,"o:extrusionok":`f`,strokeok:`f`,fillok:`f`,"o:connecttype":`rect`}),t.leafNode(`o:lock`,{"v:ext":`edit`,shapetype:`t`}),t.closeNode()),o)for(let e=0;e<i.length;e++)this.map[`v:shape`].render(t,i[e],e);if(s)for(let e of a)this._renderCheckboxShape(t,e);t.closeNode()}_renderCheckboxShape(e,t){let n={id:`_x0000_s${t.shapeId}`,type:`#_x0000_t201`,style:at.getVmlStyle(t),"o:insetmode":`auto`,fillcolor:`buttonFace [67]`,strokecolor:`windowText [64]`,"o:preferrelative":`t`,filled:`f`,stroked:`f`};e.openNode(`v:shape`,n),e.leafNode(`v:fill`,{"o:detectmouseclick":`t`}),e.leafNode(`o:lock`,{"v:ext":`edit`,text:`t`}),t.text&&(e.openNode(`v:textbox`,{style:`mso-direction-alt:auto`,"o:singleclick":`t`}),e.openNode(`div`,{style:`text-align:left`}),e.openNode(`font`,{face:`Tahoma`,size:`160`,color:`auto`}),e.writeText(t.text),e.closeNode(),e.closeNode(),e.closeNode()),e.openNode(`x:ClientData`,{ObjectType:`Checkbox`}),e.leafNode(`x:MoveWithCells`),e.leafNode(`x:SizeWithCells`),e.openNode(`x:Anchor`),e.writeText(at.getVmlAnchor(t)),e.closeNode(),e.leafNode(`x:Locked`,void 0,`False`),e.leafNode(`x:LockText`,void 0,`True`),e.leafNode(`x:PrintObject`,void 0,t.print?`True`:`False`),e.leafNode(`x:AutoFill`,void 0,`False`),e.leafNode(`x:AutoLine`,void 0,`False`),e.leafNode(`x:TextHAlign`,void 0,`Left`),e.leafNode(`x:TextVAlign`,void 0,`Center`),t.link&&e.leafNode(`x:FmlaLink`,void 0,t.link),t.noThreeD&&e.leafNode(`x:NoThreeD`),e.leafNode(`x:Checked`,void 0,String(at.getVmlCheckedValue(t))),e.leafNode(`x:Row`,void 0,String(t.tl.row)),e.leafNode(`x:Column`,void 0,String(t.tl.col)),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[],formControls:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},gl=class extends N{_checkedToXmlValue(e){switch(e){case`Checked`:return`1`;case`Mixed`:return`2`;default:return`0`}}get tag(){return`formControlPr`}render(e,t){let n=t||this.model,r={xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,objectType:`CheckBox`,checked:this._checkedToXmlValue(n.checked),lockText:`1`};n.link&&(r.fmlaLink=n.link),n.noThreeD&&(r.noThreeD=`1`),e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.leafNode(this.tag,r)}toXml(e){let t=new hi;return this.render(t,e),t.xml}parseOpen(){return!0}parseText(){}parseClose(){return!1}};let _l=e=>Array.isArray(e);var H=class e{constructor(){this.__excelts_stream=!0,this._listeners=new Map,this._maxListeners=e.defaultMaxListeners}static{this.defaultMaxListeners=10}addListener(e,t){return this.on(e,t)}_listenerCount(e){return e?_l(e)?e.length:1:0}_hasListeners(e){return this._listenerCount(this._listeners.get(e))>0}on(e,t){e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t);let n=this._listeners.get(e);if(this._maxListeners>0){let t=this._listenerCount(n);t>=this._maxListeners&&console?.warn?.(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${t+1} ${String(e)} listeners added. Use emitter.setMaxListeners() to increase limit`)}return n?_l(n)?n.push(t):this._listeners.set(e,[n,t]):this._listeners.set(e,t),this}prependListener(e,t){e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t);let n=this._listeners.get(e);return n?_l(n)?n.unshift(t):this._listeners.set(e,[t,n]):this._listeners.set(e,t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.on(e,n)}prependOnceListener(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.prependListener(e,n)}removeListener(e,t){return this.off(e,t)}off(e,t){let n=this._listeners.get(e);if(!n)return this;if(!_l(n))return(n===t||n.listener===t)&&(this._listeners.delete(e),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t)),this;let r=n;if(r.length===0)return this._listeners.delete(e),this;let i=r.lastIndexOf(t);if(i!==-1)r.splice(i,1);else for(let e=r.length-1;e>=0;e--)if(r[e].listener===t){r.splice(e,1);break}return r.length===0?this._listeners.delete(e):r.length===1&&this._listeners.set(e,r[0]),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t),this}emit(e,...t){let n=this._listeners.get(e);if(!n){if(e===`error`){let e=t[0];if(e instanceof Error)throw e;let n=`Unhandled error.${e===void 0?` (undefined)`:` (${e})`}`;throw Error(n)}return!1}if(!_l(n))return n.apply(this,t),!0;let r=n,i=r.length;if(i===0){if(e===`error`){let e=t[0];if(e instanceof Error)throw e;let n=`Unhandled error.${e===void 0?` (undefined)`:` (${e})`}`;throw Error(n)}return!1}if(i===1)return r[0].apply(this,t),!0;let a=r.slice();for(let e=0;e<a.length;e++)a[e].apply(this,t);return!0}removeAllListeners(e){if(e!==void 0){if(e!==`removeListener`&&this._hasListeners(`removeListener`)){let t=this._listeners.get(e);if(t){let n=_l(t)?t.slice():[t];this._listeners.delete(e);for(let t of n){let n=t.listener??t;this.emit(`removeListener`,e,n)}return this}}this._listeners.delete(e)}else{if(this._hasListeners(`removeListener`)){let e=[...this._listeners.keys()];for(let t of e)if(t!==`removeListener`){let e=this._listeners.get(t);if(e){let n=_l(e)?e.slice():[e];this._listeners.delete(t);for(let e of n){let n=e.listener??e;this.emit(`removeListener`,t,n)}}}}this._listeners.clear()}return this}listenerCount(e){return this._listenerCount(this._listeners.get(e))}listeners(e){let t=this._listeners.get(e);return t?(_l(t)?t:[t]).map(e=>e.listener??e):[]}rawListeners(e){let t=this._listeners.get(e);return t?_l(t)?t.slice():[t]:[]}eventNames(){return[...this._listeners.keys()]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners}};H.prototype.addListener=H.prototype.on,H.prototype.removeListener=H.prototype.off;let vl=new TextEncoder;var yl=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||=this._buf.slice(0,this._inPos),this._buffer}reset(e){e??=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+e.length;t>this._buf.length-4&&this._grow(t);let n=this._buf.subarray(this._inPos),r=vl.encodeInto(e,n);if(r.read<e.length){let t=e.length-r.read;this._grow(this._inPos+r.written+t*3);let n=vl.encodeInto(e.substring(r.read),this._buf.subarray(this._inPos+r.written));this._inPos+=r.written+n.written}else this._inPos+=r.written}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}};let bl=new TextEncoder;var xl=class{constructor(e){this._data=e}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=bl.encode(this._data),this._buffer}},Sl=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Cl=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},wl=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.subarray(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.subarray(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,r),this.iWrite+=r,r}};let Tl=()=>{};var El=class extends H{constructor(e){super(),this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),this.bufSize=e?.bufSize||1024*1024,this.buffers=[],this.batch=e?.batch??!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this._ended=!1}get writable(){return!this._ended}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new wl(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){typeof t==`function`&&(n=t),n||=Tl;let r;if(e instanceof yl||e&&e.constructor?.name===`StringBuf`)r=new Sl(e);else if(e instanceof Uint8Array)r=new Cl(e);else if(ArrayBuffer.isView(e))r=new Cl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Cl(new Uint8Array(e));else if(typeof e==`string`)r=new xl(e);else throw new g(typeof e,`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;){let e=this.buffers.shift();await this._pipeChunk(new Cl(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer(),t=!1;!this.paused&&this.listenerCount(`data`)>0&&(this.emit(`data`,e),t=!0),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e)),t=!0),t||(this._writeToBuffers(r),this.emit(`readable`)),n()}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Cl(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`),this.emit(`close`)}).catch(e=>{this.emit(`error`,e)}):(this.emit(`finish`),this.emit(`close`))};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return tr(Dl(t))}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],tr(Dl(t))}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return zn(t).decode(n)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}pipeTo(e){this._writableStreamWriter=e.getWriter()}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw new v(`unshift`,`Not implemented`)}wrap(){throw new v(`wrap`,`Not implemented`)}push(e){return e!==null&&this.write(e),!0}};function Dl(e){if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let Ol=null;function kl(){if(Ol)return Ol;let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return Ol=e,e}function Al(e,t){let n=kl();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function jl(e){return(e^4294967295)>>>0}function Ml(e){return jl(Al(4294967295,e))}function Nl(e,t){return(kl()[(e^t)&255]^e>>>8)>>>0}let Pl=(()=>{let e=new Uint8Array(288);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return e})(),Fl=new Uint8Array(32).fill(5),Il=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Ll=[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],Rl=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],zl=[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],Bl=[[1,0,0],[2,1,0],[3,2,0],[4,3,0],[6,4,1],[8,5,1],[12,6,2],[16,7,2],[24,8,3],[32,9,3],[48,10,4],[64,11,4],[96,12,5],[128,13,5],[192,14,6],[256,15,6],[384,16,7],[512,17,7],[768,18,8],[1024,19,8],[1536,20,9],[2048,21,9],[3072,22,10],[4096,23,10],[6144,24,11],[8192,25,11],[12288,26,12],[16384,27,12],[24576,28,13],[32768,29,13]],Vl=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Hl(e,t){let n=new Uint16Array(16);for(let r=0;r<t;r++)e[r]>0&&n[e[r]]++;let r=new Uint16Array(16),i=0;for(let e=1;e<=15;e++)i=i+n[e-1]<<1,r[e]=i;let a={};for(let n=0;n<t;n++){let t=e[n];if(t===0)continue;i=r[t]++;let o=a;for(let e=t-1;e>=0;e--)i>>e&1?(o.right||={},o=o.right):(o.left||={},o=o.left);o.symbol=n}return a}var Ul=class{constructor(e){this.data=e,this.pos=0,this.bitBuf=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.pos>=this.data.length)throw Error(`Unexpected end of DEFLATE data`);this.bitBuf|=this.data[this.pos++]<<this.bitCount,this.bitCount+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>=e,this.bitCount-=e,t}decodeSymbol(e){let t=e;for(;t.symbol===void 0;)if(t=this.readBits(1)===0?t.left:t.right,!t)throw Error(`Invalid Huffman code`);return t.symbol}alignToByte(){this.bitBuf=0,this.bitCount=0}readByte(){if(this.pos>=this.data.length)throw Error(`Unexpected end of data`);return this.data[this.pos++]}readUint16(){return this.readByte()|this.readByte()<<8}};function Wl(e){let t=new Ul(e),n=[],r=!1;for(;!r;){r=t.readBits(1)===1;let e=t.readBits(2);if(e===0){t.alignToByte();let e=t.readUint16();if((e^t.readUint16())!==65535)throw Error(`Invalid stored block length`);for(let r=0;r<e;r++)n.push(t.readByte())}else if(e===1||e===2){let r,i;if(e===1)r=Hl(Pl,288),i=Hl(Fl,32);else{let e=t.readBits(5)+257,n=t.readBits(5)+1,a=t.readBits(4)+4,o=new Uint8Array(19);for(let e=0;e<a;e++)o[Vl[e]]=t.readBits(3);let s=Hl(o,19),c=new Uint8Array(e+n),l=0;for(;l<e+n;){let e=t.decodeSymbol(s);if(e<16)c[l++]=e;else if(e===16){let e=t.readBits(2)+3,n=c[l-1];for(let t=0;t<e;t++)c[l++]=n}else if(e===17){let e=t.readBits(3)+3;for(let t=0;t<e;t++)c[l++]=0}else if(e===18){let e=t.readBits(7)+11;for(let t=0;t<e;t++)c[l++]=0}}r=Hl(c.subarray(0,e),e),i=Hl(c.subarray(e),n)}for(;;){let e=t.decodeSymbol(r);if(e<256)n.push(e);else if(e===256)break;else{let r=e-257,a=Il[r]+t.readBits(Ll[r]),o=t.decodeSymbol(i),s=Rl[o]+t.readBits(zl[o]),c=n.length-s;for(let e=0;e<a;e++)n.push(n[c+e])}}}else throw Error(`Invalid DEFLATE block type: `+e)}return new Uint8Array(n)}function Gl(e){let t=65535,n=Math.ceil(e.length/t)||1,r=n*5+e.length,i=new Uint8Array(r),a=0,o=0;for(let r=0;r<n;r++){let s=r===n-1,c=Math.min(t,e.length-o);i[a++]=s?1:0,i[a++]=c&255,i[a++]=c>>8&255,i[a++]=~c&255,i[a++]=~c>>8&255,i.set(e.subarray(o,o+c),a),a+=c,o+=c}return i.subarray(0,a)}let Kl=32768;Kl-1;let ql=32768;function Jl(e,t,n){return(e<<16|t<<8|n)*506832829>>>17&32767}function Yl(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return Gl(e);let t=new Xl;t.writeBits(1,1),t.writeBits(1,2);let n=new Int32Array(Kl),r=new Int32Array(ql),i=0,a=0,o=0,s=0,c=!1;for(;i<e.length;){let l=0,u=0;if(i+2<e.length){let t=Jl(e[i],e[i+1],e[i+2]),a=64,o=n[t];for(;o>0&&a-- >0;){let t=o-1,n=i-t;if(n>ql||n<=0)break;if(l>=3&&e[t+l]!==e[i+l]){o=r[t&ql-1];continue}let a=0,s=Math.min(258,e.length-i);for(;a<s&&e[t+a]===e[i+a];)a++;if(a>l&&(l=a,u=n,a>=258))break;o=r[t&ql-1]}r[i&ql-1]=n[t],n[t]=i+1}if(c)if(l>a)Ql(t,s),a=l,o=u,s=e[i],i++;else{$l(t,a),eu(t,o);let s=i-1+a;for(let t=i;t<s&&t+2<e.length;t++){let i=Jl(e[t],e[t+1],e[t+2]);r[t&ql-1]=n[i],n[i]=t+1}i=s,c=!1,a=0}else l>=3?(c=!0,a=l,o=u,s=e[i],i++):(Ql(t,e[i]),i++)}return c&&($l(t,a),eu(t,o)),Ql(t,256),t.finish()}var Xl=class{constructor(){this.chunks=[],this.buffer=[],this.bitBuf=0,this.bitCount=0}writeBits(e,t){for(this.bitBuf|=e<<this.bitCount,this.bitCount+=t;this.bitCount>=8;)this.buffer.push(this.bitBuf&255),this.bitBuf>>=8,this.bitCount-=8,this.buffer.length>=65536&&(this.chunks.push(new Uint8Array(this.buffer)),this.buffer=[])}writeBitsReverse(e,t){let n=0;for(let r=0;r<t;r++)n=n<<1|e>>r&1;this.writeBits(n,t)}finish(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),j(this.chunks))}flushBytes(){if(this.chunks.length===0&&this.buffer.length===0)return new Uint8Array;let e;return this.chunks.length===0?e=new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),e=j(this.chunks),this.chunks=[]),this.buffer=[],e}};let Zl=(()=>{let e=[];for(let t=0;t<=287;t++){let n,r;t<=143?(n=48+t,r=8):t<=255?(n=400+(t-144),r=9):t<=279?(n=t-256,r=7):(n=192+(t-280),r=8),e[t]=[n,r]}return e})();function Ql(e,t){let[n,r]=Zl[t];e.writeBitsReverse(n,r)}function $l(e,t){let n,r,i;if(t<=10)n=257+t-3,r=0,i=0;else if(t<=18){let e=t-11;n=265+Math.floor(e/2),r=1,i=e%2}else if(t<=34){let e=t-19;n=269+Math.floor(e/4),r=2,i=e%4}else if(t<=66){let e=t-35;n=273+Math.floor(e/8),r=3,i=e%8}else if(t<=130){let e=t-67;n=277+Math.floor(e/16),r=4,i=e%16}else if(t<=257){let e=t-131;n=281+Math.floor(e/32),r=5,i=e%32}else n=285,r=0,i=0;Ql(e,n),r>0&&e.writeBits(i,r)}function eu(e,t){let n=0,r=0,i=1;for(let e=0;e<Bl.length;e++){let[a,o,s]=Bl[e];if(t<=a){n=o,r=s;break}i=a+1}let a=t-i;e.writeBitsReverse(n,5),r>0&&e.writeBits(a,r)}let tu=32768;var nu=class{constructor(){this._output=new Xl,this._head=new Int32Array(Kl),this._prev=new Int32Array(ql),this._window=new Uint8Array(tu),this._windowLen=0,this._totalIn=0,this._hasPrevMatch=!1,this._prevMatchLen=0,this._prevMatchDist=0,this._prevLiteral=0}write(e){if(e.length===0)return new Uint8Array;let t=this._output;t.writeBits(0,1),t.writeBits(1,2);let n=this._window,r=this._windowLen,i=this._head,a=this._prev,o=this._totalIn,s=this._hasPrevMatch,c=this._prevMatchLen,l=this._prevMatchDist,u=this._prevLiteral,d=t=>{if(t+2>=e.length)return;let n=Jl(e[t],e[t+1],e[t+2]),r=o+t;a[r&ql-1]=i[n],i[n]=r+1},f=(t,i)=>{for(let a=0;a<i;a++)n[r+a&tu-1]=e[t+a];r+=i},p=0;for(;p<e.length;){let r=0,m=0;if(p+2<e.length){let t=Jl(e[p],e[p+1],e[p+2]),s=o+p,c=64,l=i[t];for(;l>0&&c-- >0;){let t=l-1,i=s-t;if(i>ql||i<=0)break;let c=Math.min(258,e.length-p),u=0;if(r>=3){let i=t+r,s,c=i-o;if(s=c>=0&&c<e.length?e[c]:n[i&tu-1],s!==e[p+r]){l=a[t&ql-1];continue}}for(;u<c;){let r=t+u,i,a=r-o;if(i=a>=0&&a<e.length?e[a]:n[r&tu-1],i!==e[p+u])break;u++}if(u>r&&(r=u,m=i,u>=258))break;l=a[t&ql-1]}a[s&ql-1]=i[t],i[t]=s+1}if(s)if(r>c)Ql(t,u),c=r,l=m,u=e[p],f(p,1),p++;else{$l(t,c),eu(t,l);let n=p-1+c,r=Math.min(n,e.length);for(let e=p;e<r;e++)d(e);f(p,r-p),p=r,s=!1,c=0}else r>=3?(s=!0,c=r,l=m,u=e[p],f(p,1),p++):(Ql(t,e[p]),f(p,1),p++)}if(s){$l(t,c),eu(t,l);let n=Math.min(p-1+c,e.length);for(let e=p;e<n;e++)d(e);f(p,n-p),s=!1,c=0}return Ql(t,256),this._windowLen=r,this._totalIn=o+e.length,this._hasPrevMatch=s,this._prevMatchLen=c,this._prevMatchDist=l,this._prevLiteral=u,t.flushBytes()}finish(){let e=this._output;return e.writeBits(1,1),e.writeBits(1,2),Ql(e,256),e.finish()}};let U=new Uint8Array;function ru(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}var iu=class{_activeChunkCount(){return this._chunks.length-this._chunkHead}_headChunk(){return this._chunks[this._chunkHead]}_compactConsumedChunks(){if(this._chunkHead!==0){if(this._chunkHead>=this._chunks.length){this._chunks=[],this._chunkHead=0;return}this._chunkHead>32&&this._chunkHead*2>=this._chunks.length&&(this._chunks=this._chunks.slice(this._chunkHead),this._chunkHead=0)}}_dropHeadChunk(){this._chunkHead++,this._headOffset=0,this._compactConsumedChunks()}constructor(e){this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return U;if(this._activeChunkCount()===1)return this._headChunk().subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let e=new Uint8Array(this._length),t=0;for(let n=this._chunkHead;n<this._chunks.length;n++){let r=this._chunks[n],i=n===this._chunkHead?this._headOffset:0,a=n===this._chunks.length-1?i+(this._length-t):r.length;if(e.set(r.subarray(i,a),t),t+=a-i,t>=e.length)break}return this._cachedView=e,this._cachedLength=this._length,e}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._chunkHead=0,this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return U;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._activeChunkCount()===1){let t=this._headChunk(),n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._chunkHead=0,this._headOffset=0):this._headOffset>=t.length&&this._dropHeadChunk(),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._headChunk(),i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&this._dropHeadChunk()}return this._length===0&&(this._chunks=[],this._chunkHead=0,this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._activeChunkCount()===1){let t=this._headChunk(),n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=this._chunkHead;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===this._chunkHead?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._headChunk(),n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&this._dropHeadChunk()}this._length===0&&(this._chunks=[],this._chunkHead=0,this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._activeChunkCount()===1){let t=this._headChunk(),a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):ru(o,e,i)}if(n>4)return ru(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=this._chunkHead,d=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},f=0;for(let e=u;e<l.length;e++){let t=l[e],p=e===u?this._headOffset:0,m=t.length-p;if(m<=0)continue;let h=f,g=h+m,_=i<=h?p:i>=g?t.length:p+(i-h);if(_>t.length-1){f+=m;continue}let v=t.length-1,y=t.indexOf(a,_);for(;y!==-1&&y<=v;){let i=h+(y-p);if(i>r-n)return-1;if(n===1)return i;if(y+n<=t.length){if(t[y+1]!==o){y=t.indexOf(a,y+1);continue}if(n===2)return i;if(t[y+2]!==s){y=t.indexOf(a,y+1);continue}if(n===3)return i;if(t[y+3]!==c){y=t.indexOf(a,y+1);continue}return i}let l=d(e,y+1);if(l===null||l!==o){y=t.indexOf(a,y+1);continue}if(n===2)return i;let u=d(e,y+2);if(u===null||u!==s){y=t.indexOf(a,y+1);continue}if(n===3)return i;let f=d(e,y+3);if(f===null||f!==c){y=t.indexOf(a,y+1);continue}return i}f+=m}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=this._chunkHead;e<n.length;e++){let t=n[e],i=e===this._chunkHead?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=this._chunkHead;e<this._chunks.length;e++){let t=this._chunks[e],r=e===this._chunkHead?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function au(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function ou(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let su=null,cu=null;function lu(){return typeof CompressionStream>`u`?!1:(su===null&&(su=au()),su)}function uu(){return typeof DecompressionStream>`u`?!1:(cu===null&&(cu=ou()),cu)}function du(){return lu()&&uu()}async function fu(e){let t=new iu;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function pu(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=fu(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function mu(e){return pu(e,new DecompressionStream(`deflate-raw`))}let hu=65521;function gu(e){let t=1,n=0;for(let r=0;r<e.length;){let i=Math.min(r+5552,e.length);for(;r<i;)t+=e[r++],n+=t;t%=hu,n%=hu}return n<<16|t}let _u={};function vu(e,t){let n=`${e}:${t}`;return()=>{let r=e===`compression`?typeof CompressionStream<`u`?CompressionStream:void 0:typeof DecompressionStream<`u`?DecompressionStream:void 0;if(!r)return!1;let i=_u[n];if(i!=null)return i;try{new r(t),_u[n]=!0}catch{_u[n]=!1}return _u[n]}}vu(`compression`,`gzip`),vu(`decompression`,`gzip`),vu(`compression`,`deflate`),vu(`decompression`,`deflate`);let yu={0:new Uint8Array([120,1]),1:new Uint8Array([120,1]),2:new Uint8Array([120,94]),3:new Uint8Array([120,94]),4:new Uint8Array([120,94]),5:new Uint8Array([120,94]),6:new Uint8Array([120,156]),7:new Uint8Array([120,218]),8:new Uint8Array([120,218]),9:new Uint8Array([120,218])};function bu(e){return yu[Math.max(0,Math.min(9,e))]??yu[6]}function xu(e){let t=new Uint8Array(4);return t[0]=e>>>24&255,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t}var Su=class extends t{constructor(e,t){super(e,t),this.name=`ArchiveError`}},Cu=class extends Su{constructor(e,t,n){super(`CRC32 mismatch for "${e}": expected 0x${t.toString(16).padStart(8,`0`)}, got 0x${n.toString(16).padStart(8,`0`)}`),this.path=e,this.expected=t,this.actual=n,this.name=`Crc32MismatchError`}},wu=class extends Su{constructor(e,t,n,r){let i=r===`too-many-bytes`?`Entry "${e}" produced more bytes than declared: expected ${t}, got at least ${n}`:`Entry "${e}" produced fewer bytes than declared: expected ${t}, got ${n}`;super(i),this.path=e,this.expected=t,this.actual=n,this.reason=r,this.name=`EntrySizeMismatchError`}isZipBomb(){return this.reason===`too-many-bytes`}isCorruption(){return this.reason===`too-few-bytes`}},Tu=class extends Su{constructor(e,t){super(t?`Failed to decrypt "${e}": ${t}`:`Failed to decrypt "${e}": incorrect password or corrupted data`),this.name=`DecryptionError`}},Eu=class extends Su{constructor(e){super(`File "${e}" is encrypted. Please provide a password to extract.`),this.name=`PasswordRequiredError`}},Du=class extends Su{constructor(e){super(`Unsupported compression method: ${e}`),this.name=`UnsupportedCompressionError`}};let Ou={maxWorkers:typeof navigator<`u`&&navigator.hardwareConcurrency||4,minWorkers:0,idleTimeout:3e4,useTransferables:!0,workerUrl:void 0};function ku(e){let t=e?.maxWorkers??Ou.maxWorkers,n=e?.minWorkers??Ou.minWorkers;return{maxWorkers:Math.max(1,t),minWorkers:Math.max(0,Math.min(n,t)),idleTimeout:Math.max(0,e?.idleTimeout??Ou.idleTimeout),useTransferables:e?.useTransferables??Ou.useTransferables,workerUrl:e?.workerUrl}}let Au={high:3,normal:2,low:1};function ju(e){return e?Au[e]??Au.normal:Au.normal}function Mu(){return typeof Worker<`u`&&typeof Blob<`u`}function Nu(){return`
|
|
33
|
+
`)}static{this.PIVOT_CACHE_DEFINITION_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`,"xmlns:r":`http://schemas.openxmlformats.org/officeDocument/2006/relationships`}}};let Xc=`PivotStyleLight16`,Zc=new Set([`axisRow`,`axisCol`,`axisPage`,`axisValues`]),Qc=[`x`,`t`,`h`,`sd`,`f`,`m`,`c`,`d`];function $c(){return{currentSection:null,inPivotArea:!1,inAutoSortScope:!1}}let el=new Set([`axis`,`dataField`,`compact`,`outline`,`showAll`,`defaultSubtotal`,`numFmtId`,`sortType`,`subtotalTop`,`insertBlankRow`,`multipleItemSelectionAllowed`]);var tl=class e extends N{constructor(){super(),this.state=$c(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector=new Uc(`extLst`),this.formatsCollector=new Uc(`formats`),this.conditionalFormatsCollector=new Uc(`conditionalFormats`),this.filtersCollector=new Uc(`filters`),this.unknownCollector=new Uc(``),this.unknownElementsXmlParts=[],this.model=null}get tag(){return`pivotTableDefinition`}reset(){this.model=null,this.state=$c(),this.currentPivotField=null,this.currentRowItem=null,this.currentColItem=null,this.currentChartFormat=null,this.pivotAreaXmlBuffer=[],this.autoSortScopeXmlBuffer=[],this.extLstCollector.reset(),this.formatsCollector.reset(),this.conditionalFormatsCollector.reset(),this.filtersCollector.reset(),this.unknownCollector.reset(),this.unknownElementsXmlParts=[]}render(e,t){`isLoaded`in t&&t.isLoaded?this.renderLoaded(e,t):this.renderNew(e,t)}renderNew(t,n){let{rows:r,columns:i,values:a,pages:o=[],cacheFields:s,cacheId:c,tableNumber:l,applyWidthHeightFormats:u}=n,d=i.length===0&&a.length>1,f=o.length,p=f>0?f+1:0,m=r.length,h=3+p,g=h+1,_=m+(d?a.length:1),v=`A${h}:${w.n2l(_)}${g}`;t.openXml(A),t.openNode(this.tag,{...e.PIVOT_TABLE_ATTRIBUTES,name:`PivotTable${l}`,cacheId:c,applyNumberFormats:`0`,applyBorderFormats:`0`,applyFontFormats:`0`,applyPatternFormats:`0`,applyAlignmentFormats:`0`,applyWidthHeightFormats:u,dataCaption:`Values`,updatedVersion:`8`,minRefreshableVersion:`3`,useAutoFormatting:`1`,itemPrintTitles:`1`,createdVersion:`8`,indent:`0`,compact:`0`,compactData:`0`,multipleFieldFilters:`0`});let y={ref:v,firstHeaderRow:1,firstDataRow:1,firstDataCol:m};f>0&&(y.rowPageCount=f,y.colPageCount=1),t.leafNode(`location`,y),il(t,n),t.openNode(`rowFields`,{count:r.length});for(let e of r)t.leafNode(`field`,{x:e});if(t.closeNode(),t.openNode(`rowItems`,{count:1}),t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode(),i.length>0){let e=a.length>1?i.length+1:i.length;t.openNode(`colFields`,{count:e});for(let e of i)t.leafNode(`field`,{x:e});a.length>1&&t.leafNode(`field`,{x:-2}),t.closeNode()}else d&&(t.openNode(`colFields`,{count:1}),t.leafNode(`field`,{x:-2}),t.closeNode());if(d){t.openNode(`colItems`,{count:a.length+1});for(let e=0;e<a.length;e++)t.openNode(`i`),t.leafNode(`x`,e===0?void 0:{v:e}),t.closeNode();t.openNode(`i`,{t:`grand`}),t.leafNode(`x`),t.closeNode(),t.closeNode()}else t.openNode(`colItems`,{count:1}),t.leafNode(`i`),t.closeNode();if(f>0){t.openNode(`pageFields`,{count:f});for(let e of o)t.leafNode(`pageField`,{fld:e,hier:-1});t.closeNode()}rl(t,s,a,n.valueMetrics),t.leafNode(`pivotTableStyleInfo`,{name:Xc,showRowHeaders:`1`,showColHeaders:`1`,showRowStripes:`0`,showColStripes:`0`,showLastColumn:`1`}),t.writeRaw(e.EXTLST_XML),t.closeNode()}renderLoaded(t,n){let r=this.buildLoadedRootAttributes(n);if(t.openXml(A),t.openNode(this.tag,r),n.location){let e={ref:n.location.ref,firstHeaderRow:n.location.firstHeaderRow,firstDataRow:n.location.firstDataRow,firstDataCol:n.location.firstDataCol};n.location.rowPageCount!==void 0&&(e.rowPageCount=n.location.rowPageCount),n.location.colPageCount!==void 0&&(e.colPageCount=n.location.colPageCount),t.leafNode(`location`,e)}if(n.pivotFields.length>0){t.openNode(`pivotFields`,{count:n.pivotFields.length});for(let e of n.pivotFields)this.renderPivotFieldLoaded(t,e);t.closeNode()}if(n.rowFields.length>0){t.openNode(`rowFields`,{count:n.rowFields.length});for(let e of n.rowFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.rowItems&&n.rowItems.length>0){t.openNode(`rowItems`,{count:n.rowItems.length});for(let e of n.rowItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasRowItems&&t.writeRaw(`<rowItems count="1"><i t="grand"><x/></i></rowItems>`);if(n.hasColFields||n.colFields.length>0)if(n.colFields.length===0&&n.dataFields.length<=1)t.leafNode(`colFields`,{count:0});else{let e=n.colFields.length===0?1:n.colFields.length;if(t.openNode(`colFields`,{count:e}),n.colFields.length===0)t.leafNode(`field`,{x:-2});else for(let e of n.colFields)t.leafNode(`field`,{x:e});t.closeNode()}if(n.colItems&&n.colItems.length>0){t.openNode(`colItems`,{count:n.colItems.length});for(let e of n.colItems)this.renderRowColItem(t,e);t.closeNode()}else n.hasColItems&&t.writeRaw(`<colItems count="1"><i t="grand"><x/></i></colItems>`);if(n.pageFields&&n.pageFields.length>0){t.openNode(`pageFields`,{count:n.pageFields.length});for(let e of n.pageFields){let n={fld:e.fld};e.item!==void 0&&(n.item=e.item),e.hier!==void 0&&(n.hier=e.hier),e.name!==void 0&&(n.name=e.name),t.leafNode(`pageField`,n)}t.closeNode()}if(n.dataFields.length>0){t.openNode(`dataFields`,{count:n.dataFields.length});for(let e of n.dataFields){let n={name:e.name,fld:e.fld};e.baseField!==void 0&&(n.baseField=e.baseField),e.baseItem!==void 0&&(n.baseItem=e.baseItem),e.subtotal!==void 0&&e.subtotal!==`sum`&&(n.subtotal=e.subtotal),e.numFmtId!==void 0&&(n.numFmtId=e.numFmtId),t.leafNode(`dataField`,n)}t.closeNode()}n.formatsXml&&t.writeRaw(n.formatsXml),n.conditionalFormatsXml&&t.writeRaw(n.conditionalFormatsXml),n.chartFormats&&n.chartFormats.length>0&&this.renderChartFormats(t,n.chartFormats);let i=n.styleInfo;t.leafNode(`pivotTableStyleInfo`,{name:i?.name??n.styleName??Xc,showRowHeaders:i?.showRowHeaders??`1`,showColHeaders:i?.showColHeaders??`1`,showRowStripes:i?.showRowStripes??`0`,showColStripes:i?.showColStripes??`0`,showLastColumn:i?.showLastColumn??`1`}),n.filtersXml&&t.writeRaw(n.filtersXml),n.unknownElementsXml&&t.writeRaw(n.unknownElementsXml);let a=n.extLstXml??(n.isLoaded?``:e.EXTLST_XML);a&&t.writeRaw(a),t.closeNode()}buildLoadedRootAttributes(t){let n={...e.PIVOT_TABLE_ATTRIBUTES,name:t.name??`PivotTable1`,cacheId:String(t.cacheId),applyNumberFormats:t.applyNumberFormats??`0`,applyBorderFormats:t.applyBorderFormats??`0`,applyFontFormats:t.applyFontFormats??`0`,applyPatternFormats:t.applyPatternFormats??`0`,applyAlignmentFormats:t.applyAlignmentFormats??`0`,applyWidthHeightFormats:t.applyWidthHeightFormats??`0`,dataCaption:t.dataCaption??`Values`,updatedVersion:t.updatedVersion??`8`,minRefreshableVersion:t.minRefreshableVersion??`3`};return t.useAutoFormatting!==void 0&&(n.useAutoFormatting=t.useAutoFormatting),t.itemPrintTitles!==void 0&&(n.itemPrintTitles=t.itemPrintTitles),t.multipleFieldFilters!==void 0&&(n.multipleFieldFilters=t.multipleFieldFilters),n.createdVersion=t.createdVersion??`8`,t.indent!==void 0&&(n.indent=String(t.indent)),t.uid&&(n[`xmlns:xr`]=`http://schemas.microsoft.com/office/spreadsheetml/2014/revision`,n[`xr:uid`]=t.uid),t.outline&&(n.outline=`1`),t.outlineData&&(n.outlineData=`1`),t.chartFormat!==void 0&&(n.chartFormat=String(t.chartFormat)),t.colGrandTotals!==void 0&&(n.colGrandTotals=t.colGrandTotals),t.rowGrandTotals!==void 0&&(n.rowGrandTotals=t.rowGrandTotals),t.showError!==void 0&&(n.showError=t.showError),t.errorCaption!==void 0&&(n.errorCaption=t.errorCaption),t.showMissing!==void 0&&(n.showMissing=t.showMissing),t.missingCaption!==void 0&&(n.missingCaption=t.missingCaption),t.grandTotalCaption!==void 0&&(n.grandTotalCaption=t.grandTotalCaption),t.compact===!1&&(n.compact=`0`),t.compactData===!1&&(n.compactData=`0`),n}renderChartFormats(e,t){e.openNode(`chartFormats`,{count:t.length});for(let n of t)e.openNode(`chartFormat`,{chart:n.chart,format:n.format,series:n.series===!0?`1`:n.series===!1?`0`:void 0}),n.pivotAreaXml?e.writeRaw(n.pivotAreaXml):e.writeRaw(`<pivotArea type="data" outline="0" fieldPosition="0"><references count="1"><reference field="4294967294" count="1" selected="0"><x v="0"/></reference></references></pivotArea>`),e.closeNode();e.closeNode()}renderRowColItem(e,t){let n={};if(t.t!==void 0&&(n.t=t.t),t.r!==void 0&&(n.r=t.r),t.i!==void 0&&(n.i=t.i),t.x.length>0){e.openNode(`i`,n);for(let n of t.x)n.v===0?e.leafNode(`x`):e.leafNode(`x`,{v:n.v});e.closeNode()}else e.leafNode(`i`,n)}renderPivotFieldLoaded(e,t){let n={};if(t.axis&&(n.axis=t.axis),t.dataField&&(n.dataField=`1`),t.numFmtId!==void 0&&(n.numFmtId=String(t.numFmtId)),t.sortType&&(n.sortType=t.sortType),t.compact===!1&&(n.compact=`0`),t.outline===!1&&(n.outline=`0`),n.showAll=t.showAll?`1`:`0`,t.defaultSubtotal===!1&&(n.defaultSubtotal=`0`),t.subtotalTop===!1&&(n.subtotalTop=`0`),t.insertBlankRow===!0&&(n.insertBlankRow=`1`),t.multipleItemSelectionAllowed===!0&&(n.multipleItemSelectionAllowed=`1`),t.extraAttrs)for(let[e,r]of Object.entries(t.extraAttrs))n[e]=r;if(t.items!==void 0&&t.items.length>0||t.autoSortScopeXml!==void 0){if(e.openNode(`pivotField`,n),t.items!==void 0&&t.items.length>0){e.openNode(`items`,{count:t.items.length});for(let n of t.items){let t={};for(let e of Qc)n[e]!==void 0&&(t[e]=n[e]);e.leafNode(`item`,t)}e.closeNode()}t.autoSortScopeXml&&e.writeRaw(t.autoSortScopeXml),e.closeNode()}else e.leafNode(`pivotField`,n)}parseOpen(e){let{name:t,attributes:n}=e;if(this.extLstCollector.active)return this.extLstCollector.feedOpen(t,n),!0;if(this.formatsCollector.active)return this.formatsCollector.feedOpen(t,n),!0;if(this.conditionalFormatsCollector.active)return this.conditionalFormatsCollector.feedOpen(t,n),!0;if(this.filtersCollector.active)return this.filtersCollector.feedOpen(t,n),!0;if(this.unknownCollector.active)return this.unknownCollector.feedOpen(t,n),!0;switch(t){case this.tag:this.reset(),this.model={name:n.name,cacheId:parseInt(n.cacheId??`0`,10),uid:n[`xr:uid`],pivotFields:[],rowFields:[],colFields:[],pageFields:[],dataFields:[],applyNumberFormats:n.applyNumberFormats,applyBorderFormats:n.applyBorderFormats,applyFontFormats:n.applyFontFormats,applyPatternFormats:n.applyPatternFormats,applyAlignmentFormats:n.applyAlignmentFormats,applyWidthHeightFormats:n.applyWidthHeightFormats,dataCaption:n.dataCaption,updatedVersion:n.updatedVersion,minRefreshableVersion:n.minRefreshableVersion,createdVersion:n.createdVersion,useAutoFormatting:n.useAutoFormatting,itemPrintTitles:n.itemPrintTitles,indent:n.indent===void 0?void 0:parseInt(n.indent,10),compact:n.compact!==`0`,compactData:n.compactData!==`0`,multipleFieldFilters:n.multipleFieldFilters,outline:n.outline===`1`,outlineData:n.outlineData===`1`,chartFormat:n.chartFormat===void 0?void 0:parseInt(n.chartFormat,10),colGrandTotals:n.colGrandTotals,rowGrandTotals:n.rowGrandTotals,showError:n.showError,errorCaption:n.errorCaption,showMissing:n.showMissing,missingCaption:n.missingCaption,grandTotalCaption:n.grandTotalCaption,rowItems:[],colItems:[],chartFormats:[],isLoaded:!0};break;case`location`:this.model&&(this.model.location={ref:n.ref,firstHeaderRow:n.firstHeaderRow===void 0?void 0:parseInt(n.firstHeaderRow,10),firstDataRow:n.firstDataRow===void 0?void 0:parseInt(n.firstDataRow,10),firstDataCol:n.firstDataCol===void 0?void 0:parseInt(n.firstDataCol,10),rowPageCount:n.rowPageCount===void 0?void 0:parseInt(n.rowPageCount,10),colPageCount:n.colPageCount===void 0?void 0:parseInt(n.colPageCount,10)});break;case`pivotFields`:this.state.currentSection=`pivotFields`;break;case`pivotField`:if(this.state.currentSection===`pivotFields`){let e={};for(let[t,r]of Object.entries(n))el.has(t)||(e[t]=String(r));this.currentPivotField={axis:Zc.has(n.axis)?n.axis:void 0,dataField:n.dataField===`1`,items:[],compact:n.compact!==`0`,outline:n.outline!==`0`,showAll:n.showAll!==`0`,defaultSubtotal:n.defaultSubtotal!==`0`,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10),sortType:n.sortType,subtotalTop:n.subtotalTop===void 0?void 0:n.subtotalTop===`1`,insertBlankRow:n.insertBlankRow===`1`?!0:void 0,multipleItemSelectionAllowed:n.multipleItemSelectionAllowed===`1`?!0:void 0,extraAttrs:Object.keys(e).length>0?e:void 0}}break;case`items`:break;case`item`:if(this.currentPivotField){let e={};n.x!==void 0&&(e.x=parseInt(n.x,10));for(let t of Qc)t!==`x`&&n[t]!==void 0&&(e[t]=n[t]);this.currentPivotField.items.push(e)}break;case`autoSortScope`:this.currentPivotField&&(this.state.inAutoSortScope=!0,this.autoSortScopeXmlBuffer=[`<autoSortScope>`]);break;case`rowFields`:this.state.currentSection=`rowFields`;break;case`colFields`:this.state.currentSection=`colFields`,this.model&&(this.model.hasColFields=!0);break;case`dataFields`:this.state.currentSection=`dataFields`;break;case`pageFields`:this.state.currentSection=`pageFields`;break;case`pageField`:this.state.currentSection===`pageFields`&&this.model&&this.model.pageFields.push({fld:parseInt(n.fld??`0`,10),item:n.item===void 0?void 0:parseInt(n.item,10),hier:n.hier===void 0?void 0:parseInt(n.hier,10),name:n.name});break;case`rowItems`:this.state.currentSection=`rowItems`,this.model&&(this.model.hasRowItems=!0);break;case`colItems`:this.state.currentSection=`colItems`,this.model&&(this.model.hasColItems=!0);break;case`i`:if(this.model){let e=this.state.currentSection===`rowItems`||this.state.currentSection===`colItems`?nl(n):null;this.state.currentSection===`rowItems`?this.currentRowItem=e:this.state.currentSection===`colItems`&&(this.currentColItem=e)}break;case`x`:if(this.state.inPivotArea){let e=Wc(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(e?`<x ${e}/>`:`<x/>`):this.pivotAreaXmlBuffer.push(e?`<x ${e}/>`:`<x/>`)}else this.currentRowItem?this.currentRowItem.x.push({v:parseInt(n.v??`0`,10)}):this.currentColItem&&this.currentColItem.x.push({v:parseInt(n.v??`0`,10)});break;case`chartFormats`:this.state.currentSection=`chartFormats`;break;case`chartFormat`:this.state.currentSection===`chartFormats`&&this.model&&(this.currentChartFormat={chart:parseInt(n.chart??`0`,10),format:parseInt(n.format??`0`,10),series:n.series===void 0?void 0:n.series===`1`});break;case`pivotArea`:if(this.currentChartFormat){this.state.inPivotArea=!0;let e=Wc(n);this.pivotAreaXmlBuffer=[e?`<pivotArea ${e}>`:`<pivotArea>`]}else if(this.state.inAutoSortScope){this.state.inPivotArea=!0;let e=Wc(n);this.autoSortScopeXmlBuffer.push(e?`<pivotArea ${e}>`:`<pivotArea>`)}break;case`references`:case`reference`:if(this.state.inPivotArea){let e=Wc(n);this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`<${t}${e?` `+e:``}>`):this.pivotAreaXmlBuffer.push(`<${t}${e?` `+e:``}>`)}break;case`field`:if(this.model){let e=parseInt(n.x??`0`,10);this.state.currentSection===`rowFields`?this.model.rowFields.push(e):this.state.currentSection===`colFields`&&this.model.colFields.push(e)}break;case`dataField`:this.state.currentSection===`dataFields`&&this.model&&this.model.dataFields.push({name:n.name??``,fld:parseInt(n.fld??`0`,10),baseField:n.baseField===void 0?void 0:parseInt(n.baseField,10),baseItem:n.baseItem===void 0?void 0:parseInt(n.baseItem,10),subtotal:Yt.has(n.subtotal)?n.subtotal:void 0,numFmtId:n.numFmtId===void 0?void 0:parseInt(n.numFmtId,10)});break;case`pivotTableStyleInfo`:this.model&&(this.model.styleName=n.name,this.model.styleInfo={name:n.name,showRowHeaders:n.showRowHeaders,showColHeaders:n.showColHeaders,showRowStripes:n.showRowStripes,showColStripes:n.showColStripes,showLastColumn:n.showLastColumn});break;case`extLst`:this.model&&this.extLstCollector.start(n);break;case`formats`:this.model&&this.formatsCollector.start(n);break;case`conditionalFormats`:this.model&&this.conditionalFormatsCollector.start(n);break;case`filters`:this.model&&this.filtersCollector.start(n);break;default:this.model&&this.state.currentSection===null&&!this.state.inPivotArea&&!this.state.inAutoSortScope&&this.unknownCollector.startAs(t,n);break}return!0}parseText(e){this.extLstCollector.active?this.extLstCollector.feedText(e):this.formatsCollector.active?this.formatsCollector.feedText(e):this.conditionalFormatsCollector.active?this.conditionalFormatsCollector.feedText(e):this.filtersCollector.active?this.filtersCollector.feedText(e):this.unknownCollector.active&&this.unknownCollector.feedText(e)}tryCloseCollector(e,t,n){e.feedClose(t)&&(this.model&&(this.model[n]=e.result),e.reset())}parseClose(e){if(this.extLstCollector.active)return this.tryCloseCollector(this.extLstCollector,e,`extLstXml`),!0;if(this.formatsCollector.active)return this.tryCloseCollector(this.formatsCollector,e,`formatsXml`),!0;if(this.conditionalFormatsCollector.active)return this.tryCloseCollector(this.conditionalFormatsCollector,e,`conditionalFormatsXml`),!0;if(this.filtersCollector.active)return this.tryCloseCollector(this.filtersCollector,e,`filtersXml`),!0;if(this.unknownCollector.active)return this.unknownCollector.feedClose(e)&&(this.unknownElementsXmlParts.push(this.unknownCollector.result),this.unknownCollector.reset()),!0;if(this.state.inPivotArea)return e===`pivotArea`?(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</pivotArea>`):(this.pivotAreaXmlBuffer.push(`</pivotArea>`),this.currentChartFormat&&(this.currentChartFormat.pivotAreaXml=this.pivotAreaXmlBuffer.join(``)),this.pivotAreaXmlBuffer=[]),this.state.inPivotArea=!1,!0):((e===`references`||e===`reference`)&&(this.state.inAutoSortScope?this.autoSortScopeXmlBuffer.push(`</${e}>`):this.pivotAreaXmlBuffer.push(`</${e}>`)),!0);switch(e){case this.tag:return this.model&&this.unknownElementsXmlParts.length>0&&(this.model.unknownElementsXml=this.unknownElementsXmlParts.join(``)),!1;case`pivotFields`:case`rowFields`:case`colFields`:case`dataFields`:case`pageFields`:case`rowItems`:case`colItems`:case`chartFormats`:this.state.currentSection=null;break;case`pivotField`:this.currentPivotField&&this.model&&(this.model.pivotFields.push(this.currentPivotField),this.currentPivotField=null);break;case`items`:break;case`autoSortScope`:this.state.inAutoSortScope&&this.currentPivotField&&(this.autoSortScopeXmlBuffer.push(`</autoSortScope>`),this.currentPivotField.autoSortScopeXml=this.autoSortScopeXmlBuffer.join(``),this.autoSortScopeXmlBuffer=[],this.state.inAutoSortScope=!1);break;case`i`:this.currentRowItem&&this.model?(this.model.rowItems?.push(this.currentRowItem),this.currentRowItem=null):this.currentColItem&&this.model&&(this.model.colItems?.push(this.currentColItem),this.currentColItem=null);break;case`chartFormat`:this.currentChartFormat&&this.model&&(this.model.chartFormats?.push(this.currentChartFormat),this.currentChartFormat=null);break}return!0}static{this.PIVOT_TABLE_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}static{this.EXTLST_XML=`<extLst><ext uri="{962EF5D1-5CA2-4c93-8EF4-DBF5C05439D2}" xmlns:x14="http://schemas.microsoft.com/office/spreadsheetml/2009/9/main"><x14:pivotTableDefinition hideValuesRow="1" xmlns:xm="http://schemas.microsoft.com/office/excel/2006/main"/></ext><ext uri="{747A6164-185A-40DC-8AA5-F01512510D54}" xmlns:xpdl="http://schemas.microsoft.com/office/spreadsheetml/2016/pivotdefaultlayout"><xpdl:pivotTableDefinition16 EnabledSubtotalsDefault="0" SubtotalsOnTopDefault="0"/></ext></extLst>`}};function nl(e){return{t:e.t,r:e.r===void 0?void 0:parseInt(e.r,10),i:e.i===void 0?void 0:parseInt(e.i,10),x:[]}}function rl(e,t,n,r){e.openNode(`dataFields`,{count:n.length});for(let i=0;i<n.length;i++){let a=n[i],o=r[i]??`sum`,s=Jt[o],c=t[a];if(!c)throw Error(`Value field index ${a} is out of bounds (cacheFields has ${t.length} entries)`);let l={name:`${s} of ${c.name}`,fld:a,baseField:0,baseItem:0};o!==`sum`&&(l.subtotal=o),e.leafNode(`dataField`,l)}e.closeNode()}function il(e,t){let n=new Set(t.rows),r=new Set(t.columns),i=new Set(t.values),a=new Set(t.pages??[]);e.openNode(`pivotFields`,{count:t.cacheFields.length});for(let o=0;o<t.cacheFields.length;o++){let s=t.cacheFields[o];al(e,n.has(o),r.has(o),i.has(o),a.has(o),s.sharedItems)}e.closeNode()}function al(e,t,n,r,i,a){if(t||n||i){if(!a)throw Error(`sharedItems is required for axis field (row/column/page)`);let i={axis:t?`axisRow`:n?`axisCol`:`axisPage`};r&&(i.dataField=`1`),i.compact=`0`,i.outline=`0`,i.showAll=`0`,e.openNode(`pivotField`,i),e.openNode(`items`,{count:a.length+1});for(let t=0;t<a.length;t++)e.leafNode(`item`,{x:t});e.leafNode(`item`,{t:`default`}),e.closeNode(),e.closeNode();return}let o={};r&&(o.dataField=`1`),o.compact=`0`,o.outline=`0`,o.showAll=`0`,o.defaultSubtotal=`0`,e.leafNode(`pivotField`,o)}var ol=class extends N{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new oa,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}}},sl=class e extends N{constructor(){super(),this.map={comment:new ol},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(A),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`}}},cl=class extends N{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}}},ll=class extends N{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}},ul=class extends N{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model?.tag??``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},dl=class extends N{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model?.tag??``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};let fl=[`twoCells`,`oneCells`,`absolute`];var pl=class extends N{constructor(){super(),this.map={"x:Anchor":new ll,"x:Locked":new ul({tag:`x:Locked`}),"x:LockText":new ul({tag:`x:LockText`}),"x:SizeWithCells":new dl({tag:`x:SizeWithCells`}),"x:MoveWithCells":new dl({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,fl),this.map[`x:SizeWithCells`].render(e,r,fl),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=fl[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}},ml=class e extends N{constructor(){super(),this.map={"v:textbox":new cl,"x:ClientData":new pl}}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})}},hl=class e extends N{constructor(){super(),this.map={"v:shape":new ml},this.model={comments:[],formControls:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model,i=r.comments,a=r.formControls,o=i&&i.length>0,s=a&&a.length>0;if(t.openXml(A),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),o&&(t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode()),s&&(t.openNode(`v:shapetype`,{id:`_x0000_t201`,coordsize:`21600,21600`,"o:spt":`201`,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{shadowok:`f`,"o:extrusionok":`f`,strokeok:`f`,fillok:`f`,"o:connecttype":`rect`}),t.leafNode(`o:lock`,{"v:ext":`edit`,shapetype:`t`}),t.closeNode()),o)for(let e=0;e<i.length;e++)this.map[`v:shape`].render(t,i[e],e);if(s)for(let e of a)this._renderCheckboxShape(t,e);t.closeNode()}_renderCheckboxShape(e,t){let n={id:`_x0000_s${t.shapeId}`,type:`#_x0000_t201`,style:at.getVmlStyle(t),"o:insetmode":`auto`,fillcolor:`buttonFace [67]`,strokecolor:`windowText [64]`,"o:preferrelative":`t`,filled:`f`,stroked:`f`};e.openNode(`v:shape`,n),e.leafNode(`v:fill`,{"o:detectmouseclick":`t`}),e.leafNode(`o:lock`,{"v:ext":`edit`,text:`t`}),t.text&&(e.openNode(`v:textbox`,{style:`mso-direction-alt:auto`,"o:singleclick":`t`}),e.openNode(`div`,{style:`text-align:left`}),e.openNode(`font`,{face:`Tahoma`,size:`160`,color:`auto`}),e.writeText(t.text),e.closeNode(),e.closeNode(),e.closeNode()),e.openNode(`x:ClientData`,{ObjectType:`Checkbox`}),e.leafNode(`x:MoveWithCells`),e.leafNode(`x:SizeWithCells`),e.openNode(`x:Anchor`),e.writeText(at.getVmlAnchor(t)),e.closeNode(),e.leafNode(`x:Locked`,void 0,`False`),e.leafNode(`x:LockText`,void 0,`True`),e.leafNode(`x:PrintObject`,void 0,t.print?`True`:`False`),e.leafNode(`x:AutoFill`,void 0,`False`),e.leafNode(`x:AutoLine`,void 0,`False`),e.leafNode(`x:TextHAlign`,void 0,`Left`),e.leafNode(`x:TextVAlign`,void 0,`Center`),t.link&&e.leafNode(`x:FmlaLink`,void 0,t.link),t.noThreeD&&e.leafNode(`x:NoThreeD`),e.leafNode(`x:Checked`,void 0,String(at.getVmlCheckedValue(t))),e.leafNode(`x:Row`,void 0,String(t.tl.row)),e.leafNode(`x:Column`,void 0,String(t.tl.col)),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[],formControls:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},gl=class extends N{_checkedToXmlValue(e){switch(e){case`Checked`:return`1`;case`Mixed`:return`2`;default:return`0`}}get tag(){return`formControlPr`}render(e,t){let n=t||this.model,r={xmlns:`http://schemas.microsoft.com/office/spreadsheetml/2009/9/main`,objectType:`CheckBox`,checked:this._checkedToXmlValue(n.checked),lockText:`1`};n.link&&(r.fmlaLink=n.link),n.noThreeD&&(r.noThreeD=`1`),e.openXml({version:`1.0`,encoding:`UTF-8`,standalone:`yes`}),e.leafNode(this.tag,r)}toXml(e){let t=new hi;return this.render(t,e),t.xml}parseOpen(){return!0}parseText(){}parseClose(){return!1}};let _l=e=>Array.isArray(e);var H=class e{constructor(){this.__excelts_stream=!0,this._listeners=new Map,this._maxListeners=e.defaultMaxListeners}static{this.defaultMaxListeners=10}addListener(e,t){return this.on(e,t)}_listenerCount(e){return e?_l(e)?e.length:1:0}_hasListeners(e){return this._listenerCount(this._listeners.get(e))>0}on(e,t){e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t);let n=this._listeners.get(e);if(this._maxListeners>0){let t=this._listenerCount(n);t>=this._maxListeners&&console?.warn?.(`MaxListenersExceededWarning: Possible EventEmitter memory leak detected. ${t+1} ${String(e)} listeners added. Use emitter.setMaxListeners() to increase limit`)}return n?_l(n)?n.push(t):this._listeners.set(e,[n,t]):this._listeners.set(e,t),this}prependListener(e,t){e!==`newListener`&&this._hasListeners(`newListener`)&&this.emit(`newListener`,e,t);let n=this._listeners.get(e);return n?_l(n)?n.unshift(t):this._listeners.set(e,[t,n]):this._listeners.set(e,t),this}once(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.on(e,n)}prependOnceListener(e,t){let n=(...r)=>{this.off(e,n),t.apply(this,r)};return n.listener=t,this.prependListener(e,n)}removeListener(e,t){return this.off(e,t)}off(e,t){let n=this._listeners.get(e);if(!n)return this;if(!_l(n))return(n===t||n.listener===t)&&(this._listeners.delete(e),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t)),this;let r=n;if(r.length===0)return this._listeners.delete(e),this;let i=r.lastIndexOf(t);if(i!==-1)r.splice(i,1);else for(let e=r.length-1;e>=0;e--)if(r[e].listener===t){r.splice(e,1);break}return r.length===0?this._listeners.delete(e):r.length===1&&this._listeners.set(e,r[0]),e!==`removeListener`&&this._hasListeners(`removeListener`)&&this.emit(`removeListener`,e,t),this}emit(e,...t){let n=this._listeners.get(e);if(!n){if(e===`error`){let e=t[0];if(e instanceof Error)throw e;let n=`Unhandled error.${e===void 0?` (undefined)`:` (${e})`}`;throw Error(n)}return!1}if(!_l(n))return n.apply(this,t),!0;let r=n,i=r.length;if(i===0){if(e===`error`){let e=t[0];if(e instanceof Error)throw e;let n=`Unhandled error.${e===void 0?` (undefined)`:` (${e})`}`;throw Error(n)}return!1}if(i===1)return r[0].apply(this,t),!0;let a=r.slice();for(let e=0;e<a.length;e++)a[e].apply(this,t);return!0}removeAllListeners(e){if(e!==void 0){if(e!==`removeListener`&&this._hasListeners(`removeListener`)){let t=this._listeners.get(e);if(t){let n=_l(t)?t.slice():[t];this._listeners.delete(e);for(let t of n){let n=t.listener??t;this.emit(`removeListener`,e,n)}return this}}this._listeners.delete(e)}else{if(this._hasListeners(`removeListener`)){let e=[...this._listeners.keys()];for(let t of e)if(t!==`removeListener`){let e=this._listeners.get(t);if(e){let n=_l(e)?e.slice():[e];this._listeners.delete(t);for(let e of n){let n=e.listener??e;this.emit(`removeListener`,t,n)}}}}this._listeners.clear()}return this}listenerCount(e){return this._listenerCount(this._listeners.get(e))}listeners(e){let t=this._listeners.get(e);return t?(_l(t)?t:[t]).map(e=>e.listener??e):[]}rawListeners(e){let t=this._listeners.get(e);return t?_l(t)?t.slice():[t]:[]}eventNames(){return[...this._listeners.keys()]}setMaxListeners(e){return this._maxListeners=e,this}getMaxListeners(){return this._maxListeners}};H.prototype.addListener=H.prototype.on,H.prototype.removeListener=H.prototype.off;let vl=new TextEncoder;var yl=class{constructor(e){this._buf=new Uint8Array(e&&e.size||16384),this._inPos=0,this._buffer=void 0}get length(){return this._inPos}get capacity(){return this._buf.length}get buffer(){return this._buf}toBuffer(){return this._buffer||=this._buf.slice(0,this._inPos),this._buffer}reset(e){e??=0,this._buffer=void 0,this._inPos=e}_grow(e){let t=this._buf.length*2;for(;t<e;)t*=2;let n=new Uint8Array(t);n.set(this._buf),this._buf=n}addText(e){this._buffer=void 0;let t=this._inPos+e.length;t>this._buf.length-4&&this._grow(t);let n=this._buf.subarray(this._inPos),r=vl.encodeInto(e,n);if(r.read<e.length){let t=e.length-r.read;this._grow(this._inPos+r.written+t*3);let n=vl.encodeInto(e.substring(r.read),this._buf.subarray(this._inPos+r.written));this._inPos+=r.written+n.written}else this._inPos+=r.written}addStringBuf(e){e.length&&(this._buffer=void 0,this.length+e.length>this.capacity&&this._grow(this.length+e.length),this._buf.set(e._buf.subarray(0,e.length),this._inPos),this._inPos+=e.length)}};let bl=new TextEncoder;var xl=class{constructor(e){this._data=e}get length(){return this.toBuffer().length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._buffer||=bl.encode(this._data),this._buffer}},Sl=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=this.toBuffer(),a=Math.min(r,i.length-n);return e.set(i.subarray(n,n+a),t),a}toBuffer(){return this._data.toBuffer()}},Cl=class{constructor(e){this._data=e}get length(){return this._data.length}copy(e,t,n,r){let i=Math.min(r,this._data.length-n);return e.set(this._data.subarray(n,n+i),t),i}toBuffer(){return this._data}},wl=class{constructor(e){this.size=e,this.buffer=new Uint8Array(e),this.iRead=0,this.iWrite=0}toBuffer(){return this.iRead===0&&this.iWrite===this.size?this.buffer:this.buffer.subarray(this.iRead,this.iWrite)}get length(){return this.iWrite-this.iRead}get eod(){return this.iRead===this.iWrite}get full(){return this.iWrite===this.size}read(e){if(e===0)return null;if(e===void 0||e>=this.length){let e=this.toBuffer();return this.iRead=this.iWrite,e}let t=this.buffer.subarray(this.iRead,this.iRead+e);return this.iRead+=e,t}write(e,t,n){let r=Math.min(n,this.size-this.iWrite);return e.copy(this.buffer,this.iWrite,t,r),this.iWrite+=r,r}};let Tl=()=>{};var El=class extends H{constructor(e){super(),this._writableStreamWriter=null,this._asyncWriteQueue=Promise.resolve(),this.bufSize=e?.bufSize||1024*1024,this.buffers=[],this.batch=e?.batch??!1,this.corked=!1,this.paused=!1,this.encoding=null,this.pipes=[],this._ended=!1}get writable(){return!this._ended}toBuffer(){switch(this.buffers.length){case 0:return null;case 1:return this.buffers[0].toBuffer();default:{let e=this.buffers.reduce((e,t)=>e+t.length,0),t=new Uint8Array(e),n=0;for(let e of this.buffers){let r=e.toBuffer();t.set(r,n),n+=r.length}return t}}}_getWritableBuffer(){if(this.buffers.length){let e=this.buffers[this.buffers.length-1];if(!e.full)return e}let e=new wl(this.bufSize);return this.buffers.push(e),e}async _pipeChunk(e){let t=this.pipes.map(t=>new Promise(n=>{t.write(e.toBuffer(),()=>n())}));await Promise.all(t)}_writeToBuffers(e){let t=0,n=e.length;for(;t<n;){let r=this._getWritableBuffer();t+=r.write(e,t,n-t)}}async write(e,t,n){typeof t==`function`&&(n=t),n||=Tl;let r;if(e instanceof yl||e&&e.constructor?.name===`StringBuf`)r=new Sl(e);else if(e instanceof Uint8Array)r=new Cl(e);else if(ArrayBuffer.isView(e))r=new Cl(new Uint8Array(e.buffer,e.byteOffset,e.byteLength));else if(e instanceof ArrayBuffer)r=new Cl(new Uint8Array(e));else if(typeof e==`string`)r=new xl(e);else throw new g(typeof e,`Chunk must be one of type String, Uint8Array, ArrayBuffer or StringBuf.`);if(this.pipes.length)if(this.batch)for(this._writeToBuffers(r);!this.corked&&this.buffers.length>1;){let e=this.buffers.shift();await this._pipeChunk(new Cl(e.toBuffer()))}else this.corked?(this._writeToBuffers(r),queueMicrotask(()=>n())):(await this._pipeChunk(r),n());else{let e=r.toBuffer(),t=!1;!this.paused&&this.listenerCount(`data`)>0&&(this.emit(`data`,e),t=!0),this._writableStreamWriter&&(this._asyncWriteQueue=this._asyncWriteQueue.then(()=>this._writableStreamWriter.write(e)),t=!0),t||(this._writeToBuffers(r),this.emit(`readable`)),n()}return!0}cork(){this.corked=!0}_flush(){this.pipes.length&&(async()=>{for(;this.buffers.length;){let e=this.buffers.shift();await this._pipeChunk(new Cl(e.toBuffer()))}})().catch(e=>this.emit(`error`,e))}uncork(){this.corked=!1,this._flush()}end(e,t,n){let r=e=>{if(e){n?.(e);return}this._ended=!0,this._flush(),this.pipes.forEach(e=>{typeof e.end==`function`&&e.end()}),this._writableStreamWriter?this._asyncWriteQueue.then(()=>this._writableStreamWriter.close()).then(()=>{this.emit(`finish`),this.emit(`close`)}).catch(e=>{this.emit(`error`,e)}):(this.emit(`finish`),this.emit(`close`))};e?this.write(e,t,r):r()}read(e){if(e){let t=[],n=e;for(;n&&this.buffers.length&&!this.buffers[0].eod;){let e=this.buffers[0],r=e.read(n);r&&(n-=r.length,t.push(r)),e.eod&&e.full&&this.buffers.shift()}return tr(Dl(t))}let t=this.buffers.map(e=>e.toBuffer()).filter(Boolean);return this.buffers=[],tr(Dl(t))}readString(e){let t=e??this.encoding??`utf-8`,n=this.read();return zn(t).decode(n)}setEncoding(e){this.encoding=e}pause(){this.paused=!0}resume(){this.paused=!1}isPaused(){return this.paused}pipe(e){return this.pipes.push(e),!this.paused&&this.buffers.length&&this.end(),e}pipeTo(e){this._writableStreamWriter=e.getWriter()}unpipe(e){this.pipes=this.pipes.filter(t=>t!==e)}unshift(){throw new v(`unshift`,`Not implemented`)}wrap(){throw new v(`wrap`,`Not implemented`)}push(e){return e!==null&&this.write(e),!0}};function Dl(e){if(e.length===0)return new Uint8Array;if(e.length===1)return e[0];let t=e.reduce((e,t)=>e+t.length,0),n=new Uint8Array(t),r=0;for(let t of e)n.set(t,r),r+=t.length;return n}let Ol=null;function kl(){if(Ol)return Ol;let e=new Uint32Array(256);for(let t=0;t<256;t++){let n=t;for(let e=0;e<8;e++)n=n&1?3988292384^n>>>1:n>>>1;e[t]=n}return Ol=e,e}function Al(e,t){let n=kl();for(let r=0;r<t.length;r++)e=n[(e^t[r])&255]^e>>>8;return e}function jl(e){return(e^4294967295)>>>0}function Ml(e){return jl(Al(4294967295,e))}function Nl(e,t){return(kl()[(e^t)&255]^e>>>8)>>>0}let Pl=(()=>{let e=new Uint8Array(288);for(let t=0;t<=143;t++)e[t]=8;for(let t=144;t<=255;t++)e[t]=9;for(let t=256;t<=279;t++)e[t]=7;for(let t=280;t<=287;t++)e[t]=8;return e})(),Fl=new Uint8Array(32).fill(5),Il=[3,4,5,6,7,8,9,10,11,13,15,17,19,23,27,31,35,43,51,59,67,83,99,115,131,163,195,227,258],Ll=[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],Rl=[1,2,3,4,5,7,9,13,17,25,33,49,65,97,129,193,257,385,513,769,1025,1537,2049,3073,4097,6145,8193,12289,16385,24577],zl=[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],Bl=[[1,0,0],[2,1,0],[3,2,0],[4,3,0],[6,4,1],[8,5,1],[12,6,2],[16,7,2],[24,8,3],[32,9,3],[48,10,4],[64,11,4],[96,12,5],[128,13,5],[192,14,6],[256,15,6],[384,16,7],[512,17,7],[768,18,8],[1024,19,8],[1536,20,9],[2048,21,9],[3072,22,10],[4096,23,10],[6144,24,11],[8192,25,11],[12288,26,12],[16384,27,12],[24576,28,13],[32768,29,13]],Vl=[16,17,18,0,8,7,9,6,10,5,11,4,12,3,13,2,14,1,15];function Hl(e,t){let n=new Uint16Array(16);for(let r=0;r<t;r++)e[r]>0&&n[e[r]]++;let r=new Uint16Array(16),i=0;for(let e=1;e<=15;e++)i=i+n[e-1]<<1,r[e]=i;let a={};for(let n=0;n<t;n++){let t=e[n];if(t===0)continue;i=r[t]++;let o=a;for(let e=t-1;e>=0;e--)i>>e&1?(o.right||={},o=o.right):(o.left||={},o=o.left);o.symbol=n}return a}var Ul=class{constructor(e){this.data=e,this.pos=0,this.bitBuf=0,this.bitCount=0}readBits(e){for(;this.bitCount<e;){if(this.pos>=this.data.length)throw Error(`Unexpected end of DEFLATE data`);this.bitBuf|=this.data[this.pos++]<<this.bitCount,this.bitCount+=8}let t=this.bitBuf&(1<<e)-1;return this.bitBuf>>=e,this.bitCount-=e,t}decodeSymbol(e){let t=e;for(;t.symbol===void 0;)if(t=this.readBits(1)===0?t.left:t.right,!t)throw Error(`Invalid Huffman code`);return t.symbol}alignToByte(){this.bitBuf=0,this.bitCount=0}readByte(){if(this.pos>=this.data.length)throw Error(`Unexpected end of data`);return this.data[this.pos++]}readUint16(){return this.readByte()|this.readByte()<<8}};function Wl(e){let t=new Ul(e),n=[],r=!1;for(;!r;){r=t.readBits(1)===1;let e=t.readBits(2);if(e===0){t.alignToByte();let e=t.readUint16();if((e^t.readUint16())!==65535)throw Error(`Invalid stored block length`);for(let r=0;r<e;r++)n.push(t.readByte())}else if(e===1||e===2){let r,i;if(e===1)r=Hl(Pl,288),i=Hl(Fl,32);else{let e=t.readBits(5)+257,n=t.readBits(5)+1,a=t.readBits(4)+4,o=new Uint8Array(19);for(let e=0;e<a;e++)o[Vl[e]]=t.readBits(3);let s=Hl(o,19),c=new Uint8Array(e+n),l=0;for(;l<e+n;){let e=t.decodeSymbol(s);if(e<16)c[l++]=e;else if(e===16){let e=t.readBits(2)+3,n=c[l-1];for(let t=0;t<e;t++)c[l++]=n}else if(e===17){let e=t.readBits(3)+3;for(let t=0;t<e;t++)c[l++]=0}else if(e===18){let e=t.readBits(7)+11;for(let t=0;t<e;t++)c[l++]=0}}r=Hl(c.subarray(0,e),e),i=Hl(c.subarray(e),n)}for(;;){let e=t.decodeSymbol(r);if(e<256)n.push(e);else if(e===256)break;else{let r=e-257,a=Il[r]+t.readBits(Ll[r]),o=t.decodeSymbol(i),s=Rl[o]+t.readBits(zl[o]),c=n.length-s;for(let e=0;e<a;e++)n.push(n[c+e])}}}else throw Error(`Invalid DEFLATE block type: `+e)}return new Uint8Array(n)}function Gl(e){let t=65535,n=Math.ceil(e.length/t)||1,r=n*5+e.length,i=new Uint8Array(r),a=0,o=0;for(let r=0;r<n;r++){let s=r===n-1,c=Math.min(t,e.length-o);i[a++]=+!!s,i[a++]=c&255,i[a++]=c>>8&255,i[a++]=~c&255,i[a++]=~c>>8&255,i.set(e.subarray(o,o+c),a),a+=c,o+=c}return i.subarray(0,a)}let Kl=32768;Kl-1;let ql=32768;function Jl(e,t,n){return(e<<16|t<<8|n)*506832829>>>17&32767}function Yl(e){if(e.length===0)return new Uint8Array([3,0]);if(e.length<100)return Gl(e);let t=new Xl;t.writeBits(1,1),t.writeBits(1,2);let n=new Int32Array(Kl),r=new Int32Array(ql),i=0,a=0,o=0,s=0,c=!1;for(;i<e.length;){let l=0,u=0;if(i+2<e.length){let t=Jl(e[i],e[i+1],e[i+2]),a=64,o=n[t];for(;o>0&&a-- >0;){let t=o-1,n=i-t;if(n>ql||n<=0)break;if(l>=3&&e[t+l]!==e[i+l]){o=r[t&ql-1];continue}let a=0,s=Math.min(258,e.length-i);for(;a<s&&e[t+a]===e[i+a];)a++;if(a>l&&(l=a,u=n,a>=258))break;o=r[t&ql-1]}r[i&ql-1]=n[t],n[t]=i+1}if(c)if(l>a)Ql(t,s),a=l,o=u,s=e[i],i++;else{$l(t,a),eu(t,o);let s=i-1+a;for(let t=i;t<s&&t+2<e.length;t++){let i=Jl(e[t],e[t+1],e[t+2]);r[t&ql-1]=n[i],n[i]=t+1}i=s,c=!1,a=0}else l>=3?(c=!0,a=l,o=u,s=e[i],i++):(Ql(t,e[i]),i++)}return c&&($l(t,a),eu(t,o)),Ql(t,256),t.finish()}var Xl=class{constructor(){this.chunks=[],this.buffer=[],this.bitBuf=0,this.bitCount=0}writeBits(e,t){for(this.bitBuf|=e<<this.bitCount,this.bitCount+=t;this.bitCount>=8;)this.buffer.push(this.bitBuf&255),this.bitBuf>>=8,this.bitCount-=8,this.buffer.length>=65536&&(this.chunks.push(new Uint8Array(this.buffer)),this.buffer=[])}writeBitsReverse(e,t){let n=0;for(let r=0;r<t;r++)n=n<<1|e>>r&1;this.writeBits(n,t)}finish(){return this.bitCount>0&&this.buffer.push(this.bitBuf&255),this.chunks.length===0?new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),j(this.chunks))}flushBytes(){if(this.chunks.length===0&&this.buffer.length===0)return new Uint8Array;let e;return this.chunks.length===0?e=new Uint8Array(this.buffer):(this.chunks.push(new Uint8Array(this.buffer)),e=j(this.chunks),this.chunks=[]),this.buffer=[],e}};let Zl=(()=>{let e=[];for(let t=0;t<=287;t++){let n,r;t<=143?(n=48+t,r=8):t<=255?(n=400+(t-144),r=9):t<=279?(n=t-256,r=7):(n=192+(t-280),r=8),e[t]=[n,r]}return e})();function Ql(e,t){let[n,r]=Zl[t];e.writeBitsReverse(n,r)}function $l(e,t){let n,r,i;if(t<=10)n=257+t-3,r=0,i=0;else if(t<=18){let e=t-11;n=265+Math.floor(e/2),r=1,i=e%2}else if(t<=34){let e=t-19;n=269+Math.floor(e/4),r=2,i=e%4}else if(t<=66){let e=t-35;n=273+Math.floor(e/8),r=3,i=e%8}else if(t<=130){let e=t-67;n=277+Math.floor(e/16),r=4,i=e%16}else if(t<=257){let e=t-131;n=281+Math.floor(e/32),r=5,i=e%32}else n=285,r=0,i=0;Ql(e,n),r>0&&e.writeBits(i,r)}function eu(e,t){let n=0,r=0,i=1;for(let e=0;e<Bl.length;e++){let[a,o,s]=Bl[e];if(t<=a){n=o,r=s;break}i=a+1}let a=t-i;e.writeBitsReverse(n,5),r>0&&e.writeBits(a,r)}let tu=32768;var nu=class{constructor(){this._output=new Xl,this._head=new Int32Array(Kl),this._prev=new Int32Array(ql),this._window=new Uint8Array(tu),this._windowLen=0,this._totalIn=0,this._hasPrevMatch=!1,this._prevMatchLen=0,this._prevMatchDist=0,this._prevLiteral=0}write(e){if(e.length===0)return new Uint8Array;let t=this._output;t.writeBits(0,1),t.writeBits(1,2);let n=this._window,r=this._windowLen,i=this._head,a=this._prev,o=this._totalIn,s=this._hasPrevMatch,c=this._prevMatchLen,l=this._prevMatchDist,u=this._prevLiteral,d=t=>{if(t+2>=e.length)return;let n=Jl(e[t],e[t+1],e[t+2]),r=o+t;a[r&ql-1]=i[n],i[n]=r+1},f=(t,i)=>{for(let a=0;a<i;a++)n[r+a&tu-1]=e[t+a];r+=i},p=0;for(;p<e.length;){let r=0,m=0;if(p+2<e.length){let t=Jl(e[p],e[p+1],e[p+2]),s=o+p,c=64,l=i[t];for(;l>0&&c-- >0;){let t=l-1,i=s-t;if(i>ql||i<=0)break;let c=Math.min(258,e.length-p),u=0;if(r>=3){let i=t+r,s,c=i-o;if(s=c>=0&&c<e.length?e[c]:n[i&tu-1],s!==e[p+r]){l=a[t&ql-1];continue}}for(;u<c;){let r=t+u,i,a=r-o;if(i=a>=0&&a<e.length?e[a]:n[r&tu-1],i!==e[p+u])break;u++}if(u>r&&(r=u,m=i,u>=258))break;l=a[t&ql-1]}a[s&ql-1]=i[t],i[t]=s+1}if(s)if(r>c)Ql(t,u),c=r,l=m,u=e[p],f(p,1),p++;else{$l(t,c),eu(t,l);let n=p-1+c,r=Math.min(n,e.length);for(let e=p;e<r;e++)d(e);f(p,r-p),p=r,s=!1,c=0}else r>=3?(s=!0,c=r,l=m,u=e[p],f(p,1),p++):(Ql(t,e[p]),f(p,1),p++)}if(s){$l(t,c),eu(t,l);let n=Math.min(p-1+c,e.length);for(let e=p;e<n;e++)d(e);f(p,n-p),s=!1,c=0}return Ql(t,256),this._windowLen=r,this._totalIn=o+e.length,this._hasPrevMatch=s,this._prevMatchLen=c,this._prevMatchDist=l,this._prevLiteral=u,t.flushBytes()}finish(){let e=this._output;return e.writeBits(1,1),e.writeBits(1,2),Ql(e,256),e.finish()}};let U=new Uint8Array;function ru(e,t,n=0){let r=e.length,i=t.length;if(i===0)return 0;if(i>r)return-1;let a=n|0;if(a<0&&(a=0),a>r-i)return-1;if(i===1)return e.indexOf(t[0],a);if(i===2){let n=t[0],i=t[1],o=r-2,s=e.indexOf(n,a);for(;s!==-1&&s<=o;){if(e[s+1]===i)return s;s=e.indexOf(n,s+1)}return-1}if(i===3){let n=t[0],i=t[1],o=t[2],s=r-3,c=e.indexOf(n,a);for(;c!==-1&&c<=s;){if(e[c+1]===i&&e[c+2]===o)return c;c=e.indexOf(n,c+1)}return-1}if(i===4){let n=t[0],i=t[1],o=t[2],s=t[3],c=r-4,l=e.indexOf(n,a);for(;l!==-1&&l<=c;){if(e[l+1]===i&&e[l+2]===o&&e[l+3]===s)return l;l=e.indexOf(n,l+1)}return-1}outer:for(let n=a;n<=r-i;n++){for(let r=0;r<i;r++)if(e[n+r]!==t[r])continue outer;return n}return-1}var iu=class{_activeChunkCount(){return this._chunks.length-this._chunkHead}_headChunk(){return this._chunks[this._chunkHead]}_compactConsumedChunks(){if(this._chunkHead!==0){if(this._chunkHead>=this._chunks.length){this._chunks=[],this._chunkHead=0;return}this._chunkHead>32&&this._chunkHead*2>=this._chunks.length&&(this._chunks=this._chunks.slice(this._chunkHead),this._chunkHead=0)}}_dropHeadChunk(){this._chunkHead++,this._headOffset=0,this._compactConsumedChunks()}constructor(e){this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0,e&&e.length>0&&this.reset(e)}get length(){return this._length}isEmpty(){return this.length===0}view(){if(this._length===0)return U;if(this._activeChunkCount()===1)return this._headChunk().subarray(this._headOffset,this._headOffset+this._length);if(this._cachedView&&this._cachedLength===this._length)return this._cachedView;let e=new Uint8Array(this._length),t=0;for(let n=this._chunkHead;n<this._chunks.length;n++){let r=this._chunks[n],i=n===this._chunkHead?this._headOffset:0,a=n===this._chunks.length-1?i+(this._length-t):r.length;if(e.set(r.subarray(i,a),t),t+=a-i,t>=e.length)break}return this._cachedView=e,this._cachedLength=this._length,e}reset(e){if(this._cachedView=null,this._cachedLength=0,this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,!e||e.length===0)return;let t=new Uint8Array(e.length);t.set(e),this._chunks=[t],this._chunkHead=0,this._headOffset=0,this._length=t.length}append(e){e.length!==0&&(this._cachedView=null,this._cachedLength=0,this._chunks.push(e),this._length+=e.length)}read(e){if(e<=0)return U;if(e>this._length)throw RangeError(`ByteQueue: read beyond available data`);if(this._cachedView=null,this._cachedLength=0,this._activeChunkCount()===1){let t=this._headChunk(),n=this._headOffset,r=n+e,i=t.subarray(n,r);return this._headOffset=r,this._length-=e,this._length===0?(this._chunks=[],this._chunkHead=0,this._headOffset=0):this._headOffset>=t.length&&this._dropHeadChunk(),i}let t=new Uint8Array(e),n=0,r=e;for(;r>0;){let e=this._headChunk(),i=this._headOffset,a=e.length-i,o=Math.min(a,r);t.set(e.subarray(i,i+o),n),n+=o,r-=o,this._headOffset+=o,this._length-=o,this._headOffset>=e.length&&this._dropHeadChunk()}return this._length===0&&(this._chunks=[],this._chunkHead=0,this._headOffset=0),t}peekChunks(e){if(e<=0)return[];if(e>this._length)throw RangeError(`ByteQueue: peek beyond available data`);if(this._activeChunkCount()===1){let t=this._headChunk(),n=this._headOffset;return[t.subarray(n,n+e)]}let t=[],n=e;for(let e=this._chunkHead;e<this._chunks.length&&n>0;e++){let r=this._chunks[e],i=e===this._chunkHead?this._headOffset:0,a=r.length-i;if(a<=0)continue;let o=Math.min(a,n);t.push(r.subarray(i,i+o)),n-=o}return t}discard(e){if(e<=0)return;if(e>=this._length){this._chunks=[],this._chunkHead=0,this._headOffset=0,this._length=0,this._cachedView=null,this._cachedLength=0;return}this._cachedView=null,this._cachedLength=0;let t=e;for(;t>0;){let e=this._headChunk(),n=this._headOffset,r=e.length-n,i=Math.min(r,t);this._headOffset+=i,this._length-=i,t-=i,this._headOffset>=e.length&&this._dropHeadChunk()}this._length===0&&(this._chunks=[],this._chunkHead=0,this._headOffset=0)}indexOfPattern(e,t=0){let n=e.length;if(n===0)return 0;let r=this._length;if(n>r)return-1;let i=t|0;if(i<0&&(i=0),i>r-n)return-1;if(this._activeChunkCount()===1){let t=this._headChunk(),a=this._headOffset,o=t.subarray(a,a+r);return n===1?o.indexOf(e[0],i):ru(o,e,i)}if(n>4)return ru(this.view(),e,i);let a=e[0],o=n>=2?e[1]:0,s=n>=3?e[2]:0,c=n>=4?e[3]:0,l=this._chunks,u=this._chunkHead,d=(e,t)=>{let n=e,r=t;for(;n<l.length;){let e=l[n];if(r<e.length)return e[r]|0;r-=e.length,n++}return null},f=0;for(let e=u;e<l.length;e++){let t=l[e],p=e===u?this._headOffset:0,m=t.length-p;if(m<=0)continue;let h=f,g=h+m,_=i<=h?p:i>=g?t.length:p+(i-h);if(_>t.length-1){f+=m;continue}let v=t.length-1,y=t.indexOf(a,_);for(;y!==-1&&y<=v;){let i=h+(y-p);if(i>r-n)return-1;if(n===1)return i;if(y+n<=t.length){if(t[y+1]!==o){y=t.indexOf(a,y+1);continue}if(n===2)return i;if(t[y+2]!==s){y=t.indexOf(a,y+1);continue}if(n===3)return i;if(t[y+3]!==c){y=t.indexOf(a,y+1);continue}return i}let l=d(e,y+1);if(l===null||l!==o){y=t.indexOf(a,y+1);continue}if(n===2)return i;let u=d(e,y+2);if(u===null||u!==s){y=t.indexOf(a,y+1);continue}if(n===3)return i;let f=d(e,y+3);if(f===null||f!==c){y=t.indexOf(a,y+1);continue}return i}f+=m}return-1}peekUint32LE(e){let t=e|0;if(t<0||t+4>this._length)return null;let n=this._chunks,r=t;for(let e=this._chunkHead;e<n.length;e++){let t=n[e],i=e===this._chunkHead?this._headOffset:0,a=t.length-i;if(r<a){let a=i+r;if(a+4<=t.length){let e=t[a]|0,n=t[a+1]|0,r=t[a+2]|0,i=t[a+3]|0;return(e|n<<8|r<<16|i<<24)>>>0}let o=t[a]|0,s=0,c=0,l=0,u=e,d=a+1;for(let e=1;e<4;e++)for(;u<n.length;){let t=n[u];if(d<t.length){let n=t[d]|0;e===1?s=n:e===2?c=n:l=n,d++;break}u++,d=0}return(o|s<<8|c<<16|l<<24)>>>0}r-=a}return null}peekByte(e){let t=e|0;if(t<0||t>=this._length)throw RangeError(`ByteQueue: peek beyond available data`);let n=t;for(let e=this._chunkHead;e<this._chunks.length;e++){let t=this._chunks[e],r=e===this._chunkHead?this._headOffset:0,i=t.length-r;if(n<i)return t[r+n]|0;n-=i}throw RangeError(`ByteQueue: peek beyond available data`)}};function au(){try{return typeof CompressionStream>`u`?!1:(new CompressionStream(`deflate-raw`),!0)}catch{return!1}}function ou(){try{return typeof DecompressionStream>`u`?!1:(new DecompressionStream(`deflate-raw`),!0)}catch{return!1}}let su=null,cu=null;function lu(){return typeof CompressionStream>`u`?!1:(su===null&&(su=au()),su)}function uu(){return typeof DecompressionStream>`u`?!1:(cu===null&&(cu=ou()),cu)}function du(){return lu()&&uu()}async function fu(e){let t=new iu;for(;;){let{done:n,value:r}=await e.read();if(n)break;t.append(r)}return t.read(t.length)}async function pu(e,t){let n=t.writable.getWriter(),r=t.readable.getReader();try{let t=fu(r);return await n.write(e),await n.close(),await t}finally{try{n.releaseLock()}catch{}try{r.releaseLock()}catch{}}}async function mu(e){return pu(e,new DecompressionStream(`deflate-raw`))}let hu=65521;function gu(e){let t=1,n=0;for(let r=0;r<e.length;){let i=Math.min(r+5552,e.length);for(;r<i;)t+=e[r++],n+=t;t%=hu,n%=hu}return n<<16|t}let _u={};function vu(e,t){let n=`${e}:${t}`;return()=>{let r=e===`compression`?typeof CompressionStream<`u`?CompressionStream:void 0:typeof DecompressionStream<`u`?DecompressionStream:void 0;if(!r)return!1;let i=_u[n];if(i!=null)return i;try{new r(t),_u[n]=!0}catch{_u[n]=!1}return _u[n]}}vu(`compression`,`gzip`),vu(`decompression`,`gzip`),vu(`compression`,`deflate`),vu(`decompression`,`deflate`);let yu={0:new Uint8Array([120,1]),1:new Uint8Array([120,1]),2:new Uint8Array([120,94]),3:new Uint8Array([120,94]),4:new Uint8Array([120,94]),5:new Uint8Array([120,94]),6:new Uint8Array([120,156]),7:new Uint8Array([120,218]),8:new Uint8Array([120,218]),9:new Uint8Array([120,218])};function bu(e){return yu[Math.max(0,Math.min(9,e))]??yu[6]}function xu(e){let t=new Uint8Array(4);return t[0]=e>>>24&255,t[1]=e>>>16&255,t[2]=e>>>8&255,t[3]=e&255,t}var Su=class extends t{constructor(e,t){super(e,t),this.name=`ArchiveError`}},Cu=class extends Su{constructor(e,t,n){super(`CRC32 mismatch for "${e}": expected 0x${t.toString(16).padStart(8,`0`)}, got 0x${n.toString(16).padStart(8,`0`)}`),this.path=e,this.expected=t,this.actual=n,this.name=`Crc32MismatchError`}},wu=class extends Su{constructor(e,t,n,r){let i=r===`too-many-bytes`?`Entry "${e}" produced more bytes than declared: expected ${t}, got at least ${n}`:`Entry "${e}" produced fewer bytes than declared: expected ${t}, got ${n}`;super(i),this.path=e,this.expected=t,this.actual=n,this.reason=r,this.name=`EntrySizeMismatchError`}isZipBomb(){return this.reason===`too-many-bytes`}isCorruption(){return this.reason===`too-few-bytes`}},Tu=class extends Su{constructor(e,t){super(t?`Failed to decrypt "${e}": ${t}`:`Failed to decrypt "${e}": incorrect password or corrupted data`),this.name=`DecryptionError`}},Eu=class extends Su{constructor(e){super(`File "${e}" is encrypted. Please provide a password to extract.`),this.name=`PasswordRequiredError`}},Du=class extends Su{constructor(e){super(`Unsupported compression method: ${e}`),this.name=`UnsupportedCompressionError`}};let Ou={maxWorkers:typeof navigator<`u`&&navigator.hardwareConcurrency||4,minWorkers:0,idleTimeout:3e4,useTransferables:!0,workerUrl:void 0};function ku(e){let t=e?.maxWorkers??Ou.maxWorkers,n=e?.minWorkers??Ou.minWorkers;return{maxWorkers:Math.max(1,t),minWorkers:Math.max(0,Math.min(n,t)),idleTimeout:Math.max(0,e?.idleTimeout??Ou.idleTimeout),useTransferables:e?.useTransferables??Ou.useTransferables,workerUrl:e?.workerUrl}}let Au={high:3,normal:2,low:1};function ju(e){return e?Au[e]??Au.normal:Au.normal}function Mu(){return typeof Worker<`u`&&typeof Blob<`u`}function Nu(){return`
|
|
34
34
|
'use strict';
|
|
35
35
|
|
|
36
36
|
// Check deflate-raw support once at startup
|
|
@@ -403,7 +403,7 @@ onmessage = async (ev) => {
|
|
|
403
403
|
`&&l++,o=l+1}}if(o<c&&a.length<t){let t=e.slice(o);if(!r||!t.startsWith(r)){let e=t.trim();!(t.length===0||i&&e===``)&&e!==``&&a.push(t)}}return a}function Yg(e,t,n){if(e.length===0)return{avgFieldCount:0,delta:1/0};let r=0,i=0,a;for(let o of e){let e=Xg(o,t,n)+1;if(i+=e,a===void 0){a=e;continue}r+=Math.abs(e-a),a=e}return i/=e.length,{avgFieldCount:i,delta:r}}function Xg(e,t,n){let r=0,i=!1,a=e.length,o=t.length;for(let s=0;s<a;s++)n&&e[s]===n?i&&e[s+1]===n?s++:i=!i:i||(o===1?e[s]===t&&r++:e.startsWith(t,s)&&(r++,s+=o-1));return r}let Zg=/\r\n|\r|\n/,Qg=null,$g=null,e_=null;function t_(){return Qg||(Qg=new TextEncoder,$g=new Uint8Array(4),e_=new Uint8Array(4096)),Qg}function n_(e){let t=e.length;if(t===0)return 0;if(t===1)return e.charCodeAt(0)<128?1:t_().encodeInto(e,$g).written;let n=!0;for(let r=0;r<t;r++)if(e.charCodeAt(r)>=128){n=!1;break}if(n)return t;let r=t_();return t*3>e_.length&&(e_=new Uint8Array(t*3)),r.encodeInto(e,e_).written}function r_(e){let{input:t,options:n,detectedDelimiter:r}=e,{delimiter:i=`,`,delimitersToGuess:a,lineEnding:o=``,quote:s=`"`,escape:c,skipEmptyLines:l=!1,trim:u=!1,ltrim:d=!1,rtrim:f=!1,headers:p=!1,comment:m,maxRows:h,toLine:g,skipLines:_=0,skipRows:v=0,columnMismatch:y,groupColumnsByName:b=!1,fastMode:x=!1,dynamicTyping:S,castDate:ee,beforeFirstChunk:C,info:te=!1,raw:ne=!1,relaxQuotes:w=!1,skipRecordsWithError:T=!1,skipRecordsWithEmptyValues:E=!1,onSkip:re,maxRowBytes:ie}=n,ae=y?.less??`error`,oe=y?.more??`error`,se;if(t!==void 0){if(se=t,C){let e=C(se);if(typeof e==`string`)se=e;else if(e!=null)throw new jg(`beforeFirstChunk must return a string or undefined, got ${typeof e}`)}se=Wg(se)}let D=l,{enabled:ce,char:le}=Bg(s),ue=Vg(c,le),de=ue.enabled?ue.char||le:``,fe;fe=r===void 0?i===``&&se!==void 0?qg(se,le||`"`,a,m,D):i===``?`,`:i:r;let pe=o||(se===void 0?`
|
|
404
404
|
`:Kg(se));return{config:{delimiter:fe,linebreak:pe,linebreakRegex:pe&&pe!==`
|
|
405
405
|
`&&pe!==`\r
|
|
406
|
-
`&&pe!==`\r`?pe:Zg,quote:le,escape:de,quoteEnabled:ce,trimField:o_(u,d,f),trimFieldIsIdentity:!u&&!d&&!f,shouldSkipEmpty:D,skipLines:_,skipRows:v,maxRows:h,toLine:g,maxRowBytes:ie,comment:m,fastMode:x,relaxQuotes:w,columnLess:ae,columnMore:oe,groupColumnsByName:b,skipRecordsWithError:T,skipRecordsWithEmptyValues:E,infoOption:te,rawOption:ne,dynamicTyping:S,castDate:ee,invokeOnSkip:Pg(re),headers:p},processedInput:se}}function i_(e,t){let n=r_({input:e,options:t});return{config:n.config,processedInput:n.processedInput}}function a_(e){return{delimiter:e.delimiter,quote:e.quote,escape:e.escape,quoteEnabled:e.quoteEnabled,relaxQuotes:e.relaxQuotes}}function o_(e,t,n){return e||t&&n?e=>e.trim():t?e=>e.trimStart():n?e=>e.trimEnd():e=>e}function s_(e){let t={lineNumber:0,dataRowCount:0,skippedDataRows:0,truncated:!1,headerRow:null,originalHeaders:null,useHeaders:!1,headerRowProcessed:!1,renamedHeadersForMeta:null,currentRowStartLine
|
|
406
|
+
`&&pe!==`\r`?pe:Zg,quote:le,escape:de,quoteEnabled:ce,trimField:o_(u,d,f),trimFieldIsIdentity:!u&&!d&&!f,shouldSkipEmpty:D,skipLines:_,skipRows:v,maxRows:h,toLine:g,maxRowBytes:ie,comment:m,fastMode:x,relaxQuotes:w,columnLess:ae,columnMore:oe,groupColumnsByName:b,skipRecordsWithError:T,skipRecordsWithEmptyValues:E,infoOption:te,rawOption:ne,dynamicTyping:S,castDate:ee,invokeOnSkip:Pg(re),headers:p},processedInput:se}}function i_(e,t){let n=r_({input:e,options:t});return{config:n.config,processedInput:n.processedInput}}function a_(e){return{delimiter:e.delimiter,quote:e.quote,escape:e.escape,quoteEnabled:e.quoteEnabled,relaxQuotes:e.relaxQuotes}}function o_(e,t,n){return e||t&&n?e=>e.trim():t?e=>e.trimStart():n?e=>e.trimEnd():e=>e}function s_(e){let t={lineNumber:0,dataRowCount:0,skippedDataRows:0,truncated:!1,headerRow:null,originalHeaders:null,useHeaders:!1,headerRowProcessed:!1,renamedHeadersForMeta:null,currentRowStartLine:+!!e.infoOption,currentRowStartOffset:0,currentRowQuoted:[],currentRawRow:``},{headers:n,groupColumnsByName:r}=e;if(n===!0)t.useHeaders=!0;else if(Array.isArray(n)){let e=Mg([],{headers:n,groupColumnsByName:r},null);e&&(t.headerRow=e.headers,t.originalHeaders=e.originalHeaders,t.renamedHeadersForMeta=e.renamedHeaders),t.useHeaders=!0,t.headerRowProcessed=!0}else typeof n==`function`&&(t.useHeaders=!0);return t}function c_(e,t,n,r,i){t&&(e.currentRowQuoted=[],e.currentRowStartLine=r,e.currentRowStartOffset=i),n&&(e.currentRawRow=``)}let l_=Object.freeze(Array(256).fill(!1));function u_(e){return e<=256?l_:Array(e).fill(!1)}let d_=/^-?(?:\d+(?:\.\d*)?|\.\d+)(?:[eE][+-]?\d+)?$/,f_=null;function p_(){return f_||=pg.iso(),f_}function m_(e){return!e||e.length<10?null:p_().parse(e)}function h_(e,t){return e?e===!0?!0:Array.isArray(e)&&typeof t==`string`?e.includes(t):!1:!1}function g_(e,t){return e===t||e===t-32}function __(e){let t=e.length;if(t===0)return``;let n=e.charCodeAt(0);if(t===4){if((n===116||n===84)&&g_(e.charCodeAt(1),114)&&g_(e.charCodeAt(2),117)&&g_(e.charCodeAt(3),101))return!0;if((n===110||n===78)&&g_(e.charCodeAt(1),117)&&g_(e.charCodeAt(2),108)&&g_(e.charCodeAt(3),108))return null}else if(t===5&&(n===102||n===70)&&g_(e.charCodeAt(1),97)&&g_(e.charCodeAt(2),108)&&g_(e.charCodeAt(3),115)&&g_(e.charCodeAt(4),101))return!1;if(n>=48&&n<=57||n===45||n===46||n===73||n===78){if(e.charCodeAt(t-1)<=32)return e;if(e===`Infinity`)return 1/0;if(e===`-Infinity`)return-1/0;if(e===`NaN`)return NaN;if(n===48&&t>1){let t=e.charCodeAt(1);if(t>=48&&t<=57)return e}if(n===45&&t>2&&e.charCodeAt(1)===48){let t=e.charCodeAt(2);if(t>=48&&t<=57)return e}if(d_.test(e)){let t=Number(e);if(!isNaN(t))return t}}return e}function v_(e){return typeof e==`function`}function y_(e,t){return t===!1?e:v_(t)?t(e):__(e)}function b_(e,t,n,r){if(h_(r,t)){let t=m_(e);if(t!==null)return t}if(n===!0)return __(e);if(n===!1||t===void 0)return e;let i=n[t];return i===void 0?e:y_(e,i)}function x_(e,t,n){if(t===!1&&!n)return e;for(let r in e)Object.hasOwn(e,r)&&(e[r]=b_(e[r],r,t,n));return e}function S_(e,t,n,r){return n===!1&&!r||n!==!0&&n!==!1&&!t?e:e.map((e,i)=>{let a=t?.[i];return b_(e,a,n,r)})}function C_(e,t,n){let r=Mg(e,{headers:n.headers,groupColumnsByName:n.groupColumnsByName},t.headerRow);return r?(t.headerRow=r.headers,t.originalHeaders=r.originalHeaders,t.renamedHeadersForMeta=r.renamedHeaders,t.headerRowProcessed=!0,r.skipCurrentRow):(t.headerRowProcessed=!0,!1)}function w_(e,t,n){if(!t.headerRow||t.headerRow.length===0)return null;let r=t.headerRow.length,i=e.length;if(i===r)return null;let a=Ng(e,r,{columnLess:n.columnLess,columnMore:n.columnMore});return a.errorCode?{errorCode:a.errorCode,message:a.errorCode===`TooManyFields`?`Too many fields: expected ${r}, found ${i}`:`Too few fields: expected ${r}, found ${i}`,isValid:a.isValid,reason:a.reason,extras:a.extras}:null}function T_(e,t,n,r){let i={index:t,line:e.currentRowStartLine,offset:e.currentRowStartOffset,quoted:e.currentRowQuoted.slice(0,r)};return n&&(i.raw=e.currentRawRow),i}function E_(e,t,n){if(t.headerRow){let r=Ig(e,t.headerRow,t.originalHeaders,n.groupColumnsByName);return(n.dynamicTyping||n.castDate)&&(r=x_(r,n.dynamicTyping||!1,n.castDate)),r}let r={};for(let t=0;t<e.length;t++)r[t]=e[t];return r}function D_(e,t,n,r){return!!(t&&e[0]?.trimStart().startsWith(t)||kg(e,n)||r&&Ag(e))}function O_(e,t,n,r,i){if(t.useHeaders&&!t.headerRowProcessed&&C_(e,t,n))return{stop:!1,skipped:!0};if(t.skippedDataRows<n.skipRows)return t.skippedDataRows++,{stop:!1,skipped:!0};let a=w_(e,t,n),o;if(a){let t={code:a.errorCode,message:a.message,line:i};if(r.push(t),!a.isValid)return n.skipRecordsWithError?(n.invokeOnSkip?.({code:a.errorCode,message:a.reason||`Column mismatch`,line:i},e),{stop:!1,skipped:!0,row:e,error:{code:a.errorCode,message:a.reason||`Column mismatch`,line:i},reason:a.reason||`Column mismatch`}):{stop:!1,skipped:!0,row:e,error:t,reason:a.reason||`Column mismatch`};o=a.extras}if(n.skipRecordsWithEmptyValues&&Ag(e))return{stop:!1,skipped:!0};if(n.maxRows!==void 0&&t.dataRowCount>=n.maxRows)return t.truncated=!0,{stop:!0,skipped:!1};t.dataRowCount++;let s;return n.infoOption&&(s=T_(t,t.dataRowCount-1,n.rawOption,e.length)),{stop:!1,skipped:!1,row:e,info:s,extras:o}}let k_={delimiter:`,`,quote:`"`,escape:`"`,quoteEnabled:!0,relaxQuotes:!1};function A_(){return{buffer:``,position:0}}function j_(e,t){let n=e.length,r=e.indexOf(`
|
|
407
407
|
`,t),i=e.indexOf(`\r`,t);return r===-1&&i===-1?[-1,0]:i===-1||r!==-1&&r<i?[r,1]:i+1<n?e[i+1]===`
|
|
408
408
|
`?[i,2]:[i,1]:[i,-1]}function M_(e,t,n){return n.length===1?e[t]===n:e.startsWith(n,t)}function N_(e,t,n){return e.indexOf(n,t)}function P_(e,t,n,r){let{quote:i,escape:a,delimiter:o,relaxQuotes:s}=n,c=e.length,l=t+1,u=null,d=l,f=t=>{let n=t>d?e.slice(d,t):``;return u===null?n:(n&&u.push(n),u.length===1?u[0]:u.join(``))};for(;l<c;){let n=e[l];if(a&&n===a){if(l+1<c&&e[l+1]===i){l>d&&(u??=[]).push(e.slice(d,l)),(u??=[]).push(i),l+=2,d=l;continue}if(a!==i&&l+1<c&&e[l+1]===a){l>d&&(u??=[]).push(e.slice(d,l)),(u??=[]).push(a),l+=2,d=l;continue}if(a===i){if(l+1>=c)return r?{value:f(l),quoted:!0,endPos:l+1,needMore:!1}:{value:f(l),quoted:!0,endPos:l,needMore:!0,resumePos:t};let n=e[l+1];if((o.length===1?n===o:M_(e,l+1,o))||n===`
|
|
409
409
|
`||n===`\r`)return{value:f(l),quoted:!0,endPos:l+1,needMore:!1};if(s){l>d&&(u??=[]).push(e.slice(d,l)),(u??=[]).push(i),l++,d=l;continue}return{value:f(l),quoted:!0,endPos:l+1,needMore:!1}}}if(n===i&&a!==i){if(l+1>=c)return r?{value:f(l),quoted:!0,endPos:l+1,needMore:!1}:{value:f(l),quoted:!0,endPos:l,needMore:!0,resumePos:t};let n=e[l+1];if((o.length===1?n===o:M_(e,l+1,o))||n===`
|
|
@@ -447,4 +447,4 @@ endstream
|
|
|
447
447
|
`)}getRegisteredFonts(){let e=[];for(let[t,n]of this.type1Map)e.push({resourceName:n,pdfFontName:t});return e}};function Ay(e,t){let n=`<`;for(let r=0;r<e.length;r++){let i=e.codePointAt(r);i>65535&&r++;let a=t.get(i)??0;n+=a.toString(16).toUpperCase().padStart(4,`0`)}return n+=`>`,n}function jy(e,t,n){let r=0;for(let n=0;n<e.length;n++){let i=e.codePointAt(n);i>65535&&n++;let a=t.cmap.get(i)??0;r+=t.advanceWidths[a]??0}return r/t.unitsPerEm*n}let My=65536,Ny=2e6;var Py=class e{constructor(e,t=0){this.data=e,this.view=new DataView(e.buffer,e.byteOffset,e.byteLength),this.offset=t}u8(){let e=this.view.getUint8(this.offset);return this.offset+=1,e}u16(){let e=this.view.getUint16(this.offset,!1);return this.offset+=2,e}i16(){let e=this.view.getInt16(this.offset,!1);return this.offset+=2,e}u32(){let e=this.view.getUint32(this.offset,!1);return this.offset+=4,e}i32(){let e=this.view.getInt32(this.offset,!1);return this.offset+=4,e}fixed(){return this.i32()/65536}bytes(e){let t=this.data.subarray(this.offset,this.offset+e);return this.offset+=e,t}tag(){return String.fromCharCode(this.u8(),this.u8(),this.u8(),this.u8())}skip(e){this.offset+=e}at(t){return new e(this.data,t)}u16At(e){return this.view.getUint16(e,!1)}u32At(e){return this.view.getUint32(e,!1)}i16At(e){return this.view.getInt16(e,!1)}};function Fy(e){let t=new Py(e),n=t.u32();if(n!==65536&&n!==1953658213)throw n===1330926671?new Bv(`CFF-flavored OpenType (.otf) is not supported. Use a TrueType (.ttf) font.`):new Bv(`Invalid TrueType font: bad sfVersion 0x${n.toString(16)}`);let r=t.u16();t.skip(6);let i=new Map;for(let e=0;e<r;e++){let e=t.tag();t.skip(4);let n=t.u32(),r=t.u32();i.set(e,{offset:n,length:r})}for(let e of[`head`,`hhea`,`maxp`,`cmap`,`hmtx`])if(!i.has(e))throw new Bv(`Missing required table '${e}' in TrueType font`);let a=Iy(t,i.get(`head`)),o=Ly(t,i.get(`hhea`)),s=Ry(t,i.get(`maxp`)),c=i.has(`OS/2`)?zy(t,i.get(`OS/2`)):null,l=i.has(`post`)?By(t,i.get(`post`)):null,u=i.has(`name`)?Vy(t,i.get(`name`)):null,d=Hy(t,i.get(`cmap`)),f=Gy(t,i.get(`hmtx`),o.numHMetrics,s.numGlyphs),p=i.has(`loca`)&&i.has(`glyf`)?Ky(t,i.get(`loca`),s.numGlyphs,a.indexToLocFormat):new Uint32Array(s.numGlyphs+1),m=c?.sTypoAscender??o.ascent,h=c?.sTypoDescender??o.descent,g=c?.sCapHeight??Math.round(m*.7),_=0;l?.isFixedPitch&&(_|=1),a.macStyle&2&&(_|=64),_|=32;let v=c?.usWeightClass??400,y=Math.round(50+(v/65)**2),b=u?.familyName??`Unknown`;return{data:e,familyName:b,postScriptName:u?.postScriptName??b.replace(/\s+/g,``),unitsPerEm:a.unitsPerEm,ascent:m,descent:h,capHeight:g,italicAngle:l?.italicAngle??0,flags:_,bbox:[a.xMin,a.yMin,a.xMax,a.yMax],stemV:y,numGlyphs:s.numGlyphs,indexToLocFormat:a.indexToLocFormat,numHMetrics:o.numHMetrics,tables:i,cmap:d,advanceWidths:f,glyphOffsets:p}}function Iy(e,t){let n=e.at(t.offset);n.skip(4),n.skip(4),n.skip(4),n.skip(4),n.skip(2);let r=n.u16();n.skip(16);let i=n.i16(),a=n.i16(),o=n.i16(),s=n.i16(),c=n.u16();return n.skip(2),n.skip(2),{unitsPerEm:r,xMin:i,yMin:a,xMax:o,yMax:s,macStyle:c,indexToLocFormat:n.i16()}}function Ly(e,t){let n=e.at(t.offset);n.skip(4);let r=n.i16(),i=n.i16(),a=n.i16();return n.skip(2),n.skip(22),{ascent:r,descent:i,lineGap:a,numHMetrics:n.u16()}}function Ry(e,t){let n=e.at(t.offset);return n.skip(4),{numGlyphs:n.u16()}}function zy(e,t){let n=e.at(t.offset),r=n.u16();n.skip(2);let i=n.u16();n.skip(2),n.skip(2),n.skip(22),n.skip(10),n.skip(16),n.skip(4),n.skip(2),n.skip(2),n.skip(2);let a=n.i16(),o=n.i16();n.skip(2),n.skip(2),n.skip(2);let s;return r>=2?(n.skip(8),n.skip(2),s=n.i16()):s=Math.round(a*.7),{usWeightClass:i,sTypoAscender:a,sTypoDescender:o,sCapHeight:s}}function By(e,t){let n=e.at(t.offset);n.skip(4);let r=n.fixed();return n.skip(2),n.skip(2),{italicAngle:r,isFixedPitch:n.u32()!==0}}function Vy(e,t){let n=t.offset,r=e.at(n);r.skip(2);let i=r.u16(),a=n+r.u16(),o=``,s=``;for(let t=0;t<i;t++){let t=r.u16(),n=r.u16();r.skip(2);let i=r.u16(),c=r.u16(),l=r.u16();if(i!==1&&i!==6)continue;let u=e.at(a+l).bytes(c),d;if(t===3||t===0)d=qy(u);else if(t===1&&n===0)d=Jy(u);else continue;i===1&&!o&&(o=d),i===6&&!s&&(s=d)}return{familyName:o||`Unknown`,postScriptName:s||o||`Unknown`}}function Hy(e,t){let n=t.offset,r=e.at(n);r.skip(2);let i=r.u16(),a=-1,o=-1;for(let t=0;t<i;t++){let t=r.u16(),i=r.u16(),s=r.u32();if(!(t===0||t===3&&(i===1||i===10)))continue;let c=e.u16At(n+s);c===12&&o<0&&(o=n+s),c===4&&a<0&&(a=n+s)}if(o>=0)return Wy(e,o);if(a>=0)return Uy(e,a);throw new Bv(`No usable Unicode cmap subtable found in font`)}function Uy(e,t){let n=e.at(t);n.skip(2),n.skip(2),n.skip(2);let r=n.u16()/2;n.skip(6);let i=[];for(let e=0;e<r;e++)i.push(n.u16());n.skip(2);let a=[];for(let e=0;e<r;e++)a.push(n.u16());let o=[];for(let e=0;e<r;e++)o.push(n.i16());let s=n.offset,c=[];for(let e=0;e<r;e++)c.push(n.u16());let l=new Map;for(let t=0;t<r;t++){let n=a[t],r=i[t],u=o[t],d=c[t];if(n===65535)break;for(let i=n;i<=r;i++){let r;if(d===0)r=i+u&65535;else{let a=s+t*2+d+(i-n)*2;r=e.u16At(a),r!==0&&(r=r+u&65535)}r!==0&&l.set(i,r)}}return l}function Wy(e,t){let n=e.at(t);n.skip(2),n.skip(2),n.skip(4),n.skip(4);let r=n.u32();if(r>My)throw new Bv(`cmap format 12 has ${r} groups, exceeding limit of ${My}. The font file may be malicious or corrupted.`);let i=new Map,a=0;for(let e=0;e<r;e++){let e=n.u32(),t=n.u32(),r=n.u32(),o=t>=e?t-e+1:0;if(a+=o,a>Ny)throw new Bv(`cmap format 12 maps too many codepoints (>${Ny}). The font file may be malicious or corrupted.`);for(let n=e;n<=t;n++)i.set(n,r+(n-e))}return i}function Gy(e,t,n,r){let i=e.at(t.offset),a=new Uint16Array(r),o=0;for(let e=0;e<n;e++)o=i.u16(),i.skip(2),a[e]=o;for(let e=n;e<r;e++)a[e]=o;return a}function Ky(e,t,n,r){let i=e.at(t.offset),a=new Uint32Array(n+1);if(r===0)for(let e=0;e<=n;e++)a[e]=i.u16()*2;else for(let e=0;e<=n;e++)a[e]=i.u32();return a}function qy(e){let t=[];for(let n=0;n+1<e.length;n+=2){let r=e[n]<<8|e[n+1];if(r>=55296&&r<=56319&&n+3<e.length){let i=e[n+2]<<8|e[n+3];if(i>=56320&&i<=57343){t.push(String.fromCodePoint((r-55296<<10)+(i-56320)+65536)),n+=2;continue}}t.push(String.fromCharCode(r))}return t.join(``)}function Jy(e){let t=[];for(let n=0;n<e.length;n++)t.push(String.fromCharCode(e[n]));return t.join(``)}function Yy(e){if(!e||e.length<6)return null;let t,n,r,i;if(e.length>=8?(t=parseInt(e.substring(0,2),16),n=parseInt(e.substring(2,4),16),r=parseInt(e.substring(4,6),16),i=parseInt(e.substring(6,8),16)):(t=255,n=parseInt(e.substring(0,2),16),r=parseInt(e.substring(2,4),16),i=parseInt(e.substring(4,6),16)),isNaN(n)||isNaN(r)||isNaN(i))return null;let a=t/255;return{r:n/255,g:r/255,b:i/255,...a<1?{a}:{}}}function Xy(e){if(!e)return null;if(e.argb)return Yy(e.argb);if(e.theme!==void 0){let t=Zy(e.theme);if(!t)return null;let n=e.tint;return n!==void 0&&n!==0?Qy(t,n):t}return null}function Zy(e){let t=[{r:1,g:1,b:1},{r:0,g:0,b:0},{r:.918,g:.929,b:.941},{r:.267,g:.278,b:.298},{r:.263,g:.522,b:.839},{r:.922,g:.494,b:.196},{r:.624,g:.624,b:.624},{r:1,g:.753,b:0},{r:.314,g:.686,b:.886},{r:.439,g:.678,b:.278}];return e>=0&&e<t.length?t[e]:null}function Qy(e,t){let n=e=>t<0?e*(1+t):e+(1-e)*t;return{r:Math.max(0,Math.min(1,n(e.r))),g:Math.max(0,Math.min(1,n(e.g))),b:Math.max(0,Math.min(1,n(e.b)))}}let $y={black:{r:0,g:0,b:0},white:{r:1,g:1,b:1},gridLine:{r:.816,g:.816,b:.816}};function eb(e,t,n){return{fontFamily:e?.name??t,fontSize:e?.size??n,bold:e?.bold??!1,italic:e?.italic??!1,strike:e?.strike??!1,underline:!!(e?.underline&&e.underline!==`none`),textColor:Xy(e?.color)??$y.black}}function tb(e){if(!e)return null;if(e.type===`pattern`){if(e.pattern===`solid`&&e.fgColor)return Xy(e.fgColor);if(e.pattern===`none`)return null;if(e.fgColor)return Xy(e.fgColor)}return e.type===`gradient`&&e.stops&&e.stops.length>0?Xy(e.stops[0].color):null}function nb(e){switch(e){case`thin`:return .5;case`medium`:return 1;case`thick`:return 1.5;case`double`:return .5;case`hair`:return .25;case`dotted`:return .5;case`dashed`:return .5;case`dashDot`:return .5;case`dashDotDot`:return .5;case`slantDashDot`:return .5;case`mediumDashed`:return 1;case`mediumDashDot`:return 1;case`mediumDashDotDot`:return 1;default:return .5}}function rb(e){switch(e){case`dotted`:return[1,1];case`dashed`:case`mediumDashed`:return[3,2];case`dashDot`:case`mediumDashDot`:return[3,1,1,1];case`dashDotDot`:case`mediumDashDotDot`:return[3,1,1,1,1,1];case`slantDashDot`:return[4,2,1,2];case`hair`:return[.5,.5];default:return[]}}function ib(e){return!e||!e.style?null:{width:nb(e.style),color:Xy(e.color)??$y.black,dashPattern:rb(e.style)}}function ab(e){return e?{top:ib(e.top),right:ib(e.right),bottom:ib(e.bottom),left:ib(e.left)}:{top:null,right:null,bottom:null,left:null}}function ob(e){if(!e?.horizontal)return`left`;switch(e.horizontal){case`center`:case`centerContinuous`:return`center`;case`right`:return`right`;default:return`left`}}function sb(e){if(!e?.vertical)return`bottom`;switch(e.vertical){case`top`:return`top`;case`middle`:return`middle`;default:return`bottom`}}let cb=8.43;function lb(e,t,n){let{margins:r}=t,i=t.pageSize.width,a=t.pageSize.height;t.orientation===`landscape`&&([i,a]=[a,i]);let o=i-r.left-r.right,s=a-r.top-r.bottom,c=t.showSheetNames?20:0,l=t.showPageNumbers?20:0,u=s-c-l,d=pb(e),{columnWidths:f,visibleCols:p}=mb(e,d);if(p.length===0)return[ub(i,a,e.name,t)];let m=f.reduce((e,t)=>e+t,0),h=t.scale;if(t.fitToPage&&m>0){let e=o/m;e<1&&(h*=e)}let g=f.map(e=>e*h),{rowHeights:_,visibleRows:v}=hb(e,h,d),y=_b(e),b=vb(_,u,typeof t.repeatRows==`number`?t.repeatRows:0,gb(e,v)),x=yb(g,o,e,p),S=[];for(let s of b)for(let l of x){let u=[],d=l.map(e=>g[e]),f=d.reduce((e,t)=>e+t,0),m=[],b=r.left;f<o&&(b=r.left+(o-f)/2);for(let e of d)m.push(b),b+=e;let x=[],ee=[],C=a-r.top-c;for(let e of s){let t=_[e]??15*h;x.push(C),ee.push(t),C-=t}for(let r=0;r<s.length;r++){let i=s[r],a=v[i];for(let o=0;o<l.length;o++){let s=p[l[o]],c=`${a}:${s}`,f=y.get(c);if(f&&!f.isMaster)continue;let g=e.rows.get(a)?.cells.get(s),_=1,b=1;if(f&&f.isMaster){let e=s+f.colSpan-1;_=0;for(let t=o;t<l.length&&p[l[t]]<=e;t++)_++;let t=a+f.rowSpan-1;b=0;for(let e=i;e<v.length&&v[e]<=t;e++)b++;_=Math.max(_,1),b=Math.max(b,1)}let S=m[o],C=x[r],te=0;for(let e=0;e<_&&o+e<d.length;e++)te+=d[o+e];let ne=0;for(let e=0;e<b&&r+e<ee.length;e++)ne+=ee[r+e];let w=C-ne;u.push(bb(g,S,w,te,ne,_,b,t,n,h))}}S.push({pageNumber:S.length+1,options:t,cells:u,width:i,height:a,sheetName:e.name,sheetCols:l.map(e=>p[e]),columnOffsets:m,columnWidths:d,sheetRows:s.map(e=>v[e]),rowYPositions:x,rowHeights:ee,images:[]})}return S.length>0&&e.images&&xb(e.images,S),S}function ub(e,t,n,r){return{pageNumber:1,options:r,cells:[],width:e,height:t,sheetName:n,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[]}}function db(e){let t=e.replace(/\$/g,``).toUpperCase(),n=0,r=0;for(;r<t.length&&t.charCodeAt(r)>=65&&t.charCodeAt(r)<=90;)n=n*26+(t.charCodeAt(r)-64),r++;let i=parseInt(t.substring(r),10);return{c:n-1,r:i-1}}function fb(e){let t=e.indexOf(`:`);if(t===-1){let t=db(e);return{s:t,e:{...t}}}return{s:db(e.slice(0,t)),e:db(e.slice(t+1))}}function pb(e){let t=e.pageSetup?.printArea;if(!t||typeof t!=`string`)return null;let n=t.split(`&&`)[0].trim();if(!n)return null;try{let e=fb(n);return{startRow:e.s.r+1,endRow:e.e.r+1,startCol:e.s.c+1,endCol:e.e.c+1}}catch{return null}}function mb(e,t){let n=e.bounds;if(!(n.top>0&&n.left>0))return{columnWidths:[],visibleCols:[]};let r=t?.startCol??n.left,i=t?.endCol??n.right,a=[],o=[];for(let t=r;t<=i;t++){let n=e.columns.get(t);if(n?.hidden)continue;let r=n?.width??cb,i=Math.max(r*7,5);a.push(i),o.push(t)}return{columnWidths:a,visibleCols:o}}function hb(e,t,n){let r=e.bounds;if(r.top<=0)return{rowHeights:[],visibleRows:[]};let i=n?.startRow??r.top,a=n?.endRow??r.bottom,o=[],s=[];for(let n=i;n<=a;n++){let r=e.rows.get(n);if(r&&r.hidden)continue;let i;if(r?.height)i=r.height;else if(i=15,r)for(let n of r.cells.values()){let r=n.style?.font?.size??11,a=n.value;if(a?.richText)for(let e of a.richText){let t=e.font?.size??r;t>r&&(r=t)}let o=r*1.5,s=n.text??``,c=Math.max(1,(s.match(/\n/g)??[]).length+1),l=c;if(n.style?.alignment?.wrapText&&c===1&&s.length>0){let i=(e.columns.get(n.col)?.width??cb)*7*t,a=r*.55,o=Math.max(1,Math.floor(i/a));l=Math.ceil(s.length/o)}let u=o*l;u>i&&(i=u)}o.push(i*t),s.push(n)}return{rowHeights:o,visibleRows:s}}function gb(e,t){let n=new Set,r=e.rowBreaks??[];if(r.length===0)return n;let i=new Map;for(let e=0;e<t.length;e++)i.set(t[e],e);for(let e of r){let t=i.get(e);t!==void 0&&n.add(t+1)}return n}function _b(e){let t=new Map,n=e.merges;if(!n||n.length===0)return t;for(let e of n){let n=fb(e),r=n.s.r+1,i=n.s.c+1,a=n.e.r+1,o=n.e.c+1,s=a-r+1,c=o-i+1;for(let e=r;e<=a;e++)for(let n=i;n<=o;n++)t.set(`${e}:${n}`,{isMaster:e===r&&n===i,rowSpan:s,colSpan:c})}return t}function vb(e,t,n,r){if(e.length===0)return[[]];let i=[],a=[],o=0,s=!0,c=0,l=()=>{c=0;for(let r=0;r<n&&r<e.length&&!(o+e[r]>t&&a.length>0);r++)a.push(r),o+=e[r],c++};for(let u=0;u<e.length;u++){let d=e[u],f=t;for(;;){let e=r.has(u)&&a.length>0;if((e||o+d>f)&&a.length>0){if(!e&&!s&&a.length>0&&a.length===c){a=[],o=0,c=0;continue}i.push(a),a=[],o=0,c=0,s=!1,l();continue}if(!s&&u<n&&a.includes(u))break;a.push(u),o+=d;break}}return a.length>0&&i.push(a),i.length>0?i:[[]]}function yb(e,t,n,r){if(e.length===0)return[[]];let i=new Set,a=n.colBreaks??[];if(a.length>0){let e=new Map;for(let t=0;t<r.length;t++)e.set(r[t],t);for(let t of a){let n=e.get(t);n!==void 0&&i.add(n+1)}}let o=[],s=[],c=0;for(let n=0;n<e.length;n++){let r=e[n];(i.has(n)&&s.length>0||c+r>t+.01)&&s.length>0&&(o.push(s),s=[],c=0),s.push(n),c+=r}return s.length>0&&o.push(s),o.length>0?o:[Array.from({length:e.length},(e,t)=>t)]}function bb(e,t,n,r,i,a,o,s,c,l){let u=e?.text??``,d=e?.style??{},f=eb(d.font,s.defaultFontFamily,s.defaultFontSize),p=f.fontSize*l;if(c.hasEmbeddedFont())c.trackText(u);else{let e=Oy(f.fontFamily,f.bold,f.italic);c.ensureFont(e)}let m=Sb(e,s,c,l);return{text:u,rect:{x:t,y:n,width:r,height:i},fontFamily:f.fontFamily,fontSize:p,bold:f.bold,italic:f.italic,strike:f.strike,underline:f.underline,textColor:f.textColor,fillColor:tb(d.fill),horizontalAlign:ob(d.alignment),verticalAlign:sb(d.alignment),wrapText:d.alignment?.wrapText??!1,borders:ab(d.border),colSpan:a,rowSpan:o,hyperlink:e?.hyperlink??null,richText:m,indent:d.alignment?.indent??0,textRotation:d.alignment?.textRotation??0}}function xb(e,t){for(let n of e){let e=n.range.tl,r=(e.nativeCol??e.col??0)+1,i=(e.nativeRow??e.row??0)+1,a=t.find(e=>e.sheetCols.includes(r)&&e.sheetRows.includes(i));if(!a)continue;let o=a.sheetCols.indexOf(r),s=a.sheetRows.indexOf(i),c=a.columnOffsets[o]??a.options.margins.left,l=a.rowYPositions[s]??a.height-a.options.margins.top-(a.options.showSheetNames?20:0),u=(e.nativeColOff??0)/12700||0,d=(e.nativeRowOff??0)/12700||0,f=c+u,p=l-d,m=100,h=100;if(n.range.ext)m=(n.range.ext.width??100)*.75,h=(n.range.ext.height??100)*.75;else if(n.range.br){let e=n.range.br,t=(e.nativeCol??e.col??0)+1,r=(e.nativeRow??e.row??0)+1,i=a.sheetCols.indexOf(t),c=a.sheetRows.indexOf(r),l=i>=0?a.columnOffsets[i]:f+(a.columnWidths[o]??100),u=c>=0?a.rowYPositions[c]:p-(a.rowHeights[s]??100),d=(e.nativeColOff??0)/12700||0,g=(e.nativeRowOff??0)/12700||0,_=l+d,v=u-g;m=_-f,h=p-v}a.images.push({data:n.data,format:n.format,rect:{x:f,y:p-h,width:Math.abs(m),height:Math.abs(h)}})}}function Sb(e,t,n,r){if(!e||e.type!==X.RichText)return null;let i=e.value;return!i?.richText||i.richText.length===0?null:i.richText.map(e=>{let i=eb(e.font,t.defaultFontFamily,t.defaultFontSize);if(n.hasEmbeddedFont())n.trackText(e.text);else{let e=Oy(i.fontFamily,i.bold,i.italic);n.ensureFont(e)}return{text:e.text,fontFamily:i.fontFamily,fontSize:i.fontSize*r,bold:i.bold,italic:i.italic,strike:i.strike,underline:i.underline,textColor:i.textColor}})}var Cb=class{constructor(){this.parts=[]}save(){return this.parts.push(`q`),this}restore(){return this.parts.push(`Q`),this}setGraphicsState(e){return this.parts.push(`/${e} gs`),this}setStrokeColor(e){return this.parts.push(`${Z(e.r)} ${Z(e.g)} ${Z(e.b)} RG`),this}setFillColor(e){return this.parts.push(`${Z(e.r)} ${Z(e.g)} ${Z(e.b)} rg`),this}setLineWidth(e){return this.parts.push(`${Z(e)} w`),this}setDashPattern(e,t=0){let n=e.map(Z).join(` `);return this.parts.push(`[${n}] ${Z(t)} d`),this}setLineCap(e){return this.parts.push(`${e} J`),this}setLineJoin(e){return this.parts.push(`${e} j`),this}moveTo(e,t){return this.parts.push(`${Z(e)} ${Z(t)} m`),this}lineTo(e,t){return this.parts.push(`${Z(e)} ${Z(t)} l`),this}rect(e,t,n,r){return this.parts.push(`${Z(e)} ${Z(t)} ${Z(n)} ${Z(r)} re`),this}stroke(){return this.parts.push(`S`),this}fill(){return this.parts.push(`f`),this}fillAndStroke(){return this.parts.push(`B`),this}closePath(){return this.parts.push(`h`),this}endPath(){return this.parts.push(`n`),this}clip(){return this.parts.push(`W`),this}beginText(){return this.parts.push(`BT`),this}endText(){return this.parts.push(`ET`),this}setFont(e,t){return this.parts.push(`/${e} ${Z(t)} Tf`),this}setTextMatrix(e,t,n,r,i,a){return this.parts.push(`${Z(e)} ${Z(t)} ${Z(n)} ${Z(r)} ${Z(i)} ${Z(a)} Tm`),this}moveText(e,t){return this.parts.push(`${Z(e)} ${Z(t)} Td`),this}setTextLeading(e){return this.parts.push(`${Z(e)} TL`),this}showText(e){return Tb(e)?this.showTextWinAnsi(e):(this.parts.push(`(${wb(e)}) Tj`),this)}showTextWinAnsi(e){let t=`<`;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);r>65535&&n++;let i=Db(r);t+=i.toString(16).padStart(2,`0`)}return t+=`>`,this.parts.push(`${t} Tj`),this}showTextHex(e){return this.parts.push(`${e} Tj`),this}nextLineShowText(e){if(Tb(e)){let t=`<`;for(let n=0;n<e.length;n++){let r=e.codePointAt(n);r>65535&&n++;let i=Db(r);t+=i.toString(16).padStart(2,`0`)}return t+=`>`,this.parts.push(`${t} '`),this}return this.parts.push(`(${wb(e)}) '`),this}setTextRise(e){return this.parts.push(`${Z(e)} Ts`),this}setCharacterSpacing(e){return this.parts.push(`${Z(e)} Tc`),this}setWordSpacing(e){return this.parts.push(`${Z(e)} Tw`),this}drawImage(e,t,n,r,i){return this.save().concat(r,0,0,i,t,n).doXObject(e).restore()}concat(e,t,n,r,i,a){return this.parts.push(`${Z(e)} ${Z(t)} ${Z(n)} ${Z(r)} ${Z(i)} ${Z(a)} cm`),this}doXObject(e){return this.parts.push(`/${e} Do`),this}fillRect(e,t,n,r,i){return this.save().setFillColor(i).rect(e,t,n,r).fill().restore()}drawLine(e,t,n,r,i,a,o=[]){return this.save().setStrokeColor(i).setLineWidth(a),o.length>0&&this.setDashPattern(o),this.moveTo(e,t).lineTo(n,r).stroke().restore()}toString(){return this.parts.join(`
|
|
448
448
|
`)}toUint8Array(){return new TextEncoder().encode(this.toString())}};function wb(e){return e.replace(/\\/g,`\\\\`).replace(/\(/g,`\\(`).replace(/\)/g,`\\)`).replace(/\r\n/g,`\\n`).replace(/\r/g,`\\n`).replace(/\n/g,`\\n`)}function Tb(e){for(let t=0;t<e.length;t++)if(e.charCodeAt(t)>127)return!0;return!1}let Eb=new Map([[8364,128],[8218,130],[402,131],[8222,132],[8230,133],[8224,134],[8225,135],[710,136],[8240,137],[352,138],[8249,139],[338,140],[381,142],[8216,145],[8217,146],[8220,147],[8221,148],[8226,149],[8211,150],[8212,151],[732,152],[8482,153],[353,154],[8250,155],[339,156],[382,158],[376,159]]);function Db(e){if(e<128||e>=160&&e<=255)return e;let t=Eb.get(e);return t===void 0?63:t}function Ob(e,t,n,r){let i=new Cb,a=new Set;t.showGridLines&&kb(i,e,t);for(let t of e.cells)t.fillColor&&Ab(i,t,a);for(let t of e.cells)jb(i,t);for(let t of e.cells)t.text&&Nb(i,t,n,a);return t.showSheetNames&&Ub(i,e,t,n),t.showPageNumbers&&Wb(i,e,t,n,r),{stream:i,alphaValues:a}}function kb(e,t,n){if(t.columnWidths.length===0||t.rowHeights.length===0)return;let r=n.gridLineColor;e.save(),e.setStrokeColor(r),e.setLineWidth(.25);let i=t.rowYPositions[0],a=t.rowYPositions.length-1,o=t.rowYPositions[a]-t.rowHeights[a];for(let n=0;n<=t.columnWidths.length;n++){let r=n<t.columnWidths.length?t.columnOffsets[n]:t.columnOffsets[n-1]+t.columnWidths[n-1];e.moveTo(r,i),e.lineTo(r,o)}let s=t.columnOffsets[0],c=t.columnOffsets.length-1,l=t.columnOffsets[c]+t.columnWidths[c];for(let n=0;n<=t.rowYPositions.length;n++){let r=n<t.rowYPositions.length?t.rowYPositions[n]:t.rowYPositions[n-1]-t.rowHeights[n-1];e.moveTo(s,r),e.lineTo(l,r)}e.stroke(),e.restore()}function Ab(e,t,n){if(!t.fillColor)return;let r=t.fillColor.a;if(r!==void 0&&r<1){let i=Lb(r);n.add(r),e.save(),e.setGraphicsState(i),e.fillRect(t.rect.x,t.rect.y,t.rect.width,t.rect.height,t.fillColor),e.restore()}else e.fillRect(t.rect.x,t.rect.y,t.rect.width,t.rect.height,t.fillColor)}function jb(e,t){let{rect:n,borders:r}=t,{x:i,y:a,width:o,height:s}=n;r.top&&Mb(e,r.top,i,a+s,i+o,a+s),r.bottom&&Mb(e,r.bottom,i,a,i+o,a),r.left&&Mb(e,r.left,i,a,i,a+s),r.right&&Mb(e,r.right,i+o,a,i+o,a+s)}function Mb(e,t,n,r,i,a){e.drawLine(n,r,i,a,t.color,t.width,t.dashPattern)}function Nb(e,t,n,r){let{rect:i,text:a,fontSize:o,horizontalAlign:s,verticalAlign:c,wrapText:l}=t;if(!a&&!t.richText)return;let u=i.width-6,d=i.height-4;if(u<=0||d<=0)return;let f=t.indent*Rb;e.save(),e.rect(i.x,i.y,i.width,i.height),e.clip(),e.endPath();let p=t.textColor.a;if(p!==void 0&&p<1&&(r.add(p),e.setGraphicsState(Lb(p))),t.textRotation===`vertical`){Ib(e,t,n,f),e.restore();return}if(typeof t.textRotation==`number`&&t.textRotation!==0){Fb(e,t,n,f),e.restore();return}if(t.richText&&t.richText.length>0){Pb(e,t,n,f),e.restore();return}let m=n.hasEmbeddedFont()?n.getEmbeddedResourceName():n.ensureFont(Oy(t.fontFamily,t.bold,t.italic)),h=e=>n.measureText(e,m,o),g=u-f-1,_=l?Hb(a,h,g):[a],v=o*1.2,y=n.getFontAscent(m,o),b=zb(c,i,_.length*v,y);e.setFillColor(t.textColor),e.beginText(),e.setFont(m,o);for(let t=0;t<_.length;t++){let r=_[t],a=b-t*v,o=Bb(s,i,h(r),f);e.setTextMatrix(1,0,0,1,o,a);let c=n.encodeText(r,m);c?e.showTextHex(c):e.showText(r)}e.endText(),Vb(e,t,_,v,b,h,m,n,f),e.restore()}function Pb(e,t,n,r){let{rect:i,horizontalAlign:a,verticalAlign:o,wrapText:s}=t,c=t.richText,l=t.fontSize;for(let e of c)e.fontSize>l&&(l=e.fontSize);let u=l,d=u*1.2,f=n.hasEmbeddedFont(),p=e=>f?n.getEmbeddedResourceName():n.ensureFont(Oy(e.fontFamily,e.bold,e.italic));if(s){let t=i.width-6-r-1;if(t<=0)return;let s=c.map(e=>e.text).join(``),l=p(c[0]),f=Hb(s,e=>n.measureText(e,l,u),t),m=[];for(let e=0;e<c.length;e++)for(let t=0;t<c[e].text.length;t++)m.push(e);let h=p(c[0]),g=n.getFontAscent(h,u),_=zb(o,i,f.length*d,g),v=0;for(let t=0;t<f.length;t++){let o=_-t*d,l=f[t].length,u=[],h=v;for(let e=0;e<l;e++){let n=m[v+e]??m.length-1,r=u[u.length-1];r&&r.run===c[n]?r.text+=f[t][e]:u.push({run:c[n],text:f[t][e],resourceName:p(c[n])})}for(v+=l;v<m.length&&v<h+l+1;){let e=t+1<f.length?s.indexOf(f[t+1],v):s.length;if(e>v){v=e;break}break}let g=0;for(let e of u)g+=n.measureText(e.text,e.resourceName,e.run.fontSize);let y=Bb(a,i,g,r);for(let t of u){let{run:r,text:i,resourceName:a}=t,s=n.measureText(i,a,r.fontSize);e.setFillColor(r.textColor),e.beginText(),e.setFont(a,r.fontSize),e.setTextMatrix(1,0,0,1,y,o);let c=n.encodeText(i,a);if(c?e.showTextHex(c):e.showText(i),e.endText(),r.strike){let t=o+n.getFontDescent(a,r.fontSize)+r.fontSize*.3;e.drawLine(y,t,y+s,t,r.textColor,.5)}if(r.underline){let t=o+n.getFontDescent(a,r.fontSize)*.5;e.drawLine(y,t,y+s,t,r.textColor,.5)}y+=s}}return}let m=0,h=[];for(let e of c){let t=p(e),r=n.measureText(e.text,t,e.fontSize);h.push({resourceName:t,width:r}),m+=r}let g=h[0]?.resourceName??`F1`,_=zb(o,i,d,n.getFontAscent(g,u)),v=Bb(a,i,m,r);for(let t=0;t<c.length;t++){let r=c[t],{resourceName:i}=h[t];e.setFillColor(r.textColor),e.beginText(),e.setFont(i,r.fontSize),e.setTextMatrix(1,0,0,1,v,_);let a=n.encodeText(r.text,i);a?e.showTextHex(a):e.showText(r.text),e.endText();let o=h[t].width;if(r.strike){let t=_+n.getFontDescent(i,r.fontSize)+r.fontSize*.3;e.drawLine(v,t,v+o,t,r.textColor,.5)}if(r.underline){let t=_+n.getFontDescent(i,r.fontSize)*.5;e.drawLine(v,t,v+o,t,r.textColor,.5)}v+=h[t].width}}function Fb(e,t,n,r){let{rect:i,text:a}=t,{fontSize:o}=t,s=n.hasEmbeddedFont()?n.getEmbeddedResourceName():n.ensureFont(Oy(t.fontFamily,t.bold,t.italic)),c;c=typeof t.textRotation==`number`?t.textRotation<=90?t.textRotation:-(t.textRotation-90):0;let l=c*Math.PI/180,u=Math.cos(l),d=Math.sin(l),f=n.measureText(a,s,o),p=Math.abs(d),m=Math.abs(u),h=f*m+o*p,g=f*p+o*m,_=i.width-6,v=i.height-4;if(_>0&&v>0&&(h>_||g>v)){let e=Math.min(_/h,v/g);e<1&&(o*=e)}let y=t.horizontalAlign===`left`?r/2:t.horizontalAlign===`right`?-r/2:0,b=i.x+i.width/2+y,x=i.y+i.height/2,S=n.measureText(a,s,o),ee=n.getFontAscent(s,o),C=-S/2,te=-ee/2,ne=b+C*u-te*d,w=x+C*d+te*u;e.setFillColor(t.textColor),e.beginText(),e.setFont(s,o),e.setTextMatrix(u,d,-d,u,ne,w);let T=n.encodeText(a,s);T?e.showTextHex(T):e.showText(a),e.endText()}function Ib(e,t,n,r){let{rect:i,text:a,fontSize:o}=t,s=n.hasEmbeddedFont()?n.getEmbeddedResourceName():n.ensureFont(Oy(t.fontFamily,t.bold,t.italic)),c=o*1.3,l=n.getFontAscent(s,o),u=i.x+i.width/2,d=i.y+i.height-2-l;e.setFillColor(t.textColor);for(let t=0;t<a.length&&!(d<i.y+2);t++){let r=a[t],i=n.measureText(r,s,o);e.beginText(),e.setFont(s,o),e.setTextMatrix(1,0,0,1,u-i/2,d);let l=n.encodeText(r,s);l?e.showTextHex(l):e.showText(r),e.endText(),d-=c}}function Lb(e){return`GS${Math.round(e*1e4)}`}let Rb=10;function zb(e,t,n,r){let i;switch(e){case`top`:i=t.y+t.height-2-r;break;case`middle`:i=t.y+t.height/2+n/2-r;break;default:i=t.y+2+(n-r);break}let a=t.y+t.height-2-r;i>a&&(i=a);let o=t.y+2;return i<o&&(i=o),i}function Bb(e,t,n,r=0){let i;switch(e){case`center`:i=t.x+(t.width-n)/2;break;case`right`:i=t.x+t.width-3-n;break;default:i=t.x+3+r;break}let a=t.x+3;return i<a&&(i=a),i}function Vb(e,t,n,r,i,a,o,s,c){if(t.strike){let l=i+s.getFontDescent(o,t.fontSize)+t.fontSize*.3;for(let i=0;i<n.length;i++){let o=l-i*r,s=a(n[i]),u=Bb(t.horizontalAlign,t.rect,s,c);e.drawLine(u,o,u+s,o,t.textColor,.5)}}if(t.underline){let l=s.getFontDescent(o,t.fontSize)*.5;for(let o=0;o<n.length;o++){let s=i-o*r+l,u=a(n[o]),d=Bb(t.horizontalAlign,t.rect,u,c);e.drawLine(d,s,d+u,s,t.textColor,.5)}}}function Hb(e,t,n){if(!e)return[``];let r=e.split(/\r?\n/),i=[];for(let e of r){if(!e){i.push(``);continue}let r=e.split(/\s+/),a=``;for(let e of r){if(!a){a=e;continue}let r=a+` `+e;t(r)<=n?a=r:(i.push(a),a=e)}a&&i.push(a)}return i.length>0?i:[``]}function Ub(e,t,n,r){let i=t.sheetName,a=r.hasEmbeddedFont()?r.getEmbeddedResourceName():r.ensureFont(Oy(n.defaultFontFamily,!0,!1)),o=r.measureText(i,a,10),s=(t.width-o)/2,c=t.height-n.margins.top+5;e.save(),e.setFillColor({r:.3,g:.3,b:.3}),e.beginText(),e.setFont(a,10),e.setTextMatrix(1,0,0,1,s,c);let l=r.encodeText(i,a);l?e.showTextHex(l):e.showText(i),e.endText(),e.restore()}function Wb(e,t,n,r,i){let a=`Page ${t.pageNumber} of ${i}`,o=r.ensureFont(Oy(n.defaultFontFamily,!1,!1)),s=r.measureText(a,o,9),c=(t.width-s)/2,l=Math.max(5,n.margins.bottom-15);e.save(),e.setFillColor({r:.5,g:.5,b:.5}),e.beginText(),e.setFont(o,9),e.setTextMatrix(1,0,0,1,c,l),e.showText(a),e.endText(),e.restore()}let Gb=1e8;function Kb(e){if(e.length<8||e[0]!==137||e[1]!==80||e[2]!==78||e[3]!==71)throw Error(`Invalid PNG signature`);let t=8,n=0,r=0,i=0,a=0,o=[],s=null,c=null;for(;t+8<=e.length;){let l=new DataView(e.buffer,e.byteOffset,e.byteLength).getUint32(t,!1),u=String.fromCharCode(e[t+4],e[t+5],e[t+6],e[t+7]),d=e.subarray(t+8,t+8+l);switch(t+=8+l+4,u){case`IHDR`:{let e=new DataView(d.buffer,d.byteOffset,d.byteLength);if(n=e.getUint32(0,!1),r=e.getUint32(4,!1),i=d[8],a=d[9],d[12]!==0)throw Error(`Interlaced PNG is not supported`);if(i!==8)throw Error(`Unsupported PNG bit depth: ${i}. Only 8-bit PNGs are supported.`);if(n===0||r===0)throw Error(`Invalid PNG dimensions: ${n}x${r}`);let t=n*r;if(t>Gb)throw Error(`PNG dimensions too large: ${n}x${r} (${t} pixels). Maximum allowed: ${Gb} pixels.`);break}case`PLTE`:s=new Uint8Array(d);break;case`tRNS`:c=new Uint8Array(d);break;case`IDAT`:o.push(d);break;case`IEND`:break}}if(n===0||r===0)throw Error(`PNG missing IHDR chunk`);let l=j(o),u;u=l.length>6&&(l[0]&15)==8?l.subarray(2,l.length-4):l;let d=gd(u),f=Yb(a),p=Math.max(1,f*i/8),m=Math.ceil(n*f*i/8);return Xb(qb(d,n,r,m,p),n,r,a,i,s,c)}function qb(e,t,n,r,i){let a=new Uint8Array(n*r),o=Math.max(1,Math.floor(i)),s=0;for(let t=0;t<n;t++){let n=e[s++],i=t*r,c=t>0?(t-1)*r:-1;for(let t=0;t<r;t++){let r=e[s++]??0,l=t>=o?a[i+t-o]:0,u=c>=0?a[c+t]:0,d=c>=0&&t>=o?a[c+t-o]:0;switch(n){case 0:a[i+t]=r;break;case 1:a[i+t]=r+l&255;break;case 2:a[i+t]=r+u&255;break;case 3:a[i+t]=r+Math.floor((l+u)/2)&255;break;case 4:a[i+t]=r+Jb(l,u,d)&255;break;default:a[i+t]=r}}}return a}function Jb(e,t,n){let r=e+t-n,i=Math.abs(r-e),a=Math.abs(r-t),o=Math.abs(r-n);return i<=a&&i<=o?e:a<=o?t:n}function Yb(e){switch(e){case 0:return 1;case 2:return 3;case 3:return 1;case 4:return 2;case 6:return 4;default:return 3}}function Xb(e,t,n,r,i,a,o){let s=t*n,c=new Uint8Array(s*3),l=null;switch(r){case 2:if(c.set(e.subarray(0,s*3)),o&&o.length>=6){let t=o[1],n=o[3],r=o[5];l=new Uint8Array(s),l.fill(255);for(let i=0;i<s;i++)e[i*3]===t&&e[i*3+1]===n&&e[i*3+2]===r&&(l[i]=0)}break;case 6:l=new Uint8Array(s);for(let t=0;t<s;t++)c[t*3]=e[t*4],c[t*3+1]=e[t*4+1],c[t*3+2]=e[t*4+2],l[t]=e[t*4+3];break;case 0:{let t=-1;o&&o.length>=2&&(t=o[1]),t>=0&&(l=new Uint8Array(s),l.fill(255));for(let n=0;n<s;n++){let r=e[n];c[n*3]=r,c[n*3+1]=r,c[n*3+2]=r,l&&r===t&&(l[n]=0)}break}case 4:l=new Uint8Array(s);for(let t=0;t<s;t++){let n=e[t*2];c[t*3]=n,c[t*3+1]=n,c[t*3+2]=n,l[t]=e[t*2+1]}break;case 3:if(!a)throw Error(`PNG palette color type (3) but missing PLTE chunk`);o&&o.length>0&&(l=new Uint8Array(s));for(let t=0;t<s;t++){let n=e[t];c[t*3]=a[n*3]??0,c[t*3+1]=a[n*3+1]??0,c[t*3+2]=a[n*3+2]??0,l&&(l[t]=n<o.length?o[n]:255)}break;default:throw Error(`Unsupported PNG color type: ${r}`)}if(l){let e=!0;for(let t=0;t<l.length;t++)if(l[t]!==255){e=!1;break}e&&(l=null)}return{width:t,height:n,pixels:c,alpha:l,bitsPerComponent:8}}function Zb(e,t){let n=Qb(e,t?.sheets);if(n.length===0)throw new Rv(`No sheets to export. The workbook is empty or no sheets matched.`);let r=new ky,i=new ry;if(t?.font)try{let e=Fy(t.font);r.registerEmbeddedFont(e)}catch(e){throw new zv(`Failed to parse TrueType font`,{cause:e})}let a=[];for(let e of n)try{let n=lb(e,$b(t,e),r);a.push(...n)}catch(t){throw new zv(`Failed to layout sheet "${e.name}"`,{cause:t})}let o=$b(t,n[0]);a.length===0&&a.push({pageNumber:1,options:o,cells:[],width:o.pageSize.width,height:o.pageSize.height,sheetName:n[0]?.name??`Sheet1`,sheetCols:[],columnOffsets:[],columnWidths:[],sheetRows:[],rowYPositions:[],rowHeights:[],images:[]});for(let e=0;e<a.length;e++)a[e].pageNumber=e+1;let s=a.length;if(r.hasEmbeddedFont())for(let e of a)e.options.showSheetNames&&r.trackText(e.sheetName);for(let e of a)e.options.showPageNumbers&&r.ensureFont(Oy(e.options.defaultFontFamily,!1,!1));if(!r.hasEmbeddedFont())for(let e of a)e.options.showSheetNames&&r.ensureFont(Oy(e.options.defaultFontFamily,!0,!1));let c=r.writeFontResources(i),l=[],u=i.allocObject(),d=new Map;for(let e of a)try{let{stream:t,alphaValues:n}=Ob(e,e.options,r,s),a=new Map;if(e.images.length>0)for(let n=0;n<e.images.length;n++){let r=e.images[n],o=`Im${n+1}`,s=ix(i,r.data,r.format);a.set(o,s),t.drawImage(o,r.rect.x,r.rect.y,r.rect.width,r.rect.height)}let o=i.allocObject(),f=new $;i.addStreamObject(o,f,t);let p=i.allocObject(),m=r.buildFontDictString(c),h=new $().set(`Font`,m);if(a.size>0){let e=[`<<`];for(let[t,n]of a)e.push(`/${t} ${Q(n)}`);e.push(`>>`),h.set(`XObject`,e.join(`
|
|
449
449
|
`))}if(n.size>0){let e=[`<<`];for(let t of n){let n=i.allocObject(),r=new $().set(`Type`,`/ExtGState`).set(`ca`,Z(t)).set(`CA`,Z(t));i.addObject(n,r),e.push(`/${Lb(t)} ${Q(n)}`)}e.push(`>>`),h.set(`ExtGState`,e.join(`
|
|
450
|
-
`))}i.addObject(p,h);let g=[];for(let t of e.cells)if(t.hyperlink){let e=i.allocObject(),n=`[${Z(t.rect.x)} ${Z(t.rect.y)} ${Z(t.rect.x+t.rect.width)} ${Z(t.rect.y+t.rect.height)}]`,r=new $().set(`Type`,`/Annot`).set(`Subtype`,`/Link`).set(`Rect`,n).set(`Border`,`[0 0 0]`).set(`A`,`<< /Type /Action /S /URI /URI (${t.hyperlink.replace(/[()\\]/g,`\\$&`)}) >>`);i.addObject(e,r),g.push(e)}let _=i.addPage({parentRef:u,width:e.width,height:e.height,contentsRef:o,resourcesRef:p,annotRefs:g.length>0?g:void 0});l.push(_),d.has(e.sheetName)||d.set(e.sheetName,l.length-1)}catch(t){throw new zv(`Failed to render page ${e.pageNumber} of "${e.sheetName}"`,{cause:t})}let f=`[`+l.map(e=>Q(e)).join(` `)+`]`,p=new $().set(`Type`,`/Pages`).set(`Kids`,f).set(`Count`,String(l.length));i.addObject(u,p);let m;if(d.size>1&&(m=rx(i,d,l)),i.addCatalog(u,m),i.addInfoDict({title:o.title||e.title||void 0,author:o.author||e.creator||void 0,subject:o.subject||e.subject||void 0,creator:o.creator}),t?.encryption){let e=Wv(t.encryption);i.setEncryption(e)}return i.build()}function Qb(e,t){let n=e.sheets;if(!t||t.length===0)return n.filter(e=>e.state!==`hidden`&&e.state!==`veryHidden`);let r=[];for(let e of t)if(typeof e==`string`){let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());t&&r.push(t)}else if(typeof e==`number`){let t=n[e-1];t&&r.push(t)}return r}function $b(e,t){let n=t?.pageSetup,r=tx(e?.pageSize,n?.paperSize),i=e?.orientation??(n?.orientation===`landscape`?`landscape`:`portrait`),a=nx(e?.margins,n?.margins),o=Yy(e?.gridLineColor??`FFD0D0D0`)??{r:.816,g:.816,b:.816},s=e?.repeatRows??!1;if(s===!1&&n?.printTitlesRow){let e=n.printTitlesRow.match(/^(\d+)(?::(\d+))?$/);e&&(s=parseInt(e[2]??e[1],10))}return{pageSize:r,orientation:i,margins:a,fitToPage:e?.fitToPage===void 0?!0:e.fitToPage,scale:Math.max(.1,Math.min(3,e?.scale??(n?.scale?n.scale/100:1))),showGridLines:e?.showGridLines??n?.showGridLines??!1,gridLineColor:o,repeatRows:s,defaultFontFamily:e?.defaultFontFamily??`Helvetica`,defaultFontSize:e?.defaultFontSize??11,showSheetNames:e?.showSheetNames??!1,showPageNumbers:e?.showPageNumbers??!1,title:e?.title??``,author:e?.author??``,subject:e?.subject??``,creator:e?.creator??`excelts`}}let ex={1:Av.LETTER,5:Av.LEGAL,9:Av.A4,8:Av.A3,11:Av.A5,17:Av.TABLOID};function tx(e,t){return e?typeof e==`string`?Av[e]??Av.A4:e:t===void 0?Av.A4:ex[t]??Av.A4}function nx(e,t){let n=t?{top:t.top*72,right:t.right*72,bottom:t.bottom*72,left:t.left*72}:{top:72,right:72,bottom:72,left:72};return e?{top:e.top??n.top,right:e.right??n.right,bottom:e.bottom??n.bottom,left:e.left??n.left}:n}function rx(e,t,n){let r=e.allocObject(),i=Array.from(t.entries()),a=[];for(let t=0;t<i.length;t++)a.push(e.allocObject());for(let t=0;t<i.length;t++){let[o,s]=i[t],c=n[s],l=new $().set(`Title`,jv(o)).set(`Parent`,Q(r)).set(`Dest`,`[${Q(c)} /Fit]`);t>0&&l.set(`Prev`,Q(a[t-1])),t<i.length-1&&l.set(`Next`,Q(a[t+1])),e.addObject(a[t],l)}let o=new $().set(`Type`,`/Outlines`).set(`First`,Q(a[0])).set(`Last`,Q(a[a.length-1])).set(`Count`,String(i.length));return e.addObject(r,o),r}function ix(e,t,n){return n===`png`?ox(e,t):ax(e,t)}function ax(e,t){let n=e.allocObject(),r=sx(t),i=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(r.width)).set(`Height`,Z(r.height)).set(`ColorSpace`,`/DeviceRGB`).set(`BitsPerComponent`,`8`).set(`Filter`,`/DCTDecode`);return e.addStreamObject(n,i,t),n}function ox(e,t){let n=Kb(t),r=e.allocObject(),i=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(n.width)).set(`Height`,Z(n.height)).set(`ColorSpace`,`/DeviceRGB`).set(`BitsPerComponent`,Z(n.bitsPerComponent));if(n.alpha){let t=e.allocObject(),r=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(n.width)).set(`Height`,Z(n.height)).set(`ColorSpace`,`/DeviceGray`).set(`BitsPerComponent`,`8`);e.addStreamObject(t,r,n.alpha),i.set(`SMask`,Q(t))}return e.addStreamObject(r,i,n.pixels),r}function sx(e){let t=2;for(;t<e.length-1;){for(;t<e.length&&e[t]===255&&e[t+1]===255;)t++;if(t>=e.length-1||e[t]!==255)break;let n=e[t+1];if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204){if(t+8<e.length){let n=e[t+5]<<8|e[t+6];return{width:e[t+7]<<8|e[t+8],height:n}}break}if(t+3>=e.length)break;let r=e[t+2]<<8|e[t+3];t+=2+r}return{width:1,height:1}}function cx(e,t){return Zb(lx(e),t)}function lx(e){return Array.isArray(e)?{sheets:[ux({data:e})]}:`sheets`in e?{title:e.title,creator:e.author,sheets:e.sheets.map((e,t)=>ux(e,t))}:{sheets:[ux(e)]}}function ux(e,t){let n=e.data,r=e.name??`Sheet${(t??0)+1}`,i=e.columns?.map(e=>typeof e==`number`?void 0:e.header),a=i?.some(e=>e!==void 0)??!1,o=0;for(let e of n)e.length>o&&(o=e.length);let s=Math.max(o,e.columns?.length??0),c=n.length+(a?1:0);if(e.images)for(let t of e.images){let e=t.col+1,n=t.row+1;e>s&&(s=e),n>c&&(c=n)}if(s===0)return{name:r,bounds:{top:0,left:0,bottom:0,right:0},columns:new Map,rows:new Map};let l=new Map;if(e.columns)for(let t=0;t<e.columns.length;t++){let n=e.columns[t],r=typeof n==`number`?n:n.width;l.set(t+1,{width:r??12})}for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});let u=new Map,d=1;if(a&&i){let e=new Map;for(let t=0;t<i.length;t++){let n=i[t];n!==void 0&&e.set(t+1,{type:X.String,value:n,text:n,col:t+1,style:{font:{bold:!0}}})}u.set(1,{cells:e}),d=2}for(let e=0;e<n.length;e++){let t=e+d,r=n[e],i=new Map;for(let e=0;e<r.length;e++){let t=dx(r[e],e+1);t&&i.set(e+1,t)}u.set(t,{cells:i})}let f;if(e.images&&e.images.length>0){f=e.images.map(e=>({data:e.data,format:e.format,range:{tl:{col:e.col,row:e.row},ext:{width:e.width,height:e.height}}}));for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});for(let e=1;e<=c;e++)u.has(e)||u.set(e,{cells:new Map})}return{name:r,bounds:{top:1,left:1,bottom:c,right:s},columns:l,rows:u,images:f}}function dx(e,t){if(e==null)return null;if(typeof e==`object`&&!(e instanceof Date)&&`value`in e){let n=e,r=dx(n.value,t);if(!r)return null;let i={};return(n.bold||n.italic||n.fontSize||n.fontColor)&&(i.font={bold:n.bold,italic:n.italic,size:n.fontSize,color:n.fontColor?{argb:n.fontColor}:void 0}),n.fillColor&&(i.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:n.fillColor}}),n.align&&(i.alignment={horizontal:n.align}),r.style=i,r}return typeof e==`string`?{type:X.String,value:e,text:e,col:t}:typeof e==`number`?{type:X.Number,value:e,text:String(e),col:t}:typeof e==`boolean`?{type:X.Boolean,value:e,text:e?`TRUE`:`FALSE`,col:t}:e instanceof Date?{type:X.Date,value:e,text:e.toLocaleDateString(),col:t}:null}function fx(e,t){return Zb(px(e),t)}function px(e){return{title:e.title||void 0,creator:e.creator||void 0,subject:e.subject||void 0,sheets:e.worksheets.map(t=>mx(t,e))}}function mx(e,t){let n=e.dimensions,r=n&&n.model.top>0&&n.model.left>0,i=r?{top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right}:{top:0,left:0,bottom:0,right:0},a=new Map;if(r)for(let t=i.left;t<=i.right;t++){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}let o=new Map;if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);if(!n)continue;let r=new Map;n.eachCell({includeEmpty:!1},e=>{r.set(e.col,hx(e))}),o.set(t,{hidden:n.hidden||void 0,height:n.height??void 0,cells:r})}let s=e.hasMerges&&e.model.mergeCells?[...e.model.mergeCells]:void 0,c=e.pageSetup,l=c?{orientation:c.orientation,paperSize:c.paperSize,margins:c.margins?{left:c.margins.left,right:c.margins.right,top:c.margins.top,bottom:c.margins.bottom}:void 0,scale:c.scale,printTitlesRow:c.printTitlesRow,showGridLines:c.showGridLines,printArea:c.printArea}:void 0,u=e.rowBreaks?.map(e=>e.id),d=e.colBreaks?.map(e=>e.id),f=Dx(e,t);if(f){for(let e of f){let t=e.range.tl,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;if(i.top===0&&i.left===0&&(i.top=1,i.left=1),n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r),e.range.br){let t=e.range.br,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r)}}for(let t=i.left;t<=i.right;t++)if(!a.has(t)){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}for(let e=i.top;e<=i.bottom;e++)o.has(e)||o.set(e,{cells:new Map})}return{name:e.name,state:e.state??`visible`,bounds:i,columns:a,rows:o,merges:s,pageSetup:l,rowBreaks:u,colBreaks:d,images:f}}function hx(e){let t=gx(e.type),n=_x(e),r=bx(e.style);return{type:t,value:yx(e),text:n,style:r,hyperlink:e.hyperlink||void 0,result:e.result??void 0,col:e.col}}function gx(e){switch(e){case E.Null:return X.Empty;case E.Merge:return X.Merge;case E.Number:return X.Number;case E.String:case E.SharedString:return X.String;case E.Date:return X.Date;case E.Hyperlink:return X.Hyperlink;case E.Formula:return X.Formula;case E.RichText:return X.RichText;case E.Boolean:return X.Boolean;case E.Error:return X.Error;default:return X.String}}function _x(e){if(!e)return``;switch(e.type){case E.Null:case E.Merge:return``;case E.RichText:case E.Hyperlink:return e.text??``;case E.Error:return e.value?.error??e.text??``;case E.Formula:{let t=e.result;return t==null?e.text??``:typeof t==`object`&&`error`in t?t.error:vx(t,e.style?.numFmt)}default:{let t=e.value;return t==null?``:vx(t,e.style?.numFmt)}}}function vx(e,t){let n=typeof t==`string`?t:t?.formatCode;if(n&&(typeof e==`number`||e instanceof Date||typeof e==`boolean`))try{return Nn(e,n)}catch{}return e instanceof Date?e.toLocaleDateString():String(e)}function yx(e){if(e.type===E.RichText){let t=e.value;if(t?.richText)return{richText:t.richText.map(e=>({text:e.text,font:e.font?xx(e.font):void 0}))}}return e.value}function bx(e){if(e)return{font:e.font?xx(e.font):void 0,numFmt:e.numFmt,fill:e.fill?Cx(e.fill):void 0,border:e.border?Tx(e.border):void 0,alignment:e.alignment?Ex(e.alignment):void 0}}function xx(e){return{name:e.name,size:e.size,bold:e.bold,italic:e.italic,strike:e.strike,underline:e.underline,color:e.color?Sx(e.color):void 0}}function Sx(e){return{argb:e.argb,theme:e.theme,tint:e.tint}}function Cx(e){let t={type:e.type??`pattern`,pattern:e.pattern,fgColor:e.fgColor?Sx(e.fgColor):void 0};return e.stops&&(t.stops=e.stops.map(e=>({color:Sx(e.color)}))),t}function wx(e){return{style:e.style,color:e.color?Sx(e.color):void 0}}function Tx(e){return{top:e.top?wx(e.top):void 0,right:e.right?wx(e.right):void 0,bottom:e.bottom?wx(e.bottom):void 0,left:e.left?wx(e.left):void 0}}function Ex(e){return{horizontal:e.horizontal,vertical:e.vertical,wrapText:e.wrapText,indent:e.indent,textRotation:e.textRotation}}function Dx(e,t){let n=e.getImages?.();if(!n||!Array.isArray(n)||n.length===0)return;let r=[];for(let e of n){if(!e.range?.tl)continue;let n=e.imageId,i=t.getImage?.(Number(n));if(!i)continue;let a;if(i.buffer instanceof Uint8Array?a=i.buffer:i.base64&&(a=bt(i.base64)),!a||a.length===0)continue;let o=i.extension;o!==`jpeg`&&o!==`png`||r.push({data:a,format:o,range:{tl:{col:e.range.tl.col??0,row:e.range.tl.row??0,nativeCol:e.range.tl.nativeCol,nativeRow:e.range.tl.nativeRow,nativeColOff:e.range.tl.nativeColOff,nativeRowOff:e.range.tl.nativeRowOff},br:e.range.br?{col:e.range.br.col??0,row:e.range.br.row??0,nativeCol:e.range.br.nativeCol,nativeRow:e.range.br.nativeRow,nativeColOff:e.range.br.nativeColOff,nativeRowOff:e.range.br.nativeRowOff}:void 0,ext:e.range.ext?{width:e.range.ext.width,height:e.range.ext.height}:void 0}})}return r.length>0?r:void 0}return e.Anchor=Ve,e.BaseError=t,e.Cell=O,e.Column=Re,e.ColumnOutOfBoundsError=p,e.CsvFormatterStream=gv,e.CsvParserStream=$_,e.DataValidations=Qe,e.DateFormatter=hg,e.DateParser=pg,e.DefinedNames=fi,e.DocumentType=ae,e.Enums=D,e.ErrorValue=se,e.ExcelDownloadError=x,e.ExcelError=l,e.ExcelFileError=y,e.ExcelNotSupportedError=v,e.ExcelStreamStateError=b,e.FormCheckbox=at,e.FormulaType=re,e.Image=He,e.ImageError=C,e.InvalidAddressError=f,e.InvalidValueTypeError=g,e.MaxItemsExceededError=te,e.MergeConflictError=h,e.PageSizes=Av,e.PaperSize=kv,e.PdfError=Rv,e.PdfFontError=Bv,e.PdfRenderError=zv,e.PdfStructureError=Vv,e.PivotTableError=S,e.Range=T,e.ReadingOrder=oe,e.RelationshipType=ie,e.Row=Le,e.RowOutOfBoundsError=m,e.Table=Ze,e.TableError=ee,e.ValueType=E,e.Workbook=Ov,e.WorkbookReader=Yh,e.WorkbookWriter=Xm,e.Worksheet=si,e.WorksheetNameError=d,e.WorksheetReader=Kh,e.WorksheetWriter=Km,e.XmlParseError=_,e.base64ToUint8Array=bt,e.concatUint8Arrays=j,e.createCsvFormatterStream=_v,e.createCsvParserStream=ev,e.dateToExcel=xt,e.decodeCell=ri,e.decodeCol=$r,e.decodeRange=ai,e.decodeRow=ti,e.encodeCell=ii,e.encodeCol=ei,e.encodeRange=oi,e.encodeRow=ni,e.errorToJSON=o,e.excelToDate=St,e.excelToPdf=fx,e.getErrorChain=s,e.getRootCause=c,e.getSupportedFormats=gg,e.isExcelError=u,e.isPdfError=Hv,e.pdf=cx,e.stringToUint8Array=Qn,e.toError=a,e.toUint8Array=er,e.uint8ArrayToBase64=Gt,e.uint8ArrayToString=$n,e.xmlDecode=mt,e.xmlEncode=k,e})({});
|
|
450
|
+
`))}i.addObject(p,h);let g=[];for(let t of e.cells)if(t.hyperlink){let e=i.allocObject(),n=`[${Z(t.rect.x)} ${Z(t.rect.y)} ${Z(t.rect.x+t.rect.width)} ${Z(t.rect.y+t.rect.height)}]`,r=new $().set(`Type`,`/Annot`).set(`Subtype`,`/Link`).set(`Rect`,n).set(`Border`,`[0 0 0]`).set(`A`,`<< /Type /Action /S /URI /URI (${t.hyperlink.replace(/[()\\]/g,`\\$&`)}) >>`);i.addObject(e,r),g.push(e)}let _=i.addPage({parentRef:u,width:e.width,height:e.height,contentsRef:o,resourcesRef:p,annotRefs:g.length>0?g:void 0});l.push(_),d.has(e.sheetName)||d.set(e.sheetName,l.length-1)}catch(t){throw new zv(`Failed to render page ${e.pageNumber} of "${e.sheetName}"`,{cause:t})}let f=`[`+l.map(e=>Q(e)).join(` `)+`]`,p=new $().set(`Type`,`/Pages`).set(`Kids`,f).set(`Count`,String(l.length));i.addObject(u,p);let m;if(d.size>1&&(m=rx(i,d,l)),i.addCatalog(u,m),i.addInfoDict({title:o.title||e.title||void 0,author:o.author||e.creator||void 0,subject:o.subject||e.subject||void 0,creator:o.creator}),t?.encryption){let e=Wv(t.encryption);i.setEncryption(e)}return i.build()}function Qb(e,t){let n=e.sheets;if(!t||t.length===0)return n.filter(e=>e.state!==`hidden`&&e.state!==`veryHidden`);let r=[];for(let e of t)if(typeof e==`string`){let t=n.find(t=>t.name.toLowerCase()===e.toLowerCase());t&&r.push(t)}else if(typeof e==`number`){let t=n[e-1];t&&r.push(t)}return r}function $b(e,t){let n=t?.pageSetup,r=tx(e?.pageSize,n?.paperSize),i=e?.orientation??(n?.orientation===`landscape`?`landscape`:`portrait`),a=nx(e?.margins,n?.margins),o=Yy(e?.gridLineColor??`FFD0D0D0`)??{r:.816,g:.816,b:.816},s=e?.repeatRows??!1;if(s===!1&&n?.printTitlesRow){let e=n.printTitlesRow.match(/^(\d+)(?::(\d+))?$/);e&&(s=parseInt(e[2]??e[1],10))}return{pageSize:r,orientation:i,margins:a,fitToPage:e?.fitToPage===void 0?!0:e.fitToPage,scale:Math.max(.1,Math.min(3,e?.scale??(n?.scale?n.scale/100:1))),showGridLines:e?.showGridLines??n?.showGridLines??!1,gridLineColor:o,repeatRows:s,defaultFontFamily:e?.defaultFontFamily??`Helvetica`,defaultFontSize:e?.defaultFontSize??11,showSheetNames:e?.showSheetNames??!1,showPageNumbers:e?.showPageNumbers??!1,title:e?.title??``,author:e?.author??``,subject:e?.subject??``,creator:e?.creator??`excelts`}}let ex={1:Av.LETTER,5:Av.LEGAL,9:Av.A4,8:Av.A3,11:Av.A5,17:Av.TABLOID};function tx(e,t){return e?typeof e==`string`?Av[e]??Av.A4:e:t===void 0?Av.A4:ex[t]??Av.A4}function nx(e,t){let n=t?{top:t.top*72,right:t.right*72,bottom:t.bottom*72,left:t.left*72}:{top:72,right:72,bottom:72,left:72};return e?{top:e.top??n.top,right:e.right??n.right,bottom:e.bottom??n.bottom,left:e.left??n.left}:n}function rx(e,t,n){let r=e.allocObject(),i=Array.from(t.entries()),a=[];for(let t=0;t<i.length;t++)a.push(e.allocObject());for(let t=0;t<i.length;t++){let[o,s]=i[t],c=n[s],l=new $().set(`Title`,jv(o)).set(`Parent`,Q(r)).set(`Dest`,`[${Q(c)} /Fit]`);t>0&&l.set(`Prev`,Q(a[t-1])),t<i.length-1&&l.set(`Next`,Q(a[t+1])),e.addObject(a[t],l)}let o=new $().set(`Type`,`/Outlines`).set(`First`,Q(a[0])).set(`Last`,Q(a[a.length-1])).set(`Count`,String(i.length));return e.addObject(r,o),r}function ix(e,t,n){return n===`png`?ox(e,t):ax(e,t)}function ax(e,t){let n=e.allocObject(),r=sx(t),i=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(r.width)).set(`Height`,Z(r.height)).set(`ColorSpace`,`/DeviceRGB`).set(`BitsPerComponent`,`8`).set(`Filter`,`/DCTDecode`);return e.addStreamObject(n,i,t),n}function ox(e,t){let n=Kb(t),r=e.allocObject(),i=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(n.width)).set(`Height`,Z(n.height)).set(`ColorSpace`,`/DeviceRGB`).set(`BitsPerComponent`,Z(n.bitsPerComponent));if(n.alpha){let t=e.allocObject(),r=new $().set(`Type`,`/XObject`).set(`Subtype`,`/Image`).set(`Width`,Z(n.width)).set(`Height`,Z(n.height)).set(`ColorSpace`,`/DeviceGray`).set(`BitsPerComponent`,`8`);e.addStreamObject(t,r,n.alpha),i.set(`SMask`,Q(t))}return e.addStreamObject(r,i,n.pixels),r}function sx(e){let t=2;for(;t<e.length-1;){for(;t<e.length&&e[t]===255&&e[t+1]===255;)t++;if(t>=e.length-1||e[t]!==255)break;let n=e[t+1];if(n>=192&&n<=207&&n!==196&&n!==200&&n!==204){if(t+8<e.length){let n=e[t+5]<<8|e[t+6];return{width:e[t+7]<<8|e[t+8],height:n}}break}if(t+3>=e.length)break;let r=e[t+2]<<8|e[t+3];t+=2+r}return{width:1,height:1}}function cx(e,t){return Zb(lx(e),t)}function lx(e){return Array.isArray(e)?{sheets:[ux({data:e})]}:`sheets`in e?{title:e.title,creator:e.author,sheets:e.sheets.map((e,t)=>ux(e,t))}:{sheets:[ux(e)]}}function ux(e,t){let n=e.data,r=e.name??`Sheet${(t??0)+1}`,i=e.columns?.map(e=>typeof e==`number`?void 0:e.header),a=i?.some(e=>e!==void 0)??!1,o=0;for(let e of n)e.length>o&&(o=e.length);let s=Math.max(o,e.columns?.length??0),c=n.length+ +!!a;if(e.images)for(let t of e.images){let e=t.col+1,n=t.row+1;e>s&&(s=e),n>c&&(c=n)}if(s===0)return{name:r,bounds:{top:0,left:0,bottom:0,right:0},columns:new Map,rows:new Map};let l=new Map;if(e.columns)for(let t=0;t<e.columns.length;t++){let n=e.columns[t],r=typeof n==`number`?n:n.width;l.set(t+1,{width:r??12})}for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});let u=new Map,d=1;if(a&&i){let e=new Map;for(let t=0;t<i.length;t++){let n=i[t];n!==void 0&&e.set(t+1,{type:X.String,value:n,text:n,col:t+1,style:{font:{bold:!0}}})}u.set(1,{cells:e}),d=2}for(let e=0;e<n.length;e++){let t=e+d,r=n[e],i=new Map;for(let e=0;e<r.length;e++){let t=dx(r[e],e+1);t&&i.set(e+1,t)}u.set(t,{cells:i})}let f;if(e.images&&e.images.length>0){f=e.images.map(e=>({data:e.data,format:e.format,range:{tl:{col:e.col,row:e.row},ext:{width:e.width,height:e.height}}}));for(let e=1;e<=s;e++)l.has(e)||l.set(e,{width:12});for(let e=1;e<=c;e++)u.has(e)||u.set(e,{cells:new Map})}return{name:r,bounds:{top:1,left:1,bottom:c,right:s},columns:l,rows:u,images:f}}function dx(e,t){if(e==null)return null;if(typeof e==`object`&&!(e instanceof Date)&&`value`in e){let n=e,r=dx(n.value,t);if(!r)return null;let i={};return(n.bold||n.italic||n.fontSize||n.fontColor)&&(i.font={bold:n.bold,italic:n.italic,size:n.fontSize,color:n.fontColor?{argb:n.fontColor}:void 0}),n.fillColor&&(i.fill={type:`pattern`,pattern:`solid`,fgColor:{argb:n.fillColor}}),n.align&&(i.alignment={horizontal:n.align}),r.style=i,r}return typeof e==`string`?{type:X.String,value:e,text:e,col:t}:typeof e==`number`?{type:X.Number,value:e,text:String(e),col:t}:typeof e==`boolean`?{type:X.Boolean,value:e,text:e?`TRUE`:`FALSE`,col:t}:e instanceof Date?{type:X.Date,value:e,text:e.toLocaleDateString(),col:t}:null}function fx(e,t){return Zb(px(e),t)}function px(e){return{title:e.title||void 0,creator:e.creator||void 0,subject:e.subject||void 0,sheets:e.worksheets.map(t=>mx(t,e))}}function mx(e,t){let n=e.dimensions,r=n&&n.model.top>0&&n.model.left>0,i=r?{top:n.model.top,left:n.model.left,bottom:n.model.bottom,right:n.model.right}:{top:0,left:0,bottom:0,right:0},a=new Map;if(r)for(let t=i.left;t<=i.right;t++){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}let o=new Map;if(r)for(let t=i.top;t<=i.bottom;t++){let n=e.findRow(t);if(!n)continue;let r=new Map;n.eachCell({includeEmpty:!1},e=>{r.set(e.col,hx(e))}),o.set(t,{hidden:n.hidden||void 0,height:n.height??void 0,cells:r})}let s=e.hasMerges&&e.model.mergeCells?[...e.model.mergeCells]:void 0,c=e.pageSetup,l=c?{orientation:c.orientation,paperSize:c.paperSize,margins:c.margins?{left:c.margins.left,right:c.margins.right,top:c.margins.top,bottom:c.margins.bottom}:void 0,scale:c.scale,printTitlesRow:c.printTitlesRow,showGridLines:c.showGridLines,printArea:c.printArea}:void 0,u=e.rowBreaks?.map(e=>e.id),d=e.colBreaks?.map(e=>e.id),f=Dx(e,t);if(f){for(let e of f){let t=e.range.tl,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;if(i.top===0&&i.left===0&&(i.top=1,i.left=1),n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r),e.range.br){let t=e.range.br,n=(t.nativeCol??t.col??0)+1,r=(t.nativeRow??t.row??0)+1;n>i.right&&(i.right=n),r>i.bottom&&(i.bottom=r)}}for(let t=i.left;t<=i.right;t++)if(!a.has(t)){let n=e.getColumn(t);a.set(t,{hidden:n.hidden||void 0,width:n.width??void 0})}for(let e=i.top;e<=i.bottom;e++)o.has(e)||o.set(e,{cells:new Map})}return{name:e.name,state:e.state??`visible`,bounds:i,columns:a,rows:o,merges:s,pageSetup:l,rowBreaks:u,colBreaks:d,images:f}}function hx(e){let t=gx(e.type),n=_x(e),r=bx(e.style);return{type:t,value:yx(e),text:n,style:r,hyperlink:e.hyperlink||void 0,result:e.result??void 0,col:e.col}}function gx(e){switch(e){case E.Null:return X.Empty;case E.Merge:return X.Merge;case E.Number:return X.Number;case E.String:case E.SharedString:return X.String;case E.Date:return X.Date;case E.Hyperlink:return X.Hyperlink;case E.Formula:return X.Formula;case E.RichText:return X.RichText;case E.Boolean:return X.Boolean;case E.Error:return X.Error;default:return X.String}}function _x(e){if(!e)return``;switch(e.type){case E.Null:case E.Merge:return``;case E.RichText:case E.Hyperlink:return e.text??``;case E.Error:return e.value?.error??e.text??``;case E.Formula:{let t=e.result;return t==null?e.text??``:typeof t==`object`&&`error`in t?t.error:vx(t,e.style?.numFmt)}default:{let t=e.value;return t==null?``:vx(t,e.style?.numFmt)}}}function vx(e,t){let n=typeof t==`string`?t:t?.formatCode;if(n&&(typeof e==`number`||e instanceof Date||typeof e==`boolean`))try{return Nn(e,n)}catch{}return e instanceof Date?e.toLocaleDateString():String(e)}function yx(e){if(e.type===E.RichText){let t=e.value;if(t?.richText)return{richText:t.richText.map(e=>({text:e.text,font:e.font?xx(e.font):void 0}))}}return e.value}function bx(e){if(e)return{font:e.font?xx(e.font):void 0,numFmt:e.numFmt,fill:e.fill?Cx(e.fill):void 0,border:e.border?Tx(e.border):void 0,alignment:e.alignment?Ex(e.alignment):void 0}}function xx(e){return{name:e.name,size:e.size,bold:e.bold,italic:e.italic,strike:e.strike,underline:e.underline,color:e.color?Sx(e.color):void 0}}function Sx(e){return{argb:e.argb,theme:e.theme,tint:e.tint}}function Cx(e){let t={type:e.type??`pattern`,pattern:e.pattern,fgColor:e.fgColor?Sx(e.fgColor):void 0};return e.stops&&(t.stops=e.stops.map(e=>({color:Sx(e.color)}))),t}function wx(e){return{style:e.style,color:e.color?Sx(e.color):void 0}}function Tx(e){return{top:e.top?wx(e.top):void 0,right:e.right?wx(e.right):void 0,bottom:e.bottom?wx(e.bottom):void 0,left:e.left?wx(e.left):void 0}}function Ex(e){return{horizontal:e.horizontal,vertical:e.vertical,wrapText:e.wrapText,indent:e.indent,textRotation:e.textRotation}}function Dx(e,t){let n=e.getImages?.();if(!n||!Array.isArray(n)||n.length===0)return;let r=[];for(let e of n){if(!e.range?.tl)continue;let n=e.imageId,i=t.getImage?.(Number(n));if(!i)continue;let a;if(i.buffer instanceof Uint8Array?a=i.buffer:i.base64&&(a=bt(i.base64)),!a||a.length===0)continue;let o=i.extension;o!==`jpeg`&&o!==`png`||r.push({data:a,format:o,range:{tl:{col:e.range.tl.col??0,row:e.range.tl.row??0,nativeCol:e.range.tl.nativeCol,nativeRow:e.range.tl.nativeRow,nativeColOff:e.range.tl.nativeColOff,nativeRowOff:e.range.tl.nativeRowOff},br:e.range.br?{col:e.range.br.col??0,row:e.range.br.row??0,nativeCol:e.range.br.nativeCol,nativeRow:e.range.br.nativeRow,nativeColOff:e.range.br.nativeColOff,nativeRowOff:e.range.br.nativeRowOff}:void 0,ext:e.range.ext?{width:e.range.ext.width,height:e.range.ext.height}:void 0}})}return r.length>0?r:void 0}return e.Anchor=Ve,e.BaseError=t,e.Cell=O,e.Column=Re,e.ColumnOutOfBoundsError=p,e.CsvFormatterStream=gv,e.CsvParserStream=$_,e.DataValidations=Qe,e.DateFormatter=hg,e.DateParser=pg,e.DefinedNames=fi,e.DocumentType=ae,e.Enums=D,e.ErrorValue=se,e.ExcelDownloadError=x,e.ExcelError=l,e.ExcelFileError=y,e.ExcelNotSupportedError=v,e.ExcelStreamStateError=b,e.FormCheckbox=at,e.FormulaType=re,e.Image=He,e.ImageError=C,e.InvalidAddressError=f,e.InvalidValueTypeError=g,e.MaxItemsExceededError=te,e.MergeConflictError=h,e.PageSizes=Av,e.PaperSize=kv,e.PdfError=Rv,e.PdfFontError=Bv,e.PdfRenderError=zv,e.PdfStructureError=Vv,e.PivotTableError=S,e.Range=T,e.ReadingOrder=oe,e.RelationshipType=ie,e.Row=Le,e.RowOutOfBoundsError=m,e.Table=Ze,e.TableError=ee,e.ValueType=E,e.Workbook=Ov,e.WorkbookReader=Yh,e.WorkbookWriter=Xm,e.Worksheet=si,e.WorksheetNameError=d,e.WorksheetReader=Kh,e.WorksheetWriter=Km,e.XmlParseError=_,e.base64ToUint8Array=bt,e.concatUint8Arrays=j,e.createCsvFormatterStream=_v,e.createCsvParserStream=ev,e.dateToExcel=xt,e.decodeCell=ri,e.decodeCol=$r,e.decodeRange=ai,e.decodeRow=ti,e.encodeCell=ii,e.encodeCol=ei,e.encodeRange=oi,e.encodeRow=ni,e.errorToJSON=o,e.excelToDate=St,e.excelToPdf=fx,e.getErrorChain=s,e.getRootCause=c,e.getSupportedFormats=gg,e.isExcelError=u,e.isPdfError=Hv,e.pdf=cx,e.stringToUint8Array=Qn,e.toError=a,e.toUint8Array=er,e.uint8ArrayToBase64=Gt,e.uint8ArrayToString=$n,e.xmlDecode=mt,e.xmlEncode=k,e})({});
|