@cj-tech-master/excelts 2.0.0-canary.20251228013952.4f2c3c6 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/browser/excelts.esm.js +8 -8
- package/dist/browser/excelts.esm.js.map +1 -1
- package/dist/browser/excelts.esm.min.js +3 -3
- package/dist/browser/excelts.iife.js +8 -8
- package/dist/browser/excelts.iife.js.map +1 -1
- package/dist/browser/excelts.iife.min.js +3 -3
- package/dist/cjs/utils/datetime.js +156 -7
- package/dist/esm/utils/datetime.js +153 -7
- package/dist/types/utils/datetime.d.ts +29 -0
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/*!
|
|
2
|
-
* @cj-tech-master/excelts v2.0.0
|
|
2
|
+
* @cj-tech-master/excelts v2.0.0
|
|
3
3
|
* TypeScript Excel Workbook Manager - Read and Write xlsx and csv Files.
|
|
4
4
|
* (c) 2025 cjnoname
|
|
5
5
|
* Released under the MIT License
|
|
@@ -116,10 +116,10 @@ var ExcelTS=(function(e){let t=/^[A-Z]+\d+$/,n={_dictionary:`ABCDEFGHIJKLMNOPQRS
|
|
|
116
116
|
${n}
|
|
117
117
|
/>
|
|
118
118
|
`}var Ji=class extends R{constructor(e){super(),this.model=e||{type:`note`,note:{texts:[]},ref:``}}get tag(){return`r`}get richTextXform(){return this._richTextXform||=new Fn,this._richTextXform}render(e,t){let n=t||this.model;e.openNode(`comment`,{ref:n.ref,authorId:0}),e.openNode(`text`),n&&n.note&&n.note.texts&&n.note.texts.forEach(t=>{this.richTextXform.render(e,t)}),e.closeNode(),e.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`comment`:return this.model={type:`note`,note:{texts:[]},...e.attributes},!0;case`r`:return this.parser=this.richTextXform,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`comment`:return!1;case`r`:return this.model.note.texts.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}},Yi=class e extends R{constructor(){super(),this.map={comment:new Ji},this.model={comments:[]}}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(`comments`,e.COMMENTS_ATTRIBUTES),t.openNode(`authors`),t.leafNode(`author`,null,`Author`),t.closeNode(),t.openNode(`commentList`),r.comments.forEach(e=>{this.map.comment.render(t,e)}),t.closeNode(),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case`commentList`:return this.model={comments:[]},!0;case`comment`:return this.parser=this.map.comment,this.parser.parseOpen(e),!0;default:return!1}}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){switch(e){case`commentList`:return!1;case`comment`:return this.model.comments.push(this.parser.model),this.parser=void 0,!0;default:return this.parser&&this.parser.parseClose(e),!0}}static{this.COMMENTS_ATTRIBUTES={xmlns:`http://schemas.openxmlformats.org/spreadsheetml/2006/main`}}},Xi=class extends R{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}}},Zi=class extends R{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}},Qi=class extends R{constructor(e){super(),this._model=e||{},this.text=``}get tag(){return this._model&&this._model.tag||``}render(e,t){e.leafNode(this.tag,null,t)}parseOpen(e){switch(e.name){case this.tag:return this.text=``,!0;default:return!1}}parseText(e){this.text=e}parseClose(){return!1}},$i=class extends R{constructor(e){super(),this._model=e||{},this.model={}}get tag(){return this._model&&this._model.tag||``}render(e,t,n){(n&&t===n[2]||n&&this.tag===`x:SizeWithCells`&&t===n[1])&&e.leafNode(this.tag)}parseOpen(e){switch(e.name){case this.tag:return this.model={},this.model[this.tag]=!0,!0;default:return!1}}parseText(){}parseClose(){return!1}};let ea=[`twoCells`,`oneCells`,`absolute`];var ta=class extends R{constructor(){super(),this.map={"x:Anchor":new Zi,"x:Locked":new Qi({tag:`x:Locked`}),"x:LockText":new Qi({tag:`x:LockText`}),"x:SizeWithCells":new $i({tag:`x:SizeWithCells`}),"x:MoveWithCells":new $i({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,ea),this.map[`x:SizeWithCells`].render(e,r,ea),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=ea[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}},na=class e extends R{constructor(){super(),this.map={"v:textbox":new Xi,"x:ClientData":new ta}}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})}},ra=class e extends R{constructor(){super(),this.map={"v:shape":new na},this.model={comments:[]}}get tag(){return`xml`}render(t,n){let r=n||this.model;t.openXml(F.StdDocAttributes),t.openNode(this.tag,e.DRAWING_ATTRIBUTES),t.openNode(`o:shapelayout`,{"v:ext":`edit`}),t.leafNode(`o:idmap`,{"v:ext":`edit`,data:1}),t.closeNode(),t.openNode(`v:shapetype`,{id:`_x0000_t202`,coordsize:`21600,21600`,"o:spt":202,path:`m,l,21600r21600,l21600,xe`}),t.leafNode(`v:stroke`,{joinstyle:`miter`}),t.leafNode(`v:path`,{gradientshapeok:`t`,"o:connecttype":`rect`}),t.closeNode(),r.comments.forEach((e,n)=>{this.map[`v:shape`].render(t,e,n)}),t.closeNode()}parseOpen(e){if(this.parser)return this.parser.parseOpen(e),!0;switch(e.name){case this.tag:this.reset(),this.model={comments:[]};break;default:this.parser=this.map[e.name],this.parser&&this.parser.parseOpen(e);break}return!0}parseText(e){this.parser&&this.parser.parseText(e)}parseClose(e){if(this.parser)return this.parser.parseClose(e)||(this.model.comments.push(this.parser.model),this.parser=void 0),!0;switch(e){case this.tag:return!1;default:return!0}}reconcile(e,t){e.anchors.forEach(e=>{e.br?this.map[`xdr:twoCellAnchor`].reconcile(e,t):this.map[`xdr:oneCellAnchor`].reconcile(e,t)})}static{this.DRAWING_ATTRIBUTES={"xmlns:v":`urn:schemas-microsoft-com:vml`,"xmlns:o":`urn:schemas-microsoft-com:office:office`,"xmlns:x":`urn:schemas-microsoft-com:office:excel`}}},ia=class e{static{this.RelType=q}constructor(e){this.workbook=e}parseRels(e){return new K().parseStream(e)}parseWorkbook(e){return new tr().parseStream(e)}parseSharedStrings(e){return new Rn().parseStream(e)}reconcile(e,t){let n=new tr,r=new hi(t),i=new Mi,a=new zi;n.reconcile(e);let o={media:e.media,mediaIndex:e.mediaIndex};Object.keys(e.drawings).forEach(t=>{let n=e.drawings[t],r=e.drawingRels[t];r&&(o.rels=r.reduce((e,t)=>(e[t.Id]=t,e),{}),(n.anchors||[]).forEach(e=>{let t=e.picture&&e.picture.hyperlinks;t&&o.rels[t.rId]&&(t.hyperlink=o.rels[t.rId].Target,delete t.rId)}),i.reconcile(n,o))});let s={styles:e.styles};Object.values(e.tables).forEach(e=>{a.reconcile(e,s)}),this._reconcilePivotTables(e);let c={styles:e.styles,sharedStrings:e.sharedStrings,media:e.media,mediaIndex:e.mediaIndex,date1904:e.properties&&e.properties.date1904,drawings:e.drawings,comments:e.comments,tables:e.tables,vmlDrawings:e.vmlDrawings,pivotTables:e.pivotTablesIndexed};e.worksheets.forEach(t=>{t.relationships=e.worksheetRels[t.sheetNo],r.reconcile(t,c)}),delete e.worksheetHash,delete e.worksheetRels,delete e.globalRels,delete e.sharedStrings,delete e.workbookRels,delete e.sheetDefs,delete e.styles,delete e.mediaIndex,delete e.drawings,delete e.drawingRels,delete e.vmlDrawings,delete e.pivotTableRels,delete e.pivotCacheDefinitionRels}_reconcilePivotTables(e){let t=e.pivotTables||{};if(typeof t!=`object`||Object.keys(t).length===0){e.pivotTables=[],e.pivotTablesIndexed={};return}let n=this._buildDefinitionToCacheIdMap(e),r=new Map;Object.entries(e.pivotCacheDefinitions||{}).forEach(([t,i])=>{let a=n.get(t);if(a!==void 0){let n=t.replace(`Definition`,`Records`);r.set(a,{definition:i,records:e.pivotCacheRecords?.[n],definitionName:t})}});let i=[],a={};Object.entries(t).forEach(([e,t])=>{let n=t,o=this._extractTableNumber(e),s=r.get(n.cacheId),c={...n,tableNumber:o,cacheDefinition:s?.definition,cacheRecords:s?.records,cacheFields:s?.definition?.cacheFields||[],rows:n.rowFields.filter(e=>e>=0),columns:n.colFields.filter(e=>e>=0&&e!==-2),values:n.dataFields.map(e=>e.fld),metric:this._determineMetric(n.dataFields),applyWidthHeightFormats:n.applyWidthHeightFormats||`0`};i.push(c),a[`../pivotTables/${e}.xml`]=c}),i.sort((e,t)=>e.tableNumber-t.tableNumber),e.pivotTables=i,e.pivotTablesIndexed=a,e.loadedPivotTables=i}_extractTableNumber(e){let t=e.match(/pivotTable(\d+)/);return t?parseInt(t[1],10):1}_buildCacheIdMap(e){let t=new Map,n=e.pivotCaches||[];for(let e of n)e.cacheId&&e.rId&&t.set(e.rId,parseInt(e.cacheId,10));return t}_buildDefinitionToCacheIdMap(t){let n=new Map,r=this._buildCacheIdMap(t),i=t.workbookRels||[];for(let t of i)if(t.Type===e.RelType.PivotCacheDefinition&&t.Target){let e=t.Target.match(/pivotCacheDefinition(\d+)\.xml/);if(e){let i=`pivotCacheDefinition${e[1]}`,a=r.get(t.Id);a!==void 0&&n.set(i,a)}}return n}_determineMetric(e){return e.length>0&&e[0].subtotal===`count`?`count`:`sum`}async _processWorksheetEntry(e,t,n,r,i){let a=await new hi(r).parseStream(e);if(!a)throw Error(`Failed to parse worksheet ${i}`);a.sheetNo=n,t.worksheetHash[i]=a,t.worksheets.push(a)}async _processCommentEntry(e,t,n){let r=await new Yi().parseStream(e);t.comments[`../${n}.xml`]=r}async _processTableEntry(e,t,n){let r=await new zi().parseStream(e);t.tables[`../tables/${n}.xml`]=r}async _processWorksheetRelsEntry(e,t,n){let r=await new K().parseStream(e);t.worksheetRels[n]=r}async _processMediaEntry(e,t,n){let r=n.lastIndexOf(`.`);if(r>=1){let i=n.substr(r+1),a=n.substr(0,r);await new Promise((r,o)=>{let s=this.createStreamBuf(),c=()=>{e.removeListener(`error`,u),s.removeListener(`error`,u),s.removeListener(`finish`,l)},l=()=>{c(),t.mediaIndex[n]=t.media.length,t.mediaIndex[a]=t.media.length;let e={type:`image`,name:a,extension:i,buffer:s.toBuffer?s.toBuffer():s.read()};t.media.push(e),r()},u=e=>{c(),o(e)};s.once(`finish`,l),e.on(`error`,u),s.on(`error`,u),e.pipe(s)})}}async _processDrawingEntry(e,t,n){let r=await new Mi().parseStream(e);t.drawings[n]=r}async _processDrawingRelsEntry(e,t,n){let r=await new K().parseStream(e);t.drawingRels[n]=r}async _processVmlDrawingEntry(e,t,n){let r=await new ra().parseStream(e);t.vmlDrawings[`../drawings/${n}.vml`]=r}async _processThemeEntry(e,t,n){await new Promise((r,i)=>{let a=this.createStreamBuf(),o=()=>{e.removeListener(`error`,c),a.removeListener(`error`,c),a.removeListener(`finish`,s)},s=()=>{o();let e=a.read();t.themes[n]=e?typeof e==`string`?e:this.bufferToString(e):``,r()},c=e=>{o(),i(e)};a.once(`finish`,s),e.on(`error`,c),a.on(`error`,c),e.pipe(a)})}async _processPivotTableEntry(e,t,n){let r=await new Wi().parseStream(e);r&&(t.pivotTables[n]=r)}async _processPivotTableRelsEntry(e,t,n){let r=await new K().parseStream(e);t.pivotTableRels[n]=r}async _processPivotCacheDefinitionEntry(e,t,n){let r=await new Ui().parseStream(e);r&&(t.pivotCacheDefinitions[n]=r)}async _processPivotCacheDefinitionRelsEntry(e,t,n){let r=await new K().parseStream(e);t.pivotCacheDefinitionRels[n]=r}async _processPivotCacheRecordsEntry(e,t,n){let r=await new Bi().parseStream(e);r&&(t.pivotCacheRecords[n]=r)}async loadFromFiles(e,t){let n={worksheets:[],worksheetHash:{},worksheetRels:[],themes:{},media:[],mediaIndex:{},drawings:{},drawingRels:{},comments:{},tables:{},vmlDrawings:{},pivotTables:{},pivotTableRels:{},pivotCacheDefinitions:{},pivotCacheDefinitionRels:{},pivotCacheRecords:{}},r=Object.keys(e).map(t=>({name:t,dir:t.endsWith(`/`),data:e[t]}));for(let e of r)if(!e.dir){let r=e.name;r[0]===`/`&&(r=r.substr(1));let i=r.match(/xl\/media\//)||r.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/)?this.createBinaryStream(e.data):this.createTextStream(this.bufferToString(e.data)),a=r.match(/xl\/worksheets\/sheet(\d+)[.]xml/);if(a){let e=parseInt(a[1],10);await this._processWorksheetEntry(i,n,e,t,r)}else switch(r){case`_rels/.rels`:n.globalRels=await this.parseRels(i);break;case`xl/workbook.xml`:{let e=await this.parseWorkbook(i);n.sheets=e.sheets,n.definedNames=e.definedNames,n.views=e.views,n.properties=e.properties,n.calcProperties=e.calcProperties,n.pivotCaches=e.pivotCaches;break}case`xl/sharedStrings.xml`:n.sharedStrings=new Rn,await n.sharedStrings.parseStream(i);break;case`xl/_rels/workbook.xml.rels`:n.workbookRels=await this.parseRels(i);break;case`docProps/app.xml`:{let e=await new Un().parseStream(i);n.company=e.company,n.manager=e.manager;break}case`docProps/core.xml`:{let e=await new Nn().parseStream(i);Object.assign(n,e);break}case`xl/styles.xml`:n.styles=new jn,await n.styles.parseStream(i);break;default:await this._processDefaultEntry(i,n,r)}}return this.reconcile(n,t),this.workbook.model=n,this.workbook}async _processDefaultEntry(e,t,n){let r;if(r=n.match(/xl\/worksheets\/_rels\/sheet(\d+)[.]xml[.]rels/),r){let n=parseInt(r[1],10);await this._processWorksheetRelsEntry(e,t,n);return}if(r=n.match(/xl\/media\/([a-zA-Z0-9]+[.][a-zA-Z0-9]{3,4})$/),r){await this._processMediaEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(drawing\d+)[.]xml/),r){await this._processDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/_rels\/(drawing\d+)[.]xml[.]rels/),r){await this._processDrawingRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/drawings\/(vmlDrawing\d+)[.]vml/),r){await this._processVmlDrawingEntry(e,t,r[1]);return}if(r=n.match(/xl\/comments(\d+)[.]xml/),r){await this._processCommentEntry(e,t,`comments${r[1]}`);return}if(r=n.match(/xl\/tables\/(table\d+)[.]xml/),r){await this._processTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/theme\/([a-zA-Z0-9]+)[.]xml/),r){await this._processThemeEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/(pivotTable\d+)[.]xml/),r){await this._processPivotTableEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotTables\/_rels\/(pivotTable\d+)[.]xml[.]rels/),r){await this._processPivotTableRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheDefinition\d+)[.]xml/),r){await this._processPivotCacheDefinitionEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/_rels\/(pivotCacheDefinition\d+)[.]xml[.]rels/),r){await this._processPivotCacheDefinitionRelsEntry(e,t,r[1]);return}if(r=n.match(/xl\/pivotCache\/(pivotCacheRecords\d+)[.]xml/),r){await this._processPivotCacheRecordsEntry(e,t,r[1]);return}}async addContentTypes(e,t){let n=new Bn().toXml(t);e.append(n,{name:`[Content_Types].xml`})}async addApp(e,t){let n=new Un().toXml(t);e.append(n,{name:`docProps/app.xml`})}async addCore(e,t){let n=new Nn;e.append(n.toXml(t),{name:`docProps/core.xml`})}async addThemes(e,t){let n=t.themes||{theme1:`<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
|
|
119
|
-
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`};Object.keys(n).forEach(t=>{let r=n[t],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new K().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition${t.tableNumber}.xml`})}),n.worksheets.forEach((t,n)=>{t.rId=`rId${r++}`,t.fileIndex=n+1,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.fileIndex}.xml`})});let a=new K().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new tr;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new hi,r=new K,i=new Yi,a=new ra;t.worksheets.forEach((t,o)=>{let s=t.fileIndex||o+1,c=new F;n.render(c,t),e.append(c.xml,{name:`xl/worksheets/sheet${s}.xml`}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:`xl/worksheets/_rels/sheet${s}.xml.rels`})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:`xl/comments${s}.xml`}),c=new F,a.render(c,t),e.append(c.xml,{name:`xl/drawings/vmlDrawing${s}.vml`}))})}addDrawings(e,t){let n=new Mi,r=new K;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new zi;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new Bi,i=new Ui,a=new Wi,o=new K;n.pivotTables.forEach(n=>{let s=n.tableNumber;if(n.isLoaded){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`})}}else{let e=r.toXml(n);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`}),e=i.toXml(n),t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}let c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords${s}.xml`}]);t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition${s}.xml.rels`}),c=a.toXml(n),t.append(c,{name:`xl/pivotTables/pivotTable${s}.xml`}),c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition${s}.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable${s}.xml.rels`})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator||`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy||`ExcelTS`,e.created=e.created||new Date,e.modified=e.modified||new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Rn,e.styles=e.useStyles?new jn(!0):new jn.Mock;let n=new tr,r=new hi;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}},aa=class{constructor(e){this.listeners=new Map,this.ended=!1,this.data=e}async*[Symbol.asyncIterator](){yield this.data}on(e,t){let n=this.listeners.get(e)||[];return n.push(t),this.listeners.set(e,n),this.ended||(this.ended=!0,queueMicrotask(()=>{this.emit(`data`,this.data),this.emit(`end`)})),this}removeListener(e,t){let n=this.listeners.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){(this.listeners.get(e)||[]).forEach(e=>e(...t))}pipe(e){return e.write(this.data instanceof Uint8Array?this.data:new TextEncoder().encode(this.data)),e.end(),e}},oa=class extends ia{createStreamBuf(){return new qt}createBinaryStream(e){return new aa(e)}createTextStream(e){return new aa(e)}bufferToString(e){return Me(e)}async load(e,t){let n;if(!e||typeof e==`object`&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);n=t&&t.base64?he(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e);let r=await new Mt(n).extractAll(),i={};for(let[e,t]of r)i[e]=t;return this.loadFromFiles(i,t)}async writeBuffer(e){e||={};let{model:t}=this.workbook,n=new Xt(e.zip),r=new qt;return n.pipe(r),this.prepareModel(t,e),await this.addContentTypes(n,t),await this.addOfficeRels(n,t),await this.addWorkbookRels(n,t),await this.addWorksheets(n,t),await this.addSharedStrings(n,t),this.addDrawings(n,t),this.addTables(n,t),this.addPivotTables(n,t),await Promise.all([this.addThemes(n,t),this.addStyles(n,t)]),await this.addMedia(n,t),await Promise.all([this.addApp(n,t),this.addCore(n,t)]),await this.addWorkbook(n,t),await this._finalize(n),ge.from(r.read())}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}throw Error(`Loading images from filename is not supported in browser`)}throw Error(`Unsupported media`)}))}};let Z=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Q=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,sa=(e,t)=>(e.charCodeAt(t)-48)*1e3+(e.charCodeAt(t+1)-48)*100+(e.charCodeAt(t+2)-48)*10+e.charCodeAt(t+3)-48|0,ca=[0,31,29,31,30,31,30,31,31,30,31,30,31];function la(e,t,n){if(t<1||t>12||n<1||n>ca[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function ua(e,t,n,r,i,a){return t<1||t>12||n<1||n>ca[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function da(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:la(sa(e,0),Q(e,5),Q(e,8))}function fa(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function pa(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function ma(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ha(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ga(e){let t=e.charCodeAt(19);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function _a(e){if(e.charCodeAt(19)!==46)return null;let t=e.charCodeAt(23);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function va(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:la(sa(e,6),Q(e,0),Q(e,3))}function ya(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:la(sa(e,6),Q(e,3),Q(e,0))}function ba(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,6),Q(e,0),Q(e,3),Q(e,11),Q(e,14),Q(e,17))}function xa(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,6),Q(e,3),Q(e,0),Q(e,11),Q(e,14),Q(e,17))}let Sa={"YYYY-MM-DD":da,"YYYY-MM-DD[T]HH:mm:ss":fa,"YYYY-MM-DD HH:mm:ss":pa,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?ma(e):e.length===25?ga(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?ha(e):e.length===29?_a(e):null,"MM-DD-YYYY":va,"MM-DD-YYYY HH:mm:ss":ba,"MM/DD/YYYY HH:mm:ss":ba,"DD-MM-YYYY":ya,"DD-MM-YYYY HH:mm:ss":xa,"DD/MM/YYYY HH:mm:ss":xa},Ca=[[10,[da]],[19,[fa,pa]],[20,[ma]],[24,[ha]],[25,[ga]],[29,[_a]]];var wa=class e{constructor(e){this.parse=e=>{if(!e)return null;let t=e.trim();if(!t)return null;if(this.single)return this.fn0(t);for(let e=0,n=this.fns.length;e<n;e++){let n=this.fns[e](t);if(n)return n}return null},this.fns=e,this.single=e.length===1,this.fn0=e[0]}static create(t){return new e(t.map(e=>Sa[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of Ca)t.push(...e);return new e(t)}parseAll(e){let t=e.length,n=Array(t),r=this.parse;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}parseValid(e){let t=[],n=this.parse;for(let r=0,i=e.length;r<i;r++){let i=n(e[r]);i&&t.push(i)}return t}};function Ta(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${Z[r]}:${Z[i]}`}var Ea=class e{constructor(e){this.format=e=>this.fn(e),this.fn=e}static iso(t=!1){return t?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),a=e.getUTCHours(),o=e.getUTCMinutes(),s=e.getUTCSeconds(),c=e.getUTCMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}Z`}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=e.getHours(),o=e.getMinutes(),s=e.getSeconds(),c=e.getMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}${Ta(e)}`})}static create(t,n){let r=n?.utc??!1;if(t===`YYYY-MM-DD`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]}`:``});if(t===`YYYY-MM-DD HH:mm:ss`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]} ${Z[e.getUTCHours()]}:${Z[e.getUTCMinutes()]}:${Z[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]} ${Z[e.getHours()]}:${Z[e.getMinutes()]}:${Z[e.getSeconds()]}`:``});if(t===`MM-DD-YYYY`||t===`MM/DD/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCMonth()+1]}${n}${Z[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getMonth()+1]}${n}${Z[e.getDate()]}${n}${e.getFullYear()}`:``})}if(t===`DD-MM-YYYY`||t===`DD/MM/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCDate()]}${n}${Z[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getDate()]}${n}${Z[e.getMonth()+1]}${n}${e.getFullYear()}`:``})}return e.createGeneric(t,r)}static createGeneric(t,n){let r=[],i=t.replace(/\[([^\]]*)\]/g,(e,t)=>(r.push(t),`\x00${r.length-1}\x00`)),a=i.includes(`YYYY`),o=i.includes(`SSS`),s=i.includes(`MM`),c=i.includes(`DD`),l=i.includes(`HH`),u=i.includes(`mm`),d=i.includes(`ss`),f=i.includes(`Z`);return new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let p=i;if(a&&(p=p.replace(/YYYY/g,String(n?e.getUTCFullYear():e.getFullYear()))),o){let t=n?e.getUTCMilliseconds():e.getMilliseconds();p=p.replace(/SSS/g,t<10?`00${t}`:t<100?`0${t}`:String(t))}return s&&(p=p.replace(/MM/g,Z[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,Z[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,Z[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,Z[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,Z[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:Ta(e))),r.length&&(p=p.replace(/\x00(\d+)\x00/g,(e,t)=>r[+t])),p})}formatAll(e){let t=e.length,n=Array(t),r=this.fn;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}};function Da(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Oa(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function ka(e,t,n,r){if(t)return e.trim();let i=e;return n&&(i=i.trimStart()),r&&(i=i.trimEnd()),i}function Aa(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,ee=a||o,te=r!==null&&r!==!1,b=te?String(r):``,x=i!==null&&i!==!1?String(i):``,S=[],C=[],w=[],T=``,ne=!1,E=0,re=0,ie=0,ae=0,D=null,oe=0,O=!1,se=!1;u===!0?O=!0:Array.isArray(u)?(D=u,oe=u.filter(e=>e!=null).length,Oa(u),O=!0,d||(se=!0)):typeof u==`function`&&(O=!0),e=e.replace(/\r\n/g,`
|
|
119
|
+
<a:theme xmlns:a="http://schemas.openxmlformats.org/drawingml/2006/main" name="Office Theme"> <a:themeElements> <a:clrScheme name="Office"> <a:dk1> <a:sysClr val="windowText" lastClr="000000"/> </a:dk1> <a:lt1> <a:sysClr val="window" lastClr="FFFFFF"/> </a:lt1> <a:dk2> <a:srgbClr val="1F497D"/> </a:dk2> <a:lt2> <a:srgbClr val="EEECE1"/> </a:lt2> <a:accent1> <a:srgbClr val="4F81BD"/> </a:accent1> <a:accent2> <a:srgbClr val="C0504D"/> </a:accent2> <a:accent3> <a:srgbClr val="9BBB59"/> </a:accent3> <a:accent4> <a:srgbClr val="8064A2"/> </a:accent4> <a:accent5> <a:srgbClr val="4BACC6"/> </a:accent5> <a:accent6> <a:srgbClr val="F79646"/> </a:accent6> <a:hlink> <a:srgbClr val="0000FF"/> </a:hlink> <a:folHlink> <a:srgbClr val="800080"/> </a:folHlink> </a:clrScheme> <a:fontScheme name="Office"> <a:majorFont> <a:latin typeface="Cambria"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Times New Roman"/> <a:font script="Hebr" typeface="Times New Roman"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="MoolBoran"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Times New Roman"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:majorFont> <a:minorFont> <a:latin typeface="Calibri"/> <a:ea typeface=""/> <a:cs typeface=""/> <a:font script="Jpan" typeface="MS Pゴシック"/> <a:font script="Hang" typeface="맑은 고딕"/> <a:font script="Hans" typeface="宋体"/> <a:font script="Hant" typeface="新細明體"/> <a:font script="Arab" typeface="Arial"/> <a:font script="Hebr" typeface="Arial"/> <a:font script="Thai" typeface="Tahoma"/> <a:font script="Ethi" typeface="Nyala"/> <a:font script="Beng" typeface="Vrinda"/> <a:font script="Gujr" typeface="Shruti"/> <a:font script="Khmr" typeface="DaunPenh"/> <a:font script="Knda" typeface="Tunga"/> <a:font script="Guru" typeface="Raavi"/> <a:font script="Cans" typeface="Euphemia"/> <a:font script="Cher" typeface="Plantagenet Cherokee"/> <a:font script="Yiii" typeface="Microsoft Yi Baiti"/> <a:font script="Tibt" typeface="Microsoft Himalaya"/> <a:font script="Thaa" typeface="MV Boli"/> <a:font script="Deva" typeface="Mangal"/> <a:font script="Telu" typeface="Gautami"/> <a:font script="Taml" typeface="Latha"/> <a:font script="Syrc" typeface="Estrangelo Edessa"/> <a:font script="Orya" typeface="Kalinga"/> <a:font script="Mlym" typeface="Kartika"/> <a:font script="Laoo" typeface="DokChampa"/> <a:font script="Sinh" typeface="Iskoola Pota"/> <a:font script="Mong" typeface="Mongolian Baiti"/> <a:font script="Viet" typeface="Arial"/> <a:font script="Uigh" typeface="Microsoft Uighur"/> <a:font script="Geor" typeface="Sylfaen"/> </a:minorFont> </a:fontScheme> <a:fmtScheme name="Office"> <a:fillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="35000"> <a:schemeClr val="phClr"> <a:tint val="37000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="15000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="1"/> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="100000"/> <a:shade val="100000"/> <a:satMod val="130000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:tint val="50000"/> <a:shade val="100000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:lin ang="16200000" scaled="0"/> </a:gradFill> </a:fillStyleLst> <a:lnStyleLst> <a:ln w="9525" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"> <a:shade val="95000"/> <a:satMod val="105000"/> </a:schemeClr> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="25400" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> <a:ln w="38100" cap="flat" cmpd="sng" algn="ctr"> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:prstDash val="solid"/> </a:ln> </a:lnStyleLst> <a:effectStyleLst> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="20000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="38000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> </a:effectStyle> <a:effectStyle> <a:effectLst> <a:outerShdw blurRad="40000" dist="23000" dir="5400000" rotWithShape="0"> <a:srgbClr val="000000"> <a:alpha val="35000"/> </a:srgbClr> </a:outerShdw> </a:effectLst> <a:scene3d> <a:camera prst="orthographicFront"> <a:rot lat="0" lon="0" rev="0"/> </a:camera> <a:lightRig rig="threePt" dir="t"> <a:rot lat="0" lon="0" rev="1200000"/> </a:lightRig> </a:scene3d> <a:sp3d> <a:bevelT w="63500" h="25400"/> </a:sp3d> </a:effectStyle> </a:effectStyleLst> <a:bgFillStyleLst> <a:solidFill> <a:schemeClr val="phClr"/> </a:solidFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="40000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="40000"> <a:schemeClr val="phClr"> <a:tint val="45000"/> <a:shade val="99000"/> <a:satMod val="350000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="20000"/> <a:satMod val="255000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="-80000" r="50000" b="180000"/> </a:path> </a:gradFill> <a:gradFill rotWithShape="1"> <a:gsLst> <a:gs pos="0"> <a:schemeClr val="phClr"> <a:tint val="80000"/> <a:satMod val="300000"/> </a:schemeClr> </a:gs> <a:gs pos="100000"> <a:schemeClr val="phClr"> <a:shade val="30000"/> <a:satMod val="200000"/> </a:schemeClr> </a:gs> </a:gsLst> <a:path path="circle"> <a:fillToRect l="50000" t="50000" r="50000" b="50000"/> </a:path> </a:gradFill> </a:bgFillStyleLst> </a:fmtScheme> </a:themeElements> <a:objectDefaults> <a:spDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="1"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="3"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="2"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="lt1"/> </a:fontRef> </a:style> </a:spDef> <a:lnDef> <a:spPr/> <a:bodyPr/> <a:lstStyle/> <a:style> <a:lnRef idx="2"> <a:schemeClr val="accent1"/> </a:lnRef> <a:fillRef idx="0"> <a:schemeClr val="accent1"/> </a:fillRef> <a:effectRef idx="1"> <a:schemeClr val="accent1"/> </a:effectRef> <a:fontRef idx="minor"> <a:schemeClr val="tx1"/> </a:fontRef> </a:style> </a:lnDef> </a:objectDefaults> <a:extraClrSchemeLst/> </a:theme>`};Object.keys(n).forEach(t=>{let r=n[t],i=`xl/theme/${t}.xml`;e.append(r,{name:i})})}async addOfficeRels(t,n){let r=new K().toXml([{Id:`rId1`,Type:e.RelType.OfficeDocument,Target:`xl/workbook.xml`},{Id:`rId2`,Type:e.RelType.CoreProperties,Target:`docProps/core.xml`},{Id:`rId3`,Type:e.RelType.ExtenderProperties,Target:`docProps/app.xml`}]);t.append(r,{name:`_rels/.rels`})}async addWorkbookRels(t,n){let r=1,i=[{Id:`rId${r++}`,Type:e.RelType.Styles,Target:`styles.xml`},{Id:`rId${r++}`,Type:e.RelType.Theme,Target:`theme/theme1.xml`}];n.sharedStrings.count&&i.push({Id:`rId${r++}`,Type:e.RelType.SharedStrings,Target:`sharedStrings.xml`}),(n.pivotTables||[]).forEach(t=>{t.rId=`rId${r++}`,i.push({Id:t.rId,Type:e.RelType.PivotCacheDefinition,Target:`pivotCache/pivotCacheDefinition${t.tableNumber}.xml`})}),n.worksheets.forEach((t,n)=>{t.rId=`rId${r++}`,t.fileIndex=n+1,i.push({Id:t.rId,Type:e.RelType.Worksheet,Target:`worksheets/sheet${t.fileIndex}.xml`})});let a=new K().toXml(i);t.append(a,{name:`xl/_rels/workbook.xml.rels`})}async addSharedStrings(e,t){t.sharedStrings&&t.sharedStrings.count&&e.append(t.sharedStrings.xml,{name:`xl/sharedStrings.xml`})}async addStyles(e,t){let{xml:n}=t.styles;n&&e.append(n,{name:`xl/styles.xml`})}async addWorkbook(e,t){let n=new tr;e.append(n.toXml(t),{name:`xl/workbook.xml`})}async addWorksheets(e,t){let n=new hi,r=new K,i=new Yi,a=new ra;t.worksheets.forEach((t,o)=>{let s=t.fileIndex||o+1,c=new F;n.render(c,t),e.append(c.xml,{name:`xl/worksheets/sheet${s}.xml`}),t.rels&&t.rels.length&&(c=new F,r.render(c,t.rels),e.append(c.xml,{name:`xl/worksheets/_rels/sheet${s}.xml.rels`})),t.comments.length>0&&(c=new F,i.render(c,t),e.append(c.xml,{name:`xl/comments${s}.xml`}),c=new F,a.render(c,t),e.append(c.xml,{name:`xl/drawings/vmlDrawing${s}.vml`}))})}addDrawings(e,t){let n=new Mi,r=new K;t.worksheets.forEach(t=>{let{drawing:i}=t;if(i){n.prepare(i);let t=n.toXml(i);e.append(t,{name:`xl/drawings/${i.name}.xml`}),t=r.toXml(i.rels),e.append(t,{name:`xl/drawings/_rels/${i.name}.xml.rels`})}})}addTables(e,t){let n=new zi;t.worksheets.forEach(t=>{let{tables:r}=t;r.forEach(t=>{n.prepare(t,{});let r=n.toXml(t);e.append(r,{name:`xl/tables/${t.target}`})})})}addPivotTables(t,n){if(!n.pivotTables.length)return;let r=new Bi,i=new Ui,a=new Wi,o=new K;n.pivotTables.forEach(n=>{let s=n.tableNumber;if(n.isLoaded){if(n.cacheDefinition){let e=i.toXml(n.cacheDefinition);t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}if(n.cacheRecords){let e=r.toXml(n.cacheRecords);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`})}}else{let e=r.toXml(n);t.append(e,{name:`xl/pivotCache/pivotCacheRecords${s}.xml`}),e=i.toXml(n),t.append(e,{name:`xl/pivotCache/pivotCacheDefinition${s}.xml`})}let c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheRecords,Target:`pivotCacheRecords${s}.xml`}]);t.append(c,{name:`xl/pivotCache/_rels/pivotCacheDefinition${s}.xml.rels`}),c=a.toXml(n),t.append(c,{name:`xl/pivotTables/pivotTable${s}.xml`}),c=o.toXml([{Id:`rId1`,Type:e.RelType.PivotCacheDefinition,Target:`../pivotCache/pivotCacheDefinition${s}.xml`}]),t.append(c,{name:`xl/pivotTables/_rels/pivotTable${s}.xml.rels`})})}_finalize(e){return new Promise((t,n)=>{e.on(`finish`,()=>{t(this)}),e.on(`error`,n),e.finalize()})}prepareModel(e,t){e.creator=e.creator||`ExcelTS`,e.lastModifiedBy=e.lastModifiedBy||`ExcelTS`,e.created=e.created||new Date,e.modified=e.modified||new Date,e.useSharedStrings=t.useSharedStrings===void 0?!0:t.useSharedStrings,e.useStyles=t.useStyles===void 0?!0:t.useStyles,e.sharedStrings=new Rn,e.styles=e.useStyles?new jn(!0):new jn.Mock;let n=new tr,r=new hi;n.prepare(e);let i={sharedStrings:e.sharedStrings,styles:e.styles,date1904:e.properties.date1904,drawingsCount:0,media:e.media};i.drawings=e.drawings=[],i.commentRefs=e.commentRefs=[];let a=0;e.tables=[],e.worksheets.forEach(t=>{t.tables.forEach(t=>{a++,t.target=`table${a}.xml`,t.id=a,e.tables.push(t)}),r.prepare(t,i)})}},aa=class{constructor(e){this.listeners=new Map,this.ended=!1,this.data=e}async*[Symbol.asyncIterator](){yield this.data}on(e,t){let n=this.listeners.get(e)||[];return n.push(t),this.listeners.set(e,n),this.ended||(this.ended=!0,queueMicrotask(()=>{this.emit(`data`,this.data),this.emit(`end`)})),this}removeListener(e,t){let n=this.listeners.get(e)||[],r=n.indexOf(t);return r!==-1&&n.splice(r,1),this}emit(e,...t){(this.listeners.get(e)||[]).forEach(e=>e(...t))}pipe(e){return e.write(this.data instanceof Uint8Array?this.data:new TextEncoder().encode(this.data)),e.end(),e}},oa=class extends ia{createStreamBuf(){return new qt}createBinaryStream(e){return new aa(e)}createTextStream(e){return new aa(e)}bufferToString(e){return Me(e)}async load(e,t){let n;if(!e||typeof e==`object`&&!(e instanceof Uint8Array)&&!(e instanceof ArrayBuffer))throw Error(`Can't read the data of 'the loaded zip file'. Is it in a supported JavaScript type (String, Blob, ArrayBuffer, etc) ?`);n=t&&t.base64?he(e.toString()):e instanceof ArrayBuffer?new Uint8Array(e):e instanceof Uint8Array?e:new Uint8Array(e);let r=await new Mt(n).extractAll(),i={};for(let[e,t]of r)i[e]=t;return this.loadFromFiles(i,t)}async writeBuffer(e){e||={};let{model:t}=this.workbook,n=new Xt(e.zip),r=new qt;return n.pipe(r),this.prepareModel(t,e),await this.addContentTypes(n,t),await this.addOfficeRels(n,t),await this.addWorkbookRels(n,t),await this.addWorksheets(n,t),await this.addSharedStrings(n,t),this.addDrawings(n,t),this.addTables(n,t),this.addPivotTables(n,t),await Promise.all([this.addThemes(n,t),this.addStyles(n,t)]),await this.addMedia(n,t),await Promise.all([this.addApp(n,t),this.addCore(n,t)]),await this.addWorkbook(n,t),await this._finalize(n),ge.from(r.read())}async addMedia(e,t){await Promise.all(t.media.map(async t=>{if(t.type===`image`){let n=`xl/media/${t.name}.${t.extension}`;if(t.buffer)return e.append(t.buffer,{name:n});if(t.base64){let r=t.base64,i=r.substring(r.indexOf(`,`)+1);return e.append(i,{name:n,base64:!0})}throw Error(`Loading images from filename is not supported in browser`)}throw Error(`Unsupported media`)}))}};let Z=Array.from({length:60},(e,t)=>t<10?`0${t}`:`${t}`),Q=(e,t)=>(e.charCodeAt(t)-48)*10+e.charCodeAt(t+1)-48|0,sa=(e,t)=>(e.charCodeAt(t)-48)*1e3+(e.charCodeAt(t+1)-48)*100+(e.charCodeAt(t+2)-48)*10+e.charCodeAt(t+3)-48|0,ca=[0,31,29,31,30,31,30,31,31,30,31,30,31];function la(e,t,n){if(t<1||t>12||n<1||n>ca[t])return null;let r=new Date(e,t-1,n);return r.getMonth()===t-1?r:null}function ua(e,t,n,r,i,a){return t<1||t>12||n<1||n>ca[t]||r>23||i>59||a>59?null:new Date(e,t-1,n,r,i,a)}function da(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45?null:la(sa(e,0),Q(e,5),Q(e,8))}function fa(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==84||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function pa(e){return e.charCodeAt(4)!==45||e.charCodeAt(7)!==45||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,0),Q(e,5),Q(e,8),Q(e,11),Q(e,14),Q(e,17))}function ma(e){if(e.charCodeAt(19)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ha(e){if(e.charCodeAt(19)!==46||e.charCodeAt(23)!==90)return null;let t=new Date(e);return isNaN(t.getTime())?null:t}function ga(e){let t=e.charCodeAt(19);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function _a(e){if(e.charCodeAt(19)!==46)return null;let t=e.charCodeAt(23);if(t!==43&&t!==45)return null;let n=new Date(e);return isNaN(n.getTime())?null:n}function va(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:la(sa(e,6),Q(e,0),Q(e,3))}function ya(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t?null:la(sa(e,6),Q(e,3),Q(e,0))}function ba(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,6),Q(e,0),Q(e,3),Q(e,11),Q(e,14),Q(e,17))}function xa(e){let t=e.charCodeAt(2);return t!==45&&t!==47||e.charCodeAt(5)!==t||e.charCodeAt(10)!==32||e.charCodeAt(13)!==58||e.charCodeAt(16)!==58?null:ua(sa(e,6),Q(e,3),Q(e,0),Q(e,11),Q(e,14),Q(e,17))}let Sa={"YYYY-MM-DD":da,"YYYY-MM-DD[T]HH:mm:ss":fa,"YYYY-MM-DD HH:mm:ss":pa,"YYYY-MM-DD[T]HH:mm:ssZ":e=>e.length===20?ma(e):e.length===25?ga(e):null,"YYYY-MM-DD[T]HH:mm:ss.SSSZ":e=>e.length===24?ha(e):e.length===29?_a(e):null,"MM-DD-YYYY":va,"MM-DD-YYYY HH:mm:ss":ba,"MM/DD/YYYY HH:mm:ss":ba,"DD-MM-YYYY":ya,"DD-MM-YYYY HH:mm:ss":xa,"DD/MM/YYYY HH:mm:ss":xa},Ca=[[10,[da]],[19,[fa,pa]],[20,[ma]],[24,[ha]],[25,[ga]],[29,[_a]]];function wa(e){let t=-e.getTimezoneOffset(),n=t>=0?`+`:`-`,r=Math.abs(t)/60|0,i=Math.abs(t)%60;return`${n}${Z[r]}:${Z[i]}`}var Ta=class e{constructor(e){this.parse=e=>{if(!e)return null;let t=e.trim();if(!t)return null;if(this.single)return this.fn0(t);for(let e=0,n=this.fns.length;e<n;e++){let n=this.fns[e](t);if(n)return n}return null},this.fns=e,this.single=e.length===1,this.fn0=e[0]}static create(t){return new e(t.map(e=>Sa[e]).filter(Boolean))}static iso(){let t=[];for(let[,e]of Ca)t.push(...e);return new e(t)}parseAll(e){let t=e.length,n=Array(t),r=this.parse;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}parseValid(e){let t=[],n=this.parse;for(let r=0,i=e.length;r<i;r++){let i=n(e[r]);i&&t.push(i)}return t}},Ea=class e{constructor(e){this.format=e=>this.fn(e),this.fn=e}static iso(t=!1){return t?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getUTCFullYear(),r=e.getUTCMonth()+1,i=e.getUTCDate(),a=e.getUTCHours(),o=e.getUTCMinutes(),s=e.getUTCSeconds(),c=e.getUTCMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}Z`}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let n=e.getFullYear(),r=e.getMonth()+1,i=e.getDate(),a=e.getHours(),o=e.getMinutes(),s=e.getSeconds(),c=e.getMilliseconds();return`${n}-${Z[r]}-${Z[i]}T${Z[a]}:${Z[o]}:${Z[s]}.${c<10?`00`+c:c<100?`0`+c:c}${wa(e)}`})}static create(t,n){let r=n?.utc??!1;if(t===`YYYY-MM-DD`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]}`:``});if(t===`YYYY-MM-DD HH:mm:ss`)return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getUTCFullYear()}-${Z[e.getUTCMonth()+1]}-${Z[e.getUTCDate()]} ${Z[e.getUTCHours()]}:${Z[e.getUTCMinutes()]}:${Z[e.getUTCSeconds()]}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${e.getFullYear()}-${Z[e.getMonth()+1]}-${Z[e.getDate()]} ${Z[e.getHours()]}:${Z[e.getMinutes()]}:${Z[e.getSeconds()]}`:``});if(t===`MM-DD-YYYY`||t===`MM/DD/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCMonth()+1]}${n}${Z[e.getUTCDate()]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getMonth()+1]}${n}${Z[e.getDate()]}${n}${e.getFullYear()}`:``})}if(t===`DD-MM-YYYY`||t===`DD/MM/YYYY`){let n=t.charAt(2);return r?new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getUTCDate()]}${n}${Z[e.getUTCMonth()+1]}${n}${e.getUTCFullYear()}`:``}):new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();return t===t?`${Z[e.getDate()]}${n}${Z[e.getMonth()+1]}${n}${e.getFullYear()}`:``})}return e.createGeneric(t,r)}static createGeneric(t,n){let r=[],i=t.replace(/\[([^\]]*)\]/g,(e,t)=>(r.push(t),`\x00${r.length-1}\x00`)),a=i.includes(`YYYY`),o=i.includes(`SSS`),s=i.includes(`MM`),c=i.includes(`DD`),l=i.includes(`HH`),u=i.includes(`mm`),d=i.includes(`ss`),f=i.includes(`Z`);return new e(e=>{if(!(e instanceof Date))return``;let t=e.getTime();if(t!==t)return``;let p=i;if(a&&(p=p.replace(/YYYY/g,String(n?e.getUTCFullYear():e.getFullYear()))),o){let t=n?e.getUTCMilliseconds():e.getMilliseconds();p=p.replace(/SSS/g,t<10?`00${t}`:t<100?`0${t}`:String(t))}return s&&(p=p.replace(/MM/g,Z[n?e.getUTCMonth()+1:e.getMonth()+1])),c&&(p=p.replace(/DD/g,Z[n?e.getUTCDate():e.getDate()])),l&&(p=p.replace(/HH/g,Z[n?e.getUTCHours():e.getHours()])),u&&(p=p.replace(/mm/g,Z[n?e.getUTCMinutes():e.getMinutes()])),d&&(p=p.replace(/ss/g,Z[n?e.getUTCSeconds():e.getSeconds()])),f&&(p=p.replace(/Z/g,n?`Z`:wa(e))),r.length&&(p=p.replace(/\x00(\d+)\x00/g,(e,t)=>r[+t])),p})}formatAll(e){let t=e.length,n=Array(t),r=this.fn;for(let i=0;i<t;i++)n[i]=r(e[i]);return n}};function Da(e){return e.replace(/[.*+?^${}()|[\]\\]/g,`\\$&`)}function Oa(e){let t=new Set,n=[];for(let r of e)r!=null&&(t.has(r)&&n.push(r),t.add(r));if(n.length>0)throw Error(`Duplicate headers found ${JSON.stringify(n)}`)}function ka(e,t,n,r){if(t)return e.trim();let i=e;return n&&(i=i.trimStart()),r&&(i=i.trimEnd()),i}function Aa(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i=`"`,skipEmptyLines:a=!1,ignoreEmpty:o=!1,trim:s=!1,ltrim:c=!1,rtrim:l=!1,headers:u=!1,renameHeaders:d=!1,comment:f,maxRows:p,skipLines:m=0,skipRows:h=0,strictColumnHandling:g=!1,discardUnmappedColumns:_=!1,transform:v,validate:y}=t,ee=a||o,te=r!==null&&r!==!1,b=te?String(r):``,x=i!==null&&i!==!1?String(i):``,S=[],C=[],w=[],T=``,ne=!1,E=0,re=0,ie=0,ae=0,D=null,oe=0,O=!1,se=!1;u===!0?O=!0:Array.isArray(u)?(D=u,oe=u.filter(e=>e!=null).length,Oa(u),O=!0,d||(se=!0)):typeof u==`function`&&(O=!0),e=e.replace(/\r\n/g,`
|
|
120
120
|
`).replace(/\r/g,`
|
|
121
121
|
`);let k=e=>{if(O&&!se){if(typeof u==`function`){let t=u(e);Oa(t),D=t}else Array.isArray(u)||(Oa(e),D=e);return oe=D.filter(e=>e!=null).length,se=!0,!1}if(ae<h)return ae++,!1;if(D&&D.length>0){let t=oe,n=e.length;if(n>t){if(g&&!_)return C.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;e.length=D.length}else if(n<t){if(g)return C.push({row:e,reason:`Column header mismatch expected: ${t} columns got: ${n}`}),!1;for(;e.length<D.length;)e.push(``)}}return!0};for(;E<e.length;){let t=e[E],r=e[E+1];if(ne&&te)x&&t===x&&r===b?(T+=b,E+=2):t===b?(ne=!1,E++):(T+=t,E++);else if(te&&t===b&&T===``)ne=!0,E++;else if(t===n)w.push(ka(T,s,c,l)),T=``,E++;else if(t===`
|
|
122
122
|
`){if(w.push(ka(T,s,c,l)),T=``,re++,re<=m){w=[],E++;continue}if(f&&w[0]?.startsWith(f)){w=[],E++;continue}let e=w.length===1&&w[0]===``;if(ee&&e){w=[],E++;continue}if(k(w)&&(S.push(w),ie++),w=[],E++,p!==void 0&&ie>=p)break}else T+=t,E++}if((T!==``||w.length>0)&&(w.push(ka(T,s,c,l)),re>=m&&!(f&&w[0]?.startsWith(f)))){let e=w.length===1&&w[0]===``;ee&&e||p!==void 0&&ie>=p||k(w)&&S.push(w)}if(O&&D){let e=S.map(e=>{let t={};return D.forEach((n,r)=>{n!=null&&(t[n]=e[r]??``)}),t});if(v&&(e=e.map(e=>v(e)).filter(e=>e!=null)),y){let t=[];for(let n of e){let e=y(n);typeof e==`boolean`?e?t.push(n):C.push({row:Object.values(n),reason:`Validation failed`}):e.isValid?t.push(n):C.push({row:Object.values(n),reason:e.reason||`Validation failed`})}e=t}return(g||y)&&C.length>0?{headers:D.filter(e=>e!=null),rows:e,invalidRows:C}:{headers:D.filter(e=>e!=null),rows:e}}let A=S;if(v&&(A=A.map(e=>v(e)).filter(e=>e!=null)),y){let e=[],t=[];for(let n of A){let r=y(n);typeof r==`boolean`?r?e.push(n):t.push({row:n,reason:`Validation failed`}):r.isValid?e.push(n):t.push({row:n,reason:r.reason||`Validation failed`})}if(A=e,t.length>0)return{rows:A,invalidRows:t}}return A}function ja(e,t={}){let{delimiter:n=`,`,quote:r=`"`,escape:i,rowDelimiter:a=`
|
|
123
|
-
`,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m}=t,h=u??!0,g=r!==!1&&r!==null,_=g?String(r):``,v=i!==void 0&&i!==!1&&i!==null?String(i):_,y=[],ee=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},te=(e,t,r,i=!1)=>{if(e==null)return``;let a=String(e);if(!g)return a;let s=o||ee(t,r,i),c=RegExp(`[${Da(n)}${Da(_)}\r\n]`);return s||c.test(a)?_+a.replace(new RegExp(Da(_),`g`),v+_)+_:a},b=(e,t,r=!1)=>e.map((e,n)=>te(e,n,t?.[n],r)).join(n),x=null,S=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;x=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,x&&h&&y.push(b(x,x,!0));for(let e of t){let t=S(e);if(t==null)continue;let n=x?x.map(e=>t[e]):Object.values(t);y.push(b(n,x??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(x=l,h&&y.push(b(l,l,!0)));for(let e of t){let t=S(e);t!=null&&y.push(b(t,x??void 0))}}else p&&Array.isArray(l)&&h&&y.push(b(l,l,!0));let C=y.join(a);return C.length>0&&f&&(C+=a),d&&(C=``+C),C}let Ma={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function Na(e){let t=wa.create(e);return function(e){if(e===``)return null;let n=Number(e);if(!Number.isNaN(n)&&n!==1/0)return n;let r=t.parse(e);if(r)return r;let i=Ma[e];return i===void 0?e:i}}function Pa(e,t){let n=e?Ea.create(e,{utc:t}):Ea.iso(t);return function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink||e.text||``;if(e.formula||e.result)return e.result||``;if(e instanceof Date)return n.format(e);if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}}function Fa(e,t,n={}){let r=t.addWorksheet(n.sheetName),i=n.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`YYYY-MM-DD`],a=n.map||Na(i),o=Aa(e,n.parserOptions);for(let e of o)r.addRow(e.map(a));return r}function Ia(e,t={}){if(!e)return``;let{dateFormat:n,dateUTC:r}=t,i=t.map||Pa(n,r),a=t.includeEmptyRows!==!1,o=[],s=1;return e.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),ja(o,t.formatterOptions)}var La=class{constructor(e){this.workbook=e}load(e,t){let n;if(typeof e==`string`)n=e;else if(e instanceof ArrayBuffer)n=new TextDecoder(`utf-8`).decode(e);else if(e instanceof Uint8Array)n=new TextDecoder(`utf-8`).decode(e);else throw Error(`Invalid data type. Expected string, ArrayBuffer, or Uint8Array.`);return Fa(n,this.workbook,t)}writeString(e){return Ia(this.workbook.getWorksheet(e?.sheetName||e?.sheetId),e)}writeBuffer(e){let t=this.writeString(e);return new TextEncoder().encode(t)}async readFile(e,t){throw Error(`CSV.readFile() is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async read(e,t){throw Error(`CSV.read() stream is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async writeFile(e,t){throw Error(`CSV.writeFile() is not available in browser. Use CSV.writeString() or CSV.writeBuffer() and handle download manually.`)}write(e,t){throw Error(`CSV.write() stream is not available in browser. Use CSV.writeString() or CSV.writeBuffer() instead.`)}},Ra=class extends Ye{get xlsx(){return this._xlsx||=new oa(this),this._xlsx}get csv(){return this._csv||=new La(this),this._csv}static createStreamWriter(e){throw Error("Streaming workbook writer is not available in browser. Use `new Workbook()` with `xlsx.writeBuffer()` instead, or import from 'excelts' (Node.js) for streaming support.")}static createStreamReader(e,t){throw Error("Streaming workbook reader is not available in browser. Use `new Workbook()` with `xlsx.load()` instead, or import from 'excelts' (Node.js) for streaming support.")}};let za=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function Ba(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function Va(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 Ha(e,t){let n=10**t;return Math.round(e*n)/n}function Ua(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function Wa(e){return/^General$/i.test(e.trim())}function Ga(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let Ka=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],qa=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ja=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],Ya=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Xa=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Za(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=Te(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=Ua(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,Ja[c]).replace(/\x00MN4\x00/g,qa[c]).replace(/\x00MN3\x00/g,Ka[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,Xa[u]).replace(/\x00DN3\x00/g,Ya[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 Qa(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 $a(e,t){let n=(t.match(/%/g)||[]).length;return io(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function eo(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=Ha(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=Ba(Math.abs(s),2);return n+c+`E`+l+u}function to(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 no(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]=to(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 ro(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 io(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=``]=Ha(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=Va(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 ao(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 oo(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 so(e,t){if(typeof t==`string`){let n=lo(e);return n.length>=4&&n[3]?ao(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=lo(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&&oo(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 co(e,t){let n=lo(e);return n.length>=2&&n[1]===t}function lo(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}function uo(e,t){if(t==null)return``;if(Wa(e))return Qa(t);if(typeof t==`string`)return so(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=so(e,n);n<0&&co(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=Ua(i),i=ao(i),/\[[hms]+\]/i.test(i))return ro(n,i);if(Ga(i))return Za(n,i);if(i.includes(`%`))return $a(n,i);if(/E[+-]?/i.test(i))return eo(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return no(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+io(-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=io(n,i);return a+l+o}function fo(e){return e.getTime()/(24*3600*1e3)+25569}function po(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 mo(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 ho(e,t,n){if(e instanceof Date){let r=fo(e);return po(t)?(r%=1,r<0&&(r+=1),uo(t,r)):uo(n&&mo(t)?n:t,r)}return uo(t,e)}function go(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 ho(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 ho(e,i,t)}return e.text}function _o(e){return n.l2n(e.toUpperCase())-1}function vo(e){return n.n2l(e+1)}function yo(e){return parseInt(e,10)-1}function bo(e){return String(e+1)}function $(e){let t=n.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function xo(e){return n.encodeAddress(e.r+1,e.c+1)}function So(e){let t=e.indexOf(`:`);if(t===-1){let t=$(e);return{s:t,e:{...t}}}return{s:$(e.slice(0,t)),e:$(e.slice(t+1))}}function Co(e,t){if(t===void 0){let t=e;return Co(t.s,t.e)}let n=xo(e),r=xo(t);return n===r?n:`${n}:${r}`}function wo(e,t){let n=t||{},r=new Ra().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function To(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=$(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function Eo(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=So(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?go(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?go(a,n.dateFormat).trim():a.value,s=vo(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?go(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?go(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function Do(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
|
|
123
|
+
`,alwaysQuote:o=!1,quoteColumns:s=!1,quoteHeaders:c=!1,headers:l,writeHeaders:u,writeBOM:d=!1,includeEndRowDelimiter:f=!1,alwaysWriteHeaders:p=!1,transform:m}=t,h=u??!0,g=r!==!1&&r!==null,_=g?String(r):``,v=i!==void 0&&i!==!1&&i!==null?String(i):_,y=[],ee=(e,t,n=!1)=>{let r=n?c:s;return typeof r==`boolean`?r:Array.isArray(r)?r[e]===!0:typeof r==`object`&&t?r[t]===!0:!1},te=(e,t,r,i=!1)=>{if(e==null)return``;let a=String(e);if(!g)return a;let s=o||ee(t,r,i),c=RegExp(`[${Da(n)}${Da(_)}\r\n]`);return s||c.test(a)?_+a.replace(new RegExp(Da(_),`g`),v+_)+_:a},b=(e,t,r=!1)=>e.map((e,n)=>te(e,n,t?.[n],r)).join(n),x=null,S=e=>m&&m.length===1?m(e):e;if(e.length>0&&!Array.isArray(e[0])){let t=e;x=l===!0?Object.keys(t[0]):Array.isArray(l)?l:null,x&&h&&y.push(b(x,x,!0));for(let e of t){let t=S(e);if(t==null)continue;let n=x?x.map(e=>t[e]):Object.values(t);y.push(b(n,x??void 0))}}else if(e.length>0){let t=e;Array.isArray(l)&&(x=l,h&&y.push(b(l,l,!0)));for(let e of t){let t=S(e);t!=null&&y.push(b(t,x??void 0))}}else p&&Array.isArray(l)&&h&&y.push(b(l,l,!0));let C=y.join(a);return C.length>0&&f&&(C+=a),d&&(C=``+C),C}let Ma={true:!0,false:!1,"#N/A":{error:`#N/A`},"#REF!":{error:`#REF!`},"#NAME?":{error:`#NAME?`},"#DIV/0!":{error:`#DIV/0!`},"#NULL!":{error:`#NULL!`},"#VALUE!":{error:`#VALUE!`},"#NUM!":{error:`#NUM!`}};function Na(e){let t=Ta.create(e);return function(e){if(e===``)return null;let n=Number(e);if(!Number.isNaN(n)&&n!==1/0)return n;let r=t.parse(e);if(r)return r;let i=Ma[e];return i===void 0?e:i}}function Pa(e,t){let n=e?Ea.create(e,{utc:t}):Ea.iso(t);return function(e){if(e){if(e.text||e.hyperlink)return e.hyperlink||e.text||``;if(e.formula||e.result)return e.result||``;if(e instanceof Date)return n.format(e);if(e.error)return e.error;if(typeof e==`object`)return JSON.stringify(e)}return e}}function Fa(e,t,n={}){let r=t.addWorksheet(n.sheetName),i=n.dateFormats||[`YYYY-MM-DD[T]HH:mm:ssZ`,`YYYY-MM-DD[T]HH:mm:ss`,`YYYY-MM-DD`],a=n.map||Na(i),o=Aa(e,n.parserOptions);for(let e of o)r.addRow(e.map(a));return r}function Ia(e,t={}){if(!e)return``;let{dateFormat:n,dateUTC:r}=t,i=t.map||Pa(n,r),a=t.includeEmptyRows!==!1,o=[],s=1;return e.eachRow((e,t)=>{if(a)for(;s++<t-1;)o.push([]);let{values:n}=e;n.shift(),o.push(n.map(i)),s=t}),ja(o,t.formatterOptions)}var La=class{constructor(e){this.workbook=e}load(e,t){let n;if(typeof e==`string`)n=e;else if(e instanceof ArrayBuffer)n=new TextDecoder(`utf-8`).decode(e);else if(e instanceof Uint8Array)n=new TextDecoder(`utf-8`).decode(e);else throw Error(`Invalid data type. Expected string, ArrayBuffer, or Uint8Array.`);return Fa(n,this.workbook,t)}writeString(e){return Ia(this.workbook.getWorksheet(e?.sheetName||e?.sheetId),e)}writeBuffer(e){let t=this.writeString(e);return new TextEncoder().encode(t)}async readFile(e,t){throw Error(`CSV.readFile() is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async read(e,t){throw Error(`CSV.read() stream is not available in browser. Use CSV.load() with string or ArrayBuffer instead.`)}async writeFile(e,t){throw Error(`CSV.writeFile() is not available in browser. Use CSV.writeString() or CSV.writeBuffer() and handle download manually.`)}write(e,t){throw Error(`CSV.write() stream is not available in browser. Use CSV.writeString() or CSV.writeBuffer() instead.`)}},Ra=class extends Ye{get xlsx(){return this._xlsx||=new oa(this),this._xlsx}get csv(){return this._csv||=new La(this),this._csv}static createStreamWriter(e){throw Error("Streaming workbook writer is not available in browser. Use `new Workbook()` with `xlsx.writeBuffer()` instead, or import from 'excelts' (Node.js) for streaming support.")}static createStreamReader(e,t){throw Error("Streaming workbook reader is not available in browser. Use `new Workbook()` with `xlsx.load()` instead, or import from 'excelts' (Node.js) for streaming support.")}};let za=function(e){return e[e.Legal=5]=`Legal`,e[e.Executive=7]=`Executive`,e[e.A4=9]=`A4`,e[e.A5=11]=`A5`,e[e.B5=13]=`B5`,e[e.Envelope_10=20]=`Envelope_10`,e[e.Envelope_DL=27]=`Envelope_DL`,e[e.Envelope_C5=28]=`Envelope_C5`,e[e.Envelope_B5=34]=`Envelope_B5`,e[e.Envelope_Monarch=37]=`Envelope_Monarch`,e[e.Double_Japan_Postcard_Rotated=82]=`Double_Japan_Postcard_Rotated`,e[e.K16_197x273_mm=119]=`K16_197x273_mm`,e}({});function Ba(e,t){let n=Math.round(e).toString();for(;n.length<t;)n=`0`+n;return n}function Va(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 Ha(e,t){let n=10**t;return Math.round(e*n)/n}function Ua(e){let t=e.replace(/_./g,` `);return t=t.replace(/\*./g,``),t}function Wa(e){return/^General$/i.test(e.trim())}function Ga(e){let t=e.replace(/\[[^\]]*\]/g,``);return/[ymdhs]/i.test(t)&&!/^[#0.,E%$\s()\-+]+$/i.test(t)}let Ka=[`Jan`,`Feb`,`Mar`,`Apr`,`May`,`Jun`,`Jul`,`Aug`,`Sep`,`Oct`,`Nov`,`Dec`],qa=[`January`,`February`,`March`,`April`,`May`,`June`,`July`,`August`,`September`,`October`,`November`,`December`],Ja=[`J`,`F`,`M`,`A`,`M`,`J`,`J`,`A`,`S`,`O`,`N`,`D`],Ya=[`Sun`,`Mon`,`Tue`,`Wed`,`Thu`,`Fri`,`Sat`],Xa=[`Sunday`,`Monday`,`Tuesday`,`Wednesday`,`Thursday`,`Friday`,`Saturday`];function Za(e,t){let n=Math.round(e*86400)%86400,r=Math.floor(n/3600),i=Math.floor(n%3600/60),a=n%60,o=Te(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=Ua(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,Ja[c]).replace(/\x00MN4\x00/g,qa[c]).replace(/\x00MN3\x00/g,Ka[c]).replace(/\x00M2\x00/g,(c+1).toString().padStart(2,`0`)).replace(/\x00M1\x00/g,(c+1).toString()).replace(/\x00DN4\x00/g,Xa[u]).replace(/\x00DN3\x00/g,Ya[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 Qa(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 $a(e,t){let n=(t.match(/%/g)||[]).length;return io(e*100**n,t.replace(/%/g,``)||`0`)+`%`.repeat(n)}function eo(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=Ha(r/10**s,a).toFixed(a),l=s>=0?o?`+`:``:`-`,u=Ba(Math.abs(s),2);return n+c+`E`+l+u}function to(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 no(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]=to(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 ro(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 io(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=``]=Ha(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=Va(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 ao(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 oo(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 so(e,t){if(typeof t==`string`){let n=lo(e);return n.length>=4&&n[3]?ao(n[3]).replace(/@/g,t):t}if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=lo(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&&oo(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 co(e,t){let n=lo(e);return n.length>=2&&n[1]===t}function lo(e){let t=[],n=``,r=!1,i=!1;for(let a=0;a<e.length;a++){let o=e[a];o===`"`&&!i?(r=!r,n+=o):o===`[`&&!r?(i=!0,n+=o):o===`]`&&!r?(i=!1,n+=o):o===`;`&&!r&&!i?(t.push(n),n=``):n+=o}return t.push(n),t}function uo(e,t){if(t==null)return``;if(Wa(e))return Qa(t);if(typeof t==`string`)return so(e,t);if(typeof t==`boolean`)return t?`TRUE`:`FALSE`;let n=t,r=so(e,n);n<0&&co(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=Ua(i),i=ao(i),/\[[hms]+\]/i.test(i))return ro(n,i);if(Ga(i))return Za(n,i);if(i.includes(`%`))return $a(n,i);if(/E[+-]?/i.test(i))return eo(n,i);if(/\?+\s*\/\s*[\d?]+/.test(i))return no(n,i);if(i.includes(`(`)&&i.includes(`)`)&&n<0){let e=i.replace(/\(|\)/g,``);return`(`+io(-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=io(n,i);return a+l+o}function fo(e){return e.getTime()/(24*3600*1e3)+25569}function po(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 mo(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 ho(e,t,n){if(e instanceof Date){let r=fo(e);return po(t)?(r%=1,r<0&&(r+=1),uo(t,r)):uo(n&&mo(t)?n:t,r)}return uo(t,e)}function go(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 ho(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 ho(e,i,t)}return e.text}function _o(e){return n.l2n(e.toUpperCase())-1}function vo(e){return n.n2l(e+1)}function yo(e){return parseInt(e,10)-1}function bo(e){return String(e+1)}function $(e){let t=n.decodeAddress(e.toUpperCase());return{c:t.col-1,r:t.row-1}}function xo(e){return n.encodeAddress(e.r+1,e.c+1)}function So(e){let t=e.indexOf(`:`);if(t===-1){let t=$(e);return{s:t,e:{...t}}}return{s:$(e.slice(0,t)),e:$(e.slice(t+1))}}function Co(e,t){if(t===void 0){let t=e;return Co(t.s,t.e)}let n=xo(e),r=xo(t);return n===r?n:`${n}:${r}`}function wo(e,t){let n=t||{},r=new Ra().addWorksheet(`Sheet1`);if(e.length===0)return r;let i=new Set;e.forEach(e=>Object.keys(e).forEach(e=>i.add(e)));let a=n.header?[...n.header]:[...i];n.header&&i.forEach(e=>{a.includes(e)||a.push(e)});let o=1;n.skipHeader||(a.forEach((e,t)=>{r.getCell(o,t+1).value=e}),o++);for(let t of e)a.forEach((e,i)=>{let a=t[e];a===null&&n.nullError?r.getCell(o,i+1).value={error:`#NULL!`}:a!=null&&(r.getCell(o,i+1).value=a)}),o++;return r}function To(e,t,n){let r=n||{};if(t.length===0)return e;let i=1,a=1;if(r.origin!==void 0)if(typeof r.origin==`string`){let e=$(r.origin);i=e.r+1,a=e.c+1}else typeof r.origin==`number`?i=r.origin===-1?e.rowCount+1:r.origin+1:(i=r.origin.r+1,a=r.origin.c+1);let o=new Set;t.forEach(e=>Object.keys(e).forEach(e=>o.add(e)));let s=r.header?[...r.header]:[...o];r.header&&o.forEach(e=>{s.includes(e)||s.push(e)});let c=i;r.skipHeader||(s.forEach((t,n)=>{e.getCell(c,a+n).value=t}),c++);for(let n of t)s.forEach((t,i)=>{let o=n[t];o===null&&r.nullError?e.getCell(c,a+i).value={error:`#NULL!`}:o!=null&&(e.getCell(c,a+i).value=o)}),c++;return e}function Eo(e,t){let n=t||{},r=1,i=e.rowCount,a=1,o=e.columnCount;if(n.range!==void 0){if(typeof n.range==`number`)r=n.range+1;else if(typeof n.range==`string`){let e=So(n.range);r=e.s.r+1,i=e.e.r+1,a=e.s.c+1,o=e.e.c+1}}if(i<r||o<a)return[];let s=n.header;if(s===1){let t=[],s=n.blankrows!==!1;for(let c=r;c<=i;c++){let r=[],i=!0;for(let t=a;t<=o;t++){let o=e.getCell(c,t),s=n.raw===!1?go(o,n.dateFormat).trim():o.value;s!=null&&s!==``?(r[t-a]=s,i=!1):n.defval===void 0?r[t-a]=null:r[t-a]=n.defval}(!i||s)&&t.push(r)}return t}if(s===`A`){let t=[],s=n.blankrows===!0;for(let c=r;c<=i;c++){let r={},i=!0;for(let t=a;t<=o;t++){let a=e.getCell(c,t),o=n.raw===!1?go(a,n.dateFormat).trim():a.value,s=vo(t-1);o!=null&&o!==``?(r[s]=o,i=!1):n.defval!==void 0&&(r[s]=n.defval)}(!i||s)&&t.push(r)}return t}if(Array.isArray(s)){let t=[],c=n.blankrows===!0;for(let l=r;l<=i;l++){let r={},i=!0;for(let t=a;t<=o;t++){let o=t-a,c=s[o]??`__EMPTY_${o}`,u=e.getCell(l,t),d=n.raw===!1?go(u,n.dateFormat).trim():u.value;d!=null&&d!==``?(r[c]=d,i=!1):n.defval!==void 0&&(r[c]=n.defval)}(!i||c)&&t.push(r)}return t}let c=[],l={};for(let t=a;t<=o;t++){let n=e.getCell(r,t).value,i=n==null?`__EMPTY_${t-a}`:String(n);l[i]===void 0?l[i]=0:(l[i]++,i=`${i}_${l[i]}`),c.push(i)}let u=[],d=r+1,f=n.blankrows===!0;for(let t=d;t<=i;t++){let r={},i=!0;for(let s=a;s<=o;s++){let o=e.getCell(t,s),l=n.raw===!1?go(o,n.dateFormat).trim():o.value,u=c[s-a];l!=null&&l!==``?(r[u]=l,i=!1):n.defval!==void 0&&(r[u]=n.defval)}(!i||f)&&u.push(r)}return u}function Do(e,t){let n=t||{},r=n.FS??`,`,i=n.RS??`
|
|
124
124
|
`,a=[];return e.eachRow({includeEmpty:n.blankrows!==!1},(t,i)=>{let o=[],s=!0;for(t.eachCell({includeEmpty:!0},(e,t)=>{let i=``;e.value!=null&&(i=e.value instanceof Date?e.value.toISOString():typeof e.value==`object`?`result`in e.value?String(e.value.result??``):`text`in e.value?String(e.value.text??``):`richText`in e.value?e.value.richText.map(e=>e.text).join(``):String(e.value):String(e.value),s=!1),(n.forceQuotes||i.includes(r)||i.includes(`"`)||i.includes(`
|
|
125
125
|
`)||i.includes(`\r`))&&(i=`"${i.replace(/"/g,`""`)}"`),o.push(i)});o.length<e.columnCount;)o.push(``);(!s||n.blankrows!==!1)&&a.push(o.join(r))}),a.join(i)}function Oo(){return new Ra}function ko(e,t,n){let r=e.addWorksheet(n);t.eachRow({includeEmpty:!0},(e,t)=>{e.eachCell({includeEmpty:!0},(e,n)=>{let i=r.getCell(t,n);i.value=e.value,e.style&&(i.style=e.style)})}),t.columns?.forEach((e,t)=>{e&&r.columns[t]&&e.width&&(r.getColumn(t+1).width=e.width)})}function Ao(e,t){let n=new Ra().addWorksheet(`Sheet1`);if(e.length===0)return n;let r=1,i=1;if(t?.origin!==void 0)if(typeof t.origin==`string`){let e=$(t.origin);r=e.r+1,i=e.c+1}else typeof t.origin==`number`?r=t.origin+1:(r=t.origin.r+1,i=t.origin.c+1);return e.forEach((e,t)=>{e&&e.forEach((e,a)=>{e!=null&&(n.getCell(r+t,i+a).value=e)})}),n}function jo(e,t,n){if(t.length===0)return e;let r=1,i=1;if(n?.origin!==void 0)if(typeof n.origin==`string`){let e=$(n.origin);r=e.r+1,i=e.c+1}else typeof n.origin==`number`?r=n.origin===-1?e.rowCount+1:n.origin+1:(r=n.origin.r+1,i=n.origin.c+1);return t.forEach((t,n)=>{t&&t.forEach((t,a)=>{t!=null&&(e.getCell(r+n,i+a).value=t)})}),e}function Mo(e){let t=[];return e.eachRow({includeEmpty:!0},(e,n)=>{let r=[];e.eachCell({includeEmpty:!0},(e,t)=>{r[t-1]=e.value}),t[n-1]=r}),t}let No={decodeCol:_o,encodeCol:vo,decodeRow:yo,encodeRow:bo,decodeCell:$,encodeCell:xo,decodeRange:So,encodeRange:Co,jsonToSheet:wo,sheetAddJson:To,sheetToJson:Eo,sheetToCsv:Do,aoaToSheet:Ao,sheetAddAoa:jo,sheetToAoa:Mo,bookNew:Oo,bookAppendSheet:ko};return e.Anchor=le,e.Cell=b,e.Column=k,e.DataValidations=pe,e.DocumentType=s,e.Enums=u,e.ErrorValue=l,e.FormulaType=a,e.Image=ue,e.PaperSize=za,e.Range=r,e.ReadingOrder=c,e.RelationshipType=o,e.Row=se,e.Table=fe,e.ValueType=i,e.Workbook=Ra,e.Worksheet=Ue,e.aoaToSheet=Ao,e.bookAppendSheet=ko,e.bookNew=Oo,e.decodeCell=$,e.decodeCol=_o,e.decodeRange=So,e.decodeRow=yo,e.encodeCell=xo,e.encodeCol=vo,e.encodeRange=Co,e.encodeRow=bo,e.jsonToSheet=wo,e.sheetAddAoa=jo,e.sheetAddJson=To,e.sheetToAoa=Mo,e.sheetToCsv=Do,e.sheetToJson=Eo,e.utils=No,e})({});
|
|
@@ -7,6 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
9
9
|
exports.DateFormatter = exports.DateParser = void 0;
|
|
10
|
+
exports.mightBeDate = mightBeDate;
|
|
11
|
+
exports.parseDate = parseDate;
|
|
12
|
+
exports.formatDate = formatDate;
|
|
10
13
|
exports.getSupportedFormats = getSupportedFormats;
|
|
11
14
|
// ============================================================================
|
|
12
15
|
// Constants - Pre-computed lookup tables for zero-allocation operations
|
|
@@ -15,6 +18,7 @@ exports.getSupportedFormats = getSupportedFormats;
|
|
|
15
18
|
const PAD2 = Array.from({ length: 60 }, (_, i) => (i < 10 ? `0${i}` : `${i}`));
|
|
16
19
|
// Character codes for fast comparison
|
|
17
20
|
const C_0 = 48;
|
|
21
|
+
const C_9 = 57;
|
|
18
22
|
const C_DASH = 45;
|
|
19
23
|
const C_SLASH = 47;
|
|
20
24
|
const C_COLON = 58;
|
|
@@ -190,6 +194,158 @@ const AUTO_DETECT = [
|
|
|
190
194
|
[29, [parseISOMsOffset]]
|
|
191
195
|
];
|
|
192
196
|
// ============================================================================
|
|
197
|
+
// Public API
|
|
198
|
+
// ============================================================================
|
|
199
|
+
/**
|
|
200
|
+
* Quick pre-filter to reject non-date strings
|
|
201
|
+
*/
|
|
202
|
+
function mightBeDate(s) {
|
|
203
|
+
const len = s.length;
|
|
204
|
+
if (len < 10 || len > 30) {
|
|
205
|
+
return false;
|
|
206
|
+
}
|
|
207
|
+
const c0 = s.charCodeAt(0);
|
|
208
|
+
const c1 = s.charCodeAt(1);
|
|
209
|
+
// Must start with digits
|
|
210
|
+
if (c0 < C_0 || c0 > C_9 || c1 < C_0 || c1 > C_9) {
|
|
211
|
+
return false;
|
|
212
|
+
}
|
|
213
|
+
const c2 = s.charCodeAt(2);
|
|
214
|
+
// Either YYYY format (4 digits) or MM/DD format (separator at pos 2)
|
|
215
|
+
return (c2 >= C_0 && c2 <= C_9) || c2 === C_DASH || c2 === C_SLASH;
|
|
216
|
+
}
|
|
217
|
+
/**
|
|
218
|
+
* Parse a date string
|
|
219
|
+
*
|
|
220
|
+
* @param value - String to parse
|
|
221
|
+
* @param formats - Specific formats to try (optional, auto-detects ISO if omitted)
|
|
222
|
+
* @returns Date object or null
|
|
223
|
+
*
|
|
224
|
+
* @example
|
|
225
|
+
* parseDate("2024-12-26") // auto-detect ISO
|
|
226
|
+
* parseDate("12-26-2024", ["MM-DD-YYYY"]) // explicit US format
|
|
227
|
+
*/
|
|
228
|
+
function parseDate(value, formats) {
|
|
229
|
+
if (!value || typeof value !== "string") {
|
|
230
|
+
return null;
|
|
231
|
+
}
|
|
232
|
+
const s = value.trim();
|
|
233
|
+
if (!s) {
|
|
234
|
+
return null;
|
|
235
|
+
}
|
|
236
|
+
// Explicit formats
|
|
237
|
+
if (formats?.length) {
|
|
238
|
+
for (const fmt of formats) {
|
|
239
|
+
const result = PARSERS[fmt]?.(s);
|
|
240
|
+
if (result) {
|
|
241
|
+
return result;
|
|
242
|
+
}
|
|
243
|
+
}
|
|
244
|
+
return null;
|
|
245
|
+
}
|
|
246
|
+
// Auto-detect by length
|
|
247
|
+
const len = s.length;
|
|
248
|
+
for (const [l, parsers] of AUTO_DETECT) {
|
|
249
|
+
if (len === l) {
|
|
250
|
+
for (const p of parsers) {
|
|
251
|
+
const result = p(s);
|
|
252
|
+
if (result) {
|
|
253
|
+
return result;
|
|
254
|
+
}
|
|
255
|
+
}
|
|
256
|
+
}
|
|
257
|
+
}
|
|
258
|
+
return null;
|
|
259
|
+
}
|
|
260
|
+
/**
|
|
261
|
+
* Format a Date to string
|
|
262
|
+
*
|
|
263
|
+
* @param date - Date to format
|
|
264
|
+
* @param format - Format template (optional, defaults to ISO)
|
|
265
|
+
* @param utc - Use UTC time (default: false)
|
|
266
|
+
* @returns Formatted string or empty string if invalid
|
|
267
|
+
*
|
|
268
|
+
* @example
|
|
269
|
+
* formatDate(date) // "2024-12-26T10:30:00.000+08:00"
|
|
270
|
+
* formatDate(date, "YYYY-MM-DD", true) // "2024-12-26"
|
|
271
|
+
*/
|
|
272
|
+
function formatDate(date, format, utc = false) {
|
|
273
|
+
if (!(date instanceof Date)) {
|
|
274
|
+
return "";
|
|
275
|
+
}
|
|
276
|
+
const t = date.getTime();
|
|
277
|
+
if (t !== t) {
|
|
278
|
+
return "";
|
|
279
|
+
} // NaN check (faster than isNaN)
|
|
280
|
+
// Default ISO format - direct string building (faster than toISOString)
|
|
281
|
+
if (!format) {
|
|
282
|
+
if (utc) {
|
|
283
|
+
const y = date.getUTCFullYear();
|
|
284
|
+
const M = date.getUTCMonth() + 1;
|
|
285
|
+
const D = date.getUTCDate();
|
|
286
|
+
const H = date.getUTCHours();
|
|
287
|
+
const m = date.getUTCMinutes();
|
|
288
|
+
const s = date.getUTCSeconds();
|
|
289
|
+
const ms = date.getUTCMilliseconds();
|
|
290
|
+
return `${y}-${PAD2[M]}-${PAD2[D]}T${PAD2[H]}:${PAD2[m]}:${PAD2[s]}.${ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms}Z`;
|
|
291
|
+
}
|
|
292
|
+
const y = date.getFullYear();
|
|
293
|
+
const M = date.getMonth() + 1;
|
|
294
|
+
const D = date.getDate();
|
|
295
|
+
const H = date.getHours();
|
|
296
|
+
const m = date.getMinutes();
|
|
297
|
+
const s = date.getSeconds();
|
|
298
|
+
const ms = date.getMilliseconds();
|
|
299
|
+
return `${y}-${PAD2[M]}-${PAD2[D]}T${PAD2[H]}:${PAD2[m]}:${PAD2[s]}.${ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms}${tzOffset(date)}`;
|
|
300
|
+
}
|
|
301
|
+
// Fast paths for common formats
|
|
302
|
+
if (format === "YYYY-MM-DD") {
|
|
303
|
+
return utc
|
|
304
|
+
? `${date.getUTCFullYear()}-${PAD2[date.getUTCMonth() + 1]}-${PAD2[date.getUTCDate()]}`
|
|
305
|
+
: `${date.getFullYear()}-${PAD2[date.getMonth() + 1]}-${PAD2[date.getDate()]}`;
|
|
306
|
+
}
|
|
307
|
+
return renderFormat(date, format, utc);
|
|
308
|
+
}
|
|
309
|
+
function tzOffset(d) {
|
|
310
|
+
const off = -d.getTimezoneOffset();
|
|
311
|
+
const sign = off >= 0 ? "+" : "-";
|
|
312
|
+
const h = (Math.abs(off) / 60) | 0; // Bitwise OR faster than Math.floor
|
|
313
|
+
const m = Math.abs(off) % 60;
|
|
314
|
+
return `${sign}${PAD2[h]}:${PAD2[m]}`;
|
|
315
|
+
}
|
|
316
|
+
function renderFormat(d, fmt, utc) {
|
|
317
|
+
// Handle escaped sections [...]
|
|
318
|
+
const esc = [];
|
|
319
|
+
let out = fmt.replace(/\[([^\]]*)\]/g, (_, c) => {
|
|
320
|
+
esc.push(c);
|
|
321
|
+
return `\x00${esc.length - 1}\x00`;
|
|
322
|
+
});
|
|
323
|
+
// Get components once
|
|
324
|
+
const y = utc ? d.getUTCFullYear() : d.getFullYear();
|
|
325
|
+
const M = utc ? d.getUTCMonth() + 1 : d.getMonth() + 1;
|
|
326
|
+
const D = utc ? d.getUTCDate() : d.getDate();
|
|
327
|
+
const H = utc ? d.getUTCHours() : d.getHours();
|
|
328
|
+
const m = utc ? d.getUTCMinutes() : d.getMinutes();
|
|
329
|
+
const s = utc ? d.getUTCSeconds() : d.getSeconds();
|
|
330
|
+
const ms = utc ? d.getUTCMilliseconds() : d.getMilliseconds();
|
|
331
|
+
// Replace tokens
|
|
332
|
+
out = out
|
|
333
|
+
.replace(/YYYY/g, String(y))
|
|
334
|
+
.replace(/SSS/g, ms < 10 ? `00${ms}` : ms < 100 ? `0${ms}` : String(ms))
|
|
335
|
+
.replace(/MM/g, PAD2[M])
|
|
336
|
+
.replace(/DD/g, PAD2[D])
|
|
337
|
+
.replace(/HH/g, PAD2[H])
|
|
338
|
+
.replace(/mm/g, PAD2[m])
|
|
339
|
+
.replace(/ss/g, PAD2[s])
|
|
340
|
+
.replace(/Z/g, utc ? "Z" : tzOffset(d));
|
|
341
|
+
// Restore escaped
|
|
342
|
+
if (esc.length) {
|
|
343
|
+
// oxlint-disable-next-line no-control-regex
|
|
344
|
+
out = out.replace(/\x00(\d+)\x00/g, (_, i) => esc[+i]);
|
|
345
|
+
}
|
|
346
|
+
return out;
|
|
347
|
+
}
|
|
348
|
+
// ============================================================================
|
|
193
349
|
// High-performance batch processors (class-based for state encapsulation)
|
|
194
350
|
// ============================================================================
|
|
195
351
|
/**
|
|
@@ -263,13 +419,6 @@ class DateParser {
|
|
|
263
419
|
}
|
|
264
420
|
}
|
|
265
421
|
exports.DateParser = DateParser;
|
|
266
|
-
function tzOffset(d) {
|
|
267
|
-
const off = -d.getTimezoneOffset();
|
|
268
|
-
const sign = off >= 0 ? "+" : "-";
|
|
269
|
-
const h = (Math.abs(off) / 60) | 0; // Bitwise OR faster than Math.floor
|
|
270
|
-
const m = Math.abs(off) % 60;
|
|
271
|
-
return `${sign}${PAD2[h]}:${PAD2[m]}`;
|
|
272
|
-
}
|
|
273
422
|
/**
|
|
274
423
|
* Optimized date formatter for batch processing
|
|
275
424
|
*
|
|
@@ -11,6 +11,7 @@
|
|
|
11
11
|
const PAD2 = Array.from({ length: 60 }, (_, i) => (i < 10 ? `0${i}` : `${i}`));
|
|
12
12
|
// Character codes for fast comparison
|
|
13
13
|
const C_0 = 48;
|
|
14
|
+
const C_9 = 57;
|
|
14
15
|
const C_DASH = 45;
|
|
15
16
|
const C_SLASH = 47;
|
|
16
17
|
const C_COLON = 58;
|
|
@@ -186,6 +187,158 @@ const AUTO_DETECT = [
|
|
|
186
187
|
[29, [parseISOMsOffset]]
|
|
187
188
|
];
|
|
188
189
|
// ============================================================================
|
|
190
|
+
// Public API
|
|
191
|
+
// ============================================================================
|
|
192
|
+
/**
|
|
193
|
+
* Quick pre-filter to reject non-date strings
|
|
194
|
+
*/
|
|
195
|
+
export function mightBeDate(s) {
|
|
196
|
+
const len = s.length;
|
|
197
|
+
if (len < 10 || len > 30) {
|
|
198
|
+
return false;
|
|
199
|
+
}
|
|
200
|
+
const c0 = s.charCodeAt(0);
|
|
201
|
+
const c1 = s.charCodeAt(1);
|
|
202
|
+
// Must start with digits
|
|
203
|
+
if (c0 < C_0 || c0 > C_9 || c1 < C_0 || c1 > C_9) {
|
|
204
|
+
return false;
|
|
205
|
+
}
|
|
206
|
+
const c2 = s.charCodeAt(2);
|
|
207
|
+
// Either YYYY format (4 digits) or MM/DD format (separator at pos 2)
|
|
208
|
+
return (c2 >= C_0 && c2 <= C_9) || c2 === C_DASH || c2 === C_SLASH;
|
|
209
|
+
}
|
|
210
|
+
/**
|
|
211
|
+
* Parse a date string
|
|
212
|
+
*
|
|
213
|
+
* @param value - String to parse
|
|
214
|
+
* @param formats - Specific formats to try (optional, auto-detects ISO if omitted)
|
|
215
|
+
* @returns Date object or null
|
|
216
|
+
*
|
|
217
|
+
* @example
|
|
218
|
+
* parseDate("2024-12-26") // auto-detect ISO
|
|
219
|
+
* parseDate("12-26-2024", ["MM-DD-YYYY"]) // explicit US format
|
|
220
|
+
*/
|
|
221
|
+
export function parseDate(value, formats) {
|
|
222
|
+
if (!value || typeof value !== "string") {
|
|
223
|
+
return null;
|
|
224
|
+
}
|
|
225
|
+
const s = value.trim();
|
|
226
|
+
if (!s) {
|
|
227
|
+
return null;
|
|
228
|
+
}
|
|
229
|
+
// Explicit formats
|
|
230
|
+
if (formats?.length) {
|
|
231
|
+
for (const fmt of formats) {
|
|
232
|
+
const result = PARSERS[fmt]?.(s);
|
|
233
|
+
if (result) {
|
|
234
|
+
return result;
|
|
235
|
+
}
|
|
236
|
+
}
|
|
237
|
+
return null;
|
|
238
|
+
}
|
|
239
|
+
// Auto-detect by length
|
|
240
|
+
const len = s.length;
|
|
241
|
+
for (const [l, parsers] of AUTO_DETECT) {
|
|
242
|
+
if (len === l) {
|
|
243
|
+
for (const p of parsers) {
|
|
244
|
+
const result = p(s);
|
|
245
|
+
if (result) {
|
|
246
|
+
return result;
|
|
247
|
+
}
|
|
248
|
+
}
|
|
249
|
+
}
|
|
250
|
+
}
|
|
251
|
+
return null;
|
|
252
|
+
}
|
|
253
|
+
/**
|
|
254
|
+
* Format a Date to string
|
|
255
|
+
*
|
|
256
|
+
* @param date - Date to format
|
|
257
|
+
* @param format - Format template (optional, defaults to ISO)
|
|
258
|
+
* @param utc - Use UTC time (default: false)
|
|
259
|
+
* @returns Formatted string or empty string if invalid
|
|
260
|
+
*
|
|
261
|
+
* @example
|
|
262
|
+
* formatDate(date) // "2024-12-26T10:30:00.000+08:00"
|
|
263
|
+
* formatDate(date, "YYYY-MM-DD", true) // "2024-12-26"
|
|
264
|
+
*/
|
|
265
|
+
export function formatDate(date, format, utc = false) {
|
|
266
|
+
if (!(date instanceof Date)) {
|
|
267
|
+
return "";
|
|
268
|
+
}
|
|
269
|
+
const t = date.getTime();
|
|
270
|
+
if (t !== t) {
|
|
271
|
+
return "";
|
|
272
|
+
} // NaN check (faster than isNaN)
|
|
273
|
+
// Default ISO format - direct string building (faster than toISOString)
|
|
274
|
+
if (!format) {
|
|
275
|
+
if (utc) {
|
|
276
|
+
const y = date.getUTCFullYear();
|
|
277
|
+
const M = date.getUTCMonth() + 1;
|
|
278
|
+
const D = date.getUTCDate();
|
|
279
|
+
const H = date.getUTCHours();
|
|
280
|
+
const m = date.getUTCMinutes();
|
|
281
|
+
const s = date.getUTCSeconds();
|
|
282
|
+
const ms = date.getUTCMilliseconds();
|
|
283
|
+
return `${y}-${PAD2[M]}-${PAD2[D]}T${PAD2[H]}:${PAD2[m]}:${PAD2[s]}.${ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms}Z`;
|
|
284
|
+
}
|
|
285
|
+
const y = date.getFullYear();
|
|
286
|
+
const M = date.getMonth() + 1;
|
|
287
|
+
const D = date.getDate();
|
|
288
|
+
const H = date.getHours();
|
|
289
|
+
const m = date.getMinutes();
|
|
290
|
+
const s = date.getSeconds();
|
|
291
|
+
const ms = date.getMilliseconds();
|
|
292
|
+
return `${y}-${PAD2[M]}-${PAD2[D]}T${PAD2[H]}:${PAD2[m]}:${PAD2[s]}.${ms < 10 ? "00" + ms : ms < 100 ? "0" + ms : ms}${tzOffset(date)}`;
|
|
293
|
+
}
|
|
294
|
+
// Fast paths for common formats
|
|
295
|
+
if (format === "YYYY-MM-DD") {
|
|
296
|
+
return utc
|
|
297
|
+
? `${date.getUTCFullYear()}-${PAD2[date.getUTCMonth() + 1]}-${PAD2[date.getUTCDate()]}`
|
|
298
|
+
: `${date.getFullYear()}-${PAD2[date.getMonth() + 1]}-${PAD2[date.getDate()]}`;
|
|
299
|
+
}
|
|
300
|
+
return renderFormat(date, format, utc);
|
|
301
|
+
}
|
|
302
|
+
function tzOffset(d) {
|
|
303
|
+
const off = -d.getTimezoneOffset();
|
|
304
|
+
const sign = off >= 0 ? "+" : "-";
|
|
305
|
+
const h = (Math.abs(off) / 60) | 0; // Bitwise OR faster than Math.floor
|
|
306
|
+
const m = Math.abs(off) % 60;
|
|
307
|
+
return `${sign}${PAD2[h]}:${PAD2[m]}`;
|
|
308
|
+
}
|
|
309
|
+
function renderFormat(d, fmt, utc) {
|
|
310
|
+
// Handle escaped sections [...]
|
|
311
|
+
const esc = [];
|
|
312
|
+
let out = fmt.replace(/\[([^\]]*)\]/g, (_, c) => {
|
|
313
|
+
esc.push(c);
|
|
314
|
+
return `\x00${esc.length - 1}\x00`;
|
|
315
|
+
});
|
|
316
|
+
// Get components once
|
|
317
|
+
const y = utc ? d.getUTCFullYear() : d.getFullYear();
|
|
318
|
+
const M = utc ? d.getUTCMonth() + 1 : d.getMonth() + 1;
|
|
319
|
+
const D = utc ? d.getUTCDate() : d.getDate();
|
|
320
|
+
const H = utc ? d.getUTCHours() : d.getHours();
|
|
321
|
+
const m = utc ? d.getUTCMinutes() : d.getMinutes();
|
|
322
|
+
const s = utc ? d.getUTCSeconds() : d.getSeconds();
|
|
323
|
+
const ms = utc ? d.getUTCMilliseconds() : d.getMilliseconds();
|
|
324
|
+
// Replace tokens
|
|
325
|
+
out = out
|
|
326
|
+
.replace(/YYYY/g, String(y))
|
|
327
|
+
.replace(/SSS/g, ms < 10 ? `00${ms}` : ms < 100 ? `0${ms}` : String(ms))
|
|
328
|
+
.replace(/MM/g, PAD2[M])
|
|
329
|
+
.replace(/DD/g, PAD2[D])
|
|
330
|
+
.replace(/HH/g, PAD2[H])
|
|
331
|
+
.replace(/mm/g, PAD2[m])
|
|
332
|
+
.replace(/ss/g, PAD2[s])
|
|
333
|
+
.replace(/Z/g, utc ? "Z" : tzOffset(d));
|
|
334
|
+
// Restore escaped
|
|
335
|
+
if (esc.length) {
|
|
336
|
+
// oxlint-disable-next-line no-control-regex
|
|
337
|
+
out = out.replace(/\x00(\d+)\x00/g, (_, i) => esc[+i]);
|
|
338
|
+
}
|
|
339
|
+
return out;
|
|
340
|
+
}
|
|
341
|
+
// ============================================================================
|
|
189
342
|
// High-performance batch processors (class-based for state encapsulation)
|
|
190
343
|
// ============================================================================
|
|
191
344
|
/**
|
|
@@ -258,13 +411,6 @@ export class DateParser {
|
|
|
258
411
|
return out;
|
|
259
412
|
}
|
|
260
413
|
}
|
|
261
|
-
function tzOffset(d) {
|
|
262
|
-
const off = -d.getTimezoneOffset();
|
|
263
|
-
const sign = off >= 0 ? "+" : "-";
|
|
264
|
-
const h = (Math.abs(off) / 60) | 0; // Bitwise OR faster than Math.floor
|
|
265
|
-
const m = Math.abs(off) % 60;
|
|
266
|
-
return `${sign}${PAD2[h]}:${PAD2[m]}`;
|
|
267
|
-
}
|
|
268
414
|
/**
|
|
269
415
|
* Optimized date formatter for batch processing
|
|
270
416
|
*
|