@forevka/wordcanvas 0.7.2 → 0.7.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 (49) hide show
  1. package/dist-lib/assets/{worker-4HYrkNrG.js → worker-CqU4Popa.js} +399 -375
  2. package/dist-lib/assets/{worker-CJpwUzKh.js → worker-Cw5cYW5z.js} +359 -344
  3. package/dist-lib/{blockFactory-B_CLnkUh.js → blockFactory-DDCRWDnA.js} +16 -31
  4. package/dist-lib/browser-BUrsjziD.js +612 -0
  5. package/dist-lib/builder.js +16 -17
  6. package/dist-lib/editorApp-CB_ZArIF.js +9566 -0
  7. package/dist-lib/export.js +28 -28
  8. package/dist-lib/generate-toc.js +6 -6
  9. package/dist-lib/import.js +2 -2
  10. package/dist-lib/lists-DpmgbDyt.js +110 -0
  11. package/dist-lib/measure.js +2 -2
  12. package/dist-lib/{measureHost-B2aKX7lF.js → measureHost-BlukHGwx.js} +1 -1
  13. package/dist-lib/metrics-bvGO8KDK.js +96 -0
  14. package/dist-lib/paintStyle-vT6jtWbH.js +74 -0
  15. package/dist-lib/{pipeline-DD0nxAYM.js → pipeline-UryP-u7Z.js} +80 -80
  16. package/dist-lib/recalc-docx.js +2 -2
  17. package/dist-lib/{recalcToc-CFCGCgij.js → recalcToc-BfXlXZik.js} +3 -3
  18. package/dist-lib/{stylesheet-B6oczA-L.js → stylesheet-LTBEGkvG.js} +32 -27
  19. package/dist-lib/toc-D09f4PrI.js +939 -0
  20. package/dist-lib/{webmcp-CXghUon_.js → webmcp-K6UZgQJ0.js} +60 -68
  21. package/dist-lib/wordcanvas-DBx2ana_.js +734 -0
  22. package/dist-lib/wordcanvas.js +4 -2
  23. package/dist-node/{chunk-PIMVQULL.js → chunk-373K2XRY.js} +34 -22
  24. package/dist-node/chunk-373K2XRY.js.map +7 -0
  25. package/dist-node/{chunk-57L5XMCL.js → chunk-3PUV3BG6.js} +2 -2
  26. package/dist-node/{chunk-U27EBKBG.js → chunk-5RX3IHWE.js} +3 -3
  27. package/dist-node/chunk-5RX3IHWE.js.map +7 -0
  28. package/dist-node/{chunk-SA26UVIJ.js → chunk-HWQKGDS2.js} +2 -2
  29. package/dist-node/{chunk-T3253N22.js → chunk-ZLLSXOO2.js} +3 -3
  30. package/dist-node/{engine-5F7DUU4W.js → engine-LLA6PCS5.js} +4 -4
  31. package/dist-node/export.js +5 -5
  32. package/dist-node/generate-toc.js +4 -4
  33. package/dist-node/import.js +2 -2
  34. package/dist-node/measure.js +2 -2
  35. package/dist-node/recalc-docx.js +3 -3
  36. package/package.json +1 -1
  37. package/types/wordcanvas.d.ts +649 -212
  38. package/dist-lib/browser-p_rkUcqE.js +0 -1339
  39. package/dist-lib/editorApp-mTD0YNv-.js +0 -9863
  40. package/dist-lib/lists-Sc5I40JO.js +0 -110
  41. package/dist-lib/metrics-BUMIC9Mv.js +0 -164
  42. package/dist-lib/toc-Dj57zdz-.js +0 -213
  43. package/dist-lib/wordcanvas-D5DI9ZR1.js +0 -151
  44. package/dist-node/chunk-PIMVQULL.js.map +0 -7
  45. package/dist-node/chunk-U27EBKBG.js.map +0 -7
  46. /package/dist-node/{chunk-57L5XMCL.js.map → chunk-3PUV3BG6.js.map} +0 -0
  47. /package/dist-node/{chunk-SA26UVIJ.js.map → chunk-HWQKGDS2.js.map} +0 -0
  48. /package/dist-node/{chunk-T3253N22.js.map → chunk-ZLLSXOO2.js.map} +0 -0
  49. /package/dist-node/{engine-5F7DUU4W.js.map → engine-LLA6PCS5.js.map} +0 -0
@@ -1,12 +1,12 @@
1
1
  import { B as $e } from "./index-6mKfgpcs.js";
2
- import { c as Tt, g as Rr, a as El, $ as Al, b as Ta, i as wf, r as Tl } from "./measureHost-B2aKX7lF.js";
2
+ import { c as Tt, g as Rr, a as El, $ as Al, b as Ta, i as wf, r as Tl } from "./measureHost-BlukHGwx.js";
3
3
  import { _ as Rl, f as tt } from "./__vite-browser-external-BYRIRx8p.js";
4
- import { t as Pl, s as Ol, z as Cl } from "./browser-p_rkUcqE.js";
5
- import { d as Fl, p as Il, i as kl } from "./toc-Dj57zdz-.js";
6
- import { n as Ra, T as Pa, a as Bl, b as Oa, l as Ml, c as Ll, I as Dl, D as Nl, v as jl, S as Ul, r as zl, d as ql, U as $l, s as Wl, e as Hl, f as Gl, g as Zl, p as Xl, C as Kl, F as Vl, h as Yl } from "./metrics-BUMIC9Mv.js";
4
+ import { d as Pl, t as Ol, p as Cl, i as Fl } from "./toc-D09f4PrI.js";
5
+ import { n as Ra, T as Pa, a as Il, b as Oa, l as kl, c as Bl, I as Ml, D as Ll, v as Dl, S as Nl, r as jl, d as Ul, U as zl, s as ql, e as $l, f as Wl, g as Hl, p as Gl, C as Zl, F as Xl, h as Kl } from "./paintStyle-vT6jtWbH.js";
6
+ import { s as Vl, z as Yl } from "./browser-BUrsjziD.js";
7
7
  import { e as ie, X as Rt, h as Pr, W as Yt, r as Or, p as nt, a as Jl, t as _f, b as Ql, c as fr, d as vf, f as Sf, g as ec, i as tc } from "./styleProps-DhqDEfvc.js";
8
- import { a as rc } from "./stylesheet-B6oczA-L.js";
9
- import { p as nc, c as ic } from "./recalcToc-CFCGCgij.js";
8
+ import { a as rc } from "./stylesheet-LTBEGkvG.js";
9
+ import { p as nc, c as ic } from "./recalcToc-BfXlXZik.js";
10
10
  var lr = { exports: {} }, Ca;
11
11
  function oa() {
12
12
  if (Ca) return lr.exports;
@@ -13889,7 +13889,7 @@ function vr(e, t) {
13889
13889
  const o = t.y + i.y + i.ascent, s = t.toc.style, f = Ra(s.color), d = e.font(na(s.fontFamily), !!s.bold, !!s.italic);
13890
13890
  n.font(d).fontSize(s.fontSizePx).fillColor(f).text(t.toc.numText, t.toc.numX, o, { lineBreak: !1, baseline: "alphabetic" });
13891
13891
  const p = i.fragments[i.fragments.length - 1], h = t.x + (p ? p.x + p.width : 0) + Pa, m = t.toc.numX - Pa;
13892
- m > h && (n.save(), n.lineWidth(1).strokeColor(Bl).dash(Oa[0], { space: Oa[1] }), n.moveTo(h, o).lineTo(m, o).stroke(), n.undash().restore());
13892
+ m > h && (n.save(), n.lineWidth(1).strokeColor(Il).dash(Oa[0], { space: Oa[1] }), n.moveTo(h, o).lineTo(m, o).stroke(), n.undash().restore());
13893
13893
  }
13894
13894
  const a = e.destName?.({ blockId: t.toc.targetId });
13895
13895
  if (a)
@@ -13902,8 +13902,8 @@ function vr(e, t) {
13902
13902
  const a = t.y + i.y + i.ascent;
13903
13903
  if (i.leaders)
13904
13904
  for (const o of i.leaders) {
13905
- n.save(), n.lineWidth(Ml(o.fontSizePx)).strokeColor(Ra(o.color));
13906
- const s = Ll(o.kind);
13905
+ n.save(), n.lineWidth(kl(o.fontSizePx)).strokeColor(Ra(o.color));
13906
+ const s = Bl(o.kind);
13907
13907
  s.length && n.dash(s[0], { space: s[1] }), n.moveTo(t.x + o.x1, a).lineTo(t.x + o.x2, a).stroke(), n.undash().restore();
13908
13908
  }
13909
13909
  ld(e, t, i, a);
@@ -13913,16 +13913,16 @@ function ld(e, t, n, r) {
13913
13913
  const { doc: i } = e;
13914
13914
  for (const a of n.fragments) {
13915
13915
  if (a.text.length === 0) continue;
13916
- const o = a.style, s = t.x + a.x, f = jl(o.verticalAlign, o.fontSizePx), d = o.verticalAlign ? Math.round(o.fontSizePx * Ul) : o.fontSizePx;
13916
+ const o = a.style, s = t.x + a.x, f = Dl(o.verticalAlign, o.fontSizePx), d = o.verticalAlign ? Math.round(o.fontSizePx * Nl) : o.fontSizePx;
13917
13917
  o.highlightColor && i.rect(s, t.y + n.y, a.width, n.height).fill(o.highlightColor);
13918
- const p = zl(o), h = e.font(na(o.fontFamily), !!o.bold, !!o.italic);
13918
+ const p = jl(o), h = e.font(na(o.fontFamily), !!o.bold, !!o.italic);
13919
13919
  i.font(h).fontSize(d).fillColor(p.color).text(a.text, s, r + f, {
13920
13920
  lineBreak: !1,
13921
13921
  baseline: "alphabetic",
13922
13922
  wordSpacing: a.wordSpacingPx ?? 0
13923
13923
  });
13924
- const m = ql(o.fontSizePx);
13925
- if (p.underline && i.rect(s, r + f + $l, a.width, m).fill(p.color), p.strike && i.rect(s, r + f + Wl(o.fontSizePx), a.width, m).fill(p.color), p.externalLink && o.link)
13924
+ const m = Ul(o.fontSizePx);
13925
+ if (p.underline && i.rect(s, r + f + zl, a.width, m).fill(p.color), p.strike && i.rect(s, r + f + ql(o.fontSizePx), a.width, m).fill(p.color), p.externalLink && o.link)
13926
13926
  i.link(s, t.y + n.y, a.width, n.height, o.link);
13927
13927
  else if (o.link && o.link.startsWith("#")) {
13928
13928
  const L = e.destName?.({ anchor: o.link.slice(1) });
@@ -13931,7 +13931,7 @@ function ld(e, t, n, r) {
13931
13931
  }
13932
13932
  }
13933
13933
  function df(e, t, n, r, i) {
13934
- e.doc.rect(t, n, r, i).fill(Dl);
13934
+ e.doc.rect(t, n, r, i).fill(Ml);
13935
13935
  }
13936
13936
  function cd(e, t, n, r, i, a) {
13937
13937
  const o = ud(t);
@@ -13960,7 +13960,7 @@ function ud(e) {
13960
13960
  function hd(e, t) {
13961
13961
  const { doc: n } = e, { x: r, y: i, width: a, height: o } = t;
13962
13962
  if (t.borders === void 0) {
13963
- n.undash().lineWidth(1).strokeColor(Nl), n.rect(r + 0.5, i + 0.5, a, o).stroke();
13963
+ n.undash().lineWidth(1).strokeColor(Ll), n.rect(r + 0.5, i + 0.5, a, o).stroke();
13964
13964
  return;
13965
13965
  }
13966
13966
  const s = t.borders;
@@ -13968,15 +13968,15 @@ function hd(e, t) {
13968
13968
  }
13969
13969
  function pr(e, t, n, r, i, a, o, s) {
13970
13970
  if (!t) return;
13971
- const { doc: f } = e, d = Hl(t.widthPx);
13971
+ const { doc: f } = e, d = $l(t.widthPx);
13972
13972
  f.lineWidth(d).strokeColor(t.color);
13973
- const p = Gl(t.style, d);
13973
+ const p = Wl(t.style, d);
13974
13974
  p.length ? f.dash(p[0], { space: p[1] }) : f.undash();
13975
13975
  const h = r === a, m = Math.round(d) % 2 ? 0.5 : 0, L = h ? 0 : m, k = h ? m : 0, q = (U, y) => {
13976
13976
  f.moveTo(n + L + U, r + k + y).lineTo(i + L + U, a + k + y).stroke();
13977
13977
  };
13978
13978
  if (q(0, 0), t.style === "double") {
13979
- const U = Zl(d);
13979
+ const U = Hl(d);
13980
13980
  q(o * U, s * U);
13981
13981
  }
13982
13982
  f.undash();
@@ -13987,7 +13987,7 @@ function dd(e) {
13987
13987
  const nr = 72 / 96;
13988
13988
  async function pd(e, t = {}) {
13989
13989
  await wf();
13990
- const { createLayoutEngine: n } = await import("./recalcToc-CFCGCgij.js").then((y) => y.e), r = n().layout(e), i = new ml(), a = t.images ?? {}, o = new jr({ autoFirstPage: !1, compress: !0, font: !1 }), s = xd(o), f = /* @__PURE__ */ new Set(), d = (y, x, v) => {
13990
+ const { createLayoutEngine: n } = await import("./recalcToc-BfXlXZik.js").then((y) => y.e), r = n().layout(e), i = new ml(), a = t.images ?? {}, o = new jr({ autoFirstPage: !1, compress: !0, font: !1 }), s = xd(o), f = /* @__PURE__ */ new Set(), d = (y, x, v) => {
13991
13991
  const E = Tl(y, x, v);
13992
13992
  return f.has(E.file) || (o.registerFont(E.file, yd(E.bytes)), f.add(E.file), E.substituted && i.warn("font-substituted", y)), E.file;
13993
13993
  }, p = /* @__PURE__ */ new Set();
@@ -14021,19 +14021,19 @@ async function pd(e, t = {}) {
14021
14021
  for (const x of k.get(y.index) ?? [])
14022
14022
  o.addNamedDestination(x.name, "XYZ", null, x.y * nr, null);
14023
14023
  if (o.save(), o.scale(nr), o.rect(0, 0, y.widthPx, y.heightPx).fill(y.pageColorHex ?? "#ffffff"), y.pageBorders) {
14024
- for (const x of Xl(y.pageBorders, y.widthPx, y.heightPx, y.marginPx))
14024
+ for (const x of Gl(y.pageBorders, y.widthPx, y.heightPx, y.marginPx))
14025
14025
  o.lineWidth(x.widthPx).strokeColor(x.color), x.dash.length ? o.dash(x.dash[0], { space: x.dash[1] ?? x.dash[0] }) : o.undash(), o.moveTo(x.x1, x.y1).lineTo(x.x2, x.y2).stroke();
14026
14026
  o.undash();
14027
14027
  }
14028
14028
  for (const x of y.blocks) vr(q, x);
14029
14029
  if (y.columnSeparatorsX) {
14030
- o.undash().lineWidth(1).strokeColor(Kl);
14030
+ o.undash().lineWidth(1).strokeColor(Zl);
14031
14031
  for (const x of y.columnSeparatorsX)
14032
14032
  o.moveTo(x + 0.5, y.contentTopPx).lineTo(x + 0.5, y.contentBottomPx).stroke();
14033
14033
  }
14034
14034
  if (y.footnoteRuleY !== void 0) {
14035
14035
  const x = y.widthPx - y.marginPx.left - y.marginPx.right;
14036
- o.undash().lineWidth(1).strokeColor(Vl), o.moveTo(y.marginPx.left, y.footnoteRuleY + 0.5).lineTo(y.marginPx.left + x * Yl, y.footnoteRuleY + 0.5).stroke();
14036
+ o.undash().lineWidth(1).strokeColor(Xl), o.moveTo(y.marginPx.left, y.footnoteRuleY + 0.5).lineTo(y.marginPx.left + x * Kl, y.footnoteRuleY + 0.5).stroke();
14037
14037
  }
14038
14038
  if (y.header) for (const x of y.header) vr(q, x);
14039
14039
  if (y.footer) for (const x of y.footer) vr(q, x);
@@ -14042,14 +14042,14 @@ async function pd(e, t = {}) {
14042
14042
  return gd(o, e, h), o.end(), { bytes: await s, warnings: i.list() };
14043
14043
  }
14044
14044
  function gd(e, t, n) {
14045
- const r = Fl(t, void 0, 9);
14045
+ const r = Pl(t, void 0, 9);
14046
14046
  if (r.length === 0) return;
14047
14047
  const i = [];
14048
14048
  for (const { block: a, level: o } of r) {
14049
14049
  const s = n.get(a.id);
14050
14050
  if (!s) continue;
14051
14051
  for (; i.length > 0 && i[i.length - 1].level >= o; ) i.pop();
14052
- const f = i.length > 0 ? i[i.length - 1].item : e.outline, d = Pl(a.runs).trim() || "(untitled)", p = { pageNumber: s.pageIndex, top: s.y * nr, fit: !1, expanded: !0 }, h = f.addItem(d, p);
14052
+ const f = i.length > 0 ? i[i.length - 1].item : e.outline, d = Ol(a.runs).trim() || "(untitled)", p = { pageNumber: s.pageIndex, top: s.y * nr, fit: !1, expanded: !0 }, h = f.addItem(d, p);
14053
14053
  i.push({ level: o, item: h });
14054
14054
  }
14055
14055
  }
@@ -14305,9 +14305,9 @@ function Td(e, t, n) {
14305
14305
  }
14306
14306
  const bf = (e) => e.kind === "paragraph" && !!e.style.tocEntry;
14307
14307
  function Rd(e, t) {
14308
- const n = t.tocInstruction ?? ' TOC \\o "1-3" \\h \\z \\u ', r = Il(n), i = r.hyperlinks || t.tocInstruction === void 0;
14308
+ const n = t.tocInstruction ?? ' TOC \\o "1-3" \\h \\z \\u ', r = Cl(n), i = r.hyperlinks || t.tocInstruction === void 0;
14309
14309
  return e.map((a, o) => {
14310
- const s = a.runs[0] ? Or(a.runs[0].style) : "", f = a.style.tocEntry.targetId, d = a.style.tocEntry.level, p = !kl(r.hidePageNumberRange, d), h = p || i ? t.ensureTocBookmark?.(f) : void 0;
14310
+ const s = a.runs[0] ? Or(a.runs[0].style) : "", f = a.style.tocEntry.targetId, d = a.style.tocEntry.level, p = !Fl(r.hidePageNumberRange, d), h = p || i ? t.ensureTocBookmark?.(f) : void 0;
14311
14311
  let m = "";
14312
14312
  o === 0 && (m += ft("begin") + Ur(n) + ft("separate"));
14313
14313
  let L = ia(a.runs, t);
@@ -14635,8 +14635,8 @@ function qd(e, t = {}, n) {
14635
14635
  );
14636
14636
  const me = {};
14637
14637
  for (const [w, O] of Object.entries(i))
14638
- me[w] = typeof O == "string" ? Ol(O) : O;
14639
- return { bytes: Cl(me), warnings: r.list() };
14638
+ me[w] = typeof O == "string" ? Vl(O) : O;
14639
+ return { bytes: Yl(me), warnings: r.list() };
14640
14640
  }
14641
14641
  function $d(e) {
14642
14642
  const t = e.section;
@@ -1,8 +1,8 @@
1
- import { u as G, a as C, t as H, s as R, z as M } from "./browser-p_rkUcqE.js";
2
- import { p as K, d as q, i as J, t as Q } from "./toc-Dj57zdz-.js";
1
+ import { u as G, a as C, s as R, z as M } from "./browser-BUrsjziD.js";
2
+ import { p as H, d as K, t as q, i as J, a as Q } from "./toc-D09f4PrI.js";
3
3
  import { f as V } from "./contentTypes-f7VddqoF.js";
4
- import { r as N } from "./pipeline-DD0nxAYM.js";
5
- import { p as Y, c as Z } from "./recalcToc-CFCGCgij.js";
4
+ import { r as N } from "./pipeline-UryP-u7Z.js";
5
+ import { p as Y, c as Z } from "./recalcToc-BfXlXZik.js";
6
6
  import { e as d, r as tt, b as et, t as T, a as nt } from "./styleProps-DhqDEfvc.js";
7
7
  const b = (t) => d("w:r", void 0, d("w:fldChar", { "w:fldCharType": t })), j = (t) => d("w:r", void 0, d("w:instrText", { "xml:space": "preserve" }, nt(t)));
8
8
  function st(t, a, r) {
@@ -73,7 +73,7 @@ function ut(t, a = {}) {
73
73
  if (!i) return { bytes: t, generated: 0, headings: 0, bookmarksSynthesized: 0 };
74
74
  const c = C(i), o = ot(c);
75
75
  if (!o) return { bytes: t, generated: 0, headings: 0, bookmarksSynthesized: 0 };
76
- const p = K(o.instr), s = N(t).doc, g = p.outlineRange?.to ?? a.maxLevel ?? 3, u = q(s, p, g), x = s.section.pageWidthPx - s.section.marginPx.left - s.section.marginPx.right, y = a.hyperlink ?? p.hyperlinks, v = a.includePageNumbers ?? !0, h = /* @__PURE__ */ new Map();
76
+ const p = H(o.instr), s = N(t).doc, g = p.outlineRange?.to ?? a.maxLevel ?? 3, u = K(s, p, g), x = s.section.pageWidthPx - s.section.marginPx.left - s.section.marginPx.right, y = a.hyperlink ?? p.hyperlinks, v = a.includePageNumbers ?? !0, h = /* @__PURE__ */ new Map();
77
77
  for (const [e, m] of Object.entries(s.bookmarks ?? {})) {
78
78
  const f = h.get(m.start.blockId);
79
79
  (!f || !f.startsWith("_Toc") && e.startsWith("_Toc")) && h.set(m.start.blockId, e);
@@ -83,7 +83,7 @@ function ut(t, a = {}) {
83
83
  const S = /* @__PURE__ */ new Map();
84
84
  let F = 9e5, L = 0;
85
85
  const w = u.map((e, m) => {
86
- const f = H(e.block.runs).replace(/\v/g, " ").trim(), z = v && !J(p.hidePageNumberRange, e.level);
86
+ const f = q(e.block.runs).replace(/\v/g, " ").trim(), z = v && !J(p.hidePageNumberRange, e.level);
87
87
  let k;
88
88
  return (z || y) && (k = h.get(e.block.id), k || (k = `_CwToc${L++}`, S.set(m, { name: k, id: F++ }))), { label: f, level: e.level, anchor: k, numText: z ? "1" : "" };
89
89
  }).filter((e) => e.label.length > 0);
@@ -1,6 +1,6 @@
1
- import "./toc-Dj57zdz-.js";
1
+ import "./toc-D09f4PrI.js";
2
2
  import "./contentTypes-f7VddqoF.js";
3
- import { r as t } from "./pipeline-DD0nxAYM.js";
3
+ import { r as t } from "./pipeline-UryP-u7Z.js";
4
4
  export {
5
5
  t as runImport
6
6
  };
@@ -0,0 +1,110 @@
1
+ const T = [
2
+ [1e3, "m"],
3
+ [900, "cm"],
4
+ [500, "d"],
5
+ [400, "cd"],
6
+ [100, "c"],
7
+ [90, "xc"],
8
+ [50, "l"],
9
+ [40, "xl"],
10
+ [10, "x"],
11
+ [9, "ix"],
12
+ [5, "v"],
13
+ [4, "iv"],
14
+ [1, "i"]
15
+ ];
16
+ function u(t) {
17
+ let n = "", e = Math.max(1, t);
18
+ for (const [r, l] of T)
19
+ for (; e >= r; )
20
+ n += l, e -= r;
21
+ return n;
22
+ }
23
+ function c(t) {
24
+ let n = "", e = Math.max(1, t);
25
+ for (; e > 0; )
26
+ e -= 1, n = String.fromCharCode(97 + e % 26) + n, e = Math.floor(e / 26);
27
+ return n;
28
+ }
29
+ function E(t, n) {
30
+ switch (n) {
31
+ case "decimal":
32
+ return String(t);
33
+ case "lowerLetter":
34
+ return c(t);
35
+ case "upperLetter":
36
+ return c(t).toUpperCase();
37
+ case "lowerRoman":
38
+ return u(t);
39
+ case "upperRoman":
40
+ return u(t).toUpperCase();
41
+ case "bullet":
42
+ return "";
43
+ }
44
+ }
45
+ function d(t, n, e) {
46
+ const r = t.levels[Math.min(n, t.levels.length - 1)];
47
+ return r ? r.format === "bullet" ? r.bulletChar ?? _ : r.text.replace(/%(\d)/g, (l, v) => {
48
+ const a = Number(v) - 1, i = t.levels[Math.min(a, t.levels.length - 1)], g = e[a] ?? i?.start ?? 1;
49
+ return E(g, i?.format ?? "decimal");
50
+ }) : "";
51
+ }
52
+ const b = "bullets", p = "numbers", P = "multilevel", s = 9, m = 24, h = 18, x = 22, _ = "•", L = [_, "◦", "▪"], f = ["decimal", "lowerLetter", "lowerRoman"], o = (t) => m * (t + 1);
53
+ function U(t) {
54
+ const n = [];
55
+ for (let e = 0; e < s; e++)
56
+ t === "bullet" ? n.push({
57
+ format: "bullet",
58
+ text: "",
59
+ bulletChar: L[e % L.length],
60
+ indentLeftPx: o(e),
61
+ hangingPx: h,
62
+ start: 1
63
+ }) : n.push({
64
+ format: f[e % f.length],
65
+ text: `%${e + 1}.`,
66
+ indentLeftPx: o(e),
67
+ hangingPx: x,
68
+ start: 1
69
+ });
70
+ return { id: t === "bullet" ? b : p, levels: n };
71
+ }
72
+ function D(t, n) {
73
+ const e = [];
74
+ for (let r = 0; r < s; r++)
75
+ e.push({ format: "bullet", text: "", bulletChar: n, indentLeftPx: o(r), hangingPx: h, start: 1 });
76
+ return { id: t, levels: e };
77
+ }
78
+ function I(t, n, e) {
79
+ const r = [];
80
+ for (let l = 0; l < s; l++)
81
+ r.push({ format: n, text: `%${l + 1}${e}`, indentLeftPx: o(l), hangingPx: x, start: 1 });
82
+ return { id: t, levels: r };
83
+ }
84
+ function N() {
85
+ const t = [];
86
+ for (let n = 0; n < s; n++) {
87
+ const e = Array.from({ length: n + 1 }, (r, l) => `%${l + 1}`).join(".") + ".";
88
+ t.push({
89
+ format: "decimal",
90
+ text: e,
91
+ // "%1.", "%1.%2.", "%1.%2.%3.", …
92
+ indentLeftPx: o(n),
93
+ hangingPx: m + n * 8,
94
+ // compound markers widen with depth
95
+ start: 1
96
+ });
97
+ }
98
+ return { id: P, levels: t };
99
+ }
100
+ export {
101
+ p as D,
102
+ b as a,
103
+ D as b,
104
+ P as c,
105
+ U as d,
106
+ d as e,
107
+ E as f,
108
+ N as m,
109
+ I as n
110
+ };
@@ -1,6 +1,6 @@
1
1
  import "./TimesNewRoman-Regular-DtG34YRm.js";
2
- import { i as s } from "./measureHost-B2aKX7lF.js";
3
- import "./metrics-BUMIC9Mv.js";
2
+ import { i as s } from "./measureHost-BlukHGwx.js";
3
+ import "./metrics-bvGO8KDK.js";
4
4
  export {
5
5
  s as installMeasureHost
6
6
  };
@@ -1,5 +1,5 @@
1
1
  import { _ as Fn, a as Bn, b as Dn, c as Ln, d as Mn, e as Rn, f as Nn, g as Un, h as Gn, i as Vn, j as zn, k as qn, l as Wn, m as Hn, n as Xn, o as $n, p as jn, q as Zn, r as Yn, s as Kn, t as Jn, u as _n, v as Qn, w as ei } from "./TimesNewRoman-Regular-DtG34YRm.js";
2
- import { i as ti, j as ri, k as si } from "./metrics-BUMIC9Mv.js";
2
+ import { c as ti, F as ri, s as si } from "./metrics-bvGO8KDK.js";
3
3
  import { B as C0 } from "./index-6mKfgpcs.js";
4
4
  var Z1 = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {};
5
5
  function E0(i) {
@@ -0,0 +1,96 @@
1
+ import { S as m } from "./paintStyle-vT6jtWbH.js";
2
+ const u = ["Carlito", "Caladea", "Gelasio", "Arimo", "TimesNewRoman", "Cousine"], C = "Arimo", d = {
3
+ // metric clones of common Office/Windows fonts
4
+ calibri: "Carlito",
5
+ cambria: "Caladea",
6
+ georgia: "Gelasio",
7
+ arial: "Arimo",
8
+ helvetica: "Arimo",
9
+ "helvetica neue": "Arimo",
10
+ "times new roman": "TimesNewRoman",
11
+ times: "TimesNewRoman",
12
+ "courier new": "Cousine",
13
+ courier: "Cousine",
14
+ // reasonable substitutes for fonts we don't ship
15
+ verdana: "Arimo",
16
+ tahoma: "Arimo",
17
+ "segoe ui": "Arimo",
18
+ "trebuchet ms": "Arimo",
19
+ consolas: "Cousine",
20
+ monaco: "Cousine",
21
+ "lucida console": "Cousine",
22
+ garamond: "TimesNewRoman",
23
+ "book antiqua": "Caladea",
24
+ palatino: "Caladea",
25
+ // generic CSS families
26
+ serif: "TimesNewRoman",
27
+ "sans-serif": "Arimo",
28
+ sans: "Arimo",
29
+ monospace: "Cousine",
30
+ mono: "Cousine",
31
+ // identity (already a clone)
32
+ carlito: "Carlito",
33
+ caladea: "Caladea",
34
+ gelasio: "Gelasio",
35
+ arimo: "Arimo",
36
+ timesnewroman: "TimesNewRoman",
37
+ cousine: "Cousine"
38
+ }, f = {
39
+ Carlito: { ascent: 0.9375, descent: 0.25 },
40
+ Caladea: { ascent: 0.9375, descent: 0.25 },
41
+ Gelasio: { ascent: 0.9375, descent: 0.3125 },
42
+ Arimo: { ascent: 0.875, descent: 0.1875 },
43
+ TimesNewRoman: { ascent: 0.875, descent: 0.1875 },
44
+ Cousine: { ascent: 0.625, descent: 0.1875 }
45
+ };
46
+ function c(e) {
47
+ const a = e.trim().toLowerCase().replace(/^["']|["']$/g, ""), o = d[a];
48
+ return o ? { clone: o, substituted: !1 } : { clone: C, substituted: !0 };
49
+ }
50
+ const A = (e) => (e.split(",")[0] ?? "").trim(), b = ["Regular", "Bold", "Italic", "BoldItalic"], N = u.flatMap(
51
+ (e) => b.map((a) => `${e}-${a}.ttf`)
52
+ ), x = [
53
+ { value: "Calibri, sans-serif", label: "Calibri (Carlito)" },
54
+ { value: "Cambria, serif", label: "Cambria (Caladea)" },
55
+ { value: "Georgia, serif", label: "Georgia (Gelasio)" },
56
+ { value: "Arial, sans-serif", label: "Arial (Arimo)" },
57
+ { value: "Times New Roman, serif", label: "Times New Roman" },
58
+ { value: "Verdana, sans-serif", label: "Verdana (Arimo)" },
59
+ { value: "Consolas, monospace", label: "Consolas (Cousine)" },
60
+ { value: "Courier New, monospace", label: "Courier New (Cousine)" }
61
+ ];
62
+ let t = null, n = null;
63
+ function p(e) {
64
+ t = e;
65
+ }
66
+ function T() {
67
+ return t || (n || (n = document.createElement("canvas").getContext("2d")), n);
68
+ }
69
+ const l = /* @__PURE__ */ new Map();
70
+ function F(e) {
71
+ const a = e.italic ? "italic " : "", o = e.bold ? "700" : "400", i = e.verticalAlign ? Math.round(e.fontSizePx * m) : e.fontSizePx, s = c(A(e.fontFamily)).clone;
72
+ return `${a}${o} ${i}px ${s}`;
73
+ }
74
+ function g(e, a) {
75
+ const o = T();
76
+ return o.font = a, o.measureText(e).width;
77
+ }
78
+ function h(e) {
79
+ let a = l.get(e);
80
+ if (!a) {
81
+ const o = /(\d+(?:\.\d+)?)px/.exec(e), i = o ? parseFloat(o[1]) : 16, s = e.slice(e.indexOf("px ") + 3).trim(), r = f[c(s).clone] ?? { ascent: 0.9, descent: 0.25 };
82
+ a = { ascent: Math.round(r.ascent * i), descent: Math.round(r.descent * i) }, l.set(e, a);
83
+ }
84
+ return a;
85
+ }
86
+ export {
87
+ u as C,
88
+ N as F,
89
+ x as T,
90
+ F as a,
91
+ b,
92
+ c,
93
+ h as f,
94
+ g as m,
95
+ p as s
96
+ };
@@ -0,0 +1,74 @@
1
+ const p = "#c0c4c9", x = "#0b57d0", B = "#1a73e8", A = "#202124", I = "#80868b", m = "#7a8aa0", k = "#9aa0a6", M = "#f1f3f4", P = /* @__PURE__ */ new Set([
2
+ "#0563c1",
3
+ "#0000ff",
4
+ "#0000ee",
5
+ "#0b57d0",
6
+ "#0066cc",
7
+ "#1155cc"
8
+ ]), w = (t) => P.has(t.toLowerCase()) ? A : t, G = 0.65, D = -0.38, U = 0.16;
9
+ function H(t, o) {
10
+ return t === "super" ? D * o : t === "sub" ? U * o : 0;
11
+ }
12
+ const X = (t) => Math.max(1, t / 14), v = 1.5, K = (t) => -0.28 * t;
13
+ function g(t, o = x) {
14
+ const i = t.link !== void 0 && t.link.startsWith("#"), n = t.link !== void 0 && !i;
15
+ let c = t.color;
16
+ return n ? c = o : i && P.has(t.color.toLowerCase()) && (c = A), {
17
+ color: c,
18
+ underline: n || !!t.underline && !i,
19
+ strike: !!t.strikethrough,
20
+ externalLink: n
21
+ };
22
+ }
23
+ function z(t) {
24
+ return t === "dot" ? [1, 3] : t === "dash" ? [4, 3] : [];
25
+ }
26
+ const W = (t) => Math.max(1, t / 14), Y = [1, 4], j = 8, q = 1 / 3, J = "#c0c4c9", F = 24;
27
+ function Q(t, o, i, n) {
28
+ const c = t.offsetFrom === "text", a = (s) => s?.spacePx ?? F, O = c ? n.left - a(t.left) : a(t.left), E = c ? o - n.right + a(t.right) : o - a(t.right), L = c ? n.top - a(t.top) : a(t.top), l = c ? i - n.bottom + a(t.bottom) : i - a(t.bottom), r = [], R = (s, u, e, T, f) => {
29
+ if (!s || s.style === "none") return;
30
+ const h = s.style === "thick" ? Math.max(2, s.widthPx) : Math.max(0.5, s.widthPx), C = s.color === "auto" ? "#000000" : s.color, S = s.style === "dashed" ? [h * 3, h * 2] : s.style === "dotted" ? [h, h * 1.5] : [];
31
+ if (r.push({ x1: u, y1: e, x2: T, y2: f, widthPx: h, color: C, dash: S }), s.style === "double") {
32
+ const d = h + 1;
33
+ if (e === f) {
34
+ const _ = e < i / 2 ? d : -d;
35
+ r.push({ x1: u, y1: e + _, x2: T, y2: f + _, widthPx: h, color: C, dash: [] });
36
+ } else {
37
+ const _ = u < o / 2 ? d : -d;
38
+ r.push({ x1: u + _, y1: e, x2: T + _, y2: f, widthPx: h, color: C, dash: [] });
39
+ }
40
+ }
41
+ };
42
+ return R(t.top, O, L, E, L), R(t.bottom, O, l, E, l), R(t.left, O, L, O, l), R(t.right, E, L, E, l), r;
43
+ }
44
+ const V = (t) => Math.max(0.5, t);
45
+ function Z(t, o) {
46
+ return t === "dashed" ? [o * 3, o * 2] : t === "dotted" ? [o, o * 1.5] : [];
47
+ }
48
+ const $ = (t) => t + 1;
49
+ export {
50
+ B as A,
51
+ J as C,
52
+ p as D,
53
+ x as E,
54
+ I as F,
55
+ M as I,
56
+ G as S,
57
+ j as T,
58
+ v as U,
59
+ k as a,
60
+ Y as b,
61
+ z as c,
62
+ X as d,
63
+ V as e,
64
+ Z as f,
65
+ $ as g,
66
+ q as h,
67
+ m as i,
68
+ W as l,
69
+ w as n,
70
+ Q as p,
71
+ g as r,
72
+ K as s,
73
+ H as v
74
+ };