@8wave/ai-elements 0.124.0-beta.9 → 0.124.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/_chunks/{PkFilePreview-D_piCsAW.js → PkFilePreview-BwHe4-m1.js} +368 -346
- package/dist/_chunks/PkFilePreview-BwHe4-m1.js.map +1 -0
- package/dist/_chunks/{PkFilePreviewDialog-Bq0ipzrJ.js → PkFilePreviewDialog-LWxNgkzk.js} +2 -2
- package/dist/_chunks/{PkFilePreviewDialog-Bq0ipzrJ.js.map → PkFilePreviewDialog-LWxNgkzk.js.map} +1 -1
- package/dist/_chunks/{PkStreamingMarkdown-CHwrLP75.js → PkStreamingMarkdown-BvgO6aHe.js} +2 -2
- package/dist/_chunks/{PkStreamingMarkdown-CHwrLP75.js.map → PkStreamingMarkdown-BvgO6aHe.js.map} +1 -1
- package/dist/_chunks/{PkToolChatFile-DO4zjMJr.js → PkToolChatFile-OuaeZTxw.js} +62 -54
- package/dist/_chunks/PkToolChatFile-OuaeZTxw.js.map +1 -0
- package/dist/_chunks/{PkToolShowArtifact-B2-3-k2F.js → PkToolShowArtifact-BqgW3E6D.js} +2 -2
- package/dist/_chunks/{PkToolShowArtifact-B2-3-k2F.js.map → PkToolShowArtifact-BqgW3E6D.js.map} +1 -1
- package/dist/_chunks/{PkToolShowContactForm-DbOZHB_G.js → PkToolShowContactForm-DDDXopZp.js} +2 -2
- package/dist/_chunks/{PkToolShowContactForm-DbOZHB_G.js.map → PkToolShowContactForm-DDDXopZp.js.map} +1 -1
- package/dist/_chunks/{PkToolShowForm-o2LuWDNq.js → PkToolShowForm-D2LZ8Kkl.js} +3 -3
- package/dist/_chunks/{PkToolShowForm-o2LuWDNq.js.map → PkToolShowForm-D2LZ8Kkl.js.map} +1 -1
- package/dist/_chunks/{PkToolShowSources-CUNneZCp.js → PkToolShowSources-DA4SOt-H.js} +2 -2
- package/dist/_chunks/{PkToolShowSources-CUNneZCp.js.map → PkToolShowSources-DA4SOt-H.js.map} +1 -1
- package/dist/_chunks/excelNumberFormat-CIbRUEwQ.js +543 -0
- package/dist/_chunks/excelNumberFormat-CIbRUEwQ.js.map +1 -0
- package/dist/_chunks/{utils-BHvRrCzW.js → utils-euH8esYP.js} +7 -6
- package/dist/_chunks/utils-euH8esYP.js.map +1 -0
- package/dist/ai-elements.es.js +8 -8
- 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/{PkChatbot-DQssgXm3.js → PkChatbot-BRttF7Lo.js} +5 -5
- package/dist-vue/_chunks/{PkChatbot-DQssgXm3.js.map → PkChatbot-BRttF7Lo.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotEmptyState-B6qxJAPT.js → PkChatbotEmptyState-CLOH5Z2d.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotEmptyState-B6qxJAPT.js.map → PkChatbotEmptyState-CLOH5Z2d.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotInput-Bk8OS1xU.js → PkChatbotInput-BK7f1jFE.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotInput-Bk8OS1xU.js.map → PkChatbotInput-BK7f1jFE.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotMessages-D4LJZxv7.js → PkChatbotMessages-Ck0ofhtK.js} +14 -14
- package/dist-vue/_chunks/{PkChatbotMessages-D4LJZxv7.js.map → PkChatbotMessages-Ck0ofhtK.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepPayload-_0WRbSR6.js → PkChatbotStepPayload-D682n3VR.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotStepPayload-_0WRbSR6.js.map → PkChatbotStepPayload-D682n3VR.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiaervF2.js → PkChatbotStepToolDetail-D5c8rqj9.js} +3 -3
- package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiaervF2.js.map → PkChatbotStepToolDetail-D5c8rqj9.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotSteps-BqL-ClgI.js → PkChatbotSteps-CtKRHqaG.js} +5 -5
- package/dist-vue/_chunks/{PkChatbotSteps-BqL-ClgI.js.map → PkChatbotSteps-CtKRHqaG.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewChat-BfVLCU_j.js → PkChatbotViewChat-D8depeWQ.js} +6 -6
- package/dist-vue/_chunks/{PkChatbotViewChat-BfVLCU_j.js.map → PkChatbotViewChat-D8depeWQ.js.map} +1 -1
- package/dist-vue/_chunks/{PkChatbotViewConversations-C32O6SsT.js → PkChatbotViewConversations-B-dmLi-8.js} +2 -2
- package/dist-vue/_chunks/{PkChatbotViewConversations-C32O6SsT.js.map → PkChatbotViewConversations-B-dmLi-8.js.map} +1 -1
- package/dist-vue/_chunks/PkFilePreview-B54Dp_Rs.js +1149 -0
- package/dist-vue/_chunks/PkFilePreview-B54Dp_Rs.js.map +1 -0
- package/dist-vue/_chunks/{PkFilePreviewDialog-BSvgiM9A.js → PkFilePreviewDialog-QDPoZh1v.js} +2 -2
- package/dist-vue/_chunks/{PkFilePreviewDialog-BSvgiM9A.js.map → PkFilePreviewDialog-QDPoZh1v.js.map} +1 -1
- package/dist-vue/_chunks/{PkStreamingMarkdown-Dk3iXhTm.js → PkStreamingMarkdown-qnKwvrCg.js} +2 -2
- package/dist-vue/_chunks/{PkStreamingMarkdown-Dk3iXhTm.js.map → PkStreamingMarkdown-qnKwvrCg.js.map} +1 -1
- package/dist-vue/_chunks/PkToolChatFile-i0rHgFxB.js +227 -0
- package/dist-vue/_chunks/PkToolChatFile-i0rHgFxB.js.map +1 -0
- package/dist-vue/_chunks/{PkToolShowArtifact-BtCGilTJ.js → PkToolShowArtifact-Dh4ogn6A.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowArtifact-BtCGilTJ.js.map → PkToolShowArtifact-Dh4ogn6A.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowContactForm-BZNIeJpf.js → PkToolShowContactForm-BGTI1sio.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowContactForm-BZNIeJpf.js.map → PkToolShowContactForm-BGTI1sio.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowDiagram-KD4MfVkP.js → PkToolShowDiagram-xef3wJb0.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowDiagram-KD4MfVkP.js.map → PkToolShowDiagram-xef3wJb0.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowForm-Dtfpi58S.js → PkToolShowForm-Crg4Kl6v.js} +3 -3
- package/dist-vue/_chunks/{PkToolShowForm-Dtfpi58S.js.map → PkToolShowForm-Crg4Kl6v.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowImageGallery-DnS04nTs.js → PkToolShowImageGallery-D9hdGBHK.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowImageGallery-DnS04nTs.js.map → PkToolShowImageGallery-D9hdGBHK.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowProductList-BlFKAtqQ.js → PkToolShowProductList-SC5aKDCw.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowProductList-BlFKAtqQ.js.map → PkToolShowProductList-SC5aKDCw.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowSources-DM177ZlR.js → PkToolShowSources-Bf9_JwFL.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowSources-DM177ZlR.js.map → PkToolShowSources-Bf9_JwFL.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowVideo-DQdVpaWT.js → PkToolShowVideo-C2ITZDNo.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowVideo-DQdVpaWT.js.map → PkToolShowVideo-C2ITZDNo.js.map} +1 -1
- package/dist-vue/_chunks/{PkToolShowWebPages-Cx2Ft_wN.js → PkToolShowWebPages-BrefGxKQ.js} +2 -2
- package/dist-vue/_chunks/{PkToolShowWebPages-Cx2Ft_wN.js.map → PkToolShowWebPages-BrefGxKQ.js.map} +1 -1
- package/dist-vue/_chunks/excelNumberFormat-COn5tHoH.js +543 -0
- package/dist-vue/_chunks/excelNumberFormat-COn5tHoH.js.map +1 -0
- package/dist-vue/_chunks/{utils-BuxgMuKv.js → utils-B0PnU1Rk.js} +7 -6
- package/dist-vue/_chunks/utils-B0PnU1Rk.js.map +1 -0
- package/dist-vue/composables.js +1 -1
- package/dist-vue/index.js +21 -21
- package/dist-vue/index.js.map +1 -1
- package/dist-vue/packages/components/src/chat/excelNumberFormat.d.ts +34 -0
- package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +20 -0
- package/dist-vue/packages/components/src/chat/utils.d.ts +2 -0
- package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +26 -0
- package/dist-vue/packages/models/src/schema/WordPreview.d.ts +11 -0
- package/package.json +1 -1
- package/dist/_chunks/PkFilePreview-D_piCsAW.js.map +0 -1
- package/dist/_chunks/PkToolChatFile-DO4zjMJr.js.map +0 -1
- package/dist/_chunks/utils-BHvRrCzW.js.map +0 -1
- package/dist-vue/_chunks/PkFilePreview-jeqvHDm7.js +0 -1127
- package/dist-vue/_chunks/PkFilePreview-jeqvHDm7.js.map +0 -1
- package/dist-vue/_chunks/PkToolChatFile-Bnj-YFLh.js +0 -219
- package/dist-vue/_chunks/PkToolChatFile-Bnj-YFLh.js.map +0 -1
- package/dist-vue/_chunks/utils-BuxgMuKv.js.map +0 -1
|
@@ -1,1127 +0,0 @@
|
|
|
1
|
-
import { t as e } from "./rolldown-runtime-CGnMp29N.js";
|
|
2
|
-
import { t } from "./PkEditorRadioButtons-Bw576DPQ.js";
|
|
3
|
-
import { t as n } from "./VvButtonLocalized-C-vx25u4.js";
|
|
4
|
-
import { B as r, G as i, H as a, K as o, U as s, V as c, W as l, a as u, z as d } from "./utils-BuxgMuKv.js";
|
|
5
|
-
import { VvIcon as f } from "@volverjs/ui-vue/components";
|
|
6
|
-
import { Fragment as p, computed as m, createBlock as h, createCommentVNode as g, createElementBlock as _, createElementVNode as v, createTextVNode as y, createVNode as b, defineComponent as x, inject as S, isMemoSame as ee, mergeModels as C, nextTick as te, normalizeClass as w, normalizeStyle as T, onBeforeUnmount as ne, onMounted as re, openBlock as E, provide as D, ref as O, renderList as k, toDisplayString as A, unref as j, useModel as M, useTemplateRef as ie, watch as N, withCtx as ae, withModifiers as P } from "vue";
|
|
7
|
-
import { useI18n as oe } from "vue-i18n";
|
|
8
|
-
import { useElementSize as se } from "@vueuse/core";
|
|
9
|
-
// ../../packages/components/src/chat/PkSpreadsheetPreview.vue?vue&type=script&setup=true&lang.ts
|
|
10
|
-
var ce = { class: "pk-spreadsheet-preview" }, F = { class: "pk-spreadsheet-preview__bar" }, I = ["aria-label"], le = ["aria-label"], ue = ["aria-label"], L = [
|
|
11
|
-
"rowspan",
|
|
12
|
-
"colspan",
|
|
13
|
-
"data-focus",
|
|
14
|
-
"title",
|
|
15
|
-
"onMousedown",
|
|
16
|
-
"onMouseenter"
|
|
17
|
-
], de = {
|
|
18
|
-
key: 1,
|
|
19
|
-
class: "pk-spreadsheet-preview__more"
|
|
20
|
-
}, fe = ["aria-label"], R = ["aria-current", "onClick"], pe = { class: "pk-spreadsheet-preview__status" }, me = { class: "pk-spreadsheet-preview__info" }, he = ["title"], z = ["title"], ge = {
|
|
21
|
-
key: 2,
|
|
22
|
-
class: "pk-spreadsheet-preview__stats"
|
|
23
|
-
}, B = {
|
|
24
|
-
key: 0,
|
|
25
|
-
class: "pk-spreadsheet-preview__average"
|
|
26
|
-
}, _e = { key: 1 }, ve = { class: "pk-spreadsheet-preview__zoom" }, ye = { class: "pk-spreadsheet-preview__percent" }, be = 64, V = 20, H = 28, U = 44, W = /* @__PURE__ */ x({
|
|
27
|
-
__name: "PkSpreadsheetPreview",
|
|
28
|
-
props: /*@__PURE__*/ C({ preview: {} }, {
|
|
29
|
-
sheet: { default: 0 },
|
|
30
|
-
sheetModifiers: {},
|
|
31
|
-
zoom: { default: 1 },
|
|
32
|
-
zoomModifiers: {}
|
|
33
|
-
}),
|
|
34
|
-
emits: ["update:sheet", "update:zoom"],
|
|
35
|
-
setup(e) {
|
|
36
|
-
let t = e, { t: r, locale: i } = oe({ useScope: "global" }), a = M(e, "sheet"), o = M(e, "zoom"), s = ie("scrollEl"), { width: c, height: l } = se(s, {
|
|
37
|
-
width: 0,
|
|
38
|
-
height: 0
|
|
39
|
-
}, { box: "border-box" }), u = m(() => t.preview.sheets[a.value] ?? t.preview.sheets[0]);
|
|
40
|
-
N(() => t.preview, () => {
|
|
41
|
-
a.value = 0;
|
|
42
|
-
});
|
|
43
|
-
let d = (e) => {
|
|
44
|
-
let t = "";
|
|
45
|
-
for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
|
|
46
|
-
return t;
|
|
47
|
-
}, f = m(() => {
|
|
48
|
-
let e = u.value;
|
|
49
|
-
if (!e) return [];
|
|
50
|
-
let t = new Set(e.columns.filter((e) => e.hidden).map((e) => e.col)), n = new Map(e.columns.map((e) => [e.col, e.width])), r = [], i = U, a = c.value / o.value;
|
|
51
|
-
for (let o = 1; o <= e.lastColumn || !e.moreColumns && (o <= e.lastColumn + 2 || i < a); o++) {
|
|
52
|
-
if (t.has(o)) continue;
|
|
53
|
-
let e = n.get(o) ?? be;
|
|
54
|
-
r.push({
|
|
55
|
-
col: o,
|
|
56
|
-
width: e
|
|
57
|
-
}), i += e;
|
|
58
|
-
}
|
|
59
|
-
return r;
|
|
60
|
-
}), h = m(() => f.value.reduce((e, t) => e + t.width, U)), x = m(() => f.value.map((e) => `${e.col}:${e.width}`).join(",")), S = /* @__PURE__ */ new WeakMap(), C = m(() => {
|
|
61
|
-
let e = u.value;
|
|
62
|
-
if (!e) return [];
|
|
63
|
-
let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((l.value / o.value - H) / V), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = S.get(e);
|
|
64
|
-
a || (a = /* @__PURE__ */ new Map(), S.set(e, a));
|
|
65
|
-
let s = a;
|
|
66
|
-
return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
|
|
67
|
-
let t = s.get(e);
|
|
68
|
-
return t || (t = {
|
|
69
|
-
row: e,
|
|
70
|
-
height: n.get(e) ?? V
|
|
71
|
-
}, s.set(e, t)), t;
|
|
72
|
-
});
|
|
73
|
-
}), ne = m(() => {
|
|
74
|
-
let e = /* @__PURE__ */ new Map();
|
|
75
|
-
for (let t of u.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
|
|
76
|
-
return e;
|
|
77
|
-
}), re = m(() => {
|
|
78
|
-
let e = /* @__PURE__ */ new Map();
|
|
79
|
-
for (let t of u.value?.rows ?? []) for (let n of t.cells) if (n.span) for (let r = 0; r < n.span.rows; r++) for (let i = 0; i < n.span.cols; i++) (r || i) && e.set(`${t.row + r},${n.col + i}`, {
|
|
80
|
-
row: t.row,
|
|
81
|
-
col: n.col
|
|
82
|
-
});
|
|
83
|
-
return e;
|
|
84
|
-
}), D = (e, t) => ne.value.get(`${e},${t}`), ae = (e, t) => {
|
|
85
|
-
let n = D(e, t)?.span;
|
|
86
|
-
if (n) return {
|
|
87
|
-
rows: C.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
|
|
88
|
-
cols: f.value.filter((e) => e.col >= t && e.col < t + n.cols).length
|
|
89
|
-
};
|
|
90
|
-
}, W = (e) => e?.style === void 0 ? void 0 : t.preview.styles[e.style], G = (e, t) => {
|
|
91
|
-
let n = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
|
|
92
|
-
minimumFractionDigits: e.decimals,
|
|
93
|
-
maximumFractionDigits: e.maxDecimals ?? e.decimals
|
|
94
|
-
};
|
|
95
|
-
return new Intl.NumberFormat(i.value, {
|
|
96
|
-
...n,
|
|
97
|
-
useGrouping: e.grouped === !0,
|
|
98
|
-
...e.format === "percent" ? { style: "percent" } : {},
|
|
99
|
-
...e.format === "currency" && e.currency ? {
|
|
100
|
-
style: "currency",
|
|
101
|
-
currency: e.currency
|
|
102
|
-
} : {}
|
|
103
|
-
}).format(t);
|
|
104
|
-
}, K = (e) => {
|
|
105
|
-
let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
|
|
106
|
-
return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(i.value, {
|
|
107
|
-
dateStyle: "short",
|
|
108
|
-
timeZone: "UTC"
|
|
109
|
-
}).format(t);
|
|
110
|
-
}, q = (e) => {
|
|
111
|
-
if (!e) return "";
|
|
112
|
-
if (e.missing) return "—";
|
|
113
|
-
let t = e.value;
|
|
114
|
-
return t === void 0 ? "" : typeof t == "boolean" ? r(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? K(t) : typeof t == "number" ? G(e, t) : t;
|
|
115
|
-
}, J = (e) => {
|
|
116
|
-
if (!e) return "";
|
|
117
|
-
if (e.formula) return `=${e.formula}`;
|
|
118
|
-
let t = e.value;
|
|
119
|
-
return typeof t == "number" ? new Intl.NumberFormat(i.value, {
|
|
120
|
-
useGrouping: !1,
|
|
121
|
-
maximumFractionDigits: 15,
|
|
122
|
-
...e.format === "percent" ? { style: "percent" } : {}
|
|
123
|
-
}).format(t) : q(e);
|
|
124
|
-
}, Y = (e) => e ? `${e.width}px solid ${e.color}` : void 0, xe = (e, t, n) => {
|
|
125
|
-
let r = W(e), i = e?.value, a = typeof i == "number" || !!e?.missing, o = {
|
|
126
|
-
textAlign: r?.align ?? (a ? "right" : typeof i == "boolean" || e?.format === "error" ? "center" : "left"),
|
|
127
|
-
verticalAlign: r?.valign === "top" ? "top" : r?.valign === "middle" ? "middle" : "bottom",
|
|
128
|
-
whiteSpace: r?.wrap ? "pre-wrap" : "nowrap"
|
|
129
|
-
};
|
|
130
|
-
r?.bold && (o.fontWeight = 700), r?.italic && (o.fontStyle = "italic");
|
|
131
|
-
let s = [r?.underline ? "underline" : "", r?.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
132
|
-
if (s && (o.textDecoration = s), r?.size && (o.fontSize = `${r.size}pt`), r?.color && (o.color = r.color), r?.fill && (o.backgroundColor = r.fill), r?.indent) {
|
|
133
|
-
let e = `${4 + r.indent * 9}px`;
|
|
134
|
-
o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
|
|
135
|
-
}
|
|
136
|
-
return o.borderTop = Y(r?.borders?.top), o.borderRight = Y(r?.borders?.right), o.borderBottom = Y(r?.borders?.bottom), o.borderLeft = Y(r?.borders?.left), Object.assign(o, Se(t, n)), o;
|
|
137
|
-
}, Se = (e, t) => {
|
|
138
|
-
let n = u.value?.frozen;
|
|
139
|
-
if (!n) return {};
|
|
140
|
-
let r = {};
|
|
141
|
-
return e <= n.rows && (r.position = "sticky", r.top = `${H + C.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0)}px`, r.zIndex = 2), t <= n.cols && (r.position = "sticky", r.left = `${U + f.value.filter((e) => e.col < t).reduce((e, t) => e + t.width, 0)}px`, r.zIndex = e <= n.rows ? 3 : 2), r;
|
|
142
|
-
}, X = O({
|
|
143
|
-
row: 1,
|
|
144
|
-
col: 1
|
|
145
|
-
}), Z = O({
|
|
146
|
-
row: 1,
|
|
147
|
-
col: 1
|
|
148
|
-
});
|
|
149
|
-
N(u, () => {
|
|
150
|
-
X.value = {
|
|
151
|
-
row: 1,
|
|
152
|
-
col: 1
|
|
153
|
-
}, Z.value = {
|
|
154
|
-
row: 1,
|
|
155
|
-
col: 1
|
|
156
|
-
};
|
|
157
|
-
});
|
|
158
|
-
let Q = m(() => ({
|
|
159
|
-
r1: Math.min(X.value.row, Z.value.row),
|
|
160
|
-
r2: Math.max(X.value.row, Z.value.row),
|
|
161
|
-
c1: Math.min(X.value.col, Z.value.col),
|
|
162
|
-
c2: Math.max(X.value.col, Z.value.col)
|
|
163
|
-
})), Ce = (e, t) => e >= Q.value.r1 && e <= Q.value.r2 && t >= Q.value.c1 && t <= Q.value.c2, we = (e, t) => Z.value.row === e && Z.value.col === t, Te = (e) => e >= Q.value.r1 && e <= Q.value.r2 ? `${Q.value.c1}:${Q.value.c2}:${Z.value.row === e ? Z.value.col : 0}` : "", Ee = O(!1), De = (e, t, n) => {
|
|
164
|
-
s.value?.focus({ preventScroll: !0 }), Z.value = {
|
|
165
|
-
row: e,
|
|
166
|
-
col: t
|
|
167
|
-
}, n.shiftKey || (X.value = {
|
|
168
|
-
row: e,
|
|
169
|
-
col: t
|
|
170
|
-
}), Ee.value = !0;
|
|
171
|
-
}, Oe = (e, t) => {
|
|
172
|
-
Ee.value && (Z.value = {
|
|
173
|
-
row: e,
|
|
174
|
-
col: t
|
|
175
|
-
});
|
|
176
|
-
}, ke = (e) => {
|
|
177
|
-
let t = {
|
|
178
|
-
ArrowUp: [-1, 0],
|
|
179
|
-
ArrowDown: [1, 0],
|
|
180
|
-
ArrowLeft: [0, -1],
|
|
181
|
-
ArrowRight: [0, 1],
|
|
182
|
-
Enter: [1, 0],
|
|
183
|
-
Tab: [0, 1]
|
|
184
|
-
}[e.key];
|
|
185
|
-
if (!t) return;
|
|
186
|
-
e.preventDefault();
|
|
187
|
-
let n = C.value.map((e) => e.row), r = f.value.map((e) => e.col), i = (e) => re.value.get(`${e.row},${e.col}`) ?? e, a = i(Z.value), o = n.indexOf(Z.value.row), c = r.indexOf(Z.value.col), l = a;
|
|
188
|
-
for (;;) {
|
|
189
|
-
let e = Math.min(n.length - 1, Math.max(0, o + t[0])), s = Math.min(r.length - 1, Math.max(0, c + t[1]));
|
|
190
|
-
if (e === o && s === c || (o = e, c = s, l = i({
|
|
191
|
-
row: n[o],
|
|
192
|
-
col: r[c]
|
|
193
|
-
}), l.row !== a.row || l.col !== a.col)) break;
|
|
194
|
-
}
|
|
195
|
-
Z.value = l, e.shiftKey || (X.value = l), te(() => s.value?.querySelector("[data-focus]")?.scrollIntoView({
|
|
196
|
-
block: "nearest",
|
|
197
|
-
inline: "nearest"
|
|
198
|
-
}));
|
|
199
|
-
}, Ae = m(() => D(Z.value.row, Z.value.col)), $ = m(() => {
|
|
200
|
-
let { r1: e, r2: t, c1: n, c2: r } = Q.value;
|
|
201
|
-
if (e === t && n === r) return;
|
|
202
|
-
let i = 0, a = 0, o = 0, s;
|
|
203
|
-
for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
|
|
204
|
-
let t = D(c, e);
|
|
205
|
-
t && (t.value !== void 0 || t.missing) && (i++, typeof t.value == "number" && (a += t.value, o++, s ??= t));
|
|
206
|
-
}
|
|
207
|
-
if (i) return {
|
|
208
|
-
count: i,
|
|
209
|
-
sum: s ? G(s, a) : void 0,
|
|
210
|
-
average: s ? G(s, a / o) : void 0
|
|
211
|
-
};
|
|
212
|
-
}), je = (e) => {
|
|
213
|
-
o.value = Math.min(2, Math.max(.5, Math.round((o.value + e) * 10) / 10));
|
|
214
|
-
};
|
|
215
|
-
return (t, c) => {
|
|
216
|
-
let l = n;
|
|
217
|
-
return E(), _("div", ce, [
|
|
218
|
-
v("div", F, [
|
|
219
|
-
v("span", {
|
|
220
|
-
class: "pk-spreadsheet-preview__ref",
|
|
221
|
-
"aria-label": j(r)("chatFilePreview.cell")
|
|
222
|
-
}, A(d(Z.value.col)) + A(Z.value.row), 9, I),
|
|
223
|
-
c[6] ||= v("span", {
|
|
224
|
-
class: "pk-spreadsheet-preview__fx",
|
|
225
|
-
"aria-hidden": "true"
|
|
226
|
-
}, "fx", -1),
|
|
227
|
-
v("output", {
|
|
228
|
-
class: "pk-spreadsheet-preview__formula",
|
|
229
|
-
"aria-label": j(r)("chatFilePreview.formulaBar")
|
|
230
|
-
}, A(J(Ae.value)), 9, le)
|
|
231
|
-
]),
|
|
232
|
-
v("div", {
|
|
233
|
-
ref_key: "scrollEl",
|
|
234
|
-
ref: s,
|
|
235
|
-
class: "pk-spreadsheet-preview__scroll",
|
|
236
|
-
tabindex: "0",
|
|
237
|
-
role: "grid",
|
|
238
|
-
"aria-label": u.value?.name,
|
|
239
|
-
onKeydown: ke,
|
|
240
|
-
onMouseup: c[2] ||= (e) => Ee.value = !1,
|
|
241
|
-
onMouseleave: c[3] ||= (e) => Ee.value = !1
|
|
242
|
-
}, [u.value ? (E(), _("table", {
|
|
243
|
-
key: 0,
|
|
244
|
-
class: w(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": u.value.gridlines }]),
|
|
245
|
-
style: T({
|
|
246
|
-
zoom: o.value,
|
|
247
|
-
width: `${h.value}px`
|
|
248
|
-
})
|
|
249
|
-
}, [
|
|
250
|
-
v("colgroup", null, [v("col", { style: T({ width: `${U}px` }) }, null, 4), (E(!0), _(p, null, k(f.value, (e) => (E(), _("col", {
|
|
251
|
-
key: e.col,
|
|
252
|
-
style: T({ width: `${e.width}px` })
|
|
253
|
-
}, null, 4))), 128))]),
|
|
254
|
-
v("thead", null, [v("tr", { style: T({ height: `${H}px` }) }, [c[7] ||= v("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (E(!0), _(p, null, k(f.value, (e) => (E(), _("th", {
|
|
255
|
-
key: e.col,
|
|
256
|
-
scope: "col",
|
|
257
|
-
class: w(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Q.value.c1 && e.col <= Q.value.c2 }])
|
|
258
|
-
}, A(d(e.col)), 3))), 128))], 4)]),
|
|
259
|
-
v("tbody", null, [(E(!0), _(p, null, k(C.value, (e, t, n, a) => {
|
|
260
|
-
let o = [
|
|
261
|
-
e,
|
|
262
|
-
u.value,
|
|
263
|
-
x.value,
|
|
264
|
-
j(i),
|
|
265
|
-
Te(e.row)
|
|
266
|
-
];
|
|
267
|
-
if (a && a.el && a.key === e.row && ee(a, o)) return a;
|
|
268
|
-
let s = (E(), _("tr", {
|
|
269
|
-
key: e.row,
|
|
270
|
-
style: T({ height: `${e.height}px` })
|
|
271
|
-
}, [v("th", {
|
|
272
|
-
scope: "row",
|
|
273
|
-
class: w(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Q.value.r1 && e.row <= Q.value.r2 }]),
|
|
274
|
-
style: T(u.value.frozen && e.row <= u.value.frozen.rows ? {
|
|
275
|
-
...Se(e.row, 0),
|
|
276
|
-
left: 0,
|
|
277
|
-
zIndex: 4
|
|
278
|
-
} : void 0)
|
|
279
|
-
}, A(e.row), 7), (E(!0), _(p, null, k(f.value, (t) => (E(), _(p, { key: t.col }, [re.value.has(`${e.row},${t.col}`) ? g("", !0) : (E(), _("td", {
|
|
280
|
-
key: 0,
|
|
281
|
-
rowspan: ae(e.row, t.col)?.rows,
|
|
282
|
-
colspan: ae(e.row, t.col)?.cols,
|
|
283
|
-
class: w(["pk-spreadsheet-preview__cell", {
|
|
284
|
-
"pk-spreadsheet-preview__cell--range": Ce(e.row, t.col) && !we(e.row, t.col),
|
|
285
|
-
"pk-spreadsheet-preview__cell--missing": D(e.row, t.col)?.missing
|
|
286
|
-
}]),
|
|
287
|
-
style: T(xe(D(e.row, t.col), e.row, t.col)),
|
|
288
|
-
"data-focus": we(e.row, t.col) ? "" : void 0,
|
|
289
|
-
title: D(e.row, t.col)?.missing ? j(r)("chatFilePreview.missingValue") : void 0,
|
|
290
|
-
onMousedown: P((n) => De(e.row, t.col, n), ["prevent"]),
|
|
291
|
-
onMouseenter: (n) => Oe(e.row, t.col)
|
|
292
|
-
}, A(q(D(e.row, t.col))), 47, L))], 64))), 128))], 4));
|
|
293
|
-
return s.memo = o, s;
|
|
294
|
-
}, c, 0), 128))])
|
|
295
|
-
], 6)) : g("", !0), u.value && (u.value.moreRows || u.value.moreColumns) ? (E(), _("p", de, [u.value.moreRows ? (E(), _(p, { key: 0 }, [y(A(j(r)("chatFilePreview.moreRows", u.value.moreRows)), 1)], 64)) : g("", !0), u.value.moreColumns ? (E(), _(p, { key: 1 }, [y(A(j(r)("chatFilePreview.moreColumns", u.value.moreColumns)), 1)], 64)) : g("", !0)])) : g("", !0)], 40, ue),
|
|
296
|
-
v("nav", {
|
|
297
|
-
class: "pk-spreadsheet-preview__sheets",
|
|
298
|
-
"aria-label": j(r)("chatFilePreview.sheets")
|
|
299
|
-
}, [(E(!0), _(p, null, k(e.preview.sheets, (e, t) => (E(), _("button", {
|
|
300
|
-
key: e.name,
|
|
301
|
-
type: "button",
|
|
302
|
-
class: "pk-spreadsheet-preview__sheet",
|
|
303
|
-
"aria-current": t === a.value ? "page" : void 0,
|
|
304
|
-
onClick: (e) => a.value = t
|
|
305
|
-
}, A(e.name), 9, R))), 128))], 8, fe),
|
|
306
|
-
v("div", pe, [v("p", me, [e.preview.staleFormulas ? (E(), _("span", {
|
|
307
|
-
key: 0,
|
|
308
|
-
class: "pk-spreadsheet-preview__note",
|
|
309
|
-
title: j(r)("chatFilePreview.staleFormulas")
|
|
310
|
-
}, A(j(r)("chatFilePreview.staleFormulas")), 9, he)) : e.preview.computedFormulas ? (E(), _("span", {
|
|
311
|
-
key: 1,
|
|
312
|
-
class: "pk-spreadsheet-preview__note",
|
|
313
|
-
title: j(r)("chatFilePreview.computedFormulas")
|
|
314
|
-
}, A(j(r)("chatFilePreview.computedFormulas")), 9, z)) : g("", !0), $.value ? (E(), _("span", ge, [
|
|
315
|
-
$.value.average ? (E(), _("span", B, A(j(r)("chatFilePreview.average")) + " " + A($.value.average), 1)) : g("", !0),
|
|
316
|
-
v("span", null, A(j(r)("chatFilePreview.count")) + " " + A($.value.count), 1),
|
|
317
|
-
$.value.sum ? (E(), _("span", _e, A(j(r)("chatFilePreview.sum")) + " " + A($.value.sum), 1)) : g("", !0)
|
|
318
|
-
])) : g("", !0)]), v("div", ve, [
|
|
319
|
-
b(l, {
|
|
320
|
-
modifiers: "action-quiet",
|
|
321
|
-
icon: "ri:subtract-line",
|
|
322
|
-
"aria-label": j(r)("chatFilePreview.zoomOut"),
|
|
323
|
-
disabled: o.value <= .5,
|
|
324
|
-
onClick: c[4] ||= (e) => je(-.1)
|
|
325
|
-
}, null, 8, ["aria-label", "disabled"]),
|
|
326
|
-
v("span", ye, A(Math.round(o.value * 100)) + "% ", 1),
|
|
327
|
-
b(l, {
|
|
328
|
-
modifiers: "action-quiet",
|
|
329
|
-
icon: "ri:add-line",
|
|
330
|
-
"aria-label": j(r)("chatFilePreview.zoomIn"),
|
|
331
|
-
disabled: o.value >= 2,
|
|
332
|
-
onClick: c[5] ||= (e) => je(.1)
|
|
333
|
-
}, null, 8, ["aria-label", "disabled"])
|
|
334
|
-
])])
|
|
335
|
-
]);
|
|
336
|
-
};
|
|
337
|
-
}
|
|
338
|
-
}), G = ["src"], K = {
|
|
339
|
-
key: 1,
|
|
340
|
-
class: "pk-word-preview__image"
|
|
341
|
-
}, q = ["title"], J = ["title"], Y = /* @__PURE__ */ x({
|
|
342
|
-
__name: "PkWordPreviewRuns",
|
|
343
|
-
props: {
|
|
344
|
-
runs: {},
|
|
345
|
-
mode: {},
|
|
346
|
-
page: {},
|
|
347
|
-
numbers: {}
|
|
348
|
-
},
|
|
349
|
-
setup(e) {
|
|
350
|
-
let t = e, { t: n } = oe({ useScope: "global" }), a = S(u, void 0), s = (e) => e.picture ? o(a?.value, e.picture.ref) : void 0, l = (e) => t.page ? i(e) : "inline", d = (e) => {
|
|
351
|
-
let n = {
|
|
352
|
-
width: `${e.width}pt`,
|
|
353
|
-
aspectRatio: `${e.width} / ${e.height}`
|
|
354
|
-
}, r = e.anchor, a = t.page;
|
|
355
|
-
if (!r || !a) return n;
|
|
356
|
-
let o = r.xFrom === "page" ? r.x - a.margins.left : r.x, s = i(e);
|
|
357
|
-
if (s === "around") {
|
|
358
|
-
let t = a.width - a.margins.left - a.margins.right, i = o + e.width / 2 < t / 2;
|
|
359
|
-
return {
|
|
360
|
-
...n,
|
|
361
|
-
float: i ? "left" : "right",
|
|
362
|
-
marginTop: r.yFrom === "paragraph" && r.y > 0 ? `${r.y}pt` : void 0,
|
|
363
|
-
[i ? "marginRight" : "marginLeft"]: "9pt"
|
|
364
|
-
};
|
|
365
|
-
}
|
|
366
|
-
return s === "block" ? {
|
|
367
|
-
...n,
|
|
368
|
-
display: "block",
|
|
369
|
-
marginLeft: `${Math.max(0, o)}pt`
|
|
370
|
-
} : {
|
|
371
|
-
...n,
|
|
372
|
-
position: "absolute",
|
|
373
|
-
left: `${o}pt`,
|
|
374
|
-
top: `${r.y}pt`,
|
|
375
|
-
zIndex: r.wrap === "behind" ? -1 : 1
|
|
376
|
-
};
|
|
377
|
-
}, f = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, h = m(() => {
|
|
378
|
-
let e = c(t.runs, t.mode ?? "markup"), n = (e) => !!e.picture && !!t.page && ["around", "block"].includes(i(e.picture));
|
|
379
|
-
return [...e.filter(n), ...e.filter((e) => !n(e))];
|
|
380
|
-
}), v = m(() => !t.mode || t.mode === "markup"), y = (e) => {
|
|
381
|
-
let t = {};
|
|
382
|
-
e.font && (t.fontFamily = r(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");
|
|
383
|
-
let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
|
|
384
|
-
return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
|
|
385
|
-
}, b = (e) => {
|
|
386
|
-
let t = y(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
|
|
387
|
-
return n.add(e.change === "deleted" ? "line-through" : "underline"), {
|
|
388
|
-
...t,
|
|
389
|
-
textDecoration: [...n].join(" ")
|
|
390
|
-
};
|
|
391
|
-
}, x = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
|
|
392
|
-
return (e, t) => (E(!0), _(p, null, k(h.value, (e, t) => (E(), _(p, { key: t }, [e.image ? (E(), _(p, { key: 0 }, [e.picture && s(e) ? (E(), _(p, { key: 0 }, [l(e.picture) === "page" ? g("", !0) : (E(), _("img", {
|
|
393
|
-
key: 0,
|
|
394
|
-
class: w(["pk-word-preview__picture", `pk-word-preview__picture--${l(e.picture)}`]),
|
|
395
|
-
style: T(d(e.picture)),
|
|
396
|
-
src: s(e),
|
|
397
|
-
alt: ""
|
|
398
|
-
}, null, 14, G))], 64)) : (E(), _("span", K, A(j(n)("chatFilePreview.image")), 1))], 64)) : v.value && e.change === "deleted" ? (E(), _("del", {
|
|
399
|
-
key: 1,
|
|
400
|
-
class: "pk-word-preview__removed",
|
|
401
|
-
style: T(b(e)),
|
|
402
|
-
title: x(e)
|
|
403
|
-
}, A(f(e)), 13, q)) : v.value && e.change === "inserted" ? (E(), _("ins", {
|
|
404
|
-
key: 2,
|
|
405
|
-
class: "pk-word-preview__added",
|
|
406
|
-
style: T(b(e)),
|
|
407
|
-
title: x(e)
|
|
408
|
-
}, A(f(e)), 13, J)) : (E(), _("span", {
|
|
409
|
-
key: 3,
|
|
410
|
-
style: T(y(e))
|
|
411
|
-
}, A(f(e)), 5))], 64))), 128));
|
|
412
|
-
}
|
|
413
|
-
}), xe = { key: 0 }, Se = ["colspan"], X = ["role", "aria-level"], Z = { key: 1 }, Q = /* @__PURE__ */ x({
|
|
414
|
-
__name: "PkWordPreviewBlock",
|
|
415
|
-
props: {
|
|
416
|
-
block: {},
|
|
417
|
-
row: {},
|
|
418
|
-
mode: {},
|
|
419
|
-
page: {},
|
|
420
|
-
numbers: {}
|
|
421
|
-
},
|
|
422
|
-
setup(e) {
|
|
423
|
-
let t = e, n = m(() => {
|
|
424
|
-
if (t.block.kind === "table") return {};
|
|
425
|
-
let e = t.block.style ?? {};
|
|
426
|
-
return {
|
|
427
|
-
textAlign: e.align,
|
|
428
|
-
paddingLeft: e.indentLeft ? `${e.indentLeft}pt` : void 0,
|
|
429
|
-
paddingRight: e.indentRight ? `${e.indentRight}pt` : void 0,
|
|
430
|
-
textIndent: e.firstLine ? `${e.firstLine}pt` : void 0,
|
|
431
|
-
paddingTop: e.spaceBefore ? `${e.spaceBefore}pt` : void 0,
|
|
432
|
-
paddingBottom: e.spaceAfter ? `${e.spaceAfter}pt` : void 0,
|
|
433
|
-
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})`,
|
|
434
|
-
backgroundColor: e.shading,
|
|
435
|
-
fontSize: e.size ? `${e.size}pt` : void 0
|
|
436
|
-
};
|
|
437
|
-
}), r = m(() => {
|
|
438
|
-
if (t.block.kind === "table") return {};
|
|
439
|
-
let e = -(t.block.style?.firstLine ?? 0);
|
|
440
|
-
return e > 0 ? { minWidth: `${e}pt` } : { paddingRight: "6pt" };
|
|
441
|
-
}), i = m(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), a = m(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), o = m(() => {
|
|
442
|
-
if (t.block.kind !== "table") return [];
|
|
443
|
-
let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
|
|
444
|
-
return n ? e.map((e) => `${e / n * 100}%`) : [];
|
|
445
|
-
}), s = m(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
|
|
446
|
-
return (t, c) => e.block.kind === "table" && a.value ? (E(), _("table", {
|
|
447
|
-
key: 0,
|
|
448
|
-
class: w(["pk-word-preview__table", {
|
|
449
|
-
"pk-word-preview__table--lines": e.block.borders,
|
|
450
|
-
"pk-word-preview__table--next": e.row !== 0,
|
|
451
|
-
"pk-word-preview__changed": s.value
|
|
452
|
-
}])
|
|
453
|
-
}, [o.value.length ? (E(), _("colgroup", xe, [(E(!0), _(p, null, k(o.value, (e, t) => (E(), _("col", {
|
|
454
|
-
key: t,
|
|
455
|
-
style: T({ width: e })
|
|
456
|
-
}, null, 4))), 128))])) : g("", !0), v("tbody", null, [v("tr", null, [(E(!0), _(p, null, k(a.value, (t, n) => (E(), _("td", {
|
|
457
|
-
key: n,
|
|
458
|
-
colspan: t.span,
|
|
459
|
-
style: T({
|
|
460
|
-
backgroundColor: t.fill,
|
|
461
|
-
textAlign: t.align,
|
|
462
|
-
fontSize: t.size ? `${t.size}pt` : void 0
|
|
463
|
-
})
|
|
464
|
-
}, [b(Y, {
|
|
465
|
-
runs: t.runs,
|
|
466
|
-
mode: e.mode,
|
|
467
|
-
numbers: e.numbers
|
|
468
|
-
}, null, 8, [
|
|
469
|
-
"runs",
|
|
470
|
-
"mode",
|
|
471
|
-
"numbers"
|
|
472
|
-
])], 12, Se))), 128))])])], 2)) : e.block.kind === "table" ? g("", !0) : (E(), _("div", {
|
|
473
|
-
key: 1,
|
|
474
|
-
class: w(["pk-word-preview__block", { "pk-word-preview__changed": i.value }]),
|
|
475
|
-
role: e.block.kind === "heading" ? "heading" : void 0,
|
|
476
|
-
"aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
|
|
477
|
-
style: T(n.value)
|
|
478
|
-
}, [
|
|
479
|
-
e.block.label ? (E(), _("span", {
|
|
480
|
-
key: 0,
|
|
481
|
-
class: "pk-word-preview__label",
|
|
482
|
-
style: T(r.value)
|
|
483
|
-
}, A(e.block.label), 5)) : g("", !0),
|
|
484
|
-
b(Y, {
|
|
485
|
-
runs: e.block.runs,
|
|
486
|
-
mode: e.mode,
|
|
487
|
-
page: e.page,
|
|
488
|
-
numbers: e.numbers
|
|
489
|
-
}, null, 8, [
|
|
490
|
-
"runs",
|
|
491
|
-
"mode",
|
|
492
|
-
"page",
|
|
493
|
-
"numbers"
|
|
494
|
-
]),
|
|
495
|
-
!e.block.label && !e.block.runs.length ? (E(), _("br", Z)) : g("", !0)
|
|
496
|
-
], 14, X));
|
|
497
|
-
}
|
|
498
|
-
}), Ce = { class: "pk-word-preview__part" }, we = ["src"], Te = /* @__PURE__ */ x({
|
|
499
|
-
__name: "PkWordPreviewPart",
|
|
500
|
-
props: {
|
|
501
|
-
blocks: {},
|
|
502
|
-
where: {},
|
|
503
|
-
section: {},
|
|
504
|
-
mode: {},
|
|
505
|
-
numbers: {}
|
|
506
|
-
},
|
|
507
|
-
setup(e) {
|
|
508
|
-
let t = e, n = S(u, void 0), r = m(() => d(t.blocks, t.mode)), i = m(() => l(t.blocks, t.mode).flatMap((e) => {
|
|
509
|
-
let r = o(n?.value, e.ref);
|
|
510
|
-
return r ? [{
|
|
511
|
-
src: r,
|
|
512
|
-
css: s(e, t.section.page)
|
|
513
|
-
}] : [];
|
|
514
|
-
})), a = m(() => {
|
|
515
|
-
let { margins: e } = t.section.page;
|
|
516
|
-
return {
|
|
517
|
-
left: `${e.left}pt`,
|
|
518
|
-
right: `${e.right}pt`,
|
|
519
|
-
...t.where === "header" ? { top: `${t.section.headerDistance}pt` } : { bottom: `${t.section.footerDistance}pt` }
|
|
520
|
-
};
|
|
521
|
-
});
|
|
522
|
-
return (t, n) => (E(), _("div", Ce, [v("div", {
|
|
523
|
-
class: "pk-word-preview__part-flow",
|
|
524
|
-
style: T(a.value)
|
|
525
|
-
}, [(E(!0), _(p, null, k(r.value, (t) => (E(), h(Q, {
|
|
526
|
-
key: t.key,
|
|
527
|
-
block: e.blocks[t.block],
|
|
528
|
-
row: t.row,
|
|
529
|
-
mode: e.mode,
|
|
530
|
-
page: e.section.page,
|
|
531
|
-
numbers: e.numbers
|
|
532
|
-
}, null, 8, [
|
|
533
|
-
"block",
|
|
534
|
-
"row",
|
|
535
|
-
"mode",
|
|
536
|
-
"page",
|
|
537
|
-
"numbers"
|
|
538
|
-
]))), 128))], 4), (E(!0), _(p, null, k(i.value, (e, t) => (E(), _("img", {
|
|
539
|
-
key: t,
|
|
540
|
-
class: "pk-word-preview__float",
|
|
541
|
-
style: T(e.css),
|
|
542
|
-
src: e.src,
|
|
543
|
-
alt: ""
|
|
544
|
-
}, null, 12, we))), 128))]));
|
|
545
|
-
}
|
|
546
|
-
}), Ee = ["aria-label"], De = {
|
|
547
|
-
class: "pk-word-preview__tabs",
|
|
548
|
-
role: "tablist"
|
|
549
|
-
}, Oe = ["aria-selected"], ke = ["aria-selected"], Ae = {
|
|
550
|
-
key: 0,
|
|
551
|
-
class: "pk-word-preview__list"
|
|
552
|
-
}, $ = ["aria-current", "onClick"], je = { class: "pk-word-preview__entry-text" }, Me = {
|
|
553
|
-
key: 0,
|
|
554
|
-
class: "u-dot"
|
|
555
|
-
}, Ne = {
|
|
556
|
-
key: 0,
|
|
557
|
-
class: "pk-word-preview__none"
|
|
558
|
-
}, Pe = {
|
|
559
|
-
key: 1,
|
|
560
|
-
class: "pk-word-preview__list"
|
|
561
|
-
}, Fe = ["onClick"], Ie = {
|
|
562
|
-
key: 0,
|
|
563
|
-
class: "pk-word-preview__removed"
|
|
564
|
-
}, Le = {
|
|
565
|
-
key: 1,
|
|
566
|
-
class: "pk-word-preview__added"
|
|
567
|
-
}, Re = { class: "pk-word-preview__main" }, ze = ["aria-label"], Be = ["src"], Ve = {
|
|
568
|
-
key: 2,
|
|
569
|
-
class: "pk-word-preview__truncated"
|
|
570
|
-
}, He = { class: "pk-word-preview__status" }, Ue = {
|
|
571
|
-
key: 0,
|
|
572
|
-
class: "pk-word-preview__count"
|
|
573
|
-
}, We = { class: "pk-word-preview__count" }, Ge = {
|
|
574
|
-
key: 1,
|
|
575
|
-
class: "pk-word-preview__legend"
|
|
576
|
-
}, Ke = ["title"], qe = { class: "pk-word-preview__removed" }, Je = { class: "pk-word-preview__added" }, Ye = { class: "pk-word-preview__percent" }, Xe = ["data-part"], Ze = 96 / 72, Qe = /* @__PURE__ */ x({
|
|
577
|
-
__name: "PkWordPreview",
|
|
578
|
-
props: /*@__PURE__*/ C({
|
|
579
|
-
preview: {},
|
|
580
|
-
mode: {}
|
|
581
|
-
}, {
|
|
582
|
-
fit: {
|
|
583
|
-
type: Boolean,
|
|
584
|
-
default: !0
|
|
585
|
-
},
|
|
586
|
-
fitModifiers: {},
|
|
587
|
-
zoom: { default: 1 },
|
|
588
|
-
zoomModifiers: {}
|
|
589
|
-
}),
|
|
590
|
-
emits: ["update:fit", "update:zoom"],
|
|
591
|
-
setup(e) {
|
|
592
|
-
let t = e, { t: i } = oe({ useScope: "global" });
|
|
593
|
-
D(u, m(() => t.preview.images));
|
|
594
|
-
let f = (e) => c(e, t.mode), y = m(() => d(t.preview.blocks, t.mode)), x = ie("rootEl"), S = ie("scrollEl"), ee = ie("measureEl"), { width: C } = se(x), { width: ae } = se(S), P = m(() => C.value === 0 || C.value >= 640), ce = m(() => C.value >= 1e3), F = m(() => t.preview.sections?.length ? t.preview.sections : [{
|
|
595
|
-
page: t.preview.page,
|
|
596
|
-
headerDistance: 0,
|
|
597
|
-
footerDistance: 0,
|
|
598
|
-
headers: {},
|
|
599
|
-
footers: {}
|
|
600
|
-
}]), I = m(() => F.value[0].page), le = m(() => ({
|
|
601
|
-
fontFamily: r(t.preview.defaults.font),
|
|
602
|
-
fontSize: `${t.preview.defaults.size}pt`,
|
|
603
|
-
color: t.preview.defaults.color ?? "#000000",
|
|
604
|
-
"--pk-word-line": a(t.preview.defaults.font),
|
|
605
|
-
"--pk-word-size": `${t.preview.defaults.size}pt`
|
|
606
|
-
})), ue = m(() => ({
|
|
607
|
-
...le.value,
|
|
608
|
-
width: `${I.value.width - I.value.margins.left - I.value.margins.right}pt`
|
|
609
|
-
})), L = O([]), de = O({}), fe = async () => {
|
|
610
|
-
await te();
|
|
611
|
-
let e = ee.value?.querySelectorAll("[data-item]");
|
|
612
|
-
L.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
|
|
613
|
-
let t = ee.value?.querySelectorAll("[data-part]");
|
|
614
|
-
de.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
|
|
615
|
-
};
|
|
616
|
-
N([
|
|
617
|
-
y,
|
|
618
|
-
P,
|
|
619
|
-
() => t.preview.parts
|
|
620
|
-
], fe, { flush: "post" }), re(() => {
|
|
621
|
-
fe(), document.fonts?.ready.then(fe);
|
|
622
|
-
});
|
|
623
|
-
let R = m(() => {
|
|
624
|
-
if (!P.value || L.value.length !== y.value.length) return [{
|
|
625
|
-
items: y.value.map((e, t) => t),
|
|
626
|
-
section: 0,
|
|
627
|
-
number: 1,
|
|
628
|
-
top: I.value.margins.top,
|
|
629
|
-
bottom: I.value.margins.bottom
|
|
630
|
-
}];
|
|
631
|
-
let e = [], n = 0, r = !0, i = 0, a, o = () => {
|
|
632
|
-
let o = F.value[n], s = r && o.pageStart !== void 0 ? o.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
|
|
633
|
-
a = void 0;
|
|
634
|
-
let c = (e) => r && o.titlePage ? e.first : t.preview.evenAndOddHeaders && s % 2 == 0 ? e.even : e.default, l = c(o.headers), u = c(o.footers), d = (e) => e ? (de.value[e] ?? 0) / Ze : 0;
|
|
635
|
-
e.push({
|
|
636
|
-
items: [],
|
|
637
|
-
section: n,
|
|
638
|
-
number: s,
|
|
639
|
-
header: l,
|
|
640
|
-
footer: u,
|
|
641
|
-
top: Math.max(o.page.margins.top, l ? o.headerDistance + d(l) : 0),
|
|
642
|
-
bottom: Math.max(o.page.margins.bottom, u ? o.footerDistance + d(u) : 0)
|
|
643
|
-
}), r = !1, i = 0;
|
|
644
|
-
};
|
|
645
|
-
return y.value.forEach((t, s) => {
|
|
646
|
-
t.section !== void 0 && t.section !== n && F.value[t.section] && (n = t.section, r = t.breakBefore || !e.length, r || (a = F.value[n].pageStart));
|
|
647
|
-
let c = e[e.length - 1], l = c && F.value[c.section].page, u = l ? (l.height - c.top - c.bottom) * Ze : 0;
|
|
648
|
-
(!c || c.items.length && (t.breakBefore || i + L.value[s] > u)) && o(), e[e.length - 1].items.push(s), i += L.value[s];
|
|
649
|
-
}), e.length || o(), e;
|
|
650
|
-
}), pe = m(() => {
|
|
651
|
-
let e = /* @__PURE__ */ new Map();
|
|
652
|
-
for (let t of R.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
|
|
653
|
-
return R.value.map((t) => ({
|
|
654
|
-
page: t.number,
|
|
655
|
-
pages: R.value.length,
|
|
656
|
-
sectionPages: e.get(t.section) ?? 1
|
|
657
|
-
}));
|
|
658
|
-
}), me = (e) => {
|
|
659
|
-
let t = F.value[e.section].page;
|
|
660
|
-
return {
|
|
661
|
-
...le.value,
|
|
662
|
-
width: `${t.width}pt`,
|
|
663
|
-
minHeight: `${t.height}pt`,
|
|
664
|
-
padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
|
|
665
|
-
};
|
|
666
|
-
}, he = (e) => {
|
|
667
|
-
let n = [...new Set(e.items.map((e) => y.value[e].block))];
|
|
668
|
-
return l(n.map((e) => t.preview.blocks[e]), t.mode).flatMap((n) => {
|
|
669
|
-
let r = o(t.preview.images, n.ref);
|
|
670
|
-
return r ? [{
|
|
671
|
-
src: r,
|
|
672
|
-
css: s(n, F.value[e.section].page)
|
|
673
|
-
}] : [];
|
|
674
|
-
});
|
|
675
|
-
}, z = M(e, "fit"), ge = M(e, "zoom"), B = m(() => z.value ? Math.min(1.25, Math.max(.3, (ae.value - 48) / (I.value.width * Ze))) : ge.value), _e = (e) => {
|
|
676
|
-
ge.value = Math.min(2, Math.max(.3, Math.round((B.value + e) * 10) / 10)), z.value = !1;
|
|
677
|
-
}, ve = O(0), ye = O(), be = () => {
|
|
678
|
-
let e = S.value?.getBoundingClientRect();
|
|
679
|
-
if (!e) return;
|
|
680
|
-
let t = S.value?.querySelectorAll("[data-page]") ?? [], n = 0;
|
|
681
|
-
for (let [r, i] of [...t].entries()) {
|
|
682
|
-
if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
|
|
683
|
-
n = r;
|
|
684
|
-
}
|
|
685
|
-
ve.value = n;
|
|
686
|
-
let r;
|
|
687
|
-
for (let t of W.value) {
|
|
688
|
-
let n = S.value?.querySelector(`[data-key="${t.key}"]`);
|
|
689
|
-
if (n) {
|
|
690
|
-
if (n.getBoundingClientRect().top - e.top > 48) break;
|
|
691
|
-
r = t.key;
|
|
692
|
-
}
|
|
693
|
-
}
|
|
694
|
-
ye.value = r ?? W.value[0]?.key;
|
|
695
|
-
}, V = 0, H = () => {
|
|
696
|
-
V ||= requestAnimationFrame(() => {
|
|
697
|
-
V = 0, be();
|
|
698
|
-
});
|
|
699
|
-
};
|
|
700
|
-
ne(() => cancelAnimationFrame(V)), N(R, () => te(H));
|
|
701
|
-
let U = (e) => f(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), W = m(() => y.value.flatMap((e) => {
|
|
702
|
-
let n = t.preview.blocks[e.block], r = n.kind === "heading" ? [n.label, U(n.runs)].filter(Boolean).join(" ") : "";
|
|
703
|
-
return n.kind === "heading" && n.level <= 3 && r ? [{
|
|
704
|
-
key: e.key,
|
|
705
|
-
level: n.level,
|
|
706
|
-
text: r
|
|
707
|
-
}] : [];
|
|
708
|
-
})), G = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, K = m(() => y.value.flatMap((e) => {
|
|
709
|
-
let n = t.preview.blocks[e.block], r = n.kind === "table" ? (n.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : n.runs, i = r.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), a = r.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
|
|
710
|
-
return i || a ? [{
|
|
711
|
-
key: e.key,
|
|
712
|
-
removed: G(i),
|
|
713
|
-
added: G(a)
|
|
714
|
-
}] : [];
|
|
715
|
-
})), q = O("outline"), J = O(!1), Y = (e) => {
|
|
716
|
-
S.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
|
|
717
|
-
block: "start",
|
|
718
|
-
behavior: "smooth"
|
|
719
|
-
}), ce.value || (J.value = !1);
|
|
720
|
-
}, xe = m(() => t.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => U(e.runs)) : [U(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), Se = m(() => t.preview.revisionAuthors.join(", "));
|
|
721
|
-
return (t, r) => {
|
|
722
|
-
let a = n;
|
|
723
|
-
return E(), _("div", {
|
|
724
|
-
ref_key: "rootEl",
|
|
725
|
-
ref: x,
|
|
726
|
-
class: w(["pk-word-preview", { "pk-word-preview--paged": P.value }])
|
|
727
|
-
}, [
|
|
728
|
-
(ce.value || J.value) && (W.value.length || K.value.length) ? (E(), _("aside", {
|
|
729
|
-
key: 0,
|
|
730
|
-
class: w(["pk-word-preview__side", { "pk-word-preview__side--over": !ce.value }]),
|
|
731
|
-
"aria-label": j(i)("chatFilePreview.outline")
|
|
732
|
-
}, [v("div", De, [v("button", {
|
|
733
|
-
type: "button",
|
|
734
|
-
role: "tab",
|
|
735
|
-
class: "pk-word-preview__tab",
|
|
736
|
-
"aria-selected": q.value === "outline",
|
|
737
|
-
onClick: r[0] ||= (e) => q.value = "outline"
|
|
738
|
-
}, A(j(i)("chatFilePreview.outline")), 9, Oe), K.value.length ? (E(), _("button", {
|
|
739
|
-
key: 0,
|
|
740
|
-
type: "button",
|
|
741
|
-
role: "tab",
|
|
742
|
-
class: "pk-word-preview__tab",
|
|
743
|
-
"aria-selected": q.value === "changes",
|
|
744
|
-
onClick: r[1] ||= (e) => q.value = "changes"
|
|
745
|
-
}, A(j(i)("chatFilePreview.changes", { count: K.value.length })), 9, ke)) : g("", !0)]), q.value === "outline" || !K.value.length ? (E(), _("nav", Ae, [(E(!0), _(p, null, k(W.value, (e) => (E(), _("button", {
|
|
746
|
-
key: e.key,
|
|
747
|
-
type: "button",
|
|
748
|
-
class: w(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
|
|
749
|
-
"aria-current": ye.value === e.key ? "location" : void 0,
|
|
750
|
-
onClick: (t) => Y(e.key)
|
|
751
|
-
}, [v("span", je, A(e.text), 1), K.value.some((t) => t.key === e.key) ? (E(), _("span", Me)) : g("", !0)], 10, $))), 128)), W.value.length ? g("", !0) : (E(), _("p", Ne, A(j(i)("chatFilePreview.noHeadings")), 1))])) : (E(), _("nav", Pe, [(E(!0), _(p, null, k(K.value, (e) => (E(), _("button", {
|
|
752
|
-
key: e.key,
|
|
753
|
-
type: "button",
|
|
754
|
-
class: "pk-word-preview__entry pk-word-preview__entry--change",
|
|
755
|
-
onClick: (t) => Y(e.key)
|
|
756
|
-
}, [e.removed ? (E(), _("del", Ie, A(e.removed), 1)) : g("", !0), e.added ? (E(), _("ins", Le, A(e.added), 1)) : g("", !0)], 8, Fe))), 128))]))], 10, Ee)) : g("", !0),
|
|
757
|
-
v("div", Re, [v("div", {
|
|
758
|
-
ref_key: "scrollEl",
|
|
759
|
-
ref: S,
|
|
760
|
-
class: "pk-word-preview__scroll",
|
|
761
|
-
onScroll: H
|
|
762
|
-
}, [P.value ? (E(), _("div", {
|
|
763
|
-
key: 0,
|
|
764
|
-
class: "pk-word-preview__pages",
|
|
765
|
-
style: T({ zoom: B.value })
|
|
766
|
-
}, [(E(!0), _(p, null, k(R.value, (t, n) => (E(), _("article", {
|
|
767
|
-
key: n,
|
|
768
|
-
"data-page": "",
|
|
769
|
-
class: "pk-word-preview__page",
|
|
770
|
-
"aria-label": j(i)("chatFilePreview.pageOf", {
|
|
771
|
-
page: n + 1,
|
|
772
|
-
count: R.value.length
|
|
773
|
-
}),
|
|
774
|
-
style: T(me(t))
|
|
775
|
-
}, [
|
|
776
|
-
t.header && e.preview.parts?.[t.header] ? (E(), h(Te, {
|
|
777
|
-
key: 0,
|
|
778
|
-
blocks: e.preview.parts[t.header],
|
|
779
|
-
where: "header",
|
|
780
|
-
section: F.value[t.section],
|
|
781
|
-
mode: e.mode,
|
|
782
|
-
numbers: pe.value[n]
|
|
783
|
-
}, null, 8, [
|
|
784
|
-
"blocks",
|
|
785
|
-
"section",
|
|
786
|
-
"mode",
|
|
787
|
-
"numbers"
|
|
788
|
-
])) : g("", !0),
|
|
789
|
-
(E(!0), _(p, null, k(t.items, (r) => (E(), h(Q, {
|
|
790
|
-
key: y.value[r].key,
|
|
791
|
-
"data-key": y.value[r].key,
|
|
792
|
-
block: e.preview.blocks[y.value[r].block],
|
|
793
|
-
row: y.value[r].row,
|
|
794
|
-
mode: e.mode,
|
|
795
|
-
page: F.value[t.section].page,
|
|
796
|
-
numbers: pe.value[n]
|
|
797
|
-
}, null, 8, [
|
|
798
|
-
"data-key",
|
|
799
|
-
"block",
|
|
800
|
-
"row",
|
|
801
|
-
"mode",
|
|
802
|
-
"page",
|
|
803
|
-
"numbers"
|
|
804
|
-
]))), 128)),
|
|
805
|
-
(E(!0), _(p, null, k(he(t), (e, t) => (E(), _("img", {
|
|
806
|
-
key: `image-${t}`,
|
|
807
|
-
class: "pk-word-preview__float",
|
|
808
|
-
style: T(e.css),
|
|
809
|
-
src: e.src,
|
|
810
|
-
alt: ""
|
|
811
|
-
}, null, 12, Be))), 128)),
|
|
812
|
-
t.footer && e.preview.parts?.[t.footer] ? (E(), h(Te, {
|
|
813
|
-
key: 1,
|
|
814
|
-
blocks: e.preview.parts[t.footer],
|
|
815
|
-
where: "footer",
|
|
816
|
-
section: F.value[t.section],
|
|
817
|
-
mode: e.mode,
|
|
818
|
-
numbers: pe.value[n]
|
|
819
|
-
}, null, 8, [
|
|
820
|
-
"blocks",
|
|
821
|
-
"section",
|
|
822
|
-
"mode",
|
|
823
|
-
"numbers"
|
|
824
|
-
])) : g("", !0)
|
|
825
|
-
], 12, ze))), 128))], 4)) : (E(), _("article", {
|
|
826
|
-
key: 1,
|
|
827
|
-
class: "pk-word-preview__page pk-word-preview__page--flow",
|
|
828
|
-
style: T(le.value)
|
|
829
|
-
}, [(E(!0), _(p, null, k(y.value, (t) => (E(), h(Q, {
|
|
830
|
-
key: t.key,
|
|
831
|
-
"data-key": t.key,
|
|
832
|
-
block: e.preview.blocks[t.block],
|
|
833
|
-
row: t.row,
|
|
834
|
-
mode: e.mode
|
|
835
|
-
}, null, 8, [
|
|
836
|
-
"data-key",
|
|
837
|
-
"block",
|
|
838
|
-
"row",
|
|
839
|
-
"mode"
|
|
840
|
-
]))), 128))], 4)), e.preview.truncated ? (E(), _("p", Ve, A(j(i)("chatFilePreview.truncated")), 1)) : g("", !0)], 544), v("div", He, [
|
|
841
|
-
P.value ? (E(), _("span", Ue, A(j(i)("chatFilePreview.pageOf", {
|
|
842
|
-
page: ve.value + 1,
|
|
843
|
-
count: R.value.length
|
|
844
|
-
})), 1)) : g("", !0),
|
|
845
|
-
v("span", We, A(j(i)("chatFilePreview.words", xe.value)), 1),
|
|
846
|
-
e.mode === "markup" && e.preview.revisionAuthors.length ? (E(), _("span", Ge, [
|
|
847
|
-
v("span", {
|
|
848
|
-
class: "pk-word-preview__legend-text",
|
|
849
|
-
title: j(i)("chatFilePreview.revisionsOf", { authors: Se.value })
|
|
850
|
-
}, A(j(i)("chatFilePreview.revisionsOf", { authors: Se.value })), 9, Ke),
|
|
851
|
-
v("del", qe, A(j(i)("chatFilePreview.removed")), 1),
|
|
852
|
-
v("ins", Je, A(j(i)("chatFilePreview.added")), 1)
|
|
853
|
-
])) : g("", !0),
|
|
854
|
-
r[6] ||= v("span", { class: "pk-word-preview__spacer" }, null, -1),
|
|
855
|
-
!ce.value && (W.value.length || K.value.length) ? (E(), h(a, {
|
|
856
|
-
key: 2,
|
|
857
|
-
class: "pk-word-preview__outline-toggle",
|
|
858
|
-
modifiers: "action-quiet",
|
|
859
|
-
icon: "ri:list-unordered",
|
|
860
|
-
label: j(i)("chatFilePreview.outline"),
|
|
861
|
-
title: j(i)("chatFilePreview.outline"),
|
|
862
|
-
"aria-label": j(i)("chatFilePreview.outline"),
|
|
863
|
-
"aria-expanded": J.value,
|
|
864
|
-
onClick: r[2] ||= (e) => J.value = !J.value
|
|
865
|
-
}, null, 8, [
|
|
866
|
-
"label",
|
|
867
|
-
"title",
|
|
868
|
-
"aria-label",
|
|
869
|
-
"aria-expanded"
|
|
870
|
-
])) : g("", !0),
|
|
871
|
-
P.value ? (E(), _(p, { key: 3 }, [
|
|
872
|
-
b(a, {
|
|
873
|
-
modifiers: "action-quiet",
|
|
874
|
-
label: j(i)("chatFilePreview.fitWidth"),
|
|
875
|
-
disabled: z.value,
|
|
876
|
-
onClick: r[3] ||= (e) => z.value = !0
|
|
877
|
-
}, null, 8, ["label", "disabled"]),
|
|
878
|
-
b(a, {
|
|
879
|
-
modifiers: "action-quiet",
|
|
880
|
-
icon: "ri:subtract-line",
|
|
881
|
-
"aria-label": j(i)("chatFilePreview.zoomOut"),
|
|
882
|
-
disabled: B.value <= .3,
|
|
883
|
-
onClick: r[4] ||= (e) => _e(-.1)
|
|
884
|
-
}, null, 8, ["aria-label", "disabled"]),
|
|
885
|
-
v("span", Ye, A(Math.round(B.value * 100)) + "% ", 1),
|
|
886
|
-
b(a, {
|
|
887
|
-
modifiers: "action-quiet",
|
|
888
|
-
icon: "ri:add-line",
|
|
889
|
-
"aria-label": j(i)("chatFilePreview.zoomIn"),
|
|
890
|
-
disabled: B.value >= 2,
|
|
891
|
-
onClick: r[5] ||= (e) => _e(.1)
|
|
892
|
-
}, null, 8, ["aria-label", "disabled"])
|
|
893
|
-
], 64)) : g("", !0)
|
|
894
|
-
])]),
|
|
895
|
-
P.value ? (E(), _("div", {
|
|
896
|
-
key: 1,
|
|
897
|
-
ref_key: "measureEl",
|
|
898
|
-
ref: ee,
|
|
899
|
-
class: "pk-word-preview__measure",
|
|
900
|
-
"aria-hidden": "true",
|
|
901
|
-
style: T(ue.value)
|
|
902
|
-
}, [(E(!0), _(p, null, k(y.value, (t) => (E(), _("div", {
|
|
903
|
-
key: t.key,
|
|
904
|
-
"data-item": ""
|
|
905
|
-
}, [b(Q, {
|
|
906
|
-
block: e.preview.blocks[t.block],
|
|
907
|
-
row: t.row,
|
|
908
|
-
mode: e.mode,
|
|
909
|
-
page: I.value
|
|
910
|
-
}, null, 8, [
|
|
911
|
-
"block",
|
|
912
|
-
"row",
|
|
913
|
-
"mode",
|
|
914
|
-
"page"
|
|
915
|
-
])]))), 128)), (E(!0), _(p, null, k(e.preview.parts, (t, n) => (E(), _("div", {
|
|
916
|
-
key: n,
|
|
917
|
-
"data-part": n
|
|
918
|
-
}, [(E(!0), _(p, null, k(j(d)(t, e.mode), (n) => (E(), h(Q, {
|
|
919
|
-
key: n.key,
|
|
920
|
-
block: t[n.block],
|
|
921
|
-
row: n.row,
|
|
922
|
-
mode: e.mode,
|
|
923
|
-
page: I.value
|
|
924
|
-
}, null, 8, [
|
|
925
|
-
"block",
|
|
926
|
-
"row",
|
|
927
|
-
"mode",
|
|
928
|
-
"page"
|
|
929
|
-
]))), 128))], 8, Xe))), 128))], 4)) : g("", !0)
|
|
930
|
-
], 2);
|
|
931
|
-
};
|
|
932
|
-
}
|
|
933
|
-
}), $e = ["aria-label"], et = { class: "pk-file-preview__head" }, tt = { class: "pk-file-preview__file" }, nt = {
|
|
934
|
-
class: "pk-file-preview__tile",
|
|
935
|
-
"aria-hidden": "true"
|
|
936
|
-
}, rt = { class: "pk-file-preview__name" }, it = { class: "pk-file-preview__title" }, at = { class: "pk-file-preview__note" }, ot = {
|
|
937
|
-
key: 0,
|
|
938
|
-
class: "pk-file-preview__tools"
|
|
939
|
-
}, st = ["aria-label"], ct = { class: "pk-file-preview__version" }, lt = { class: "pk-file-preview__mode-long" }, ut = { class: "pk-file-preview__mode-short" }, dt = { class: "pk-file-preview__actions" }, ft = { class: "pk-file-preview__body" }, pt = {
|
|
940
|
-
key: 0,
|
|
941
|
-
class: "pk-file-preview__skeleton vv-skeleton"
|
|
942
|
-
}, mt = {
|
|
943
|
-
key: 1,
|
|
944
|
-
class: "pk-file-preview__empty"
|
|
945
|
-
}, ht = /*@__PURE__*/ x({
|
|
946
|
-
__name: "PkFilePreview",
|
|
947
|
-
props: /*@__PURE__*/ C({
|
|
948
|
-
kind: {},
|
|
949
|
-
filename: {},
|
|
950
|
-
version: {},
|
|
951
|
-
versions: {},
|
|
952
|
-
downloadUrl: {},
|
|
953
|
-
preview: {},
|
|
954
|
-
loading: { type: Boolean },
|
|
955
|
-
error: { type: Boolean },
|
|
956
|
-
restorable: { type: Boolean },
|
|
957
|
-
resize: {}
|
|
958
|
-
}, {
|
|
959
|
-
mode: { default: "markup" },
|
|
960
|
-
modeModifiers: {},
|
|
961
|
-
sheet: { default: 0 },
|
|
962
|
-
sheetModifiers: {},
|
|
963
|
-
zoom: { default: 1 },
|
|
964
|
-
zoomModifiers: {},
|
|
965
|
-
fit: {
|
|
966
|
-
type: Boolean,
|
|
967
|
-
default: !0
|
|
968
|
-
},
|
|
969
|
-
fitModifiers: {}
|
|
970
|
-
}),
|
|
971
|
-
emits: /*@__PURE__*/ C([
|
|
972
|
-
"close",
|
|
973
|
-
"version",
|
|
974
|
-
"restore",
|
|
975
|
-
"resize"
|
|
976
|
-
], [
|
|
977
|
-
"update:mode",
|
|
978
|
-
"update:sheet",
|
|
979
|
-
"update:zoom",
|
|
980
|
-
"update:fit"
|
|
981
|
-
]),
|
|
982
|
-
setup(e, { emit: r }) {
|
|
983
|
-
let i = e, a = r, { t: o } = oe({ useScope: "global" }), s = m(() => i.versions ?? []), c = m(() => i.version ? s.value.indexOf(i.version) : -1), l = m(() => c.value > 0 ? s.value[c.value - 1] : void 0), u = m(() => c.value >= 0 && c.value < s.value.length - 1 ? s.value[c.value + 1] : void 0), d = M(e, "mode"), y = M(e, "sheet"), x = M(e, "zoom"), S = M(e, "fit"), ee = m(() => [
|
|
984
|
-
{
|
|
985
|
-
value: "markup",
|
|
986
|
-
label: o("chatFilePreview.modeMarkup")
|
|
987
|
-
},
|
|
988
|
-
{
|
|
989
|
-
value: "accepted",
|
|
990
|
-
label: o("chatFilePreview.modeAccepted")
|
|
991
|
-
},
|
|
992
|
-
{
|
|
993
|
-
value: "original",
|
|
994
|
-
label: o("chatFilePreview.modeOriginal")
|
|
995
|
-
}
|
|
996
|
-
]), C = m(() => i.preview?.kind === "word" && i.preview.revisionAuthors.length > 0);
|
|
997
|
-
return N(() => i.version, () => {
|
|
998
|
-
d.value = "markup";
|
|
999
|
-
}), (r, i) => {
|
|
1000
|
-
let c = f, m = n;
|
|
1001
|
-
return E(), _("section", {
|
|
1002
|
-
class: "pk-file-preview",
|
|
1003
|
-
"aria-label": e.filename,
|
|
1004
|
-
tabindex: "-1",
|
|
1005
|
-
autofocus: ""
|
|
1006
|
-
}, [v("header", et, [
|
|
1007
|
-
v("div", tt, [v("span", nt, [b(c, {
|
|
1008
|
-
name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
|
|
1009
|
-
class: w(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
|
|
1010
|
-
}, null, 8, ["name", "class"])]), v("div", rt, [v("strong", it, A(e.filename), 1), v("span", at, A(j(o)("chatFilePreview.readOnly")), 1)])]),
|
|
1011
|
-
e.version && s.value.length > 1 || C.value ? (E(), _("div", ot, [e.version && s.value.length > 1 ? (E(), _("nav", {
|
|
1012
|
-
key: 0,
|
|
1013
|
-
class: "pk-file-preview__versions",
|
|
1014
|
-
"aria-label": j(o)("chatFilePreview.versions")
|
|
1015
|
-
}, [
|
|
1016
|
-
b(m, {
|
|
1017
|
-
modifiers: "action-quiet",
|
|
1018
|
-
icon: "ri:arrow-left-s-line",
|
|
1019
|
-
"aria-label": j(o)("chatFilePreview.previousVersion"),
|
|
1020
|
-
disabled: !l.value,
|
|
1021
|
-
onClick: i[0] ||= (e) => l.value && a("version", l.value)
|
|
1022
|
-
}, null, 8, ["aria-label", "disabled"]),
|
|
1023
|
-
v("span", ct, A(j(o)("chatFilePreview.versionOf", {
|
|
1024
|
-
version: e.version,
|
|
1025
|
-
count: s.value.length
|
|
1026
|
-
})), 1),
|
|
1027
|
-
b(m, {
|
|
1028
|
-
modifiers: "action-quiet",
|
|
1029
|
-
icon: "ri:arrow-right-s-line",
|
|
1030
|
-
"aria-label": j(o)("chatFilePreview.nextVersion"),
|
|
1031
|
-
disabled: !u.value,
|
|
1032
|
-
onClick: i[1] ||= (e) => u.value && a("version", u.value)
|
|
1033
|
-
}, null, 8, ["aria-label", "disabled"])
|
|
1034
|
-
], 8, st)) : g("", !0), C.value ? (E(), h(t, {
|
|
1035
|
-
key: 1,
|
|
1036
|
-
modelValue: d.value,
|
|
1037
|
-
"onUpdate:modelValue": i[2] ||= (e) => d.value = e,
|
|
1038
|
-
name: "revisions",
|
|
1039
|
-
segmented: "",
|
|
1040
|
-
class: "pk-file-preview__modes u-segmented-fit mb-0",
|
|
1041
|
-
"aria-label": j(o)("chatFilePreview.modes"),
|
|
1042
|
-
options: ee.value
|
|
1043
|
-
}, {
|
|
1044
|
-
markup: ae(() => [v("span", lt, A(j(o)("chatFilePreview.modeMarkup")), 1), v("span", ut, A(j(o)("chatFilePreview.modeMarkupShort")), 1)]),
|
|
1045
|
-
_: 1
|
|
1046
|
-
}, 8, [
|
|
1047
|
-
"modelValue",
|
|
1048
|
-
"aria-label",
|
|
1049
|
-
"options"
|
|
1050
|
-
])) : g("", !0)])) : g("", !0),
|
|
1051
|
-
v("div", dt, [
|
|
1052
|
-
e.restorable ? (E(), h(m, {
|
|
1053
|
-
key: 0,
|
|
1054
|
-
modifiers: "action-quiet",
|
|
1055
|
-
icon: "ri:arrow-go-back-line",
|
|
1056
|
-
label: j(o)("chatFilePreview.restore"),
|
|
1057
|
-
onClick: i[3] ||= (e) => a("restore")
|
|
1058
|
-
}, null, 8, ["label"])) : g("", !0),
|
|
1059
|
-
b(m, {
|
|
1060
|
-
href: e.downloadUrl,
|
|
1061
|
-
download: "",
|
|
1062
|
-
modifiers: "action-quiet",
|
|
1063
|
-
icon: "ri:download-line",
|
|
1064
|
-
title: j(o)("chatFilePreview.download"),
|
|
1065
|
-
"aria-label": j(o)("chatFilePreview.download")
|
|
1066
|
-
}, null, 8, [
|
|
1067
|
-
"href",
|
|
1068
|
-
"title",
|
|
1069
|
-
"aria-label"
|
|
1070
|
-
]),
|
|
1071
|
-
e.resize === "expand" ? (E(), h(m, {
|
|
1072
|
-
key: 1,
|
|
1073
|
-
modifiers: "action-quiet",
|
|
1074
|
-
icon: "ri:fullscreen-line",
|
|
1075
|
-
title: j(o)("chatFilePreview.expand"),
|
|
1076
|
-
"aria-label": j(o)("chatFilePreview.expand"),
|
|
1077
|
-
onClick: i[4] ||= (e) => a("resize")
|
|
1078
|
-
}, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (E(), h(m, {
|
|
1079
|
-
key: 2,
|
|
1080
|
-
modifiers: "action-quiet",
|
|
1081
|
-
icon: "ri:fullscreen-exit-line",
|
|
1082
|
-
title: j(o)("chatFilePreview.shrink"),
|
|
1083
|
-
"aria-label": j(o)("chatFilePreview.shrink"),
|
|
1084
|
-
onClick: i[5] ||= (e) => a("resize")
|
|
1085
|
-
}, null, 8, ["title", "aria-label"])) : g("", !0),
|
|
1086
|
-
b(m, {
|
|
1087
|
-
modifiers: "action-quiet",
|
|
1088
|
-
icon: "ri:close-line",
|
|
1089
|
-
title: j(o)("chatFilePreview.close"),
|
|
1090
|
-
"aria-label": j(o)("chatFilePreview.close"),
|
|
1091
|
-
onClick: i[6] ||= (e) => a("close")
|
|
1092
|
-
}, null, 8, ["title", "aria-label"])
|
|
1093
|
-
])
|
|
1094
|
-
]), v("div", ft, [e.loading ? (E(), _("div", pt, [(E(), _(p, null, k(8, (e) => v("div", {
|
|
1095
|
-
key: e,
|
|
1096
|
-
class: w(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
|
|
1097
|
-
}, null, 2)), 64))])) : e.error || !e.preview ? (E(), _("p", mt, A(j(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (E(), h(Qe, {
|
|
1098
|
-
key: 2,
|
|
1099
|
-
zoom: x.value,
|
|
1100
|
-
"onUpdate:zoom": i[7] ||= (e) => x.value = e,
|
|
1101
|
-
fit: S.value,
|
|
1102
|
-
"onUpdate:fit": i[8] ||= (e) => S.value = e,
|
|
1103
|
-
preview: e.preview,
|
|
1104
|
-
mode: C.value ? d.value : "markup"
|
|
1105
|
-
}, null, 8, [
|
|
1106
|
-
"zoom",
|
|
1107
|
-
"fit",
|
|
1108
|
-
"preview",
|
|
1109
|
-
"mode"
|
|
1110
|
-
])) : (E(), h(W, {
|
|
1111
|
-
key: 3,
|
|
1112
|
-
sheet: y.value,
|
|
1113
|
-
"onUpdate:sheet": i[9] ||= (e) => y.value = e,
|
|
1114
|
-
zoom: x.value,
|
|
1115
|
-
"onUpdate:zoom": i[10] ||= (e) => x.value = e,
|
|
1116
|
-
preview: e.preview
|
|
1117
|
-
}, null, 8, [
|
|
1118
|
-
"sheet",
|
|
1119
|
-
"zoom",
|
|
1120
|
-
"preview"
|
|
1121
|
-
]))])], 8, $e);
|
|
1122
|
-
};
|
|
1123
|
-
}
|
|
1124
|
-
}), gt = /* @__PURE__ */ e({ default: () => _t }), _t = ht;
|
|
1125
|
-
export { gt as n, _t as t };
|
|
1126
|
-
|
|
1127
|
-
//# sourceMappingURL=PkFilePreview-jeqvHDm7.js.map
|