@8wave/ai-elements 0.123.0-beta.16 → 0.123.0-beta.18

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 (95) hide show
  1. package/dist/_chunks/PkFilePreview-DXmgMwwu.js +1143 -0
  2. package/dist/_chunks/PkFilePreview-DXmgMwwu.js.map +1 -0
  3. package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js → PkFilePreviewDialog-Bzt534GA.js} +2 -2
  4. package/dist/_chunks/{PkFilePreviewDialog-nibxELSF.js.map → PkFilePreviewDialog-Bzt534GA.js.map} +1 -1
  5. package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js → PkStreamingMarkdown-PQ3X83Fq.js} +2 -2
  6. package/dist/_chunks/{PkStreamingMarkdown-C6cFkf82.js.map → PkStreamingMarkdown-PQ3X83Fq.js.map} +1 -1
  7. package/dist/_chunks/{PkToolChatFile-5t_1vL81.js → PkToolChatFile-CYxqugvO.js} +2 -2
  8. package/dist/_chunks/{PkToolChatFile-5t_1vL81.js.map → PkToolChatFile-CYxqugvO.js.map} +1 -1
  9. package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js → PkToolShowArtifact-BIpD-GkV.js} +2 -2
  10. package/dist/_chunks/{PkToolShowArtifact-DV78g_yD.js.map → PkToolShowArtifact-BIpD-GkV.js.map} +1 -1
  11. package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js → PkToolShowContactForm-2_YDqjeM.js} +2 -2
  12. package/dist/_chunks/{PkToolShowContactForm-Bnjy0g50.js.map → PkToolShowContactForm-2_YDqjeM.js.map} +1 -1
  13. package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js → PkToolShowForm-Bu4igmQL.js} +5 -5
  14. package/dist/_chunks/{PkToolShowForm-CT5_ln9b.js.map → PkToolShowForm-Bu4igmQL.js.map} +1 -1
  15. package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js → PkToolShowSources-DKtdU_Bq.js} +2 -2
  16. package/dist/_chunks/{PkToolShowSources-DhZ5I_J-.js.map → PkToolShowSources-DKtdU_Bq.js.map} +1 -1
  17. package/dist/_chunks/{utils-B5VcWm3g.js → utils-Bz1Gb3iO.js} +114 -77
  18. package/dist/_chunks/utils-Bz1Gb3iO.js.map +1 -0
  19. package/dist/ai-elements.es.js +252 -252
  20. package/dist/ai-elements.es.js.map +1 -1
  21. package/dist-vue/PkChatbot.js +1 -1
  22. package/dist-vue/PkChatbotEmptyState.js +1 -1
  23. package/dist-vue/PkChatbotInput.js +1 -1
  24. package/dist-vue/PkChatbotMessages.js +1 -1
  25. package/dist-vue/PkChatbotStepPayload.js +1 -1
  26. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  27. package/dist-vue/PkChatbotSteps.js +1 -1
  28. package/dist-vue/PkChatbotViewChat.js +1 -1
  29. package/dist-vue/PkChatbotViewConversations.js +1 -1
  30. package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js → PkChatbot-MEYD0XUR.js} +5 -5
  31. package/dist-vue/_chunks/{PkChatbot-tq-fJUij.js.map → PkChatbot-MEYD0XUR.js.map} +1 -1
  32. package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js → PkChatbotEmptyState-qKpfIuvI.js} +2 -2
  33. package/dist-vue/_chunks/{PkChatbotEmptyState-Dp0_UPJm.js.map → PkChatbotEmptyState-qKpfIuvI.js.map} +1 -1
  34. package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js → PkChatbotInput-DSH5IrO6.js} +2 -2
  35. package/dist-vue/_chunks/{PkChatbotInput-B_kPnNNB.js.map → PkChatbotInput-DSH5IrO6.js.map} +1 -1
  36. package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js → PkChatbotMessages-BcHNPZUB.js} +327 -327
  37. package/dist-vue/_chunks/{PkChatbotMessages-BTZOic9V.js.map → PkChatbotMessages-BcHNPZUB.js.map} +1 -1
  38. package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js → PkChatbotStepPayload-BT-Xg18D.js} +2 -2
  39. package/dist-vue/_chunks/{PkChatbotStepPayload-CoGCHBhJ.js.map → PkChatbotStepPayload-BT-Xg18D.js.map} +1 -1
  40. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js → PkChatbotStepToolDetail-Cs322RDk.js} +16 -16
  41. package/dist-vue/_chunks/{PkChatbotStepToolDetail-BJtIZBF0.js.map → PkChatbotStepToolDetail-Cs322RDk.js.map} +1 -1
  42. package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js → PkChatbotSteps-Dd62GEXJ.js} +23 -23
  43. package/dist-vue/_chunks/{PkChatbotSteps-CEJNclG4.js.map → PkChatbotSteps-Dd62GEXJ.js.map} +1 -1
  44. package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js → PkChatbotViewChat-CfpGWukX.js} +9 -9
  45. package/dist-vue/_chunks/{PkChatbotViewChat-CnEOSH32.js.map → PkChatbotViewChat-CfpGWukX.js.map} +1 -1
  46. package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js → PkChatbotViewConversations-JCrQIoGf.js} +2 -2
  47. package/dist-vue/_chunks/{PkChatbotViewConversations-D7j5P1RO.js.map → PkChatbotViewConversations-JCrQIoGf.js.map} +1 -1
  48. package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js +1126 -0
  49. package/dist-vue/_chunks/PkFilePreview-CFqcO3vY.js.map +1 -0
  50. package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js → PkFilePreviewDialog-DeNnbXWq.js} +2 -2
  51. package/dist-vue/_chunks/{PkFilePreviewDialog-Cic7gmVR.js.map → PkFilePreviewDialog-DeNnbXWq.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js → PkStreamingMarkdown-QDsT-4jC.js} +2 -2
  53. package/dist-vue/_chunks/{PkStreamingMarkdown-CYlCIfA0.js.map → PkStreamingMarkdown-QDsT-4jC.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js → PkToolChatFile-UZeUytvT.js} +2 -2
  55. package/dist-vue/_chunks/{PkToolChatFile-B_PeJef8.js.map → PkToolChatFile-UZeUytvT.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js → PkToolShowArtifact-ldnH-U3h.js} +2 -2
  57. package/dist-vue/_chunks/{PkToolShowArtifact-Bh-jIo0V.js.map → PkToolShowArtifact-ldnH-U3h.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js → PkToolShowContactForm-4hISKYqb.js} +2 -2
  59. package/dist-vue/_chunks/{PkToolShowContactForm-BjfRuNuj.js.map → PkToolShowContactForm-4hISKYqb.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js → PkToolShowDiagram-uHFCQ0FJ.js} +2 -2
  61. package/dist-vue/_chunks/{PkToolShowDiagram-_NnrFDGT.js.map → PkToolShowDiagram-uHFCQ0FJ.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js → PkToolShowForm-DiUz5_Ct.js} +5 -5
  63. package/dist-vue/_chunks/{PkToolShowForm-AqEY4_do.js.map → PkToolShowForm-DiUz5_Ct.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js → PkToolShowImageGallery-CEzeXupr.js} +2 -2
  65. package/dist-vue/_chunks/{PkToolShowImageGallery-DM5AJNZ3.js.map → PkToolShowImageGallery-CEzeXupr.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js → PkToolShowProductList-h4Dqvk1V.js} +2 -2
  67. package/dist-vue/_chunks/{PkToolShowProductList-CAV8be9a.js.map → PkToolShowProductList-h4Dqvk1V.js.map} +1 -1
  68. package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js → PkToolShowSources-BJd4zYAY.js} +2 -2
  69. package/dist-vue/_chunks/{PkToolShowSources-CriswKr_.js.map → PkToolShowSources-BJd4zYAY.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js → PkToolShowVideo-DgkpZriW.js} +2 -2
  71. package/dist-vue/_chunks/{PkToolShowVideo-FSWM5MOl.js.map → PkToolShowVideo-DgkpZriW.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js → PkToolShowWebPages-DQr3SEGC.js} +2 -2
  73. package/dist-vue/_chunks/{PkToolShowWebPages-CPhm2ba3.js.map → PkToolShowWebPages-DQr3SEGC.js.map} +1 -1
  74. package/dist-vue/_chunks/{utils-BgvjC1Pu.js → utils-DmBnucJs.js} +129 -92
  75. package/dist-vue/_chunks/utils-DmBnucJs.js.map +1 -0
  76. package/dist-vue/composables.js +1 -1
  77. package/dist-vue/composables.js.map +1 -1
  78. package/dist-vue/index.js +32 -32
  79. package/dist-vue/index.js.map +1 -1
  80. package/dist-vue/packages/components/src/chat/PkWordPreview.d.ts +3 -1
  81. package/dist-vue/packages/components/src/chat/PkWordPreviewBlock.d.ts +9 -3
  82. package/dist-vue/packages/components/src/chat/PkWordPreviewPart.d.ts +20 -0
  83. package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +12 -3
  84. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +420 -0
  85. package/dist-vue/packages/components/src/chat/utils.d.ts +49 -1
  86. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +339 -0
  87. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +571 -0
  88. package/dist-vue/style.css +1 -1
  89. package/package.json +1 -1
  90. package/dist/_chunks/PkFilePreview-Bcdfci6i.js +0 -948
  91. package/dist/_chunks/PkFilePreview-Bcdfci6i.js.map +0 -1
  92. package/dist/_chunks/utils-B5VcWm3g.js.map +0 -1
  93. package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js +0 -934
  94. package/dist-vue/_chunks/PkFilePreview-BKwnNsyV.js.map +0 -1
  95. package/dist-vue/_chunks/utils-BgvjC1Pu.js.map +0 -1
@@ -0,0 +1,1143 @@
1
+ import { r as e } from "./rolldown-runtime-9rEmUaIe.js";
2
+ import { A as t, B as n, Et as r, F as i, I as a, J as o, L as s, N as c, Ot as l, Q as u, S as d, Tt as f, V as p, X as m, _ as h, d as g, f as _, g as v, gt as y, h as b, j as x, k as S, kt as C, ot as w, r as T, tt as E, v 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 ee } from "./vue-i18n-POtLvOl1.js";
4
+ import { B as te, F as N, H as P, I as ne, L as re, R as F, V as I, a as ie, z as L } from "./utils-Bz1Gb3iO.js";
5
+ import { c as ae } from "./dist-m75acBC9.js";
6
+ import { t as R } from "./index.es-fkUmGg9G.js";
7
+ import { t as oe } from "./VvButtonLocalized-DCJiCUYU.js";
8
+ import { t as z } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
9
+ import { t as se } from "./PkEditorRadioButtons-DWNs2pp4.js";
10
+ // ../../packages/components/src/chat/PkSpreadsheetPreview.vue?vue&type=script&setup=true&lang.ts
11
+ S(), w(), f(), T();
12
+ var B = { class: "pk-spreadsheet-preview" }, ce = { class: "pk-spreadsheet-preview__bar" }, le = ["aria-label"], V = ["aria-label"], ue = ["aria-label"], de = [
13
+ "rowspan",
14
+ "colspan",
15
+ "data-focus",
16
+ "title",
17
+ "onMousedown",
18
+ "onMouseenter"
19
+ ], fe = {
20
+ key: 1,
21
+ class: "pk-spreadsheet-preview__more"
22
+ }, pe = ["aria-label"], me = ["aria-current", "onClick"], H = { class: "pk-spreadsheet-preview__status" }, he = { class: "pk-spreadsheet-preview__info" }, ge = ["title"], _e = ["title"], ve = {
23
+ key: 2,
24
+ class: "pk-spreadsheet-preview__stats"
25
+ }, ye = {
26
+ key: 0,
27
+ class: "pk-spreadsheet-preview__average"
28
+ }, be = { key: 1 }, xe = { class: "pk-spreadsheet-preview__zoom" }, U = { class: "pk-spreadsheet-preview__percent" }, Se = 64, W = 20, G = 28, K = 44, q = /*#__PURE__*/ z(/* @__PURE__ */ O({
29
+ __name: "PkSpreadsheetPreview",
30
+ props: /*@__PURE__*/ c({ preview: { type: null } }, {
31
+ sheet: { default: 0 },
32
+ sheetModifiers: {},
33
+ zoom: { default: 1 },
34
+ zoomModifiers: {}
35
+ }),
36
+ emits: ["update:sheet", "update:zoom"],
37
+ setup(e) {
38
+ let t = e, { t: n, locale: a } = ee({ useScope: "global" }), s = o(e, "sheet"), c = o(e, "zoom"), f = m("scrollEl"), { width: h, height: S } = ae(f, {
39
+ width: 0,
40
+ height: 0
41
+ }, { box: "border-box" }), w = b(() => t.preview.sheets[s.value] ?? t.preview.sheets[0]);
42
+ u(() => t.preview, () => {
43
+ s.value = 0;
44
+ });
45
+ let T = (e) => {
46
+ let t = "";
47
+ for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
48
+ return t;
49
+ }, E = b(() => {
50
+ let e = w.value;
51
+ if (!e) return [];
52
+ 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 = K, a = h.value / c.value;
53
+ for (let o = 1; o <= e.lastColumn || !e.moreColumns && (o <= e.lastColumn + 2 || i < a); o++) {
54
+ if (t.has(o)) continue;
55
+ let e = n.get(o) ?? Se;
56
+ r.push({
57
+ col: o,
58
+ width: e
59
+ }), i += e;
60
+ }
61
+ return r;
62
+ }), O = b(() => E.value.reduce((e, t) => e + t.width, K)), te = b(() => E.value.map((e) => `${e.col}:${e.width}`).join(",")), N = /* @__PURE__ */ new WeakMap(), P = b(() => {
63
+ let e = w.value;
64
+ if (!e) return [];
65
+ let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((S.value / c.value - G) / W), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = N.get(e);
66
+ a || (a = /* @__PURE__ */ new Map(), N.set(e, a));
67
+ let o = a;
68
+ return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
69
+ let t = o.get(e);
70
+ return t || (t = {
71
+ row: e,
72
+ height: n.get(e) ?? W
73
+ }, o.set(e, t)), t;
74
+ });
75
+ }), ne = b(() => {
76
+ let e = /* @__PURE__ */ new Map();
77
+ for (let t of w.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
78
+ return e;
79
+ }), re = b(() => {
80
+ let e = /* @__PURE__ */ new Map();
81
+ for (let t of w.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}`, {
82
+ row: t.row,
83
+ col: n.col
84
+ });
85
+ return e;
86
+ }), F = (e, t) => ne.value.get(`${e},${t}`), I = (e, t) => {
87
+ let n = F(e, t)?.span;
88
+ if (n) return {
89
+ rows: P.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
90
+ cols: E.value.filter((e) => e.col >= t && e.col < t + n.cols).length
91
+ };
92
+ }, ie = (e) => e?.style === void 0 ? void 0 : t.preview.styles[e.style], L = (e, t) => {
93
+ let n = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
94
+ minimumFractionDigits: e.decimals,
95
+ maximumFractionDigits: e.maxDecimals ?? e.decimals
96
+ };
97
+ return new Intl.NumberFormat(a.value, {
98
+ ...n,
99
+ ...e.format === "percent" ? { style: "percent" } : {},
100
+ ...e.format === "currency" && e.currency ? {
101
+ style: "currency",
102
+ currency: e.currency
103
+ } : {}
104
+ }).format(t);
105
+ }, R = (e) => {
106
+ let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
107
+ return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(a.value, {
108
+ dateStyle: "short",
109
+ timeZone: "UTC"
110
+ }).format(t);
111
+ }, z = (e) => {
112
+ if (!e) return "";
113
+ if (e.missing) return "—";
114
+ let t = e.value;
115
+ return t === void 0 ? "" : typeof t == "boolean" ? n(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? R(t) : typeof t == "number" ? L(e, t) : t;
116
+ }, se = (e) => {
117
+ if (!e) return "";
118
+ if (e.formula) return `=${e.formula}`;
119
+ let t = e.value;
120
+ return typeof t == "number" ? new Intl.NumberFormat(a.value, {
121
+ useGrouping: !1,
122
+ maximumFractionDigits: 15,
123
+ ...e.format === "percent" ? { style: "percent" } : {}
124
+ }).format(t) : z(e);
125
+ }, q = (e) => e ? `${e.width}px solid ${e.color}` : void 0, Ce = (e, t, n) => {
126
+ let r = ie(e), i = e?.value, a = typeof i == "number" || !!e?.missing, o = {
127
+ textAlign: r?.align ?? (a ? "right" : typeof i == "boolean" || e?.format === "error" ? "center" : "left"),
128
+ verticalAlign: r?.valign === "top" ? "top" : r?.valign === "middle" ? "middle" : "bottom",
129
+ whiteSpace: r?.wrap ? "pre-wrap" : "nowrap"
130
+ };
131
+ r?.bold && (o.fontWeight = 700), r?.italic && (o.fontStyle = "italic");
132
+ let s = [r?.underline ? "underline" : "", r?.strike ? "line-through" : ""].filter(Boolean).join(" ");
133
+ if (s && (o.textDecoration = s), r?.size && (o.fontSize = `${r.size}pt`), r?.color && (o.color = r.color), r?.fill && (o.backgroundColor = r.fill), r?.indent) {
134
+ let e = `${4 + r.indent * 9}px`;
135
+ o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
136
+ }
137
+ return o.borderTop = q(r?.borders?.top), o.borderRight = q(r?.borders?.right), o.borderBottom = q(r?.borders?.bottom), o.borderLeft = q(r?.borders?.left), Object.assign(o, J(t, n)), o;
138
+ }, J = (e, t) => {
139
+ let n = w.value?.frozen;
140
+ if (!n) return {};
141
+ let r = {};
142
+ return e <= n.rows && (r.position = "sticky", r.top = `${G + P.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0)}px`, r.zIndex = 2), t <= n.cols && (r.position = "sticky", r.left = `${K + E.value.filter((e) => e.col < t).reduce((e, t) => e + t.width, 0)}px`, r.zIndex = e <= n.rows ? 3 : 2), r;
143
+ }, Y = y({
144
+ row: 1,
145
+ col: 1
146
+ }), X = y({
147
+ row: 1,
148
+ col: 1
149
+ });
150
+ u(w, () => {
151
+ Y.value = {
152
+ row: 1,
153
+ col: 1
154
+ }, X.value = {
155
+ row: 1,
156
+ col: 1
157
+ };
158
+ });
159
+ let Z = b(() => ({
160
+ r1: Math.min(Y.value.row, X.value.row),
161
+ r2: Math.max(Y.value.row, X.value.row),
162
+ c1: Math.min(Y.value.col, X.value.col),
163
+ c2: Math.max(Y.value.col, X.value.col)
164
+ })), we = (e, t) => e >= Z.value.r1 && e <= Z.value.r2 && t >= Z.value.c1 && t <= Z.value.c2, Te = (e, t) => X.value.row === e && X.value.col === t, Ee = (e) => e >= Z.value.r1 && e <= Z.value.r2 ? `${Z.value.c1}:${Z.value.c2}:${X.value.row === e ? X.value.col : 0}` : "", De = y(!1), Q = (e, t, n) => {
165
+ f.value?.focus({ preventScroll: !0 }), X.value = {
166
+ row: e,
167
+ col: t
168
+ }, n.shiftKey || (Y.value = {
169
+ row: e,
170
+ col: t
171
+ }), De.value = !0;
172
+ }, Oe = (e, t) => {
173
+ De.value && (X.value = {
174
+ row: e,
175
+ col: t
176
+ });
177
+ }, ke = (e) => {
178
+ let t = {
179
+ ArrowUp: [-1, 0],
180
+ ArrowDown: [1, 0],
181
+ ArrowLeft: [0, -1],
182
+ ArrowRight: [0, 1],
183
+ Enter: [1, 0],
184
+ Tab: [0, 1]
185
+ }[e.key];
186
+ if (!t) return;
187
+ e.preventDefault();
188
+ let n = P.value.map((e) => e.row), r = E.value.map((e) => e.col), a = (e) => re.value.get(`${e.row},${e.col}`) ?? e, o = a(X.value), s = n.indexOf(X.value.row), c = r.indexOf(X.value.col), l = o;
189
+ for (;;) {
190
+ let e = Math.min(n.length - 1, Math.max(0, s + t[0])), i = Math.min(r.length - 1, Math.max(0, c + t[1]));
191
+ if (e === s && i === c || (s = e, c = i, l = a({
192
+ row: n[s],
193
+ col: r[c]
194
+ }), l.row !== o.row || l.col !== o.col)) break;
195
+ }
196
+ X.value = l, e.shiftKey || (Y.value = l), i(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
197
+ block: "nearest",
198
+ inline: "nearest"
199
+ }));
200
+ }, Ae = b(() => F(X.value.row, X.value.col)), $ = b(() => {
201
+ let { r1: e, r2: t, c1: n, c2: r } = Z.value;
202
+ if (e === t && n === r) return;
203
+ let i = 0, a = 0, o = 0, s;
204
+ for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
205
+ let t = F(c, e);
206
+ t && (t.value !== void 0 || t.missing) && (i++, typeof t.value == "number" && (a += t.value, o++, s ??= t));
207
+ }
208
+ if (i) return {
209
+ count: i,
210
+ sum: s ? L(s, a) : void 0,
211
+ average: s ? L(s, a / o) : void 0
212
+ };
213
+ }), je = (e) => {
214
+ c.value = Math.min(2, Math.max(.5, Math.round((c.value + e) * 10) / 10));
215
+ };
216
+ return (t, i) => {
217
+ let o = oe;
218
+ return M(), j("div", B, [
219
+ v("div", ce, [
220
+ v("span", {
221
+ class: "pk-spreadsheet-preview__ref",
222
+ "aria-label": k(n)("chatFilePreview.cell")
223
+ }, C(T(X.value.col)) + C(X.value.row), 9, le),
224
+ i[6] ||= v("span", {
225
+ class: "pk-spreadsheet-preview__fx",
226
+ "aria-hidden": "true"
227
+ }, "fx", -1),
228
+ v("output", {
229
+ class: "pk-spreadsheet-preview__formula",
230
+ "aria-label": k(n)("chatFilePreview.formulaBar")
231
+ }, C(se(Ae.value)), 9, V)
232
+ ]),
233
+ v("div", {
234
+ ref_key: "scrollEl",
235
+ ref: f,
236
+ class: "pk-spreadsheet-preview__scroll",
237
+ tabindex: "0",
238
+ role: "grid",
239
+ "aria-label": w.value?.name,
240
+ onKeydown: ke,
241
+ onMouseup: i[2] ||= (e) => De.value = !1,
242
+ onMouseleave: i[3] ||= (e) => De.value = !1
243
+ }, [w.value ? (M(), j("table", {
244
+ key: 0,
245
+ class: r(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": w.value.gridlines }]),
246
+ style: l({
247
+ zoom: c.value,
248
+ width: `${O.value}px`
249
+ })
250
+ }, [
251
+ v("colgroup", null, [v("col", { style: l({ width: `${K}px` }) }, null, 4), (M(!0), j(_, null, p(E.value, (e) => (M(), j("col", {
252
+ key: e.col,
253
+ style: l({ width: `${e.width}px` })
254
+ }, null, 4))), 128))]),
255
+ v("thead", null, [v("tr", { style: l({ height: `${G}px` }) }, [i[7] ||= v("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (M(!0), j(_, null, p(E.value, (e) => (M(), j("th", {
256
+ key: e.col,
257
+ scope: "col",
258
+ class: r(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Z.value.c1 && e.col <= Z.value.c2 }])
259
+ }, C(T(e.col)), 3))), 128))], 4)]),
260
+ v("tbody", null, [(M(!0), j(_, null, p(P.value, (e, t, i, o) => {
261
+ let s = [
262
+ e,
263
+ w.value,
264
+ te.value,
265
+ k(a),
266
+ Ee(e.row)
267
+ ];
268
+ if (o && o.el && o.key === e.row && x(o, s)) return o;
269
+ let c = (M(), j("tr", {
270
+ key: e.row,
271
+ style: l({ height: `${e.height}px` })
272
+ }, [v("th", {
273
+ scope: "row",
274
+ class: r(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Z.value.r1 && e.row <= Z.value.r2 }]),
275
+ style: l(w.value.frozen && e.row <= w.value.frozen.rows ? {
276
+ ...J(e.row, 0),
277
+ left: 0,
278
+ zIndex: 4
279
+ } : void 0)
280
+ }, C(e.row), 7), (M(!0), j(_, null, p(E.value, (t) => (M(), j(_, { key: t.col }, [re.value.has(`${e.row},${t.col}`) ? D("", !0) : (M(), j("td", {
281
+ key: 0,
282
+ rowspan: I(e.row, t.col)?.rows,
283
+ colspan: I(e.row, t.col)?.cols,
284
+ class: r(["pk-spreadsheet-preview__cell", {
285
+ "pk-spreadsheet-preview__cell--range": we(e.row, t.col) && !Te(e.row, t.col),
286
+ "pk-spreadsheet-preview__cell--missing": F(e.row, t.col)?.missing
287
+ }]),
288
+ style: l(Ce(F(e.row, t.col), e.row, t.col)),
289
+ "data-focus": Te(e.row, t.col) ? "" : void 0,
290
+ title: F(e.row, t.col)?.missing ? k(n)("chatFilePreview.missingValue") : void 0,
291
+ onMousedown: g((n) => Q(e.row, t.col, n), ["prevent"]),
292
+ onMouseenter: (n) => Oe(e.row, t.col)
293
+ }, C(z(F(e.row, t.col))), 47, de))], 64))), 128))], 4));
294
+ return c.memo = s, c;
295
+ }, i, 0), 128))])
296
+ ], 6)) : D("", !0), w.value && (w.value.moreRows || w.value.moreColumns) ? (M(), j("p", fe, [w.value.moreRows ? (M(), j(_, { key: 0 }, [A(C(k(n)("chatFilePreview.moreRows", w.value.moreRows)), 1)], 64)) : D("", !0), w.value.moreColumns ? (M(), j(_, { key: 1 }, [A(C(k(n)("chatFilePreview.moreColumns", w.value.moreColumns)), 1)], 64)) : D("", !0)])) : D("", !0)], 40, ue),
297
+ v("nav", {
298
+ class: "pk-spreadsheet-preview__sheets",
299
+ "aria-label": k(n)("chatFilePreview.sheets")
300
+ }, [(M(!0), j(_, null, p(e.preview.sheets, (e, t) => (M(), j("button", {
301
+ key: e.name,
302
+ type: "button",
303
+ class: "pk-spreadsheet-preview__sheet",
304
+ "aria-current": t === s.value ? "page" : void 0,
305
+ onClick: (e) => s.value = t
306
+ }, C(e.name), 9, me))), 128))], 8, pe),
307
+ v("div", H, [v("p", he, [e.preview.staleFormulas ? (M(), j("span", {
308
+ key: 0,
309
+ class: "pk-spreadsheet-preview__note",
310
+ title: k(n)("chatFilePreview.staleFormulas")
311
+ }, C(k(n)("chatFilePreview.staleFormulas")), 9, ge)) : e.preview.computedFormulas ? (M(), j("span", {
312
+ key: 1,
313
+ class: "pk-spreadsheet-preview__note",
314
+ title: k(n)("chatFilePreview.computedFormulas")
315
+ }, C(k(n)("chatFilePreview.computedFormulas")), 9, _e)) : D("", !0), $.value ? (M(), j("span", ve, [
316
+ $.value.average ? (M(), j("span", ye, C(k(n)("chatFilePreview.average")) + " " + C($.value.average), 1)) : D("", !0),
317
+ v("span", null, C(k(n)("chatFilePreview.count")) + " " + C($.value.count), 1),
318
+ $.value.sum ? (M(), j("span", be, C(k(n)("chatFilePreview.sum")) + " " + C($.value.sum), 1)) : D("", !0)
319
+ ])) : D("", !0)]), v("div", xe, [
320
+ d(o, {
321
+ modifiers: "action-quiet",
322
+ icon: "ri:subtract-line",
323
+ "aria-label": k(n)("chatFilePreview.zoomOut"),
324
+ disabled: c.value <= .5,
325
+ onClick: i[4] ||= (e) => je(-.1)
326
+ }, null, 8, ["aria-label", "disabled"]),
327
+ v("span", U, C(Math.round(c.value * 100)) + "% ", 1),
328
+ d(o, {
329
+ modifiers: "action-quiet",
330
+ icon: "ri:add-line",
331
+ "aria-label": k(n)("chatFilePreview.zoomIn"),
332
+ disabled: c.value >= 2,
333
+ onClick: i[5] ||= (e) => je(.1)
334
+ }, null, 8, ["aria-label", "disabled"])
335
+ ])])
336
+ ]);
337
+ };
338
+ }
339
+ }), [["styles", [".pk-spreadsheet-preview{--pk-spreadsheet-green:#217346;--pk-spreadsheet-green-head:#217346;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;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;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 #e1e1e1}.pk-spreadsheet-preview__corner,.pk-spreadsheet-preview__head,.pk-spreadsheet-preview__row{z-index:1;border:var(--border) solid var(--color-surface-3);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;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{z-index:5;left:0}.pk-spreadsheet-preview__row{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:inset 0 calc(var(--spacing-2) * -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:inset calc(var(--spacing-2) * -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]{outline:var(--spacing-2) solid var(--pk-spreadsheet-green);outline-offset:calc(var(--spacing-2) * -1)}.pk-spreadsheet-preview__cell--range{box-shadow:inset 0 0 0 100vmax #1f1d2b14}.pk-spreadsheet-preview__cell--missing{color:#6b6880}.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}"]]]);
340
+ // ../../packages/components/src/chat/PkWordPreviewRuns.vue?vue&type=script&setup=true&lang.ts
341
+ S(), f(), w();
342
+ var Ce = ["src"], J = {
343
+ key: 1,
344
+ class: "pk-word-preview__image"
345
+ }, Y = ["title"], X = ["title"], Z = /* @__PURE__ */ O({
346
+ __name: "PkWordPreviewRuns",
347
+ props: {
348
+ runs: { type: Array },
349
+ mode: { type: String },
350
+ page: { type: null },
351
+ numbers: { type: Object }
352
+ },
353
+ setup(e) {
354
+ let n = e, { t: i } = ee({ useScope: "global" }), a = t(ie, void 0), o = (e) => e.picture ? P(a?.value, e.picture.ref) : void 0, s = (e) => n.page ? I(e) : "inline", c = (e) => {
355
+ let t = {
356
+ width: `${e.width}pt`,
357
+ aspectRatio: `${e.width} / ${e.height}`
358
+ }, r = e.anchor, i = n.page;
359
+ if (!r || !i) return t;
360
+ let a = r.xFrom === "page" ? r.x - i.margins.left : r.x, o = I(e);
361
+ if (o === "around") {
362
+ let n = i.width - i.margins.left - i.margins.right, o = a + e.width / 2 < n / 2;
363
+ return {
364
+ ...t,
365
+ float: o ? "left" : "right",
366
+ marginTop: r.yFrom === "paragraph" && r.y > 0 ? `${r.y}pt` : void 0,
367
+ [o ? "marginRight" : "marginLeft"]: "9pt"
368
+ };
369
+ }
370
+ return o === "block" ? {
371
+ ...t,
372
+ display: "block",
373
+ marginLeft: `${Math.max(0, a)}pt`
374
+ } : {
375
+ ...t,
376
+ position: "absolute",
377
+ left: `${a}pt`,
378
+ top: `${r.y}pt`,
379
+ zIndex: r.wrap === "behind" ? -1 : 1
380
+ };
381
+ }, u = (e) => e.field && n.numbers ? String(n.numbers[e.field]) : e.text, d = b(() => {
382
+ let e = re(n.runs, n.mode ?? "markup"), t = (e) => !!e.picture && !!n.page && ["around", "block"].includes(I(e.picture));
383
+ return [...e.filter(t), ...e.filter((e) => !t(e))];
384
+ }), f = b(() => !n.mode || n.mode === "markup"), m = (e) => {
385
+ let t = {};
386
+ e.font && (t.fontFamily = ne(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");
387
+ let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
388
+ return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
389
+ }, h = (e) => {
390
+ let t = m(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
391
+ return n.add(e.change === "deleted" ? "line-through" : "underline"), {
392
+ ...t,
393
+ textDecoration: [...n].join(" ")
394
+ };
395
+ }, g = (e) => e.author ? i("chatFilePreview.revisionBy", { author: e.author }) : void 0;
396
+ return (e, t) => (M(!0), j(_, null, p(d.value, (e, t) => (M(), j(_, { key: t }, [e.image ? (M(), j(_, { key: 0 }, [e.picture && o(e) ? (M(), j(_, { key: 0 }, [s(e.picture) === "page" ? D("", !0) : (M(), j("img", {
397
+ key: 0,
398
+ class: r(["pk-word-preview__picture", `pk-word-preview__picture--${s(e.picture)}`]),
399
+ style: l(c(e.picture)),
400
+ src: o(e),
401
+ alt: ""
402
+ }, null, 14, Ce))], 64)) : (M(), j("span", J, C(k(i)("chatFilePreview.image")), 1))], 64)) : f.value && e.change === "deleted" ? (M(), j("del", {
403
+ key: 1,
404
+ class: "pk-word-preview__removed",
405
+ style: l(h(e)),
406
+ title: g(e)
407
+ }, C(u(e)), 13, Y)) : f.value && e.change === "inserted" ? (M(), j("ins", {
408
+ key: 2,
409
+ class: "pk-word-preview__added",
410
+ style: l(h(e)),
411
+ title: g(e)
412
+ }, C(u(e)), 13, X)) : (M(), j("span", {
413
+ key: 3,
414
+ style: l(m(e))
415
+ }, C(u(e)), 5))], 64))), 128));
416
+ }
417
+ });
418
+ // ../../packages/components/src/chat/PkWordPreviewBlock.vue?vue&type=script&setup=true&lang.ts
419
+ S(), f();
420
+ var we = { key: 0 }, Te = ["colspan"], Ee = ["role", "aria-level"], De = { key: 1 }, Q = /* @__PURE__ */ O({
421
+ __name: "PkWordPreviewBlock",
422
+ props: {
423
+ block: { type: null },
424
+ row: { type: Number },
425
+ mode: { type: String },
426
+ page: { type: null },
427
+ numbers: { type: Object }
428
+ },
429
+ setup(e) {
430
+ let t = e, n = b(() => {
431
+ if (t.block.kind === "table") return {};
432
+ let e = t.block.style ?? {};
433
+ return {
434
+ textAlign: e.align,
435
+ paddingLeft: e.indentLeft ? `${e.indentLeft}pt` : void 0,
436
+ paddingRight: e.indentRight ? `${e.indentRight}pt` : void 0,
437
+ textIndent: e.firstLine ? `${e.firstLine}pt` : void 0,
438
+ paddingTop: e.spaceBefore ? `${e.spaceBefore}pt` : void 0,
439
+ paddingBottom: e.spaceAfter ? `${e.spaceAfter}pt` : void 0,
440
+ 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})`,
441
+ backgroundColor: e.shading,
442
+ fontSize: e.size ? `${e.size}pt` : void 0
443
+ };
444
+ }), i = b(() => {
445
+ if (t.block.kind === "table") return {};
446
+ let e = -(t.block.style?.firstLine ?? 0);
447
+ return e > 0 ? { minWidth: `${e}pt` } : { paddingRight: "6pt" };
448
+ }), a = b(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), o = b(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), s = b(() => {
449
+ if (t.block.kind !== "table") return [];
450
+ let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
451
+ return n ? e.map((e) => `${e / n * 100}%`) : [];
452
+ }), c = b(() => t.mode === "markup" && !!o.value?.some((e) => e.runs.some((e) => e.change)));
453
+ return (t, u) => e.block.kind === "table" && o.value ? (M(), j("table", {
454
+ key: 0,
455
+ class: r(["pk-word-preview__table", {
456
+ "pk-word-preview__table--lines": e.block.borders,
457
+ "pk-word-preview__table--next": e.row !== 0,
458
+ "pk-word-preview__changed": c.value
459
+ }])
460
+ }, [s.value.length ? (M(), j("colgroup", we, [(M(!0), j(_, null, p(s.value, (e, t) => (M(), j("col", {
461
+ key: t,
462
+ style: l({ width: e })
463
+ }, null, 4))), 128))])) : D("", !0), v("tbody", null, [v("tr", null, [(M(!0), j(_, null, p(o.value, (t, n) => (M(), j("td", {
464
+ key: n,
465
+ colspan: t.span,
466
+ style: l({
467
+ backgroundColor: t.fill,
468
+ textAlign: t.align,
469
+ fontSize: t.size ? `${t.size}pt` : void 0
470
+ })
471
+ }, [d(Z, {
472
+ runs: t.runs,
473
+ mode: e.mode,
474
+ numbers: e.numbers
475
+ }, null, 8, [
476
+ "runs",
477
+ "mode",
478
+ "numbers"
479
+ ])], 12, Te))), 128))])])], 2)) : e.block.kind === "table" ? D("", !0) : (M(), j("div", {
480
+ key: 1,
481
+ class: r(["pk-word-preview__block", { "pk-word-preview__changed": a.value }]),
482
+ role: e.block.kind === "heading" ? "heading" : void 0,
483
+ "aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
484
+ style: l(n.value)
485
+ }, [
486
+ e.block.label ? (M(), j("span", {
487
+ key: 0,
488
+ class: "pk-word-preview__label",
489
+ style: l(i.value)
490
+ }, C(e.block.label), 5)) : D("", !0),
491
+ d(Z, {
492
+ runs: e.block.runs,
493
+ mode: e.mode,
494
+ page: e.page,
495
+ numbers: e.numbers
496
+ }, null, 8, [
497
+ "runs",
498
+ "mode",
499
+ "page",
500
+ "numbers"
501
+ ]),
502
+ !e.block.label && !e.block.runs.length ? (M(), j("br", De)) : D("", !0)
503
+ ], 14, Ee));
504
+ }
505
+ });
506
+ // ../../packages/components/src/chat/PkWordPreviewPart.vue?vue&type=script&setup=true&lang.ts
507
+ S(), f();
508
+ var Oe = { class: "pk-word-preview__part" }, ke = ["src"], Ae = /* @__PURE__ */ O({
509
+ __name: "PkWordPreviewPart",
510
+ props: {
511
+ blocks: { type: Array },
512
+ where: { type: String },
513
+ section: { type: null },
514
+ mode: { type: String },
515
+ numbers: { type: Object }
516
+ },
517
+ setup(e) {
518
+ let n = e, r = t(ie, void 0), i = b(() => N(n.blocks, n.mode)), a = b(() => te(n.blocks, n.mode).flatMap((e) => {
519
+ let t = P(r?.value, e.ref);
520
+ return t ? [{
521
+ src: t,
522
+ css: L(e, n.section.page)
523
+ }] : [];
524
+ })), o = b(() => {
525
+ let { margins: e } = n.section.page;
526
+ return {
527
+ left: `${e.left}pt`,
528
+ right: `${e.right}pt`,
529
+ ...n.where === "header" ? { top: `${n.section.headerDistance}pt` } : { bottom: `${n.section.footerDistance}pt` }
530
+ };
531
+ });
532
+ return (t, n) => (M(), j("div", Oe, [v("div", {
533
+ class: "pk-word-preview__part-flow",
534
+ style: l(o.value)
535
+ }, [(M(!0), j(_, null, p(i.value, (t) => (M(), h(Q, {
536
+ key: t.key,
537
+ block: e.blocks[t.block],
538
+ row: t.row,
539
+ mode: e.mode,
540
+ page: e.section.page,
541
+ numbers: e.numbers
542
+ }, null, 8, [
543
+ "block",
544
+ "row",
545
+ "mode",
546
+ "page",
547
+ "numbers"
548
+ ]))), 128))], 4), (M(!0), j(_, null, p(a.value, (e, t) => (M(), j("img", {
549
+ key: t,
550
+ class: "pk-word-preview__float",
551
+ style: l(e.css),
552
+ src: e.src,
553
+ alt: ""
554
+ }, null, 12, ke))), 128))]));
555
+ }
556
+ });
557
+ // ../../packages/components/src/chat/PkWordPreview.vue?vue&type=script&setup=true&lang.ts
558
+ S(), w(), f();
559
+ var $ = ["aria-label"], je = {
560
+ class: "pk-word-preview__tabs",
561
+ role: "tablist"
562
+ }, Me = ["aria-selected"], Ne = ["aria-selected"], Pe = {
563
+ key: 0,
564
+ class: "pk-word-preview__list"
565
+ }, Fe = ["aria-current", "onClick"], Ie = { class: "pk-word-preview__entry-text" }, Le = {
566
+ key: 0,
567
+ class: "u-dot"
568
+ }, Re = {
569
+ key: 0,
570
+ class: "pk-word-preview__none"
571
+ }, ze = {
572
+ key: 1,
573
+ class: "pk-word-preview__list"
574
+ }, Be = ["onClick"], Ve = {
575
+ key: 0,
576
+ class: "pk-word-preview__removed"
577
+ }, He = {
578
+ key: 1,
579
+ class: "pk-word-preview__added"
580
+ }, Ue = { class: "pk-word-preview__main" }, We = ["aria-label"], Ge = ["src"], Ke = {
581
+ key: 2,
582
+ class: "pk-word-preview__truncated"
583
+ }, qe = { class: "pk-word-preview__status" }, Je = {
584
+ key: 0,
585
+ class: "pk-word-preview__count"
586
+ }, Ye = { class: "pk-word-preview__count" }, Xe = {
587
+ key: 1,
588
+ class: "pk-word-preview__legend"
589
+ }, Ze = ["title"], Qe = { class: "pk-word-preview__removed" }, $e = { class: "pk-word-preview__added" }, et = { class: "pk-word-preview__percent" }, tt = ["data-part"], nt = 96 / 72, rt = /*#__PURE__*/ z(/* @__PURE__ */ O({
590
+ __name: "PkWordPreview",
591
+ props: /*@__PURE__*/ c({
592
+ preview: { type: null },
593
+ mode: { type: String }
594
+ }, {
595
+ fit: {
596
+ type: Boolean,
597
+ default: !0
598
+ },
599
+ fitModifiers: {},
600
+ zoom: { default: 1 },
601
+ zoomModifiers: {}
602
+ }),
603
+ emits: ["update:fit", "update:zoom"],
604
+ setup(e) {
605
+ let t = e, { t: c } = ee({ useScope: "global" });
606
+ n(ie, b(() => t.preview.images));
607
+ let f = (e) => re(e, t.mode), g = b(() => N(t.preview.blocks, t.mode)), x = m("rootEl"), S = m("scrollEl"), w = m("measureEl"), { width: T } = ae(x), { width: E } = ae(S), O = b(() => T.value === 0 || T.value >= 640), A = b(() => T.value >= 1e3), I = b(() => t.preview.sections?.length ? t.preview.sections : [{
608
+ page: t.preview.page,
609
+ headerDistance: 0,
610
+ footerDistance: 0,
611
+ headers: {},
612
+ footers: {}
613
+ }]), R = b(() => I.value[0].page), z = b(() => ({
614
+ fontFamily: ne(t.preview.defaults.font),
615
+ fontSize: `${t.preview.defaults.size}pt`,
616
+ color: t.preview.defaults.color ?? "#000000",
617
+ "--pk-word-line": F(t.preview.defaults.font),
618
+ "--pk-word-size": `${t.preview.defaults.size}pt`
619
+ })), se = b(() => ({
620
+ ...z.value,
621
+ width: `${R.value.width - R.value.margins.left - R.value.margins.right}pt`
622
+ })), B = y([]), ce = y({}), le = async () => {
623
+ await i();
624
+ let e = w.value?.querySelectorAll("[data-item]");
625
+ B.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
626
+ let t = w.value?.querySelectorAll("[data-part]");
627
+ ce.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
628
+ };
629
+ u([
630
+ g,
631
+ O,
632
+ () => t.preview.parts
633
+ ], le, { flush: "post" }), s(() => {
634
+ le(), document.fonts?.ready.then(le);
635
+ });
636
+ let V = b(() => {
637
+ if (!O.value || B.value.length !== g.value.length) return [{
638
+ items: g.value.map((e, t) => t),
639
+ section: 0,
640
+ number: 1,
641
+ top: R.value.margins.top,
642
+ bottom: R.value.margins.bottom
643
+ }];
644
+ let e = [], n = 0, r = !0, i = 0, a, o = () => {
645
+ let o = I.value[n], s = r && o.pageStart !== void 0 ? o.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
646
+ a = void 0;
647
+ let c = (e) => r && o.titlePage ? e.first : t.preview.evenAndOddHeaders && s % 2 == 0 ? e.even : e.default, l = c(o.headers), u = c(o.footers), d = (e) => e ? (ce.value[e] ?? 0) / nt : 0;
648
+ e.push({
649
+ items: [],
650
+ section: n,
651
+ number: s,
652
+ header: l,
653
+ footer: u,
654
+ top: Math.max(o.page.margins.top, l ? o.headerDistance + d(l) : 0),
655
+ bottom: Math.max(o.page.margins.bottom, u ? o.footerDistance + d(u) : 0)
656
+ }), r = !1, i = 0;
657
+ };
658
+ return g.value.forEach((t, s) => {
659
+ t.section !== void 0 && t.section !== n && I.value[t.section] && (n = t.section, r = t.breakBefore || !e.length, r || (a = I.value[n].pageStart));
660
+ let c = e[e.length - 1], l = c && I.value[c.section].page, u = l ? (l.height - c.top - c.bottom) * nt : 0;
661
+ (!c || c.items.length && (t.breakBefore || i + B.value[s] > u)) && o(), e[e.length - 1].items.push(s), i += B.value[s];
662
+ }), e.length || o(), e;
663
+ }), ue = b(() => {
664
+ let e = /* @__PURE__ */ new Map();
665
+ for (let t of V.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
666
+ return V.value.map((t) => ({
667
+ page: t.number,
668
+ pages: V.value.length,
669
+ sectionPages: e.get(t.section) ?? 1
670
+ }));
671
+ }), de = (e) => {
672
+ let t = I.value[e.section].page;
673
+ return {
674
+ ...z.value,
675
+ width: `${t.width}pt`,
676
+ minHeight: `${t.height}pt`,
677
+ padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
678
+ };
679
+ }, fe = (e) => {
680
+ let n = [...new Set(e.items.map((e) => g.value[e].block))];
681
+ return te(n.map((e) => t.preview.blocks[e]), t.mode).flatMap((n) => {
682
+ let r = P(t.preview.images, n.ref);
683
+ return r ? [{
684
+ src: r,
685
+ css: L(n, I.value[e.section].page)
686
+ }] : [];
687
+ });
688
+ }, pe = o(e, "fit"), me = o(e, "zoom"), H = b(() => pe.value ? Math.min(1.25, Math.max(.3, (E.value - 48) / (R.value.width * nt))) : me.value), he = (e) => {
689
+ me.value = Math.min(2, Math.max(.3, Math.round((H.value + e) * 10) / 10)), pe.value = !1;
690
+ }, ge = y(0), _e = y(), ve = () => {
691
+ let e = S.value?.getBoundingClientRect();
692
+ if (!e) return;
693
+ let t = S.value?.querySelectorAll("[data-page]") ?? [], n = 0;
694
+ for (let [r, i] of [...t].entries()) {
695
+ if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
696
+ n = r;
697
+ }
698
+ ge.value = n;
699
+ let r;
700
+ for (let t of U.value) {
701
+ let n = S.value?.querySelector(`[data-key="${t.key}"]`);
702
+ if (n) {
703
+ if (n.getBoundingClientRect().top - e.top > 48) break;
704
+ r = t.key;
705
+ }
706
+ }
707
+ _e.value = r ?? U.value[0]?.key;
708
+ }, ye = 0, be = () => {
709
+ ye ||= requestAnimationFrame(() => {
710
+ ye = 0, ve();
711
+ });
712
+ };
713
+ a(() => cancelAnimationFrame(ye)), u(V, () => i(be));
714
+ let xe = (e) => f(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), U = b(() => g.value.flatMap((e) => {
715
+ let n = t.preview.blocks[e.block], r = n.kind === "heading" ? [n.label, xe(n.runs)].filter(Boolean).join(" ") : "";
716
+ return n.kind === "heading" && n.level <= 3 && r ? [{
717
+ key: e.key,
718
+ level: n.level,
719
+ text: r
720
+ }] : [];
721
+ })), Se = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, W = b(() => g.value.flatMap((e) => {
722
+ let n = t.preview.blocks[e.block], r = n.kind === "table" ? (n.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : n.runs, i = r.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), a = r.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
723
+ return i || a ? [{
724
+ key: e.key,
725
+ removed: Se(i),
726
+ added: Se(a)
727
+ }] : [];
728
+ })), G = y("outline"), K = y(!1), q = (e) => {
729
+ S.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
730
+ block: "start",
731
+ behavior: "smooth"
732
+ }), A.value || (K.value = !1);
733
+ }, Ce = b(() => t.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => xe(e.runs)) : [xe(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), J = b(() => t.preview.revisionAuthors.join(", "));
734
+ return (t, n) => {
735
+ let i = oe;
736
+ return M(), j("div", {
737
+ ref_key: "rootEl",
738
+ ref: x,
739
+ class: r(["pk-word-preview", { "pk-word-preview--paged": O.value }])
740
+ }, [
741
+ (A.value || K.value) && (U.value.length || W.value.length) ? (M(), j("aside", {
742
+ key: 0,
743
+ class: r(["pk-word-preview__side", { "pk-word-preview__side--over": !A.value }]),
744
+ "aria-label": k(c)("chatFilePreview.outline")
745
+ }, [v("div", je, [v("button", {
746
+ type: "button",
747
+ role: "tab",
748
+ class: "pk-word-preview__tab",
749
+ "aria-selected": G.value === "outline",
750
+ onClick: n[0] ||= (e) => G.value = "outline"
751
+ }, C(k(c)("chatFilePreview.outline")), 9, Me), W.value.length ? (M(), j("button", {
752
+ key: 0,
753
+ type: "button",
754
+ role: "tab",
755
+ class: "pk-word-preview__tab",
756
+ "aria-selected": G.value === "changes",
757
+ onClick: n[1] ||= (e) => G.value = "changes"
758
+ }, C(k(c)("chatFilePreview.changes", { count: W.value.length })), 9, Ne)) : D("", !0)]), G.value === "outline" || !W.value.length ? (M(), j("nav", Pe, [(M(!0), j(_, null, p(U.value, (e) => (M(), j("button", {
759
+ key: e.key,
760
+ type: "button",
761
+ class: r(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
762
+ "aria-current": _e.value === e.key ? "location" : void 0,
763
+ onClick: (t) => q(e.key)
764
+ }, [v("span", Ie, C(e.text), 1), W.value.some((t) => t.key === e.key) ? (M(), j("span", Le)) : D("", !0)], 10, Fe))), 128)), U.value.length ? D("", !0) : (M(), j("p", Re, C(k(c)("chatFilePreview.noHeadings")), 1))])) : (M(), j("nav", ze, [(M(!0), j(_, null, p(W.value, (e) => (M(), j("button", {
765
+ key: e.key,
766
+ type: "button",
767
+ class: "pk-word-preview__entry pk-word-preview__entry--change",
768
+ onClick: (t) => q(e.key)
769
+ }, [e.removed ? (M(), j("del", Ve, C(e.removed), 1)) : D("", !0), e.added ? (M(), j("ins", He, C(e.added), 1)) : D("", !0)], 8, Be))), 128))]))], 10, $)) : D("", !0),
770
+ v("div", Ue, [v("div", {
771
+ ref_key: "scrollEl",
772
+ ref: S,
773
+ class: "pk-word-preview__scroll",
774
+ onScroll: be
775
+ }, [O.value ? (M(), j("div", {
776
+ key: 0,
777
+ class: "pk-word-preview__pages",
778
+ style: l({ zoom: H.value })
779
+ }, [(M(!0), j(_, null, p(V.value, (t, n) => (M(), j("article", {
780
+ key: n,
781
+ "data-page": "",
782
+ class: "pk-word-preview__page",
783
+ "aria-label": k(c)("chatFilePreview.pageOf", {
784
+ page: n + 1,
785
+ count: V.value.length
786
+ }),
787
+ style: l(de(t))
788
+ }, [
789
+ t.header && e.preview.parts?.[t.header] ? (M(), h(Ae, {
790
+ key: 0,
791
+ blocks: e.preview.parts[t.header],
792
+ where: "header",
793
+ section: I.value[t.section],
794
+ mode: e.mode,
795
+ numbers: ue.value[n]
796
+ }, null, 8, [
797
+ "blocks",
798
+ "section",
799
+ "mode",
800
+ "numbers"
801
+ ])) : D("", !0),
802
+ (M(!0), j(_, null, p(t.items, (r) => (M(), h(Q, {
803
+ key: g.value[r].key,
804
+ "data-key": g.value[r].key,
805
+ block: e.preview.blocks[g.value[r].block],
806
+ row: g.value[r].row,
807
+ mode: e.mode,
808
+ page: I.value[t.section].page,
809
+ numbers: ue.value[n]
810
+ }, null, 8, [
811
+ "data-key",
812
+ "block",
813
+ "row",
814
+ "mode",
815
+ "page",
816
+ "numbers"
817
+ ]))), 128)),
818
+ (M(!0), j(_, null, p(fe(t), (e, t) => (M(), j("img", {
819
+ key: `image-${t}`,
820
+ class: "pk-word-preview__float",
821
+ style: l(e.css),
822
+ src: e.src,
823
+ alt: ""
824
+ }, null, 12, Ge))), 128)),
825
+ t.footer && e.preview.parts?.[t.footer] ? (M(), h(Ae, {
826
+ key: 1,
827
+ blocks: e.preview.parts[t.footer],
828
+ where: "footer",
829
+ section: I.value[t.section],
830
+ mode: e.mode,
831
+ numbers: ue.value[n]
832
+ }, null, 8, [
833
+ "blocks",
834
+ "section",
835
+ "mode",
836
+ "numbers"
837
+ ])) : D("", !0)
838
+ ], 12, We))), 128))], 4)) : (M(), j("article", {
839
+ key: 1,
840
+ class: "pk-word-preview__page pk-word-preview__page--flow",
841
+ style: l(z.value)
842
+ }, [(M(!0), j(_, null, p(g.value, (t) => (M(), h(Q, {
843
+ key: t.key,
844
+ "data-key": t.key,
845
+ block: e.preview.blocks[t.block],
846
+ row: t.row,
847
+ mode: e.mode
848
+ }, null, 8, [
849
+ "data-key",
850
+ "block",
851
+ "row",
852
+ "mode"
853
+ ]))), 128))], 4)), e.preview.truncated ? (M(), j("p", Ke, C(k(c)("chatFilePreview.truncated")), 1)) : D("", !0)], 544), v("div", qe, [
854
+ O.value ? (M(), j("span", Je, C(k(c)("chatFilePreview.pageOf", {
855
+ page: ge.value + 1,
856
+ count: V.value.length
857
+ })), 1)) : D("", !0),
858
+ v("span", Ye, C(k(c)("chatFilePreview.words", Ce.value)), 1),
859
+ e.mode === "markup" && e.preview.revisionAuthors.length ? (M(), j("span", Xe, [
860
+ v("span", {
861
+ class: "pk-word-preview__legend-text",
862
+ title: k(c)("chatFilePreview.revisionsOf", { authors: J.value })
863
+ }, C(k(c)("chatFilePreview.revisionsOf", { authors: J.value })), 9, Ze),
864
+ v("del", Qe, C(k(c)("chatFilePreview.removed")), 1),
865
+ v("ins", $e, C(k(c)("chatFilePreview.added")), 1)
866
+ ])) : D("", !0),
867
+ n[6] ||= v("span", { class: "pk-word-preview__spacer" }, null, -1),
868
+ !A.value && (U.value.length || W.value.length) ? (M(), h(i, {
869
+ key: 2,
870
+ class: "pk-word-preview__outline-toggle",
871
+ modifiers: "action-quiet",
872
+ icon: "ri:list-unordered",
873
+ label: k(c)("chatFilePreview.outline"),
874
+ title: k(c)("chatFilePreview.outline"),
875
+ "aria-label": k(c)("chatFilePreview.outline"),
876
+ "aria-expanded": K.value,
877
+ onClick: n[2] ||= (e) => K.value = !K.value
878
+ }, null, 8, [
879
+ "label",
880
+ "title",
881
+ "aria-label",
882
+ "aria-expanded"
883
+ ])) : D("", !0),
884
+ O.value ? (M(), j(_, { key: 3 }, [
885
+ d(i, {
886
+ modifiers: "action-quiet",
887
+ label: k(c)("chatFilePreview.fitWidth"),
888
+ disabled: pe.value,
889
+ onClick: n[3] ||= (e) => pe.value = !0
890
+ }, null, 8, ["label", "disabled"]),
891
+ d(i, {
892
+ modifiers: "action-quiet",
893
+ icon: "ri:subtract-line",
894
+ "aria-label": k(c)("chatFilePreview.zoomOut"),
895
+ disabled: H.value <= .3,
896
+ onClick: n[4] ||= (e) => he(-.1)
897
+ }, null, 8, ["aria-label", "disabled"]),
898
+ v("span", et, C(Math.round(H.value * 100)) + "% ", 1),
899
+ d(i, {
900
+ modifiers: "action-quiet",
901
+ icon: "ri:add-line",
902
+ "aria-label": k(c)("chatFilePreview.zoomIn"),
903
+ disabled: H.value >= 2,
904
+ onClick: n[5] ||= (e) => he(.1)
905
+ }, null, 8, ["aria-label", "disabled"])
906
+ ], 64)) : D("", !0)
907
+ ])]),
908
+ O.value ? (M(), j("div", {
909
+ key: 1,
910
+ ref_key: "measureEl",
911
+ ref: w,
912
+ class: "pk-word-preview__measure",
913
+ "aria-hidden": "true",
914
+ style: l(se.value)
915
+ }, [(M(!0), j(_, null, p(g.value, (t) => (M(), j("div", {
916
+ key: t.key,
917
+ "data-item": ""
918
+ }, [d(Q, {
919
+ block: e.preview.blocks[t.block],
920
+ row: t.row,
921
+ mode: e.mode,
922
+ page: R.value
923
+ }, null, 8, [
924
+ "block",
925
+ "row",
926
+ "mode",
927
+ "page"
928
+ ])]))), 128)), (M(!0), j(_, null, p(e.preview.parts, (t, n) => (M(), j("div", {
929
+ key: n,
930
+ "data-part": n
931
+ }, [(M(!0), j(_, null, p(k(N)(t, e.mode), (n) => (M(), h(Q, {
932
+ key: n.key,
933
+ block: t[n.block],
934
+ row: n.row,
935
+ mode: e.mode,
936
+ page: R.value
937
+ }, null, 8, [
938
+ "block",
939
+ "row",
940
+ "mode",
941
+ "page"
942
+ ]))), 128))], 8, tt))), 128))], 4)) : D("", !0)
943
+ ], 2);
944
+ };
945
+ }
946
+ }), [["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;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;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;line-height:var(--pk-word-line,1.17);overflow-wrap:break-word;position:absolute;top:0;left:-100000px}.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__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__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<30rem){.pk-word-preview__outline-toggle .vv-button__label{display:none}}.pk-word-preview__percent{min-width:var(--spacing-40);font-variant-numeric:tabular-nums;text-align:center}"]]]);
947
+ // ../../packages/components/src/chat/PkFilePreview.vue?vue&type=script&setup=true&lang.ts
948
+ S(), f(), w();
949
+ var it = ["aria-label"], at = { class: "pk-file-preview__head" }, ot = { class: "pk-file-preview__file" }, st = {
950
+ class: "pk-file-preview__tile",
951
+ "aria-hidden": "true"
952
+ }, ct = { class: "pk-file-preview__name" }, lt = { class: "pk-file-preview__title" }, ut = { class: "pk-file-preview__note" }, dt = {
953
+ key: 0,
954
+ class: "pk-file-preview__tools"
955
+ }, ft = ["aria-label"], pt = { class: "pk-file-preview__version" }, mt = { class: "pk-file-preview__mode-long" }, ht = { class: "pk-file-preview__mode-short" }, gt = { class: "pk-file-preview__actions" }, _t = { class: "pk-file-preview__body" }, vt = {
956
+ key: 0,
957
+ class: "pk-file-preview__skeleton vv-skeleton"
958
+ }, yt = {
959
+ key: 1,
960
+ class: "pk-file-preview__empty"
961
+ }, bt = /*@__PURE__*/ O({
962
+ __name: "PkFilePreview",
963
+ props: /*@__PURE__*/ c({
964
+ kind: { type: String },
965
+ filename: { type: String },
966
+ version: { type: Number },
967
+ versions: { type: Array },
968
+ downloadUrl: { type: String },
969
+ preview: { type: null },
970
+ loading: { type: Boolean },
971
+ error: { type: Boolean },
972
+ restorable: { type: Boolean },
973
+ resize: { type: String }
974
+ }, {
975
+ mode: { default: "markup" },
976
+ modeModifiers: {},
977
+ sheet: { default: 0 },
978
+ sheetModifiers: {},
979
+ zoom: { default: 1 },
980
+ zoomModifiers: {},
981
+ fit: {
982
+ type: Boolean,
983
+ default: !0
984
+ },
985
+ fitModifiers: {}
986
+ }),
987
+ emits: /*@__PURE__*/ c([
988
+ "close",
989
+ "version",
990
+ "restore",
991
+ "resize"
992
+ ], [
993
+ "update:mode",
994
+ "update:sheet",
995
+ "update:zoom",
996
+ "update:fit"
997
+ ]),
998
+ setup(e, { emit: t }) {
999
+ let n = e, i = t, { t: a } = ee({ useScope: "global" }), s = b(() => n.versions ?? []), c = b(() => n.version ? s.value.indexOf(n.version) : -1), l = b(() => c.value > 0 ? s.value[c.value - 1] : void 0), f = b(() => c.value >= 0 && c.value < s.value.length - 1 ? s.value[c.value + 1] : void 0), m = o(e, "mode"), g = o(e, "sheet"), y = o(e, "zoom"), x = o(e, "fit"), S = b(() => [
1000
+ {
1001
+ value: "markup",
1002
+ label: a("chatFilePreview.modeMarkup")
1003
+ },
1004
+ {
1005
+ value: "accepted",
1006
+ label: a("chatFilePreview.modeAccepted")
1007
+ },
1008
+ {
1009
+ value: "original",
1010
+ label: a("chatFilePreview.modeOriginal")
1011
+ }
1012
+ ]), w = b(() => n.preview?.kind === "word" && n.preview.revisionAuthors.length > 0);
1013
+ return u(() => n.version, () => {
1014
+ m.value = "markup";
1015
+ }), (t, n) => {
1016
+ let o = R, c = oe;
1017
+ return M(), j("section", {
1018
+ class: "pk-file-preview",
1019
+ "aria-label": e.filename,
1020
+ tabindex: "-1",
1021
+ autofocus: ""
1022
+ }, [v("header", at, [
1023
+ v("div", ot, [v("span", st, [d(o, {
1024
+ name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
1025
+ class: r(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
1026
+ }, null, 8, ["name", "class"])]), v("div", ct, [v("strong", lt, C(e.filename), 1), v("span", ut, C(k(a)("chatFilePreview.readOnly")), 1)])]),
1027
+ e.version && s.value.length > 1 || w.value ? (M(), j("div", dt, [e.version && s.value.length > 1 ? (M(), j("nav", {
1028
+ key: 0,
1029
+ class: "pk-file-preview__versions",
1030
+ "aria-label": k(a)("chatFilePreview.versions")
1031
+ }, [
1032
+ d(c, {
1033
+ modifiers: "action-quiet",
1034
+ icon: "ri:arrow-left-s-line",
1035
+ "aria-label": k(a)("chatFilePreview.previousVersion"),
1036
+ disabled: !l.value,
1037
+ onClick: n[0] ||= (e) => l.value && i("version", l.value)
1038
+ }, null, 8, ["aria-label", "disabled"]),
1039
+ v("span", pt, C(k(a)("chatFilePreview.versionOf", {
1040
+ version: e.version,
1041
+ count: s.value.length
1042
+ })), 1),
1043
+ d(c, {
1044
+ modifiers: "action-quiet",
1045
+ icon: "ri:arrow-right-s-line",
1046
+ "aria-label": k(a)("chatFilePreview.nextVersion"),
1047
+ disabled: !f.value,
1048
+ onClick: n[1] ||= (e) => f.value && i("version", f.value)
1049
+ }, null, 8, ["aria-label", "disabled"])
1050
+ ], 8, ft)) : D("", !0), w.value ? (M(), h(se, {
1051
+ key: 1,
1052
+ modelValue: m.value,
1053
+ "onUpdate:modelValue": n[2] ||= (e) => m.value = e,
1054
+ name: "revisions",
1055
+ segmented: "",
1056
+ class: "pk-file-preview__modes u-segmented-fit mb-0",
1057
+ "aria-label": k(a)("chatFilePreview.modes"),
1058
+ options: S.value
1059
+ }, {
1060
+ markup: E(() => [v("span", mt, C(k(a)("chatFilePreview.modeMarkup")), 1), v("span", ht, C(k(a)("chatFilePreview.modeMarkupShort")), 1)]),
1061
+ _: 1
1062
+ }, 8, [
1063
+ "modelValue",
1064
+ "aria-label",
1065
+ "options"
1066
+ ])) : D("", !0)])) : D("", !0),
1067
+ v("div", gt, [
1068
+ e.restorable ? (M(), h(c, {
1069
+ key: 0,
1070
+ modifiers: "action-quiet",
1071
+ icon: "ri:arrow-go-back-line",
1072
+ label: k(a)("chatFilePreview.restore"),
1073
+ onClick: n[3] ||= (e) => i("restore")
1074
+ }, null, 8, ["label"])) : D("", !0),
1075
+ d(c, {
1076
+ href: e.downloadUrl,
1077
+ download: "",
1078
+ modifiers: "action-quiet",
1079
+ icon: "ri:download-line",
1080
+ title: k(a)("chatFilePreview.download"),
1081
+ "aria-label": k(a)("chatFilePreview.download")
1082
+ }, null, 8, [
1083
+ "href",
1084
+ "title",
1085
+ "aria-label"
1086
+ ]),
1087
+ e.resize === "expand" ? (M(), h(c, {
1088
+ key: 1,
1089
+ modifiers: "action-quiet",
1090
+ icon: "ri:fullscreen-line",
1091
+ title: k(a)("chatFilePreview.expand"),
1092
+ "aria-label": k(a)("chatFilePreview.expand"),
1093
+ onClick: n[4] ||= (e) => i("resize")
1094
+ }, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (M(), h(c, {
1095
+ key: 2,
1096
+ modifiers: "action-quiet",
1097
+ icon: "ri:fullscreen-exit-line",
1098
+ title: k(a)("chatFilePreview.shrink"),
1099
+ "aria-label": k(a)("chatFilePreview.shrink"),
1100
+ onClick: n[5] ||= (e) => i("resize")
1101
+ }, null, 8, ["title", "aria-label"])) : D("", !0),
1102
+ d(c, {
1103
+ modifiers: "action-quiet",
1104
+ icon: "ri:close-line",
1105
+ title: k(a)("chatFilePreview.close"),
1106
+ "aria-label": k(a)("chatFilePreview.close"),
1107
+ onClick: n[6] ||= (e) => i("close")
1108
+ }, null, 8, ["title", "aria-label"])
1109
+ ])
1110
+ ]), v("div", _t, [e.loading ? (M(), j("div", vt, [(M(), j(_, null, p(8, (e) => v("div", {
1111
+ key: e,
1112
+ class: r(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
1113
+ }, null, 2)), 64))])) : e.error || !e.preview ? (M(), j("p", yt, C(k(a)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (M(), h(rt, {
1114
+ key: 2,
1115
+ zoom: y.value,
1116
+ "onUpdate:zoom": n[7] ||= (e) => y.value = e,
1117
+ fit: x.value,
1118
+ "onUpdate:fit": n[8] ||= (e) => x.value = e,
1119
+ preview: e.preview,
1120
+ mode: w.value ? m.value : "markup"
1121
+ }, null, 8, [
1122
+ "zoom",
1123
+ "fit",
1124
+ "preview",
1125
+ "mode"
1126
+ ])) : (M(), h(q, {
1127
+ key: 3,
1128
+ sheet: g.value,
1129
+ "onUpdate:sheet": n[9] ||= (e) => g.value = e,
1130
+ zoom: y.value,
1131
+ "onUpdate:zoom": n[10] ||= (e) => y.value = e,
1132
+ preview: e.preview
1133
+ }, null, 8, [
1134
+ "sheet",
1135
+ "zoom",
1136
+ "preview"
1137
+ ]))])], 8, it);
1138
+ };
1139
+ }
1140
+ }), xt = ".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;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}.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{color:var(--color-word-3);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}", St = /* @__PURE__ */ e({ default: () => Ct }), Ct = /*#__PURE__*/ z(bt, [["styles", [xt]]]);
1141
+ export { St as n, Ct as t };
1142
+
1143
+ //# sourceMappingURL=PkFilePreview-DXmgMwwu.js.map