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