@silurus/ooxml 0.75.5 → 0.76.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/README.md +66 -28
- package/dist/bounded-raw-part-cache-C6ro6Ezf.js +254 -0
- package/dist/{find-cursor-Dc5iM6s7.js → canvas-viewer-mechanics-CwVSOYke.js} +192 -64
- package/dist/{document-pull-client-BcNYhoAG.js → document-pull-client-AAnwzlig.js} +3625 -3601
- package/dist/docx-CCksIXd5.js +1301 -0
- package/dist/docx.mjs +4 -6
- package/dist/docx_parser_bg.wasm +0 -0
- package/dist/index.mjs +3 -3
- package/dist/{line-distribute-B8sqT8kC.js → line-distribute-C1r2zvji.js} +141 -141
- package/dist/{line-metrics-D9gqQWHl.js → line-metrics-BdCACYlq.js} +4026 -1170
- package/dist/math.mjs +1 -1
- package/dist/node.mjs +779 -465
- package/dist/pptx-CKAk5e-J.js +1735 -0
- package/dist/pptx.mjs +5 -7
- package/dist/pptx_parser_bg.wasm +0 -0
- package/dist/{render-CalC7GX4.js → render-CLcpSi0m.js} +11 -18
- package/dist/render-worker-host-B8HAb_sK.js +27 -0
- package/dist/render-worker-host-Bkf1jUcW.js +27 -0
- package/dist/render-worker-host-CKOmXdyr.js +27 -0
- package/dist/resource-measurement-E_S_iau4.js +119 -0
- package/dist/session-B4Y54cbT.js +730 -0
- package/dist/{renderer-B9R6F_QY.js → slide-pull-client-WCuYCjio.js} +973 -820
- package/dist/types/docx.d.ts +1181 -3994
- package/dist/types/index.d.ts +2733 -8171
- package/dist/types/math.d.ts +8 -33
- package/dist/types/node.d.ts +1852 -4433
- package/dist/types/pptx.d.ts +1030 -3678
- package/dist/types/xlsx.d.ts +1291 -3262
- package/dist/worksheet-pull-client-YzjJMOns.js +455 -0
- package/dist/xlsx-BBmmZNQn.js +6362 -0
- package/dist/xlsx.mjs +5 -7
- package/dist/xlsx_parser_bg.wasm +0 -0
- package/package.json +14 -7
- package/dist/bounded-raw-part-cache-BTfZD_Sz.js +0 -1248
- package/dist/docx-DjF8FgoP.js +0 -1274
- package/dist/duotone-bitmap-by-path-CWsSJkJu.js +0 -28
- package/dist/hyperlink-D85FexTa.js +0 -27
- package/dist/pptx-C17xP8AV.js +0 -1705
- package/dist/pptx-Dl8tOSmP.js +0 -822
- package/dist/preload-BEouWnlI.js +0 -132
- package/dist/render-worker-host-BG3a7brz.js +0 -27
- package/dist/render-worker-host-CsB-dPJv.js +0 -27
- package/dist/render-worker-host-Cyv5Hkbh.js +0 -27
- package/dist/resource-measurement-6aReN3K0.js +0 -93
- package/dist/slide-pull-client-D_T0AIoX.js +0 -175
- package/dist/svg-image-by-path-C1M3N2pT.js +0 -1623
- package/dist/worksheet-pull-worker-DCei8u-4.js +0 -347
- package/dist/xlsx-BaH9irS0.js +0 -5515
- /package/dist/{highlight-rect-cCvVU-MW.js → highlight-rect-CAkCWJ37.js} +0 -0
- /package/dist/{mathjax-Dqo857oC.js → mathjax-CMjda8Ip.js} +0 -0
- /package/dist/{transfer-3QEJrsJa.js → transfer-DCu4c2BL.js} +0 -0
- /package/dist/{visible-index-CKvgpUrf.js → visible-index-CgyJLAS_.js} +0 -0
|
@@ -1,347 +0,0 @@
|
|
|
1
|
-
import { C as e, N as t, O as n, S as r, T as i, a, b as o, i as s, o as c, w as l, x as u, y as d } from "./bounded-raw-part-cache-BTfZD_Sz.js";
|
|
2
|
-
import { t as f } from "./transfer-3QEJrsJa.js";
|
|
3
|
-
import { n as p, r as m, t as h } from "./resource-measurement-6aReN3K0.js";
|
|
4
|
-
//#region packages/xlsx/src/shared-strings.ts
|
|
5
|
-
function g(e, t) {
|
|
6
|
-
return _(e.rows, t), e;
|
|
7
|
-
}
|
|
8
|
-
function _(e, t) {
|
|
9
|
-
for (let n of e) for (let e of n.cells) {
|
|
10
|
-
let n = e.value;
|
|
11
|
-
if (n.type === "shared") {
|
|
12
|
-
let r = t[n.si];
|
|
13
|
-
if (r) {
|
|
14
|
-
let t = {
|
|
15
|
-
type: "text",
|
|
16
|
-
text: r.text
|
|
17
|
-
};
|
|
18
|
-
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;
|
|
19
|
-
} else e.value = {
|
|
20
|
-
type: "text",
|
|
21
|
-
text: ""
|
|
22
|
-
};
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
return e;
|
|
26
|
-
}
|
|
27
|
-
//#endregion
|
|
28
|
-
//#region packages/xlsx/src/worksheet-resource-limits.ts
|
|
29
|
-
var v = l, y = u, b = r, x = e, S = o, C = d, w = Object.freeze({
|
|
30
|
-
archiveEntryCount: 0,
|
|
31
|
-
declaredInflatedBytes: 0,
|
|
32
|
-
distinctInflatedBytes: 0,
|
|
33
|
-
operationInflatedBytes: 0
|
|
34
|
-
});
|
|
35
|
-
function T(e) {
|
|
36
|
-
let t = e.reduce((e, t) => h(e, t.cells.length, y), 0);
|
|
37
|
-
return {
|
|
38
|
-
rows: e.length,
|
|
39
|
-
cells: t,
|
|
40
|
-
ownedUtf8Bytes: e.reduce((e, t) => t.cells.reduce((e, t) => {
|
|
41
|
-
let n = p(t.value, b).stringValueUtf8Bytes;
|
|
42
|
-
return h(e, h(n, t.formula === void 0 ? 0 : m(t.formula, b), b), b);
|
|
43
|
-
}, e), 0)
|
|
44
|
-
};
|
|
45
|
-
}
|
|
46
|
-
function E(e) {
|
|
47
|
-
let t = T(e.rows), n = p(e, Math.max(b, x));
|
|
48
|
-
return {
|
|
49
|
-
...t,
|
|
50
|
-
jsonBytes: n.jsonBytes
|
|
51
|
-
};
|
|
52
|
-
}
|
|
53
|
-
function D(e, t) {
|
|
54
|
-
return {
|
|
55
|
-
rows: h(e.rows, t.rows, v),
|
|
56
|
-
cells: h(e.cells, t.cells, y),
|
|
57
|
-
ownedUtf8Bytes: h(e.ownedUtf8Bytes, t.ownedUtf8Bytes, b)
|
|
58
|
-
};
|
|
59
|
-
}
|
|
60
|
-
function O(e, t, n = {}) {
|
|
61
|
-
let r = e.rows - (n.rows ?? 0), i = e.cells - (n.cells ?? 0);
|
|
62
|
-
if (r < 0 || i < 0) throw Error("worksheet cache accounting underflow");
|
|
63
|
-
return {
|
|
64
|
-
rows: h(r, t.rows, S),
|
|
65
|
-
cells: h(i, t.cells, C)
|
|
66
|
-
};
|
|
67
|
-
}
|
|
68
|
-
function k(e, n, r, i, a, o, s) {
|
|
69
|
-
let c = r === "worksheet-json" ? "serialization" : "parsing";
|
|
70
|
-
return new t(`OOXML resource limit exceeded${n ? ` for ${n}` : ""}: ${i} ${o} > ${a}`, {
|
|
71
|
-
stage: c,
|
|
72
|
-
violation: {
|
|
73
|
-
format: "xlsx",
|
|
74
|
-
operation: e,
|
|
75
|
-
resource: r,
|
|
76
|
-
metric: i,
|
|
77
|
-
...n === void 0 ? {} : { part: n },
|
|
78
|
-
limit: a,
|
|
79
|
-
observed: Math.min(o, a + 1),
|
|
80
|
-
configurable: !1,
|
|
81
|
-
usage: s ?? w
|
|
82
|
-
}
|
|
83
|
-
});
|
|
84
|
-
}
|
|
85
|
-
function A(e, t, n, r) {
|
|
86
|
-
let i = [
|
|
87
|
-
[
|
|
88
|
-
"rows",
|
|
89
|
-
e.rows,
|
|
90
|
-
v
|
|
91
|
-
],
|
|
92
|
-
[
|
|
93
|
-
"cells",
|
|
94
|
-
e.cells,
|
|
95
|
-
y
|
|
96
|
-
],
|
|
97
|
-
[
|
|
98
|
-
"owned-utf8-bytes",
|
|
99
|
-
e.ownedUtf8Bytes,
|
|
100
|
-
b
|
|
101
|
-
]
|
|
102
|
-
];
|
|
103
|
-
for (let [e, a, o] of i) if (a > o) throw k(t, n, e === "owned-utf8-bytes" ? "worksheet-cell-content" : "worksheet-model", e, o, a, r);
|
|
104
|
-
}
|
|
105
|
-
function j(e, t, n, r) {
|
|
106
|
-
if (e > x) throw k(t, n, "worksheet-json", "bytes", x, e, r);
|
|
107
|
-
}
|
|
108
|
-
function M(e, t, n, r) {
|
|
109
|
-
if (e.rows > S) throw k(t, n, "worksheet-cache", "rows", S, e.rows, r);
|
|
110
|
-
if (e.cells > C) throw k(t, n, "worksheet-cache", "cells", C, e.cells, r);
|
|
111
|
-
}
|
|
112
|
-
//#endregion
|
|
113
|
-
//#region packages/xlsx/src/worksheet-pull-worker.ts
|
|
114
|
-
var N = 64 * 1024 * 1024, P = class {
|
|
115
|
-
coordinator = new c();
|
|
116
|
-
sessions = /* @__PURE__ */ new Map();
|
|
117
|
-
operationTail = Promise.resolve();
|
|
118
|
-
pendingOpens = /* @__PURE__ */ new Map();
|
|
119
|
-
resourceFailure;
|
|
120
|
-
constructor(e, t, n = (e) => e(this.requireArchive()), r) {
|
|
121
|
-
this.archive = e, this.acceptWorksheet = t, this.executeArchive = n, this.prepareRows = r;
|
|
122
|
-
}
|
|
123
|
-
reserveOpen(e) {
|
|
124
|
-
this.pendingOpens.set(e.sessionId, {
|
|
125
|
-
identity: e,
|
|
126
|
-
canceled: !1
|
|
127
|
-
});
|
|
128
|
-
}
|
|
129
|
-
abandonOpen(e) {
|
|
130
|
-
this.pendingOpens.delete(e);
|
|
131
|
-
}
|
|
132
|
-
get pendingOpenCount() {
|
|
133
|
-
return this.pendingOpens.size;
|
|
134
|
-
}
|
|
135
|
-
async open(e, n, r) {
|
|
136
|
-
if (this.resourceFailure) throw this.resourceFailure;
|
|
137
|
-
let i = this.pendingOpens.get(r.sessionId);
|
|
138
|
-
if (!i || i.identity.operationId !== r.operationId || i.identity.generation !== r.generation) throw Error("worksheet pull session open reservation is stale or missing");
|
|
139
|
-
let o, s = new Promise((e) => {
|
|
140
|
-
o = e;
|
|
141
|
-
}), c = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
142
|
-
if (i.canceled) throw Error("worksheet pull session open was canceled");
|
|
143
|
-
this.executeArchive((t) => t.open_sheet_cursor(e, n));
|
|
144
|
-
let s = [], c = {
|
|
145
|
-
rows: 0,
|
|
146
|
-
cells: 0,
|
|
147
|
-
ownedUtf8Bytes: 0
|
|
148
|
-
}, l, u = !1, d = new a({
|
|
149
|
-
...r,
|
|
150
|
-
maxByteCredit: N,
|
|
151
|
-
coordinator: this.coordinator,
|
|
152
|
-
driver: {
|
|
153
|
-
pull: () => {
|
|
154
|
-
let e = this.executeArchive((e) => e.pull_sheet_cursor(128)), n = this.executeArchive((e) => e.sheet_cursor_pull_finished());
|
|
155
|
-
if (this.acceptWorksheet) {
|
|
156
|
-
let r = JSON.parse(new TextDecoder().decode(e));
|
|
157
|
-
if (n !== (r.kind === "finished")) throw Error("worksheet cursor terminal marker mismatch");
|
|
158
|
-
try {
|
|
159
|
-
if (r.kind === "rows") {
|
|
160
|
-
this.prepareRows?.(r.rows);
|
|
161
|
-
let e = D(c, T(r.rows));
|
|
162
|
-
A(e, "get-worksheet-worker", void 0, this.readResourceUsage()), s.push(...r.rows), c = e;
|
|
163
|
-
} else l = r.worksheet;
|
|
164
|
-
} catch (e) {
|
|
165
|
-
throw e instanceof t && (this.resourceFailure ??= e), e;
|
|
166
|
-
}
|
|
167
|
-
}
|
|
168
|
-
u = n;
|
|
169
|
-
let r = f(e);
|
|
170
|
-
return {
|
|
171
|
-
payload: r,
|
|
172
|
-
byteLength: r.byteLength,
|
|
173
|
-
done: n,
|
|
174
|
-
transfer: [r]
|
|
175
|
-
};
|
|
176
|
-
},
|
|
177
|
-
measureChunk: ({ payload: e }) => e.byteLength,
|
|
178
|
-
acknowledge: () => {
|
|
179
|
-
if (!u) return;
|
|
180
|
-
let n, i;
|
|
181
|
-
try {
|
|
182
|
-
if (this.acceptWorksheet) {
|
|
183
|
-
if (!l) throw Error("worksheet terminal payload is missing");
|
|
184
|
-
l.rows = s;
|
|
185
|
-
let t = E(l), r = this.readResourceUsage();
|
|
186
|
-
A(t, "get-worksheet-worker", void 0, r), j(t.jsonBytes, "get-worksheet-worker", void 0, r);
|
|
187
|
-
let a = this.acceptWorksheet(e, l, r);
|
|
188
|
-
typeof a == "function" ? n = a : a && ({rollback: n, commit: i} = a);
|
|
189
|
-
}
|
|
190
|
-
this.executeArchive((e) => e.acknowledge_sheet_cursor_terminal()), i?.();
|
|
191
|
-
} catch (e) {
|
|
192
|
-
throw n?.(), e instanceof t && (this.resourceFailure ??= e), e;
|
|
193
|
-
}
|
|
194
|
-
u = !1, this.sessions.delete(r.sessionId), o();
|
|
195
|
-
},
|
|
196
|
-
cancel: () => {
|
|
197
|
-
try {
|
|
198
|
-
this.archive() && this.executeArchive((e) => e.cancel_sheet_cursor());
|
|
199
|
-
} finally {
|
|
200
|
-
this.sessions.delete(r.sessionId), o();
|
|
201
|
-
}
|
|
202
|
-
},
|
|
203
|
-
close: () => {
|
|
204
|
-
try {
|
|
205
|
-
this.archive() && this.executeArchive((e) => e.close_sheet_cursor());
|
|
206
|
-
} finally {
|
|
207
|
-
this.sessions.delete(r.sessionId), o();
|
|
208
|
-
}
|
|
209
|
-
},
|
|
210
|
-
resourceUsage: () => this.readResourceUsage()
|
|
211
|
-
}
|
|
212
|
-
});
|
|
213
|
-
this.sessions.set(r.sessionId, {
|
|
214
|
-
host: d,
|
|
215
|
-
identity: r
|
|
216
|
-
}), this.pendingOpens.delete(r.sessionId);
|
|
217
|
-
}));
|
|
218
|
-
this.operationTail = c.then(() => s, () => void 0);
|
|
219
|
-
try {
|
|
220
|
-
await c;
|
|
221
|
-
} catch (e) {
|
|
222
|
-
throw this.pendingOpens.delete(r.sessionId), o(), e;
|
|
223
|
-
}
|
|
224
|
-
}
|
|
225
|
-
async postOpenedSafely(e, t, n) {
|
|
226
|
-
try {
|
|
227
|
-
t();
|
|
228
|
-
} catch (t) {
|
|
229
|
-
await this.closeIdentity(e);
|
|
230
|
-
try {
|
|
231
|
-
n(t);
|
|
232
|
-
} catch {}
|
|
233
|
-
}
|
|
234
|
-
}
|
|
235
|
-
dispatch(e, t) {
|
|
236
|
-
let r = this.sessions.get(e.sessionId);
|
|
237
|
-
if (r) return r.host.dispatch(e, t);
|
|
238
|
-
let i = this.pendingOpens.get(e.sessionId);
|
|
239
|
-
if (i && (e.kind === "cancel" || e.kind === "close")) {
|
|
240
|
-
let n = i.identity.operationId === e.operationId && i.identity.generation === e.generation;
|
|
241
|
-
return n && (i.canceled = !0), t(n ? {
|
|
242
|
-
protocol: s,
|
|
243
|
-
kind: "accepted",
|
|
244
|
-
sessionId: e.sessionId,
|
|
245
|
-
operationId: e.operationId,
|
|
246
|
-
generation: e.generation,
|
|
247
|
-
requestId: e.requestId,
|
|
248
|
-
command: e.kind
|
|
249
|
-
} : {
|
|
250
|
-
protocol: s,
|
|
251
|
-
kind: "error",
|
|
252
|
-
sessionId: e.sessionId,
|
|
253
|
-
operationId: e.operationId,
|
|
254
|
-
generation: e.generation,
|
|
255
|
-
requestId: e.requestId,
|
|
256
|
-
error: {
|
|
257
|
-
message: "stale lifecycle targets another pending worksheet operation",
|
|
258
|
-
errorName: "PullSessionProtocolError",
|
|
259
|
-
code: "ooxml-stale-lifecycle"
|
|
260
|
-
}
|
|
261
|
-
}), Promise.resolve();
|
|
262
|
-
}
|
|
263
|
-
return e.kind === "cancel" || e.kind === "close" ? (t({
|
|
264
|
-
protocol: s,
|
|
265
|
-
kind: "accepted",
|
|
266
|
-
sessionId: e.sessionId,
|
|
267
|
-
operationId: e.operationId,
|
|
268
|
-
generation: e.generation,
|
|
269
|
-
requestId: e.requestId,
|
|
270
|
-
command: e.kind
|
|
271
|
-
}), Promise.resolve()) : (t({
|
|
272
|
-
protocol: s,
|
|
273
|
-
kind: "error",
|
|
274
|
-
sessionId: e.sessionId,
|
|
275
|
-
operationId: e.operationId,
|
|
276
|
-
generation: e.generation,
|
|
277
|
-
requestId: e.requestId,
|
|
278
|
-
error: n(/* @__PURE__ */ Error("worksheet pull session is not open"))
|
|
279
|
-
}), Promise.resolve());
|
|
280
|
-
}
|
|
281
|
-
async dispatchSafely(e, t) {
|
|
282
|
-
try {
|
|
283
|
-
await this.dispatch(e, t);
|
|
284
|
-
} catch (r) {
|
|
285
|
-
try {
|
|
286
|
-
t({
|
|
287
|
-
protocol: s,
|
|
288
|
-
kind: "error",
|
|
289
|
-
sessionId: e.sessionId,
|
|
290
|
-
operationId: e.operationId,
|
|
291
|
-
generation: e.generation,
|
|
292
|
-
requestId: e.requestId,
|
|
293
|
-
error: n(r)
|
|
294
|
-
});
|
|
295
|
-
} catch {}
|
|
296
|
-
}
|
|
297
|
-
}
|
|
298
|
-
run(e) {
|
|
299
|
-
let n = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
300
|
-
if (this.resourceFailure) throw this.resourceFailure;
|
|
301
|
-
return e();
|
|
302
|
-
})).catch((e) => {
|
|
303
|
-
throw e instanceof t && (this.resourceFailure ??= e), e;
|
|
304
|
-
});
|
|
305
|
-
return this.operationTail = n.then(() => void 0, () => void 0), n;
|
|
306
|
-
}
|
|
307
|
-
async reset() {
|
|
308
|
-
for (let e of this.pendingOpens.values()) e.canceled = !0;
|
|
309
|
-
let e = 1;
|
|
310
|
-
for (let { host: t, identity: n } of [...this.sessions.values()]) await t.dispatch({
|
|
311
|
-
protocol: s,
|
|
312
|
-
kind: "close",
|
|
313
|
-
...n,
|
|
314
|
-
requestId: e++
|
|
315
|
-
}, () => void 0);
|
|
316
|
-
this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.resourceFailure = void 0;
|
|
317
|
-
}
|
|
318
|
-
requireArchive() {
|
|
319
|
-
let e = this.archive();
|
|
320
|
-
if (!e) throw Error("Workbook not loaded");
|
|
321
|
-
return e;
|
|
322
|
-
}
|
|
323
|
-
async closeIdentity(e) {
|
|
324
|
-
let t = this.sessions.get(e.sessionId);
|
|
325
|
-
if (t) {
|
|
326
|
-
await t.host.dispatch({
|
|
327
|
-
protocol: s,
|
|
328
|
-
kind: "close",
|
|
329
|
-
...e,
|
|
330
|
-
requestId: 1
|
|
331
|
-
}, () => void 0);
|
|
332
|
-
return;
|
|
333
|
-
}
|
|
334
|
-
let n = this.pendingOpens.get(e.sessionId);
|
|
335
|
-
n && n.identity.operationId === e.operationId && n.identity.generation === e.generation && (n.canceled = !0);
|
|
336
|
-
}
|
|
337
|
-
readResourceUsage() {
|
|
338
|
-
try {
|
|
339
|
-
return i(this.executeArchive((e) => e.sheet_cursor_resource_usage()));
|
|
340
|
-
} catch (e) {
|
|
341
|
-
if (String(e).includes("worksheet cursor usage is unavailable")) return;
|
|
342
|
-
throw e;
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
|
-
};
|
|
346
|
-
//#endregion
|
|
347
|
-
export { M as a, T as c, g as d, D as i, E as l, N as n, j as o, O as r, A as s, P as t, _ as u };
|