@silurus/ooxml 0.87.0 → 0.89.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/README.md +118 -23
- package/THIRD_PARTY_NOTICES.md +7 -6
- package/dist/abort-VrnK7mdP.js +10 -0
- package/dist/assets/render-worker-CUOU6mL2.js +16 -0
- package/dist/assets/render-worker-DOqrFhSU.js +15 -0
- package/dist/assets/render-worker-DvWUdZUN.js +35 -0
- package/dist/bounded-raw-part-cache-B7JoC1CD.js +64586 -0
- package/dist/bundled-asset-url-E2nXURF9.js +15 -0
- package/dist/canvas-viewer-mechanics-DfQqRKkD.js +675 -0
- package/dist/cfb-guard-9QTRTg7f.js +528 -0
- package/dist/chart-ex.mjs +708 -739
- package/dist/comment-overlay-controller-B5_zGgG5.js +994 -0
- package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
- package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-D_sb2K6s.js} +5 -5
- package/dist/{comment-ui-runtime-BfE7MJZn.js → comment-ui-runtime-Jy-3goA9.js} +5 -5
- package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
- package/dist/document-model-source-BKNrXjAL.js +249 -0
- package/dist/document-pull-client-CxONDGbk.js +37833 -0
- package/dist/document-pull-worker-AMyXYpPq.js +104 -0
- package/dist/docx-D91ER1_S.js +495 -0
- package/dist/docx-DhDnKEI6.js +3563 -0
- package/dist/docx-model-source-CdrSt3hF.js +98 -0
- package/dist/docx-source-worker.mjs +455 -0
- package/dist/docx.mjs +7 -7
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/drawingml-shape-ChcGZNd8.js +310 -0
- package/dist/duotone-ekYik4ix.js +126 -0
- package/dist/emf-UT6I8rVi.js +1790 -0
- package/dist/font-preload-demand-CdJZUMCT.js +2058 -0
- package/dist/grid-geometry-uQOgViJU.js +384 -0
- package/dist/host-layout-DVMw8hDY.js +56 -0
- package/dist/host-layout-measure-CCEgaC_v.js +7 -0
- package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
- package/dist/index.mjs +4 -4
- package/dist/internal-companion.mjs +12 -0
- package/dist/line-distribute-CPOV6csk.js +2716 -0
- package/dist/math.mjs +2 -2
- package/dist/mathjax-stix2.js +10 -10
- package/dist/model-source-DJGzDtGb.js +61 -0
- package/dist/model-source-kz_NkZqT.js +179 -0
- package/dist/model-source-session-Bu9CHFHc.js +71 -0
- package/dist/model-source-session-CDuijwv1.js +85 -0
- package/dist/model-source-session-sKpNiIJI.js +58 -0
- package/dist/node.mjs +7 -1327
- package/dist/{pixel-budget-Dgjw269h.js → pixel-budget-BpTYrepD.js} +13 -10
- package/dist/plot-area-frame-CaJFvZ7p.js +8502 -0
- package/dist/pptx-CDP9dZHe.js +2936 -0
- package/dist/pptx-C_uxLVKB.js +183 -0
- package/dist/pptx-model-source-O7LhpOjz.js +37 -0
- package/dist/pptx-source-worker.mjs +446 -0
- package/dist/pptx.mjs +8 -7
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/presentation-model-source-tmROzteR.js +77 -0
- package/dist/raster-target-YQ4G6rxo.js +42 -0
- package/dist/region-map.mjs +114 -150
- package/dist/{render-8Zo7dnds.js → render-CJVglUHl.js} +3 -3
- package/dist/{render-worker-host-BfbnEChF.js → render-worker-host-BseIaVvm.js} +1 -1
- package/dist/{render-worker-host-DNL9dWRh.js → render-worker-host-CyxPU4JU.js} +1 -1
- package/dist/{render-worker-host-IkHrYOci.js → render-worker-host-aF6aWkC0.js} +1 -1
- package/dist/renderer-CkGLj0CC.js +5170 -0
- package/dist/renderer-Czw1cCC7.js +5823 -0
- package/dist/resource-measurement-mXw-WjMF.js +771 -0
- package/dist/session-Csv9maad.js +656 -0
- package/dist/slide-pull-client-DRZYwBTu.js +6515 -0
- package/dist/three-d-BK5siJgJ.js +878 -0
- package/dist/three-d.mjs +871 -764
- package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
- package/dist/tiff.mjs +401 -248
- package/dist/types/chart-ex.d.ts +289 -4
- package/dist/types/docx.d.ts +473 -98
- package/dist/types/index.d.ts +674 -303
- package/dist/types/internal-companion.d.ts +11 -0
- package/dist/types/math.d.ts +1 -1
- package/dist/types/node.d.ts +530 -11
- package/dist/types/pptx.d.ts +410 -97
- package/dist/types/region-map.d.ts +289 -4
- package/dist/types/three-d.d.ts +289 -4
- package/dist/types/tiff.d.ts +1 -1
- package/dist/types/xlsx.d.ts +483 -134
- package/dist/wasm-loader-rlgHmcSv.js +35 -0
- package/dist/wasm-runtime-generation-DX4y0Ecl.js +97 -0
- package/dist/workbook-model-source-BTC4ISTS.js +94 -0
- package/dist/worker-source-I1cIYBel.js +22 -0
- package/dist/worker-source-SbudzjYL.js +22 -0
- package/dist/worker-source-UAi3GNcM.js +22 -0
- package/dist/worksheet-pull-client-CkHgbtyM.js +579 -0
- package/dist/xlsx-CpSDPAEU.js +5809 -0
- package/dist/xlsx-D5569TPf.js +534 -0
- package/dist/xlsx-model-source-DPSkjFic.js +309 -0
- package/dist/xlsx-source-worker.mjs +525 -0
- package/dist/xlsx.mjs +8 -7
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +42 -16
- package/dist/assets/render-worker-CeK_iqK3.js +0 -10
- package/dist/assets/render-worker-DusrDhPk.js +0 -11
- package/dist/assets/render-worker-n2ZG0lrQ.js +0 -31
- package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
- package/dist/canvas-viewer-mechanics-Cpk0YFvM.js +0 -1384
- package/dist/cjk-fallback-bLI3z70h.js +0 -46
- package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
- package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
- package/dist/comments-Diid5ujN.js +0 -246
- package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
- package/dist/document-pull-client-yKxI8aDH.js +0 -27251
- package/dist/docx-BkSRiy07.js +0 -2995
- package/dist/dom-interaction-boundary-CBUQJsIM.js +0 -223
- package/dist/highlight-rect-C5hkRqUr.js +0 -13
- package/dist/hyperlink-ArrU3ArU.js +0 -36447
- package/dist/line-distribute-Dtudnqhs.js +0 -1023
- package/dist/line-metrics-B60C86uh.js +0 -60
- package/dist/plot-area-frame-D5hEOgkJ.js +0 -2903
- package/dist/pptx-62MmVbYB.js +0 -3063
- package/dist/renderer-XFSCOT6m.js +0 -5857
- package/dist/resource-measurement-CJsgolre.js +0 -150
- package/dist/session-CrU8f8DI.js +0 -743
- package/dist/slide-pull-client-B9KA8bU6.js +0 -6253
- package/dist/source-key-DIJG8BA0.js +0 -42
- package/dist/three-d-YYghQndN.js +0 -1346
- package/dist/transfer-p6iCC2R7.js +0 -6
- package/dist/units-EJdC96r6.js +0 -4
- package/dist/worksheet-pull-client-eIcQ-xlD.js +0 -458
- package/dist/xlsx-CRcSzZNq.js +0 -8482
- /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
- /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
- /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
- /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
- /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
- /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
package/dist/units-EJdC96r6.js
DELETED
|
@@ -1,458 +0,0 @@
|
|
|
1
|
-
import { F as e, G as t, H as n, M as r, N as i, P as a, an as o, cn as s, in as c, nn as l, on as u, rn as d, sn as f, tn as p, un as m } from "./hyperlink-ArrU3ArU.js";
|
|
2
|
-
import { n as h, r as g, t as _ } from "./resource-measurement-CJsgolre.js";
|
|
3
|
-
import { t as v } from "./transfer-p6iCC2R7.js";
|
|
4
|
-
//#region packages/xlsx/src/worksheet-resource-limits.ts
|
|
5
|
-
var y = s, b = o, x = u, S = f, C = c, w = p, T = l, E = d, D = Object.freeze({
|
|
6
|
-
archiveEntryCount: 0,
|
|
7
|
-
declaredInflatedBytes: 0,
|
|
8
|
-
distinctInflatedBytes: 0,
|
|
9
|
-
operationInflatedBytes: 0
|
|
10
|
-
});
|
|
11
|
-
function O(e) {
|
|
12
|
-
let t = e.reduce((e, t) => _(e, t.cells.length, b), 0);
|
|
13
|
-
return {
|
|
14
|
-
rows: e.length,
|
|
15
|
-
cells: t,
|
|
16
|
-
ownedUtf8Bytes: e.reduce((e, t) => t.cells.reduce((e, t) => {
|
|
17
|
-
let n = h(t.value, x).stringValueUtf8Bytes;
|
|
18
|
-
return _(e, _(n, t.formula === void 0 ? 0 : g(t.formula, x), x), x);
|
|
19
|
-
}, e), 0)
|
|
20
|
-
};
|
|
21
|
-
}
|
|
22
|
-
function k(e) {
|
|
23
|
-
return A(e, O(e.rows));
|
|
24
|
-
}
|
|
25
|
-
function A(e, t) {
|
|
26
|
-
let n = h(e, Math.max(x, S));
|
|
27
|
-
return {
|
|
28
|
-
...t,
|
|
29
|
-
jsonBytes: n.jsonBytes
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
function j(e, t) {
|
|
33
|
-
return {
|
|
34
|
-
rows: _(e.rows, t.rows, y),
|
|
35
|
-
cells: _(e.cells, t.cells, b),
|
|
36
|
-
ownedUtf8Bytes: _(e.ownedUtf8Bytes, t.ownedUtf8Bytes, x)
|
|
37
|
-
};
|
|
38
|
-
}
|
|
39
|
-
function M(e, t, n = {}) {
|
|
40
|
-
let r = e.rows - (n.rows ?? 0), i = e.cells - (n.cells ?? 0), a = e.ownedUtf8Bytes - (n.ownedUtf8Bytes ?? 0), o = e.jsonBytes - (n.jsonBytes ?? 0);
|
|
41
|
-
if (r < 0 || i < 0 || a < 0 || o < 0) throw Error("worksheet cache accounting underflow");
|
|
42
|
-
return {
|
|
43
|
-
rows: _(r, t.rows, C),
|
|
44
|
-
cells: _(i, t.cells, w),
|
|
45
|
-
ownedUtf8Bytes: _(a, t.ownedUtf8Bytes, T),
|
|
46
|
-
jsonBytes: _(o, t.jsonBytes, E)
|
|
47
|
-
};
|
|
48
|
-
}
|
|
49
|
-
function N(e, t, n, r, i, a, o) {
|
|
50
|
-
let s = n === "worksheet-json" ? "serialization" : "parsing";
|
|
51
|
-
return new m(`OOXML resource limit exceeded${t ? ` for ${t}` : ""}: ${r} ${a} > ${i}`, {
|
|
52
|
-
stage: s,
|
|
53
|
-
violation: {
|
|
54
|
-
format: "xlsx",
|
|
55
|
-
operation: e,
|
|
56
|
-
resource: n,
|
|
57
|
-
metric: r,
|
|
58
|
-
...t === void 0 ? {} : { part: t },
|
|
59
|
-
limit: i,
|
|
60
|
-
observed: Math.min(a, i + 1),
|
|
61
|
-
configurable: !1,
|
|
62
|
-
usage: o ?? D
|
|
63
|
-
}
|
|
64
|
-
});
|
|
65
|
-
}
|
|
66
|
-
function P(e, t, n, r) {
|
|
67
|
-
let i = [
|
|
68
|
-
[
|
|
69
|
-
"rows",
|
|
70
|
-
e.rows,
|
|
71
|
-
y
|
|
72
|
-
],
|
|
73
|
-
[
|
|
74
|
-
"cells",
|
|
75
|
-
e.cells,
|
|
76
|
-
b
|
|
77
|
-
],
|
|
78
|
-
[
|
|
79
|
-
"owned-utf8-bytes",
|
|
80
|
-
e.ownedUtf8Bytes,
|
|
81
|
-
x
|
|
82
|
-
]
|
|
83
|
-
];
|
|
84
|
-
for (let [e, a, o] of i) if (a > o) throw N(t, n, e === "owned-utf8-bytes" ? "worksheet-cell-content" : "worksheet-model", e, o, a, r);
|
|
85
|
-
}
|
|
86
|
-
function F(e, t, n, r) {
|
|
87
|
-
if (e > S) throw N(t, n, "worksheet-json", "bytes", S, e, r);
|
|
88
|
-
}
|
|
89
|
-
function I(e, t, n, r) {
|
|
90
|
-
if (e.rows > C) throw N(t, n, "worksheet-cache", "rows", C, e.rows, r);
|
|
91
|
-
if (e.cells > w) throw N(t, n, "worksheet-cache", "cells", w, e.cells, r);
|
|
92
|
-
if (e.ownedUtf8Bytes > T) throw N(t, n, "worksheet-cache", "owned-utf8-bytes", T, e.ownedUtf8Bytes, r);
|
|
93
|
-
if (e.jsonBytes > E) throw N(t, n, "worksheet-cache", "bytes", E, e.jsonBytes, r);
|
|
94
|
-
}
|
|
95
|
-
//#endregion
|
|
96
|
-
//#region packages/xlsx/src/shared-strings.ts
|
|
97
|
-
function L(e, t) {
|
|
98
|
-
return R(e.rows, t), e;
|
|
99
|
-
}
|
|
100
|
-
function R(e, t) {
|
|
101
|
-
for (let n of e) for (let e of n.cells) {
|
|
102
|
-
let n = e.value;
|
|
103
|
-
if (n.type === "shared") {
|
|
104
|
-
let r = t[n.si];
|
|
105
|
-
if (r) {
|
|
106
|
-
let t = {
|
|
107
|
-
type: "text",
|
|
108
|
-
text: r.text
|
|
109
|
-
};
|
|
110
|
-
r.runs !== void 0 && (t.runs = r.runs), r.phoneticRuns !== void 0 && (t.phoneticRuns = r.phoneticRuns), r.phoneticPr !== void 0 && (t.phoneticPr = r.phoneticPr), e.value = t;
|
|
111
|
-
} else e.value = {
|
|
112
|
-
type: "text",
|
|
113
|
-
text: ""
|
|
114
|
-
};
|
|
115
|
-
}
|
|
116
|
-
}
|
|
117
|
-
return e;
|
|
118
|
-
}
|
|
119
|
-
//#endregion
|
|
120
|
-
//#region packages/xlsx/src/worksheet-pull-codec.ts
|
|
121
|
-
function z(e, t, n, r) {
|
|
122
|
-
let i = e instanceof ArrayBuffer ? new Uint8Array(e) : new Uint8Array(e.buffer, e.byteOffset, e.byteLength), a = JSON.parse(new TextDecoder().decode(i));
|
|
123
|
-
if (!a || typeof a != "object" || !("kind" in a)) throw Error("worksheet cursor returned an invalid unit");
|
|
124
|
-
let o = a;
|
|
125
|
-
if (t !== (o.kind === "finished")) throw Error("worksheet cursor terminal marker mismatch");
|
|
126
|
-
if (o.kind === "rows") {
|
|
127
|
-
if (!Array.isArray(o.rows)) throw Error("worksheet row unit is missing rows");
|
|
128
|
-
return n && R(o.rows, n), r?.(o.rows), {
|
|
129
|
-
kind: "rows",
|
|
130
|
-
rows: o.rows
|
|
131
|
-
};
|
|
132
|
-
}
|
|
133
|
-
if (o.kind === "finished") {
|
|
134
|
-
if (!o.worksheet || typeof o.worksheet != "object") throw Error("worksheet terminal unit is missing its worksheet");
|
|
135
|
-
return o.worksheet.rows = [], {
|
|
136
|
-
kind: "finished",
|
|
137
|
-
worksheet: o.worksheet
|
|
138
|
-
};
|
|
139
|
-
}
|
|
140
|
-
throw Error("worksheet cursor returned an unknown unit kind");
|
|
141
|
-
}
|
|
142
|
-
//#endregion
|
|
143
|
-
//#region packages/xlsx/src/worksheet-pull-worker.ts
|
|
144
|
-
var B = 64 * 1024 * 1024, V = class {
|
|
145
|
-
coordinator = new e();
|
|
146
|
-
sessions = /* @__PURE__ */ new Map();
|
|
147
|
-
operationTail = Promise.resolve();
|
|
148
|
-
pendingOpens = /* @__PURE__ */ new Map();
|
|
149
|
-
resourceFailure;
|
|
150
|
-
constructor(e, t, n = (e) => e(this.requireArchive()), r) {
|
|
151
|
-
this.archive = e, this.acceptWorksheet = t, this.executeArchive = n, this.prepareRows = r;
|
|
152
|
-
}
|
|
153
|
-
reserveOpen(e) {
|
|
154
|
-
this.pendingOpens.set(e.sessionId, {
|
|
155
|
-
identity: e,
|
|
156
|
-
canceled: !1
|
|
157
|
-
});
|
|
158
|
-
}
|
|
159
|
-
abandonOpen(e) {
|
|
160
|
-
this.pendingOpens.delete(e);
|
|
161
|
-
}
|
|
162
|
-
get pendingOpenCount() {
|
|
163
|
-
return this.pendingOpens.size;
|
|
164
|
-
}
|
|
165
|
-
async open(e, t, n) {
|
|
166
|
-
if (this.resourceFailure) throw this.resourceFailure;
|
|
167
|
-
let r = this.pendingOpens.get(n.sessionId);
|
|
168
|
-
if (!r || r.identity.operationId !== n.operationId || r.identity.generation !== n.generation) throw Error("worksheet pull session open reservation is stale or missing");
|
|
169
|
-
let i, o = new Promise((e) => {
|
|
170
|
-
i = e;
|
|
171
|
-
}), s = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
172
|
-
if (r.canceled) throw Error("worksheet pull session open was canceled");
|
|
173
|
-
this.executeArchive((n) => n.open_sheet_cursor(e, t));
|
|
174
|
-
let o = [], s = {
|
|
175
|
-
rows: 0,
|
|
176
|
-
cells: 0,
|
|
177
|
-
ownedUtf8Bytes: 0
|
|
178
|
-
}, c, l = !1, u = new a({
|
|
179
|
-
...n,
|
|
180
|
-
maxByteCredit: B,
|
|
181
|
-
coordinator: this.coordinator,
|
|
182
|
-
driver: {
|
|
183
|
-
pull: () => {
|
|
184
|
-
let e = this.executeArchive((e) => e.pull_sheet_cursor(128)), t = this.executeArchive((e) => e.sheet_cursor_pull_finished());
|
|
185
|
-
if (this.acceptWorksheet) {
|
|
186
|
-
let n = z(e, t, void 0, this.prepareRows);
|
|
187
|
-
try {
|
|
188
|
-
if (n.kind === "rows") {
|
|
189
|
-
let e = j(s, O(n.rows));
|
|
190
|
-
P(e, "get-worksheet-worker", void 0, this.readResourceUsage()), o.push(...n.rows), s = e;
|
|
191
|
-
} else c = n.worksheet;
|
|
192
|
-
} catch (e) {
|
|
193
|
-
throw e instanceof m && (this.resourceFailure ??= e), e;
|
|
194
|
-
}
|
|
195
|
-
}
|
|
196
|
-
l = t;
|
|
197
|
-
let n = v(e);
|
|
198
|
-
return {
|
|
199
|
-
payload: n,
|
|
200
|
-
byteLength: n.byteLength,
|
|
201
|
-
done: t,
|
|
202
|
-
transfer: [n]
|
|
203
|
-
};
|
|
204
|
-
},
|
|
205
|
-
measureChunk: ({ payload: e }) => e.byteLength,
|
|
206
|
-
acknowledge: () => {
|
|
207
|
-
if (!l) return;
|
|
208
|
-
let t, r;
|
|
209
|
-
try {
|
|
210
|
-
if (this.acceptWorksheet) {
|
|
211
|
-
if (!c) throw Error("worksheet terminal payload is missing");
|
|
212
|
-
c.rows = c.parseError ? [] : o;
|
|
213
|
-
let n = c.parseError ? {
|
|
214
|
-
rows: 0,
|
|
215
|
-
cells: 0,
|
|
216
|
-
ownedUtf8Bytes: 0
|
|
217
|
-
} : s, i = A(c, n), a = this.readResourceUsage();
|
|
218
|
-
P(i, "get-worksheet-worker", void 0, a), F(i.jsonBytes, "get-worksheet-worker", void 0, a);
|
|
219
|
-
let l = this.acceptWorksheet(e, c, i, a);
|
|
220
|
-
typeof l == "function" ? t = l : l && ({rollback: t, commit: r} = l);
|
|
221
|
-
}
|
|
222
|
-
this.executeArchive((e) => e.acknowledge_sheet_cursor_terminal()), r?.();
|
|
223
|
-
} catch (e) {
|
|
224
|
-
throw t?.(), e instanceof m && (this.resourceFailure ??= e), e;
|
|
225
|
-
}
|
|
226
|
-
l = !1, this.sessions.delete(n.sessionId), i();
|
|
227
|
-
},
|
|
228
|
-
cancel: () => {
|
|
229
|
-
try {
|
|
230
|
-
this.archive() && this.executeArchive((e) => e.cancel_sheet_cursor());
|
|
231
|
-
} finally {
|
|
232
|
-
this.sessions.delete(n.sessionId), i();
|
|
233
|
-
}
|
|
234
|
-
},
|
|
235
|
-
close: () => {
|
|
236
|
-
try {
|
|
237
|
-
this.archive() && this.executeArchive((e) => e.close_sheet_cursor());
|
|
238
|
-
} finally {
|
|
239
|
-
this.sessions.delete(n.sessionId), i();
|
|
240
|
-
}
|
|
241
|
-
},
|
|
242
|
-
resourceUsage: () => this.readResourceUsage()
|
|
243
|
-
}
|
|
244
|
-
});
|
|
245
|
-
this.sessions.set(n.sessionId, {
|
|
246
|
-
host: u,
|
|
247
|
-
identity: n
|
|
248
|
-
}), this.pendingOpens.delete(n.sessionId);
|
|
249
|
-
}));
|
|
250
|
-
this.operationTail = s.then(() => o, () => void 0);
|
|
251
|
-
try {
|
|
252
|
-
await s;
|
|
253
|
-
} catch (e) {
|
|
254
|
-
throw this.pendingOpens.delete(n.sessionId), i(), e;
|
|
255
|
-
}
|
|
256
|
-
}
|
|
257
|
-
async postOpenedSafely(e, t, n) {
|
|
258
|
-
try {
|
|
259
|
-
t();
|
|
260
|
-
} catch (t) {
|
|
261
|
-
await this.closeIdentity(e);
|
|
262
|
-
try {
|
|
263
|
-
n(t);
|
|
264
|
-
} catch {}
|
|
265
|
-
}
|
|
266
|
-
}
|
|
267
|
-
dispatch(e, n) {
|
|
268
|
-
let r = this.sessions.get(e.sessionId);
|
|
269
|
-
if (r) return r.host.dispatch(e, n);
|
|
270
|
-
let a = this.pendingOpens.get(e.sessionId);
|
|
271
|
-
if (a && (e.kind === "cancel" || e.kind === "close")) {
|
|
272
|
-
let t = a.identity.operationId === e.operationId && a.identity.generation === e.generation;
|
|
273
|
-
return t && (a.canceled = !0), n(t ? {
|
|
274
|
-
protocol: i,
|
|
275
|
-
kind: "accepted",
|
|
276
|
-
sessionId: e.sessionId,
|
|
277
|
-
operationId: e.operationId,
|
|
278
|
-
generation: e.generation,
|
|
279
|
-
requestId: e.requestId,
|
|
280
|
-
command: e.kind
|
|
281
|
-
} : {
|
|
282
|
-
protocol: i,
|
|
283
|
-
kind: "error",
|
|
284
|
-
sessionId: e.sessionId,
|
|
285
|
-
operationId: e.operationId,
|
|
286
|
-
generation: e.generation,
|
|
287
|
-
requestId: e.requestId,
|
|
288
|
-
error: {
|
|
289
|
-
message: "stale lifecycle targets another pending worksheet operation",
|
|
290
|
-
errorName: "PullSessionProtocolError",
|
|
291
|
-
code: "ooxml-stale-lifecycle"
|
|
292
|
-
}
|
|
293
|
-
}), Promise.resolve();
|
|
294
|
-
}
|
|
295
|
-
return e.kind === "cancel" || e.kind === "close" ? (n({
|
|
296
|
-
protocol: i,
|
|
297
|
-
kind: "accepted",
|
|
298
|
-
sessionId: e.sessionId,
|
|
299
|
-
operationId: e.operationId,
|
|
300
|
-
generation: e.generation,
|
|
301
|
-
requestId: e.requestId,
|
|
302
|
-
command: e.kind
|
|
303
|
-
}), Promise.resolve()) : (n({
|
|
304
|
-
protocol: i,
|
|
305
|
-
kind: "error",
|
|
306
|
-
sessionId: e.sessionId,
|
|
307
|
-
operationId: e.operationId,
|
|
308
|
-
generation: e.generation,
|
|
309
|
-
requestId: e.requestId,
|
|
310
|
-
error: t(/* @__PURE__ */ Error("worksheet pull session is not open"))
|
|
311
|
-
}), Promise.resolve());
|
|
312
|
-
}
|
|
313
|
-
async dispatchSafely(e, n) {
|
|
314
|
-
try {
|
|
315
|
-
await this.dispatch(e, n);
|
|
316
|
-
} catch (r) {
|
|
317
|
-
try {
|
|
318
|
-
n({
|
|
319
|
-
protocol: i,
|
|
320
|
-
kind: "error",
|
|
321
|
-
sessionId: e.sessionId,
|
|
322
|
-
operationId: e.operationId,
|
|
323
|
-
generation: e.generation,
|
|
324
|
-
requestId: e.requestId,
|
|
325
|
-
error: t(r)
|
|
326
|
-
});
|
|
327
|
-
} catch {}
|
|
328
|
-
}
|
|
329
|
-
}
|
|
330
|
-
run(e) {
|
|
331
|
-
let t = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
332
|
-
if (this.resourceFailure) throw this.resourceFailure;
|
|
333
|
-
return e();
|
|
334
|
-
})).catch((e) => {
|
|
335
|
-
throw e instanceof m && (this.resourceFailure ??= e), e;
|
|
336
|
-
});
|
|
337
|
-
return this.operationTail = t.then(() => void 0, () => void 0), t;
|
|
338
|
-
}
|
|
339
|
-
async reset() {
|
|
340
|
-
for (let e of this.pendingOpens.values()) e.canceled = !0;
|
|
341
|
-
let e = 1;
|
|
342
|
-
for (let { host: t, identity: n } of [...this.sessions.values()]) await t.dispatch({
|
|
343
|
-
protocol: i,
|
|
344
|
-
kind: "close",
|
|
345
|
-
...n,
|
|
346
|
-
requestId: e++
|
|
347
|
-
}, () => void 0);
|
|
348
|
-
this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.resourceFailure = void 0;
|
|
349
|
-
}
|
|
350
|
-
requireArchive() {
|
|
351
|
-
let e = this.archive();
|
|
352
|
-
if (!e) throw Error("Workbook not loaded");
|
|
353
|
-
return e;
|
|
354
|
-
}
|
|
355
|
-
async closeIdentity(e) {
|
|
356
|
-
let t = this.sessions.get(e.sessionId);
|
|
357
|
-
if (t) {
|
|
358
|
-
await t.host.dispatch({
|
|
359
|
-
protocol: i,
|
|
360
|
-
kind: "close",
|
|
361
|
-
...e,
|
|
362
|
-
requestId: 1
|
|
363
|
-
}, () => void 0);
|
|
364
|
-
return;
|
|
365
|
-
}
|
|
366
|
-
let n = this.pendingOpens.get(e.sessionId);
|
|
367
|
-
n && n.identity.operationId === e.operationId && n.identity.generation === e.generation && (n.canceled = !0);
|
|
368
|
-
}
|
|
369
|
-
readResourceUsage() {
|
|
370
|
-
try {
|
|
371
|
-
return n(this.executeArchive((e) => e.sheet_cursor_resource_usage()));
|
|
372
|
-
} catch (e) {
|
|
373
|
-
if (String(e).includes("worksheet cursor usage is unavailable")) return;
|
|
374
|
-
throw e;
|
|
375
|
-
}
|
|
376
|
-
}
|
|
377
|
-
}, H = class {
|
|
378
|
-
active = /* @__PURE__ */ new Set();
|
|
379
|
-
nextSessionId = 1;
|
|
380
|
-
constructor(e) {
|
|
381
|
-
if (this.options = e, e.generation !== void 0 && (!Number.isSafeInteger(e.generation) || e.generation <= 0)) throw TypeError("generation must be a positive safe integer");
|
|
382
|
-
}
|
|
383
|
-
async *stream(e, t, n) {
|
|
384
|
-
if (!Number.isSafeInteger(e) || e < 0) throw RangeError("sheetIndex must be a non-negative safe integer");
|
|
385
|
-
if (!t) throw TypeError("sheetName must be non-empty");
|
|
386
|
-
G(n);
|
|
387
|
-
let i = this.nextSessionId++, a = {
|
|
388
|
-
sessionId: i,
|
|
389
|
-
operationId: i,
|
|
390
|
-
generation: this.options.generation ?? 1
|
|
391
|
-
}, o = new r(this.options.transport, {
|
|
392
|
-
...a,
|
|
393
|
-
maxByteCredit: B,
|
|
394
|
-
timeoutMs: this.options.timeoutMs,
|
|
395
|
-
disposeTransferred: this.options.disposeTransferred
|
|
396
|
-
});
|
|
397
|
-
this.active.add(o);
|
|
398
|
-
let s = !1, c;
|
|
399
|
-
try {
|
|
400
|
-
for (await this.options.open(e, t, a, this.options.timeoutMs);;) {
|
|
401
|
-
G(n);
|
|
402
|
-
let e = await o.pull(B, { signal: n });
|
|
403
|
-
try {
|
|
404
|
-
let t = e.usage ?? o.usageCheckpoint;
|
|
405
|
-
t && this.options.onUsage?.(t);
|
|
406
|
-
let r = z(e.payload, e.done, this.options.sharedStrings);
|
|
407
|
-
if (yield r.kind === "rows" ? {
|
|
408
|
-
kind: "rows",
|
|
409
|
-
rows: r.rows,
|
|
410
|
-
sequence: e.sequence,
|
|
411
|
-
wireBytes: e.byteLength,
|
|
412
|
-
usage: t
|
|
413
|
-
} : {
|
|
414
|
-
kind: "finished",
|
|
415
|
-
worksheet: r.worksheet,
|
|
416
|
-
sequence: e.sequence,
|
|
417
|
-
wireBytes: e.byteLength,
|
|
418
|
-
usage: t
|
|
419
|
-
}, await e.ack({ signal: n }), r.kind === "finished") {
|
|
420
|
-
s = !0;
|
|
421
|
-
return;
|
|
422
|
-
}
|
|
423
|
-
} finally {
|
|
424
|
-
e.disposeTransferred();
|
|
425
|
-
}
|
|
426
|
-
}
|
|
427
|
-
} catch (e) {
|
|
428
|
-
throw c = e, e;
|
|
429
|
-
} finally {
|
|
430
|
-
let e;
|
|
431
|
-
try {
|
|
432
|
-
s || await o.cancel(W(c));
|
|
433
|
-
} catch (t) {
|
|
434
|
-
e = t;
|
|
435
|
-
} finally {
|
|
436
|
-
this.active.delete(o);
|
|
437
|
-
}
|
|
438
|
-
if (c === void 0 && e !== void 0) throw e;
|
|
439
|
-
}
|
|
440
|
-
}
|
|
441
|
-
async cancelAll(e = "closed") {
|
|
442
|
-
let t = (await Promise.allSettled([...this.active].map((t) => t.cancel(e)))).find((e) => e.status === "rejected");
|
|
443
|
-
if (t) throw t.reason;
|
|
444
|
-
}
|
|
445
|
-
};
|
|
446
|
-
function U(e) {
|
|
447
|
-
return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
|
|
448
|
-
}
|
|
449
|
-
function W(e) {
|
|
450
|
-
return e && typeof e == "object" && "name" in e && e.name === "AbortError" ? "abort" : e === void 0 ? "closed" : "request-error";
|
|
451
|
-
}
|
|
452
|
-
function G(e) {
|
|
453
|
-
if (!e?.aborted) return;
|
|
454
|
-
let t = /* @__PURE__ */ Error("XLSX workbook session was aborted");
|
|
455
|
-
throw t.name = "AbortError", t;
|
|
456
|
-
}
|
|
457
|
-
//#endregion
|
|
458
|
-
export { S as a, I as c, A as d, O as f, L as i, F as l, N as m, U as n, M as o, k as p, V as r, j as s, H as t, P as u };
|