@silurus/ooxml 0.85.1 → 0.85.3

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (42) hide show
  1. package/README.md +3 -2
  2. package/dist/assets/render-worker-D1O73gYW.js +10 -0
  3. package/dist/assets/{render-worker-BRKOyWVH.js → render-worker-DHP0rgcW.js} +16 -16
  4. package/dist/assets/render-worker-V2wWYA4O.js +11 -0
  5. package/dist/{canvas-viewer-mechanics-CfRzOhz5.js → canvas-viewer-mechanics-CDNMJ-Yz.js} +1 -1
  6. package/dist/{document-pull-client-BkHHIdR4.js → document-pull-client-F3ox_VXK.js} +3505 -3494
  7. package/dist/{docx-_uelcAui.js → docx-BYvm3TWw.js} +21 -38
  8. package/dist/docx.mjs +5 -5
  9. package/dist/docx_parser_bg.wasm +0 -0
  10. package/dist/{dom-interaction-boundary-CMDDgICk.js → dom-interaction-boundary-CDGegIB5.js} +1 -1
  11. package/dist/index.mjs +3 -3
  12. package/dist/line-distribute-BsV4MVZ2.js +1023 -0
  13. package/dist/{line-metrics-u87yCAfV.js → line-metrics-BGtFM-ec.js} +650 -607
  14. package/dist/node.mjs +30 -30
  15. package/dist/{pptx-WpBbS0mq.js → pptx-BqpVTP8p.js} +27 -24
  16. package/dist/pptx.mjs +6 -6
  17. package/dist/pptx_parser_bg.wasm +0 -0
  18. package/dist/{raster-target-whZhvVMt.js → raster-target-ojDdQizC.js} +11 -7
  19. package/dist/{render-DrAAZWwH.js → render-DeZpRCfx.js} +1 -1
  20. package/dist/{render-worker-host-XDMsyVsv.js → render-worker-host-BKtXmlEF.js} +1 -1
  21. package/dist/{render-worker-host-CBVe8aeD.js → render-worker-host-CBcQXsR5.js} +1 -1
  22. package/dist/{render-worker-host-CHlwYJdK.js → render-worker-host-CNKQ76tu.js} +1 -1
  23. package/dist/{resource-measurement-6uR3Huao.js → resource-measurement-D41R-0Bl.js} +4 -4
  24. package/dist/{session-DoPwA4gv.js → session-n2p5_jxV.js} +6 -6
  25. package/dist/{slide-pull-client-8i8C4VyD.js → slide-pull-client-Dwek7xW8.js} +462 -444
  26. package/dist/tiff.mjs +1 -1
  27. package/dist/types/chart-ex.d.ts +2 -2
  28. package/dist/types/docx.d.ts +8 -10
  29. package/dist/types/index.d.ts +12 -14
  30. package/dist/types/node.d.ts +5 -5
  31. package/dist/types/pptx.d.ts +8 -7
  32. package/dist/types/region-map.d.ts +2 -2
  33. package/dist/types/three-d.d.ts +2 -2
  34. package/dist/types/xlsx.d.ts +8 -7
  35. package/dist/{worksheet-pull-client-Btydoxto.js → worksheet-pull-client-C9sC36Vu.js} +20 -20
  36. package/dist/{xlsx-Bd16V4Xx.js → xlsx-DSU6pV1O.js} +1214 -1208
  37. package/dist/xlsx.mjs +6 -6
  38. package/dist/xlsx_parser_bg.wasm +0 -0
  39. package/package.json +1 -1
  40. package/dist/assets/render-worker-CtLMFj9r.js +0 -10
  41. package/dist/assets/render-worker-NZPOUOTU.js +0 -11
  42. package/dist/line-distribute-CiKeWjBF.js +0 -1023
@@ -1,12 +1,12 @@
1
- import { $ as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Dt as s, Ft as c, It as l, J as u, Jt as d, Lt as f, M as p, Mt as m, N as h, Nt as g, O as _, Pt as v, Rt as y, S as b, St as x, Tt as S, Ut as C, Vt as w, Yt as T, _ as E, _t as D, at as O, bt as k, c as A, ct as j, d as M, dt as N, et as P, f as F, g as I, gt as L, h as R, i as z, it as B, j as V, jt as H, kt as U, lt as ee, m as W, mt as te, n as G, nt as K, p as q, r as ne, rt as re, s as ie, sn as ae, tt as oe, u as se, w as ce, wt as le, xt as ue, y as de, zt as fe } from "./line-metrics-u87yCAfV.js";
2
- import { a as pe, c as me, d as he, f as ge, i as _e, l as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./line-distribute-CiKeWjBF.js";
1
+ import { $ as e, A as t, At as n, Bt as r, C as i, Ct as a, D as o, Et as s, Ft as c, Ht as l, It as u, J as d, Lt as f, M as p, Mt as m, N as h, Nt as g, O as _, Ot as v, Pt as y, Rt as b, S as x, St as S, Tt as C, Vt as w, Wt as T, Xt as E, Yt as D, _ as O, _t as k, at as A, bt as j, c as M, cn as N, ct as P, d as F, dt as I, et as L, f as R, g as z, gt as B, h as V, i as H, it as U, j as ee, jt as W, lt as G, m as K, mt as q, n as J, nt as te, p as ne, r as re, rt as ie, s as ae, tt as oe, u as se, w as ce, wt as le, xt as ue, y as de, zt as fe } from "./line-metrics-BGtFM-ec.js";
2
+ import { a as pe, c as me, d as he, f as ge, i as _e, l as ve, o as ye, p as be, r as xe, s as Se, t as Ce, u as we } from "./line-distribute-BsV4MVZ2.js";
3
3
  import { A as Te, D as Ee, S as De, _ as Oe, h as ke, hn as Ae, in as je, j as Me, on as Ne, sn as Pe, v as Fe, w as Ie } from "./plot-area-frame-D5hEOgkJ.js";
4
4
  import { l as Le } from "./pixel-budget-Dgjw269h.js";
5
- import { r as J } from "./units-EJdC96r6.js";
5
+ import { r as Y } from "./units-EJdC96r6.js";
6
6
  import { A as Re, F as ze, I as Be, L as Ve, M as He, N as Ue, P as We, j as Ge } from "./three-d-YYghQndN.js";
7
7
  import { k as Ke } from "./renderer-XFSCOT6m.js";
8
- import { s as qe } from "./raster-target-whZhvVMt.js";
9
- import { a as Je, i as Ye, n as Xe, t as Ze } from "./resource-measurement-6uR3Huao.js";
8
+ import { s as qe } from "./raster-target-ojDdQizC.js";
9
+ import { a as Je, i as Ye, n as Xe, t as Ze } from "./resource-measurement-D41R-0Bl.js";
10
10
  //#region packages/pptx/src/types.ts
11
11
  function Qe(e) {
12
12
  return e;
@@ -2402,8 +2402,8 @@ function it(e) {
2402
2402
  if (t) return t;
2403
2403
  let n = tt[e];
2404
2404
  return n ? (t = {
2405
- adj: n.adj.map(([e, t]) => [e, g(t)]),
2406
- gd: n.gd.map(([e, t]) => [e, g(t)]),
2405
+ adj: n.adj.map(([e, t]) => [e, y(t)]),
2406
+ gd: n.gd.map(([e, t]) => [e, y(t)]),
2407
2407
  paths: n.paths
2408
2408
  }, nt.set(e, t), t) : null;
2409
2409
  }
@@ -2476,16 +2476,16 @@ function st(e) {
2476
2476
  function ct(e, t, n, r) {
2477
2477
  let i = it(e.toLowerCase());
2478
2478
  if (!i || i.paths.length === 0) return null;
2479
- let a = v({
2479
+ let a = c({
2480
2480
  w: n,
2481
2481
  h: r,
2482
2482
  adj: t
2483
- }, i.adj, i.gd), o = i.paths.length === 1, s = ot(i.paths[0], a, n, r), c = o ? s : ot(i.paths[i.paths.length - 1], a, n, r);
2483
+ }, i.adj, i.gd), o = i.paths.length === 1, s = ot(i.paths[0], a, n, r), l = o ? s : ot(i.paths[i.paths.length - 1], a, n, r);
2484
2484
  return {
2485
2485
  top: s,
2486
- bottom: c,
2486
+ bottom: l,
2487
2487
  topLen: st(s),
2488
- bottomLen: st(c),
2488
+ bottomLen: st(l),
2489
2489
  singleEdge: o
2490
2490
  };
2491
2491
  }
@@ -3159,8 +3159,8 @@ function rn(e, t) {
3159
3159
  kind: "internal",
3160
3160
  ref: n ?? r
3161
3161
  };
3162
- let i = n, a = z(i);
3163
- return a !== null && ne.includes(a) ? {
3162
+ let i = n, a = H(i);
3163
+ return a !== null && re.includes(a) ? {
3164
3164
  kind: "external",
3165
3165
  url: i
3166
3166
  } : {
@@ -3191,7 +3191,7 @@ var on = (e) => {
3191
3191
  function cn(e) {
3192
3192
  for (let t of e) {
3193
3193
  let e = on(t);
3194
- if (e !== void 0 && V(e)) return !0;
3194
+ if (e !== void 0 && ee(e)) return !0;
3195
3195
  }
3196
3196
  return !1;
3197
3197
  }
@@ -3298,9 +3298,9 @@ function hn(e, t) {
3298
3298
  //#endregion
3299
3299
  //#region packages/pptx/src/smartart-fallback-contrast.ts
3300
3300
  function gn(e) {
3301
- let t = j(e.length === 8 ? e.slice(0, 6) : e);
3301
+ let t = P(e.length === 8 ? e.slice(0, 6) : e);
3302
3302
  if (!t) return null;
3303
- let n = ee(t[0], t[1], t[2]);
3303
+ let n = G(t[0], t[1], t[2]);
3304
3304
  if (e.length !== 8) return n;
3305
3305
  let r = Number.parseInt(e.slice(6, 8), 16);
3306
3306
  if (Number.isNaN(r)) return null;
@@ -3381,12 +3381,12 @@ function Cn(e, t) {
3381
3381
  function wn(e, t, n, r, i, a, o = "fill", s = xn) {
3382
3382
  let c = e.textAlign, l = e.textBaseline, u = o === "stroke" ? e.strokeText.bind(e) : e.fillText.bind(e), d = r - Sn(e, t, i), f = 0;
3383
3383
  for (let o of t) {
3384
- let t = o.codePointAt(0) ?? 0, l = F(t), p = e.measureText(o).width + a, m = l === "Tr" ? se(t) : null, h = l === "Tr" && m === null && W(t), g = l === "U" || l === "Tu" || m !== null || h;
3385
- if (q(t) && s(t)) {
3384
+ let t = o.codePointAt(0) ?? 0, l = R(t), p = e.measureText(o).width + a, m = l === "Tr" ? se(t) : null, h = l === "Tr" && m === null && K(t), g = l === "U" || l === "Tu" || m !== null || h;
3385
+ if (ne(t) && s(t)) {
3386
3386
  let t = n + f + p / 2;
3387
- e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", A(e, () => u(o, 0, 0)), e.restore();
3387
+ e.save(), e.translate(t, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", M(e, () => u(o, 0, 0)), e.restore();
3388
3388
  } else if (g) {
3389
- let r = m === null && l === "Tu" ? M(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? Cn(e, s) / i : 0;
3389
+ let r = m === null && l === "Tu" ? F(t) : null, a = m === null ? r : m, s = a === null ? o : String.fromCodePoint(a), c = n + f + p / 2, h = r === null ? Cn(e, s) / i : 0;
3390
3390
  e.save(), e.translate(c, d), e.rotate(-Math.PI / 2), e.textAlign = "center", e.textBaseline = "middle", u(s, 0, h * i), e.restore();
3391
3391
  } else if (l === "Tr") {
3392
3392
  let t = n + f + p / 2;
@@ -3397,11 +3397,11 @@ function wn(e, t, n, r, i, a, o = "fill", s = xn) {
3397
3397
  e.textAlign = c, e.textBaseline = l;
3398
3398
  }
3399
3399
  function Tn(e, t, n, r, i, a, o = "fill") {
3400
- wn(e, t, n, r, i, a, o, (t) => ie(e, t));
3400
+ wn(e, t, n, r, i, a, o, (t) => ae(e, t));
3401
3401
  }
3402
3402
  //#endregion
3403
3403
  //#region packages/pptx/src/renderer.ts
3404
- function Y(e, t) {
3404
+ function X(e, t) {
3405
3405
  return e * t;
3406
3406
  }
3407
3407
  function En(e, t, n, r) {
@@ -3411,7 +3411,7 @@ function En(e, t, n, r) {
3411
3411
  targetHeightPx: i.height
3412
3412
  } : void 0;
3413
3413
  }
3414
- function X(e, t) {
3414
+ function Z(e, t) {
3415
3415
  return Ye(e, t);
3416
3416
  }
3417
3417
  function Dn(e, t) {
@@ -3419,11 +3419,11 @@ function Dn(e, t) {
3419
3419
  return n ? {
3420
3420
  targetWidthPx: n.width,
3421
3421
  targetHeightPx: n.height,
3422
- maxRetainedPixels: n.retainedPixels
3422
+ maxRetainedPixels: n.maxRetainedPixels
3423
3423
  } : void 0;
3424
3424
  }
3425
3425
  function On(e) {
3426
- return O(e) ? e.svgImagePath : e.imagePath;
3426
+ return A(e) ? e.svgImagePath : e.imagePath;
3427
3427
  }
3428
3428
  function kn(e, t, n, r) {
3429
3429
  let i = Qe(t.bullet);
@@ -3434,39 +3434,49 @@ function kn(e, t, n, r) {
3434
3434
  break;
3435
3435
  }
3436
3436
  let o = a ?? t.defFontSize ?? e.defaultFontSize ?? 18, s = i.sizePts == null ? o * ((i.sizePct ?? 100) / 100) : i.sizePts;
3437
- return Math.max(1, s * J * n * r);
3438
- }
3439
- async function An(e, t, n, r, i, a, o, s, c, l) {
3440
- let u = [], d = (e, t, n, r, i, a = 1, o = i) => {
3441
- !t || !i || u.push(L(n, r, i, o).then((n) => n.dimensions && S(n.format, l !== void 0) ? {
3442
- key: e,
3443
- ...t,
3444
- sourceWidthPx: n.dimensions.width,
3445
- sourceHeightPx: n.dimensions.height,
3446
- retainedSurfaceCount: a
3447
- } : null).catch(() => null));
3448
- }, f = e.background;
3449
- if (f?.fillType === "image" && f.imagePath && !f.tile && !f.duotone) {
3450
- let e = f.fillRect ?? {}, r = t * (1 - (e.l ?? 0) - (e.r ?? 0)), a = n * (1 - (e.t ?? 0) - (e.b ?? 0));
3451
- d(X(f.imagePath, f.duotone), En(r, a, i, f.srcRect), f.imagePath, f.mimeType, o, 1);
3437
+ return Math.max(1, s * Y * n * r);
3438
+ }
3439
+ async function An(e, t, n, r, i, a, o, c, l, u) {
3440
+ let d = ue(a), f = [], p = [], m = (e, t, n, r, i, a = 1, o = i) => {
3441
+ if (!(!t || !i)) {
3442
+ if (C(r) && (d.resolution === "display" || d.strategy === "adaptive")) {
3443
+ f.push({
3444
+ key: e,
3445
+ ...t,
3446
+ retainedSurfaceCount: a
3447
+ });
3448
+ return;
3449
+ }
3450
+ p.push(B(n, r, i, o).then((n) => n.dimensions && s(n.format, u !== void 0) ? {
3451
+ key: e,
3452
+ ...t,
3453
+ sourceWidthPx: n.dimensions.width,
3454
+ sourceHeightPx: n.dimensions.height,
3455
+ retainedSurfaceCount: a
3456
+ } : null).catch(() => null));
3457
+ }
3458
+ }, h = e.background;
3459
+ if (h?.fillType === "image" && h.imagePath && !h.tile && !h.duotone) {
3460
+ let e = h.fillRect ?? {}, r = t * (1 - (e.l ?? 0) - (e.r ?? 0)), a = n * (1 - (e.t ?? 0) - (e.b ?? 0));
3461
+ m(Z(h.imagePath, h.duotone), En(r, a, i, h.srcRect), h.imagePath, h.mimeType, o, 1);
3452
3462
  }
3453
- for (let t of e.elements) if (t.type === "picture") !(O(t) || t.mimeType === "image/svg+xml") && !t.duotone && d(X(t.imagePath, t.duotone), En(Y(t.width, r), Y(t.height, r), i, t.srcRect), t.imagePath, t.mimeType, o, 1);
3463
+ for (let t of e.elements) if (t.type === "picture") !(A(t) || t.mimeType === "image/svg+xml") && !t.duotone && m(Z(t.imagePath, t.duotone), En(X(t.width, r), X(t.height, r), i, t.srcRect), t.imagePath, t.mimeType, o, 1);
3454
3464
  else if (t.type === "media" && t.posterPath) {
3455
- let e = s ? qr(s) : void 0;
3456
- d(X(t.posterPath), En(Y(t.width, r), Y(t.height, r), i), t.posterPath, t.posterMimeType || "application/octet-stream", e, 1, c ?? e);
3465
+ let e = c ? qr(c) : void 0;
3466
+ m(Z(t.posterPath), En(X(t.width, r), X(t.height, r), i), t.posterPath, t.posterMimeType || "application/octet-stream", e, 1, l ?? e);
3457
3467
  } else if (t.type === "chart") {
3458
3468
  let e = {
3459
- widthPt: t.width / J,
3460
- heightPt: t.height / J,
3461
- targetWidthPx: Y(t.width, r) * i,
3462
- targetHeightPx: Y(t.height, r) * i
3469
+ widthPt: t.width / Y,
3470
+ heightPt: t.height / Y,
3471
+ targetWidthPx: X(t.width, r) * i,
3472
+ targetHeightPx: X(t.height, r) * i
3463
3473
  };
3464
3474
  for (let n of Te(t.chart)) {
3465
3475
  let t = n.fill, r = Ee(n, e);
3466
- !(t.mimeType === "image/svg+xml" || O({
3476
+ !(t.mimeType === "image/svg+xml" || A({
3467
3477
  svgImagePath: t.svgImagePath,
3468
3478
  srcRect: n.hasSourceCrop ? !0 : null
3469
- })) && !t.duotone && !n.preserveNaturalSize && r?.targetWidthPx && r.targetHeightPx && d(X(t.imagePath, t.duotone), {
3479
+ })) && !t.duotone && !n.preserveNaturalSize && r?.targetWidthPx && r.targetHeightPx && m(Z(t.imagePath, t.duotone), {
3470
3480
  targetWidthPx: r.targetWidthPx,
3471
3481
  targetHeightPx: r.targetHeightPx
3472
3482
  }, t.imagePath, t.mimeType, o, 1);
@@ -3475,20 +3485,20 @@ async function An(e, t, n, r, i, a, o, s, c, l) {
3475
3485
  let n = Qe(e.bullet);
3476
3486
  if (n.type !== "blip") continue;
3477
3487
  let a = kn(t.textBody, e, r, i);
3478
- !a || !o || u.push(L(n.imagePath, n.mimeType, o).then((e) => e.dimensions && e.dimensions.width > 0 && e.dimensions.height > 0 && S(e.format, l !== void 0) ? {
3479
- key: X(n.imagePath),
3488
+ !a || !o || p.push(B(n.imagePath, n.mimeType, o).then((e) => e.dimensions && e.dimensions.width > 0 && e.dimensions.height > 0 && s(e.format, u !== void 0) ? {
3489
+ key: Z(n.imagePath),
3480
3490
  targetWidthPx: a * e.dimensions.width / e.dimensions.height,
3481
3491
  targetHeightPx: a,
3482
3492
  sourceWidthPx: e.dimensions.width,
3483
3493
  sourceHeightPx: e.dimensions.height
3484
3494
  } : null).catch(() => null));
3485
3495
  }
3486
- return x((await Promise.all(u)).filter((e) => e !== null), ue(a));
3496
+ return f.push(...(await Promise.all(p)).filter((e) => e !== null)), S(f, d);
3487
3497
  }
3488
3498
  function jn(e) {
3489
3499
  return e.background?.fillType === "image" ? !0 : e.elements.some((e) => e.type === "picture" ? !0 : e.type === "media" ? !!e.posterPath : e.type === "chart" ? Te(e.chart).length > 0 : e.type === "shape" && !!e.textBody?.paragraphs.some((e) => Qe(e.bullet).type === "blip"));
3490
3500
  }
3491
- var Z = Oe;
3501
+ var Q = Oe;
3492
3502
  function Mn(e, t, n, r, i, a, o) {
3493
3503
  let { top: s, height: c } = Qt(n, i);
3494
3504
  e.fillStyle = a, e.fillRect(t, s, r, c), e.fillStyle = o;
@@ -3500,7 +3510,7 @@ var Pn = /* @__PURE__ */ new WeakMap();
3500
3510
  function Fn(e, t) {
3501
3511
  let n = e.tinted.get(t);
3502
3512
  if (n) return n;
3503
- let r = re(e.raster, t);
3513
+ let r = ie(e.raster, t);
3504
3514
  return e.tinted.set(t, r), r;
3505
3515
  }
3506
3516
  function In(e) {
@@ -3519,7 +3529,7 @@ async function Ln(e, t) {
3519
3529
  if (n.length !== 0) {
3520
3530
  await t.loadMathJax();
3521
3531
  for (let e of n) if (!Pn.has(e.nodes)) try {
3522
- let n = await t.mathMLToSvg(B(e.nodes, e.display)), r = await K(n, "#000000");
3532
+ let n = await t.mathMLToSvg(U(e.nodes, e.display)), r = await te(n, "#000000");
3523
3533
  Pn.set(e.nodes, {
3524
3534
  raster: r,
3525
3535
  widthEm: n.widthEm,
@@ -3546,7 +3556,7 @@ var zn = new Set([
3546
3556
  "system-ui"
3547
3557
  ]);
3548
3558
  function Bn(e) {
3549
- let t = w(e);
3559
+ let t = l(e);
3550
3560
  return t === "mono" ? "monospace" : t === "serif" ? "serif" : "sans-serif";
3551
3561
  }
3552
3562
  var Vn = {
@@ -3573,8 +3583,8 @@ function Wn(e) {
3573
3583
  function Gn(e, t = e) {
3574
3584
  let n = Bn(t), i = Vn[t.toLowerCase()], a = i ? `"${i}", ` : "";
3575
3585
  if (Un(t)) return `"${e}", ${a}${Hn}, ${n}`;
3576
- let o = n === "serif" ? "serif" : "sans", s = r(t);
3577
- return `"${e}", ${a}${s ? `${Wn(fe(s, o))}, ` : ""}${`${Wn(o === "serif" ? l : c)}, `}${n}`;
3586
+ let o = n === "serif" ? "serif" : "sans", s = w(t);
3587
+ return `"${e}", ${a}${s ? `${Wn(r(s, o))}, ` : ""}${`${Wn(o === "serif" ? f : u)}, `}${n}`;
3578
3588
  }
3579
3589
  function Kn(e) {
3580
3590
  return e ? e.kind === "external" ? `e:${e.url}` : `i:${e.ref}` : "";
@@ -3642,15 +3652,15 @@ function $n(e, t) {
3642
3652
  return t != null && t !== 0 ? e * .65 : e;
3643
3653
  }
3644
3654
  function er(e, t, n, r, i, a, o) {
3645
- let s = (t.defaultFontSize ?? 18) * J * a;
3655
+ let s = (t.defaultFontSize ?? 18) * Y * a;
3646
3656
  for (let c of t.paragraphs) {
3647
- let l = Y(c.marL, a), u = Y(c.marR, a), d = Y(c.indent, a), f = Qn(Xn(c), d), p = n - r - i - l - u - f, m = 0;
3657
+ let l = X(c.marL, a), u = X(c.marR, a), d = X(c.indent, a), f = Qn(Xn(c), d), p = n - r - i - l - u - f, m = 0;
3648
3658
  for (let n of c.runs) {
3649
3659
  if (n.type !== "text") continue;
3650
- let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * J * a : n.fontSize * J * a, i = Rn(n.fontFamily ?? c.defFontFamily ?? null, o);
3660
+ let r = n.fontSize == null ? c.defFontSize == null ? s : c.defFontSize * Y * a : n.fontSize * Y * a, i = Rn(n.fontFamily ?? c.defFontFamily ?? null, o);
3651
3661
  e.font = Yn(n.bold ?? c.defBold ?? t.defaultBold ?? !1, n.italic ?? c.defItalic ?? t.defaultItalic ?? !1, $n(r, n.baseline ?? void 0), i, o);
3652
- let l = (n.letterSpacing ?? 0) * J * a;
3653
- if (m += Q(e, n.text, l), m > p) return !0;
3662
+ let l = (n.letterSpacing ?? 0) * Y * a;
3663
+ if (m += $(e, n.text, l), m > p) return !0;
3654
3664
  }
3655
3665
  }
3656
3666
  return !1;
@@ -3686,7 +3696,7 @@ function ir(e) {
3686
3696
  }
3687
3697
  return rr.set(e, i), i;
3688
3698
  }
3689
- function Q(e, t, n) {
3699
+ function $(e, t, n) {
3690
3700
  let r = e, i = r.letterSpacing;
3691
3701
  if (n !== 0 && ir(e)) try {
3692
3702
  r.letterSpacing = `${n}px`;
@@ -3713,22 +3723,22 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3713
3723
  let r = n.text.replace(/ +$/u, "");
3714
3724
  r !== n.text && h.set(n, r), (r.length > 0 || n.fieldType != null) && (g = !1);
3715
3725
  }
3716
- let v = () => n - (m.length === 0 ? p : 0), y = { segments: [] }, x = 0, S = !1, C = t.rtl === !0, w = Y(t.marR, o), T = (t.tabStops ?? []).map((e) => ({
3717
- pos: Y(e.pos, o),
3726
+ let v = () => n - (m.length === 0 ? p : 0), y = { segments: [] }, b = 0, S = !1, C = t.rtl === !0, w = X(t.marR, o), T = (t.tabStops ?? []).map((e) => ({
3727
+ pos: X(e.pos, o),
3718
3728
  algn: e.algn
3719
- })), D = Y(t.defTabSz ?? 914400, o), O = !1, k = [], A = 0, j = () => C ? w : s + (m.length === 0 ? p : 0), M = (e = 0) => {
3729
+ })), E = X(t.defTabSz ?? 914400, o), D = !1, k = [], A = 0, j = () => C ? w : s + (m.length === 0 ? p : 0), M = (e = 0) => {
3720
3730
  let t = bn(e > 0 ? [...k, {
3721
3731
  isTab: !1,
3722
3732
  width: e
3723
- }] : k, T, j(), Infinity, A, D), n = 0;
3733
+ }] : k, T, j(), Infinity, A, E), n = 0;
3724
3734
  for (let e of t) n += e;
3725
3735
  return n;
3726
3736
  }, N = (e) => {
3727
3737
  let t = v();
3728
- return Number.isFinite(t) ? O ? M(e) <= t : x + e <= t : !0;
3738
+ return Number.isFinite(t) ? D ? M(e) <= t : b + e <= t : !0;
3729
3739
  }, P = () => {
3730
3740
  let e = v();
3731
- if (!O) return e - x;
3741
+ if (!D) return e - b;
3732
3742
  if (!Number.isFinite(e)) return Infinity;
3733
3743
  if (M(0) >= e) return 0;
3734
3744
  let t = 0, n = e;
@@ -3738,16 +3748,16 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3738
3748
  }
3739
3749
  return t;
3740
3750
  }, F = (e = !1) => {
3741
- e && (y.endsWithBreak = !0), m.push(y), y = { segments: [] }, x = 0, O = !1, k = [], S = !1;
3742
- }, L = (t, n, r, i) => {
3751
+ e && (y.endsWithBreak = !0), m.push(y), y = { segments: [] }, b = 0, D = !1, k = [], S = !1;
3752
+ }, I = (t, n, r, i) => {
3743
3753
  e.font = n;
3744
- let a = Q(e, t, r), o = y.segments.at(-1);
3745
- return !o || o.isTab || o.math || o.sourceRunId !== i ? a : o.font === n && (o.letterSpacingPx ?? 0) === r ? Q(e, o.text + t, r) - Q(e, o.text, r) : a + r;
3746
- }, z = (t, n, r, i, a, o, s, c) => {
3754
+ let a = $(e, t, r), o = y.segments.at(-1);
3755
+ return !o || o.isTab || o.math || o.sourceRunId !== i ? a : o.font === n && (o.letterSpacingPx ?? 0) === r ? $(e, o.text + t, r) - $(e, o.text, r) : a + r;
3756
+ }, L = (t, n, r, i, a, o, s, c) => {
3747
3757
  if (!t) return;
3748
3758
  e.font = n;
3749
- let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, b = c?.hyperlink, S = c?.drawSizePx ?? r, C = (e) => !e.math && !e.isTab && 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.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (v ?? "") && (e.drawSizePx ?? e.sizePx) === S && Kn(e.hyperlink) === Kn(b) && (l === 0 || e.sourceRunId === u), w = y.segments.at(-1), T = Q(e, t, l);
3750
- if (w && C(w) ? T = Q(e, w.text + t, l) - Q(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l), x += T, k.push({
3759
+ let l = c?.letterSpacingPx ?? 0, u = c?.sourceRunId, d = c?.strikeDouble, f = c?.underlineStyle, p = c?.underlineColor, m = c?.shadow, h = c?.reflection, g = c?.outline, _ = c?.highlight, v = c?.fontFamily, x = c?.hyperlink, S = c?.drawSizePx ?? r, C = (e) => !e.math && !e.isTab && 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.reflection === h && e.outline === g && (e.highlight ?? "") === (_ ?? "") && (e.fontFamily ?? "") === (v ?? "") && (e.drawSizePx ?? e.sizePx) === S && Kn(e.hyperlink) === Kn(x) && (l === 0 || e.sourceRunId === u), w = y.segments.at(-1), T = $(e, t, l);
3760
+ if (w && C(w) ? T = $(e, w.text + t, l) - $(e, w.text, l) : w && !w.isTab && !w.math && u != null && w.sourceRunId === u && (T += l), b += T, k.push({
3751
3761
  isTab: !1,
3752
3762
  width: T
3753
3763
  }), w && C(w)) w.text += t;
@@ -3773,17 +3783,17 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3773
3783
  reflection: h,
3774
3784
  outline: g,
3775
3785
  highlight: _,
3776
- hyperlink: b
3786
+ hyperlink: x
3777
3787
  });
3778
3788
  }
3779
- }, B = () => {
3789
+ }, R = () => {
3780
3790
  let e = y.segments.at(-1);
3781
3791
  if (!e || e.math) return !1;
3782
3792
  let t = /^(.*\s)(\S+)$/s.exec(e.text), n;
3783
3793
  if (t) e.text = t[1], n = t[2];
3784
3794
  else if (y.segments.length > 1) y.segments.pop(), n = e.text;
3785
3795
  else return !1;
3786
- return F(), z(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
3796
+ return F(), L(n, e.font, e.sizePx, e.color, e.underline, e.strikethrough, e.baseline, {
3787
3797
  strikeDouble: e.strikeDouble,
3788
3798
  letterSpacingPx: e.letterSpacingPx,
3789
3799
  underlineStyle: e.underlineStyle,
@@ -3803,15 +3813,15 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3803
3813
  continue;
3804
3814
  }
3805
3815
  if (s.type === "math") {
3806
- let e = Pn.get(s.nodes), t = s.fontSize == null ? r : s.fontSize * J * o * u, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
3807
- (s.display && x > 0 || !N(n) && x > 0) && F(), k.push({
3816
+ let e = Pn.get(s.nodes), t = s.fontSize == null ? r : s.fontSize * Y * o * u, n = e ? e.widthEm * t : 0, i = e ? e.ascentEm * t : 0, c = e ? e.descentEm * t : 0;
3817
+ (s.display && b > 0 || !N(n) && b > 0) && F(), k.push({
3808
3818
  isTab: !1,
3809
3819
  width: n
3810
3820
  }), y.segments.push({
3811
3821
  text: "",
3812
3822
  font: `${t}px sans-serif`,
3813
3823
  sizePx: t,
3814
- color: s.color ? Z(s.color) : a,
3824
+ color: s.color ? Q(s.color) : a,
3815
3825
  underline: !1,
3816
3826
  strikethrough: !1,
3817
3827
  math: {
@@ -3821,33 +3831,33 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3821
3831
  ascent: i,
3822
3832
  descent: c
3823
3833
  }
3824
- }), x += n, s.display && F();
3834
+ }), b += n, s.display && F();
3825
3835
  continue;
3826
3836
  }
3827
- let p = s.fontSize == null ? r : s.fontSize * J * o * u, m = $n(p, s.baseline ?? void 0), g = Rn(s.fontFamily ?? t.defFontFamily ?? null, f), C = s.fontFamilyEa ? Rn(s.fontFamilyEa, f) : null, w = s.fontFamilySym ? Rn(s.fontFamilySym, f) : null, T;
3828
- T = s.color ? Z(s.color) : s.hyperlink && f.themeHlinkColor ? Z(f.themeHlinkColor) : a;
3829
- let D = s.bold ?? t.defBold ?? c, j = s.italic ?? t.defItalic ?? l, M = Yn(D, j, m, g, f), V = C ? Yn(D, j, m, C, f) : M;
3837
+ let p = s.fontSize == null ? r : s.fontSize * Y * o * u, m = $n(p, s.baseline ?? void 0), g = Rn(s.fontFamily ?? t.defFontFamily ?? null, f), C = s.fontFamilyEa ? Rn(s.fontFamilyEa, f) : null, w = s.fontFamilySym ? Rn(s.fontFamilySym, f) : null, T;
3838
+ T = s.color ? Q(s.color) : s.hyperlink && f.themeHlinkColor ? Q(f.themeHlinkColor) : a;
3839
+ let E = s.bold ?? t.defBold ?? c, j = s.italic ?? t.defItalic ?? l, M = Yn(E, j, m, g, f), B = C ? Yn(E, j, m, C, f) : M;
3830
3840
  e.font = M;
3831
3841
  let H = s.caps, U = h.get(s) ?? s.text;
3832
3842
  (H === "all" || H === "small") && (U = U.toUpperCase());
3833
- let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, te = s.strikeDouble === !0, G = s.letterSpacing == null ? 0 : s.letterSpacing * J * o, K = {
3834
- strikeDouble: te,
3835
- letterSpacingPx: G,
3843
+ let ee = s.fieldType === "slidenum" && d !== void 0 ? String(d) : U, W = s.underline || s.hyperlink !== void 0, G = s.strikeDouble === !0, K = s.letterSpacing == null ? 0 : s.letterSpacing * Y * o, q = {
3844
+ strikeDouble: G,
3845
+ letterSpacingPx: K,
3836
3846
  underlineStyle: s.underlineStyle,
3837
- underlineColor: s.underlineColor ? Z(s.underlineColor) : void 0,
3847
+ underlineColor: s.underlineColor ? Q(s.underlineColor) : void 0,
3838
3848
  shadow: s.shadow,
3839
3849
  reflection: s.reflection,
3840
3850
  outline: s.outline,
3841
3851
  fontFamily: g,
3842
- highlight: s.highlight ? Z(s.highlight) : void 0,
3852
+ highlight: s.highlight ? Q(s.highlight) : void 0,
3843
3853
  hyperlink: rn(s.hyperlink),
3844
3854
  sourceRunId: n,
3845
3855
  drawSizePx: m
3846
- }, q = ee.split(/(\s+)/);
3847
- for (let r of q) {
3856
+ }, J = ee.split(/(\s+)/);
3857
+ for (let r of J) {
3848
3858
  if (!r) continue;
3849
3859
  if (/^\t+$/.test(r)) {
3850
- O || (e.font = M, A = e.measureText(" ").width);
3860
+ D || (e.font = M, A = e.measureText(" ").width);
3851
3861
  for (let e of r) y.segments.push({
3852
3862
  text: "",
3853
3863
  isTab: !0,
@@ -3861,48 +3871,48 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3861
3871
  isTab: !0,
3862
3872
  width: 0
3863
3873
  });
3864
- O = !0;
3874
+ D = !0;
3865
3875
  continue;
3866
3876
  }
3867
3877
  e.font = M;
3868
- let a = L(r, M, G, n), o = /^\s+$/.test(r), c = /[-]/;
3878
+ let a = I(r, M, K, n), o = /^\s+$/.test(r), c = /[-]/;
3869
3879
  if (c.test(r) && (w != null || ge(g))) {
3870
3880
  let t = w ?? g;
3871
3881
  for (let i of r) {
3872
3882
  let r = i, a = M;
3873
3883
  if (c.test(i)) {
3874
3884
  let e = be(i, t);
3875
- e === i ? a = Yn(D, j, m, t, f) : (r = e, a = Yn(D, j, m, "sans-serif", f));
3885
+ e === i ? a = Yn(E, j, m, t, f) : (r = e, a = Yn(E, j, m, "sans-serif", f));
3876
3886
  }
3877
- e.font = a, !N(L(r, a, G, n)) && x > 0 && F(), z(r, a, p, T, W, s.strikethrough, s.baseline ?? void 0, K);
3887
+ e.font = a, !N(I(r, a, K, n)) && b > 0 && F(), L(r, a, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3878
3888
  }
3879
3889
  continue;
3880
3890
  }
3881
- if (tr(r) && (!R(r) || t.eaLnBrk === !1)) {
3891
+ if (tr(r) && (!V(r) || t.eaLnBrk === !1)) {
3882
3892
  let i = [];
3883
3893
  for (let t of r) {
3884
- let n = ce(t.codePointAt(0) ?? 0) && C != null, r = n ? V : M, a = n ? C : g;
3894
+ let n = ce(t.codePointAt(0) ?? 0) && C != null, r = n ? B : M, a = n ? C : g;
3885
3895
  e.font = r, i.push({
3886
3896
  ch: t,
3887
- w: Q(e, t, 0),
3897
+ w: $(e, t, 0),
3888
3898
  font: r,
3889
3899
  family: a
3890
3900
  });
3891
3901
  }
3892
3902
  if (t.eaLnBrk === !1) {
3893
- let e = y.segments.at(-1), t = !!e && !e.isTab && !e.math && e.sourceRunId === n, r = i.reduce((e, t) => e + t.w, 0) + Math.max(0, i.length - 1) * G + (t && i.length > 0 ? G : 0);
3894
- x > 0 && !N(r) && F();
3895
- for (let e of i) z(e.ch, e.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3896
- ...K,
3903
+ let e = y.segments.at(-1), t = !!e && !e.isTab && !e.math && e.sourceRunId === n, r = i.reduce((e, t) => e + t.w, 0) + Math.max(0, i.length - 1) * K + (t && i.length > 0 ? K : 0);
3904
+ b > 0 && !N(r) && F();
3905
+ for (let e of i) L(e.ch, e.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3906
+ ...q,
3897
3907
  fontFamily: e.family
3898
3908
  });
3899
3909
  continue;
3900
3910
  }
3901
3911
  let a = i;
3902
3912
  for (; a.length > 0;) {
3903
- let e = Number.isFinite(v()) ? v() - P() : x, t = y.segments.at(-1), r = !!t && !t.isTab && !t.math && t.sourceRunId === n, i = un(a, e, v(), _, G, r);
3913
+ let e = Number.isFinite(v()) ? v() - P() : b, t = y.segments.at(-1), r = !!t && !t.isTab && !t.math && t.sourceRunId === n, i = un(a, e, v(), _, K, r);
3904
3914
  if (i === 0) {
3905
- if (x > 0) {
3915
+ if (b > 0) {
3906
3916
  F();
3907
3917
  continue;
3908
3918
  }
@@ -3910,8 +3920,8 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3910
3920
  }
3911
3921
  for (let e = 0; e < i; e++) {
3912
3922
  let t = a[e];
3913
- z(t.ch, t.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3914
- ...K,
3923
+ L(t.ch, t.font, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3924
+ ...q,
3915
3925
  fontFamily: t.family
3916
3926
  });
3917
3927
  }
@@ -3919,13 +3929,13 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3919
3929
  }
3920
3930
  continue;
3921
3931
  }
3922
- if (R(r)) {
3923
- let t = b(r, {
3932
+ if (V(r)) {
3933
+ let t = x(r, {
3924
3934
  cjk: !0,
3925
3935
  kinsoku: _
3926
- }), i = C != null && V !== M, a = (e) => i && ce(e.codePointAt(0) ?? 0), o = (t) => {
3936
+ }), i = C != null && B !== M, a = (e) => i && ce(e.codePointAt(0) ?? 0), o = (t) => {
3927
3937
  let r = 0, i = y.segments.at(-1), o = !!i && !i.isTab && !i.math && i.sourceRunId === n, s = "", c = null, l = () => {
3928
- s !== "" && (e.font = c ? V : M, r += Q(e, s, G), o && (r += G), o = !0, s = "");
3938
+ s !== "" && (e.font = c ? B : M, r += $(e, s, K), o && (r += K), o = !0, s = "");
3929
3939
  };
3930
3940
  for (let e of t) {
3931
3941
  let t = a(e);
@@ -3935,9 +3945,9 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3935
3945
  }, c = (e) => {
3936
3946
  let t = "", n = null, r = () => {
3937
3947
  if (t === "") return;
3938
- let e = n ? V : M, r = n ? C : g;
3939
- z(t, e, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3940
- ...K,
3948
+ let e = n ? B : M, r = n ? C : g;
3949
+ L(t, e, p, T, W, s.strikethrough, s.baseline ?? void 0, {
3950
+ ...q,
3941
3951
  fontFamily: r
3942
3952
  }), t = "";
3943
3953
  };
@@ -3948,28 +3958,28 @@ function ar(e, t, n, r, a, o, s, c = !1, l = !1, u = 1, d, f = {
3948
3958
  r();
3949
3959
  }, l = de(r), u = r.length, d = 0;
3950
3960
  for (; d < u;) {
3951
- let e = P(), n = I(r, t, d, e, o, l);
3961
+ let e = P(), n = z(r, t, d, e, o, l);
3952
3962
  if (n <= d) {
3953
- if (x > 0) {
3963
+ if (b > 0) {
3954
3964
  F();
3955
3965
  continue;
3956
3966
  }
3957
- let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = E(a), c = I(a, s, 0, e, o, l);
3967
+ let i = t.find((e) => e > d) ?? u, a = r.slice(d, i), s = O(a), c = z(a, s, 0, e, o, l);
3958
3968
  c <= 0 && (c = s.length > 0 ? s[0] : a.length), n = d + c;
3959
3969
  }
3960
3970
  c(r.slice(d, n)), d = n, d < u && F();
3961
3971
  }
3962
3972
  continue;
3963
3973
  }
3964
- if (N(a)) z(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, K), o && (S = !0);
3965
- else if (o) x > 0 && F();
3974
+ if (N(a)) L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q), o && (S = !0);
3975
+ else if (o) b > 0 && F();
3966
3976
  else if (a > v()) {
3967
- x > 0 && F();
3968
- for (let t of r) e.font = M, !N(L(t, M, G, n)) && x > 0 && F(), z(t, M, p, T, W, s.strikethrough, s.baseline ?? void 0, K);
3969
- } else if (!S) z(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, K);
3977
+ b > 0 && F();
3978
+ for (let t of r) e.font = M, !N(I(t, M, K, n)) && b > 0 && F(), L(t, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3979
+ } else if (!S) L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3970
3980
  else {
3971
- let e = y.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), a = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, o = t !== void 0 && _.lineStartForbidden.has(t) && a, c = n !== void 0 && t !== void 0 && a && !R(e) && !R(r) && i(n, t);
3972
- (o || c) && B() || F(), z(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, K);
3981
+ let e = y.segments.at(-1)?.text ?? "", t = r.codePointAt(0), n = [...e].at(-1)?.codePointAt(0), a = /\S$/u.test(e) && /^\S/u.test(r) && n !== 8203 && t !== 8203, o = t !== void 0 && _.lineStartForbidden.has(t) && a, c = n !== void 0 && t !== void 0 && a && !V(e) && !V(r) && i(n, t);
3982
+ (o || c) && R() || F(), L(r, M, p, T, W, s.strikethrough, s.baseline ?? void 0, q);
3973
3983
  }
3974
3984
  }
3975
3985
  }
@@ -3979,9 +3989,9 @@ async function or(e, t, n, r, i, o, s, c, l, u) {
3979
3989
  if (t && t.fillType === "image") {
3980
3990
  if (e.fillStyle = "#FFFFFF", e.fillRect(0, 0, n, r), !t.imagePath || !t.mimeType || !s) return;
3981
3991
  try {
3982
- let a = t.fillRect ?? {}, d = a.l ?? 0, f = a.t ?? 0, p = a.r ?? 0, m = a.b ?? 0, h = d * n, g = f * r, _ = n * (1 - d - p), v = r * (1 - f - m), y = u && !t.duotone ? Dn(u, X(t.imagePath, t.duotone)) : void 0, b = t.tile ? await L(t.imagePath, t.mimeType, s) : void 0, x = await Je(t.imagePath, t.mimeType, t.duotone, s, {
3983
- widthPt: n / i / J,
3984
- heightPt: r / i / J,
3992
+ let a = t.fillRect ?? {}, d = a.l ?? 0, f = a.t ?? 0, p = a.r ?? 0, m = a.b ?? 0, h = d * n, g = f * r, _ = n * (1 - d - p), v = r * (1 - f - m), y = u && !t.duotone ? Dn(u, Z(t.imagePath, t.duotone)) : void 0, b = t.tile ? await B(t.imagePath, t.mimeType, s) : void 0, x = await Je(t.imagePath, t.mimeType, t.duotone, s, {
3993
+ widthPt: n / i / Y,
3994
+ heightPt: r / i / Y,
3985
3995
  ...y ?? {},
3986
3996
  tiff: c,
3987
3997
  svgDecoder: l
@@ -4033,16 +4043,16 @@ function ur(e, t, n, r, i, a, o, s) {
4033
4043
  h(0, 0, !1, !1), d && h(l, 0, !0, !1), f && h(0, u, !1, !0), d && f && h(l, u, !0, !0);
4034
4044
  let g = e.createPattern(p, "repeat");
4035
4045
  if (!g) return;
4036
- let { ax: _, ay: v } = cr(n.algn ?? "tl", r, i, l, u), y = _ + Y(n.tx ?? 0, a), b = v + Y(n.ty ?? 0, a);
4046
+ let { ax: _, ay: v } = cr(n.algn ?? "tl", r, i, l, u), y = _ + X(n.tx ?? 0, a), b = v + X(n.ty ?? 0, a);
4037
4047
  typeof g.setTransform == "function" && typeof DOMMatrix < "u" ? (g.setTransform(new DOMMatrix().translateSelf(y, b)), e.fillStyle = g, e.fillRect(0, 0, r, i)) : (e.save(), e.translate(y, b), e.fillStyle = g, e.fillRect(-y, -b, r, i), e.restore());
4038
4048
  }
4039
4049
  function dr(e, t, n) {
4040
4050
  if (!t) return;
4041
- let r = t.dir * Math.PI / 180, i = Y(t.dist, n);
4042
- e.shadowColor = Z(t.color, t.alpha), e.shadowBlur = 0, e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
4051
+ let r = t.dir * Math.PI / 180, i = X(t.dist, n);
4052
+ e.shadowColor = Q(t.color, t.alpha), e.shadowBlur = 0, e.shadowOffsetX = Math.cos(r) * i, e.shadowOffsetY = Math.sin(r) * i;
4043
4053
  }
4044
4054
  function fr(e, t, n) {
4045
- t && (e.shadowColor = Z(t.color, t.alpha), e.shadowBlur = Y(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
4055
+ t && (e.shadowColor = Q(t.color, t.alpha), e.shadowBlur = X(t.radius, n), e.shadowOffsetX = 0, e.shadowOffsetY = 0);
4046
4056
  }
4047
4057
  function pr(e) {
4048
4058
  e.shadowColor = "transparent", e.shadowBlur = 0, e.shadowOffsetX = 0, e.shadowOffsetY = 0;
@@ -4145,9 +4155,9 @@ function Cr(e, t, n, r, i, a, o, s, c, l, u) {
4145
4155
  function wr(e, t, n, r, i, a, o, s, c, l, u) {
4146
4156
  let d = i, f = a, p = Math.max(1, o), m = Math.max(1, s), h = ct(n, r, p, m);
4147
4157
  if (!h) return;
4148
- let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * J * c, y = [];
4158
+ let g = t.defaultBold ?? !1, _ = t.defaultItalic ?? !1, v = (t.defaultFontSize ?? 18) * Y * c, y = [];
4149
4159
  for (let n of t.paragraphs) {
4150
- let t = ar(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * J * c, n.defColor ? Z(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
4160
+ let t = ar(e, n, Infinity, n.defFontSize == null ? v : n.defFontSize * Y * c, n.defColor ? Q(n.defColor) : l, c, 0, g, _, 1, void 0, u, 0);
4151
4161
  for (let e of t) y.push(e);
4152
4162
  }
4153
4163
  if (y.length === 0) return;
@@ -4221,7 +4231,7 @@ function Tr(e, t, n, r, i, a, o) {
4221
4231
  }
4222
4232
  }
4223
4233
  function Er(e, t) {
4224
- return e.defaultTextColor ? Z(e.defaultTextColor) : t.smartArtFallbackTextColor != null && vn(e) ? t.smartArtFallbackTextColor : null;
4234
+ return e.defaultTextColor ? Q(e.defaultTextColor) : t.smartArtFallbackTextColor != null && vn(e) ? t.smartArtFallbackTextColor : null;
4225
4235
  }
4226
4236
  function Dr(e, t, n) {
4227
4237
  return {
@@ -4335,7 +4345,7 @@ function Fr(e, t, r, i = "#000000", a, o = {
4335
4345
  themeMinorFont: null,
4336
4346
  dpr: 1
4337
4347
  }, s, c) {
4338
- let l = Y(t.x, r), u = Y(t.y, r), d = Y(t.width, r), f = Y(t.height, r), p = s && t.id !== void 0 ? (e) => s({
4348
+ let l = X(t.x, r), u = X(t.y, r), d = X(t.width, r), f = X(t.height, r), p = s && t.id !== void 0 ? (e) => s({
4339
4349
  ...e,
4340
4350
  shapeId: t.id
4341
4351
  }) : s;
@@ -4401,9 +4411,9 @@ function Fr(e, t, r, i = "#000000", a, o = {
4401
4411
  e.restore();
4402
4412
  }
4403
4413
  e.save(), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(l + d / 2, u + f / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(l + d / 2), -(u + f / 2)));
4404
- let g = t.geometry.toLowerCase(), _ = Nn(t.fill, e, l, u, d, f, t.rotation);
4414
+ let _ = t.geometry.toLowerCase(), v = Nn(t.fill, e, l, u, d, f, t.rotation);
4405
4415
  t.shadow || fr(e, t.glow ?? null, r);
4406
- let v = new Set([
4416
+ let y = new Set([
4407
4417
  "line",
4408
4418
  "straightconnector1",
4409
4419
  "bentconnector2",
@@ -4414,7 +4424,7 @@ function Fr(e, t, r, i = "#000000", a, o = {
4414
4424
  "curvedconnector3",
4415
4425
  "curvedconnector4",
4416
4426
  "curvedconnector5"
4417
- ]), y = new Set([
4427
+ ]), b = new Set([
4418
4428
  "callout1",
4419
4429
  "callout2",
4420
4430
  "callout3",
@@ -4427,13 +4437,13 @@ function Fr(e, t, r, i = "#000000", a, o = {
4427
4437
  "accentbordercallout1",
4428
4438
  "accentbordercallout2",
4429
4439
  "accentbordercallout3"
4430
- ]), b = (e) => y.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), x = !t.custGeom && H(g), S = (n, i, a = {
4440
+ ]), x = (e) => b.has(e) || e === "line" || e === "straightconnector1" || e.startsWith("bentconnector"), S = !t.custGeom && m(_), C = (n, i, a = {
4431
4441
  x: l,
4432
4442
  y: u,
4433
4443
  w: d,
4434
4444
  h: f
4435
4445
  }) => {
4436
- let { x: o, y: s, w: c, h: p } = a, h = i ?? (n === e && o === l && s === u && c === d && p === f ? _ : Nn(t.fill, n, o, s, c, p, t.rotation)), v = i ? null : t.stroke ? () => {
4446
+ let { x: o, y: s, w: c, h: p } = a, m = i ?? (n === e && o === l && s === u && c === d && p === f ? v : Nn(t.fill, n, o, s, c, p, t.rotation)), h = i ? null : t.stroke ? () => {
4437
4447
  $r(n, t.stroke, r, {
4438
4448
  x: o,
4439
4449
  y: s,
@@ -4441,8 +4451,8 @@ function Fr(e, t, r, i = "#000000", a, o = {
4441
4451
  h: p
4442
4452
  }, t.rotation), n.stroke();
4443
4453
  } : null, y = () => pr(n);
4444
- if (x && !i) {
4445
- m(n, g, o, s, c, p, [
4454
+ if (S && !i) {
4455
+ g(n, _, o, s, c, p, [
4446
4456
  t.adj,
4447
4457
  t.adj2,
4448
4458
  t.adj3,
@@ -4451,11 +4461,11 @@ function Fr(e, t, r, i = "#000000", a, o = {
4451
4461
  t.adj6,
4452
4462
  t.adj7,
4453
4463
  t.adj8
4454
- ], h, v, y, b(g) ? { skipTrailingStroke: !0 } : void 0);
4464
+ ], m, h, y, x(_) ? { skipTrailingStroke: !0 } : void 0);
4455
4465
  return;
4456
4466
  }
4457
- n.beginPath(), t.custGeom && t.custGeom.length > 0 ? Ir(n, t.custGeom, o, s, c, p) : me(n, g, o, s, c, p, t.adj, t.adj2, t.adj3, t.adj4), h && g !== "arc" && (n.fillStyle = h, g === "donut" || g === "smileyface" || g === "frame" ? n.fill("evenodd") : n.fill(), i || y()), v && v();
4458
- }, C = e.getTransform(), w = Math.abs(C.a * C.d - C.b * C.c), T = w > 0 ? Math.sqrt(w) : 1, E = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? x ? n(g, l, u, d, f, [
4467
+ n.beginPath(), t.custGeom && t.custGeom.length > 0 ? Ir(n, t.custGeom, o, s, c, p) : me(n, _, o, s, c, p, t.adj, t.adj2, t.adj3, t.adj4), m && _ !== "arc" && (n.fillStyle = m, _ === "donut" || _ === "smileyface" || _ === "frame" ? n.fill("evenodd") : n.fill(), i || y()), h && h();
4468
+ }, w = e.getTransform(), T = Math.abs(w.a * w.d - w.b * w.c), E = T > 0 ? Math.sqrt(T) : 1, D = (t.shadow || t.reflection || t.softEdge || t.innerShadow ? S ? W(_, l, u, d, f, [
4459
4469
  t.adj,
4460
4470
  t.adj2,
4461
4471
  t.adj3,
@@ -4469,15 +4479,15 @@ function Fr(e, t, r, i = "#000000", a, o = {
4469
4479
  y: u,
4470
4480
  w: d,
4471
4481
  h: f
4472
- }, D = t.stroke ? t.stroke.width * r / 2 : 0, O = t.stroke ? Math.max(t.stroke.headEnd ? pe(t.stroke.headEnd, t.stroke, r) : 0, t.stroke.tailEnd ? pe(t.stroke.tailEnd, t.stroke, r) : 0) : 0, k = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, A = Math.max(D, O, k), j = A > 0 ? {
4473
- x: E.x - A,
4474
- y: E.y - A,
4475
- w: E.w + A * 2,
4476
- h: E.h + A * 2
4477
- } : E, M = Or(C, j.x, j.y, j.w, j.h), N = r * T, P = h ? [] : Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, T), F = (t.stroke ? t.stroke.width * r / 2 : 0) + 2, I = (e) => {
4478
- let n = t.stroke?.fill ? Nn(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
4479
- if (t.stroke && (v.has(g) || y.has(g))) {
4480
- let i = U(g, l, u, d, f, [
4482
+ }, O = t.stroke ? t.stroke.width * r / 2 : 0, k = t.stroke ? Math.max(t.stroke.headEnd ? pe(t.stroke.headEnd, t.stroke, r) : 0, t.stroke.tailEnd ? pe(t.stroke.tailEnd, t.stroke, r) : 0) : 0, A = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, j = Math.max(O, k, A), M = j > 0 ? {
4483
+ x: D.x - j,
4484
+ y: D.y - j,
4485
+ w: D.w + j * 2,
4486
+ h: D.h + j * 2
4487
+ } : D, N = Or(w, M.x, M.y, M.w, M.h), P = r * E, F = h ? [] : Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d?.prstMaterial, r, E), I = (t.stroke ? t.stroke.width * r / 2 : 0) + 2, L = (e) => {
4488
+ let i = t.stroke?.fill ? Nn(t.stroke.fill, e, l, u, d, f, t.rotation) ?? void 0 : void 0;
4489
+ if (t.stroke && (y.has(_) || b.has(_))) {
4490
+ let a = n(_, l, u, d, f, [
4481
4491
  t.adj,
4482
4492
  t.adj2,
4483
4493
  t.adj3,
@@ -4487,10 +4497,10 @@ function Fr(e, t, r, i = "#000000", a, o = {
4487
4497
  t.adj7,
4488
4498
  t.adj8
4489
4499
  ]);
4490
- if (!i) return;
4491
- let a = t.stroke.cmpd, o = g === "line" || g === "straightconnector1";
4492
- if (b(g) && i.vertices.length >= 2 && !(a && o)) {
4493
- let n = i.vertices.map((e) => ({
4500
+ if (!a) return;
4501
+ let o = t.stroke.cmpd, s = _ === "line" || _ === "straightconnector1";
4502
+ if (x(_) && a.vertices.length >= 2 && !(o && s)) {
4503
+ let n = a.vertices.map((e) => ({
4494
4504
  x: e.x,
4495
4505
  y: e.y
4496
4506
  }));
@@ -4511,40 +4521,40 @@ function Fr(e, t, r, i = "#000000", a, o = {
4511
4521
  for (let t = 1; t < n.length; t++) e.lineTo(n[t].x, n[t].y);
4512
4522
  e.stroke();
4513
4523
  }
4514
- a && o && Qr(e, i.start, i.end, t.stroke, a, r, t.rotation), t.stroke.tailEnd && _e(e, i.end.x, i.end.y, i.end.angle, t.stroke.tailEnd, t.stroke, r, n), t.stroke.headEnd && _e(e, i.start.x, i.start.y, i.start.angle, t.stroke.headEnd, t.stroke, r, n);
4524
+ o && s && Qr(e, a.start, a.end, t.stroke, o, r, t.rotation), t.stroke.tailEnd && _e(e, a.end.x, a.end.y, a.end.angle, t.stroke.tailEnd, t.stroke, r, i), t.stroke.headEnd && _e(e, a.start.x, a.start.y, a.start.angle, t.stroke.headEnd, t.stroke, r, i);
4515
4525
  return;
4516
4526
  }
4517
4527
  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")) return;
4518
- let { start: i, end: a } = ve(t.custGeom);
4519
- i && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && _e(e, l + i.x * d, u + i.y * f, Math.atan2(i.dy * f, i.dx * d), t.stroke.headEnd, t.stroke, r, n), a && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && _e(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.tailEnd, t.stroke, r, n);
4520
- }, L = (e) => {
4521
- if (P.length > 0 && Gr(e, l, u, d, f, P, (e, t, n, r, i) => S(e, void 0, {
4528
+ let { start: a, end: o } = ve(t.custGeom);
4529
+ a && t.stroke.headEnd && t.stroke.headEnd.type !== "none" && _e(e, l + a.x * d, u + a.y * f, Math.atan2(a.dy * f, a.dx * d), t.stroke.headEnd, t.stroke, r, i), o && t.stroke.tailEnd && t.stroke.tailEnd.type !== "none" && _e(e, l + o.x * d, u + o.y * f, Math.atan2(o.dy * f, o.dx * d), t.stroke.tailEnd, t.stroke, r, i);
4530
+ }, R = (e) => {
4531
+ if (F.length > 0 && Gr(e, l, u, d, f, F, (e, t, n, r, i) => C(e, void 0, {
4522
4532
  x: t,
4523
4533
  y: n,
4524
4534
  w: r,
4525
4535
  h: i
4526
- }), void 0, F)) {
4527
- I(e), pr(e);
4536
+ }), void 0, I)) {
4537
+ L(e), pr(e);
4528
4538
  return;
4529
4539
  }
4530
- S(e), I(e);
4540
+ C(e), L(e);
4531
4541
  };
4532
- if (Pr(e, t, L, L, M, jr(C, l, u, d, f, t.shadow?.algn), r, N, C, !!_, (e) => S(e, "#000")), t.textBody) {
4542
+ if (Pr(e, t, R, R, N, jr(w, l, u, d, f, t.shadow?.algn), r, P, w, !!v, (e) => C(e, "#000")), t.textBody) {
4533
4543
  let n = Er(t, o);
4534
4544
  if (e.save(), t.flipH || t.flipV) {
4535
4545
  let n = l + d / 2, r = u + f / 2;
4536
4546
  e.translate(n, r), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-n, -r);
4537
4547
  }
4538
- let s = l, m = u, h = d, _ = f;
4539
- if (t.textRect) s = Y(t.textRect.x, r), m = Y(t.textRect.y, r), h = Y(t.textRect.width, r), _ = Y(t.textRect.height, r);
4540
- else if (g === "ellipse") {
4548
+ let s = l, m = u, h = d, g = f;
4549
+ if (t.textRect) s = X(t.textRect.x, r), m = X(t.textRect.y, r), h = X(t.textRect.width, r), g = X(t.textRect.height, r);
4550
+ else if (_ === "ellipse") {
4541
4551
  let e = d * (1 - 1 / Math.SQRT2) / 2, t = f * (1 - 1 / Math.SQRT2) / 2;
4542
- s = l + e, m = u + t, h = d / Math.SQRT2, _ = f / Math.SQRT2;
4552
+ s = l + e, m = u + t, h = d / Math.SQRT2, g = f / Math.SQRT2;
4543
4553
  } else {
4544
- let e = Tr(g, l, u, d, f, t.adj, t.adj2);
4545
- e && (s = e.tx, m = e.ty, h = e.tw, _ = e.th);
4554
+ let e = Tr(_, l, u, d, f, t.adj, t.adj2);
4555
+ e && (s = e.tx, m = e.ty, h = e.tw, g = e.th);
4546
4556
  }
4547
- Vr(e, t.textBody, s, m, h, _, r, n, t.rotation, !1, !1, i, a, o, p, !1, c), e.restore();
4557
+ Vr(e, t.textBody, s, m, h, g, r, n, t.rotation, !1, !1, i, a, o, p, !1, c), e.restore();
4548
4558
  }
4549
4559
  e.restore();
4550
4560
  }
@@ -4654,102 +4664,107 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4654
4664
  wr(t, n, S.preset, S.adj ?? [], r, i, a, o, s, c ?? f, m);
4655
4665
  return;
4656
4666
  }
4657
- let C = Y(n.lIns, s), w = Y(n.rIns, s), T = Y(n.tIns, s), E = Y(n.bIns, s), O = n.wrap !== "none", k = n.autoFit === "sp" ? O && er(t, n, a, C, w, s, m) : O, A = Math.max(1, n.numCol ?? 1), j = Y(n.spcCol ?? 0, s), M = n.defaultBold ?? !1, N = n.defaultItalic ?? !1, P = c ?? f, F = (e) => {
4658
- let i = (n.defaultFontSize ?? 18) * J * s * e, o = [], c = 0, l = /* @__PURE__ */ new Map();
4667
+ let C = X(n.lIns, s), w = X(n.rIns, s), T = X(n.tIns, s), E = X(n.bIns, s), D = n.wrap !== "none", O = n.autoFit === "sp", A = O ? D && er(t, n, a, C, w, s, m) : D, j = Math.max(1, n.numCol ?? 1), M = X(n.spcCol ?? 0, s), N = n.defaultBold ?? !1, P = n.defaultItalic ?? !1, F = c ?? f, I = (e) => {
4668
+ let i = (n.defaultFontSize ?? 18) * Y * s * e, o = [], c = 0, l = /* @__PURE__ */ new Map();
4659
4669
  for (let u = 0; u < n.paragraphs.length; u++) {
4660
- let d = n.paragraphs[u], f = Y(d.marL, s), h = Y(d.marR, s), _ = Y(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * J * s * e, b = d.defColor ? Z(d.defColor) : P, x = Xn(d), S = (() => {
4670
+ let d = n.paragraphs[u], f = X(d.marL, s), h = X(d.marR, s), _ = X(d.indent, s), v = d.defFontSize == null ? i : d.defFontSize * Y * s * e, b = d.defColor ? Q(d.defColor) : F, x = Xn(d), S = (() => {
4661
4671
  for (let e of d.runs) if (e.type === "text" && e.fontSize != null) return e.fontSize;
4662
4672
  return d.defFontSize ?? n.defaultFontSize ?? 18;
4663
- })() * J * s * e, T = (() => {
4673
+ })() * Y * s * e, T = (() => {
4664
4674
  for (let e of d.runs) if (e.type === "text" && e.color) return e.color;
4665
4675
  return null;
4666
- })(), E = T ? Z(T) : b, D = (() => {
4676
+ })(), E = T ? Q(T) : b, D = (() => {
4667
4677
  for (let e of d.runs) if (e.type === "text" && e.fontFamily) return e.fontFamily;
4668
4678
  return d.defFontFamily ?? null;
4669
- })(), O = "", F = Yn(!1, !1, S, "sans-serif", m), I = E, L = null;
4670
- O = Br(d, l);
4671
- let R = Qe(d.bullet);
4672
- if (R.type === "char") {
4673
- let t = R;
4674
- F = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * J * s * e, O === t.char ? Rn(t.fontFamily ?? null, m) : "sans-serif", m), I = t.color ? Z(t.color) : E;
4675
- } else if (R.type === "autoNum") {
4676
- let t = R;
4677
- F = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * J * s * e, Rn(t.fontFamily ?? D, m), m), I = R.color ? Z(R.color) : E;
4678
- } else if (R.type === "blip") {
4679
- let t = R, r = Zn(n, d, t) * J * s * e;
4680
- L = {
4679
+ })(), k = "", I = Yn(!1, !1, S, "sans-serif", m), L = E, R = null;
4680
+ k = Br(d, l);
4681
+ let z = Qe(d.bullet);
4682
+ if (z.type === "char") {
4683
+ let t = z;
4684
+ I = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * Y * s * e, k === t.char ? Rn(t.fontFamily ?? null, m) : "sans-serif", m), L = t.color ? Q(t.color) : E;
4685
+ } else if (z.type === "autoNum") {
4686
+ let t = z;
4687
+ I = Yn(!1, !1, t.sizePts == null ? t.sizePct == null ? S : S * (t.sizePct / 100) : t.sizePts * Y * s * e, Rn(t.fontFamily ?? D, m), m), L = z.color ? Q(z.color) : E;
4688
+ } else if (z.type === "blip") {
4689
+ let t = z, r = Zn(n, d, t) * Y * s * e;
4690
+ R = {
4681
4691
  imagePath: t.imagePath,
4682
4692
  mimeType: t.mimeType,
4683
4693
  sizePx: r
4684
4694
  };
4685
4695
  }
4686
- let z = A > 1 ? (a - C - w - (A - 1) * j) / A : a - C - w, B = r + C + f, V = r + C + f + _, H = z - f - h, U = ar(t, d, k ? H : Infinity, v, b, s, f, M, N, e, p, m, Qn(x, _)), ee = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * J * s * e, W = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * J * s * e;
4687
- for (let e = 0; e < U.length; e++) {
4688
- let r = U[e], i = e === 0, a = e === U.length - 1, l = 0, f = 0;
4696
+ let B = j > 1 ? (a - C - w - (j - 1) * M) / j : a - C - w, V = r + C + f, H = r + C + f + _, U = B - f - h, ee = ar(t, d, A ? U : Infinity, v, b, s, f, N, P, e, p, m, Qn(x, _)), W = d.spaceBefore == null ? 0 : d.spaceBefore / 100 * Y * s * e, G = d.spaceAfter == null ? 0 : d.spaceAfter / 100 * Y * s * e;
4697
+ for (let e = 0; e < ee.length; e++) {
4698
+ let r = ee[e], i = e === 0, a = e === ee.length - 1, l = 0, f = 0, p = 0;
4689
4699
  for (let e of r.segments) {
4690
- let t = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
4691
- if (t > l && (l = t), !e.math) {
4692
- let t = G(e.fontFamily, e.sizePx);
4693
- t > f && (f = t);
4700
+ let n = e.math ? Math.max(e.sizePx, (e.math.ascent + e.math.descent) / 1.2) : e.sizePx;
4701
+ if (n > l && (l = n), !e.math) {
4702
+ let n = J(e.fontFamily, e.sizePx);
4703
+ if (n > f && (f = n), O) {
4704
+ t.font = e.font;
4705
+ let n = t.measureText(e.text || "M"), r = (n.fontBoundingBoxAscent ?? 0) + (n.fontBoundingBoxDescent ?? 0);
4706
+ r > p && (p = r);
4707
+ }
4694
4708
  }
4695
4709
  }
4696
- if (l === 0 && (l = v), i && O) {
4697
- t.font = F;
4710
+ if (l === 0 && (l = v), i && k) {
4711
+ t.font = I;
4698
4712
  let e = t.measureText("M"), n = e.actualBoundingBoxAscent + e.actualBoundingBoxDescent;
4699
4713
  n > l && (l = n);
4700
4714
  }
4701
- i && L && L.sizePx > l && (l = L.sizePx);
4702
- let p = l * 1.2, m = Math.max(p, f), h;
4703
- h = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : p) * (d.spaceLine.val / 1e5) : d.spaceLine.val * J * s : g ? y ? p : l : m, n.autoFit === "norm" && n.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (h *= 1 - n.lnSpcReduction);
4704
- let b = h + (a ? W : 0), S = i && u > 0 ? ee : 0, C = i ? Qn(x, _) : 0, w = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), T = i && w ? L : null;
4715
+ i && R && R.sizePx > l && (l = R.sizePx);
4716
+ let m = l * 1.2, h = O && f > m && p > 0, b = h ? Math.max(m, p) : Math.max(m, f), S;
4717
+ S = d.spaceLine ? d.spaceLine.type === "pct" ? (g ? l : m) * (d.spaceLine.val / 1e5) : d.spaceLine.val * Y * s : g && !O ? y ? m : l : b, n.autoFit === "norm" && n.lnSpcReduction != null && d.spaceLine?.type !== "pts" && (S *= 1 - n.lnSpcReduction);
4718
+ let C = S + (a ? G : 0), w = i && u > 0 ? W : 0, T = i ? Qn(x, _) : 0, E = r.segments.some((e) => e.text && e.text.length > 0 || e.math != null), D = i && E ? R : null;
4705
4719
  o.push({
4706
4720
  line: r,
4707
- linePx: b,
4708
- lineHeight: h,
4709
- topGapPx: S,
4710
- textXOffset: C,
4711
- bulletLabel: i ? O : "",
4712
- bulletFont: F,
4713
- bulletColor: I,
4714
- bulletX: V,
4715
- bulletImage: T,
4716
- textX: B,
4717
- textMaxW: H,
4721
+ linePx: C,
4722
+ lineHeight: S,
4723
+ topGapPx: w,
4724
+ textXOffset: T,
4725
+ bulletLabel: i ? k : "",
4726
+ bulletFont: I,
4727
+ bulletColor: L,
4728
+ bulletX: H,
4729
+ bulletImage: D,
4730
+ textX: V,
4731
+ textMaxW: U,
4718
4732
  alignment: d.alignment,
4719
4733
  isLastLine: a,
4720
- para: d
4721
- }), c += b + S;
4734
+ para: d,
4735
+ useResolvedFontMetrics: h
4736
+ }), c += C + w;
4722
4737
  }
4723
4738
  }
4724
4739
  return {
4725
4740
  allLines: o,
4726
4741
  totalHeight: c
4727
4742
  };
4728
- }, { allLines: I, totalHeight: L } = F(1);
4729
- if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines: I, totalHeight: L} = F(n.fontScale));
4743
+ }, { allLines: L, totalHeight: R } = I(1);
4744
+ if (n.autoFit === "norm") if (n.fontScale != null && n.fontScale > 0) n.fontScale < 1 && ({allLines: L, totalHeight: R} = I(n.fontScale));
4730
4745
  else {
4731
4746
  let e = o - T - E;
4732
- if (L > e && e > 0) {
4747
+ if (R > e && e > 0) {
4733
4748
  let t = .1, n = 1;
4734
4749
  for (let r = 0; r < 6; r++) {
4735
4750
  let r = (t + n) / 2;
4736
- F(r).totalHeight <= e ? t = r : n = r;
4751
+ I(r).totalHeight <= e ? t = r : n = r;
4737
4752
  }
4738
- ({allLines: I, totalHeight: L} = F(t));
4753
+ ({allLines: L, totalHeight: R} = I(t));
4739
4754
  }
4740
4755
  }
4741
- if (g) return T + L + E;
4742
- let R = n.verticalAnchor ?? "t", z = i, B;
4743
- o === 0 && R === "b" ? (B = T + L + E, z = i - B) : B = n.autoFit === "sp" ? Math.max(o, T + L + E) : o;
4744
- let V, H = Math.max(0, B - T - E);
4745
- V = R === "ctr" ? z + T + (H - L) / 2 : R === "b" ? z + B - E - L : z + T, t.save(), t.textAlign = "left", t.textBaseline = "alphabetic";
4746
- let U = V, ee = A > 1 ? (a - C - w - (A - 1) * j) / A + j : 0, W = Math.max(0, B - T - E), te = I[I.length - 1], K = te ? Math.max(0, te.linePx - te.lineHeight) : 0, q = L - K, ne = o === 0 || q <= W + .5, re = A > 1 && !ne ? Math.ceil(I.length / A) : I.length, ie = 0, ae = 0;
4747
- for (let c of I) {
4748
- let { line: u, linePx: d, lineHeight: f, topGapPx: p, textXOffset: g, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w } = c;
4749
- A > 1 && ie < A - 1 && ae >= re && (ie++, ae = 0, V = U), V += p, ae++;
4750
- let T = (n.rtlCol ? A - 1 - ie : ie) * ee, E = c.textX + T, O = c.bulletX + T, k = c.textMaxW, j = c.para.rtl === !0, M = j || cn(u.segments), N = u.segments.some((e) => e.isTab);
4751
- if (N) {
4752
- let e = Y(c.para.marL, s), n = Y(c.para.marR, s), r = j ? n : e + g, i = k + e + n;
4756
+ if (g) return T + R + E;
4757
+ let z = n.verticalAnchor ?? "t", B = i, V;
4758
+ o === 0 && z === "b" ? (V = T + R + E, B = i - V) : V = n.autoFit === "sp" ? Math.max(o, T + R + E) : o;
4759
+ let H, U = Math.max(0, V - T - E);
4760
+ H = z === "ctr" ? B + T + (U - R) / 2 : z === "b" ? B + V - E - R : B + T, t.save(), t.textAlign = "left", t.textBaseline = "alphabetic";
4761
+ let ee = H, W = j > 1 ? (a - C - w - (j - 1) * M) / j + M : 0, G = Math.max(0, V - T - E), K = L[L.length - 1], q = K ? Math.max(0, K.linePx - K.lineHeight) : 0, te = R - q, ne = o === 0 || te <= G + .5, re = j > 1 && !ne ? Math.ceil(L.length / j) : L.length, ie = 0, ae = 0;
4762
+ for (let c of L) {
4763
+ let { line: u, linePx: d, lineHeight: f, topGapPx: p, textXOffset: g, bulletLabel: y, bulletFont: b, bulletColor: x, bulletImage: S, alignment: C, isLastLine: w, useResolvedFontMetrics: T } = c;
4764
+ j > 1 && ie < j - 1 && ae >= re && (ie++, ae = 0, H = ee), H += p, ae++;
4765
+ let E = (n.rtlCol ? j - 1 - ie : ie) * W, D = c.textX + E, O = c.bulletX + E, A = c.textMaxW, M = c.para.rtl === !0, N = M || cn(u.segments), P = u.segments.some((e) => e.isTab);
4766
+ if (P) {
4767
+ let e = X(c.para.marL, s), n = X(c.para.marR, s), r = M ? n : e + g, i = A + e + n;
4753
4768
  t.font = u.segments.find((e) => e.isTab).font;
4754
4769
  let a = t.measureText(" ").width, o = bn(u.segments.map((e) => {
4755
4770
  if (e.isTab) return {
@@ -4764,76 +4779,79 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4764
4779
  let n = e.letterSpacingPx ?? 0;
4765
4780
  return {
4766
4781
  isTab: !1,
4767
- width: e.text ? (e.leadingLetterSpacingPx ?? 0) + Q(t, e.text, n) : 0
4782
+ width: e.text ? (e.leadingLetterSpacingPx ?? 0) + $(t, e.text, n) : 0
4768
4783
  };
4769
4784
  }), (c.para.tabStops ?? []).map((e) => ({
4770
- pos: Y(e.pos, s),
4785
+ pos: X(e.pos, s),
4771
4786
  algn: e.algn
4772
- })), r, i, a, Y(c.para.defTabSz ?? 914400, s));
4787
+ })), r, i, a, X(c.para.defTabSz ?? 914400, s));
4773
4788
  for (let e = 0; e < u.segments.length; e++) u.segments[e].isTab && (u.segments[e].tabWidthPx = o[e]);
4774
4789
  }
4775
- let P = 0, F = f * .8;
4790
+ let F = 0, I = 0, L = 0, R = 0;
4776
4791
  for (let e of u.segments) {
4777
4792
  if (e.isTab) {
4778
- P += e.tabWidthPx ?? 0;
4793
+ F += e.tabWidthPx ?? 0;
4779
4794
  continue;
4780
4795
  }
4781
4796
  if (e.math) {
4782
- P += e.math.width, F = Math.max(F, e.math.ascent);
4797
+ F += e.math.width, I = Math.max(I, e.math.ascent);
4783
4798
  continue;
4784
4799
  }
4785
4800
  t.font = e.font;
4786
4801
  let n = t.measureText(e.text || "M"), r = e.letterSpacingPx ?? 0;
4787
- P += e.leadingLetterSpacingPx ?? 0, P += e.text ? Q(t, e.text, r) : 0, n.actualBoundingBoxAscent > 0 && (F = Math.max(F, n.actualBoundingBoxAscent));
4802
+ if (F += e.leadingLetterSpacingPx ?? 0, F += e.text ? $(t, e.text, r) : 0, n.actualBoundingBoxAscent > 0 && (I = Math.max(I, n.actualBoundingBoxAscent)), T) {
4803
+ let e = n.fontBoundingBoxAscent ?? 0, t = e + (n.fontBoundingBoxDescent ?? 0);
4804
+ t > R && (R = t, L = e);
4805
+ }
4788
4806
  }
4789
- let I = V + F, L = E + k, R = S && _ ? m.pictureBulletImages?.has(S.imagePath) ? m.pictureBulletImages.get(S.imagePath) : D(S.imagePath, _) : void 0, z = 0;
4790
- if (M && j) {
4791
- if (y) t.font = b, z = t.measureText(y).width;
4792
- else if (S && R) {
4807
+ let B = T && R > 0 ? z === "t" && I > 0 ? I : Math.max(I, L + Math.max(0, f - R) / 2) : Math.max(f * .8, I), V = H + B, U = D + A, G = S && _ ? m.pictureBulletImages?.has(S.imagePath) ? m.pictureBulletImages.get(S.imagePath) : k(S.imagePath, _) : void 0, K = 0;
4808
+ if (N && M) {
4809
+ if (y) t.font = b, K = t.measureText(y).width;
4810
+ else if (S && G) {
4793
4811
  let e = S.sizePx;
4794
- z = R.height > 0 ? e * (R.width / R.height) : e;
4812
+ K = G.height > 0 ? e * (G.width / G.height) : e;
4795
4813
  }
4796
4814
  }
4797
- if (y) if (t.font = b, t.fillStyle = x, M && j) {
4815
+ if (y) if (t.font = b, t.fillStyle = x, N && M) {
4798
4816
  let e = t.direction;
4799
- t.direction = "rtl", t.fillText(y, L - z, I), t.direction = e;
4800
- } else t.fillText(y, O, I);
4801
- if (S && _ && R) {
4802
- let e = S.sizePx, n = R.height > 0 ? e * (R.width / R.height) : e, r = I - e;
4803
- M && j ? t.drawImage(R, L - n, r, n, e) : t.drawImage(R, O, r, n, e);
4817
+ t.direction = "rtl", t.fillText(y, U - K, V), t.direction = e;
4818
+ } else t.fillText(y, O, V);
4819
+ if (S && _ && G) {
4820
+ let e = S.sizePx, n = G.height > 0 ? e * (G.width / G.height) : e, r = V - e;
4821
+ N && M ? t.drawImage(G, U - n, r, n, e) : t.drawImage(G, O, r, n, e);
4804
4822
  }
4805
- let B = E + g, H;
4806
- H = N ? j ? E + k - z - P : B : C === "ctr" ? B + (k - g - P) / 2 : C === "r" ? E + k - z - P : B;
4807
- let W = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, te = w || (u.endsWithBreak ?? !1), G = (W && !M && !N ? fn(u.segments, k - g, P, W, te) : null) ?? u.segments, K = M ? ln(u.segments, j) : null, q = (e, t) => {
4823
+ let q = D + g, J;
4824
+ J = P ? M ? D + A - K - F : q : C === "ctr" ? q + (A - g - F) / 2 : C === "r" ? D + A - K - F : q;
4825
+ let te = C === "just" || C === "justLow" ? "just" : C === "thaiDist" ? "thaiDist" : C === "dist" ? "dist" : null, ne = w || (u.endsWithBreak ?? !1), oe = (te && !N && !P ? fn(u.segments, A - g, F, te, ne) : null) ?? u.segments, se = N ? ln(u.segments, M) : null, ce = (e, t) => {
4808
4826
  if (Math.abs(e - t) !== 1) return 0;
4809
4827
  let n = u.segments[Math.min(e, t)], r = u.segments[Math.max(e, t)];
4810
4828
  return n.isTab || n.math || r.isTab || r.math || n.sourceRunId == null || n.sourceRunId !== r.sourceRunId ? 0 : r.leadingLetterSpacingPx ?? 0;
4811
- }, ne = G.length;
4812
- for (let n = 0; n < ne; n++) {
4813
- let c = K ? K.order[n] : n, u = G[c], d = K ? K.rtl[c] : !1;
4814
- if (M && (t.direction = d ? "rtl" : "ltr"), n > 0) {
4815
- let e = K ? K.order[n - 1] : n - 1;
4816
- H += q(e, c);
4829
+ }, le = oe.length;
4830
+ for (let n = 0; n < le; n++) {
4831
+ let c = se ? se.order[n] : n, u = oe[c], d = se ? se.rtl[c] : !1;
4832
+ if (N && (t.direction = d ? "rtl" : "ltr"), n > 0) {
4833
+ let e = se ? se.order[n - 1] : n - 1;
4834
+ J += ce(e, c);
4817
4835
  }
4818
4836
  if (u.isTab) {
4819
- H += u.tabWidthPx ?? 0;
4837
+ J += u.tabWidthPx ?? 0;
4820
4838
  continue;
4821
4839
  }
4822
4840
  let p = u.jext ?? 0, g = u.splitBefore, _ = u.perGap ?? 0, y = g && g.length > 0 ? g.length * _ : 0;
4823
4841
  if (u.math) {
4824
4842
  let e = Pn.get(u.math.nodes), n = u.math.width, r = u.math.ascent + u.math.descent;
4825
4843
  if (e && n > 0 && r > 0) {
4826
- let i = I - u.math.ascent, a = Fn(e, u.color);
4827
- t.drawImage(a, H, i, n, r);
4844
+ let i = V - u.math.ascent, a = Fn(e, u.color);
4845
+ t.drawImage(a, J, i, n, r);
4828
4846
  }
4829
- H += n, H += p;
4847
+ J += n, J += p;
4830
4848
  continue;
4831
4849
  }
4832
4850
  t.font = u.font, t.fillStyle = u.color;
4833
- let b = u.drawSizePx ?? u.sizePx, x = I + (u.baseline ? -(u.baseline / 1e5) * u.sizePx : 0), S = u.letterSpacingPx ?? 0;
4851
+ let b = u.drawSizePx ?? u.sizePx, x = V + (u.baseline ? -(u.baseline / 1e5) * u.sizePx : 0), S = u.letterSpacingPx ?? 0;
4834
4852
  if (u.highlight && u.text) {
4835
- let e = Q(t, u.text, S) + y + p;
4836
- Mn(t, H, x, e, b, u.highlight, u.color);
4853
+ let e = $(t, u.text, S) + y + p;
4854
+ Mn(t, J, x, e, b, u.highlight, u.color);
4837
4855
  }
4838
4856
  let C = u.shadow, w = (e, t, n, r) => {
4839
4857
  let i = r === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e);
@@ -4852,29 +4870,29 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4852
4870
  }
4853
4871
  }
4854
4872
  } else i(t, n, x);
4855
- }, T = (e) => Q(t, e, S), E = g && g.length > 0 ? $t([...u.text], g, _, T) : null, D = [...u.text], O = !!g && g.length === D.length - 1 && D.length > 1, k = (e, t) => {
4873
+ }, T = (e) => $(t, e, S), E = g && g.length > 0 ? $t([...u.text], g, _, T) : null, D = [...u.text], O = !!g && g.length === D.length - 1 && D.length > 1, k = (e, t) => {
4856
4874
  if (v) {
4857
4875
  let n = O ? S + _ : S;
4858
- Tn(e, u.text, H, x, b, n, t);
4876
+ Tn(e, u.text, J, x, b, n, t);
4859
4877
  return;
4860
4878
  }
4861
4879
  if (O) {
4862
4880
  let n = t === "fill" ? e.fillText.bind(e) : e.strokeText.bind(e), r = S + _;
4863
4881
  if (ir(e)) {
4864
4882
  let t = e, i = t.letterSpacing;
4865
- t.letterSpacing = `${r}px`, n(u.text, H, x);
4883
+ t.letterSpacing = `${r}px`, n(u.text, J, x);
4866
4884
  try {
4867
4885
  t.letterSpacing = i;
4868
4886
  } catch {}
4869
4887
  } else {
4870
- let t = H;
4888
+ let t = J;
4871
4889
  for (let i = 0; i < D.length; i++) {
4872
4890
  let a = D[i];
4873
4891
  n(a, t, x), i < D.length - 1 && (t += e.measureText(a).width + r);
4874
4892
  }
4875
4893
  }
4876
- } else if (E) for (let { text: n, dx: r } of E) w(e, n, H + r, t);
4877
- else w(e, u.text, H, t);
4894
+ } else if (E) for (let { text: n, dx: r } of E) w(e, n, J + r, t);
4895
+ else w(e, u.text, J, t);
4878
4896
  }, A = u.reflection;
4879
4897
  if (A && u.text) {
4880
4898
  let e = t.canvas.width || 0, n = t.canvas.height || 0;
@@ -4884,7 +4902,7 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4884
4902
  Jn(t, (e) => {
4885
4903
  e.font = u.font, e.fillStyle = u.color, k(e, "fill");
4886
4904
  }, {
4887
- x: (H - o) * f,
4905
+ x: (J - o) * f,
4888
4906
  y: (x - i) * f,
4889
4907
  w: Math.max(1, o + c) * f,
4890
4908
  h: Math.max(1, i + a) * f
@@ -4892,18 +4910,18 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4892
4910
  }
4893
4911
  }
4894
4912
  if (C) {
4895
- let e = C.dir * Math.PI / 180, n = Y(C.dist, s);
4896
- t.save(), t.shadowColor = Z(C.color, C.alpha), t.shadowBlur = Y(C.blur, s), t.shadowOffsetX = Math.cos(e) * n, t.shadowOffsetY = Math.sin(e) * n;
4913
+ let e = C.dir * Math.PI / 180, n = X(C.dist, s);
4914
+ t.save(), t.shadowColor = Q(C.color, C.alpha), t.shadowBlur = X(C.blur, s), t.shadowOffsetX = Math.cos(e) * n, t.shadowOffsetY = Math.sin(e) * n;
4897
4915
  }
4898
4916
  k(t, "fill"), C && t.restore();
4899
4917
  let j = u.outline;
4900
- j && j.width > 0 && (t.save(), t.lineWidth = Math.max(.5, Y(j.width, s)), t.strokeStyle = j.color ? `#${j.color}` : u.color, t.lineJoin = "round", k(t, "stroke"), t.restore()), t.font = u.font;
4901
- let N = Q(t, u.text, S) + y;
4918
+ j && j.width > 0 && (t.save(), t.lineWidth = Math.max(.5, X(j.width, s)), t.strokeStyle = j.color ? `#${j.color}` : u.color, t.lineJoin = "round", k(t, "stroke"), t.restore()), t.font = u.font;
4919
+ let M = $(t, u.text, S) + y;
4902
4920
  if (h && u.text && h({
4903
4921
  text: u.text,
4904
- inShapeX: H - r,
4905
- inShapeY: V - i,
4906
- w: N + p,
4922
+ inShapeX: J - r,
4923
+ inShapeY: H - i,
4924
+ w: M + p,
4907
4925
  h: f,
4908
4926
  fontSize: b,
4909
4927
  font: u.font,
@@ -4913,21 +4931,21 @@ function Vr(t, n, r, i, a, o, s, c = null, l = 0, u = !1, d = !1, f = "#000000",
4913
4931
  shapeH: o,
4914
4932
  rotation: l,
4915
4933
  hyperlink: u.hyperlink
4916
- }), u.underline && Zt(t, H, x, N + p, b, u.underlineColor ?? u.color, u.underlineStyle, m.dpr), u.strikethrough) {
4934
+ }), u.underline && Zt(t, J, x, M + p, b, u.underlineColor ?? u.color, u.underlineStyle, m.dpr), u.strikethrough) {
4917
4935
  let n = Math.max(1, b * .05);
4918
4936
  t.strokeStyle = u.color, t.lineWidth = n, t.setLineDash([]);
4919
4937
  let r = x - b * .32;
4920
4938
  if (u.strikeDouble) {
4921
4939
  let i = n * .9, a = r - i, o = r + i;
4922
- t.beginPath(), t.moveTo(H, a + e(a, n, m.dpr)), t.lineTo(H + N + p, a + e(a, n, m.dpr)), t.moveTo(H, o + e(o, n, m.dpr)), t.lineTo(H + N + p, o + e(o, n, m.dpr)), t.stroke();
4940
+ t.beginPath(), t.moveTo(J, a + e(a, n, m.dpr)), t.lineTo(J + M + p, a + e(a, n, m.dpr)), t.moveTo(J, o + e(o, n, m.dpr)), t.lineTo(J + M + p, o + e(o, n, m.dpr)), t.stroke();
4923
4941
  } else {
4924
4942
  let i = r + e(r, n, m.dpr);
4925
- t.beginPath(), t.moveTo(H, i), t.lineTo(H + N + p, i), t.stroke();
4943
+ t.beginPath(), t.moveTo(J, i), t.lineTo(J + M + p, i), t.stroke();
4926
4944
  }
4927
4945
  }
4928
- H += N, H += p;
4946
+ J += M, J += p;
4929
4947
  }
4930
- M && (t.direction = "ltr"), V += d;
4948
+ N && (t.direction = "ltr"), H += d;
4931
4949
  }
4932
4950
  t.restore();
4933
4951
  }
@@ -5029,7 +5047,7 @@ function qr(e) {
5029
5047
  }
5030
5048
  function Jr(e, t, n = qr(t), r, i, a) {
5031
5049
  let o = qr(t);
5032
- return te(e.posterPath, e.posterMimeType || "application/octet-stream", o, {
5050
+ return q(e.posterPath, e.posterMimeType || "application/octet-stream", o, {
5033
5051
  tiff: r,
5034
5052
  svgDecoder: a,
5035
5053
  ...i ?? {}
@@ -5039,7 +5057,7 @@ function Jr(e, t, n = qr(t), r, i, a) {
5039
5057
  });
5040
5058
  }
5041
5059
  function Yr(e, t, n) {
5042
- let r = Y(t.x, n), i = Y(t.y, n), a = Y(t.width, n), o = Y(t.height, n);
5060
+ let r = X(t.x, n), i = X(t.y, n), a = X(t.width, n), o = X(t.height, n);
5043
5061
  e.save();
5044
5062
  try {
5045
5063
  t.alpha != null && (e.globalAlpha *= t.alpha), (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(r + a / 2, i + o / 2), e.rotate(t.rotation * Math.PI / 180), e.scale(t.flipH ? -1 : 1, t.flipV ? -1 : 1), e.translate(-(r + a / 2), -(i + o / 2))), le(e, "tiff", {
@@ -5052,107 +5070,107 @@ function Yr(e, t, n) {
5052
5070
  e.restore();
5053
5071
  }
5054
5072
  }
5055
- async function Xr(e, t, r, i, o, c, l = 1, u, d) {
5056
- if (o) try {
5057
- let a = t.mimeType === "image/svg+xml", f = Ne(t.mimeType, t.srcRect, t.width / J, t.height / J);
5058
- if (!f) return;
5059
- let { widthPt: p, heightPt: m } = f, h = En(Y(t.width, r), Y(t.height, r), l, t.srcRect), g = O(t) || a, _ = g ? h : d && !t.duotone ? Dn(d, X(On(t), g ? void 0 : t.duotone)) : void 0, v = _ && "maxRetainedPixels" in _ ? _.maxRetainedPixels : void 0, y = {
5060
- ..._ ? {
5061
- targetWidthPx: _.targetWidthPx,
5062
- targetHeightPx: _.targetHeightPx,
5063
- ...v === void 0 ? {} : { maxRetainedPixels: v }
5073
+ async function Xr(e, t, n, r, i, o, s = 1, c, l) {
5074
+ if (i) try {
5075
+ let a = t.mimeType === "image/svg+xml", u = Ne(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5076
+ if (!u) return;
5077
+ let { widthPt: d, heightPt: f } = u, p = En(X(t.width, n), X(t.height, n), s, t.srcRect), h = A(t) || a, g = h ? p : l && !t.duotone ? Dn(l, Z(On(t), h ? void 0 : t.duotone)) : void 0, _ = g && "maxRetainedPixels" in g ? g.maxRetainedPixels : void 0, y = {
5078
+ ...g ? {
5079
+ targetWidthPx: g.targetWidthPx,
5080
+ targetHeightPx: g.targetHeightPx,
5081
+ ..._ === void 0 ? {} : { maxRetainedPixels: _ }
5064
5082
  } : {},
5065
- workerDecoder: u
5083
+ workerDecoder: c
5066
5084
  }, b;
5067
- if (O(t)) try {
5068
- b = await N(t.svgImagePath, o, y);
5085
+ if (A(t)) try {
5086
+ b = await I(t.svgImagePath, i, y);
5069
5087
  } catch {
5070
- b = a ? await N(t.imagePath, o, y) : await Je(t.imagePath, t.mimeType, t.duotone, o, {
5071
- widthPt: p,
5072
- heightPt: m,
5073
- ..._ ?? {},
5074
- tiff: c
5088
+ b = a ? await I(t.imagePath, i, y) : await Je(t.imagePath, t.mimeType, t.duotone, i, {
5089
+ widthPt: d,
5090
+ heightPt: f,
5091
+ ...g ?? {},
5092
+ tiff: o
5075
5093
  });
5076
5094
  }
5077
- else b = a ? await N(t.imagePath, o, y) : await Je(t.imagePath, t.mimeType, t.duotone, o, {
5078
- widthPt: p,
5079
- heightPt: m,
5080
- ..._ ?? {},
5081
- tiff: c
5095
+ else b = a ? await I(t.imagePath, i, y) : await Je(t.imagePath, t.mimeType, t.duotone, i, {
5096
+ widthPt: d,
5097
+ heightPt: f,
5098
+ ...g ?? {},
5099
+ tiff: o
5082
5100
  });
5083
- if (!b || i()) return;
5101
+ if (!b || r()) return;
5084
5102
  e.save(), t.alpha != null && (e.globalAlpha *= t.alpha);
5085
- let x = Y(t.x, r), S = Y(t.y, r), C = Y(t.width, r), w = Y(t.height, r);
5103
+ let x = X(t.x, n), S = X(t.y, n), C = X(t.width, n), w = X(t.height, n);
5086
5104
  (t.rotation !== 0 || t.flipH || t.flipV) && (e.translate(x + C / 2, S + w / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(x + C / 2), -(S + w / 2)));
5087
5105
  let T = (e, n, r, i, a) => {
5088
- t.custGeom && t.custGeom.length > 0 ? Ir(e, t.custGeom, n, r, i, a) : t.prstGeom && s(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
5106
+ t.custGeom && t.custGeom.length > 0 ? Ir(e, t.custGeom, n, r, i, a) : t.prstGeom && v(e, t.prstGeom, n, r, i, a, t.prstAdjust ?? []) || e.rect(n, r, i, a);
5089
5107
  }, E = (e, t, n, r, i) => {
5090
5108
  e.beginPath(), T(e, t, n, r, i);
5091
5109
  }, D = (e, n, r, i, a) => {
5092
5110
  (t.prstGeom || t.custGeom && t.custGeom.length > 0) && (E(e, n, r, i, a), e.clip());
5093
- }, k = (e, n, i, a, o) => {
5094
- t.stroke && (e.save(), $r(e, t.stroke, r, {
5095
- x: n,
5111
+ }, O = (e, r, i, a, o) => {
5112
+ t.stroke && (e.save(), $r(e, t.stroke, n, {
5113
+ x: r,
5096
5114
  y: i,
5097
5115
  w: a,
5098
5116
  h: o
5099
- }, t.rotation), E(e, n, i, a, o), e.stroke(), e.restore());
5100
- }, A = (e, n, i, a, o) => {
5117
+ }, t.rotation), E(e, r, i, a, o), e.stroke(), e.restore());
5118
+ }, k = (e, r, i, a, o) => {
5101
5119
  let s = t.sp3d;
5102
5120
  if (s && (s.contourW ?? 0) > 0 && s.contourClr) {
5103
- let t = Math.max(.5, s.contourW * r);
5121
+ let t = Math.max(.5, s.contourW * n);
5104
5122
  e.save(), e.beginPath();
5105
5123
  let c = t * 2 + Math.max(a, o);
5106
- e.rect(n - c, i - c, a + 2 * c, o + 2 * c), T(e, n, i, a, o), e.clip("evenodd"), e.beginPath(), E(e, n, i, a, o), e.strokeStyle = Z(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
5124
+ e.rect(r - c, i - c, a + 2 * c, o + 2 * c), T(e, r, i, a, o), e.clip("evenodd"), e.beginPath(), E(e, r, i, a, o), e.strokeStyle = Q(s.contourClr), e.lineWidth = t * 2, e.setLineDash([]), e.stroke(), e.restore();
5107
5125
  }
5108
5126
  }, j = t.scene3d && Ct(t.scene3d.camera) ? t.scene3d : null, M = (e, n, r, i, a) => {
5109
5127
  e.save(), D(e, n, r, i, a), je(e, b, t.srcRect, n, r, i, a), e.restore();
5128
+ }, N = (e, t, n, r, i) => {
5129
+ M(e, t, n, r, i), O(e, t, n, r, i), k(e, t, n, r, i);
5110
5130
  }, P = (e, t, n, r, i) => {
5111
- M(e, t, n, r, i), k(e, t, n, r, i), A(e, t, n, r, i);
5112
- }, F = (e, t, n, r, i) => {
5113
- M(e, t, n, r, i), k(e, t, n, r, i);
5114
- }, I = e.getTransform(), L = Math.abs(I.a * I.d - I.b * I.c), R = L > 0 ? Math.sqrt(L) : 1, z = Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, r, R), B = j ? Ur(t.sp3d, j.camera, C, w, r, R) : null, V = t.stroke ? t.stroke.width * r / 2 : 0, U = t.sp3d?.contourW ? t.sp3d.contourW * r : 0, ee = B ? Math.hypot(B.offsetX, B.offsetY) / R : 0, W = V + U + ee + 2, te = (e) => {
5131
+ M(e, t, n, r, i), O(e, t, n, r, i);
5132
+ }, F = e.getTransform(), L = Math.abs(F.a * F.d - F.b * F.c), R = L > 0 ? Math.sqrt(L) : 1, z = Hr(t.sp3d, t.scene3d?.lightRig, t.sp3d ? t.sp3d.prstMaterial : void 0, n, R), B = j ? Ur(t.sp3d, j.camera, C, w, n, R) : null, V = t.stroke ? t.stroke.width * n / 2 : 0, H = t.sp3d?.contourW ? t.sp3d.contourW * n : 0, U = B ? Math.hypot(B.offsetX, B.offsetY) / R : 0, ee = V + H + U + 2, G = (e) => {
5115
5133
  if (j) {
5116
- if (Wr(e, j.camera, x, S, C, w, F, {
5134
+ if (Wr(e, j.camera, x, S, C, w, P, {
5117
5135
  bevels: z,
5118
5136
  extrusion: B ?? void 0,
5119
- paintEdges: A,
5120
- edgePadCss: W
5137
+ paintEdges: k,
5138
+ edgePadCss: ee
5121
5139
  })) return;
5122
- } else if (z.length > 0 && Gr(e, x, S, C, w, z, F, A, W)) return;
5123
- P(e, x, S, C, w);
5124
- }, G = (e, t, n, r, i, a) => {
5140
+ } else if (z.length > 0 && Gr(e, x, S, C, w, z, P, k, ee)) return;
5141
+ N(e, x, S, C, w);
5142
+ }, K = (e, t, n, r, i, a) => {
5125
5143
  e.save(), D(e, n, r, i, a), e.fillStyle = t, e.fillRect(n, r, i, a), e.restore();
5126
- }, K = (e, t) => {
5127
- j && Wr(e, j.camera, x, S, C, w, (e, n, r, i, a) => G(e, t, n, r, i, a)) || G(e, t, x, S, C, w);
5128
- }, q = e.getTransform(), ne = Math.abs(q.a * q.d - q.b * q.c), re = ne > 0 ? Math.sqrt(ne) : 1, ie = V + U, ae = (t.custGeom && t.custGeom.length > 0 ? he(t.custGeom, x, S, C, w) : t.prstGeom && H(t.prstGeom.toLowerCase()) ? n(t.prstGeom.toLowerCase(), x, S, C, w, t.prstAdjust ?? []) : null) ?? {
5144
+ }, q = (e, t) => {
5145
+ j && Wr(e, j.camera, x, S, C, w, (e, n, r, i, a) => K(e, t, n, r, i, a)) || K(e, t, x, S, C, w);
5146
+ }, J = e.getTransform(), te = Math.abs(J.a * J.d - J.b * J.c), ne = te > 0 ? Math.sqrt(te) : 1, re = V + H, ie = (t.custGeom && t.custGeom.length > 0 ? he(t.custGeom, x, S, C, w) : t.prstGeom && m(t.prstGeom.toLowerCase()) ? W(t.prstGeom.toLowerCase(), x, S, C, w, t.prstAdjust ?? []) : null) ?? {
5129
5147
  x,
5130
5148
  y: S,
5131
5149
  w: C,
5132
5150
  h: w
5133
- }, oe = j ? Mr(j.camera, q, x, S, C, w, W, t.shadow?.algn) : {
5134
- bbox: Or(q, ae.x - ie, ae.y - ie, ae.w + ie * 2, ae.h + ie * 2),
5135
- anchor: jr(q, x, S, C, w, t.shadow?.algn)
5136
- }, se = r * re, ce = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), le = (e) => K(e, "#000");
5137
- Pr(e, t, j && ce ? Nr(te, q, oe.bbox, {
5151
+ }, ae = j ? Mr(j.camera, J, x, S, C, w, ee, t.shadow?.algn) : {
5152
+ bbox: Or(J, ie.x - re, ie.y - re, ie.w + re * 2, ie.h + re * 2),
5153
+ anchor: jr(J, x, S, C, w, t.shadow?.algn)
5154
+ }, oe = n * ne, se = !!(t.shadow || t.innerShadow || t.glow || t.softEdge || t.reflection), ce = (e) => q(e, "#000");
5155
+ Pr(e, t, j && se ? Nr(G, J, ae.bbox, {
5138
5156
  w: e.canvas.width || 0,
5139
5157
  h: e.canvas.height || 0
5140
- }) : te, j && ce ? Nr(le, q, oe.bbox, {
5158
+ }) : G, j && se ? Nr(ce, J, ae.bbox, {
5141
5159
  w: e.canvas.width || 0,
5142
5160
  h: e.canvas.height || 0
5143
- }) : le, oe.bbox, oe.anchor, r, se, q), e.restore();
5144
- } catch (n) {
5145
- if (a(n, "tiff")) {
5146
- i() || Yr(e, t, r);
5161
+ }) : ce, ae.bbox, ae.anchor, n, oe, J), e.restore();
5162
+ } catch (i) {
5163
+ if (a(i, "tiff")) {
5164
+ r() || Yr(e, t, n);
5147
5165
  return;
5148
5166
  }
5149
- if (Le(n) || qe(n)) throw n;
5167
+ if (Le(i) || qe(i)) throw i;
5150
5168
  }
5151
5169
  }
5152
5170
  async function Zr(e, t, n, r, i, o, s, c, l = 1, u, d) {
5153
- let f = Y(t.x, n), p = Y(t.y, n), m = Y(t.width, n), h = Y(t.height, n), g, _ = !1;
5171
+ let f = X(t.x, n), p = X(t.y, n), m = X(t.width, n), h = X(t.height, n), g, _ = !1;
5154
5172
  if (t.posterPath && i) try {
5155
- g = await Jr(t, i, s, c, t.posterMimeType === "image/svg+xml" ? En(m, h, l) : d ? Dn(d, X(t.posterPath)) : void 0, u);
5173
+ g = await Jr(t, i, s, c, t.posterMimeType === "image/svg+xml" ? En(m, h, l) : d ? Dn(d, Z(t.posterPath)) : void 0, u);
5156
5174
  } catch (e) {
5157
5175
  if (a(e, "tiff")) _ = !0;
5158
5176
  else if (Le(e) || qe(e)) throw e;
@@ -5165,7 +5183,7 @@ async function Zr(e, t, n, r, i, o, s, c, l = 1, u, d) {
5165
5183
  })), o || an(e, f + m / 2, p + h / 2, m, h, "paused"), e.restore());
5166
5184
  }
5167
5185
  function Qr(e, t, n, r, i, a, o) {
5168
- let s = Math.max(.5, Y(r.width, a)), c = n.x - t.x, l = n.y - t.y, u = Math.hypot(c, l);
5186
+ let s = Math.max(.5, X(r.width, a)), c = n.x - t.x, l = n.y - t.y, u = Math.hypot(c, l);
5169
5187
  if (u === 0) return;
5170
5188
  let d = -l / u, f = c / u, p;
5171
5189
  switch (i) {
@@ -5214,7 +5232,7 @@ function Qr(e, t, n, r, i, a, o) {
5214
5232
  break;
5215
5233
  default: return;
5216
5234
  }
5217
- e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .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 = (r.fill ? Nn(r.fill, e, Math.min(t.x, n.x), Math.min(t.y, n.y), Math.max(1, Math.abs(n.x - t.x)), Math.max(1, Math.abs(n.y - t.y)), o) : null) ?? Z(r.color);
5235
+ e.save(), e.globalCompositeOperation = "destination-out", e.strokeStyle = "#000", e.lineWidth = s + .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 = (r.fill ? Nn(r.fill, e, Math.min(t.x, n.x), Math.min(t.y, n.y), Math.max(1, Math.abs(n.x - t.x)), Math.max(1, Math.abs(n.y - t.y)), o) : null) ?? Q(r.color);
5218
5236
  for (let r of p) {
5219
5237
  let i = d * (s * r.offset), a = f * (s * r.offset);
5220
5238
  e.lineWidth = Math.max(.5, s * r.widthFrac), e.beginPath(), e.moveTo(t.x + i, t.y + a), e.lineTo(n.x + i, n.y + a), e.stroke();
@@ -5229,7 +5247,7 @@ function $r(e, t, n, r, i = 0) {
5229
5247
  }
5230
5248
  function ei(e, t, n) {
5231
5249
  if (t.rotation === 0 && !t.flipH && !t.flipV) return;
5232
- let r = Y(t.x, n), i = Y(t.y, n), a = Y(t.width, n), o = Y(t.height, n);
5250
+ let r = X(t.x, n), i = X(t.y, n), a = X(t.width, n), o = X(t.height, n);
5233
5251
  e.translate(r + a / 2, i + o / 2), e.rotate(t.rotation * Math.PI / 180), t.flipH && e.scale(-1, 1), t.flipV && e.scale(1, -1), e.translate(-(r + a / 2), -(i + o / 2));
5234
5252
  }
5235
5253
  function ti(t, n, r, i, a = {
@@ -5238,11 +5256,11 @@ function ti(t, n, r, i, a = {
5238
5256
  dpr: 1
5239
5257
  }, o) {
5240
5258
  t.save(), ei(t, n, r);
5241
- let s = Y(n.x, r), c = Y(n.y, r), l = n.cols.map((e) => Y(e, r)), u = l.length, d = (e, t) => {
5259
+ let s = X(n.x, r), c = X(n.y, r), l = n.cols.map((e) => X(e, r)), u = l.length, d = (e, t) => {
5242
5260
  let n = 0;
5243
5261
  for (let r = 0; r < t; r++) n += l[e + r] ?? 0;
5244
5262
  return n;
5245
- }, f = n.rows.map((e) => Y(e.height, r));
5263
+ }, f = n.rows.map((e) => X(e.height, r));
5246
5264
  for (let e = 0; e < n.rows.length; e++) {
5247
5265
  let o = n.rows[e];
5248
5266
  for (let n = 0; n < o.cells.length; n++) {
@@ -5285,7 +5303,7 @@ function ti(t, n, r, i, a = {
5285
5303
  column: 0
5286
5304
  };
5287
5305
  if (o) {
5288
- let e = Y(n.width, r), t = Y(n.height, r), i = s + e / 2, a = c + t / 2, l = n.rotation * Math.PI / 180, u = Math.cos(l), d = Math.sin(l);
5306
+ let e = X(n.width, r), t = X(n.height, r), i = s + e / 2, a = c + t / 2, l = n.rotation * Math.PI / 180, u = Math.cos(l), d = Math.sin(l);
5289
5307
  _ = (e) => {
5290
5308
  let t = e.shapeX + e.shapeW / 2 - i, r = e.shapeY + e.shapeH / 2 - a;
5291
5309
  n.flipH && (t = -t), n.flipV && (r = -r);
@@ -5332,7 +5350,7 @@ function ti(t, n, r, i, a = {
5332
5350
  row: d,
5333
5351
  column: u
5334
5352
  });
5335
- let n = e.textColor ? Z(e.textColor) : null;
5353
+ let n = e.textColor ? Q(e.textColor) : null;
5336
5354
  Vr(t, e.textBody, o, s, c, l, r, n, 0, !1, !1, "#000000", i, a, _);
5337
5355
  }
5338
5356
  }
@@ -5347,7 +5365,7 @@ function ti(t, n, r, i, a = {
5347
5365
  w: Math.max(1, Math.abs(s - a)),
5348
5366
  h: Math.max(1, Math.abs(c - o))
5349
5367
  }, n.rotation), i.cmpd === "dbl" && !i.dashStyle && !i.customDash?.length && (a === s || o === c)) {
5350
- t.fillStyle = t.strokeStyle, xe(t, a, o, s, c, Math.max(.5, Y(i.width, r)), x);
5368
+ t.fillStyle = t.strokeStyle, xe(t, a, o, s, c, Math.max(.5, X(i.width, r)), x);
5351
5369
  return;
5352
5370
  }
5353
5371
  let l = a === s ? e(a, t.lineWidth, x) : 0, u = o === c ? e(o, t.lineWidth, x) : 0;
@@ -5433,10 +5451,10 @@ async function si(e, t, n, r, i = {}, a) {
5433
5451
  let o = i.fetchImage ?? (i.fetchMedia ? qr(i.fetchMedia) : void 0), s = (ri.get(e) ?? 0) + 1;
5434
5452
  ri.set(e, s);
5435
5453
  let c = () => ri.get(e) !== s, l = () => c() ? Promise.resolve(e) : ci(e, t, n, r, i, a, o, c);
5436
- return o && jn(t) ? k(o, i.imageResources, l) : l();
5454
+ return o && jn(t) ? j(o, i.imageResources, l) : l();
5437
5455
  }
5438
5456
  async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5439
- let l = i.width ?? ((oe(e) ? e.offsetWidth : 0) || 960), u = l / n, d = Math.round(l), f = Math.round(r * u), p = i.dpr ?? P(), m = Ve(d * p, f * p), h = m.clamped ? p * m.scale : p, g = await An(t, d, f, u, h, i.imageResources, i.fetchImage, i.fetchMedia, s, i.tiff);
5457
+ let l = i.width ?? ((oe(e) ? e.offsetWidth : 0) || 960), u = l / n, d = Math.round(l), f = Math.round(r * u), p = i.dpr ?? L(), m = Ve(d * p, f * p), h = m.clamped ? p * m.scale : p, g = await An(t, d, f, u, h, i.imageResources, i.fetchImage, i.fetchMedia, s, i.tiff);
5440
5458
  e.width = m.width, e.height = m.height, oe(e) && (e.style.width = `${d}px`, e.style.display || (e.style.display = "block"));
5441
5459
  let _ = e.getContext("2d");
5442
5460
  if (!_) throw Error("Could not get 2D context");
@@ -5454,7 +5472,7 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5454
5472
  if (await or(_, t.background, d, f, u, c, i.fetchImage, i.tiff, i.svgDecoder, g), c() || (i.math && await Ln(t, i.math), c())) return e;
5455
5473
  let x = t.slideNumber;
5456
5474
  for (let e of t.elements) if (e.type === "picture" && i.fetchImage) {
5457
- let t = e, n = t.mimeType === "image/svg+xml", r = O(t) || n, a = !r && !t.duotone ? Dn(g, X(On(t), t.duotone)) : void 0, o = En(Y(t.width, u), Y(t.height, u), h, t.srcRect), s = r ? o : a, c = s && "maxRetainedPixels" in s ? s.maxRetainedPixels : void 0, l = {
5475
+ let t = e, n = t.mimeType === "image/svg+xml", r = A(t) || n, a = !r && !t.duotone ? Dn(g, Z(On(t), t.duotone)) : void 0, o = En(X(t.width, u), X(t.height, u), h, t.srcRect), s = r ? o : a, c = s && "maxRetainedPixels" in s ? s.maxRetainedPixels : void 0, l = {
5458
5476
  ...s ? {
5459
5477
  targetWidthPx: s.targetWidthPx,
5460
5478
  targetHeightPx: s.targetHeightPx,
@@ -5462,10 +5480,10 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5462
5480
  } : {},
5463
5481
  workerDecoder: i.svgDecoder
5464
5482
  };
5465
- if (O(t)) N(t.svgImagePath, i.fetchImage, l).catch(() => void 0);
5466
- else if (n) N(t.imagePath, i.fetchImage, l).catch(() => void 0);
5483
+ if (A(t)) I(t.svgImagePath, i.fetchImage, l).catch(() => void 0);
5484
+ else if (n) I(t.imagePath, i.fetchImage, l).catch(() => void 0);
5467
5485
  else {
5468
- let e = Ne(t.mimeType, t.srcRect, t.width / J, t.height / J);
5486
+ let e = Ne(t.mimeType, t.srcRect, t.width / Y, t.height / Y);
5469
5487
  if (!e) continue;
5470
5488
  Je(t.imagePath, t.mimeType, t.duotone, i.fetchImage, {
5471
5489
  widthPt: e.widthPt,
@@ -5477,7 +5495,7 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5477
5495
  }
5478
5496
  } else if (e.type === "media") {
5479
5497
  let t = e;
5480
- t.posterPath && i.fetchMedia && Jr(t, i.fetchMedia, s, i.tiff, t.posterMimeType === "image/svg+xml" ? En(Y(t.width, u), Y(t.height, u), h) : Dn(g, X(t.posterPath)), i.svgDecoder).catch(() => void 0);
5498
+ t.posterPath && i.fetchMedia && Jr(t, i.fetchMedia, s, i.tiff, t.posterMimeType === "image/svg+xml" ? En(X(t.width, u), X(t.height, u), h) : Dn(g, Z(t.posterPath)), i.svgDecoder).catch(() => void 0);
5481
5499
  }
5482
5500
  let S = /* @__PURE__ */ new Map();
5483
5501
  if (i.fetchImage) {
@@ -5485,10 +5503,10 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5485
5503
  for (let e of t.elements) {
5486
5504
  if (e.type !== "chart" || !Number.isFinite(e.width) || e.width <= 0 || !Number.isFinite(e.height) || e.height <= 0) continue;
5487
5505
  let t = {
5488
- widthPt: e.width / J,
5489
- heightPt: e.height / J,
5490
- targetWidthPx: Y(e.width, u) * h,
5491
- targetHeightPx: Y(e.height, u) * h
5506
+ widthPt: e.width / Y,
5507
+ heightPt: e.height / Y,
5508
+ targetWidthPx: X(e.width, u) * h,
5509
+ targetHeightPx: X(e.height, u) * h
5492
5510
  }, n = [], r = !0;
5493
5511
  for (let i of Te(e.chart)) {
5494
5512
  let e = Ee(i, t);
@@ -5521,7 +5539,7 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5521
5539
  for (let { usages: e } of o) for (let { usage: t, size: n } of e) {
5522
5540
  let { fill: e } = t, r = Ie(e), i = s.get(r);
5523
5541
  if (!i) continue;
5524
- let a = i.preserveNaturalSize || t.preserveNaturalSize, o = i.hasSourceCrop || t.hasSourceCrop, c = a || e.duotone ? void 0 : Dn(g, X(e.imagePath, e.duotone)), l = !e.duotone && (e.mimeType === "image/svg+xml" || O({
5542
+ let a = i.preserveNaturalSize || t.preserveNaturalSize, o = i.hasSourceCrop || t.hasSourceCrop, c = a || e.duotone ? void 0 : Dn(g, Z(e.imagePath, e.duotone)), l = !e.duotone && (e.mimeType === "image/svg+xml" || A({
5525
5543
  svgImagePath: e.svgImagePath,
5526
5544
  srcRect: o ? !0 : null
5527
5545
  }));
@@ -5539,7 +5557,7 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5539
5557
  for (let e of t.elements) if (!(e.type !== "shape" || !e.textBody)) for (let t of e.textBody.paragraphs) {
5540
5558
  let n = Qe(t.bullet);
5541
5559
  if (n.type === "blip") {
5542
- let i = Zn(e.textBody, t, n) * J * u * h, a = r.get(n.imagePath);
5560
+ let i = Zn(e.textBody, t, n) * Y * u * h, a = r.get(n.imagePath);
5543
5561
  a ? Number.isFinite(i) && i > 0 && (a.targetHeightPx = Math.max(a.targetHeightPx ?? 0, i)) : r.set(n.imagePath, {
5544
5562
  mimeType: n.mimeType,
5545
5563
  ...Number.isFinite(i) && i > 0 ? { targetHeightPx: i } : {}
@@ -5552,10 +5570,10 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5552
5570
  let a = t === "image/svg+xml" ? r === void 0 ? {} : {
5553
5571
  targetWidthPx: 1,
5554
5572
  targetHeightPx: r
5555
- } : Dn(g, X(e)) ?? {}, o = t === "image/svg+xml" ? await N(e, n, {
5573
+ } : Dn(g, Z(e)) ?? {}, o = t === "image/svg+xml" ? await I(e, n, {
5556
5574
  ...a,
5557
5575
  workerDecoder: i.svgDecoder
5558
- }) : await te(e, t, n, {
5576
+ }) : await q(e, t, n, {
5559
5577
  tiff: i.tiff,
5560
5578
  ...a
5561
5579
  });
@@ -5575,7 +5593,7 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5575
5593
  ...u === void 0 ? {} : { maxRetainedPixels: u }
5576
5594
  } : void 0;
5577
5595
  try {
5578
- let t = () => r.mimeType === "image/svg+xml" ? r.duotone ? Promise.resolve(null) : N(r.imagePath, n, {
5596
+ let t = () => r.mimeType === "image/svg+xml" ? r.duotone ? Promise.resolve(null) : I(r.imagePath, n, {
5579
5597
  ...f ?? {},
5580
5598
  workerDecoder: i.svgDecoder
5581
5599
  }) : Je(r.imagePath, r.mimeType, r.duotone, n, {
@@ -5588,8 +5606,8 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5588
5606
  svgImagePath: r.svgImagePath,
5589
5607
  srcRect: d ? !0 : null
5590
5608
  };
5591
- if (!r.duotone && O(c)) try {
5592
- a = await N(c.svgImagePath, n, {
5609
+ if (!r.duotone && A(c)) try {
5610
+ a = await I(c.svgImagePath, n, {
5593
5611
  ...f ?? {},
5594
5612
  workerDecoder: i.svgDecoder
5595
5613
  });
@@ -5625,12 +5643,12 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5625
5643
  }) : void 0);
5626
5644
  else if (r.type === "media") await Zr(_, r, u, c, i.fetchMedia, i.skipMediaControls, i.fetchImage, i.tiff, h, i.svgDecoder, g);
5627
5645
  else if (r.type === "chart") {
5628
- let e = J * u;
5646
+ let e = Y * u;
5629
5647
  _.save(), ei(_, r, u), Ke(_, r.chart, {
5630
- x: Y(r.x, u),
5631
- y: Y(r.y, u),
5632
- w: Y(r.width, u),
5633
- h: Y(r.height, u)
5648
+ x: X(r.x, u),
5649
+ y: X(r.y, u),
5650
+ w: X(r.width, u),
5651
+ h: X(r.height, u)
5634
5652
  }, e, r.rotation, i.threeD, i.regionMap, (e) => S.get(Ie(e)), i.chartEx), _.restore();
5635
5653
  }
5636
5654
  }
@@ -5639,8 +5657,8 @@ async function ci(e, t, n, r, i = {}, o, s, c = () => !1) {
5639
5657
  //#endregion
5640
5658
  //#region packages/pptx/src/google-fonts.ts
5641
5659
  var li = {
5642
- ...C,
5643
- ...f
5660
+ ...T,
5661
+ ...b
5644
5662
  };
5645
5663
  function* ui(e) {
5646
5664
  for (let t of e?.paragraphs ?? []) for (let e of t.runs) e.type === "text" && (yield e.text);
@@ -5663,10 +5681,10 @@ function* fi(e) {
5663
5681
  var pi = class e {
5664
5682
  scripts;
5665
5683
  families;
5666
- constructor(e, t, n, i) {
5684
+ constructor(e, t, n, r) {
5667
5685
  this.majorFont = e, this.minorFont = t;
5668
- let a = r(e) ?? r(t) ?? null;
5669
- this.scripts = n ?? new y(a), this.families = i ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
5686
+ let i = w(e) ?? w(t) ?? null;
5687
+ this.scripts = n ?? new fe(i), this.families = r ?? /* @__PURE__ */ new Set(), e && this.families.add(e), t && this.families.add(t);
5670
5688
  }
5671
5689
  addSlide(e) {
5672
5690
  this.scripts.addText(fi(e));
@@ -5685,11 +5703,11 @@ var pi = class e {
5685
5703
  declaredInflatedBytes: 0,
5686
5704
  distinctInflatedBytes: 0,
5687
5705
  operationInflatedBytes: 0
5688
- }), hi = d;
5689
- function $(e, t) {
5706
+ }), hi = D;
5707
+ function gi(e, t) {
5690
5708
  if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation bootstrap ${t}`);
5691
5709
  }
5692
- function gi(e, t) {
5710
+ function _i(e, t) {
5693
5711
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap slide at ${t}`);
5694
5712
  let n = e;
5695
5713
  if (n.index !== t) throw Error(`invalid PPTX presentation bootstrap slide index ${n.index}`);
@@ -5699,7 +5717,7 @@ function gi(e, t) {
5699
5717
  ...n.partName === void 0 ? {} : { partName: n.partName }
5700
5718
  });
5701
5719
  }
5702
- function _i(e, t) {
5720
+ function vi(e, t) {
5703
5721
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation bootstrap embedded font at ${t}`);
5704
5722
  let n = e;
5705
5723
  if (typeof n.fontName != "string" || n.fontName.length === 0 || ![
@@ -5715,11 +5733,11 @@ function _i(e, t) {
5715
5733
  contentType: n.contentType
5716
5734
  });
5717
5735
  }
5718
- function vi(e) {
5736
+ function yi(e) {
5719
5737
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation bootstrap payload");
5720
5738
  let t = e;
5721
5739
  if (!Number.isSafeInteger(t.slideCount) || (t.slideCount ?? -1) < 0 || !Number.isSafeInteger(t.slideWidth) || (t.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(t.slideHeight) || (t.slideHeight ?? 0) <= 0 || !Array.isArray(t.embeddedFonts) || !Array.isArray(t.slides) || t.slides.length !== t.slideCount) throw Error("invalid PPTX presentation bootstrap dimensions or slide count");
5722
- return $(t.defaultTextColor, "defaultTextColor"), $(t.majorFont, "majorFont"), $(t.minorFont, "minorFont"), $(t.hlinkColor, "hlinkColor"), $(t.folHlinkColor, "folHlinkColor"), Object.freeze({
5740
+ return gi(t.defaultTextColor, "defaultTextColor"), gi(t.majorFont, "majorFont"), gi(t.minorFont, "minorFont"), gi(t.hlinkColor, "hlinkColor"), gi(t.folHlinkColor, "folHlinkColor"), Object.freeze({
5723
5741
  slideCount: t.slideCount,
5724
5742
  slideWidth: t.slideWidth,
5725
5743
  slideHeight: t.slideHeight,
@@ -5728,11 +5746,11 @@ function vi(e) {
5728
5746
  minorFont: t.minorFont,
5729
5747
  hlinkColor: t.hlinkColor,
5730
5748
  folHlinkColor: t.folHlinkColor,
5731
- embeddedFonts: Object.freeze(t.embeddedFonts.map(_i)),
5732
- slides: Object.freeze(t.slides.map(gi))
5749
+ embeddedFonts: Object.freeze(t.embeddedFonts.map(vi)),
5750
+ slides: Object.freeze(t.slides.map(_i))
5733
5751
  });
5734
5752
  }
5735
- function yi(e) {
5753
+ function bi(e) {
5736
5754
  return Object.freeze({
5737
5755
  type: "media",
5738
5756
  x: e.x,
@@ -5749,7 +5767,7 @@ function yi(e) {
5749
5767
  mimeType: e.mimeType
5750
5768
  });
5751
5769
  }
5752
- function bi(e) {
5770
+ function xi(e) {
5753
5771
  return Object.freeze({
5754
5772
  ...e.id === void 0 ? {} : { id: e.id },
5755
5773
  ...e.authorId === void 0 ? {} : { authorId: e.authorId },
@@ -5759,10 +5777,10 @@ function bi(e) {
5759
5777
  text: e.text
5760
5778
  });
5761
5779
  }
5762
- function xi(e) {
5780
+ function Si(e) {
5763
5781
  return Object.freeze({ ...e });
5764
5782
  }
5765
- function Si(e) {
5783
+ function Ci(e) {
5766
5784
  return Object.freeze({
5767
5785
  ...e.authorId === void 0 ? {} : { authorId: e.authorId },
5768
5786
  ...e.modernAuthorId === void 0 ? {} : { modernAuthorId: e.modernAuthorId },
@@ -5772,16 +5790,16 @@ function Si(e) {
5772
5790
  ...e.date === void 0 ? {} : { date: e.date },
5773
5791
  ...e.x === void 0 ? {} : { x: e.x },
5774
5792
  ...e.y === void 0 ? {} : { y: e.y },
5775
- ...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(xi)) } : {},
5793
+ ...e.anchors?.length ? { anchors: Object.freeze(e.anchors.map(Si)) } : {},
5776
5794
  ...e.status === void 0 ? {} : { status: e.status },
5777
5795
  text: e.text,
5778
- ...e.replies?.length ? { replies: Object.freeze(e.replies.map(bi)) } : {}
5796
+ ...e.replies?.length ? { replies: Object.freeze(e.replies.map(xi)) } : {}
5779
5797
  });
5780
5798
  }
5781
- function Ci(e, t, n) {
5799
+ function wi(e, t, n) {
5782
5800
  if (e !== void 0 && typeof e != "string") throw Error(`invalid PPTX presentation preflight comment ${t} at slide ${n}`);
5783
5801
  }
5784
- function wi(e, t) {
5802
+ function Ti(e, t) {
5785
5803
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment reply at slide ${t}`);
5786
5804
  let n = e;
5787
5805
  for (let e of [
@@ -5790,16 +5808,16 @@ function wi(e, t) {
5790
5808
  "author",
5791
5809
  "date",
5792
5810
  "status"
5793
- ]) Ci(n[e], e, t);
5811
+ ]) wi(n[e], e, t);
5794
5812
  if (typeof n.text != "string") throw Error(`invalid PPTX presentation preflight comment reply text at slide ${t}`);
5795
5813
  if (n.status !== void 0 && ![
5796
5814
  "active",
5797
5815
  "resolved",
5798
5816
  "closed"
5799
5817
  ].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment reply status at slide ${t}`);
5800
- return bi(n);
5818
+ return xi(n);
5801
5819
  }
5802
- function Ti(e, t) {
5820
+ function Ei(e, t) {
5803
5821
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment at slide ${t}`);
5804
5822
  let n = e;
5805
5823
  for (let e of [
@@ -5808,7 +5826,7 @@ function Ti(e, t) {
5808
5826
  "author",
5809
5827
  "date",
5810
5828
  "status"
5811
- ]) Ci(n[e], e, t);
5829
+ ]) wi(n[e], e, t);
5812
5830
  for (let e of [
5813
5831
  "authorId",
5814
5832
  "index",
@@ -5824,23 +5842,23 @@ function Ti(e, t) {
5824
5842
  "resolved",
5825
5843
  "closed"
5826
5844
  ].includes(n.status)) throw Error(`invalid PPTX presentation preflight comment status at slide ${t}`);
5827
- return Si({
5845
+ return Ci({
5828
5846
  ...n,
5829
- ...n.anchors?.length ? { anchors: n.anchors.map((e) => Ei(e, t)) } : {},
5830
- ...n.replies?.length ? { replies: n.replies.map((e) => wi(e, t)) } : {}
5847
+ ...n.anchors?.length ? { anchors: n.anchors.map((e) => Di(e, t)) } : {},
5848
+ ...n.replies?.length ? { replies: n.replies.map((e) => Ti(e, t)) } : {}
5831
5849
  });
5832
5850
  }
5833
- function Ei(e, t) {
5851
+ function Di(e, t) {
5834
5852
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight comment anchor at slide ${t}`);
5835
5853
  let n = e;
5836
5854
  if (n.type === "slide" || n.type === "unknown") return Object.freeze({ type: n.type });
5837
- if (n.type === "drawingElement") return Ci(n.elementId, "anchor.elementId", t), Ci(n.creationId, "anchor.creationId", t), Object.freeze({
5855
+ if (n.type === "drawingElement") return wi(n.elementId, "anchor.elementId", t), wi(n.creationId, "anchor.creationId", t), Object.freeze({
5838
5856
  type: "drawingElement",
5839
5857
  ...n.elementId === void 0 ? {} : { elementId: n.elementId },
5840
5858
  ...n.creationId === void 0 ? {} : { creationId: n.creationId }
5841
5859
  });
5842
5860
  if (n.type === "textRange") {
5843
- Ci(n.elementId, "anchor.elementId", t);
5861
+ wi(n.elementId, "anchor.elementId", t);
5844
5862
  for (let e of ["start", "length"]) {
5845
5863
  let r = n[e];
5846
5864
  if (r !== void 0 && (typeof r != "number" || !Number.isSafeInteger(r))) throw Error(`invalid PPTX presentation preflight comment anchor.${e} at slide ${t}`);
@@ -5854,7 +5872,7 @@ function Ei(e, t) {
5854
5872
  }
5855
5873
  throw Error(`invalid PPTX presentation preflight comment anchor type at slide ${t}`);
5856
5874
  }
5857
- function Di(e, t) {
5875
+ function Oi(e, t) {
5858
5876
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight media at slide ${t}`);
5859
5877
  let n = e;
5860
5878
  for (let e of [
@@ -5865,13 +5883,13 @@ function Di(e, t) {
5865
5883
  "rotation"
5866
5884
  ]) if (typeof n[e] != "number" || !Number.isFinite(n[e])) throw Error(`invalid PPTX presentation preflight media ${e} at slide ${t}`);
5867
5885
  if (n.type !== "media" || typeof n.flipH != "boolean" || typeof n.flipV != "boolean" || n.mediaKind !== "audio" && n.mediaKind !== "video" || typeof n.posterPath != "string" || typeof n.posterMimeType != "string" || typeof n.mediaPath != "string" || typeof n.mimeType != "string") throw Error(`invalid PPTX presentation preflight media fields at slide ${t}`);
5868
- return yi(n);
5886
+ return bi(n);
5869
5887
  }
5870
- function Oi(e, t) {
5888
+ function ki(e, t) {
5871
5889
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error("invalid PPTX presentation preflight payload");
5872
5890
  let n = e;
5873
5891
  if (!Number.isSafeInteger(n.slideCount) || (n.slideCount ?? -1) < 0 || !Number.isSafeInteger(n.slideWidth) || (n.slideWidth ?? 0) <= 0 || !Number.isSafeInteger(n.slideHeight) || (n.slideHeight ?? 0) <= 0 || !Array.isArray(n.embeddedFonts) || !Array.isArray(n.slides) || (t ? n.slides.length > (n.slideCount ?? -1) : n.slides.length !== n.slideCount) || !Array.isArray(n.fontPreloadNames)) throw Error("invalid PPTX presentation preflight dimensions or slide count");
5874
- $(n.defaultTextColor, "defaultTextColor"), $(n.majorFont, "majorFont"), $(n.minorFont, "minorFont"), $(n.hlinkColor, "hlinkColor"), $(n.folHlinkColor, "folHlinkColor");
5892
+ gi(n.defaultTextColor, "defaultTextColor"), gi(n.majorFont, "majorFont"), gi(n.minorFont, "minorFont"), gi(n.hlinkColor, "hlinkColor"), gi(n.folHlinkColor, "folHlinkColor");
5875
5893
  let r = n.slides.map((e, t) => {
5876
5894
  if (!e || typeof e != "object" || Array.isArray(e)) throw Error(`invalid PPTX presentation preflight slide at ${t}`);
5877
5895
  let n = e;
@@ -5881,8 +5899,8 @@ function Oi(e, t) {
5881
5899
  ...n.partName === void 0 ? {} : { partName: n.partName },
5882
5900
  notes: n.notes,
5883
5901
  hidden: n.hidden,
5884
- mediaElements: Object.freeze(n.mediaElements.map((e) => Di(e, t))),
5885
- ...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => Ti(e, t))) } : {}
5902
+ mediaElements: Object.freeze(n.mediaElements.map((e) => Oi(e, t))),
5903
+ ...n.comments?.length ? { comments: Object.freeze(n.comments.map((e) => Ei(e, t))) } : {}
5886
5904
  });
5887
5905
  }), i = n.fontPreloadNames.map((e, t) => {
5888
5906
  if (e !== null && typeof e != "string") throw Error(`invalid PPTX presentation preflight font at ${t}`);
@@ -5897,37 +5915,37 @@ function Oi(e, t) {
5897
5915
  minorFont: n.minorFont,
5898
5916
  hlinkColor: n.hlinkColor,
5899
5917
  folHlinkColor: n.folHlinkColor,
5900
- embeddedFonts: Object.freeze(n.embeddedFonts.map(_i)),
5918
+ embeddedFonts: Object.freeze(n.embeddedFonts.map(vi)),
5901
5919
  slides: Object.freeze(r),
5902
5920
  fontPreloadNames: Object.freeze(i)
5903
5921
  });
5904
5922
  }
5905
- function ki(e) {
5906
- return Oi(e, !1);
5907
- }
5908
5923
  function Ai(e) {
5909
- return Oi(e, !0);
5924
+ return ki(e, !1);
5925
+ }
5926
+ function ji(e) {
5927
+ return ki(e, !0);
5910
5928
  }
5911
- function ji(e, t) {
5929
+ function Mi(e, t) {
5912
5930
  for (let n of e.slides) for (let e of n.mediaElements) {
5913
5931
  if (e.mediaPath === t) return e.mimeType;
5914
5932
  if (e.posterPath === t) return e.posterMimeType;
5915
5933
  }
5916
5934
  return "";
5917
5935
  }
5918
- function Mi(e, t) {
5936
+ function Ni(e, t) {
5919
5937
  if (e.index !== t.index || e.partName !== t.partName) throw Error(`PPTX pulled slide identity does not match bootstrap index ${t.index}`);
5920
5938
  return Object.freeze({
5921
5939
  index: t.index,
5922
5940
  ...t.partName === void 0 ? {} : { partName: t.partName },
5923
5941
  notes: e.notes ?? null,
5924
5942
  hidden: e.hidden ?? !1,
5925
- mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map(yi)),
5926
- ...e.comments?.length ? { comments: Object.freeze(e.comments.map(Si)) } : {}
5943
+ mediaElements: Object.freeze(e.elements.filter((e) => e.type === "media").map(bi)),
5944
+ ...e.comments?.length ? { comments: Object.freeze(e.comments.map(Ci)) } : {}
5927
5945
  });
5928
5946
  }
5929
- function Ni(e, t, n) {
5930
- if (!(e <= t)) throw new ae(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
5947
+ function Pi(e, t, n) {
5948
+ if (!(e <= t)) throw new N(`PPTX presentation preflight exceeded its hard limit of ${t} projected bytes`, {
5931
5949
  stage: "parsing",
5932
5950
  violation: {
5933
5951
  format: "pptx",
@@ -5941,7 +5959,7 @@ function Ni(e, t, n) {
5941
5959
  }
5942
5960
  });
5943
5961
  }
5944
- var Pi = class {
5962
+ var Fi = class {
5945
5963
  slideCountValue;
5946
5964
  slideWidthValue;
5947
5965
  slideHeightValue;
@@ -5961,7 +5979,7 @@ var Pi = class {
5961
5979
  pending = null;
5962
5980
  finished = null;
5963
5981
  constructor(e, t = {}) {
5964
- let n = vi(e), r = t.hardLimitForTesting ?? hi;
5982
+ let n = yi(e), r = t.hardLimitForTesting ?? hi;
5965
5983
  if (!Number.isSafeInteger(r) || r <= 0 || r > hi) throw Error("invalid PPTX presentation preflight test limit");
5966
5984
  this.limit = r, this.slideCountValue = n.slideCount, this.slideWidthValue = n.slideWidth, this.slideHeightValue = n.slideHeight, this.defaultTextColorValue = n.defaultTextColor, this.majorFontValue = n.majorFont, this.minorFontValue = n.minorFont, this.hlinkColorValue = n.hlinkColor, this.folHlinkColorValue = n.folHlinkColor, this.embeddedFontsValue = n.embeddedFonts, this.descriptors = [...n.slides], this.fonts = new pi(this.majorFontValue, this.minorFontValue), this.fontPreloadNames = Object.freeze(this.fonts.names()), this.fontProjectionBytes = Xe(this.fontPreloadNames, this.limit).jsonBytes, this.projectionBytesValue = Xe({
5967
5985
  slideCount: this.slideCountValue,
@@ -5976,7 +5994,7 @@ var Pi = class {
5976
5994
  remainingSlides: this.descriptors,
5977
5995
  slides: [],
5978
5996
  fontPreloadNames: this.fontPreloadNames
5979
- }, this.limit).jsonBytes, Ni(this.projectionBytesValue, this.limit, mi);
5997
+ }, this.limit).jsonBytes, Pi(this.projectionBytesValue, this.limit, mi);
5980
5998
  }
5981
5999
  get acceptedSlideCount() {
5982
6000
  return this.finished?.slideCount ?? this.slides.length;
@@ -6018,13 +6036,13 @@ var Pi = class {
6018
6036
  if (this.pending) throw Error("PPTX presentation preflight already has a prepared slide");
6019
6037
  let n = this.slides.length, r = this.descriptors[n];
6020
6038
  if (!r) throw Error("PPTX presentation preflight received an extra slide");
6021
- let i = Mi(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Xe(o, this.limit).jsonBytes, c = Xe(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Xe(r, this.limit).jsonBytes + 4;
6039
+ let i = Ni(e, r), a = this.fonts.withSlide(e), o = Object.freeze(a.names()), s = Xe(o, this.limit).jsonBytes, c = Xe(i, this.limit).jsonBytes, l = this.projectionBytesValue - this.fontProjectionBytes - Xe(r, this.limit).jsonBytes + 4;
6022
6040
  l = Ze(l, s, this.limit), l = Ze(l, c, this.limit), this.slides.length !== 0 && (l = Ze(l, 1, this.limit));
6023
6041
  let u = Xe({
6024
6042
  slide: i,
6025
6043
  fontPreloadNames: o
6026
6044
  }, this.limit).jsonBytes, d = Ze(this.projectionBytesValue, u, this.limit);
6027
- Ni(Math.max(d, l), this.limit, t);
6045
+ Pi(Math.max(d, l), this.limit, t);
6028
6046
  let f = {
6029
6047
  state: "prepared",
6030
6048
  fact: i,
@@ -6069,7 +6087,7 @@ var Pi = class {
6069
6087
  fontPreloadNames: this.fontPreloadNames
6070
6088
  }), this.descriptors = [], this.slides = [], this.projectionBytesValue = Xe(this.finished, this.limit).jsonBytes, this.finished;
6071
6089
  }
6072
- }, Fi = 1024 * 1024, Ii = class {
6090
+ }, Ii = 1024 * 1024, Li = class {
6073
6091
  active = /* @__PURE__ */ new Set();
6074
6092
  nextSessionId = 1;
6075
6093
  constructor(e) {
@@ -6084,13 +6102,13 @@ var Pi = class {
6084
6102
  generation: this.options.generation ?? 1
6085
6103
  }, a = new h(this.options.transport, {
6086
6104
  ...i,
6087
- maxByteCredit: T,
6105
+ maxByteCredit: E,
6088
6106
  timeoutMs: n
6089
6107
  });
6090
6108
  this.active.add(a);
6091
6109
  try {
6092
6110
  await this.options.open(e, i, n);
6093
- let r = await Ri(a);
6111
+ let r = await zi(a);
6094
6112
  try {
6095
6113
  let e = r.usage ?? a.usageCheckpoint;
6096
6114
  e && this.options.onUsage?.(e);
@@ -6113,20 +6131,20 @@ var Pi = class {
6113
6131
  if (!Number.isSafeInteger(e) || e < 0 || e >= this.options.slideCount) throw RangeError(`Slide index ${e} out of range (count: ${this.options.slideCount})`);
6114
6132
  }
6115
6133
  };
6116
- function Li(e) {
6134
+ function Ri(e) {
6117
6135
  return !!e && typeof e == "object" && e.protocol === "ooxml-pull-v1";
6118
6136
  }
6119
- async function Ri(e) {
6137
+ async function zi(e) {
6120
6138
  try {
6121
- return await e.pull(Fi);
6139
+ return await e.pull(Ii);
6122
6140
  } catch (t) {
6123
- let n = zi(t);
6141
+ let n = Bi(t);
6124
6142
  if (n === void 0) throw t;
6125
6143
  return e.pull(n);
6126
6144
  }
6127
6145
  }
6128
- function zi(e) {
6129
- return u(e, Fi, T);
6146
+ function Bi(e) {
6147
+ return d(e, Ii, E);
6130
6148
  }
6131
6149
  //#endregion
6132
- export { vi as a, li as c, si as d, an as f, ji as i, ii as l, Li as n, ki as o, Pi as r, Ai as s, Ii as t, oi as u };
6150
+ export { yi as a, li as c, si as d, an as f, Mi as i, ii as l, Ri as n, Ai as o, Fi as r, ji as s, Li as t, oi as u };