@silurus/ooxml 0.88.0 → 0.89.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.
Files changed (127) hide show
  1. package/README.md +118 -23
  2. package/THIRD_PARTY_NOTICES.md +8 -7
  3. package/dist/abort-VrnK7mdP.js +10 -0
  4. package/dist/assets/render-worker-C5G_Nr_A.js +35 -0
  5. package/dist/assets/render-worker-DQfWdNsm.js +16 -0
  6. package/dist/assets/render-worker-Ds7LjwU-.js +15 -0
  7. package/dist/{hyperlink-Cxzhet30.js → bounded-raw-part-cache-CsnNptAy.js} +4937 -7458
  8. package/dist/bundled-asset-url-E2nXURF9.js +15 -0
  9. package/dist/canvas-viewer-mechanics-BZ8QCrRi.js +675 -0
  10. package/dist/cfb-guard-dNeUiANF.js +528 -0
  11. package/dist/chart-ex.mjs +667 -663
  12. package/dist/comment-overlay-controller-CBvQx-En.js +994 -0
  13. package/dist/comment-ui-runtime-B7ZvovcS.js +2 -0
  14. package/dist/{comment-ui-runtime-DcJOYlw-.js → comment-ui-runtime-BKidRH36.js} +5 -5
  15. package/dist/{comment-ui-runtime-CWGqn5Vr.js → comment-ui-runtime-C47QoDUy.js} +5 -5
  16. package/dist/delimited-text-worker-host-CikWU6_m.js +27 -0
  17. package/dist/document-model-source-MzFPrxt0.js +249 -0
  18. package/dist/document-pull-client-BoJeuURD.js +35941 -0
  19. package/dist/document-pull-worker-CaP8XESP.js +104 -0
  20. package/dist/docx-BN70UhvX.js +495 -0
  21. package/dist/docx-BRRtSvk3.js +3563 -0
  22. package/dist/docx-model-source-CTO9iw_W.js +98 -0
  23. package/dist/docx-source-worker.mjs +455 -0
  24. package/dist/docx.mjs +7 -7
  25. package/dist/docx_parser_bg.wasm +0 -0
  26. package/dist/drawingml-shape-CHmq8kpM.js +310 -0
  27. package/dist/duotone-DN8P4aXe.js +126 -0
  28. package/dist/emf-CGFQIz6c.js +1790 -0
  29. package/dist/font-preload-demand-Dmy31xt-.js +2058 -0
  30. package/dist/grid-geometry-C3IG20ut.js +384 -0
  31. package/dist/host-layout-DVMw8hDY.js +56 -0
  32. package/dist/host-layout-measure-DsuQ2UJs.js +7 -0
  33. package/dist/in-process-pull-transport-DuXcPZng.js +29 -0
  34. package/dist/index.mjs +4 -4
  35. package/dist/internal-companion.mjs +12 -0
  36. package/dist/line-distribute-Bu8psjGd.js +2799 -0
  37. package/dist/math.mjs +2 -2
  38. package/dist/mathjax-stix2.js +10 -10
  39. package/dist/model-source-kz_NkZqT.js +179 -0
  40. package/dist/model-source-s5hRpk4w.js +61 -0
  41. package/dist/model-source-session-6fuaqbGs.js +71 -0
  42. package/dist/model-source-session-DqrR4XHR.js +85 -0
  43. package/dist/model-source-session-cPJSF_Ak.js +58 -0
  44. package/dist/node.mjs +7 -1327
  45. package/dist/{pixel-budget-9P63Bsk5.js → pixel-budget-BpTYrepD.js} +13 -10
  46. package/dist/plot-area-frame-Bs_j4uu7.js +41811 -0
  47. package/dist/pptx-CaJ6ILnw.js +183 -0
  48. package/dist/pptx-_BOGcBym.js +2936 -0
  49. package/dist/pptx-model-source-B_9afw9R.js +37 -0
  50. package/dist/pptx-source-worker.mjs +446 -0
  51. package/dist/pptx.mjs +8 -7
  52. package/dist/pptx_parser_bg.wasm +0 -0
  53. package/dist/presentation-model-source-CGHLyX32.js +77 -0
  54. package/dist/raster-target-YQ4G6rxo.js +42 -0
  55. package/dist/region-map.mjs +117 -153
  56. package/dist/{render-D3iqVKCo.js → render-CzbDzRKa.js} +3 -3
  57. package/dist/{render-worker-host-B5wQfB7U.js → render-worker-host-B1u6BOUd.js} +1 -1
  58. package/dist/{render-worker-host-D4123J27.js → render-worker-host-C-EECo68.js} +1 -1
  59. package/dist/{render-worker-host-Di3LxLc0.js → render-worker-host-DDqZTCVf.js} +1 -1
  60. package/dist/renderer-CD2cvVAF.js +5823 -0
  61. package/dist/renderer-DRoeb14O.js +5170 -0
  62. package/dist/resource-measurement-Dhhm7P_l.js +772 -0
  63. package/dist/session-XPmC0CUd.js +656 -0
  64. package/dist/slide-pull-client-tq7U_fYg.js +6485 -0
  65. package/dist/three-d-BKwNPAP4.js +878 -0
  66. package/dist/three-d.mjs +925 -910
  67. package/dist/{raster-target-ojDdQizC.js → tiff-contract-C6M3QcPp.js} +1 -42
  68. package/dist/tiff.mjs +401 -248
  69. package/dist/types/chart-ex.d.ts +149 -2
  70. package/dist/types/docx.d.ts +333 -96
  71. package/dist/types/index.d.ts +566 -301
  72. package/dist/types/internal-companion.d.ts +11 -0
  73. package/dist/types/math.d.ts +1 -1
  74. package/dist/types/node.d.ts +422 -9
  75. package/dist/types/pptx.d.ts +302 -95
  76. package/dist/types/region-map.d.ts +149 -2
  77. package/dist/types/three-d.d.ts +149 -2
  78. package/dist/types/tiff.d.ts +1 -1
  79. package/dist/types/xlsx.d.ts +343 -132
  80. package/dist/wasm-loader-rlgHmcSv.js +35 -0
  81. package/dist/wasm-runtime-generation-D6TKZdNb.js +97 -0
  82. package/dist/workbook-model-source-BIGrfZy6.js +94 -0
  83. package/dist/worker-source-DrwhR9fw.js +22 -0
  84. package/dist/worker-source-SbudzjYL.js +22 -0
  85. package/dist/worker-source-UAi3GNcM.js +22 -0
  86. package/dist/worksheet-pull-client-ClvPO_Jf.js +579 -0
  87. package/dist/xlsx-CsmREBaZ.js +5819 -0
  88. package/dist/xlsx-DmHfeNNp.js +534 -0
  89. package/dist/xlsx-model-source-D1flORqy.js +309 -0
  90. package/dist/xlsx-source-worker.mjs +525 -0
  91. package/dist/xlsx.mjs +8 -7
  92. package/dist/xlsx_parser_bg.wasm +0 -0
  93. package/package.json +42 -16
  94. package/dist/assets/render-worker-1uPAxMZr.js +0 -31
  95. package/dist/assets/render-worker-BlvJybji.js +0 -10
  96. package/dist/assets/render-worker-CzmiJfFL.js +0 -11
  97. package/dist/bounded-raw-part-cache-Cg1BsSZQ.js +0 -119
  98. package/dist/canvas-viewer-mechanics-DbLz0rYW.js +0 -1384
  99. package/dist/cjk-fallback-bLI3z70h.js +0 -46
  100. package/dist/comment-occurrence-C8Y2uoVr.js +0 -6
  101. package/dist/comment-ui-runtime-BsK8pmUT.js +0 -2
  102. package/dist/comments-Diid5ujN.js +0 -246
  103. package/dist/delimited-text-worker-host-BVY-Ecni.js +0 -27
  104. package/dist/document-pull-client-B9PTM-pL.js +0 -27280
  105. package/dist/docx-BF9WXrYH.js +0 -3103
  106. package/dist/dom-interaction-boundary-Cnm8DSBN.js +0 -223
  107. package/dist/highlight-rect-C5hkRqUr.js +0 -13
  108. package/dist/line-distribute-D1WNHKz_.js +0 -1023
  109. package/dist/line-metrics-B60C86uh.js +0 -60
  110. package/dist/plot-area-frame-DLTYKHNP.js +0 -4354
  111. package/dist/pptx-DkyYBYoL.js +0 -3065
  112. package/dist/renderer-B4GZb5We.js +0 -6492
  113. package/dist/resource-measurement-SHQCbkh2.js +0 -150
  114. package/dist/session-BGq81gRQ.js +0 -743
  115. package/dist/slide-pull-client-DiPnm240.js +0 -6253
  116. package/dist/source-key-DIJG8BA0.js +0 -42
  117. package/dist/three-d-DJBl8g8M.js +0 -1162
  118. package/dist/transfer-p6iCC2R7.js +0 -6
  119. package/dist/units-BzZ0gAxs.js +0 -4
  120. package/dist/worksheet-pull-client-BM8ywvbu.js +0 -458
  121. package/dist/xlsx-C9NVjgaV.js +0 -8484
  122. /package/dist/{chunk-DmhlhrBa.js → chunk-Dy4uBu1J.js} +0 -0
  123. /package/dist/{mathjax-DoyWZbSp.js → mathjax-BhwN6ilc.js} +0 -0
  124. /package/dist/{read-only-comment-decoration-Dz7eTQ4d.js → read-only-comment-decoration-PidH0wnP.js} +0 -0
  125. /package/dist/{read-only-comment-margin-DkgzASAl.js → read-only-comment-margin-B52rDVKo.js} +0 -0
  126. /package/dist/{renderer-module-contract-D91rkYHH.js → renderer-module-contract-CWM7jv6d.js} +0 -0
  127. /package/dist/{visible-index-BgiHEc1z.js → visible-index-FeVA0mGE.js} +0 -0
@@ -1,743 +0,0 @@
1
- import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { F as t, G as n, H as r, J as i, K as a, L as o, N as s, P as c, Qt as l, U as u, V as d, W as f, X as p, Y as m, Z as h, un as g, z as _ } from "./hyperlink-Cxzhet30.js";
3
- import { a as v, l as y } from "./slide-pull-client-DiPnm240.js";
4
- import { t as b } from "./transfer-p6iCC2R7.js";
5
- //#region packages/pptx/src/slide-cursor-operation.ts
6
- function x(e) {
7
- try {
8
- return r(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", ne = "ooxml-pull-reset-failed", re = class {
33
- coordinatorGeneration = new t();
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(), S(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, i = 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 i, o = !1, s = new c({
70
- ...t,
71
- maxByteCredit: l,
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 a(e, n, l) || (this.latchResourceFailure(e), e);
80
- }
81
- let s = b(r);
82
- return this.acceptSlide && (i = JSON.parse(new TextDecoder().decode(new Uint8Array(s)))), o = !0, {
83
- payload: s,
84
- byteLength: s.byteLength,
85
- done: !0,
86
- transfer: [s]
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, i, this.acceptSlide);
94
- } catch (e) {
95
- throw this.latchResourceFailure(e), e;
96
- }
97
- o = !1, i = 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
- i = 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
- i = 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: s,
124
- identity: t
125
- }), this.pendingOpens.delete(t.sessionId);
126
- }));
127
- this.operationTail = o.then(() => i, () => 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 r = this.sessions.get(e.sessionId);
153
- if (r) return r.host.dispatch(e, t);
154
- let i = this.pendingOpens.get(e.sessionId);
155
- if (i && (e.kind === "cancel" || e.kind === "close")) {
156
- let n = C(i.identity, e);
157
- return n && (i.canceled = !0), t(n ? {
158
- protocol: s,
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: s,
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: s,
177
- kind: "error",
178
- sessionId: e.sessionId,
179
- operationId: e.operationId,
180
- generation: e.generation,
181
- requestId: e.requestId,
182
- error: n(/* @__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 (r) {
189
- try {
190
- t({
191
- protocol: s,
192
- kind: "error",
193
- sessionId: e.sessionId,
194
- operationId: e.operationId,
195
- generation: e.generation,
196
- requestId: e.requestId,
197
- error: n(r)
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: s,
231
- kind: "close",
232
- ...n,
233
- requestId: e++
234
- }, (e) => {
235
- e.kind === "error" && (r = u(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 t(), 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 ? ne : 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: s,
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: s,
266
- kind: "error",
267
- sessionId: e.sessionId,
268
- operationId: e.operationId,
269
- generation: e.generation,
270
- requestId: e.requestId,
271
- error: n(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: s,
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 g ? e : f(e);
299
- t && (this.resourceFailure ??= t);
300
- }
301
- staleLifecycleResponse(e) {
302
- return {
303
- protocol: s,
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 S(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 p(e) ? new i(`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 h(() => 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, m(t);
407
- }
408
- }, T = /* @__PURE__ */ e({
409
- PptxArchive: () => E,
410
- default: () => Y,
411
- extract_font: () => D,
412
- extract_image: () => O,
413
- extract_media: () => oe,
414
- initSync: () => ue,
415
- parse_pptx: () => se,
416
- pptx_to_markdown: () => ce,
417
- reinit: () => de
418
- }), E = class {
419
- __destroy_into_raw() {
420
- let e = this.__wbg_ptr;
421
- return this.__wbg_ptr = 0, A.unregister(this), e;
422
- }
423
- free() {
424
- let e = this.__destroy_into_raw();
425
- q.__wbg_pptxarchive_free(e, 0);
426
- }
427
- acknowledge_slide(e, t) {
428
- let n = q.pptxarchive_acknowledge_slide(this.__wbg_ptr, e, t);
429
- if (n[1]) throw B(n[0]);
430
- }
431
- assert_healthy() {
432
- let e = q.pptxarchive_assert_healthy(this.__wbg_ptr);
433
- if (e[1]) throw B(e[0]);
434
- }
435
- cancel_slide() {
436
- q.pptxarchive_cancel_slide(this.__wbg_ptr);
437
- }
438
- close_presentation_session() {
439
- q.pptxarchive_close_presentation_session(this.__wbg_ptr);
440
- }
441
- extract_font(e) {
442
- let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_font(this.__wbg_ptr, t, n);
443
- if (r[3]) throw B(r[2]);
444
- var i = j(r[0], r[1]).slice();
445
- return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
446
- }
447
- extract_image(e) {
448
- let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_image(this.__wbg_ptr, t, n);
449
- if (r[3]) throw B(r[2]);
450
- var i = j(r[0], r[1]).slice();
451
- return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
452
- }
453
- extract_media(e) {
454
- let t = z(e, q.__wbindgen_malloc, q.__wbindgen_realloc), n = K, r = q.pptxarchive_extract_media(this.__wbg_ptr, t, n);
455
- if (r[3]) throw B(r[2]);
456
- var i = j(r[0], r[1]).slice();
457
- return q.__wbindgen_free(r[0], r[1] * 1, 1), i;
458
- }
459
- constructor(e, t, n, r) {
460
- 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);
461
- if (o[2]) throw B(o[1]);
462
- return this.__wbg_ptr = o[0] >>> 0, A.register(this, this.__wbg_ptr, this), this;
463
- }
464
- parse() {
465
- let e = q.pptxarchive_parse(this.__wbg_ptr);
466
- if (e[3]) throw B(e[2]);
467
- var t = j(e[0], e[1]).slice();
468
- return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
469
- }
470
- presentation_bootstrap() {
471
- let e = q.pptxarchive_presentation_bootstrap(this.__wbg_ptr);
472
- if (e[3]) throw B(e[2]);
473
- var t = j(e[0], e[1]).slice();
474
- return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
475
- }
476
- pull_slide(e, t, n, r) {
477
- let i = q.pptxarchive_pull_slide(this.__wbg_ptr, e, t, n, r);
478
- if (i[3]) throw B(i[2]);
479
- var a = j(i[0], i[1]).slice();
480
- return q.__wbindgen_free(i[0], i[1] * 1, 1), a;
481
- }
482
- resource_usage() {
483
- let e = q.pptxarchive_resource_usage(this.__wbg_ptr);
484
- if (e[3]) throw B(e[2]);
485
- var t = j(e[0], e[1]).slice();
486
- return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
487
- }
488
- slide_cursor_resource_usage() {
489
- let e = q.pptxarchive_slide_cursor_resource_usage(this.__wbg_ptr);
490
- if (e[3]) throw B(e[2]);
491
- var t = j(e[0], e[1]).slice();
492
- return q.__wbindgen_free(e[0], e[1] * 1, 1), t;
493
- }
494
- to_markdown() {
495
- let e, t;
496
- try {
497
- let i = q.pptxarchive_to_markdown(this.__wbg_ptr);
498
- var n = i[0], r = i[1];
499
- if (i[3]) throw n = 0, r = 0, B(i[2]);
500
- return e = n, t = r, P(n, r);
501
- } finally {
502
- q.__wbindgen_free(e, t, 1);
503
- }
504
- }
505
- };
506
- Symbol.dispose && (E.prototype[Symbol.dispose] = E.prototype.free);
507
- function D(e, t, n, r) {
508
- let i = R(e, q.__wbindgen_malloc), a = K, o = z(t, q.__wbindgen_malloc, q.__wbindgen_realloc), s = K, c = q.extract_font(i, a, o, s, !L(n), L(n) ? BigInt(0) : n, !L(r), L(r) ? BigInt(0) : r);
509
- if (c[3]) throw B(c[2]);
510
- var l = j(c[0], c[1]).slice();
511
- return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
512
- }
513
- function O(e, t, n, r) {
514
- 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);
515
- if (c[3]) throw B(c[2]);
516
- var l = j(c[0], c[1]).slice();
517
- return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
518
- }
519
- function oe(e, t, n, r) {
520
- 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);
521
- if (c[3]) throw B(c[2]);
522
- var l = j(c[0], c[1]).slice();
523
- return q.__wbindgen_free(c[0], c[1] * 1, 1), l;
524
- }
525
- function se(e, t, n) {
526
- 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);
527
- if (a[3]) throw B(a[2]);
528
- var o = j(a[0], a[1]).slice();
529
- return q.__wbindgen_free(a[0], a[1] * 1, 1), o;
530
- }
531
- function ce(e, t, n) {
532
- let r, i;
533
- try {
534
- 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);
535
- var a = l[0], o = l[1];
536
- if (l[3]) throw a = 0, o = 0, B(l[2]);
537
- return r = a, i = o, P(a, o);
538
- } finally {
539
- q.__wbindgen_free(r, i, 1);
540
- }
541
- }
542
- function k() {
543
- return {
544
- __proto__: null,
545
- "./pptx_parser_bg.js": {
546
- __proto__: null,
547
- __wbg___wbindgen_throw_6b64449b9b9ed33c: function(e, t) {
548
- throw Error(P(e, t));
549
- },
550
- __wbg_error_a6fa202b58aa1cd3: function(e, t) {
551
- let n, r;
552
- try {
553
- n = e, r = t, console.error(P(e, t));
554
- } finally {
555
- q.__wbindgen_free(n, r, 1);
556
- }
557
- },
558
- __wbg_new_227d7c05414eb861: function() {
559
- return /* @__PURE__ */ Error();
560
- },
561
- __wbg_stack_3b0d974bbf31e44f: function(e, t) {
562
- let n = t.stack, r = z(n, q.__wbindgen_malloc, q.__wbindgen_realloc), i = K;
563
- N().setInt32(e + 4, i, !0), N().setInt32(e + 0, r, !0);
564
- },
565
- __wbindgen_cast_0000000000000001: function(e, t) {
566
- return P(e, t);
567
- },
568
- __wbindgen_init_externref_table: function() {
569
- let e = q.__wbindgen_externrefs, t = e.grow(4);
570
- 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);
571
- }
572
- }
573
- };
574
- }
575
- var A = typeof FinalizationRegistry > "u" ? {
576
- register: () => {},
577
- unregister: () => {}
578
- } : new FinalizationRegistry((e) => q.__wbg_pptxarchive_free(e >>> 0, 1));
579
- function j(e, t) {
580
- return e >>>= 0, I().subarray(e / 1, e / 1 + t);
581
- }
582
- var M = null;
583
- function N() {
584
- return (M === null || M.buffer.detached === !0 || M.buffer.detached === void 0 && M.buffer !== q.memory.buffer) && (M = new DataView(q.memory.buffer)), M;
585
- }
586
- function P(e, t) {
587
- return e >>>= 0, W(e, t);
588
- }
589
- var F = null;
590
- function I() {
591
- return (F === null || F.byteLength === 0) && (F = new Uint8Array(q.memory.buffer)), F;
592
- }
593
- function L(e) {
594
- return e == null;
595
- }
596
- function R(e, t) {
597
- let n = t(e.length * 1, 1) >>> 0;
598
- return I().set(e, n / 1), K = e.length, n;
599
- }
600
- function z(e, t, n) {
601
- if (n === void 0) {
602
- let n = G.encode(e), r = t(n.length, 1) >>> 0;
603
- return I().subarray(r, r + n.length).set(n), K = n.length, r;
604
- }
605
- let r = e.length, i = t(r, 1) >>> 0, a = I(), o = 0;
606
- for (; o < r; o++) {
607
- let t = e.charCodeAt(o);
608
- if (t > 127) break;
609
- a[i + o] = t;
610
- }
611
- if (o !== r) {
612
- o !== 0 && (e = e.slice(o)), i = n(i, r, r = o + e.length * 3, 1) >>> 0;
613
- let t = I().subarray(i + o, i + r), a = G.encodeInto(e, t);
614
- o += a.written, i = n(i, r, o, 1) >>> 0;
615
- }
616
- return K = o, i;
617
- }
618
- function B(e) {
619
- let t = q.__wbindgen_externrefs.get(e);
620
- return q.__externref_table_dealloc(e), t;
621
- }
622
- var V = new TextDecoder("utf-8", {
623
- ignoreBOM: !0,
624
- fatal: !0
625
- });
626
- V.decode();
627
- var H = 2146435072, U = 0;
628
- function W(e, t) {
629
- return U += t, U >= H && (V = new TextDecoder("utf-8", {
630
- ignoreBOM: !0,
631
- fatal: !0
632
- }), V.decode(), U = t), V.decode(I().subarray(e, e + t));
633
- }
634
- var G = new TextEncoder();
635
- "encodeInto" in G || (G.encodeInto = function(e, t) {
636
- let n = G.encode(e);
637
- return t.set(n), {
638
- read: e.length,
639
- written: n.length
640
- };
641
- });
642
- var K = 0, q;
643
- function J(e, t) {
644
- return q = e.exports, M = null, F = null, q.__wbindgen_start(), q;
645
- }
646
- async function le(e, t) {
647
- if (typeof Response == "function" && e instanceof Response) {
648
- if (typeof WebAssembly.instantiateStreaming == "function") try {
649
- return await WebAssembly.instantiateStreaming(e, t);
650
- } catch (t) {
651
- 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);
652
- else throw t;
653
- }
654
- let r = await e.arrayBuffer();
655
- return await WebAssembly.instantiate(r, t);
656
- } else {
657
- let n = await WebAssembly.instantiate(e, t);
658
- return n instanceof WebAssembly.Instance ? {
659
- instance: n,
660
- module: e
661
- } : n;
662
- }
663
- function n(e) {
664
- switch (e) {
665
- case "basic":
666
- case "cors":
667
- case "default": return !0;
668
- }
669
- return !1;
670
- }
671
- }
672
- function ue(e) {
673
- if (q !== void 0) return q;
674
- e !== void 0 && (Object.getPrototypeOf(e) === Object.prototype ? {module: e} = e : console.warn("using deprecated parameters for `initSync()`; pass a single object instead"));
675
- let t = k();
676
- return e instanceof WebAssembly.Module || (e = new WebAssembly.Module(e)), J(new WebAssembly.Instance(e, t), e);
677
- }
678
- async function Y(e) {
679
- if (q !== void 0) return q;
680
- 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"));
681
- let t = k();
682
- (typeof e == "string" || typeof Request == "function" && e instanceof Request || typeof URL == "function" && e instanceof URL) && (e = fetch(e));
683
- let { instance: n, module: r } = await le(await e, t);
684
- return J(n, r);
685
- }
686
- async function de(e) {
687
- return q = void 0, M = null, F = null, Y(e);
688
- }
689
- //#endregion
690
- //#region packages/pptx/src/internal/node-acquisition.ts
691
- var X, Z;
692
- function fe(e) {
693
- if (!Z) X = e, Z = new w(T, e);
694
- else if (X !== e) throw Error("PPTX runtime was already initialized with another WebAssembly.Module");
695
- return Z;
696
- }
697
- async function pe(e, t, n = {}) {
698
- let r = _(n), i = new o({
699
- enabled: r.debug || r.onResourceMetrics !== void 0,
700
- format: "pptx",
701
- mode: "node",
702
- scope: "session",
703
- policy: r.policy,
704
- onMetrics: r.onResourceMetrics,
705
- emitToConsole: r.debug
706
- });
707
- i.setSourceBytes(e.byteLength);
708
- let a;
709
- try {
710
- Q(n.signal);
711
- let [o, s, c] = d(r.policy), l = E;
712
- a = await fe(t).open(() => new l(e, o, s, c), {
713
- signal: n.signal,
714
- abortError: $,
715
- disposeOnAbort: (e) => e.free()
716
- }), Q(n.signal);
717
- let u = a.proxy, f = v(JSON.parse(new TextDecoder().decode(u.presentation_bootstrap())));
718
- return i.checkpoint("presentation bootstrap ready"), {
719
- archive: u,
720
- bootstrap: f,
721
- metrics: i,
722
- closeArchive: () => a?.close((e) => e.free())
723
- };
724
- } catch (e) {
725
- try {
726
- a?.close((e) => e.free());
727
- } catch {}
728
- let t = f(e) ?? e;
729
- throw i.fail(t), t;
730
- }
731
- }
732
- function Q(e) {
733
- if (e?.aborted) throw $();
734
- }
735
- function $() {
736
- let e = /* @__PURE__ */ Error("PPTX presentation session was aborted");
737
- return e.name = "AbortError", e;
738
- }
739
- //#endregion
740
- //#region packages/pptx/src/internal/session.ts
741
- var me = /* @__PURE__ */ e({ renderSlide: () => y });
742
- //#endregion
743
- export { x as a, re as i, pe as n, w as r, me as t };