@epam/ai-dial-attachment-canvas 1.1.0-dev.44 → 1.1.0-dev.441

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 (71) hide show
  1. package/LazyContentBoundary-CL7J_W9c.js +166 -0
  2. package/PdfContent-solOLCRi.js +239 -0
  3. package/PdfContent.css +1 -0
  4. package/attachment-canvas-Bp6WeQws.js +12 -0
  5. package/bounded-raw-part-cache-BfbSxRIL-DD07NKh9.js +37832 -0
  6. package/chart-ex-B0DgG3Dt.js +1009 -0
  7. package/comment-occurrence-CqejEuts-7SeKCBXk.js +6 -0
  8. package/comment-ui-runtime-DEtgcmj7-B1G7PH4z.js +170 -0
  9. package/comment-ui-runtime-TLHustXJ-DWCXG2mL.js +2 -0
  10. package/comment-ui-runtime-lXwVOgjW-Be4RALsI.js +112 -0
  11. package/comments-CAn2A_Xh-CdgNAj0h.js +282 -0
  12. package/components/AttachmentCanvas/AttachmentCanvas.d.ts +1 -0
  13. package/components/AttachmentCanvas/AttachmentCanvas.d.ts.map +1 -1
  14. package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts +4 -0
  15. package/components/AttachmentCanvasBody/AttachmentCanvasBody.d.ts.map +1 -0
  16. package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts +14 -0
  17. package/components/AttachmentCanvasContainer/AttachmentCanvasContainer.d.ts.map +1 -1
  18. package/components/CodeContent/CodeContent.d.ts +24 -0
  19. package/components/CodeContent/CodeContent.d.ts.map +1 -0
  20. package/components/HtmlContent/HtmlContent.d.ts +21 -0
  21. package/components/HtmlContent/HtmlContent.d.ts.map +1 -0
  22. package/components/LazyContentBoundary/LazyContentBoundary.d.ts +73 -0
  23. package/components/LazyContentBoundary/LazyContentBoundary.d.ts.map +1 -0
  24. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts +12 -0
  25. package/components/McpAppCanvasRenderer/McpAppCanvasRenderer.d.ts.map +1 -0
  26. package/components/OoxmlContent/OoxmlContent.d.ts +22 -0
  27. package/components/OoxmlContent/OoxmlContent.d.ts.map +1 -0
  28. package/components/PdfContent/PdfContent.d.ts +56 -0
  29. package/components/PdfContent/PdfContent.d.ts.map +1 -1
  30. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts +25 -0
  31. package/components/VisualizerCanvasRenderer/VisualizerCanvasRenderer.d.ts.map +1 -0
  32. package/constants/file.d.ts +8 -0
  33. package/constants/file.d.ts.map +1 -1
  34. package/context/AttachmentCanvasContext.d.ts +5 -3
  35. package/context/AttachmentCanvasContext.d.ts.map +1 -1
  36. package/delimited-text-worker-host-DcHj_JZt-DWJmaPag.js +25 -0
  37. package/docx-B9qBTEkj.js +29822 -0
  38. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts +64 -0
  39. package/hooks/useOpenAttachmentCanvas/useOpenAttachmentCanvas.d.ts.map +1 -0
  40. package/index.css +1 -2
  41. package/index.d.ts +11 -3
  42. package/index.d.ts.map +1 -1
  43. package/index.js +1123 -17237
  44. package/line-distribute-IsUGfHXm-DeITjLzJ.js +1234 -0
  45. package/line-metrics-CBbw80Ko-DoOuwYxZ.js +60 -0
  46. package/models/attachment-canvas.d.ts +314 -11
  47. package/models/attachment-canvas.d.ts.map +1 -1
  48. package/ooxml-highlight-surfaces-BhfVZvru.js +294 -0
  49. package/package.json +17 -9
  50. package/pptx-dkJw0-Vx.js +9179 -0
  51. package/read-only-comment-decoration-BTnWEeo5-BNhbteYc.js +94 -0
  52. package/read-only-comment-margin-plStyGfE-mggNAMB_.js +189 -0
  53. package/render-worker-host-BEfLZvSL-COy91Rd8.js +7 -0
  54. package/render-worker-host-Ba6Fchqr-DZeKpMWD.js +7 -0
  55. package/render-worker-host-C3xwtHnv-BBGHFdo9.js +7 -0
  56. package/renderer-module-contract-Cu-GKuPd-Bt0YZuzB.js +10063 -0
  57. package/types/attachment-canvas.d.ts +22 -0
  58. package/types/attachment-canvas.d.ts.map +1 -1
  59. package/utils/content.d.ts +11 -0
  60. package/utils/content.d.ts.map +1 -1
  61. package/utils/download.d.ts.map +1 -1
  62. package/utils/ooxml-highlight-geometry.d.ts +158 -0
  63. package/utils/ooxml-highlight-geometry.d.ts.map +1 -0
  64. package/utils/ooxml-highlight-surfaces.d.ts +42 -0
  65. package/utils/ooxml-highlight-surfaces.d.ts.map +1 -0
  66. package/utils/visualizer.d.ts +8 -0
  67. package/utils/visualizer.d.ts.map +1 -0
  68. package/utils/vite-external-matcher.d.ts +16 -0
  69. package/utils/vite-external-matcher.d.ts.map +1 -0
  70. package/visible-index-DPoQYSDt-9lRc-2Ik.js +162 -0
  71. package/xlsx-BAXMTJTG.js +8585 -0
@@ -0,0 +1,94 @@
1
+ //#region ../../node_modules/@silurus/ooxml/dist/read-only-comment-decoration-BTnWEeo5.js
2
+ function e(e, t) {
3
+ let n = Math.max(e.x, t.x), r = Math.max(e.y, t.y), i = Math.min(e.x + e.width, t.x + t.width), a = Math.min(e.y + e.height, t.y + t.height);
4
+ if (!(i <= n || a <= r)) return Object.freeze({
5
+ x: n,
6
+ y: r,
7
+ width: i - n,
8
+ height: a - r
9
+ });
10
+ }
11
+ function t(e, t) {
12
+ let n = e.getBoundingClientRect(), r = t.getBoundingClientRect();
13
+ if ([
14
+ n.left,
15
+ n.top,
16
+ n.width,
17
+ n.height,
18
+ r.left,
19
+ r.top
20
+ ].every(Number.isFinite) && !(n.width <= 0 || n.height <= 0)) return Object.freeze({
21
+ x: n.left - r.left,
22
+ y: n.top - r.top,
23
+ width: n.width,
24
+ height: n.height
25
+ });
26
+ }
27
+ function n(t, n) {
28
+ let r = t.scrollTop - n;
29
+ return Object.freeze(t.threads.map((n) => {
30
+ if (!n.cardRect) return n;
31
+ let i = Object.freeze({
32
+ ...n.cardRect,
33
+ y: n.cardRect.y + r
34
+ }), a = t.cardClipBounds ? e(i, t.cardClipBounds) : i, { cardRect: o, ...s } = n;
35
+ return Object.freeze({
36
+ ...s,
37
+ ...a ? { cardRect: a } : {}
38
+ });
39
+ }));
40
+ }
41
+ var r = "http://www.w3.org/2000/svg", i = /* @__PURE__ */ new WeakMap();
42
+ function a(e) {
43
+ let t = Math.round(e * 1e3) / 1e3;
44
+ return Object.is(t, -0) ? "0" : String(t);
45
+ }
46
+ function o(e, t) {
47
+ let n = (t.x - e.x) * .5;
48
+ return [{
49
+ x: e.x + n,
50
+ y: e.y
51
+ }, {
52
+ x: t.x - n,
53
+ y: t.y
54
+ }];
55
+ }
56
+ function s(e, t, n) {
57
+ let r = e.x + (t.x - e.x) * .55;
58
+ if (n === "orthogonal") return `M ${a(e.x)} ${a(e.y)} H ${a(r)} V ${a(t.y)} H ${a(t.x)}`;
59
+ let [i, s] = o(e, t);
60
+ return `M ${a(e.x)} ${a(e.y)} C ${a(i.x)} ${a(i.y)}, ${a(s.x)} ${a(s.y)}, ${a(t.x)} ${a(t.y)}`;
61
+ }
62
+ function c(e) {
63
+ i.delete(e), e.replaceChildren();
64
+ }
65
+ function l(e, t, n) {
66
+ e.dataset.ooxmlCommentConnectors = "";
67
+ let a = i.get(e);
68
+ if (!a) {
69
+ let t = e.ownerDocument.createElementNS(r, "svg");
70
+ t.setAttribute("aria-hidden", "true"), t.style.cssText = "position:absolute;inset:0;width:100%;height:100%;overflow:visible;pointer-events:none;", a = {
71
+ svg: t,
72
+ paths: /* @__PURE__ */ new Map()
73
+ }, i.set(e, a), e.replaceChildren(t);
74
+ }
75
+ a.svg.setAttribute("viewBox", `${t.surfaceBounds.x} ${t.surfaceBounds.y} ${t.surfaceBounds.width} ${t.surfaceBounds.height}`);
76
+ let o = [], c = /* @__PURE__ */ new Set();
77
+ for (let i of t.threads) {
78
+ let l = i.anchorRects.at(-1), u = i.cardRect;
79
+ if (!l || !u) continue;
80
+ c.add(i.occurrenceKey);
81
+ let d = t.side === "left" ? l.x : l.x + l.width, f = l.y + l.height / 2, p = t.side === "left" ? u.x + u.width : u.x, m = u.y + Math.min(u.height / 2, 25), h = a.paths.get(i.occurrenceKey);
82
+ h || (h = e.ownerDocument.createElementNS(r, "path"), a.paths.set(i.occurrenceKey, h)), h.dataset.ooxmlCommentConnector = i.occurrenceKey, h.dataset.active = String(i.active), h.setAttribute("d", s({
83
+ x: d,
84
+ y: f
85
+ }, {
86
+ x: p,
87
+ y: m
88
+ }, n.route)), h.style.cssText = `fill:none;vector-effect:non-scaling-stroke;stroke:${i.active ? n.activeColor ?? n.color ?? "#2563eb" : n.color ?? "#94a3b8"};stroke-width:${i.active ? "1.5px" : "1px"};stroke-dasharray:${n.stroke === "dashed" ? "4 4" : "none"};opacity:${i.active ? ".9" : ".45"};`, o.push(h);
89
+ }
90
+ for (let [e, t] of [...a.paths]) c.has(e) || (a.paths.delete(e), t.remove());
91
+ (o.length !== a.svg.children.length || o.some((e, t) => a.svg.children[t] !== e)) && a.svg.replaceChildren(...o);
92
+ }
93
+ //#endregion
94
+ export { t as i, l as n, n as r, c as t };
@@ -0,0 +1,189 @@
1
+ //#region ../../node_modules/@silurus/ooxml/dist/read-only-comment-margin-plStyGfE.js
2
+ var e = 1, t = "\n:where(.ooxml-comment-marker) {\n padding: 0;\n border: 0;\n cursor: pointer;\n pointer-events: auto;\n background: transparent;\n box-shadow: none;\n color: var(--ooxml-comment-marker-color, var(--ooxml-comment-author-accent));\n}\n:where([data-ooxml-comment-highlight]) {\n position: absolute;\n pointer-events: none;\n background: var(--ooxml-comment-highlight, color-mix(in srgb, var(--ooxml-comment-author-accent) 18%, transparent));\n transform-origin: top left;\n}\n:where([data-ooxml-comment-highlight][data-active=\"true\"]) {\n background: var(--ooxml-comment-highlight-active, color-mix(in srgb, var(--ooxml-comment-author-accent) 34%, transparent));\n}\n:where([data-ooxml-comment-target]) {\n position: absolute;\n box-sizing: border-box;\n pointer-events: none;\n border-style: solid;\n border-color: var(--ooxml-comment-target-border, #2563eb);\n background: var(--ooxml-comment-target-background, rgba(37, 99, 235, .06));\n transform-origin: center;\n}\n:where(.ooxml-comment-card) {\n position: relative;\n display: block;\n width: 100%;\n margin: 0 0 var(--ooxml-comment-card-gap, .42em);\n box-sizing: border-box;\n padding: var(--ooxml-comment-card-padding, .56em .68em);\n border: 0;\n border-radius: var(--ooxml-comment-card-radius, .3em);\n text-align: start;\n cursor: default;\n font: inherit;\n outline: none;\n background: var(--ooxml-comment-card-background, #fff);\n box-shadow: var(--ooxml-comment-card-shadow, none);\n}\n:where(button.ooxml-comment-card) {\n cursor: pointer;\n}\n:where(.ooxml-comment-card[data-standalone=\"true\"]) {\n position: absolute;\n width: max-content;\n max-width: 100%;\n margin: 0;\n z-index: 3;\n pointer-events: none;\n overflow: hidden;\n font-size: 13px;\n}\n:where(.ooxml-comment-card[data-active=\"true\"]) {\n background: var(--ooxml-comment-card-active-background, #eff6ff);\n box-shadow: var(--ooxml-comment-card-active-shadow, none);\n}\n:where(.ooxml-comment-card[data-focused=\"true\"]) {\n box-shadow: var(--ooxml-comment-card-focus-shadow, 0 0 0 .12em rgba(37, 99, 235, .65));\n}\n:where(.ooxml-comment-card [data-ooxml-comment-part=\"content\"]) {\n min-width: 0;\n flex: 1;\n}\n:where(.ooxml-comment-card [data-ooxml-comment-part=\"identity\"]) {\n display: flex;\n align-items: baseline;\n gap: .48em;\n min-width: 0;\n}\n:where(.ooxml-comment-card__author) {\n min-width: 0;\n font: 700 .84em/1.3 var(--ooxml-comment-font-family, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);\n color: var(--ooxml-comment-author-color, #0f172a);\n overflow: hidden;\n text-overflow: ellipsis;\n white-space: nowrap;\n}\n:where(.ooxml-comment-card__date) {\n font: 500 .66em/1.35 var(--ooxml-comment-date-font-family, ui-monospace, SFMono-Regular, Menlo, Consolas, monospace);\n color: var(--ooxml-comment-muted-color, #64748b);\n white-space: nowrap;\n}\n:where(.ooxml-comment-card__body) {\n margin-top: .28em;\n font: 400 .84em/1.45 var(--ooxml-comment-font-family, system-ui, -apple-system, BlinkMacSystemFont, \"Segoe UI\", sans-serif);\n color: var(--ooxml-comment-body-color, #334155);\n white-space: pre-wrap;\n overflow-wrap: anywhere;\n}\n:where(.ooxml-comment-card__reply) {\n margin: .55em 0 0 .45em;\n padding: .08em 0 0 .65em;\n border-left: .08em solid var(--ooxml-comment-reply-border, rgba(100, 116, 139, .24));\n}\n:where(.ooxml-comment-card [data-ooxml-comment-part=\"frame\"]) {\n position: absolute;\n inset: 0;\n box-sizing: border-box;\n pointer-events: none;\n border-radius: inherit;\n border: var(--ooxml-comment-card-border, 1px solid rgba(148, 163, 184, .34));\n border-left: var(--ooxml-comment-card-border-left, .14em solid var(--ooxml-comment-author-accent));\n border-right: var(--ooxml-comment-card-border-right, var(--ooxml-comment-card-border, 1px solid rgba(148, 163, 184, .34)));\n}\n:where(.ooxml-comment-card[data-active=\"true\"] [data-ooxml-comment-part=\"frame\"]) {\n border: var(--ooxml-comment-card-active-border, 1px solid rgba(37, 99, 235, .5));\n border-left: var(--ooxml-comment-card-border-left, .14em solid var(--ooxml-comment-author-accent));\n border-right: var(--ooxml-comment-card-border-right, var(--ooxml-comment-card-active-border, 1px solid rgba(37, 99, 235, .5)));\n}\n:where([data-ooxml-comment-ui=\"margin\"] > [data-ooxml-comment-item]) {\n position: absolute;\n left: 0;\n padding: 0 .14em;\n box-sizing: border-box;\n transform-origin: 0 0;\n}\n:where([data-ooxml-comment-ui=\"margin\"] > [data-ooxml-comment-item]:last-child > .ooxml-comment-card) {\n margin-bottom: 0;\n}\n";
3
+ function n(e) {
4
+ let n = e.head;
5
+ if (!n || n.querySelector("style[data-ooxml-comment-styles]")) return;
6
+ let r = e.createElement("style");
7
+ r.dataset.ooxmlCommentStyles = "", r.textContent = t, n.appendChild(r);
8
+ }
9
+ function r(e) {
10
+ if (!e) return "#2563eb";
11
+ let t = 2166136261;
12
+ for (let n of e.normalize("NFKC")) t ^= n.codePointAt(0) ?? 0, t = Math.imul(t, 16777619);
13
+ return `hsl(${(t >>> 0) % 360} 68% 42%)`;
14
+ }
15
+ function i(e, t) {
16
+ n(e);
17
+ let i = e.createElement("button");
18
+ return i.type = "button", i.setAttribute("class", "ooxml-comment-marker"), i.dataset.ooxmlCommentId = t.occurrenceKey, i.dataset.ooxmlCommentMarker = "", i.dataset.active = String(t.active), i.setAttribute("aria-label", `Comment ${t.visibleIndex + 1}`), i.setAttribute("aria-pressed", String(t.active)), i.style.cssText = `--ooxml-comment-author-accent:${r(t.author)};position:absolute;transform:translate(-50%,-50%);width:${24 * t.zoom}px;height:${24 * t.zoom}px;`, i.innerHTML = "<svg viewBox=\"0 0 24 24\" width=\"100%\" height=\"100%\" aria-hidden=\"true\"><path fill=\"currentColor\" stroke=\"currentColor\" stroke-width=\"2\" stroke-linecap=\"round\" stroke-linejoin=\"round\" d=\"M18 4C18.7956 4 19.5587 4.31607 20.1213 4.87868C20.6839 5.44129 21 6.20435 21 7V15C21 15.7956 20.6839 16.5587 20.1213 17.1213C19.5587 17.6839 18.7956 18 18 18H13L8 21V18H6C5.20435 18 4.44129 17.6839 3.87868 17.1213C3.31607 16.5587 3 15.7956 3 15V7C3 6.20435 3.31607 5.44129 3.87868 4.87868C4.44129 4.31607 5.20435 4 6 4H18Z\"/></svg>", i.addEventListener("click", () => t.onSetActive(t.occurrenceKey, !t.active)), i;
19
+ }
20
+ var a = /* @__PURE__ */ new WeakMap();
21
+ function o(e, t) {
22
+ t && typeof t.unobserve == "function" && t.unobserve(e.card), e.card.removeEventListener("click", e.onClick), e.card.removeEventListener("focus", e.onFocus), e.card.removeEventListener("blur", e.onBlur), e.item.remove();
23
+ }
24
+ function s(e) {
25
+ let t = a.get(e);
26
+ a.delete(e);
27
+ for (let e of t?.cards.values() ?? []) o(e, t?.resizeObserver);
28
+ t?.cards.clear(), t && e.removeEventListener("scroll", t.onScroll), t?.resizeObserver?.disconnect(), e.replaceChildren();
29
+ }
30
+ function c(e, t) {
31
+ let n = a.get(e);
32
+ if (!n || n.cards.size === 0 || !Number.isFinite(t) || t <= 0) return !1;
33
+ let r = Number.parseFloat(e.dataset.ooxmlCommentZoom ?? ""), i = Number.isFinite(r) && r > 0 ? r : n.zoom * t;
34
+ for (let e of n.cards.values()) e.item.style.top = `${e.committedTop * i}px`, e.item.style.transform = `scale(${i})`;
35
+ return !0;
36
+ }
37
+ function l(e, t = "") {
38
+ let n = e.createElement("div");
39
+ return n.style.cssText = t, n;
40
+ }
41
+ function u(e) {
42
+ if (!e) return;
43
+ let t = new Date(e);
44
+ return Number.isFinite(t.getTime()) ? new Intl.DateTimeFormat(void 0, {
45
+ dateStyle: "medium",
46
+ timeStyle: "short"
47
+ }).format(t) : e;
48
+ }
49
+ function d(e, t) {
50
+ return e.messageKey === t.messageKey && e.sourceId === t.sourceId && e.author === t.author && e.date === t.date && e.text === t.text && e.status === t.status;
51
+ }
52
+ function f(e, t) {
53
+ return e.occurrenceKey === t.occurrenceKey && d(e.root, t.root) && e.replies.length === t.replies.length && e.replies.every((e, n) => d(e, t.replies[n]));
54
+ }
55
+ function p(e, t, n) {
56
+ let r = e.map((e, t) => ({
57
+ ...e,
58
+ index: t
59
+ })).sort((e, t) => e.preferredTop - t.preferredTop || e.index - t.index), i = Math.max(0, n), a = r.reduce((e, t) => e + Math.max(0, t.height), 0) + i * Math.max(0, r.length - 1);
60
+ if (t <= 0 || a > t) {
61
+ let e = 0;
62
+ return new Map(r.map((t) => {
63
+ let n = [t.occurrenceKey, e];
64
+ return e += Math.max(0, t.height) + i, n;
65
+ }));
66
+ }
67
+ let o = r.map((e) => Math.max(0, Math.min(e.preferredTop, t - e.height)));
68
+ for (let e = 1; e < r.length; e++) {
69
+ let t = o[e - 1] + r[e - 1].height + i;
70
+ o[e] = Math.max(o[e], t);
71
+ }
72
+ if (r.length > 0) {
73
+ let e = r.length - 1;
74
+ o[e] = Math.min(o[e], t - r[e].height);
75
+ for (let t = e - 1; t >= 0; t--) o[t] = Math.min(o[t], o[t + 1] - i - r[t].height);
76
+ if (o[0] < 0) {
77
+ let e = -o[0];
78
+ for (let t = 0; t < o.length; t++) o[t] += e;
79
+ }
80
+ }
81
+ return new Map(r.map((e, t) => [e.occurrenceKey, o[t]]));
82
+ }
83
+ function m(e, t, n) {
84
+ let r = e.ownerDocument, i = l(r);
85
+ n && i.setAttribute("class", "ooxml-comment-card__reply"), i.dataset.ooxmlCommentPart = n ? "reply" : "comment";
86
+ let a = l(r);
87
+ a.dataset.ooxmlCommentPart = "content";
88
+ let o = l(r);
89
+ o.dataset.ooxmlCommentPart = "identity";
90
+ let s = l(r);
91
+ s.setAttribute("class", "ooxml-comment-card__author"), s.dataset.ooxmlCommentPart = "author", s.textContent = t.author || "Comment", o.appendChild(s);
92
+ let c = u(t.date);
93
+ if (c) {
94
+ let e = l(r);
95
+ e.setAttribute("class", "ooxml-comment-card__date"), e.dataset.ooxmlCommentPart = "date", e.textContent = c, e.setAttribute("title", t.date), o.appendChild(e);
96
+ }
97
+ let d = l(r);
98
+ d.setAttribute("class", "ooxml-comment-card__body"), d.dataset.ooxmlCommentPart = "body", d.textContent = t.text, a.appendChild(o), a.appendChild(d), i.appendChild(a), e.appendChild(i);
99
+ }
100
+ function h(e, t, i = {}) {
101
+ n(e.ownerDocument);
102
+ let a = i.active ?? !1, o = i.focused ?? !1, s = i.interactive ?? e.tagName === "BUTTON", c = r(t.root.author);
103
+ e.setAttribute("class", "ooxml-comment-card"), e.dataset.ooxmlCommentId = t.occurrenceKey, e.dataset.active = String(a), e.dataset.focused = String(o), e.dataset.standalone = String(i.standalone ?? !1), e.dataset.ooxmlCommentCard = "", s ? e.setAttribute("aria-pressed", String(a)) : e.removeAttribute("aria-pressed"), e.style.cssText = `--ooxml-comment-author-accent:${c};`, e.replaceChildren(), m(e, t.root, !1);
104
+ for (let n of t.replies) m(e, n, !0);
105
+ let u = l(e.ownerDocument);
106
+ u.dataset.ooxmlCommentPart = "frame", u.setAttribute("aria-hidden", "true"), e.appendChild(u);
107
+ }
108
+ function g(t, n, r) {
109
+ t.setAttribute("role", "list"), t.setAttribute("aria-label", "Comments"), t.dataset.ooxmlCommentUi = "margin", t.dataset.ooxmlCommentZoom = String(r.zoom);
110
+ let i = a.get(t);
111
+ if (!i) {
112
+ let e = {
113
+ cards: /* @__PURE__ */ new Map(),
114
+ onScroll: () => e.onScrollGeometryChange?.(),
115
+ zoom: r.zoom,
116
+ onGeometryChange: r.onGeometryChange,
117
+ onScrollGeometryChange: r.onScrollGeometryChange
118
+ };
119
+ if ((r.onGeometryChange || r.onScrollGeometryChange) && t.addEventListener("scroll", e.onScroll, { passive: !0 }), r.onGeometryChange) {
120
+ let n = t.ownerDocument.defaultView?.ResizeObserver ?? globalThis.ResizeObserver;
121
+ n && (e.resizeObserver = new n(() => e.onGeometryChange?.()));
122
+ }
123
+ i = e, a.set(t, i);
124
+ }
125
+ i.zoom = r.zoom, i.onGeometryChange = r.onGeometryChange, i.onScrollGeometryChange = r.onScrollGeometryChange;
126
+ let s = /* @__PURE__ */ new Set();
127
+ for (let e of n) {
128
+ if (s.has(e.occurrenceKey)) throw Error(`Duplicate comment occurrence key: ${e.occurrenceKey}`);
129
+ s.add(e.occurrenceKey);
130
+ }
131
+ for (let [e, t] of [...i.cards]) s.has(e) || (i.cards.delete(e), o(t, i.resizeObserver));
132
+ for (let a of n) {
133
+ let n = i.cards.get(a.occurrenceKey);
134
+ if (!n) {
135
+ let o = l(t.ownerDocument);
136
+ o.setAttribute("role", "listitem"), o.dataset.ooxmlCommentItem = "";
137
+ let s = t.ownerDocument.createElement("button");
138
+ s.type = "button", s.id = `ooxml-comment-card-${e++}`, s.dataset.ooxmlCommentCard = "";
139
+ let c = {
140
+ item: o,
141
+ card: s,
142
+ thread: a,
143
+ painted: !1,
144
+ focused: !1,
145
+ active: !1,
146
+ committedTop: 0,
147
+ onSetActive: r.onSetActive,
148
+ onClick: () => c.onSetActive(a.occurrenceKey, !c.active),
149
+ onFocus: () => {
150
+ c.focused = !0, c.card.dataset.focused = "true";
151
+ },
152
+ onBlur: () => {
153
+ c.focused = !1, c.card.dataset.focused = "false";
154
+ }
155
+ };
156
+ s.addEventListener("click", c.onClick), s.addEventListener("focus", c.onFocus), s.addEventListener("blur", c.onBlur), o.appendChild(s), i.cards.set(a.occurrenceKey, c), i.resizeObserver?.observe(s), n = c;
157
+ }
158
+ let o = r.activeId === a.occurrenceKey;
159
+ n.onSetActive = r.onSetActive, (!n.painted || n.active !== o || !f(n.thread, a)) && h(n.card, a, {
160
+ active: o,
161
+ focused: n.focused,
162
+ interactive: !0
163
+ }), n.painted = !0, n.active = o, n.thread = a;
164
+ }
165
+ let c = n.map((e, t) => ({
166
+ thread: e,
167
+ index: t
168
+ })).sort((e, t) => (r.preferredTopById?.get(e.thread.occurrenceKey) ?? 0) - (r.preferredTopById?.get(t.thread.occurrenceKey) ?? 0) || e.index - t.index).map(({ thread: e }) => e).flatMap((e) => {
169
+ let t = i.cards.get(e.occurrenceKey);
170
+ return t ? [t.item] : [];
171
+ });
172
+ (c.length !== t.children.length || c.some((e, n) => t.children[n] !== e)) && t.replaceChildren(...c);
173
+ for (let e of i.cards.values()) e.item.style.cssText = `width:${r.logicalWidth}px;top:${e.committedTop * r.zoom}px;`;
174
+ let u = c[0]?.children[0], d = u && t.ownerDocument.defaultView?.getComputedStyle ? Number.parseFloat(t.ownerDocument.defaultView.getComputedStyle(u).marginBottom) : 0, m = p(n.map((e) => {
175
+ let t = i.cards.get(e.occurrenceKey);
176
+ return {
177
+ occurrenceKey: e.occurrenceKey,
178
+ preferredTop: (r.preferredTopById?.get(e.occurrenceKey) ?? 0) / r.zoom,
179
+ height: t?.card.getBoundingClientRect().height ?? 0
180
+ };
181
+ }), t.clientHeight / r.zoom, Number.isFinite(d) ? d : 0);
182
+ for (let e of i.cards.values()) e.committedTop = m.get(e.thread.occurrenceKey) ?? 0, e.item.style.top = `${e.committedTop * r.zoom}px`, e.item.style.transform = `scale(${r.zoom})`;
183
+ return new Map(n.flatMap((e) => {
184
+ let t = i.cards.get(e.occurrenceKey);
185
+ return t ? [[e.occurrenceKey, t.card]] : [];
186
+ }));
187
+ }
188
+ //#endregion
189
+ export { n as a, i, g as n, r as o, h as r, s, c as t };