@8wave/ai-elements 0.125.0-beta.14 → 0.125.0-beta.16
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.
- package/dist/_chunks/{PkFilePreview-rAHDDtGS.js → PkFilePreview-8nVPKv8k.js} +348 -320
- package/dist/_chunks/PkFilePreview-8nVPKv8k.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-BBFrC_rn.js → PkFilePreviewDialog-BHPcGlnF.js} +6 -3
- package/dist/_chunks/PkFilePreviewDialog-BHPcGlnF.js.map +1 -0
- package/dist/ai-elements.es.js +115 -115
- package/dist/ai-elements.es.js.map +1 -1
- package/dist-vue/PkChatbot.js +1 -1
- package/dist-vue/PkChatbotViewChat.js +1 -1
- package/dist-vue/_chunks/{PkChatbot-D48q-ulR.js → PkChatbot-Bpo22_yE.js} +2 -2
- package/dist-vue/_chunks/{PkChatbot-D48q-ulR.js.map → PkChatbot-Bpo22_yE.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-lLX_msKI.js → PkChatbotViewChat-Drp0At_n.js} +284 -284
- package/dist-vue/_chunks/PkChatbotViewChat-Drp0At_n.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreview-Ac_8QIBX.js → PkFilePreview-z7JcRtjP.js} +527 -499
- package/dist-vue/_chunks/PkFilePreview-z7JcRtjP.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-DGBaeZ8y.js → PkFilePreviewDialog-zVon3aPY.js} +6 -3
- package/dist-vue/_chunks/PkFilePreviewDialog-zVon3aPY.js.map +1 -0
- package/dist-vue/index.js +3 -3
- package/dist-vue/packages/components/src/chat/PkFilePreviewDialog.d.ts +2 -2
- package/dist-vue/style.css +1 -1
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-rAHDDtGS.js.map +0 -1
- package/dist/_chunks/PkFilePreviewDialog-BBFrC_rn.js.map +0 -1
- package/dist-vue/_chunks/PkChatbotViewChat-lLX_msKI.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-Ac_8QIBX.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreviewDialog-DGBaeZ8y.js.map +0 -1
|
@@ -3,13 +3,13 @@ import { t } from "./PkEditorRadioButtons-Bw576DPQ.js";
|
|
|
3
3
|
import { i as n, n as r, r as i } from "./excelNumberFormat-C1sCQrOz.js";
|
|
4
4
|
import { t as a } from "./VvButtonLocalized-C-vx25u4.js";
|
|
5
5
|
import { G as o, H as s, J as c, K as l, R as u, U as d, V as f, W as p, o as m, q as h } from "./utils-8lO2Gj-m.js";
|
|
6
|
-
import { VvIcon as
|
|
7
|
-
import { Fragment as
|
|
6
|
+
import { VvIcon as g } from "@volverjs/ui-vue/components";
|
|
7
|
+
import { Fragment as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as w, defineComponent as T, inject as E, isMemoSame as D, mergeModels as O, nextTick as ee, normalizeClass as k, normalizeStyle as A, onBeforeUnmount as j, onMounted as te, onScopeDispose as M, openBlock as N, provide as P, ref as F, renderList as I, renderSlot as L, shallowRef as R, toDisplayString as z, unref as B, useModel as V, useTemplateRef as ne, vModelText as H, watch as U, withCtx as re, withDirectives as ie, withKeys as ae, withModifiers as W } from "vue";
|
|
8
8
|
import { useI18n as oe } from "vue-i18n";
|
|
9
|
-
import { useElementSize as se, useEventListener as
|
|
9
|
+
import { useElementSize as se, useEventListener as ce } from "@vueuse/core";
|
|
10
10
|
// ../../packages/composable/src/useSettledSelection.ts
|
|
11
|
-
var
|
|
12
|
-
function
|
|
11
|
+
var le = "(hover: hover) and (pointer: fine)";
|
|
12
|
+
function ue(e) {
|
|
13
13
|
let t = document.getSelection();
|
|
14
14
|
if (!t || t.rangeCount === 0) return;
|
|
15
15
|
if (e.nodeType === Node.DOCUMENT_NODE) return t.getRangeAt(0).cloneRange();
|
|
@@ -29,13 +29,13 @@ function ce(e) {
|
|
|
29
29
|
let r = n.getSelection?.();
|
|
30
30
|
return r && r.rangeCount > 0 ? r.getRangeAt(0).cloneRange() : void 0;
|
|
31
31
|
}
|
|
32
|
-
function
|
|
33
|
-
let i =
|
|
32
|
+
function de({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 }) {
|
|
33
|
+
let i = R(), a, o = () => {
|
|
34
34
|
clearTimeout(a), i.value = void 0;
|
|
35
35
|
}, s = () => {
|
|
36
36
|
let n = e();
|
|
37
37
|
if (!n || !t()) return;
|
|
38
|
-
let i =
|
|
38
|
+
let i = ue(n);
|
|
39
39
|
if (!i || i.collapsed || i.toString().trim().length < r) return;
|
|
40
40
|
let a = i.getBoundingClientRect();
|
|
41
41
|
return {
|
|
@@ -48,7 +48,7 @@ function le({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 })
|
|
|
48
48
|
i.value = s();
|
|
49
49
|
}, n);
|
|
50
50
|
};
|
|
51
|
-
return typeof document < "u" && typeof matchMedia == "function" && matchMedia(
|
|
51
|
+
return typeof document < "u" && typeof matchMedia == "function" && matchMedia(le).matches && (document.addEventListener("selectionchange", c), M(() => {
|
|
52
52
|
clearTimeout(a), document.removeEventListener("selectionchange", c);
|
|
53
53
|
})), {
|
|
54
54
|
selection: i,
|
|
@@ -56,26 +56,26 @@ function le({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2 })
|
|
|
56
56
|
};
|
|
57
57
|
}
|
|
58
58
|
// ../../packages/components/src/chat/fileSelection.ts
|
|
59
|
-
var
|
|
60
|
-
let t = [...new Set(e)].sort((e, t) =>
|
|
59
|
+
var G = 2e3, fe = 1e3, K = 60, q = 1400, pe = 20, me = (e) => Number(e.slice(1)), he = (e) => {
|
|
60
|
+
let t = [...new Set(e)].sort((e, t) => me(e) - me(t)), n = [];
|
|
61
61
|
for (let e of t) {
|
|
62
62
|
let t = n[n.length - 1];
|
|
63
|
-
t &&
|
|
63
|
+
t && me(e) === me(t.to) + 1 ? t.to = e : n.push({
|
|
64
64
|
from: e,
|
|
65
65
|
to: e
|
|
66
66
|
});
|
|
67
67
|
}
|
|
68
68
|
return n.slice(0, 100);
|
|
69
|
-
},
|
|
69
|
+
}, ge = (e, t) => {
|
|
70
70
|
let n = [];
|
|
71
71
|
for (let r = e.indexOf(t); r >= 0;) n.push(r), r = e.indexOf(t, r + t.length);
|
|
72
72
|
return n;
|
|
73
|
-
},
|
|
74
|
-
let r =
|
|
73
|
+
}, _e = (e, t, n) => {
|
|
74
|
+
let r = ge(e, e.slice(t, t + n));
|
|
75
75
|
if (r.length < 2) return {};
|
|
76
76
|
let i = t, a = t + n;
|
|
77
|
-
for (let t = !0; a - i <=
|
|
78
|
-
if (
|
|
77
|
+
for (let t = !0; a - i <= q; t = !t) {
|
|
78
|
+
if (ge(e, e.slice(i, a)).length === 1) return { find: e.slice(i, a) };
|
|
79
79
|
if (t && i > 0) i = e.slice(0, i).replace(/\S*\s*$/, "").length;
|
|
80
80
|
else if (a < e.length) {
|
|
81
81
|
let t = e.slice(a).match(/^\s*\S*/)?.[0] ?? "";
|
|
@@ -86,17 +86,17 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
86
86
|
index: r.indexOf(t) + 1 || 1,
|
|
87
87
|
of: r.length
|
|
88
88
|
} };
|
|
89
|
-
},
|
|
89
|
+
}, J = (e) => (e.querySelectorAll("[data-quote-skip]").forEach((e) => e.remove()), e.querySelectorAll("[data-paragraph]").forEach((e) => e.append("\n")), e.textContent ?? ""), ve = (e) => e.length > fe ? `${e.slice(0, fe / 2)} […] ${e.slice(-500)}` : e, ye = (e, t, n) => {
|
|
90
90
|
if (!e.contains(t.commonAncestorContainer)) return;
|
|
91
91
|
let r = [...e.querySelectorAll("[data-paragraph]")].filter((e) => !e.closest(n) && t.intersectsNode(e));
|
|
92
92
|
if (!r.length) return;
|
|
93
|
-
let i = r.flatMap((e) => e.dataset.paragraph.split(" ")), a =
|
|
93
|
+
let i = r.flatMap((e) => e.dataset.paragraph.split(" ")), a = J(t.cloneContents()), o = a.trim();
|
|
94
94
|
if (o.length < 2) return;
|
|
95
95
|
let s = {
|
|
96
96
|
format: "docx",
|
|
97
|
-
runs:
|
|
97
|
+
runs: he(i),
|
|
98
98
|
paragraphCount: new Set(i).size,
|
|
99
|
-
quote:
|
|
99
|
+
quote: ve(o),
|
|
100
100
|
measure: () => {
|
|
101
101
|
let e = t.getBoundingClientRect(), n = t.getClientRects()[0] ?? e;
|
|
102
102
|
return {
|
|
@@ -115,17 +115,17 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
115
115
|
if (r.length === 1) {
|
|
116
116
|
let e = r[0], n = document.createRange();
|
|
117
117
|
n.selectNodeContents(e);
|
|
118
|
-
let i =
|
|
118
|
+
let i = J(n.cloneContents()).replace(/\n$/, ""), c = document.createRange();
|
|
119
119
|
c.setStart(e, 0), c.setEnd(t.startContainer, t.startOffset);
|
|
120
|
-
let l =
|
|
121
|
-
s.before = i.slice(Math.max(0, l -
|
|
120
|
+
let l = J(c.cloneContents()).length + (a.length - a.trimStart().length);
|
|
121
|
+
s.before = i.slice(Math.max(0, l - K), l), s.after = i.slice(l + o.length, l + o.length + K), Object.assign(s, _e(i, l, o.length));
|
|
122
122
|
}
|
|
123
123
|
return s;
|
|
124
|
-
},
|
|
124
|
+
}, be = (e) => {
|
|
125
125
|
let t = "";
|
|
126
126
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
127
127
|
return t;
|
|
128
|
-
},
|
|
128
|
+
}, xe = (e, t) => {
|
|
129
129
|
let n = { ...t }, r = e.rows.flatMap((e) => e.cells.filter((e) => e.span).map((t) => ({
|
|
130
130
|
r1: e.row,
|
|
131
131
|
r2: e.row + t.span.rows - 1,
|
|
@@ -136,7 +136,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
136
136
|
e = !1;
|
|
137
137
|
for (let t of r) t.r1 <= n.r2 && t.r2 >= n.r1 && t.c1 <= n.c2 && t.c2 >= n.c1 && (t.r1 < n.r1 || t.r2 > n.r2 || t.c1 < n.c1 || t.c2 > n.c2) && (n.r1 = Math.min(n.r1, t.r1), n.r2 = Math.max(n.r2, t.r2), n.c1 = Math.min(n.c1, t.c1), n.c2 = Math.max(n.c2, t.c2), e = !0);
|
|
138
138
|
}
|
|
139
|
-
let i = `${
|
|
139
|
+
let i = `${be(n.c1)}${n.r1}`, a = `${be(n.c2)}${n.r2}`, o = (e.hiddenRows ?? []).filter((e) => e >= n.r1 && e <= n.r2), s = e.columns.filter((e) => e.hidden && e.col >= n.c1 && e.col <= n.c2).map((e) => be(e.col)), c = e.rows.filter((e) => e.row >= n.r1 && e.row <= n.r2).flatMap((e) => e.cells.filter((e) => e.col >= n.c1 && e.col <= n.c2 && e.value !== void 0 && e.value !== "")).slice(0, pe).map((e) => String(e.value)).join("; ").slice(0, 500);
|
|
140
140
|
return {
|
|
141
141
|
format: "xlsx",
|
|
142
142
|
sheet: e.name,
|
|
@@ -146,12 +146,12 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
146
146
|
...s.length ? { hiddenColumns: s } : {},
|
|
147
147
|
...c ? { sample: c } : {}
|
|
148
148
|
};
|
|
149
|
-
},
|
|
149
|
+
}, Se = ["onKeydown"], Y = ["placeholder", "aria-label"], X = ["disabled"], Z = ["aria-label"], Ce = { class: "pk-selection-actions__text" }, Q = {
|
|
150
150
|
key: 0,
|
|
151
151
|
class: "pk-selection-actions__text"
|
|
152
|
-
},
|
|
152
|
+
}, we = ["onClick"], $ = /* @__PURE__ */ T({
|
|
153
153
|
__name: "PkSelectionActions",
|
|
154
|
-
props: /*@__PURE__*/
|
|
154
|
+
props: /*@__PURE__*/ O({
|
|
155
155
|
actions: {},
|
|
156
156
|
anchor: {},
|
|
157
157
|
strategy: {},
|
|
@@ -166,52 +166,52 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
166
166
|
},
|
|
167
167
|
askingModifiers: {}
|
|
168
168
|
}),
|
|
169
|
-
emits: /*@__PURE__*/
|
|
169
|
+
emits: /*@__PURE__*/ O([
|
|
170
170
|
"action",
|
|
171
171
|
"ask",
|
|
172
172
|
"note",
|
|
173
173
|
"close"
|
|
174
174
|
], ["update:asking"]),
|
|
175
175
|
setup(e, { emit: t }) {
|
|
176
|
-
let n = e, r = t, i =
|
|
176
|
+
let n = e, r = t, i = V(e, "asking"), { t: a } = oe({ useScope: "global" }), o = ne("barEl"), s = ne("inputEl"), { width: c, height: l } = se(o, void 0, { box: "border-box" }), d = v(() => u({
|
|
177
177
|
...n.anchor,
|
|
178
178
|
bar: {
|
|
179
179
|
width: c.value,
|
|
180
180
|
height: l.value
|
|
181
181
|
},
|
|
182
182
|
touch: n.touch
|
|
183
|
-
})), f =
|
|
183
|
+
})), f = F(), p = F(""), m = async (e, t) => {
|
|
184
184
|
f.value = {
|
|
185
185
|
id: e,
|
|
186
186
|
placeholder: t
|
|
187
|
-
}, p.value = "", i.value = !0, await
|
|
187
|
+
}, p.value = "", i.value = !0, await ee(), s.value?.focus();
|
|
188
188
|
}, h = () => {
|
|
189
189
|
f.value = void 0, i.value = !1;
|
|
190
|
-
},
|
|
190
|
+
}, g = (e) => {
|
|
191
191
|
e.asks ? m(e.id, e.asks) : r("action", e.id);
|
|
192
|
-
},
|
|
192
|
+
}, y = () => {
|
|
193
193
|
let e = p.value.trim();
|
|
194
194
|
e && f.value && (f.value.id ? r("action", f.value.id, e) : r("ask", e), h());
|
|
195
|
-
},
|
|
195
|
+
}, C = () => {
|
|
196
196
|
f.value ? h() : r("close");
|
|
197
197
|
};
|
|
198
|
-
return (t, n) => (
|
|
199
|
-
class:
|
|
198
|
+
return (t, n) => (N(), x("div", {
|
|
199
|
+
class: k(["pk-selection-actions", {
|
|
200
200
|
"pk-selection-actions--fixed": e.strategy === "fixed",
|
|
201
201
|
"pk-selection-actions--asking": !!f.value
|
|
202
202
|
}]),
|
|
203
|
-
style:
|
|
203
|
+
style: A({
|
|
204
204
|
top: `${d.value.top}px`,
|
|
205
205
|
left: `${d.value.left}px`
|
|
206
206
|
}),
|
|
207
|
-
onKeydown: ae(W(
|
|
208
|
-
}, [f.value ? (
|
|
207
|
+
onKeydown: ae(W(C, ["stop"]), ["esc"])
|
|
208
|
+
}, [f.value ? (N(), x("form", {
|
|
209
209
|
key: 0,
|
|
210
210
|
ref_key: "barEl",
|
|
211
211
|
ref: o,
|
|
212
212
|
class: "pk-selection-actions__bar pk-selection-actions__bar--field",
|
|
213
|
-
onSubmit: W(
|
|
214
|
-
}, [
|
|
213
|
+
onSubmit: W(y, ["prevent"])
|
|
214
|
+
}, [ie(S("input", {
|
|
215
215
|
ref_key: "inputEl",
|
|
216
216
|
ref: s,
|
|
217
217
|
"onUpdate:modelValue": n[0] ||= (e) => p.value = e,
|
|
@@ -220,39 +220,39 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
220
220
|
maxlength: "500",
|
|
221
221
|
placeholder: f.value.placeholder,
|
|
222
222
|
"aria-label": f.value.placeholder
|
|
223
|
-
}, null, 8,
|
|
223
|
+
}, null, 8, Y), [[H, p.value]]), S("button", {
|
|
224
224
|
type: "submit",
|
|
225
225
|
class: "pk-selection-actions__button pk-selection-actions__button--send",
|
|
226
226
|
disabled: !p.value.trim()
|
|
227
|
-
},
|
|
227
|
+
}, z(B(a)("action.send")), 9, X)], 544)) : (N(), x("div", {
|
|
228
228
|
key: 1,
|
|
229
229
|
ref_key: "barEl",
|
|
230
230
|
ref: o,
|
|
231
231
|
class: "pk-selection-actions__bar",
|
|
232
232
|
role: "toolbar",
|
|
233
|
-
"aria-label":
|
|
234
|
-
}, [e.note ? (
|
|
233
|
+
"aria-label": B(a)("selectionActions.label")
|
|
234
|
+
}, [e.note ? (N(), x(_, { key: 0 }, [S("span", Ce, z(e.note), 1), e.noteAction ? (N(), x("button", {
|
|
235
235
|
key: 0,
|
|
236
236
|
type: "button",
|
|
237
237
|
class: "pk-selection-actions__button",
|
|
238
238
|
onMousedown: n[1] ||= W(() => {}, ["prevent"]),
|
|
239
239
|
onClick: n[2] ||= (e) => r("note")
|
|
240
|
-
},
|
|
241
|
-
e.hint ? (
|
|
242
|
-
(
|
|
240
|
+
}, z(e.noteAction), 33)) : b("", !0)], 64)) : (N(), x(_, { key: 1 }, [
|
|
241
|
+
e.hint ? (N(), x("span", Q, z(e.hint), 1)) : b("", !0),
|
|
242
|
+
(N(!0), x(_, null, I(e.actions, (e) => (N(), x("button", {
|
|
243
243
|
key: e.id,
|
|
244
244
|
type: "button",
|
|
245
245
|
class: "pk-selection-actions__button",
|
|
246
246
|
onMousedown: n[3] ||= W(() => {}, ["prevent"]),
|
|
247
|
-
onClick: (t) =>
|
|
248
|
-
},
|
|
249
|
-
|
|
247
|
+
onClick: (t) => g(e)
|
|
248
|
+
}, z(e.label), 41, we))), 128)),
|
|
249
|
+
S("button", {
|
|
250
250
|
type: "button",
|
|
251
251
|
class: "pk-selection-actions__button",
|
|
252
252
|
onMousedown: n[4] ||= W(() => {}, ["prevent"]),
|
|
253
|
-
onClick: n[5] ||= (e) => m(void 0,
|
|
254
|
-
},
|
|
255
|
-
], 64))], 8,
|
|
253
|
+
onClick: n[5] ||= (e) => m(void 0, B(a)("selectionActions.askPlaceholder"))
|
|
254
|
+
}, z(B(a)("selectionActions.ask")), 33)
|
|
255
|
+
], 64))], 8, Z)), L(t.$slots, "card")], 46, Se));
|
|
256
256
|
}
|
|
257
257
|
}), Te = { class: "pk-spreadsheet-preview" }, Ee = { class: "pk-spreadsheet-preview__bar" }, De = ["aria-label"], Oe = ["aria-label"], ke = ["aria-label"], Ae = [
|
|
258
258
|
"rowspan",
|
|
@@ -270,28 +270,28 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
270
270
|
}, ze = {
|
|
271
271
|
key: 0,
|
|
272
272
|
class: "pk-spreadsheet-preview__average"
|
|
273
|
-
}, Be = { key: 1 }, Ve = { class: "pk-spreadsheet-preview__zoom" }, He = { class: "pk-spreadsheet-preview__percent" }, Ue = 64, We = 20, Ge = 28, Ke = 44, qe = /* @__PURE__ */
|
|
273
|
+
}, Be = { key: 1 }, Ve = { class: "pk-spreadsheet-preview__zoom" }, He = { class: "pk-spreadsheet-preview__percent" }, Ue = 64, We = 20, Ge = 28, Ke = 44, qe = /* @__PURE__ */ T({
|
|
274
274
|
__name: "PkSpreadsheetPreview",
|
|
275
|
-
props: /*@__PURE__*/
|
|
275
|
+
props: /*@__PURE__*/ O({ preview: {} }, {
|
|
276
276
|
sheet: { default: 0 },
|
|
277
277
|
sheetModifiers: {},
|
|
278
278
|
zoom: { default: 1 },
|
|
279
279
|
zoomModifiers: {}
|
|
280
280
|
}),
|
|
281
|
-
emits: /*@__PURE__*/
|
|
281
|
+
emits: /*@__PURE__*/ O(["select"], ["update:sheet", "update:zoom"]),
|
|
282
282
|
setup(e, { emit: t }) {
|
|
283
|
-
let o = e, s = t, { t: c, locale: l } = oe({ useScope: "global" }), u =
|
|
283
|
+
let o = e, s = t, { t: c, locale: l } = oe({ useScope: "global" }), u = V(e, "sheet"), d = V(e, "zoom"), f = ne("scrollEl"), { width: p, height: m } = se(f, {
|
|
284
284
|
width: 0,
|
|
285
285
|
height: 0
|
|
286
|
-
}, { box: "border-box" }), h =
|
|
287
|
-
|
|
286
|
+
}, { box: "border-box" }), h = v(() => o.preview.sheets[u.value] ?? o.preview.sheets[0]);
|
|
287
|
+
U(() => o.preview, () => {
|
|
288
288
|
u.value = 0;
|
|
289
289
|
});
|
|
290
|
-
let
|
|
290
|
+
let g = (e) => {
|
|
291
291
|
let t = "";
|
|
292
292
|
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
293
293
|
return t;
|
|
294
|
-
},
|
|
294
|
+
}, y = v(() => {
|
|
295
295
|
let e = h.value;
|
|
296
296
|
if (!e) return [];
|
|
297
297
|
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 = Ke, a = p.value / d.value;
|
|
@@ -304,11 +304,11 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
304
304
|
}), i += e;
|
|
305
305
|
}
|
|
306
306
|
return r;
|
|
307
|
-
}),
|
|
307
|
+
}), T = v(() => y.value.reduce((e, t) => e + t.width, Ke)), E = v(() => y.value.map((e) => `${e.col}:${e.width}`).join(",")), O = /* @__PURE__ */ new WeakMap(), j = v(() => {
|
|
308
308
|
let e = h.value;
|
|
309
309
|
if (!e) return [];
|
|
310
|
-
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - Ge) / We), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a =
|
|
311
|
-
a || (a = /* @__PURE__ */ new Map(),
|
|
310
|
+
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - Ge) / We), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = O.get(e);
|
|
311
|
+
a || (a = /* @__PURE__ */ new Map(), O.set(e, a));
|
|
312
312
|
let o = a;
|
|
313
313
|
return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
|
|
314
314
|
let t = o.get(e);
|
|
@@ -317,32 +317,32 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
317
317
|
height: n.get(e) ?? We
|
|
318
318
|
}, o.set(e, t)), t;
|
|
319
319
|
});
|
|
320
|
-
}),
|
|
320
|
+
}), te = v(() => {
|
|
321
321
|
let e = /* @__PURE__ */ new Map();
|
|
322
322
|
for (let t of h.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
|
|
323
323
|
return e;
|
|
324
|
-
}),
|
|
324
|
+
}), M = v(() => {
|
|
325
325
|
let e = /* @__PURE__ */ new Map();
|
|
326
326
|
for (let t of h.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}`, {
|
|
327
327
|
row: t.row,
|
|
328
328
|
col: n.col
|
|
329
329
|
});
|
|
330
330
|
return e;
|
|
331
|
-
}),
|
|
332
|
-
let n =
|
|
331
|
+
}), P = (e, t) => te.value.get(`${e},${t}`), L = (e, t) => {
|
|
332
|
+
let n = P(e, t)?.span;
|
|
333
333
|
if (n) return {
|
|
334
|
-
rows:
|
|
335
|
-
cols:
|
|
334
|
+
rows: j.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
|
|
335
|
+
cols: y.value.filter((e) => e.col >= t && e.col < t + n.cols).length
|
|
336
336
|
};
|
|
337
|
-
},
|
|
337
|
+
}, R = (e) => e?.style === void 0 ? void 0 : o.preview.styles[e.style], H = (e) => {
|
|
338
338
|
let t = e.numFmt === void 0 ? void 0 : o.preview.numberFormats?.[e.numFmt], a = e.value;
|
|
339
339
|
if (t !== void 0) try {
|
|
340
340
|
return e.format === "date" ? e.serial === void 0 ? void 0 : r(t, e.serial, l.value, o.preview.date1904) : typeof a == "number" ? n(t) ? r(t, a, l.value, o.preview.date1904) : i(t, a, l.value) : void 0;
|
|
341
341
|
} catch {
|
|
342
342
|
return;
|
|
343
343
|
}
|
|
344
|
-
},
|
|
345
|
-
let n =
|
|
344
|
+
}, re = (e, t) => {
|
|
345
|
+
let n = H(e);
|
|
346
346
|
if (n) return n.text;
|
|
347
347
|
let r = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
|
|
348
348
|
minimumFractionDigits: e.decimals,
|
|
@@ -357,7 +357,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
357
357
|
currency: e.currency
|
|
358
358
|
} : {}
|
|
359
359
|
}).format(t);
|
|
360
|
-
},
|
|
360
|
+
}, ie = (e) => {
|
|
361
361
|
let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
362
362
|
return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(l.value, {
|
|
363
363
|
dateStyle: "short",
|
|
@@ -367,8 +367,8 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
367
367
|
if (!e) return "";
|
|
368
368
|
if (e.missing) return "—";
|
|
369
369
|
let t = e.value;
|
|
370
|
-
return t === void 0 ? "" : typeof t == "boolean" ? c(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ?
|
|
371
|
-
},
|
|
370
|
+
return t === void 0 ? "" : typeof t == "boolean" ? c(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? H(e)?.text ?? ie(t) : typeof t == "number" ? re(e, t) : t;
|
|
371
|
+
}, ce = (e) => {
|
|
372
372
|
if (!e) return "";
|
|
373
373
|
if (e.formula) return `=${e.formula}`;
|
|
374
374
|
let t = e.value;
|
|
@@ -377,8 +377,8 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
377
377
|
maximumFractionDigits: 15,
|
|
378
378
|
...e.format === "percent" ? { style: "percent" } : {}
|
|
379
379
|
}).format(t) : ae(e);
|
|
380
|
-
},
|
|
381
|
-
let r =
|
|
380
|
+
}, le = (e) => e ? `${e.width}px solid ${e.color}` : void 0, ue = (e, t, n) => {
|
|
381
|
+
let r = R(e), i = e?.value, a = typeof i == "number" || e?.format === "date" || !!e?.missing, o = {
|
|
382
382
|
textAlign: r?.align ?? (a ? "right" : typeof i == "boolean" || e?.format === "error" ? "center" : "left"),
|
|
383
383
|
verticalAlign: r?.valign === "top" ? "top" : r?.valign === "middle" ? "middle" : "bottom",
|
|
384
384
|
whiteSpace: r?.wrap ? "pre-wrap" : "nowrap"
|
|
@@ -386,32 +386,32 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
386
386
|
r?.bold && (o.fontWeight = 700), r?.italic && (o.fontStyle = "italic");
|
|
387
387
|
let s = [r?.underline ? "underline" : "", r?.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
388
388
|
s && (o.textDecoration = s), r?.size && (o.fontSize = `${r.size}pt`);
|
|
389
|
-
let c = e ?
|
|
389
|
+
let c = e ? H(e)?.color : void 0;
|
|
390
390
|
if ((c ?? r?.color) && (o.color = c ?? r?.color), r?.fill && (o.backgroundColor = r.fill), r?.indent) {
|
|
391
391
|
let e = `${4 + r.indent * 9}px`;
|
|
392
392
|
o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
|
|
393
393
|
}
|
|
394
|
-
return
|
|
395
|
-
},
|
|
394
|
+
return de(t, n) ? (o.borderStyle = "hidden", o.boxShadow = J(e, t, n)) : (o.borderTop = le(r?.borders?.top), o.borderRight = le(r?.borders?.right), o.borderBottom = le(r?.borders?.bottom), o.borderLeft = le(r?.borders?.left), o.boxShadow = K(e, t, n).join(", ")), Object.assign(o, Se(t, n)), o;
|
|
395
|
+
}, de = (e, t) => {
|
|
396
396
|
let n = h.value?.frozen;
|
|
397
397
|
return !!n && (e <= n.rows || t <= n.cols);
|
|
398
|
-
},
|
|
398
|
+
}, G = {
|
|
399
399
|
top: (e) => `inset 0 ${e.width}px 0 ${e.color}`,
|
|
400
400
|
right: (e) => `inset -${e.width}px 0 0 ${e.color}`,
|
|
401
401
|
bottom: (e) => `inset 0 -${e.width}px 0 ${e.color}`,
|
|
402
402
|
left: (e) => `inset ${e.width}px 0 0 ${e.color}`
|
|
403
|
-
},
|
|
404
|
-
let r =
|
|
405
|
-
return [t ===
|
|
406
|
-
},
|
|
403
|
+
}, fe = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), K = (e, t, n) => {
|
|
404
|
+
let r = R(e)?.borders;
|
|
405
|
+
return [t === j.value[0]?.row && r?.top && G.top(r.top), n === y.value[0]?.col && r?.left && G.left(r.left)].filter((e) => !!e);
|
|
406
|
+
}, q = v(() => j.value.map((e) => e.row)), pe = v(() => y.value.map((e) => e.col)), me = v(() => new Map(q.value.map((e, t) => [e, t]))), he = v(() => new Map(pe.value.map((e, t) => [e, t]))), ge = (e, t, n, r) => {
|
|
407
407
|
let i = [], a = t.get(n) ?? e.length;
|
|
408
408
|
for (; a < e.length && e[a] < n + r; a++) i.push(e[a]);
|
|
409
409
|
return {
|
|
410
410
|
spanned: i,
|
|
411
411
|
next: e[a]
|
|
412
412
|
};
|
|
413
|
-
},
|
|
414
|
-
let { spanned: i, next: a } =
|
|
413
|
+
}, _e = (e, t, n, r) => {
|
|
414
|
+
let { spanned: i, next: a } = ge(q.value, me.value, t, e?.span?.rows ?? 1), { spanned: o, next: s } = ge(pe.value, he.value, n, e?.span?.cols ?? 1);
|
|
415
415
|
return (r === "right" ? s === void 0 ? [] : i.map((e) => ({
|
|
416
416
|
row: e,
|
|
417
417
|
col: s
|
|
@@ -419,58 +419,58 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
419
419
|
row: a,
|
|
420
420
|
col: e
|
|
421
421
|
}))).map((e) => {
|
|
422
|
-
let t =
|
|
423
|
-
return
|
|
422
|
+
let t = M.value.get(`${e.row},${e.col}`) ?? e;
|
|
423
|
+
return P(t.row, t.col);
|
|
424
424
|
});
|
|
425
|
-
},
|
|
426
|
-
let r =
|
|
425
|
+
}, J = (e, t, n) => {
|
|
426
|
+
let r = R(e)?.borders, i = fe(r?.right, ..._e(e, t, n, "right").map((e) => R(e)?.borders?.left)), a = fe(r?.bottom, ..._e(e, t, n, "bottom").map((e) => R(e)?.borders?.top)), o = h.value?.gridlines;
|
|
427
427
|
return [
|
|
428
|
-
i ?
|
|
429
|
-
a ?
|
|
430
|
-
...
|
|
428
|
+
i ? G.right(i) : o && "inset calc(var(--border) * -1) 0 0 var(--pk-spreadsheet-gridline)",
|
|
429
|
+
a ? G.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
|
|
430
|
+
...K(e, t, n)
|
|
431
431
|
].filter(Boolean).join(", ");
|
|
432
|
-
},
|
|
432
|
+
}, ve = (e) => Ge + j.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), ye = (e) => Ke + y.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), be = v(() => {
|
|
433
433
|
let e = h.value?.frozen;
|
|
434
434
|
return {
|
|
435
|
-
top:
|
|
436
|
-
left:
|
|
435
|
+
top: ve((e?.rows ?? 0) + 1),
|
|
436
|
+
left: ye((e?.cols ?? 0) + 1)
|
|
437
437
|
};
|
|
438
|
-
}),
|
|
438
|
+
}), Se = (e, t) => {
|
|
439
439
|
let n = h.value?.frozen;
|
|
440
440
|
if (!n) return {};
|
|
441
441
|
let r = {};
|
|
442
|
-
return e <= n.rows && (r.position = "sticky", r.top = `${
|
|
443
|
-
},
|
|
442
|
+
return e <= n.rows && (r.position = "sticky", r.top = `${ve(e)}px`, r.scrollMarginTop = r.top, r.zIndex = 0), t <= n.cols && (r.position = "sticky", r.left = `${ye(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
|
|
443
|
+
}, Y = F({
|
|
444
444
|
row: 1,
|
|
445
445
|
col: 1
|
|
446
|
-
}),
|
|
446
|
+
}), X = F({
|
|
447
447
|
row: 1,
|
|
448
448
|
col: 1
|
|
449
449
|
});
|
|
450
|
-
|
|
451
|
-
|
|
450
|
+
U(h, () => {
|
|
451
|
+
Y.value = {
|
|
452
452
|
row: 1,
|
|
453
453
|
col: 1
|
|
454
|
-
},
|
|
454
|
+
}, X.value = {
|
|
455
455
|
row: 1,
|
|
456
456
|
col: 1
|
|
457
457
|
};
|
|
458
458
|
});
|
|
459
|
-
let
|
|
460
|
-
r1: Math.min(
|
|
461
|
-
r2: Math.max(
|
|
462
|
-
c1: Math.min(
|
|
463
|
-
c2: Math.max(
|
|
464
|
-
})),
|
|
465
|
-
f.value?.focus({ preventScroll: !0 }),
|
|
459
|
+
let Z = v(() => ({
|
|
460
|
+
r1: Math.min(Y.value.row, X.value.row),
|
|
461
|
+
r2: Math.max(Y.value.row, X.value.row),
|
|
462
|
+
c1: Math.min(Y.value.col, X.value.col),
|
|
463
|
+
c2: Math.max(Y.value.col, X.value.col)
|
|
464
|
+
})), Ce = (e, t) => e >= Z.value.r1 && e <= Z.value.r2 && t >= Z.value.c1 && t <= Z.value.c2, Q = (e, t) => X.value.row === e && X.value.col === t, we = (e) => e >= Z.value.r1 && e <= Z.value.r2 ? `${Z.value.c1}:${Z.value.c2}:${X.value.row === e ? X.value.col : 0}` : "", $ = F(!1), qe = (e, t, n) => {
|
|
465
|
+
f.value?.focus({ preventScroll: !0 }), X.value = {
|
|
466
466
|
row: e,
|
|
467
467
|
col: t
|
|
468
|
-
}, n.shiftKey || (
|
|
468
|
+
}, n.shiftKey || (Y.value = {
|
|
469
469
|
row: e,
|
|
470
470
|
col: t
|
|
471
|
-
}),
|
|
471
|
+
}), $.value = !0;
|
|
472
472
|
}, Je = (e, t) => {
|
|
473
|
-
|
|
473
|
+
$.value && (X.value = {
|
|
474
474
|
row: e,
|
|
475
475
|
col: t
|
|
476
476
|
});
|
|
@@ -484,12 +484,12 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
484
484
|
bottom: Math.max(...e.map((e) => e.bottom))
|
|
485
485
|
};
|
|
486
486
|
}, Ze = () => h.value ? {
|
|
487
|
-
...
|
|
487
|
+
...xe(h.value, Z.value),
|
|
488
488
|
measure: Xe
|
|
489
489
|
} : void 0;
|
|
490
|
-
|
|
491
|
-
clearTimeout(Ye),
|
|
492
|
-
let e =
|
|
490
|
+
U([Z, $], () => {
|
|
491
|
+
clearTimeout(Ye), !$.value && (Ye = setTimeout(() => {
|
|
492
|
+
let e = Z.value, t = e.r2 > e.r1 || e.c2 > e.c1;
|
|
493
493
|
s("select", t ? Ze() : void 0);
|
|
494
494
|
}, 150));
|
|
495
495
|
});
|
|
@@ -506,7 +506,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
506
506
|
}[e.key];
|
|
507
507
|
if (!t) return;
|
|
508
508
|
e.preventDefault();
|
|
509
|
-
let n =
|
|
509
|
+
let n = j.value.map((e) => e.row), r = y.value.map((e) => e.col), i = (e) => M.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;
|
|
510
510
|
for (;;) {
|
|
511
511
|
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]));
|
|
512
512
|
if (e === o && l === s || (o = e, s = l, c = i({
|
|
@@ -514,44 +514,44 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
514
514
|
col: r[s]
|
|
515
515
|
}), c.row !== a.row || c.col !== a.col)) break;
|
|
516
516
|
}
|
|
517
|
-
|
|
517
|
+
X.value = c, e.shiftKey || (Y.value = c), ee(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
|
|
518
518
|
block: "nearest",
|
|
519
519
|
inline: "nearest"
|
|
520
520
|
}));
|
|
521
|
-
}, et =
|
|
522
|
-
let { r1: e, r2: t, c1: n, c2: r } =
|
|
521
|
+
}, et = v(() => P(X.value.row, X.value.col)), tt = v(() => {
|
|
522
|
+
let { r1: e, r2: t, c1: n, c2: r } = Z.value;
|
|
523
523
|
if (e === t && n === r) return;
|
|
524
524
|
let i = 0, a = 0, o = 0, s;
|
|
525
525
|
for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
|
|
526
|
-
let t =
|
|
526
|
+
let t = P(c, e);
|
|
527
527
|
t && (t.value !== void 0 || t.missing) && (i++, typeof t.value == "number" && (a += t.value, o++, s ??= t));
|
|
528
528
|
}
|
|
529
529
|
if (i) return {
|
|
530
530
|
count: i,
|
|
531
|
-
sum: s ?
|
|
532
|
-
average: s ?
|
|
531
|
+
sum: s ? re(s, a) : void 0,
|
|
532
|
+
average: s ? re(s, a / o) : void 0
|
|
533
533
|
};
|
|
534
534
|
}), nt = (e) => {
|
|
535
535
|
d.value = Math.min(2, Math.max(.5, Math.round((d.value + e) * 10) / 10));
|
|
536
536
|
};
|
|
537
537
|
return (t, n) => {
|
|
538
538
|
let r = a;
|
|
539
|
-
return
|
|
540
|
-
|
|
541
|
-
|
|
539
|
+
return N(), x("div", Te, [
|
|
540
|
+
S("div", Ee, [
|
|
541
|
+
S("span", {
|
|
542
542
|
class: "pk-spreadsheet-preview__ref",
|
|
543
|
-
"aria-label":
|
|
544
|
-
},
|
|
545
|
-
n[6] ||=
|
|
543
|
+
"aria-label": B(c)("chatFilePreview.cell")
|
|
544
|
+
}, z(g(X.value.col)) + z(X.value.row), 9, De),
|
|
545
|
+
n[6] ||= S("span", {
|
|
546
546
|
class: "pk-spreadsheet-preview__fx",
|
|
547
547
|
"aria-hidden": "true"
|
|
548
548
|
}, "fx", -1),
|
|
549
|
-
|
|
549
|
+
S("output", {
|
|
550
550
|
class: "pk-spreadsheet-preview__formula",
|
|
551
|
-
"aria-label":
|
|
552
|
-
},
|
|
551
|
+
"aria-label": B(c)("chatFilePreview.formulaBar")
|
|
552
|
+
}, z(ce(et.value)), 9, Oe)
|
|
553
553
|
]),
|
|
554
|
-
|
|
554
|
+
S("div", {
|
|
555
555
|
ref_key: "scrollEl",
|
|
556
556
|
ref: f,
|
|
557
557
|
class: "pk-spreadsheet-preview__scroll",
|
|
@@ -559,104 +559,104 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
559
559
|
role: "grid",
|
|
560
560
|
"aria-label": h.value?.name,
|
|
561
561
|
onKeydown: $e,
|
|
562
|
-
onMouseup: n[2] ||= (e) =>
|
|
563
|
-
onMouseleave: n[3] ||= (e) =>
|
|
564
|
-
}, [h.value ? (
|
|
562
|
+
onMouseup: n[2] ||= (e) => $.value = !1,
|
|
563
|
+
onMouseleave: n[3] ||= (e) => $.value = !1
|
|
564
|
+
}, [h.value ? (N(), x("table", {
|
|
565
565
|
key: 0,
|
|
566
|
-
class:
|
|
567
|
-
style:
|
|
566
|
+
class: k(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": h.value.gridlines }]),
|
|
567
|
+
style: A({
|
|
568
568
|
zoom: d.value,
|
|
569
|
-
width: `${
|
|
570
|
-
"--pk-spreadsheet-stuck-top": `${
|
|
571
|
-
"--pk-spreadsheet-stuck-left": `${
|
|
569
|
+
width: `${T.value}px`,
|
|
570
|
+
"--pk-spreadsheet-stuck-top": `${be.value.top}px`,
|
|
571
|
+
"--pk-spreadsheet-stuck-left": `${be.value.left}px`
|
|
572
572
|
})
|
|
573
573
|
}, [
|
|
574
|
-
|
|
574
|
+
S("colgroup", null, [S("col", { style: A({ width: `${Ke}px` }) }, null, 4), (N(!0), x(_, null, I(y.value, (e) => (N(), x("col", {
|
|
575
575
|
key: e.col,
|
|
576
|
-
style:
|
|
576
|
+
style: A({ width: `${e.width}px` })
|
|
577
577
|
}, null, 4))), 128))]),
|
|
578
|
-
|
|
578
|
+
S("thead", null, [S("tr", { style: A({ height: `${Ge}px` }) }, [n[7] ||= S("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (N(!0), x(_, null, I(y.value, (e) => (N(), x("th", {
|
|
579
579
|
key: e.col,
|
|
580
580
|
scope: "col",
|
|
581
|
-
class:
|
|
582
|
-
style:
|
|
583
|
-
left: `${
|
|
581
|
+
class: k(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Z.value.c1 && e.col <= Z.value.c2 }]),
|
|
582
|
+
style: A(h.value.frozen && e.col <= h.value.frozen.cols ? {
|
|
583
|
+
left: `${ye(e.col)}px`,
|
|
584
584
|
zIndex: 2
|
|
585
585
|
} : void 0)
|
|
586
|
-
},
|
|
587
|
-
|
|
586
|
+
}, z(g(e.col)), 7))), 128))], 4)]),
|
|
587
|
+
S("tbody", null, [(N(!0), x(_, null, I(j.value, (e, t, n, r) => {
|
|
588
588
|
let i = [
|
|
589
589
|
e,
|
|
590
590
|
h.value,
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
591
|
+
E.value,
|
|
592
|
+
B(l),
|
|
593
|
+
we(e.row)
|
|
594
594
|
];
|
|
595
|
-
if (r && r.el && r.key === e.row &&
|
|
596
|
-
let a = (
|
|
595
|
+
if (r && r.el && r.key === e.row && D(r, i)) return r;
|
|
596
|
+
let a = (N(), x("tr", {
|
|
597
597
|
key: e.row,
|
|
598
|
-
style:
|
|
599
|
-
}, [
|
|
598
|
+
style: A({ height: `${e.height}px` })
|
|
599
|
+
}, [S("th", {
|
|
600
600
|
scope: "row",
|
|
601
|
-
class:
|
|
602
|
-
style:
|
|
603
|
-
...
|
|
601
|
+
class: k(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Z.value.r1 && e.row <= Z.value.r2 }]),
|
|
602
|
+
style: A(h.value.frozen && e.row <= h.value.frozen.rows ? {
|
|
603
|
+
...Se(e.row, 0),
|
|
604
604
|
left: 0,
|
|
605
605
|
zIndex: 4
|
|
606
606
|
} : void 0)
|
|
607
|
-
},
|
|
607
|
+
}, z(e.row), 7), (N(!0), x(_, null, I(y.value, (t) => (N(), x(_, { key: t.col }, [M.value.has(`${e.row},${t.col}`) ? b("", !0) : (N(), x("td", {
|
|
608
608
|
key: 0,
|
|
609
|
-
rowspan:
|
|
610
|
-
colspan:
|
|
611
|
-
class:
|
|
612
|
-
"pk-spreadsheet-preview__cell--range":
|
|
613
|
-
"pk-spreadsheet-preview__cell--missing":
|
|
609
|
+
rowspan: L(e.row, t.col)?.rows,
|
|
610
|
+
colspan: L(e.row, t.col)?.cols,
|
|
611
|
+
class: k(["pk-spreadsheet-preview__cell", {
|
|
612
|
+
"pk-spreadsheet-preview__cell--range": Ce(e.row, t.col) && !Q(e.row, t.col),
|
|
613
|
+
"pk-spreadsheet-preview__cell--missing": P(e.row, t.col)?.missing
|
|
614
614
|
}]),
|
|
615
|
-
style:
|
|
616
|
-
"data-focus":
|
|
617
|
-
title:
|
|
615
|
+
style: A(ue(P(e.row, t.col), e.row, t.col)),
|
|
616
|
+
"data-focus": Q(e.row, t.col) ? "" : void 0,
|
|
617
|
+
title: P(e.row, t.col)?.missing ? B(c)("chatFilePreview.missingValue") : void 0,
|
|
618
618
|
onMousedown: W((n) => qe(e.row, t.col, n), ["prevent"]),
|
|
619
619
|
onMouseenter: (n) => Je(e.row, t.col),
|
|
620
620
|
onDblclick: Qe
|
|
621
|
-
},
|
|
621
|
+
}, z(ae(P(e.row, t.col))), 47, Ae))], 64))), 128))], 4));
|
|
622
622
|
return a.memo = i, a;
|
|
623
623
|
}, n, 0), 128))])
|
|
624
|
-
], 6)) :
|
|
625
|
-
|
|
624
|
+
], 6)) : b("", !0), h.value && (h.value.moreRows || h.value.moreColumns) ? (N(), x("p", je, [h.value.moreRows ? (N(), x(_, { key: 0 }, [C(z(B(c)("chatFilePreview.moreRows", h.value.moreRows)), 1)], 64)) : b("", !0), h.value.moreColumns ? (N(), x(_, { key: 1 }, [C(z(B(c)("chatFilePreview.moreColumns", h.value.moreColumns)), 1)], 64)) : b("", !0)])) : b("", !0)], 40, ke),
|
|
625
|
+
S("nav", {
|
|
626
626
|
class: "pk-spreadsheet-preview__sheets",
|
|
627
|
-
"aria-label":
|
|
628
|
-
}, [(
|
|
627
|
+
"aria-label": B(c)("chatFilePreview.sheets")
|
|
628
|
+
}, [(N(!0), x(_, null, I(e.preview.sheets, (e, t) => (N(), x("button", {
|
|
629
629
|
key: e.name,
|
|
630
630
|
type: "button",
|
|
631
631
|
class: "pk-spreadsheet-preview__sheet",
|
|
632
632
|
"aria-current": t === u.value ? "page" : void 0,
|
|
633
633
|
onClick: (e) => u.value = t
|
|
634
|
-
},
|
|
635
|
-
|
|
634
|
+
}, z(e.name), 9, Ne))), 128))], 8, Me),
|
|
635
|
+
S("div", Pe, [S("p", Fe, [e.preview.staleFormulas ? (N(), x("span", {
|
|
636
636
|
key: 0,
|
|
637
637
|
class: "pk-spreadsheet-preview__note",
|
|
638
|
-
title:
|
|
639
|
-
},
|
|
638
|
+
title: B(c)("chatFilePreview.staleFormulas")
|
|
639
|
+
}, z(B(c)("chatFilePreview.staleFormulas")), 9, Ie)) : e.preview.computedFormulas ? (N(), x("span", {
|
|
640
640
|
key: 1,
|
|
641
641
|
class: "pk-spreadsheet-preview__note",
|
|
642
|
-
title:
|
|
643
|
-
},
|
|
644
|
-
tt.value.average ? (
|
|
645
|
-
|
|
646
|
-
tt.value.sum ? (
|
|
647
|
-
])) :
|
|
648
|
-
|
|
642
|
+
title: B(c)("chatFilePreview.computedFormulas")
|
|
643
|
+
}, z(B(c)("chatFilePreview.computedFormulas")), 9, Le)) : b("", !0), tt.value ? (N(), x("span", Re, [
|
|
644
|
+
tt.value.average ? (N(), x("span", ze, z(B(c)("chatFilePreview.average")) + " " + z(tt.value.average), 1)) : b("", !0),
|
|
645
|
+
S("span", null, z(B(c)("chatFilePreview.count")) + " " + z(tt.value.count), 1),
|
|
646
|
+
tt.value.sum ? (N(), x("span", Be, z(B(c)("chatFilePreview.sum")) + " " + z(tt.value.sum), 1)) : b("", !0)
|
|
647
|
+
])) : b("", !0)]), S("div", Ve, [
|
|
648
|
+
w(r, {
|
|
649
649
|
modifiers: "action-quiet",
|
|
650
650
|
icon: "ri:subtract-line",
|
|
651
|
-
"aria-label":
|
|
651
|
+
"aria-label": B(c)("chatFilePreview.zoomOut"),
|
|
652
652
|
disabled: d.value <= .5,
|
|
653
653
|
onClick: n[4] ||= (e) => nt(-.1)
|
|
654
654
|
}, null, 8, ["aria-label", "disabled"]),
|
|
655
|
-
|
|
656
|
-
|
|
655
|
+
S("span", He, z(Math.round(d.value * 100)) + "% ", 1),
|
|
656
|
+
w(r, {
|
|
657
657
|
modifiers: "action-quiet",
|
|
658
658
|
icon: "ri:add-line",
|
|
659
|
-
"aria-label":
|
|
659
|
+
"aria-label": B(c)("chatFilePreview.zoomIn"),
|
|
660
660
|
disabled: d.value >= 2,
|
|
661
661
|
onClick: n[5] ||= (e) => nt(.1)
|
|
662
662
|
}, null, 8, ["aria-label", "disabled"])
|
|
@@ -668,7 +668,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
668
668
|
key: 1,
|
|
669
669
|
class: "pk-word-preview__image",
|
|
670
670
|
"data-quote-skip": ""
|
|
671
|
-
}, Xe = ["title"], Ze = ["title"], Qe = ["data-quote-skip"], $e = /* @__PURE__ */
|
|
671
|
+
}, Xe = ["title"], Ze = ["title"], Qe = ["data-quote-skip"], $e = /* @__PURE__ */ T({
|
|
672
672
|
__name: "PkWordPreviewRuns",
|
|
673
673
|
props: {
|
|
674
674
|
runs: {},
|
|
@@ -677,7 +677,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
677
677
|
numbers: {}
|
|
678
678
|
},
|
|
679
679
|
setup(e) {
|
|
680
|
-
let t = e, { t: n } = oe({ useScope: "global" }), r =
|
|
680
|
+
let t = e, { t: n } = oe({ useScope: "global" }), r = E(m, void 0), i = (e) => e.picture ? c(r?.value, e.picture.ref) : void 0, a = (e) => t.page ? h(e) : "inline", o = (e) => {
|
|
681
681
|
let n = {
|
|
682
682
|
width: `${e.width}pt`,
|
|
683
683
|
aspectRatio: `${e.width} / ${e.height}`
|
|
@@ -704,49 +704,49 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
704
704
|
top: `${r.y}pt`,
|
|
705
705
|
zIndex: r.wrap === "behind" ? -1 : 1
|
|
706
706
|
};
|
|
707
|
-
}, l = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, u =
|
|
707
|
+
}, l = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, u = v(() => {
|
|
708
708
|
let e = d(t.runs, t.mode ?? "markup"), n = (e) => !!e.picture && !!t.page && ["around", "block"].includes(h(e.picture));
|
|
709
709
|
return [...e.filter(n), ...e.filter((e) => !n(e))];
|
|
710
|
-
}), f =
|
|
710
|
+
}), f = v(() => !t.mode || t.mode === "markup"), p = (e) => {
|
|
711
711
|
let t = {};
|
|
712
712
|
e.font && (t.fontFamily = s(e.font)), t.fontSize = e.size ? `${e.size}pt` : "var(--pk-word-size)", e.color && (t.color = e.color), e.highlight && (t.backgroundColor = e.highlight), e.bold && (t.fontWeight = 700), e.italic && (t.fontStyle = "italic");
|
|
713
713
|
let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
714
714
|
return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
|
|
715
|
-
},
|
|
715
|
+
}, g = (e) => {
|
|
716
716
|
let t = p(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
|
|
717
717
|
return n.add(e.change === "deleted" ? "line-through" : "underline"), {
|
|
718
718
|
...t,
|
|
719
719
|
textDecoration: [...n].join(" ")
|
|
720
720
|
};
|
|
721
|
-
},
|
|
722
|
-
return (e, t) => (
|
|
721
|
+
}, y = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
|
|
722
|
+
return (e, t) => (N(!0), x(_, null, I(u.value, (e, t) => (N(), x(_, { key: t }, [e.image ? (N(), x(_, { key: 0 }, [e.picture && i(e) ? (N(), x(_, { key: 0 }, [a(e.picture) === "page" ? b("", !0) : (N(), x("img", {
|
|
723
723
|
key: 0,
|
|
724
|
-
class:
|
|
725
|
-
style:
|
|
724
|
+
class: k(["pk-word-preview__picture", `pk-word-preview__picture--${a(e.picture)}`]),
|
|
725
|
+
style: A(o(e.picture)),
|
|
726
726
|
src: i(e),
|
|
727
727
|
alt: ""
|
|
728
|
-
}, null, 14, Je))], 64)) : (
|
|
728
|
+
}, null, 14, Je))], 64)) : (N(), x("span", Ye, z(B(n)("chatFilePreview.image")), 1))], 64)) : f.value && e.change === "deleted" ? (N(), x("del", {
|
|
729
729
|
key: 1,
|
|
730
730
|
class: "pk-word-preview__removed",
|
|
731
731
|
"data-quote-skip": "",
|
|
732
|
-
style:
|
|
733
|
-
title:
|
|
734
|
-
},
|
|
732
|
+
style: A(g(e)),
|
|
733
|
+
title: y(e)
|
|
734
|
+
}, z(l(e)), 13, Xe)) : f.value && e.change === "inserted" ? (N(), x("ins", {
|
|
735
735
|
key: 2,
|
|
736
736
|
class: "pk-word-preview__added",
|
|
737
|
-
style:
|
|
738
|
-
title:
|
|
739
|
-
},
|
|
737
|
+
style: A(g(e)),
|
|
738
|
+
title: y(e)
|
|
739
|
+
}, z(l(e)), 13, Ze)) : (N(), x("span", {
|
|
740
740
|
key: 3,
|
|
741
|
-
style:
|
|
741
|
+
style: A(p(e)),
|
|
742
742
|
"data-quote-skip": e.label ? "" : void 0
|
|
743
|
-
},
|
|
743
|
+
}, z(l(e)), 13, Qe))], 64))), 128));
|
|
744
744
|
}
|
|
745
745
|
}), et = { key: 0 }, tt = ["data-paragraph", "colspan"], nt = [
|
|
746
746
|
"data-paragraph",
|
|
747
747
|
"role",
|
|
748
748
|
"aria-level"
|
|
749
|
-
], rt = { key: 1 }, it = /* @__PURE__ */
|
|
749
|
+
], rt = { key: 1 }, it = /* @__PURE__ */ T({
|
|
750
750
|
__name: "PkWordPreviewBlock",
|
|
751
751
|
props: {
|
|
752
752
|
block: {},
|
|
@@ -756,49 +756,49 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
756
756
|
numbers: {}
|
|
757
757
|
},
|
|
758
758
|
setup(e) {
|
|
759
|
-
let t = e, n =
|
|
759
|
+
let t = e, n = v(() => {
|
|
760
760
|
if (t.block.kind === "table") return {};
|
|
761
761
|
let e = t.block.style ?? {};
|
|
762
762
|
return {
|
|
763
763
|
textAlign: e.align,
|
|
764
|
-
paddingLeft: e.indentLeft ?
|
|
765
|
-
paddingRight: e.indentRight ?
|
|
766
|
-
textIndent: e.firstLine ?
|
|
764
|
+
paddingLeft: e.indentLeft ? `max(0pt, calc((${e.indentLeft}pt - var(--pk-word-indent-shared, 0pt)) * var(--pk-word-indent-scale, 1)))` : void 0,
|
|
765
|
+
paddingRight: e.indentRight ? `calc(${e.indentRight}pt * var(--pk-word-indent-scale, 1))` : void 0,
|
|
766
|
+
textIndent: e.firstLine ? `calc(${e.firstLine}pt * var(--pk-word-indent-scale, 1))` : void 0,
|
|
767
767
|
paddingTop: e.spaceBefore ? `${e.spaceBefore}pt` : void 0,
|
|
768
768
|
paddingBottom: e.spaceAfter ? `${e.spaceAfter}pt` : void 0,
|
|
769
769
|
lineHeight: e.lineExact ? `${e.lineExact}pt` : e.lineAtLeast ? `max(calc(var(--pk-word-line, 1.17) * max(1em, var(--pk-word-size, 1em))), ${e.lineAtLeast}pt)` : `calc(var(--pk-word-line, 1.17) * ${e.lineHeight ?? 1})`,
|
|
770
770
|
backgroundColor: e.shading,
|
|
771
771
|
fontSize: e.size ? `${e.size}pt` : void 0
|
|
772
772
|
};
|
|
773
|
-
}), r =
|
|
773
|
+
}), r = v(() => {
|
|
774
774
|
if (t.block.kind === "table") return {};
|
|
775
775
|
let e = -(t.block.style?.firstLine ?? 0);
|
|
776
|
-
return e > 0 ? { minWidth:
|
|
777
|
-
}), i =
|
|
776
|
+
return e > 0 ? { minWidth: `calc(${e}pt * var(--pk-word-indent-scale, 1))` } : { paddingRight: "6pt" };
|
|
777
|
+
}), i = v(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), a = v(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), o = v(() => {
|
|
778
778
|
if (t.block.kind !== "table") return [];
|
|
779
779
|
let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
|
|
780
780
|
return n ? e.map((e) => `${e / n * 100}%`) : [];
|
|
781
|
-
}), s =
|
|
782
|
-
return (t, c) => e.block.kind === "table" && a.value ? (
|
|
781
|
+
}), s = v(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
|
|
782
|
+
return (t, c) => e.block.kind === "table" && a.value ? (N(), x("table", {
|
|
783
783
|
key: 0,
|
|
784
|
-
class:
|
|
784
|
+
class: k(["pk-word-preview__table", {
|
|
785
785
|
"pk-word-preview__table--lines": e.block.borders,
|
|
786
786
|
"pk-word-preview__table--next": e.row !== 0,
|
|
787
787
|
"pk-word-preview__changed": s.value
|
|
788
788
|
}])
|
|
789
|
-
}, [o.value.length ? (
|
|
789
|
+
}, [o.value.length ? (N(), x("colgroup", et, [(N(!0), x(_, null, I(o.value, (e, t) => (N(), x("col", {
|
|
790
790
|
key: t,
|
|
791
|
-
style:
|
|
792
|
-
}, null, 4))), 128))])) :
|
|
791
|
+
style: A({ width: e })
|
|
792
|
+
}, null, 4))), 128))])) : b("", !0), S("tbody", null, [S("tr", null, [(N(!0), x(_, null, I(a.value, (t, n) => (N(), x("td", {
|
|
793
793
|
key: n,
|
|
794
794
|
"data-paragraph": t.ids?.join(" "),
|
|
795
795
|
colspan: t.span,
|
|
796
|
-
style:
|
|
796
|
+
style: A({
|
|
797
797
|
backgroundColor: t.fill,
|
|
798
798
|
textAlign: t.align,
|
|
799
799
|
fontSize: t.size ? `${t.size}pt` : void 0
|
|
800
800
|
})
|
|
801
|
-
}, [
|
|
801
|
+
}, [w($e, {
|
|
802
802
|
runs: t.runs,
|
|
803
803
|
mode: e.mode,
|
|
804
804
|
numbers: e.numbers
|
|
@@ -806,21 +806,21 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
806
806
|
"runs",
|
|
807
807
|
"mode",
|
|
808
808
|
"numbers"
|
|
809
|
-
])], 12, tt))), 128))])])], 2)) : e.block.kind === "table" ?
|
|
809
|
+
])], 12, tt))), 128))])])], 2)) : e.block.kind === "table" ? b("", !0) : (N(), x("div", {
|
|
810
810
|
key: 1,
|
|
811
|
-
class:
|
|
811
|
+
class: k(["pk-word-preview__block", { "pk-word-preview__changed": i.value }]),
|
|
812
812
|
"data-paragraph": e.block.id,
|
|
813
813
|
role: e.block.kind === "heading" ? "heading" : void 0,
|
|
814
814
|
"aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
|
|
815
|
-
style:
|
|
815
|
+
style: A(n.value)
|
|
816
816
|
}, [
|
|
817
|
-
e.block.label ? (
|
|
817
|
+
e.block.label ? (N(), x("span", {
|
|
818
818
|
key: 0,
|
|
819
819
|
class: "pk-word-preview__label",
|
|
820
820
|
"data-quote-skip": "",
|
|
821
|
-
style:
|
|
822
|
-
},
|
|
823
|
-
|
|
821
|
+
style: A(r.value)
|
|
822
|
+
}, z(e.block.label), 5)) : b("", !0),
|
|
823
|
+
w($e, {
|
|
824
824
|
runs: e.block.runs,
|
|
825
825
|
mode: e.mode,
|
|
826
826
|
page: e.page,
|
|
@@ -831,10 +831,10 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
831
831
|
"page",
|
|
832
832
|
"numbers"
|
|
833
833
|
]),
|
|
834
|
-
!e.block.label && !e.block.runs.length ? (
|
|
834
|
+
!e.block.label && !e.block.runs.length ? (N(), x("br", rt)) : b("", !0)
|
|
835
835
|
], 14, nt));
|
|
836
836
|
}
|
|
837
|
-
}), at = { class: "pk-word-preview__part" }, ot = ["src"], st = /* @__PURE__ */
|
|
837
|
+
}), at = { class: "pk-word-preview__part" }, ot = ["src"], st = /* @__PURE__ */ T({
|
|
838
838
|
__name: "PkWordPreviewPart",
|
|
839
839
|
props: {
|
|
840
840
|
blocks: {},
|
|
@@ -844,13 +844,13 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
844
844
|
numbers: {}
|
|
845
845
|
},
|
|
846
846
|
setup(e) {
|
|
847
|
-
let t = e, n =
|
|
847
|
+
let t = e, n = E(m, void 0), r = v(() => f(t.blocks, t.mode)), i = v(() => l(t.blocks, t.mode).flatMap((e) => {
|
|
848
848
|
let r = c(n?.value, e.ref);
|
|
849
849
|
return r ? [{
|
|
850
850
|
src: r,
|
|
851
851
|
css: o(e, t.section.page)
|
|
852
852
|
}] : [];
|
|
853
|
-
})), a =
|
|
853
|
+
})), a = v(() => {
|
|
854
854
|
let { margins: e } = t.section.page;
|
|
855
855
|
return {
|
|
856
856
|
left: `${e.left}pt`,
|
|
@@ -858,10 +858,10 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
858
858
|
...t.where === "header" ? { top: `${t.section.headerDistance}pt` } : { bottom: `${t.section.footerDistance}pt` }
|
|
859
859
|
};
|
|
860
860
|
});
|
|
861
|
-
return (t, n) => (
|
|
861
|
+
return (t, n) => (N(), x("div", at, [S("div", {
|
|
862
862
|
class: "pk-word-preview__part-flow",
|
|
863
|
-
style:
|
|
864
|
-
}, [(
|
|
863
|
+
style: A(a.value)
|
|
864
|
+
}, [(N(!0), x(_, null, I(r.value, (t) => (N(), y(it, {
|
|
865
865
|
key: t.key,
|
|
866
866
|
block: e.blocks[t.block],
|
|
867
867
|
row: t.row,
|
|
@@ -874,10 +874,10 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
874
874
|
"mode",
|
|
875
875
|
"page",
|
|
876
876
|
"numbers"
|
|
877
|
-
]))), 128))], 4), (
|
|
877
|
+
]))), 128))], 4), (N(!0), x(_, null, I(i.value, (e, t) => (N(), x("img", {
|
|
878
878
|
key: t,
|
|
879
879
|
class: "pk-word-preview__float",
|
|
880
|
-
style:
|
|
880
|
+
style: A(e.css),
|
|
881
881
|
src: e.src,
|
|
882
882
|
alt: ""
|
|
883
883
|
}, null, 12, ot))), 128))]));
|
|
@@ -912,9 +912,9 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
912
912
|
}, Dt = { class: "pk-word-preview__count" }, Ot = {
|
|
913
913
|
key: 1,
|
|
914
914
|
class: "pk-word-preview__legend"
|
|
915
|
-
}, kt = ["title"], At = { class: "pk-word-preview__removed" }, jt = { class: "pk-word-preview__added" }, Mt = { class: "pk-word-preview__percent" }, Nt = ["data-part"], Pt = 96 / 72, Ft = /* @__PURE__ */
|
|
915
|
+
}, kt = ["title"], At = { class: "pk-word-preview__removed" }, jt = { class: "pk-word-preview__added" }, Mt = { class: "pk-word-preview__percent" }, Nt = ["data-part"], Pt = 96 / 72, Ft = .5, It = /* @__PURE__ */ T({
|
|
916
916
|
__name: "PkWordPreview",
|
|
917
|
-
props: /*@__PURE__*/
|
|
917
|
+
props: /*@__PURE__*/ O({
|
|
918
918
|
preview: {},
|
|
919
919
|
mode: {}
|
|
920
920
|
}, {
|
|
@@ -926,41 +926,58 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
926
926
|
zoom: { default: 1 },
|
|
927
927
|
zoomModifiers: {}
|
|
928
928
|
}),
|
|
929
|
-
emits: /*@__PURE__*/
|
|
929
|
+
emits: /*@__PURE__*/ O(["select"], ["update:fit", "update:zoom"]),
|
|
930
930
|
setup(e, { emit: t }) {
|
|
931
931
|
let n = e, r = t, { t: i } = oe({ useScope: "global" });
|
|
932
|
-
|
|
933
|
-
let u = (e) => d(e, n.mode), h =
|
|
932
|
+
P(m, v(() => n.preview.images));
|
|
933
|
+
let u = (e) => d(e, n.mode), h = v(() => f(n.preview.blocks, n.mode)), g = ne("rootEl"), C = ne("scrollEl"), T = ne("measureEl"), { width: E } = se(g), { width: D } = se(C), O = v(() => E.value >= 1e3), M = v(() => n.preview.sections?.length ? n.preview.sections : [{
|
|
934
934
|
page: n.preview.page,
|
|
935
935
|
headerDistance: 0,
|
|
936
936
|
footerDistance: 0,
|
|
937
937
|
headers: {},
|
|
938
938
|
footers: {}
|
|
939
|
-
}]), L =
|
|
939
|
+
}]), L = v(() => M.value[0].page), R = v(() => (D.value - 48) / (L.value.width * Pt)), H = v(() => E.value === 0 || D.value === 0 || R.value >= Ft), re = v(() => ({
|
|
940
940
|
fontFamily: s(n.preview.defaults.font),
|
|
941
941
|
fontSize: `${n.preview.defaults.size}pt`,
|
|
942
942
|
color: n.preview.defaults.color ?? "#000000",
|
|
943
943
|
"--pk-word-line": p(n.preview.defaults.font),
|
|
944
944
|
"--pk-word-size": `${n.preview.defaults.size}pt`
|
|
945
|
-
})), ie =
|
|
946
|
-
...
|
|
947
|
-
width: `${
|
|
948
|
-
})),
|
|
949
|
-
|
|
950
|
-
let
|
|
951
|
-
|
|
952
|
-
|
|
953
|
-
|
|
945
|
+
})), ie = v(() => L.value.width - L.value.margins.left - L.value.margins.right), ae = v(() => ({
|
|
946
|
+
...re.value,
|
|
947
|
+
width: `${ie.value}pt`
|
|
948
|
+
})), W = ne("flowEl"), { width: ce } = se(W), le = v(() => {
|
|
949
|
+
let e = /* @__PURE__ */ new Map(), t = 0;
|
|
950
|
+
for (let r of n.preview.blocks) {
|
|
951
|
+
if (r.kind === "table") continue;
|
|
952
|
+
let n = r.runs.reduce((e, t) => e + t.text.trim().length, 0);
|
|
953
|
+
if (n) {
|
|
954
|
+
let i = Math.max(0, r.style?.indentLeft ?? 0);
|
|
955
|
+
e.set(i, (e.get(i) ?? 0) + n), t += n;
|
|
956
|
+
}
|
|
957
|
+
}
|
|
958
|
+
let r = 0;
|
|
959
|
+
for (let [n, i] of [...e].sort((e, t) => e[0] - t[0])) if (r += i, r > t / 10) return n;
|
|
960
|
+
return 0;
|
|
961
|
+
}), ue = v(() => ({
|
|
962
|
+
...re.value,
|
|
963
|
+
"--pk-word-indent-shared": `${le.value}pt`,
|
|
964
|
+
"--pk-word-indent-scale": ce.value ? Math.min(1, ce.value / (ie.value * Pt)) : 1
|
|
965
|
+
})), G = F([]), fe = F({}), K = async () => {
|
|
966
|
+
await ee();
|
|
967
|
+
let e = T.value?.querySelectorAll("[data-item]");
|
|
968
|
+
G.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
|
|
969
|
+
let t = T.value?.querySelectorAll("[data-part]");
|
|
970
|
+
fe.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
|
|
954
971
|
};
|
|
955
|
-
|
|
972
|
+
U([
|
|
956
973
|
h,
|
|
957
|
-
|
|
974
|
+
H,
|
|
958
975
|
() => n.preview.parts
|
|
959
|
-
],
|
|
960
|
-
|
|
976
|
+
], K, { flush: "post" }), te(() => {
|
|
977
|
+
K(), document.fonts?.ready.then(K);
|
|
961
978
|
});
|
|
962
|
-
let
|
|
963
|
-
if (!
|
|
979
|
+
let q = v(() => {
|
|
980
|
+
if (!H.value || G.value.length !== h.value.length) return [{
|
|
964
981
|
items: h.value.map((e, t) => t),
|
|
965
982
|
section: 0,
|
|
966
983
|
number: 1,
|
|
@@ -968,10 +985,10 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
968
985
|
bottom: L.value.margins.bottom
|
|
969
986
|
}];
|
|
970
987
|
let e = [], t = 0, r = !0, i = 0, a, o = () => {
|
|
971
|
-
let n =
|
|
988
|
+
let n = M.value[t];
|
|
972
989
|
return r && n.pageStart !== void 0 ? n.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
|
|
973
990
|
}, s = (e) => {
|
|
974
|
-
let i =
|
|
991
|
+
let i = M.value[t], a = (t) => r && i.titlePage ? t.first : n.preview.evenAndOddHeaders && e % 2 == 0 ? t.even : t.default, o = a(i.headers), s = a(i.footers), c = (e) => e ? (fe.value[e] ?? 0) / Pt : 0;
|
|
975
992
|
return {
|
|
976
993
|
header: o,
|
|
977
994
|
footer: s,
|
|
@@ -988,166 +1005,166 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
988
1005
|
}), r = !1, i = 0;
|
|
989
1006
|
};
|
|
990
1007
|
return h.value.forEach((n, l) => {
|
|
991
|
-
n.section !== void 0 && n.section !== t &&
|
|
992
|
-
let u = e[e.length - 1], d = u &&
|
|
993
|
-
for (let e = l; h.value[e]?.keepNext && e + 1 < h.value.length && !h.value[e + 1].breakBefore; e++) p +=
|
|
994
|
-
(!u || u.items.length && (n.breakBefore || i +
|
|
1008
|
+
n.section !== void 0 && n.section !== t && M.value[n.section] && (t = n.section, r = n.breakBefore || !e.length, r || (a = M.value[t].pageStart));
|
|
1009
|
+
let u = e[e.length - 1], d = u && M.value[u.section].page, f = d ? (d.height - u.top - u.bottom) * Pt : 0, p = G.value[l];
|
|
1010
|
+
for (let e = l; h.value[e]?.keepNext && e + 1 < h.value.length && !h.value[e + 1].breakBefore; e++) p += G.value[e + 1];
|
|
1011
|
+
(!u || u.items.length && (n.breakBefore || i + G.value[l] > f || i + p > f && p <= (() => {
|
|
995
1012
|
let e = s(o());
|
|
996
|
-
return (
|
|
997
|
-
})())) && c(), e[e.length - 1].items.push(l), i +=
|
|
1013
|
+
return (M.value[t].page.height - e.top - e.bottom) * Pt;
|
|
1014
|
+
})())) && c(), e[e.length - 1].items.push(l), i += G.value[l];
|
|
998
1015
|
}), e.length || c(), e;
|
|
999
|
-
}),
|
|
1016
|
+
}), pe = v(() => {
|
|
1000
1017
|
let e = /* @__PURE__ */ new Map();
|
|
1001
|
-
for (let t of
|
|
1002
|
-
return
|
|
1018
|
+
for (let t of q.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
|
|
1019
|
+
return q.value.map((t) => ({
|
|
1003
1020
|
page: t.number,
|
|
1004
|
-
pages:
|
|
1021
|
+
pages: q.value.length,
|
|
1005
1022
|
sectionPages: e.get(t.section) ?? 1
|
|
1006
1023
|
}));
|
|
1007
|
-
}),
|
|
1008
|
-
let t =
|
|
1024
|
+
}), me = (e) => {
|
|
1025
|
+
let t = M.value[e.section].page;
|
|
1009
1026
|
return {
|
|
1010
|
-
...
|
|
1027
|
+
...re.value,
|
|
1011
1028
|
width: `${t.width}pt`,
|
|
1012
1029
|
minHeight: `${t.height}pt`,
|
|
1013
1030
|
padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
|
|
1014
1031
|
};
|
|
1015
|
-
},
|
|
1032
|
+
}, he = (e) => {
|
|
1016
1033
|
let t = [...new Set(e.items.map((e) => h.value[e].block))];
|
|
1017
1034
|
return l(t.map((e) => n.preview.blocks[e]), n.mode).flatMap((t) => {
|
|
1018
1035
|
let r = c(n.preview.images, t.ref);
|
|
1019
1036
|
return r ? [{
|
|
1020
1037
|
src: r,
|
|
1021
|
-
css: o(t,
|
|
1038
|
+
css: o(t, M.value[e.section].page)
|
|
1022
1039
|
}] : [];
|
|
1023
1040
|
});
|
|
1024
|
-
},
|
|
1025
|
-
|
|
1026
|
-
},
|
|
1027
|
-
let e =
|
|
1041
|
+
}, ge = V(e, "fit"), _e = V(e, "zoom"), J = v(() => ge.value ? Math.min(1.25, Math.max(.3, R.value)) : _e.value), ve = (e) => {
|
|
1042
|
+
_e.value = Math.min(2, Math.max(.3, Math.round((J.value + e) * 10) / 10)), ge.value = !1;
|
|
1043
|
+
}, be = F(0), xe = F(), Se = () => {
|
|
1044
|
+
let e = C.value?.getBoundingClientRect();
|
|
1028
1045
|
if (!e) return;
|
|
1029
|
-
let t =
|
|
1046
|
+
let t = C.value?.querySelectorAll("[data-page]") ?? [], n = 0;
|
|
1030
1047
|
for (let [r, i] of [...t].entries()) {
|
|
1031
1048
|
if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
|
|
1032
1049
|
n = r;
|
|
1033
1050
|
}
|
|
1034
|
-
|
|
1051
|
+
be.value = n;
|
|
1035
1052
|
let r;
|
|
1036
|
-
for (let t of
|
|
1037
|
-
let n =
|
|
1053
|
+
for (let t of Q.value) {
|
|
1054
|
+
let n = C.value?.querySelector(`[data-key="${t.key}"]`);
|
|
1038
1055
|
if (n) {
|
|
1039
1056
|
if (n.getBoundingClientRect().top - e.top > 48) break;
|
|
1040
1057
|
r = t.key;
|
|
1041
1058
|
}
|
|
1042
1059
|
}
|
|
1043
|
-
|
|
1044
|
-
},
|
|
1045
|
-
|
|
1046
|
-
|
|
1060
|
+
xe.value = r ?? Q.value[0]?.key;
|
|
1061
|
+
}, Y = 0, X = () => {
|
|
1062
|
+
Y ||= requestAnimationFrame(() => {
|
|
1063
|
+
Y = 0, Se();
|
|
1047
1064
|
});
|
|
1048
1065
|
};
|
|
1049
|
-
|
|
1050
|
-
let { selection:
|
|
1051
|
-
|
|
1052
|
-
let t =
|
|
1053
|
-
r("select", e && t ?
|
|
1066
|
+
j(() => cancelAnimationFrame(Y)), U(q, () => ee(X));
|
|
1067
|
+
let { selection: Z } = de({ root: () => C.value?.getRootNode() });
|
|
1068
|
+
U(Z, (e) => {
|
|
1069
|
+
let t = C.value;
|
|
1070
|
+
r("select", e && t ? ye(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
|
|
1054
1071
|
});
|
|
1055
|
-
let
|
|
1056
|
-
let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label,
|
|
1072
|
+
let Ce = (e) => u(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), Q = v(() => h.value.flatMap((e) => {
|
|
1073
|
+
let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label, Ce(t.runs)].filter(Boolean).join(" ") : "";
|
|
1057
1074
|
return t.kind === "heading" && t.level <= 3 && r ? [{
|
|
1058
1075
|
key: e.key,
|
|
1059
1076
|
level: t.level,
|
|
1060
1077
|
text: r
|
|
1061
1078
|
}] : [];
|
|
1062
|
-
})),
|
|
1079
|
+
})), we = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, $ = v(() => h.value.flatMap((e) => {
|
|
1063
1080
|
let t = n.preview.blocks[e.block], r = t.kind === "table" ? (t.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : t.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();
|
|
1064
1081
|
return i || a ? [{
|
|
1065
1082
|
key: e.key,
|
|
1066
|
-
removed:
|
|
1067
|
-
added:
|
|
1083
|
+
removed: we(i),
|
|
1084
|
+
added: we(a)
|
|
1068
1085
|
}] : [];
|
|
1069
|
-
})),
|
|
1070
|
-
|
|
1086
|
+
})), Te = F("outline"), Ee = F(!1), De = (e) => {
|
|
1087
|
+
C.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
|
|
1071
1088
|
block: "start",
|
|
1072
1089
|
behavior: "smooth"
|
|
1073
|
-
}),
|
|
1074
|
-
},
|
|
1090
|
+
}), O.value || (Ee.value = !1);
|
|
1091
|
+
}, Oe = v(() => n.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => Ce(e.runs)) : [Ce(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), ke = v(() => n.preview.revisionAuthors.join(", "));
|
|
1075
1092
|
return (t, n) => {
|
|
1076
1093
|
let r = a;
|
|
1077
|
-
return
|
|
1094
|
+
return N(), x("div", {
|
|
1078
1095
|
ref_key: "rootEl",
|
|
1079
|
-
ref:
|
|
1080
|
-
class:
|
|
1096
|
+
ref: g,
|
|
1097
|
+
class: k(["pk-word-preview", { "pk-word-preview--paged": H.value }])
|
|
1081
1098
|
}, [
|
|
1082
|
-
(
|
|
1099
|
+
(O.value || Ee.value) && (Q.value.length || $.value.length) ? (N(), x("aside", {
|
|
1083
1100
|
key: 0,
|
|
1084
|
-
class:
|
|
1085
|
-
"aria-label":
|
|
1086
|
-
}, [
|
|
1101
|
+
class: k(["pk-word-preview__side", { "pk-word-preview__side--over": !O.value }]),
|
|
1102
|
+
"aria-label": B(i)("chatFilePreview.outline")
|
|
1103
|
+
}, [S("div", lt, [S("button", {
|
|
1087
1104
|
type: "button",
|
|
1088
1105
|
role: "tab",
|
|
1089
1106
|
class: "pk-word-preview__tab",
|
|
1090
|
-
"aria-selected":
|
|
1091
|
-
onClick: n[0] ||= (e) =>
|
|
1092
|
-
},
|
|
1107
|
+
"aria-selected": Te.value === "outline",
|
|
1108
|
+
onClick: n[0] ||= (e) => Te.value = "outline"
|
|
1109
|
+
}, z(B(i)("chatFilePreview.outline")), 9, ut), $.value.length ? (N(), x("button", {
|
|
1093
1110
|
key: 0,
|
|
1094
1111
|
type: "button",
|
|
1095
1112
|
role: "tab",
|
|
1096
1113
|
class: "pk-word-preview__tab",
|
|
1097
|
-
"aria-selected":
|
|
1098
|
-
onClick: n[1] ||= (e) =>
|
|
1099
|
-
},
|
|
1114
|
+
"aria-selected": Te.value === "changes",
|
|
1115
|
+
onClick: n[1] ||= (e) => Te.value = "changes"
|
|
1116
|
+
}, z(B(i)("chatFilePreview.changes", { count: $.value.length })), 9, dt)) : b("", !0)]), Te.value === "outline" || !$.value.length ? (N(), x("nav", ft, [(N(!0), x(_, null, I(Q.value, (e) => (N(), x("button", {
|
|
1100
1117
|
key: e.key,
|
|
1101
1118
|
type: "button",
|
|
1102
|
-
class:
|
|
1103
|
-
"aria-current":
|
|
1104
|
-
onClick: (t) =>
|
|
1105
|
-
}, [
|
|
1119
|
+
class: k(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
|
|
1120
|
+
"aria-current": xe.value === e.key ? "location" : void 0,
|
|
1121
|
+
onClick: (t) => De(e.key)
|
|
1122
|
+
}, [S("span", mt, z(e.text), 1), $.value.some((t) => t.key === e.key) ? (N(), x("span", ht)) : b("", !0)], 10, pt))), 128)), Q.value.length ? b("", !0) : (N(), x("p", gt, z(B(i)("chatFilePreview.noHeadings")), 1))])) : (N(), x("nav", _t, [(N(!0), x(_, null, I($.value, (e) => (N(), x("button", {
|
|
1106
1123
|
key: e.key,
|
|
1107
1124
|
type: "button",
|
|
1108
1125
|
class: "pk-word-preview__entry pk-word-preview__entry--change",
|
|
1109
|
-
onClick: (t) =>
|
|
1110
|
-
}, [e.removed ? (
|
|
1111
|
-
|
|
1126
|
+
onClick: (t) => De(e.key)
|
|
1127
|
+
}, [e.removed ? (N(), x("del", yt, z(e.removed), 1)) : b("", !0), e.added ? (N(), x("ins", bt, z(e.added), 1)) : b("", !0)], 8, vt))), 128))]))], 10, ct)) : b("", !0),
|
|
1128
|
+
S("div", xt, [S("div", {
|
|
1112
1129
|
ref_key: "scrollEl",
|
|
1113
|
-
ref:
|
|
1130
|
+
ref: C,
|
|
1114
1131
|
class: "pk-word-preview__scroll",
|
|
1115
|
-
onScroll:
|
|
1116
|
-
}, [
|
|
1132
|
+
onScroll: X
|
|
1133
|
+
}, [H.value ? (N(), x("div", {
|
|
1117
1134
|
key: 0,
|
|
1118
1135
|
class: "pk-word-preview__pages",
|
|
1119
|
-
style:
|
|
1120
|
-
}, [(
|
|
1136
|
+
style: A({ zoom: J.value })
|
|
1137
|
+
}, [(N(!0), x(_, null, I(q.value, (t, n) => (N(), x("article", {
|
|
1121
1138
|
key: n,
|
|
1122
1139
|
"data-page": "",
|
|
1123
1140
|
class: "pk-word-preview__page",
|
|
1124
|
-
"aria-label":
|
|
1141
|
+
"aria-label": B(i)("chatFilePreview.pageOf", {
|
|
1125
1142
|
page: n + 1,
|
|
1126
|
-
count:
|
|
1143
|
+
count: q.value.length
|
|
1127
1144
|
}),
|
|
1128
|
-
style:
|
|
1145
|
+
style: A(me(t))
|
|
1129
1146
|
}, [
|
|
1130
|
-
t.header && e.preview.parts?.[t.header] ? (
|
|
1147
|
+
t.header && e.preview.parts?.[t.header] ? (N(), y(st, {
|
|
1131
1148
|
key: 0,
|
|
1132
1149
|
blocks: e.preview.parts[t.header],
|
|
1133
1150
|
where: "header",
|
|
1134
|
-
section:
|
|
1151
|
+
section: M.value[t.section],
|
|
1135
1152
|
mode: e.mode,
|
|
1136
|
-
numbers:
|
|
1153
|
+
numbers: pe.value[n]
|
|
1137
1154
|
}, null, 8, [
|
|
1138
1155
|
"blocks",
|
|
1139
1156
|
"section",
|
|
1140
1157
|
"mode",
|
|
1141
1158
|
"numbers"
|
|
1142
|
-
])) :
|
|
1143
|
-
(
|
|
1159
|
+
])) : b("", !0),
|
|
1160
|
+
(N(!0), x(_, null, I(t.items, (r) => (N(), y(it, {
|
|
1144
1161
|
key: h.value[r].key,
|
|
1145
1162
|
"data-key": h.value[r].key,
|
|
1146
1163
|
block: e.preview.blocks[h.value[r].block],
|
|
1147
1164
|
row: h.value[r].row,
|
|
1148
1165
|
mode: e.mode,
|
|
1149
|
-
page:
|
|
1150
|
-
numbers:
|
|
1166
|
+
page: M.value[t.section].page,
|
|
1167
|
+
numbers: pe.value[n]
|
|
1151
1168
|
}, null, 8, [
|
|
1152
1169
|
"data-key",
|
|
1153
1170
|
"block",
|
|
@@ -1156,31 +1173,33 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1156
1173
|
"page",
|
|
1157
1174
|
"numbers"
|
|
1158
1175
|
]))), 128)),
|
|
1159
|
-
(
|
|
1176
|
+
(N(!0), x(_, null, I(he(t), (e, t) => (N(), x("img", {
|
|
1160
1177
|
key: `image-${t}`,
|
|
1161
1178
|
class: "pk-word-preview__float",
|
|
1162
|
-
style:
|
|
1179
|
+
style: A(e.css),
|
|
1163
1180
|
src: e.src,
|
|
1164
1181
|
alt: ""
|
|
1165
1182
|
}, null, 12, Ct))), 128)),
|
|
1166
|
-
t.footer && e.preview.parts?.[t.footer] ? (
|
|
1183
|
+
t.footer && e.preview.parts?.[t.footer] ? (N(), y(st, {
|
|
1167
1184
|
key: 1,
|
|
1168
1185
|
blocks: e.preview.parts[t.footer],
|
|
1169
1186
|
where: "footer",
|
|
1170
|
-
section:
|
|
1187
|
+
section: M.value[t.section],
|
|
1171
1188
|
mode: e.mode,
|
|
1172
|
-
numbers:
|
|
1189
|
+
numbers: pe.value[n]
|
|
1173
1190
|
}, null, 8, [
|
|
1174
1191
|
"blocks",
|
|
1175
1192
|
"section",
|
|
1176
1193
|
"mode",
|
|
1177
1194
|
"numbers"
|
|
1178
|
-
])) :
|
|
1179
|
-
], 12, St))), 128))], 4)) : (
|
|
1195
|
+
])) : b("", !0)
|
|
1196
|
+
], 12, St))), 128))], 4)) : (N(), x("article", {
|
|
1180
1197
|
key: 1,
|
|
1198
|
+
ref_key: "flowEl",
|
|
1199
|
+
ref: W,
|
|
1181
1200
|
class: "pk-word-preview__page pk-word-preview__page--flow",
|
|
1182
|
-
style:
|
|
1183
|
-
}, [(
|
|
1201
|
+
style: A(ue.value)
|
|
1202
|
+
}, [(N(!0), x(_, null, I(h.value, (t) => (N(), y(it, {
|
|
1184
1203
|
key: t.key,
|
|
1185
1204
|
"data-key": t.key,
|
|
1186
1205
|
block: e.preview.blocks[t.block],
|
|
@@ -1191,72 +1210,81 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1191
1210
|
"block",
|
|
1192
1211
|
"row",
|
|
1193
1212
|
"mode"
|
|
1194
|
-
]))), 128))], 4)), e.preview.truncated ? (
|
|
1195
|
-
|
|
1196
|
-
page:
|
|
1197
|
-
count:
|
|
1198
|
-
})), 1)) :
|
|
1199
|
-
|
|
1200
|
-
e.mode === "markup" && e.preview.revisionAuthors.length ? (
|
|
1201
|
-
|
|
1213
|
+
]))), 128))], 4)), e.preview.truncated ? (N(), x("p", wt, z(B(i)("chatFilePreview.truncated")), 1)) : b("", !0)], 544), S("div", Tt, [
|
|
1214
|
+
H.value ? (N(), x("span", Et, z(B(i)("chatFilePreview.pageOf", {
|
|
1215
|
+
page: be.value + 1,
|
|
1216
|
+
count: q.value.length
|
|
1217
|
+
})), 1)) : b("", !0),
|
|
1218
|
+
S("span", Dt, z(B(i)("chatFilePreview.words", Oe.value)), 1),
|
|
1219
|
+
e.mode === "markup" && e.preview.revisionAuthors.length ? (N(), x("span", Ot, [
|
|
1220
|
+
S("span", {
|
|
1202
1221
|
class: "pk-word-preview__legend-text",
|
|
1203
|
-
title:
|
|
1204
|
-
},
|
|
1205
|
-
|
|
1206
|
-
|
|
1207
|
-
])) :
|
|
1208
|
-
n[6] ||=
|
|
1209
|
-
!
|
|
1222
|
+
title: B(i)("chatFilePreview.revisionsOf", { authors: ke.value })
|
|
1223
|
+
}, z(B(i)("chatFilePreview.revisionsOf", { authors: ke.value })), 9, kt),
|
|
1224
|
+
S("del", At, z(B(i)("chatFilePreview.removed")), 1),
|
|
1225
|
+
S("ins", jt, z(B(i)("chatFilePreview.added")), 1)
|
|
1226
|
+
])) : b("", !0),
|
|
1227
|
+
n[6] ||= S("span", { class: "pk-word-preview__spacer" }, null, -1),
|
|
1228
|
+
!O.value && (Q.value.length || $.value.length) ? (N(), y(r, {
|
|
1210
1229
|
key: 2,
|
|
1211
1230
|
class: "pk-word-preview__outline-toggle",
|
|
1212
1231
|
modifiers: "action-quiet",
|
|
1213
1232
|
icon: "ri:list-unordered",
|
|
1214
|
-
label:
|
|
1215
|
-
title:
|
|
1216
|
-
"aria-label":
|
|
1217
|
-
"aria-expanded":
|
|
1218
|
-
onClick: n[2] ||= (e) =>
|
|
1233
|
+
label: B(i)("chatFilePreview.outline"),
|
|
1234
|
+
title: B(i)("chatFilePreview.outline"),
|
|
1235
|
+
"aria-label": B(i)("chatFilePreview.outline"),
|
|
1236
|
+
"aria-expanded": Ee.value,
|
|
1237
|
+
onClick: n[2] ||= (e) => Ee.value = !Ee.value
|
|
1219
1238
|
}, null, 8, [
|
|
1220
1239
|
"label",
|
|
1221
1240
|
"title",
|
|
1222
1241
|
"aria-label",
|
|
1223
1242
|
"aria-expanded"
|
|
1224
|
-
])) :
|
|
1225
|
-
|
|
1226
|
-
|
|
1243
|
+
])) : b("", !0),
|
|
1244
|
+
H.value ? (N(), x(_, { key: 3 }, [
|
|
1245
|
+
w(r, {
|
|
1246
|
+
class: "pk-word-preview__fit",
|
|
1227
1247
|
modifiers: "action-quiet",
|
|
1228
|
-
|
|
1229
|
-
|
|
1230
|
-
|
|
1231
|
-
|
|
1232
|
-
|
|
1248
|
+
icon: "ri:expand-width-line",
|
|
1249
|
+
label: B(i)("chatFilePreview.fitWidth"),
|
|
1250
|
+
title: B(i)("chatFilePreview.fitWidth"),
|
|
1251
|
+
"aria-label": B(i)("chatFilePreview.fitWidth"),
|
|
1252
|
+
disabled: ge.value,
|
|
1253
|
+
onClick: n[3] ||= (e) => ge.value = !0
|
|
1254
|
+
}, null, 8, [
|
|
1255
|
+
"label",
|
|
1256
|
+
"title",
|
|
1257
|
+
"aria-label",
|
|
1258
|
+
"disabled"
|
|
1259
|
+
]),
|
|
1260
|
+
w(r, {
|
|
1233
1261
|
modifiers: "action-quiet",
|
|
1234
1262
|
icon: "ri:subtract-line",
|
|
1235
|
-
"aria-label":
|
|
1236
|
-
disabled:
|
|
1237
|
-
onClick: n[4] ||= (e) =>
|
|
1263
|
+
"aria-label": B(i)("chatFilePreview.zoomOut"),
|
|
1264
|
+
disabled: J.value <= .3,
|
|
1265
|
+
onClick: n[4] ||= (e) => ve(-.1)
|
|
1238
1266
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1239
|
-
|
|
1240
|
-
|
|
1267
|
+
S("span", Mt, z(Math.round(J.value * 100)) + "% ", 1),
|
|
1268
|
+
w(r, {
|
|
1241
1269
|
modifiers: "action-quiet",
|
|
1242
1270
|
icon: "ri:add-line",
|
|
1243
|
-
"aria-label":
|
|
1244
|
-
disabled:
|
|
1245
|
-
onClick: n[5] ||= (e) =>
|
|
1271
|
+
"aria-label": B(i)("chatFilePreview.zoomIn"),
|
|
1272
|
+
disabled: J.value >= 2,
|
|
1273
|
+
onClick: n[5] ||= (e) => ve(.1)
|
|
1246
1274
|
}, null, 8, ["aria-label", "disabled"])
|
|
1247
|
-
], 64)) :
|
|
1275
|
+
], 64)) : b("", !0)
|
|
1248
1276
|
])]),
|
|
1249
|
-
|
|
1277
|
+
H.value ? (N(), x("div", {
|
|
1250
1278
|
key: 1,
|
|
1251
1279
|
ref_key: "measureEl",
|
|
1252
|
-
ref:
|
|
1280
|
+
ref: T,
|
|
1253
1281
|
class: "pk-word-preview__measure",
|
|
1254
1282
|
"aria-hidden": "true",
|
|
1255
|
-
style:
|
|
1256
|
-
}, [(
|
|
1283
|
+
style: A(ae.value)
|
|
1284
|
+
}, [(N(!0), x(_, null, I(h.value, (t) => (N(), x("div", {
|
|
1257
1285
|
key: t.key,
|
|
1258
1286
|
"data-item": ""
|
|
1259
|
-
}, [
|
|
1287
|
+
}, [w(it, {
|
|
1260
1288
|
block: e.preview.blocks[t.block],
|
|
1261
1289
|
row: t.row,
|
|
1262
1290
|
mode: e.mode,
|
|
@@ -1266,10 +1294,10 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1266
1294
|
"row",
|
|
1267
1295
|
"mode",
|
|
1268
1296
|
"page"
|
|
1269
|
-
])]))), 128)), (
|
|
1297
|
+
])]))), 128)), (N(!0), x(_, null, I(e.preview.parts, (t, n) => (N(), x("div", {
|
|
1270
1298
|
key: n,
|
|
1271
1299
|
"data-part": n
|
|
1272
|
-
}, [(
|
|
1300
|
+
}, [(N(!0), x(_, null, I(B(f)(t, e.mode), (n) => (N(), y(it, {
|
|
1273
1301
|
key: n.key,
|
|
1274
1302
|
block: t[n.block],
|
|
1275
1303
|
row: n.row,
|
|
@@ -1280,25 +1308,25 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1280
1308
|
"row",
|
|
1281
1309
|
"mode",
|
|
1282
1310
|
"page"
|
|
1283
|
-
]))), 128))], 8, Nt))), 128))], 4)) :
|
|
1311
|
+
]))), 128))], 8, Nt))), 128))], 4)) : b("", !0)
|
|
1284
1312
|
], 2);
|
|
1285
1313
|
};
|
|
1286
1314
|
}
|
|
1287
|
-
}),
|
|
1315
|
+
}), Lt = ["aria-label"], Rt = { class: "pk-file-preview__head" }, zt = { class: "pk-file-preview__file" }, Bt = {
|
|
1288
1316
|
class: "pk-file-preview__tile",
|
|
1289
1317
|
"aria-hidden": "true"
|
|
1290
|
-
},
|
|
1318
|
+
}, Vt = { class: "pk-file-preview__name" }, Ht = { class: "pk-file-preview__title" }, Ut = { class: "pk-file-preview__note" }, Wt = {
|
|
1291
1319
|
key: 0,
|
|
1292
1320
|
class: "pk-file-preview__tools"
|
|
1293
|
-
},
|
|
1321
|
+
}, Gt = ["aria-label"], Kt = { class: "pk-file-preview__version" }, qt = { class: "pk-file-preview__mode-long" }, Jt = { class: "pk-file-preview__mode-short" }, Yt = { class: "pk-file-preview__actions" }, Xt = { class: "pk-file-preview__body" }, Zt = {
|
|
1294
1322
|
key: 0,
|
|
1295
1323
|
class: "pk-file-preview__skeleton vv-skeleton"
|
|
1296
|
-
},
|
|
1324
|
+
}, Qt = {
|
|
1297
1325
|
key: 1,
|
|
1298
1326
|
class: "pk-file-preview__empty"
|
|
1299
|
-
},
|
|
1327
|
+
}, $t = /*@__PURE__*/ T({
|
|
1300
1328
|
__name: "PkFilePreview",
|
|
1301
|
-
props: /*@__PURE__*/
|
|
1329
|
+
props: /*@__PURE__*/ O({
|
|
1302
1330
|
kind: {},
|
|
1303
1331
|
filename: {},
|
|
1304
1332
|
version: {},
|
|
@@ -1325,7 +1353,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1325
1353
|
},
|
|
1326
1354
|
fitModifiers: {}
|
|
1327
1355
|
}),
|
|
1328
|
-
emits: /*@__PURE__*/
|
|
1356
|
+
emits: /*@__PURE__*/ O([
|
|
1329
1357
|
"close",
|
|
1330
1358
|
"version",
|
|
1331
1359
|
"restore",
|
|
@@ -1338,7 +1366,7 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1338
1366
|
"update:fit"
|
|
1339
1367
|
]),
|
|
1340
1368
|
setup(e, { emit: n }) {
|
|
1341
|
-
let r = e, i = n, { t: o, locale: s } = oe({ useScope: "global" }), c =
|
|
1369
|
+
let r = e, i = n, { t: o, locale: s } = oe({ useScope: "global" }), c = v(() => r.versions ?? []), l = v(() => r.version ? c.value.indexOf(r.version) : -1), u = v(() => l.value > 0 ? c.value[l.value - 1] : void 0), d = v(() => l.value >= 0 && l.value < c.value.length - 1 ? c.value[l.value + 1] : void 0), f = V(e, "mode"), p = V(e, "sheet"), m = V(e, "zoom"), h = V(e, "fit"), C = v(() => [
|
|
1342
1370
|
{
|
|
1343
1371
|
value: "markup",
|
|
1344
1372
|
label: o("chatFilePreview.modeMarkup")
|
|
@@ -1351,46 +1379,46 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1351
1379
|
value: "original",
|
|
1352
1380
|
label: o("chatFilePreview.modeOriginal")
|
|
1353
1381
|
}
|
|
1354
|
-
]),
|
|
1355
|
-
|
|
1382
|
+
]), T = v(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
|
|
1383
|
+
U(() => r.version, () => {
|
|
1356
1384
|
f.value = "markup";
|
|
1357
1385
|
});
|
|
1358
|
-
let
|
|
1359
|
-
|
|
1386
|
+
let E = ne("rootEl"), D = R(), O = F(!1), A = () => {
|
|
1387
|
+
D.value = void 0, O.value = !1;
|
|
1360
1388
|
};
|
|
1361
|
-
|
|
1389
|
+
U(() => [
|
|
1362
1390
|
r.version,
|
|
1363
1391
|
r.preview,
|
|
1364
1392
|
f.value
|
|
1365
|
-
],
|
|
1366
|
-
let
|
|
1367
|
-
|
|
1393
|
+
], A);
|
|
1394
|
+
let j = (e) => {
|
|
1395
|
+
O.value || (D.value = e);
|
|
1368
1396
|
};
|
|
1369
|
-
|
|
1370
|
-
let n =
|
|
1371
|
-
t && !e && n?.format === "docx" && (await
|
|
1397
|
+
U(O, async (e, t) => {
|
|
1398
|
+
let n = D.value;
|
|
1399
|
+
t && !e && n?.format === "docx" && (await ee(), n.restore());
|
|
1372
1400
|
});
|
|
1373
|
-
let
|
|
1401
|
+
let te = v(() => !r.version || r.version === c.value[c.value.length - 1]), M = () => {
|
|
1374
1402
|
let e = c.value[c.value.length - 1];
|
|
1375
1403
|
e && i("version", e);
|
|
1376
|
-
},
|
|
1377
|
-
let e =
|
|
1378
|
-
return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) >
|
|
1379
|
-
}),
|
|
1380
|
-
let e =
|
|
1404
|
+
}, P = v(() => {
|
|
1405
|
+
let e = D.value;
|
|
1406
|
+
return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > G;
|
|
1407
|
+
}), L = v(() => D.value?.format === "docx" && f.value === "original"), H = v(() => P.value || L.value), ie = v(() => L.value ? o("selectionActions.hintOriginal") : P.value ? o(D.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: D.value?.format === "docx" ? 200 : G }) : void 0), ae = (e) => e[s.value] ?? e[s.value.split("-")[0]] ?? Object.values(e)[0] ?? "", W = ["explain", "summarize"], se = v(() => {
|
|
1408
|
+
let e = D.value, t = r.selectionActions;
|
|
1381
1409
|
if (!e || !t) return [];
|
|
1382
1410
|
let n = e.format;
|
|
1383
|
-
return [...(n === "docx" &&
|
|
1411
|
+
return [...(n === "docx" && H.value ? W : t.builtIns).map((e) => ({
|
|
1384
1412
|
id: e,
|
|
1385
1413
|
label: o(`selectionActions.builtIn.${e}`),
|
|
1386
1414
|
...e === "translate" && { asks: o("selectionActions.translateAsks") },
|
|
1387
1415
|
prompt: (t) => o(`selectionActions.prompt.${n}.${e}`, { language: t ?? "" })
|
|
1388
|
-
})), ...(
|
|
1416
|
+
})), ...(H.value ? [] : t.actions).map((e) => ({
|
|
1389
1417
|
id: e.id,
|
|
1390
1418
|
label: ae(e.label),
|
|
1391
1419
|
prompt: () => ae(e.prompt)
|
|
1392
1420
|
}))];
|
|
1393
|
-
}),
|
|
1421
|
+
}), le = (e) => {
|
|
1394
1422
|
if (e.format === "docx") return o("selectionActions.labelParagraphs", {
|
|
1395
1423
|
file: r.filename,
|
|
1396
1424
|
count: e.paragraphCount
|
|
@@ -1406,20 +1434,20 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1406
1434
|
sheet: e.sheet,
|
|
1407
1435
|
cell: t
|
|
1408
1436
|
});
|
|
1409
|
-
},
|
|
1437
|
+
}, ue = (e) => {
|
|
1410
1438
|
if (!r.fileId || !r.storedFileName) return;
|
|
1411
1439
|
let t = {
|
|
1412
1440
|
fileId: r.fileId,
|
|
1413
1441
|
version: r.version ?? 1,
|
|
1414
1442
|
storedFileName: r.storedFileName,
|
|
1415
|
-
label:
|
|
1443
|
+
label: le(e)
|
|
1416
1444
|
};
|
|
1417
1445
|
if (e.format === "docx") {
|
|
1418
1446
|
let { measure: n, ...r } = e;
|
|
1419
1447
|
return {
|
|
1420
1448
|
...t,
|
|
1421
1449
|
...r,
|
|
1422
|
-
...
|
|
1450
|
+
...L.value && { original: !0 }
|
|
1423
1451
|
};
|
|
1424
1452
|
}
|
|
1425
1453
|
let { measure: n, cells: i, ...a } = e;
|
|
@@ -1427,23 +1455,23 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1427
1455
|
...t,
|
|
1428
1456
|
...a
|
|
1429
1457
|
};
|
|
1430
|
-
},
|
|
1431
|
-
let n =
|
|
1458
|
+
}, de = (e, t) => {
|
|
1459
|
+
let n = D.value, r = n && ue(n);
|
|
1432
1460
|
r && (i("selectionSend", e, r, {
|
|
1433
1461
|
id: t,
|
|
1434
1462
|
size: n.format === "docx" ? n.paragraphCount : n.cells
|
|
1435
|
-
}),
|
|
1436
|
-
},
|
|
1463
|
+
}), A(), document.getSelection()?.removeAllRanges());
|
|
1464
|
+
}, fe = (e, t) => {
|
|
1437
1465
|
let n = se.value.find((t) => t.id === e);
|
|
1438
|
-
n &&
|
|
1439
|
-
},
|
|
1440
|
-
|
|
1466
|
+
n && de(n.prompt(t), e);
|
|
1467
|
+
}, K = F(0);
|
|
1468
|
+
ce(E, "scroll", () => K.value++, {
|
|
1441
1469
|
capture: !0,
|
|
1442
1470
|
passive: !0
|
|
1443
|
-
}),
|
|
1444
|
-
let
|
|
1445
|
-
|
|
1446
|
-
let e =
|
|
1471
|
+
}), ce(window, "resize", () => K.value++, { passive: !0 });
|
|
1472
|
+
let q = v(() => {
|
|
1473
|
+
K.value;
|
|
1474
|
+
let e = D.value?.measure(), t = E.value?.getBoundingClientRect();
|
|
1447
1475
|
if (e && t) return {
|
|
1448
1476
|
start: {
|
|
1449
1477
|
top: e.start.top - t.top,
|
|
@@ -1459,148 +1487,148 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1459
1487
|
};
|
|
1460
1488
|
});
|
|
1461
1489
|
return (n, r) => {
|
|
1462
|
-
let s =
|
|
1463
|
-
return
|
|
1490
|
+
let s = g, l = a;
|
|
1491
|
+
return N(), x("section", {
|
|
1464
1492
|
ref_key: "rootEl",
|
|
1465
|
-
ref:
|
|
1493
|
+
ref: E,
|
|
1466
1494
|
class: "pk-file-preview",
|
|
1467
1495
|
"aria-label": e.filename,
|
|
1468
1496
|
tabindex: "-1",
|
|
1469
1497
|
autofocus: ""
|
|
1470
1498
|
}, [
|
|
1471
|
-
|
|
1472
|
-
|
|
1499
|
+
S("header", Rt, [
|
|
1500
|
+
S("div", zt, [S("span", Bt, [w(s, {
|
|
1473
1501
|
name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
|
|
1474
|
-
class:
|
|
1475
|
-
}, null, 8, ["name", "class"])]),
|
|
1476
|
-
e.version && c.value.length > 1 ||
|
|
1502
|
+
class: k(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
|
|
1503
|
+
}, null, 8, ["name", "class"])]), S("div", Vt, [S("strong", Ht, z(e.filename), 1), S("span", Ut, z(B(o)("chatFilePreview.readOnly")), 1)])]),
|
|
1504
|
+
e.version && c.value.length > 1 || T.value ? (N(), x("div", Wt, [e.version && c.value.length > 1 ? (N(), x("nav", {
|
|
1477
1505
|
key: 0,
|
|
1478
1506
|
class: "pk-file-preview__versions",
|
|
1479
|
-
"aria-label":
|
|
1507
|
+
"aria-label": B(o)("chatFilePreview.versions")
|
|
1480
1508
|
}, [
|
|
1481
|
-
|
|
1509
|
+
w(l, {
|
|
1482
1510
|
modifiers: "action-quiet",
|
|
1483
1511
|
icon: "ri:arrow-left-s-line",
|
|
1484
|
-
"aria-label":
|
|
1512
|
+
"aria-label": B(o)("chatFilePreview.previousVersion"),
|
|
1485
1513
|
disabled: !u.value,
|
|
1486
1514
|
onClick: r[0] ||= (e) => u.value && i("version", u.value)
|
|
1487
1515
|
}, null, 8, ["aria-label", "disabled"]),
|
|
1488
|
-
|
|
1516
|
+
S("span", Kt, z(B(o)("chatFilePreview.versionOf", {
|
|
1489
1517
|
version: e.version,
|
|
1490
1518
|
count: c.value.length
|
|
1491
1519
|
})), 1),
|
|
1492
|
-
|
|
1520
|
+
w(l, {
|
|
1493
1521
|
modifiers: "action-quiet",
|
|
1494
1522
|
icon: "ri:arrow-right-s-line",
|
|
1495
|
-
"aria-label":
|
|
1523
|
+
"aria-label": B(o)("chatFilePreview.nextVersion"),
|
|
1496
1524
|
disabled: !d.value,
|
|
1497
1525
|
onClick: r[1] ||= (e) => d.value && i("version", d.value)
|
|
1498
1526
|
}, null, 8, ["aria-label", "disabled"])
|
|
1499
|
-
], 8,
|
|
1527
|
+
], 8, Gt)) : b("", !0), T.value ? (N(), y(t, {
|
|
1500
1528
|
key: 1,
|
|
1501
1529
|
modelValue: f.value,
|
|
1502
1530
|
"onUpdate:modelValue": r[2] ||= (e) => f.value = e,
|
|
1503
1531
|
name: "revisions",
|
|
1504
1532
|
segmented: "",
|
|
1505
1533
|
class: "pk-file-preview__modes u-segmented-fit mb-0",
|
|
1506
|
-
"aria-label":
|
|
1507
|
-
options:
|
|
1534
|
+
"aria-label": B(o)("chatFilePreview.modes"),
|
|
1535
|
+
options: C.value
|
|
1508
1536
|
}, {
|
|
1509
|
-
markup:
|
|
1537
|
+
markup: re(() => [S("span", qt, z(B(o)("chatFilePreview.modeMarkup")), 1), S("span", Jt, z(B(o)("chatFilePreview.modeMarkupShort")), 1)]),
|
|
1510
1538
|
_: 1
|
|
1511
1539
|
}, 8, [
|
|
1512
1540
|
"modelValue",
|
|
1513
1541
|
"aria-label",
|
|
1514
1542
|
"options"
|
|
1515
|
-
])) :
|
|
1516
|
-
|
|
1517
|
-
e.restorable ? (
|
|
1543
|
+
])) : b("", !0)])) : b("", !0),
|
|
1544
|
+
S("div", Yt, [
|
|
1545
|
+
e.restorable ? (N(), y(l, {
|
|
1518
1546
|
key: 0,
|
|
1519
1547
|
modifiers: "action-quiet",
|
|
1520
1548
|
icon: "ri:arrow-go-back-line",
|
|
1521
|
-
label:
|
|
1549
|
+
label: B(o)("chatFilePreview.restore"),
|
|
1522
1550
|
onClick: r[3] ||= (e) => i("restore")
|
|
1523
|
-
}, null, 8, ["label"])) :
|
|
1524
|
-
|
|
1551
|
+
}, null, 8, ["label"])) : b("", !0),
|
|
1552
|
+
w(l, {
|
|
1525
1553
|
href: e.downloadUrl,
|
|
1526
1554
|
download: "",
|
|
1527
1555
|
modifiers: "action-quiet",
|
|
1528
1556
|
icon: "ri:download-line",
|
|
1529
|
-
title:
|
|
1530
|
-
"aria-label":
|
|
1557
|
+
title: B(o)("chatFilePreview.download"),
|
|
1558
|
+
"aria-label": B(o)("chatFilePreview.download")
|
|
1531
1559
|
}, null, 8, [
|
|
1532
1560
|
"href",
|
|
1533
1561
|
"title",
|
|
1534
1562
|
"aria-label"
|
|
1535
1563
|
]),
|
|
1536
|
-
e.resize === "expand" ? (
|
|
1564
|
+
e.resize === "expand" ? (N(), y(l, {
|
|
1537
1565
|
key: 1,
|
|
1538
1566
|
modifiers: "action-quiet",
|
|
1539
1567
|
icon: "ri:fullscreen-line",
|
|
1540
|
-
title:
|
|
1541
|
-
"aria-label":
|
|
1568
|
+
title: B(o)("chatFilePreview.expand"),
|
|
1569
|
+
"aria-label": B(o)("chatFilePreview.expand"),
|
|
1542
1570
|
onClick: r[4] ||= (e) => i("resize")
|
|
1543
|
-
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (
|
|
1571
|
+
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (N(), y(l, {
|
|
1544
1572
|
key: 2,
|
|
1545
1573
|
modifiers: "action-quiet",
|
|
1546
1574
|
icon: "ri:fullscreen-exit-line",
|
|
1547
|
-
title:
|
|
1548
|
-
"aria-label":
|
|
1575
|
+
title: B(o)("chatFilePreview.shrink"),
|
|
1576
|
+
"aria-label": B(o)("chatFilePreview.shrink"),
|
|
1549
1577
|
onClick: r[5] ||= (e) => i("resize")
|
|
1550
|
-
}, null, 8, ["title", "aria-label"])) :
|
|
1551
|
-
|
|
1578
|
+
}, null, 8, ["title", "aria-label"])) : b("", !0),
|
|
1579
|
+
w(l, {
|
|
1552
1580
|
modifiers: "action-quiet",
|
|
1553
1581
|
icon: "ri:close-line",
|
|
1554
|
-
title:
|
|
1555
|
-
"aria-label":
|
|
1582
|
+
title: B(o)("chatFilePreview.close"),
|
|
1583
|
+
"aria-label": B(o)("chatFilePreview.close"),
|
|
1556
1584
|
onClick: r[6] ||= (e) => i("close")
|
|
1557
1585
|
}, null, 8, ["title", "aria-label"])
|
|
1558
1586
|
])
|
|
1559
1587
|
]),
|
|
1560
|
-
|
|
1588
|
+
S("div", Xt, [e.loading ? (N(), x("div", Zt, [(N(), x(_, null, I(8, (e) => S("div", {
|
|
1561
1589
|
key: e,
|
|
1562
|
-
class:
|
|
1563
|
-
}, null, 2)), 64))])) : e.error || !e.preview ? (
|
|
1590
|
+
class: k(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
|
|
1591
|
+
}, null, 2)), 64))])) : e.error || !e.preview ? (N(), x("p", Qt, z(B(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (N(), y(It, {
|
|
1564
1592
|
key: 2,
|
|
1565
1593
|
zoom: m.value,
|
|
1566
1594
|
"onUpdate:zoom": r[7] ||= (e) => m.value = e,
|
|
1567
1595
|
fit: h.value,
|
|
1568
1596
|
"onUpdate:fit": r[8] ||= (e) => h.value = e,
|
|
1569
1597
|
preview: e.preview,
|
|
1570
|
-
mode:
|
|
1571
|
-
onSelect:
|
|
1598
|
+
mode: T.value ? f.value : "markup",
|
|
1599
|
+
onSelect: j
|
|
1572
1600
|
}, null, 8, [
|
|
1573
1601
|
"zoom",
|
|
1574
1602
|
"fit",
|
|
1575
1603
|
"preview",
|
|
1576
1604
|
"mode"
|
|
1577
|
-
])) : (
|
|
1605
|
+
])) : (N(), y(qe, {
|
|
1578
1606
|
key: 3,
|
|
1579
1607
|
sheet: p.value,
|
|
1580
1608
|
"onUpdate:sheet": r[9] ||= (e) => p.value = e,
|
|
1581
1609
|
zoom: m.value,
|
|
1582
1610
|
"onUpdate:zoom": r[10] ||= (e) => m.value = e,
|
|
1583
1611
|
preview: e.preview,
|
|
1584
|
-
onSelect:
|
|
1612
|
+
onSelect: j
|
|
1585
1613
|
}, null, 8, [
|
|
1586
1614
|
"sheet",
|
|
1587
1615
|
"zoom",
|
|
1588
1616
|
"preview"
|
|
1589
1617
|
]))]),
|
|
1590
|
-
e.selectionActions &&
|
|
1618
|
+
e.selectionActions && D.value && q.value ? (N(), y($, {
|
|
1591
1619
|
key: 0,
|
|
1592
|
-
asking:
|
|
1593
|
-
"onUpdate:asking": r[11] ||= (e) =>
|
|
1620
|
+
asking: O.value,
|
|
1621
|
+
"onUpdate:asking": r[11] ||= (e) => O.value = e,
|
|
1594
1622
|
strategy: "absolute",
|
|
1595
|
-
anchor:
|
|
1623
|
+
anchor: q.value,
|
|
1596
1624
|
actions: se.value,
|
|
1597
|
-
hint:
|
|
1598
|
-
note:
|
|
1599
|
-
"note-action":
|
|
1600
|
-
onAction:
|
|
1601
|
-
onAsk: r[12] ||= (e) =>
|
|
1602
|
-
onNote:
|
|
1603
|
-
onClose:
|
|
1625
|
+
hint: ie.value,
|
|
1626
|
+
note: te.value ? void 0 : B(o)("selectionActions.notLatest", { version: e.version }),
|
|
1627
|
+
"note-action": B(o)("selectionActions.openLatest"),
|
|
1628
|
+
onAction: fe,
|
|
1629
|
+
onAsk: r[12] ||= (e) => de(e, "ask"),
|
|
1630
|
+
onNote: M,
|
|
1631
|
+
onClose: A
|
|
1604
1632
|
}, null, 8, [
|
|
1605
1633
|
"asking",
|
|
1606
1634
|
"anchor",
|
|
@@ -1608,11 +1636,11 @@ var ue = 2e3, q = 1e3, J = 60, Y = 1400, de = 20, fe = (e) => Number(e.slice(1))
|
|
|
1608
1636
|
"hint",
|
|
1609
1637
|
"note",
|
|
1610
1638
|
"note-action"
|
|
1611
|
-
])) :
|
|
1612
|
-
], 8,
|
|
1639
|
+
])) : b("", !0)
|
|
1640
|
+
], 8, Lt);
|
|
1613
1641
|
};
|
|
1614
1642
|
}
|
|
1615
|
-
}),
|
|
1616
|
-
export {
|
|
1643
|
+
}), en = /* @__PURE__ */ e({ default: () => tn }), tn = $t;
|
|
1644
|
+
export { en as n, tn as t };
|
|
1617
1645
|
|
|
1618
|
-
//# sourceMappingURL=PkFilePreview-
|
|
1646
|
+
//# sourceMappingURL=PkFilePreview-z7JcRtjP.js.map
|