@silurus/ooxml 0.81.0 → 0.82.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (61) hide show
  1. package/README.md +4 -8
  2. package/dist/assets/render-worker-7-Zr7fSw.js +10 -0
  3. package/dist/assets/{render-worker-C2ACcLes.js → render-worker-B5gsW6b5.js} +4 -4
  4. package/dist/assets/{render-worker-DtU8oQZ7.js → render-worker-Dw_wQRIh.js} +1 -1
  5. package/dist/{canvas-viewer-mechanics-CqxKRGCp.js → canvas-viewer-mechanics-CS_qbr6T.js} +1 -1
  6. package/dist/chart-ex.mjs +4 -4
  7. package/dist/comment-occurrence-C34fWs_F.js +6 -0
  8. package/dist/comment-ui-runtime-BAe30Ct9.js +112 -0
  9. package/dist/comment-ui-runtime-BUCj4hWn.js +171 -0
  10. package/dist/comment-ui-runtime-F4a3te6p.js +2 -0
  11. package/dist/comments-Cf9W7r3M.js +241 -0
  12. package/dist/{document-pull-client-Ux4a_ax8.js → document-pull-client-BCgmytqI.js} +2205 -2192
  13. package/dist/{docx-SEyQ4gS-.js → docx-wokGKYfi.js} +674 -249
  14. package/dist/docx.mjs +6 -5
  15. package/dist/docx_parser_bg.wasm +0 -0
  16. package/dist/dom-interaction-boundary-C8F6HO5x.js +119 -0
  17. package/dist/highlight-rect-MaCt0om0.js +13 -0
  18. package/dist/index.mjs +3 -3
  19. package/dist/{line-distribute-BBGvvwLt.js → line-distribute-iXsUCIH-.js} +2 -2
  20. package/dist/{line-metrics-Baz31mML.js → line-metrics-B3syvDn2.js} +52 -52
  21. package/dist/math.mjs +2 -2
  22. package/dist/node.mjs +10 -10
  23. package/dist/{plot-area-frame-Dg1VIpUU.js → plot-area-frame-DHV02PJU.js} +591 -590
  24. package/dist/{pptx-5lQrMvMR.js → pptx-DU8L8I2T.js} +537 -243
  25. package/dist/pptx.mjs +6 -6
  26. package/dist/pptx_parser_bg.wasm +0 -0
  27. package/dist/read-only-comment-decoration-DcFevX_Q.js +96 -0
  28. package/dist/read-only-comment-margin-Dn2y55W6.js +189 -0
  29. package/dist/region-map.mjs +2 -2
  30. package/dist/{render-DEHjijQD.js → render-CenWM4g1.js} +1 -1
  31. package/dist/{render-worker-host-Dg_74V64.js → render-worker-host-BNENN3qP.js} +1 -1
  32. package/dist/{render-worker-host-B1nbV_k7.js → render-worker-host-BmH3kGSj.js} +1 -1
  33. package/dist/{render-worker-host-Bze5M6k5.js → render-worker-host-CmPBviYJ.js} +1 -1
  34. package/dist/{renderer-DuopJE1K.js → renderer-CYr9YTXM.js} +436 -435
  35. package/dist/{resource-measurement-DRLp4nFt.js → resource-measurement-CsW4_eYt.js} +2 -2
  36. package/dist/{session-CNVc3VJ4.js → session-Cky_swUj.js} +3 -3
  37. package/dist/{slide-pull-client-CzutXnGc.js → slide-pull-client-CqTVFb3W.js} +490 -383
  38. package/dist/source-key-BklvnEyQ.js +42 -0
  39. package/dist/{three-d-BYiWCNlz.js → three-d-7MaVzQuZ.js} +48 -47
  40. package/dist/three-d.mjs +324 -323
  41. package/dist/types/chart-ex.d.ts +2 -2
  42. package/dist/types/docx.d.ts +181 -19
  43. package/dist/types/index.d.ts +337 -26
  44. package/dist/types/math.d.ts +1 -1
  45. package/dist/types/node.d.ts +84 -10
  46. package/dist/types/pptx.d.ts +130 -11
  47. package/dist/types/region-map.d.ts +2 -2
  48. package/dist/types/three-d.d.ts +2 -2
  49. package/dist/types/xlsx.d.ts +76 -10
  50. package/dist/units-BzZ0gAxs.js +4 -0
  51. package/dist/{worksheet-pull-client-Cxj3Ej0s.js → worksheet-pull-client-CYtwXP5D.js} +3 -3
  52. package/dist/{xlsx-Bl3TIEVu.js → xlsx-DlV37-0j.js} +429 -218
  53. package/dist/xlsx.mjs +6 -6
  54. package/dist/xlsx_parser_bg.wasm +0 -0
  55. package/package.json +1 -1
  56. package/dist/assets/render-worker-Cx5uR77k.js +0 -10
  57. package/dist/highlight-rect-BqcZMHUE.js +0 -48
  58. /package/dist/{mathjax-DJa-Q93p.js → mathjax-DwIrafQ6.js} +0 -0
  59. /package/dist/{renderer-module-contract-0bO_5SC0.js → renderer-module-contract-DLbb7zY0.js} +0 -0
  60. /package/dist/{transfer-D0U6Uhn4.js → transfer-R6NjgBKD.js} +0 -0
  61. /package/dist/{visible-index-DbDuGMCE.js → visible-index-BFE3PWiY.js} +0 -0
@@ -1,14 +1,15 @@
1
1
  import { t as e } from "./chunk-DmhlhrBa.js";
2
- import { A as t, B as n, Bt as r, C as i, Ct as a, D as o, Et as s, Gt as c, Ht as l, J as u, Jt as d, Kt as f, Lt as p, M as m, O as h, R as g, S as _, T as v, Tt as y, Ut as b, V as x, Vt as S, Wt as C, Yt as w, _ as T, _t as E, a as D, c as O, d as k, f as A, g as j, gt as M, h as ee, ht as N, it as P, j as F, m as I, mt as L, n as R, p as te, pt as z, q as B, qt as ne, s as re, u as V, vt as H, w as U, wt as W, y as ie, yt as ae, z as oe } from "./line-metrics-Baz31mML.js";
3
- import { C as se, E as ce, S as le, T as ue, _ as de, a as fe, b as pe, d as me, f as G, h as K, i as he, l as ge, m as _e, p as ve, t as ye, u as q, v as be, w as xe, x as Se, y as Ce } from "./canvas-viewer-mechanics-CqxKRGCp.js";
2
+ import { A as t, B as n, Bt as r, C as i, Ct as a, D as o, Et as s, Gt as c, Ht as l, J as u, Jt as d, Kt as f, Lt as p, M as m, O as h, R as g, S as _, T as v, Tt as y, Ut as b, V as x, Vt as S, Wt as C, Yt as w, _ as T, _t as E, a as D, c as O, d as k, f as A, g as j, gt as M, h as ee, ht as N, it as P, j as F, m as I, mt as L, n as R, p as te, pt as z, q as ne, qt as B, s as re, u as V, vt as H, w as U, wt as W, y as ie, yt as ae, z as oe } from "./line-metrics-B3syvDn2.js";
3
+ import { C as se, E as ce, S as le, T as ue, _ as de, a as fe, b as pe, d as me, f as G, h as K, i as he, l as ge, m as _e, p as ve, t as ye, u as q, v as be, w as xe, x as Se, y as Ce } from "./canvas-viewer-mechanics-CS_qbr6T.js";
4
4
  import { a as we, i as Te, t as Ee } from "./bounded-raw-part-cache-C6ro6Ezf.js";
5
- import { C as De, _ as J, an as Oe, c as ke, h as Ae, hn as je, in as Y, k as Me, l as Ne, ln as Pe, mn as Fe, o as Ie, pn as Le, rn as Re, s as ze, sn as Be, v as Ve, w as He } from "./plot-area-frame-Dg1VIpUU.js";
6
- import { L as Ue } from "./three-d-BYiWCNlz.js";
7
- import { k as We } from "./renderer-DuopJE1K.js";
8
- import { i as Ge } from "./resource-measurement-DRLp4nFt.js";
9
- import { n as Ke } from "./renderer-module-contract-0bO_5SC0.js";
10
- import { n as qe, r as Je, t as Ye } from "./visible-index-DbDuGMCE.js";
11
- import { a as Xe, c as Ze, d as Qe, i as $e, l as et, n as tt, o as nt, s as rt, t as it, u as at } from "./worksheet-pull-client-Cxj3Ej0s.js";
5
+ import { C as De, _ as J, c as Oe, cn as ke, h as Ae, in as je, k as Me, l as Ne, ln as Pe, nn as Fe, o as Ie, s as Le, un as Re, v as ze, w as Be } from "./plot-area-frame-DHV02PJU.js";
6
+ import { a as Ve, i as Y, r as He } from "./units-BzZ0gAxs.js";
7
+ import { L as Ue } from "./three-d-7MaVzQuZ.js";
8
+ import { k as We } from "./renderer-CYr9YTXM.js";
9
+ import { i as Ge } from "./resource-measurement-CsW4_eYt.js";
10
+ import { n as Ke } from "./renderer-module-contract-DLbb7zY0.js";
11
+ import { n as qe, r as Je, t as Ye } from "./visible-index-BFE3PWiY.js";
12
+ import { a as Xe, c as Ze, d as Qe, i as $e, l as et, n as tt, o as nt, s as rt, t as it, u as at } from "./worksheet-pull-client-CYtwXP5D.js";
12
13
  //#region packages/core/src/sparkline/renderer.ts
13
14
  function ot(e, t, n) {
14
15
  let { values: r } = n;
@@ -32,7 +33,7 @@ function ot(e, t, n) {
32
33
  e.moveTo(s, t), e.lineTo(s + l, t), e.stroke(), e.restore();
33
34
  }
34
35
  let v = r.length, y = (e) => v === 1 ? s + l / 2 : s + e / (v - 1) * l;
35
- e.save(), e.strokeStyle = i, e.lineCap = "round", e.lineJoin = "round", e.lineWidth = (n.lineWeight ?? .75) * Oe, e.beginPath();
36
+ e.save(), e.strokeStyle = i, e.lineCap = "round", e.lineJoin = "round", e.lineWidth = (n.lineWeight ?? .75) * Ve, e.beginPath();
36
37
  let b = !1, x = n.displayEmptyCellsAs ?? "gap";
37
38
  for (let t = 0; t < v; t++) {
38
39
  let n = r[t];
@@ -654,7 +655,7 @@ function Xt(e, t, n) {
654
655
  return Math.floor(Ne(new Date(Date.UTC(e, t - 1, n)), !1));
655
656
  }
656
657
  function Zt(e) {
657
- return ke(Math.floor(e), !1);
658
+ return Oe(Math.floor(e), !1);
658
659
  }
659
660
  function Qt(e) {
660
661
  let t = Zt(e);
@@ -824,7 +825,7 @@ function dn(e) {
824
825
  };
825
826
  }
826
827
  function fn(e, t, n = !1) {
827
- let r = ke(e, n), i = r.getUTCFullYear(), a = r.getUTCMonth() + 1, o = r.getUTCDate(), s = r.getUTCDay(), c = r.getUTCHours(), l = r.getUTCMinutes(), u = r.getUTCSeconds(), d = t.split(";")[0], f = /am\/pm|a\/p/i.test(d), p = null, m = () => p ??= dn(r), h = "", g = 0, _ = !1;
828
+ let r = Oe(e, n), i = r.getUTCFullYear(), a = r.getUTCMonth() + 1, o = r.getUTCDate(), s = r.getUTCDay(), c = r.getUTCHours(), l = r.getUTCMinutes(), u = r.getUTCSeconds(), d = t.split(";")[0], f = /am\/pm|a\/p/i.test(d), p = null, m = () => p ??= dn(r), h = "", g = 0, _ = !1;
828
829
  for (; g < d.length;) {
829
830
  let t = d[g];
830
831
  if (t === "\"") {
@@ -1144,11 +1145,11 @@ function jn(e, t, n) {
1144
1145
  }
1145
1146
  if (r.exp) {
1146
1147
  let e = Math.max(r.intSpec.length, 1), t = r.fracSpec.length, n = 0, i = 0;
1147
- o !== 0 && (i = Math.floor(Math.log10(o)), i = Math.floor(i / e) * e, n = o / 10 ** i, parseFloat(ze(n, t)) >= 10 ** e && (i += e, n = o / 10 ** i));
1148
- let [s, c = ""] = ze(n, t).split(".");
1148
+ o !== 0 && (i = Math.floor(Math.log10(o)), i = Math.floor(i / e) * e, n = o / 10 ** i, parseFloat(Le(n, t)) >= 10 ** e && (i += e, n = o / 10 ** i));
1149
+ let [s, c = ""] = Le(n, t).split(".");
1149
1150
  return a + Mn(r, On(s, r.intSpec, !1), kn(c, r.fracSpec), "E" + (i < 0 ? "-" : r.exp.plus ? "+" : "") + String(Math.abs(i)).padStart(r.exp.width, "0"));
1150
1151
  }
1151
- let s = r.fracSpec.length, [c, l = ""] = ze(o, s).split("."), u = c.replace(/^0+/, ""), d = /[0]/.test(r.intSpec) || r.intSpec === "" && !1;
1152
+ let s = r.fracSpec.length, [c, l = ""] = Le(o, s).split("."), u = c.replace(/^0+/, ""), d = /[0]/.test(r.intSpec) || r.intSpec === "" && !1;
1152
1153
  return u === "" && d && (u = "0"), a + Mn(r, On(u, r.intSpec, r.grouping), kn(l, r.fracSpec), "");
1153
1154
  }
1154
1155
  function Mn(e, t, n, r) {
@@ -1497,10 +1498,10 @@ function ar(e, t = 8) {
1497
1498
  return e / t;
1498
1499
  }
1499
1500
  function or(e) {
1500
- return Math.round(e * Oe);
1501
+ return Math.round(e * Ve);
1501
1502
  }
1502
1503
  function sr(e) {
1503
- return e / Oe;
1504
+ return e / Ve;
1504
1505
  }
1505
1506
  //#endregion
1506
1507
  //#region packages/xlsx/src/internal/grid-axis-geometry.ts
@@ -1831,7 +1832,7 @@ function Tr(e, t, n, r) {
1831
1832
  }
1832
1833
  var Er = "#7a7a7a";
1833
1834
  function Dr(e, t) {
1834
- let n = t * Oe, r = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : typeof document < "u" ? document.createElement("canvas") : null;
1835
+ let n = t * Ve, r = typeof OffscreenCanvas < "u" ? new OffscreenCanvas(1, 1) : typeof document < "u" ? document.createElement("canvas") : null;
1835
1836
  if (!r) return 8;
1836
1837
  let i = r.getContext("2d");
1837
1838
  if (!i) return 8;
@@ -2048,7 +2049,7 @@ function Nr(e, t, n, r) {
2048
2049
  if (jr.has(s)) return jr.get(s);
2049
2050
  let c = Mr[t];
2050
2051
  if (!c) return jr.set(s, null), null;
2051
- let l = c.length, u = je(l, l);
2052
+ let l = c.length, u = Re(l, l);
2052
2053
  if (!u) return jr.set(s, null), null;
2053
2054
  let d = u.getContext("2d");
2054
2055
  if (!d) return jr.set(s, null), null;
@@ -2103,11 +2104,11 @@ function Rr(e, t, n) {
2103
2104
  return `rgb(${Math.round(a * d + c * (1 - d))},${Math.round(o * d + l * (1 - d))},${Math.round(s * d + u * (1 - d))})`;
2104
2105
  }
2105
2106
  function $(e, t, n = 1, r) {
2106
- let i = Math.round(e * Oe * n * t);
2107
- return r ? Math.max(i, Math.round(R(r, e * Oe * t))) : i;
2107
+ let i = Math.round(e * Ve * n * t);
2108
+ return r ? Math.max(i, Math.round(R(r, e * Ve * t))) : i;
2108
2109
  }
2109
2110
  function zr(e, t = 1) {
2110
- return `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${Math.max(1, Math.round(e.size * Oe * t))}px ${Sr(e.name)}`;
2111
+ return `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${Math.max(1, Math.round(e.size * Ve * t))}px ${Sr(e.name)}`;
2111
2112
  }
2112
2113
  function Br(e, t, n, r, i, a, o, s, c, l) {
2113
2114
  if (t.length === 0) return;
@@ -2677,13 +2678,13 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2677
2678
  e.font = zr(te, x);
2678
2679
  let z = t.hyperlinkMap.get(y) ? "#0563C1" : j.fontColor ?? N.color ?? w.color;
2679
2680
  e.fillStyle = z ? J(z) : "#000000";
2680
- let B = C.value.type === "number", ne = A.alignH ?? (B ? "right" : "left"), re = A.alignV ?? "bottom", V = A.indent ? Math.round(A.indent * 3 * t.mdw) : 0, H = 3 + (ne === "left" || !A.alignH ? V : 0);
2681
+ let ne = C.value.type === "number", B = A.alignH ?? (ne ? "right" : "left"), re = A.alignV ?? "bottom", V = A.indent ? Math.round(A.indent * 3 * t.mdw) : 0, H = 3 + (B === "left" || !A.alignH ? V : 0);
2681
2682
  e.save(), e.beginPath(), e.rect(m, h, _, v), e.clip();
2682
2683
  let U;
2683
- ne === "right" ? (U = m + _ - 3, e.textAlign = "right") : ne === "center" ? (U = m + _ / 2, e.textAlign = "center") : (U = m + H, e.textAlign = "left");
2684
+ B === "right" ? (U = m + _ - 3, e.textAlign = "right") : B === "center" ? (U = m + _ / 2, e.textAlign = "center") : (U = m + H, e.textAlign = "left");
2684
2685
  let W = C.value.type === "text" ? C.value.runs : void 0, ie = W && W.length > 0;
2685
2686
  if (A.wrapText && ie) li(e, W, te, {
2686
- alignH: ne,
2687
+ alignH: B,
2687
2688
  alignV: re,
2688
2689
  cx: m,
2689
2690
  cy: h,
@@ -2697,7 +2698,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2697
2698
  readingOrder: A.readingOrder
2698
2699
  });
2699
2700
  else if (A.wrapText) ci(e, P, U, te, {
2700
- alignH: ne,
2701
+ alignH: B,
2701
2702
  alignV: re,
2702
2703
  cx: m,
2703
2704
  cy: h,
@@ -2708,7 +2709,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2708
2709
  paddingY: 2
2709
2710
  }, x);
2710
2711
  else if (ie) si(e, W, te, {
2711
- alignH: ne,
2712
+ alignH: B,
2712
2713
  alignV: re,
2713
2714
  cx: m,
2714
2715
  cy: h,
@@ -2723,7 +2724,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2723
2724
  });
2724
2725
  else {
2725
2726
  let { baseline: t, textY: n } = ei({
2726
- alignH: ne,
2727
+ alignH: B,
2727
2728
  alignV: re,
2728
2729
  cx: m,
2729
2730
  cy: h,
@@ -2766,7 +2767,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2766
2767
  if (y.has(k)) continue;
2767
2768
  let A = v.get(k), j = A ? A.totalW : E, P = A ? A.totalH : l, F = d + j <= f || d >= f + m;
2768
2769
  if (c + P <= p || c >= p + h || F && !t.overflowTextAnchors.has(k)) continue;
2769
- let I = D(d, j), L = _.get(k), { font: R, fill: B, border: ne, xf: V } = Wr(g, Kr(t.worksheet, L, s)), H = $n(L, r, s, b, g.dxfs ?? []), U = H.fill ?? B, W = t.tableStyleMap.get(k), ie = g.dxfs ?? [], ae = (e) => e == null ? void 0 : ie[e], oe = ae(W?.wholeTableDxf), se = ae(W?.headerRowDxf), ce = ae(W?.totalRowDxf), le = ae(W?.firstColumnDxf), ue = ae(W?.lastColumnDxf), de = ae(W?.stripeDxf), fe = W?.isHeader && se?.fill?.fgColor ? se : W?.isTotals && ce?.fill?.fgColor ? ce : W?.isLastCol && ue?.fill?.fgColor ? ue : W?.isFirstCol && le?.fill?.fgColor ? le : de?.fill?.fgColor ? de : !W?.isHeader && !W?.isTotals && oe?.fill?.fgColor ? oe : void 0, pe = Pr(e, U, I, c, j, P);
2770
+ let I = D(d, j), L = _.get(k), { font: R, fill: ne, border: B, xf: V } = Wr(g, Kr(t.worksheet, L, s)), H = $n(L, r, s, b, g.dxfs ?? []), U = H.fill ?? ne, W = t.tableStyleMap.get(k), ie = g.dxfs ?? [], ae = (e) => e == null ? void 0 : ie[e], oe = ae(W?.wholeTableDxf), se = ae(W?.headerRowDxf), ce = ae(W?.totalRowDxf), le = ae(W?.firstColumnDxf), ue = ae(W?.lastColumnDxf), de = ae(W?.stripeDxf), fe = W?.isHeader && se?.fill?.fgColor ? se : W?.isTotals && ce?.fill?.fgColor ? ce : W?.isLastCol && ue?.fill?.fgColor ? ue : W?.isFirstCol && le?.fill?.fgColor ? le : de?.fill?.fgColor ? de : !W?.isHeader && !W?.isTotals && oe?.fill?.fgColor ? oe : void 0, pe = Pr(e, U, I, c, j, P);
2770
2771
  if (pe || (W && fe?.fill?.fgColor ? (e.fillStyle = J(fe.fill.fgColor), e.fillRect(I, c, j, P), pe = !0) : W && !W.isCustom && W.isBanded && (e.fillStyle = yi(W.accent), e.fillRect(I, c, j, P), pe = !0)), t.commentCells.has(k) && Lr(e, I, c, j, P), H.dataBar && H.dataBar.ratio > 0) {
2771
2772
  let t = Math.max(0, (j - 4) * H.dataBar.ratio);
2772
2773
  kr(e, H.dataBar.color, I + 2, c + 2, t, P - 4, H.dataBar.gradient);
@@ -2793,7 +2794,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2793
2794
  }
2794
2795
  e.stroke();
2795
2796
  }
2796
- let G = na(A ? ta(ne, r, s, A.right, A.bottom, _, g) : ne, H.border);
2797
+ let G = na(A ? ta(B, r, s, A.right, A.bottom, _, g) : B, H.border);
2797
2798
  (w.has(a) || T.has(a)) && (G = {
2798
2799
  ...G,
2799
2800
  left: T.has(a) ? null : G.left,
@@ -2846,21 +2847,21 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2846
2847
  e.font = zr(m, x);
2847
2848
  let h = t.hyperlinkMap.get(k), b = n?.font?.color ?? null, w = h ? "#0563C1" : H.fontColor ?? ye.color ?? b ?? R.color;
2848
2849
  e.fillStyle = w ? J(w) : "#000000";
2849
- let T = L.value.type === "number", E = V.alignH ?? (T ? "right" : "left"), D = V.alignV ?? "bottom", O = V.indent ? Math.round(V.indent * 3 * t.mdw) : 0, M = H.iconSet ? Math.max(8, Math.round(Math.min(j, P) * .55)) : 0, ee = M > 0 ? M + 4 : 0, N = 3 + (E === "left" || !V.alignH ? O : 0) + ee, F = j, B = a;
2850
+ let T = L.value.type === "number", E = V.alignH ?? (T ? "right" : "left"), D = V.alignV ?? "bottom", O = V.indent ? Math.round(V.indent * 3 * t.mdw) : 0, M = H.iconSet ? Math.max(8, Math.round(Math.min(j, P) * .55)) : 0, ee = M > 0 ? M + 4 : 0, N = 3 + (E === "left" || !V.alignH ? O : 0) + ee, F = j, ne = a;
2850
2851
  if (E === "centerContinuous" && !A) for (let e = a + 1; e < C; e++) {
2851
2852
  let n = `${r}:${o[e]}`;
2852
2853
  if (y.has(n) || v.has(n)) break;
2853
2854
  let a = _.get(n);
2854
2855
  if (a && a.value.type !== "empty" || Wr(g, Kr(t.worksheet, a, o[e])).xf.alignH !== "centerContinuous") break;
2855
- F += i[e], B = e;
2856
+ F += i[e], ne = e;
2856
2857
  }
2857
- let ne = t.rtl ? I - (F - j) : I, U = E === "centerContinuous" ? ne : I, ie = E === "centerContinuous" ? F : j, ae = q.includes("\n");
2858
+ let B = t.rtl ? I - (F - j) : I, U = E === "centerContinuous" ? B : I, ie = E === "centerContinuous" ? F : j, ae = q.includes("\n");
2858
2859
  if (!A && !V.wrapText && !V.textRotation && !T && !ae) {
2859
2860
  let n = e.measureText(q).width, s = E === "centerContinuous", c = s ? n + 6 : n + N + 3, l = s ? F : j;
2860
2861
  if (c > l) {
2861
2862
  let e = c - l, n = 0, u = 0;
2862
2863
  E === "right" ? u = e : E === "center" || s ? (u = e / 2, n = e / 2) : n = e;
2863
- let d = t.rtl ? -1 : 1, f = t.rtl ? a - 1 : B + 1, p = t.rtl ? 1 : -1, m = t.rtl ? B + 1 : a - 1;
2864
+ let d = t.rtl ? -1 : 1, f = t.rtl ? a - 1 : ne + 1, p = t.rtl ? 1 : -1, m = t.rtl ? ne + 1 : a - 1;
2864
2865
  if (n > 0) {
2865
2866
  let e = n;
2866
2867
  for (let t = f; t >= 0 && t < C && e > 0; t += d) {
@@ -2896,7 +2897,7 @@ function bi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h) {
2896
2897
  n < t && (pe = Math.max(0, (t - n) / r));
2897
2898
  }
2898
2899
  let me, G;
2899
- E === "right" ? (me = I + j - 3, G = "right") : E === "center" ? (me = I + j / 2, G = "center") : E === "centerContinuous" ? (me = ne + F / 2, G = "center") : E === "distributed" || E === "justify" && !V.wrapText && !ae ? (me = I + 3, G = "left") : (me = I + N, G = "left");
2900
+ E === "right" ? (me = I + j - 3, G = "right") : E === "center" ? (me = I + j / 2, G = "center") : E === "centerContinuous" ? (me = B + F / 2, G = "center") : E === "distributed" || E === "justify" && !V.wrapText && !ae ? (me = I + 3, G = "left") : (me = I + N, G = "left");
2900
2901
  let K = V.textRotation ?? 0, he = K === 255, ge = K > 0 && K !== 255;
2901
2902
  if (H.iconSet && M > 0 && (e.save(), e.beginPath(), e.rect(I, c, j, P), e.clip(), mi(e, H.iconSet.name, H.iconSet.index, I + 2, c + (P - M) / 2, M), e.restore()), e.save(), e.beginPath(), e.rect(U, c, ie, P), e.clip(), he) {
2902
2903
  let t = $(R.size, x, 1.1), n = [...q].length * t, r = D === "top" ? c + 2 : D === "center" ? c + (P - n) / 2 : c + P - n - 2;
@@ -3263,7 +3264,7 @@ function Li(e, t) {
3263
3264
  function Ri(e, t, n, r, i = {}) {
3264
3265
  let a = i.dpr ?? 1, o = i.cellScale ?? 1, s = t.isChartSheet === !0, c = Q(t), l = c.maximumDigitWidth, u = e.canvas.width / a, d = e.canvas.height / a;
3265
3266
  e.clearRect(0, 0, u, d), e.fillStyle = "#ffffff", e.fillRect(0, 0, u, d);
3266
- let f = (e) => Math.round(e * o), p = s ? 0 : f(50), m = s ? 0 : f(22), { row: h, col: g, rows: _, cols: v } = r, y = (i.scrollOffsetX ?? 0) * o, b = (i.scrollOffsetY ?? 0) * o, { col: x, row: S } = c.axesAtScale(o), C = x.bandsToCover(1, s ? 0 : i.freezeCols ?? 0, Math.max(0, u - p)), w = S.bandsToCover(1, s ? 0 : i.freezeRows ?? 0, Math.max(0, d - m)), T = w.at(-1)?.index ?? 0, E = C.at(-1)?.index ?? 0, D = C.map(({ index: e }) => e), O = w.map(({ index: e }) => e), k = C.map(({ size: e }) => e), A = w.map(({ size: e }) => e), j = k.reduce((e, t) => e + t, 0), M = A.reduce((e, t) => e + t, 0), ee = x.bandsToCover(g, Math.min(16384, g + v - 1)), N = S.bandsToCover(h, Math.min(1048576, h + _ - 1)), P = ee.map(({ index: e }) => e), F = N.map(({ index: e }) => e), I = ee.map(({ size: e }) => e), L = N.map(({ size: e }) => e), { cellMap: R, cfContext: te, mergeSkipSet: B, autoFilterCells: ne, hyperlinkMap: re, commentCells: V, tableStyleMap: H, sparklineMap: U, nonEmptyColsByRow: W } = Ci(t), ie = /* @__PURE__ */ new Map(), ae = Si("worksheet-merge-anchor-index", "index-merge-anchor-coordinates");
3267
+ let f = (e) => Math.round(e * o), p = s ? 0 : f(50), m = s ? 0 : f(22), { row: h, col: g, rows: _, cols: v } = r, y = (i.scrollOffsetX ?? 0) * o, b = (i.scrollOffsetY ?? 0) * o, { col: x, row: S } = c.axesAtScale(o), C = x.bandsToCover(1, s ? 0 : i.freezeCols ?? 0, Math.max(0, u - p)), w = S.bandsToCover(1, s ? 0 : i.freezeRows ?? 0, Math.max(0, d - m)), T = w.at(-1)?.index ?? 0, E = C.at(-1)?.index ?? 0, D = C.map(({ index: e }) => e), O = w.map(({ index: e }) => e), k = C.map(({ size: e }) => e), A = w.map(({ size: e }) => e), j = k.reduce((e, t) => e + t, 0), M = A.reduce((e, t) => e + t, 0), ee = x.bandsToCover(g, Math.min(16384, g + v - 1)), N = S.bandsToCover(h, Math.min(1048576, h + _ - 1)), P = ee.map(({ index: e }) => e), F = N.map(({ index: e }) => e), I = ee.map(({ size: e }) => e), L = N.map(({ size: e }) => e), { cellMap: R, cfContext: te, mergeSkipSet: ne, autoFilterCells: B, hyperlinkMap: re, commentCells: V, tableStyleMap: H, sparklineMap: U, nonEmptyColsByRow: W } = Ci(t), ie = /* @__PURE__ */ new Map(), ae = Si("worksheet-merge-anchor-index", "index-merge-anchor-coordinates");
3267
3268
  for (let e of t.mergeCells ?? []) {
3268
3269
  let t = x.offsetOf(e.right + 1) - x.offsetOf(e.left), n = S.offsetOf(e.bottom + 1) - S.offsetOf(e.top);
3269
3270
  Ln(ie, `${e.top}:${e.left}`, {
@@ -3278,7 +3279,7 @@ function Ri(e, t, n, r, i = {}) {
3278
3279
  styles: n,
3279
3280
  cellMap: R,
3280
3281
  mergeAnchorMap: ie,
3281
- mergeSkipSet: B,
3282
+ mergeSkipSet: ne,
3282
3283
  cfContext: te,
3283
3284
  colWidths: de,
3284
3285
  rowHeights: L,
@@ -3292,7 +3293,7 @@ function Ri(e, t, n, r, i = {}) {
3292
3293
  startCol: g,
3293
3294
  cs: o,
3294
3295
  dpr: a,
3295
- autoFilterCells: ne,
3296
+ autoFilterCells: B,
3296
3297
  hyperlinkMap: re,
3297
3298
  commentCells: V,
3298
3299
  tableStyleMap: H,
@@ -3304,7 +3305,7 @@ function Ri(e, t, n, r, i = {}) {
3304
3305
  canvasW: u,
3305
3306
  threeD: i.threeD
3306
3307
  }, me = p, G = m, K = me + j, he = G + M, ge = Math.max(0, u - K), _e = Math.max(0, d - he);
3307
- T > 0 && E > 0 && bi(e, pe, 1, 1, k, A, D, O, 0, 0, me, G, me, G, j, M), T > 0 && bi(e, pe, 1, ce.startCol, de, A, ue, O, fe, 0, K, G, K, G, ge, M), E > 0 && bi(e, pe, h, 1, k, L, D, F, 0, b, me, he, me, he, j, _e), s || bi(e, pe, h, ce.startCol, de, L, ue, F, fe, b, K, he, K, he, ge, _e), Bi(e, t, x, S, i.loadedImages, o, h, g, y, b, K, he, ge, _e, t.rightToLeft === !0, u, i.threeD, i.regionMap, i.chartEx), !s && t.slicers && t.slicers.length > 0 && Sa(e, t, x, S, o, h, g, y, b, K, he, ge, _e, t.rightToLeft === !0, u), s || zi(e, u, d, h, g, _, v, I, L, P, F, y, b, k, A, D, O, j, M, p, m, o, a, i.selectedRowRange ?? null, i.selectedColRange ?? null, t.rightToLeft === !0);
3308
+ T > 0 && E > 0 && bi(e, pe, 1, 1, k, A, D, O, 0, 0, me, G, me, G, j, M), T > 0 && bi(e, pe, 1, ce.startCol, de, A, ue, O, fe, 0, K, G, K, G, ge, M), E > 0 && bi(e, pe, h, 1, k, L, D, F, 0, b, me, he, me, he, j, _e), s || bi(e, pe, h, ce.startCol, de, L, ue, F, fe, b, K, he, K, he, ge, _e), Bi(e, t, x, S, i.loadedImages, o, h, g, y, b, K, he, ge, _e, t.rightToLeft === !0, u, i.threeD, i.regionMap, i.chartEx), !s && t.slicers && t.slicers.length > 0 && Sa(e, t, x, S, o, h, g, y, b, K, he, ge, _e, t.rightToLeft === !0, u), s || zi(e, u, d, h, g, _, v, I, L, P, F, y, b, k, A, D, O, j, M, p, m, o, a, i.selectedRowRange ?? null, i.selectedColRange ?? null, t.rightToLeft === !0, i.chromeColors);
3308
3309
  let ve = t.rightToLeft === !0;
3309
3310
  if (T > 0) {
3310
3311
  e.save(), e.strokeStyle = Er, e.lineWidth = .5, e.beginPath();
@@ -3317,47 +3318,47 @@ function Ri(e, t, n, r, i = {}) {
3317
3318
  e.moveTo(n, m), e.lineTo(n, d), e.stroke(), e.restore();
3318
3319
  }
3319
3320
  }
3320
- function zi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T) {
3321
- let E = "#f8f9fa", D = "#e8eaed", O = "#caddf6", k = "#c8ccd0", A = "#5b9bd5", j = "#444", M = (e) => !w || e < w.start || e > w.end ? E : w.strong ? O : D, ee = (e) => !w || e < w.start || e > w.end ? k : w.strong ? A : k, N = (e) => !C || e < C.start || e > C.end ? E : C.strong ? O : D, P = (e) => !C || e < C.start || e > C.end ? k : C.strong ? A : k, F = `${Math.max(1, Math.round(11 * x))}px ${vr}`, I = y + _, L = b + v, R = .5 / S, te = (e, n) => T ? wr(e, n, t) : e, B = T ? t - y : 0;
3322
- e.fillStyle = E, e.fillRect(B, 0, y, b), e.strokeStyle = k, e.lineWidth = .5, e.beginPath();
3323
- let ne = T ? B + z(B, .5, S) : B + y - R;
3324
- e.moveTo(ne, 0), e.lineTo(ne, b), e.moveTo(B, b - R), e.lineTo(B + y, b - R), e.stroke(), e.font = F, e.fillStyle = j;
3325
- let re = (t, n, r) => {
3326
- let i = te(n, r);
3327
- e.fillStyle = M(t), e.fillRect(i, 0, r, b), e.strokeStyle = ee(t), e.lineWidth = .5, e.beginPath();
3321
+ function zi(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g, _, v, y, b, x, S, C, w, T, E) {
3322
+ let D = E?.surface ?? "#f8f9fa", O = E?.mutedSurface ?? "#e8eaed", k = E?.selectedSurface ?? "#caddf6", A = E?.border ?? "#c8ccd0", j = E?.accent ?? "#5b9bd5", M = E?.text ?? "#444", ee = (e) => !w || e < w.start || e > w.end ? D : w.strong ? k : O, N = (e) => !w || e < w.start || e > w.end ? A : w.strong ? j : A, P = (e) => !C || e < C.start || e > C.end ? D : C.strong ? k : O, F = (e) => !C || e < C.start || e > C.end ? A : C.strong ? j : A, I = `${Math.max(1, Math.round(11 * x))}px ${vr}`, L = y + _, R = b + v, te = .5 / S, ne = (e, n) => T ? wr(e, n, t) : e, B = T ? t - y : 0;
3323
+ e.fillStyle = D, e.fillRect(B, 0, y, b), e.strokeStyle = A, e.lineWidth = .5, e.beginPath();
3324
+ let re = T ? B + z(B, .5, S) : B + y - te;
3325
+ e.moveTo(re, 0), e.lineTo(re, b), e.moveTo(B, b - te), e.lineTo(B + y, b - te), e.stroke(), e.font = I, e.fillStyle = M;
3326
+ let V = (t, n, r) => {
3327
+ let i = ne(n, r);
3328
+ e.fillStyle = ee(t), e.fillRect(i, 0, r, b), e.strokeStyle = N(t), e.lineWidth = .5, e.beginPath();
3328
3329
  let a = i + z(i, .5, S);
3329
- e.moveTo(a, 0), e.lineTo(a, b), e.moveTo(i, b - R), e.lineTo(i + r, b - R), e.stroke(), e.fillStyle = j, e.textAlign = "center", e.textBaseline = "middle", e.fillText(ui(t), i + r / 2, b / 2);
3330
- }, V = (t, n, r) => {
3330
+ e.moveTo(a, 0), e.lineTo(a, b), e.moveTo(i, b - te), e.lineTo(i + r, b - te), e.stroke(), e.fillStyle = M, e.textAlign = "center", e.textBaseline = "middle", e.fillText(ui(t), i + r / 2, b / 2);
3331
+ }, H = (t, n, r) => {
3331
3332
  let i = B;
3332
- e.fillStyle = N(t), e.fillRect(i, n, y, r), e.strokeStyle = P(t), e.lineWidth = .5, e.beginPath();
3333
- let a = n + z(n, .5, S), o = T ? i + z(i, .5, S) : i + y - R;
3334
- e.moveTo(o, n), e.lineTo(o, n + r), e.moveTo(i, a), e.lineTo(i + y, a), e.stroke(), e.fillStyle = j, e.textBaseline = "middle";
3333
+ e.fillStyle = P(t), e.fillRect(i, n, y, r), e.strokeStyle = F(t), e.lineWidth = .5, e.beginPath();
3334
+ let a = n + z(n, .5, S), o = T ? i + z(i, .5, S) : i + y - te;
3335
+ e.moveTo(o, n), e.lineTo(o, n + r), e.moveTo(i, a), e.lineTo(i + y, a), e.stroke(), e.fillStyle = M, e.textBaseline = "middle";
3335
3336
  let s = Math.max(2, Math.round(4 * x));
3336
3337
  T ? (e.textAlign = "left", e.fillText(String(t), i + s, n + r / 2)) : (e.textAlign = "right", e.fillText(String(t), i + y - s, n + r / 2));
3337
3338
  };
3338
3339
  if (p.length > 0) {
3339
- e.save(), e.beginPath(), e.rect(te(y, _), 0, _, b), e.clip();
3340
+ e.save(), e.beginPath(), e.rect(ne(y, _), 0, _, b), e.clip();
3340
3341
  let t = y;
3341
- for (let e = 0; e < p.length; e++) re(h[e], t, p[e]), t += p[e];
3342
+ for (let e = 0; e < p.length; e++) V(h[e], t, p[e]), t += p[e];
3342
3343
  e.restore();
3343
3344
  }
3344
- e.save(), e.beginPath(), e.rect(te(I, t - I), 0, t - I, b), e.clip();
3345
- let H = I - d;
3345
+ e.save(), e.beginPath(), e.rect(ne(L, t - L), 0, t - L, b), e.clip();
3346
+ let U = L - d;
3346
3347
  for (let e = 0; e < s.length; e++) {
3347
3348
  let n = s[e];
3348
- H + n > I && H < t && re(l[e], H, n), H += n;
3349
+ U + n > L && U < t && V(l[e], U, n), U += n;
3349
3350
  }
3350
3351
  if (e.restore(), m.length > 0) {
3351
3352
  e.save(), e.beginPath(), e.rect(B, b, y, v), e.clip();
3352
3353
  let t = b;
3353
- for (let e = 0; e < m.length; e++) V(g[e], t, m[e]), t += m[e];
3354
+ for (let e = 0; e < m.length; e++) H(g[e], t, m[e]), t += m[e];
3354
3355
  e.restore();
3355
3356
  }
3356
- e.save(), e.beginPath(), e.rect(B, L, y, n - L), e.clip();
3357
- let U = L - f;
3357
+ e.save(), e.beginPath(), e.rect(B, R, y, n - R), e.clip();
3358
+ let W = R - f;
3358
3359
  for (let e = 0; e < c.length; e++) {
3359
3360
  let t = c[e];
3360
- U + t > L && U < n && V(u[e], U, t), U += t;
3361
+ W + t > R && W < n && H(u[e], W, t), W += t;
3361
3362
  }
3362
3363
  e.restore();
3363
3364
  }
@@ -3411,7 +3412,7 @@ function Ui(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g = t.images) {
3411
3412
  }
3412
3413
  if (S <= 0 || C <= 0) continue;
3413
3414
  let w = Tr(u + (b - _) - c, S, h, m), T = d + (x - v) - l;
3414
- w + S < y || w > y + f || T + C < d || T > d + p || (t.alpha != null && t.alpha < 1 ? (e.save(), e.globalAlpha = t.alpha, Be(e, o, t.srcRect, w, T, S, C), e.restore()) : Be(e, o, t.srcRect, w, T, S, C));
3415
+ w + S < y || w > y + f || T + C < d || T > d + p || (t.alpha != null && t.alpha < 1 ? (e.save(), e.globalAlpha = t.alpha, Fe(e, o, t.srcRect, w, T, S, C), e.restore()) : Fe(e, o, t.srcRect, w, T, S, C));
3415
3416
  }
3416
3417
  e.restore();
3417
3418
  }
@@ -3478,7 +3479,7 @@ function Gi(e, t, n, r, i, a, o, s) {
3478
3479
  Qi(e, t, i, a);
3479
3480
  }
3480
3481
  else if (t.geom.type === "preset") {
3481
- let n = Ve(t.fill ?? (t.fillColor ? {
3482
+ let n = ze(t.fill ?? (t.fillColor ? {
3482
3483
  fillType: "solid",
3483
3484
  color: t.fillColor
3484
3485
  } : null), e, 0, 0, i, a, t.rot), r = t.strokeColor && t.strokeWidth > 0 ? () => ea(e, t, i, a) : null;
@@ -3487,7 +3488,7 @@ function Gi(e, t, n, r, i, a, o, s) {
3487
3488
  let n = s?.get(hr(t.geom.imagePath, t.geom.duotone));
3488
3489
  if (n) {
3489
3490
  let r = t.geom.alpha;
3490
- r != null && r < 1 ? (e.save(), e.globalAlpha = r, Be(e, n, t.geom.srcRect, 0, 0, i, a), e.restore()) : Be(e, n, t.geom.srcRect, 0, 0, i, a);
3491
+ r != null && r < 1 ? (e.save(), e.globalAlpha = r, Fe(e, n, t.geom.srcRect, 0, 0, i, a), e.restore()) : Fe(e, n, t.geom.srcRect, 0, 0, i, a);
3491
3492
  }
3492
3493
  }
3493
3494
  t.text && Zi(e, t.text, i, a, o), e.restore();
@@ -3532,7 +3533,7 @@ function Zi(e, t, n, r, i) {
3532
3533
  let a = t.lIns / Y * i, o = t.rIns / Y * i, s = t.tIns / Y * i, c = t.bIns / Y * i, l = Math.max(0, n - a - o), u = Math.max(0, r - s - c);
3533
3534
  if (l <= 0 || u <= 0) return;
3534
3535
  let d = (e) => {
3535
- let t = (e.size > 0 ? e.size : Cr) * Oe * i, n = Sr(e.fontFace);
3536
+ let t = (e.size > 0 ? e.size : Cr) * Ve * i, n = Sr(e.fontFace);
3536
3537
  return {
3537
3538
  font: `${e.italic ? "italic " : ""}${e.bold ? "bold " : ""}${t}px ${n}`,
3538
3539
  px: t
@@ -3546,10 +3547,10 @@ function Zi(e, t, n, r, i) {
3546
3547
  for (let n of t.paragraphs) {
3547
3548
  let r = n.align || "l", a = (n.marL ?? 0) / Y * i, o = (n.marR ?? 0) / Y * i, s = (n.indent ?? 0) / Y * i, c = Math.max(0, s), u = Math.max(0, l - a - o), h = !1, g = () => h ? a : a + c, _ = () => h ? u : u - c, v = [], y = 0, b = 0, x = 0, S = !1, C = n.spaceLine?.type === "pct", w = (e) => {
3548
3549
  let r = e;
3549
- return n.spaceLine && (n.spaceLine.type === "pct" ? r *= n.spaceLine.val / 1e5 : r = n.spaceLine.val * Oe * i), t.autoFit === "norm" && t.lnSpcReduction != null && n.spaceLine?.type !== "pts" && (r *= 1 - t.lnSpcReduction), r;
3550
+ return n.spaceLine && (n.spaceLine.type === "pct" ? r *= n.spaceLine.val / 1e5 : r = n.spaceLine.val * Ve * i), t.autoFit === "norm" && t.lnSpcReduction != null && n.spaceLine?.type !== "pts" && (r *= 1 - t.lnSpcReduction), r;
3550
3551
  }, T = () => {
3551
3552
  if (b === 0) {
3552
- let e = (E || Cr) * Oe * i, t = Math.max(R(D, e), R(O, e)), n = e * 1.2;
3553
+ let e = (E || Cr) * Ve * i, t = Math.max(R(D, e), R(O, e)), n = e * 1.2;
3553
3554
  b = C ? n : Math.max(n, t), x = f(`${e}px ${Sr(D)}`, e);
3554
3555
  }
3555
3556
  b = w(b), m.push({
@@ -3570,7 +3571,7 @@ function Zi(e, t, n, r, i) {
3570
3571
  if (t.type === "math") {
3571
3572
  let e = Ki.get(t.nodes);
3572
3573
  if (!e) continue;
3573
- let n = (t.fontSize ?? (E || Cr)) * Oe * i, o = e.widthEm * n, s = e.ascentEm * n, c = e.descentEm * n, l = t.color ?? "#000000";
3574
+ let n = (t.fontSize ?? (E || Cr)) * Ve * i, o = e.widthEm * n, s = e.ascentEm * n, c = e.descentEm * n, l = t.color ?? "#000000";
3574
3575
  if (t.display) {
3575
3576
  T(), m.push({
3576
3577
  segs: [{
@@ -3675,7 +3676,7 @@ function Zi(e, t, n, r, i) {
3675
3676
  }
3676
3677
  }
3677
3678
  function Qi(e, t, n, r) {
3678
- let i = Ve(t.fill ?? (t.fillColor ? {
3679
+ let i = ze(t.fill ?? (t.fillColor ? {
3679
3680
  fillType: "solid",
3680
3681
  color: t.fillColor
3681
3682
  } : null), e, 0, 0, n, r, t.rot);
@@ -3701,7 +3702,7 @@ function ea(e, t, n, r) {
3701
3702
  let i = $i(t);
3702
3703
  if (i) {
3703
3704
  if (Ae(e, i, 1 / Y), i.fill) {
3704
- let a = Ve(i.fill, e, 0, 0, n, r, t.rot);
3705
+ let a = ze(i.fill, e, 0, 0, n, r, t.rot);
3705
3706
  a && (e.strokeStyle = a);
3706
3707
  }
3707
3708
  e.stroke();
@@ -3881,7 +3882,7 @@ function la(e, t, n, r, i, a, o, s, c, l, u, d, f, p, m, h, g = t.charts, _, v,
3881
3882
  y: j / i,
3882
3883
  w: O / i,
3883
3884
  h: k / i
3884
- }, Oe, 0, _, v, (e) => h?.get(He(e)), y), e.restore(), e.restore());
3885
+ }, Ve, 0, _, v, (e) => h?.get(Be(e)), y), e.restore(), e.restore());
3885
3886
  }
3886
3887
  }
3887
3888
  var ua = "600 12px \"Meiryo UI\", \"Segoe UI\", sans-serif", da = "11px \"Meiryo UI\", \"Segoe UI\", sans-serif", fa = "#FFFFFF", pa = "#BFBFBF", ma = "#F2F2F2", ha = "#404040", ga = "#FFFFFF", _a = "#000000", va = "#A5A5A5", ya = "#E7E6E6", ba = "#A6A6A6", xa = "#C6C6C6";
@@ -3971,7 +3972,7 @@ function Aa(e, t, n, r, i) {
3971
3972
  async function ja(e, t, n, r, i = 0, a = 0, o = null, s = null, c, l = !1) {
3972
3973
  let u = t === "image/svg+xml";
3973
3974
  if (u && s) return null;
3974
- let d = Pe(t, o, i, a);
3975
+ let d = je(t, o, i, a);
3975
3976
  if (!d) return null;
3976
3977
  let f = () => Ge(e, t, s, r, {
3977
3978
  widthPt: d.widthPt,
@@ -4002,8 +4003,8 @@ async function Ma(e, t, n, r) {
4002
4003
  imagePath: t.imagePath,
4003
4004
  mimeType: t.mimeType,
4004
4005
  svgImagePath: t.svgImagePath,
4005
- widthPt: t.nativeExtCx > 0 ? t.nativeExtCx / Re : 0,
4006
- heightPt: t.nativeExtCy > 0 ? t.nativeExtCy / Re : 0,
4006
+ widthPt: t.nativeExtCx > 0 ? t.nativeExtCx / He : 0,
4007
+ heightPt: t.nativeExtCy > 0 ? t.nativeExtCy / He : 0,
4007
4008
  srcRect: t.srcRect ?? null,
4008
4009
  duotone: t.duotone ?? null
4009
4010
  });
@@ -4012,14 +4013,14 @@ async function Ma(e, t, n, r) {
4012
4013
  imagePath: e.geom.imagePath,
4013
4014
  mimeType: e.geom.mimeType,
4014
4015
  svgImagePath: e.geom.svgImagePath,
4015
- widthPt: t.nativeExtCx > 0 ? t.nativeExtCx * e.w / Re : 0,
4016
- heightPt: t.nativeExtCy > 0 ? t.nativeExtCy * e.h / Re : 0,
4016
+ widthPt: t.nativeExtCx > 0 ? t.nativeExtCx * e.w / He : 0,
4017
+ heightPt: t.nativeExtCy > 0 ? t.nativeExtCy * e.h / He : 0,
4017
4018
  srcRect: e.geom.srcRect ?? null,
4018
4019
  duotone: e.geom.duotone ?? null
4019
4020
  });
4020
4021
  }
4021
4022
  let c = (e.charts ?? []).filter((t) => Aa(t, e, r?.viewport, o, s)).map((e) => e.chart);
4022
- for (let e of Me(c)) a.set(He(e), {
4023
+ for (let e of Me(c)) a.set(Be(e), {
4023
4024
  imagePath: e.imagePath,
4024
4025
  mimeType: e.mimeType,
4025
4026
  svgImagePath: e.svgImagePath,
@@ -4034,7 +4035,7 @@ async function Ma(e, t, n, r) {
4034
4035
  let a = await ja(n.imagePath, n.mimeType, n.svgImagePath, i, n.widthPt, n.heightPt, n.srcRect, n.duotone, r?.offscreenFactory, n.failClosedOnDuotoneFailure ?? !1);
4035
4036
  t.set(e, a);
4036
4037
  } catch (n) {
4037
- if (Fe(n)) throw n;
4038
+ if (Pe(n)) throw n;
4038
4039
  t.delete(e);
4039
4040
  }
4040
4041
  }));
@@ -4112,7 +4113,7 @@ function La(e, t, n, r, i) {
4112
4113
  //#endregion
4113
4114
  //#region packages/xlsx/src/google-fonts.ts
4114
4115
  var Ra = {
4115
- ...ne,
4116
+ ...B,
4116
4117
  ...l
4117
4118
  };
4118
4119
  function* za(e) {
@@ -4248,7 +4249,7 @@ var Ya = Symbol("retain-xlsx-viewer-fonts"), Xa = Symbol("prepare-xlsx-viewer-ro
4248
4249
  sheetLoads = /* @__PURE__ */ new Map();
4249
4250
  rawParts = new Ee({
4250
4251
  maxEntries: 64,
4251
- maxBytes: B
4252
+ maxBytes: ne
4252
4253
  });
4253
4254
  queuedImageLoads = /* @__PURE__ */ new Map();
4254
4255
  _fetchImage = (e, t) => this.getImageWithinArchiveOperation(e, t);
@@ -4306,7 +4307,7 @@ var Ya = Symbol("retain-xlsx-viewer-fonts"), Xa = Symbol("prepare-xlsx-viewer-ro
4306
4307
  s = ce(await ue(s, r.password));
4307
4308
  let c = s === n;
4308
4309
  o.setSourceBytes(s.byteLength), o.checkpoint("container ready");
4309
- let l = a === "worker" ? (await import("./render-worker-host-Bze5M6k5.js")).createRenderWorker() : new pt(), u;
4310
+ let l = a === "worker" ? (await import("./render-worker-host-CmPBviYJ.js")).createRenderWorker() : new pt(), u;
4310
4311
  try {
4311
4312
  return u = new e(l, a, r.wasmUrl), u.metrics = o, await u._load(s, r, i.policy, (e) => o.observeUsage(e), c), o.checkpoint("workbook index ready"), o.succeed({ sheets: u.sheetCount }), u;
4312
4313
  } catch (e) {
@@ -4408,6 +4409,10 @@ var Ya = Symbol("retain-xlsx-viewer-fonts"), Xa = Symbol("prepare-xlsx-viewer-ro
4408
4409
  this.sheetLoads.get(e) === r && this.sheetLoads.delete(e);
4409
4410
  }
4410
4411
  }
4412
+ async getComments(e) {
4413
+ let t = await this.getWorksheet(e);
4414
+ return structuredClone(t.comments ?? []);
4415
+ }
4411
4416
  async getResourceMetrics() {
4412
4417
  let e = this.metrics;
4413
4418
  if (!e) throw Error("Workbook not loaded");
@@ -5658,10 +5663,11 @@ var Zo = class {
5658
5663
  selection;
5659
5664
  find;
5660
5665
  comment;
5666
+ commentStatus;
5661
5667
  validation;
5662
5668
  constructor(e, t, n, r) {
5663
5669
  let i = e.ownerDocument ?? document;
5664
- this.selection = i.createElement("div"), this.selection.style.cssText = "position:absolute;top:0;left:0;z-index:1;pointer-events:none;overflow:hidden;width:100%;height:100%;", this.find = i.createElement("div"), this.find.style.cssText = "position:absolute;top:0;left:0;z-index:1;pointer-events:none;overflow:hidden;width:100%;height:100%;", this.comment = i.createElement("div"), this.comment.style.cssText = `position:absolute;z-index:3;pointer-events:none;display:none;max-width:${r.commentMaxWidth}px;max-height:${r.commentMaxHeight}px;overflow:hidden;box-sizing:border-box;padding:6px 8px;background:#fffbcc;border:1px solid #b8b8a0;box-shadow:1px 2px 5px rgba(0,0,0,0.25);font:12px/1.4 sans-serif;color:#222;white-space:pre-wrap;word-break:break-word;`, this.validation = i.createElement("div"), this.validation.setAttribute("data-xlsx-validation-panel", ""), this.validation.style.cssText = `position:absolute;z-index:4;pointer-events:auto;display:none;min-width:80px;max-width:${r.validationMaxWidth}px;max-height:${r.validationMaxHeight}px;overflow-y:auto;box-sizing:border-box;background:#fff;border:1px solid #7f7f7f;box-shadow:1px 2px 5px rgba(0,0,0,0.25);font:12px/1.4 sans-serif;color:#222;`, this.validation.addEventListener("wheel", (e) => e.stopPropagation()), e.appendChild(t), e.appendChild(this.selection), e.appendChild(this.find), e.appendChild(n), e.appendChild(this.comment), e.appendChild(this.validation);
5670
+ this.selection = i.createElement("div"), this.selection.style.cssText = "position:absolute;top:0;left:0;z-index:1;pointer-events:none;overflow:hidden;width:100%;height:100%;", this.find = i.createElement("div"), this.find.style.cssText = "position:absolute;top:0;left:0;z-index:1;pointer-events:none;overflow:hidden;width:100%;height:100%;", this.comment = i.createElement("div"), this.comment.dataset.ooxmlCommentUi = "popup", this.comment.setAttribute("role", "note"), this.comment.setAttribute("aria-hidden", "true"), this.comment.style.cssText = `position:absolute;z-index:3;pointer-events:none;display:none;max-width:${r.commentMaxWidth}px;max-height:${r.commentMaxHeight}px;overflow:hidden;font:13px/1.45 var(--ooxml-comment-font-family,system-ui,-apple-system,BlinkMacSystemFont,"Segoe UI",sans-serif);`, this.commentStatus = i.createElement("div"), this.commentStatus.setAttribute("role", "status"), this.commentStatus.setAttribute("aria-live", "polite"), this.commentStatus.setAttribute("aria-atomic", "true"), this.commentStatus.setAttribute("data-xlsx-comment-status", ""), this.commentStatus.style.cssText = "position:absolute;width:1px;height:1px;padding:0;margin:-1px;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", this.validation = i.createElement("div"), this.validation.setAttribute("data-xlsx-validation-panel", ""), this.validation.style.cssText = `position:absolute;z-index:4;pointer-events:auto;display:none;min-width:80px;max-width:${r.validationMaxWidth}px;max-height:${r.validationMaxHeight}px;overflow-y:auto;box-sizing:border-box;background:#fff;border:1px solid #7f7f7f;box-shadow:1px 2px 5px rgba(0,0,0,0.25);font:12px/1.4 sans-serif;color:#222;`, this.validation.addEventListener("wheel", (e) => e.stopPropagation()), e.appendChild(t), e.appendChild(this.selection), e.appendChild(this.find), e.appendChild(n), e.appendChild(this.comment), e.appendChild(this.commentStatus), e.appendChild(this.validation);
5665
5671
  }
5666
5672
  clearSelection() {
5667
5673
  this.selection.textContent = "";
@@ -5676,10 +5682,13 @@ var Zo = class {
5676
5682
  this.find.appendChild(e);
5677
5683
  }
5678
5684
  hideComment() {
5679
- this.comment.style.display = "none";
5685
+ this.comment.style.display = "none", this.comment.setAttribute("aria-hidden", "true"), this.commentStatus.textContent = "";
5686
+ }
5687
+ announceComment(e) {
5688
+ this.commentStatus.textContent = e;
5680
5689
  }
5681
5690
  showComment(e, t) {
5682
- this.comment.style.left = `${e}px`, this.comment.style.top = `${t}px`, this.comment.style.display = "block";
5691
+ this.comment.style.left = `${e}px`, this.comment.style.top = `${t}px`, this.comment.style.display = "block", this.comment.setAttribute("aria-hidden", "false");
5683
5692
  }
5684
5693
  hideValidation() {
5685
5694
  this.validation.style.display = "none";
@@ -5729,13 +5738,30 @@ function is(e) {
5729
5738
  }
5730
5739
  //#endregion
5731
5740
  //#region packages/xlsx/src/viewer.ts
5732
- var as = Symbol("XlsxViewer.borrowedWorkbook"), os = 150, ss = 280, cs = 200, ls = 240, us = 200, ds = 30, fs = 50, ps = 1, ms = 1, hs = .45, gs = "data-xlsx-viewer-styles", _s = ".xlsx-tab-strip::-webkit-scrollbar{display:none}[data-xlsx-viewport-input]:focus{outline:none}.xlsx-tab-nav{background:transparent;transition:background 0.1s;}.xlsx-tab-nav:hover{background:rgba(0,0,0,0.08);}.xlsx-zoom-slider{-webkit-appearance:none;appearance:none;background:transparent;height:15px;margin:0;}.xlsx-zoom-slider::-webkit-slider-runnable-track{height:4px;background:#c4c4c4;border-radius:2px;}.xlsx-zoom-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:12px;height:12px;margin-top:-4px;border-radius:50%;background:#808080;cursor:pointer;}.xlsx-zoom-slider:hover::-webkit-slider-thumb{background:#5f5f5f;}.xlsx-zoom-slider::-moz-range-track{height:4px;background:#c4c4c4;border-radius:2px;}.xlsx-zoom-slider::-moz-range-thumb{width:12px;height:12px;border:none;border-radius:50%;background:#808080;cursor:pointer;}";
5733
- function vs(e) {
5734
- if (!e.head || e.head.querySelector(`style[${gs}]`)) return;
5741
+ var as = Symbol("XlsxViewer.borrowedWorkbook"), os;
5742
+ function ss() {
5743
+ return os ??= import("./comment-ui-runtime-F4a3te6p.js");
5744
+ }
5745
+ var cs = 150, ls = 280, us = 200, ds = 240, fs = 200, ps = 30, ms = 50, hs = 1, gs = 1, _s = .45, vs = "data-xlsx-viewer-styles", ys = ".xlsx-tab-strip::-webkit-scrollbar{display:none}[data-xlsx-viewport-input]:focus{outline:none}[data-xlsx-viewport-input]:focus-visible{outline:2px solid var(--ooxml-xlsx-focus-ring,#2563eb);outline-offset:-2px}.xlsx-tab-nav{background:transparent;transition:background 0.1s;}.xlsx-tab-nav:hover{background:color-mix(in srgb,var(--ooxml-xlsx-chrome-text,#444) 8%,transparent);}.xlsx-zoom-slider{-webkit-appearance:none;appearance:none;background:transparent;height:15px;margin:0;}.xlsx-zoom-slider::-webkit-slider-runnable-track{height:4px;background:var(--ooxml-xlsx-chrome-border,#c4c4c4);border-radius:2px;}.xlsx-zoom-slider::-webkit-slider-thumb{-webkit-appearance:none;appearance:none;width:12px;height:12px;margin-top:-4px;border-radius:50%;background:var(--ooxml-xlsx-chrome-text-muted,#808080);cursor:pointer;}.xlsx-zoom-slider:hover::-webkit-slider-thumb{background:var(--ooxml-xlsx-chrome-text,#5f5f5f);}.xlsx-zoom-slider::-moz-range-track{height:4px;background:var(--ooxml-xlsx-chrome-border,#c4c4c4);border-radius:2px;}.xlsx-zoom-slider::-moz-range-thumb{width:12px;height:12px;border:none;border-radius:50%;background:var(--ooxml-xlsx-chrome-text-muted,#808080);cursor:pointer;}";
5746
+ function bs(e) {
5747
+ if (!e.head || e.head.querySelector(`style[${vs}]`)) return;
5735
5748
  let t = e.createElement("style");
5736
- t.setAttribute(gs, ""), t.textContent = _s, e.head.appendChild(t);
5749
+ t.setAttribute(vs, ""), t.textContent = ys, e.head.appendChild(t);
5750
+ }
5751
+ var xs = {
5752
+ background: "--ooxml-xlsx-chrome-background",
5753
+ surface: "--ooxml-xlsx-chrome-surface",
5754
+ mutedSurface: "--ooxml-xlsx-chrome-surface-muted",
5755
+ text: "--ooxml-xlsx-chrome-text",
5756
+ mutedText: "--ooxml-xlsx-chrome-text-muted",
5757
+ border: "--ooxml-xlsx-chrome-border",
5758
+ selectedSurface: "--ooxml-xlsx-chrome-selection-background",
5759
+ accent: "--ooxml-xlsx-chrome-accent"
5760
+ };
5761
+ function Ss(e, t) {
5762
+ return Object.keys(xs).every((n) => e[n] === t[n]);
5737
5763
  }
5738
- function ys(e) {
5764
+ function Cs(e) {
5739
5765
  let t = [...e].sort((e, t) => e.first - t.first || e.last - t.last), n = [];
5740
5766
  for (let e of t) {
5741
5767
  let t = n.at(-1);
@@ -5746,7 +5772,7 @@ function ys(e) {
5746
5772
  }
5747
5773
  return n;
5748
5774
  }
5749
- function bs(e, t) {
5775
+ function ws(e, t) {
5750
5776
  let n = 0, r = e.length - 1;
5751
5777
  for (; n <= r;) {
5752
5778
  let i = n + r >>> 1, a = e[i];
@@ -5756,7 +5782,7 @@ function bs(e, t) {
5756
5782
  }
5757
5783
  return !1;
5758
5784
  }
5759
- function xs(e, t, n) {
5785
+ function Ts(e, t, n) {
5760
5786
  let r = 0, i = e.length;
5761
5787
  for (; r < i;) {
5762
5788
  let a = r + i >>> 1;
@@ -5764,12 +5790,12 @@ function xs(e, t, n) {
5764
5790
  }
5765
5791
  return r;
5766
5792
  }
5767
- function Ss(e, t) {
5793
+ function Es(e, t) {
5768
5794
  for (let n = 1; n < e.length; n++) if (t(e[n - 1]) > t(e[n])) return [...e].sort((e, n) => t(e) - t(n));
5769
5795
  return e;
5770
5796
  }
5771
- var Cs = "#1a73e8", ws = 4, Ts = 5, Es = 25e4, Ds = 8 * 1024 * 1024, Os = 1 * 1024 * 1024, ks = 65536, As = 65536, js = 100;
5772
- function Ms(e, t) {
5797
+ var Ds = "#1a73e8", Os = 4, ks = 5, As = 25e4, js = 8 * 1024 * 1024, Ms = 1 * 1024 * 1024, Ns = 65536, Ps = 65536, Fs = 100;
5798
+ function Is(e, t) {
5773
5799
  let n = Math.min(e.length, Math.max(0, t));
5774
5800
  if (n > 0 && n < e.length) {
5775
5801
  let t = e.charCodeAt(n - 1), r = e.charCodeAt(n);
@@ -5777,7 +5803,7 @@ function Ms(e, t) {
5777
5803
  }
5778
5804
  return e.slice(0, n);
5779
5805
  }
5780
- function Ns(e, t) {
5806
+ function Ls(e, t) {
5781
5807
  let n = 0, r = !1;
5782
5808
  for (let t = 0; t < e.length; t++) {
5783
5809
  let i = e.charCodeAt(t);
@@ -5785,17 +5811,17 @@ function Ns(e, t) {
5785
5811
  }
5786
5812
  return e.length + (r ? n + 2 : 0) > t ? null : r ? `"${e.replace(/"/g, "\"\"")}"` : e;
5787
5813
  }
5788
- function Ps(e, t, n, r) {
5814
+ function Rs(e, t, n, r) {
5789
5815
  for (let { index: i, edge: a } of t) if (!(a <= r) && Math.abs(e - a) <= n) return i;
5790
5816
  return null;
5791
5817
  }
5792
- function Fs(e) {
5818
+ function zs(e) {
5793
5819
  return {
5794
5820
  border: `2px solid ${e}`,
5795
5821
  background: `color-mix(in srgb, ${e} 8%, transparent)`
5796
5822
  };
5797
5823
  }
5798
- function Is(e) {
5824
+ function Bs(e) {
5799
5825
  let t = [];
5800
5826
  for (let n of e) {
5801
5827
  let e = n.x + n.width, r = n.y + n.height;
@@ -5841,15 +5867,16 @@ function Is(e) {
5841
5867
  }
5842
5868
  return r.join("");
5843
5869
  }
5844
- var Ls = 0, Rs = "color-mix(in srgb, #ffb300 8%, transparent)", zs = "color-mix(in srgb, #fb8c00 8%, transparent)";
5845
- function Bs(e, t = {}) {
5846
- let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ? zs : Rs);
5870
+ var Vs = 0, Hs = "color-mix(in srgb, #ffb300 8%, transparent)", Us = "color-mix(in srgb, #fb8c00 8%, transparent)";
5871
+ function Ws(e, t = {}) {
5872
+ let n = e ? "#fb8c00" : "#ffb300", r = e ? t.active : t.match, i = r ?? (e ? Us : Hs);
5847
5873
  return {
5848
5874
  border: `2px solid ${r ?? n}`,
5849
5875
  background: i
5850
5876
  };
5851
5877
  }
5852
- var Vs = class {
5878
+ var Gs = class {
5879
+ container;
5853
5880
  hostDocument;
5854
5881
  hostWindow;
5855
5882
  acquisition = new Yo();
@@ -5872,7 +5899,7 @@ var Vs = class {
5872
5899
  stashedRowHeights = /* @__PURE__ */ new Map();
5873
5900
  stashedColWidths = /* @__PURE__ */ new Map();
5874
5901
  sizeOverrideStore = /* @__PURE__ */ new Map();
5875
- projectionId = ms++;
5902
+ projectionId = gs++;
5876
5903
  canvasArea;
5877
5904
  scrollHost;
5878
5905
  spacer;
@@ -5893,6 +5920,9 @@ var Vs = class {
5893
5920
  fontBinding = null;
5894
5921
  _hiddenSheetMode;
5895
5922
  currentWorksheet = null;
5923
+ currentSourceComments = [];
5924
+ commentNavigationGeneration = 0;
5925
+ sourceCommentMap = /* @__PURE__ */ new Map();
5896
5926
  sheetViews = /* @__PURE__ */ new Map();
5897
5927
  opts;
5898
5928
  _mountKind;
@@ -5902,6 +5932,10 @@ var Vs = class {
5902
5932
  preparedWorkbook = null;
5903
5933
  _destroyed = !1;
5904
5934
  resizeObserver = null;
5935
+ chromeColors = {};
5936
+ chromeStyleObserver = null;
5937
+ chromeSchemeMedia = null;
5938
+ chromeSchemeListener = null;
5905
5939
  _lastViewportNotification = null;
5906
5940
  get anchorCell() {
5907
5941
  return this.selectionController.anchor;
@@ -5949,44 +5983,85 @@ var Vs = class {
5949
5983
  hyperlinkMap = /* @__PURE__ */ new Map();
5950
5984
  commentPopupKey = null;
5951
5985
  commentPopupTimer = null;
5986
+ commentPopupCell = null;
5987
+ commentPopupPositionScheduled = !1;
5988
+ commentPopupResizeObserver = null;
5989
+ commentUi = null;
5990
+ commentPopupRenderGeneration = 0;
5952
5991
  validationPanel;
5953
5992
  validationPanelKey = null;
5954
5993
  validationRequestGeneration = 0;
5955
5994
  validationArrowRect = null;
5956
5995
  validationOutsideHandler = null;
5957
5996
  constructor(e, t = {}, n) {
5958
- this.hostDocument = (n.kind === "sheet" ? n.canvas.ownerDocument : e.ownerDocument) ?? document;
5997
+ this.container = e, this.hostDocument = (n.kind === "sheet" ? n.canvas.ownerDocument : e.ownerDocument) ?? document;
5959
5998
  let r = this.hostDocument.defaultView;
5960
5999
  if (!r) throw Error("XlsxViewer requires a document with an active Window");
5961
6000
  this.hostWindow = r, this.opts = t, this._mountKind = n.kind, this._nativeScrollbars = t.showScrollbars ?? !0;
5962
6001
  let i = t[as];
5963
- this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode : ge("XlsxViewer", t.mode, i), this._hiddenSheetMode = t.hiddenSheetMode ?? "show", this.viewport = new Zo(t.cellScale ?? 1), this.wrapper = this.hostDocument.createElement("div"), this.wrapper.style.cssText = `position:relative;width:100%;height:100%;background:${n.kind === "composite" ? "#fff" : "transparent"};box-sizing:border-box;font-family:sans-serif;display:flex;flex-direction:column;`, this.gridRegion = this.hostDocument.createElement("div"), this.gridRegion.style.cssText = "position:relative;flex:1;min-height:0;overflow:hidden;";
5964
- let a = "position:absolute;top:0;left:0;z-index:3;display:none;background:#f5f5f5;";
5965
- if (this.cornerGutter = this.hostDocument.createElement("canvas"), this.cornerGutter.style.cssText = a, this.cornerGutter.setAttribute("data-xlsx-outline", "corner"), this.colGutter = this.hostDocument.createElement("canvas"), this.colGutter.style.cssText = a, this.colGutter.setAttribute("data-xlsx-outline", "col"), this.rowGutter = this.hostDocument.createElement("canvas"), this.rowGutter.style.cssText = a, this.rowGutter.setAttribute("data-xlsx-outline", "row"), this.canvasArea = this.hostDocument.createElement("div"), this.canvasArea.style.cssText = "position:absolute;inset:0;overflow:hidden;", this.canvas = n.kind === "sheet" ? n.canvas : this.hostDocument.createElement("canvas"), this.canvas.style.cssText = "position:absolute;top:0;left:0;z-index:0;display:block;", this.renderDispatcher = new Qo(this.canvas, this._mode === "worker", this.hostWindow), this.scrollHost = this.hostDocument.createElement("div"), this.scrollHost.setAttribute("data-xlsx-viewport-input", n.kind), this.scrollHost.tabIndex = 0, this.scrollHost.style.cssText = `position:absolute;inset:0;overflow:${this._nativeScrollbars ? "auto" : "clip"};z-index:2;background:transparent;`, this.spacer = this.hostDocument.createElement("div"), this.spacer.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;", this._nativeScrollbars && this.scrollHost.appendChild(this.spacer), this.surface = new es(this.canvas, this.canvasArea, this.scrollHost), this.overlayHost = new ts(this.canvasArea, this.canvas, this.scrollHost, {
5966
- commentMaxWidth: ss,
5967
- commentMaxHeight: cs,
5968
- validationMaxWidth: ls,
5969
- validationMaxHeight: us
5970
- }), this.selectionOverlay = this.overlayHost.selection, this.findOverlay = this.overlayHost.find, this.commentPopup = this.overlayHost.comment, this.validationPanel = this.overlayHost.validation, vs(this.hostDocument), n.kind === "composite") {
5971
- this.tabBar = this.hostDocument.createElement("div"), this.tabBar.style.cssText = `display:flex;align-items:flex-end;height:${ds}px;flex-shrink:0;background:#f0f0f0;border-top:1px solid #c8ccd0;`, this.navPrev = this.makeNavButton("◀", "Scroll tabs left", () => this.scrollTabs(-1)), this.navNext = this.makeNavButton("▶", "Scroll tabs right", () => this.scrollTabs(1)), this.navPrev.dataset.xlsxTabNav = "prev", this.navNext.dataset.xlsxTabNav = "next";
6002
+ this._borrowed = i !== void 0, this._mode = n.kind === "sheet" ? n.mode : ge("XlsxViewer", t.mode, i), this._hiddenSheetMode = t.hiddenSheetMode ?? "show", this.viewport = new Zo(t.cellScale ?? 1), this.wrapper = this.hostDocument.createElement("div"), this.wrapper.style.cssText = `position:relative;width:100%;height:100%;background:${n.kind === "composite" ? "var(--ooxml-xlsx-chrome-surface,#fff)" : "transparent"};box-sizing:border-box;font-family:sans-serif;display:flex;flex-direction:column;`, this.gridRegion = this.hostDocument.createElement("div"), this.gridRegion.style.cssText = "position:relative;flex:1;min-height:0;overflow:hidden;";
6003
+ let a = "position:absolute;top:0;left:0;z-index:3;display:none;background:var(--ooxml-xlsx-chrome-background,#f5f5f5);";
6004
+ this.cornerGutter = this.hostDocument.createElement("canvas"), this.cornerGutter.style.cssText = a, this.cornerGutter.setAttribute("data-xlsx-outline", "corner"), this.colGutter = this.hostDocument.createElement("canvas"), this.colGutter.style.cssText = a, this.colGutter.setAttribute("data-xlsx-outline", "col"), this.rowGutter = this.hostDocument.createElement("canvas"), this.rowGutter.style.cssText = a, this.rowGutter.setAttribute("data-xlsx-outline", "row"), this.canvasArea = this.hostDocument.createElement("div"), this.canvasArea.style.cssText = "position:absolute;inset:0;overflow:hidden;", this.canvas = n.kind === "sheet" ? n.canvas : this.hostDocument.createElement("canvas"), this.canvas.style.cssText = "position:absolute;top:0;left:0;z-index:0;display:block;", this.renderDispatcher = new Qo(this.canvas, this._mode === "worker", this.hostWindow), this.scrollHost = this.hostDocument.createElement("div"), this.scrollHost.setAttribute("data-xlsx-viewport-input", n.kind), this.scrollHost.setAttribute("role", "region"), this.scrollHost.setAttribute("aria-label", "Spreadsheet viewport. Use Arrow keys to move the selected cell. Press Enter to show its comment."), this.scrollHost.tabIndex = 0, this.scrollHost.style.cssText = `position:absolute;inset:0;overflow:${this._nativeScrollbars ? "auto" : "clip"};z-index:2;background:transparent;scrollbar-color:var(--ooxml-xlsx-chrome-scrollbar-color,auto);`, this.spacer = this.hostDocument.createElement("div"), this.spacer.style.cssText = "position:absolute;top:0;left:0;pointer-events:none;", this._nativeScrollbars && this.scrollHost.appendChild(this.spacer), this.surface = new es(this.canvas, this.canvasArea, this.scrollHost), this.overlayHost = new ts(this.canvasArea, this.canvas, this.scrollHost, {
6005
+ commentMaxWidth: ls,
6006
+ commentMaxHeight: us,
6007
+ validationMaxWidth: ds,
6008
+ validationMaxHeight: fs
6009
+ }), this.selectionOverlay = this.overlayHost.selection, this.findOverlay = this.overlayHost.find, this.commentPopup = this.overlayHost.comment;
6010
+ let o = this.hostDocument.defaultView?.ResizeObserver ?? globalThis.ResizeObserver;
6011
+ if (o && (this.commentPopupResizeObserver = new o(() => {
6012
+ this.scheduleCommentPopupPosition();
6013
+ }), this.commentPopupResizeObserver.observe(this.commentPopup)), this.validationPanel = this.overlayHost.validation, bs(this.hostDocument), n.kind === "composite") {
6014
+ this.tabBar = this.hostDocument.createElement("div"), this.tabBar.style.cssText = `display:flex;align-items:flex-end;height:${ps}px;flex-shrink:0;background:var(--ooxml-xlsx-chrome-background,#f0f0f0);border-top:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);`, this.navPrev = this.makeNavButton("◀", "Scroll tabs left", () => this.scrollTabs(-1)), this.navNext = this.makeNavButton("▶", "Scroll tabs right", () => this.scrollTabs(1)), this.navPrev.dataset.xlsxTabNav = "prev", this.navNext.dataset.xlsxTabNav = "next";
5972
6015
  let e = this.hostDocument.createElement("div");
5973
- e.style.cssText = `display:flex;flex-shrink:0;width:${fs}px;height:100%;`, e.appendChild(this.navPrev), e.appendChild(this.navNext), this.tabStrip = this.hostDocument.createElement("div"), this.tabStrip.style.cssText = `position:relative;display:block;flex:1;min-width:0;height:100%;margin-left:${ps}px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;`, this.tabStrip.classList.add("xlsx-tab-strip"), this.tabStrip.addEventListener("scroll", () => this.updateNavButtons()), this.tabList = this.hostDocument.createElement("div"), this.tabList.style.cssText = `display:flex;align-items:flex-end;height:100%;gap:${ps}px;box-sizing:border-box;`, this.tabList.style.width = "max-content", this.tabList.style.minWidth = "100%", this.tabStrip.appendChild(this.tabList), this.tabBar.appendChild(e), this.tabBar.appendChild(this.tabStrip), this.opts.showZoomSlider !== !1 && this.tabBar.appendChild(this.buildZoomControl());
6016
+ e.style.cssText = `display:flex;flex-shrink:0;width:${ms}px;height:100%;`, e.appendChild(this.navPrev), e.appendChild(this.navNext), this.tabStrip = this.hostDocument.createElement("div"), this.tabStrip.style.cssText = `position:relative;display:block;flex:1;min-width:0;height:100%;margin-left:${hs}px;overflow-x:auto;overflow-y:hidden;scrollbar-width:none;`, this.tabStrip.classList.add("xlsx-tab-strip"), this.tabStrip.addEventListener("scroll", () => this.updateNavButtons()), this.tabList = this.hostDocument.createElement("div"), this.tabList.style.cssText = `display:flex;align-items:flex-end;height:100%;gap:${hs}px;box-sizing:border-box;`, this.tabList.style.width = "max-content", this.tabList.style.minWidth = "100%", this.tabStrip.appendChild(this.tabList), this.tabBar.appendChild(e), this.tabBar.appendChild(this.tabStrip), this.opts.showZoomSlider !== !1 && this.tabBar.appendChild(this.buildZoomControl());
5974
6017
  }
5975
- this.gridRegion.appendChild(this.canvasArea), this.wrapper.appendChild(this.gridRegion), n.kind === "composite" && this.wrapper.appendChild(this.tabBar), e.appendChild(this.wrapper), this.rowGutter.addEventListener("pointerdown", (e) => this.onGutterPointerDown(e, "row")), this.colGutter.addEventListener("pointerdown", (e) => this.onGutterPointerDown(e, "col")), this._nativeScrollbars && this.surface.on("scroll", () => {
6018
+ this.gridRegion.appendChild(this.canvasArea), this.wrapper.appendChild(this.gridRegion), n.kind === "composite" && this.wrapper.appendChild(this.tabBar), e.appendChild(this.wrapper), this.installChromeThemeRefresh(), this.rowGutter.addEventListener("pointerdown", (e) => this.onGutterPointerDown(e, "row")), this.colGutter.addEventListener("pointerdown", (e) => this.onGutterPointerDown(e, "col")), this._nativeScrollbars && this.surface.on("scroll", () => {
5976
6019
  if (this.pendingTap = null, this.pendingElementClick = null, this.hideCommentPopup(), this.hideValidationPanel(), this.scrollHost.clientWidth > 0) {
5977
6020
  let e = this.scrollHost.scrollLeft, t = this.isRtl ? this.maxScrollLeft - e : e;
5978
6021
  this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.viewport.setOffset(t, this.scrollHost.scrollTop);
5979
6022
  }
5980
6023
  this.emitViewportChange(), this.scheduleRender(), this.updateSelectionOverlay(), this.updateFindOverlay();
5981
6024
  });
5982
- let o = new this.hostWindow.ResizeObserver(() => {
6025
+ let s = new this.hostWindow.ResizeObserver(() => {
5983
6026
  let e = {
5984
6027
  x: this.viewport.x,
5985
6028
  y: this.viewport.y
5986
6029
  };
5987
6030
  this.viewport.setViewportSize(this.scrollHost.clientWidth, this.scrollHost.clientHeight), this.setViewportLeft(e.x), this.viewportTop = e.y, this.reanchorHorizontalScroll(), this.layoutGutters(), this.scheduleRender(), this.updateSelectionOverlay(), this.updateFindOverlay(), this.updateNavButtons();
5988
6031
  });
5989
- o.observe(this.gridRegion), this.resizeObserver = o, this.setupSelectionEvents(), this._find = new Fo(() => this.sheetCount, (e) => this.wb?.sheetNames[e] ?? "", (e) => this._collectSheetCells(e)), i && (this.acquisition.install(i, !1), this._mountKind === "composite" && this.activateWorkbook(i).catch((e) => this._reportRenderError(e)));
6032
+ s.observe(this.gridRegion), this.resizeObserver = s, this.setupSelectionEvents(), this._find = new Fo(() => this.sheetCount, (e) => this.wb?.sheetNames[e] ?? "", (e) => this._collectSheetCells(e)), i && (this.acquisition.install(i, !1), this._mountKind === "composite" && this.activateWorkbook(i).catch((e) => this._reportRenderError(e)));
6033
+ }
6034
+ refreshChromeTheme() {
6035
+ if (this._destroyed) return;
6036
+ let e = this.hostWindow.getComputedStyle?.bind(this.hostWindow);
6037
+ if (!e) return;
6038
+ let t = e(this.wrapper), n = {};
6039
+ for (let [e, r] of Object.entries(xs)) {
6040
+ let i = t.getPropertyValue(r).trim();
6041
+ i && (n[e] = i);
6042
+ }
6043
+ let r = n;
6044
+ Ss(this.chromeColors, r) || (this.chromeColors = r, this.renderGutters(), this.scheduleRender());
6045
+ }
6046
+ installChromeThemeRefresh() {
6047
+ this.refreshChromeTheme();
6048
+ let e = this.hostWindow.MutationObserver ?? globalThis.MutationObserver;
6049
+ if (e) {
6050
+ this.chromeStyleObserver = new e(() => this.refreshChromeTheme());
6051
+ for (let e = this.container; e; e = e.parentElement) this.chromeStyleObserver.observe(e, {
6052
+ attributes: !0,
6053
+ attributeFilter: [
6054
+ "class",
6055
+ "style",
6056
+ "data-theme"
6057
+ ]
6058
+ });
6059
+ }
6060
+ let t = this.hostWindow.matchMedia?.("(prefers-color-scheme: dark)") ?? null;
6061
+ if (t) {
6062
+ let e = () => this.refreshChromeTheme();
6063
+ t.addEventListener?.("change", e), this.chromeSchemeMedia = t, this.chromeSchemeListener = e;
6064
+ }
5990
6065
  }
5991
6066
  async _collectSheetCells(e) {
5992
6067
  let t = this.wb;
@@ -6060,22 +6135,21 @@ var Vs = class {
6060
6135
  e ? this.acquisition.install(e) : this.acquisition.destroy();
6061
6136
  }
6062
6137
  async showSheet(e) {
6063
- let t = ++this.sheetRequestGeneration, n = this.workbook, r;
6138
+ let t = ++this.sheetRequestGeneration, n = this.workbook, r, i;
6064
6139
  try {
6065
6140
  if (!await this.ensureHostFonts(n)) return;
6066
- let t = await n.getWorksheet(e);
6067
- r = this.sheetViews.get(e) ?? Xo(t);
6068
- let i = n[Xa];
6069
- if (typeof i == "function") {
6141
+ i = await n.getWorksheet(e), r = this.sheetViews.get(e) ?? this.createVisibleSheetView(i);
6142
+ let t = n[Xa];
6143
+ if (typeof t == "function") {
6070
6144
  let e = this.hostDocument.createElement("canvas").getContext("2d");
6071
- e && i.call(n, r, e);
6145
+ e && t.call(n, r, e);
6072
6146
  }
6073
6147
  this.syncAutomaticRowOverrides(e, r), this.sheetViews.set(e, r);
6074
6148
  } catch (e) {
6075
6149
  if (!this.isCurrentSheetRequest(t, n)) return;
6076
6150
  throw e;
6077
6151
  }
6078
- this.isCurrentSheetRequest(t, n) && (this.currentSheet = e, this.currentWorksheet = r, this.setElementContext(null), this.pendingElementClick = null, this.updateFooterDirection(), this.viewportTop = 0, this.selectionController.reset(), this.emitSelectionChange(), this.hideCommentPopup(), this.hideValidationPanel(), this.updateSelectionOverlay(), this.updateTabActive(e), this.buildCommentMap(this.currentWorksheet), this.buildHyperlinkMap(this.currentWorksheet), this.buildOutline(this.currentWorksheet), this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), this.resetHorizontalScroll(), await this.renderCurrentSheet(), this.isCurrentSheetRequest(t, n) && (this.updateFindOverlay(), this.emitViewportChange(), this.opts.onSheetChange?.(e, this.workbook.sheetNames.length)));
6152
+ this.isCurrentSheetRequest(t, n) && (this.currentSheet = e, this.currentWorksheet = r, this.currentSourceComments = i.comments ?? [], this.opts.comments !== !1 && this.currentSourceComments.length > 0 && this.loadCommentUi().catch((e) => this._reportRenderError(e)), this.sourceCommentMap = this.createCommentMap(this.currentSourceComments), this.setElementContext(null), this.pendingElementClick = null, this.updateFooterDirection(), this.viewportTop = 0, this.selectionController.reset(), this.emitSelectionChange(), this.hideCommentPopup(), this.hideValidationPanel(), this.updateSelectionOverlay(), this.updateTabActive(e), this.buildCommentMap(this.currentWorksheet), this.buildHyperlinkMap(this.currentWorksheet), this.buildOutline(this.currentWorksheet), this.layoutGutters(), this.updateSpacerSize(this.currentWorksheet), this.resetHorizontalScroll(), await this.renderCurrentSheet(), this.isCurrentSheetRequest(t, n) && (this.updateFindOverlay(), this.emitViewportChange(), this.opts.onSheetChange?.(e, this.workbook.sheetNames.length)));
6079
6153
  }
6080
6154
  isCurrentSheetRequest(e, t) {
6081
6155
  return !this._destroyed && e === this.sheetRequestGeneration && this.wb === t;
@@ -6112,9 +6186,9 @@ var Vs = class {
6112
6186
  if (o <= 0 || s <= 0) return;
6113
6187
  let c = this.surface.sizeCanvas(i, o, s), l = i.getContext("2d");
6114
6188
  if (!l) return;
6115
- l.setTransform(c, 0, 0, c, 0, 0), l.clearRect(0, 0, o, s), l.fillStyle = "#f5f5f5", l.fillRect(0, 0, o, s);
6189
+ l.setTransform(c, 0, 0, c, 0, 0), l.clearRect(0, 0, o, s), l.fillStyle = this.chromeColors.background ?? "#f5f5f5", l.fillRect(0, 0, o, s);
6116
6190
  let u = 19 * n;
6117
- l.strokeStyle = "#808080", l.lineWidth = 1, l.fillStyle = "#404040";
6191
+ l.strokeStyle = this.chromeColors.border ?? "#808080", l.lineWidth = 1, l.fillStyle = this.chromeColors.text ?? "#404040";
6118
6192
  let d = Q(t), f = d.effectiveFrozenBands({
6119
6193
  scale: n,
6120
6194
  width: this.canvasArea.clientWidth,
@@ -6128,7 +6202,7 @@ var Vs = class {
6128
6202
  return n.w <= 0 || n.h <= 0 ? !1 : (l.save(), l.beginPath(), l.rect(n.x, n.y, n.w, n.h), l.clip(), !0);
6129
6203
  };
6130
6204
  for (let t of a.groups) {
6131
- let i = (t.level - 1 + .5) * u, a = r ? this.getCellRect(t.start, 1) : this.getCellRect(1, t.start), o = r ? this.getCellRect(t.end, 1) : this.getCellRect(1, t.end);
6205
+ let i = (t.level - 1 + .5) * u, a = r ? this._cellRect(t.start, 1) : this._cellRect(1, t.start), o = r ? this._cellRect(t.end, 1) : this._cellRect(1, t.end);
6132
6206
  if (!a || !o) continue;
6133
6207
  let s = r ? a.y : this.screenX(a.x, a.w), c = r ? o.y + o.h : this.screenX(o.x, o.w) + o.w, d = Math.min(s, c), f = Math.max(s, c);
6134
6208
  if (!t.collapsed && f - d > 1 && v(t.start, t.end)) {
@@ -6137,7 +6211,7 @@ var Vs = class {
6137
6211
  l.stroke(), l.restore();
6138
6212
  }
6139
6213
  if (t.summary != null) {
6140
- let e = r ? this.getCellRect(t.summary, 1) : this.getCellRect(1, t.summary);
6214
+ let e = r ? this._cellRect(t.summary, 1) : this._cellRect(1, t.summary);
6141
6215
  if (e) {
6142
6216
  let a = r ? e.y + e.h / 2 : this.screenX(e.x, e.w) + e.w / 2;
6143
6217
  v(t.summary, t.summary) && (this.drawToggleBox(l, r ? i : a, r ? a : i, t.collapsed, n), l.restore());
@@ -6152,22 +6226,22 @@ var Vs = class {
6152
6226
  }
6153
6227
  if (m > 0) {
6154
6228
  let e = r ? g + h : t.rightToLeft === !0 ? o - g - h : g + h;
6155
- l.save(), l.strokeStyle = "#7a7a7a", l.lineWidth = .5, l.beginPath(), r ? (l.moveTo(0, e), l.lineTo(o, e)) : (l.moveTo(e, 0), l.lineTo(e, s)), l.stroke(), l.restore();
6229
+ l.save(), l.strokeStyle = this.chromeColors.border ?? "#7a7a7a", l.lineWidth = .5, l.beginPath(), r ? (l.moveTo(0, e), l.lineTo(o, e)) : (l.moveTo(e, 0), l.lineTo(e, s)), l.stroke(), l.restore();
6156
6230
  }
6157
6231
  }
6158
6232
  drawToggleBox(e, t, n, r, i) {
6159
6233
  let a = Math.round(9 * i), o = Math.round(t - a / 2), s = Math.round(n - a / 2);
6160
- e.save(), e.fillStyle = "#ffffff", e.strokeStyle = "#808080", e.lineWidth = 1, e.fillRect(o + .5, s + .5, a, a), e.strokeRect(o + .5, s + .5, a, a), e.strokeStyle = "#404040", e.beginPath(), e.moveTo(o + 2.5, s + a / 2 + .5), e.lineTo(o + a - 1.5, s + a / 2 + .5), r && (e.moveTo(o + a / 2 + .5, s + 2.5), e.lineTo(o + a / 2 + .5, s + a - 1.5)), e.stroke(), e.restore();
6234
+ e.save(), e.fillStyle = this.chromeColors.surface ?? "#ffffff", e.strokeStyle = this.chromeColors.border ?? "#808080", e.lineWidth = 1, e.fillRect(o + .5, s + .5, a, a), e.strokeRect(o + .5, s + .5, a, a), e.strokeStyle = this.chromeColors.text ?? "#404040", e.beginPath(), e.moveTo(o + 2.5, s + a / 2 + .5), e.lineTo(o + a - 1.5, s + a / 2 + .5), r && (e.moveTo(o + a / 2 + .5, s + 2.5), e.lineTo(o + a / 2 + .5, s + a - 1.5)), e.stroke(), e.restore();
6161
6235
  }
6162
6236
  drawLevelButton(e, t, n, r, i) {
6163
6237
  let a = Math.round(12 * i), o = Math.round(t - a / 2), s = Math.round(n - a / 2);
6164
- e.save(), e.font = `${Math.round(9 * i)}px sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = "#ffffff", e.strokeStyle = "#808080", e.lineWidth = 1, e.fillRect(o + .5, s + .5, a, a), e.strokeRect(o + .5, s + .5, a, a), e.fillStyle = "#404040", e.fillText(r, t, n + .5), e.restore();
6238
+ e.save(), e.font = `${Math.round(9 * i)}px sans-serif`, e.textAlign = "center", e.textBaseline = "middle", e.fillStyle = this.chromeColors.surface ?? "#ffffff", e.strokeStyle = this.chromeColors.border ?? "#808080", e.lineWidth = 1, e.fillRect(o + .5, s + .5, a, a), e.strokeRect(o + .5, s + .5, a, a), e.fillStyle = this.chromeColors.text ?? "#404040", e.fillText(r, t, n + .5), e.restore();
6165
6239
  }
6166
6240
  paintCornerGutter() {
6167
6241
  let e = this.cornerGutter, t = parseFloat(e.style.width) || 0, n = parseFloat(e.style.height) || 0;
6168
6242
  if (t <= 0 || n <= 0) return;
6169
6243
  let r = this.surface.sizeCanvas(e, t, n), i = e.getContext("2d");
6170
- i && (i.setTransform(r, 0, 0, r, 0, 0), i.clearRect(0, 0, t, n), i.fillStyle = "#f5f5f5", i.fillRect(0, 0, t, n));
6244
+ i && (i.setTransform(r, 0, 0, r, 0, 0), i.clearRect(0, 0, t, n), i.fillStyle = this.chromeColors.background ?? "#f5f5f5", i.fillRect(0, 0, t, n));
6171
6245
  }
6172
6246
  onGutterPointerDown(e, t) {
6173
6247
  if (!this.currentWorksheet) return;
@@ -6186,7 +6260,7 @@ var Vs = class {
6186
6260
  }
6187
6261
  for (let i of r.groups) {
6188
6262
  if (i.summary == null) continue;
6189
- let r = (i.level - 1 + .5) * c, s = n ? this.getCellRect(i.summary, 1) : this.getCellRect(1, i.summary);
6263
+ let r = (i.level - 1 + .5) * c, s = n ? this._cellRect(i.summary, 1) : this._cellRect(1, i.summary);
6190
6264
  if (!s) continue;
6191
6265
  let u = n ? s.y + s.h / 2 : this.screenX(s.x, s.w) + s.w / 2, d = n ? r : u, f = n ? u : r;
6192
6266
  if (Math.abs(a - d) <= l && Math.abs(o - f) <= l) {
@@ -6303,7 +6377,7 @@ var Vs = class {
6303
6377
  return this.currentWorksheet?.rightToLeft === !0;
6304
6378
  }
6305
6379
  updateFooterDirection() {
6306
- this._mountKind === "composite" && (this.tabBar.style.flexDirection = this.isRtl ? "row-reverse" : "row", this.tabStrip.style.marginLeft = this.isRtl ? "0" : `${ps}px`, this.tabStrip.style.marginRight = this.isRtl ? `${ps}px` : "0", this.tabList.style.flexDirection = this.isRtl ? "row-reverse" : "row");
6380
+ this._mountKind === "composite" && (this.tabBar.style.flexDirection = this.isRtl ? "row-reverse" : "row", this.tabStrip.style.marginLeft = this.isRtl ? "0" : `${hs}px`, this.tabStrip.style.marginRight = this.isRtl ? `${hs}px` : "0", this.tabList.style.flexDirection = this.isRtl ? "row-reverse" : "row");
6307
6381
  }
6308
6382
  get maxScrollLeft() {
6309
6383
  return this.syncNativeViewportExtent(), this.viewport.maxX;
@@ -6438,7 +6512,7 @@ var Vs = class {
6438
6512
  y: t - i.top
6439
6513
  }, r);
6440
6514
  }
6441
- getCellRect(e, t) {
6515
+ _cellRect(e, t) {
6442
6516
  let n = this.currentWorksheet;
6443
6517
  if (!n) return null;
6444
6518
  let r = this.viewport.scale;
@@ -6450,6 +6524,38 @@ var Vs = class {
6450
6524
  headerHeight: 22
6451
6525
  });
6452
6526
  }
6527
+ getCellViewportRect(e) {
6528
+ if (this._destroyed) return null;
6529
+ let t = typeof e == "string" ? dr(e) : e;
6530
+ if (!t || t.row < 1 || t.col < 1) return null;
6531
+ let n = this._cellRect(t.row, t.col);
6532
+ return n ? Object.freeze({
6533
+ x: this.screenX(n.x, n.w),
6534
+ y: n.y,
6535
+ width: n.w,
6536
+ height: n.h
6537
+ }) : null;
6538
+ }
6539
+ getComments() {
6540
+ return this.assertOpen(), structuredClone(this.currentSourceComments);
6541
+ }
6542
+ async goToComment(e, t, n) {
6543
+ let r = dr(t), i = this.wb;
6544
+ if (!r || !i || !Number.isInteger(e) || e < 0 || e >= i.sheetCount) return !1;
6545
+ let a = ++this.commentNavigationGeneration, o = e === this.currentSheet && this.currentWorksheet !== null ? this.currentSourceComments : await i.getComments(e);
6546
+ if (this._destroyed) throw this.destroyedError();
6547
+ if (a !== this.commentNavigationGeneration || i !== this.wb || !o.some((e) => {
6548
+ let t = dr(e.cellRef);
6549
+ return t?.row === r.row && t.col === r.col;
6550
+ })) return !1;
6551
+ if (e !== this.currentSheet || this.currentWorksheet === null) {
6552
+ if (await this.goToSheet(e), this._destroyed) throw this.destroyedError();
6553
+ if (a !== this.commentNavigationGeneration || i !== this.wb || e !== this.currentSheet) return !1;
6554
+ }
6555
+ let s = this.sheetRequestGeneration, c = this.currentSheet, l = this.currentWorksheet;
6556
+ if (await this.scrollToCell(t, n), this._destroyed) throw this.destroyedError();
6557
+ return a !== this.commentNavigationGeneration || i !== this.wb || s !== this.sheetRequestGeneration || c !== this.currentSheet || l !== this.currentWorksheet ? !1 : (this.setSelection(t), !0);
6558
+ }
6453
6559
  get selectionState() {
6454
6560
  return this.selectionController.snapshot();
6455
6561
  }
@@ -6467,22 +6573,22 @@ var Vs = class {
6467
6573
  if (!t || !n) return null;
6468
6574
  let r = e.maxCells ?? 1e3;
6469
6575
  if (!Number.isFinite(r) || r < 0) throw RangeError("maxCells must be a finite non-negative number.");
6470
- let i = Math.min(wo, Math.floor(r)), a = e.maxTextCharacters ?? Os;
6576
+ let i = Math.min(wo, Math.floor(r)), a = e.maxTextCharacters ?? Ms;
6471
6577
  if (!Number.isFinite(a) || a < 0) throw RangeError("maxTextCharacters must be a finite non-negative number.");
6472
6578
  let o = Math.min(To, Math.floor(a)), s = 0, c = !1, l = (e) => {
6473
6579
  let t = typeof e == "string" ? [e] : e, n = [], r = 0;
6474
6580
  for (let e = 0; e < t.length; e++) {
6475
- let i = t[e], a = typeof i == "string" ? i : i.text, l = Math.max(0, Math.min(As - r, o - s)), u = Ms(a, l);
6581
+ let i = t[e], a = typeof i == "string" ? i : i.text, l = Math.max(0, Math.min(Ps - r, o - s)), u = Is(a, l);
6476
6582
  if (n.push(u), r += u.length, s += u.length, u.length < a.length || e + 1 < t.length && l === 0) {
6477
6583
  c = !0;
6478
6584
  break;
6479
6585
  }
6480
6586
  }
6481
6587
  return n.join("");
6482
- }, u = n.areas.some((e) => e.kind === "sheet"), d = ys(n.areas.flatMap((e) => e.kind === "rows" ? [{
6588
+ }, u = n.areas.some((e) => e.kind === "sheet"), d = Cs(n.areas.flatMap((e) => e.kind === "rows" ? [{
6483
6589
  first: e.firstRow,
6484
6590
  last: e.lastRow
6485
- }] : [])), f = ys(n.areas.flatMap((e) => e.kind === "columns" ? [{
6591
+ }] : [])), f = Cs(n.areas.flatMap((e) => e.kind === "columns" ? [{
6486
6592
  first: e.firstColumn,
6487
6593
  last: e.lastColumn
6488
6594
  }] : [])), p = n.areas.flatMap((e) => e.kind === "cells" ? [e] : []), m = p.flatMap((e, t) => [{
@@ -6496,13 +6602,13 @@ var Vs = class {
6496
6602
  }]).sort((e, t) => e.row - t.row || Number(e.active) - Number(t.active)), h = /* @__PURE__ */ new Set(), g = 0, _ = [], v = [], y = !1, b = u || f.length > 0 ? [{
6497
6603
  first: 1,
6498
6604
  last: lr
6499
- }] : ys([...d, ...p.map((e) => ({
6605
+ }] : Cs([...d, ...p.map((e) => ({
6500
6606
  first: e.top,
6501
6607
  last: e.bottom
6502
6608
  }))]), x = this.selectionContextRows.get(t);
6503
- x || (x = Ss(t.rows, (e) => e.index), this.selectionContextRows.set(t, x));
6609
+ x || (x = Es(t.rows, (e) => e.index), this.selectionContextRows.set(t, x));
6504
6610
  cellScan: for (let e of b) {
6505
- let n = xs(x, e.first, (e) => e.index);
6611
+ let n = Ts(x, e.first, (e) => e.index);
6506
6612
  for (; n < x.length;) {
6507
6613
  let r = x[n++];
6508
6614
  if (r.index > e.last) break;
@@ -6511,37 +6617,53 @@ var Vs = class {
6511
6617
  let e = m[g++];
6512
6618
  e.active ? h.add(e.index) : h.delete(e.index), a = !0;
6513
6619
  }
6514
- a && (_ = ys([...h].map((e) => ({
6620
+ a && (_ = Cs([...h].map((e) => ({
6515
6621
  first: p[e].left,
6516
6622
  last: p[e].right
6517
6623
  }))));
6518
- let o = u || bs(d, r.index) ? [{
6624
+ let o = u || ws(d, r.index) ? [{
6519
6625
  first: 1,
6520
6626
  last: Z
6521
- }] : ys([...f, ..._]);
6627
+ }] : Cs([...f, ..._]);
6522
6628
  for (let e of o) {
6523
6629
  let n = this.selectionContextCells.get(r);
6524
- n || (n = Ss(r.cells, (e) => e.col), this.selectionContextCells.set(r, n));
6525
- let a = xs(n, e.first, (e) => e.col);
6630
+ n || (n = Es(r.cells, (e) => e.col), this.selectionContextCells.set(r, n));
6631
+ let a = Ts(n, e.first, (e) => e.col);
6526
6632
  for (; a < n.length;) {
6527
6633
  let r = n[a++];
6528
6634
  if (r.col > e.last) break;
6529
- let o = r.value;
6530
- if (o.type === "empty" && r.formula === void 0) continue;
6635
+ let o = r.value, s = this.sourceCommentMap.get(`${r.row}:${r.col}`);
6636
+ if (o.type === "empty" && r.formula === void 0 && !s) continue;
6531
6637
  if (v.length >= i) {
6532
6638
  y = !0;
6533
6639
  break cellScan;
6534
6640
  }
6535
- let s = l(this.wb?.cellText(t, r) ?? ""), u = o.type === "text" ? l(o.runs ?? o.text) : o.type === "number" ? o.number : o.type === "bool" ? o.bool : o.type === "error" ? l(o.error) : null;
6641
+ let u = l(this.wb?.cellText(t, r) ?? ""), d = o.type === "text" ? l(o.runs ?? o.text) : o.type === "number" ? o.number : o.type === "bool" ? o.bool : o.type === "error" ? l(o.error) : null, f = s ? {
6642
+ root: {
6643
+ id: s.id,
6644
+ author: s.author,
6645
+ date: s.date,
6646
+ text: l(s.rootText ?? s.text),
6647
+ status: s.resolved ? "resolved" : "active"
6648
+ },
6649
+ replies: (s.replies ?? []).map((e) => ({
6650
+ id: e.id,
6651
+ author: e.author,
6652
+ date: e.date,
6653
+ text: l(e.text),
6654
+ status: e.resolved ? "resolved" : "active"
6655
+ }))
6656
+ } : void 0;
6536
6657
  if (v.push({
6537
6658
  address: {
6538
6659
  row: r.row,
6539
6660
  col: r.col
6540
6661
  },
6541
- displayText: s,
6662
+ displayText: u,
6542
6663
  valueType: o.type,
6543
- value: u,
6544
- ...r.formula === void 0 ? {} : { formula: l(r.formula) }
6664
+ value: d,
6665
+ ...r.formula === void 0 ? {} : { formula: l(r.formula) },
6666
+ ...f === void 0 ? {} : { comment: f }
6545
6667
  }), c) break cellScan;
6546
6668
  }
6547
6669
  }
@@ -6575,7 +6697,7 @@ var Vs = class {
6575
6697
  if (!this.opts.onSelectionContextChange || this._destroyed || this.selectionContextNotificationFrame !== null || this.selectionContextNotificationMicrotask) return;
6576
6698
  let e = () => {
6577
6699
  if (this.selectionContextNotificationFrame = null, this.selectionContextNotificationMicrotask = !1, this._destroyed) return;
6578
- let e = this.getSelectionContext({ maxTextCharacters: ks });
6700
+ let e = this.getSelectionContext({ maxTextCharacters: Ns });
6579
6701
  this.opts.onSelectionContextChange?.(e ? structuredClone(e) : null);
6580
6702
  };
6581
6703
  typeof this.hostWindow.requestAnimationFrame == "function" ? this.selectionContextNotificationFrame = this.hostWindow.requestAnimationFrame(e) : (this.selectionContextNotificationMicrotask = !0, queueMicrotask(e));
@@ -6590,7 +6712,7 @@ var Vs = class {
6590
6712
  this.finishSelectionNotificationChain();
6591
6713
  return;
6592
6714
  }
6593
- if (this.selectionNotificationCount >= js) {
6715
+ if (this.selectionNotificationCount >= Fs) {
6594
6716
  this.lastNotifiedSelectionState = e ? structuredClone(e) : null, this.finishSelectionNotificationChain();
6595
6717
  return;
6596
6718
  }
@@ -6643,13 +6765,13 @@ var Vs = class {
6643
6765
  let r = /* @__PURE__ */ new Map(), i = [];
6644
6766
  for (let e of [n.col - 1, n.col]) {
6645
6767
  if (e < 1) continue;
6646
- let t = this.getCellRect(1, e);
6768
+ let t = this._cellRect(1, e);
6647
6769
  t && (r.set(e, t.x), i.push({
6648
6770
  index: e,
6649
6771
  edge: t.x + t.w
6650
6772
  }));
6651
6773
  }
6652
- let o = Ps(a, i, ws, s);
6774
+ let o = Rs(a, i, Os, s);
6653
6775
  return o === null ? null : {
6654
6776
  kind: "col",
6655
6777
  index: o,
@@ -6663,13 +6785,13 @@ var Vs = class {
6663
6785
  let r = /* @__PURE__ */ new Map(), i = [];
6664
6786
  for (let e of [n.row - 1, n.row]) {
6665
6787
  if (e < 1) continue;
6666
- let t = this.getCellRect(e, 1);
6788
+ let t = this._cellRect(e, 1);
6667
6789
  t && (r.set(e, t.y), i.push({
6668
6790
  index: e,
6669
6791
  edge: t.y + t.h
6670
6792
  }));
6671
6793
  }
6672
- let a = Ps(o, i, ws, c);
6794
+ let a = Rs(o, i, Os, c);
6673
6795
  return a === null ? null : {
6674
6796
  kind: "row",
6675
6797
  index: a,
@@ -6684,10 +6806,10 @@ var Vs = class {
6684
6806
  if (!n || !r) return;
6685
6807
  let i = this.viewport.scale, a = this.canvasArea.getBoundingClientRect();
6686
6808
  if (n.kind === "col") {
6687
- let t = this.screenX(e - a.left, 0), o = Math.max(Ts, Math.round((t - n.originScaled) / i));
6809
+ let t = this.screenX(e - a.left, 0), o = Math.max(ks, Math.round((t - n.originScaled) / i));
6688
6810
  r.colWidths[n.index] = ar(o, n.mdw), this.recordSizeOverride("col", n.index);
6689
6811
  } else {
6690
- let e = t - a.top, o = Math.max(Ts, Math.round((e - n.originScaled) / i));
6812
+ let e = t - a.top, o = Math.max(ks, Math.round((e - n.originScaled) / i));
6691
6813
  r.rowHeights[n.index] = sr(o), this.recordSizeOverride("row", n.index);
6692
6814
  }
6693
6815
  ur.invalidate(r), this.updateSpacerSize(r), this.updateSelectionOverlay(), this.scheduleRender();
@@ -6746,12 +6868,12 @@ var Vs = class {
6746
6868
  c1: n.left,
6747
6869
  c2: n.right
6748
6870
  }, l = o - a + 1, u = c - s + 1;
6749
- if (l > Math.floor(Es / u)) return {
6871
+ if (l > Math.floor(As / u)) return {
6750
6872
  status: "too-large",
6751
6873
  limit: "cells"
6752
6874
  };
6753
6875
  let d = l * u, f = Math.max(0, l - 1) + l * Math.max(0, u - 1);
6754
- if (f > Ds) return {
6876
+ if (f > js) return {
6755
6877
  status: "too-large",
6756
6878
  limit: "text"
6757
6879
  };
@@ -6760,7 +6882,7 @@ var Vs = class {
6760
6882
  if (n.col < s || n.col > c) continue;
6761
6883
  let r = n.value, i = this.wb?.cellText(e, n) ?? "";
6762
6884
  if (this.wb || (r.type === "text" ? i = r.runs ? r.runs.map((e) => e.text).join("") : r.text : r.type === "number" ? i = String(r.number) : r.type === "bool" ? i = r.bool ? "TRUE" : "FALSE" : r.type === "error" && (i = r.error)), i) {
6763
- let e = Ns(i, Ds - f);
6885
+ let e = Ls(i, js - f);
6764
6886
  if (e === null) return {
6765
6887
  status: "too-large",
6766
6888
  limit: "text"
@@ -6838,7 +6960,7 @@ var Vs = class {
6838
6960
  last: lr,
6839
6961
  start: a,
6840
6962
  end: s
6841
- }], h = this.opts.selectionColor ?? Cs, { background: g } = Fs(h), _ = /* @__PURE__ */ new Set(), v = [], y = [];
6963
+ }], h = this.opts.selectionColor ?? Ds, { background: g } = zs(h), _ = /* @__PURE__ */ new Set(), v = [], y = [];
6842
6964
  for (let t of e.areas) {
6843
6965
  let e = t.kind === "cells" ? {
6844
6966
  top: t.top,
@@ -6881,7 +7003,7 @@ var Vs = class {
6881
7003
  if (n.end <= n.start || t.end <= t.start) continue;
6882
7004
  let r = Math.max(e.top, t.first), i = Math.min(e.bottom, t.last), a = Math.max(e.left, n.first), o = Math.min(e.right, n.last);
6883
7005
  if (r > i || a > o) continue;
6884
- let s = this.getCellRect(r, a), c = this.getCellRect(i, o);
7006
+ let s = this._cellRect(r, a), c = this._cellRect(i, o);
6885
7007
  if (!s || !c) continue;
6886
7008
  let l = s.x, u = s.y, d = c.x + c.w, f = c.y + c.h, p = Math.max(l, n.start), m = Math.max(u, t.start), h = Math.min(d, n.end), g = Math.min(f, t.end), b = h - p, x = g - m;
6887
7009
  if (b <= 0 || x <= 0) continue;
@@ -6910,7 +7032,7 @@ var Vs = class {
6910
7032
  if (v.length > 0) {
6911
7033
  let t = "http://www.w3.org/2000/svg", n = this.hostDocument.createElementNS(t, "svg");
6912
7034
  n.setAttribute("data-xlsx-selection-fill", ""), n.style.cssText = "position:absolute;inset:0;width:100%;height:100%;overflow:hidden;pointer-events:none;";
6913
- let r = e.areas.length > 1, i = this.getCellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++Ls}`, c = this.hostDocument.createElementNS(t, "defs"), l = this.hostDocument.createElementNS(t, "mask");
7035
+ let r = e.areas.length > 1, i = this._cellRect(e.activeCell.row, e.activeCell.col), a = `xlsx-selection-mask-${++Vs}`, c = this.hostDocument.createElementNS(t, "defs"), l = this.hostDocument.createElementNS(t, "mask");
6914
7036
  l.setAttribute("id", a), l.setAttribute("maskUnits", "userSpaceOnUse"), l.setAttribute("x", "0"), l.setAttribute("y", "0"), l.setAttribute("width", String(o)), l.setAttribute("height", String(s));
6915
7037
  let u = this.hostDocument.createElementNS(t, "path");
6916
7038
  if (u.setAttribute("d", v.join("")), u.setAttribute("fill", "#fff"), l.appendChild(u), i) for (let e of m) for (let n of p) {
@@ -6922,7 +7044,7 @@ var Vs = class {
6922
7044
  c.appendChild(l), n.appendChild(c);
6923
7045
  let d = this.hostDocument.createElementNS(t, "rect");
6924
7046
  d.setAttribute("x", "0"), d.setAttribute("y", "0"), d.setAttribute("width", String(o)), d.setAttribute("height", String(s)), d.setAttribute("fill", g), d.setAttribute("mask", `url(#${a})`), n.appendChild(d);
6925
- let f = r ? "" : Is(y);
7047
+ let f = r ? "" : Bs(y);
6926
7048
  if (f) {
6927
7049
  let e = this.hostDocument.createElementNS(t, "path");
6928
7050
  e.setAttribute("data-xlsx-selection-border", ""), e.setAttribute("d", f), e.setAttribute("fill", "none"), e.setAttribute("stroke", h), e.setAttribute("stroke-width", "2"), e.setAttribute("stroke-linecap", "square"), e.setAttribute("stroke-linejoin", "miter"), n.appendChild(e);
@@ -6946,14 +7068,14 @@ var Vs = class {
6946
7068
  i.setAttribute("data-xlsx-element-context-clip", ""), i.style.cssText = `position:absolute;left:${r.clip.x}px;top:${r.clip.y}px;width:${r.clip.width}px;height:${r.clip.height}px;overflow:hidden;pointer-events:none;`;
6947
7069
  let a = this.hostDocument.createElement("div");
6948
7070
  a.setAttribute("data-xlsx-element-context-outline", e.elementType);
6949
- let o = this.opts.selectionColor ?? Cs;
7071
+ let o = this.opts.selectionColor ?? Ds;
6950
7072
  a.style.cssText = `position:absolute;left:${r.rect.x - r.clip.x}px;top:${r.rect.y - r.clip.y}px;width:${r.rect.width}px;height:${r.rect.height}px;box-sizing:border-box;border:2px solid ${o};background:color-mix(in srgb, ${o} 6%, transparent);transform:rotate(${r.rotation}deg);transform-origin:center;pointer-events:none;`, i.appendChild(a), this.overlayHost.appendSelection(i);
6951
7073
  }
6952
7074
  maybeDrawValidationDropdown() {
6953
7075
  if (this.validationArrowRect = null, this.selectionMode !== "cells") return;
6954
7076
  let e = this.currentWorksheet, t = this.activeCell;
6955
7077
  if (!e || !t || !eo(e.dataValidations, t.row, t.col)) return;
6956
- let n = this.getCellRect(t.row, t.col);
7078
+ let n = this._cellRect(t.row, t.col);
6957
7079
  if (!n) return;
6958
7080
  let r = this.viewport.scale, i = Math.round(50 * r), a = Math.round(22 * r), o = Math.max(14, Math.min(n.h, 22 * r)), s = n.x + n.w, c = n.y;
6959
7081
  if (s + o <= i || c + o <= a) return;
@@ -6971,9 +7093,9 @@ var Vs = class {
6971
7093
  this.overlayHost.clearFind();
6972
7094
  let e = this.currentWorksheet;
6973
7095
  if (!e) return;
6974
- let t = this.viewport.scale, n = (e) => Math.round(e * t), r = n(50), i = n(22), a = e.freezeRows ?? 0, o = e.freezeCols ?? 0, s = Q(e).roundedFrozenExtent(t), c = r + s.width, l = i + s.height, u = Bs(!1, this.opts.findHighlightColors), d = Bs(!0, this.opts.findHighlightColors);
7096
+ let t = this.viewport.scale, n = (e) => Math.round(e * t), r = n(50), i = n(22), a = e.freezeRows ?? 0, o = e.freezeCols ?? 0, s = Q(e).roundedFrozenExtent(t), c = r + s.width, l = i + s.height, u = Ws(!1, this.opts.findHighlightColors), d = Ws(!0, this.opts.findHighlightColors);
6975
7097
  for (let e of this._find.sheetHighlights(this.currentSheet)) {
6976
- let t = this.getCellRect(e.row, e.col);
7098
+ let t = this._cellRect(e.row, e.col);
6977
7099
  if (!t) continue;
6978
7100
  let { x: n, y: s, w: f, h: p } = t;
6979
7101
  if (n < r && (f -= r - n, n = r), s < i && (p -= i - s, s = i), e.col > o && n < c && (f -= c - n, n = c), e.row > a && s < l && (p -= l - s, s = l), f <= 0 || p <= 0) continue;
@@ -7064,7 +7186,7 @@ var Vs = class {
7064
7186
  positionValidationPanel() {
7065
7187
  let e = this.activeCell;
7066
7188
  if (!e) return;
7067
- let t = this.getCellRect(e.row, e.col);
7189
+ let t = this._cellRect(e.row, e.col);
7068
7190
  if (!t) return;
7069
7191
  let n = this.screenX(t.x, t.w);
7070
7192
  this.validationPanel.style.left = "-9999px", this.validationPanel.style.top = "-9999px", this.validationPanel.style.display = "block";
@@ -7099,11 +7221,30 @@ var Vs = class {
7099
7221
  this.validationRequestGeneration++, this.overlayHost.hideValidation(), this.validationPanelKey = null, this.validationOutsideHandler &&= (this.hostDocument.removeEventListener("pointerdown", this.validationOutsideHandler, !0), null);
7100
7222
  }
7101
7223
  buildCommentMap(e) {
7102
- this.commentMap = /* @__PURE__ */ new Map();
7103
- for (let t of e.comments ?? []) {
7104
- let e = dr(t.cellRef);
7105
- e && this.commentMap.set(`${e.row}:${e.col}`, t);
7224
+ this.commentMap = this.createCommentMap(e.comments ?? []);
7225
+ }
7226
+ createCommentMap(e) {
7227
+ let t = /* @__PURE__ */ new Map();
7228
+ for (let n of e) {
7229
+ let e = dr(n.cellRef);
7230
+ e && t.set(`${e.row}:${e.col}`, n);
7106
7231
  }
7232
+ return t;
7233
+ }
7234
+ createVisibleSheetView(e) {
7235
+ let t = Xo(e);
7236
+ if (this.opts.comments === !1) return {
7237
+ ...t,
7238
+ commentRefs: [],
7239
+ comments: []
7240
+ };
7241
+ if ((typeof this.opts.comments == "object" ? this.opts.comments : void 0)?.includeResolved !== !1) return t;
7242
+ let n = new Set((t.comments ?? []).filter((e) => e.resolved === !0).map((e) => e.cellRef));
7243
+ return n.size === 0 ? t : {
7244
+ ...t,
7245
+ commentRefs: t.commentRefs?.filter((e) => !n.has(e)),
7246
+ comments: t.comments?.filter((e) => !n.has(e.cellRef))
7247
+ };
7107
7248
  }
7108
7249
  buildHyperlinkMap(e) {
7109
7250
  this.hyperlinkMap = /* @__PURE__ */ new Map();
@@ -7139,26 +7280,63 @@ var Vs = class {
7139
7280
  return;
7140
7281
  }
7141
7282
  this.commentPopupKey !== t && (this.hideCommentPopup(), this.commentPopupKey = t, this.commentPopupTimer = setTimeout(() => {
7142
- this.commentPopupTimer = null, this.renderCommentPopup(e, n);
7143
- }, os));
7283
+ this.commentPopupTimer = null, this.renderCommentPopup(e, n).catch((e) => this._reportRenderError(e));
7284
+ }, cs));
7285
+ }
7286
+ async loadCommentUi() {
7287
+ let e = this.commentUi ?? await ss();
7288
+ return this._destroyed || (this.commentUi = e), e;
7289
+ }
7290
+ async renderCommentPopup(e, t) {
7291
+ if (!this._cellRect(e.row, e.col)) return;
7292
+ let n = ++this.commentPopupRenderGeneration, r = await this.loadCommentUi();
7293
+ if (this._destroyed || n !== this.commentPopupRenderGeneration || !this._cellRect(e.row, e.col)) return;
7294
+ this.commentPopupCell = e;
7295
+ let i = `sheet:${this.currentSheet}:cell:${t.cellRef}:comment:${t.id ?? "root"}`, a = {
7296
+ occurrenceKey: i,
7297
+ root: {
7298
+ messageKey: `${i}:root`,
7299
+ sourceId: t.id,
7300
+ author: t.author,
7301
+ date: t.date,
7302
+ text: t.rootText ?? t.text,
7303
+ status: t.resolved ? "resolved" : "active"
7304
+ },
7305
+ replies: (t.replies ?? []).map((e, t) => ({
7306
+ messageKey: `${i}:reply:${e.id ?? t}`,
7307
+ sourceId: e.id,
7308
+ author: e.author,
7309
+ date: e.date,
7310
+ text: e.text,
7311
+ status: e.resolved ? "resolved" : "active"
7312
+ }))
7313
+ };
7314
+ r.paintReadOnlyCommentCard(this.commentPopup, a, {
7315
+ interactive: !1,
7316
+ standalone: !0
7317
+ });
7318
+ let o = (t.rootText ?? t.text).trim(), s = t.author?.trim() ? ` by ${t.author.trim()}` : "", c = t.replies?.length ?? 0, l = c === 0 ? "" : `; ${c} ${c === 1 ? "reply" : "replies"}`;
7319
+ this.overlayHost.announceComment(`Comment on ${t.cellRef}${s}${o ? `: ${o}` : ""}${l}`), this.commentPopup.dataset.ooxmlCommentUi = "popup", this.commentPopup.style.maxWidth = `${ls}px`, this.commentPopup.style.maxHeight = `${us}px`, this.commentPopup.style.left = "-9999px", this.commentPopup.style.top = "-9999px", this.commentPopup.style.display = "", this.positionCommentPopup();
7144
7320
  }
7145
- renderCommentPopup(e, t) {
7146
- let n = this.getCellRect(e.row, e.col);
7147
- if (!n) return;
7148
- if (this.commentPopup.textContent = "", t.author) {
7149
- let e = this.hostDocument.createElement("div");
7150
- e.style.cssText = "font-weight:bold;margin-bottom:2px;", e.textContent = t.author, this.commentPopup.appendChild(e);
7151
- }
7152
- let r = this.hostDocument.createElement("div");
7153
- r.textContent = t.text, this.commentPopup.appendChild(r);
7154
- let i = this.screenX(n.x, n.w);
7155
- this.commentPopup.style.left = "-9999px", this.commentPopup.style.top = "-9999px", this.commentPopup.style.display = "block";
7156
- let a = Io({
7321
+ scheduleCommentPopupPosition() {
7322
+ if (this.commentPopupPositionScheduled || !this.commentPopupCell) return;
7323
+ this.commentPopupPositionScheduled = !0;
7324
+ let e = () => {
7325
+ this.commentPopupPositionScheduled = !1, this.positionCommentPopup();
7326
+ }, t = this.hostDocument.defaultView;
7327
+ t?.requestAnimationFrame ? t.requestAnimationFrame(e) : queueMicrotask(e);
7328
+ }
7329
+ positionCommentPopup() {
7330
+ let e = this.commentPopupCell;
7331
+ if (!e || this.commentPopup.style.display === "none") return;
7332
+ let t = this._cellRect(e.row, e.col);
7333
+ if (!t) return;
7334
+ let n = Io({
7157
7335
  cell: {
7158
- x: i,
7159
- y: n.y,
7160
- w: n.w,
7161
- h: n.h
7336
+ x: this.screenX(t.x, t.w),
7337
+ y: t.y,
7338
+ w: t.w,
7339
+ h: t.h
7162
7340
  },
7163
7341
  popup: {
7164
7342
  w: this.commentPopup.offsetWidth,
@@ -7170,10 +7348,10 @@ var Vs = class {
7170
7348
  },
7171
7349
  rtl: this.isRtl
7172
7350
  });
7173
- this.overlayHost.showComment(a.left, a.top);
7351
+ this.overlayHost.showComment(n.left, n.top);
7174
7352
  }
7175
7353
  hideCommentPopup() {
7176
- this.commentPopupTimer !== null && (clearTimeout(this.commentPopupTimer), this.commentPopupTimer = null), this.commentPopupKey = null, this.overlayHost.hideComment();
7354
+ this.commentPopupRenderGeneration++, this.commentPopupTimer !== null && (clearTimeout(this.commentPopupTimer), this.commentPopupTimer = null), this.commentPopupKey = null, this.commentPopupCell = null, this.overlayHost.hideComment(), this.commentPopup.replaceChildren();
7177
7355
  }
7178
7356
  applyPointerSelection(e, t, n, r, i, a) {
7179
7357
  let o = this.getHeaderHit(e, t);
@@ -7422,7 +7600,7 @@ var Vs = class {
7422
7600
  if (t * t + n * n <= 64) {
7423
7601
  if (this.applyPointerSelection(e.clientX, e.clientY, this.pendingTap.shiftKey, this.pendingTap.additiveKey, e.pointerId, !1), e.pointerType !== "mouse" && this.activeCell) {
7424
7602
  let e = `${this.activeCell.row}:${this.activeCell.col}`, t = this.commentMap.get(e);
7425
- t ? (this.hideCommentPopup(), this.renderCommentPopup(this.activeCell, t)) : this.hideCommentPopup();
7603
+ t ? (this.hideCommentPopup(), this.renderCommentPopup(this.activeCell, t).catch((e) => this._reportRenderError(e))) : this.hideCommentPopup();
7426
7604
  }
7427
7605
  this.activeCell && this.dispatchHyperlink(this.activeCell);
7428
7606
  }
@@ -7451,13 +7629,34 @@ var Vs = class {
7451
7629
  x: t,
7452
7630
  y: n
7453
7631
  } : null, this.setScale(Se(this.viewport.scale, e.deltaY));
7454
- }, { passive: !1 }), this.surface.on("pointerleave", () => this.hideCommentPopup()), this.keydownHandler = (e) => {
7632
+ }, { passive: !1 }), this.surface.on("pointerleave", (e) => {
7633
+ let t = e.relatedTarget;
7634
+ t && this.commentPopup.contains(t) || this.hideCommentPopup();
7635
+ }), this.surface.on("focus", () => {
7636
+ this.currentWorksheet && !this.activeCell && this.setSelection("A1");
7637
+ }), this.keydownHandler = (e) => {
7455
7638
  if ((e.ctrlKey || e.metaKey) && e.key === "c") {
7456
7639
  if (e.defaultPrevented || e.isComposing) return;
7457
7640
  let t = e.target, n = t?.tagName;
7458
7641
  if (t?.isContentEditable || n === "INPUT" || n === "TEXTAREA" || n === "SELECT") return;
7459
7642
  e.preventDefault(), this.copySelection();
7460
- } else e.key === "Escape" && this.validationPanel.style.display !== "none" && this.hideValidationPanel();
7643
+ } else if (!e.defaultPrevented && !e.isComposing && !e.ctrlKey && !e.metaKey && !e.altKey && !e.shiftKey && (e.key === "ArrowUp" || e.key === "ArrowDown" || e.key === "ArrowLeft" || e.key === "ArrowRight")) {
7644
+ let t = this.activeCell, n = e.key === "ArrowUp" ? -1 : +(e.key === "ArrowDown"), r = e.key === "ArrowLeft" ? this.isRtl ? 1 : -1 : e.key === "ArrowRight" ? this.isRtl ? -1 : 1 : 0, i = t ? {
7645
+ row: Math.max(1, Math.min(lr, t.row + n)),
7646
+ col: Math.max(1, Math.min(Z, t.col + r))
7647
+ } : {
7648
+ row: 1,
7649
+ col: 1
7650
+ };
7651
+ e.preventDefault(), this.hideCommentPopup();
7652
+ let a = fr(i.row, i.col);
7653
+ this.setSelection(a), this._scrollCellIntoView(i.row, i.col), this.updateSelectionOverlay(), this.updateFindOverlay(), this.emitViewportChange();
7654
+ } else if (e.key === "Escape" && this.validationPanel.style.display !== "none") this.hideValidationPanel();
7655
+ else if (e.key === "Escape" && this.commentPopup.style.display !== "none") this.hideCommentPopup();
7656
+ else if (e.key === "Enter" && this.activeCell && !e.defaultPrevented && !e.isComposing && !e.ctrlKey && !e.metaKey && !e.altKey) {
7657
+ let t = this.commentMap.get(`${this.activeCell.row}:${this.activeCell.col}`);
7658
+ t && (e.preventDefault(), this.hideCommentPopup(), this.renderCommentPopup(this.activeCell, t).catch((e) => this._reportRenderError(e)));
7659
+ }
7461
7660
  }, this.surface.on("keydown", this.keydownHandler);
7462
7661
  }
7463
7662
  buildTabs() {
@@ -7473,7 +7672,7 @@ var Vs = class {
7473
7672
  return r.textContent = e, r.setAttribute("aria-label", t), r.title = t, r.classList.add("xlsx-tab-nav"), r.style.cssText = this.navButtonStyle(!1), r.addEventListener("click", n), r;
7474
7673
  }
7475
7674
  navButtonStyle(e) {
7476
- return e ? "flex:1;height:100%;padding:0;display:flex;align-items:center;justify-content:center;border:none;color:#666;font-size:9px;line-height:1;box-sizing:border-box;outline:none;opacity:0.3;cursor:default;pointer-events:none;" : "flex:1;height:100%;padding:0;display:flex;align-items:center;justify-content:center;border:none;color:#666;font-size:9px;line-height:1;box-sizing:border-box;outline:none;cursor:pointer;";
7675
+ return e ? "flex:1;height:100%;padding:0;display:flex;align-items:center;justify-content:center;border:none;color:var(--ooxml-xlsx-chrome-text-muted,#666);font-size:9px;line-height:1;box-sizing:border-box;outline:none;opacity:0.3;cursor:default;pointer-events:none;" : "flex:1;height:100%;padding:0;display:flex;align-items:center;justify-content:center;border:none;color:var(--ooxml-xlsx-chrome-text-muted,#666);font-size:9px;line-height:1;box-sizing:border-box;outline:none;cursor:pointer;";
7477
7676
  }
7478
7677
  scrollTabs(e) {
7479
7678
  let t = this.tabStrip, n = t.scrollLeft, r = n + t.clientWidth, i = null;
@@ -7511,19 +7710,19 @@ var Vs = class {
7511
7710
  this.updateNavButtons();
7512
7711
  }
7513
7712
  tabStyle(e, t) {
7514
- let n = ds - 2, r = ds - 5, i = t ? `box-shadow:inset 0 -${e ? 2 : 3}px 0 0 ${t};` : "";
7515
- return e ? `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid #c8ccd0;border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${n}px;font-size:13px;background:#fff;color:#000;border-bottom:1px solid #fff;font-weight:600;top:1px;` + i : `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid #c8ccd0;border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${r}px;font-size:11px;background:#e0e0e0;color:#555;` + i;
7713
+ let n = ps - 2, r = ps - 5, i = t ? `box-shadow:inset 0 -${e ? 2 : 3}px 0 0 ${t};` : "";
7714
+ return e ? `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${n}px;font-size:13px;background:var(--ooxml-xlsx-chrome-surface,#fff);color:var(--ooxml-xlsx-chrome-text,#000);border-bottom:1px solid var(--ooxml-xlsx-chrome-surface,#fff);font-weight:600;top:1px;` + i : `display:inline-block;flex:none;padding:0 14px;position:relative;border:1px solid var(--ooxml-xlsx-chrome-border,#c8ccd0);border-bottom:none;border-radius:3px 3px 0 0;cursor:pointer;white-space:nowrap;max-width:160px;overflow:hidden;text-overflow:ellipsis;outline:none;box-sizing:border-box;height:${r}px;font-size:11px;background:var(--ooxml-xlsx-chrome-surface-muted,#e0e0e0);color:var(--ooxml-xlsx-chrome-text-muted,#555);` + i;
7516
7715
  }
7517
7716
  tabCss(e, t) {
7518
7717
  let n = this.tabStyle(t, this.tabColors[e]);
7519
- return this._hiddenSheetMode !== "show" && this.wb?.isHidden(e) && (n += this._hiddenSheetMode === "skip" ? "display:none;" : `opacity:${hs};`), n;
7718
+ return this._hiddenSheetMode !== "show" && this.wb?.isHidden(e) && (n += this._hiddenSheetMode === "skip" ? "display:none;" : `opacity:${_s};`), n;
7520
7719
  }
7521
7720
  buildZoomControl() {
7522
7721
  let e = this.opts.zoomMin ?? .1, t = this.opts.zoomMax ?? 4, n = this.viewport.scale, r = this.hostDocument.createElement("div");
7523
- r.style.cssText = "display:flex;align-items:center;flex-shrink:0;gap:2px;padding:0 10px;height:100%;color:#555;font-size:12px;user-select:none;";
7722
+ r.style.cssText = "display:flex;align-items:center;flex-shrink:0;gap:2px;padding:0 10px;height:100%;color:var(--ooxml-xlsx-chrome-text-muted,#555);font-size:12px;user-select:none;";
7524
7723
  let i = (e, t, n) => {
7525
7724
  let r = this.hostDocument.createElement("button");
7526
- return r.type = "button", r.textContent = e, r.setAttribute("aria-label", t), r.title = t, r.style.cssText = "width:18px;height:18px;padding:0;border:none;background:transparent;color:#555;font-size:14px;line-height:1;cursor:pointer;border-radius:3px;", r.addEventListener("click", n), r;
7725
+ return r.type = "button", r.textContent = e, r.setAttribute("aria-label", t), r.title = t, r.style.cssText = "width:18px;height:18px;padding:0;border:none;background:transparent;color:var(--ooxml-xlsx-chrome-text-muted,#555);font-size:14px;line-height:1;cursor:pointer;border-radius:3px;", r.addEventListener("click", n), r;
7527
7726
  }, a = this.hostDocument.createElement("input");
7528
7727
  a.type = "range", a.min = "0", a.max = "100", a.step = "any", a.value = String(this.zoomScaleToPos(n, e, t)), a.setAttribute("aria-label", "Zoom"), a.title = "Zoom", a.classList.add("xlsx-zoom-slider"), a.style.cssText = "width:90px;cursor:pointer;", a.addEventListener("input", () => this.setScale(this.zoomPosToScale(Number(a.value), e, t)));
7529
7728
  let o = this.hostDocument.createElement("span");
@@ -7628,7 +7827,8 @@ var Vs = class {
7628
7827
  freezeRows: o,
7629
7828
  freezeCols: s,
7630
7829
  selectedRowRange: f,
7631
- selectedColRange: p
7830
+ selectedColRange: p,
7831
+ chromeColors: this.chromeColors
7632
7832
  }, h = this.wireSizeOverrides(), g = qa(h ? {
7633
7833
  ...m,
7634
7834
  sizeOverrides: h.overrides
@@ -7661,9 +7861,9 @@ var Vs = class {
7661
7861
  }
7662
7862
  destroy() {
7663
7863
  if (this._destroyed) return;
7664
- this._destroyed = !0, this.selectionContextNotificationFrame !== null && (this.hostWindow.cancelAnimationFrame(this.selectionContextNotificationFrame), this.selectionContextNotificationFrame = null), this.selectionContextNotificationMicrotask = !1, this.stopSelectionAutoScroll(), this.sheetRequestGeneration++, this.resizeObserver?.disconnect(), this.renderDispatcher.destroy(), this.surface.destroy(), this.hideCommentPopup(), this.hideValidationPanel(), this._find.invalidate(), this.releaseHostFonts();
7864
+ this._destroyed = !0, this.selectionContextNotificationFrame !== null && (this.hostWindow.cancelAnimationFrame(this.selectionContextNotificationFrame), this.selectionContextNotificationFrame = null), this.selectionContextNotificationMicrotask = !1, this.stopSelectionAutoScroll(), this.sheetRequestGeneration++, this.resizeObserver?.disconnect(), this.chromeStyleObserver?.disconnect(), this.chromeStyleObserver = null, this.chromeSchemeMedia && this.chromeSchemeListener && this.chromeSchemeMedia.removeEventListener?.("change", this.chromeSchemeListener), this.chromeSchemeMedia = null, this.chromeSchemeListener = null, this.commentPopupResizeObserver?.disconnect(), this.commentPopupResizeObserver = null, this.renderDispatcher.destroy(), this.surface.destroy(), this.hideCommentPopup(), this.hideValidationPanel(), this._find.invalidate(), this.releaseHostFonts();
7665
7865
  let e = this.wb?.[Za];
7666
- typeof e == "function" && e.call(this.wb, this.projectionId), this.currentWorksheet = null, this.elementContext = null, this.pendingElementClick = null, this.selectionController.reset(), this.lastNotifiedSelectionState = null, this.finishSelectionNotificationChain(), this.acquisition.destroy(), this.wrapper.remove();
7866
+ typeof e == "function" && e.call(this.wb, this.projectionId), this.currentWorksheet = null, this.currentSourceComments = [], this.sourceCommentMap.clear(), this.elementContext = null, this.pendingElementClick = null, this.selectionController.reset(), this.lastNotifiedSelectionState = null, this.finishSelectionNotificationChain(), this.acquisition.destroy(), this.wrapper.remove();
7667
7867
  }
7668
7868
  assertOpen() {
7669
7869
  if (this._destroyed) throw this.destroyedError();
@@ -7671,7 +7871,7 @@ var Vs = class {
7671
7871
  destroyedError() {
7672
7872
  return /* @__PURE__ */ Error(this._mountKind === "sheet" ? "XlsxSheetViewer is destroyed" : "XlsxViewer is destroyed");
7673
7873
  }
7674
- }, Hs = class e extends Vs {
7874
+ }, Ks = class e extends Gs {
7675
7875
  static fromWorkbook(t, n, r = {}) {
7676
7876
  return new e(t, {
7677
7877
  ...r,
@@ -7681,7 +7881,7 @@ var Vs = class {
7681
7881
  constructor(e, t = {}) {
7682
7882
  super(e, t, { kind: "composite" });
7683
7883
  }
7684
- }, Us = class e {
7884
+ }, qs = class e {
7685
7885
  engine;
7686
7886
  canvasMount;
7687
7887
  destroyed = !1;
@@ -7699,7 +7899,7 @@ var Vs = class {
7699
7899
  this.canvasMount = new ye(e, {
7700
7900
  wrapperCssText: `position:relative;display:inline-block;vertical-align:top;overflow:hidden;width:${e.style.width || `${i.width || e.width}px`};height:${e.style.height || `${i.height || e.height}px`};`,
7701
7901
  restoreMode: "style-and-bitmap"
7702
- }), this.engine = new Vs(this.canvasMount.wrapper, {
7902
+ }), this.engine = new Gs(this.canvasMount.wrapper, {
7703
7903
  ...t,
7704
7904
  onResourceMetrics: (e) => {
7705
7905
  this.lastMetrics = e, t.onResourceMetrics?.(e);
@@ -7784,6 +7984,17 @@ var Vs = class {
7784
7984
  getCellAt(e, t) {
7785
7985
  return this.destroyed ? null : this.engine.getCellAt(e, t);
7786
7986
  }
7987
+ getCellViewportRect(e) {
7988
+ return this.destroyed ? null : this.engine.getCellViewportRect(e);
7989
+ }
7990
+ getComments() {
7991
+ return this.assertOpen(), this.engine.getComments();
7992
+ }
7993
+ async goToComment(e, t, n) {
7994
+ this.assertOpen();
7995
+ let r = await this.engine.goToComment(e, t, n);
7996
+ return this.assertOpen(), this.captureSnapshot(), r;
7997
+ }
7787
7998
  get selectionState() {
7788
7999
  let e = this.destroyed ? this.snapshot.selectionState : this.engine.selectionState;
7789
8000
  return e ? structuredClone(e) : null;
@@ -7856,20 +8067,20 @@ var Vs = class {
7856
8067
  destroyedError() {
7857
8068
  return /* @__PURE__ */ Error("XlsxSheetViewer is destroyed");
7858
8069
  }
7859
- }, Ws = /* @__PURE__ */ e({
8070
+ }, Js = /* @__PURE__ */ e({
7860
8071
  MAX_SELECTION_AREAS: () => 128,
7861
8072
  MAX_SELECTION_CONTEXT_CELLS: () => wo,
7862
8073
  MAX_SELECTION_CONTEXT_TEXT_CHARACTERS: () => To,
7863
- OoxmlDecodedImageLimitError: () => Le,
8074
+ OoxmlDecodedImageLimitError: () => ke,
7864
8075
  OoxmlError: () => d,
7865
8076
  OoxmlResourceLimitError: () => w,
7866
- XlsxSheetViewer: () => Us,
7867
- XlsxViewer: () => Hs,
8077
+ XlsxSheetViewer: () => qs,
8078
+ XlsxViewer: () => Ks,
7868
8079
  XlsxWorkbook: () => Qa,
7869
8080
  autoResize: () => xe,
7870
- isOoxmlDecodedImageLimitError: () => Fe,
8081
+ isOoxmlDecodedImageLimitError: () => Pe,
7871
8082
  openExternalHyperlink: () => D,
7872
8083
  resolveSharedStrings: () => $e
7873
8084
  });
7874
8085
  //#endregion
7875
- export { wo as a, Co as i, Us as n, To as o, Hs as r, Qa as s, Ws as t };
8086
+ export { wo as a, Co as i, qs as n, To as o, Ks as r, Qa as s, Js as t };