@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
|
@@ -0,0 +1,730 @@
|
|
|
1
|
+
import { t as e } from "./chunk-DmhlhrBa.js";
|
|
2
|
+
import { c as t, i as n } from "./slide-pull-client-WCuYCjio.js";
|
|
3
|
+
import { B as r, F as i, H as a, I as o, K as s, P as c, R as l, at as u, dt as d, ft as f, hn as p, it as m, lt as h, ot as g, rt as _, st as v, ut as y } from "./line-metrics-BdCACYlq.js";
|
|
4
|
+
import { t as b } from "./transfer-DCu4c2BL.js";
|
|
5
|
+
//#region packages/pptx/src/slide-cursor-operation.ts
|
|
6
|
+
function x(e) {
|
|
7
|
+
try {
|
|
8
|
+
return _(e((e) => e.slide_cursor_resource_usage()));
|
|
9
|
+
} catch (e) {
|
|
10
|
+
if (String(e).includes("slide cursor usage is unavailable")) return;
|
|
11
|
+
throw e;
|
|
12
|
+
}
|
|
13
|
+
}
|
|
14
|
+
function ee(e, t, n, r, i) {
|
|
15
|
+
let a, o;
|
|
16
|
+
try {
|
|
17
|
+
if (i) {
|
|
18
|
+
if (!r) throw Error("slide payload is missing before acknowledgement");
|
|
19
|
+
let t = i(n, r, x(e));
|
|
20
|
+
typeof t == "function" ? a = t : t && ({rollback: a, commit: o} = t);
|
|
21
|
+
}
|
|
22
|
+
e((e) => e.acknowledge_slide(t.operationId, t.generation)), o?.();
|
|
23
|
+
} catch (e) {
|
|
24
|
+
try {
|
|
25
|
+
a?.();
|
|
26
|
+
} catch {}
|
|
27
|
+
throw e;
|
|
28
|
+
}
|
|
29
|
+
}
|
|
30
|
+
//#endregion
|
|
31
|
+
//#region packages/pptx/src/slide-pull-worker.ts
|
|
32
|
+
var te = "ooxml-pull-resetting", S = "ooxml-pull-reset-failed", ne = class {
|
|
33
|
+
coordinatorGeneration = new o();
|
|
34
|
+
sessions = /* @__PURE__ */ new Map();
|
|
35
|
+
pendingOpens = /* @__PURE__ */ new Map();
|
|
36
|
+
operationTail = Promise.resolve();
|
|
37
|
+
resourceFailure;
|
|
38
|
+
lifecycleState = "ready";
|
|
39
|
+
resetBarrier;
|
|
40
|
+
resetIdentities = /* @__PURE__ */ new Map();
|
|
41
|
+
constructor(e, t, n = (e) => e(this.requireArchive())) {
|
|
42
|
+
this.archive = e, this.acceptSlide = t, this.executeArchive = n;
|
|
43
|
+
}
|
|
44
|
+
get coordinator() {
|
|
45
|
+
return this.coordinatorGeneration;
|
|
46
|
+
}
|
|
47
|
+
reserveOpen(e) {
|
|
48
|
+
if (this.assertReady(), re(e), this.pendingOpens.has(e.sessionId) || this.sessions.has(e.sessionId)) throw Error("slide pull session id is already reserved");
|
|
49
|
+
this.pendingOpens.set(e.sessionId, {
|
|
50
|
+
identity: e,
|
|
51
|
+
canceled: !1
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
abandonOpen(e) {
|
|
55
|
+
this.pendingOpens.delete(e);
|
|
56
|
+
}
|
|
57
|
+
get pendingOpenCount() {
|
|
58
|
+
return this.pendingOpens.size;
|
|
59
|
+
}
|
|
60
|
+
async open(e, t) {
|
|
61
|
+
if (this.assertReady(), this.resourceFailure) throw this.resourceFailure;
|
|
62
|
+
if (!Number.isSafeInteger(e) || e < 0) throw RangeError("slide index must be a non-negative safe integer");
|
|
63
|
+
let n = this.pendingOpens.get(t.sessionId);
|
|
64
|
+
if (!n || !C(n.identity, t)) throw Error("slide pull session open reservation is stale or missing");
|
|
65
|
+
let r, a = new Promise((e) => {
|
|
66
|
+
r = e;
|
|
67
|
+
}), o = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
68
|
+
if (n.canceled) throw Error("slide pull session open was canceled");
|
|
69
|
+
let a, o = !1, c = new i({
|
|
70
|
+
...t,
|
|
71
|
+
maxByteCredit: s,
|
|
72
|
+
coordinator: this.coordinator,
|
|
73
|
+
driver: {
|
|
74
|
+
pull: (n) => {
|
|
75
|
+
let r;
|
|
76
|
+
try {
|
|
77
|
+
r = this.executeArchive((r) => r.pull_slide(e, t.operationId, t.generation, n));
|
|
78
|
+
} catch (e) {
|
|
79
|
+
throw v(e, n, s) || (this.latchResourceFailure(e), e);
|
|
80
|
+
}
|
|
81
|
+
let i = b(r);
|
|
82
|
+
return this.acceptSlide && (a = JSON.parse(new TextDecoder().decode(new Uint8Array(i)))), o = !0, {
|
|
83
|
+
payload: i,
|
|
84
|
+
byteLength: i.byteLength,
|
|
85
|
+
done: !0,
|
|
86
|
+
transfer: [i]
|
|
87
|
+
};
|
|
88
|
+
},
|
|
89
|
+
measureChunk: ({ payload: e }) => e.byteLength,
|
|
90
|
+
acknowledge: () => {
|
|
91
|
+
if (!o) throw Error("slide unit is not awaiting acknowledgement");
|
|
92
|
+
try {
|
|
93
|
+
ee(this.executeArchive, t, e, a, this.acceptSlide);
|
|
94
|
+
} catch (e) {
|
|
95
|
+
throw this.latchResourceFailure(e), e;
|
|
96
|
+
}
|
|
97
|
+
o = !1, a = void 0, this.sessions.delete(t.sessionId), r();
|
|
98
|
+
},
|
|
99
|
+
cancel: async () => {
|
|
100
|
+
try {
|
|
101
|
+
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
|
102
|
+
} finally {
|
|
103
|
+
a = void 0, o = !1, this.sessions.delete(t.sessionId), r();
|
|
104
|
+
}
|
|
105
|
+
},
|
|
106
|
+
close: async () => {
|
|
107
|
+
try {
|
|
108
|
+
this.archive() && await this.executeArchive((e) => e.cancel_slide());
|
|
109
|
+
} finally {
|
|
110
|
+
a = void 0, o = !1, this.sessions.delete(t.sessionId), r();
|
|
111
|
+
}
|
|
112
|
+
},
|
|
113
|
+
resourceUsage: () => {
|
|
114
|
+
try {
|
|
115
|
+
return this.readResourceUsage();
|
|
116
|
+
} catch (e) {
|
|
117
|
+
throw this.latchResourceFailure(e), e;
|
|
118
|
+
}
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
});
|
|
122
|
+
this.sessions.set(t.sessionId, {
|
|
123
|
+
host: c,
|
|
124
|
+
identity: t
|
|
125
|
+
}), this.pendingOpens.delete(t.sessionId);
|
|
126
|
+
}));
|
|
127
|
+
this.operationTail = o.then(() => a, () => void 0);
|
|
128
|
+
try {
|
|
129
|
+
await o;
|
|
130
|
+
} catch (e) {
|
|
131
|
+
throw this.pendingOpens.delete(t.sessionId), r(), e;
|
|
132
|
+
}
|
|
133
|
+
}
|
|
134
|
+
async postOpenedSafely(e, t, n) {
|
|
135
|
+
if (this.lifecycleState !== "ready") {
|
|
136
|
+
try {
|
|
137
|
+
n(this.lifecycleError());
|
|
138
|
+
} catch {}
|
|
139
|
+
return;
|
|
140
|
+
}
|
|
141
|
+
try {
|
|
142
|
+
t();
|
|
143
|
+
} catch (t) {
|
|
144
|
+
await this.closeIdentity(e);
|
|
145
|
+
try {
|
|
146
|
+
n(t);
|
|
147
|
+
} catch {}
|
|
148
|
+
}
|
|
149
|
+
}
|
|
150
|
+
dispatch(e, t) {
|
|
151
|
+
if (this.lifecycleState !== "ready") return t(this.responseDuringReset(e)), Promise.resolve();
|
|
152
|
+
let n = this.sessions.get(e.sessionId);
|
|
153
|
+
if (n) return n.host.dispatch(e, t);
|
|
154
|
+
let r = this.pendingOpens.get(e.sessionId);
|
|
155
|
+
if (r && (e.kind === "cancel" || e.kind === "close")) {
|
|
156
|
+
let n = C(r.identity, e);
|
|
157
|
+
return n && (r.canceled = !0), t(n ? {
|
|
158
|
+
protocol: c,
|
|
159
|
+
kind: "accepted",
|
|
160
|
+
sessionId: e.sessionId,
|
|
161
|
+
operationId: e.operationId,
|
|
162
|
+
generation: e.generation,
|
|
163
|
+
requestId: e.requestId,
|
|
164
|
+
command: e.kind
|
|
165
|
+
} : this.staleLifecycleResponse(e)), Promise.resolve();
|
|
166
|
+
}
|
|
167
|
+
return e.kind === "cancel" || e.kind === "close" ? (t({
|
|
168
|
+
protocol: c,
|
|
169
|
+
kind: "accepted",
|
|
170
|
+
sessionId: e.sessionId,
|
|
171
|
+
operationId: e.operationId,
|
|
172
|
+
generation: e.generation,
|
|
173
|
+
requestId: e.requestId,
|
|
174
|
+
command: e.kind
|
|
175
|
+
}), Promise.resolve()) : (t({
|
|
176
|
+
protocol: c,
|
|
177
|
+
kind: "error",
|
|
178
|
+
sessionId: e.sessionId,
|
|
179
|
+
operationId: e.operationId,
|
|
180
|
+
generation: e.generation,
|
|
181
|
+
requestId: e.requestId,
|
|
182
|
+
error: g(/* @__PURE__ */ Error("slide pull session is not open"))
|
|
183
|
+
}), Promise.resolve());
|
|
184
|
+
}
|
|
185
|
+
async dispatchSafely(e, t) {
|
|
186
|
+
try {
|
|
187
|
+
await this.dispatch(e, t);
|
|
188
|
+
} catch (n) {
|
|
189
|
+
try {
|
|
190
|
+
t({
|
|
191
|
+
protocol: c,
|
|
192
|
+
kind: "error",
|
|
193
|
+
sessionId: e.sessionId,
|
|
194
|
+
operationId: e.operationId,
|
|
195
|
+
generation: e.generation,
|
|
196
|
+
requestId: e.requestId,
|
|
197
|
+
error: g(n)
|
|
198
|
+
});
|
|
199
|
+
} catch {}
|
|
200
|
+
}
|
|
201
|
+
}
|
|
202
|
+
run(e) {
|
|
203
|
+
if (this.lifecycleState !== "ready") return Promise.reject(this.lifecycleError());
|
|
204
|
+
let t = this.operationTail.then(() => this.coordinator.enqueue(async () => {
|
|
205
|
+
if (this.resourceFailure) throw this.resourceFailure;
|
|
206
|
+
return e();
|
|
207
|
+
})).catch((e) => {
|
|
208
|
+
throw this.latchResourceFailure(e), e;
|
|
209
|
+
});
|
|
210
|
+
return this.operationTail = t.then(() => void 0, () => void 0), t;
|
|
211
|
+
}
|
|
212
|
+
reset() {
|
|
213
|
+
if (this.resetBarrier) return this.resetBarrier;
|
|
214
|
+
this.lifecycleState = "resetting", this.captureResetIdentities();
|
|
215
|
+
let e = this.performReset().then(() => {
|
|
216
|
+
this.resetIdentities.clear(), this.lifecycleState = "ready";
|
|
217
|
+
}, (e) => {
|
|
218
|
+
throw this.lifecycleState = "reset-failed", e;
|
|
219
|
+
}).finally(() => {
|
|
220
|
+
this.resetBarrier === e && (this.resetBarrier = void 0);
|
|
221
|
+
});
|
|
222
|
+
return this.resetBarrier = e, e;
|
|
223
|
+
}
|
|
224
|
+
async performReset() {
|
|
225
|
+
for (let e of this.pendingOpens.values()) e.canceled = !0;
|
|
226
|
+
let e = 1;
|
|
227
|
+
for (let { host: t, identity: n } of [...this.sessions.values()]) {
|
|
228
|
+
let r;
|
|
229
|
+
if (await t.dispatch({
|
|
230
|
+
protocol: c,
|
|
231
|
+
kind: "close",
|
|
232
|
+
...n,
|
|
233
|
+
requestId: e++
|
|
234
|
+
}, (e) => {
|
|
235
|
+
e.kind === "error" && (r = m(e.error));
|
|
236
|
+
}), r) throw r;
|
|
237
|
+
}
|
|
238
|
+
this.sessions.clear(), await this.operationTail, this.pendingOpens.clear(), this.archive() && await this.executeArchive((e) => e.close_presentation_session()), this.coordinatorGeneration = new o(), this.resourceFailure = void 0;
|
|
239
|
+
}
|
|
240
|
+
assertReady() {
|
|
241
|
+
if (this.lifecycleState !== "ready") throw this.lifecycleError();
|
|
242
|
+
}
|
|
243
|
+
lifecycleError() {
|
|
244
|
+
let e = this.lifecycleState === "reset-failed", t = /* @__PURE__ */ Error(e ? "slide pull worker reset failed; retry reset before new work" : "slide pull worker reset is in progress");
|
|
245
|
+
return t.name = "PullSessionLifecycleError", Object.assign(t, { code: e ? S : te });
|
|
246
|
+
}
|
|
247
|
+
captureResetIdentities() {
|
|
248
|
+
for (let { identity: e } of this.sessions.values()) this.resetIdentities.set(e.sessionId, e);
|
|
249
|
+
for (let { identity: e } of this.pendingOpens.values()) this.resetIdentities.set(e.sessionId, e);
|
|
250
|
+
}
|
|
251
|
+
responseDuringReset(e) {
|
|
252
|
+
if (e.kind === "cancel" || e.kind === "close") {
|
|
253
|
+
let t = this.resetIdentities.get(e.sessionId);
|
|
254
|
+
return t && !C(t, e) ? this.staleLifecycleResponse(e) : {
|
|
255
|
+
protocol: c,
|
|
256
|
+
kind: "accepted",
|
|
257
|
+
sessionId: e.sessionId,
|
|
258
|
+
operationId: e.operationId,
|
|
259
|
+
generation: e.generation,
|
|
260
|
+
requestId: e.requestId,
|
|
261
|
+
command: e.kind
|
|
262
|
+
};
|
|
263
|
+
}
|
|
264
|
+
return {
|
|
265
|
+
protocol: c,
|
|
266
|
+
kind: "error",
|
|
267
|
+
sessionId: e.sessionId,
|
|
268
|
+
operationId: e.operationId,
|
|
269
|
+
generation: e.generation,
|
|
270
|
+
requestId: e.requestId,
|
|
271
|
+
error: g(this.lifecycleError())
|
|
272
|
+
};
|
|
273
|
+
}
|
|
274
|
+
requireArchive() {
|
|
275
|
+
let e = this.archive();
|
|
276
|
+
if (!e) throw Error("Presentation not loaded");
|
|
277
|
+
return e;
|
|
278
|
+
}
|
|
279
|
+
async closeIdentity(e) {
|
|
280
|
+
if (this.lifecycleState !== "ready") return;
|
|
281
|
+
let t = this.sessions.get(e.sessionId);
|
|
282
|
+
if (t) {
|
|
283
|
+
await t.host.dispatch({
|
|
284
|
+
protocol: c,
|
|
285
|
+
kind: "close",
|
|
286
|
+
...e,
|
|
287
|
+
requestId: 1
|
|
288
|
+
}, () => void 0);
|
|
289
|
+
return;
|
|
290
|
+
}
|
|
291
|
+
let n = this.pendingOpens.get(e.sessionId);
|
|
292
|
+
n && C(n.identity, e) && (n.canceled = !0);
|
|
293
|
+
}
|
|
294
|
+
readResourceUsage() {
|
|
295
|
+
return x(this.executeArchive);
|
|
296
|
+
}
|
|
297
|
+
latchResourceFailure(e) {
|
|
298
|
+
let t = e instanceof p ? e : u(e);
|
|
299
|
+
t && (this.resourceFailure ??= t);
|
|
300
|
+
}
|
|
301
|
+
staleLifecycleResponse(e) {
|
|
302
|
+
return {
|
|
303
|
+
protocol: c,
|
|
304
|
+
kind: "error",
|
|
305
|
+
sessionId: e.sessionId,
|
|
306
|
+
operationId: e.operationId,
|
|
307
|
+
generation: e.generation,
|
|
308
|
+
requestId: e.requestId,
|
|
309
|
+
error: {
|
|
310
|
+
message: "stale lifecycle targets another slide operation",
|
|
311
|
+
errorName: "PullSessionProtocolError",
|
|
312
|
+
code: "ooxml-stale-lifecycle"
|
|
313
|
+
}
|
|
314
|
+
};
|
|
315
|
+
}
|
|
316
|
+
};
|
|
317
|
+
function re(e) {
|
|
318
|
+
if (!Number.isSafeInteger(e.sessionId) || e.sessionId <= 0) throw RangeError("session id must be a positive safe integer");
|
|
319
|
+
if (!Number.isSafeInteger(e.operationId) || e.operationId <= 0) throw RangeError("operation id must be a positive safe integer");
|
|
320
|
+
if (!Number.isSafeInteger(e.generation) || e.generation <= 0) throw RangeError("generation must be a positive safe integer");
|
|
321
|
+
}
|
|
322
|
+
function C(e, t) {
|
|
323
|
+
return e.sessionId === t.sessionId && e.operationId === t.operationId && e.generation === t.generation;
|
|
324
|
+
}
|
|
325
|
+
//#endregion
|
|
326
|
+
//#region packages/core/src/internal/wasm-runtime-generation.ts
|
|
327
|
+
function ie(e) {
|
|
328
|
+
return d(e) ? new h(`WASM parser trapped and was recycled: ${e instanceof Error ? e.message : String(e)}`) : null;
|
|
329
|
+
}
|
|
330
|
+
var w = class {
|
|
331
|
+
realm;
|
|
332
|
+
live = /* @__PURE__ */ new Set();
|
|
333
|
+
constructor(e, t) {
|
|
334
|
+
this.realm = new f(() => e.initSync({ module: t }), () => e.reinit({ module_or_path: t }), ie), this.realm.onPoison((e) => {
|
|
335
|
+
for (let t of this.live) t.poison(e);
|
|
336
|
+
this.live.clear();
|
|
337
|
+
});
|
|
338
|
+
}
|
|
339
|
+
async open(e, t) {
|
|
340
|
+
for (;;) {
|
|
341
|
+
this.throwIfOpenAborted(t), await this.awaitReadyOrAbort(t), this.throwIfOpenAborted(t);
|
|
342
|
+
let n = this.realm.tryRunReady(e);
|
|
343
|
+
if (!n.current) continue;
|
|
344
|
+
let r = new ae(this, n.value, n.generation);
|
|
345
|
+
if (this.live.add(r), t?.signal?.aborted) throw r.close(t.disposeOnAbort), t.abortError?.() ?? new DOMException("The operation was aborted", "AbortError");
|
|
346
|
+
return r;
|
|
347
|
+
}
|
|
348
|
+
}
|
|
349
|
+
async awaitReadyOrAbort(e) {
|
|
350
|
+
let t = e?.signal;
|
|
351
|
+
if (!t) {
|
|
352
|
+
await this.realm.ensureReady();
|
|
353
|
+
return;
|
|
354
|
+
}
|
|
355
|
+
this.throwIfOpenAborted(e), await new Promise((n, r) => {
|
|
356
|
+
let i = () => r(e?.abortError?.() ?? new DOMException("The operation was aborted", "AbortError"));
|
|
357
|
+
t.addEventListener("abort", i, { once: !0 }), this.realm.ensureReady().then(n, r).finally(() => {
|
|
358
|
+
t.removeEventListener("abort", i);
|
|
359
|
+
});
|
|
360
|
+
});
|
|
361
|
+
}
|
|
362
|
+
throwIfOpenAborted(e) {
|
|
363
|
+
if (e?.signal?.aborted) throw e.abortError?.() ?? new DOMException("The operation was aborted", "AbortError");
|
|
364
|
+
}
|
|
365
|
+
async ensureReady() {
|
|
366
|
+
await this.realm.ensureReady();
|
|
367
|
+
}
|
|
368
|
+
run(e, t) {
|
|
369
|
+
let n = e.requireLive(this.realm);
|
|
370
|
+
return this.realm.run(() => t(n));
|
|
371
|
+
}
|
|
372
|
+
close(e, t) {
|
|
373
|
+
let n = e.detachForClose();
|
|
374
|
+
this.live.delete(e), n && this.realm.run(() => t(n));
|
|
375
|
+
}
|
|
376
|
+
}, ae = class {
|
|
377
|
+
archive;
|
|
378
|
+
failure;
|
|
379
|
+
proxy;
|
|
380
|
+
constructor(e, t, n) {
|
|
381
|
+
this.host = e, this.generation = n, this.archive = t, this.proxy = new Proxy(t, { get: (e, t) => {
|
|
382
|
+
let n = this.host.run(this, (e) => Reflect.get(e, t, e));
|
|
383
|
+
return typeof n == "function" ? (...e) => this.host.run(this, (n) => {
|
|
384
|
+
let r = Reflect.get(n, t, n);
|
|
385
|
+
return Reflect.apply(r, n, e);
|
|
386
|
+
}) : n;
|
|
387
|
+
} });
|
|
388
|
+
}
|
|
389
|
+
run(e) {
|
|
390
|
+
return this.host.run(this, e);
|
|
391
|
+
}
|
|
392
|
+
close(e) {
|
|
393
|
+
this.host.close(this, e);
|
|
394
|
+
}
|
|
395
|
+
requireLive(e) {
|
|
396
|
+
if (this.failure) throw this.failure;
|
|
397
|
+
if (e.assertCurrent(this.generation), !this.archive) throw Error("WASM archive session belongs to a discarded runtime generation");
|
|
398
|
+
return this.archive;
|
|
399
|
+
}
|
|
400
|
+
detachForClose() {
|
|
401
|
+
let e = this.archive;
|
|
402
|
+
return this.archive = void 0, this.failure ? void 0 : e;
|
|
403
|
+
}
|
|
404
|
+
poison(e) {
|
|
405
|
+
let t = this.archive;
|
|
406
|
+
this.failure = e, this.archive = void 0, y(t);
|
|
407
|
+
}
|
|
408
|
+
}, oe = /* @__PURE__ */ e({
|
|
409
|
+
PptxArchive: () => T,
|
|
410
|
+
default: () => Y,
|
|
411
|
+
extract_image: () => se,
|
|
412
|
+
extract_media: () => E,
|
|
413
|
+
initSync: () => le,
|
|
414
|
+
parse_pptx: () => D,
|
|
415
|
+
pptx_to_markdown: () => O,
|
|
416
|
+
reinit: () => ue
|
|
417
|
+
}), T = class {
|
|
418
|
+
__destroy_into_raw() {
|
|
419
|
+
let e = this.__wbg_ptr;
|
|
420
|
+
return this.__wbg_ptr = 0, A.unregister(this), e;
|
|
421
|
+
}
|
|
422
|
+
free() {
|
|
423
|
+
let e = this.__destroy_into_raw();
|
|
424
|
+
q.__wbg_pptxarchive_free(e, 0);
|
|
425
|
+
}
|
|
426
|
+
acknowledge_slide(e, t) {
|
|
427
|
+
let n = q.pptxarchive_acknowledge_slide(this.__wbg_ptr, e, t);
|
|
428
|
+
if (n[1]) throw B(n[0]);
|
|
429
|
+
}
|
|
430
|
+
assert_healthy() {
|
|
431
|
+
let e = q.pptxarchive_assert_healthy(this.__wbg_ptr);
|
|
432
|
+
if (e[1]) throw B(e[0]);
|
|
433
|
+
}
|
|
434
|
+
cancel_slide() {
|
|
435
|
+
q.pptxarchive_cancel_slide(this.__wbg_ptr);
|
|
436
|
+
}
|
|
437
|
+
close_presentation_session() {
|
|
438
|
+
q.pptxarchive_close_presentation_session(this.__wbg_ptr);
|
|
439
|
+
}
|
|
440
|
+
extract_image(e) {
|
|
441
|
+
let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_image(this.__wbg_ptr, t, n);
|
|
442
|
+
if (r[3]) throw B(r[2]);
|
|
443
|
+
var i = j(r[0], r[1]).slice();
|
|
444
|
+
return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
|
445
|
+
}
|
|
446
|
+
extract_media(e) {
|
|
447
|
+
let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_media(this.__wbg_ptr, t, n);
|
|
448
|
+
if (r[3]) throw B(r[2]);
|
|
449
|
+
var i = j(r[0], r[1]).slice();
|
|
450
|
+
return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
|
|
451
|
+
}
|
|
452
|
+
constructor(e, t, n, r) {
|
|
453
|
+
let i = R(e, q.__wbindgen_malloc), a = K, o = q.pptxarchive_new(i, a, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
|
454
|
+
if (o[2]) throw B(o[1]);
|
|
455
|
+
return this.__wbg_ptr = o[0] >>> 0, A.register(this, this.__wbg_ptr, this), this;
|
|
456
|
+
}
|
|
457
|
+
parse() {
|
|
458
|
+
let e = q.pptxarchive_parse(this.__wbg_ptr);
|
|
459
|
+
if (e[3]) throw B(e[2]);
|
|
460
|
+
var t = j(e[0], e[1]).slice();
|
|
461
|
+
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
462
|
+
}
|
|
463
|
+
presentation_bootstrap() {
|
|
464
|
+
let e = q.pptxarchive_presentation_bootstrap(this.__wbg_ptr);
|
|
465
|
+
if (e[3]) throw B(e[2]);
|
|
466
|
+
var t = j(e[0], e[1]).slice();
|
|
467
|
+
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
468
|
+
}
|
|
469
|
+
pull_slide(e, t, n, r) {
|
|
470
|
+
let i = q.pptxarchive_pull_slide(this.__wbg_ptr, e, t, n, r);
|
|
471
|
+
if (i[3]) throw B(i[2]);
|
|
472
|
+
var a = j(i[0], i[1]).slice();
|
|
473
|
+
return q.__wbindgen_free(i[0], i[1] * 1, 1), a;
|
|
474
|
+
}
|
|
475
|
+
resource_usage() {
|
|
476
|
+
let e = q.pptxarchive_resource_usage(this.__wbg_ptr);
|
|
477
|
+
if (e[3]) throw B(e[2]);
|
|
478
|
+
var t = j(e[0], e[1]).slice();
|
|
479
|
+
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
480
|
+
}
|
|
481
|
+
slide_cursor_resource_usage() {
|
|
482
|
+
let e = q.pptxarchive_slide_cursor_resource_usage(this.__wbg_ptr);
|
|
483
|
+
if (e[3]) throw B(e[2]);
|
|
484
|
+
var t = j(e[0], e[1]).slice();
|
|
485
|
+
return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
|
|
486
|
+
}
|
|
487
|
+
to_markdown() {
|
|
488
|
+
let e, t;
|
|
489
|
+
try {
|
|
490
|
+
let i = q.pptxarchive_to_markdown(this.__wbg_ptr);
|
|
491
|
+
var n = i[0], r = i[1];
|
|
492
|
+
if (i[3]) throw n = 0, r = 0, B(i[2]);
|
|
493
|
+
return e = n, t = r, P(n, r);
|
|
494
|
+
} finally {
|
|
495
|
+
q.__wbindgen_free(e, t, 1);
|
|
496
|
+
}
|
|
497
|
+
}
|
|
498
|
+
};
|
|
499
|
+
Symbol.dispose && (T.prototype[Symbol.dispose] = T.prototype.free);
|
|
500
|
+
function se(e, t, n, r) {
|
|
501
|
+
let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_image(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
|
502
|
+
if (c[3]) throw B(c[2]);
|
|
503
|
+
var l = j(c[0], c[1]).slice();
|
|
504
|
+
return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
|
505
|
+
}
|
|
506
|
+
function E(e, t, n, r) {
|
|
507
|
+
let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_media(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
|
|
508
|
+
if (c[3]) throw B(c[2]);
|
|
509
|
+
var l = j(c[0], c[1]).slice();
|
|
510
|
+
return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
|
|
511
|
+
}
|
|
512
|
+
function D(e, t, n) {
|
|
513
|
+
let r = R(e, q.__wbindgen_malloc), i = K, a = q.parse_pptx(r, i, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n);
|
|
514
|
+
if (a[3]) throw B(a[2]);
|
|
515
|
+
var o = j(a[0], a[1]).slice();
|
|
516
|
+
return q.__wbindgen_free(a[0], a[1] * 1, 1), o;
|
|
517
|
+
}
|
|
518
|
+
function O(e, t, n) {
|
|
519
|
+
let r, i;
|
|
520
|
+
try {
|
|
521
|
+
let s = R(e, q.__wbindgen_malloc), c = K, l = q.pptx_to_markdown(s, c, !L(t), L(t) ? BigInt(0) : t, !L(n), L(n) ? BigInt(0) : n);
|
|
522
|
+
var a = l[0], o = l[1];
|
|
523
|
+
if (l[3]) throw a = 0, o = 0, B(l[2]);
|
|
524
|
+
return r = a, i = o, P(a, o);
|
|
525
|
+
} finally {
|
|
526
|
+
q.__wbindgen_free(r, i, 1);
|
|
527
|
+
}
|
|
528
|
+
}
|
|
529
|
+
function k() {
|
|
530
|
+
return {
|
|
531
|
+
__proto__: null,
|
|
532
|
+
"./pptx_parser_bg.js": {
|
|
533
|
+
__proto__: null,
|
|
534
|
+
__wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
|
|
535
|
+
throw Error(P(e, t));
|
|
536
|
+
},
|
|
537
|
+
__wbg_error_a6fa202b58aa1cd3: function(e, t) {
|
|
538
|
+
let n, r;
|
|
539
|
+
try {
|
|
540
|
+
n = e, r = t, console.error(P(e, t));
|
|
541
|
+
} finally {
|
|
542
|
+
q.__wbindgen_free(n, r, 1);
|
|
543
|
+
}
|
|
544
|
+
},
|
|
545
|
+
__wbg_new_227d7c05414eb861: function() {
|
|
546
|
+
return /* @__PURE__ */ Error();
|
|
547
|
+
},
|
|
548
|
+
__wbg_stack_3b0d974bbf31e44f: function(e, t) {
|
|
549
|
+
let n = t.stack, r = z(n, q.__wbindgen_malloc, q.__wbindgen_realloc), i = K;
|
|
550
|
+
N().setInt32(e + 4, i, !0), N().setInt32(e + 0, r, !0);
|
|
551
|
+
},
|
|
552
|
+
__wbindgen_cast_0000000000000001: function(e, t) {
|
|
553
|
+
return P(e, t);
|
|
554
|
+
},
|
|
555
|
+
__wbindgen_init_externref_table: function() {
|
|
556
|
+
let e = q.__wbindgen_externrefs, t = e.grow(4);
|
|
557
|
+
e.set(0, void 0), e.set(t + 0, void 0), e.set(t + 1, null), e.set(t + 2, !0), e.set(t + 3, !1);
|
|
558
|
+
}
|
|
559
|
+
}
|
|
560
|
+
};
|
|
561
|
+
}
|
|
562
|
+
var A = typeof FinalizationRegistry > "u" ? {
|
|
563
|
+
register: () => {},
|
|
564
|
+
unregister: () => {}
|
|
565
|
+
} : new FinalizationRegistry((e) => q.__wbg_pptxarchive_free(e >>> 0, 1));
|
|
566
|
+
function j(e, t) {
|
|
567
|
+
return e >>>= 0, I().subarray(e / 1, e / 1 + t);
|
|
568
|
+
}
|
|
569
|
+
var M = null;
|
|
570
|
+
function N() {
|
|
571
|
+
return (M === null || M.buffer.detached === !0 || M.buffer.detached === void 0 && M.buffer !== q.memory.buffer) && (M = new DataView(q.memory.buffer)), M;
|
|
572
|
+
}
|
|
573
|
+
function P(e, t) {
|
|
574
|
+
return e >>>= 0, W(e, t);
|
|
575
|
+
}
|
|
576
|
+
var F = null;
|
|
577
|
+
function I() {
|
|
578
|
+
return (F === null || F.byteLength === 0) && (F = new Uint8Array(q.memory.buffer)), F;
|
|
579
|
+
}
|
|
580
|
+
function L(e) {
|
|
581
|
+
return e == null;
|
|
582
|
+
}
|
|
583
|
+
function R(e, t) {
|
|
584
|
+
let n = t(e.length * 1, 1) >>> 0;
|
|
585
|
+
return I().set(e, n / 1), K = e.length, n;
|
|
586
|
+
}
|
|
587
|
+
function z(e, t, n) {
|
|
588
|
+
if (n === void 0) {
|
|
589
|
+
let n = G.encode(e), r = t(n.length, 1) >>> 0;
|
|
590
|
+
return I().subarray(r, r + n.length).set(n), K = n.length, r;
|
|
591
|
+
}
|
|
592
|
+
let r = e.length, i = t(r, 1) >>> 0, a = I(), o = 0;
|
|
593
|
+
for (; o < r; o++) {
|
|
594
|
+
let t = e.charCodeAt(o);
|
|
595
|
+
if (t > 127) break;
|
|
596
|
+
a[i + o] = t;
|
|
597
|
+
}
|
|
598
|
+
if (o !== r) {
|
|
599
|
+
o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
|
|
600
|
+
let t = I().subarray(i + o, i + r), a = G.encodeInto(e, t);
|
|
601
|
+
o += a.written, i = n(i, r, o, 1) >>> 0;
|
|
602
|
+
}
|
|
603
|
+
return K = o, i;
|
|
604
|
+
}
|
|
605
|
+
function B(e) {
|
|
606
|
+
let t = q.__wbindgen_externrefs.get(e);
|
|
607
|
+
return q.__externref_table_dealloc(e), t;
|
|
608
|
+
}
|
|
609
|
+
var V = new TextDecoder("utf-8", {
|
|
610
|
+
ignoreBOM: !0,
|
|
611
|
+
fatal: !0
|
|
612
|
+
});
|
|
613
|
+
V.decode();
|
|
614
|
+
var H = 2146435072, U = 0;
|
|
615
|
+
function W(e, t) {
|
|
616
|
+
return U += t, U >= H && (V = new TextDecoder("utf-8", {
|
|
617
|
+
ignoreBOM: !0,
|
|
618
|
+
fatal: !0
|
|
619
|
+
}), V.decode(), U = t), V.decode(I().subarray(e, e + t));
|
|
620
|
+
}
|
|
621
|
+
var G = new TextEncoder();
|
|
622
|
+
"encodeInto" in G || (G.encodeInto = function(e, t) {
|
|
623
|
+
let n = G.encode(e);
|
|
624
|
+
return t.set(n), {
|
|
625
|
+
read: e.length,
|
|
626
|
+
written: n.length
|
|
627
|
+
};
|
|
628
|
+
});
|
|
629
|
+
var K = 0, q;
|
|
630
|
+
function J(e, t) {
|
|
631
|
+
return q = e.exports, M = null, F = null, q.__wbindgen_start(), q;
|
|
632
|
+
}
|
|
633
|
+
async function ce(e, t) {
|
|
634
|
+
if (typeof Response == "function" && e instanceof Response) {
|
|
635
|
+
if (typeof WebAssembly.instantiateStreaming == "function") try {
|
|
636
|
+
return await WebAssembly.instantiateStreaming(e, t);
|
|
637
|
+
} catch (t) {
|
|
638
|
+
if (e.ok && n(e.type) && e.headers.get("Content-Type") !== "application/wasm") console.warn("`WebAssembly.instantiateStreaming` failed because your server does not serve Wasm with `application/wasm` MIME type. Falling back to `WebAssembly.instantiate` which is slower. Original error:\n", t);
|
|
639
|
+
else throw t;
|
|
640
|
+
}
|
|
641
|
+
let r = await e.arrayBuffer();
|
|
642
|
+
return await WebAssembly.instantiate(r, t);
|
|
643
|
+
} else {
|
|
644
|
+
let n = await WebAssembly.instantiate(e, t);
|
|
645
|
+
return n instanceof WebAssembly.Instance ? {
|
|
646
|
+
instance: n,
|
|
647
|
+
module: e
|
|
648
|
+
} : n;
|
|
649
|
+
}
|
|
650
|
+
function n(e) {
|
|
651
|
+
switch (e) {
|
|
652
|
+
case "basic":
|
|
653
|
+
case "cors":
|
|
654
|
+
case "default": return !0;
|
|
655
|
+
}
|
|
656
|
+
return !1;
|
|
657
|
+
}
|
|
658
|
+
}
|
|
659
|
+
function le(e) {
|
|
660
|
+
if (q !== void 0) return q;
|
|
661
|
+
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
|
|
662
|
+
let t = k();
|
|
663
|
+
return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), J(new WebAssembly.Instance(e, t), e);
|
|
664
|
+
}
|
|
665
|
+
async function Y(e) {
|
|
666
|
+
if (q !== void 0) return q;
|
|
667
|
+
e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module_or_path: e} = e : console.warn("using deprecated parameters for the initialization function; pass a single object instead"));
|
|
668
|
+
let t = k();
|
|
669
|
+
(typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
|
|
670
|
+
let { instance: n, module: r } = await ce(await e, t);
|
|
671
|
+
return J(n, r);
|
|
672
|
+
}
|
|
673
|
+
async function ue(e) {
|
|
674
|
+
return q = void 0, M = null, F = null, Y(e);
|
|
675
|
+
}
|
|
676
|
+
//#endregion
|
|
677
|
+
//#region packages/pptx/src/internal/node-acquisition.ts
|
|
678
|
+
var X, Z;
|
|
679
|
+
function de(e) {
|
|
680
|
+
if (!Z) X = e, Z = new w(oe, e);
|
|
681
|
+
else if (X !== e) throw Error("PPTX runtime was already initialized with another WebAssembly.Module");
|
|
682
|
+
return Z;
|
|
683
|
+
}
|
|
684
|
+
async function fe(e, t, i = {}) {
|
|
685
|
+
let o = r(i), s = new l({
|
|
686
|
+
enabled: o.debug || o.onResourceMetrics !== void 0,
|
|
687
|
+
format: "pptx",
|
|
688
|
+
mode: "node",
|
|
689
|
+
scope: "session",
|
|
690
|
+
policy: o.policy,
|
|
691
|
+
onMetrics: o.onResourceMetrics,
|
|
692
|
+
emitToConsole: o.debug
|
|
693
|
+
});
|
|
694
|
+
s.setSourceBytes(e.byteLength);
|
|
695
|
+
let c;
|
|
696
|
+
try {
|
|
697
|
+
Q(i.signal);
|
|
698
|
+
let [r, l, u] = a(o.policy), d = T;
|
|
699
|
+
c = await de(t).open(() => new d(e, r, l, u), {
|
|
700
|
+
signal: i.signal,
|
|
701
|
+
abortError: $,
|
|
702
|
+
disposeOnAbort: (e) => e.free()
|
|
703
|
+
}), Q(i.signal);
|
|
704
|
+
let f = c.proxy, p = n(JSON.parse(new TextDecoder().decode(f.presentation_bootstrap())));
|
|
705
|
+
return s.checkpoint("presentation bootstrap ready"), {
|
|
706
|
+
archive: f,
|
|
707
|
+
bootstrap: p,
|
|
708
|
+
metrics: s,
|
|
709
|
+
closeArchive: () => c?.close((e) => e.free())
|
|
710
|
+
};
|
|
711
|
+
} catch (e) {
|
|
712
|
+
try {
|
|
713
|
+
c?.close((e) => e.free());
|
|
714
|
+
} catch {}
|
|
715
|
+
let t = u(e) ?? e;
|
|
716
|
+
throw s.fail(t), t;
|
|
717
|
+
}
|
|
718
|
+
}
|
|
719
|
+
function Q(e) {
|
|
720
|
+
if (e?.aborted) throw $();
|
|
721
|
+
}
|
|
722
|
+
function $() {
|
|
723
|
+
let e = /* @__PURE__ */ Error("PPTX presentation session was aborted");
|
|
724
|
+
return e.name = "AbortError", e;
|
|
725
|
+
}
|
|
726
|
+
//#endregion
|
|
727
|
+
//#region packages/pptx/src/internal/session.ts
|
|
728
|
+
var pe = /* @__PURE__ */ e({ renderSlide: () => t });
|
|
729
|
+
//#endregion
|
|
730
|
+
export { x as a, ne as i, fe as n, w as r, pe as t };
|