@silurus/ooxml 0.68.0 → 0.70.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.
@@ -0,0 +1,3324 @@
1
+ import { A as e, C as t, D as n, E as r, F as i, G as a, H as o, J as s, K as c, L as l, M as u, N as d, O as f, R as p, T as m, U as h, V as g, W as _, X as v, Y as y, Z as b, _ as x, c as S, d as C, f as w, g as T, h as E, i as D, k as O, m as k, n as A, p as j, r as M, s as N, u as P, v as F, w as I, x as L, y as R, z } from "./line-metrics-DG9p1RvA.js";
2
+ import { a as B, c as V, d as H, f as U, i as W, l as G, n as ee, o as te, p as K, r as q, s as ne, t as re, u as ie } from "./virtual-scroll-CsikPntn.js";
3
+ import { i as ae, n as oe, r as se, t as ce } from "./visible-index-B4ljB_dg.js";
4
+ import { t as le } from "./mathjax-BRfWlbSJ.js";
5
+ //#region packages/pptx/src/text-layer.ts
6
+ function ue(e, t, n, r) {
7
+ e.innerHTML = "", e.style.width = `${n}px`, e.style.height = `${r}px`;
8
+ let i = /* @__PURE__ */ new Map();
9
+ for (let n of t) {
10
+ let t = n.rotation + (n.textBodyRotation ?? 0), r = `${n.shapeX},${n.shapeY},${n.shapeW},${n.shapeH},${t}`;
11
+ if (!i.has(r)) {
12
+ let a = document.createElement("div");
13
+ a.style.cssText = `position:absolute;left:${n.shapeX}px;top:${n.shapeY}px;width:${n.shapeW}px;height:${n.shapeH}px;pointer-events:all;overflow:hidden;`, t !== 0 && (a.style.transformOrigin = "center center", a.style.transform = `rotate(${t}deg)`), i.set(r, {
14
+ div: a,
15
+ x: n.shapeX,
16
+ y: n.shapeY,
17
+ w: n.shapeW,
18
+ h: n.shapeH,
19
+ rot: t
20
+ }), e.appendChild(a);
21
+ }
22
+ let a = i.get(r), o = document.createElement("span");
23
+ o.textContent = n.text, o.style.cssText = `position:absolute;left:${n.inShapeX}px;top:${n.inShapeY}px;font:${n.font};line-height:${n.h}px;letter-spacing:0;white-space:pre;color:transparent;cursor:text;`, a.div.appendChild(o);
24
+ }
25
+ }
26
+ //#endregion
27
+ //#region packages/pptx/src/types.ts
28
+ function de(e) {
29
+ return e;
30
+ }
31
+ //#endregion
32
+ //#region packages/core/src/shape/custgeom-endpoints.ts
33
+ var J = 1e-9;
34
+ function fe(e) {
35
+ return e.cmd === "lineTo" || e.cmd === "cubicBezTo" || e.cmd === "arcTo";
36
+ }
37
+ function pe(e, t, n, r) {
38
+ let i = n === 0 ? 0 : n, a = r === 0 ? 0 : r;
39
+ return {
40
+ x: e,
41
+ y: t,
42
+ dx: i,
43
+ dy: a,
44
+ angle: Math.atan2(a, i)
45
+ };
46
+ }
47
+ function me(e, t, n) {
48
+ switch (n.cmd) {
49
+ case "lineTo": return {
50
+ dx: n.x - e,
51
+ dy: n.y - t
52
+ };
53
+ case "cubicBezTo": {
54
+ let r = n.x1 - e, i = n.y1 - t;
55
+ return Math.abs(r) < J && Math.abs(i) < J && (r = n.x2 - e, i = n.y2 - t), Math.abs(r) < J && Math.abs(i) < J && (r = n.x - e, i = n.y - t), {
56
+ dx: r,
57
+ dy: i
58
+ };
59
+ }
60
+ case "arcTo": {
61
+ let e = n.stAng * Math.PI / 180, t = n.swAng < 0 ? -1 : 1;
62
+ return {
63
+ dx: -n.wr * Math.sin(e) * t,
64
+ dy: n.hr * Math.cos(e) * t
65
+ };
66
+ }
67
+ default: return {
68
+ dx: 0,
69
+ dy: 0
70
+ };
71
+ }
72
+ }
73
+ function he(e, t, n) {
74
+ switch (n.cmd) {
75
+ case "moveTo":
76
+ case "lineTo":
77
+ case "cubicBezTo": return {
78
+ x: n.x,
79
+ y: n.y
80
+ };
81
+ case "arcTo": {
82
+ if (n.wr <= 0 || n.hr <= 0) return {
83
+ x: e,
84
+ y: t
85
+ };
86
+ let r = n.stAng * Math.PI / 180, i = r + n.swAng * Math.PI / 180, a = e - n.wr * Math.cos(r), o = t - n.hr * Math.sin(r);
87
+ return {
88
+ x: a + n.wr * Math.cos(i),
89
+ y: o + n.hr * Math.sin(i)
90
+ };
91
+ }
92
+ default: return {
93
+ x: e,
94
+ y: t
95
+ };
96
+ }
97
+ }
98
+ function ge(e, t, n) {
99
+ let { x: r, y: i } = he(e, t, n);
100
+ switch (n.cmd) {
101
+ case "lineTo": return {
102
+ dx: n.x - e,
103
+ dy: n.y - t,
104
+ x: r,
105
+ y: i
106
+ };
107
+ case "cubicBezTo": {
108
+ let a = n.x - n.x2, o = n.y - n.y2;
109
+ return Math.abs(a) < J && Math.abs(o) < J && (a = n.x - n.x1, o = n.y - n.y1), Math.abs(a) < J && Math.abs(o) < J && (a = n.x - e, o = n.y - t), {
110
+ dx: a,
111
+ dy: o,
112
+ x: r,
113
+ y: i
114
+ };
115
+ }
116
+ case "arcTo": {
117
+ if (n.wr <= 0 || n.hr <= 0) return {
118
+ dx: 0,
119
+ dy: 0,
120
+ x: r,
121
+ y: i
122
+ };
123
+ let e = n.stAng * Math.PI / 180 + n.swAng * Math.PI / 180, t = n.swAng < 0 ? -1 : 1;
124
+ return {
125
+ dx: -n.wr * Math.sin(e) * t,
126
+ dy: n.hr * Math.cos(e) * t,
127
+ x: r,
128
+ y: i
129
+ };
130
+ }
131
+ default: return {
132
+ dx: 0,
133
+ dy: 0,
134
+ x: r,
135
+ y: i
136
+ };
137
+ }
138
+ }
139
+ function _e(e) {
140
+ let t = 0, n = 0, r = !1;
141
+ for (let i of e) i.cmd === "moveTo" && (r = !0), {x: t, y: n} = he(t, n, i);
142
+ return r ? {
143
+ x: t,
144
+ y: n
145
+ } : null;
146
+ }
147
+ function ve(e) {
148
+ if (e.some((e) => e.cmd === "close")) return !0;
149
+ let t = e.find((e) => e.cmd === "moveTo");
150
+ if (!t) return !1;
151
+ let n = _e(e);
152
+ return !n || !e.some(fe) ? !1 : Math.abs(n.x - t.x) < J && Math.abs(n.y - t.y) < J;
153
+ }
154
+ function ye(e) {
155
+ let t = {
156
+ start: null,
157
+ end: null
158
+ };
159
+ if (!e || e.length === 0) return t;
160
+ let n = e[0];
161
+ if (n && n.length > 0 && !ve(n)) {
162
+ let e = n.find((e) => e.cmd === "moveTo"), r = n.find(fe);
163
+ if (e && r) {
164
+ let n = me(e.x, e.y, r);
165
+ (Math.abs(n.dx) > J || Math.abs(n.dy) > J) && (t.start = pe(e.x, e.y, -n.dx, -n.dy));
166
+ }
167
+ }
168
+ let r = e[e.length - 1];
169
+ if (r && r.length > 0 && !ve(r)) {
170
+ let e = 0, n = 0, i = -1;
171
+ for (let e = 0; e < r.length; e++) fe(r[e]) && (i = e);
172
+ if (i >= 0) {
173
+ for (let t = 0; t < i; t++) ({x: e, y: n} = he(e, n, r[t]));
174
+ let a = ge(e, n, r[i]);
175
+ (Math.abs(a.dx) > J || Math.abs(a.dy) > J) && (t.end = pe(a.x, a.y, a.dx, a.dy));
176
+ }
177
+ }
178
+ return t;
179
+ }
180
+ //#endregion
181
+ //#region packages/core/src/shape/effects.ts
182
+ function be(e, t) {
183
+ return e * t;
184
+ }
185
+ function xe(e) {
186
+ return e.getContext("2d") ?? null;
187
+ }
188
+ function Se(e, t, n, r) {
189
+ let i = Math.max(0, Math.floor(e.x - t)), a = Math.max(0, Math.floor(e.y - t)), o = Math.min(n, Math.ceil(e.x + e.w + t)), s = Math.min(r, Math.ceil(e.y + e.h + t));
190
+ return {
191
+ x: i,
192
+ y: a,
193
+ w: Math.max(1, o - i),
194
+ h: Math.max(1, s - a)
195
+ };
196
+ }
197
+ function Ce(e, t) {
198
+ if (t.x === 0 && t.y === 0) return e;
199
+ let n = t.x, r = t.y;
200
+ return new Proxy(e, {
201
+ get(e, t) {
202
+ if (t === "setTransform") return (t) => {
203
+ e.setTransform(t.a, t.b, t.c, t.d, t.e - n, t.f - r);
204
+ };
205
+ let i = Reflect.get(e, t);
206
+ return typeof i == "function" ? i.bind(e) : i;
207
+ },
208
+ set(e, t, n) {
209
+ return e[t] = n, !0;
210
+ }
211
+ });
212
+ }
213
+ function we(e, t, n, r, i, a, o) {
214
+ let s = be(r.blur, i), c = be(r.dist, i), d = r.dir * Math.PI / 180, f = Math.cos(d) * c, p = Math.sin(d) * c, m = Se(n, Math.ceil(3 * s + Math.abs(c)) + 2, a, o), h = l(m.w, m.h);
215
+ if (!h) return;
216
+ let g = xe(h);
217
+ if (!g) return;
218
+ let _ = Ce(g, m);
219
+ _.save(), _.fillStyle = u(r.color, r.alpha), t(_), _.restore(), _.save(), _.globalCompositeOperation = "destination-out", _.filter = s > 0 ? `blur(${s}px)` : "none", _.translate(f, p), _.fillStyle = "#000", t(_), _.restore(), _.save(), _.globalCompositeOperation = "destination-in", _.filter = "none", _.fillStyle = "#000", t(_), _.restore(), e.save(), e.drawImage(h, m.x, m.y), e.restore();
220
+ }
221
+ function Te(e, t, n, r, i, a, o, s) {
222
+ let c = be(r.radius, i);
223
+ if (c <= 0) {
224
+ t(e);
225
+ return;
226
+ }
227
+ let u = Se(n, Math.ceil(c) + 2, a, o), d = n.x - u.x, f = n.y - u.y, p = l(u.w, u.h);
228
+ if (!p) {
229
+ t(e);
230
+ return;
231
+ }
232
+ let m = xe(p);
233
+ if (!m) {
234
+ t(e);
235
+ return;
236
+ }
237
+ let h = Ce(m, u), g = s ?? t;
238
+ t(h);
239
+ let _ = l(u.w, u.h), v = l(u.w, u.h), y = _ ? xe(_) : null, b = v ? xe(v) : null;
240
+ if (_ && y && v && b) {
241
+ let t = Ce(y, u);
242
+ t.fillStyle = "#000", g(t), b.drawImage(p, d, f, n.w, n.h, d - c, f - c, n.w + c * 2, n.h + c * 2), b.drawImage(p, 0, 0), b.globalCompositeOperation = "destination-in", b.filter = `blur(${c / 3}px)`, b.drawImage(_, 0, 0), b.filter = "none", b.globalCompositeOperation = "source-over", e.save(), e.drawImage(v, u.x, u.y), e.restore();
243
+ return;
244
+ }
245
+ e.save(), e.drawImage(p, 0, 0), e.restore();
246
+ }
247
+ function Ee(e, t, n, r, i, a, o) {
248
+ let s = l(a, o);
249
+ if (!s) return;
250
+ let c = xe(s);
251
+ if (!c) return;
252
+ let u = be(r.blur, i);
253
+ c.save(), u > 0 && (c.filter = `blur(${u}px)`), t(c), c.restore(), c.save(), c.globalCompositeOperation = "destination-in";
254
+ let d = n.y, f = n.y + n.h, p = c.createLinearGradient(0, f, 0, d), m = De(r.stPos), h = De(r.endPos);
255
+ p.addColorStop(0, `rgba(0,0,0,${r.stA})`), m > 0 && p.addColorStop(m, `rgba(0,0,0,${r.stA})`), h < 1 && h > m && p.addColorStop(h, `rgba(0,0,0,${r.endA})`), p.addColorStop(1, `rgba(0,0,0,${r.endA})`), c.fillStyle = p, c.fillRect(0, 0, a, o), c.restore();
256
+ let g = be(r.dist, i), _ = r.dir * Math.PI / 180, v = Math.cos(_) * g, y = Math.sin(_) * g;
257
+ e.save(), e.translate(n.x + v, f + y), e.scale(r.sx, r.sy), e.translate(-n.x, -f), e.drawImage(s, 0, 0), e.restore();
258
+ }
259
+ function De(e) {
260
+ return e < 0 ? 0 : e > 1 ? 1 : e;
261
+ }
262
+ //#endregion
263
+ //#region packages/core/src/shape/scene3d-camera.ts
264
+ var Y = 26, Oe = {
265
+ orthographicFront: {
266
+ kind: "orthographic",
267
+ baseLat: 0,
268
+ baseLon: 0,
269
+ baseRev: 0,
270
+ fovDeg: 0
271
+ },
272
+ perspectiveFront: {
273
+ kind: "perspective",
274
+ baseLat: 0,
275
+ baseLon: 0,
276
+ baseRev: 0,
277
+ fovDeg: Y
278
+ },
279
+ perspectiveRelaxed: {
280
+ kind: "perspective",
281
+ baseLat: 0,
282
+ baseLon: 0,
283
+ baseRev: 0,
284
+ fovDeg: Y
285
+ },
286
+ perspectiveRelaxedModerately: {
287
+ kind: "perspective",
288
+ baseLat: 0,
289
+ baseLon: 0,
290
+ baseRev: 0,
291
+ fovDeg: Y
292
+ },
293
+ perspectiveAbove: {
294
+ kind: "perspective",
295
+ baseLat: -20,
296
+ baseLon: 0,
297
+ baseRev: 0,
298
+ fovDeg: Y
299
+ },
300
+ perspectiveBelow: {
301
+ kind: "perspective",
302
+ baseLat: 20,
303
+ baseLon: 0,
304
+ baseRev: 0,
305
+ fovDeg: Y
306
+ },
307
+ perspectiveLeft: {
308
+ kind: "perspective",
309
+ baseLat: 0,
310
+ baseLon: -20,
311
+ baseRev: 0,
312
+ fovDeg: Y
313
+ },
314
+ perspectiveRight: {
315
+ kind: "perspective",
316
+ baseLat: 0,
317
+ baseLon: 20,
318
+ baseRev: 0,
319
+ fovDeg: Y
320
+ }
321
+ };
322
+ function ke(e, t) {
323
+ let n = Array(9).fill(0);
324
+ for (let r = 0; r < 3; r++) for (let i = 0; i < 3; i++) {
325
+ let a = 0;
326
+ for (let n = 0; n < 3; n++) a += e[r * 3 + n] * t[n * 3 + i];
327
+ n[r * 3 + i] = a;
328
+ }
329
+ return n;
330
+ }
331
+ function Ae(e) {
332
+ let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
333
+ return [
334
+ 1,
335
+ 0,
336
+ 0,
337
+ 0,
338
+ n,
339
+ -r,
340
+ 0,
341
+ r,
342
+ n
343
+ ];
344
+ }
345
+ function je(e) {
346
+ let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
347
+ return [
348
+ n,
349
+ 0,
350
+ r,
351
+ 0,
352
+ 1,
353
+ 0,
354
+ -r,
355
+ 0,
356
+ n
357
+ ];
358
+ }
359
+ function Me(e) {
360
+ let t = e * Math.PI / 180, n = Math.cos(t), r = Math.sin(t);
361
+ return [
362
+ n,
363
+ -r,
364
+ 0,
365
+ r,
366
+ n,
367
+ 0,
368
+ 0,
369
+ 0,
370
+ 1
371
+ ];
372
+ }
373
+ function Ne(e, t, n, r) {
374
+ return [
375
+ e[0] * t + e[1] * n + e[2] * r,
376
+ e[3] * t + e[4] * n + e[5] * r,
377
+ e[6] * t + e[7] * n + e[8] * r
378
+ ];
379
+ }
380
+ function Pe(e, t) {
381
+ let n = t ? t.lat : e.baseLat, r = t ? t.lon : e.baseLon;
382
+ return ke(Me(-(t ? t.rev : e.baseRev)), ke(Ae(-n), je(-r)));
383
+ }
384
+ function Fe(e) {
385
+ return Oe[e] ?? Oe.orthographicFront;
386
+ }
387
+ function Ie(e, t, n) {
388
+ let r = Fe(e.prst), i = Pe(r, e.rot);
389
+ if (t <= 0 || n <= 0) return {
390
+ corners: [
391
+ {
392
+ x: 0,
393
+ y: 0
394
+ },
395
+ {
396
+ x: t,
397
+ y: 0
398
+ },
399
+ {
400
+ x: t,
401
+ y: n
402
+ },
403
+ {
404
+ x: 0,
405
+ y: n
406
+ }
407
+ ],
408
+ isAffine: !0,
409
+ isIdentity: !0
410
+ };
411
+ let a = t / 2, o = n / 2, s = [
412
+ [-a, -o],
413
+ [a, -o],
414
+ [a, o],
415
+ [-a, o]
416
+ ], c = e.zoom ?? 1, l = Math.max(a, o), u;
417
+ if (r.kind === "perspective") {
418
+ let t = e.fov ?? r.fovDeg, n = Math.max(1, Math.min(179, t)) * Math.PI / 180, a = l / Math.tan(n / 2);
419
+ u = s.map(([e, t]) => {
420
+ let [n, r, o] = Ne(i, e, t, 0), s = a - o, c = a / (Math.abs(s) < 1e-6 ? 1e-6 * Math.sign(s || 1) : s);
421
+ return [n * c, r * c];
422
+ });
423
+ } else u = s.map(([e, t]) => {
424
+ let [n, r] = Ne(i, e, t, 0);
425
+ return [n, r];
426
+ });
427
+ u = u.map(([e, t]) => [e * c, t * c]);
428
+ let d = Infinity, f = Infinity, p = -Infinity, m = -Infinity;
429
+ for (let [e, t] of u) e < d && (d = e), t < f && (f = t), e > p && (p = e), t > m && (m = t);
430
+ let h = p - d || 1, g = m - f || 1, _ = Math.min(t / h, n / g), v = (d + p) / 2, y = (f + m) / 2, b = u.map(([e, r]) => ({
431
+ x: t / 2 + (e - v) * _,
432
+ y: n / 2 + (r - y) * _
433
+ })), x = .001 * Math.max(t, n), S = b[0].x + b[2].x - (b[1].x + b[3].x), C = b[0].y + b[2].y - (b[1].y + b[3].y), w = Math.abs(S) < x && Math.abs(C) < x, T = [
434
+ [0, 0],
435
+ [t, 0],
436
+ [t, n],
437
+ [0, n]
438
+ ], E = !0;
439
+ for (let e = 0; e < 4; e++) if (Math.abs(b[e].x - T[e][0]) > x || Math.abs(b[e].y - T[e][1]) > x) {
440
+ E = !1;
441
+ break;
442
+ }
443
+ return {
444
+ corners: b,
445
+ isAffine: w,
446
+ isIdentity: E
447
+ };
448
+ }
449
+ function Le(e) {
450
+ let { isIdentity: t } = Ie(e, 1e3, 1e3);
451
+ return !t;
452
+ }
453
+ function Re(e, t, n, r) {
454
+ let i = Fe(e.prst), a = Pe(i, e.rot);
455
+ if (t <= 0 || n <= 0 || r === 0) return {
456
+ x: 0,
457
+ y: 0
458
+ };
459
+ let o = t / 2, s = n / 2, c = Math.max(o, s), l = e.zoom ?? 1, u = (t) => {
460
+ let [n, r, o] = Ne(a, 0, 0, t);
461
+ if (i.kind === "perspective") {
462
+ let t = e.fov ?? i.fovDeg, a = Math.max(1, Math.min(179, t)) * Math.PI / 180, s = c / Math.tan(a / 2), u = s - o, d = s / (Math.abs(u) < 1e-6 ? 1e-6 * Math.sign(u || 1) : u);
463
+ return [n * d * l, r * d * l];
464
+ }
465
+ return [n * l, r * l];
466
+ }, [d, f] = u(0), [p, m] = u(-r);
467
+ return {
468
+ x: p - d,
469
+ y: m - f
470
+ };
471
+ }
472
+ //#endregion
473
+ //#region packages/core/src/shape/scene3d-draw.ts
474
+ function ze(e, t, n, r) {
475
+ let i = e.x, a = e.y, o = t.x, s = t.y, c = n.x, l = n.y, u = r.x, d = r.y, f = o - c, p = u - c, m = i - o + c - u, h = s - l, g = d - l, _ = a - s + l - d, v, y;
476
+ if (Math.abs(m) < 1e-12 && Math.abs(_) < 1e-12) v = 0, y = 0;
477
+ else {
478
+ let e = f * g - p * h;
479
+ if (Math.abs(e) < 1e-12) return null;
480
+ v = (m * g - p * _) / e, y = (f * _ - m * h) / e;
481
+ }
482
+ return [
483
+ o - i + v * o,
484
+ u - i + y * u,
485
+ i,
486
+ s - a + v * s,
487
+ d - a + y * d,
488
+ a,
489
+ v,
490
+ y,
491
+ 1
492
+ ];
493
+ }
494
+ function Be(e, t, n) {
495
+ let r = e[6] * t + e[7] * n + e[8];
496
+ return {
497
+ x: (e[0] * t + e[1] * n + e[2]) / r,
498
+ y: (e[3] * t + e[4] * n + e[5]) / r
499
+ };
500
+ }
501
+ var Ve = 1;
502
+ function He(e, t) {
503
+ let [n, r, i, a, o, s] = e, [c, l, u, d, f, p] = t;
504
+ return [
505
+ n * c + i * l,
506
+ r * c + a * l,
507
+ n * u + i * d,
508
+ r * u + a * d,
509
+ n * f + i * p + o,
510
+ r * f + a * p + s
511
+ ];
512
+ }
513
+ function Ue(e, t, n, r, i, a, o, s, c, l, u, d, f) {
514
+ let p = c - o, m = l - s;
515
+ if (p <= 0 || m <= 0) return;
516
+ let h = (d.x - u.x) / p, g = (d.y - u.y) / p, _ = (f.x - u.x) / m, v = (f.y - u.y) / m, y = (Math.hypot(d.x - u.x, d.y - u.y) || 1) * a, b = (Math.hypot(f.x - u.x, f.y - u.y) || 1) * a, x = Ve * p / y, S = Ve * m / b, C = Math.max(0, o - x), w = Math.max(0, s - S), T = Math.min(n, c + x), E = Math.min(r, l + S), D = T - C, O = E - w;
517
+ if (D <= 0 || O <= 0) return;
518
+ e.save();
519
+ let [k, A, j, M, N, P] = He(i, [
520
+ h,
521
+ g,
522
+ _,
523
+ v,
524
+ u.x - o * h - s * _,
525
+ u.y - o * g - s * v
526
+ ]);
527
+ e.setTransform(k, A, j, M, N, P), e.drawImage(t, C, w, D, O, C, w, D, O), e.restore();
528
+ }
529
+ function We(e, t, n, r, i, a, o, s, c, l, u, d, f) {
530
+ let p = Be(o, s, c), m = Be(o, l, c), h = Be(o, s, u), g = Be(o, l, u), _ = (s + l) / 2, v = (c + u) / 2, y = Be(o, _, v), b = {
531
+ x: (p.x + m.x + h.x + g.x) / 4,
532
+ y: (p.y + m.y + h.y + g.y) / 4
533
+ }, x = Ke(i), S = Math.hypot(y.x - b.x, y.y - b.y) * x;
534
+ if (f <= 0 || S <= d) {
535
+ Ue(e, t, n, r, i, a, s * n, c * r, l * n, u * r, p, m, h);
536
+ return;
537
+ }
538
+ l - s >= u - c ? (We(e, t, n, r, i, a, o, s, c, _, u, d, f - 1), We(e, t, n, r, i, a, o, _, c, l, u, d, f - 1)) : (We(e, t, n, r, i, a, o, s, c, l, v, d, f - 1), We(e, t, n, r, i, a, o, s, v, l, u, d, f - 1));
539
+ }
540
+ function Ge(e, t, n, r, i, a = .5) {
541
+ if (n <= 0 || r <= 0) return;
542
+ let [o, s, c, l] = i;
543
+ if (Math.abs(o.x * s.y - s.x * o.y + s.x * c.y - c.x * s.y + c.x * l.y - l.x * c.y + l.x * o.y - o.x * l.y) / 2 < 1e-6) return;
544
+ let u = ze(i[0], i[1], i[2], i[3]);
545
+ if (!u) return;
546
+ let d = t.getTransform(), f = [
547
+ d.a,
548
+ d.b,
549
+ d.c,
550
+ d.d,
551
+ d.e,
552
+ d.f
553
+ ], p = Ke(f);
554
+ Ze(e, t, n, r, i, f, p, u, a, 14) || (Ye(), t.save(), t.beginPath(), t.moveTo(i[0].x, i[0].y), t.lineTo(i[1].x, i[1].y), t.lineTo(i[2].x, i[2].y), t.lineTo(i[3].x, i[3].y), t.closePath(), t.clip(), We(t, e, n, r, f, p, u, 0, 0, 1, 1, a, 14), t.restore());
555
+ }
556
+ function Ke(e) {
557
+ return Math.sqrt(Math.abs(e[0] * e[3] - e[1] * e[2])) || 1;
558
+ }
559
+ function qe(e, t, n) {
560
+ let r = ze(e[0], e[1], e[2], e[3]);
561
+ if (!r) return null;
562
+ let i = [
563
+ [-t, -n],
564
+ [1 + t, -n],
565
+ [1 + t, 1 + n],
566
+ [-t, 1 + n]
567
+ ], a = [];
568
+ for (let [e, t] of i) {
569
+ if (!(r[6] * e + r[7] * t + r[8] > 1e-9)) return null;
570
+ a.push(Be(r, e, t));
571
+ }
572
+ return a;
573
+ }
574
+ var Je = !1;
575
+ function Ye() {
576
+ Je || (Je = !0, typeof console < "u" && typeof console.warn == "function" && console.warn("[ooxml] scene3d: no offscreen canvas available — using the direct warp fallback (per-cell bleed only, no supersample). Textured-source seams may be faintly visible; the silhouette and geometry are unaffected."));
577
+ }
578
+ var Xe = 2;
579
+ function Ze(e, t, n, r, i, a, o, s, c, u) {
580
+ let d = i.map((e) => ({
581
+ x: a[0] * e.x + a[2] * e.y + a[4],
582
+ y: a[1] * e.x + a[3] * e.y + a[5]
583
+ })), f = Infinity, p = Infinity, m = -Infinity, h = -Infinity;
584
+ for (let e of d) e.x < f && (f = e.x), e.y < p && (p = e.y), e.x > m && (m = e.x), e.y > h && (h = e.y);
585
+ f = Math.floor(f) - 1, p = Math.floor(p) - 1, m = Math.ceil(m) + 1, h = Math.ceil(h) + 1;
586
+ let g = m - f, _ = h - p;
587
+ if (g <= 0 || _ <= 0) return !1;
588
+ let v = Math.max(1, Math.ceil(g * Xe)), y = Math.max(1, Math.ceil(_ * Xe)), b = l(v, y);
589
+ if (!b || b.width !== v || b.height !== y) return !1;
590
+ let x = b.getContext("2d") ?? null;
591
+ if (!x) return !1;
592
+ let S = Xe, C = [
593
+ a[0] * S,
594
+ a[1] * S,
595
+ a[2] * S,
596
+ a[3] * S,
597
+ (a[4] - f) * S,
598
+ (a[5] - p) * S
599
+ ];
600
+ x.save(), x.setTransform(C[0], C[1], C[2], C[3], C[4], C[5]), x.beginPath(), x.moveTo(i[0].x, i[0].y), x.lineTo(i[1].x, i[1].y), x.lineTo(i[2].x, i[2].y), x.lineTo(i[3].x, i[3].y), x.closePath(), x.clip(), We(x, e, n, r, C, o, s, 0, 0, 1, 1, c * S, u), x.restore(), t.save(), t.setTransform(1, 0, 0, 1, 0, 0);
601
+ let w = t.imageSmoothingEnabled, T = t.imageSmoothingQuality;
602
+ return t.imageSmoothingEnabled = !0, t.imageSmoothingQuality = "high", t.drawImage(b, 0, 0, g * S, _ * S, f, p, g, _), t.imageSmoothingEnabled = w, t.imageSmoothingQuality = T, t.restore(), !0;
603
+ }
604
+ //#endregion
605
+ //#region packages/core/src/shape/bevel-shading.ts
606
+ function Qe(e, t) {
607
+ if (t <= 0) return () => 1;
608
+ let n = (e) => Math.max(0, Math.min(1, e / t));
609
+ switch (e) {
610
+ case "hardEdge": {
611
+ let e = ot;
612
+ return (t) => {
613
+ let r = Math.min(1, n(t) / e);
614
+ return r * r * (3 - 2 * r);
615
+ };
616
+ }
617
+ case "angle":
618
+ case "slope": return (e) => n(e);
619
+ case "circle":
620
+ case "convex":
621
+ case "softRound": return (e) => {
622
+ let t = 1 - n(e);
623
+ return Math.sqrt(Math.max(0, 1 - t * t));
624
+ };
625
+ default: return (e) => {
626
+ let t = n(e);
627
+ return t * t * (3 - 2 * t);
628
+ };
629
+ }
630
+ }
631
+ function $e(e) {
632
+ let t = e.length, n = new Float64Array(t);
633
+ if (t === 0) return n;
634
+ let r = new Int32Array(t), i = new Float64Array(t + 1), a = 0;
635
+ r[0] = 0, i[0] = -Infinity, i[1] = Infinity;
636
+ for (let n = 1; n < t; n++) {
637
+ let t = (e[n] + n * n - (e[r[a]] + r[a] * r[a])) / (2 * n - 2 * r[a]);
638
+ for (; t <= i[a];) a--, t = (e[n] + n * n - (e[r[a]] + r[a] * r[a])) / (2 * n - 2 * r[a]);
639
+ a++, r[a] = n, i[a] = t, i[a + 1] = Infinity;
640
+ }
641
+ a = 0;
642
+ for (let o = 0; o < t; o++) {
643
+ for (; i[a + 1] < o;) a++;
644
+ let t = o - r[a];
645
+ n[o] = t * t + e[r[a]];
646
+ }
647
+ return n;
648
+ }
649
+ function et(e, t = 3) {
650
+ if (e <= 0) return Array(t).fill(1);
651
+ let n = Math.sqrt(12 * e * e / t + 1), r = Math.floor(n);
652
+ r % 2 == 0 && r--;
653
+ let i = r + 2, a = (12 * e * e - t * r * r - 4 * t * r - 3 * t) / (-4 * r - 4), o = Math.round(a), s = [];
654
+ for (let e = 0; e < t; e++) s.push(e < o ? r : i);
655
+ return s;
656
+ }
657
+ function tt(e, t, n, r, i, a) {
658
+ let o = 1 / (2 * i + 1);
659
+ if (a) for (let a = 0; a < r; a++) {
660
+ let r = a * n, s = 0;
661
+ for (let t = 0; t <= i; t++) t < n && (s += e[r + t]);
662
+ for (let a = 0; a < n; a++) {
663
+ t[r + a] = s * o;
664
+ let c = a + i + 1, l = a - i;
665
+ c < n && (s += e[r + c]), l >= 0 && (s -= e[r + l]);
666
+ }
667
+ }
668
+ else for (let a = 0; a < n; a++) {
669
+ let s = 0;
670
+ for (let t = 0; t <= i; t++) t < r && (s += e[t * n + a]);
671
+ for (let c = 0; c < r; c++) {
672
+ t[c * n + a] = s * o;
673
+ let l = c + i + 1, u = c - i;
674
+ l < r && (s += e[l * n + a]), u >= 0 && (s -= e[u * n + a]);
675
+ }
676
+ }
677
+ }
678
+ function nt(e, t, n, r) {
679
+ let i = Float64Array.from(e);
680
+ if (r <= 0 || t <= 0 || n <= 0) return i;
681
+ let a = new Float64Array(t * n);
682
+ for (let e of et(r, 3)) {
683
+ let r = Math.max(1, (e - 1) / 2);
684
+ tt(i, a, t, n, r, !0), tt(a, i, t, n, r, !1);
685
+ }
686
+ return i;
687
+ }
688
+ function rt(e, t, n, r = 128) {
689
+ let i = new Float64Array(t * n);
690
+ for (let a = 0; a < t * n; a++) i[a] = (e[a] ?? 0) >= r ? 0x56bc75e2d63100000 : 0;
691
+ let a = new Float64Array(n);
692
+ for (let e = 0; e < t; e++) {
693
+ for (let r = 0; r < n; r++) a[r] = i[r * t + e];
694
+ let r = $e(a);
695
+ for (let a = 0; a < n; a++) i[a * t + e] = r[a];
696
+ }
697
+ let o = new Float64Array(t);
698
+ for (let e = 0; e < n; e++) {
699
+ for (let n = 0; n < t; n++) o[n] = i[e * t + n];
700
+ let n = $e(o);
701
+ for (let r = 0; r < t; r++) i[e * t + r] = n[r];
702
+ }
703
+ for (let e = 0; e < n; e++) for (let r = 0; r < t; r++) {
704
+ let a = e * t + r;
705
+ if (i[a] === 0) continue;
706
+ let o = (e + 1) * (e + 1), s = (n - e) * (n - e), c = (r + 1) * (r + 1), l = (t - r) * (t - r), u = Math.min(o, s, c, l);
707
+ u < i[a] && (i[a] = u);
708
+ }
709
+ for (let e = 0; e < t * n; e++) i[e] = Math.sqrt(i[e]);
710
+ return i;
711
+ }
712
+ var it = .25, at = .35, ot = .5;
713
+ function st(e, t, n, r, i, a) {
714
+ let o = new Float32Array(t * n * 3), s = new Uint8Array(t * n), c = new Float32Array(t * n);
715
+ if (t <= 0 || n <= 0) return {
716
+ normals: o,
717
+ bandMask: s,
718
+ bandWeight: c
719
+ };
720
+ let l = rt(e, t, n), u = Qe(i, r), d = (n, r) => (e[r * t + n] ?? 0) >= 128, f = (r > 0 ? a / r : 0) * r, p = nt(l, t, n, Math.max(1, r * it)), m = (e) => {
721
+ let t = u(Math.max(0, e - .5));
722
+ return u(e + .5) - t;
723
+ };
724
+ for (let e = 0; e < n; e++) for (let i = 0; i < t; i++) {
725
+ let a = e * t + i;
726
+ if (!d(i, e)) {
727
+ o[a * 3 + 2] = 1;
728
+ continue;
729
+ }
730
+ let u = l[a], h = u > 0 && u < r;
731
+ if (s[a] = +!!h, !h) {
732
+ o[a * 3 + 2] = 1;
733
+ continue;
734
+ }
735
+ let g = u / r, _ = 1 - at, v = 1;
736
+ if (g > _) {
737
+ let e = Math.min(1, (g - _) / at);
738
+ v = 1 - e * e * (3 - 2 * e);
739
+ }
740
+ c[a] = v;
741
+ let y = i > 0 ? i - 1 : i, b = i < t - 1 ? i + 1 : i, x = e > 0 ? e - 1 : e, S = e < n - 1 ? e + 1 : e, C = (p[e * t + b] - p[e * t + y]) / (b - y || 1), w = (p[S * t + i] - p[x * t + i]) / (S - x || 1), T = Math.hypot(C, w), E = 0, D = 0;
742
+ T > 1e-9 && (E = -C / T, D = -w / T);
743
+ let O = m(u) * f, k = O * E, A = O * D, j = 1, M = Math.hypot(k, A, j) || 1;
744
+ k /= M, A /= M, j /= M, o[a * 3] = k, o[a * 3 + 1] = A, o[a * 3 + 2] = j;
745
+ }
746
+ return {
747
+ normals: o,
748
+ bandMask: s,
749
+ bandWeight: c
750
+ };
751
+ }
752
+ var ct = 35 * Math.PI / 180, lt = 12 * Math.PI / 180, ut = {
753
+ t: {
754
+ x: 0,
755
+ y: -1
756
+ },
757
+ b: {
758
+ x: 0,
759
+ y: 1
760
+ },
761
+ l: {
762
+ x: -1,
763
+ y: 0
764
+ },
765
+ r: {
766
+ x: 1,
767
+ y: 0
768
+ },
769
+ tl: {
770
+ x: -1,
771
+ y: -1
772
+ },
773
+ tr: {
774
+ x: 1,
775
+ y: -1
776
+ },
777
+ bl: {
778
+ x: -1,
779
+ y: 1
780
+ },
781
+ br: {
782
+ x: 1,
783
+ y: 1
784
+ }
785
+ };
786
+ function dt(e, t, n) {
787
+ let r = n * Math.PI / 180, i = Math.cos(r), a = Math.sin(r);
788
+ return {
789
+ x: e * i - t * a,
790
+ y: e * a + t * i
791
+ };
792
+ }
793
+ function ft(e, t, n) {
794
+ let r = ut[t] ?? ut.t;
795
+ return n && n.rev && (r = dt(r.x, r.y, n.rev)), mt(r.x, r.y, ct);
796
+ }
797
+ function pt(e) {
798
+ let t = Math.hypot(e.x, e.y) || 1;
799
+ return mt(-e.x / t, -e.y / t, lt);
800
+ }
801
+ function mt(e, t, n) {
802
+ let r = Math.hypot(e, t) || 1, i = Math.cos(n), a = Math.sin(n), o = e / r * i, s = t / r * i, c = a, l = Math.hypot(o, s, c) || 1;
803
+ return {
804
+ x: o / l,
805
+ y: s / l,
806
+ z: c / l
807
+ };
808
+ }
809
+ var ht = 2, gt = {
810
+ matte: {
811
+ ambient: .62,
812
+ diffuse: .45,
813
+ specular: 0,
814
+ shininess: 8
815
+ },
816
+ plastic: {
817
+ ambient: .55,
818
+ diffuse: .5,
819
+ specular: .35,
820
+ shininess: 22
821
+ }
822
+ }, _t = .8;
823
+ function vt(e) {
824
+ switch (e) {
825
+ case "plastic":
826
+ case "metal":
827
+ case "clear":
828
+ case "softEdge":
829
+ case "shiny":
830
+ case "softmetal": return "plastic";
831
+ default: return "matte";
832
+ }
833
+ }
834
+ function yt(e, t, n = !0) {
835
+ let r = gt[e], i = {
836
+ light: t,
837
+ material: e,
838
+ ambient: r.ambient,
839
+ diffuse: r.diffuse,
840
+ specular: r.specular,
841
+ shininess: r.shininess
842
+ };
843
+ return n && (i.fillLight = pt(t), i.fillDiffuse = i.diffuse * _t), i;
844
+ }
845
+ function bt(e, t) {
846
+ let n = e.x * t.light.x + e.y * t.light.y + e.z * t.light.z, r = t.diffuse * Math.max(0, n), i = 0;
847
+ if (t.fillLight && t.fillDiffuse) {
848
+ let n = e.x * t.fillLight.x + e.y * t.fillLight.y + e.z * t.fillLight.z;
849
+ i = t.fillDiffuse * Math.max(0, n);
850
+ }
851
+ let a = 0;
852
+ if (t.specular > 0) {
853
+ let n = t.light.x, r = t.light.y, i = t.light.z + 1, o = Math.hypot(n, r, i) || 1, s = (e.x * n + e.y * r + e.z * i) / o;
854
+ a = t.specular * Math.max(0, s) ** +t.shininess;
855
+ }
856
+ return Math.max(0, t.ambient + r + i + a);
857
+ }
858
+ function xt(e, t, n) {
859
+ if (!e) return {
860
+ x: 0,
861
+ y: 0,
862
+ w: t,
863
+ h: n
864
+ };
865
+ let r = Math.max(0, Math.floor(e.x)), i = Math.max(0, Math.floor(e.y)), a = Math.min(t, Math.ceil(e.x + e.w)), o = Math.min(n, Math.ceil(e.y + e.h));
866
+ return {
867
+ x: r,
868
+ y: i,
869
+ w: Math.max(0, a - r),
870
+ h: Math.max(0, o - i)
871
+ };
872
+ }
873
+ function St(e, t, n) {
874
+ let r = e.canvas.width, i = e.canvas.height;
875
+ if (r <= 0 || i <= 0) return;
876
+ let a = t.widthPx;
877
+ if (a < .75) return;
878
+ let { x: o, y: s, w: c, h: l } = xt(n, r, i);
879
+ if (c <= 0 || l <= 0) return;
880
+ let u = e.getImageData(o, s, c, l), d = u.data, f = new Uint8ClampedArray(c * l);
881
+ for (let e = 0; e < c * l; e++) f[e] = d[e * 4 + 3];
882
+ let { bandMask: p, bandWeight: m, normals: h } = st(f, c, l, a, t.prst, t.heightPx), g = yt(t.material, t.light), _ = bt({
883
+ x: 0,
884
+ y: 0,
885
+ z: 1
886
+ }, g) || 1;
887
+ for (let e = 0; e < c * l; e++) {
888
+ if (p[e] === 0) continue;
889
+ let n = m[e];
890
+ if (n <= 0) continue;
891
+ let r = h[e * 3], i = h[e * 3 + 1], a = h[e * 3 + 2];
892
+ t.bottom && (r = -r, i = -i);
893
+ let o = 1 + (bt({
894
+ x: r,
895
+ y: i,
896
+ z: a
897
+ }, g) / _ - 1) * n, s = e * 4;
898
+ if (o >= 1) {
899
+ let e = Math.min(1, (o - 1) * ht);
900
+ for (let t = 0; t < 3; t++) {
901
+ let n = Math.min(255, d[s + t] * o);
902
+ d[s + t] = n + (255 - n) * e;
903
+ }
904
+ } else d[s] = Math.max(0, d[s] * o), d[s + 1] = Math.max(0, d[s + 1] * o), d[s + 2] = Math.max(0, d[s + 2] * o);
905
+ }
906
+ e.putImageData(u, o, s);
907
+ }
908
+ function Ct(e, t, n) {
909
+ let r = e.canvas.width, i = e.canvas.height;
910
+ if (r <= 0 || i <= 0) return;
911
+ let a = t.offsetX, o = t.offsetY, s = Math.hypot(a, o);
912
+ if (s < .75) return;
913
+ let { x: c, y: l, w: u, h: d } = xt(n, r, i);
914
+ if (u <= 0 || d <= 0) return;
915
+ let f = e.getImageData(c, l, u, d), p = f.data, m = new Uint8ClampedArray(u * d);
916
+ for (let e = 0; e < u * d; e++) m[e] = p[e * 4 + 3];
917
+ let h = Math.max(1, Math.ceil(s)), [g, _, v] = t.rgb;
918
+ for (let e = 0; e < d; e++) for (let t = 0; t < u; t++) {
919
+ let n = e * u + t;
920
+ if (m[n] >= 128) continue;
921
+ let r = !1;
922
+ for (let n = 1; n <= h; n++) {
923
+ let i = n / h, s = Math.round(t - a * i), c = Math.round(e - o * i);
924
+ if (!(s < 0 || c < 0 || s >= u || c >= d) && m[c * u + s] >= 128) {
925
+ r = !0;
926
+ break;
927
+ }
928
+ }
929
+ if (!r) continue;
930
+ let i = n * 4;
931
+ p[i] = g, p[i + 1] = _, p[i + 2] = v, p[i + 3] = 255;
932
+ }
933
+ e.putImageData(f, c, l);
934
+ }
935
+ //#endregion
936
+ //#region packages/core/src/text/highlight-box.ts
937
+ function wt(e, t) {
938
+ return {
939
+ top: e - t * .85,
940
+ height: t * 1.1
941
+ };
942
+ }
943
+ //#endregion
944
+ //#region packages/pptx/src/media-chrome.ts
945
+ function Tt(e, t, n, r, i, a) {
946
+ let o = Math.max(18, Math.min(32, Math.min(r, i) * .25));
947
+ if (e.save(), e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = o * .35, e.fillStyle = "rgba(20, 20, 20, 0.7)", e.beginPath(), e.arc(t, n, o, 0, Math.PI * 2), e.fill(), e.shadowColor = "transparent", e.shadowBlur = 0, e.fillStyle = "#fff", a === "paused") {
948
+ e.beginPath();
949
+ let r = o * .48;
950
+ e.moveTo(t - r * .4, n - r), e.lineTo(t - r * .4, n + r), e.lineTo(t + r * .75, n), e.closePath(), e.fill();
951
+ } else {
952
+ let r = o * .2, i = o * .8, a = o * .15;
953
+ e.fillRect(t - a - r, n - i / 2, r, i), e.fillRect(t + a, n - i / 2, r, i);
954
+ }
955
+ e.restore();
956
+ }
957
+ //#endregion
958
+ //#region packages/pptx/src/bidi-line.ts
959
+ var Et = (e) => {
960
+ let t = e.text;
961
+ return typeof t == "string" ? t : void 0;
962
+ };
963
+ function Dt(e) {
964
+ for (let t of e) {
965
+ let e = Et(t);
966
+ if (e !== void 0 && C(e)) return !0;
967
+ }
968
+ return !1;
969
+ }
970
+ function Ot(e, t) {
971
+ let n = e.length;
972
+ if (n === 0) return {
973
+ order: [],
974
+ rtl: []
975
+ };
976
+ let r = "", i = Array(n);
977
+ for (let t = 0; t < n; t++) {
978
+ i[t] = r.length;
979
+ let n = Et(e[t]) ?? "";
980
+ r += n.length > 0 ? n : "";
981
+ }
982
+ let { levels: a, paragraphLevel: o } = w().computeLevels(r, t ? "rtl" : "ltr"), { order: s, segLevels: c } = P(a, o, i), l = Array(n);
983
+ for (let e = 0; e < n; e++) l[e] = (c[e] & 1) == 1;
984
+ return {
985
+ order: s,
986
+ rtl: l
987
+ };
988
+ }
989
+ //#endregion
990
+ //#region packages/pptx/src/cjk-wrap.ts
991
+ function kt(e, t, n, r) {
992
+ if (e.length === 0) return 0;
993
+ let i = t === 0, a = 0, o = t;
994
+ for (let t of e) {
995
+ if (o + t.w > n) {
996
+ if (a > 0 || !i) break;
997
+ o += t.w, a++;
998
+ break;
999
+ }
1000
+ o += t.w, a++;
1001
+ }
1002
+ return a === 0 ? 0 : a >= e.length ? e.length : N(e.map((e) => e.ch), a, r, +!!i);
1003
+ }
1004
+ //#endregion
1005
+ //#region packages/pptx/src/text-justify.ts
1006
+ var At = (e) => /\s/.test(String.fromCodePoint(e));
1007
+ function jt(e, t, n, r, i) {
1008
+ if (r === "just" && i) return null;
1009
+ let a = t - n;
1010
+ if (a <= .5) return null;
1011
+ let o = q(e, a, {
1012
+ firstContentSi: 0,
1013
+ lastDrawnSi: e.length,
1014
+ isGapChar: D,
1015
+ isWhitespace: At
1016
+ });
1017
+ if (!o) return null;
1018
+ let { perGap: s, perSeg: c } = o, l = [];
1019
+ for (let t = 0; t < e.length; t++) {
1020
+ let n = e[t], r = c.get(t), i = r?.trailingGap ? s : 0, a = r?.splitBefore;
1021
+ a && a.length > 0 ? l.push({
1022
+ ...n,
1023
+ jext: i,
1024
+ splitBefore: [...a],
1025
+ perGap: s
1026
+ }) : l.push({
1027
+ ...n,
1028
+ jext: i
1029
+ });
1030
+ }
1031
+ return l;
1032
+ }
1033
+ //#endregion
1034
+ //#region packages/pptx/src/renderer.ts
1035
+ function X(e, t) {
1036
+ return e * t;
1037
+ }
1038
+ var Z = u;
1039
+ function Mt(e, t, n, r, i, a, o) {
1040
+ let { top: s, height: c } = wt(n, i);
1041
+ e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
1042
+ }
1043
+ function Nt(e) {
1044
+ return !e || e.fillType === "none" ? null : e.fillType === "solid" ? Z(e.color) : e.fillType === "gradient" ? e.stops.length > 0 ? Z(e.stops[0].color) : null : e.fillType === "pattern" ? Z(e.fg) : null;
1045
+ }
1046
+ function Pt(e, t, n, r, i, a) {
1047
+ return d(e, t, n, r, i, a);
1048
+ }
1049
+ function Ft(e, t, n, r, a, o, s, c = 1) {
1050
+ let l = Math.max(1, a * .05), u = s?.endsWith("Heavy") ?? !1 ? l * 1.8 : l, d = n + Math.max(2, u), f = k(d, u, c);
1051
+ if (e.strokeStyle = o, e.lineWidth = u, e.setLineDash([]), s && s.startsWith("wavy")) {
1052
+ let n = u, i = u * 6;
1053
+ e.beginPath(), e.moveTo(t, d);
1054
+ let a = Math.max(1, u * .5);
1055
+ for (let o = 0; o <= r; o += a) {
1056
+ let r = d + Math.sin(o / i * Math.PI * 2) * n;
1057
+ e.lineTo(t + o, r);
1058
+ }
1059
+ if (e.stroke(), s === "wavyDbl") {
1060
+ e.beginPath(), e.moveTo(t, d + n * 2.5);
1061
+ for (let o = 0; o <= r; o += a) {
1062
+ let r = d + n * 2.5 + Math.sin(o / i * Math.PI * 2) * n;
1063
+ e.lineTo(t + o, r);
1064
+ }
1065
+ e.stroke();
1066
+ }
1067
+ return;
1068
+ }
1069
+ if (s === "dbl") {
1070
+ let n = u * 1.4, i = d - n / 2, a = d + n / 2;
1071
+ e.beginPath(), e.moveTo(t, i + k(i, u, c)), e.lineTo(t + r, i + k(i, u, c)), e.moveTo(t, a + k(a, u, c)), e.lineTo(t + r, a + k(a, u, c)), e.stroke();
1072
+ return;
1073
+ }
1074
+ e.setLineDash(i(s ?? "sng", u)), e.beginPath(), e.moveTo(t, d + f), e.lineTo(t + r, d + f), e.stroke(), e.setLineDash([]);
1075
+ }
1076
+ var It = /* @__PURE__ */ new WeakMap();
1077
+ function Lt(e, t) {
1078
+ let n = e.tinted.get(t);
1079
+ if (n) return n;
1080
+ let r = e.img.naturalWidth || 1, i = e.img.naturalHeight || 1, a = document.createElement("canvas");
1081
+ a.width = r, a.height = i;
1082
+ let o = a.getContext("2d");
1083
+ return o ? (o.drawImage(e.img, 0, 0, r, i), o.globalCompositeOperation = "source-in", o.fillStyle = t, o.fillRect(0, 0, r, i), e.tinted.set(t, a), a) : e.img;
1084
+ }
1085
+ function Rt(e) {
1086
+ let t = `data:image/svg+xml;charset=utf-8,${encodeURIComponent(e)}`, n = new Image();
1087
+ return new Promise((e, r) => {
1088
+ n.onload = () => e(n), n.onerror = r, n.src = t;
1089
+ });
1090
+ }
1091
+ var zt = 256;
1092
+ function Bt(e, t, n) {
1093
+ let r = Math.max(1, Math.round(t * zt)), i = Math.max(1, Math.round(n * zt));
1094
+ return e.replace(/<svg([^>]*?)>/, (e, t) => `<svg${t.replace(/\s(?:width|height)="[^"]*"/g, "")} width="${r}" height="${i}">`);
1095
+ }
1096
+ function Vt(e) {
1097
+ let t = [], n = (e) => {
1098
+ if (e) for (let n of e.paragraphs) for (let e of n.runs) e.type === "math" && t.push({
1099
+ nodes: e.nodes,
1100
+ display: e.display
1101
+ });
1102
+ };
1103
+ for (let t of e.elements) if (t.type === "shape") n(t.textBody);
1104
+ else if (t.type === "table") for (let e of t.rows) for (let t of e.cells) n(t.textBody);
1105
+ return t;
1106
+ }
1107
+ async function Ht(e, t) {
1108
+ let n = Vt(e);
1109
+ if (n.length !== 0) {
1110
+ await t.loadMathJax();
1111
+ for (let e of n) if (!It.has(e.nodes)) try {
1112
+ let n = await t.mathMLToSvg(x(e.nodes, e.display)), r = await Rt(Bt(le(n.svg, "#000000"), n.widthEm, n.ascentEm + n.descentEm));
1113
+ It.set(e.nodes, {
1114
+ img: r,
1115
+ widthEm: n.widthEm,
1116
+ ascentEm: n.ascentEm,
1117
+ descentEm: n.descentEm,
1118
+ tinted: /* @__PURE__ */ new Map()
1119
+ });
1120
+ } catch {}
1121
+ }
1122
+ }
1123
+ function Ut(e, t) {
1124
+ return e ? e.startsWith("+") ? e === "+mj-lt" || e === "+mj-ea" || e === "+mj-cs" ? t.themeMajorFont ?? "sans-serif" : t.themeMinorFont ?? "sans-serif" : e.split(",")[0].trim() || (t.themeMinorFont ?? "sans-serif") : t.themeMinorFont ?? "sans-serif";
1125
+ }
1126
+ var Wt = new Set([
1127
+ "serif",
1128
+ "sans-serif",
1129
+ "monospace",
1130
+ "cursive",
1131
+ "fantasy",
1132
+ "system-ui"
1133
+ ]);
1134
+ function Gt(e) {
1135
+ let t = c(e);
1136
+ return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
1137
+ }
1138
+ var Kt = {
1139
+ calibri: "Carlito",
1140
+ "calibri light": "Carlito",
1141
+ cambria: "Caladea",
1142
+ "cambria math": "Caladea",
1143
+ "sakkal majalla": "Noto Naskh Arabic",
1144
+ "traditional arabic": "Noto Naskh Arabic",
1145
+ "simplified arabic": "Noto Naskh Arabic",
1146
+ "arabic typesetting": "Noto Naskh Arabic",
1147
+ "univers next arabic": "Noto Sans Arabic"
1148
+ }, qt = "\"Noto Naskh Arabic\", \"Noto Sans Arabic\"";
1149
+ function Jt(e) {
1150
+ if (Kt[e.toLowerCase()]?.includes("Arabic")) return !0;
1151
+ let t = e.toLowerCase();
1152
+ return /arabic|naskh|kufi|nastaliq|amiri|scheherazade|lateef|aldhabi|urdu|farsi|العرب|[؀-ۿ]/.test(t);
1153
+ }
1154
+ function Yt(e) {
1155
+ return e.map((e) => `"${e}"`).join(", ");
1156
+ }
1157
+ function Xt(e) {
1158
+ let t = Gt(e), n = Kt[e.toLowerCase()], r = n ? `"${n}", ` : "";
1159
+ if (Jt(e)) return `"${e}", ${r}${qt}, ${t}`;
1160
+ let i = t === "serif" ? "serif" : "sans", s = a(e);
1161
+ return `"${e}", ${r}${s ? `${Yt(_(s, i))}, ` : ""}${`${Yt(i === "serif" ? o : g)}, `}${t}`;
1162
+ }
1163
+ function Q(e, t, n, r, i) {
1164
+ let a = t ? "italic " : "", o = e ? "bold " : "", s = Ut(r, i);
1165
+ return Wt.has(s) ? `${a}${o}${n}px ${s}` : `${a}${o}${n}px ${Xt(s)}`;
1166
+ }
1167
+ function Zt(e) {
1168
+ return e.bullet.type === "char" || e.bullet.type === "autoNum" || de(e.bullet).type === "blip";
1169
+ }
1170
+ function Qt(e, t) {
1171
+ return e ? 0 : Math.max(0, t);
1172
+ }
1173
+ function $t(e, t, n, r, i, a, o) {
1174
+ let s = (t.defaultFontSize ?? 18) * p * a;
1175
+ for (let c of t.paragraphs) {
1176
+ let l = X(c.marL, a), u = X(c.marR, a), d = X(c.indent, a), f = Qt(Zt(c), d), m = n - r - i - l - u - f, h = 0;
1177
+ for (let n of c.runs) {
1178
+ if (n.type !== "text") continue;
1179
+ let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * p * a : n.fontSize * p * a, i = Ut(n.fontFamily ?? c.defFontFamily ?? null, o);
1180
+ if (e.font = Q(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, r, i, o), h += e.measureText(n.text).width, h > m) return !0;
1181
+ }
1182
+ }
1183
+ return !1;
1184
+ }
1185
+ function en(e) {
1186
+ for (let t of e) if (D(t.codePointAt(0) ?? 0)) return !0;
1187
+ return !1;
1188
+ }
1189
+ function tn(e) {
1190
+ let t = 0;
1191
+ for (let n of e) t++;
1192
+ return t;
1193
+ }
1194
+ function nn(e, t, n, r, i, a, o, s = !1, c = !1, l = 1, u, d = {
1195
+ themeMajorFont: null,
1196
+ themeMinorFont: null,
1197
+ dpr: 1
1198
+ }, f = 0) {
1199
+ let m = [], h = () => n - (m.length === 0 ? f : 0), g = { segments: [] }, _ = 0, v = !1, y = !1, b = 0, x = (e = !1) => {
1200
+ e && (g.endsWithBreak = !0), m.push(g), g = { segments: [] }, _ = 0, y = !1, v = !1;
1201
+ }, C = (t, n, r, i, a, o, s, c) => {
1202
+ if (!t) return;
1203
+ e.font = n;
1204
+ let l = c?.letterSpacingPx ?? 0, u = e.measureText(t).width + l * tn(t), d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.outline, v = c?.highlight, b = c?.fontFamily, x = (e) => !e.math && e.font === n && e.color === i && e.underline === a && (e.underlineStyle ?? "") === (f ?? "") && (e.underlineColor ?? "") === (p ?? "") && e.strikethrough === o && (e.strikeDouble ?? !1) === (d ?? !1) && (e.letterSpacingPx ?? 0) === l && e.baseline === s && e.shadow === m && e.outline === h && (e.highlight ?? "") === (v ?? "") && (e.fontFamily ?? "") === (b ?? "");
1205
+ if (y && g.tabStop) {
1206
+ let e = g.tabStop.segments, c = e.at(-1);
1207
+ c && x(c) ? c.text += t : e.push({
1208
+ text: t,
1209
+ font: n,
1210
+ fontFamily: b,
1211
+ sizePx: r,
1212
+ color: i,
1213
+ underline: a,
1214
+ underlineStyle: f,
1215
+ underlineColor: p,
1216
+ strikethrough: o,
1217
+ strikeDouble: d,
1218
+ letterSpacingPx: l || void 0,
1219
+ baseline: s,
1220
+ shadow: m,
1221
+ outline: h,
1222
+ highlight: v
1223
+ });
1224
+ } else {
1225
+ _ += u;
1226
+ let e = g.segments.at(-1);
1227
+ e && x(e) ? e.text += t : g.segments.push({
1228
+ text: t,
1229
+ font: n,
1230
+ fontFamily: b,
1231
+ sizePx: r,
1232
+ color: i,
1233
+ underline: a,
1234
+ underlineStyle: f,
1235
+ underlineColor: p,
1236
+ strikethrough: o,
1237
+ strikeDouble: d,
1238
+ letterSpacingPx: l || void 0,
1239
+ baseline: s,
1240
+ shadow: m,
1241
+ outline: h,
1242
+ highlight: v
1243
+ });
1244
+ }
1245
+ }, w = () => {
1246
+ let e = g.segments.at(-1);
1247
+ if (!e || e.math) return !1;
1248
+ let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
1249
+ if (t) e.text = t[1], n = t[2];
1250
+ else if (g.segments.length > 1) g.segments.pop(), n = e.text;
1251
+ else return !1;
1252
+ return x(), C(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
1253
+ strikeDouble: e.strikeDouble,
1254
+ letterSpacingPx: e.letterSpacingPx,
1255
+ underlineStyle: e.underlineStyle,
1256
+ underlineColor: e.underlineColor,
1257
+ shadow: e.shadow,
1258
+ outline: e.outline,
1259
+ highlight: e.highlight,
1260
+ fontFamily: e.fontFamily
1261
+ }), !0;
1262
+ };
1263
+ for (let n of t.runs) {
1264
+ if (n.type === "break") {
1265
+ x(!0);
1266
+ continue;
1267
+ }
1268
+ if (n.type === "math") {
1269
+ let e = It.get(n.nodes), t = n.fontSize == null ? r : n.fontSize * p * a * l, o = e ? e.widthEm * t : 0, s = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
1270
+ (n.display && _ > 0 || _ + o > h() && _ > 0) && x(), g.segments.push({
1271
+ text: "",
1272
+ font: `${t}px sans-serif`,
1273
+ sizePx: t,
1274
+ color: n.color ? Z(n.color) : i,
1275
+ underline: !1,
1276
+ strikethrough: !1,
1277
+ math: {
1278
+ nodes: n.nodes,
1279
+ display: n.display,
1280
+ width: o,
1281
+ ascent: s,
1282
+ descent: c
1283
+ }
1284
+ }), _ += o, n.display && x();
1285
+ continue;
1286
+ }
1287
+ let f = n.fontSize == null ? r : n.fontSize * p * a * l, m = Ut(n.fontFamily ?? t.defFontFamily ?? null, d), T = n.fontFamilyEa ? Ut(n.fontFamilyEa, d) : null, E = n.fontFamilySym ? Ut(n.fontFamilySym, d) : null, O;
1288
+ O = n.color ? Z(n.color) : n.hyperlink && d.themeHlinkColor ? Z(d.themeHlinkColor) : i;
1289
+ let k = n.bold ?? t.defBold ?? s, A = n.italic ?? t.defItalic ?? c, j = Q(k, A, f, m, d), M = T ? Q(k, A, f, T, d) : j;
1290
+ e.font = j;
1291
+ let N = n.caps, P = n.text;
1292
+ (N === "all" || N === "small") && (P = P.toUpperCase());
1293
+ let F = n.fieldType === "slidenum" && u !== void 0 ? String(u) : P, I = n.underline || n.hyperlink !== void 0, L = {
1294
+ strikeDouble: n.strikeDouble === !0,
1295
+ letterSpacingPx: n.letterSpacing == null ? 0 : n.letterSpacing * p * a,
1296
+ underlineStyle: n.underlineStyle,
1297
+ underlineColor: n.underlineColor ? Z(n.underlineColor) : void 0,
1298
+ shadow: n.shadow,
1299
+ outline: n.outline,
1300
+ fontFamily: m,
1301
+ highlight: n.highlight ? Z(n.highlight) : void 0
1302
+ }, R = F.split(/(\s+)/);
1303
+ for (let r of R) {
1304
+ if (!r) continue;
1305
+ if (/^\t+$/.test(r)) {
1306
+ let e = o + _, r = (t.tabStops ?? []).find((t) => X(t.pos, a) > e);
1307
+ r ? (b = X(r.pos, a), r.algn === "r" || r.algn === "ctr" ? (y = !0, g.tabStop = {
1308
+ px: b,
1309
+ algn: r.algn,
1310
+ segments: []
1311
+ }) : _ = b - o) : C(" ", j, f, O, I, n.strikethrough, void 0, L);
1312
+ continue;
1313
+ }
1314
+ e.font = j;
1315
+ let i = e.measureText(r).width, s = /^\s+$/.test(r);
1316
+ if (y) {
1317
+ C(r, j, f, O, I, n.strikethrough, n.baseline ?? void 0, L);
1318
+ continue;
1319
+ }
1320
+ let c = /[-]/;
1321
+ if (c.test(r) && (E != null || U(m))) {
1322
+ let t = E ?? m;
1323
+ for (let i of r) {
1324
+ let r = i, a = j;
1325
+ if (c.test(i)) {
1326
+ let e = K(i, t);
1327
+ e === i ? a = Q(k, A, f, t, d) : (r = e, a = Q(k, A, f, "sans-serif", d));
1328
+ }
1329
+ e.font = a;
1330
+ let o = e.measureText(r).width;
1331
+ _ + o > h() && _ > 0 && x(), C(r, a, f, O, I, n.strikethrough, n.baseline ?? void 0, L);
1332
+ }
1333
+ continue;
1334
+ }
1335
+ if (en(r)) {
1336
+ let i = [];
1337
+ for (let t of r) {
1338
+ let n = D(t.codePointAt(0) ?? 0) && T != null, r = n ? M : j, a = n ? T : m;
1339
+ e.font = r, i.push({
1340
+ ch: t,
1341
+ w: e.measureText(t).width,
1342
+ font: r,
1343
+ family: a
1344
+ });
1345
+ }
1346
+ if (t.eaLnBrk === !1) {
1347
+ let e = i.reduce((e, t) => e + t.w, 0);
1348
+ _ > 0 && _ + e > h() && x();
1349
+ for (let e of i) C(e.ch, e.font, f, O, I, n.strikethrough, n.baseline ?? void 0, {
1350
+ ...L,
1351
+ fontFamily: e.family
1352
+ });
1353
+ continue;
1354
+ }
1355
+ let a = i;
1356
+ for (; a.length > 0;) {
1357
+ let e = kt(a, _, h(), S);
1358
+ if (e === 0) {
1359
+ x();
1360
+ continue;
1361
+ }
1362
+ for (let t = 0; t < e; t++) {
1363
+ let e = a[t];
1364
+ C(e.ch, e.font, f, O, I, n.strikethrough, n.baseline ?? void 0, {
1365
+ ...L,
1366
+ fontFamily: e.family
1367
+ });
1368
+ }
1369
+ a = a.slice(e), a.length > 0 && x();
1370
+ }
1371
+ continue;
1372
+ }
1373
+ if (_ + i <= h()) C(r, j, f, O, I, n.strikethrough, n.baseline ?? void 0, L), s && (v = !0);
1374
+ else if (s) _ > 0 && x();
1375
+ else if (i > h()) {
1376
+ _ > 0 && x();
1377
+ for (let t of r) {
1378
+ e.font = j;
1379
+ let r = e.measureText(t).width;
1380
+ _ + r > h() && _ > 0 && x(), C(t, j, f, O, I, n.strikethrough, n.baseline ?? void 0, L);
1381
+ }
1382
+ } else if (!v) C(r, j, f, O, I, n.strikethrough, n.baseline ?? void 0, L);
1383
+ else {
1384
+ let e = r.codePointAt(0);
1385
+ e !== void 0 && S.lineStartForbidden.has(e) && /\S$/.test(g.segments.at(-1)?.text ?? "") && w() || x(), C(r, j, f, O, I, n.strikethrough, n.baseline ?? void 0, L);
1386
+ }
1387
+ }
1388
+ }
1389
+ return m.push(g), m;
1390
+ }
1391
+ async function rn(e, t, n, r, i, a) {
1392
+ if (t && t.fillType === "image") {
1393
+ if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !a) return;
1394
+ try {
1395
+ let o = await B(t.imagePath, t.mimeType, a, {
1396
+ widthPt: n / i / p,
1397
+ heightPt: r / i / p
1398
+ });
1399
+ if (!o) return;
1400
+ if (e.save(), e.beginPath(), e.rect(0, 0, n, r), e.clip(), t.alpha != null && (e.globalAlpha = t.alpha), t.tile) sn(e, o, t.tile, n, r, i);
1401
+ else {
1402
+ let i = t.fillRect ?? {}, a = i.l ?? 0, s = i.t ?? 0, c = i.r ?? 0, l = i.b ?? 0, u = a * n, d = s * r, f = n * (1 - a - c), p = r * (1 - s - l);
1403
+ e.drawImage(o, u, d, f, p);
1404
+ }
1405
+ e.restore();
1406
+ } catch {}
1407
+ return;
1408
+ }
1409
+ e.fillStyle = Pt(t, e, 0, 0, n, r) ?? "#FFFFFF", e.fillRect(0, 0, n, r);
1410
+ }
1411
+ var an = 9525;
1412
+ function on(e, t, n, r, i) {
1413
+ let a;
1414
+ a = e === "t" || e === "ctr" || e === "b" ? (t - r) / 2 : e === "tr" || e === "r" || e === "br" ? t - r : 0;
1415
+ let o;
1416
+ return o = e === "l" || e === "ctr" || e === "r" ? (n - i) / 2 : e === "bl" || e === "b" || e === "br" ? n - i : 0, {
1417
+ ax: a,
1418
+ ay: o
1419
+ };
1420
+ }
1421
+ function sn(e, t, n, r, i, a) {
1422
+ let o = t.width * an * n.sx * a, s = t.height * an * n.sy * a;
1423
+ if (!(o > 0) || !(s > 0)) return;
1424
+ let c = n.flip === "x" || n.flip === "xy", u = n.flip === "y" || n.flip === "xy", d = l(o * (c ? 2 : 1), s * (u ? 2 : 1));
1425
+ if (!d) return;
1426
+ let f = d.getContext("2d");
1427
+ if (!f) return;
1428
+ let p = (e, n, r, i) => {
1429
+ f.save(), f.translate(e + (r ? o : 0), n + (i ? s : 0)), f.scale(r ? -1 : 1, i ? -1 : 1), f.drawImage(t, 0, 0, o, s), f.restore();
1430
+ };
1431
+ p(0, 0, !1, !1), c && p(o, 0, !0, !1), u && p(0, s, !1, !0), c && u && p(o, s, !0, !0);
1432
+ let m = e.createPattern(d, "repeat");
1433
+ if (!m) return;
1434
+ let { ax: h, ay: g } = on(n.algn, r, i, o, s), _ = h + X(n.tx, a), v = g + X(n.ty, a);
1435
+ typeof m.setTransform == "function" && typeof DOMMatrix < "u" ? (m.setTransform(new DOMMatrix().translateSelf(_, v)), e.fillStyle = m, e.fillRect(0, 0, r, i)) : (e.save(), e.translate(_, v), e.fillStyle = m, e.fillRect(-_, -v, r, i), e.restore());
1436
+ }
1437
+ function cn(e, t, n) {
1438
+ if (!t) return;
1439
+ let r = t.dir * Math.PI / 180, i = X(t.dist, n);
1440
+ e.shadowColor = Z(t.color, t.alpha), e.shadowBlur = X(t.blur, n), e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
1441
+ }
1442
+ function ln(e, t, n) {
1443
+ t && (e.shadowColor = Z(t.color, t.alpha), e.shadowBlur = X(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
1444
+ }
1445
+ function un(e) {
1446
+ e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
1447
+ }
1448
+ function dn(e, t, n, r, i, a, o) {
1449
+ let s = Math.min(r, i);
1450
+ switch (e) {
1451
+ case "rightarrow":
1452
+ case "leftarrow": {
1453
+ let c = Math.min(Math.max(a ?? 5e4, 0), 1e5), l = s * Math.min(Math.max(o ?? 5e4, 0), 1e5) / 1e5, u = i * c / 2e5, d = n + i / 2 - u, f = 2 * u, p = Math.max(0, r - l);
1454
+ return e === "rightarrow" ? {
1455
+ tx: t,
1456
+ ty: d,
1457
+ tw: p,
1458
+ th: f
1459
+ } : {
1460
+ tx: t + l,
1461
+ ty: d,
1462
+ tw: p,
1463
+ th: f
1464
+ };
1465
+ }
1466
+ case "roundrect": {
1467
+ let e = s * Math.min(Math.max(a ?? 16667, 0), 1e5) / 1e5 * (1 - 1 / Math.SQRT2);
1468
+ return {
1469
+ tx: t + e,
1470
+ ty: n + e,
1471
+ tw: Math.max(0, r - 2 * e),
1472
+ th: Math.max(0, i - 2 * e)
1473
+ };
1474
+ }
1475
+ default: return null;
1476
+ }
1477
+ }
1478
+ function fn(e, t, i, a = "#000000", o, s = {
1479
+ themeMajorFont: null,
1480
+ themeMinorFont: null,
1481
+ dpr: 1
1482
+ }, c, l) {
1483
+ let u = X(t.x, i), d = X(t.y, i), p = X(t.width, i), m = X(t.height, i);
1484
+ if (m === 0 && t.textBody?.verticalAnchor === "b") {
1485
+ if (t.stroke && (e.save(), $(e, t.stroke, i), e.beginPath(), e.moveTo(u, d), e.lineTo(u + p, d), e.stroke(), e.restore()), t.textBody) {
1486
+ let n = t.defaultTextColor ? Z(t.defaultTextColor) : null;
1487
+ vn(e, t.textBody, u, d, p, m, i, n, t.rotation, t.flipH, t.flipV, a, o, s, c, !1, l);
1488
+ }
1489
+ return;
1490
+ }
1491
+ let h = t.scene3d && Le(t.scene3d.camera) ? t.scene3d : null;
1492
+ if (h && p > 0 && m > 0) {
1493
+ let n = e.getTransform(), r = Math.abs(n.a * n.d - n.b * n.c), c = r > 0 ? Math.sqrt(r) : 1, l = yn(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, i, c), f = bn(t.sp3d, h.camera, p, m, i, c);
1494
+ e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(u + p / 2, d + m / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(u + p / 2), -(d + m / 2)));
1495
+ let g = {
1496
+ ...t,
1497
+ x: 0,
1498
+ y: 0,
1499
+ rotation: 0,
1500
+ flipH: !1,
1501
+ flipV: !1,
1502
+ scene3d: void 0
1503
+ };
1504
+ if (xn(e, h.camera, u, d, p, m, (e) => {
1505
+ fn(e, g, i, a, o, s, void 0);
1506
+ }, {
1507
+ bevels: l,
1508
+ extrusion: f ?? void 0,
1509
+ edgePadCss: (t.stroke ? t.stroke.width * i / 2 : 0) + (t.sp3d?.contourW ? t.sp3d.contourW * i : 0) + (f ? Math.hypot(f.offsetX, f.offsetY) / c : 0) + 2
1510
+ })) {
1511
+ e.restore();
1512
+ return;
1513
+ }
1514
+ e.restore();
1515
+ }
1516
+ e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(u + p / 2, d + m / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(u + p / 2), -(d + m / 2)));
1517
+ let g = t.geometry.toLowerCase(), _ = Pt(t.fill, e, u, d, p, m);
1518
+ cn(e, t.shadow ?? null, i), t.shadow || ln(e, t.glow ?? null, i);
1519
+ let v = new Set([
1520
+ "line",
1521
+ "straightconnector1",
1522
+ "bentconnector2",
1523
+ "bentconnector3",
1524
+ "bentconnector4",
1525
+ "bentconnector5",
1526
+ "curvedconnector2",
1527
+ "curvedconnector3",
1528
+ "curvedconnector4",
1529
+ "curvedconnector5"
1530
+ ]), y = new Set([
1531
+ "callout1",
1532
+ "callout2",
1533
+ "callout3",
1534
+ "bordercallout1",
1535
+ "bordercallout2",
1536
+ "bordercallout3",
1537
+ "accentcallout1",
1538
+ "accentcallout2",
1539
+ "accentcallout3",
1540
+ "accentbordercallout1",
1541
+ "accentbordercallout2",
1542
+ "accentbordercallout3"
1543
+ ]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && n(g), S = (e, n) => {
1544
+ let r = n ?? _, a = n ? null : t.stroke ? () => {
1545
+ $(e, t.stroke, i), e.stroke();
1546
+ } : null, o = () => un(e);
1547
+ if (x && !n) {
1548
+ f(e, g, u, d, p, m, [
1549
+ t.adj,
1550
+ t.adj2,
1551
+ t.adj3,
1552
+ t.adj4,
1553
+ t.adj5,
1554
+ t.adj6,
1555
+ t.adj7,
1556
+ t.adj8
1557
+ ], r, a, o, b(g) ? { skipTrailingStroke: !0 } : void 0);
1558
+ return;
1559
+ }
1560
+ e.beginPath(), t.custGeom && t.custGeom.length > 0 ? pn(e, t.custGeom, u, d, p, m) : ie(e, g, u, d, p, m, t.adj, t.adj2, t.adj3, t.adj4), r && g !== "arc" && (e.fillStyle = r, g === "donut" || g === "smileyface" || g === "frame" ? e.fill("evenodd") : e.fill(), n || o()), a && a();
1561
+ }, C = e.canvas.width || 0, w = e.canvas.height || 0, T = e.getTransform(), E = Math.abs(T.a * T.d - T.b * T.c), D = E > 0 ? Math.sqrt(E) : 1, O = {
1562
+ x: u * D,
1563
+ y: d * D,
1564
+ w: p * D,
1565
+ h: m * D
1566
+ }, k = i * D, A = (e) => {
1567
+ e.setTransform(T);
1568
+ };
1569
+ if (t.reflection && C > 0 && w > 0 && (e.save(), e.setTransform(new DOMMatrix()), Ee(e, (e) => {
1570
+ A(e), S(e);
1571
+ }, O, t.reflection, k, C, w), e.restore()), t.softEdge && C > 0 && w > 0 ? (e.save(), e.setTransform(new DOMMatrix()), Te(e, (e) => {
1572
+ A(e), S(e);
1573
+ }, O, t.softEdge, k, C, w, (e) => {
1574
+ A(e), S(e, "#000");
1575
+ }), e.restore()) : S(e), t.innerShadow && C > 0 && w > 0 && (e.save(), e.setTransform(new DOMMatrix()), we(e, (e) => {
1576
+ A(e), S(e, "#000");
1577
+ }, O, t.innerShadow, k, C, w), e.restore()), t.stroke && (v.has(g) || y.has(g))) {
1578
+ let n = r(g, u, d, p, m, [
1579
+ t.adj,
1580
+ t.adj2,
1581
+ t.adj3,
1582
+ t.adj4,
1583
+ t.adj5,
1584
+ t.adj6,
1585
+ t.adj7,
1586
+ t.adj8
1587
+ ]);
1588
+ if (n) {
1589
+ let r = t.stroke.cmpd, a = g === "line" || g === "straightconnector1";
1590
+ if (b(g) && n.vertices.length >= 2 && !(r && a)) {
1591
+ let r = n.vertices.map((e) => ({
1592
+ x: e.x,
1593
+ y: e.y
1594
+ }));
1595
+ if (t.stroke.tailEnd) {
1596
+ let e = V(t.stroke.tailEnd, t.stroke, i);
1597
+ r[r.length - 1] = G(r[r.length - 1], r[r.length - 2], e);
1598
+ }
1599
+ if (t.stroke.headEnd) {
1600
+ let e = V(t.stroke.headEnd, t.stroke, i);
1601
+ r[0] = G(r[0], r[1], e);
1602
+ }
1603
+ $(e, t.stroke, i), e.beginPath(), e.moveTo(r[0].x, r[0].y);
1604
+ for (let t = 1; t < r.length; t++) e.lineTo(r[t].x, r[t].y);
1605
+ e.stroke();
1606
+ }
1607
+ r && a && Dn(e, n.start, n.end, t.stroke, r, i), t.stroke.tailEnd && ne(e, n.end.x, n.end.y, n.end.angle, t.stroke.tailEnd, t.stroke, i), t.stroke.headEnd && ne(e, n.start.x, n.start.y, n.start.angle, t.stroke.headEnd, t.stroke, i);
1608
+ }
1609
+ } else if (t.stroke && t.custGeom && t.custGeom.length > 0 && (t.stroke.headEnd && t.stroke.headEnd.type !== "none" || t.stroke.tailEnd && t.stroke.tailEnd.type !== "none")) {
1610
+ let { start: n, end: r } = ye(t.custGeom);
1611
+ n && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && ne(e, u + n.x * p, d + n.y * m, Math.atan2(n.dy * m, n.dx * p), t.stroke.headEnd, t.stroke, i), r && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && ne(e, u + r.x * p, d + r.y * m, Math.atan2(r.dy * m, r.dx * p), t.stroke.tailEnd, t.stroke, i);
1612
+ }
1613
+ if (t.textBody) {
1614
+ let n = t.defaultTextColor ? Z(t.defaultTextColor) : null;
1615
+ if (e.save(), t.flipH || t.flipV) {
1616
+ let n = u + p / 2, r = d + m / 2;
1617
+ e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
1618
+ }
1619
+ let r = u, f = d, h = p, _ = m;
1620
+ if (t.textRect) r = X(t.textRect.x, i), f = X(t.textRect.y, i), h = X(t.textRect.width, i), _ = X(t.textRect.height, i);
1621
+ else if (g === "ellipse") {
1622
+ let e = p * (1 - 1 / Math.SQRT2) / 2, t = m * (1 - 1 / Math.SQRT2) / 2;
1623
+ r = u + e, f = d + t, h = p / Math.SQRT2, _ = m / Math.SQRT2;
1624
+ } else {
1625
+ let e = dn(g, u, d, p, m, t.adj, t.adj2);
1626
+ e && (r = e.tx, f = e.ty, h = e.tw, _ = e.th);
1627
+ }
1628
+ vn(e, t.textBody, r, f, h, _, i, n, t.rotation, !1, !1, a, o, s, c, !1, l), e.restore();
1629
+ }
1630
+ e.restore();
1631
+ }
1632
+ var pn = H;
1633
+ function mn(e, t) {
1634
+ let n = `${e}`, r = e >= 1 && e <= 26 ? String.fromCharCode(96 + e) : n, i = e >= 1 && e <= 26 ? String.fromCharCode(64 + e) : n, a = hn(e).toLowerCase(), o = hn(e), s = n.replace(/[0-9]/g, (e) => String.fromCharCode(65296 + (e.charCodeAt(0) - 48)));
1635
+ switch (t) {
1636
+ case "arabicPlain": return n;
1637
+ case "arabicPeriod": return `${n}.`;
1638
+ case "arabicParenR": return `${n})`;
1639
+ case "arabicParenBoth": return `(${n})`;
1640
+ case "arabicDbPlain": return s;
1641
+ case "arabicDbPeriod": return `${s}.`;
1642
+ case "alphaLcPlain": return r;
1643
+ case "alphaLcPeriod": return `${r}.`;
1644
+ case "alphaLcParenR": return `${r})`;
1645
+ case "alphaLcParenBoth": return `(${r})`;
1646
+ case "alphaUcPlain": return i;
1647
+ case "alphaUcPeriod": return `${i}.`;
1648
+ case "alphaUcParenR": return `${i})`;
1649
+ case "alphaUcParenBoth": return `(${i})`;
1650
+ case "romanLcPlain": return a;
1651
+ case "romanLcPeriod": return `${a}.`;
1652
+ case "romanLcParenR": return `${a})`;
1653
+ case "romanLcParenBoth": return `(${a})`;
1654
+ case "romanUcPlain": return o;
1655
+ case "romanUcPeriod": return `${o}.`;
1656
+ case "romanUcParenR": return `${o})`;
1657
+ case "romanUcParenBoth": return `(${o})`;
1658
+ default: return `${n}.`;
1659
+ }
1660
+ }
1661
+ function hn(e) {
1662
+ let t = [
1663
+ 1e3,
1664
+ 900,
1665
+ 500,
1666
+ 400,
1667
+ 100,
1668
+ 90,
1669
+ 50,
1670
+ 40,
1671
+ 10,
1672
+ 9,
1673
+ 5,
1674
+ 4,
1675
+ 1
1676
+ ], n = [
1677
+ "M",
1678
+ "CM",
1679
+ "D",
1680
+ "CD",
1681
+ "C",
1682
+ "XC",
1683
+ "L",
1684
+ "XL",
1685
+ "X",
1686
+ "IX",
1687
+ "V",
1688
+ "IV",
1689
+ "I"
1690
+ ], r = "";
1691
+ for (let i = 0; i < t.length; i++) for (; e >= t[i];) r += n[i], e -= t[i];
1692
+ return r;
1693
+ }
1694
+ function gn(e) {
1695
+ for (let t of e.runs) if (t.type === "text" && t.text !== "" || t.type === "math") return !0;
1696
+ return !1;
1697
+ }
1698
+ function _n(e, t) {
1699
+ let n = gn(e);
1700
+ if (e.bullet.type === "char") return t.clear(), n ? K(e.bullet.char, e.bullet.fontFamily ?? null) : "";
1701
+ if (e.bullet.type === "autoNum") {
1702
+ if (!n) return "";
1703
+ let r = e.lvl;
1704
+ return t.has(r) ? t.set(r, t.get(r) + 1) : t.set(r, e.bullet.startAt ?? 1), mn(t.get(r), e.bullet.numType);
1705
+ }
1706
+ return t.clear(), "";
1707
+ }
1708
+ function vn(e, t, n, r, i, a, o, s = null, c = 0, l = !1, u = !1, d = "#000000", f, m = {
1709
+ themeMajorFont: null,
1710
+ themeMinorFont: null,
1711
+ dpr: 1
1712
+ }, h, g = !1, _) {
1713
+ let v = t.vert === "vert" || t.vert === "eaVert", y = t.vert === "vert270";
1714
+ if (v || y) {
1715
+ let l = n + i / 2, u = r + a / 2, p = v ? 90 : -90, b = h ? (e) => h({
1716
+ ...e,
1717
+ inShapeX: e.inShapeX - a / 2 + i / 2,
1718
+ inShapeY: e.inShapeY - i / 2 + a / 2,
1719
+ shapeX: n,
1720
+ shapeY: r,
1721
+ shapeW: i,
1722
+ shapeH: a,
1723
+ rotation: c,
1724
+ textBodyRotation: p
1725
+ }) : void 0;
1726
+ if (g) return i;
1727
+ e.save(), e.translate(l, u), e.rotate(y ? -Math.PI / 2 : Math.PI / 2), vn(e, {
1728
+ ...t,
1729
+ vert: "horz"
1730
+ }, -a / 2, -i / 2, a, i, o, s, 0, !1, !1, d, f, m, b, !1, _), e.restore();
1731
+ return;
1732
+ }
1733
+ let b = X(t.lIns, o), x = X(t.rIns, o), S = X(t.tIns, o), C = X(t.bIns, o), w = t.wrap !== "none", T = t.autoFit === "sp" ? w && $t(e, t, i, b, x, o, m) : w, E = Math.max(1, t.numCol ?? 1), D = X(t.spcCol ?? 0, o), O = t.defaultBold ?? !1, j = t.defaultItalic ?? !1, M = s ?? d, N = (r) => {
1734
+ let a = (t.defaultFontSize ?? 18) * p * o * r, s = [], c = 0, l = /* @__PURE__ */ new Map();
1735
+ for (let u = 0; u < t.paragraphs.length; u++) {
1736
+ let d = t.paragraphs[u], h = X(d.marL, o), g = X(d.marR, o), _ = X(d.indent, o), v = d.defFontSize == null ? a : d.defFontSize * p * o * r, y = d.defColor ? Z(d.defColor) : M, S = Zt(d), C = (() => {
1737
+ for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
1738
+ return null;
1739
+ })(), w = C == null ? v : C * p * o * r, k = (() => {
1740
+ for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
1741
+ return null;
1742
+ })(), N = k ? Z(k) : y, P = "", F = Q(!1, !1, w, "sans-serif", m), I = N, L = null;
1743
+ P = _n(d, l);
1744
+ let R = de(d.bullet);
1745
+ if (R.type === "char") {
1746
+ let e = R;
1747
+ F = Q(!1, !1, e.sizePct == null ? w : w * (e.sizePct / 100), P === e.char ? Ut(e.fontFamily ?? null, m) : "sans-serif", m), I = e.color ? Z(e.color) : N;
1748
+ } else if (R.type === "autoNum") F = Q(!1, !1, w, "sans-serif", m), I = N;
1749
+ else if (R.type === "blip") {
1750
+ let e = R, t = e.sizePct == null ? w : w * (e.sizePct / 100);
1751
+ L = {
1752
+ imagePath: e.imagePath,
1753
+ mimeType: e.mimeType,
1754
+ sizePx: t
1755
+ };
1756
+ }
1757
+ let z = E > 1 ? (i - b - x - (E - 1) * D) / E : i - b - x, B = n + b + h, V = n + b + h + _, H = z - h - g, U = nn(e, d, T ? H : Infinity, v, y, o, h, O, j, r, f, m, Qt(S, _)), W = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * p * o * r, G = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * p * o * r;
1758
+ for (let n = 0; n < U.length; n++) {
1759
+ let r = U[n], i = n === 0, a = n === U.length - 1, l = 0, f = 0;
1760
+ for (let e of r.segments) {
1761
+ let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
1762
+ if (t > l && (l = t), !e.math) {
1763
+ let t = A(e.fontFamily, e.sizePx);
1764
+ t > f && (f = t);
1765
+ }
1766
+ }
1767
+ if (l === 0 && (l = v), i && P) {
1768
+ e.font = F;
1769
+ let t = e.measureText("M"), n = t.actualBoundingBoxAscent + t.actualBoundingBoxDescent;
1770
+ n > l && (l = n);
1771
+ }
1772
+ i && L && L.sizePx > l && (l = L.sizePx);
1773
+ let m = Math.max(l * 1.2, f), h;
1774
+ h = d.spaceLine ? d.spaceLine.type === "pct" ? m * (d.spaceLine.val / 1e5) : d.spaceLine.val * p * o : m, t.autoFit === "norm" && t.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (h *= 1 - t.lnSpcReduction);
1775
+ let g = h + (a ? G : 0), y = i && u > 0 ? W : 0, b = i ? Qt(S, _) : 0, x = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), C = i && x ? L : null;
1776
+ s.push({
1777
+ line: r,
1778
+ linePx: g,
1779
+ lineHeight: h,
1780
+ topGapPx: y,
1781
+ textXOffset: b,
1782
+ bulletLabel: i ? P : "",
1783
+ bulletFont: F,
1784
+ bulletColor: I,
1785
+ bulletX: V,
1786
+ bulletImage: C,
1787
+ textX: B,
1788
+ textMaxW: H,
1789
+ alignment: d.alignment,
1790
+ isLastLine: a,
1791
+ para: d
1792
+ }), c += g + y;
1793
+ }
1794
+ }
1795
+ return {
1796
+ allLines: s,
1797
+ totalHeight: c
1798
+ };
1799
+ }, { allLines: P, totalHeight: F } = N(1);
1800
+ if (t.autoFit === "norm") if (t.fontScale != null && t.fontScale > 0) t.fontScale < 1 && ({allLines: P, totalHeight: F} = N(t.fontScale));
1801
+ else {
1802
+ let e = a - S - C;
1803
+ if (F > e && e > 0) {
1804
+ let t = .1, n = 1;
1805
+ for (let r = 0; r < 6; r++) {
1806
+ let r = (t + n) / 2;
1807
+ N(r).totalHeight <= e ? t = r : n = r;
1808
+ }
1809
+ ({allLines: P, totalHeight: F} = N(t));
1810
+ }
1811
+ }
1812
+ if (g) return S + F + C;
1813
+ let I = t.verticalAnchor ?? "t", L = r, R;
1814
+ a === 0 && I === "b" ? (R = S + F + C, L = r - R) : R = t.autoFit === "sp" ? Math.max(a, S + F + C) : a;
1815
+ let z, B = Math.max(0, R - S - C);
1816
+ z = I === "ctr" ? L + S + (B - F) / 2 : I === "b" ? L + R - C - F : L + S, e.save(), e.textAlign = "left", e.textBaseline = "alphabetic";
1817
+ let V = z, H = E > 1 ? (i - b - x - (E - 1) * D) / E + D : 0, U = Math.max(0, R - S - C), W = a === 0 || F <= U + .5, G = E > 1 && !W ? Math.ceil(P.length / E) : P.length, K = 0, q = 0;
1818
+ for (let s of P) {
1819
+ let { line: l, linePx: u, lineHeight: d, topGapPx: f, textXOffset: p, bulletLabel: g, bulletFont: v, bulletColor: y, bulletImage: x, alignment: S, isLastLine: C } = s;
1820
+ E > 1 && K < E - 1 && q >= G && (K++, q = 0, z = V), z += f, q++;
1821
+ let w = (t.rtlCol ? E - 1 - K : K) * H, T = s.textX + w, D = s.bulletX + w, O = s.textMaxW, A = s.para.rtl === !0, j = A || Dt(l.segments), M = 0, N = d * .8;
1822
+ for (let t of l.segments) {
1823
+ if (t.math) {
1824
+ M += t.math.width, N = Math.max(N, t.math.ascent);
1825
+ continue;
1826
+ }
1827
+ e.font = t.font;
1828
+ let n = e.measureText(t.text || "M"), r = t.letterSpacingPx ?? 0;
1829
+ M += t.text ? n.width + r * tn(t.text) : 0, n.actualBoundingBoxAscent > 0 && (N = Math.max(N, n.actualBoundingBoxAscent));
1830
+ }
1831
+ let P = z + N;
1832
+ if (g) if (e.font = v, e.fillStyle = y, j && A) {
1833
+ let t = e.direction;
1834
+ e.direction = "rtl";
1835
+ let n = e.measureText(g).width;
1836
+ e.fillText(g, T + O + (T - D) - n, P), e.direction = t;
1837
+ } else e.fillText(g, D, P);
1838
+ if (x && _) {
1839
+ let t = te(x.imagePath, _);
1840
+ if (t) {
1841
+ let n = x.sizePx, r = t.height > 0 ? n * (t.width / t.height) : n, i = P - n;
1842
+ if (j && A) {
1843
+ let a = T + O + (T - D) - r;
1844
+ e.drawImage(t, a, i, r, n);
1845
+ } else e.drawImage(t, D, i, r, n);
1846
+ }
1847
+ }
1848
+ let F = T + p, I;
1849
+ I = S === "ctr" ? F + (O - p - M) / 2 : S === "r" ? T + O - M : F;
1850
+ let L = S === "just" || S === "justLow" ? "just" : S === "dist" || S === "thaiDist" ? "dist" : null, R = !!l.tabStop && l.tabStop.segments.length > 0, B = C || (l.endsWithBreak ?? !1), U = (L && !j && !R ? jt(l.segments, O - p, M, L, B) : null) ?? l.segments, W = j ? Ot(l.segments, A) : null, ne = U.length;
1851
+ for (let t = 0; t < ne; t++) {
1852
+ let s = W ? W.order[t] : t, l = U[s], u = W ? W.rtl[s] : !1;
1853
+ j && (e.direction = u ? "rtl" : "ltr");
1854
+ let f = l.jext ?? 0, p = l.splitBefore, g = l.perGap ?? 0, _ = p && p.length > 0 ? p.length * g : 0;
1855
+ if (l.math) {
1856
+ let t = It.get(l.math.nodes), n = l.math.width, r = l.math.ascent + l.math.descent;
1857
+ if (t && n > 0 && r > 0) {
1858
+ let i = P - l.math.ascent, a = Lt(t, l.color);
1859
+ e.drawImage(a, I, i, n, r);
1860
+ }
1861
+ I += n, I += f;
1862
+ continue;
1863
+ }
1864
+ e.font = l.font, e.fillStyle = l.color;
1865
+ let v = P + (l.baseline ? -(l.baseline / 1e5) * l.sizePx : 0), y = l.letterSpacingPx ?? 0;
1866
+ if (l.highlight && l.text) {
1867
+ let t = e.measureText(l.text).width + (y > 0 ? y * tn(l.text) : 0) + _ + f;
1868
+ Mt(e, I, v, t, l.sizePx, l.highlight, l.color);
1869
+ }
1870
+ let b = l.shadow;
1871
+ if (b) {
1872
+ let t = b.dir * Math.PI / 180, n = X(b.dist, o);
1873
+ e.save(), e.shadowColor = Z(b.color, b.alpha), e.shadowBlur = X(b.blur, o), e.shadowOffsetX = Math.cos(t) * n, e.shadowOffsetY = Math.sin(t) * n;
1874
+ }
1875
+ let x = (t, n, r) => {
1876
+ let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
1877
+ if (y > 0 && t.length > 1) {
1878
+ let r = e, a = r.letterSpacing;
1879
+ try {
1880
+ r.letterSpacing = `${y}px`;
1881
+ } catch {}
1882
+ i(t, n, v);
1883
+ try {
1884
+ r.letterSpacing = a;
1885
+ } catch {}
1886
+ } else i(t, n, v);
1887
+ }, S = (t) => e.measureText(t).width, C = p && p.length > 0 ? ee([...l.text], p, g, S, y) : null, w = [...l.text], T = !!p && p.length === w.length - 1 && w.length > 1, E = (t) => {
1888
+ if (T) {
1889
+ let n = e, r = n.letterSpacing;
1890
+ try {
1891
+ n.letterSpacing = `${y + g}px`;
1892
+ } catch {}
1893
+ (t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e))(l.text, I, v);
1894
+ try {
1895
+ n.letterSpacing = r;
1896
+ } catch {}
1897
+ } else if (C) for (let { text: e, dx: n } of C) x(e, I + n, t);
1898
+ else x(l.text, I, t);
1899
+ };
1900
+ E("fill"), b && e.restore();
1901
+ let D = l.outline;
1902
+ D && D.width > 0 && (e.save(), e.lineWidth = Math.max(.5, X(D.width, o)), e.strokeStyle = D.color ? `#${D.color}` : l.color, e.lineJoin = "round", E("stroke"), e.restore()), e.font = l.font;
1903
+ let O = e.measureText(l.text).width + (y > 0 ? y * tn(l.text) : 0) + _;
1904
+ if (h && l.text && h({
1905
+ text: l.text,
1906
+ inShapeX: I - n,
1907
+ inShapeY: z - r,
1908
+ w: O + f,
1909
+ h: d,
1910
+ fontSize: l.sizePx,
1911
+ font: l.font,
1912
+ shapeX: n,
1913
+ shapeY: r,
1914
+ shapeW: i,
1915
+ shapeH: a,
1916
+ rotation: c
1917
+ }), l.underline && Ft(e, I, v, O + f, l.sizePx, l.underlineColor ?? l.color, l.underlineStyle, m.dpr), l.strikethrough) {
1918
+ let t = Math.max(1, l.sizePx * .05);
1919
+ e.strokeStyle = l.color, e.lineWidth = t, e.setLineDash([]);
1920
+ let n = v - l.sizePx * .32;
1921
+ if (l.strikeDouble) {
1922
+ let r = t * .9, i = n - r, a = n + r;
1923
+ e.beginPath(), e.moveTo(I, i + k(i, t, m.dpr)), e.lineTo(I + O + f, i + k(i, t, m.dpr)), e.moveTo(I, a + k(a, t, m.dpr)), e.lineTo(I + O + f, a + k(a, t, m.dpr)), e.stroke();
1924
+ } else {
1925
+ let r = n + k(n, t, m.dpr);
1926
+ e.beginPath(), e.moveTo(I, r), e.lineTo(I + O + f, r), e.stroke();
1927
+ }
1928
+ }
1929
+ I += O, I += f;
1930
+ }
1931
+ if (j && (e.direction = "ltr"), l.tabStop && l.tabStop.segments.length > 0) {
1932
+ let t = n + b + l.tabStop.px, o = 0;
1933
+ for (let t of l.tabStop.segments) {
1934
+ e.font = t.font;
1935
+ let n = t.letterSpacingPx ?? 0;
1936
+ o += e.measureText(t.text).width + n * tn(t.text);
1937
+ }
1938
+ let s;
1939
+ s = l.tabStop.algn === "r" ? t - o : l.tabStop.algn === "ctr" ? t - o / 2 : t;
1940
+ for (let t of l.tabStop.segments) {
1941
+ e.font = t.font, e.fillStyle = t.color;
1942
+ let o = t.letterSpacingPx ?? 0;
1943
+ if (t.highlight && t.text) {
1944
+ let n = e.measureText(t.text).width + o * tn(t.text);
1945
+ Mt(e, s, P, n, t.sizePx, t.highlight, t.color);
1946
+ }
1947
+ if (o > 0 && t.text.length > 1) {
1948
+ let n = e, r = n.letterSpacing;
1949
+ try {
1950
+ n.letterSpacing = `${o}px`;
1951
+ } catch {}
1952
+ e.fillText(t.text, s, P);
1953
+ try {
1954
+ n.letterSpacing = r;
1955
+ } catch {}
1956
+ } else e.fillText(t.text, s, P);
1957
+ e.font = t.font;
1958
+ let l = e.measureText(t.text).width + o * tn(t.text);
1959
+ h && t.text && h({
1960
+ text: t.text,
1961
+ inShapeX: s - n,
1962
+ inShapeY: z - r,
1963
+ w: l,
1964
+ h: d,
1965
+ fontSize: t.sizePx,
1966
+ font: t.font,
1967
+ shapeX: n,
1968
+ shapeY: r,
1969
+ shapeW: i,
1970
+ shapeH: a,
1971
+ rotation: c
1972
+ }), s += l;
1973
+ }
1974
+ }
1975
+ z += u;
1976
+ }
1977
+ e.restore();
1978
+ }
1979
+ function yn(e, t, n, r, i) {
1980
+ if (!e) return [];
1981
+ let a = ft(t?.rig ?? "threePt", t?.dir ?? "t", t?.rot), o = vt(n), s = r * i, c = [];
1982
+ return e.bevelT && e.bevelT.w > 0 && e.bevelT.h > 0 && c.push({
1983
+ widthPx: e.bevelT.w * s,
1984
+ heightPx: e.bevelT.h * s,
1985
+ prst: e.bevelT.prst || "circle",
1986
+ material: o,
1987
+ light: a
1988
+ }), e.bevelB && e.bevelB.w > 0 && e.bevelB.h > 0 && c.push({
1989
+ widthPx: e.bevelB.w * s,
1990
+ heightPx: e.bevelB.h * s,
1991
+ prst: e.bevelB.prst || "circle",
1992
+ material: o,
1993
+ light: a,
1994
+ bottom: !0
1995
+ }), c;
1996
+ }
1997
+ function bn(e, t, n, r, i, a) {
1998
+ if (!e || !e.extrusionH || e.extrusionH <= 0) return null;
1999
+ let o = e.extrusionH * i * a, s = Re(t, n * a, r * a, o);
2000
+ if (Math.hypot(s.x, s.y) < .75) return null;
2001
+ let c = [
2002
+ 64,
2003
+ 64,
2004
+ 64
2005
+ ];
2006
+ if (e.extrusionClr) {
2007
+ let t = e.extrusionClr.replace("#", "");
2008
+ t.length >= 6 && (c = [
2009
+ parseInt(t.slice(0, 2), 16),
2010
+ parseInt(t.slice(2, 4), 16),
2011
+ parseInt(t.slice(4, 6), 16)
2012
+ ]);
2013
+ }
2014
+ return {
2015
+ offsetX: s.x,
2016
+ offsetY: s.y,
2017
+ rgb: c
2018
+ };
2019
+ }
2020
+ function xn(e, t, n, r, i, a, o, s = {}) {
2021
+ if (i <= 0 || a <= 0) return !1;
2022
+ let c = e.getTransform(), u = Math.abs(c.a * c.d - c.b * c.c), d = u > 0 ? Math.sqrt(u) : 1, f = Math.max(0, Math.ceil((s.edgePadCss ?? 0) * d)), p = Ie(t, i, a), m = p.corners;
2023
+ if (f > 0) {
2024
+ let e = f / d, t = qe(p.corners, e / i, e / a);
2025
+ t ? m = t : f = 0;
2026
+ }
2027
+ let h = f / d, g = Math.max(1, Math.ceil(i * d) + 2 * f), _ = Math.max(1, Math.ceil(a * d) + 2 * f), v = l(g, _);
2028
+ if (!v) return !1;
2029
+ let y = v.getContext("2d");
2030
+ if (!y) return !1;
2031
+ y.save(), y.scale(d, d), y.translate(h, h), o(y, 0, 0, i, a), y.restore();
2032
+ let b = Math.ceil(i * d), x = Math.ceil(a * d), S = (e) => ({
2033
+ x: f - e,
2034
+ y: f - e,
2035
+ w: b + 2 * e,
2036
+ h: x + 2 * e
2037
+ });
2038
+ if (s.extrusion) {
2039
+ let e = Math.ceil(Math.hypot(s.extrusion.offsetX, s.extrusion.offsetY)) + 2;
2040
+ Ct(y, s.extrusion, S(e));
2041
+ }
2042
+ if (s.bevels && s.bevels.length > 0) for (let e of s.bevels) St(y, e, S(Math.ceil(e.widthPx) + 2));
2043
+ return s.paintEdges && (y.save(), y.scale(d, d), y.translate(h, h), s.paintEdges(y, 0, 0, i, a), y.restore()), Ge(v, e, g, _, m.map((e) => ({
2044
+ x: n + e.x,
2045
+ y: r + e.y
2046
+ }))), !0;
2047
+ }
2048
+ function Sn(e, t, n, r, i, a, o, s, c = 0) {
2049
+ if (r <= 0 || i <= 0 || a.length === 0) return !1;
2050
+ let u = e.getTransform(), d = Math.abs(u.a * u.d - u.b * u.c), f = d > 0 ? Math.sqrt(d) : 1, p = Math.max(0, Math.ceil(c * f)), m = p / f, h = Math.max(1, Math.ceil(r * f) + 2 * p), g = Math.max(1, Math.ceil(i * f) + 2 * p), _ = l(h, g);
2051
+ if (!_) return !1;
2052
+ let v = _.getContext("2d");
2053
+ if (!v) return !1;
2054
+ v.save(), v.scale(f, f), v.translate(m, m), o(v, 0, 0, r, i), v.restore();
2055
+ let y = Math.ceil(r * f), b = Math.ceil(i * f);
2056
+ for (let e of a) {
2057
+ let t = Math.ceil(e.widthPx) + 2;
2058
+ St(v, e, {
2059
+ x: p - t,
2060
+ y: p - t,
2061
+ w: y + 2 * t,
2062
+ h: b + 2 * t
2063
+ });
2064
+ }
2065
+ return s && (v.save(), v.scale(f, f), v.translate(m, m), s(v, 0, 0, r, i), v.restore()), e.drawImage(_, t - m, n - m, h / f, g / f), !0;
2066
+ }
2067
+ var Cn = /* @__PURE__ */ new WeakMap();
2068
+ function wn(e, t) {
2069
+ let n = Cn.get(e);
2070
+ if (n) return n;
2071
+ let r = (async () => {
2072
+ let n = await t(e.posterPath), r = e.posterMimeType ? new Blob([n], { type: e.posterMimeType }) : n;
2073
+ return createImageBitmap(r);
2074
+ })();
2075
+ return Cn.set(e, r), r;
2076
+ }
2077
+ async function Tn(e, t, n, r) {
2078
+ if (r) try {
2079
+ let i = t.mimeType === "image/svg+xml", { widthPt: a, heightPt: o } = L(t.mimeType, t.srcRect, t.width / p, t.height / p), s;
2080
+ if (F(t)) try {
2081
+ s = await I(t.svgImagePath, r);
2082
+ } catch {
2083
+ s = i ? await I(t.imagePath, r) : await B(t.imagePath, t.mimeType, r, {
2084
+ widthPt: a,
2085
+ heightPt: o
2086
+ });
2087
+ }
2088
+ else s = i ? await I(t.imagePath, r) : await B(t.imagePath, t.mimeType, r, {
2089
+ widthPt: a,
2090
+ heightPt: o
2091
+ });
2092
+ if (!s) return;
2093
+ e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
2094
+ let c = X(t.x, n), l = X(t.y, n), u = X(t.width, n), d = X(t.height, n);
2095
+ (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(c + u / 2, l + d / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(c + u / 2), -(l + d / 2)));
2096
+ let f = R(s, t.srcRect), h = (e, n, r, i, a) => {
2097
+ t.custGeom && t.custGeom.length > 0 ? pn(e, t.custGeom, n, r, i, a) : t.prstGeom && m(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
2098
+ }, g = (e, t, n, r, i) => {
2099
+ e.beginPath(), h(e, t, n, r, i);
2100
+ }, _ = (e, n, r, i, a) => {
2101
+ (t.prstGeom || t.custGeom && t.custGeom.length > 0) && (g(e, n, r, i, a), e.clip());
2102
+ }, v = (e, r, i, a, o) => {
2103
+ t.stroke && (e.save(), $(e, t.stroke, n), g(e, r, i, a, o), e.stroke(), e.restore());
2104
+ }, y = (e, r, i, a, o) => {
2105
+ let s = t.sp3d;
2106
+ if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
2107
+ let t = Math.max(.5, s.contourW * n);
2108
+ e.save(), e.beginPath();
2109
+ let c = t * 2 + Math.max(a, o);
2110
+ e.rect(r - c, i - c, a + 2 * c, o + 2 * c), h(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), g(e, r, i, a, o), e.strokeStyle = Z(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
2111
+ }
2112
+ }, b = t.scene3d && Le(t.scene3d.camera) ? t.scene3d : null, x = (e, t, n, r, i) => {
2113
+ e.save(), _(e, t, n, r, i), f ? e.drawImage(s, f.sx, f.sy, f.sw, f.sh, t, n, r, i) : e.drawImage(s, t, n, r, i), e.restore();
2114
+ }, S = (e, t, n, r, i) => {
2115
+ x(e, t, n, r, i), v(e, t, n, r, i), y(e, t, n, r, i);
2116
+ }, C = (e, t, n, r, i) => {
2117
+ x(e, t, n, r, i), v(e, t, n, r, i);
2118
+ }, w = e.getTransform(), T = Math.abs(w.a * w.d - w.b * w.c), E = T > 0 ? Math.sqrt(T) : 1, D = yn(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, E), O = b ? bn(t.sp3d, b.camera, u, d, n, E) : null, k = t.stroke ? t.stroke.width * n / 2 : 0, A = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, j = O ? Math.hypot(O.offsetX, O.offsetY) / E : 0, M = k + A + j + 2, N = (e) => {
2119
+ if (b) {
2120
+ if (xn(e, b.camera, c, l, u, d, C, {
2121
+ bevels: D,
2122
+ extrusion: O ?? void 0,
2123
+ paintEdges: y,
2124
+ edgePadCss: M
2125
+ })) return;
2126
+ } else if (D.length > 0 && Sn(e, c, l, u, d, D, C, y, M)) return;
2127
+ S(e, c, l, u, d);
2128
+ }, P = (e, t, n, r, i, a) => {
2129
+ e.save(), _(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
2130
+ }, z = (e, t) => {
2131
+ b && xn(e, b.camera, c, l, u, d, (e, n, r, i, a) => P(e, t, n, r, i, a)) || P(e, t, c, l, u, d);
2132
+ }, V = e.canvas.width || 0, H = e.canvas.height || 0, U = e.getTransform(), W = Math.abs(U.a * U.d - U.b * U.c), G = W > 0 ? Math.sqrt(W) : 1, ee = {
2133
+ x: c * G,
2134
+ y: l * G,
2135
+ w: u * G,
2136
+ h: d * G
2137
+ }, te = n * G, K = (e) => e.setTransform(U), q = V > 0 && H > 0;
2138
+ t.reflection && q && (e.save(), e.setTransform(new DOMMatrix()), Ee(e, (e) => {
2139
+ K(e), N(e);
2140
+ }, ee, t.reflection, te, V, H), e.restore()), t.shadow ? cn(e, t.shadow, n) : t.glow && ln(e, t.glow, n), t.softEdge && q ? (e.save(), e.setTransform(new DOMMatrix()), Te(e, (e) => {
2141
+ K(e), N(e);
2142
+ }, ee, t.softEdge, te, V, H, (e) => {
2143
+ K(e), z(e, "#000");
2144
+ }), e.restore()) : N(e), (t.shadow || t.glow) && un(e), t.innerShadow && q && (e.save(), e.setTransform(new DOMMatrix()), we(e, (e) => {
2145
+ K(e), z(e, "#000");
2146
+ }, ee, t.innerShadow, te, V, H), e.restore()), e.restore();
2147
+ } catch {}
2148
+ }
2149
+ async function En(e, t, n, r, i) {
2150
+ let a = X(t.x, n), o = X(t.y, n), s = X(t.width, n), c = X(t.height, n), l = !1;
2151
+ if (t.posterPath && r) try {
2152
+ let n = await wn(t, r);
2153
+ e.drawImage(n, a, o, s, c), l = !0;
2154
+ } catch {}
2155
+ l || (e.fillStyle = t.mediaKind === "video" ? "#111" : "#f0f0f0", e.fillRect(a, o, s, c)), !i && Tt(e, a + s / 2, o + c / 2, s, c, "paused");
2156
+ }
2157
+ function Dn(e, t, n, r, i, a) {
2158
+ let o = Math.max(.5, X(r.width, a)), s = n.x - t.x, c = n.y - t.y, l = Math.hypot(s, c);
2159
+ if (l === 0) return;
2160
+ let u = -c / l, d = s / l, f;
2161
+ switch (i) {
2162
+ case "dbl":
2163
+ f = [{
2164
+ offset: -1 / 3,
2165
+ widthFrac: 1 / 3
2166
+ }, {
2167
+ offset: 1 / 3,
2168
+ widthFrac: 1 / 3
2169
+ }];
2170
+ break;
2171
+ case "thinThick":
2172
+ f = [{
2173
+ offset: -3 / 8,
2174
+ widthFrac: 1 / 4
2175
+ }, {
2176
+ offset: 1 / 4,
2177
+ widthFrac: 1 / 2
2178
+ }];
2179
+ break;
2180
+ case "thickThin":
2181
+ f = [{
2182
+ offset: -1 / 4,
2183
+ widthFrac: 1 / 2
2184
+ }, {
2185
+ offset: 3 / 8,
2186
+ widthFrac: 1 / 4
2187
+ }];
2188
+ break;
2189
+ case "tri":
2190
+ f = [
2191
+ {
2192
+ offset: -2 / 5,
2193
+ widthFrac: 1 / 5
2194
+ },
2195
+ {
2196
+ offset: 0,
2197
+ widthFrac: 3 / 5
2198
+ },
2199
+ {
2200
+ offset: 2 / 5,
2201
+ widthFrac: 1 / 5
2202
+ }
2203
+ ];
2204
+ break;
2205
+ default: return;
2206
+ }
2207
+ e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = o + .5, e.setLineDash([]), e.beginPath(), e.moveTo(t.x, t.y), e.lineTo(n.x, n.y), e.stroke(), e.globalCompositeOperation = "source-over", e.strokeStyle = Z(r.color);
2208
+ for (let r of f) {
2209
+ let i = u * (o * r.offset), a = d * (o * r.offset);
2210
+ e.lineWidth = Math.max(.5, o * r.widthFrac), e.beginPath(), e.moveTo(t.x + i, t.y + a), e.lineTo(n.x + i, n.y + a), e.stroke();
2211
+ }
2212
+ e.restore();
2213
+ }
2214
+ function $(t, n, r) {
2215
+ e(t, n, r);
2216
+ }
2217
+ function On(e, t, n, r, i = {
2218
+ themeMajorFont: null,
2219
+ themeMinorFont: null,
2220
+ dpr: 1
2221
+ }) {
2222
+ let a = X(t.x, n), o = X(t.y, n), s = t.cols.map((e) => X(e, n)), c = s.length, l = (e, t) => {
2223
+ let n = 0;
2224
+ for (let r = 0; r < t; r++) n += s[e + r] ?? 0;
2225
+ return n;
2226
+ }, u = t.rows.map((e) => X(e.height, n));
2227
+ for (let a = 0; a < t.rows.length; a++) {
2228
+ let o = t.rows[a];
2229
+ for (let t = 0; t < o.cells.length; t++) {
2230
+ let s = o.cells[t];
2231
+ if (s.hMerge || s.vMerge || (s.rowSpan || 1) > 1 || !s.textBody) continue;
2232
+ let c = l(t, s.gridSpan || 1), d = vn(e, s.textBody, 0, 0, c, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0) || 0;
2233
+ d > u[a] && (u[a] = d);
2234
+ }
2235
+ }
2236
+ for (let a = 0; a < t.rows.length; a++) {
2237
+ let o = t.rows[a];
2238
+ for (let t = 0; t < o.cells.length; t++) {
2239
+ let s = o.cells[t];
2240
+ if (s.hMerge || s.vMerge) continue;
2241
+ let c = s.rowSpan || 1;
2242
+ if (c <= 1 || !s.textBody) continue;
2243
+ let d = l(t, s.gridSpan || 1), f = vn(e, s.textBody, 0, 0, d, 0, n, null, 0, !1, !1, "#000000", r, i, void 0, !0) || 0, p = 0;
2244
+ for (let e = 0; e < c && a + e < u.length; e++) p += u[a + e];
2245
+ if (f > p) {
2246
+ let e = (f - p) / c;
2247
+ for (let t = 0; t < c && a + t < u.length; t++) u[a + t] += e;
2248
+ }
2249
+ }
2250
+ }
2251
+ let d = s.reduce((e, t) => e + t, 0), f = Array(c);
2252
+ if (t.rtl) {
2253
+ let e = a + d;
2254
+ for (let t = 0; t < c; t++) e -= s[t], f[t] = e;
2255
+ } else {
2256
+ let e = a;
2257
+ for (let t = 0; t < c; t++) f[t] = e, e += s[t];
2258
+ }
2259
+ let p = (e, n) => t.rtl ? f[e + n - 1] : f[e], m = Array(t.rows.length);
2260
+ {
2261
+ let e = o;
2262
+ for (let n = 0; n < t.rows.length; n++) m[n] = e, e += u[n];
2263
+ }
2264
+ let h = [];
2265
+ for (let e = 0; e < t.rows.length; e++) {
2266
+ let n = t.rows[e], r = m[e];
2267
+ for (let t = 0; t < n.cells.length; t++) {
2268
+ let i = n.cells[t];
2269
+ if (i.hMerge || i.vMerge) continue;
2270
+ let a = l(t, i.gridSpan || 1), o = 0;
2271
+ for (let t = 0; t < (i.rowSpan || 1); t++) o += u[e + t] ?? 0;
2272
+ let s = p(t, i.gridSpan || 1);
2273
+ h.push({
2274
+ cell: i,
2275
+ colX: s,
2276
+ rowY: r,
2277
+ cellW: a,
2278
+ cellH: o
2279
+ });
2280
+ }
2281
+ }
2282
+ for (let { cell: t, colX: a, rowY: o, cellW: s, cellH: c } of h) {
2283
+ let l = Nt(t.fill);
2284
+ if (l && (e.fillStyle = l, e.fillRect(a, o, s, c)), t.textBody) {
2285
+ let l = t.textColor ? Z(t.textColor) : null;
2286
+ vn(e, t.textBody, a, o, s, c, n, l, 0, !1, !1, "#000000", r, i);
2287
+ }
2288
+ }
2289
+ let g = i.dpr;
2290
+ for (let { cell: t, colX: r, rowY: i, cellW: a, cellH: o } of h) {
2291
+ if (e.save(), t.borderT) {
2292
+ $(e, t.borderT, n);
2293
+ let o = k(i, e.lineWidth, g);
2294
+ e.beginPath(), e.moveTo(r, i + o), e.lineTo(r + a, i + o), e.stroke();
2295
+ }
2296
+ if (t.borderB) {
2297
+ $(e, t.borderB, n);
2298
+ let s = k(i + o, e.lineWidth, g);
2299
+ e.beginPath(), e.moveTo(r, i + o + s), e.lineTo(r + a, i + o + s), e.stroke();
2300
+ }
2301
+ if (t.borderL) {
2302
+ $(e, t.borderL, n);
2303
+ let a = k(r, e.lineWidth, g);
2304
+ e.beginPath(), e.moveTo(r + a, i), e.lineTo(r + a, i + o), e.stroke();
2305
+ }
2306
+ if (t.borderR) {
2307
+ $(e, t.borderR, n);
2308
+ let s = k(r + a, e.lineWidth, g);
2309
+ e.beginPath(), e.moveTo(r + a + s, i), e.lineTo(r + a + s, i + o), e.stroke();
2310
+ }
2311
+ t.diagonalTL && ($(e, t.diagonalTL, n), e.beginPath(), e.moveTo(r, i), e.lineTo(r + a, i + o), e.stroke()), t.diagonalTR && ($(e, t.diagonalTR, n), e.beginPath(), e.moveTo(r + a, i), e.lineTo(r, i + o), e.stroke()), e.restore();
2312
+ }
2313
+ }
2314
+ function kn(e, t, n, r) {
2315
+ e.save(), e.globalAlpha = t.opacity, e.fillStyle = t.color, e.fillRect(0, 0, n, r), e.restore();
2316
+ }
2317
+ var An = /* @__PURE__ */ new WeakMap();
2318
+ async function jn(e, t, n, r, i = {}, a) {
2319
+ let o = (An.get(e) ?? 0) + 1;
2320
+ An.set(e, o);
2321
+ let s = () => An.get(e) !== o, c = i.width ?? ((T(e) ? e.offsetWidth : 0) || 960), l = c / n, u = Math.round(c), d = Math.round(r * l), f = i.dpr ?? E();
2322
+ e.width = u * f, e.height = d * f, T(e) && (e.style.width = `${u}px`, e.style.display || (e.style.display = "block"));
2323
+ let m = e.getContext("2d");
2324
+ if (!m) throw Error("Could not get 2D context");
2325
+ m.scale(f, f);
2326
+ let h = {
2327
+ themeMajorFont: i.majorFont ?? null,
2328
+ themeMinorFont: i.minorFont ?? null,
2329
+ themeHlinkColor: i.hlinkColor ?? null,
2330
+ dpr: f
2331
+ };
2332
+ if (await rn(m, t.background, u, d, l, i.fetchImage), s() || (i.math && await Ht(t, i.math), s())) return e;
2333
+ let g = i.defaultTextColor ? `#${i.defaultTextColor}` : "#000000", _ = t.slideNumber;
2334
+ for (let e of t.elements) if (e.type === "picture" && i.fetchImage) {
2335
+ let t = e, n = t.mimeType === "image/svg+xml";
2336
+ if (F(t)) I(t.svgImagePath, i.fetchImage).catch(() => void 0);
2337
+ else if (n) I(t.imagePath, i.fetchImage).catch(() => void 0);
2338
+ else {
2339
+ let e = L(t.mimeType, t.srcRect, t.width / p, t.height / p);
2340
+ B(t.imagePath, t.mimeType, i.fetchImage, {
2341
+ widthPt: e.widthPt,
2342
+ heightPt: e.heightPt
2343
+ }).catch(() => void 0);
2344
+ }
2345
+ } else if (e.type === "media") {
2346
+ let t = e;
2347
+ t.posterPath && i.fetchMedia && wn(t, i.fetchMedia).catch(() => void 0);
2348
+ }
2349
+ if (i.fetchImage) {
2350
+ let n = i.fetchImage, r = /* @__PURE__ */ new Set();
2351
+ for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
2352
+ let e = de(t.bullet);
2353
+ e.type === "blip" && r.add(`${e.imagePath} ${e.mimeType}`);
2354
+ }
2355
+ if (r.size > 0 && (await Promise.all([...r].map((e) => {
2356
+ let [t, r] = e.split(" ");
2357
+ return B(t, r, n).catch(() => void 0);
2358
+ })), s())) return e;
2359
+ }
2360
+ for (let n of t.elements) {
2361
+ if (s()) return e;
2362
+ if (n.type === "shape") fn(m, n, l, g, _, h, a, i.fetchImage);
2363
+ else if (n.type === "picture") await Tn(m, n, l, i.fetchImage);
2364
+ else if (n.type === "table") On(m, n, l, _, h);
2365
+ else if (n.type === "media") await En(m, n, l, i.fetchMedia, i.skipMediaControls);
2366
+ else if (n.type === "chart") {
2367
+ let e = p * l;
2368
+ ae(m, n.chart, {
2369
+ x: X(n.x, l),
2370
+ y: X(n.y, l),
2371
+ w: X(n.width, l),
2372
+ h: X(n.height, l)
2373
+ }, e);
2374
+ }
2375
+ }
2376
+ return s() || i.dim && kn(m, i.dim, u, d), e;
2377
+ }
2378
+ //#endregion
2379
+ //#region packages/pptx/src/tabular-text.ts
2380
+ var Mn = (e) => e >= "0" && e <= "9";
2381
+ function Nn(e) {
2382
+ let t = 0;
2383
+ for (let n = 0; n < 10; n++) t = Math.max(t, e.measureText(String(n)).width);
2384
+ return t;
2385
+ }
2386
+ function Pn(e, t, n) {
2387
+ let r = 0;
2388
+ for (let i of t) r += Mn(i) ? n : e.measureText(i).width;
2389
+ return r;
2390
+ }
2391
+ function Fn(e, t, n, r, i) {
2392
+ let a = e.textAlign;
2393
+ e.textAlign = "left";
2394
+ let o = n;
2395
+ for (let n of t) if (Mn(n)) {
2396
+ let t = e.measureText(n).width;
2397
+ e.fillText(n, o + (i - t) / 2, r), o += i;
2398
+ } else e.fillText(n, o, r), o += e.measureText(n).width;
2399
+ e.textAlign = a;
2400
+ }
2401
+ //#endregion
2402
+ //#region packages/pptx/src/presentation-handle.ts
2403
+ var In = (e, t) => e / z * t;
2404
+ async function Ln(e, t, n) {
2405
+ let r = e.getContext("2d");
2406
+ if (!r) throw Error("2D context not available");
2407
+ let i = n.width / (n.slideWidthEmu / z);
2408
+ await n.drawBase();
2409
+ let a = document.createElement("canvas");
2410
+ a.width = e.width, a.height = e.height;
2411
+ let o = a.getContext("2d");
2412
+ if (!o) throw Error("base 2D context not available");
2413
+ o.drawImage(e, 0, 0);
2414
+ let s = [];
2415
+ for (let e of t) {
2416
+ let t;
2417
+ try {
2418
+ t = await n.fetchMedia(e.mediaPath);
2419
+ } catch {
2420
+ continue;
2421
+ }
2422
+ let r = e.mimeType || t.type, a = t.type === r ? t : new Blob([t], { type: r }), o = URL.createObjectURL(a), c = e.mediaKind === "video" ? document.createElement("video") : document.createElement("audio");
2423
+ c.src = o, c.preload = "metadata", e.mediaKind === "video" && (c.playsInline = !0);
2424
+ let l = {
2425
+ x: In(e.x, i),
2426
+ y: In(e.y, i),
2427
+ w: In(e.width, i),
2428
+ h: In(e.height, i)
2429
+ }, u = e.mediaKind === "audio" ? {
2430
+ x: l.x + l.w / 2 - Math.max(l.w, 260) / 2,
2431
+ y: l.y,
2432
+ w: Math.max(l.w, 260),
2433
+ h: l.h + 36
2434
+ } : l;
2435
+ s.push({
2436
+ el: e,
2437
+ rect: u,
2438
+ posterRect: l,
2439
+ media: c,
2440
+ objectUrl: o
2441
+ });
2442
+ }
2443
+ let c = null, l = !1, u = null, d = () => {
2444
+ r.setTransform(n.dpr, 0, 0, n.dpr, 0, 0);
2445
+ let t = e.width / n.dpr, i = e.height / n.dpr;
2446
+ r.drawImage(a, 0, 0, e.width, e.height, 0, 0, t, i);
2447
+ for (let e of s) {
2448
+ let t = e.media;
2449
+ if (e.el.mediaKind === "video" && t.readyState >= 2) {
2450
+ let { x: n, y: i, w: a, h: o } = e.posterRect;
2451
+ r.drawImage(t, n, i, a, o);
2452
+ }
2453
+ if (e === u || h?.state === e) Un(r, e, t);
2454
+ else if (t.paused) {
2455
+ let { x: t, y: n, w: i, h: a } = e.posterRect;
2456
+ Tt(r, t + i / 2, n + a / 2, i, a, "paused");
2457
+ }
2458
+ }
2459
+ }, f = () => {
2460
+ l || (d(), c = requestAnimationFrame(f));
2461
+ }, p = (t, r) => {
2462
+ let i = e.getBoundingClientRect(), a = e.width / n.dpr, o = e.height / n.dpr;
2463
+ return {
2464
+ x: (t - i.left) / i.width * a,
2465
+ y: (r - i.top) / i.height * o
2466
+ };
2467
+ }, m = (e, t) => {
2468
+ for (let n of s) {
2469
+ let { x: r, y: i, w: a, h: o } = n.rect;
2470
+ if (e < r || e > r + a || t < i || t > i + o) continue;
2471
+ let s = Yn(n), c = s.y - 12, l = s.y + s.h + 8;
2472
+ return (Number.isFinite(n.media.duration) ? n.media.duration : 0) > 0 && e >= s.x && e <= s.x + s.w && t >= c && t <= l ? {
2473
+ kind: "seek",
2474
+ state: n,
2475
+ fraction: Math.max(0, Math.min(1, (e - s.x) / s.w))
2476
+ } : {
2477
+ kind: "toggle",
2478
+ state: n
2479
+ };
2480
+ }
2481
+ return null;
2482
+ }, h = null, g = (e, t) => {
2483
+ let n = Number.isFinite(e.media.duration) ? e.media.duration : 0;
2484
+ n <= 0 || (e.media.currentTime = n * t);
2485
+ }, _ = (t) => {
2486
+ let { x: n, y: r } = p(t.clientX, t.clientY), i = m(n, r);
2487
+ i && (i.kind === "seek" ? (h = {
2488
+ state: i.state,
2489
+ wasPlaying: !i.state.media.paused
2490
+ }, i.state.media.pause(), g(i.state, i.fraction), e.setPointerCapture(t.pointerId), t.preventDefault()) : i.state.media.paused ? i.state.media.play().catch(() => void 0) : i.state.media.pause());
2491
+ }, v = (e) => {
2492
+ let { x: t, y: n } = p(e.clientX, e.clientY);
2493
+ u = null;
2494
+ for (let e of s) {
2495
+ let { x: r, y: i, w: a, h: o } = e.rect;
2496
+ if (t >= r && t <= r + a && n >= i && n <= i + o) {
2497
+ u = e;
2498
+ break;
2499
+ }
2500
+ }
2501
+ if (h) {
2502
+ let e = Yn(h.state), n = Math.max(0, Math.min(1, (t - e.x) / e.w));
2503
+ g(h.state, n);
2504
+ }
2505
+ }, y = () => {
2506
+ u = null;
2507
+ }, b = (t) => {
2508
+ if (!h) return;
2509
+ let { wasPlaying: n, state: r } = h;
2510
+ h = null, e.releasePointerCapture(t.pointerId), n && r.media.play().catch(() => void 0);
2511
+ };
2512
+ return s.length > 0 && (e.addEventListener("pointerdown", _), e.addEventListener("pointermove", v), e.addEventListener("pointerleave", y), e.addEventListener("pointerup", b), e.addEventListener("pointercancel", b), e.style.cursor = "pointer", f()), {
2513
+ play(e) {
2514
+ for (let t of s) (!e || t.el.mediaPath === e) && t.media.play().catch(() => void 0);
2515
+ },
2516
+ pause(e) {
2517
+ for (let t of s) (!e || t.el.mediaPath === e) && t.media.pause();
2518
+ },
2519
+ destroy() {
2520
+ if (!l) {
2521
+ l = !0, c !== null && cancelAnimationFrame(c), e.removeEventListener("pointerdown", _), e.removeEventListener("pointermove", v), e.removeEventListener("pointerleave", y), e.removeEventListener("pointerup", b), e.removeEventListener("pointercancel", b), e.style.cursor = "";
2522
+ for (let e of s) e.media.pause(), e.media.removeAttribute("src"), e.media.load(), URL.revokeObjectURL(e.objectUrl);
2523
+ }
2524
+ }
2525
+ };
2526
+ }
2527
+ var Rn = 28, zn = 14, Bn = 72, Vn = 10, Hn = 3;
2528
+ function Un(e, t, n) {
2529
+ let r = Number.isFinite(n.duration) ? n.duration : 0, i = r > 0 ? Math.min(1, n.currentTime / r) : 0, a = t.posterRect;
2530
+ Tt(e, a.x + a.w / 2, a.y + a.h / 2, a.w, a.h, n.paused ? "paused" : "playing"), t.el.mediaKind === "audio" ? Gn(e, t, n, r, i) : Wn(e, t, n, r, i);
2531
+ }
2532
+ function Wn(e, t, n, r, i) {
2533
+ let { x: a, y: o, w: s, h: c } = t.rect, l = Math.max(28, Math.min(56, c * .22)), u = o + c - l;
2534
+ e.save();
2535
+ let d = e.createLinearGradient(0, u, 0, o + c);
2536
+ d.addColorStop(0, "rgba(0, 0, 0, 0)"), d.addColorStop(1, "rgba(0, 0, 0, 0.55)"), e.fillStyle = d, e.fillRect(a, u, s, l), e.restore();
2537
+ let f = Yn(t);
2538
+ qn(e, f, i, r > 0), e.save(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.shadowColor = "rgba(0, 0, 0, 0.75)", e.shadowBlur = 3, e.fillStyle = "rgba(255, 255, 255, 0.95)", Kn(e, n.currentTime, r, f.x, f.y - 10, "bottom"), e.restore();
2539
+ }
2540
+ function Gn(e, t, n, r, i) {
2541
+ let a = Jn(t.rect);
2542
+ e.save(), Xn(e, a.x, a.y, a.w, a.h, a.h / 2), e.fillStyle = "rgba(20, 20, 20, 0.72)", e.fill(), e.font = "500 11px system-ui, -apple-system, sans-serif", e.textBaseline = "middle", e.fillStyle = "rgba(255, 255, 255, 0.95)", Kn(e, n.currentTime, r, a.x + zn, a.y + a.h / 2, "middle"), e.restore(), qn(e, Yn(t), i, r > 0);
2543
+ }
2544
+ function Kn(e, t, n, r, i, a) {
2545
+ let o = Zn(t), s = Zn(n), c = Nn(e), l = Pn(e, o, c), u = Pn(e, s, c), d = e.measureText(" / ").width, f = Math.max(l, u);
2546
+ Fn(e, o, r + f - l, i, c);
2547
+ let p = e.textAlign;
2548
+ e.textAlign = "left", e.fillText(" / ", r + f, i), e.textAlign = p, Fn(e, s, r + f + d, i, c);
2549
+ }
2550
+ function qn(e, t, n, r) {
2551
+ let i = t.h / 2;
2552
+ if (e.save(), Xn(e, t.x, t.y, t.w, t.h, i), e.fillStyle = "rgba(255, 255, 255, 0.35)", e.fill(), n > 0 && (Xn(e, t.x, t.y, t.w * n, t.h, i), e.fillStyle = "#fff", e.fill()), r) {
2553
+ let r = Math.max(t.x + 5, Math.min(t.x + t.w - 5, t.x + t.w * n));
2554
+ e.shadowColor = "rgba(0, 0, 0, 0.3)", e.shadowBlur = 3, e.fillStyle = "#fff", e.beginPath(), e.arc(r, t.y + t.h / 2, 5, 0, Math.PI * 2), e.fill();
2555
+ }
2556
+ e.restore();
2557
+ }
2558
+ function Jn(e) {
2559
+ let t = Math.max(220, e.w - 24);
2560
+ return {
2561
+ x: e.x + e.w / 2 - t / 2,
2562
+ y: e.y + e.h - Rn - 4,
2563
+ w: t,
2564
+ h: Rn
2565
+ };
2566
+ }
2567
+ function Yn(e) {
2568
+ if (e.el.mediaKind === "audio") {
2569
+ let t = Jn(e.rect), n = t.x + zn + Bn + Vn, r = Math.max(40, t.x + t.w - zn - n);
2570
+ return {
2571
+ x: n,
2572
+ y: t.y + (t.h - Hn) / 2,
2573
+ w: r,
2574
+ h: Hn
2575
+ };
2576
+ }
2577
+ let t = e.rect, n = Math.max(12, t.w * .025), r = Math.max(12, Math.min(18, t.h * .05));
2578
+ return {
2579
+ x: t.x + n,
2580
+ y: t.y + t.h - Hn - r,
2581
+ w: t.w - n * 2,
2582
+ h: Hn
2583
+ };
2584
+ }
2585
+ function Xn(e, t, n, r, i, a) {
2586
+ let o = Math.min(a, i / 2, r / 2);
2587
+ e.beginPath(), e.moveTo(t + o, n), e.lineTo(t + r - o, n), e.quadraticCurveTo(t + r, n, t + r, n + o), e.lineTo(t + r, n + i - o), e.quadraticCurveTo(t + r, n + i, t + r - o, n + i), e.lineTo(t + o, n + i), e.quadraticCurveTo(t, n + i, t, n + i - o), e.lineTo(t, n + o), e.quadraticCurveTo(t, n, t + o, n), e.closePath();
2588
+ }
2589
+ function Zn(e) {
2590
+ if (!Number.isFinite(e) || e < 0) return "0:00";
2591
+ let t = Math.floor(e);
2592
+ return `${Math.floor(t / 60)}:${(t % 60).toString().padStart(2, "0")}`;
2593
+ }
2594
+ //#endregion
2595
+ //#region packages/pptx/src/notes.ts
2596
+ function Qn(e, t) {
2597
+ return !Number.isInteger(t) || t < 0 || t >= e.length ? null : e[t].notes ?? null;
2598
+ }
2599
+ //#endregion
2600
+ //#region packages/pptx/src/hidden.ts
2601
+ function $n(e, t) {
2602
+ return !Number.isInteger(t) || t < 0 || t >= e.length ? !1 : e[t].hidden ?? !1;
2603
+ }
2604
+ //#endregion
2605
+ //#region packages/pptx/src/google-fonts.ts
2606
+ var er = {
2607
+ ...y,
2608
+ ...h
2609
+ };
2610
+ function* tr(e) {
2611
+ for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
2612
+ }
2613
+ function* nr(e) {
2614
+ for (let t of e.slides) for (let e of t.elements) if (e.type === "shape") yield* tr(e.textBody);
2615
+ else if (e.type === "table") for (let t of e.rows) for (let e of t.cells) yield* tr(e.textBody);
2616
+ else if (e.type === "chart") {
2617
+ e.chart.title && (yield e.chart.title);
2618
+ for (let t of e.chart.categories) yield t;
2619
+ for (let t of e.chart.series) t.name && (yield t.name);
2620
+ }
2621
+ }
2622
+ function rr(e) {
2623
+ let t = a(e.majorFont) ?? a(e.minorFont) ?? null;
2624
+ return [
2625
+ e.majorFont,
2626
+ e.minorFont,
2627
+ ...s(nr(e), t)
2628
+ ];
2629
+ }
2630
+ //#endregion
2631
+ //#region packages/pptx/src/media-mime.ts
2632
+ function ir(e, t) {
2633
+ for (let n of e.slides) for (let e of n.elements) {
2634
+ if (e.type !== "media") continue;
2635
+ let n = e;
2636
+ if (n.mediaPath === t) return n.mimeType;
2637
+ if (n.posterPath === t) return n.posterMimeType;
2638
+ }
2639
+ return "";
2640
+ }
2641
+ //#endregion
2642
+ //#region packages/pptx/src/worker.ts?worker&inline
2643
+ var ar = "function e(e){if(!e.startsWith(`data:`))return null;let t=e.indexOf(`,`);if(t===-1)return null;let n=atob(e.slice(t+1)),r=new Uint8Array(n.length);for(let e=0;e<n.length;e++)r[e]=n.charCodeAt(e);return r.buffer}var t=class{__destroy_into_raw(){let e=this.__wbg_ptr;return this.__wbg_ptr=0,r.unregister(this),e}free(){let e=this.__destroy_into_raw();y.__wbg_pptxarchive_free(e,0)}extract_image(e){let t=f(e,y.__wbindgen_malloc,y.__wbindgen_realloc),n=v,r=y.pptxarchive_extract_image(this.__wbg_ptr,t,n);if(r[3])throw p(r[2]);var a=i(r[0],r[1]).slice();return y.__wbindgen_free(r[0],r[1]*1,1),a}extract_media(e){let t=f(e,y.__wbindgen_malloc,y.__wbindgen_realloc),n=v,r=y.pptxarchive_extract_media(this.__wbg_ptr,t,n);if(r[3])throw p(r[2]);var a=i(r[0],r[1]).slice();return y.__wbindgen_free(r[0],r[1]*1,1),a}constructor(e,t){let n=d(e,y.__wbindgen_malloc),i=v,a=y.pptxarchive_new(n,i,!u(t),u(t)?BigInt(0):t);if(a[2])throw p(a[1]);return this.__wbg_ptr=a[0]>>>0,r.register(this,this.__wbg_ptr,this),this}parse(){let e=y.pptxarchive_parse(this.__wbg_ptr);if(e[3])throw p(e[2]);var t=i(e[0],e[1]).slice();return y.__wbindgen_free(e[0],e[1]*1,1),t}to_markdown(){let e,t;try{let i=y.pptxarchive_to_markdown(this.__wbg_ptr);var n=i[0],r=i[1];if(i[3])throw n=0,r=0,p(i[2]);return e=n,t=r,s(n,r)}finally{y.__wbindgen_free(e,t,1)}}};Symbol.dispose&&(t.prototype[Symbol.dispose]=t.prototype.free);function n(){return{__proto__:null,\"./pptx_parser_bg.js\":{__proto__:null,__wbg___wbindgen_throw_6b64449b9b9ed33c:function(e,t){throw Error(s(e,t))},__wbg_error_a6fa202b58aa1cd3:function(e,t){let n,r;try{n=e,r=t,console.error(s(e,t))}finally{y.__wbindgen_free(n,r,1)}},__wbg_new_227d7c05414eb861:function(){return Error()},__wbg_stack_3b0d974bbf31e44f:function(e,t){let n=t.stack,r=f(n,y.__wbindgen_malloc,y.__wbindgen_realloc),i=v;o().setInt32(e+4,i,!0),o().setInt32(e+0,r,!0)},__wbindgen_cast_0000000000000001:function(e,t){return s(e,t)},__wbindgen_init_externref_table:function(){let e=y.__wbindgen_externrefs,t=e.grow(4);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)}}}}const r=typeof FinalizationRegistry>`u`?{register:()=>{},unregister:()=>{}}:new FinalizationRegistry(e=>y.__wbg_pptxarchive_free(e>>>0,1));function i(e,t){return e>>>=0,l().subarray(e/1,e/1+t)}let a=null;function o(){return(a===null||a.buffer.detached===!0||a.buffer.detached===void 0&&a.buffer!==y.memory.buffer)&&(a=new DataView(y.memory.buffer)),a}function s(e,t){return e>>>=0,g(e,t)}let c=null;function l(){return(c===null||c.byteLength===0)&&(c=new Uint8Array(y.memory.buffer)),c}function u(e){return e==null}function d(e,t){let n=t(e.length*1,1)>>>0;return l().set(e,n/1),v=e.length,n}function f(e,t,n){if(n===void 0){let n=_.encode(e),r=t(n.length,1)>>>0;return l().subarray(r,r+n.length).set(n),v=n.length,r}let r=e.length,i=t(r,1)>>>0,a=l(),o=0;for(;o<r;o++){let t=e.charCodeAt(o);if(t>127)break;a[i+o]=t}if(o!==r){o!==0&&(e=e.slice(o)),i=n(i,r,r=o+e.length*3,1)>>>0;let t=l().subarray(i+o,i+r),a=_.encodeInto(e,t);o+=a.written,i=n(i,r,o,1)>>>0}return v=o,i}function p(e){let t=y.__wbindgen_externrefs.get(e);return y.__externref_table_dealloc(e),t}let m=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0});m.decode();let h=0;function g(e,t){return h+=t,h>=2146435072&&(m=new TextDecoder(`utf-8`,{ignoreBOM:!0,fatal:!0}),m.decode(),h=t),m.decode(l().subarray(e,e+t))}const _=new TextEncoder;`encodeInto`in _||(_.encodeInto=function(e,t){let n=_.encode(e);return t.set(n),{read:e.length,written:n.length}});let v=0,y;function b(e,t){return y=e.exports,a=null,c=null,y.__wbindgen_start(),y}async function x(e,t){if(typeof Response==`function`&&e instanceof Response){if(typeof WebAssembly.instantiateStreaming==`function`)try{return await WebAssembly.instantiateStreaming(e,t)}catch(t){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);else throw t}let r=await e.arrayBuffer();return await WebAssembly.instantiate(r,t)}else{let n=await WebAssembly.instantiate(e,t);return n instanceof WebAssembly.Instance?{instance:n,module:e}:n}function n(e){switch(e){case`basic`:case`cors`:case`default`:return!0}return!1}}async function S(e){if(y!==void 0)return y;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`));let t=n();(typeof e==`string`||typeof Request==`function`&&e instanceof Request||typeof URL==`function`&&e instanceof URL)&&(e=fetch(e));let{instance:r,module:i}=await x(await e,t);return b(r,i)}let C=!1,w=null;function T(){w&&=(w.free(),null)}async function E(t){await S(e(t)??t),C=!0,self.postMessage({kind:`ready`})}self.onmessage=e=>{let n=e.data;if(n.kind===`init`){E(n.wasmUrl).catch(e=>{console.error(`[pptx-worker] WASM init failed:`,e)});return}if(n.kind===`parse`){if(!C){let e={kind:`error`,id:n.id,message:`WASM not initialized`};self.postMessage(e);return}try{let e=typeof n.maxZipEntryBytes==`number`&&n.maxZipEntryBytes>0?BigInt(n.maxZipEntryBytes):void 0;T(),w=new t(new Uint8Array(n.buffer),e);let r=w.parse().buffer,i={kind:`parsed`,id:n.id,presentationJson:r};self.postMessage(i,[r])}catch(e){let t={kind:`error`,id:n.id,message:e instanceof Error?e.message:String(e)};self.postMessage(t)}return}if(n.kind===`extractMedia`){if(!w){let e={kind:`error`,id:n.id,message:`No pptx loaded`};self.postMessage(e);return}try{let e=w.extract_media(n.path),t=new Uint8Array(e).slice().buffer,r={kind:`mediaExtracted`,id:n.id,bytes:t};self.postMessage(r,[t])}catch(e){let t={kind:`error`,id:n.id,message:e instanceof Error?e.message:String(e)};self.postMessage(t)}return}if(n.kind===`extractImage`){if(!w){let e={kind:`error`,id:n.id,message:`No pptx loaded`};self.postMessage(e);return}try{let e=w.extract_image(n.path),t=new Uint8Array(e).slice().buffer,r={kind:`imageExtracted`,id:n.id,bytes:t};self.postMessage(r,[t])}catch(e){let t={kind:`error`,id:n.id,message:e instanceof Error?e.message:String(e)};self.postMessage(t)}return}};", or = typeof self < "u" && self.Blob && new Blob(["URL.revokeObjectURL(import.meta.url);", ar], { type: "text/javascript;charset=utf-8" });
2644
+ function sr(e) {
2645
+ let t;
2646
+ try {
2647
+ if (t = or && (self.URL || self.webkitURL).createObjectURL(or), !t) throw "";
2648
+ let n = new Worker(t, {
2649
+ type: "module",
2650
+ name: e?.name
2651
+ });
2652
+ return n.addEventListener("error", () => {
2653
+ (self.URL || self.webkitURL).revokeObjectURL(t);
2654
+ }), n;
2655
+ } catch {
2656
+ return new Worker("data:text/javascript;charset=utf-8," + encodeURIComponent(ar), {
2657
+ type: "module",
2658
+ name: e?.name
2659
+ });
2660
+ }
2661
+ }
2662
+ //#endregion
2663
+ //#region packages/pptx/src/wasm/pptx_parser_bg.wasm?url
2664
+ var cr = new URL(new URL("pptx_parser_bg.wasm", import.meta.url).href, import.meta.url).href, lr = class e {
2665
+ _worker;
2666
+ _bridge;
2667
+ _mode = "main";
2668
+ _presentation = null;
2669
+ _meta = null;
2670
+ _mediaCache = /* @__PURE__ */ new Map();
2671
+ _imageCache = /* @__PURE__ */ new Map();
2672
+ _fetchImage = (e, t) => this.getImage(e, t);
2673
+ _workerReady = !1;
2674
+ _workerReadyCallbacks = [];
2675
+ _math;
2676
+ constructor(e, t, n) {
2677
+ this._worker = e, this._mode = t, this._bridge = new j(this._worker, {
2678
+ correlate: (e) => "id" in e ? e.id : void 0,
2679
+ toError: (e) => e.kind === "error" ? e.message : void 0,
2680
+ onUnsolicited: (e) => {
2681
+ if (e.kind === "ready") {
2682
+ this._workerReady = !0;
2683
+ for (let e of this._workerReadyCallbacks) e();
2684
+ this._workerReadyCallbacks = [];
2685
+ }
2686
+ }
2687
+ });
2688
+ let r = new URL(n ?? cr, location.href).href;
2689
+ this._bridge.post({
2690
+ kind: "init",
2691
+ wasmUrl: r
2692
+ });
2693
+ }
2694
+ static async load(t, n = {}) {
2695
+ let r = n.mode ?? "main";
2696
+ if (r === "worker" && (typeof Worker > "u" || typeof OffscreenCanvas > "u")) throw Error("mode: 'worker' requires Worker and OffscreenCanvas support");
2697
+ let i = new e(r === "worker" ? (await import("./render-worker-host-UUYE6Oqt.js")).createRenderWorker() : new sr(), r, n.wasmUrl), a;
2698
+ if (typeof t == "string") {
2699
+ let e = await fetch(t);
2700
+ if (!e.ok) throw Error(`Failed to fetch: ${e.status} ${e.statusText}`);
2701
+ a = await e.arrayBuffer();
2702
+ } else a = t;
2703
+ return n.math && r === "worker" && console.warn("[ooxml] the math engine is unavailable in mode: 'worker'; equations will be skipped. Use mode: 'main' for documents with equations."), i._math = r === "worker" ? void 0 : n.math, await i._parse(a, n.maxZipEntryBytes, r === "worker" ? !!n.useGoogleFonts : !1, n.workerTimeoutMs), r === "main" && n.useGoogleFonts && i._presentation && await v(rr(i._presentation), er), i;
2704
+ }
2705
+ _waitForWorker() {
2706
+ return this._workerReady ? Promise.resolve() : new Promise((e) => this._workerReadyCallbacks.push(e));
2707
+ }
2708
+ async _parse(e, t, n = !1, r) {
2709
+ await this._waitForWorker();
2710
+ let i = await this._bridge.request((r) => this._mode === "worker" ? {
2711
+ kind: "parse",
2712
+ id: r,
2713
+ buffer: e,
2714
+ maxZipEntryBytes: t,
2715
+ useGoogleFonts: n
2716
+ } : {
2717
+ kind: "parse",
2718
+ id: r,
2719
+ buffer: e,
2720
+ maxZipEntryBytes: t
2721
+ }, [e], { timeoutMs: r });
2722
+ if (this._mode === "worker") this._meta = i.meta;
2723
+ else {
2724
+ let { presentationJson: e } = i;
2725
+ this._presentation = JSON.parse(new TextDecoder().decode(new Uint8Array(e)));
2726
+ }
2727
+ }
2728
+ get slideCount() {
2729
+ return this._presentation?.slides.length ?? this._meta?.slideCount ?? 0;
2730
+ }
2731
+ get slideWidth() {
2732
+ return this._presentation?.slideWidth ?? this._meta?.slideWidth ?? 0;
2733
+ }
2734
+ get slideHeight() {
2735
+ return this._presentation?.slideHeight ?? this._meta?.slideHeight ?? 0;
2736
+ }
2737
+ get mode() {
2738
+ return this._mode;
2739
+ }
2740
+ getNotes(e) {
2741
+ return this._meta ? Number.isInteger(e) ? this._meta.notes[e] ?? null : null : Qn(this._presentation?.slides ?? [], e);
2742
+ }
2743
+ isHidden(e) {
2744
+ return this._meta ? Number.isInteger(e) ? this._meta.hidden[e] ?? !1 : !1 : $n(this._presentation?.slides ?? [], e);
2745
+ }
2746
+ async renderSlide(e, t, n = {}) {
2747
+ if (this._mode === "worker") throw Error("renderSlide(canvas) is unavailable in mode: 'worker'; use renderSlideToBitmap() and paint it via an ImageBitmapRenderingContext");
2748
+ if (!this._presentation) throw Error("Presentation not loaded");
2749
+ let r = this._presentation.slides[t];
2750
+ if (!r) throw Error(`Slide index ${t} out of range (count: ${this.slideCount})`);
2751
+ let i = n.dpr ?? E(), a = n.width ?? ((T(e) ? e.offsetWidth : 0) || 960);
2752
+ await jn(e, r, this._presentation.slideWidth, this._presentation.slideHeight, {
2753
+ width: a,
2754
+ dpr: i,
2755
+ defaultTextColor: this._presentation.defaultTextColor,
2756
+ majorFont: this._presentation.majorFont,
2757
+ minorFont: this._presentation.minorFont,
2758
+ hlinkColor: this._presentation.hlinkColor ?? null,
2759
+ fetchMedia: (e) => this.getMedia(e),
2760
+ fetchImage: this._fetchImage,
2761
+ skipMediaControls: n.skipMediaControls,
2762
+ dim: n.dim,
2763
+ math: this._math
2764
+ }, n.onTextRun);
2765
+ }
2766
+ async renderSlideToBitmap(e, t = {}) {
2767
+ let n = t.width ?? 960, r = t.dpr ?? E();
2768
+ if (this._mode === "worker") {
2769
+ if (!Number.isInteger(e) || e < 0 || e >= this.slideCount) throw Error(`Slide index ${e} out of range (count: ${this.slideCount})`);
2770
+ return (await this._bridge.request((i) => ({
2771
+ kind: "renderSlide",
2772
+ id: i,
2773
+ slideIndex: e,
2774
+ width: n,
2775
+ dpr: r,
2776
+ skipMediaControls: t.skipMediaControls,
2777
+ dim: t.dim
2778
+ }))).bitmap;
2779
+ }
2780
+ let i = new OffscreenCanvas(1, 1);
2781
+ return await this.renderSlide(i, e, {
2782
+ width: n,
2783
+ dpr: r,
2784
+ skipMediaControls: t.skipMediaControls,
2785
+ dim: t.dim
2786
+ }), i.transferToImageBitmap();
2787
+ }
2788
+ async getMedia(e) {
2789
+ let t = this._mediaCache.get(e);
2790
+ if (t) return t;
2791
+ let n = this._findMimeTypeForPath(e), r = (async () => {
2792
+ await this._waitForWorker();
2793
+ let t = (await this._bridge.request((t) => ({
2794
+ kind: "extractMedia",
2795
+ id: t,
2796
+ path: e
2797
+ }))).bytes;
2798
+ return new Blob([t], { type: n });
2799
+ })();
2800
+ return this._mediaCache.set(e, r), r;
2801
+ }
2802
+ _findMimeTypeForPath(e) {
2803
+ return this._presentation ? ir(this._presentation, e) : "";
2804
+ }
2805
+ async getImage(e, t) {
2806
+ let n = this._imageCache.get(e);
2807
+ if (n) return n;
2808
+ let r = (async () => {
2809
+ await this._waitForWorker();
2810
+ let n = (await this._bridge.request((t) => ({
2811
+ kind: "extractImage",
2812
+ id: t,
2813
+ path: e
2814
+ }))).bytes;
2815
+ return new Blob([n], { type: t });
2816
+ })();
2817
+ return this._imageCache.set(e, r), r;
2818
+ }
2819
+ async presentSlide(e, t, n = {}) {
2820
+ if (this._mode === "main" && !this._presentation) throw Error("Presentation not loaded");
2821
+ if (!Number.isInteger(t) || t < 0 || t >= this.slideCount) throw Error(`Slide index ${t} out of range (count: ${this.slideCount})`);
2822
+ let r = n.dpr ?? E(), i = n.width ?? (e.offsetWidth || 960);
2823
+ this._mode === "worker" && n.onTextRun && console.warn("[ooxml] onTextRun is unavailable in mode: 'worker'; the text selection overlay will be empty for this slide.");
2824
+ let a = this._mode === "worker" ? async () => {
2825
+ let a = await this.renderSlideToBitmap(t, {
2826
+ width: i,
2827
+ dpr: r,
2828
+ skipMediaControls: !0,
2829
+ dim: n.dim
2830
+ });
2831
+ e.width = a.width, e.height = a.height, e.style.width = `${Math.round(a.width / r)}px`, e.style.display || (e.style.display = "block");
2832
+ let o = e.getContext("2d");
2833
+ if (!o) throw Error("2D context not available");
2834
+ o.drawImage(a, 0, 0), a.close();
2835
+ } : () => this.renderSlide(e, t, {
2836
+ width: i,
2837
+ dpr: r,
2838
+ skipMediaControls: !0,
2839
+ dim: n.dim,
2840
+ onTextRun: n.onTextRun
2841
+ });
2842
+ return Ln(e, this._mode === "worker" ? this._meta?.mediaElements[t] ?? [] : this._presentation.slides[t].elements.filter((e) => e.type === "media"), {
2843
+ width: i,
2844
+ dpr: r,
2845
+ slideWidthEmu: this.slideWidth,
2846
+ fetchMedia: (e) => this.getMedia(e),
2847
+ fetchImage: this._fetchImage,
2848
+ drawBase: a
2849
+ });
2850
+ }
2851
+ destroy() {
2852
+ this._bridge.terminate(), this._presentation = null, this._meta = null, this._mediaCache.clear(), this._imageCache.clear(), W(this._fetchImage), t(this._fetchImage);
2853
+ }
2854
+ }, ur = {
2855
+ color: "#ffffff",
2856
+ opacity: .6
2857
+ }, dr = class {
2858
+ canvas;
2859
+ wrapper;
2860
+ _originalParent;
2861
+ _originalNextSibling;
2862
+ _originalDisplay;
2863
+ textLayer = null;
2864
+ engine = null;
2865
+ opts;
2866
+ currentSlide = 0;
2867
+ _hiddenMode;
2868
+ handle = null;
2869
+ _mode;
2870
+ _bitmapCtx = null;
2871
+ _warnedNoTextSelection = !1;
2872
+ constructor(e, t = {}) {
2873
+ this.opts = t, this.canvas = e, this._mode = t.mode ?? "main", this._hiddenMode = t.hiddenSlideMode ?? "show";
2874
+ let n = e.parentElement;
2875
+ this._originalParent = n, this._originalNextSibling = e.nextSibling, this._originalDisplay = e.style.display, this.wrapper = document.createElement("div"), this.wrapper.style.cssText = "position:relative;display:inline-block;vertical-align:top;", e.style.display || (e.style.display = "block"), n && n.insertBefore(this.wrapper, e), this.wrapper.appendChild(e), this._mode === "worker" && !t.enableMediaPlayback && (this._bitmapCtx = e.getContext("bitmaprenderer")), t.enableTextSelection && (this.textLayer = document.createElement("div"), this.textLayer.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;", this.wrapper.appendChild(this.textLayer));
2876
+ }
2877
+ async load(e) {
2878
+ try {
2879
+ this.engine = await lr.load(e, {
2880
+ useGoogleFonts: this.opts.useGoogleFonts,
2881
+ maxZipEntryBytes: this.opts.maxZipEntryBytes,
2882
+ workerTimeoutMs: this.opts.workerTimeoutMs,
2883
+ wasmUrl: this.opts.wasmUrl,
2884
+ math: this.opts.math,
2885
+ mode: this._mode
2886
+ }), this.currentSlide = this._initialSlide(), await this.renderCurrentSlide();
2887
+ } catch (e) {
2888
+ let t = e instanceof Error ? e : Error(String(e));
2889
+ if (this.opts.onError) {
2890
+ this.opts.onError(t);
2891
+ return;
2892
+ }
2893
+ throw t;
2894
+ }
2895
+ }
2896
+ async goToSlide(e) {
2897
+ !this.engine || this.slideCount === 0 || (this.currentSlide = Math.max(0, Math.min(e, this.slideCount - 1)), await this.renderCurrentSlide());
2898
+ }
2899
+ async nextSlide() {
2900
+ await this.goToSlide(this._step(1));
2901
+ }
2902
+ async prevSlide() {
2903
+ await this.goToSlide(this._step(-1));
2904
+ }
2905
+ _step(e) {
2906
+ return this._hiddenMode === "skip" && this.engine ? oe(this.currentSlide, e, (e) => this.engine.isHidden(e), this.slideCount) : this.currentSlide + e;
2907
+ }
2908
+ _initialSlide() {
2909
+ return this._hiddenMode === "skip" && this.engine ? se(0, (e) => this.engine.isHidden(e), this.slideCount) : 0;
2910
+ }
2911
+ _dim() {
2912
+ return {
2913
+ color: this.opts.hiddenSlideDim?.color ?? ur.color,
2914
+ opacity: this.opts.hiddenSlideDim?.opacity ?? ur.opacity
2915
+ };
2916
+ }
2917
+ async setHiddenSlideMode(e) {
2918
+ this._hiddenMode = e, e === "skip" && this.engine && (this.currentSlide = se(this.currentSlide, (e) => this.engine.isHidden(e), this.slideCount)), await this.renderCurrentSlide();
2919
+ }
2920
+ get hiddenSlideMode() {
2921
+ return this._hiddenMode;
2922
+ }
2923
+ get visibleSlideCount() {
2924
+ if (!this.engine) return 0;
2925
+ let e = this.engine;
2926
+ return ce((t) => e.isHidden(t), this.slideCount);
2927
+ }
2928
+ get slideIndex() {
2929
+ return this.currentSlide;
2930
+ }
2931
+ get slideCount() {
2932
+ return this.engine?.slideCount ?? 0;
2933
+ }
2934
+ getNotes(e) {
2935
+ return this.engine?.getNotes(e) ?? null;
2936
+ }
2937
+ get canvasElement() {
2938
+ return this.canvas;
2939
+ }
2940
+ async renderCurrentSlide() {
2941
+ if (!this.engine) return;
2942
+ let e = this._hiddenMode === "dim" && this.engine.isHidden(this.currentSlide) ? this._dim() : void 0, t = this.opts.width ?? (this.canvas.offsetWidth || 960), n = this.opts.dpr ?? (window.devicePixelRatio || 1), r = t / this.engine.slideWidth, i = Math.round(this.engine.slideHeight * r);
2943
+ this.canvas.style.width = `${t}px`, this.canvas.style.height = `${i}px`, this.handle?.destroy(), this.handle = null;
2944
+ let a = this._mode === "worker";
2945
+ a && this.textLayer && !this._warnedNoTextSelection && (this._warnedNoTextSelection = !0, console.warn("[ooxml] text selection is unavailable in mode: 'worker'; the overlay will be empty. Use mode: 'main' for selectable text."));
2946
+ let o = [], s = !a && this.textLayer ? (e) => o.push(e) : void 0;
2947
+ try {
2948
+ if (this.opts.enableMediaPlayback) this.handle = await this.engine.presentSlide(this.canvas, this.currentSlide, {
2949
+ width: t,
2950
+ dpr: n,
2951
+ dim: e
2952
+ });
2953
+ else if (a) {
2954
+ let r = await this.engine.renderSlideToBitmap(this.currentSlide, {
2955
+ width: t,
2956
+ dpr: n,
2957
+ dim: e
2958
+ });
2959
+ this.canvas.width = r.width, this.canvas.height = r.height, this._bitmapCtx?.transferFromImageBitmap(r);
2960
+ } else await this.engine.renderSlide(this.canvas, this.currentSlide, {
2961
+ width: t,
2962
+ dpr: n,
2963
+ onTextRun: s,
2964
+ dim: e
2965
+ });
2966
+ this.opts.onSlideChange?.(this.currentSlide, this.slideCount);
2967
+ } catch (e) {
2968
+ this.opts.onError?.(e instanceof Error ? e : Error(String(e)));
2969
+ }
2970
+ this.textLayer && !a && this._buildTextLayer(this.textLayer, o, t, i);
2971
+ }
2972
+ _buildTextLayer(e, t, n, r) {
2973
+ ue(e, t, n, r);
2974
+ }
2975
+ destroy() {
2976
+ if (this.handle?.destroy(), this.handle = null, this.engine?.destroy(), this._originalParent) {
2977
+ let e = this._originalNextSibling && this._originalNextSibling.parentNode === this._originalParent ? this._originalNextSibling : null;
2978
+ this._originalParent.insertBefore(this.canvas, e);
2979
+ } else this.canvas.parentNode && this.canvas.parentNode.removeChild(this.canvas);
2980
+ this.canvas.style.display = this._originalDisplay, this.wrapper.remove();
2981
+ }
2982
+ }, fr = 150, pr = "0 1px 3px rgba(0,0,0,0.2)", mr = class {
2983
+ _pres = null;
2984
+ _injected;
2985
+ _opts;
2986
+ _container;
2987
+ _wrapper;
2988
+ _scrollHost;
2989
+ _spacer;
2990
+ _mode;
2991
+ _scale = 1;
2992
+ _scaleEstablished = !1;
2993
+ _slots = /* @__PURE__ */ new Map();
2994
+ _free = [];
2995
+ _heights = [];
2996
+ _lastRange = null;
2997
+ _lastTopIndex = -1;
2998
+ _scrollListener = null;
2999
+ _destroyed = !1;
3000
+ _slideInFlight = /* @__PURE__ */ new Set();
3001
+ _renderEpoch = 0;
3002
+ _settleTimer = null;
3003
+ _wheelListener = null;
3004
+ _warnedNoTextSelection = !1;
3005
+ _resizeObserver = null;
3006
+ _prevBase = 0;
3007
+ _lastFitWidth = 0;
3008
+ _pageShadow;
3009
+ constructor(e, t = {}) {
3010
+ if (this._container = e, this._opts = t, this._pageShadow = t.pageShadow ?? pr, this._injected = !!t.presentation, this._injected) {
3011
+ let e = t.presentation;
3012
+ if (t.mode !== void 0 && t.mode !== e.mode) throw Error(`PptxScrollViewer: opts.mode='${t.mode}' conflicts with the injected engine's mode='${e.mode}'. Omit opts.mode when injecting an engine — the engine owns its render mode.`);
3013
+ this._pres = e, this._mode = e.mode;
3014
+ } else this._mode = t.mode ?? "main";
3015
+ this._wrapper = document.createElement("div"), this._wrapper.style.cssText = "position:relative;width:100%;height:100%;overflow:hidden;", this._scrollHost = document.createElement("div"), this._scrollHost.style.cssText = "position:absolute;inset:0;overflow:auto;", t.background && (this._scrollHost.style.background = t.background), this._spacer = document.createElement("div"), this._spacer.style.cssText = "position:absolute;top:0;left:0;width:1px;height:0;pointer-events:none;", this._scrollHost.appendChild(this._spacer), this._wrapper.appendChild(this._scrollHost), this._container.appendChild(this._wrapper), this._scrollListener = () => this._onScroll(), this._scrollHost.addEventListener("scroll", this._scrollListener), this._opts.enableZoom !== !1 && (this._wheelListener = (e) => {
3016
+ (e.ctrlKey || e.metaKey) && (e.preventDefault(), e.deltaY !== 0 && this.setScale(M(this._scale, e.deltaY)));
3017
+ }, this._scrollHost.addEventListener("wheel", this._wheelListener, { passive: !1 })), typeof ResizeObserver < "u" && (this._resizeObserver = new ResizeObserver(() => this._onResize()), this._resizeObserver.observe(this._container)), this._injected && this.relayout();
3018
+ }
3019
+ async load(e) {
3020
+ if (this._injected) throw Error("PptxScrollViewer.load() is unsupported when an engine is injected via opts.presentation; the injected engine is already loaded.");
3021
+ try {
3022
+ this._pres = await lr.load(e, {
3023
+ useGoogleFonts: this._opts.useGoogleFonts,
3024
+ maxZipEntryBytes: this._opts.maxZipEntryBytes,
3025
+ workerTimeoutMs: this._opts.workerTimeoutMs,
3026
+ wasmUrl: this._opts.wasmUrl,
3027
+ math: this._opts.math,
3028
+ mode: this._mode
3029
+ }), this.relayout();
3030
+ } catch (e) {
3031
+ let t = e instanceof Error ? e : Error(String(e));
3032
+ if (this._opts.onError) {
3033
+ this._opts.onError(t);
3034
+ return;
3035
+ }
3036
+ throw t;
3037
+ }
3038
+ }
3039
+ get slideCount() {
3040
+ return this._pres?.slideCount ?? 0;
3041
+ }
3042
+ _slideWidthPx() {
3043
+ return this._pres.slideWidth / z * this._scale;
3044
+ }
3045
+ _slideHeightPx() {
3046
+ return this._pres.slideHeight / z * this._scale;
3047
+ }
3048
+ _fitWidthPx() {
3049
+ if (this._opts.width && this._opts.width > 0) return this._opts.width;
3050
+ let e = this._container.clientWidth || this._scrollHost.clientWidth;
3051
+ if (e <= 0) return 0;
3052
+ let { left: t, right: n } = this._padH(), r = e - t - n;
3053
+ return r > 0 ? r : 0;
3054
+ }
3055
+ _baseScale() {
3056
+ if (!this._pres || this._pres.slideCount === 0) return 0;
3057
+ let e = this._fitWidthPx(), t = this._pres.slideWidth / z;
3058
+ return e <= 0 || t <= 0 ? 0 : e / t;
3059
+ }
3060
+ relayout() {
3061
+ if (this._pres) {
3062
+ if (!this._scaleEstablished) {
3063
+ let e = this._baseScale();
3064
+ if (e > 0) this._scale = e, this._prevBase = e, this._lastFitWidth = this._fitWidthPx(), this._scaleEstablished = !0;
3065
+ else return;
3066
+ }
3067
+ this._recomputeHeights(), this._syncSpacer(), this._mountVisible();
3068
+ }
3069
+ }
3070
+ _recomputeHeights() {
3071
+ let e = this._pres.slideCount, t = this._slideHeightPx();
3072
+ this._heights = Array(e).fill(t);
3073
+ }
3074
+ _gap() {
3075
+ return this._opts.gap ?? 16;
3076
+ }
3077
+ _overscan() {
3078
+ return this._opts.overscan ?? 1;
3079
+ }
3080
+ _pad() {
3081
+ let e = this._gap();
3082
+ return {
3083
+ leading: this._opts.paddingTop ?? e,
3084
+ trailing: this._opts.paddingBottom ?? e
3085
+ };
3086
+ }
3087
+ _padH() {
3088
+ let e = this._gap();
3089
+ return {
3090
+ left: this._opts.paddingLeft ?? e,
3091
+ right: this._opts.paddingRight ?? e
3092
+ };
3093
+ }
3094
+ _range() {
3095
+ return re(this._heights, this._gap(), this._scrollHost.scrollTop, this._scrollHost.clientHeight, this._overscan(), this._pad());
3096
+ }
3097
+ _syncSpacer() {
3098
+ let e = this._range();
3099
+ this._lastRange = e, this._spacer.style.height = `${e.totalHeight}px`, this._syncSpacerWidth();
3100
+ }
3101
+ _syncSpacerWidth() {
3102
+ let { left: e, right: t } = this._padH();
3103
+ this._spacer.style.width = `${this._slideWidthPx() + e + t}px`;
3104
+ }
3105
+ _onScroll() {
3106
+ !this._pres || !this._scaleEstablished || this._mountVisible();
3107
+ }
3108
+ _mountVisible() {
3109
+ if (!this._pres || this._pres.slideCount === 0) return;
3110
+ let e = this._range();
3111
+ this._lastRange = e;
3112
+ for (let [t, n] of [...this._slots]) (t < e.start || t > e.end) && this._recycleSlot(t, n);
3113
+ for (let t = e.start; t <= e.end; t++) if (this._slots.has(t)) this._positionSlot(this._slots.get(t), t, e);
3114
+ else {
3115
+ let n = this._acquireSlot();
3116
+ this._positionSlot(n, t, e), this._slots.set(t, n), this._renderSlot(t, n);
3117
+ }
3118
+ e.topIndex !== this._lastTopIndex && (this._lastTopIndex = e.topIndex, this._opts.onVisibleSlideChange?.(e.topIndex, this._pres.slideCount));
3119
+ }
3120
+ _applyPageShadow(e) {
3121
+ this._pageShadow !== !1 && (e.style.boxShadow = this._pageShadow);
3122
+ }
3123
+ _acquireSlot() {
3124
+ let e = this._free.pop();
3125
+ if (e) return this._scrollHost.appendChild(e.wrapper), e;
3126
+ let t = document.createElement("div");
3127
+ t.style.cssText = "position:absolute;";
3128
+ let n = document.createElement("canvas");
3129
+ n.style.cssText = "display:block;background:#fff;", this._applyPageShadow(n), t.appendChild(n);
3130
+ let r = null;
3131
+ return this._opts.enableTextSelection && (r = document.createElement("div"), r.style.cssText = "position:absolute;top:0;left:0;width:100%;height:100%;overflow:hidden;pointer-events:none;user-select:text;-webkit-user-select:text;", t.appendChild(r)), this._scrollHost.appendChild(t), {
3132
+ wrapper: t,
3133
+ canvas: n,
3134
+ textLayer: r,
3135
+ renderedSlide: -1,
3136
+ renderedScale: -1,
3137
+ bitmap: null,
3138
+ bitmapCtx: null
3139
+ };
3140
+ }
3141
+ _recycleSlot(e, t) {
3142
+ this._slots.delete(e), t.bitmap &&= (t.bitmap.close(), null), t.textLayer && (t.textLayer.innerHTML = "", t.textLayer.style.transform = "", t.textLayer.style.transformOrigin = ""), t.renderedSlide = -1, t.renderedScale = -1, t.wrapper.remove(), this._free.push(t);
3143
+ }
3144
+ _positionSlot(e, t, n) {
3145
+ e.wrapper.style.top = `${n.offsets[t]}px`;
3146
+ let r = this._slideWidthPx();
3147
+ e.wrapper.style.width = `${r}px`, e.wrapper.style.height = `${this._slideHeightPx()}px`;
3148
+ let { left: i } = this._padH(), a = this._scrollHost.clientWidth;
3149
+ e.wrapper.style.left = `${Math.max(i, (a - r) / 2)}px`;
3150
+ }
3151
+ _dpr() {
3152
+ return this._opts.dpr ?? (typeof window < "u" && window.devicePixelRatio || 1);
3153
+ }
3154
+ _renderSlot(e, t) {
3155
+ if (!this._pres || t.renderedSlide === e) return;
3156
+ t.renderedSlide = e;
3157
+ let n = this._dpr(), r = this._slideWidthPx(), i = this._renderEpoch, a = this._scale;
3158
+ if (this._mode === "worker") {
3159
+ this._renderSlotBitmap(e, t, r, n, a);
3160
+ return;
3161
+ }
3162
+ let o = [], s = !!this._opts.enableTextSelection && !!t.textLayer, c = s ? (e) => o.push(e) : void 0;
3163
+ this._pres.renderSlide(t.canvas, e, {
3164
+ width: r,
3165
+ dpr: n,
3166
+ onTextRun: c
3167
+ }).then(() => {
3168
+ i !== this._renderEpoch || this._slots.get(e) !== t || t.renderedSlide !== e || (t.renderedScale = a, s && t.textLayer && ue(t.textLayer, o, Math.round(r), Math.round(this._slideHeightPx())));
3169
+ }).catch((e) => {
3170
+ this._reportRenderError(e);
3171
+ });
3172
+ }
3173
+ _maybeWarnNoTextSelection() {
3174
+ this._opts.enableTextSelection && !this._warnedNoTextSelection && (this._warnedNoTextSelection = !0, console.warn("[ooxml] text selection is unavailable in mode: 'worker'; the overlay will be empty. Use mode: 'main' for selectable text."));
3175
+ }
3176
+ _reportRenderError(e) {
3177
+ if (this._destroyed) return;
3178
+ let t = e instanceof Error ? e : Error(String(e));
3179
+ this._opts.onError ? this._opts.onError(t) : console.error("[ooxml] PptxScrollViewer render failed:", t);
3180
+ }
3181
+ async _renderSlotBitmap(e, t, n, r, i) {
3182
+ if (this._maybeWarnNoTextSelection(), this._slideInFlight.has(e) || this._slots.get(e) !== t) return;
3183
+ let a = this._renderEpoch;
3184
+ this._slideInFlight.add(e);
3185
+ let o = !1;
3186
+ t.bitmapCtx ||= t.canvas.getContext("bitmaprenderer");
3187
+ try {
3188
+ let s = await this._pres.renderSlideToBitmap(e, {
3189
+ width: n,
3190
+ dpr: r
3191
+ });
3192
+ if (a !== this._renderEpoch || this._slots.get(e) !== t || t.renderedSlide !== e) {
3193
+ s.close();
3194
+ return;
3195
+ }
3196
+ t.bitmap && t.bitmap.close(), t.bitmap = s, t.canvas.width = s.width, t.canvas.height = s.height, t.canvas.style.width = `${Math.round(s.width / r)}px`, t.canvas.style.height = `${Math.round(s.height / r)}px`, t.bitmapCtx?.transferFromImageBitmap(s), t.bitmap = null, t.renderedScale = i, o = !0;
3197
+ } catch (e) {
3198
+ this._reportRenderError(e);
3199
+ } finally {
3200
+ this._slideInFlight.delete(e);
3201
+ let n = this._slots.get(e);
3202
+ !o && n && (n !== t || a !== this._renderEpoch) && !this._slideInFlight.has(e) && !this._destroyed && this._renderSlotBitmap(e, n, this._slideWidthPx(), this._dpr(), this._scale);
3203
+ }
3204
+ }
3205
+ setScale(e) {
3206
+ if (!this._pres || this._pres.slideCount === 0 || !this._scaleEstablished) return;
3207
+ let t = this._opts.zoomMin ?? .1, n = this._opts.zoomMax ?? 4, r = Math.min(n, Math.max(t, e));
3208
+ if (r === this._scale) return;
3209
+ let i = this._range(), a = i.topIndex, o = this._heights[a] || 0, s = o > 0 ? (this._scrollHost.scrollTop - i.offsets[a]) / o : 0;
3210
+ s = Math.min(1, Math.max(0, s)), this._renderEpoch++, this._scale = r, this._recomputeHeights();
3211
+ let c = re(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad());
3212
+ this._spacer.style.height = `${c.totalHeight}px`, this._syncSpacerWidth();
3213
+ let l = Math.max(0, c.totalHeight - this._scrollHost.clientHeight), u = (c.offsets[a] ?? 0) + s * (this._heights[a] || 0);
3214
+ this._scrollHost.scrollTop = Math.min(l, Math.max(0, u)), this._previewVisible(), this._scheduleSettle();
3215
+ }
3216
+ _previewVisible() {
3217
+ if (!this._pres || this._pres.slideCount === 0) return;
3218
+ let e = this._range();
3219
+ this._lastRange = e;
3220
+ for (let [t, n] of [...this._slots]) (t < e.start || t > e.end) && this._recycleSlot(t, n);
3221
+ for (let t = e.start; t <= e.end; t++) {
3222
+ let n = this._slots.get(t);
3223
+ if (n) this._previewSlot(n, t, e);
3224
+ else {
3225
+ let n = this._acquireSlot();
3226
+ this._positionSlot(n, t, e), this._slots.set(t, n), this._renderSlot(t, n);
3227
+ }
3228
+ }
3229
+ e.topIndex !== this._lastTopIndex && (this._lastTopIndex = e.topIndex, this._opts.onVisibleSlideChange?.(e.topIndex, this._pres.slideCount));
3230
+ }
3231
+ _previewSlot(e, t, n) {
3232
+ if (this._positionSlot(e, t, n), e.canvas.style.width = `${this._slideWidthPx()}px`, e.canvas.style.height = `${this._slideHeightPx()}px`, e.textLayer && e.renderedScale > 0) {
3233
+ let t = this._scale / e.renderedScale;
3234
+ e.textLayer.style.transformOrigin = "0 0", e.textLayer.style.transform = `scale(${t})`;
3235
+ }
3236
+ }
3237
+ _scheduleSettle() {
3238
+ this._settleTimer !== null && clearTimeout(this._settleTimer), this._settleTimer = setTimeout(() => {
3239
+ this._settleTimer = null, this._settleRender();
3240
+ }, fr);
3241
+ }
3242
+ _settleRender() {
3243
+ if (!(this._destroyed || !this._pres || this._pres.slideCount === 0)) for (let [e, t] of [...this._slots]) t.renderedScale !== this._scale && this._settleSlot(e, t);
3244
+ }
3245
+ _settleSlot(e, t) {
3246
+ if (!this._pres) return;
3247
+ let n = this._dpr(), r = this._slideWidthPx(), i = this._scale, a = this._renderEpoch;
3248
+ if (this._mode === "worker") {
3249
+ this._renderSlotBitmap(e, t, r, n, i);
3250
+ return;
3251
+ }
3252
+ let o = document.createElement("canvas");
3253
+ o.style.cssText = "display:block;background:#fff;", this._applyPageShadow(o);
3254
+ let s = [], c = !!this._opts.enableTextSelection && !!t.textLayer, l = c ? (e) => s.push(e) : void 0;
3255
+ this._pres.renderSlide(o, e, {
3256
+ width: r,
3257
+ dpr: n,
3258
+ onTextRun: l
3259
+ }).then(() => {
3260
+ if (a !== this._renderEpoch || this._slots.get(e) !== t || t.renderedSlide !== e) return;
3261
+ let n = t.canvas;
3262
+ t.wrapper.insertBefore(o, n), n.remove(), t.canvas = o, t.bitmapCtx = null, t.renderedScale = i, t.textLayer && (t.textLayer.style.transform = "", t.textLayer.style.transformOrigin = "", c && ue(t.textLayer, s, Math.round(r), Math.round(this._slideHeightPx())));
3263
+ }).catch((e) => {
3264
+ this._reportRenderError(e);
3265
+ });
3266
+ }
3267
+ scrollToSlide(e, t) {
3268
+ if (!this._pres || this._pres.slideCount === 0 || !this._scaleEstablished) return;
3269
+ let n = Math.max(0, Math.min(e, this._pres.slideCount - 1)), r = re(this._heights, this._gap(), 0, this._scrollHost.clientHeight, this._overscan(), this._pad()), i = r.offsets[n] ?? 0, a = Math.max(0, r.totalHeight - this._scrollHost.clientHeight), o = Math.min(a, Math.max(0, i)), s = this._scrollHost;
3270
+ typeof s.scrollTo == "function" ? s.scrollTo({
3271
+ top: o,
3272
+ behavior: t?.behavior ?? "auto"
3273
+ }) : this._scrollHost.scrollTop = o, this._mountVisible();
3274
+ }
3275
+ _onResize() {
3276
+ if (!this._pres || this._pres.slideCount === 0) return;
3277
+ if (!this._scaleEstablished) {
3278
+ this.relayout();
3279
+ return;
3280
+ }
3281
+ let e = this._baseScale();
3282
+ if (e <= 0) return;
3283
+ let t = this._fitWidthPx();
3284
+ if (t === this._lastFitWidth) {
3285
+ this._mountVisible();
3286
+ return;
3287
+ }
3288
+ this._lastFitWidth = t;
3289
+ let n = this._prevBase > 0 ? this._scale / this._prevBase : 1;
3290
+ this._prevBase = e, this.setScale(e * n), this._mountVisible();
3291
+ }
3292
+ get topVisibleSlide() {
3293
+ return this._lastRange?.topIndex ?? 0;
3294
+ }
3295
+ mountedSlideIndicesForTest() {
3296
+ return [...this._slots.keys()];
3297
+ }
3298
+ scaleForTest() {
3299
+ return this._scale;
3300
+ }
3301
+ baseScaleForTest() {
3302
+ return this._baseScale();
3303
+ }
3304
+ renderEpochForTest() {
3305
+ return this._renderEpoch;
3306
+ }
3307
+ resizeForTest() {
3308
+ this._onResize();
3309
+ }
3310
+ destroy() {
3311
+ this._destroyed = !0, this._scrollListener &&= (this._scrollHost.removeEventListener("scroll", this._scrollListener), null), this._wheelListener &&= (this._scrollHost.removeEventListener("wheel", this._wheelListener), null), this._resizeObserver?.disconnect(), this._resizeObserver = null, this._settleTimer !== null && (clearTimeout(this._settleTimer), this._settleTimer = null);
3312
+ for (let [e, t] of [...this._slots]) this._recycleSlot(e, t);
3313
+ this._free.length = 0, this._injected || this._pres?.destroy(), this._pres = null, this._wrapper.remove();
3314
+ }
3315
+ }, hr = /* @__PURE__ */ b({
3316
+ PptxPresentation: () => lr,
3317
+ PptxScrollViewer: () => mr,
3318
+ PptxViewer: () => dr,
3319
+ autoResize: () => O,
3320
+ buildPptxTextLayer: () => ue,
3321
+ renderSlide: () => jn
3322
+ });
3323
+ //#endregion
3324
+ export { jn as a, lr as i, mr as n, ue as o, dr as r, hr as t };