@8wave/ai-elements 0.125.0-beta.42 → 0.125.0-beta.43

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 (129) hide show
  1. package/dist/_chunks/Chart-1vt0m6l_.js +87 -0
  2. package/dist/_chunks/Chart-1vt0m6l_.js.map +1 -0
  3. package/dist/_chunks/{PkChart-CbtMRGWc.js → PkChart-CYFx_UDq.js} +741 -623
  4. package/dist/_chunks/PkChart-CYFx_UDq.js.map +1 -0
  5. package/dist/_chunks/PkFilePreview-yjdtArag.js +1745 -0
  6. package/dist/_chunks/PkFilePreview-yjdtArag.js.map +1 -0
  7. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js → PkFilePreviewDialog-Df0Lt40J.js} +2 -2
  8. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js.map → PkFilePreviewDialog-Df0Lt40J.js.map} +1 -1
  9. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js → PkImageEditorDialog-PVf3IHGB.js} +2 -2
  10. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js.map → PkImageEditorDialog-PVf3IHGB.js.map} +1 -1
  11. package/dist/_chunks/{PkSelectionActions-BbfVZY0R.js → PkSelectionActions-CMyg_x8h.js} +2 -2
  12. package/dist/_chunks/{PkSelectionActions-BbfVZY0R.js.map → PkSelectionActions-CMyg_x8h.js.map} +1 -1
  13. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js → PkStreamingMarkdown-BDXbU2tz.js} +2 -2
  14. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js.map → PkStreamingMarkdown-BDXbU2tz.js.map} +1 -1
  15. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js → PkToolChatFile-CMQdMs-9.js} +3 -3
  16. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js.map → PkToolChatFile-CMQdMs-9.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js → PkToolShowArtifact-YrC54qxc.js} +2 -2
  18. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js.map → PkToolShowArtifact-YrC54qxc.js.map} +1 -1
  19. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js +138 -0
  20. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js.map +1 -0
  21. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js → PkToolShowContactForm-Dio2FNkA.js} +2 -2
  22. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js.map → PkToolShowContactForm-Dio2FNkA.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js → PkToolShowForm-w9HGhvCy.js} +3 -3
  24. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js.map → PkToolShowForm-w9HGhvCy.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js → PkToolShowSources-DXFvFHOo.js} +2 -2
  26. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js.map → PkToolShowSources-DXFvFHOo.js.map} +1 -1
  27. package/dist/_chunks/chartFormat-B1T7y-16.js +27 -0
  28. package/dist/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  29. package/dist/_chunks/{excelNumberFormat-BhQjife9.js → excelNumberFormat-CcXF_wJK.js} +101 -88
  30. package/dist/_chunks/excelNumberFormat-CcXF_wJK.js.map +1 -0
  31. package/dist/_chunks/{utils-DMvy5QRR.js → utils-BBoaLDYF.js} +14 -14
  32. package/dist/_chunks/utils-BBoaLDYF.js.map +1 -0
  33. package/dist/ai-elements.es.js +178 -172
  34. package/dist/ai-elements.es.js.map +1 -1
  35. package/dist-vue/PkChatbot.js +1 -1
  36. package/dist-vue/PkChatbotEmptyState.js +1 -1
  37. package/dist-vue/PkChatbotInput.js +1 -1
  38. package/dist-vue/PkChatbotMessages.js +1 -1
  39. package/dist-vue/PkChatbotStepPayload.js +1 -1
  40. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  41. package/dist-vue/PkChatbotSteps.js +1 -1
  42. package/dist-vue/PkChatbotViewChat.js +1 -1
  43. package/dist-vue/PkChatbotViewConversations.js +1 -1
  44. package/dist-vue/_chunks/Chart-DsBNs5rS.js +87 -0
  45. package/dist-vue/_chunks/Chart-DsBNs5rS.js.map +1 -0
  46. package/dist-vue/_chunks/{PkChart-D-K7nc0g.js → PkChart-CrZqhEpp.js} +112 -74
  47. package/dist-vue/_chunks/PkChart-CrZqhEpp.js.map +1 -0
  48. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js → PkChatbot-CxkTubw8.js} +6 -6
  49. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js.map → PkChatbot-CxkTubw8.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js → PkChatbotEmptyState-CUoHkCgO.js} +2 -2
  51. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js.map → PkChatbotEmptyState-CUoHkCgO.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js → PkChatbotInput-CPf7wqiQ.js} +4 -4
  53. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js.map → PkChatbotInput-CPf7wqiQ.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js → PkChatbotMessages-CLNu2dTm.js} +307 -307
  55. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js.map → PkChatbotMessages-CLNu2dTm.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js → PkChatbotStepPayload-Cf7mJPjL.js} +2 -2
  57. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js.map → PkChatbotStepPayload-Cf7mJPjL.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js → PkChatbotStepToolDetail-D6nwNnHv.js} +16 -16
  59. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js.map → PkChatbotStepToolDetail-D6nwNnHv.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js → PkChatbotSteps-xkxdaX7O.js} +38 -38
  61. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js.map → PkChatbotSteps-xkxdaX7O.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js → PkChatbotViewChat-BkkyjiFl.js} +22 -22
  63. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js.map → PkChatbotViewChat-BkkyjiFl.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js → PkChatbotViewConversations-hgqSO1hx.js} +2 -2
  65. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js.map → PkChatbotViewConversations-hgqSO1hx.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkFilePreview-k5gEl3n8.js → PkFilePreview-CmsT6lSP.js} +701 -624
  67. package/dist-vue/_chunks/PkFilePreview-CmsT6lSP.js.map +1 -0
  68. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js → PkFilePreviewDialog-DIiTt9iK.js} +2 -2
  69. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js.map → PkFilePreviewDialog-DIiTt9iK.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js → PkImageEditorDialog-CE0Y5Pwr.js} +2 -2
  71. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js.map → PkImageEditorDialog-CE0Y5Pwr.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js → PkStreamingMarkdown-BBvCtDlO.js} +2 -2
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js.map → PkStreamingMarkdown-BBvCtDlO.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js → PkToolChatFile-DVhunkPS.js} +3 -3
  75. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js.map → PkToolChatFile-DVhunkPS.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js → PkToolShowArtifact-DKOTsP9C.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js.map → PkToolShowArtifact-DKOTsP9C.js.map} +1 -1
  78. package/dist-vue/_chunks/PkToolShowChart-CNBUjDc7.js +133 -0
  79. package/dist-vue/_chunks/PkToolShowChart-CNBUjDc7.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js → PkToolShowContactForm-D1Ff15Zf.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js.map → PkToolShowContactForm-D1Ff15Zf.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js → PkToolShowDiagram-CBwqjy6a.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js.map → PkToolShowDiagram-CBwqjy6a.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js → PkToolShowForm-D-rzzwJa.js} +3 -3
  85. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js.map → PkToolShowForm-D-rzzwJa.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js → PkToolShowImageGallery-Cre2zSGV.js} +2 -2
  87. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js.map → PkToolShowImageGallery-Cre2zSGV.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js → PkToolShowProductList-D4FAfMS-.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js.map → PkToolShowProductList-D4FAfMS-.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js → PkToolShowSources-BC6YJl-O.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js.map → PkToolShowSources-BC6YJl-O.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js → PkToolShowVideo-CxN7z_cZ.js} +2 -2
  93. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js.map → PkToolShowVideo-CxN7z_cZ.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js → PkToolShowWebPages-0Ux6n8G1.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js.map → PkToolShowWebPages-0Ux6n8G1.js.map} +1 -1
  96. package/dist-vue/_chunks/chartFormat-B1T7y-16.js +27 -0
  97. package/dist-vue/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  98. package/dist-vue/_chunks/{excelNumberFormat-C1sCQrOz.js → excelNumberFormat-BxRi0Y3e.js} +101 -88
  99. package/dist-vue/_chunks/excelNumberFormat-BxRi0Y3e.js.map +1 -0
  100. package/dist-vue/_chunks/{utils-KBB6SDPn.js → utils-C9l078yb.js} +10 -10
  101. package/dist-vue/_chunks/utils-C9l078yb.js.map +1 -0
  102. package/dist-vue/composables.js +9 -3
  103. package/dist-vue/composables.js.map +1 -1
  104. package/dist-vue/index.js +42 -42
  105. package/dist-vue/index.js.map +1 -1
  106. package/dist-vue/locales.js +6 -0
  107. package/dist-vue/packages/components/src/chat/PkChart.d.ts +8 -0
  108. package/dist-vue/packages/components/src/chat/PkFileChart.d.ts +14 -0
  109. package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +4 -1
  110. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +240 -0
  111. package/dist-vue/packages/components/src/chat/utils.d.ts +6 -1
  112. package/dist-vue/packages/models/src/schema/Chart.d.ts +91 -0
  113. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +381 -0
  114. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +304 -0
  115. package/dist-vue/style.css +1 -1
  116. package/package.json +1 -1
  117. package/dist/_chunks/PkChart-CbtMRGWc.js.map +0 -1
  118. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js +0 -1665
  119. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js.map +0 -1
  120. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js +0 -224
  121. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js.map +0 -1
  122. package/dist/_chunks/excelNumberFormat-BhQjife9.js.map +0 -1
  123. package/dist/_chunks/utils-DMvy5QRR.js.map +0 -1
  124. package/dist-vue/_chunks/PkChart-D-K7nc0g.js.map +0 -1
  125. package/dist-vue/_chunks/PkFilePreview-k5gEl3n8.js.map +0 -1
  126. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js +0 -217
  127. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js.map +0 -1
  128. package/dist-vue/_chunks/excelNumberFormat-C1sCQrOz.js.map +0 -1
  129. package/dist-vue/_chunks/utils-KBB6SDPn.js.map +0 -1
@@ -0,0 +1,1745 @@
1
+ import { r as e } from "./rolldown-runtime-9rEmUaIe.js";
2
+ import { A as t, B as n, C as r, Et as i, F as a, I as o, J as s, L as c, N as l, Ot as u, Q as d, S as f, Tt as p, V as m, X as h, _ as g, d as _, f as v, g as y, gt as b, h as x, j as S, k as C, kt as w, ot as T, r as ee, tt as te, v as E, vt as D, w as O, wt as k, x as A, y as j, z as M } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
3
+ import { r as ne } from "./vue-i18n-POtLvOl1.js";
4
+ import { i as N, n as re, r as P } from "./excelNumberFormat-CcXF_wJK.js";
5
+ import { G as ie, H as F, J as I, K as ae, U as oe, W as L, Y as se, o as ce, q as le, s as R } from "./utils-BBoaLDYF.js";
6
+ import { d as ue, l as de } from "./dist-D6oUr4J_.js";
7
+ import { r as fe } from "./index.es-DIHz5I8K.js";
8
+ import { t as pe } from "./VvButtonLocalized-C8S7XJGv.js";
9
+ import { a as me, i as z, r as he, t as ge } from "./PkSelectionActions-CMyg_x8h.js";
10
+ import { t as B } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
11
+ import { t as _e } from "./PkEditorRadioButtons-Br4c42KS.js";
12
+ // ../../packages/components/src/chat/fileSelection.ts
13
+ var V = 2e3, ve = 1e3, H = 60, U = 1400, W = 20, ye = 100, G = (e) => Number(e.slice(1)), K = (e) => {
14
+ let t = [...new Set(e)].sort((e, t) => G(e) - G(t)), n = [];
15
+ for (let e of t) {
16
+ let t = n[n.length - 1];
17
+ t && G(e) === G(t.to) + 1 ? t.to = e : n.push({
18
+ from: e,
19
+ to: e
20
+ });
21
+ }
22
+ return n.slice(0, 100);
23
+ }, be = (e, t) => {
24
+ let n = [];
25
+ if (!t) return n;
26
+ for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + 1)) n.push(r);
27
+ return n;
28
+ }, q = (e, t, n) => {
29
+ let r = be(e, e.slice(t, t + n));
30
+ if (r.length < 2) return {};
31
+ let i = t, a = t + n;
32
+ for (let t = !0; a - i <= U; t = !t) {
33
+ if (be(e, e.slice(i, a)).length === 1) return { find: e.slice(i, a) };
34
+ if (t && i > 0) i = e.slice(0, i).replace(/\S*\s*$/, "").length;
35
+ else if (a < e.length) {
36
+ let t = e.slice(a).match(/^\s*\S*/)?.[0] ?? "";
37
+ a += Math.max(1, t.length);
38
+ } else if (i === 0) break;
39
+ }
40
+ return { occurrence: {
41
+ index: r.indexOf(t) + 1 || 1,
42
+ of: r.length
43
+ } };
44
+ }, xe = (e) => (e.querySelectorAll("[data-quote-skip]").forEach((e) => e.remove()), e.querySelectorAll("[data-paragraph]").forEach((e) => e.append("\n")), e.textContent ?? ""), Se = (e) => e.length > ve ? `${e.slice(0, ve / 2)} […] ${e.slice(-500)}` : e, Ce = (e) => {
45
+ let t = e.startContainer.getRootNode().getSelection?.() ?? document.getSelection();
46
+ try {
47
+ t?.setBaseAndExtent(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
48
+ } catch {}
49
+ }, we = (e, t, n) => {
50
+ let r = t.commonAncestorContainer;
51
+ if (!e.contains(r) || (r instanceof Element ? r : r.parentElement)?.closest("[data-quote-skip]")) return;
52
+ let i = [...e.querySelectorAll("[data-paragraph]")].filter((e) => !e.closest(n) && t.intersectsNode(e));
53
+ if (!i.length) return;
54
+ let a = i.flatMap((e) => e.dataset.paragraph.split(" ")), o = xe(t.cloneContents()), s = o.trim();
55
+ if (s.length < 2) return;
56
+ let c = {
57
+ format: "docx",
58
+ runs: K(a),
59
+ paragraphCount: new Set(a).size,
60
+ quote: Se(s),
61
+ measure: () => {
62
+ let e = t.getBoundingClientRect(), n = t.getClientRects()[0] ?? e;
63
+ return {
64
+ start: {
65
+ top: n.top,
66
+ left: n.left
67
+ },
68
+ bottom: e.bottom
69
+ };
70
+ },
71
+ restore: () => Ce(t)
72
+ };
73
+ if (i.length === 1) {
74
+ let e = i[0], n = document.createRange();
75
+ n.selectNodeContents(e);
76
+ let r = xe(n.cloneContents()).replace(/\n$/, ""), a = document.createRange();
77
+ a.setStart(e, 0), a.setEnd(t.startContainer, t.startOffset);
78
+ let l = xe(a.cloneContents()).length + (o.length - o.trimStart().length);
79
+ c.before = r.slice(Math.max(0, l - H), l), c.after = r.slice(l + s.length, l + s.length + H), Object.assign(c, q(r, l, s.length));
80
+ }
81
+ return c;
82
+ }, Te = (e) => {
83
+ let t = "";
84
+ for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
85
+ return t;
86
+ }, Ee = (e, t) => {
87
+ let n = { ...t }, r = e.rows.flatMap((e) => e.cells.filter((e) => e.span).map((t) => ({
88
+ r1: e.row,
89
+ r2: e.row + t.span.rows - 1,
90
+ c1: t.col,
91
+ c2: t.col + t.span.cols - 1
92
+ })));
93
+ for (let e = !0; e;) {
94
+ e = !1;
95
+ for (let t of r) t.r1 <= n.r2 && t.r2 >= n.r1 && t.c1 <= n.c2 && t.c2 >= n.c1 && (t.r1 < n.r1 || t.r2 > n.r2 || t.c1 < n.c1 || t.c2 > n.c2) && (n.r1 = Math.min(n.r1, t.r1), n.r2 = Math.max(n.r2, t.r2), n.c1 = Math.min(n.c1, t.c1), n.c2 = Math.max(n.c2, t.c2), e = !0);
96
+ }
97
+ let i = `${Te(n.c1)}${n.r1}`, a = `${Te(n.c2)}${n.r2}`, o = (e.hiddenRows ?? []).filter((e) => e >= n.r1 && e <= n.r2).slice(0, ye), s = e.columns.filter((e) => e.hidden && e.col >= n.c1 && e.col <= n.c2).map((e) => Te(e.col)).slice(0, ye), c = e.rows.filter((e) => e.row >= n.r1 && e.row <= n.r2).flatMap((e) => e.cells.filter((e) => e.col >= n.c1 && e.col <= n.c2 && e.value !== void 0 && e.value !== "")).slice(0, W).map((e) => String(e.value)).join("; ").slice(0, 500);
98
+ return {
99
+ format: "xlsx",
100
+ sheet: e.name,
101
+ range: i === a ? i : `${i}:${a}`,
102
+ cells: (n.r2 - n.r1 + 1) * (n.c2 - n.c1 + 1),
103
+ ...o.length ? { hiddenRows: o } : {},
104
+ ...s.length ? { hiddenColumns: s } : {},
105
+ ...c ? { sample: c } : {}
106
+ };
107
+ };
108
+ // ../../packages/components/src/chat/PkFileChart.vue?vue&type=script&setup=true&lang.ts
109
+ C(), T(), p();
110
+ var De = {
111
+ class: "pk-file-chart",
112
+ "data-quote-skip": ""
113
+ }, Oe = {
114
+ key: 1,
115
+ class: "pk-file-chart__placeholder"
116
+ }, ke = { class: "pk-file-chart__title" }, J = /*#__PURE__*/ B(/* @__PURE__ */ O({
117
+ __name: "PkFileChart",
118
+ props: { preview: { type: null } },
119
+ setup(e) {
120
+ let t = r(() => import("./PkChart-CYFx_UDq.js")), { t: n } = ne({ useScope: "global" });
121
+ return (r, i) => {
122
+ let a = fe;
123
+ return M(), j("div", De, [e.preview.chart ? (M(), g(k(t), {
124
+ key: 0,
125
+ chart: e.preview.chart,
126
+ colors: e.preview.colors,
127
+ legend: e.preview.legend,
128
+ paper: ""
129
+ }, null, 8, [
130
+ "chart",
131
+ "colors",
132
+ "legend"
133
+ ])) : (M(), j("div", Oe, [
134
+ f(a, {
135
+ name: "ri:bar-chart-2-line",
136
+ class: "text-16"
137
+ }),
138
+ y("span", ke, w(e.preview.title || k(n)("chatFilePreview.chart")), 1),
139
+ y("span", null, w(k(n)("chatFilePreview.chartNotDrawn")), 1)
140
+ ]))]);
141
+ };
142
+ }
143
+ }), [["styles", [".pk-file-chart{width:100%;height:100%;padding:var(--spacing-8);box-sizing:border-box;color:#595959;background-color:#fff;border:1px solid #d9d9d9;font-family:Calibri,Carlito,Segoe UI,Arial,sans-serif}.pk-file-chart__placeholder{justify-content:center;align-items:center;gap:var(--spacing-4);height:100%;font-size:var(--text-12);text-align:center;flex-direction:column;display:flex}.pk-file-chart__title{font-size:var(--text-14)}"]]]);
144
+ // ../../packages/components/src/chat/PkSpreadsheetPreview.vue?vue&type=script&setup=true&lang.ts
145
+ C(), T(), p(), ee();
146
+ var Ae = { class: "pk-spreadsheet-preview" }, je = { class: "pk-spreadsheet-preview__bar" }, Me = ["aria-label"], Ne = ["aria-label"], Pe = ["aria-label"], Fe = [
147
+ "rowspan",
148
+ "colspan",
149
+ "data-focus",
150
+ "data-cell",
151
+ "title",
152
+ "onMousedown",
153
+ "onMouseenter"
154
+ ], Ie = {
155
+ key: 1,
156
+ class: "pk-spreadsheet-preview__charts"
157
+ }, Le = {
158
+ key: 2,
159
+ class: "pk-spreadsheet-preview__more"
160
+ }, Re = ["aria-label"], ze = ["aria-current", "onClick"], Be = { class: "pk-spreadsheet-preview__status" }, Ve = { class: "pk-spreadsheet-preview__info" }, He = ["title"], Ue = ["title"], We = {
161
+ key: 2,
162
+ class: "pk-spreadsheet-preview__stats"
163
+ }, Ge = {
164
+ key: 0,
165
+ class: "pk-spreadsheet-preview__average"
166
+ }, Ke = { key: 1 }, qe = { class: "pk-spreadsheet-preview__zoom" }, Je = { class: "pk-spreadsheet-preview__percent" }, Ye = 64, Xe = 20, Ze = 28, Qe = 44, $e = 400, et = 10, tt = /*#__PURE__*/ B(/* @__PURE__ */ O({
167
+ __name: "PkSpreadsheetPreview",
168
+ props: /*@__PURE__*/ l({
169
+ preview: { type: null },
170
+ marked: { type: Map }
171
+ }, {
172
+ sheet: { default: 0 },
173
+ sheetModifiers: {},
174
+ zoom: { default: 1 },
175
+ zoomModifiers: {}
176
+ }),
177
+ emits: /*@__PURE__*/ l(["select"], ["update:sheet", "update:zoom"]),
178
+ setup(e, { emit: t }) {
179
+ let n = e, r = t, { t: l, locale: p } = ne({ useScope: "global" }), g = s(e, "sheet"), C = s(e, "zoom"), T = h("scrollEl"), { width: ee, height: te } = de(T, {
180
+ width: 0,
181
+ height: 0
182
+ }, { box: "border-box" }), D = x(() => n.preview.sheets[g.value] ?? n.preview.sheets[0]);
183
+ d(() => n.preview, () => {
184
+ g.value = 0;
185
+ });
186
+ let O = x(() => n.marked?.get(D.value?.name ?? "")), ie = x(() => {
187
+ let e = /* @__PURE__ */ new Map();
188
+ for (let t of O.value ?? []) {
189
+ let [n, r] = t.split(":"), i = e.get(Number(n));
190
+ e.set(Number(n), i ? `${i},${r}` : r);
191
+ }
192
+ return e;
193
+ }), F = (e, t) => !!O.value?.has(`${e}:${t}`);
194
+ d(() => n.marked, (e) => {
195
+ if (!e || O.value) return;
196
+ let t = n.preview.sheets.findIndex((t) => e.has(t.name));
197
+ t >= 0 && (g.value = t);
198
+ }, { immediate: !0 });
199
+ let I = () => he(T.value, ".pk-spreadsheet-preview__cell--marked");
200
+ d(O, I, { flush: "post" }), c(I);
201
+ let ae = (e) => {
202
+ let t = "";
203
+ for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
204
+ return t;
205
+ }, oe = x(() => (D.value?.charts ?? []).reduce((e, t) => ({
206
+ col: Math.max(e.col, t.lastCol),
207
+ row: Math.max(e.row, t.lastRow)
208
+ }), {
209
+ col: 0,
210
+ row: 0
211
+ })), L = x(() => {
212
+ let e = D.value;
213
+ if (!e) return [];
214
+ let t = new Set(e.columns.filter((e) => e.hidden).map((e) => e.col)), n = new Map(e.columns.map((e) => [e.col, e.width])), r = [], i = Qe, a = ee.value / C.value;
215
+ for (let o = 1; o <= e.lastColumn || o <= oe.value.col || !e.moreColumns && (o <= e.lastColumn + 2 || i < a); o++) {
216
+ if (t.has(o)) continue;
217
+ let e = n.get(o) ?? Ye;
218
+ r.push({
219
+ col: o,
220
+ width: e
221
+ }), i += e;
222
+ }
223
+ return r;
224
+ }), se = x(() => L.value.reduce((e, t) => e + t.width, Qe)), ce = x(() => L.value.map((e) => `${e.col}:${e.width}`).join(",")), le = /* @__PURE__ */ new WeakMap(), R = x(() => {
225
+ let e = D.value;
226
+ if (!e) return [];
227
+ let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((te.value / C.value - Ze) / Xe), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size, oe.value.row), a = le.get(e);
228
+ a || (a = /* @__PURE__ */ new Map(), le.set(e, a));
229
+ let o = a;
230
+ return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
231
+ let t = o.get(e);
232
+ return t || (t = {
233
+ row: e,
234
+ height: n.get(e) ?? Xe
235
+ }, o.set(e, t)), t;
236
+ });
237
+ }), ue = x(() => {
238
+ let e = D.value?.charts ?? [];
239
+ if (!e.length) return [];
240
+ let t = C.value;
241
+ return e.map((e, n) => {
242
+ let r = L.value.reduce((t, n) => n.col < e.col ? t + n.width : t, Qe + e.x), i = R.value.reduce((t, n) => n.row < e.row ? t + n.height : t, Ze + e.y);
243
+ return {
244
+ key: `${D.value?.name}:${n}`,
245
+ chart: e,
246
+ css: {
247
+ left: `${r * t}px`,
248
+ top: `${i * t}px`,
249
+ width: `${e.width * t}px`,
250
+ height: `${e.height * t}px`
251
+ }
252
+ };
253
+ });
254
+ }), fe = x(() => {
255
+ let e = /* @__PURE__ */ new Map();
256
+ for (let t of D.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
257
+ return e;
258
+ }), me = x(() => {
259
+ let e = /* @__PURE__ */ new Map();
260
+ for (let t of D.value?.rows ?? []) for (let n of t.cells) if (n.span) for (let r = 0; r < n.span.rows; r++) for (let i = 0; i < n.span.cols; i++) (r || i) && e.set(`${t.row + r},${n.col + i}`, {
261
+ row: t.row,
262
+ col: n.col
263
+ });
264
+ return e;
265
+ }), z = (e, t) => fe.value.get(`${e},${t}`), ge = (e, t) => {
266
+ let n = z(e, t)?.span;
267
+ if (n) return {
268
+ rows: R.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
269
+ cols: L.value.filter((e) => e.col >= t && e.col < t + n.cols).length
270
+ };
271
+ }, B = (e) => e?.style === void 0 ? void 0 : n.preview.styles[e.style], _e = (e) => {
272
+ let t = e.numFmt === void 0 ? void 0 : n.preview.numberFormats?.[e.numFmt], r = e.value;
273
+ if (t !== void 0) try {
274
+ return e.format === "date" ? e.serial === void 0 ? void 0 : re(t, e.serial, p.value, n.preview.date1904) : typeof r == "number" ? N(t) ? re(t, r, p.value, n.preview.date1904) : P(t, r, p.value) : void 0;
275
+ } catch {
276
+ return;
277
+ }
278
+ }, V = (e, t) => {
279
+ let n = _e(e);
280
+ if (n) return n.text;
281
+ let r = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
282
+ minimumFractionDigits: e.decimals,
283
+ maximumFractionDigits: e.maxDecimals ?? e.decimals
284
+ };
285
+ return new Intl.NumberFormat(p.value, {
286
+ ...r,
287
+ useGrouping: e.grouped === !0,
288
+ ...e.format === "percent" ? { style: "percent" } : {},
289
+ ...e.format === "currency" && e.currency ? {
290
+ style: "currency",
291
+ currency: e.currency
292
+ } : {}
293
+ }).format(t);
294
+ }, ve = (e) => {
295
+ let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
296
+ return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(p.value, {
297
+ dateStyle: "short",
298
+ timeZone: "UTC"
299
+ }).format(t);
300
+ }, H = (e) => {
301
+ if (!e) return "";
302
+ if (e.missing) return "—";
303
+ let t = e.value;
304
+ return t === void 0 ? "" : typeof t == "boolean" ? l(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? _e(e)?.text ?? ve(t) : typeof t == "number" ? V(e, t) : t;
305
+ }, U = (e) => {
306
+ if (!e) return "";
307
+ if (e.formula) return `=${e.formula}`;
308
+ let t = e.value;
309
+ return typeof t == "number" ? new Intl.NumberFormat(p.value, {
310
+ useGrouping: !1,
311
+ maximumFractionDigits: 15,
312
+ ...e.format === "percent" ? { style: "percent" } : {}
313
+ }).format(t) : H(e);
314
+ }, W = (e) => e ? `${e.width}px solid ${e.color}` : void 0, ye = (e, t, n) => {
315
+ let r = B(e), i = e?.value, a = typeof i == "number" || e?.format === "date" || !!e?.missing, o = {
316
+ textAlign: r?.align ?? (a ? "right" : typeof i == "boolean" || e?.format === "error" ? "center" : "left"),
317
+ verticalAlign: r?.valign === "top" ? "top" : r?.valign === "middle" ? "middle" : "bottom",
318
+ whiteSpace: r?.wrap ? "pre-wrap" : "nowrap"
319
+ };
320
+ r?.bold && (o.fontWeight = 700), r?.italic && (o.fontStyle = "italic");
321
+ let s = [r?.underline ? "underline" : "", r?.strike ? "line-through" : ""].filter(Boolean).join(" ");
322
+ s && (o.textDecoration = s), r?.size && (o.fontSize = `${r.size}pt`);
323
+ let c = e ? _e(e)?.color : void 0;
324
+ if ((c ?? r?.color) && (o.color = c ?? r?.color), r?.fill && (o.backgroundColor = r.fill), r?.indent) {
325
+ let e = `${4 + r.indent * 9}px`;
326
+ o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
327
+ }
328
+ let l = st(t, n);
329
+ return G(t, n) ? (o.borderStyle = "hidden", o.boxShadow = [...l, Oe(e, t, n)].filter(Boolean).join(", ")) : (o.borderTop = W(r?.borders?.top), o.borderRight = W(r?.borders?.right), o.borderBottom = W(r?.borders?.bottom), o.borderLeft = W(r?.borders?.left), o.boxShadow = [...l, ...q(e, t, n)].join(", ")), Object.assign(o, rt(t, n)), o;
330
+ }, G = (e, t) => {
331
+ let n = D.value?.frozen;
332
+ return !!n && (e <= n.rows || t <= n.cols);
333
+ }, K = {
334
+ top: (e) => `inset 0 ${e.width}px 0 ${e.color}`,
335
+ right: (e) => `inset -${e.width}px 0 0 ${e.color}`,
336
+ bottom: (e) => `inset 0 -${e.width}px 0 ${e.color}`,
337
+ left: (e) => `inset ${e.width}px 0 0 ${e.color}`
338
+ }, be = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), q = (e, t, n) => {
339
+ let r = B(e)?.borders;
340
+ return [t === R.value[0]?.row && r?.top && K.top(r.top), n === L.value[0]?.col && r?.left && K.left(r.left)].filter((e) => !!e);
341
+ }, xe = x(() => R.value.map((e) => e.row)), Se = x(() => L.value.map((e) => e.col)), Ce = x(() => new Map(xe.value.map((e, t) => [e, t]))), we = x(() => new Map(Se.value.map((e, t) => [e, t]))), Te = (e, t, n, r) => {
342
+ let i = [], a = t.get(n) ?? e.length;
343
+ for (; a < e.length && e[a] < n + r; a++) i.push(e[a]);
344
+ return {
345
+ spanned: i,
346
+ next: e[a]
347
+ };
348
+ }, De = (e, t, n, r) => {
349
+ let { spanned: i, next: a } = Te(xe.value, Ce.value, t, e?.span?.rows ?? 1), { spanned: o, next: s } = Te(Se.value, we.value, n, e?.span?.cols ?? 1);
350
+ return (r === "right" ? s === void 0 ? [] : i.map((e) => ({
351
+ row: e,
352
+ col: s
353
+ })) : a === void 0 ? [] : o.map((e) => ({
354
+ row: a,
355
+ col: e
356
+ }))).map((e) => {
357
+ let t = me.value.get(`${e.row},${e.col}`) ?? e;
358
+ return z(t.row, t.col);
359
+ });
360
+ }, Oe = (e, t, n) => {
361
+ let r = B(e)?.borders, i = be(r?.right, ...De(e, t, n, "right").map((e) => B(e)?.borders?.left)), a = be(r?.bottom, ...De(e, t, n, "bottom").map((e) => B(e)?.borders?.top)), o = D.value?.gridlines;
362
+ return [
363
+ i ? K.right(i) : o && "inset calc(var(--border) * -1) 0 0 var(--pk-spreadsheet-gridline)",
364
+ a ? K.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
365
+ ...q(e, t, n)
366
+ ].filter(Boolean).join(", ");
367
+ }, ke = (e) => Ze + R.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), tt = (e) => Qe + L.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), nt = x(() => {
368
+ let e = D.value?.frozen;
369
+ return {
370
+ top: ke((e?.rows ?? 0) + 1),
371
+ left: tt((e?.cols ?? 0) + 1)
372
+ };
373
+ }), rt = (e, t) => {
374
+ let n = D.value?.frozen;
375
+ if (!n) return {};
376
+ let r = {};
377
+ return e <= n.rows && (r.position = "sticky", r.top = `${ke(e)}px`, r.scrollMarginTop = r.top, r.zIndex = 0), t <= n.cols && (r.position = "sticky", r.left = `${tt(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
378
+ }, Y = b({
379
+ row: 1,
380
+ col: 1
381
+ }), X = b({
382
+ row: 1,
383
+ col: 1
384
+ });
385
+ d(D, () => {
386
+ Y.value = {
387
+ row: 1,
388
+ col: 1
389
+ }, X.value = {
390
+ row: 1,
391
+ col: 1
392
+ };
393
+ });
394
+ let Z = x(() => ({
395
+ r1: Math.min(Y.value.row, X.value.row),
396
+ r2: Math.max(Y.value.row, X.value.row),
397
+ c1: Math.min(Y.value.col, X.value.col),
398
+ c2: Math.max(Y.value.col, X.value.col)
399
+ })), it = (e, t) => e >= Z.value.r1 && e <= Z.value.r2 && t >= Z.value.c1 && t <= Z.value.c2, at = (e, t) => X.value.row === e && X.value.col === t, ot = (e) => e >= Z.value.r1 && e <= Z.value.r2 ? `${Z.value.c1}:${Z.value.c2}:${X.value.row === e ? X.value.col : 0}:${e === Z.value.r1 ? "t" : ""}${e === Z.value.r2 ? "b" : ""}` : "", st = (e, t) => {
400
+ let { r1: n, r2: r, c1: i, c2: a } = Z.value;
401
+ if (n === r && i === a || !it(e, t)) return [];
402
+ let o = z(e, t)?.span, s = e + (o?.rows ?? 1) - 1, c = t + (o?.cols ?? 1) - 1, l = "var(--spacing-2)", u = "var(--pk-spreadsheet-green)";
403
+ return [
404
+ e === n && `inset 0 ${l} 0 ${u}`,
405
+ s >= r && `inset 0 calc(${l} * -1) 0 ${u}`,
406
+ t === i && `inset ${l} 0 0 ${u}`,
407
+ c >= a && `inset calc(${l} * -1) 0 0 ${u}`
408
+ ].filter((e) => !!e);
409
+ }, Q = b(!1), ct = (e, t, n) => {
410
+ T.value?.focus({ preventScroll: !0 }), X.value = {
411
+ row: e,
412
+ col: t
413
+ }, n.shiftKey || (Y.value = {
414
+ row: e,
415
+ col: t
416
+ }), Q.value = !0;
417
+ }, lt = (e, t) => {
418
+ Q.value && (X.value = {
419
+ row: e,
420
+ col: t
421
+ });
422
+ }, ut, dt = () => {
423
+ let e = [...T.value?.querySelectorAll(".pk-spreadsheet-preview__cell--range, [data-focus]") ?? []].map((e) => e.getBoundingClientRect());
424
+ if (e.length) return {
425
+ start: {
426
+ top: Math.min(...e.map((e) => e.top)),
427
+ left: Math.min(...e.map((e) => e.left))
428
+ },
429
+ bottom: Math.max(...e.map((e) => e.bottom))
430
+ };
431
+ }, ft = () => D.value ? {
432
+ ...Ee(D.value, Z.value),
433
+ measure: dt
434
+ } : void 0;
435
+ d([Z, Q], () => {
436
+ clearTimeout(ut), !Q.value && (ut = setTimeout(() => {
437
+ let e = Z.value, t = e.r2 > e.r1 || e.c2 > e.c1;
438
+ r("select", t ? ft() : void 0);
439
+ }, 150));
440
+ });
441
+ let pt = () => {
442
+ clearTimeout(ut), r("select", ft());
443
+ }, $, mt;
444
+ d(D, () => {
445
+ mt = void 0;
446
+ });
447
+ let ht = (e) => {
448
+ let [t, n] = ((e?.closest?.("[data-cell]"))?.dataset.cell ?? "").split(":").map(Number);
449
+ return t && n ? {
450
+ row: t,
451
+ col: n
452
+ } : void 0;
453
+ }, gt = () => {
454
+ clearTimeout($?.timer), $?.active && (Q.value = !1), $ = void 0;
455
+ };
456
+ o(() => {
457
+ gt(), clearTimeout(ut);
458
+ });
459
+ let _t = () => void a(pt), vt = (e) => {
460
+ gt();
461
+ let t = e.touches[0], n = e.touches.length === 1 ? ht(e.target) : void 0;
462
+ t && n && ($ = {
463
+ ...n,
464
+ x: t.clientX,
465
+ y: t.clientY,
466
+ active: !1,
467
+ timer: setTimeout(() => {
468
+ $ && ($.active = !0, T.value?.focus({ preventScroll: !0 }), Y.value = {
469
+ row: $.row,
470
+ col: $.col
471
+ }, X.value = {
472
+ row: $.row,
473
+ col: $.col
474
+ }, Q.value = !0);
475
+ }, $e)
476
+ });
477
+ }, yt = (e) => {
478
+ let t = e.touches[0];
479
+ if (!$ || !t) return;
480
+ if (!$.active) {
481
+ (!e.cancelable || Math.hypot(t.clientX - $.x, t.clientY - $.y) > et) && gt();
482
+ return;
483
+ }
484
+ e.preventDefault();
485
+ let n = T.value?.getRootNode(), r = ht(n?.elementFromPoint(t.clientX, t.clientY) ?? null);
486
+ r && (X.value = r);
487
+ }, bt = (e) => {
488
+ if (!$) return;
489
+ let { row: t, col: n, active: r } = $;
490
+ gt(), e.preventDefault();
491
+ let i = Z.value, a = i.r1 === i.r2 && i.c1 === i.c2;
492
+ if (r) {
493
+ a && _t();
494
+ return;
495
+ }
496
+ let o = a && at(t, n) && mt === `${t}:${n}`;
497
+ mt = `${t}:${n}`, T.value?.focus({ preventScroll: !0 }), Y.value = {
498
+ row: t,
499
+ col: n
500
+ }, X.value = {
501
+ row: t,
502
+ col: n
503
+ }, o && _t();
504
+ }, xt = (e) => {
505
+ let t = {
506
+ ArrowUp: [-1, 0],
507
+ ArrowDown: [1, 0],
508
+ ArrowLeft: [0, -1],
509
+ ArrowRight: [0, 1],
510
+ Enter: [1, 0],
511
+ Tab: [0, 1]
512
+ }[e.key];
513
+ if (!t) return;
514
+ e.preventDefault();
515
+ let n = R.value.map((e) => e.row), r = L.value.map((e) => e.col), i = (e) => me.value.get(`${e.row},${e.col}`) ?? e, o = i(X.value), s = n.indexOf(X.value.row), c = r.indexOf(X.value.col), l = o;
516
+ for (;;) {
517
+ let e = Math.min(n.length - 1, Math.max(0, s + t[0])), a = Math.min(r.length - 1, Math.max(0, c + t[1]));
518
+ if (e === s && a === c || (s = e, c = a, l = i({
519
+ row: n[s],
520
+ col: r[c]
521
+ }), l.row !== o.row || l.col !== o.col)) break;
522
+ }
523
+ X.value = l, e.shiftKey || (Y.value = l), a(() => T.value?.querySelector("[data-focus]")?.scrollIntoView({
524
+ block: "nearest",
525
+ inline: "nearest"
526
+ }));
527
+ }, St = x(() => z(X.value.row, X.value.col)), Ct = x(() => {
528
+ let { r1: e, r2: t, c1: n, c2: r } = Z.value;
529
+ if (e === t && n === r) return;
530
+ let i = 0, a = 0, o = 0, s;
531
+ for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
532
+ let t = z(c, e);
533
+ t && (t.value !== void 0 || t.missing) && (i++, typeof t.value == "number" && (a += t.value, o++, s ??= t));
534
+ }
535
+ if (i) return {
536
+ count: i,
537
+ sum: s ? V(s, a) : void 0,
538
+ average: s ? V(s, a / o) : void 0
539
+ };
540
+ }), wt = (e) => {
541
+ C.value = Math.min(2, Math.max(.5, Math.round((C.value + e) * 10) / 10));
542
+ };
543
+ return (t, n) => {
544
+ let r = pe;
545
+ return M(), j("div", Ae, [
546
+ y("div", je, [
547
+ y("span", {
548
+ class: "pk-spreadsheet-preview__ref",
549
+ "aria-label": k(l)("chatFilePreview.cell")
550
+ }, w(ae(X.value.col)) + w(X.value.row), 9, Me),
551
+ n[6] ||= y("span", {
552
+ class: "pk-spreadsheet-preview__fx",
553
+ "aria-hidden": "true"
554
+ }, "fx", -1),
555
+ y("output", {
556
+ class: "pk-spreadsheet-preview__formula",
557
+ "aria-label": k(l)("chatFilePreview.formulaBar")
558
+ }, w(U(St.value)), 9, Ne)
559
+ ]),
560
+ y("div", {
561
+ ref_key: "scrollEl",
562
+ ref: T,
563
+ class: "pk-spreadsheet-preview__scroll",
564
+ tabindex: "0",
565
+ role: "grid",
566
+ "aria-label": D.value?.name,
567
+ onKeydown: xt,
568
+ onMouseup: n[2] ||= (e) => Q.value = !1,
569
+ onMouseleave: n[3] ||= (e) => Q.value = !1,
570
+ onTouchstart: vt,
571
+ onTouchmove: yt,
572
+ onTouchend: bt,
573
+ onTouchcancel: gt
574
+ }, [
575
+ D.value ? (M(), j("table", {
576
+ key: 0,
577
+ class: i(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": D.value.gridlines }]),
578
+ style: u({
579
+ zoom: C.value,
580
+ width: `${se.value}px`,
581
+ "--pk-spreadsheet-stuck-top": `${nt.value.top}px`,
582
+ "--pk-spreadsheet-stuck-left": `${nt.value.left}px`
583
+ })
584
+ }, [
585
+ y("colgroup", null, [y("col", { style: u({ width: `${Qe}px` }) }, null, 4), (M(!0), j(v, null, m(L.value, (e) => (M(), j("col", {
586
+ key: e.col,
587
+ style: u({ width: `${e.width}px` })
588
+ }, null, 4))), 128))]),
589
+ y("thead", null, [y("tr", { style: u({ height: `${Ze}px` }) }, [n[7] ||= y("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (M(!0), j(v, null, m(L.value, (e) => (M(), j("th", {
590
+ key: e.col,
591
+ scope: "col",
592
+ class: i(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Z.value.c1 && e.col <= Z.value.c2 }]),
593
+ style: u(D.value.frozen && e.col <= D.value.frozen.cols ? {
594
+ left: `${tt(e.col)}px`,
595
+ zIndex: 2
596
+ } : void 0)
597
+ }, w(ae(e.col)), 7))), 128))], 4)]),
598
+ y("tbody", null, [(M(!0), j(v, null, m(R.value, (e, t, n, r) => {
599
+ let a = [
600
+ e,
601
+ D.value,
602
+ ce.value,
603
+ k(p),
604
+ ot(e.row),
605
+ ie.value.get(e.row)
606
+ ];
607
+ if (r && r.el && r.key === e.row && S(r, a)) return r;
608
+ let o = (M(), j("tr", {
609
+ key: e.row,
610
+ style: u({ height: `${e.height}px` })
611
+ }, [y("th", {
612
+ scope: "row",
613
+ class: i(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Z.value.r1 && e.row <= Z.value.r2 }]),
614
+ style: u(D.value.frozen && e.row <= D.value.frozen.rows ? {
615
+ ...rt(e.row, 0),
616
+ left: 0,
617
+ zIndex: 4
618
+ } : void 0)
619
+ }, w(e.row), 7), (M(!0), j(v, null, m(L.value, (t) => (M(), j(v, { key: t.col }, [me.value.has(`${e.row},${t.col}`) ? E("", !0) : (M(), j("td", {
620
+ key: 0,
621
+ rowspan: ge(e.row, t.col)?.rows,
622
+ colspan: ge(e.row, t.col)?.cols,
623
+ class: i(["pk-spreadsheet-preview__cell", {
624
+ "pk-spreadsheet-preview__cell--range": it(e.row, t.col) && !at(e.row, t.col),
625
+ "pk-spreadsheet-preview__cell--missing": z(e.row, t.col)?.missing,
626
+ "pk-spreadsheet-preview__cell--marked": F(e.row, t.col)
627
+ }]),
628
+ style: u(ye(z(e.row, t.col), e.row, t.col)),
629
+ "data-focus": at(e.row, t.col) ? "" : void 0,
630
+ "data-cell": `${e.row}:${t.col}`,
631
+ title: z(e.row, t.col)?.missing ? k(l)("chatFilePreview.missingValue") : void 0,
632
+ onMousedown: _((n) => ct(e.row, t.col, n), ["prevent"]),
633
+ onMouseenter: (n) => lt(e.row, t.col),
634
+ onDblclick: pt
635
+ }, w(H(z(e.row, t.col))), 47, Fe))], 64))), 128))], 4));
636
+ return o.memo = a, o;
637
+ }, n, 0), 128))])
638
+ ], 6)) : E("", !0),
639
+ ue.value.length ? (M(), j("div", Ie, [(M(!0), j(v, null, m(ue.value, (e) => (M(), j("div", {
640
+ key: e.key,
641
+ class: "pk-spreadsheet-preview__chart",
642
+ style: u(e.css)
643
+ }, [f(J, { preview: e.chart }, null, 8, ["preview"])], 4))), 128))])) : E("", !0),
644
+ D.value && (D.value.moreRows || D.value.moreColumns) ? (M(), j("p", Le, [D.value.moreRows ? (M(), j(v, { key: 0 }, [A(w(k(l)("chatFilePreview.moreRows", D.value.moreRows)), 1)], 64)) : E("", !0), D.value.moreColumns ? (M(), j(v, { key: 1 }, [A(w(k(l)("chatFilePreview.moreColumns", D.value.moreColumns)), 1)], 64)) : E("", !0)])) : E("", !0)
645
+ ], 40, Pe),
646
+ y("nav", {
647
+ class: "pk-spreadsheet-preview__sheets",
648
+ "aria-label": k(l)("chatFilePreview.sheets")
649
+ }, [(M(!0), j(v, null, m(e.preview.sheets, (e, t) => (M(), j("button", {
650
+ key: e.name,
651
+ type: "button",
652
+ class: "pk-spreadsheet-preview__sheet",
653
+ "aria-current": t === g.value ? "page" : void 0,
654
+ onClick: (e) => g.value = t
655
+ }, w(e.name), 9, ze))), 128))], 8, Re),
656
+ y("div", Be, [y("p", Ve, [e.preview.staleFormulas ? (M(), j("span", {
657
+ key: 0,
658
+ class: "pk-spreadsheet-preview__note",
659
+ title: k(l)("chatFilePreview.staleFormulas")
660
+ }, w(k(l)("chatFilePreview.staleFormulas")), 9, He)) : e.preview.computedFormulas ? (M(), j("span", {
661
+ key: 1,
662
+ class: "pk-spreadsheet-preview__note",
663
+ title: k(l)("chatFilePreview.computedFormulas")
664
+ }, w(k(l)("chatFilePreview.computedFormulas")), 9, Ue)) : E("", !0), Ct.value ? (M(), j("span", We, [
665
+ Ct.value.average ? (M(), j("span", Ge, w(k(l)("chatFilePreview.average")) + " " + w(Ct.value.average), 1)) : E("", !0),
666
+ y("span", null, w(k(l)("chatFilePreview.count")) + " " + w(Ct.value.count), 1),
667
+ Ct.value.sum ? (M(), j("span", Ke, w(k(l)("chatFilePreview.sum")) + " " + w(Ct.value.sum), 1)) : E("", !0)
668
+ ])) : E("", !0)]), y("div", qe, [
669
+ f(r, {
670
+ modifiers: "action-quiet",
671
+ icon: "ri:subtract-line",
672
+ "aria-label": k(l)("chatFilePreview.zoomOut"),
673
+ disabled: C.value <= .5,
674
+ onClick: n[4] ||= (e) => wt(-.1)
675
+ }, null, 8, ["aria-label", "disabled"]),
676
+ y("span", Je, w(Math.round(C.value * 100)) + "% ", 1),
677
+ f(r, {
678
+ modifiers: "action-quiet",
679
+ icon: "ri:add-line",
680
+ "aria-label": k(l)("chatFilePreview.zoomIn"),
681
+ disabled: C.value >= 2,
682
+ onClick: n[5] ||= (e) => wt(.1)
683
+ }, null, 8, ["aria-label", "disabled"])
684
+ ])])
685
+ ]);
686
+ };
687
+ }
688
+ }), [["styles", [".pk-spreadsheet-preview{--pk-spreadsheet-green:#217346;--pk-spreadsheet-green-head:#217346;--pk-spreadsheet-gridline:#e1e1e1;flex-direction:column;flex:1;min-height:0;display:flex}.pk-spreadsheet-preview__bar{min-height:var(--spacing-40);border-bottom:var(--border) solid var(--color-surface-3);background-color:var(--color-surface);font-size:var(--text-14);align-items:stretch;display:flex}.pk-spreadsheet-preview__ref{width:var(--spacing-96);padding:0 var(--spacing-12);box-sizing:border-box;border-right:var(--border) solid var(--color-surface-3);font-variant-numeric:tabular-nums;flex-shrink:0;align-items:center;display:flex}.pk-spreadsheet-preview__fx{width:var(--spacing-40);border-right:var(--border) solid var(--color-surface-3);color:var(--color-word-3);flex-shrink:0;justify-content:center;align-items:center;font-family:Georgia,serif;font-style:italic;display:flex}.pk-spreadsheet-preview__formula{min-width:0;padding:0 var(--spacing-12);text-overflow:ellipsis;white-space:nowrap;flex:1;align-items:center;display:flex;overflow:hidden}.pk-spreadsheet-preview__scroll{cursor:cell;background-color:#fff;outline:none;flex:1;min-height:0;position:relative;overflow:auto}.pk-spreadsheet-preview__scroll:focus-visible{box-shadow:inset 0 0 0 var(--spacing-2) var(--input-focus-color)}.pk-spreadsheet-preview__grid{border-collapse:collapse;table-layout:fixed;color:#000;-webkit-user-select:none;user-select:none;-webkit-touch-callout:none;font-family:Calibri,Carlito,Segoe UI,Arial,sans-serif;font-size:11pt}.pk-spreadsheet-preview__grid td{max-width:0;padding:0 var(--spacing-4);text-overflow:clip;background-color:#fff;line-height:1.2;overflow:hidden}.pk-spreadsheet-preview__grid--lines td{border:var(--border) solid var(--pk-spreadsheet-gridline)}.pk-spreadsheet-preview__charts{z-index:0;pointer-events:none;position:absolute;top:0;left:0}.pk-spreadsheet-preview__chart{pointer-events:auto;cursor:default;position:absolute}.pk-spreadsheet-preview__corner,.pk-spreadsheet-preview__head,.pk-spreadsheet-preview__row{z-index:1;box-shadow:var(--pk-spreadsheet-lines);background-color:var(--color-surface-1);color:var(--color-word-3);font-family:var(--font-family-sans);font-size:var(--text-12);font-weight:var(--font-normal);text-align:center;border-style:hidden;position:sticky}.pk-spreadsheet-preview__corner,.pk-spreadsheet-preview__head{padding:var(--spacing-4) var(--spacing-4) var(--spacing-2);vertical-align:middle;line-height:1;top:0}.pk-spreadsheet-preview__row{vertical-align:middle}.pk-spreadsheet-preview__corner{--pk-spreadsheet-lines:inset 0 0 0 var(--border) var(--color-surface-3);z-index:5;left:0}.pk-spreadsheet-preview__head{--pk-spreadsheet-lines:inset 0 var(--border) 0 var(--color-surface-3), inset calc(var(--border) * -1) calc(var(--border) * -1) 0 var(--color-surface-3)}.pk-spreadsheet-preview__row{--pk-spreadsheet-lines:inset var(--border) 0 0 var(--color-surface-3), inset calc(var(--border) * -1) calc(var(--border) * -1) 0 var(--color-surface-3);padding:0 var(--spacing-4);font-variant-numeric:tabular-nums;left:0}.pk-spreadsheet-preview__head--current{background-color:var(--color-surface-2);box-shadow:var(--pk-spreadsheet-lines), inset 0 calc((var(--spacing-2) + var(--border)) * -1) 0 var(--pk-spreadsheet-green-head);color:var(--pk-spreadsheet-green-head);font-weight:var(--font-medium)}.pk-spreadsheet-preview__row--current{background-color:var(--color-surface-2);box-shadow:var(--pk-spreadsheet-lines), inset calc((var(--spacing-2) + var(--border)) * -1) 0 0 var(--pk-spreadsheet-green-head);color:var(--pk-spreadsheet-green-head);font-weight:var(--font-medium)}.pk-spreadsheet-preview__cell[data-focus]{scroll-margin-top:var(--pk-spreadsheet-stuck-top);scroll-margin-left:var(--pk-spreadsheet-stuck-left);outline:var(--spacing-2) solid var(--pk-spreadsheet-green);outline-offset:calc(var(--spacing-2) * -1)}.pk-spreadsheet-preview__cell--range{background-image:linear-gradient(#1f1d2b1f,#1f1d2b1f)}.pk-spreadsheet-preview__cell--missing{color:#6b6880}.pk-spreadsheet-preview__cell--marked{background-image:linear-gradient(var(--pk-spreadsheet-mark), var(--pk-spreadsheet-mark));animation:pk-spreadsheet-preview-marked 3.5s var(--ease-out) forwards}@media (prefers-reduced-motion:reduce){.pk-spreadsheet-preview__cell--marked{--pk-spreadsheet-mark:#facc1573;animation:none}}.pk-spreadsheet-preview__more{padding:var(--spacing-8) var(--spacing-12);color:#6b6880;font-size:var(--text-12);margin:0;position:sticky;left:0}.pk-spreadsheet-preview__sheets{min-height:var(--spacing-32);padding-left:var(--spacing-40);border-top:var(--border) solid var(--color-surface-3);background-color:var(--color-surface-1);flex-shrink:0;display:flex;overflow-x:auto}@media (pointer:coarse){.pk-spreadsheet-preview__sheets{min-height:var(--spacing-40)}}.pk-spreadsheet-preview__status{min-height:var(--spacing-40);border-top:var(--border) solid var(--color-surface-3);background-color:var(--color-surface-1);font-size:var(--text-12);flex-shrink:0;align-items:center;display:flex}.pk-spreadsheet-preview__sheet{padding:0 var(--spacing-16);border:0;border-right:var(--border) solid var(--color-surface-3);color:var(--color-word-2);font:inherit;font-size:var(--text-12);white-space:nowrap;cursor:pointer;background:0 0;flex-shrink:0}.pk-spreadsheet-preview__sheet:first-child{border-left:var(--border) solid var(--color-surface-3)}.pk-spreadsheet-preview__sheet:hover{background-color:var(--color-surface-2)}.pk-spreadsheet-preview__sheet[aria-current=page]{background-color:var(--color-surface);box-shadow:inset 0 calc(var(--spacing-2) * -1) 0 var(--pk-spreadsheet-green-head);color:var(--pk-spreadsheet-green-head);font-weight:var(--font-semibold)}.pk-spreadsheet-preview__info{align-items:center;gap:var(--spacing-16);min-width:0;padding:0 var(--spacing-12);color:var(--color-word-2);font-variant-numeric:tabular-nums;white-space:nowrap;flex:1;margin:0;display:flex;overflow:hidden}.pk-spreadsheet-preview__note{min-width:0;color:var(--color-word-3);text-overflow:ellipsis;overflow:hidden}.pk-spreadsheet-preview__stats{gap:var(--spacing-12);flex-shrink:0;margin-left:auto;display:flex}@container (width<26rem){.pk-spreadsheet-preview__average{display:none}}.pk-spreadsheet-preview__zoom{align-items:center;gap:var(--spacing-2);padding-right:var(--spacing-8);flex-shrink:0;display:flex}.pk-spreadsheet-preview__percent{min-width:var(--spacing-40);font-variant-numeric:tabular-nums;text-align:center}@media (prefers-color-scheme:dark){:where(:host,:root,.theme):not(.theme--light) .pk-spreadsheet-preview{--pk-spreadsheet-green-head:#5fbf8f}}:where(.theme.theme--dark) .pk-spreadsheet-preview{--pk-spreadsheet-green-head:#5fbf8f}@property --pk-spreadsheet-mark{syntax:\"<color>\";inherits:false;initial-value:#0000}@keyframes pk-spreadsheet-preview-marked{0%,30%{--pk-spreadsheet-mark:#facc1573}to{--pk-spreadsheet-mark:#facc1500}}"]]]);
689
+ // ../../packages/components/src/chat/PkWordPreviewRuns.vue?vue&type=script&setup=true&lang.ts
690
+ C(), p(), T();
691
+ var nt = ["src"], rt = {
692
+ key: 2,
693
+ class: "pk-word-preview__image",
694
+ "data-quote-skip": ""
695
+ }, Y = ["title"], X = ["title"], Z = ["data-quote-skip"], it = /* @__PURE__ */ O({
696
+ __name: "PkWordPreviewRuns",
697
+ props: {
698
+ runs: { type: Array },
699
+ mode: { type: String },
700
+ page: { type: null },
701
+ numbers: { type: Object }
702
+ },
703
+ setup(e) {
704
+ let n = e, { t: r } = ne({ useScope: "global" }), a = t(R, void 0), o = t(ce, void 0), s = (e) => e.picture ? se(a?.value, e.picture.ref) : void 0, c = (e) => e.chart ? o?.value?.[e.chart.ref] : void 0, l = (e) => n.page ? I(e) : "inline", d = (e) => l(e) === "page" ? {
705
+ ...e,
706
+ anchor: void 0
707
+ } : e, p = (e) => {
708
+ let t = {
709
+ width: `${e.width}pt`,
710
+ aspectRatio: `${e.width} / ${e.height}`
711
+ }, r = e.anchor, i = n.page;
712
+ if (!r || !i) return t;
713
+ let a = r.xFrom === "page" ? r.x - i.margins.left : r.x, o = I(e);
714
+ if (o === "around") {
715
+ let n = i.width - i.margins.left - i.margins.right, o = a + e.width / 2 < n / 2;
716
+ return {
717
+ ...t,
718
+ float: o ? "left" : "right",
719
+ marginTop: r.yFrom === "paragraph" && r.y > 0 ? `${r.y}pt` : void 0,
720
+ [o ? "marginRight" : "marginLeft"]: "9pt"
721
+ };
722
+ }
723
+ return o === "block" ? {
724
+ ...t,
725
+ display: "block",
726
+ marginLeft: `${Math.max(0, a)}pt`
727
+ } : {
728
+ ...t,
729
+ position: "absolute",
730
+ left: `${a}pt`,
731
+ top: `${r.y}pt`,
732
+ zIndex: r.wrap === "behind" ? -1 : 1
733
+ };
734
+ }, h = (e) => e.field && n.numbers ? String(n.numbers[e.field]) : e.text, g = x(() => {
735
+ let e = L(n.runs, n.mode ?? "markup"), t = (e) => {
736
+ let t = e.picture ?? (e.chart && d(e.chart));
737
+ return !!t && !!n.page && ["around", "block"].includes(I(t));
738
+ };
739
+ return [...e.filter(t), ...e.filter((e) => !t(e))];
740
+ }), _ = x(() => !n.mode || n.mode === "markup"), y = (e) => {
741
+ let t = {};
742
+ e.font && (t.fontFamily = oe(e.font)), t.fontSize = e.size ? `${e.size}pt` : "var(--pk-word-size)", e.color && (t.color = e.color), e.highlight && (t.backgroundColor = e.highlight), e.bold && (t.fontWeight = 700), e.italic && (t.fontStyle = "italic");
743
+ let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
744
+ return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
745
+ }, b = (e) => {
746
+ let t = y(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
747
+ return n.add(e.change === "deleted" ? "line-through" : "underline"), {
748
+ ...t,
749
+ textDecoration: [...n].join(" ")
750
+ };
751
+ }, S = (e) => e.author ? r("chatFilePreview.revisionBy", { author: e.author }) : void 0;
752
+ return (e, t) => (M(!0), j(v, null, m(g.value, (e, t) => (M(), j(v, { key: t }, [e.image ? (M(), j(v, { key: 0 }, [e.chart && c(e) ? (M(), j("span", {
753
+ key: 0,
754
+ class: i(["pk-word-preview__chart", `pk-word-preview__chart--${l(d(e.chart))}`]),
755
+ style: u(p(d(e.chart)))
756
+ }, [f(J, { preview: c(e) }, null, 8, ["preview"])], 6)) : e.picture && s(e) ? (M(), j(v, { key: 1 }, [l(e.picture) === "page" ? E("", !0) : (M(), j("img", {
757
+ key: 0,
758
+ class: i(["pk-word-preview__picture", `pk-word-preview__picture--${l(e.picture)}`]),
759
+ style: u(p(e.picture)),
760
+ src: s(e),
761
+ alt: ""
762
+ }, null, 14, nt))], 64)) : (M(), j("span", rt, w(k(r)("chatFilePreview.image")), 1))], 64)) : _.value && e.change === "deleted" ? (M(), j("del", {
763
+ key: 1,
764
+ class: "pk-word-preview__removed",
765
+ "data-quote-skip": "",
766
+ style: u(b(e)),
767
+ title: S(e)
768
+ }, w(h(e)), 13, Y)) : _.value && e.change === "inserted" ? (M(), j("ins", {
769
+ key: 2,
770
+ class: "pk-word-preview__added",
771
+ style: u(b(e)),
772
+ title: S(e)
773
+ }, w(h(e)), 13, X)) : (M(), j("span", {
774
+ key: 3,
775
+ style: u(y(e)),
776
+ "data-quote-skip": e.label ? "" : void 0
777
+ }, w(h(e)), 13, Z))], 64))), 128));
778
+ }
779
+ });
780
+ // ../../packages/components/src/chat/PkWordPreviewBlock.vue?vue&type=script&setup=true&lang.ts
781
+ C(), p();
782
+ var at = { key: 0 }, ot = ["data-paragraph", "colspan"], st = [
783
+ "data-paragraph",
784
+ "role",
785
+ "aria-level"
786
+ ], Q = { key: 1 }, ct = /* @__PURE__ */ O({
787
+ __name: "PkWordPreviewBlock",
788
+ props: {
789
+ block: { type: null },
790
+ row: { type: Number },
791
+ mode: { type: String },
792
+ page: { type: null },
793
+ numbers: { type: Object },
794
+ marked: { type: Set }
795
+ },
796
+ setup(e) {
797
+ let t = e, n = x(() => {
798
+ if (t.block.kind === "table") return {};
799
+ let e = t.block.style ?? {};
800
+ return {
801
+ textAlign: e.align,
802
+ paddingLeft: e.indentLeft ? `max(0pt, calc((${e.indentLeft}pt - var(--pk-word-indent-shared, 0pt)) * var(--pk-word-indent-scale, 1)))` : void 0,
803
+ paddingRight: e.indentRight ? `calc(${e.indentRight}pt * var(--pk-word-indent-scale, 1))` : void 0,
804
+ textIndent: e.firstLine ? `calc(${e.firstLine}pt * var(--pk-word-indent-scale, 1))` : void 0,
805
+ paddingTop: e.spaceBefore ? `${e.spaceBefore}pt` : void 0,
806
+ paddingBottom: e.spaceAfter ? `${e.spaceAfter}pt` : void 0,
807
+ lineHeight: e.lineExact ? `${e.lineExact}pt` : e.lineAtLeast ? `max(calc(var(--pk-word-line, 1.17) * max(1em, var(--pk-word-size, 1em))), ${e.lineAtLeast}pt)` : `calc(var(--pk-word-line, 1.17) * ${e.lineHeight ?? 1})`,
808
+ backgroundColor: e.shading,
809
+ fontSize: e.size ? `${e.size}pt` : void 0
810
+ };
811
+ }), r = x(() => {
812
+ if (t.block.kind === "table") return {};
813
+ let e = -(t.block.style?.firstLine ?? 0);
814
+ return e > 0 ? { minWidth: `calc(${e}pt * var(--pk-word-indent-scale, 1))` } : { paddingRight: "6pt" };
815
+ }), a = x(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), o = x(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), s = x(() => {
816
+ if (t.block.kind !== "table") return [];
817
+ let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
818
+ return n ? e.map((e) => `${e / n * 100}%`) : [];
819
+ }), c = x(() => t.block.kind !== "table" && !!t.block.id && !!t.marked?.has(t.block.id)), l = (e) => !!e?.some((e) => t.marked?.has(e)), d = x(() => t.mode === "markup" && !!o.value?.some((e) => e.runs.some((e) => e.change)));
820
+ return (t, p) => e.block.kind === "table" && o.value ? (M(), j("table", {
821
+ key: 0,
822
+ class: i(["pk-word-preview__table", {
823
+ "pk-word-preview__table--lines": e.block.borders,
824
+ "pk-word-preview__table--next": e.row !== 0,
825
+ "pk-word-preview__changed": d.value
826
+ }])
827
+ }, [s.value.length ? (M(), j("colgroup", at, [(M(!0), j(v, null, m(s.value, (e, t) => (M(), j("col", {
828
+ key: t,
829
+ style: u({ width: e })
830
+ }, null, 4))), 128))])) : E("", !0), y("tbody", null, [y("tr", null, [(M(!0), j(v, null, m(o.value, (t, n) => (M(), j("td", {
831
+ key: n,
832
+ "data-paragraph": t.ids?.join(" "),
833
+ class: i({ "pk-word-preview__marked": l(t.ids) }),
834
+ colspan: t.span,
835
+ style: u({
836
+ backgroundColor: t.fill,
837
+ textAlign: t.align,
838
+ fontSize: t.size ? `${t.size}pt` : void 0
839
+ })
840
+ }, [f(it, {
841
+ runs: t.runs,
842
+ mode: e.mode,
843
+ numbers: e.numbers
844
+ }, null, 8, [
845
+ "runs",
846
+ "mode",
847
+ "numbers"
848
+ ])], 14, ot))), 128))])])], 2)) : e.block.kind === "table" ? E("", !0) : (M(), j("div", {
849
+ key: 1,
850
+ class: i(["pk-word-preview__block", {
851
+ "pk-word-preview__changed": a.value,
852
+ "pk-word-preview__marked": c.value
853
+ }]),
854
+ "data-paragraph": e.block.id,
855
+ role: e.block.kind === "heading" ? "heading" : void 0,
856
+ "aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
857
+ style: u(n.value)
858
+ }, [
859
+ e.block.label ? (M(), j("span", {
860
+ key: 0,
861
+ class: "pk-word-preview__label",
862
+ "data-quote-skip": "",
863
+ style: u(r.value)
864
+ }, w(e.block.label), 5)) : E("", !0),
865
+ f(it, {
866
+ runs: e.block.runs,
867
+ mode: e.mode,
868
+ page: e.page,
869
+ numbers: e.numbers
870
+ }, null, 8, [
871
+ "runs",
872
+ "mode",
873
+ "page",
874
+ "numbers"
875
+ ]),
876
+ !e.block.label && !e.block.runs.length ? (M(), j("br", Q)) : E("", !0)
877
+ ], 14, st));
878
+ }
879
+ });
880
+ // ../../packages/components/src/chat/PkWordPreviewPart.vue?vue&type=script&setup=true&lang.ts
881
+ C(), p();
882
+ var lt = { class: "pk-word-preview__part" }, ut = ["src"], dt = /* @__PURE__ */ O({
883
+ __name: "PkWordPreviewPart",
884
+ props: {
885
+ blocks: { type: Array },
886
+ where: { type: String },
887
+ section: { type: null },
888
+ mode: { type: String },
889
+ numbers: { type: Object }
890
+ },
891
+ setup(e) {
892
+ let n = e, r = t(R, void 0), i = x(() => F(n.blocks, n.mode)), a = x(() => le(n.blocks, n.mode).flatMap((e) => {
893
+ let t = se(r?.value, e.ref);
894
+ return t ? [{
895
+ src: t,
896
+ css: ae(e, n.section.page)
897
+ }] : [];
898
+ })), o = x(() => {
899
+ let { margins: e } = n.section.page;
900
+ return {
901
+ left: `${e.left}pt`,
902
+ right: `${e.right}pt`,
903
+ ...n.where === "header" ? { top: `${n.section.headerDistance}pt` } : { bottom: `${n.section.footerDistance}pt` }
904
+ };
905
+ });
906
+ return (t, n) => (M(), j("div", lt, [y("div", {
907
+ class: "pk-word-preview__part-flow",
908
+ style: u(o.value)
909
+ }, [(M(!0), j(v, null, m(i.value, (t) => (M(), g(ct, {
910
+ key: t.key,
911
+ block: e.blocks[t.block],
912
+ row: t.row,
913
+ mode: e.mode,
914
+ page: e.section.page,
915
+ numbers: e.numbers
916
+ }, null, 8, [
917
+ "block",
918
+ "row",
919
+ "mode",
920
+ "page",
921
+ "numbers"
922
+ ]))), 128))], 4), (M(!0), j(v, null, m(a.value, (e, t) => (M(), j("img", {
923
+ key: t,
924
+ class: "pk-word-preview__float",
925
+ style: u(e.css),
926
+ src: e.src,
927
+ alt: ""
928
+ }, null, 12, ut))), 128))]));
929
+ }
930
+ });
931
+ // ../../packages/components/src/chat/PkWordPreview.vue?vue&type=script&setup=true&lang.ts
932
+ C(), T(), p();
933
+ var ft = ["aria-label"], pt = {
934
+ class: "pk-word-preview__tabs",
935
+ role: "tablist"
936
+ }, $ = ["aria-selected"], mt = ["aria-selected"], ht = {
937
+ key: 0,
938
+ class: "pk-word-preview__list"
939
+ }, gt = ["aria-current", "onClick"], _t = { class: "pk-word-preview__entry-text" }, vt = {
940
+ key: 0,
941
+ class: "u-dot"
942
+ }, yt = {
943
+ key: 0,
944
+ class: "pk-word-preview__none"
945
+ }, bt = {
946
+ key: 1,
947
+ class: "pk-word-preview__list"
948
+ }, xt = ["onClick"], St = {
949
+ key: 0,
950
+ class: "pk-word-preview__removed"
951
+ }, Ct = {
952
+ key: 1,
953
+ class: "pk-word-preview__added"
954
+ }, wt = { class: "pk-word-preview__main" }, Tt = ["aria-label"], Et = ["src"], Dt = {
955
+ key: 2,
956
+ class: "pk-word-preview__truncated"
957
+ }, Ot = { class: "pk-word-preview__status" }, kt = {
958
+ key: 0,
959
+ class: "pk-word-preview__count"
960
+ }, At = { class: "pk-word-preview__count" }, jt = {
961
+ key: 1,
962
+ class: "pk-word-preview__legend"
963
+ }, Mt = ["title"], Nt = { class: "pk-word-preview__removed" }, Pt = { class: "pk-word-preview__added" }, Ft = { class: "pk-word-preview__percent" }, It = ["data-part"], Lt = 96 / 72, Rt = .5, zt = /*#__PURE__*/ B(/* @__PURE__ */ O({
964
+ __name: "PkWordPreview",
965
+ props: /*@__PURE__*/ l({
966
+ preview: { type: null },
967
+ mode: { type: String },
968
+ marked: { type: Set }
969
+ }, {
970
+ fit: {
971
+ type: Boolean,
972
+ default: !0
973
+ },
974
+ fitModifiers: {},
975
+ zoom: { default: 1 },
976
+ zoomModifiers: {}
977
+ }),
978
+ emits: /*@__PURE__*/ l(["select"], ["update:fit", "update:zoom"]),
979
+ setup(e, { emit: t }) {
980
+ let r = e, l = t, { t: p } = ne({ useScope: "global" });
981
+ n(R, x(() => r.preview.images)), n(ce, x(() => r.preview.charts));
982
+ let _ = (e) => L(e, r.mode), S = x(() => F(r.preview.blocks, r.mode)), C = h("rootEl"), T = h("scrollEl"), ee = h("measureEl"), { width: te } = de(C), { width: D } = de(T), O = x(() => te.value >= 1e3), A = x(() => r.preview.sections?.length ? r.preview.sections : [{
983
+ page: r.preview.page,
984
+ headerDistance: 0,
985
+ footerDistance: 0,
986
+ headers: {},
987
+ footers: {}
988
+ }]), N = x(() => A.value[0].page), re = x(() => (D.value - 48) / (N.value.width * Lt)), P = x(() => te.value === 0 || D.value === 0 || re.value >= Rt), I = x(() => ({
989
+ fontFamily: oe(r.preview.defaults.font),
990
+ fontSize: `${r.preview.defaults.size}pt`,
991
+ color: r.preview.defaults.color ?? "#000000",
992
+ "--pk-word-line": ie(r.preview.defaults.font),
993
+ "--pk-word-size": `${r.preview.defaults.size}pt`
994
+ })), ue = x(() => N.value.width - N.value.margins.left - N.value.margins.right), fe = x(() => ({
995
+ ...I.value,
996
+ width: `${ue.value}pt`
997
+ })), z = h("flowEl"), { width: ge } = de(z), B = x(() => {
998
+ let e = /* @__PURE__ */ new Map(), t = 0;
999
+ for (let n of r.preview.blocks) {
1000
+ if (n.kind === "table") continue;
1001
+ let r = n.runs.reduce((e, t) => e + t.text.trim().length, 0);
1002
+ if (r) {
1003
+ let i = Math.max(0, n.style?.indentLeft ?? 0);
1004
+ e.set(i, (e.get(i) ?? 0) + r), t += r;
1005
+ }
1006
+ }
1007
+ let n = 0;
1008
+ for (let [r, i] of [...e].sort((e, t) => e[0] - t[0])) if (n += i, n > t / 10) return r;
1009
+ return 0;
1010
+ }), _e = x(() => ({
1011
+ ...I.value,
1012
+ "--pk-word-indent-shared": `${B.value}pt`,
1013
+ "--pk-word-indent-scale": ge.value ? Math.min(1, ge.value / (ue.value * Lt)) : 1
1014
+ })), V = b([]), ve = b({}), H = async () => {
1015
+ await a();
1016
+ let e = ee.value?.querySelectorAll("[data-item]");
1017
+ V.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
1018
+ let t = ee.value?.querySelectorAll("[data-part]");
1019
+ ve.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
1020
+ };
1021
+ d([
1022
+ S,
1023
+ P,
1024
+ () => r.preview.parts
1025
+ ], H, { flush: "post" }), c(() => {
1026
+ H(), document.fonts?.ready.then(H);
1027
+ });
1028
+ let U = x(() => {
1029
+ if (!P.value || V.value.length !== S.value.length) return [{
1030
+ items: S.value.map((e, t) => t),
1031
+ section: 0,
1032
+ number: 1,
1033
+ top: N.value.margins.top,
1034
+ bottom: N.value.margins.bottom
1035
+ }];
1036
+ let e = [], t = 0, n = !0, i = 0, a, o = () => {
1037
+ let r = A.value[t];
1038
+ return n && r.pageStart !== void 0 ? r.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
1039
+ }, s = (e) => {
1040
+ let i = A.value[t], a = (t) => n && i.titlePage ? t.first : r.preview.evenAndOddHeaders && e % 2 == 0 ? t.even : t.default, o = a(i.headers), s = a(i.footers), c = (e) => e ? (ve.value[e] ?? 0) / Lt : 0;
1041
+ return {
1042
+ header: o,
1043
+ footer: s,
1044
+ top: Math.max(i.page.margins.top, o ? i.headerDistance + c(o) : 0),
1045
+ bottom: Math.max(i.page.margins.bottom, s ? i.footerDistance + c(s) : 0)
1046
+ };
1047
+ }, c = () => {
1048
+ let r = o();
1049
+ a = void 0, e.push({
1050
+ items: [],
1051
+ section: t,
1052
+ number: r,
1053
+ ...s(r)
1054
+ }), n = !1, i = 0;
1055
+ };
1056
+ return S.value.forEach((r, l) => {
1057
+ r.section !== void 0 && r.section !== t && A.value[r.section] && (t = r.section, n = r.breakBefore || !e.length, n || (a = A.value[t].pageStart));
1058
+ let u = e[e.length - 1], d = u && A.value[u.section].page, f = d ? (d.height - u.top - u.bottom) * Lt : 0, p = V.value[l];
1059
+ for (let e = l; S.value[e]?.keepNext && e + 1 < S.value.length && !S.value[e + 1].breakBefore; e++) p += V.value[e + 1];
1060
+ (!u || u.items.length && (r.breakBefore || i + V.value[l] > f || i + p > f && p <= (() => {
1061
+ let e = s(o());
1062
+ return (A.value[t].page.height - e.top - e.bottom) * Lt;
1063
+ })())) && c(), e[e.length - 1].items.push(l), i += V.value[l];
1064
+ }), e.length || c(), e;
1065
+ }), W = x(() => {
1066
+ let e = /* @__PURE__ */ new Map();
1067
+ for (let t of U.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
1068
+ return U.value.map((t) => ({
1069
+ page: t.number,
1070
+ pages: U.value.length,
1071
+ sectionPages: e.get(t.section) ?? 1
1072
+ }));
1073
+ }), ye = (e) => {
1074
+ let t = A.value[e.section].page;
1075
+ return {
1076
+ ...I.value,
1077
+ width: `${t.width}pt`,
1078
+ minHeight: `${t.height}pt`,
1079
+ padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
1080
+ };
1081
+ }, G = (e) => {
1082
+ let t = [...new Set(e.items.map((e) => S.value[e].block))];
1083
+ return le(t.map((e) => r.preview.blocks[e]), r.mode).flatMap((t) => {
1084
+ let n = se(r.preview.images, t.ref);
1085
+ return n ? [{
1086
+ src: n,
1087
+ css: ae(t, A.value[e.section].page)
1088
+ }] : [];
1089
+ });
1090
+ }, K = s(e, "fit"), be = s(e, "zoom"), q = x(() => K.value ? Math.min(1.25, Math.max(.3, re.value)) : be.value), xe = (e) => {
1091
+ be.value = Math.min(2, Math.max(.3, Math.round((q.value + e) * 10) / 10)), K.value = !1;
1092
+ }, Se = b(0), Ce = b(), Te = () => {
1093
+ let e = T.value?.getBoundingClientRect();
1094
+ if (!e) return;
1095
+ let t = T.value?.querySelectorAll("[data-page]") ?? [], n = 0;
1096
+ for (let [r, i] of [...t].entries()) {
1097
+ if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
1098
+ n = r;
1099
+ }
1100
+ Se.value = n;
1101
+ let r;
1102
+ for (let t of J.value) {
1103
+ let n = T.value?.querySelector(`[data-key="${t.key}"]`);
1104
+ if (n) {
1105
+ if (n.getBoundingClientRect().top - e.top > 48) break;
1106
+ r = t.key;
1107
+ }
1108
+ }
1109
+ Ce.value = r ?? J.value[0]?.key;
1110
+ }, Ee = 0, De = () => {
1111
+ Ee ||= requestAnimationFrame(() => {
1112
+ Ee = 0, Te();
1113
+ });
1114
+ };
1115
+ o(() => cancelAnimationFrame(Ee)), d(U, () => a(De));
1116
+ let { selection: Oe } = me({
1117
+ root: () => T.value?.getRootNode(),
1118
+ touch: !0
1119
+ });
1120
+ d(Oe, (e) => {
1121
+ let t = T.value;
1122
+ l("select", e && t ? we(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
1123
+ });
1124
+ let ke = (e) => _(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), J = x(() => S.value.flatMap((e) => {
1125
+ let t = r.preview.blocks[e.block], n = t.kind === "heading" ? [t.label, ke(t.runs)].filter(Boolean).join(" ") : "";
1126
+ return t.kind === "heading" && t.level <= 3 && n ? [{
1127
+ key: e.key,
1128
+ level: t.level,
1129
+ text: n
1130
+ }] : [];
1131
+ })), Ae = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, je = x(() => S.value.flatMap((e) => {
1132
+ let t = r.preview.blocks[e.block], n = t.kind === "table" ? (t.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : t.runs, i = n.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), a = n.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
1133
+ return i || a ? [{
1134
+ key: e.key,
1135
+ removed: Ae(i),
1136
+ added: Ae(a)
1137
+ }] : [];
1138
+ })), Me;
1139
+ d([() => r.marked, U], ([e]) => {
1140
+ !e || e === Me || P.value && V.value.length !== S.value.length || he(T.value, ".pk-word-preview__marked") && (Me = e);
1141
+ }, {
1142
+ flush: "post",
1143
+ immediate: !0
1144
+ });
1145
+ let Ne = b("outline"), Pe = b(!1), Fe = (e) => {
1146
+ T.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
1147
+ block: "start",
1148
+ behavior: "smooth"
1149
+ }), O.value || (Pe.value = !1);
1150
+ }, Ie = x(() => r.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => ke(e.runs)) : [ke(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), Le = x(() => r.preview.revisionAuthors.join(", "));
1151
+ return (t, n) => {
1152
+ let r = pe;
1153
+ return M(), j("div", {
1154
+ ref_key: "rootEl",
1155
+ ref: C,
1156
+ class: i(["pk-word-preview", { "pk-word-preview--paged": P.value }])
1157
+ }, [
1158
+ (O.value || Pe.value) && (J.value.length || je.value.length) ? (M(), j("aside", {
1159
+ key: 0,
1160
+ class: i(["pk-word-preview__side", { "pk-word-preview__side--over": !O.value }]),
1161
+ "aria-label": k(p)("chatFilePreview.outline")
1162
+ }, [y("div", pt, [y("button", {
1163
+ type: "button",
1164
+ role: "tab",
1165
+ class: "pk-word-preview__tab",
1166
+ "aria-selected": Ne.value === "outline",
1167
+ onClick: n[0] ||= (e) => Ne.value = "outline"
1168
+ }, w(k(p)("chatFilePreview.outline")), 9, $), je.value.length ? (M(), j("button", {
1169
+ key: 0,
1170
+ type: "button",
1171
+ role: "tab",
1172
+ class: "pk-word-preview__tab",
1173
+ "aria-selected": Ne.value === "changes",
1174
+ onClick: n[1] ||= (e) => Ne.value = "changes"
1175
+ }, w(k(p)("chatFilePreview.changes", { count: je.value.length })), 9, mt)) : E("", !0)]), Ne.value === "outline" || !je.value.length ? (M(), j("nav", ht, [(M(!0), j(v, null, m(J.value, (e) => (M(), j("button", {
1176
+ key: e.key,
1177
+ type: "button",
1178
+ class: i(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
1179
+ "aria-current": Ce.value === e.key ? "location" : void 0,
1180
+ onClick: (t) => Fe(e.key)
1181
+ }, [y("span", _t, w(e.text), 1), je.value.some((t) => t.key === e.key) ? (M(), j("span", vt)) : E("", !0)], 10, gt))), 128)), J.value.length ? E("", !0) : (M(), j("p", yt, w(k(p)("chatFilePreview.noHeadings")), 1))])) : (M(), j("nav", bt, [(M(!0), j(v, null, m(je.value, (e) => (M(), j("button", {
1182
+ key: e.key,
1183
+ type: "button",
1184
+ class: "pk-word-preview__entry pk-word-preview__entry--change",
1185
+ onClick: (t) => Fe(e.key)
1186
+ }, [e.removed ? (M(), j("del", St, w(e.removed), 1)) : E("", !0), e.added ? (M(), j("ins", Ct, w(e.added), 1)) : E("", !0)], 8, xt))), 128))]))], 10, ft)) : E("", !0),
1187
+ y("div", wt, [y("div", {
1188
+ ref_key: "scrollEl",
1189
+ ref: T,
1190
+ class: "pk-word-preview__scroll",
1191
+ onScroll: De
1192
+ }, [P.value ? (M(), j("div", {
1193
+ key: 0,
1194
+ class: "pk-word-preview__pages",
1195
+ style: u({ zoom: q.value })
1196
+ }, [(M(!0), j(v, null, m(U.value, (t, n) => (M(), j("article", {
1197
+ key: n,
1198
+ "data-page": "",
1199
+ class: "pk-word-preview__page",
1200
+ "aria-label": k(p)("chatFilePreview.pageOf", {
1201
+ page: n + 1,
1202
+ count: U.value.length
1203
+ }),
1204
+ style: u(ye(t))
1205
+ }, [
1206
+ t.header && e.preview.parts?.[t.header] ? (M(), g(dt, {
1207
+ key: 0,
1208
+ blocks: e.preview.parts[t.header],
1209
+ where: "header",
1210
+ section: A.value[t.section],
1211
+ mode: e.mode,
1212
+ numbers: W.value[n]
1213
+ }, null, 8, [
1214
+ "blocks",
1215
+ "section",
1216
+ "mode",
1217
+ "numbers"
1218
+ ])) : E("", !0),
1219
+ (M(!0), j(v, null, m(t.items, (r) => (M(), g(ct, {
1220
+ key: S.value[r].key,
1221
+ "data-key": S.value[r].key,
1222
+ block: e.preview.blocks[S.value[r].block],
1223
+ row: S.value[r].row,
1224
+ mode: e.mode,
1225
+ page: A.value[t.section].page,
1226
+ numbers: W.value[n],
1227
+ marked: e.marked
1228
+ }, null, 8, [
1229
+ "data-key",
1230
+ "block",
1231
+ "row",
1232
+ "mode",
1233
+ "page",
1234
+ "numbers",
1235
+ "marked"
1236
+ ]))), 128)),
1237
+ (M(!0), j(v, null, m(G(t), (e, t) => (M(), j("img", {
1238
+ key: `image-${t}`,
1239
+ class: "pk-word-preview__float",
1240
+ style: u(e.css),
1241
+ src: e.src,
1242
+ alt: ""
1243
+ }, null, 12, Et))), 128)),
1244
+ t.footer && e.preview.parts?.[t.footer] ? (M(), g(dt, {
1245
+ key: 1,
1246
+ blocks: e.preview.parts[t.footer],
1247
+ where: "footer",
1248
+ section: A.value[t.section],
1249
+ mode: e.mode,
1250
+ numbers: W.value[n]
1251
+ }, null, 8, [
1252
+ "blocks",
1253
+ "section",
1254
+ "mode",
1255
+ "numbers"
1256
+ ])) : E("", !0)
1257
+ ], 12, Tt))), 128))], 4)) : (M(), j("article", {
1258
+ key: 1,
1259
+ ref_key: "flowEl",
1260
+ ref: z,
1261
+ class: "pk-word-preview__page pk-word-preview__page--flow",
1262
+ style: u(_e.value)
1263
+ }, [(M(!0), j(v, null, m(S.value, (t) => (M(), g(ct, {
1264
+ key: t.key,
1265
+ "data-key": t.key,
1266
+ block: e.preview.blocks[t.block],
1267
+ row: t.row,
1268
+ mode: e.mode,
1269
+ marked: e.marked
1270
+ }, null, 8, [
1271
+ "data-key",
1272
+ "block",
1273
+ "row",
1274
+ "mode",
1275
+ "marked"
1276
+ ]))), 128))], 4)), e.preview.truncated ? (M(), j("p", Dt, w(k(p)("chatFilePreview.truncated")), 1)) : E("", !0)], 544), y("div", Ot, [
1277
+ P.value ? (M(), j("span", kt, w(k(p)("chatFilePreview.pageOf", {
1278
+ page: Se.value + 1,
1279
+ count: U.value.length
1280
+ })), 1)) : E("", !0),
1281
+ y("span", At, w(k(p)("chatFilePreview.words", Ie.value)), 1),
1282
+ e.mode === "markup" && e.preview.revisionAuthors.length ? (M(), j("span", jt, [
1283
+ y("span", {
1284
+ class: "pk-word-preview__legend-text",
1285
+ title: k(p)("chatFilePreview.revisionsOf", { authors: Le.value })
1286
+ }, w(k(p)("chatFilePreview.revisionsOf", { authors: Le.value })), 9, Mt),
1287
+ y("del", Nt, w(k(p)("chatFilePreview.removed")), 1),
1288
+ y("ins", Pt, w(k(p)("chatFilePreview.added")), 1)
1289
+ ])) : E("", !0),
1290
+ n[6] ||= y("span", { class: "pk-word-preview__spacer" }, null, -1),
1291
+ !O.value && (J.value.length || je.value.length) ? (M(), g(r, {
1292
+ key: 2,
1293
+ class: "pk-word-preview__outline-toggle",
1294
+ modifiers: "action-quiet",
1295
+ icon: "ri:list-unordered",
1296
+ label: k(p)("chatFilePreview.outline"),
1297
+ title: k(p)("chatFilePreview.outline"),
1298
+ "aria-label": k(p)("chatFilePreview.outline"),
1299
+ "aria-expanded": Pe.value,
1300
+ onClick: n[2] ||= (e) => Pe.value = !Pe.value
1301
+ }, null, 8, [
1302
+ "label",
1303
+ "title",
1304
+ "aria-label",
1305
+ "aria-expanded"
1306
+ ])) : E("", !0),
1307
+ P.value ? (M(), j(v, { key: 3 }, [
1308
+ f(r, {
1309
+ class: "pk-word-preview__fit",
1310
+ modifiers: "action-quiet",
1311
+ icon: "ri:expand-width-line",
1312
+ label: k(p)("chatFilePreview.fitWidth"),
1313
+ title: k(p)("chatFilePreview.fitWidth"),
1314
+ "aria-label": k(p)("chatFilePreview.fitWidth"),
1315
+ disabled: K.value,
1316
+ onClick: n[3] ||= (e) => K.value = !0
1317
+ }, null, 8, [
1318
+ "label",
1319
+ "title",
1320
+ "aria-label",
1321
+ "disabled"
1322
+ ]),
1323
+ f(r, {
1324
+ modifiers: "action-quiet",
1325
+ icon: "ri:subtract-line",
1326
+ "aria-label": k(p)("chatFilePreview.zoomOut"),
1327
+ disabled: q.value <= .3,
1328
+ onClick: n[4] ||= (e) => xe(-.1)
1329
+ }, null, 8, ["aria-label", "disabled"]),
1330
+ y("span", Ft, w(Math.round(q.value * 100)) + "% ", 1),
1331
+ f(r, {
1332
+ modifiers: "action-quiet",
1333
+ icon: "ri:add-line",
1334
+ "aria-label": k(p)("chatFilePreview.zoomIn"),
1335
+ disabled: q.value >= 2,
1336
+ onClick: n[5] ||= (e) => xe(.1)
1337
+ }, null, 8, ["aria-label", "disabled"])
1338
+ ], 64)) : E("", !0)
1339
+ ])]),
1340
+ P.value ? (M(), j("div", {
1341
+ key: 1,
1342
+ ref_key: "measureEl",
1343
+ ref: ee,
1344
+ class: "pk-word-preview__measure",
1345
+ "aria-hidden": "true",
1346
+ style: u(fe.value)
1347
+ }, [(M(!0), j(v, null, m(S.value, (t) => (M(), j("div", {
1348
+ key: t.key,
1349
+ "data-item": ""
1350
+ }, [f(ct, {
1351
+ block: e.preview.blocks[t.block],
1352
+ row: t.row,
1353
+ mode: e.mode,
1354
+ page: N.value
1355
+ }, null, 8, [
1356
+ "block",
1357
+ "row",
1358
+ "mode",
1359
+ "page"
1360
+ ])]))), 128)), (M(!0), j(v, null, m(e.preview.parts, (t, n) => (M(), j("div", {
1361
+ key: n,
1362
+ "data-part": n
1363
+ }, [(M(!0), j(v, null, m(k(F)(t, e.mode), (n) => (M(), g(ct, {
1364
+ key: n.key,
1365
+ block: t[n.block],
1366
+ row: n.row,
1367
+ mode: e.mode,
1368
+ page: N.value
1369
+ }, null, 8, [
1370
+ "block",
1371
+ "row",
1372
+ "mode",
1373
+ "page"
1374
+ ]))), 128))], 8, It))), 128))], 4)) : E("", !0)
1375
+ ], 2);
1376
+ };
1377
+ }
1378
+ }), [["styles", [".pk-word-preview{flex:1;min-height:0;display:flex;position:relative}.pk-word-preview__side{gap:var(--spacing-12);width:16.5rem;padding:var(--spacing-12);box-sizing:border-box;border-right:var(--border) solid var(--color-surface-3);background-color:var(--color-surface);flex-direction:column;flex-shrink:0;display:flex;overflow-y:auto}.pk-word-preview__side--over{inset:0 auto var(--spacing-40) 0;z-index:3;box-shadow:var(--shadow-lg);position:absolute}.pk-word-preview__tabs{border-bottom:var(--border) solid var(--color-surface-3);display:flex}.pk-word-preview__tab{min-height:var(--spacing-40);color:var(--color-word-3);font:inherit;font-size:var(--text-14);cursor:pointer;background:0 0;border:0;flex:1}.pk-word-preview__tab[aria-selected=true]{box-shadow:inset 0 calc(var(--spacing-2) * -1) 0 var(--color-word-1);color:var(--color-word-1);font-weight:var(--font-semibold)}.pk-word-preview__list{border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded-lg);flex-direction:column;flex-shrink:0;display:flex;overflow:hidden}.pk-word-preview__entry{align-items:center;gap:var(--spacing-8);min-height:var(--spacing-40);padding:var(--spacing-8) var(--spacing-12);border:0;border-bottom:var(--border) solid var(--color-surface-2);color:var(--color-word-2);font:inherit;font-size:var(--text-14);text-align:start;cursor:pointer;transition:background-color var(--duration-150) var(--ease-out);background:0 0;display:flex}.pk-word-preview__entry:last-child{border-bottom:0}.pk-word-preview__entry:hover{background-color:var(--color-surface-1)}.pk-word-preview__entry[aria-current=location]{background-color:var(--color-surface-2);box-shadow:inset var(--spacing-3) 0 0 var(--color-word-2);color:var(--color-word-1);font-weight:var(--font-medium)}.pk-word-preview__entry--0{font-weight:var(--font-semibold)}.pk-word-preview__entry--2{padding-left:var(--spacing-24)}.pk-word-preview__entry--3{padding-left:var(--spacing-36)}.pk-word-preview__entry--change{gap:var(--spacing-4) var(--spacing-8);font-size:var(--text-12);flex-wrap:wrap}.pk-word-preview__entry-text{flex:1;min-width:0}.pk-word-preview__none{padding:var(--spacing-md);color:var(--color-word-3);font-size:var(--text-12);text-align:center;margin:0}.pk-word-preview__main{flex-direction:column;flex:1;min-width:0;display:flex}.pk-word-preview__scroll{min-height:0;padding:var(--spacing-md);background-color:var(--color-surface-2);flex:1;overflow:auto}.pk-word-preview__pages{align-items:center;gap:var(--spacing-24);flex-direction:column;width:max-content;min-width:100%;display:flex}.pk-word-preview__page{isolation:isolate;box-sizing:border-box;--lightningcss-light:initial;--lightningcss-dark: ;color-scheme:light;line-height:var(--pk-word-line,1.17);overflow-wrap:break-word;background-color:#fff;position:relative;overflow:hidden;box-shadow:0 1px 3px #140e3329,0 10px 28px #140e3314}.pk-word-preview__page--flow{width:100%;padding:var(--spacing-24) var(--spacing-20)}.pk-word-preview__measure{visibility:hidden;pointer-events:none;height:0;line-height:var(--pk-word-line,1.17);overflow-wrap:break-word;position:absolute;top:0;left:-100000px;overflow:hidden}.pk-word-preview__block{white-space:pre-wrap;margin:0;display:flow-root;position:relative}.pk-word-preview__picture{vertical-align:baseline;max-width:100%;height:auto}.pk-word-preview__picture--paragraph{max-width:none}.pk-word-preview__chart{text-indent:0;white-space:normal;vertical-align:bottom;max-width:100%;display:inline-block}.pk-word-preview__chart--paragraph{max-width:none}.pk-word-preview__float{max-width:none;position:absolute}.pk-word-preview__part{pointer-events:none;position:absolute;inset:0}.pk-word-preview__part-flow{pointer-events:auto;position:absolute}.pk-word-preview__label{text-indent:0;display:inline-block}.pk-word-preview__changed:before{content:\"\";background-color:#3f3c51;width:1.5pt;position:absolute;top:0;bottom:0;left:-14pt}.pk-word-preview__marked{isolation:isolate;position:relative}.pk-word-preview__marked:after{content:\"\";z-index:-1;pointer-events:none;animation:pk-word-preview-marked 3.5s var(--ease-out) forwards;background-color:#facc1566;position:absolute;inset:0}@media (prefers-reduced-motion:reduce){.pk-word-preview__marked:after{animation:none}}.pk-word-preview__table{border-collapse:collapse;table-layout:fixed;width:100%;margin:0;position:relative}.pk-word-preview__table td{vertical-align:top;white-space:pre-wrap;overflow-wrap:anywhere;padding:0 5.4pt}.pk-word-preview__table--lines td{border:.5pt solid #000}.pk-word-preview__table--lines.pk-word-preview__table--next td{border-top:0}.pk-word-preview__removed{color:var(--u-danger-text,#c42b3c);text-decoration:line-through}.pk-word-preview__added{color:var(--u-success-text,#178230);text-underline-offset:.2em;text-decoration:underline}.pk-word-preview__page .pk-word-preview__removed{color:#c42b3c}.pk-word-preview__page .pk-word-preview__added{color:#178230}.pk-word-preview__removed+.pk-word-preview__added{margin-inline-start:.15em}.pk-word-preview__image{padding:var(--spacing-2) var(--spacing-8);border:var(--border) dashed #c9c8d2;border-radius:var(--rounded);color:#6b6880;text-indent:0;font-size:9pt;display:inline-block}.pk-word-preview__truncated{margin:var(--spacing-md) 0 0;color:var(--color-word-3);font-size:var(--text-12);text-align:center}.pk-word-preview__status{align-items:center;gap:var(--spacing-16);min-height:var(--spacing-40);padding:0 var(--spacing-8) 0 var(--spacing-12);border-top:var(--border) solid var(--color-surface-3);background-color:var(--color-surface-1);color:var(--color-word-2);font-size:var(--text-12);white-space:nowrap;display:flex}.pk-word-preview__status>*{flex-shrink:0}.pk-word-preview__count{font-variant-numeric:tabular-nums}.pk-word-preview__status>.pk-word-preview__legend{gap:var(--spacing-8);flex-shrink:1;min-width:0;display:flex}.pk-word-preview__legend-text{text-overflow:ellipsis;min-width:0;overflow:hidden}.pk-word-preview__legend>.pk-word-preview__removed,.pk-word-preview__legend>.pk-word-preview__added{flex-shrink:0}.pk-word-preview__spacer{flex:1}@container (width<46rem){.pk-word-preview__status{gap:var(--spacing-12)}.pk-word-preview__outline-toggle .vv-button__label,.pk-word-preview__fit .vv-button__label{display:none}}.pk-word-preview__percent{min-width:var(--spacing-40);font-variant-numeric:tabular-nums;text-align:center}@keyframes pk-word-preview-marked{30%{opacity:1}to{opacity:0}}"]]]);
1379
+ // ../../packages/components/src/chat/PkFilePreview.vue?vue&type=script&setup=true&lang.ts
1380
+ C(), p(), T();
1381
+ var Bt = ["aria-label"], Vt = { class: "pk-file-preview__head" }, Ht = { class: "pk-file-preview__file" }, Ut = {
1382
+ class: "pk-file-preview__tile",
1383
+ "aria-hidden": "true"
1384
+ }, Wt = { class: "pk-file-preview__name" }, Gt = { class: "pk-file-preview__title" }, Kt = {
1385
+ class: "pk-file-preview__note",
1386
+ role: "status"
1387
+ }, qt = {
1388
+ key: 0,
1389
+ class: "pk-file-preview__progress",
1390
+ "aria-hidden": "true"
1391
+ }, Jt = {
1392
+ key: 1,
1393
+ class: "pk-file-preview__tools"
1394
+ }, Yt = ["aria-label"], Xt = { class: "pk-file-preview__version" }, Zt = { class: "pk-file-preview__mode-long" }, Qt = { class: "pk-file-preview__mode-short" }, $t = { class: "pk-file-preview__actions" }, en = { class: "pk-file-preview__body" }, tn = {
1395
+ key: 0,
1396
+ class: "pk-file-preview__skeleton vv-skeleton"
1397
+ }, nn = {
1398
+ key: 1,
1399
+ class: "pk-file-preview__empty"
1400
+ }, rn = /*@__PURE__*/ O({
1401
+ __name: "PkFilePreview",
1402
+ props: /*@__PURE__*/ l({
1403
+ kind: { type: String },
1404
+ filename: { type: String },
1405
+ version: { type: Number },
1406
+ versions: { type: Array },
1407
+ downloadUrl: { type: String },
1408
+ preview: { type: null },
1409
+ changes: { type: Object },
1410
+ loading: { type: Boolean },
1411
+ error: { type: Boolean },
1412
+ restorable: { type: Boolean },
1413
+ resize: { type: String },
1414
+ fileId: { type: String },
1415
+ storedFileName: { type: String },
1416
+ selectionActions: { type: null },
1417
+ working: { type: Boolean }
1418
+ }, {
1419
+ mode: { default: "markup" },
1420
+ modeModifiers: {},
1421
+ sheet: { default: 0 },
1422
+ sheetModifiers: {},
1423
+ zoom: { default: 1 },
1424
+ zoomModifiers: {},
1425
+ fit: {
1426
+ type: Boolean,
1427
+ default: !0
1428
+ },
1429
+ fitModifiers: {}
1430
+ }),
1431
+ emits: /*@__PURE__*/ l([
1432
+ "close",
1433
+ "version",
1434
+ "restore",
1435
+ "resize",
1436
+ "showChat",
1437
+ "selectionSend"
1438
+ ], [
1439
+ "update:mode",
1440
+ "update:sheet",
1441
+ "update:zoom",
1442
+ "update:fit"
1443
+ ]),
1444
+ setup(e, { emit: t }) {
1445
+ let n = e, r = t, { t: o, locale: c } = ne({ useScope: "global" }), l = b(!1), u;
1446
+ d(() => n.working, (e, t) => {
1447
+ e ? (u = t === void 0 ? void 0 : n.version, l.value = !1) : u !== void 0 && (l.value = n.version === u, u = void 0);
1448
+ }, { immediate: !0 }), d(() => [n.version, n.fileId], () => {
1449
+ n.working || (l.value = !1);
1450
+ });
1451
+ let p = x(() => n.versions ?? []), _ = x(() => n.version ? p.value.indexOf(n.version) : -1), S = x(() => _.value > 0 ? p.value[_.value - 1] : void 0), C = x(() => _.value >= 0 && _.value < p.value.length - 1 ? p.value[_.value + 1] : void 0), T = s(e, "mode"), ee = s(e, "sheet"), O = s(e, "zoom"), N = s(e, "fit"), re = x(() => [
1452
+ {
1453
+ value: "markup",
1454
+ label: o("chatFilePreview.modeMarkup")
1455
+ },
1456
+ {
1457
+ value: "accepted",
1458
+ label: o("chatFilePreview.modeAccepted")
1459
+ },
1460
+ {
1461
+ value: "original",
1462
+ label: o("chatFilePreview.modeOriginal")
1463
+ }
1464
+ ]), P = x(() => n.preview?.kind === "word" && n.preview.revisionAuthors.length > 0);
1465
+ d(() => n.version, () => {
1466
+ T.value = "markup";
1467
+ });
1468
+ let ie = h("rootEl"), F = D(), I = b(!1), ae = () => {
1469
+ F.value = void 0, I.value = !1;
1470
+ };
1471
+ d(() => [
1472
+ n.version,
1473
+ n.preview,
1474
+ T.value,
1475
+ ee.value
1476
+ ], ae);
1477
+ let oe = (e) => {
1478
+ I.value || (F.value = e);
1479
+ }, L = x(() => F.value?.format === "docx" && z());
1480
+ d(I, async (e, t) => {
1481
+ let n = F.value;
1482
+ t && !e && n?.format === "docx" && (await a(), n.restore());
1483
+ });
1484
+ let se = x(() => !n.version || n.version === p.value[p.value.length - 1]), ce = () => {
1485
+ let e = p.value[p.value.length - 1];
1486
+ e && r("version", e);
1487
+ }, le = x(() => {
1488
+ let e = F.value;
1489
+ return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > V;
1490
+ }), R = x(() => F.value?.format === "docx" && T.value === "original"), de = x(() => le.value || R.value), me = x(() => R.value ? o("selectionActions.hintOriginal") : le.value ? o(F.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: F.value?.format === "docx" ? 200 : V }) : void 0), he = (e) => e[c.value] ?? e[c.value.split("-")[0]] ?? Object.values(e)[0] ?? "", B = ["explain", "summarize"], ve = x(() => {
1491
+ let e = F.value, t = n.selectionActions;
1492
+ if (!e || !t) return [];
1493
+ let r = e.format;
1494
+ return [...(r === "docx" && de.value ? B : t.builtIns).map((e) => ({
1495
+ id: e,
1496
+ label: o(`selectionActions.builtIn.${e}`),
1497
+ ...e === "translate" && { asks: o("selectionActions.translateAsks") },
1498
+ prompt: (t) => o(`selectionActions.prompt.${r}.${e}`, { language: t ?? "" })
1499
+ })), ...(de.value ? [] : t.actions).map((e) => ({
1500
+ id: e.id,
1501
+ label: he(e.label),
1502
+ icon: e.icon,
1503
+ prompt: () => he(e.prompt)
1504
+ }))];
1505
+ }), H = (e) => {
1506
+ if (e.format === "docx") return o("selectionActions.labelParagraphs", {
1507
+ file: n.filename,
1508
+ count: e.paragraphCount
1509
+ }, e.paragraphCount);
1510
+ let [t, r] = e.range.split(":");
1511
+ return r ? o("selectionActions.labelCells", {
1512
+ file: n.filename,
1513
+ sheet: e.sheet,
1514
+ from: t,
1515
+ to: r
1516
+ }) : o("selectionActions.labelCell", {
1517
+ file: n.filename,
1518
+ sheet: e.sheet,
1519
+ cell: t
1520
+ });
1521
+ }, U = (e) => {
1522
+ if (!n.fileId || !n.storedFileName) return;
1523
+ let t = {
1524
+ fileId: n.fileId,
1525
+ version: n.version ?? 1,
1526
+ storedFileName: n.storedFileName,
1527
+ label: H(e).slice(0, 200)
1528
+ };
1529
+ if (e.format === "docx") {
1530
+ let { measure: n, ...r } = e;
1531
+ return {
1532
+ ...t,
1533
+ ...r,
1534
+ ...R.value && { original: !0 }
1535
+ };
1536
+ }
1537
+ let { measure: r, cells: i, ...a } = e;
1538
+ return {
1539
+ ...t,
1540
+ ...a
1541
+ };
1542
+ }, W = (e, t) => {
1543
+ let n = F.value, i = n && U(n);
1544
+ i && (r("selectionSend", e, i, {
1545
+ id: t,
1546
+ size: n.format === "docx" ? n.paragraphCount : n.cells
1547
+ }), ae(), document.getSelection()?.removeAllRanges());
1548
+ }, ye = (e, t) => {
1549
+ let n = ve.value.find((t) => t.id === e);
1550
+ n && W(n.prompt(t), e);
1551
+ }, G = b(0);
1552
+ ue(ie, "scroll", () => G.value++, {
1553
+ capture: !0,
1554
+ passive: !0
1555
+ }), ue(window, "resize", () => G.value++, { passive: !0 });
1556
+ let K = x(() => {
1557
+ G.value;
1558
+ let e = F.value?.measure(), t = ie.value?.getBoundingClientRect();
1559
+ if (e && t) return {
1560
+ start: {
1561
+ top: e.start.top - t.top,
1562
+ left: e.start.left - t.left
1563
+ },
1564
+ bottom: e.bottom - t.top,
1565
+ bounds: {
1566
+ top: 0,
1567
+ left: 0,
1568
+ width: t.width,
1569
+ height: t.height
1570
+ }
1571
+ };
1572
+ });
1573
+ return (t, n) => {
1574
+ let a = fe, s = pe;
1575
+ return M(), j("section", {
1576
+ ref_key: "rootEl",
1577
+ ref: ie,
1578
+ class: "pk-file-preview",
1579
+ "aria-label": e.filename,
1580
+ tabindex: "-1",
1581
+ autofocus: ""
1582
+ }, [
1583
+ y("header", Vt, [
1584
+ y("div", Ht, [y("span", Ut, [f(a, {
1585
+ name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
1586
+ class: i(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
1587
+ }, null, 8, ["name", "class"])]), y("div", Wt, [y("strong", Gt, w(e.filename), 1), y("span", Kt, [e.working ? (M(), j(v, { key: 0 }, [n[14] ||= y("span", {
1588
+ class: "pk-file-preview__spinner",
1589
+ "aria-hidden": "true"
1590
+ }, null, -1), A(" " + w(k(o)("chatFilePreview.working")), 1)], 64)) : l.value ? (M(), j(v, { key: 1 }, [A(w(k(o)("chatFilePreview.answeredInChat")) + " ", 1), f(s, {
1591
+ modifiers: "link",
1592
+ class: "pk-file-preview__show-chat",
1593
+ label: k(o)("chatFilePreview.showChat"),
1594
+ onClick: n[0] ||= (e) => r("showChat")
1595
+ }, null, 8, ["label"])], 64)) : (M(), j(v, { key: 2 }, [A(w(k(o)("chatFilePreview.readOnly")), 1)], 64))])])]),
1596
+ e.working ? (M(), j("div", qt)) : E("", !0),
1597
+ e.version && p.value.length > 1 || P.value ? (M(), j("div", Jt, [e.version && p.value.length > 1 ? (M(), j("nav", {
1598
+ key: 0,
1599
+ class: "pk-file-preview__versions",
1600
+ "aria-label": k(o)("chatFilePreview.versions")
1601
+ }, [
1602
+ f(s, {
1603
+ modifiers: "action-quiet",
1604
+ icon: "ri:arrow-left-s-line",
1605
+ "aria-label": k(o)("chatFilePreview.previousVersion"),
1606
+ disabled: !S.value,
1607
+ onClick: n[1] ||= (e) => S.value && r("version", S.value)
1608
+ }, null, 8, ["aria-label", "disabled"]),
1609
+ y("span", Xt, w(k(o)("chatFilePreview.versionOf", {
1610
+ version: e.version,
1611
+ count: p.value.length
1612
+ })), 1),
1613
+ f(s, {
1614
+ modifiers: "action-quiet",
1615
+ icon: "ri:arrow-right-s-line",
1616
+ "aria-label": k(o)("chatFilePreview.nextVersion"),
1617
+ disabled: !C.value,
1618
+ onClick: n[2] ||= (e) => C.value && r("version", C.value)
1619
+ }, null, 8, ["aria-label", "disabled"])
1620
+ ], 8, Yt)) : E("", !0), P.value ? (M(), g(_e, {
1621
+ key: 1,
1622
+ modelValue: T.value,
1623
+ "onUpdate:modelValue": n[3] ||= (e) => T.value = e,
1624
+ name: "revisions",
1625
+ segmented: "",
1626
+ class: "pk-file-preview__modes u-segmented-fit mb-0",
1627
+ "aria-label": k(o)("chatFilePreview.modes"),
1628
+ options: re.value
1629
+ }, {
1630
+ markup: te(() => [y("span", Zt, w(k(o)("chatFilePreview.modeMarkup")), 1), y("span", Qt, w(k(o)("chatFilePreview.modeMarkupShort")), 1)]),
1631
+ _: 1
1632
+ }, 8, [
1633
+ "modelValue",
1634
+ "aria-label",
1635
+ "options"
1636
+ ])) : E("", !0)])) : E("", !0),
1637
+ y("div", $t, [
1638
+ e.restorable ? (M(), g(s, {
1639
+ key: 0,
1640
+ modifiers: "action-quiet",
1641
+ icon: "ri:arrow-go-back-line",
1642
+ label: k(o)("chatFilePreview.restore"),
1643
+ onClick: n[4] ||= (e) => r("restore")
1644
+ }, null, 8, ["label"])) : E("", !0),
1645
+ f(s, {
1646
+ href: e.downloadUrl,
1647
+ download: "",
1648
+ modifiers: "action-quiet",
1649
+ icon: "ri:download-line",
1650
+ title: k(o)("chatFilePreview.download"),
1651
+ "aria-label": k(o)("chatFilePreview.download")
1652
+ }, null, 8, [
1653
+ "href",
1654
+ "title",
1655
+ "aria-label"
1656
+ ]),
1657
+ e.resize === "expand" ? (M(), g(s, {
1658
+ key: 1,
1659
+ modifiers: "action-quiet",
1660
+ icon: "ri:fullscreen-line",
1661
+ title: k(o)("chatFilePreview.expand"),
1662
+ "aria-label": k(o)("chatFilePreview.expand"),
1663
+ onClick: n[5] ||= (e) => r("resize")
1664
+ }, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (M(), g(s, {
1665
+ key: 2,
1666
+ modifiers: "action-quiet",
1667
+ icon: "ri:fullscreen-exit-line",
1668
+ title: k(o)("chatFilePreview.shrink"),
1669
+ "aria-label": k(o)("chatFilePreview.shrink"),
1670
+ onClick: n[6] ||= (e) => r("resize")
1671
+ }, null, 8, ["title", "aria-label"])) : E("", !0),
1672
+ f(s, {
1673
+ modifiers: "action-quiet",
1674
+ icon: "ri:close-line",
1675
+ title: k(o)("chatFilePreview.close"),
1676
+ "aria-label": k(o)("chatFilePreview.close"),
1677
+ onClick: n[7] ||= (e) => r("close")
1678
+ }, null, 8, ["title", "aria-label"])
1679
+ ])
1680
+ ]),
1681
+ y("div", en, [e.loading ? (M(), j("div", tn, [(M(), j(v, null, m(8, (e) => y("div", {
1682
+ key: e,
1683
+ class: i(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
1684
+ }, null, 2)), 64))])) : e.error || !e.preview ? (M(), j("p", nn, w(k(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (M(), g(zt, {
1685
+ key: 2,
1686
+ zoom: O.value,
1687
+ "onUpdate:zoom": n[8] ||= (e) => O.value = e,
1688
+ fit: N.value,
1689
+ "onUpdate:fit": n[9] ||= (e) => N.value = e,
1690
+ preview: e.preview,
1691
+ mode: P.value ? T.value : "markup",
1692
+ marked: e.changes?.kind === "word" ? e.changes.paragraphs : void 0,
1693
+ onSelect: oe
1694
+ }, null, 8, [
1695
+ "zoom",
1696
+ "fit",
1697
+ "preview",
1698
+ "mode",
1699
+ "marked"
1700
+ ])) : (M(), g(tt, {
1701
+ key: 3,
1702
+ sheet: ee.value,
1703
+ "onUpdate:sheet": n[10] ||= (e) => ee.value = e,
1704
+ zoom: O.value,
1705
+ "onUpdate:zoom": n[11] ||= (e) => O.value = e,
1706
+ preview: e.preview,
1707
+ marked: e.changes?.kind === "spreadsheet" ? e.changes.cells : void 0,
1708
+ onSelect: oe
1709
+ }, null, 8, [
1710
+ "sheet",
1711
+ "zoom",
1712
+ "preview",
1713
+ "marked"
1714
+ ]))]),
1715
+ e.selectionActions && F.value && K.value ? (M(), g(ge, {
1716
+ key: 0,
1717
+ asking: I.value,
1718
+ "onUpdate:asking": n[12] ||= (e) => I.value = e,
1719
+ strategy: "absolute",
1720
+ anchor: K.value,
1721
+ actions: ve.value,
1722
+ hint: me.value,
1723
+ touch: L.value,
1724
+ note: se.value ? void 0 : k(o)("selectionActions.notLatest", { version: e.version }),
1725
+ "note-action": k(o)("selectionActions.openLatest"),
1726
+ onAction: ye,
1727
+ onAsk: n[13] ||= (e) => W(e, "ask"),
1728
+ onNote: ce,
1729
+ onClose: ae
1730
+ }, null, 8, [
1731
+ "asking",
1732
+ "anchor",
1733
+ "actions",
1734
+ "hint",
1735
+ "touch",
1736
+ "note",
1737
+ "note-action"
1738
+ ])) : E("", !0)
1739
+ ], 8, Bt);
1740
+ };
1741
+ }
1742
+ }), an = ".pk-file-preview{background-color:var(--color-surface);height:100%;min-height:0;color:var(--color-word-1);outline:none;flex-direction:column;display:flex;position:relative;container-type:inline-size}.pk-file-preview__head{align-items:center;gap:var(--spacing-8) var(--spacing-12);padding:var(--spacing-12) var(--spacing-12) var(--spacing-12) var(--spacing-md);border-bottom:var(--border) solid var(--color-surface-3);flex-wrap:wrap;display:flex;position:relative}.pk-file-preview__file{align-items:center;gap:var(--spacing-12);flex:12rem;min-width:0;display:flex}.pk-file-preview__tile{width:var(--spacing-32);height:var(--spacing-32);border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded);flex-shrink:0;justify-content:center;align-items:center;display:flex}.pk-file-preview__tile .vv-icon{width:var(--spacing-18);height:var(--spacing-18)}.pk-file-preview__icon--word{color:#2b7de9}.pk-file-preview__icon--sheet{color:#1f9d57}.pk-file-preview__name{flex-direction:column;min-width:0;display:flex}.pk-file-preview__title{font-size:var(--text-14);text-overflow:ellipsis;white-space:nowrap;overflow:hidden}.pk-file-preview__note{align-items:center;gap:var(--spacing-6);color:var(--color-word-3);font-size:var(--text-12);display:flex}.pk-file-preview__spinner{width:var(--spacing-12);height:var(--spacing-12);border:var(--spacing-2) solid var(--color-surface-4);border-top-color:var(--color-word-2);border-radius:50%;flex-shrink:0;animation:.8s linear infinite pk-file-preview-spin}.pk-file-preview__progress{right:0;bottom:calc(-1 * var(--border));height:var(--spacing-2);position:absolute;left:0;overflow:hidden}.pk-file-preview__progress:before{content:\"\";background-color:var(--color-word-3);width:30%;animation:1.4s ease-in-out infinite pk-file-preview-progress;position:absolute;top:0;bottom:0}@media (prefers-reduced-motion:reduce){.pk-file-preview__spinner,.pk-file-preview__progress:before{animation:none}}@keyframes pk-file-preview-spin{to{rotate:360deg}}@keyframes pk-file-preview-progress{0%{left:-30%}to{left:100%}}.pk-file-preview__show-chat{font-size:var(--text-12)}.pk-file-preview__tools{align-items:center;gap:var(--spacing-8) var(--spacing-12);flex-wrap:wrap;display:flex}.pk-file-preview__versions{align-items:center;gap:var(--spacing-2);display:flex}.pk-file-preview__version{font-size:var(--text-14);font-weight:var(--font-semibold);font-variant-numeric:tabular-nums;white-space:nowrap}.pk-file-preview__actions{align-items:center;gap:var(--spacing-8);margin-left:auto;display:flex}@container (width<52rem){.pk-file-preview__file{order:1}.pk-file-preview__actions{order:2}.pk-file-preview__tools{flex-basis:100%;order:3}.pk-file-preview__tools .pk-file-preview__modes{flex:auto}}.pk-file-preview__mode-short{display:none}@container (width<38rem){.pk-file-preview__mode-long{display:none}.pk-file-preview__mode-short{display:inline}}@container (width<30rem){.pk-file-preview__tools .pk-file-preview__modes{flex:100%}.pk-file-preview__tools .pk-file-preview__modes .vv-radio{padding-inline:var(--spacing-4)}}.pk-file-preview__body{background-color:var(--color-surface-1);flex-direction:column;flex:1;min-height:0;display:flex}.pk-file-preview__skeleton{width:min(42rem, 100% - 2 * var(--spacing-md));margin:var(--spacing-md) auto;padding:var(--spacing-lg);box-sizing:border-box;border:var(--border) solid var(--color-surface-3);border-radius:var(--rounded);background-color:var(--color-surface)}.pk-file-preview__skeleton-line{height:var(--spacing-12);margin-bottom:var(--spacing-12);border-radius:var(--rounded)}.pk-file-preview__empty{margin:var(--spacing-lg) var(--spacing-md);color:var(--color-word-3);font-size:var(--text-14);text-align:center}", on = /* @__PURE__ */ e({ default: () => sn }), sn = /*#__PURE__*/ B(rn, [["styles", [an]]]);
1743
+ export { on as n, sn as t };
1744
+
1745
+ //# sourceMappingURL=PkFilePreview-yjdtArag.js.map