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