@sheetxl/io-xlsx 0.7.28-beta.3 → 0.8.0-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/browser/cjs/BAtEL-5TLyoaPFDP.cjs +2 -0
- package/browser/cjs/Bg0e53JZa8vhmm5a.cjs +1 -0
- package/browser/cjs/CK5FFUvet6FnIYO_.cjs +5 -0
- package/browser/cjs/{BZsKjlEe8ttWIao7.cjs → DV6LeTEiiFUrZoxj.cjs} +1 -1
- package/browser/cjs/Db8YjGM6TG34c8aT.cjs +1 -0
- package/browser/cjs/index.cjs +1 -1
- package/browser/esm/{Da4uZFnis4q5dMxA.mjs → 4BWLu134ABlCQEtM.mjs} +928 -890
- package/browser/esm/{uIgz_sO2ZTlIJryO.mjs → BkNXyG6NC-w5Xo92.mjs} +2 -2
- package/browser/esm/{9k07cBjQx8ZMNU1r.mjs → BzQ_lPzc8C4OTIGZ.mjs} +2 -2
- package/browser/esm/{BwSyMclyk-t3Qsxs.mjs → CJknI8BYGSZr-4zS.mjs} +5 -5
- package/browser/esm/{DmzsYgxDBYYWxQWu.mjs → CLWzJJyoSrykkVLX.mjs} +2 -2
- package/browser/esm/{BjKFtNZckTyELfHX.mjs → Cok_fBIUCHDSrKw0.mjs} +260 -242
- package/browser/esm/{C0ftqc3PDJkuDjFG.mjs → Ctqql4O-3xj2K8vv.mjs} +2 -2
- package/browser/esm/{DofvhgOWFHBSl9vH.mjs → D-m_kQLaewdwuXaF.mjs} +743 -681
- package/browser/esm/{Wg4pN30I3RZmpjIf.mjs → Dj7D2nVdAZ3TiUks.mjs} +1460 -1392
- package/browser/esm/{DatxS1drpnPiN0bA.mjs → Dz1Dp8DDJvhd09RR.mjs} +1 -1
- package/browser/esm/{B1HdC5n0VHTzJXno.mjs → ijQzHH-bvDfUHIi1.mjs} +1 -1
- package/browser/esm/index.mjs +2 -2
- package/node/esm/{C9wIBQW-fwqlpFJm.mjs → CEAmv36xpTNgFwl_.mjs} +2 -2
- package/node/esm/{CUQy4BVE8DwTALUu.mjs → CEV7nKotMpeRRnQC.mjs} +1 -1
- package/node/esm/{BTiGUmPt1-zNmYTg.mjs → CF1R5ovFsRNu--Rw.mjs} +994 -950
- package/node/esm/{DWNfn3shRCVhbEOV.mjs → Ctcl4jN52INWpKWC.mjs} +197 -179
- package/node/esm/{BOF2zpi3fMaBFMe7.mjs → CvnRSooxEQdlJgMn.mjs} +741 -677
- package/node/esm/{zldOc2ba5Vlg1s2E.mjs → DQd0vxzTaPt2qSL-.mjs} +1 -1
- package/node/esm/{DYH_lfcyj9wTL8Er.mjs → fOnuUjpPCAzmuIXN.mjs} +2 -2
- package/node/esm/index.mjs +5 -5
- package/node/esm/{f9-SN-lQDdZGt0vO.mjs → ssSlRCbCqxvZ9IX8.mjs} +613 -545
- package/package.json +3 -3
- package/types/src/AutoFilterRules.d.ts +62 -0
- package/types/src/reader/dom/DOMTransformer.d.ts +10 -0
- package/types/src/reader/domVisitors/AutoFilterVisitor.d.ts +1 -1
- package/types/src/reader/sax/SaxVisitor.d.ts +14 -0
- package/types/src/writer/builder/EmitterRegistry.d.ts +7 -0
- package/types/src/writer/emitters/StylesEmitter.d.ts +13 -2
- package/types/src/writer/utils/AutoFilter.d.ts +3 -2
- package/browser/cjs/5QaWZ2tRVhz1rf3W.cjs +0 -1
- package/browser/cjs/Bi-WvoygX7yZzlxU.cjs +0 -5
- package/browser/cjs/D-8WoJkvdPf-79sB.cjs +0 -2
- package/browser/cjs/sEmMmxaNBSY_o-Zb.cjs +0 -1
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@sheetxl/io-xlsx",
|
|
3
3
|
"description": "SheetXL - Import/Export from/to Excel",
|
|
4
|
-
"version": "0.
|
|
4
|
+
"version": "0.8.0-beta.1",
|
|
5
5
|
"license": "SEE LICENSE IN <LICENSE>",
|
|
6
6
|
"type": "module",
|
|
7
7
|
"exports": {
|
|
@@ -45,8 +45,8 @@
|
|
|
45
45
|
"utilities"
|
|
46
46
|
],
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@sheetxl/sdk": "^0.
|
|
49
|
-
"@sheetxl/utils": "^0.
|
|
48
|
+
"@sheetxl/sdk": "^0.8.0-beta.1",
|
|
49
|
+
"@sheetxl/utils": "^0.8.0-beta.1",
|
|
50
50
|
"@xmldom/xmldom": "^0.9.10",
|
|
51
51
|
"@zip.js/zip.js": "^2.8.34",
|
|
52
52
|
"web-streams-polyfill": "^4.3.0",
|
|
@@ -0,0 +1,62 @@
|
|
|
1
|
+
import { ICondition } from '@sheetxl/sdk';
|
|
2
|
+
/**
|
|
3
|
+
* The border between OOXML's `customFilter` and the SDK's condition.
|
|
4
|
+
*
|
|
5
|
+
* @remarks
|
|
6
|
+
* `customFilter` is the third of OOXML's three condition systems, and the only one that had no
|
|
7
|
+
* border of its own: the reader passed `@operator` straight through as an SDK operator name and
|
|
8
|
+
* the writer switched SDK names against OOXML spellings. The two vocabularies overlap on exactly
|
|
9
|
+
* `lessThan` and `greaterThan`, so those worked and the other four did not — `greaterThanOrEqual`
|
|
10
|
+
* arrived as an operator no registry knew, and left again as `equal`.
|
|
11
|
+
*
|
|
12
|
+
* Both directions live in one file, as they do for data validations and conditional formats: they
|
|
13
|
+
* are one table, and a mapping whose halves drift apart is the bug the round-trip corpus exists to
|
|
14
|
+
* catch.
|
|
15
|
+
*
|
|
16
|
+
* Not handled here, deliberately: the wildcards Excel packs into `@val` for its text filters
|
|
17
|
+
* (`val="abc*"` under `equal` is "begins with abc"). Those need `*`/`?`/`~` escaping settled in
|
|
18
|
+
* both directions before `startsWith`/`contains`/`endsWith` can be inferred, and a half-done
|
|
19
|
+
* inference would turn a literal asterisk into a pattern.
|
|
20
|
+
*/
|
|
21
|
+
/** A `customFilter` in OOXML's own shape. Reader input, writer output — never persisted. */
|
|
22
|
+
export interface OOXMLCustomFilter {
|
|
23
|
+
operator?: string | null;
|
|
24
|
+
val?: string | null;
|
|
25
|
+
}
|
|
26
|
+
/** OOXML `customFilter/@operator` values (`ST_FilterOperator`). */
|
|
27
|
+
export declare const FilterOperator: {
|
|
28
|
+
readonly Equal: "equal";
|
|
29
|
+
readonly NotEqual: "notEqual";
|
|
30
|
+
readonly GreaterThan: "greaterThan";
|
|
31
|
+
readonly GreaterThanOrEqual: "greaterThanOrEqual";
|
|
32
|
+
readonly LessThan: "lessThan";
|
|
33
|
+
readonly LessThanOrEqual: "lessThanOrEqual";
|
|
34
|
+
};
|
|
35
|
+
export type FilterOperator = typeof FilterOperator[keyof typeof FilterOperator];
|
|
36
|
+
/** Whether a condition operator is one this border can spell as a `customFilter`. */
|
|
37
|
+
export declare function isComparison(operator: unknown): boolean;
|
|
38
|
+
/**
|
|
39
|
+
* `@val` ↦ condition param.
|
|
40
|
+
*
|
|
41
|
+
* @remarks
|
|
42
|
+
* `@val` is an attribute, so it always arrives as text, but a numeric spelling means the number:
|
|
43
|
+
* `equalTo` compares text to text and never coerces, so a numeric column filtered on `val="2"`
|
|
44
|
+
* would match nothing at all. This is the same reading the `'=2'` comparison shorthand takes.
|
|
45
|
+
*/
|
|
46
|
+
export declare function valToParam(val: string | null | undefined): string | number | undefined;
|
|
47
|
+
/** The inverse of {@link valToParam}. */
|
|
48
|
+
export declare function paramToVal(param: unknown): string | undefined;
|
|
49
|
+
/**
|
|
50
|
+
* Reads a `customFilter` as a condition.
|
|
51
|
+
*
|
|
52
|
+
* @returns The condition, or `null` when the element carries nothing to compare against.
|
|
53
|
+
*/
|
|
54
|
+
export declare function toCondition(filter: OOXMLCustomFilter, warn?: (message: string) => void): ICondition.JSON | null;
|
|
55
|
+
/**
|
|
56
|
+
* The inverse of {@link toCondition}.
|
|
57
|
+
*
|
|
58
|
+
* @returns `null` when the condition cannot be spelled as a `customFilter`; the caller warns and
|
|
59
|
+
* skips it rather than writing an element Excel would reject.
|
|
60
|
+
*/
|
|
61
|
+
export declare function fromCondition(condition: ICondition.JSON | undefined | null, warn?: (message: string) => void): OOXMLCustomFilter | null;
|
|
62
|
+
//# sourceMappingURL=AutoFilterRules.d.ts.map
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { IStyle } from '@sheetxl/sdk';
|
|
1
2
|
import { TransformerOptions } from './Types';
|
|
2
3
|
import { Visitor } from './Visitor';
|
|
3
4
|
import { ExecutionContext } from './ExecutionContext';
|
|
@@ -13,6 +14,15 @@ export declare class DOMTransformer {
|
|
|
13
14
|
private visitorParamsState;
|
|
14
15
|
constructor();
|
|
15
16
|
registerVisitor(nodeType: string, visitor: Visitor | null, path?: string | null): void;
|
|
17
|
+
/**
|
|
18
|
+
* Reads a standalone `dxf` element through the same visitor the `styles.xml` table uses.
|
|
19
|
+
*
|
|
20
|
+
* @remarks
|
|
21
|
+
* An `x14:dxf` is a differential style written inline in a worksheet rather than as an entry in
|
|
22
|
+
* the `dxfs` table, so it arrives from the streaming reader with no index to look up. The
|
|
23
|
+
* `processingDXFs` flag matters: a dxf's solid pattern fill has its colors inverted.
|
|
24
|
+
*/
|
|
25
|
+
parseDxf(elem: Element, location?: string): IStyle.JSON;
|
|
16
26
|
getVisitorParamsState(): Map<string, any>;
|
|
17
27
|
transform(xmlRootDoc: Document, location: string, options?: TransformerOptions): any;
|
|
18
28
|
protected _walkScoped(elemName: string, context: ExecutionContext, visited: VisitedRecord[], elemParent: Element, jsonParent: any, location: string, options: TransformerOptions): void;
|
|
@@ -10,7 +10,7 @@ import { Visitor, ExecutionContext } from '../dom';
|
|
|
10
10
|
export declare class AutoFilterVisitor implements Visitor {
|
|
11
11
|
visit(context: ExecutionContext, elem: Element, jsonTable: ITable.JSON): IFilter.JSON | undefined;
|
|
12
12
|
processColorFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
|
|
13
|
-
processCustomFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
|
|
13
|
+
processCustomFilter(context: ExecutionContext, elem: Element): ICondition.JSON | null;
|
|
14
14
|
processCustomFilters(context: ExecutionContext, elem: Element): ICondition.JSON;
|
|
15
15
|
processDynamicFilter(context: ExecutionContext, elem: Element): ICondition.JSON;
|
|
16
16
|
processDateGroupItem(context: ExecutionContext, elem: Element): ICondition.DateGroupItem;
|
|
@@ -18,6 +18,11 @@ export interface SAXExecutionContext<J = any> {
|
|
|
18
18
|
copyTo: (key: keyof J, mutator?: ValueMutator | ValueMutator[] | null, from?: string) => void;
|
|
19
19
|
copyToObject: <T>(object: Partial<T>, key: keyof T, mutator?: ValueMutator | ValueMutator[] | null, from?: string) => void;
|
|
20
20
|
parseAttribute: (from?: string, mutator?: ValueMutator | ValueMutator[] | null) => any | undefined;
|
|
21
|
+
/**
|
|
22
|
+
* The serialized children of the enclosing {@link SaxVisitor.raw} element, valid only inside its
|
|
23
|
+
* `closeTag`. `null` anywhere else.
|
|
24
|
+
*/
|
|
25
|
+
getRawXml(): string | null;
|
|
21
26
|
warn(message: string): void;
|
|
22
27
|
}
|
|
23
28
|
export interface SaxVisitor<J = any, P = any, C = any | void> {
|
|
@@ -44,6 +49,15 @@ export interface SaxVisitor<J = any, P = any, C = any | void> {
|
|
|
44
49
|
* `undefined` to continue with the current registry.
|
|
45
50
|
*/
|
|
46
51
|
scope?(context: SAXExecutionContext<J>): Map<string, SaxVisitor> | null | undefined;
|
|
52
|
+
/**
|
|
53
|
+
* Capture the element's children as raw XML instead of visiting them.
|
|
54
|
+
*
|
|
55
|
+
* @remarks
|
|
56
|
+
* No descendant is dispatched and no text event fires; `closeTag` reads the serialized subtree
|
|
57
|
+
* through {@link SAXExecutionContext.getRawXml}. For content whose reader is DOM-shaped — an
|
|
58
|
+
* inline `x14:dxf` — where restating it against the stream would fork the semantics.
|
|
59
|
+
*/
|
|
60
|
+
raw?: boolean;
|
|
47
61
|
openTag?(context: SAXExecutionContext<J>): C;
|
|
48
62
|
closeTag?(context: SAXExecutionContext<J>): void;
|
|
49
63
|
attribute?(attribute: string, value: string, context: SAXExecutionContext<J>): void;
|
|
@@ -25,5 +25,12 @@ export declare class EmitterRegistry {
|
|
|
25
25
|
* @returns True if an emitter for the kind is registered, false otherwise.
|
|
26
26
|
*/
|
|
27
27
|
has(kind: string): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Whether a registered emitter produces parts of the given relationship type — i.e. the model,
|
|
30
|
+
* not the source package, is authoritative for that kind of part.
|
|
31
|
+
*
|
|
32
|
+
* @param relTypeUri The relationship type URI.
|
|
33
|
+
*/
|
|
34
|
+
ownsRelType(relTypeUri: string): boolean;
|
|
28
35
|
}
|
|
29
36
|
//# sourceMappingURL=EmitterRegistry.d.ts.map
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { ITheme, IStyleCollection } from '@sheetxl/sdk';
|
|
2
|
-
import { Emitter, EmitContext } from '../builder';
|
|
1
|
+
import { IStyle, ITheme, IStyleCollection } from '@sheetxl/sdk';
|
|
2
|
+
import { Emitter, IXmlWriter, EmitContext } from '../builder';
|
|
3
3
|
/**
|
|
4
4
|
* Emits the styles.xml part.
|
|
5
5
|
*/
|
|
@@ -8,6 +8,17 @@ export declare class StylesEmitter extends Emitter<ModelHandle> {
|
|
|
8
8
|
/** @inheritdoc IEmitter.emit */
|
|
9
9
|
emit(handle: ModelHandle, ctx: EmitContext): Promise<void>;
|
|
10
10
|
}
|
|
11
|
+
/**
|
|
12
|
+
* Writes ONE differential format.
|
|
13
|
+
*
|
|
14
|
+
* @param tag The element name — `dxf` in the styles table, `x14:dxf` for a conditional format
|
|
15
|
+
* written x14-only, which carries its style inline because it has no legacy rule to
|
|
16
|
+
* hold a `dxfId`.
|
|
17
|
+
* @param numFmtId The next synthetic custom format id (see {@link writeDxfs}).
|
|
18
|
+
*
|
|
19
|
+
* @returns `numFmtId`, advanced if this dxf consumed one.
|
|
20
|
+
*/
|
|
21
|
+
export declare function writeDxf(ctx: EmitContext, xml: IXmlWriter, dxf: IStyle.Properties, styles: IStyleCollection, theme: ITheme, tag?: string, numFmtId?: number): number;
|
|
11
22
|
type ModelHandle = {
|
|
12
23
|
json: IStyleCollection.JSON;
|
|
13
24
|
styles: IStyleCollection;
|
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { ICondition, IRange, ITable, ISort, ICellRange } from '@sheetxl/sdk';
|
|
2
2
|
import { EmitContext, IXmlWriter } from '../builder';
|
|
3
3
|
export declare const writeSortState: (ctx: EmitContext, xml: IXmlWriter, model: ITable, json: ISort.JSON, range: ICellRange, coords: IRange.Coords) => void;
|
|
4
4
|
export declare const writeAutoFilter: (ctx: EmitContext, xml: IXmlWriter, model: ITable, json: ITable.JSON, isAutoTable?: boolean) => void;
|
|
5
|
-
|
|
5
|
+
/** Writes one `customFilter`, taking its OOXML spelling from the border. */
|
|
6
|
+
export declare const writeCustomFilter: (ctx: EmitContext, xml: IXmlWriter, condition: ICondition.JSON) => void;
|
|
6
7
|
/**
|
|
7
8
|
* In SheetXL we have rationalized the different types of conditions into a single
|
|
8
9
|
* structure. However, in the OOXML we have different structures for different
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
const e=require("./B7_pDFYCVzt-3hUs.cjs"),t=require("./DWkuoJSgvcXJTdN1.cjs"),n=require("./D-8WoJkvdPf-79sB.cjs");let r=require("@sheetxl/utils"),i=require("@sheetxl/sdk");var a=new Uint8Array,o=class e{constructor(e,t,n){this.buffers=new Map,this.zip=e,this.entries=t,this.rawBuffer=n}static normalize(e){return e.startsWith(`/`)?e.slice(1):e}static async create(t){let r=t instanceof Blob?a:t instanceof Uint8Array?t:new Uint8Array(t),i=new n.z(t instanceof Blob?new n.B(t):new n.U(r)),o=new Map;for(let e of await i.getEntries())e.directory||o.set(e.filename,e);return new e(i,o,r)}getNames(){return[...this.entries.keys()]}has(t){return this.entries.has(e.normalize(t))}uncompressedSize(t){return this.entries.get(e.normalize(t))?.uncompressedSize??0}async getBuffer(t){let r=e.normalize(t),i=this.buffers.get(r);if(i)return i;let a=this.entries.get(r);if(!a)return null;let o=await a.getData(new n.W);return this.buffers.set(r,o),o}async prefetch(e){let t=[];for(let[r,i]of this.entries)!this.buffers.has(r)&&e(r,i)&&t.push(i.getData(new n.W).then(e=>{this.buffers.set(r,e)}));await Promise.all(t)}getEntry(t){return this.buffers.get(e.normalize(t))??null}async getTextStream(t,n){let r=this.entries.get(e.normalize(t));if(!r)return null;let i=new TransformStream;r.getData(i.writable).catch(()=>{});let a=i.readable.getReader(),o=new TextDecoder(`utf-8`);return new ReadableStream({async pull(e){let{value:t,done:r}=await a.read();if(r){let t=o.decode();t&&e.enqueue(t),e.close();return}n?.(t.byteLength);let i=o.decode(t,{stream:!0});i&&e.enqueue(i)}}).getReader()}getRawEntry(t){let n=this.entries.get(e.normalize(t));if(!n||n.encrypted)return null;let r=n.offset;if(r+30>this.rawBuffer.byteLength)return null;let i=new DataView(this.rawBuffer.buffer,this.rawBuffer.byteOffset+r,30);if(i.getUint32(0,!0)!==67324752)return null;let a=r+30+i.getUint16(26,!0)+i.getUint16(28,!0),o=a+n.compressedSize;return o>this.rawBuffer.byteLength?null:{data:this.rawBuffer.subarray(a,o),compressionMethod:n.compressionMethod,signature:n.signature}}async close(){await this.zip.close()}},s=class{constructor(e){this._sink=e,this._samples=[],this._t0=c(),this._tPrev=this._t0,this._heapPrev=l()}mark(e){let t=c(),n=l(),r={label:e,tMs:t-this._t0,dtMs:t-this._tPrev,heapBytes:n,dHeapBytes:n!==void 0&&this._heapPrev!==void 0?n-this._heapPrev:void 0,rssBytes:u()};this._tPrev=t,this._heapPrev=n,this._samples.push(r),this._sink?.(r)}samples(){return this._samples}toTable(){return this._samples.map(e=>({phase:e.label,tMs:Math.round(e.tMs),dtMs:Math.round(e.dtMs),heapMB:e.heapBytes===void 0?`—`:d(e.heapBytes/1048576),dHeapMB:e.dHeapBytes===void 0?`—`:d(e.dHeapBytes/1048576),rssMB:e.rssBytes===void 0?`—`:d(e.rssBytes/1048576)}))}},c=typeof performance==`object`&&typeof performance.now==`function`?()=>performance.now():()=>Date.now();function l(){let e=typeof performance==`object`?performance.memory:void 0;if(e&&typeof e.usedJSHeapSize==`number`)return e.usedJSHeapSize;let t=globalThis.process;return typeof t==`object`&&typeof t.memoryUsage==`function`?t.memoryUsage().heapUsed:void 0}function u(){let e=globalThis.process;if(typeof e==`object`&&typeof e.memoryUsage==`function`)return e.memoryUsage().rss}function d(e){return Math.round(10*e)/10}var f=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,p=`-${f}.0-9·̀-ͯ‿-⁀`,m=(RegExp(`^[${f}]$`,`u`),RegExp(`^[${p}]$`,`u`),RegExp(`^[${f}][${p}]*$`,`u`)),h=(RegExp(`^[${p}]+$`,`u`),[32,10,13,9]);function g(e){return e>=65&&e<=90||e>=97&&e<=122||e===58||e===95||e===8204||e===8205||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}var _=`:A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ-⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,v=`-${_}.0-9·̀-ͯ‿-⁀`;RegExp(`^[${_}]$`,`u`),RegExp(`^[${v}]$`,`u`),RegExp(`^[${_}][${v}]*$`,`u`),RegExp(`^[${v}]+$`,`u`);var y=`A-Z_a-zÀ-ÖØ-öø-˿Ͱ-ͽͿ--⁰-Ⰰ-、-豈-﷏ﷰ-�𐀀-`,b=`-${y}.0-9·̀-ͯ‿-⁀`,x=(RegExp(`^[${y}]$`,`u`),RegExp(`^[${b}]$`,`u`),RegExp(`^[${y}][${b}]*$`,`u`));function ee(e){return e>=65&&e<=90||e===95||e>=97&&e<=122||e>=192&&e<=214||e>=216&&e<=246||e>=248&&e<=767||e>=880&&e<=893||e>=895&&e<=8191||e>=8204&&e<=8205||e>=8304&&e<=8591||e>=11264&&e<=12271||e>=12289&&e<=55295||e>=63744&&e<=64975||e>=65008&&e<=65533||e>=65536&&e<=983039}var S=function(e){return e===32||e===10||e===13||e===9},C=function(e){return e>=32&&e<=55295||e===10||e===13||e===9||e>=57344&&e<=65533||e>=65536&&e<=1114111},w=g,T=function(e){return g(e)||e>=48&&e<=57||e===45||e===46||e===183||e>=768&&e<=879||e>=8255&&e<=8256},E=h,D=m,te=function(e){return e>=1&&e<=55295||e>=57344&&e<=65533||e>=65536&&e<=1114111},O=ee,k=function(e){return ee(e)||e===45||e===46||e>=48&&e<=57||e===183||e>=768&&e<=879||e>=8255&&e<=8256},A=x,j=`http://www.w3.org/XML/1998/namespace`,M=`http://www.w3.org/2000/xmlns/`,N={__proto__:null,xml:j,xmlns:M},P={__proto__:null,amp:`&`,gt:`>`,lt:`<`,quot:`"`,apos:`'`},F=-1,I=-2,L=13,R=33,z=10,B=60,V=61,H=62,U=63,W=93,ne=e=>e===34||e===39,re=[34,39],ie=[...re,91,H],ae=[...re,B,W],oe=[V,U,...E],se=[...E,H,38,B];function G(e,t,n){switch(t){case`xml`:n!==j&&e.fail(`xml prefix must be bound to ${j}.`);break;case`xmlns`:n!==M&&e.fail(`xmlns prefix must be bound to ${M}.`)}switch(n){case M:e.fail(t===``?`the default namespace may not be set to ${n}.`:`may not assign a prefix (even "xmlns") to the URI ${M}.`);break;case j:switch(t){case`xml`:break;case``:e.fail(`the default namespace may not be set to ${n}.`);break;default:e.fail(`may not assign the xml namespace to another prefix.`)}}}var K,q,ce=e=>A.test(e),le=e=>D.test(e),J={xmldecl:`xmlDeclHandler`,text:`textHandler`,processinginstruction:`piHandler`,doctype:`doctypeHandler`,comment:`commentHandler`,opentagstart:`openTagStartHandler`,attribute:`attributeHandler`,opentag:`openTagHandler`,closetag:`closeTagHandler`,cdata:`cdataHandler`,error:`errorHandler`,end:`endHandler`,ready:`readyHandler`},Y=class{get closed(){return this._closed}constructor(e){this.i=0,this.prevI=0,this.opt=e??{},this.fragmentOpt=!!this.opt.fragment;let t=this.xmlnsOpt=!!this.opt.xmlns;if(this.trackPosition=!1!==this.opt.position,this.fileName=this.opt.fileName,t){this.nameStartCheck=O,this.nameCheck=k,this.isName=ce,this.processAttribs=this.processAttribsNS,this.pushAttrib=this.pushAttribNS,this.ns={__proto__:null,...N};let e=this.opt.additionalNamespaces;e!=null&&(function(e,t){for(let n of Object.keys(t))G(e,n,t[n])}(this,e),Object.assign(this.ns,e))}else this.nameStartCheck=w,this.nameCheck=T,this.isName=le,this.processAttribs=this.processAttribsPlain,this.pushAttrib=this.pushAttribPlain;this.stateTable=[this.sBegin,this.sBeginWhitespace,this.sDoctype,this.sDoctypeQuote,this.sDTD,this.sDTDQuoted,this.sDTDOpenWaka,this.sDTDOpenWakaBang,this.sDTDComment,this.sDTDCommentEnding,this.sDTDCommentEnded,this.sDTDPI,this.sDTDPIEnding,this.sText,this.sEntity,this.sOpenWaka,this.sOpenWakaBang,this.sComment,this.sCommentEnding,this.sCommentEnded,this.sCData,this.sCDataEnding,this.sCDataEnding2,this.sPIFirstChar,this.sPIRest,this.sPIBody,this.sPIEnding,this.sXMLDeclNameStart,this.sXMLDeclName,this.sXMLDeclEq,this.sXMLDeclValueStart,this.sXMLDeclValue,this.sXMLDeclSeparator,this.sXMLDeclEnding,this.sOpenTag,this.sOpenTagSlash,this.sAttrib,this.sAttribName,this.sAttribNameSawWhite,this.sAttribValue,this.sAttribValueQuoted,this.sAttribValueClosed,this.sAttribValueUnquoted,this.sCloseTag,this.sCloseTagSawWhite],this._init()}_init(){this.openWakaBang=``,this.text=``,this.name=``,this.piTarget=``,this.entity=``,this.q=null,this.tags=[],this.tag=null,this.topNS=null,this.chunk=``,this.chunkPosition=0,this.i=0,this.prevI=0,this.carriedFromPrevious=void 0,this.forbiddenState=0,this.attribList=[];let{fragmentOpt:e}=this;this.state=e?L:0,this.reportedTextBeforeRoot=this.reportedTextAfterRoot=this.closedRoot=this.sawRoot=e,this.xmlDeclPossible=!e,this.xmlDeclExpects=[`version`],this.entityReturnState=void 0;let{defaultXMLVersion:t}=this.opt;if(t===void 0){if(!0===this.opt.forceXMLVersion)throw Error(`forceXMLVersion set but defaultXMLVersion is not set`);t=`1.0`}this.setXMLVersion(t),this.positionAtNewLine=0,this.doctype=!1,this._closed=!1,this.xmlDecl={version:void 0,encoding:void 0,standalone:void 0},this.line=1,this.column=0,this.ENTITIES=Object.create(P),this.readyHandler?.()}get position(){return this.chunkPosition+this.i}get columnIndex(){return this.position-this.positionAtNewLine}on(e,t){this[J[e]]=t}off(e){this[J[e]]=void 0}makeError(e){let t=this.fileName??``;return this.trackPosition&&(t.length>0&&(t+=`:`),t+=`${this.line}:${this.column}`),t.length>0&&(t+=`: `),Error(t+e)}fail(e){let t=this.makeError(e),n=this.errorHandler;if(n===void 0)throw t;return n(t),this}write(e){if(this.closed)return this.fail(`cannot write after close.`);let t=!1;e===null?(t=!0,e=``):typeof e==`object`&&(e=e.toString()),this.carriedFromPrevious!==void 0&&(e=`${this.carriedFromPrevious}${e}`,this.carriedFromPrevious=void 0);let n=e.length,r=e.charCodeAt(n-1);!t&&(r===13||r>=55296&&r<=56319)&&(this.carriedFromPrevious=e[n-1],n--,e=e.slice(0,n));let{stateTable:i}=this;for(this.chunk=e,this.i=0;this.i<n;)i[this.state].call(this);return this.chunkPosition+=n,t?this.end():this}close(){return this.write(null)}getCode10(){let e=this.chunk,t=this.i;if(this.prevI=t,this.i++,t>=e.length)return F;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>=32||n===9)return n;switch(n){case z:return this.line++,this.column=0,this.positionAtNewLine=this.position,z;case 13:return e.charCodeAt(t+1)===z&&(this.i=t+2),this.line++,this.column=0,this.positionAtNewLine=this.position,I;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+1024*(n-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCode11(){let{chunk:e,i:t}=this;if(this.prevI=t,this.i=t+1,t>=e.length)return F;let n=e.charCodeAt(t);if(this.column++,n<55296){if(n>31&&n<127||n>159&&n!==8232||n===9)return n;switch(n){case z:return this.line++,this.column=0,this.positionAtNewLine=this.position,z;case 13:{let n=e.charCodeAt(t+1);n!==z&&n!==133||(this.i=t+2)}case 133:case 8232:return this.line++,this.column=0,this.positionAtNewLine=this.position,I;default:return this.fail(`disallowed character.`),n}}if(n>56319)return n>=57344&&n<=65533||this.fail(`disallowed character.`),n;let r=65536+1024*(n-55296)+(e.charCodeAt(t+1)-56320);return this.i=t+2,r>1114111&&this.fail(`disallowed character.`),r}getCodeNorm(){let e=this.getCode();return e===I?z:e}unGet(){this.i=this.prevI,this.column--}captureTo(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode(),i=r===I,a=i?z:r;if(a===F||e.includes(a))return this.text+=n.slice(t,this.prevI),a;i&&(this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i)}}captureToChar(e){let{i:t}=this,{chunk:n}=this;for(;;){let r=this.getCode();switch(r){case I:this.text+=`${n.slice(t,this.prevI)}\n`,t=this.i,r=z;break;case F:return this.text+=n.slice(t),!1}if(r===e)return this.text+=n.slice(t,this.prevI),!0}}captureNameChars(){let{chunk:e,i:t}=this;for(;;){let n=this.getCode();if(n===F)return this.name+=e.slice(t),F;if(!T(n))return this.name+=e.slice(t,this.prevI),n===I?z:n}}skipSpaces(){for(;;){let e=this.getCodeNorm();if(e===F||!S(e))return e}}setXMLVersion(e){this.currentXMLVersion=e,e===`1.0`?(this.isChar=C,this.getCode=this.getCode10):(this.isChar=te,this.getCode=this.getCode11)}sBegin(){this.chunk.charCodeAt(0)===65279&&(this.i++,this.column++),this.state=1}sBeginWhitespace(){let e=this.i,t=this.skipSpaces();switch(this.prevI!==e&&(this.xmlDeclPossible=!1),t){case B:if(this.state=15,this.text.length!==0)throw Error(`no-empty text at start`);break;case F:break;default:this.unGet(),this.state=L,this.xmlDeclPossible=!1}}sDoctype(){let e=this.captureTo(ie);switch(e){case H:this.doctypeHandler?.(this.text),this.text=``,this.state=L,this.doctype=!0;break;case F:break;default:this.text+=String.fromCodePoint(e),e===91?this.state=4:ne(e)&&(this.state=3,this.q=e)}}sDoctypeQuote(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.q=null,this.state=2)}sDTD(){let e=this.captureTo(ae);e!==F&&(this.text+=String.fromCodePoint(e),e===W?this.state=2:e===B?this.state=6:ne(e)&&(this.state=5,this.q=e))}sDTDQuoted(){let e=this.q;this.captureToChar(e)&&(this.text+=String.fromCodePoint(e),this.state=4,this.q=null)}sDTDOpenWaka(){let e=this.getCodeNorm();switch(this.text+=String.fromCodePoint(e),e){case 33:this.state=7,this.openWakaBang=``;break;case U:this.state=11;break;default:this.state=4}}sDTDOpenWakaBang(){let e=String.fromCodePoint(this.getCodeNorm()),t=this.openWakaBang+=e;this.text+=e,t!==`-`&&(this.state=t===`--`?8:4,this.openWakaBang=``)}sDTDComment(){this.captureToChar(45)&&(this.text+=`-`,this.state=9)}sDTDCommentEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),this.state=e===45?10:8}sDTDCommentEnded(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===H?this.state=4:(this.fail(`malformed comment.`),this.state=8)}sDTDPI(){this.captureToChar(U)&&(this.text+=`?`,this.state=12)}sDTDPIEnding(){let e=this.getCodeNorm();this.text+=String.fromCodePoint(e),e===H&&(this.state=4)}sText(){this.tags.length===0?this.handleTextOutsideRoot():this.handleTextInRoot()}sEntity(){let{i:e}=this,{chunk:t}=this;t:for(;;)switch(this.getCode()){case I:this.entity+=`${t.slice(e,this.prevI)}\n`,e=this.i;break;case 59:{let{entityReturnState:n}=this,r=this.entity+t.slice(e,this.prevI),i;this.state=n,r===``?(this.fail(`empty entity name.`),i=`&;`):(i=this.parseEntity(r),this.entity=``),n===L&&this.textHandler===void 0||(this.text+=i);break t}case F:this.entity+=t.slice(e);break t}}sOpenWaka(){let e=this.getCode();if(w(e))this.state=34,this.unGet(),this.xmlDeclPossible=!1;else switch(e){case 47:this.state=43,this.xmlDeclPossible=!1;break;case 33:this.state=16,this.openWakaBang=``,this.xmlDeclPossible=!1;break;case U:this.state=23;break;default:this.fail(`disallowed character in tag name`),this.state=L,this.xmlDeclPossible=!1}}sOpenWakaBang(){switch(this.openWakaBang+=String.fromCodePoint(this.getCodeNorm()),this.openWakaBang){case`[CDATA[`:this.sawRoot||this.reportedTextBeforeRoot||(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0),this.state=20,this.openWakaBang=``;break;case`--`:this.state=17,this.openWakaBang=``;break;case`DOCTYPE`:this.state=2,(this.doctype||this.sawRoot)&&this.fail(`inappropriately located doctype declaration.`),this.openWakaBang=``;break;default:this.openWakaBang.length>=7&&this.fail(`incorrect syntax.`)}}sComment(){this.captureToChar(45)&&(this.state=18)}sCommentEnding(){let e=this.getCodeNorm();e===45?(this.state=19,this.commentHandler?.(this.text),this.text=``):(this.text+=`-${String.fromCodePoint(e)}`,this.state=17)}sCommentEnded(){let e=this.getCodeNorm();e===H?this.state=L:(this.fail(`malformed comment.`),this.text+=`--${String.fromCodePoint(e)}`,this.state=17)}sCData(){this.captureToChar(W)&&(this.state=21)}sCDataEnding(){let e=this.getCodeNorm();e===W?this.state=22:(this.text+=`]${String.fromCodePoint(e)}`,this.state=20)}sCDataEnding2(){let e=this.getCodeNorm();switch(e){case H:this.cdataHandler?.(this.text),this.text=``,this.state=L;break;case W:this.text+=`]`;break;default:this.text+=`]]${String.fromCodePoint(e)}`,this.state=20}}sPIFirstChar(){let e=this.getCodeNorm();this.nameStartCheck(e)?(this.piTarget+=String.fromCodePoint(e),this.state=24):e===U||S(e)?(this.fail(`processing instruction without a target.`),this.state=e===U?26:25):(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(e),this.state=24)}sPIRest(){let{chunk:e,i:t}=this;for(;;){let n=this.getCodeNorm();if(n===F)return void(this.piTarget+=e.slice(t));if(!this.nameCheck(n)){this.piTarget+=e.slice(t,this.prevI);let r=n===U;r||S(n)?this.piTarget===`xml`?(this.xmlDeclPossible||this.fail(`an XML declaration must be at the start of the document.`),this.state=r?R:27):this.state=r?26:25:(this.fail(`disallowed character in processing instruction name.`),this.piTarget+=String.fromCodePoint(n));break}}}sPIBody(){if(this.text.length===0){let e=this.getCodeNorm();e===U?this.state=26:S(e)||(this.text=String.fromCodePoint(e))}else this.captureToChar(U)&&(this.state=26)}sPIEnding(){let e=this.getCodeNorm();if(e===H){let{piTarget:e}=this;e.toLowerCase()===`xml`&&this.fail(`the XML declaration must appear at the start of the document.`),this.piHandler?.({target:e,body:this.text}),this.piTarget=this.text=``,this.state=L}else e===U?this.text+=`?`:(this.text+=`?${String.fromCodePoint(e)}`,this.state=25);this.xmlDeclPossible=!1}sXMLDeclNameStart(){let e=this.skipSpaces();e===U?this.state=R:e!==F&&(this.state=28,this.name=String.fromCodePoint(e))}sXMLDeclName(){let e=this.captureTo(oe);if(e===U)return this.state=R,this.name+=this.text,this.text=``,void this.fail(`XML declaration is incomplete.`);if(S(e)||e===V){if(this.name+=this.text,this.text=``,!this.xmlDeclExpects.includes(this.name))switch(this.name.length){case 0:this.fail(`did not expect any more name/value pairs.`);break;case 1:this.fail(`expected the name ${this.xmlDeclExpects[0]}.`);break;default:this.fail(`expected one of ${this.xmlDeclExpects.join(`, `)}`)}this.state=e===V?30:29}}sXMLDeclEq(){let e=this.getCodeNorm();if(e===U)return this.state=R,void this.fail(`XML declaration is incomplete.`);S(e)||(e!==V&&this.fail(`value required.`),this.state=30)}sXMLDeclValueStart(){let e=this.getCodeNorm();if(e===U)return this.state=R,void this.fail(`XML declaration is incomplete.`);S(e)||(ne(e)?this.q=e:(this.fail(`value must be quoted.`),this.q=32),this.state=31)}sXMLDeclValue(){let e=this.captureTo([this.q,U]);if(e===U)return this.state=R,this.text=``,void this.fail(`XML declaration is incomplete.`);if(e===F)return;let t=this.text;switch(this.text=``,this.name){case`version`:{this.xmlDeclExpects=[`encoding`,`standalone`];let e=t;this.xmlDecl.version=e,/^1\.[0-9]+$/.test(e)?this.opt.forceXMLVersion||this.setXMLVersion(e):this.fail(`version number must match /^1\\.[0-9]+$/.`);break}case`encoding`:/^[A-Za-z][A-Za-z0-9._-]*$/.test(t)||this.fail(`encoding value must match /^[A-Za-z0-9][A-Za-z0-9._-]*$/.`),this.xmlDeclExpects=[`standalone`],this.xmlDecl.encoding=t;break;case`standalone`:t!==`yes`&&t!==`no`&&this.fail(`standalone value must match "yes" or "no".`),this.xmlDeclExpects=[],this.xmlDecl.standalone=t}this.name=``,this.state=32}sXMLDeclSeparator(){let e=this.getCodeNorm();e===U?this.state=R:(S(e)||(this.fail(`whitespace required.`),this.unGet()),this.state=27)}sXMLDeclEnding(){this.getCodeNorm()===H?(this.piTarget===`xml`?this.name!==`version`&&this.xmlDeclExpects.includes(`version`)&&this.fail(`XML declaration must contain a version.`):this.fail(`processing instructions are not allowed before root.`),this.xmlDeclHandler?.(this.xmlDecl),this.name=``,this.piTarget=this.text=``,this.state=L):this.fail(`The character ? is disallowed anywhere in XML declarations.`),this.xmlDeclPossible=!1}sOpenTag(){let e=this.captureNameChars();if(e===F)return;let t=this.tag={name:this.name,attributes:Object.create(null)};switch(this.name=``,this.xmlnsOpt&&(this.topNS=t.ns=Object.create(null)),this.openTagStartHandler?.(t),this.sawRoot=!0,!this.fragmentOpt&&this.closedRoot&&this.fail(`documents may contain only one root.`),e){case H:this.openTag();break;case 47:this.state=35;break;default:S(e)||this.fail(`disallowed character in tag name.`),this.state=36}}sOpenTagSlash(){this.getCode()===H?this.openSelfClosingTag():(this.fail(`forward-slash in opening tag not followed by >.`),this.state=36)}sAttrib(){let e=this.skipSpaces();e!==F&&(w(e)?(this.unGet(),this.state=37):e===H?this.openTag():e===47?this.state=35:this.fail(`disallowed character in attribute name.`))}sAttribName(){let e=this.captureNameChars();e===V?this.state=39:S(e)?this.state=38:e===H?(this.fail(`attribute without value.`),this.pushAttrib(this.name,this.name),this.name=this.text=``,this.openTag()):e!==F&&this.fail(`disallowed character in attribute name.`)}sAttribNameSawWhite(){let e=this.skipSpaces();switch(e){case F:return;case V:this.state=39;break;default:this.fail(`attribute without value.`),this.text=``,this.name=``,e===H?this.openTag():w(e)?(this.unGet(),this.state=37):(this.fail(`disallowed character in attribute name.`),this.state=36)}}sAttribValue(){let e=this.getCodeNorm();ne(e)?(this.q=e,this.state=40):S(e)||(this.fail(`unquoted attribute value.`),this.state=42,this.unGet())}sAttribValueQuoted(){let{q:e,chunk:t}=this,{i:n}=this;for(;;)switch(this.getCode()){case e:this.pushAttrib(this.name,this.text+t.slice(n,this.prevI)),this.name=this.text=``,this.q=null,this.state=41;return;case 38:this.text+=t.slice(n,this.prevI),this.state=14,this.entityReturnState=40;return;case z:case I:case 9:this.text+=`${t.slice(n,this.prevI)} `,n=this.i;break;case B:this.text+=t.slice(n,this.prevI),this.fail(`disallowed character.`);return;case F:this.text+=t.slice(n);return}}sAttribValueClosed(){let e=this.getCodeNorm();S(e)?this.state=36:e===H?this.openTag():e===47?this.state=35:w(e)?(this.fail(`no whitespace between attributes.`),this.unGet(),this.state=37):this.fail(`disallowed character in attribute name.`)}sAttribValueUnquoted(){let e=this.captureTo(se);switch(e){case 38:this.state=14,this.entityReturnState=42;break;case B:this.fail(`disallowed character.`);break;case F:break;default:this.text.includes(`]]>`)&&this.fail(`the string "]]>" is disallowed in char data.`),this.pushAttrib(this.name,this.text),this.name=this.text=``,e===H?this.openTag():this.state=36}}sCloseTag(){let e=this.captureNameChars();e===H?this.closeTag():S(e)?this.state=44:e!==F&&this.fail(`disallowed character in closing tag.`)}sCloseTagSawWhite(){switch(this.skipSpaces()){case H:this.closeTag();break;case F:break;default:this.fail(`disallowed character in closing tag.`)}}handleTextInRoot(){let{i:e,forbiddenState:t}=this,{chunk:n,textHandler:r}=this;t:for(;;)switch(this.getCode()){case B:if(this.state=15,r!==void 0){let{text:t}=this,i=n.slice(e,this.prevI);t.length===0?i.length!==0&&r(i):(r(t+i),this.text=``)}t=0;break t;case 38:this.state=14,this.entityReturnState=L,r!==void 0&&(this.text+=n.slice(e,this.prevI)),t=0;break t;case W:switch(t){case 0:t=1;break;case 1:t=2;break;case 2:break;default:throw Error(`impossible state`)}break;case H:t===2&&this.fail(`the string "]]>" is disallowed in char data.`),t=0;break;case I:r!==void 0&&(this.text+=`${n.slice(e,this.prevI)}\n`),e=this.i,t=0;break;case F:r!==void 0&&(this.text+=n.slice(e));break t;default:t=0}this.forbiddenState=t}handleTextOutsideRoot(){let{i:e}=this,{chunk:t,textHandler:n}=this,r=!1;t:for(;;){let i=this.getCode();switch(i){case B:if(this.state=15,n!==void 0){let{text:r}=this,i=t.slice(e,this.prevI);r.length===0?i.length!==0&&n(i):(n(r+i),this.text=``)}break t;case 38:this.state=14,this.entityReturnState=L,n!==void 0&&(this.text+=t.slice(e,this.prevI)),r=!0;break t;case I:n!==void 0&&(this.text+=`${t.slice(e,this.prevI)}\n`),e=this.i;break;case F:n!==void 0&&(this.text+=t.slice(e));break t;default:S(i)||(r=!0)}}r&&(this.sawRoot||this.reportedTextBeforeRoot||(this.fail(`text data outside of root node.`),this.reportedTextBeforeRoot=!0),this.closedRoot&&!this.reportedTextAfterRoot&&(this.fail(`text data outside of root node.`),this.reportedTextAfterRoot=!0))}pushAttribNS(e,t){let{prefix:n,local:r}=this.qName(e),i={name:e,prefix:n,local:r,value:t};if(this.attribList.push(i),this.attributeHandler?.(i),n===`xmlns`){let e=t.trim();this.currentXMLVersion===`1.0`&&e===``&&this.fail(`invalid attempt to undefine prefix in XML 1.0`),this.topNS[r]=e,G(this,r,e)}else if(e===`xmlns`){let e=t.trim();this.topNS[``]=e,G(this,``,e)}}pushAttribPlain(e,t){let n={name:e,value:t};this.attribList.push(n),this.attributeHandler?.(n)}end(){this.sawRoot||this.fail(`document must contain a root element.`);let{tags:e}=this;for(;e.length>0;){let t=e.pop();this.fail(`unclosed tag: ${t.name}`)}this.state!==0&&this.state!==L&&this.fail(`unexpected end.`);let{text:t}=this;return t.length!==0&&(this.textHandler?.(t),this.text=``),this._closed=!0,this.endHandler?.(),this._init(),this}resolve(e){let t=this.topNS[e];if(t!==void 0)return t;let{tags:n}=this;for(let r=n.length-1;r>=0;r--)if(t=n[r].ns[e],t!==void 0)return t;return t=this.ns[e],t===void 0?this.opt.resolvePrefix?.(e):t}qName(e){let t=e.indexOf(`:`);if(t===-1)return{prefix:``,local:e};let n=e.slice(t+1),r=e.slice(0,t);return(r===``||n===``||n.includes(`:`))&&this.fail(`malformed name: ${e}.`),{prefix:r,local:n}}processAttribsNS(){let{attribList:e}=this,t=this.tag;{let{prefix:e,local:n}=this.qName(t.name);t.prefix=e,t.local=n;let r=t.uri=this.resolve(e)??``;e!==``&&(e===`xmlns`&&this.fail(`tags may not have "xmlns" as prefix.`),r===``&&(this.fail(`unbound namespace prefix: ${JSON.stringify(e)}.`),t.uri=e))}if(e.length===0)return;let{attributes:n}=t,r=new Set;for(let t of e){let{name:e,prefix:i,local:a}=t,o,s;i===``?(o=e===`xmlns`?M:``,s=e):(o=this.resolve(i),o===void 0&&(this.fail(`unbound namespace prefix: ${JSON.stringify(i)}.`),o=i),s=`{${o}}${a}`),r.has(s)&&this.fail(`duplicate attribute: ${s}.`),r.add(s),t.uri=o,n[e]=t}this.attribList=[]}processAttribsPlain(){let{attribList:e}=this,t=this.tag.attributes;for(let{name:n,value:r}of e)t[n]!==void 0&&this.fail(`duplicate attribute: ${n}.`),t[n]=r;this.attribList=[]}openTag(){this.processAttribs();let{tags:e}=this,t=this.tag;t.isSelfClosing=!1,this.openTagHandler?.(t),e.push(t),this.state=L,this.name=``}openSelfClosingTag(){this.processAttribs();let{tags:e}=this,t=this.tag;t.isSelfClosing=!0,this.openTagHandler?.(t),this.closeTagHandler?.(t),(this.tag=e[e.length-1]??null)===null&&(this.closedRoot=!0),this.state=L,this.name=``}closeTag(){let{tags:e,name:t}=this;if(this.state=L,this.name=``,t===``)return this.fail(`weird empty close tag.`),void(this.text+=`</>`);let n=this.closeTagHandler,r=e.length;for(;r-->0;){let r=this.tag=e.pop();if(this.topNS=r.ns,n?.(r),r.name===t)break;this.fail(`unexpected close tag: ${t}.`)}r===0?this.closedRoot=!0:r<0&&(this.fail(`unmatched closing tag: ${t}.`),this.text+=`</${t}>`)}parseEntity(e){if(e[0]!==`#`){let t=this.ENTITIES[e];return t===void 0?(this.fail(this.isName(e)?`undefined entity.`:`disallowed character in entity name.`),`&${e};`):t}let t=NaN;return e[1]===`x`&&/^#x[0-9a-f]+$/i.test(e)?t=parseInt(e.slice(2),16):/^#[0-9]+$/.test(e)&&(t=parseInt(e.slice(1),10)),this.isChar(t)?String.fromCodePoint(t):(this.fail(`malformed character entity.`),`&${e};`)}};(q=K||={}).Events={XmlDecl:`xmldecl`,Text:`text`,ProcessingInstruction:`processinginstruction`,Doctype:`doctype`,Comment:`comment`,OpenTagStart:`opentagstart`,Attribute:`attribute`,OpenTag:`opentag`,CloseTag:`closetag`,CDdata:`cdata`,Error:`error`,End:`end`,Ready:`ready`},q.parseStream=async(e,t,n)=>{let r=new Y({position:!1,...n}),i;t.onOpenTagStart&&r.on(K.Events.OpenTagStart,t.onOpenTagStart),t.onOpenTag&&r.on(K.Events.OpenTag,t.onOpenTag),t.onCloseTag&&r.on(K.Events.CloseTag,t.onCloseTag),t.onAttribute&&r.on(K.Events.Attribute,t.onAttribute),t.onText&&r.on(K.Events.Text,t.onText),t.onError&&r.on(K.Events.Error,t.onError);let a=t.onEnd;for(a&&r.on(K.Events.End,()=>{i=a()});;){let{value:t,done:n}=await e.read();if(n)break;r.write(t)}return r.close(),i};var X=e=>!0===e||e===`1`||e===`on`||e===`true`||!1!==e&&e!==`0`&&e!==`off`&&e!==`false`&&null,Z=e=>{let t=parseInt(e);return isNaN(t)?null:t},Q=e=>{let t=parseFloat(e);return isNaN(t)?null:t},$=null,ue=class{constructor(){this._registeredVisitors=new Map}registerVisitor(e){this._registeredVisitors.set(e.from,e)}createEventHandler(e,t,n){let r=this._registeredVisitors,i=[],a=[],o=null,s=null,c=null,l=null,u=[],d={key:null,source:e,parent:null},f=null,p=!1,m=(e,t)=>{let n=c.attributes[e];if(t){if(Array.isArray(t)){let e=t.length;for(let r=0;r<e;r++)if(n==null||(n=t[r](n),n==null))return}else if(n==null||(n=t(n),n==null))return}return n},h={getSource:()=>f?.source??null,setSource:e=>{f.source=e},setKey:e=>{f.key=e},getFrom:()=>c,getAttribute:(e,t)=>m(e,t)??null,hasAttribute:e=>h.getAttribute(e)!==null,getParent:()=>{let e=u[u.length-2];return e.parent??e.source},getPath:()=>{let e=[],t=a.length;for(let n=0;n<t;n++)e.push(a[n].local);return e.join(`\\`)},parseAttribute:m,copyToObject:(e,t,n,r)=>{let i=m(r??t,n);i!==void 0&&(e[t]=i)},copyTo:(e,t,n)=>{let r=m(n??e,t);r!==void 0&&(f.source[e]=r)},warn:e=>{n?n?.(e):console.warn(e)}};return{onOpenTag:e=>{let t=e.name,n=t.indexOf(`:`);n!==-1&&(t=t.slice(n+1));let m=(i.length>0?i[i.length-1]:r).get(t);if(o={local:t,visitor:m,tag:e,destination:null},p)return a.push(o),s=t,void(c=e);l=o?.visitor??null,s=t,c=e;let g=!!m&&m.to===null;if(m&&!g&&m.scope){let e=m.scope(h);e===null?g=!0:e&&(i.push(e),o.pushedScope=!0)}m&&(a.length===0?(f=d,o.destination=f,o.pushedDestination=!0,u.push(f)):g?(f=null,o.destination=null):m.transparent?o.destination=f:(f={key:null,source:{},parent:null},o.destination=f,o.pushedDestination=!0,u.push(f))),a.push(o),p=g;let _=l?.openTag?.(h);_!==void 0&&(f.parent=_)},onCloseTag:e=>{let t=e.name,r=t.indexOf(`:`);if(r!==-1&&(t=t.slice(r+1)),t!==s)throw Error(`mismatch open/close tag: '${t}'/'${s}'`);p||l?.closeTag?.(h);let m=a.pop()??null;o=a[a.length-1]??null,m?.pushedScope&&i.pop();let g=m?.destination;if(g&&m.pushedDestination){u.pop(),f=u[u.length-1]??d;let e=m.visitor;e&&e.to&&g.source!==void 0&&(Array.isArray(e.to)?f.source.push?f.source.push(g.source):n?.(`Unable to parse array for ${e.from} at ${h.getPath()}`):g.key?f.source[g.key]=g.source:typeof e.to==`string`&&(f.source[e.to]=g.source))}s=o?.local??null,c=o?.tag??null,l=o?.visitor??null,p=!o?.destination},onText:e=>{l?.text?.(e,h)},onEnd:t}}},de=`IFERROR(${n.C}(`,fe=de.toUpperCase(),pe=n.S.toUpperCase(),me={kind:`none`},he={kind:`spilled`},ge=(e,t)=>{if(e.charCodeAt(t)!==34)return null;let n=``,r=t+1;for(;r<e.length;)if(e.charCodeAt(r)===34){if(e.charCodeAt(r+1)!==34)return{value:n,end:r+1};n+=`"`,r+=2}else n+=e[r],r++;return null},_e=e=>{let t=[],n=0;for(;n<e.length;){let r=e.charCodeAt(n);if(r===34){let t=ge(e,n);if(t===null)break;n=t.end;continue}if(!(r>=65&&r<=90||r>=97&&r<=122||r===95)){n++;continue}let i=n+1;for(;i<e.length;){let t=e.charCodeAt(i);if(!(t>=65&&t<=90||t>=97&&t<=122||t>=48&&t<=57||t===95||t===46))break;i++}e.charCodeAt(i)===40&&t.push(e.slice(n,i).toUpperCase().replace(/^_XLFN\./,``).replace(/^_XLWS\./,``)),n=i}return t},ve=e=>{let t=0,n=0;for(let r=0;r<e.length;r++){let i=e[r];if(i!==`"`&&i!==`'`){if(i===`[`)n++;else if(i===`]`)n>0&&n--;else if(n===0){if(i===`(`)t++;else if(i===`)`&&(t--,t<0))return!1}}else{for(r++;r<e.length;){if(e[r]===i){if(e[r+1]===i){r+=2;continue}break}r++}if(r>=e.length)return!1}}return t===0&&n===0},ye=class{static{this.Collapsed=1}static{this.CustomFormat=2}static{this.CustomHeight=4}static{this.Hidden=8}static{this.Ht=16}static{this.OutlineLevel=32}static{this.Ph=64}static{this.R=128}static{this.S=256}static{this.Spans=512}static{this.ThickBot=1024}static{this.ThickTop=2048}},be=(e,t,n)=>{if(e[0].value[0]===e[1].value[0])return t},xe={colStart:0,colEnd:0,rowStart:0,rowEnd:0},Se=(e,t,r,a,o,s,c)=>{let l=!1,u=!1,d=[],f=!1,p=null,m=null,h=null,g=null,_=null,v=null,y=c?.get(`richData`)??i.CommonUtils.EmptyArray,b=c?.get(`dummyWrapped`)??null,x=i.AddressUtils.normalizeA1ToR1C1,ee=i.CoordUtils.createConflatingRanges(),S=new Map,C=[],w=!1,T=!1,E=null,D=!1,te=i.CoordUtils.createConflatingRanges(),O=!1,k=-1,A=-1,j=null,M=null,N=null,P=[],F=null,I=-2,L=0,R=``,z=``,B=``,V=``,H=``,U=``,W=``,ne=``,re=``,ie=``,ae=``,oe=``,se=``,G=``,K=!0,q=null,ce=!1,le=!1,J=null,Y=0;return{...r,onEnd:()=>{P.length>0&&(t.rows=i.AddressUtils.runsToRefs(P,!1));let a=ee.done(be),o=a.length;if(o>0){let e=new Set;for(let t=0;t<C.length;t++)e.add(C[t][0].split(`:`)[0]);let r=Array(o);for(let t=0;t<o;t++){let o=a[t],s=i.AddressUtils.rangeToString(o),c=o.value[1],l=i.AddressUtils.resolveRelativeToA1(c,o.rowStart,o.colStart);l&&!e.has(s.split(`:`)[0])&&ve(l)&&(l=`${n.M}(${l})`),r[t]=[s,l]}t.formulas=r}let s=te.done(!0),c=s.length;if(c>0){let e=Array(c);for(let t=0;t<c;t++){let n=s[t];e[t]=i.AddressUtils.rangeToString(n)}t.volatile=e}C.length>0&&(t.formulaArray=[...C]);let l=d.length;if(l>0){d.sort(i.CoordUtils.createRangeComparator(i.IRange.Axis.Column));let e=d[0],n=e.colStart,r=e.colEnd,a=e.rowEnd,o=e.value,s=[];s.push(e);let c=null;for(let t=1;t<l;t++)c=d[t],o!==c.value||n!==c.colStart||r!==c.colEnd||a+1!==c.rowEnd?(s.push(c),e=c,n=e.colStart,r=e.colEnd,a=e.rowEnd,o=e.value):(a=c.rowEnd,e.rowEnd=a);let u=s.length,f=Array(u);for(let e=0;e<u;e++){let t=s[e];f[e]=[i.AddressUtils.rangeToString(t),t.value]}t.directStyles=f}let u=e.build();u&&(t.data=u.tuples),r?.onEnd?.()},onOpenTag:e=>{let n=e.name,a=n.indexOf(`:`);if(a!==-1&&(n=n.slice(a+1)),Y++,Y%196608==0&&o?.(Y),M){let t=e.attributes;switch(n){case`v`:u=!0;break;case`f`:switch(f=!0,t.t??null){case null:case`normal`:break;case`shared`:let e=t.si;m=t.ref,p=e;break;case`array`:m=t.ref,E=m;break;case`datatable`:m=t.ref,f=!0}let e=t.ca;e!==void 0&&(D=e===`1`);break;case`is`:O=!0;return}O&&!f&&s?.onOpenTag?.(e);return}if(l){if(n===`c`){M=e;let t=e.attributes,n=t.r;A=i.AddressUtils.fastStringToCol(n);let r=t.t;r===void 0?N=null:(N=r,N===`str`&&(O=!0));let a=t.s;a===void 0&&(J!==null||le)&&(a=`0`),a!==void 0&&(a=parseInt(a),q&&q.value===a&&q.colEnd+1===A?q.colEnd=A:(q={colStart:A,rowStart:k,colEnd:A,rowEnd:k,value:a},d.push(q))),E=null,T=!1;let o=t.cm;w=o!==void 0&&(e=>{let t=c?.get(`metadata`)?.cells;if(!t)return!1;let n=parseInt(e,10);return!(!Number.isFinite(n)||n<1)&&!0===t[n-1]?.get(`XLDAPR`)?.fDynamic})(o);let s=t.vm;if(s!==void 0){let e=y[parseInt(s)-1];if(i.FormulaError.isError(e)){let t=e.getCode();j={t:`e`,v:t},w&&t===i.FormulaError.Code.Spill&&(T=!0)}}}}else{if(n===`row`){l=!0;let t=e.attributes.r;if(k=parseInt(t)-1,L=0,z=e.attributes.customHeight,z!==void 0&&(L|=ye.CustomHeight),z!==re&&(K=!0,re=z),R=e.attributes.ht,R!==void 0&&(L|=ye.Ht),R!==ne&&(K=!0,ne=R),B=e.attributes.hidden,B!==void 0&&(L|=ye.Hidden),B!==ie&&(K=!0,ie=B),H=e.attributes.s,H!==void 0&&(L|=ye.S),H!==oe&&(K=!0,oe=H),V=e.attributes.customFormat,V!==void 0&&(L|=ye.CustomFormat),V!==ae&&(K=!0,ae=V),U=e.attributes.outlineLevel,U!==void 0&&(L|=ye.OutlineLevel),U!==se&&(K=!0,se=U),W=e.attributes.collapsed,W!==void 0&&(L|=ye.Collapsed),W!==G&&(K=!0,G=W),L!==0)if(I+1!==k||K){let e=z!==void 0&&(z===`1`||z===`true`),t=V!==void 0&&(V===`1`||V===`true`);J=t&&H!==void 0?H:null,t&&J===null&&(J=`0`),F={min:k,max:k,value:{sz:R===void 0?-1:parseFloat(R),csz:e,h:B!==void 0&&(B===`1`||B===`true`),s:J===null?void 0:J===`0`?0:parseInt(J),l:U===void 0||U===`0`?0:parseInt(U),cl:W!==void 0&&(W===`1`||W===`true`)}},P.push(F)}else F.max=k;I=k,K=!1;return}if(!ce&&n===`sheetData`){ce=!0;let e=t.cols,n=e?e.length:0;for(let t=0;!le&&t<n;t++)e[t].v.s&&(le=!0)}r?.onOpenTag?.(e)}},onCloseTag:t=>{let n=t.name;if(!f||n!==`c`&&n!==`f`||(p&&(g=S.get(p)??null),g&&(ee.append(k,A,g),D&&te.append(k,A)),E!==null&&C.push([E,w?T?`dynamicSpillError`:`dynamic`:`static`]),f=!1,g=null,p=null,m=null,u=!1,D=!1,E=null,w=!1,T=!1),M){let r=n.indexOf(`:`);if(r!==-1&&(n=n.slice(r+1)),O)if(n===`is`||n===`v`){let t=s?.onEnd?.();t!=null&&e.pushAt(k,A,``+t)}else n!==`f`&&s?.onCloseTag?.(t);u&&=!1,n===`c`&&(M=null,O=!1);return}if(l)return l=!1,void(q=null);r?.onCloseTag?.(t)},onText:n=>{let o=n.trim();if(u){switch(j=null,N){case null:case`n`:j=parseFloat(o);break;case`b`:j=o===`1`||o===`true`;break;case`s`:j=o;break;case`e`:if(o===`#VALUE!`){let e=M.attributes.vm;if(e!==void 0){let t=y[parseInt(e)-1];if(i.FormulaError.isError(t)){j={t:`e`,v:t.getCode()};break}}}let e=i.FormulaError.getBuiltInByLabel(o);e?j={t:`e`,v:e.getCode()}:(j=o,a?.(`Unknown formula error '${o}' in cell ${i.AddressUtils.cellToString({colIndex:A,rowIndex:k})}`));break;case`str`:case`inlineStr`:O=!0}j!==null&&e.pushAt(k,A,j)}if(p){if(_===p)g=v;else{if(g=S.get(p)??null,!g){let e=[];h=x(o,k,A,e),g=[h,e,o],S.set(p,g)}_=p,v=g}p=null}if(f){if(b!==null){let e=(e=>{if(e.length<de.length||e.slice(0,de.length).toUpperCase()!==fe)return me;let t=ge(e,de.length);if(t===null||e.charCodeAt(t.end)!==41||e.charCodeAt(t.end+1)!==44||e.charCodeAt(e.length-1)!==41)return me;let n=t.value;return n.toUpperCase()===pe?he:n.length===0?me:{kind:`formula`,formula:n}})(o);e.kind!==`none`&&b.push({sheet:t,rowIndex:k,colIndex:A,formula:e.kind===`formula`?e.formula:null})}let e=[];h=x(o,k,A,e),g=[h,e,o]}O?s?.onText?.(n):l||r?.onText?.(o)}}},Ce=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)},we={"application/vnd.openxmlformats-officedocument.spreadsheetml.sheet.main+xml":`workbooks`,"application/vnd.ms-excel.sheet.macroEnabled.main+xml":`workbooks`,"application/vnd.ms-excel.sheet.binary.macroEnabled.main":`workbooks`,"application/vnd.ms-excel.addin.macroEnabled.main+xml":`workbooks`,"application/vnd.openxmlformats-officedocument.spreadsheetml.template.main+xml":`workbooks`,"application/vnd.openxmlformats-officedocument.spreadsheetml.worksheet+xml":`sheets`,"application/vnd.ms-excel.worksheet":`sheets`,"application/vnd.openxmlformats-officedocument.spreadsheetml.chartsheet+xml":`charts`,"application/vnd.ms-excel.chartsheet":`charts`,"application/vnd.ms-excel.macrosheet+xml":`macros`,"application/vnd.ms-excel.macrosheet":`macros`,"application/vnd.openxmlformats-officedocument.spreadsheetml.dialogsheet+xml":`dialogs`,"application/vnd.ms-excel.dialogsheet":`dialogs`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sharedStrings+xml":`strs`,"application/vnd.ms-excel.sharedStrings":`strs`,"application/vnd.openxmlformats-officedocument.spreadsheetml.styles+xml":`styles`,"application/vnd.ms-excel.styles":`styles`,"application/vnd.openxmlformats-package.core-properties+xml":`coreprops`,"application/vnd.openxmlformats-officedocument.custom-properties+xml":`custprops`,"application/vnd.openxmlformats-officedocument.extended-properties+xml":`extprops`,"application/vnd.openxmlformats-officedocument.spreadsheetml.comments+xml":`comments`,"application/vnd.ms-excel.comments":`comments`,"application/vnd.ms-excel.threadedcomments+xml":`threadedcomments`,"application/vnd.ms-excel.person+xml":`people`,"application/vnd.openxmlformats-officedocument.spreadsheetml.sheetMetadata+xml":`metadata`,"application/vnd.ms-excel.sheetMetadata":`metadata`,"application/vnd.ms-excel.externalLink":`links`,"application/vnd.openxmlformats-officedocument.spreadsheetml.externalLink+xml":`links`,"application/vnd.openxmlformats-officedocument.theme+xml":`themes`},Te=e=>e.startsWith(`/`)?e.slice(1):e,Ee=/^xl\/(worksheets|chartsheets)\/[^/]+\.xml$/i;exports.readXLSX=async(a,c)=>{let{password:l,onVBA:u,profile:d,createWorkbookOptions:f={},...p}=c??{},m=f.origin&&typeof f.origin!=`string`?f.origin:null,h=d?new s(typeof d==`function`?d:void 0):null,g=[],_=c?.progress,v=_?.onProgress?_.onProgress.bind(_):void 0,y=a.byteLength,b=0,x=0,ee=v?e=>{if(b<=0)return;x+=e;let t=Math.min(y,Math.round(x/b*y));v(t,y)}:void 0,S=Promise.resolve().then(()=>require("./sEmMmxaNBSY_o-Zb.cjs")),C=null;try{C=new DOMParser}catch{}let w=null;try{w=new XMLSerializer}catch{}let T,E,D,te=null;C||(te=Promise.resolve().then(()=>e.r(require("./CIpMN7SDVREKQUQE.cjs").default,1)));try{let[e,t]=await Promise.all([te,S]);T=new t.DOMTransformer,E=C??new e.DOMParser,D=w??new e.XMLSerializer}catch(e){throw Error(`Unable to load XLSX parser.`,{cause:e})}let O=e=>D.serializeToString(e),k;try{k=await o.create(a)}catch(e){throw new r.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`,{cause:e})}h?.mark(`zip-open`);try{if(!k.has(`[Content_Types].xml`))throw new r.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`);let e=e=>{let t=k.getEntry(e);return t?{content:t}:void 0},a={workbooks:[],sheets:[],charts:[],dialogs:[],macros:[],strs:[],comments:[],threadedcomments:[],links:[],coreprops:[],extprops:[],custprops:[],themes:[],styles:[],metadata:[],people:[],sst:``,style:``,defaults:{}};{let e=((e,t)=>({onOpenTag:t=>{let n=(e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)})(t.name),r=t.attributes;if(n===`Override`){let t=r.ContentType,n=r.PartName;if(!t||!n)return;let i=we[t],a=i?e[i]:void 0;Array.isArray(a)&&a.push(n)}else if(n===`Default`){let t=r.Extension,n=r.ContentType;t&&(e.defaults[t.toLowerCase()]=n)}},onEnd:()=>{e.sst=e.strs.length>0?e.strs[0]:``,e.style=e.styles.length>0?e.styles[0]:``},onError:e=>{t?.(`Error parsing content types: ${e?.message??e}`)}}))(a,e=>{g.push([e,`[Content_Types].xml`])}),t=await k.getTextStream(`[Content_Types].xml`);if(!t)throw Error(`Error parsing content types: '[Content_Types].xml'`);try{await K.parseStream(t,e,{xmlns:!1})}catch(e){throw Error(`Error parsing content types: '[Content_Types].xml'`,{cause:e})}m&&await k.getBuffer(`[Content_Types].xml`)}h?.mark(`content-types`);let o=a.sst,s=new Set;for(let e of a.sheets)s.add(Te(e));o&&s.add(Te(o));for(let e of s)b+=k.uncompressedSize(e);if(await k.prefetch(e=>!s.has(e)&&!Ee.test(e)),h?.mark(`prefetch-side-parts`),a.workbooks.length===0){let n=t.s(`_rels/.rels`,e,E,T);if(n){for(let e of n.values())if(e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/officeDocument`&&e.target){a.workbooks.push(e.target);break}}}if(a.workbooks.length===0)throw new r.ExpectedError(`Unable to parse as an Excel document. Try to save as '.xlsx' and try again.`);a.richstructure=[`/xl/richData/rdrichvaluestructure.xml`],a.richdata=[`/xl/richData/rdrichvalue.xml`];let c=f?.resources??new i.ResourceCollection,l=c.beginPersist(),p={},x=new Set,S=new Map;S.set(`richTypes`,[]);let C=[];S.set(`dummyWrapped`,C);let w=t.u(`metadata`,a,e,E,T).entries().next()?.value?.[1]?.metadata;w&&S.set(`metadata`,w);let D=new Map,te=[],A=(n,r=D)=>{let i=n.lastIndexOf(`/`),a=n.substring(0,i+1)+`_rels/`+n.substring(i+1,n.length)+`.rels`,o=r.get(a);return o||(o=t.s(a,e,E,T,L),r.set(a,o)),o},j=(a,o,s,u=D)=>{let d=A(o,u).get(a),f=d?.target;if(!f)return null;if(d.targetMode===`External`){if(!s)return d.target;let e=c.add({source:{external:d.target}});return e.addReference(p),x.add(e),l.toResourceId(e)}let m=o.lastIndexOf(`/`),h=o.substring(0,m+1);f.startsWith(`/`)||(f=h+f),f=t.p(f);let _=T?.getVisitorParamsState().get(`dxfs`),v=u.get(f);if(!v)if(d.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/worksheet`){let e={};v=e,te.push((async()=>{let a=((e,r,a,o,s,c,l,u)=>{let d=new ue,f=new i.Tuple.TransposedBuilder,p=null;d.registerVisitor({from:`autoFilter`,to:`autoTable`,openTag:e=>{let t=e.getAttribute(`ref`),n=i.AddressUtils.fastStringToRange(t);e.getSource().r=n,e.getSource().v={}},closeTag:e=>{let t=e.getSource(),n=t.v,r=n.hiddenButtons;if(Array.isArray(r)){let e=r.length,i=t.r,a=i.colEnd-i.colStart+1;e===0?n.hiddenButtons=!1:e===a&&(n.hiddenButtons=!0)}}}),d.registerVisitor({from:`conditionalFormatting`,to:{},openTag:e=>{let t=e.getParent();t.conditionals||=[];let n=e.getAttribute(`sqref`);n&&=n.trim().split(/\s+/).join(`,`);let r={r:n,conditionals:t.conditionals},i=e.getAttribute(`pivot`,X);i!==null&&(r.pivot=i),e.setSource(r)}}),d.registerVisitor({from:`cfRule`,to:{},openTag:e=>{let t=e.getParent();if(!t?.r)return;let n=e.getSource()??{};t.pivot!==void 0&&(n.pivot=t.pivot),t.conditionals.push({r:t.r,v:null,rule:n}),e.copyToObject(n,`type`,$),e.copyToObject(n,`priority`,Z),e.copyToObject(n,`stopIfTrue`,X);let r=e.getAttribute(`dxfId`,Z);if(r!==null){let t=o?.get(r);t||=(c?.(`Unable to load conditional color. Invalid dxfI: '${r}' at '${e.getPath()}'.`),{}),n.style=t}e.copyToObject(n,`aboveAverage`,X),e.copyToObject(n,`equalAverage`,X),e.copyToObject(n,`stdDev`,Z),e.copyToObject(n,`bottom`,X),e.copyToObject(n,`percent`,X),e.copyToObject(n,`rank`,Z),e.copyToObject(n,`operator`,$),e.copyToObject(n,`text`,$),e.copyToObject(n,`timePeriod`,$)},closeTag:e=>{let t=e.getParent();if(!t?.r)return;let r=t.conditionals[t.conditionals.length-1],i=r?.rule;if(!i)return;let a={},o=n._(i,c);o&&(a.condition=o),i.style&&(a.style=i.style),i.scale&&(a.scale=i.scale),i.stopIfTrue&&(a.stopIfTrue=!0),i.pivot&&(a.pivot=!0),r.v=a,r.priority=i.priority,i.x14Id&&(r.x14Id=i.x14Id),delete r.rule}});let m=e=>{let t=e.conditions??[],n=[];for(let e=0;e<t.length;e++){let r=t[e],i={};r.type&&(i.type=r.type),r.value!==void 0&&(i.value=r.value),r.exclusive&&(i.exclusive=!0),n.push(i)}return n};d.registerVisitor({from:`colorScale`,to:{},openTag:e=>{},closeTag:e=>{let t=e.getSource(),n=t.colors??[],r=m(t);for(let e=0;e<r.length;e++)r[e].color=n[e];e.getParent().scale={type:i.IConditionalFormat.ScaleType.ColorScale,stops:r}}}),d.registerVisitor({from:`dataBar`,to:{},openTag:e=>{e.copyTo(`maxLength`,Z),e.copyTo(`minLength`,Z),e.copyTo(`showValue`,X)},closeTag:e=>{let t=e.getSource(),n={type:i.IConditionalFormat.ScaleType.DataBar,stops:m(t)},r=t.colors?.[0];r&&(n.color=r),t.minLength!==void 0&&(n.minLength=t.minLength),t.maxLength!==void 0&&(n.maxLength=t.maxLength),t.showValue!==void 0&&(n.showValue=t.showValue),e.getParent().scale=n}}),d.registerVisitor({from:`iconSet`,to:{},openTag:e=>{e.copyTo(`iconSet`,$),e.copyTo(`reverse`,X),e.copyTo(`showValue`,X)},closeTag:e=>{let t=e.getSource(),n={type:i.IConditionalFormat.ScaleType.IconSet,stops:m(t)};t.iconSet!==void 0&&(n.iconSet=t.iconSet),t.reverse!==void 0&&(n.reverse=t.reverse),t.showValue!==void 0&&(n.showValue=t.showValue),e.getParent().scale=n}}),d.registerVisitor({from:`formula`,to:{},text:(e,t)=>{let n=t.getParent(),r=n.formulas;r||(r=[],n.formulas=r),r.push(e)}}),d.registerVisitor({from:`cfvo`,to:{},openTag:e=>{let t=e.getParent();t.conditions||=[];let n=e.getSource();t.conditions.push(n),e.copyTo(`type`,$),n.type===i.IConditionalFormat.ColorStopType.Formula?e.copyTo(`value`,$,`val`):e.copyTo(`value`,Q,`val`),!1===e.getAttribute(`gte`,X)&&(n.exclusive=!0)}}),d.registerVisitor({from:`color`,to:{},openTag:e=>{let n=e.getParent();n.colors||=[];let r=t.d(t=>e.getAttribute(t));n.colors.push(r)}}),d.registerVisitor({from:`filterColumn`,to:{},openTag:e=>{let t=e.getParent().v,n=parseInt(e.getAttribute(`colId`)),r=e.getSource();r.index=n;let i=t.filter;i||(i={conditions:[]},t.filter=i);let a=i.conditions;if(a||(a=[],i.conditions=a),a.push(r),e.getAttribute(`hiddenButton`,X)&&t){let e=t.hiddenButtons;e||(e=[],t.hiddenButtons=e),e.push(n)}if(e.getAttribute(`showButton`,X)&&t){let e=t.showButtons;e||(e=[],t.showButtons=e),e.push(n)}return r}}),d.registerVisitor({from:`colorFilter`,openTag:e=>{let t=e.getParent(),n={};t.operator=i.ICondition.BuiltInOperatorNames.Color,t.param=n,e.copyToObject(n,`cellColor`),e.copyToObject(n,`styleId`,Z,`dxfId`)}}),d.registerVisitor({from:`iconFilter`,openTag:e=>{let t=e.getParent(),n={};t.operator=i.ICondition.BuiltInOperatorNames.Icon,t.param=n,e.copyToObject(n,`iconId`,Z),e.copyToObject(n,`iconSet`,$)}}),d.registerVisitor({from:`top10`,openTag:e=>{let t=e.getParent(),n={};t.operator=i.ICondition.BuiltInOperatorNames.TopN,t.param=n,e.copyToObject(n,`filterVal`,Q),e.copyToObject(n,`percent`,X),e.copyToObject(n,`top`,X),e.copyToObject(n,`limit`,Q,`val`)}}),d.registerVisitor({from:`dynamicFilter`,openTag:e=>{let t=e.getParent(),n={};t.operator=i.ICondition.BuiltInOperatorNames.TimePeriod,t.param=n;let r=e.getAttribute(`type`);Object.values(i.ICondition.AverageType).includes(r)?(t.operator=i.ICondition.BuiltInOperatorNames.Average,e.copyToObject(n,`stdDevs`,Z,`val`)):e.copyToObject(n,`anchorDate`,Z,`val`),e.copyToObject(n,`operator`,$,`type`),e.copyToObject(n,`maxVal`,Q,`maxVal`)}}),d.registerVisitor({from:`filters`,to:{},openTag:e=>{let t=e.getParent(),n={};return t.operator=i.ICondition.BuiltInOperatorNames.InSet,t.param=n,e.copyToObject(n,`blank`,X),e.copyToObject(n,`calendarType`,$),n}}),d.registerVisitor({from:`filter`,openTag:e=>{let t=e.getParent(),n=t.items;n||(n=[],t.items=n),n.push(e.getAttribute(`val`,$))}}),d.registerVisitor({from:`dateGroupItem`,to:{},openTag:e=>{let t=e.getParent(),n=t.dateGroups;n||(n=[],t.dateGroups=n),n.push(e.getSource()),e.copyTo(`group`,$,`dateTimeGrouping`),e.copyTo(`day`,Z),e.copyTo(`hour`,Z),e.copyTo(`minute`,Z),e.copyTo(`month`,Z),e.copyTo(`second`,Z),e.copyTo(`year`,Z)}}),d.registerVisitor({from:`customFilters`,openTag:e=>{let t=e.getParent(),n=e.getAttribute(`and`),r=n===`and`||n===`1`;e.getAttribute(`val`);let a=[];return t.operator=r?i.ICondition.BuiltInOperatorNames.And:i.ICondition.BuiltInOperatorNames.Or,t.param={conditions:a},e.setSource(t),a},closeTag:e=>{e.getSource().param.conditions.length}}),d.registerVisitor({from:`customFilter`,openTag:e=>{let t=e.getParent(),n;Array.isArray(t)?(n={},t.push(n)):n=t,e.copyToObject(n,`operator`),e.copyToObject(n,`param`,$,`val`)}}),d.registerVisitor({from:`sortState`,to:{},openTag:e=>{let t=e.getParent(),n=t.v;n&&(n.sort={},e.setSource(t))}}),d.registerVisitor({from:`sortCondition`,to:{},openTag:e=>{let t=e.getParent(),n=t.v;if(!n)return;let r=n.sort;if(!r)return;let a=r.sorts;a||(a=[],r.sorts=a);let o=e.getAttribute(`ref`),s=0;if(o){let e=i.AddressUtils.fastStringToRange(o,xe).colStart,n=t.r,r=n.colStart;s=n?e-r:e}let c={};e.copyToObject(c,`sortOn`,$,`sortBy`),e.copyToObject(c,`dxfId`,$,`sortBy`),e.copyToObject(c,`iconSet`,$),e.copyToObject(c,`customList`,$),c.reverse=e.getAttribute(`descending`,X)??!1;let l={index:s,criteria:c};a.push(l)}}),d.registerVisitor({from:`AlternateContent`,to:null});let h=e=>{p=e.getSource(),e.copyTo(`topLeft`,$,`topLeftCell`);let n=t.r(e.getAttribute(`defaultGridColor`)),r=e.getAttribute(`colorId`);r===null||n||(e.getSource().gridLineColor=`index`+parseFloat(r)),e.copyTo(`showZeros`,X),e.copyTo(`showFormulas`,X),e.copyTo(`zoomScale`,Z),e.copyTo(`showRowHeaders`,X,`showRowColHeaders`),e.copyTo(`showColumnHeaders`,X,`showRowColHeaders`),e.copyTo(`showRowGridlines`,X,`showGridLines`),e.copyTo(`showColumnGridlines`,X,`showGridLines`),e.copyTo(`rightToLeft`,X)};d.registerVisitor({from:`sheetView`,to:`view`,openTag:e=>{h(e)},closeTag:()=>{p=null}}),d.registerVisitor({from:`customSheetViews`,to:`customSheetViews`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`customSheetView`,to:[],openTag:e=>{h(e)},closeTag:()=>{p=null}}),d.registerVisitor({from:`selection`,to:`selection`,openTag:e=>{if(!p)return;e.copyTo(`cell`,$,`activeCell`),e.copyTo(`rangeIndex`,Z,`activeCellId`);let t=e.getAttribute(`activeCell`),n=e.getAttribute(`sqref`);n&&n!==t&&(e.getSource().ranges=n.trim().split(/\s+/))}}),d.registerVisitor({from:`pane`,to:null,openTag:e=>{if(p&&e.getAttribute(`state`)===`frozen`){let t={};p.freezePanes=t,e.copyToObject(t,`topLeft`,$,`topLeftCell`);let n=(p.topLeft?i.AddressUtils.fastStringToCell(p.topLeft):void 0)??{colIndex:0,rowIndex:0},r={colIndex:0,rowIndex:0};e.copyToObject(r,`colIndex`,Z,`xSplit`),e.copyToObject(r,`rowIndex`,Z,`ySplit`);let a={colIndex:n.colIndex+r.colIndex,rowIndex:n.rowIndex+r.rowIndex};t.coords=i.AddressUtils.cellToString(a)}}}),d.registerVisitor({from:`tabColor`,to:null,openTag:n=>{let r=t.d(e=>n.getAttribute(e));r&&(e.tabColor=r)}}),d.registerVisitor({from:`pageSetUpPr`,to:`pageSetUpPr`,openTag:e=>{}}),d.registerVisitor({from:`outlinePr`,to:`outlinePr`,openTag:e=>{}}),d.registerVisitor({from:`pageMargins`,to:`pageMargins`,openTag:e=>{e.copyTo(`bottom`,Q),e.copyTo(`footer`,Q),e.copyTo(`header`,Q),e.copyTo(`left`,Q),e.copyTo(`right`,Q),e.copyTo(`top`,Q),e.copyTo(`bottom`,Q)}}),d.registerVisitor({from:`pageSetup`,to:`pageSetup`,openTag:e=>{e.copyTo(`blackAndWhite`,X),e.copyTo(`cellComments`),e.copyTo(`copies`,Z),e.copyTo(`draft`,X),e.copyTo(`errors`),e.copyTo(`firstPageNumber`,Z),e.copyTo(`fitToHeight`,Z),e.copyTo(`fitToWidth`,Z),e.copyTo(`horizontalDpi`,Z),e.copyTo(`orientation`),e.copyTo(`pageOrder`),e.copyTo(`paperSize`,Z),e.copyTo(`scale`,Z),e.copyTo(`useFirstPageNumber`,X),e.copyTo(`usePrinterDefaults`,X),e.copyTo(`verticalDpi`,Z)}}),d.registerVisitor({from:`printOptions`,to:`printOptions`,openTag:e=>{e.copyTo(`gridLines`,X),e.copyTo(`gridLinesSet`,X),e.copyTo(`headings`,X),e.copyTo(`horizontalCentered`,X),e.copyTo(`verticalCentered`,X)}}),d.registerVisitor({from:`headerFoot`,to:`headerFoot`,openTag:e=>{}}),d.registerVisitor({from:`mergeCells`,to:`merges`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`dataValidations`,to:`validations`,openTag:e=>{e.setSource([])}});let g={from:`dataValidation`,to:[],openTag:e=>{let t=e.getAttribute(`sqref`);t&&=t.trim().split(/\s+/).join(`,`);let n={},r={r:t,v:n,rule:{type:e.getAttribute(`type`)??void 0,operator:e.getAttribute(`operator`)??void 0}};!0===e.getAttribute(`showDropDown`,X)&&(n.hideDropdown=!0),e.copyToObject(n,`alert`,$,`error`),e.copyToObject(n,`alertTitle`,$,`errorTitle`),e.copyToObject(n,`showAlertMessage`,X,`showErrorMessage`),n.alertStyle=e.getAttribute(`errorStyle`)??`stop`,e.copyToObject(n,`imeMode`),e.copyToObject(n,`prompt`),e.copyToObject(n,`promptTitle`),e.copyToObject(n,`showPromptMessage`,X,`showInputMessage`),e.setSource(r)},closeTag:e=>{let t=e.getSource();if(!t?.rule)return;let r=n.h(t.rule,c);r&&(e.getAttribute(`allowBlank`,X)&&(r.includeBlanks=!0),t.v.condition=r),delete t.rule}};d.registerVisitor(g),d.registerVisitor({from:`formula1`,to:{},text:(e,t)=>{let r=t.getParent().rule;r?.type&&(r.formula1=n.p(e,r.type))}}),d.registerVisitor({from:`formula2`,to:{},text:(e,t)=>{let r=t.getParent().rule;r?.type&&(r.formula2=n.p(e,r.type))}}),d.registerVisitor({from:`picture`,to:`picture`,openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return void console.warn(`no rId found for picture`,e.getPath());let n=r(t,!0);e.getSource().resId=n}});let _={from:`slicer`,to:{},openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return void console.warn(`no rId found for picture`,e.getPath());let n=r(t)?.slicers,i=e.getParent();i.slicers||={};let a=Object.keys(n);for(let e of a)i.slicers[e]=n[e]}};d.registerVisitor(_);let v=(e,t)=>({from:e,to:{},openTag:e=>{e.setSource(``)},text:(e,t)=>{t.setSource((t.getSource()??``)+e)},closeTag:e=>{t(String(e.getSource()??``),e)}}),y=new Map;y.set(`dataValidations`,{from:`dataValidations`,to:`validations`,openTag:e=>{let t=e.getParent();e.setSource(t.validations??[])},closeTag:e=>{(e.getSource()?.length??0)===0&&e.setSource(void 0)}}),y.set(`dataValidation`,{...g,closeTag:e=>{g.closeTag(e);let t=e.getSource();t&&!t.r&&(e.warn(`x14 dataValidation with no xm:sqref was dropped.`),e.setSource(void 0))}});let b=e=>({from:e,to:{},openTag:t=>{t.setSource({rule:t.getParent()?.rule,key:e})}});y.set(`formula1`,b(`formula1`)),y.set(`formula2`,b(`formula2`)),y.set(`f`,v(`f`,(e,t)=>{let r=t.getParent(),i=r?.rule;i&&(i[r.key]=n.p(e,i.type))})),y.set(`sqref`,v(`sqref`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.r=r.split(/\s+/).join(`,`))}));let x=new Map,ee=[],S=new Map;S.set(`conditionalFormattings`,{from:`conditionalFormattings`,transparent:!0}),S.set(`conditionalFormatting`,{from:`conditionalFormatting`,to:{},openTag:e=>{e.setSource({rules:[]})},closeTag:e=>{let t=e.getSource(),n=t?.rules??[];for(let e=0;e<n.length;e++){let r=n[e];r.sqref=t.sqref,r.id?x.set(r.id,r):ee.push(r)}}}),S.set(`cfRule`,{from:`cfRule`,to:{},openTag:e=>{e.copyTo(`id`,$),e.copyTo(`type`,$),e.copyTo(`priority`,Z)},closeTag:e=>{let t=e.getSource();t&&e.getParent()?.rules?.push(t)}}),S.set(`sqref`,v(`sqref`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.sqref=r)})),S.set(`dataBar`,{from:`dataBar`,to:{},openTag:e=>{e.copyTo(`minLength`,Z),e.copyTo(`maxLength`,Z),e.copyTo(`gradient`,X),e.copyTo(`border`,X),e.copyTo(`direction`,$),e.copyTo(`axisPosition`,$),e.copyTo(`negativeBarColorSameAsPositive`,X),e.copyTo(`negativeBarBorderColorSameAsPositive`,X)},closeTag:e=>{e.getParent().dataBar=e.getSource()}}),S.set(`iconSet`,{from:`iconSet`,to:{},openTag:e=>{e.copyTo(`iconSet`,$),e.copyTo(`custom`,X),e.copyTo(`reverse`,X),e.copyTo(`showValue`,X)},closeTag:e=>{e.getParent().iconSet=e.getSource()}}),S.set(`cfvo`,{from:`cfvo`,to:{},openTag:e=>{let t=e.getParent();t.conditions||=[];let n=e.getSource();t.conditions.push(n),e.copyTo(`type`,$),!1===e.getAttribute(`gte`,X)&&(n.exclusive=!0)}}),S.set(`f`,v(`f`,(e,t)=>{let n=t.getParent();if(!n)return;let r=e.trim(),i=Number(r);n.value=r.length>0&&Number.isFinite(i)?i:e}));let C=e=>({from:e,to:{},openTag:n=>{let r=t.d(e=>n.getAttribute(e));r&&(n.getParent()[e]=r)}});S.set(`borderColor`,C(`borderColor`)),S.set(`negativeFillColor`,C(`negativeFillColor`)),S.set(`negativeBorderColor`,C(`negativeBorderColor`)),S.set(`axisColor`,C(`axisColor`)),S.set(`cfIcon`,{from:`cfIcon`,to:{},openTag:e=>{let t=e.getAttribute(`iconSet`),n=e.getAttribute(`iconId`,Z);if(t===null||n===null)return;let r=e.getParent();r.icons||=[],r.icons.push({set:t,id:n})}});let w=new Map;w.set(`id`,v(`id`,(e,t)=>{let n=t.getParent(),r=e.trim();n&&r&&(n.x14Id=r)}));let T=new Map;T.set(`slicerList`,{from:`slicerList`,transparent:!0}),T.set(`slicer`,_);let E=new Map([[n.f(n.i),y],[n.f(n.n),S],[n.f(n.r),S],[n.f(n.t),w],[n.f(n.a),T],[n.f(n.o),T]]),D=new Set;d.registerVisitor({from:`extLst`,transparent:!0}),d.registerVisitor({from:`ext`,transparent:!0,scope:e=>{let t=e.getAttribute(`uri`),r=n.f(t),i=E.get(r);if(i)return i;if(!n.l.has(r)&&!D.has(r)){D.add(r);let i=n.u[r];e.warn(i?`Extension content '${i}' (${t}) is not read; it will be lost on resave.`:`Unknown extension content (uri ${t}) is not read; it will be lost on resave.`)}return null}}),d.registerVisitor({from:`mergeCell`,to:[],openTag:e=>{let t=e.getAttribute(`ref`);e.setSource(t)}}),d.registerVisitor({from:`hyperlinks`,to:`hyperlinks`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`hyperlink`,to:[],openTag:e=>{let t=e.getAttribute(`r:id`),n=e.getAttribute(`ref`);if(!n)return void console.warn(`No ref found for hyperlink`);e.setKey(n);let i=t?r(t):``;if(typeof i!=`string`)return void console.warn(`Invalid address `,i);i.endsWith(`\\`)&&(i=i.substring(0,i.length-1));let a=e.getAttribute(`location`);if(a&&(i+=`#`+a),!i)return void console.warn(`No address found for hyperlink. r:id`,t);let o,s=e.getAttribute(`tooltip`);o=s?{address:i,screenTip:s}:i,e.setSource({r:n,v:o})}}),d.registerVisitor({from:`drawing`,to:`movables`,openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return;let n=r(t);n?e.setSource(n.movables):console.warn(`no drawing found for rId`,t)}}),d.registerVisitor({from:`tableParts`,to:`tables`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`tablePart`,to:[],openTag:e=>{let t=e.getAttribute(`r:id`);if(!t)return;let n=r(t);n?e.setSource(n):console.warn(`no table found for rId`,t)}});let te=(e,t)=>{t.conditions?.length&&(e.stops=m(t)),t.minLength!==void 0&&(e.minLength=t.minLength),t.maxLength!==void 0&&(e.maxLength=t.maxLength),(t.gradient??1)&&(e.gradient=!0),t.border&&t.borderColor&&(e.borderColor=t.borderColor),!t.negativeBarColorSameAsPositive&&t.negativeFillColor&&(e.negativeFillColor=t.negativeFillColor),!(t.negativeBarBorderColorSameAsPositive??1)&&t.negativeBorderColor&&(e.negativeBorderColor=t.negativeBorderColor),t.axisColor&&(e.axisColor=t.axisColor),t.axisPosition!==`middle`&&t.axisPosition!==`none`||(e.axisPosition=t.axisPosition),t.direction!==`leftToRight`&&t.direction!==`rightToLeft`||(e.direction=t.direction)},O=(e,t)=>{t.conditions?.length&&(e.stops=m(t)),t.iconSet&&t.iconSet!==e.iconSet&&(e.iconSet=t.iconSet),t.icons?.length&&(e.icon=t.icons),t.reverse!==void 0&&(e.reverse=t.reverse),t.showValue!==void 0&&(e.showValue=t.showValue)},k=e=>{if(e.type!==`iconSet`||!e.iconSet||!e.sqref)return null;let t={type:i.IConditionalFormat.ScaleType.IconSet,stops:[]};return O(t,e.iconSet),{r:e.sqref.split(/\s+/).join(`,`),v:{scale:t},priority:e.priority}};d.registerVisitor({from:`worksheet`,to:{},openTag:e=>{},closeTag:e=>{let t=e.getSource(),n=t?.conditionals;if(n)for(let e=0;e<n.length;e++){let t=n[e],r=t.x14Id;if(!r)continue;delete t.x14Id;let a=x.get(r);if(!a)continue;x.delete(r);let o=t.v?.scale;a.dataBar&&o?.type===i.IConditionalFormat.ScaleType.DataBar?te(o,a.dataBar):a.iconSet&&o?.type===i.IConditionalFormat.ScaleType.IconSet&&O(o,a.iconSet)}let r=[...x.values(),...ee];for(let e=0;e<r.length;e++){let i=k(r[e]);i?(n||(n=[],t.conditionals=n),n.push(i)):c?.(`x14-only conditional formatting rule (type '${r[e].type??`unknown`}') is not read and will be lost on resave.`)}if(n){n.length>1&&n.sort((e,t)=>(e.priority??1/0)-(t.priority??1/0));for(let e=0;e<n.length;e++)delete n[e].priority}}}),d.registerVisitor({from:`customProperties`,to:`customProperties`,openTag:e=>{e.setSource([])},closeTag:e=>{let t=e.getSource();t.length>0&&(e.getParent().customProperties=t)}}),d.registerVisitor({from:`customPr`,to:{},openTag:e=>{let t=e.getParent();e.copyTo(`name`);let n=e.getAttribute(`r:id`);if(!n)return void console.warn(`no rId found for customProperties`,e.getPath());let i=r(n,!0),a=e.getSource();a.resId=i,t.push(a)}}),d.registerVisitor({from:`sheetProtection`,to:`protection`,openTag:e=>{let t=!1;if(e.hasAttribute(`sheet`)&&X(e.getAttribute(`sheet`))&&(t=!0),!t)return void e.setSource(void 0);let n=e=>!0===e||e===`1`||e===`on`||e===`true`||!1!==e&&e!==`0`&&e!==`off`&&e!==`false`&&null;e.copyTo(`autoTable`,n),e.copyTo(`deleteColumns`,n),e.copyTo(`formatCells`,n),e.copyTo(`formatColumns`,n),e.copyTo(`formatRows`,n),e.copyTo(`insertColumns`,n),e.copyTo(`insertHyperlinks`,n),e.copyTo(`insertRows`,n),e.copyTo(`objects`,n),e.copyTo(`pivotTables`,n),e.copyTo(`scenarios`,n),e.copyTo(`selectLockedCells`,n),e.copyTo(`selectUnlockedCells`,n),e.copyTo(`sort`,n);let r={};e.copyToObject(r,`hash`,$,`hashValue`),e.copyToObject(r,`algorithm`,$,`algorithmName`),e.copyToObject(r,`salt`,$,`saltValue`),e.copyToObject(r,`spinCount`,Z),Object.keys(r).length>0&&(e.getSource().password=r)}}),d.registerVisitor({from:`protectedRanges`,to:`protectedRanges`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`protectedRange`,to:[],openTag:e=>{let t=e.getAttribute(`sqref`);t&&=t.trim().split(/\s+/).join(`,`);let n={},r={r:t,v:n};e.copyToObject(n,`name`),e.copyToObject(n,`securityDescriptor`);let i={};e.copyToObject(i,`hash`,$,`hashValue`),e.copyToObject(i,`algorithm`,$,`algorithmName`),e.copyToObject(i,`salt`,$,`saltValue`),e.copyToObject(i,`spinCount`,Z),Object.keys(i).length>0&&(n.password=i),e.setSource(r)},closeTag:e=>{let t=e.getSource();t?.r&&t.v.name||e.setSource(void 0)}}),d.registerVisitor({from:`sheetFormatPr`,to:`sheetFormatPr`,openTag:t=>{t.copyToObject(e,`defaultColSize`,Q,`defaultColWidth`),t.copyToObject(e,`outlineLevelCol`,Z,`outlineLevelCol`);let n=t.getAttribute(`customHeight`);n!==`1`&&n!==`true`||t.copyToObject(e,`defaultRowSize`,Q,`defaultRowHeight`),t.copyToObject(e,`outlineLevelRow`,Z,`outlineLevelRow`)}}),d.registerVisitor({from:`cols`,to:`cols`,openTag:e=>{e.setSource([])}}),d.registerVisitor({from:`col`,to:[],openTag:e=>{let t=e.getSource(),n=e.getAttribute(`min`),r=e.getAttribute(`max`),a=n===void 0?0:parseInt(n)-1,o=r===void 0?a:parseInt(r)-1;t.r=i.AddressUtils.runToString(a,o,!0);let s={};t.v=s,e.copyToObject(s,`sz`,Q,`width`),e.copyToObject(s,`csz`,X,`customWidth`),e.copyToObject(s,`h`,X,`hidden`),e.copyToObject(s,`l`,Z,`outlineLevel`),e.copyToObject(s,`s`,Z,`style`)}}),d.registerVisitor({from:`oleObjects`,to:null,openTag:e=>{e.warn(`'OLE Objects' are not supported.`)}});let A=!1,j=!1,M=0,N=``,P=e=>{let t=e.indexOf(`:`);return t===-1?e:e.slice(t+1)};return Se(f,e,d.createEventHandler(e,s,c),c,l,{onOpenTag:e=>{A=!0;let t=P(e.name);t===`t`||t===`v`?M===0&&(j=!0):t!==`rPh`&&t!==`phoneticPr`||M++},onText:e=>{j&&(N+=e)},onCloseTag:e=>{let t=P(e.name);t===`t`||t===`v`?j=!1:t!==`rPh`&&t!==`phoneticPr`||M>0&&M--},onEnd:()=>{if(!A)return;let e=a(n.b(N));return A=!1,j=!1,M=0,N=``,e},onError:e=>{}},u)})(e,(e,t=!1)=>j(e,f,t)??null,H,_,()=>{},(e,t)=>{let n=t?`${t} (${f})`:f;g.push([e,n])},void 0,S),o=await k.getTextStream(f,ee);if(o)try{await K.parseStream(o,a,{xmlns:!1})}catch(e){throw console.warn(`Error parsing sheet: '${f}'`,e),Error(`Error parsing sheet: '${f}'`,{cause:e})}let s=A(f,u),c,l=new Map;if(s){let n;if(s.forEach((e,t)=>{e.type===`http://schemas.microsoft.com/office/2017/10/relationships/threadedComment`&&(c=j(t,f,!1,u)?.comments,c&&c.forEach(e=>{let t=e.v;l.set(t.id,e)}))}),s.forEach((e,t)=>{e.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/comments`&&(n=j(t,f,!1,u))}),n||c){let i=c??[],a=n?.authors,o=n?.comments,s=o?o.length:0;if(o)for(let e=0;e<s;e++){let n=o[e];if(!n)continue;let s=n.v,c=a&&s.personId!==void 0?a[s.personId]:s.personId;if(c&&c.startsWith(`tc=`)&&(c=t.f(c.substring(3)),l.has(c)))continue;let u=I({displayName:c}),d={id:r.CommonUtils.uuidV4(),personId:u.id,done:!1,asNote:!0,content:s.content};i.push({r:n.r,v:d})}e.comments=i}}})())}else if(d.type===`http://schemas.openxmlformats.org/officeDocument/2006/relationships/externalLink`){let n=t.l(f,e,E,T,L);if(n&&Object.keys(n).length!==0){let e=n,t=[];A(f,u)?.forEach(e=>{e.targetMode===`External`&&e.type&&e.target&&t.push({type:e.type,target:e.target})}),e.identity=t,v=e}else v=null}else v=s?t.c(f,e,(e,t)=>{let n=c.add({source:{buffer:e}});return n.addReference(p),x.add(n),l.toResourceId(n)},L):t.l(f,e,E,T,L);return v};t.u(`coreprops`,a,e,E,T),t.u(`extprops`,a,e,E,T);let M=new Map,N=new Map,P=t.u(`people`,a,e,E,T),F=null;if(P.size>0&&(F=P.entries().next()?.value?.[1]?.persons,F)){let e=F.length;for(let t=0;t<e;t++){let e=F[t];M.set(e.id,e),e.displayName!==void 0&&N.set(e.displayName,e)}}let I=e=>{if(!e)return;if(e.id&&M.has(e.id))return M.get(e.id);let t=e.displayName;if(!e.id){if(t){let e=N.get(t);if(e)return e}e.id=r.CommonUtils.uuidV4()}let n=M.get(e.id);if(n)return n;let i=e;return M.set(e.id,i),t&&N.set(t,i),F||=[],F.push(i),i},L={paramMap:S,getRefs:A,getRef:j,parsedRefs:D,addPerson:I,serializeElement:O},R=[];if(o){let e=await k.getTextStream(o,ee);if(e){let t=((e,t)=>{let r=!1,i=!1,a=0,o=``;return{onOpenTag:e=>{let t=Ce(e.name);t===`t`?r&&a===0&&(i=!0):t===`si`?(r=!0,o=``,a=0):t!==`rPh`&&t!==`phoneticPr`||a++},onText:e=>{i&&(o+=e)},onCloseTag:t=>{let s=Ce(t.name);s===`t`?i=!1:s===`si`?(e(n.b(o)),r=!1,o=``):s!==`rPh`&&s!==`phoneticPr`||a>0&&a--},onError:e=>{t?.(`Error parsing shared strings: ${e?.message??e}`)}}})(e=>{R.push(e)},e=>{g.push([e,o])});try{await K.parseStream(e,t,{xmlns:!1})}catch(e){throw console.warn(`Error parsing shared strings: '${o}'`,e),Error(`Error parsing shared strings: '${o}'`,{cause:e})}}}h?.mark(`shared-strings`);let z=R.length,B=new Map,V=z,H=e=>{let t=B.get(e);if(t!==void 0)return t;let n=V;return B.set(e,V++),R.push(e),n},U=[];a.slicersCache=U;let W=k.getNames(),ne=W.length;for(let e=0;e<ne;e++){let t=W[e];t&&t.startsWith(`xl/slicerCache`)&&U.push(`/${t}`)}let re=t.u(`slicersCache`,a,e,E,T,L),ie=new Map;re.forEach(e=>{let t=e.name;delete e.name,ie.set(t,e)}),S.set(`slicerCaches`,ie),t.u(`richstructure`,a,e,E,T,L),t.u(`richdata`,a,e,E,T,L);let ae=t.u(`themes`,a,e,E,T,L),oe=null;if(ae&&ae.entries){let e=ae.entries().next();e?.value?.[1]&&(oe=e.value[1])}let se=new i.Theme(oe),G=t.u(`styles`,a,e,E,T,L).entries().next()?.value?.[1];G&&=JSON.parse(r.BufferUtils.JSONStableStringify(G));let q=t.u(`workbooks`,a,e,E,T,L);h?.mark(`side-parts-json`),await Promise.all(te),v&&b>0&&(v(y,y),await new Promise(e=>setTimeout(e,0))),h?.mark(`sheets`);let ce={...q.entries().next().value?.[1],styles:G,theme:se.toJSON()};if(R.length>0&&(ce.strings=R),F&&F.length>0&&(ce.people=F),u){let e=k.getEntry(`xl/vbaProject.bin`);if(e)try{let{VBAProject:t}=await Promise.resolve().then(()=>require("./D5Y4KQhKdukOkjvA.cjs")),n=t.extract(e);n?(u?.(n),ce.vba=n):g.push([`Unable to parse VBA project.`,`xl/vbaProject.bin`])}catch(e){g.push([`Error extracting VBA: ${e?.message??e}`,`xl/vbaProject.bin`])}}let le=null,J={...f,resources:c,json:ce,formulaTransform:n.P(()=>le?.getCalculation())};J.disableLoadAutoFit===void 0&&(J.disableLoadAutoFit=!1),h?.mark(`json-assembled`);let Y=new i.Workbook(J);if(le=Y,h?.mark(`workbook-constructed`),C.length>0){await Y.whenCalculationReady();let e=new Map,t=ce.sheets??[],n=Y.getSheets().getItems();for(let r=0;r<t.length;r++){let i=t[r]?.sheet,a=n[r];i&&a&&e.set(i,a)}((e,t,n)=>{if(t.length===0)return;let r=e.getCalculation().getFunctions(),i=new Map,a=e=>{let t=i.get(e);return t===void 0&&(t=r.getByName(e)!==null,i.set(e,t)),t},o=new Map;for(let e of t){let t=o.get(e.sheet);t||(t=[],o.set(e.sheet,t)),t.push(e)}for(let[e,t]of o){let r=n.get(e);if(!r)continue;let i=(e,t)=>`${e},${t}`,o=new Set;for(let e of t)e.formula===null&&o.add(i(e.rowIndex,e.colIndex));for(let e of t){if(e.formula===null)continue;let t=_e(e.formula),n=!0;for(let e of t)if(!a(e)){n=!1;break}if(!n)continue;let s=[],c=[[e.rowIndex,e.colIndex]],l=new Set([i(e.rowIndex,e.colIndex)]);for(;c.length>0;){let[e,t]=c.pop(),n=[[e+1,t],[e-1,t],[e,t+1],[e,t-1]];for(let[e,t]of n){let n=i(e,t);!l.has(n)&&o.has(n)&&(l.add(n),s.push([e,t]),c.push([e,t]))}}for(let[e,t]of s)o.delete(i(e,t)),r.getRange({rowStart:e,colStart:t,rowEnd:e,colEnd:t}).clear();r.getRange({rowStart:e.rowIndex,colStart:e.colIndex,rowEnd:e.rowIndex,colEnd:e.colIndex}).setValue(`=`+e.formula)}}})(Y,C,e)}if(x.forEach(e=>{e.deleteReference(p)}),l.endPersist(),m){n.A(m);let e=new Map,t=0;for(let n of k.getNames()){let r=k.getEntry(n);if(!r)continue;let i=k.getRawEntry(n),a=i?{data:r,uncompressedSize:k.uncompressedSize(n),raw:{compressedData:i.data,compressionMethod:i.compressionMethod,signature:i.signature}}:{data:r,uncompressedSize:k.uncompressedSize(n)};e.set(n,a),t+=r.byteLength}if(t>67108864)g.push([`Source package too large to retain (${t} bytes, limit ${n.D}); unmodeled parts will be dropped on save.`,`SourcePackage`]);else if(e.size>0){let t=new n.O(e);n.j(m,t);let r=Y.getSheets().getItems(),i=Y.getTransactions().addListener({onCommitEnd:e=>{let n=e.getOperation()?.name;n!==`insertCells`&&n!==`deleteCells`||t.markStructuralChange()}}),a=Y.addListeners({onSheetsChange:()=>{let e=Y.getSheets().getItems();(e.length!==r.length||e.some((e,t)=>e!==r[t]))&&t.markStructuralChange(),r=e}});Y.addListeners({onClose:()=>{i(),a(),n.A(m)}})}}if(g.length&&_?.onWarning)for(let e of g){let[t,n]=e;_.onWarning(t,n)}return h&&!0===d&&console.table(h.toTable()),Y}catch(e){let t=`Unable to parse XLSX.`;throw e instanceof i.OutOfBoundsError&&(t=`Unable to open XLSX. There are too many rows or columns.`),Error(t,{cause:e})}finally{await k.close().catch(()=>{})}};
|