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