@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
@@ -1,948 +0,0 @@
1
- import { r as e } from "./rolldown-runtime-9rEmUaIe.js";
2
- import { Et as t, F as n, I as r, J as i, L as a, N as o, Ot as s, Q as c, S as l, Tt as u, V as d, X as f, _ as p, d as m, f as h, g, gt as _, h as v, j as y, k as b, kt as x, ot as S, r as C, tt as w, v as T, w as E, wt as D, x as ee, y as O, z as k } from "./vue.runtime.esm-bundler-C2U5uTqB.js";
3
- import { r as A } from "./vue-i18n-POtLvOl1.js";
4
- import { F as j, P as te } from "./utils-B5VcWm3g.js";
5
- import { c as ne } from "./dist-m75acBC9.js";
6
- import { t as M } from "./index.es-fkUmGg9G.js";
7
- import { t as re } from "./VvButtonLocalized-DCJiCUYU.js";
8
- import { t as N } from "./_plugin-vue_export-helper-Djzt4Yr7.js";
9
- import { t as P } from "./PkEditorRadioButtons-DWNs2pp4.js";
10
- // ../../packages/components/src/chat/PkSpreadsheetPreview.vue?vue&type=script&setup=true&lang.ts
11
- b(), S(), u(), C();
12
- var ie = { class: "pk-spreadsheet-preview" }, ae = { class: "pk-spreadsheet-preview__bar" }, oe = ["aria-label"], se = ["aria-label"], ce = ["aria-label"], F = [
13
- "rowspan",
14
- "colspan",
15
- "data-focus",
16
- "title",
17
- "onMousedown",
18
- "onMouseenter"
19
- ], I = {
20
- key: 1,
21
- class: "pk-spreadsheet-preview__more"
22
- }, le = ["aria-label"], L = ["aria-current", "onClick"], ue = { class: "pk-spreadsheet-preview__status" }, de = { class: "pk-spreadsheet-preview__info" }, fe = ["title"], pe = ["title"], R = {
23
- key: 2,
24
- class: "pk-spreadsheet-preview__stats"
25
- }, me = {
26
- key: 0,
27
- class: "pk-spreadsheet-preview__average"
28
- }, z = { key: 1 }, B = { class: "pk-spreadsheet-preview__zoom" }, he = { class: "pk-spreadsheet-preview__percent" }, V = 64, H = 20, U = 28, W = 44, ge = /*#__PURE__*/ N(/* @__PURE__ */ E({
29
- __name: "PkSpreadsheetPreview",
30
- props: /*@__PURE__*/ o({ 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 r = e, { t: a, locale: o } = A({ useScope: "global" }), u = i(e, "sheet"), p = i(e, "zoom"), b = f("scrollEl"), { width: S, height: C } = ne(b, {
39
- width: 0,
40
- height: 0
41
- }, { box: "border-box" }), w = v(() => r.preview.sheets[u.value] ?? r.preview.sheets[0]);
42
- c(() => r.preview, () => {
43
- u.value = 0;
44
- });
45
- let E = (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
- }, j = v(() => {
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 = W, a = S.value / p.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) ?? V;
56
- r.push({
57
- col: o,
58
- width: e
59
- }), i += e;
60
- }
61
- return r;
62
- }), te = v(() => j.value.reduce((e, t) => e + t.width, W)), M = v(() => j.value.map((e) => `${e.col}:${e.width}`).join(",")), N = /* @__PURE__ */ new WeakMap(), P = v(() => {
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((C.value / p.value - U) / H), 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) ?? H
73
- }, o.set(e, t)), t;
74
- });
75
- }), ge = v(() => {
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
- }), G = v(() => {
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
- }), K = (e, t) => ge.value.get(`${e},${t}`), _e = (e, t) => {
87
- let n = K(e, t)?.span;
88
- if (n) return {
89
- rows: P.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
90
- cols: j.value.filter((e) => e.col >= t && e.col < t + n.cols).length
91
- };
92
- }, ve = (e) => e?.style === void 0 ? void 0 : r.preview.styles[e.style], q = (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(o.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
- }, ye = (e) => {
106
- let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
107
- return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(o.value, {
108
- dateStyle: "short",
109
- timeZone: "UTC"
110
- }).format(t);
111
- }, be = (e) => {
112
- if (!e) return "";
113
- if (e.missing) return "—";
114
- let t = e.value;
115
- return t === void 0 ? "" : typeof t == "boolean" ? a(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? ye(t) : typeof t == "number" ? q(e, t) : t;
116
- }, xe = (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(o.value, {
121
- useGrouping: !1,
122
- maximumFractionDigits: 15,
123
- ...e.format === "percent" ? { style: "percent" } : {}
124
- }).format(t) : be(e);
125
- }, J = (e) => e ? `${e.width}px solid ${e.color}` : void 0, Se = (e, t, n) => {
126
- let r = ve(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 = J(r?.borders?.top), o.borderRight = J(r?.borders?.right), o.borderBottom = J(r?.borders?.bottom), o.borderLeft = J(r?.borders?.left), Object.assign(o, Ce(t, n)), o;
138
- }, Ce = (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 = `${U + 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 = `${W + j.value.filter((e) => e.col < t).reduce((e, t) => e + t.width, 0)}px`, r.zIndex = e <= n.rows ? 3 : 2), r;
143
- }, Y = _({
144
- row: 1,
145
- col: 1
146
- }), X = _({
147
- row: 1,
148
- col: 1
149
- });
150
- c(w, () => {
151
- Y.value = {
152
- row: 1,
153
- col: 1
154
- }, X.value = {
155
- row: 1,
156
- col: 1
157
- };
158
- });
159
- let Z = v(() => ({
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}` : "", Q = _(!1), De = (e, t, n) => {
165
- b.value?.focus({ preventScroll: !0 }), X.value = {
166
- row: e,
167
- col: t
168
- }, n.shiftKey || (Y.value = {
169
- row: e,
170
- col: t
171
- }), Q.value = !0;
172
- }, Oe = (e, t) => {
173
- Q.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 r = P.value.map((e) => e.row), i = j.value.map((e) => e.col), a = (e) => G.value.get(`${e.row},${e.col}`) ?? e, o = a(X.value), s = r.indexOf(X.value.row), c = i.indexOf(X.value.col), l = o;
189
- for (;;) {
190
- let e = Math.min(r.length - 1, Math.max(0, s + t[0])), n = Math.min(i.length - 1, Math.max(0, c + t[1]));
191
- if (e === s && n === c || (s = e, c = n, l = a({
192
- row: r[s],
193
- col: i[c]
194
- }), l.row !== o.row || l.col !== o.col)) break;
195
- }
196
- X.value = l, e.shiftKey || (Y.value = l), n(() => b.value?.querySelector("[data-focus]")?.scrollIntoView({
197
- block: "nearest",
198
- inline: "nearest"
199
- }));
200
- }, Ae = v(() => K(X.value.row, X.value.col)), $ = v(() => {
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 = K(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 ? q(s, a) : void 0,
211
- average: s ? q(s, a / o) : void 0
212
- };
213
- }), je = (e) => {
214
- p.value = Math.min(2, Math.max(.5, Math.round((p.value + e) * 10) / 10));
215
- };
216
- return (n, r) => {
217
- let i = re;
218
- return k(), O("div", ie, [
219
- g("div", ae, [
220
- g("span", {
221
- class: "pk-spreadsheet-preview__ref",
222
- "aria-label": D(a)("chatFilePreview.cell")
223
- }, x(E(X.value.col)) + x(X.value.row), 9, oe),
224
- r[6] ||= g("span", {
225
- class: "pk-spreadsheet-preview__fx",
226
- "aria-hidden": "true"
227
- }, "fx", -1),
228
- g("output", {
229
- class: "pk-spreadsheet-preview__formula",
230
- "aria-label": D(a)("chatFilePreview.formulaBar")
231
- }, x(xe(Ae.value)), 9, se)
232
- ]),
233
- g("div", {
234
- ref_key: "scrollEl",
235
- ref: b,
236
- class: "pk-spreadsheet-preview__scroll",
237
- tabindex: "0",
238
- role: "grid",
239
- "aria-label": w.value?.name,
240
- onKeydown: ke,
241
- onMouseup: r[2] ||= (e) => Q.value = !1,
242
- onMouseleave: r[3] ||= (e) => Q.value = !1
243
- }, [w.value ? (k(), O("table", {
244
- key: 0,
245
- class: t(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": w.value.gridlines }]),
246
- style: s({
247
- zoom: p.value,
248
- width: `${te.value}px`
249
- })
250
- }, [
251
- g("colgroup", null, [g("col", { style: s({ width: `${W}px` }) }, null, 4), (k(!0), O(h, null, d(j.value, (e) => (k(), O("col", {
252
- key: e.col,
253
- style: s({ width: `${e.width}px` })
254
- }, null, 4))), 128))]),
255
- g("thead", null, [g("tr", { style: s({ height: `${U}px` }) }, [r[7] ||= g("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (k(!0), O(h, null, d(j.value, (e) => (k(), O("th", {
256
- key: e.col,
257
- scope: "col",
258
- class: t(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Z.value.c1 && e.col <= Z.value.c2 }])
259
- }, x(E(e.col)), 3))), 128))], 4)]),
260
- g("tbody", null, [(k(!0), O(h, null, d(P.value, (e, n, r, i) => {
261
- let c = [
262
- e,
263
- w.value,
264
- M.value,
265
- D(o),
266
- Ee(e.row)
267
- ];
268
- if (i && i.el && i.key === e.row && y(i, c)) return i;
269
- let l = (k(), O("tr", {
270
- key: e.row,
271
- style: s({ height: `${e.height}px` })
272
- }, [g("th", {
273
- scope: "row",
274
- class: t(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Z.value.r1 && e.row <= Z.value.r2 }]),
275
- style: s(w.value.frozen && e.row <= w.value.frozen.rows ? {
276
- ...Ce(e.row, 0),
277
- left: 0,
278
- zIndex: 4
279
- } : void 0)
280
- }, x(e.row), 7), (k(!0), O(h, null, d(j.value, (n) => (k(), O(h, { key: n.col }, [G.value.has(`${e.row},${n.col}`) ? T("", !0) : (k(), O("td", {
281
- key: 0,
282
- rowspan: _e(e.row, n.col)?.rows,
283
- colspan: _e(e.row, n.col)?.cols,
284
- class: t(["pk-spreadsheet-preview__cell", {
285
- "pk-spreadsheet-preview__cell--range": we(e.row, n.col) && !Te(e.row, n.col),
286
- "pk-spreadsheet-preview__cell--missing": K(e.row, n.col)?.missing
287
- }]),
288
- style: s(Se(K(e.row, n.col), e.row, n.col)),
289
- "data-focus": Te(e.row, n.col) ? "" : void 0,
290
- title: K(e.row, n.col)?.missing ? D(a)("chatFilePreview.missingValue") : void 0,
291
- onMousedown: m((t) => De(e.row, n.col, t), ["prevent"]),
292
- onMouseenter: (t) => Oe(e.row, n.col)
293
- }, x(be(K(e.row, n.col))), 47, F))], 64))), 128))], 4));
294
- return l.memo = c, l;
295
- }, r, 0), 128))])
296
- ], 6)) : T("", !0), w.value && (w.value.moreRows || w.value.moreColumns) ? (k(), O("p", I, [w.value.moreRows ? (k(), O(h, { key: 0 }, [ee(x(D(a)("chatFilePreview.moreRows", w.value.moreRows)), 1)], 64)) : T("", !0), w.value.moreColumns ? (k(), O(h, { key: 1 }, [ee(x(D(a)("chatFilePreview.moreColumns", w.value.moreColumns)), 1)], 64)) : T("", !0)])) : T("", !0)], 40, ce),
297
- g("nav", {
298
- class: "pk-spreadsheet-preview__sheets",
299
- "aria-label": D(a)("chatFilePreview.sheets")
300
- }, [(k(!0), O(h, null, d(e.preview.sheets, (e, t) => (k(), O("button", {
301
- key: e.name,
302
- type: "button",
303
- class: "pk-spreadsheet-preview__sheet",
304
- "aria-current": t === u.value ? "page" : void 0,
305
- onClick: (e) => u.value = t
306
- }, x(e.name), 9, L))), 128))], 8, le),
307
- g("div", ue, [g("p", de, [e.preview.staleFormulas ? (k(), O("span", {
308
- key: 0,
309
- class: "pk-spreadsheet-preview__note",
310
- title: D(a)("chatFilePreview.staleFormulas")
311
- }, x(D(a)("chatFilePreview.staleFormulas")), 9, fe)) : e.preview.computedFormulas ? (k(), O("span", {
312
- key: 1,
313
- class: "pk-spreadsheet-preview__note",
314
- title: D(a)("chatFilePreview.computedFormulas")
315
- }, x(D(a)("chatFilePreview.computedFormulas")), 9, pe)) : T("", !0), $.value ? (k(), O("span", R, [
316
- $.value.average ? (k(), O("span", me, x(D(a)("chatFilePreview.average")) + " " + x($.value.average), 1)) : T("", !0),
317
- g("span", null, x(D(a)("chatFilePreview.count")) + " " + x($.value.count), 1),
318
- $.value.sum ? (k(), O("span", z, x(D(a)("chatFilePreview.sum")) + " " + x($.value.sum), 1)) : T("", !0)
319
- ])) : T("", !0)]), g("div", B, [
320
- l(i, {
321
- modifiers: "action-quiet",
322
- icon: "ri:subtract-line",
323
- "aria-label": D(a)("chatFilePreview.zoomOut"),
324
- disabled: p.value <= .5,
325
- onClick: r[4] ||= (e) => je(-.1)
326
- }, null, 8, ["aria-label", "disabled"]),
327
- g("span", he, x(Math.round(p.value * 100)) + "% ", 1),
328
- l(i, {
329
- modifiers: "action-quiet",
330
- icon: "ri:add-line",
331
- "aria-label": D(a)("chatFilePreview.zoomIn"),
332
- disabled: p.value >= 2,
333
- onClick: r[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
- b(), S(), u();
342
- var G = {
343
- key: 0,
344
- class: "pk-word-preview__image"
345
- }, K = ["title"], _e = ["title"], ve = /* @__PURE__ */ E({
346
- __name: "PkWordPreviewRuns",
347
- props: {
348
- runs: { type: Array },
349
- mode: { type: String }
350
- },
351
- setup(e) {
352
- let t = e, { t: n } = A({ useScope: "global" }), r = v(() => t.runs.filter((e) => t.mode === "accepted" ? e.change !== "deleted" : t.mode !== "original" || e.change !== "inserted")), i = v(() => !t.mode || t.mode === "markup"), a = (e) => {
353
- let t = {};
354
- e.font && (t.fontFamily = te(e.font)), e.size && (t.fontSize = `${e.size}pt`), e.color && (t.color = e.color), e.highlight && (t.backgroundColor = e.highlight), e.bold && (t.fontWeight = 700), e.italic && (t.fontStyle = "italic");
355
- let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
356
- return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
357
- }, o = (e) => {
358
- let t = a(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
359
- return n.add(e.change === "deleted" ? "line-through" : "underline"), {
360
- ...t,
361
- textDecoration: [...n].join(" ")
362
- };
363
- }, c = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
364
- return (e, t) => (k(!0), O(h, null, d(r.value, (e, t) => (k(), O(h, { key: t }, [e.image ? (k(), O("span", G, x(D(n)("chatFilePreview.image")), 1)) : i.value && e.change === "deleted" ? (k(), O("del", {
365
- key: 1,
366
- class: "pk-word-preview__removed",
367
- style: s(o(e)),
368
- title: c(e)
369
- }, x(e.text), 13, K)) : i.value && e.change === "inserted" ? (k(), O("ins", {
370
- key: 2,
371
- class: "pk-word-preview__added",
372
- style: s(o(e)),
373
- title: c(e)
374
- }, x(e.text), 13, _e)) : (k(), O("span", {
375
- key: 3,
376
- style: s(a(e))
377
- }, x(e.text), 5))], 64))), 128));
378
- }
379
- });
380
- // ../../packages/components/src/chat/PkWordPreviewBlock.vue?vue&type=script&setup=true&lang.ts
381
- b(), u();
382
- var q = { key: 0 }, ye = ["colspan"], be = ["role", "aria-level"], xe = { key: 1 }, J = /* @__PURE__ */ E({
383
- __name: "PkWordPreviewBlock",
384
- props: {
385
- block: { type: null },
386
- row: { type: Number },
387
- mode: { type: String }
388
- },
389
- setup(e) {
390
- let n = e, r = v(() => {
391
- if (n.block.kind === "table") return {};
392
- let e = n.block.style ?? {};
393
- return {
394
- textAlign: e.align,
395
- paddingLeft: e.indentLeft ? `${e.indentLeft}pt` : void 0,
396
- paddingRight: e.indentRight ? `${e.indentRight}pt` : void 0,
397
- textIndent: e.firstLine ? `${e.firstLine}pt` : void 0,
398
- paddingTop: e.spaceBefore ? `${e.spaceBefore}pt` : void 0,
399
- paddingBottom: e.spaceAfter ? `${e.spaceAfter}pt` : void 0,
400
- lineHeight: e.lineExact ? `${e.lineExact}pt` : e.lineAtLeast ? `max(calc(var(--pk-word-line, 1.17) * 1em), ${e.lineAtLeast}pt)` : `calc(var(--pk-word-line, 1.17) * ${e.lineHeight ?? 1})`,
401
- backgroundColor: e.shading
402
- };
403
- }), i = v(() => {
404
- if (n.block.kind === "table") return {};
405
- let e = -(n.block.style?.firstLine ?? 0);
406
- return e > 0 ? { minWidth: `${e}pt` } : { paddingRight: "6pt" };
407
- }), a = v(() => n.mode === "markup" && n.block.kind !== "table" && n.block.runs.some((e) => e.change)), o = v(() => n.block.kind === "table" && n.row !== void 0 ? n.block.rows[n.row] : void 0), c = v(() => {
408
- if (n.block.kind !== "table") return [];
409
- let e = n.block.widths ?? [], t = e.reduce((e, t) => e + t, 0);
410
- return t ? e.map((e) => `${e / t * 100}%`) : [];
411
- }), u = v(() => n.mode === "markup" && !!o.value?.some((e) => e.runs.some((e) => e.change)));
412
- return (n, f) => e.block.kind === "table" && o.value ? (k(), O("table", {
413
- key: 0,
414
- class: t(["pk-word-preview__table", {
415
- "pk-word-preview__table--lines": e.block.borders,
416
- "pk-word-preview__table--next": e.row !== 0,
417
- "pk-word-preview__changed": u.value
418
- }])
419
- }, [c.value.length ? (k(), O("colgroup", q, [(k(!0), O(h, null, d(c.value, (e, t) => (k(), O("col", {
420
- key: t,
421
- style: s({ width: e })
422
- }, null, 4))), 128))])) : T("", !0), g("tbody", null, [g("tr", null, [(k(!0), O(h, null, d(o.value, (t, n) => (k(), O("td", {
423
- key: n,
424
- colspan: t.span,
425
- style: s({
426
- backgroundColor: t.fill,
427
- textAlign: t.align
428
- })
429
- }, [l(ve, {
430
- runs: t.runs,
431
- mode: e.mode
432
- }, null, 8, ["runs", "mode"])], 12, ye))), 128))])])], 2)) : e.block.kind === "table" ? T("", !0) : (k(), O("div", {
433
- key: 1,
434
- class: t(["pk-word-preview__block", { "pk-word-preview__changed": a.value }]),
435
- role: e.block.kind === "heading" ? "heading" : void 0,
436
- "aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
437
- style: s(r.value)
438
- }, [
439
- e.block.label ? (k(), O("span", {
440
- key: 0,
441
- class: "pk-word-preview__label",
442
- style: s(i.value)
443
- }, x(e.block.label), 5)) : T("", !0),
444
- l(ve, {
445
- runs: e.block.runs,
446
- mode: e.mode
447
- }, null, 8, ["runs", "mode"]),
448
- !e.block.label && !e.block.runs.length ? (k(), O("br", xe)) : T("", !0)
449
- ], 14, be));
450
- }
451
- });
452
- // ../../packages/components/src/chat/PkWordPreview.vue?vue&type=script&setup=true&lang.ts
453
- b(), S(), u();
454
- var Se = ["aria-label"], Ce = {
455
- class: "pk-word-preview__tabs",
456
- role: "tablist"
457
- }, Y = ["aria-selected"], X = ["aria-selected"], Z = {
458
- key: 0,
459
- class: "pk-word-preview__list"
460
- }, we = ["aria-current", "onClick"], Te = { class: "pk-word-preview__entry-text" }, Ee = {
461
- key: 0,
462
- class: "u-dot"
463
- }, Q = {
464
- key: 0,
465
- class: "pk-word-preview__none"
466
- }, De = {
467
- key: 1,
468
- class: "pk-word-preview__list"
469
- }, Oe = ["onClick"], ke = {
470
- key: 0,
471
- class: "pk-word-preview__removed"
472
- }, Ae = {
473
- key: 1,
474
- class: "pk-word-preview__added"
475
- }, $ = { class: "pk-word-preview__main" }, je = ["aria-label"], Me = {
476
- key: 2,
477
- class: "pk-word-preview__truncated"
478
- }, Ne = { class: "pk-word-preview__status" }, Pe = {
479
- key: 0,
480
- class: "pk-word-preview__count"
481
- }, Fe = { class: "pk-word-preview__count" }, Ie = {
482
- key: 1,
483
- class: "pk-word-preview__legend"
484
- }, Le = ["title"], Re = { class: "pk-word-preview__removed" }, ze = { class: "pk-word-preview__added" }, Be = { class: "pk-word-preview__percent" }, Ve = 96 / 72, He = /*#__PURE__*/ N(/* @__PURE__ */ E({
485
- __name: "PkWordPreview",
486
- props: /*@__PURE__*/ o({
487
- preview: { type: null },
488
- mode: { type: String }
489
- }, {
490
- fit: {
491
- type: Boolean,
492
- default: !0
493
- },
494
- fitModifiers: {},
495
- zoom: { default: 1 },
496
- zoomModifiers: {}
497
- }),
498
- emits: ["update:fit", "update:zoom"],
499
- setup(e) {
500
- let o = e, { t: u } = A({ useScope: "global" }), m = (e) => e.filter((e) => o.mode === "accepted" ? e.change !== "deleted" : o.mode !== "original" || e.change !== "inserted"), y = (e) => e.some((e) => e.image || e.text.trim()), b = v(() => {
501
- let e = [];
502
- return o.preview.blocks.forEach((t, n) => {
503
- if (t.kind === "table") {
504
- let r = !0;
505
- t.rows.forEach((i, a) => {
506
- (!i.some((e) => e.runs.length) || i.some((e) => y(m(e.runs)))) && (e.push({
507
- key: `${n}:${a}`,
508
- block: n,
509
- row: a,
510
- breakBefore: r && !!t.pageBreakBefore
511
- }), r = !1);
512
- });
513
- } else (!t.runs.length || y(m(t.runs))) && e.push({
514
- key: `${n}`,
515
- block: n,
516
- breakBefore: !!t.style?.pageBreakBefore
517
- });
518
- }), e;
519
- }), S = f("rootEl"), C = f("scrollEl"), w = f("measureEl"), { width: E } = ne(S), { width: ee } = ne(C), M = v(() => E.value === 0 || E.value >= 640), N = v(() => E.value >= 1e3), P = v(() => o.preview.page), ie = v(() => ({
520
- fontFamily: te(o.preview.defaults.font),
521
- fontSize: `${o.preview.defaults.size}pt`,
522
- color: o.preview.defaults.color ?? "#000000",
523
- "--pk-word-line": j(o.preview.defaults.font)
524
- })), ae = v(() => ({
525
- ...ie.value,
526
- width: `${P.value.width}pt`,
527
- minHeight: `${P.value.height}pt`,
528
- padding: `${P.value.margins.top}pt ${P.value.margins.right}pt ${P.value.margins.bottom}pt ${P.value.margins.left}pt`
529
- })), oe = v(() => ({
530
- ...ie.value,
531
- width: `${P.value.width - P.value.margins.left - P.value.margins.right}pt`
532
- })), se = _([]), ce = async () => {
533
- await n();
534
- let e = w.value?.querySelectorAll("[data-item]");
535
- se.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
536
- };
537
- c([b, M], ce, { flush: "post" }), a(() => {
538
- ce(), document.fonts?.ready.then(ce);
539
- });
540
- let F = v(() => {
541
- let e = b.value.map((e, t) => t);
542
- if (!M.value || se.value.length !== b.value.length) return [e];
543
- let t = (P.value.height - P.value.margins.top - P.value.margins.bottom) * Ve, n = [[]], r = 0;
544
- return b.value.forEach((e, i) => {
545
- let a = se.value[i];
546
- n[n.length - 1].length && (e.breakBefore || r + a > t) && (n.push([]), r = 0), n[n.length - 1].push(i), r += a;
547
- }), n;
548
- }), I = i(e, "fit"), le = i(e, "zoom"), L = v(() => I.value ? Math.min(1.25, Math.max(.3, (ee.value - 48) / (P.value.width * Ve))) : le.value), ue = (e) => {
549
- le.value = Math.min(2, Math.max(.3, Math.round((L.value + e) * 10) / 10)), I.value = !1;
550
- }, de = _(0), fe = _(), pe = () => {
551
- let e = C.value?.getBoundingClientRect();
552
- if (!e) return;
553
- let t = C.value?.querySelectorAll("[data-page]") ?? [], n = 0;
554
- for (let [r, i] of [...t].entries()) {
555
- if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
556
- n = r;
557
- }
558
- de.value = n;
559
- let r;
560
- for (let t of B.value) {
561
- let n = C.value?.querySelector(`[data-key="${t.key}"]`);
562
- if (n) {
563
- if (n.getBoundingClientRect().top - e.top > 48) break;
564
- r = t.key;
565
- }
566
- }
567
- fe.value = r ?? B.value[0]?.key;
568
- }, R = 0, me = () => {
569
- R ||= requestAnimationFrame(() => {
570
- R = 0, pe();
571
- });
572
- };
573
- r(() => cancelAnimationFrame(R)), c(F, () => n(me));
574
- let z = (e) => m(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), B = v(() => b.value.flatMap((e) => {
575
- let t = o.preview.blocks[e.block];
576
- return t.kind === "heading" && t.level <= 3 ? [{
577
- key: e.key,
578
- level: t.level,
579
- text: [t.label, z(t.runs)].filter(Boolean).join(" ")
580
- }] : [];
581
- })), he = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, V = v(() => b.value.flatMap((e) => {
582
- let t = o.preview.blocks[e.block], n = t.kind === "table" ? (t.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : t.runs, r = n.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), i = n.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
583
- return r || i ? [{
584
- key: e.key,
585
- removed: he(r),
586
- added: he(i)
587
- }] : [];
588
- })), H = _("outline"), U = _(!1), W = (e) => {
589
- C.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
590
- block: "start",
591
- behavior: "smooth"
592
- }), N.value || (U.value = !1);
593
- }, ge = v(() => o.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => z(e.runs)) : [z(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), G = v(() => o.preview.revisionAuthors.join(", "));
594
- return (n, r) => {
595
- let i = re;
596
- return k(), O("div", {
597
- ref_key: "rootEl",
598
- ref: S,
599
- class: t(["pk-word-preview", { "pk-word-preview--paged": M.value }])
600
- }, [
601
- (N.value || U.value) && (B.value.length || V.value.length) ? (k(), O("aside", {
602
- key: 0,
603
- class: t(["pk-word-preview__side", { "pk-word-preview__side--over": !N.value }]),
604
- "aria-label": D(u)("chatFilePreview.outline")
605
- }, [g("div", Ce, [g("button", {
606
- type: "button",
607
- role: "tab",
608
- class: "pk-word-preview__tab",
609
- "aria-selected": H.value === "outline",
610
- onClick: r[0] ||= (e) => H.value = "outline"
611
- }, x(D(u)("chatFilePreview.outline")), 9, Y), V.value.length ? (k(), O("button", {
612
- key: 0,
613
- type: "button",
614
- role: "tab",
615
- class: "pk-word-preview__tab",
616
- "aria-selected": H.value === "changes",
617
- onClick: r[1] ||= (e) => H.value = "changes"
618
- }, x(D(u)("chatFilePreview.changes", { count: V.value.length })), 9, X)) : T("", !0)]), H.value === "outline" || !V.value.length ? (k(), O("nav", Z, [(k(!0), O(h, null, d(B.value, (e) => (k(), O("button", {
619
- key: e.key,
620
- type: "button",
621
- class: t(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
622
- "aria-current": fe.value === e.key ? "location" : void 0,
623
- onClick: (t) => W(e.key)
624
- }, [g("span", Te, x(e.text), 1), V.value.some((t) => t.key === e.key) ? (k(), O("span", Ee)) : T("", !0)], 10, we))), 128)), B.value.length ? T("", !0) : (k(), O("p", Q, x(D(u)("chatFilePreview.noHeadings")), 1))])) : (k(), O("nav", De, [(k(!0), O(h, null, d(V.value, (e) => (k(), O("button", {
625
- key: e.key,
626
- type: "button",
627
- class: "pk-word-preview__entry pk-word-preview__entry--change",
628
- onClick: (t) => W(e.key)
629
- }, [e.removed ? (k(), O("del", ke, x(e.removed), 1)) : T("", !0), e.added ? (k(), O("ins", Ae, x(e.added), 1)) : T("", !0)], 8, Oe))), 128))]))], 10, Se)) : T("", !0),
630
- g("div", $, [g("div", {
631
- ref_key: "scrollEl",
632
- ref: C,
633
- class: "pk-word-preview__scroll",
634
- onScroll: me
635
- }, [M.value ? (k(), O("div", {
636
- key: 0,
637
- class: "pk-word-preview__pages",
638
- style: s({ zoom: L.value })
639
- }, [(k(!0), O(h, null, d(F.value, (t, n) => (k(), O("article", {
640
- key: n,
641
- "data-page": "",
642
- class: "pk-word-preview__page",
643
- "aria-label": D(u)("chatFilePreview.pageOf", {
644
- page: n + 1,
645
- count: F.value.length
646
- }),
647
- style: s(ae.value)
648
- }, [(k(!0), O(h, null, d(t, (t) => (k(), p(J, {
649
- key: b.value[t].key,
650
- "data-key": b.value[t].key,
651
- block: e.preview.blocks[b.value[t].block],
652
- row: b.value[t].row,
653
- mode: e.mode
654
- }, null, 8, [
655
- "data-key",
656
- "block",
657
- "row",
658
- "mode"
659
- ]))), 128))], 12, je))), 128))], 4)) : (k(), O("article", {
660
- key: 1,
661
- class: "pk-word-preview__page pk-word-preview__page--flow",
662
- style: s(ie.value)
663
- }, [(k(!0), O(h, null, d(b.value, (t) => (k(), p(J, {
664
- key: t.key,
665
- "data-key": t.key,
666
- block: e.preview.blocks[t.block],
667
- row: t.row,
668
- mode: e.mode
669
- }, null, 8, [
670
- "data-key",
671
- "block",
672
- "row",
673
- "mode"
674
- ]))), 128))], 4)), e.preview.truncated ? (k(), O("p", Me, x(D(u)("chatFilePreview.truncated")), 1)) : T("", !0)], 544), g("div", Ne, [
675
- M.value ? (k(), O("span", Pe, x(D(u)("chatFilePreview.pageOf", {
676
- page: de.value + 1,
677
- count: F.value.length
678
- })), 1)) : T("", !0),
679
- g("span", Fe, x(D(u)("chatFilePreview.words", ge.value)), 1),
680
- e.mode === "markup" && e.preview.revisionAuthors.length ? (k(), O("span", Ie, [
681
- g("span", {
682
- class: "pk-word-preview__legend-text",
683
- title: D(u)("chatFilePreview.revisionsOf", { authors: G.value })
684
- }, x(D(u)("chatFilePreview.revisionsOf", { authors: G.value })), 9, Le),
685
- g("del", Re, x(D(u)("chatFilePreview.removed")), 1),
686
- g("ins", ze, x(D(u)("chatFilePreview.added")), 1)
687
- ])) : T("", !0),
688
- r[6] ||= g("span", { class: "pk-word-preview__spacer" }, null, -1),
689
- !N.value && (B.value.length || V.value.length) ? (k(), p(i, {
690
- key: 2,
691
- class: "pk-word-preview__outline-toggle",
692
- modifiers: "action-quiet",
693
- icon: "ri:list-unordered",
694
- label: D(u)("chatFilePreview.outline"),
695
- title: D(u)("chatFilePreview.outline"),
696
- "aria-label": D(u)("chatFilePreview.outline"),
697
- "aria-expanded": U.value,
698
- onClick: r[2] ||= (e) => U.value = !U.value
699
- }, null, 8, [
700
- "label",
701
- "title",
702
- "aria-label",
703
- "aria-expanded"
704
- ])) : T("", !0),
705
- M.value ? (k(), O(h, { key: 3 }, [
706
- l(i, {
707
- modifiers: "action-quiet",
708
- label: D(u)("chatFilePreview.fitWidth"),
709
- disabled: I.value,
710
- onClick: r[3] ||= (e) => I.value = !0
711
- }, null, 8, ["label", "disabled"]),
712
- l(i, {
713
- modifiers: "action-quiet",
714
- icon: "ri:subtract-line",
715
- "aria-label": D(u)("chatFilePreview.zoomOut"),
716
- disabled: L.value <= .3,
717
- onClick: r[4] ||= (e) => ue(-.1)
718
- }, null, 8, ["aria-label", "disabled"]),
719
- g("span", Be, x(Math.round(L.value * 100)) + "% ", 1),
720
- l(i, {
721
- modifiers: "action-quiet",
722
- icon: "ri:add-line",
723
- "aria-label": D(u)("chatFilePreview.zoomIn"),
724
- disabled: L.value >= 2,
725
- onClick: r[5] ||= (e) => ue(.1)
726
- }, null, 8, ["aria-label", "disabled"])
727
- ], 64)) : T("", !0)
728
- ])]),
729
- M.value ? (k(), O("div", {
730
- key: 1,
731
- ref_key: "measureEl",
732
- ref: w,
733
- class: "pk-word-preview__measure",
734
- "aria-hidden": "true",
735
- style: s(oe.value)
736
- }, [(k(!0), O(h, null, d(b.value, (t) => (k(), O("div", {
737
- key: t.key,
738
- "data-item": ""
739
- }, [l(J, {
740
- block: e.preview.blocks[t.block],
741
- row: t.row,
742
- mode: e.mode
743
- }, null, 8, [
744
- "block",
745
- "row",
746
- "mode"
747
- ])]))), 128))], 4)) : T("", !0)
748
- ], 2);
749
- };
750
- }
751
- }), [["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{box-sizing:border-box;line-height:var(--pk-word-line,1.17);overflow-wrap:break-word;background-color:#fff;position:relative;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;position:relative}.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}"]]]);
752
- // ../../packages/components/src/chat/PkFilePreview.vue?vue&type=script&setup=true&lang.ts
753
- b(), u(), S();
754
- var Ue = ["aria-label"], We = { class: "pk-file-preview__head" }, Ge = { class: "pk-file-preview__file" }, Ke = {
755
- class: "pk-file-preview__tile",
756
- "aria-hidden": "true"
757
- }, qe = { class: "pk-file-preview__name" }, Je = { class: "pk-file-preview__title" }, Ye = { class: "pk-file-preview__note" }, Xe = {
758
- key: 0,
759
- class: "pk-file-preview__tools"
760
- }, Ze = ["aria-label"], Qe = { class: "pk-file-preview__version" }, $e = { class: "pk-file-preview__mode-long" }, et = { class: "pk-file-preview__mode-short" }, tt = { class: "pk-file-preview__actions" }, nt = { class: "pk-file-preview__body" }, rt = {
761
- key: 0,
762
- class: "pk-file-preview__skeleton vv-skeleton"
763
- }, it = {
764
- key: 1,
765
- class: "pk-file-preview__empty"
766
- }, at = /*@__PURE__*/ E({
767
- __name: "PkFilePreview",
768
- props: /*@__PURE__*/ o({
769
- kind: { type: String },
770
- filename: { type: String },
771
- version: { type: Number },
772
- versions: { type: Array },
773
- downloadUrl: { type: String },
774
- preview: { type: null },
775
- loading: { type: Boolean },
776
- error: { type: Boolean },
777
- restorable: { type: Boolean },
778
- resize: { type: String }
779
- }, {
780
- mode: { default: "markup" },
781
- modeModifiers: {},
782
- sheet: { default: 0 },
783
- sheetModifiers: {},
784
- zoom: { default: 1 },
785
- zoomModifiers: {},
786
- fit: {
787
- type: Boolean,
788
- default: !0
789
- },
790
- fitModifiers: {}
791
- }),
792
- emits: /*@__PURE__*/ o([
793
- "close",
794
- "version",
795
- "restore",
796
- "resize"
797
- ], [
798
- "update:mode",
799
- "update:sheet",
800
- "update:zoom",
801
- "update:fit"
802
- ]),
803
- setup(e, { emit: n }) {
804
- let r = e, a = n, { t: o } = A({ useScope: "global" }), s = v(() => r.versions ?? []), u = v(() => r.version ? s.value.indexOf(r.version) : -1), f = v(() => u.value > 0 ? s.value[u.value - 1] : void 0), m = v(() => u.value >= 0 && u.value < s.value.length - 1 ? s.value[u.value + 1] : void 0), _ = i(e, "mode"), y = i(e, "sheet"), b = i(e, "zoom"), S = i(e, "fit"), C = v(() => [
805
- {
806
- value: "markup",
807
- label: o("chatFilePreview.modeMarkup")
808
- },
809
- {
810
- value: "accepted",
811
- label: o("chatFilePreview.modeAccepted")
812
- },
813
- {
814
- value: "original",
815
- label: o("chatFilePreview.modeOriginal")
816
- }
817
- ]), E = v(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
818
- return c(() => r.version, () => {
819
- _.value = "markup";
820
- }), (n, r) => {
821
- let i = M, c = re;
822
- return k(), O("section", {
823
- class: "pk-file-preview",
824
- "aria-label": e.filename,
825
- tabindex: "-1",
826
- autofocus: ""
827
- }, [g("header", We, [
828
- g("div", Ge, [g("span", Ke, [l(i, {
829
- name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
830
- class: t(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
831
- }, null, 8, ["name", "class"])]), g("div", qe, [g("strong", Je, x(e.filename), 1), g("span", Ye, x(D(o)("chatFilePreview.readOnly")), 1)])]),
832
- e.version && s.value.length > 1 || E.value ? (k(), O("div", Xe, [e.version && s.value.length > 1 ? (k(), O("nav", {
833
- key: 0,
834
- class: "pk-file-preview__versions",
835
- "aria-label": D(o)("chatFilePreview.versions")
836
- }, [
837
- l(c, {
838
- modifiers: "action-quiet",
839
- icon: "ri:arrow-left-s-line",
840
- "aria-label": D(o)("chatFilePreview.previousVersion"),
841
- disabled: !f.value,
842
- onClick: r[0] ||= (e) => f.value && a("version", f.value)
843
- }, null, 8, ["aria-label", "disabled"]),
844
- g("span", Qe, x(D(o)("chatFilePreview.versionOf", {
845
- version: e.version,
846
- count: s.value.length
847
- })), 1),
848
- l(c, {
849
- modifiers: "action-quiet",
850
- icon: "ri:arrow-right-s-line",
851
- "aria-label": D(o)("chatFilePreview.nextVersion"),
852
- disabled: !m.value,
853
- onClick: r[1] ||= (e) => m.value && a("version", m.value)
854
- }, null, 8, ["aria-label", "disabled"])
855
- ], 8, Ze)) : T("", !0), E.value ? (k(), p(P, {
856
- key: 1,
857
- modelValue: _.value,
858
- "onUpdate:modelValue": r[2] ||= (e) => _.value = e,
859
- name: "revisions",
860
- segmented: "",
861
- class: "pk-file-preview__modes u-segmented-fit mb-0",
862
- "aria-label": D(o)("chatFilePreview.modes"),
863
- options: C.value
864
- }, {
865
- markup: w(() => [g("span", $e, x(D(o)("chatFilePreview.modeMarkup")), 1), g("span", et, x(D(o)("chatFilePreview.modeMarkupShort")), 1)]),
866
- _: 1
867
- }, 8, [
868
- "modelValue",
869
- "aria-label",
870
- "options"
871
- ])) : T("", !0)])) : T("", !0),
872
- g("div", tt, [
873
- e.restorable ? (k(), p(c, {
874
- key: 0,
875
- modifiers: "action-quiet",
876
- icon: "ri:arrow-go-back-line",
877
- label: D(o)("chatFilePreview.restore"),
878
- onClick: r[3] ||= (e) => a("restore")
879
- }, null, 8, ["label"])) : T("", !0),
880
- l(c, {
881
- href: e.downloadUrl,
882
- download: "",
883
- modifiers: "action-quiet",
884
- icon: "ri:download-line",
885
- title: D(o)("chatFilePreview.download"),
886
- "aria-label": D(o)("chatFilePreview.download")
887
- }, null, 8, [
888
- "href",
889
- "title",
890
- "aria-label"
891
- ]),
892
- e.resize === "expand" ? (k(), p(c, {
893
- key: 1,
894
- modifiers: "action-quiet",
895
- icon: "ri:fullscreen-line",
896
- title: D(o)("chatFilePreview.expand"),
897
- "aria-label": D(o)("chatFilePreview.expand"),
898
- onClick: r[4] ||= (e) => a("resize")
899
- }, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (k(), p(c, {
900
- key: 2,
901
- modifiers: "action-quiet",
902
- icon: "ri:fullscreen-exit-line",
903
- title: D(o)("chatFilePreview.shrink"),
904
- "aria-label": D(o)("chatFilePreview.shrink"),
905
- onClick: r[5] ||= (e) => a("resize")
906
- }, null, 8, ["title", "aria-label"])) : T("", !0),
907
- l(c, {
908
- modifiers: "action-quiet",
909
- icon: "ri:close-line",
910
- title: D(o)("chatFilePreview.close"),
911
- "aria-label": D(o)("chatFilePreview.close"),
912
- onClick: r[6] ||= (e) => a("close")
913
- }, null, 8, ["title", "aria-label"])
914
- ])
915
- ]), g("div", nt, [e.loading ? (k(), O("div", rt, [(k(), O(h, null, d(8, (e) => g("div", {
916
- key: e,
917
- class: t(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
918
- }, null, 2)), 64))])) : e.error || !e.preview ? (k(), O("p", it, x(D(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (k(), p(He, {
919
- key: 2,
920
- zoom: b.value,
921
- "onUpdate:zoom": r[7] ||= (e) => b.value = e,
922
- fit: S.value,
923
- "onUpdate:fit": r[8] ||= (e) => S.value = e,
924
- preview: e.preview,
925
- mode: E.value ? _.value : "markup"
926
- }, null, 8, [
927
- "zoom",
928
- "fit",
929
- "preview",
930
- "mode"
931
- ])) : (k(), p(ge, {
932
- key: 3,
933
- sheet: y.value,
934
- "onUpdate:sheet": r[9] ||= (e) => y.value = e,
935
- zoom: b.value,
936
- "onUpdate:zoom": r[10] ||= (e) => b.value = e,
937
- preview: e.preview
938
- }, null, 8, [
939
- "sheet",
940
- "zoom",
941
- "preview"
942
- ]))])], 8, Ue);
943
- };
944
- }
945
- }), ot = ".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__*/ N(at, [["styles", [ot]]]);
946
- export { st as n, ct as t };
947
-
948
- //# sourceMappingURL=PkFilePreview-Bcdfci6i.js.map