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