@8wave/ai-elements 0.125.0-beta.42 → 0.125.0-beta.43

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (129) hide show
  1. package/dist/_chunks/Chart-1vt0m6l_.js +87 -0
  2. package/dist/_chunks/Chart-1vt0m6l_.js.map +1 -0
  3. package/dist/_chunks/{PkChart-CbtMRGWc.js → PkChart-CYFx_UDq.js} +741 -623
  4. package/dist/_chunks/PkChart-CYFx_UDq.js.map +1 -0
  5. package/dist/_chunks/PkFilePreview-yjdtArag.js +1745 -0
  6. package/dist/_chunks/PkFilePreview-yjdtArag.js.map +1 -0
  7. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js → PkFilePreviewDialog-Df0Lt40J.js} +2 -2
  8. package/dist/_chunks/{PkFilePreviewDialog-bcTkTcYk.js.map → PkFilePreviewDialog-Df0Lt40J.js.map} +1 -1
  9. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js → PkImageEditorDialog-PVf3IHGB.js} +2 -2
  10. package/dist/_chunks/{PkImageEditorDialog-FpbyhV3t.js.map → PkImageEditorDialog-PVf3IHGB.js.map} +1 -1
  11. package/dist/_chunks/{PkSelectionActions-BbfVZY0R.js → PkSelectionActions-CMyg_x8h.js} +2 -2
  12. package/dist/_chunks/{PkSelectionActions-BbfVZY0R.js.map → PkSelectionActions-CMyg_x8h.js.map} +1 -1
  13. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js → PkStreamingMarkdown-BDXbU2tz.js} +2 -2
  14. package/dist/_chunks/{PkStreamingMarkdown-COSOOhCg.js.map → PkStreamingMarkdown-BDXbU2tz.js.map} +1 -1
  15. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js → PkToolChatFile-CMQdMs-9.js} +3 -3
  16. package/dist/_chunks/{PkToolChatFile-C_gS0X1j.js.map → PkToolChatFile-CMQdMs-9.js.map} +1 -1
  17. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js → PkToolShowArtifact-YrC54qxc.js} +2 -2
  18. package/dist/_chunks/{PkToolShowArtifact-fpFtKrZo.js.map → PkToolShowArtifact-YrC54qxc.js.map} +1 -1
  19. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js +138 -0
  20. package/dist/_chunks/PkToolShowChart-D3E_xBJv.js.map +1 -0
  21. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js → PkToolShowContactForm-Dio2FNkA.js} +2 -2
  22. package/dist/_chunks/{PkToolShowContactForm-BAM772bm.js.map → PkToolShowContactForm-Dio2FNkA.js.map} +1 -1
  23. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js → PkToolShowForm-w9HGhvCy.js} +3 -3
  24. package/dist/_chunks/{PkToolShowForm-DJcL0bgw.js.map → PkToolShowForm-w9HGhvCy.js.map} +1 -1
  25. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js → PkToolShowSources-DXFvFHOo.js} +2 -2
  26. package/dist/_chunks/{PkToolShowSources-GeWAMHYC.js.map → PkToolShowSources-DXFvFHOo.js.map} +1 -1
  27. package/dist/_chunks/chartFormat-B1T7y-16.js +27 -0
  28. package/dist/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  29. package/dist/_chunks/{excelNumberFormat-BhQjife9.js → excelNumberFormat-CcXF_wJK.js} +101 -88
  30. package/dist/_chunks/excelNumberFormat-CcXF_wJK.js.map +1 -0
  31. package/dist/_chunks/{utils-DMvy5QRR.js → utils-BBoaLDYF.js} +14 -14
  32. package/dist/_chunks/utils-BBoaLDYF.js.map +1 -0
  33. package/dist/ai-elements.es.js +178 -172
  34. package/dist/ai-elements.es.js.map +1 -1
  35. package/dist-vue/PkChatbot.js +1 -1
  36. package/dist-vue/PkChatbotEmptyState.js +1 -1
  37. package/dist-vue/PkChatbotInput.js +1 -1
  38. package/dist-vue/PkChatbotMessages.js +1 -1
  39. package/dist-vue/PkChatbotStepPayload.js +1 -1
  40. package/dist-vue/PkChatbotStepToolDetail.js +1 -1
  41. package/dist-vue/PkChatbotSteps.js +1 -1
  42. package/dist-vue/PkChatbotViewChat.js +1 -1
  43. package/dist-vue/PkChatbotViewConversations.js +1 -1
  44. package/dist-vue/_chunks/Chart-DsBNs5rS.js +87 -0
  45. package/dist-vue/_chunks/Chart-DsBNs5rS.js.map +1 -0
  46. package/dist-vue/_chunks/{PkChart-D-K7nc0g.js → PkChart-CrZqhEpp.js} +112 -74
  47. package/dist-vue/_chunks/PkChart-CrZqhEpp.js.map +1 -0
  48. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js → PkChatbot-CxkTubw8.js} +6 -6
  49. package/dist-vue/_chunks/{PkChatbot-DVQ-Bb7n.js.map → PkChatbot-CxkTubw8.js.map} +1 -1
  50. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js → PkChatbotEmptyState-CUoHkCgO.js} +2 -2
  51. package/dist-vue/_chunks/{PkChatbotEmptyState-OlgewA4_.js.map → PkChatbotEmptyState-CUoHkCgO.js.map} +1 -1
  52. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js → PkChatbotInput-CPf7wqiQ.js} +4 -4
  53. package/dist-vue/_chunks/{PkChatbotInput-D_I0Gf_u.js.map → PkChatbotInput-CPf7wqiQ.js.map} +1 -1
  54. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js → PkChatbotMessages-CLNu2dTm.js} +307 -307
  55. package/dist-vue/_chunks/{PkChatbotMessages-CAXnEfXK.js.map → PkChatbotMessages-CLNu2dTm.js.map} +1 -1
  56. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js → PkChatbotStepPayload-Cf7mJPjL.js} +2 -2
  57. package/dist-vue/_chunks/{PkChatbotStepPayload-EBri1L10.js.map → PkChatbotStepPayload-Cf7mJPjL.js.map} +1 -1
  58. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js → PkChatbotStepToolDetail-D6nwNnHv.js} +16 -16
  59. package/dist-vue/_chunks/{PkChatbotStepToolDetail-DiQEa0UV.js.map → PkChatbotStepToolDetail-D6nwNnHv.js.map} +1 -1
  60. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js → PkChatbotSteps-xkxdaX7O.js} +38 -38
  61. package/dist-vue/_chunks/{PkChatbotSteps-BgLnv2J1.js.map → PkChatbotSteps-xkxdaX7O.js.map} +1 -1
  62. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js → PkChatbotViewChat-BkkyjiFl.js} +22 -22
  63. package/dist-vue/_chunks/{PkChatbotViewChat-CmjD1IXf.js.map → PkChatbotViewChat-BkkyjiFl.js.map} +1 -1
  64. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js → PkChatbotViewConversations-hgqSO1hx.js} +2 -2
  65. package/dist-vue/_chunks/{PkChatbotViewConversations-CVZH5dXx.js.map → PkChatbotViewConversations-hgqSO1hx.js.map} +1 -1
  66. package/dist-vue/_chunks/{PkFilePreview-k5gEl3n8.js → PkFilePreview-CmsT6lSP.js} +701 -624
  67. package/dist-vue/_chunks/PkFilePreview-CmsT6lSP.js.map +1 -0
  68. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js → PkFilePreviewDialog-DIiTt9iK.js} +2 -2
  69. package/dist-vue/_chunks/{PkFilePreviewDialog-DUwZPErE.js.map → PkFilePreviewDialog-DIiTt9iK.js.map} +1 -1
  70. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js → PkImageEditorDialog-CE0Y5Pwr.js} +2 -2
  71. package/dist-vue/_chunks/{PkImageEditorDialog-DQPXePae.js.map → PkImageEditorDialog-CE0Y5Pwr.js.map} +1 -1
  72. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js → PkStreamingMarkdown-BBvCtDlO.js} +2 -2
  73. package/dist-vue/_chunks/{PkStreamingMarkdown-ZasabxE0.js.map → PkStreamingMarkdown-BBvCtDlO.js.map} +1 -1
  74. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js → PkToolChatFile-DVhunkPS.js} +3 -3
  75. package/dist-vue/_chunks/{PkToolChatFile-CD26Q2xp.js.map → PkToolChatFile-DVhunkPS.js.map} +1 -1
  76. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js → PkToolShowArtifact-DKOTsP9C.js} +2 -2
  77. package/dist-vue/_chunks/{PkToolShowArtifact-BhVd_ZQ8.js.map → PkToolShowArtifact-DKOTsP9C.js.map} +1 -1
  78. package/dist-vue/_chunks/PkToolShowChart-CNBUjDc7.js +133 -0
  79. package/dist-vue/_chunks/PkToolShowChart-CNBUjDc7.js.map +1 -0
  80. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js → PkToolShowContactForm-D1Ff15Zf.js} +2 -2
  81. package/dist-vue/_chunks/{PkToolShowContactForm-CackCDGD.js.map → PkToolShowContactForm-D1Ff15Zf.js.map} +1 -1
  82. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js → PkToolShowDiagram-CBwqjy6a.js} +2 -2
  83. package/dist-vue/_chunks/{PkToolShowDiagram-CABPsFi8.js.map → PkToolShowDiagram-CBwqjy6a.js.map} +1 -1
  84. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js → PkToolShowForm-D-rzzwJa.js} +3 -3
  85. package/dist-vue/_chunks/{PkToolShowForm-BStbk4Iu.js.map → PkToolShowForm-D-rzzwJa.js.map} +1 -1
  86. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js → PkToolShowImageGallery-Cre2zSGV.js} +2 -2
  87. package/dist-vue/_chunks/{PkToolShowImageGallery-BeeHsdTp.js.map → PkToolShowImageGallery-Cre2zSGV.js.map} +1 -1
  88. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js → PkToolShowProductList-D4FAfMS-.js} +2 -2
  89. package/dist-vue/_chunks/{PkToolShowProductList-BfUiap9U.js.map → PkToolShowProductList-D4FAfMS-.js.map} +1 -1
  90. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js → PkToolShowSources-BC6YJl-O.js} +2 -2
  91. package/dist-vue/_chunks/{PkToolShowSources-CgEkcyRg.js.map → PkToolShowSources-BC6YJl-O.js.map} +1 -1
  92. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js → PkToolShowVideo-CxN7z_cZ.js} +2 -2
  93. package/dist-vue/_chunks/{PkToolShowVideo-CqSRnDNC.js.map → PkToolShowVideo-CxN7z_cZ.js.map} +1 -1
  94. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js → PkToolShowWebPages-0Ux6n8G1.js} +2 -2
  95. package/dist-vue/_chunks/{PkToolShowWebPages-B-qIS8qY.js.map → PkToolShowWebPages-0Ux6n8G1.js.map} +1 -1
  96. package/dist-vue/_chunks/chartFormat-B1T7y-16.js +27 -0
  97. package/dist-vue/_chunks/chartFormat-B1T7y-16.js.map +1 -0
  98. package/dist-vue/_chunks/{excelNumberFormat-C1sCQrOz.js → excelNumberFormat-BxRi0Y3e.js} +101 -88
  99. package/dist-vue/_chunks/excelNumberFormat-BxRi0Y3e.js.map +1 -0
  100. package/dist-vue/_chunks/{utils-KBB6SDPn.js → utils-C9l078yb.js} +10 -10
  101. package/dist-vue/_chunks/utils-C9l078yb.js.map +1 -0
  102. package/dist-vue/composables.js +9 -3
  103. package/dist-vue/composables.js.map +1 -1
  104. package/dist-vue/index.js +42 -42
  105. package/dist-vue/index.js.map +1 -1
  106. package/dist-vue/locales.js +6 -0
  107. package/dist-vue/packages/components/src/chat/PkChart.d.ts +8 -0
  108. package/dist-vue/packages/components/src/chat/PkFileChart.d.ts +14 -0
  109. package/dist-vue/packages/components/src/chat/PkWordPreviewRuns.d.ts +4 -1
  110. package/dist-vue/packages/components/src/chat/useChatFilePreview.d.ts +240 -0
  111. package/dist-vue/packages/components/src/chat/utils.d.ts +6 -1
  112. package/dist-vue/packages/models/src/schema/Chart.d.ts +91 -0
  113. package/dist-vue/packages/models/src/schema/SpreadsheetPreview.d.ts +381 -0
  114. package/dist-vue/packages/models/src/schema/WordPreview.d.ts +304 -0
  115. package/dist-vue/style.css +1 -1
  116. package/package.json +1 -1
  117. package/dist/_chunks/PkChart-CbtMRGWc.js.map +0 -1
  118. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js +0 -1665
  119. package/dist/_chunks/PkFilePreview-DC4iX7Yc.js.map +0 -1
  120. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js +0 -224
  121. package/dist/_chunks/PkToolShowChart-DZWu3Yuo.js.map +0 -1
  122. package/dist/_chunks/excelNumberFormat-BhQjife9.js.map +0 -1
  123. package/dist/_chunks/utils-DMvy5QRR.js.map +0 -1
  124. package/dist-vue/_chunks/PkChart-D-K7nc0g.js.map +0 -1
  125. package/dist-vue/_chunks/PkFilePreview-k5gEl3n8.js.map +0 -1
  126. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js +0 -217
  127. package/dist-vue/_chunks/PkToolShowChart-BQXxaPIO.js.map +0 -1
  128. package/dist-vue/_chunks/excelNumberFormat-C1sCQrOz.js.map +0 -1
  129. package/dist-vue/_chunks/utils-KBB6SDPn.js.map +0 -1
@@ -1,19 +1,19 @@
1
1
  import { t as e } from "./rolldown-runtime-CGnMp29N.js";
2
2
  import { t } from "./PkEditorRadioButtons-Bw576DPQ.js";
3
- import { i as n, n as r, r as i } from "./excelNumberFormat-C1sCQrOz.js";
3
+ import { i as n, n as r, r as i } from "./excelNumberFormat-BxRi0Y3e.js";
4
4
  import { t as a } from "./VvButtonLocalized-C-vx25u4.js";
5
- import { B as o, G as s, J as c, K as l, U as u, W as d, X as f, Y as p, o as m, q as h } from "./utils-KBB6SDPn.js";
6
- import { r as g } from "./PkChatbotViewChat-CmjD1IXf.js";
7
- import { VvIcon as _ } from "@volverjs/ui-vue/components";
8
- import { Fragment as v, computed as y, createBlock as b, createCommentVNode as x, createElementBlock as S, createElementVNode as C, createTextVNode as w, createVNode as T, defineComponent as E, inject as ee, isMemoSame as D, mergeModels as O, nextTick as te, normalizeClass as k, normalizeStyle as A, onBeforeUnmount as ne, onMounted as re, onScopeDispose as j, openBlock as M, provide as ie, ref as N, renderList as P, shallowRef as F, toDisplayString as I, unref as L, useModel as R, useTemplateRef as ae, vModelText as oe, watch as z, withCtx as B, withDirectives as se, withKeys as ce, withModifiers as V } from "vue";
9
- import { useI18n as le } from "vue-i18n";
10
- import { useElementSize as ue, useEventListener as H } from "@vueuse/core";
5
+ import { G as o, J as s, K as c, V as l, W as u, X as d, Y as f, Z as p, o as m, q as h, s as g } from "./utils-C9l078yb.js";
6
+ import { r as ee } from "./PkChatbotViewChat-BkkyjiFl.js";
7
+ import { VvIcon as te } from "@volverjs/ui-vue/components";
8
+ import { Fragment as _, computed as v, createBlock as y, createCommentVNode as b, createElementBlock as x, createElementVNode as S, createTextVNode as C, createVNode as w, defineAsyncComponent as T, defineComponent as E, inject as D, isMemoSame as O, mergeModels as k, nextTick as ne, normalizeClass as A, normalizeStyle as j, onBeforeUnmount as re, onMounted as ie, onScopeDispose as M, openBlock as N, provide as ae, ref as P, renderList as F, shallowRef as oe, toDisplayString as I, unref as L, useModel as R, useTemplateRef as se, vModelText as z, watch as B, withCtx as ce, withDirectives as le, withKeys as ue, withModifiers as V } from "vue";
9
+ import { useI18n as de } from "vue-i18n";
10
+ import { useElementSize as fe, useEventListener as H } from "@vueuse/core";
11
11
  // ../../packages/composable/src/useSettledSelection.ts
12
- var de = "(hover: hover) and (pointer: fine)", U = "(hover: none) and (pointer: coarse)", fe = 400;
13
- function W() {
12
+ var pe = "(hover: hover) and (pointer: fine)", U = "(hover: none) and (pointer: coarse)", W = 400;
13
+ function me() {
14
14
  return typeof matchMedia == "function" && matchMedia(U).matches;
15
15
  }
16
- function pe(e) {
16
+ function he(e) {
17
17
  let t = document.getSelection();
18
18
  if (!t || t.rangeCount === 0) return;
19
19
  if (e.nodeType === Node.DOCUMENT_NODE) return t.getRangeAt(0).cloneRange();
@@ -33,13 +33,13 @@ function pe(e) {
33
33
  let r = n.getSelection?.();
34
34
  return r && r.rangeCount > 0 ? r.getRangeAt(0).cloneRange() : void 0;
35
35
  }
36
- function me({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2, touch: i = !1 }) {
37
- let a = F(), o, s = () => {
36
+ function ge({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2, touch: i = !1 }) {
37
+ let a = oe(), o, s = () => {
38
38
  clearTimeout(o), a.value = void 0;
39
39
  }, c = () => {
40
40
  let n = e();
41
41
  if (!n || !t()) return;
42
- let i = pe(n);
42
+ let i = he(n);
43
43
  if (!i || i.collapsed || i.toString().trim().length < r) return;
44
44
  let a = i.getBoundingClientRect();
45
45
  return {
@@ -47,12 +47,12 @@ function me({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2, t
47
47
  start: i.getClientRects()[0] ?? a,
48
48
  box: a
49
49
  };
50
- }, l = typeof document < "u" && typeof matchMedia == "function" && matchMedia(de).matches, u = i && typeof document < "u" && W(), d = u ? Math.max(n, fe) : n, f = () => {
50
+ }, l = typeof document < "u" && typeof matchMedia == "function" && matchMedia(pe).matches, u = i && typeof document < "u" && me(), d = u ? Math.max(n, W) : n, f = () => {
51
51
  s(), o = setTimeout(() => {
52
52
  a.value = c();
53
53
  }, d);
54
54
  };
55
- return (l || u) && (document.addEventListener("selectionchange", f), j(() => {
55
+ return (l || u) && (document.addEventListener("selectionchange", f), M(() => {
56
56
  clearTimeout(o), document.removeEventListener("selectionchange", f);
57
57
  })), {
58
58
  selection: a,
@@ -60,7 +60,7 @@ function me({ root: e, enabled: t = () => !0, delay: n = 150, minChars: r = 2, t
60
60
  };
61
61
  }
62
62
  // ../../packages/components/src/chat/selectionActionIcons.ts
63
- var he = {
63
+ var G = {
64
64
  sparkles: "ri:sparkling-line",
65
65
  magic: "ri:magic-line",
66
66
  idea: "ri:lightbulb-line",
@@ -187,27 +187,27 @@ var he = {
187
187
  music: "ri:music-2-line",
188
188
  video: "ri:video-line",
189
189
  microphone: "ri:mic-line"
190
- }, G = (e) => he[e ?? "sparkles"], ge = 2e3, _e = 1e3, K = 60, q = 1400, ve = 20, J = 100, ye = (e) => Number(e.slice(1)), be = (e) => {
191
- let t = [...new Set(e)].sort((e, t) => ye(e) - ye(t)), n = [];
190
+ }, K = (e) => G[e ?? "sparkles"], _e = 2e3, ve = 1e3, q = 60, ye = 1400, be = 20, xe = 100, Se = (e) => Number(e.slice(1)), Ce = (e) => {
191
+ let t = [...new Set(e)].sort((e, t) => Se(e) - Se(t)), n = [];
192
192
  for (let e of t) {
193
193
  let t = n[n.length - 1];
194
- t && ye(e) === ye(t.to) + 1 ? t.to = e : n.push({
194
+ t && Se(e) === Se(t.to) + 1 ? t.to = e : n.push({
195
195
  from: e,
196
196
  to: e
197
197
  });
198
198
  }
199
199
  return n.slice(0, 100);
200
- }, xe = (e, t) => {
200
+ }, we = (e, t) => {
201
201
  let n = [];
202
202
  if (!t) return n;
203
203
  for (let r = e.indexOf(t); r >= 0; r = e.indexOf(t, r + 1)) n.push(r);
204
204
  return n;
205
- }, Se = (e, t, n) => {
206
- let r = xe(e, e.slice(t, t + n));
205
+ }, Te = (e, t, n) => {
206
+ let r = we(e, e.slice(t, t + n));
207
207
  if (r.length < 2) return {};
208
208
  let i = t, a = t + n;
209
- for (let t = !0; a - i <= q; t = !t) {
210
- if (xe(e, e.slice(i, a)).length === 1) return { find: e.slice(i, a) };
209
+ for (let t = !0; a - i <= ye; t = !t) {
210
+ if (we(e, e.slice(i, a)).length === 1) return { find: e.slice(i, a) };
211
211
  if (t && i > 0) i = e.slice(0, i).replace(/\S*\s*$/, "").length;
212
212
  else if (a < e.length) {
213
213
  let t = e.slice(a).match(/^\s*\S*/)?.[0] ?? "";
@@ -218,23 +218,23 @@ var he = {
218
218
  index: r.indexOf(t) + 1 || 1,
219
219
  of: r.length
220
220
  } };
221
- }, Ce = (e) => (e.querySelectorAll("[data-quote-skip]").forEach((e) => e.remove()), e.querySelectorAll("[data-paragraph]").forEach((e) => e.append("\n")), e.textContent ?? ""), we = (e) => e.length > _e ? `${e.slice(0, _e / 2)} […] ${e.slice(-500)}` : e, Te = (e) => {
221
+ }, Ee = (e) => (e.querySelectorAll("[data-quote-skip]").forEach((e) => e.remove()), e.querySelectorAll("[data-paragraph]").forEach((e) => e.append("\n")), e.textContent ?? ""), De = (e) => e.length > ve ? `${e.slice(0, ve / 2)} […] ${e.slice(-500)}` : e, Oe = (e) => {
222
222
  let t = e.startContainer.getRootNode().getSelection?.() ?? document.getSelection();
223
223
  try {
224
224
  t?.setBaseAndExtent(e.startContainer, e.startOffset, e.endContainer, e.endOffset);
225
225
  } catch {}
226
- }, Ee = (e, t, n) => {
226
+ }, ke = (e, t, n) => {
227
227
  let r = t.commonAncestorContainer;
228
228
  if (!e.contains(r) || (r instanceof Element ? r : r.parentElement)?.closest("[data-quote-skip]")) return;
229
229
  let i = [...e.querySelectorAll("[data-paragraph]")].filter((e) => !e.closest(n) && t.intersectsNode(e));
230
230
  if (!i.length) return;
231
- let a = i.flatMap((e) => e.dataset.paragraph.split(" ")), o = Ce(t.cloneContents()), s = o.trim();
231
+ let a = i.flatMap((e) => e.dataset.paragraph.split(" ")), o = Ee(t.cloneContents()), s = o.trim();
232
232
  if (s.length < 2) return;
233
233
  let c = {
234
234
  format: "docx",
235
- runs: be(a),
235
+ runs: Ce(a),
236
236
  paragraphCount: new Set(a).size,
237
- quote: we(s),
237
+ quote: De(s),
238
238
  measure: () => {
239
239
  let e = t.getBoundingClientRect(), n = t.getClientRects()[0] ?? e;
240
240
  return {
@@ -245,22 +245,22 @@ var he = {
245
245
  bottom: e.bottom
246
246
  };
247
247
  },
248
- restore: () => Te(t)
248
+ restore: () => Oe(t)
249
249
  };
250
250
  if (i.length === 1) {
251
251
  let e = i[0], n = document.createRange();
252
252
  n.selectNodeContents(e);
253
- let r = Ce(n.cloneContents()).replace(/\n$/, ""), a = document.createRange();
253
+ let r = Ee(n.cloneContents()).replace(/\n$/, ""), a = document.createRange();
254
254
  a.setStart(e, 0), a.setEnd(t.startContainer, t.startOffset);
255
- let l = Ce(a.cloneContents()).length + (o.length - o.trimStart().length);
256
- c.before = r.slice(Math.max(0, l - K), l), c.after = r.slice(l + s.length, l + s.length + K), Object.assign(c, Se(r, l, s.length));
255
+ let l = Ee(a.cloneContents()).length + (o.length - o.trimStart().length);
256
+ c.before = r.slice(Math.max(0, l - q), l), c.after = r.slice(l + s.length, l + s.length + q), Object.assign(c, Te(r, l, s.length));
257
257
  }
258
258
  return c;
259
- }, De = (e) => {
259
+ }, J = (e) => {
260
260
  let t = "";
261
261
  for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
262
262
  return t;
263
- }, Oe = (e, t) => {
263
+ }, Ae = (e, t) => {
264
264
  let n = { ...t }, r = e.rows.flatMap((e) => e.cells.filter((e) => e.span).map((t) => ({
265
265
  r1: e.row,
266
266
  r2: e.row + t.span.rows - 1,
@@ -271,7 +271,7 @@ var he = {
271
271
  e = !1;
272
272
  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);
273
273
  }
274
- let i = `${De(n.c1)}${n.r1}`, a = `${De(n.c2)}${n.r2}`, o = (e.hiddenRows ?? []).filter((e) => e >= n.r1 && e <= n.r2).slice(0, J), s = e.columns.filter((e) => e.hidden && e.col >= n.c1 && e.col <= n.c2).map((e) => De(e.col)).slice(0, J), 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, ve).map((e) => String(e.value)).join("; ").slice(0, 500);
274
+ let i = `${J(n.c1)}${n.r1}`, a = `${J(n.c2)}${n.r2}`, o = (e.hiddenRows ?? []).filter((e) => e >= n.r1 && e <= n.r2).slice(0, xe), s = e.columns.filter((e) => e.hidden && e.col >= n.c1 && e.col <= n.c2).map((e) => J(e.col)).slice(0, xe), 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, be).map((e) => String(e.value)).join("; ").slice(0, 500);
275
275
  return {
276
276
  format: "xlsx",
277
277
  sheet: e.name,
@@ -281,12 +281,12 @@ var he = {
281
281
  ...s.length ? { hiddenColumns: s } : {},
282
282
  ...c ? { sample: c } : {}
283
283
  };
284
- }, ke = ["placeholder", "aria-label"], Y = ["disabled"], X = ["aria-label"], Z = { class: "pk-selection-actions__text" }, Ae = {
284
+ }, Y = ["placeholder", "aria-label"], X = ["disabled"], Z = ["aria-label"], Q = { class: "pk-selection-actions__text" }, je = {
285
285
  key: 0,
286
286
  class: "pk-selection-actions__text"
287
- }, je = ["onClick", "onTouchend"], Me = /* @__PURE__ */ E({
287
+ }, Me = ["onClick", "onTouchend"], Ne = /* @__PURE__ */ E({
288
288
  __name: "PkSelectionActions",
289
- props: /*@__PURE__*/ O({
289
+ props: /*@__PURE__*/ k({
290
290
  actions: {},
291
291
  anchor: {},
292
292
  strategy: {},
@@ -301,7 +301,7 @@ var he = {
301
301
  },
302
302
  askingModifiers: {}
303
303
  }),
304
- emits: /*@__PURE__*/ O([
304
+ emits: /*@__PURE__*/ k([
305
305
  "action",
306
306
  "ask",
307
307
  "note",
@@ -316,109 +316,142 @@ var he = {
316
316
  proofread: "ri:check-double-line",
317
317
  translate: "ri:translate-2",
318
318
  chart: "ri:bar-chart-2-line"
319
- }, r = e, i = t, a = R(e, "asking"), { t: s } = le({ useScope: "global" }), c = ae("barEl"), l = ae("inputEl"), { width: u, height: d } = ue(c, void 0, { box: "border-box" }), f = y(() => o({
319
+ }, r = e, i = t, a = R(e, "asking"), { t: o } = de({ useScope: "global" }), s = se("barEl"), c = se("inputEl"), { width: u, height: d } = fe(s, void 0, { box: "border-box" }), f = v(() => l({
320
320
  ...r.anchor,
321
321
  bar: {
322
322
  width: u.value,
323
323
  height: d.value
324
324
  },
325
325
  touch: r.touch
326
- })), p = N(), m = N(""), h = async (e, t) => {
326
+ })), p = P(), m = P(""), h = async (e, t) => {
327
327
  p.value = {
328
328
  id: e,
329
329
  placeholder: t
330
- }, m.value = "", a.value = !0, await te(), l.value?.focus();
330
+ }, m.value = "", a.value = !0, await ne(), c.value?.focus();
331
331
  }, g = () => {
332
332
  p.value = void 0, a.value = !1;
333
- }, b = () => h(void 0, s("selectionActions.askPlaceholder")), E = (e) => n[e.id] ?? G(e.icon), ee = (e) => {
333
+ }, ee = () => h(void 0, o("selectionActions.askPlaceholder")), y = (e) => n[e.id] ?? K(e.icon), T = (e) => {
334
334
  e.asks ? h(e.id, e.asks) : i("action", e.id);
335
- }, D = (e, t) => {
335
+ }, E = (e, t) => {
336
336
  let n = e.currentTarget, r = e.changedTouches[0], i = n.getRootNode(), a = r && i.elementFromPoint(r.clientX, r.clientY);
337
337
  a && n.contains(a) && t();
338
- }, O = () => {
338
+ }, D = () => {
339
339
  let e = m.value.trim();
340
340
  e && p.value && (p.value.id ? i("action", p.value.id, e) : i("ask", e), g());
341
- }, ne = (e) => {
341
+ }, O = (e) => {
342
342
  e.isComposing || (e.stopPropagation(), e.preventDefault(), p.value ? g() : i("close"));
343
343
  };
344
344
  return (t, n) => {
345
- let r = _;
346
- return M(), S("div", {
347
- class: k(["pk-selection-actions", {
345
+ let r = te;
346
+ return N(), x("div", {
347
+ class: A(["pk-selection-actions", {
348
348
  "pk-selection-actions--fixed": e.strategy === "fixed",
349
349
  "pk-selection-actions--asking": !!p.value
350
350
  }]),
351
- style: A({
351
+ style: j({
352
352
  top: `${f.value.top}px`,
353
353
  left: `${f.value.left}px`
354
354
  }),
355
- onKeydown: ce(ne, ["esc"])
356
- }, [p.value ? (M(), S("form", {
355
+ onKeydown: ue(O, ["esc"])
356
+ }, [p.value ? (N(), x("form", {
357
357
  key: 0,
358
358
  ref_key: "barEl",
359
- ref: c,
359
+ ref: s,
360
360
  class: "pk-selection-actions__menu pk-selection-actions__menu--field",
361
- onSubmit: V(O, ["prevent"])
362
- }, [se(C("input", {
361
+ onSubmit: V(D, ["prevent"])
362
+ }, [le(S("input", {
363
363
  ref_key: "inputEl",
364
- ref: l,
364
+ ref: c,
365
365
  "onUpdate:modelValue": n[0] ||= (e) => m.value = e,
366
366
  class: "pk-selection-actions__input",
367
367
  type: "text",
368
368
  maxlength: "500",
369
369
  placeholder: p.value.placeholder,
370
370
  "aria-label": p.value.placeholder
371
- }, null, 8, ke), [[oe, m.value]]), C("button", {
371
+ }, null, 8, Y), [[z, m.value]]), S("button", {
372
372
  type: "submit",
373
373
  class: "pk-selection-actions__button pk-selection-actions__button--send",
374
374
  disabled: !m.value.trim()
375
- }, I(L(s)("action.send")), 9, Y)], 544)) : (M(), S("div", {
375
+ }, I(L(o)("action.send")), 9, X)], 544)) : (N(), x("div", {
376
376
  key: 1,
377
377
  ref_key: "barEl",
378
- ref: c,
378
+ ref: s,
379
379
  class: "pk-selection-actions__menu",
380
380
  role: "toolbar",
381
381
  "aria-orientation": "vertical",
382
- "aria-label": L(s)("selectionActions.label"),
382
+ "aria-label": L(o)("selectionActions.label"),
383
383
  onTouchstart: n[7] ||= V(() => {}, ["prevent"])
384
- }, [e.note ? (M(), S(v, { key: 0 }, [C("p", Z, I(e.note), 1), e.noteAction ? (M(), S("button", {
384
+ }, [e.note ? (N(), x(_, { key: 0 }, [S("p", Q, I(e.note), 1), e.noteAction ? (N(), x("button", {
385
385
  key: 0,
386
386
  type: "button",
387
387
  class: "pk-selection-actions__button",
388
388
  onMousedown: n[1] ||= V(() => {}, ["prevent"]),
389
389
  onClick: n[2] ||= (e) => i("note"),
390
- onTouchend: n[3] ||= (e) => D(e, () => i("note"))
391
- }, [T(r, {
390
+ onTouchend: n[3] ||= (e) => E(e, () => i("note"))
391
+ }, [w(r, {
392
392
  name: "ri:arrow-right-line",
393
393
  class: "pk-selection-actions__icon"
394
- }), w(" " + I(e.noteAction), 1)], 32)) : x("", !0)], 64)) : (M(), S(v, { key: 1 }, [
395
- e.hint ? (M(), S("p", Ae, I(e.hint), 1)) : x("", !0),
396
- (M(!0), S(v, null, P(e.actions, (e) => (M(), S("button", {
394
+ }), C(" " + I(e.noteAction), 1)], 32)) : b("", !0)], 64)) : (N(), x(_, { key: 1 }, [
395
+ e.hint ? (N(), x("p", je, I(e.hint), 1)) : b("", !0),
396
+ (N(!0), x(_, null, F(e.actions, (e) => (N(), x("button", {
397
397
  key: e.id,
398
398
  type: "button",
399
399
  class: "pk-selection-actions__button",
400
400
  onMousedown: n[4] ||= V(() => {}, ["prevent"]),
401
- onClick: (t) => ee(e),
402
- onTouchend: (t) => D(t, () => ee(e))
403
- }, [T(r, {
404
- name: E(e),
401
+ onClick: (t) => T(e),
402
+ onTouchend: (t) => E(t, () => T(e))
403
+ }, [w(r, {
404
+ name: y(e),
405
405
  class: "pk-selection-actions__icon"
406
- }, null, 8, ["name"]), w(" " + I(e.label), 1)], 40, je))), 128)),
407
- n[8] ||= C("hr", { class: "pk-selection-actions__rule" }, null, -1),
408
- C("button", {
406
+ }, null, 8, ["name"]), C(" " + I(e.label), 1)], 40, Me))), 128)),
407
+ n[8] ||= S("hr", { class: "pk-selection-actions__rule" }, null, -1),
408
+ S("button", {
409
409
  type: "button",
410
410
  class: "pk-selection-actions__button",
411
411
  onMousedown: n[5] ||= V(() => {}, ["prevent"]),
412
- onClick: b,
413
- onTouchend: n[6] ||= (e) => D(e, b)
414
- }, [T(r, {
412
+ onClick: ee,
413
+ onTouchend: n[6] ||= (e) => E(e, ee)
414
+ }, [w(r, {
415
415
  name: "ri:chat-1-line",
416
416
  class: "pk-selection-actions__icon"
417
- }), w(" " + I(L(s)("selectionActions.ask")), 1)], 32)
418
- ], 64))], 40, X))], 38);
417
+ }), C(" " + I(L(o)("selectionActions.ask")), 1)], 32)
418
+ ], 64))], 40, Z))], 38);
419
+ };
420
+ }
421
+ }), Pe = {
422
+ class: "pk-file-chart",
423
+ "data-quote-skip": ""
424
+ }, Fe = {
425
+ key: 1,
426
+ class: "pk-file-chart__placeholder"
427
+ }, Ie = { class: "pk-file-chart__title" }, Le = /* @__PURE__ */ E({
428
+ __name: "PkFileChart",
429
+ props: { preview: {} },
430
+ setup(e) {
431
+ let t = T(() => import("./PkChart-CrZqhEpp.js")), { t: n } = de({ useScope: "global" });
432
+ return (r, i) => {
433
+ let a = te;
434
+ return N(), x("div", Pe, [e.preview.chart ? (N(), y(L(t), {
435
+ key: 0,
436
+ chart: e.preview.chart,
437
+ colors: e.preview.colors,
438
+ legend: e.preview.legend,
439
+ paper: ""
440
+ }, null, 8, [
441
+ "chart",
442
+ "colors",
443
+ "legend"
444
+ ])) : (N(), x("div", Fe, [
445
+ w(a, {
446
+ name: "ri:bar-chart-2-line",
447
+ class: "text-16"
448
+ }),
449
+ S("span", Ie, I(e.preview.title || L(n)("chatFilePreview.chart")), 1),
450
+ S("span", null, I(L(n)("chatFilePreview.chartNotDrawn")), 1)
451
+ ]))]);
419
452
  };
420
453
  }
421
- }), Ne = { class: "pk-spreadsheet-preview" }, Pe = { class: "pk-spreadsheet-preview__bar" }, Fe = ["aria-label"], Ie = ["aria-label"], Le = ["aria-label"], Re = [
454
+ }), Re = { class: "pk-spreadsheet-preview" }, ze = { class: "pk-spreadsheet-preview__bar" }, Be = ["aria-label"], Ve = ["aria-label"], He = ["aria-label"], Ue = [
422
455
  "rowspan",
423
456
  "colspan",
424
457
  "data-focus",
@@ -426,18 +459,21 @@ var he = {
426
459
  "title",
427
460
  "onMousedown",
428
461
  "onMouseenter"
429
- ], ze = {
462
+ ], We = {
430
463
  key: 1,
464
+ class: "pk-spreadsheet-preview__charts"
465
+ }, Ge = {
466
+ key: 2,
431
467
  class: "pk-spreadsheet-preview__more"
432
- }, Be = ["aria-label"], Ve = ["aria-current", "onClick"], He = { class: "pk-spreadsheet-preview__status" }, Ue = { class: "pk-spreadsheet-preview__info" }, We = ["title"], Ge = ["title"], Ke = {
468
+ }, Ke = ["aria-label"], qe = ["aria-current", "onClick"], Je = { class: "pk-spreadsheet-preview__status" }, Ye = { class: "pk-spreadsheet-preview__info" }, Xe = ["title"], Ze = ["title"], Qe = {
433
469
  key: 2,
434
470
  class: "pk-spreadsheet-preview__stats"
435
- }, qe = {
471
+ }, $e = {
436
472
  key: 0,
437
473
  class: "pk-spreadsheet-preview__average"
438
- }, Je = { key: 1 }, Ye = { class: "pk-spreadsheet-preview__zoom" }, Xe = { class: "pk-spreadsheet-preview__percent" }, Ze = 64, Qe = 20, $e = 28, et = 44, tt = 400, nt = 10, rt = /* @__PURE__ */ E({
474
+ }, et = { key: 1 }, tt = { class: "pk-spreadsheet-preview__zoom" }, nt = { class: "pk-spreadsheet-preview__percent" }, rt = 64, it = 20, at = 28, ot = 44, st = 400, ct = 10, lt = /* @__PURE__ */ E({
439
475
  __name: "PkSpreadsheetPreview",
440
- props: /*@__PURE__*/ O({
476
+ props: /*@__PURE__*/ k({
441
477
  preview: {},
442
478
  marked: {}
443
479
  }, {
@@ -446,86 +482,109 @@ var he = {
446
482
  zoom: { default: 1 },
447
483
  zoomModifiers: {}
448
484
  }),
449
- emits: /*@__PURE__*/ O(["select"], ["update:sheet", "update:zoom"]),
485
+ emits: /*@__PURE__*/ k(["select"], ["update:sheet", "update:zoom"]),
450
486
  setup(e, { emit: t }) {
451
- let o = e, s = t, { t: c, locale: l } = le({ useScope: "global" }), u = R(e, "sheet"), d = R(e, "zoom"), f = ae("scrollEl"), { width: p, height: m } = ue(f, {
487
+ let o = e, s = t, { t: c, locale: l } = de({ useScope: "global" }), u = R(e, "sheet"), d = R(e, "zoom"), f = se("scrollEl"), { width: p, height: m } = fe(f, {
452
488
  width: 0,
453
489
  height: 0
454
- }, { box: "border-box" }), h = y(() => o.preview.sheets[u.value] ?? o.preview.sheets[0]);
455
- z(() => o.preview, () => {
490
+ }, { box: "border-box" }), h = v(() => o.preview.sheets[u.value] ?? o.preview.sheets[0]);
491
+ B(() => o.preview, () => {
456
492
  u.value = 0;
457
493
  });
458
- let _ = y(() => o.marked?.get(h.value?.name ?? "")), b = y(() => {
494
+ let g = v(() => o.marked?.get(h.value?.name ?? "")), te = v(() => {
459
495
  let e = /* @__PURE__ */ new Map();
460
- for (let t of _.value ?? []) {
496
+ for (let t of g.value ?? []) {
461
497
  let [n, r] = t.split(":"), i = e.get(Number(n));
462
498
  e.set(Number(n), i ? `${i},${r}` : r);
463
499
  }
464
500
  return e;
465
- }), E = (e, t) => !!_.value?.has(`${e}:${t}`);
466
- z(() => o.marked, (e) => {
467
- if (!e || _.value) return;
501
+ }), y = (e, t) => !!g.value?.has(`${e}:${t}`);
502
+ B(() => o.marked, (e) => {
503
+ if (!e || g.value) return;
468
504
  let t = o.preview.sheets.findIndex((t) => e.has(t.name));
469
505
  t >= 0 && (u.value = t);
470
506
  }, { immediate: !0 });
471
- let ee = () => g(f.value, ".pk-spreadsheet-preview__cell--marked");
472
- z(_, ee, { flush: "post" }), re(ee);
473
- let O = (e) => {
507
+ let T = () => ee(f.value, ".pk-spreadsheet-preview__cell--marked");
508
+ B(g, T, { flush: "post" }), ie(T);
509
+ let E = (e) => {
474
510
  let t = "";
475
511
  for (let n = e; n > 0; n = Math.floor((n - 1) / 26)) t = String.fromCharCode(65 + (n - 1) % 26) + t;
476
512
  return t;
477
- }, j = y(() => {
513
+ }, D = v(() => (h.value?.charts ?? []).reduce((e, t) => ({
514
+ col: Math.max(e.col, t.lastCol),
515
+ row: Math.max(e.row, t.lastRow)
516
+ }), {
517
+ col: 0,
518
+ row: 0
519
+ })), k = v(() => {
478
520
  let e = h.value;
479
521
  if (!e) return [];
480
- 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 = et, a = p.value / d.value;
481
- for (let o = 1; o <= e.lastColumn || !e.moreColumns && (o <= e.lastColumn + 2 || i < a); o++) {
522
+ 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 = ot, a = p.value / d.value;
523
+ for (let o = 1; o <= e.lastColumn || o <= D.value.col || !e.moreColumns && (o <= e.lastColumn + 2 || i < a); o++) {
482
524
  if (t.has(o)) continue;
483
- let e = n.get(o) ?? Ze;
525
+ let e = n.get(o) ?? rt;
484
526
  r.push({
485
527
  col: o,
486
528
  width: e
487
529
  }), i += e;
488
530
  }
489
531
  return r;
490
- }), ie = y(() => j.value.reduce((e, t) => e + t.width, et)), F = y(() => j.value.map((e) => `${e.col}:${e.width}`).join(",")), oe = /* @__PURE__ */ new WeakMap(), B = y(() => {
532
+ }), M = v(() => k.value.reduce((e, t) => e + t.width, ot)), ae = v(() => k.value.map((e) => `${e.col}:${e.width}`).join(",")), oe = /* @__PURE__ */ new WeakMap(), z = v(() => {
491
533
  let e = h.value;
492
534
  if (!e) return [];
493
- let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - $e) / Qe), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size), a = oe.get(e);
535
+ let t = new Set(e.hiddenRows ?? []), n = new Map(e.rows.map((e) => [e.row, e.height])), r = Math.ceil((m.value / d.value - at) / it), i = e.moreRows ? e.lastRow : Math.max(e.lastRow + 5, r + t.size, D.value.row), a = oe.get(e);
494
536
  a || (a = /* @__PURE__ */ new Map(), oe.set(e, a));
495
537
  let o = a;
496
538
  return Array.from({ length: i }, (e, t) => t + 1).filter((e) => !t.has(e)).map((e) => {
497
539
  let t = o.get(e);
498
540
  return t || (t = {
499
541
  row: e,
500
- height: n.get(e) ?? Qe
542
+ height: n.get(e) ?? it
501
543
  }, o.set(e, t)), t;
502
544
  });
503
- }), se = y(() => {
545
+ }), ce = v(() => {
546
+ let e = h.value?.charts ?? [];
547
+ if (!e.length) return [];
548
+ let t = d.value;
549
+ return e.map((e, n) => {
550
+ let r = k.value.reduce((t, n) => n.col < e.col ? t + n.width : t, ot + e.x), i = z.value.reduce((t, n) => n.row < e.row ? t + n.height : t, at + e.y);
551
+ return {
552
+ key: `${h.value?.name}:${n}`,
553
+ chart: e,
554
+ css: {
555
+ left: `${r * t}px`,
556
+ top: `${i * t}px`,
557
+ width: `${e.width * t}px`,
558
+ height: `${e.height * t}px`
559
+ }
560
+ };
561
+ });
562
+ }), le = v(() => {
504
563
  let e = /* @__PURE__ */ new Map();
505
564
  for (let t of h.value?.rows ?? []) for (let n of t.cells) e.set(`${t.row},${n.col}`, n);
506
565
  return e;
507
- }), ce = y(() => {
566
+ }), ue = v(() => {
508
567
  let e = /* @__PURE__ */ new Map();
509
568
  for (let t of h.value?.rows ?? []) for (let n of t.cells) if (n.span) for (let r = 0; r < n.span.rows; r++) for (let i = 0; i < n.span.cols; i++) (r || i) && e.set(`${t.row + r},${n.col + i}`, {
510
569
  row: t.row,
511
570
  col: n.col
512
571
  });
513
572
  return e;
514
- }), H = (e, t) => se.value.get(`${e},${t}`), de = (e, t) => {
573
+ }), H = (e, t) => le.value.get(`${e},${t}`), pe = (e, t) => {
515
574
  let n = H(e, t)?.span;
516
575
  if (n) return {
517
- rows: B.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
518
- cols: j.value.filter((e) => e.col >= t && e.col < t + n.cols).length
576
+ rows: z.value.filter((t) => t.row >= e && t.row < e + n.rows).length,
577
+ cols: k.value.filter((e) => e.col >= t && e.col < t + n.cols).length
519
578
  };
520
- }, U = (e) => e?.style === void 0 ? void 0 : o.preview.styles[e.style], fe = (e) => {
579
+ }, U = (e) => e?.style === void 0 ? void 0 : o.preview.styles[e.style], W = (e) => {
521
580
  let t = e.numFmt === void 0 ? void 0 : o.preview.numberFormats?.[e.numFmt], a = e.value;
522
581
  if (t !== void 0) try {
523
582
  return e.format === "date" ? e.serial === void 0 ? void 0 : r(t, e.serial, l.value, o.preview.date1904) : typeof a == "number" ? n(t) ? r(t, a, l.value, o.preview.date1904) : i(t, a, l.value) : void 0;
524
583
  } catch {
525
584
  return;
526
585
  }
527
- }, W = (e, t) => {
528
- let n = fe(e);
586
+ }, me = (e, t) => {
587
+ let n = W(e);
529
588
  if (n) return n.text;
530
589
  let r = e.decimals === void 0 ? { maximumFractionDigits: 10 } : {
531
590
  minimumFractionDigits: e.decimals,
@@ -540,18 +599,18 @@ var he = {
540
599
  currency: e.currency
541
600
  } : {}
542
601
  }).format(t);
543
- }, pe = (e) => {
602
+ }, he = (e) => {
544
603
  let t = /* @__PURE__ */ new Date(`${e}T00:00:00Z`);
545
604
  return Number.isNaN(t.getTime()) ? e : new Intl.DateTimeFormat(l.value, {
546
605
  dateStyle: "short",
547
606
  timeZone: "UTC"
548
607
  }).format(t);
549
- }, me = (e) => {
608
+ }, ge = (e) => {
550
609
  if (!e) return "";
551
610
  if (e.missing) return "—";
552
611
  let t = e.value;
553
- return t === void 0 ? "" : typeof t == "boolean" ? c(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? fe(e)?.text ?? pe(t) : typeof t == "number" ? W(e, t) : t;
554
- }, he = (e) => {
612
+ return t === void 0 ? "" : typeof t == "boolean" ? c(t ? "chatFilePreview.true" : "chatFilePreview.false") : e.format === "date" && typeof t == "string" ? W(e)?.text ?? he(t) : typeof t == "number" ? me(e, t) : t;
613
+ }, G = (e) => {
555
614
  if (!e) return "";
556
615
  if (e.formula) return `=${e.formula}`;
557
616
  let t = e.value;
@@ -559,8 +618,8 @@ var he = {
559
618
  useGrouping: !1,
560
619
  maximumFractionDigits: 15,
561
620
  ...e.format === "percent" ? { style: "percent" } : {}
562
- }).format(t) : me(e);
563
- }, G = (e) => e ? `${e.width}px solid ${e.color}` : void 0, ge = (e, t, n) => {
621
+ }).format(t) : ge(e);
622
+ }, K = (e) => e ? `${e.width}px solid ${e.color}` : void 0, _e = (e, t, n) => {
564
623
  let r = U(e), i = e?.value, a = typeof i == "number" || e?.format === "date" || !!e?.missing, o = {
565
624
  textAlign: r?.align ?? (a ? "right" : typeof i == "boolean" || e?.format === "error" ? "center" : "left"),
566
625
  verticalAlign: r?.valign === "top" ? "top" : r?.valign === "middle" ? "middle" : "bottom",
@@ -569,33 +628,33 @@ var he = {
569
628
  r?.bold && (o.fontWeight = 700), r?.italic && (o.fontStyle = "italic");
570
629
  let s = [r?.underline ? "underline" : "", r?.strike ? "line-through" : ""].filter(Boolean).join(" ");
571
630
  s && (o.textDecoration = s), r?.size && (o.fontSize = `${r.size}pt`);
572
- let c = e ? fe(e)?.color : void 0;
631
+ let c = e ? W(e)?.color : void 0;
573
632
  if ((c ?? r?.color) && (o.color = c ?? r?.color), r?.fill && (o.backgroundColor = r.fill), r?.indent) {
574
633
  let e = `${4 + r.indent * 9}px`;
575
634
  o.textAlign === "right" ? o.paddingRight = e : o.paddingLeft = e;
576
635
  }
577
- let l = rt(t, n);
578
- return _e(t, n) ? (o.borderStyle = "hidden", o.boxShadow = [...l, we(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, ...ve(e, t, n)].join(", ")), Object.assign(o, ke(t, n)), o;
579
- }, _e = (e, t) => {
636
+ let l = Pe(t, n);
637
+ return ve(t, n) ? (o.borderStyle = "hidden", o.boxShadow = [...l, De(e, t, n)].filter(Boolean).join(", ")) : (o.borderTop = K(r?.borders?.top), o.borderRight = K(r?.borders?.right), o.borderBottom = K(r?.borders?.bottom), o.borderLeft = K(r?.borders?.left), o.boxShadow = [...l, ...be(e, t, n)].join(", ")), Object.assign(o, Y(t, n)), o;
638
+ }, ve = (e, t) => {
580
639
  let n = h.value?.frozen;
581
640
  return !!n && (e <= n.rows || t <= n.cols);
582
- }, K = {
641
+ }, q = {
583
642
  top: (e) => `inset 0 ${e.width}px 0 ${e.color}`,
584
643
  right: (e) => `inset -${e.width}px 0 0 ${e.color}`,
585
644
  bottom: (e) => `inset 0 -${e.width}px 0 ${e.color}`,
586
645
  left: (e) => `inset ${e.width}px 0 0 ${e.color}`
587
- }, q = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), ve = (e, t, n) => {
646
+ }, ye = (...e) => e.reduce((e, t) => t && (!e || t.width > e.width) ? t : e, void 0), be = (e, t, n) => {
588
647
  let r = U(e)?.borders;
589
- return [t === B.value[0]?.row && r?.top && K.top(r.top), n === j.value[0]?.col && r?.left && K.left(r.left)].filter((e) => !!e);
590
- }, J = y(() => B.value.map((e) => e.row)), ye = y(() => j.value.map((e) => e.col)), be = y(() => new Map(J.value.map((e, t) => [e, t]))), xe = y(() => new Map(ye.value.map((e, t) => [e, t]))), Se = (e, t, n, r) => {
648
+ return [t === z.value[0]?.row && r?.top && q.top(r.top), n === k.value[0]?.col && r?.left && q.left(r.left)].filter((e) => !!e);
649
+ }, xe = v(() => z.value.map((e) => e.row)), Se = v(() => k.value.map((e) => e.col)), Ce = v(() => new Map(xe.value.map((e, t) => [e, t]))), we = v(() => new Map(Se.value.map((e, t) => [e, t]))), Te = (e, t, n, r) => {
591
650
  let i = [], a = t.get(n) ?? e.length;
592
651
  for (; a < e.length && e[a] < n + r; a++) i.push(e[a]);
593
652
  return {
594
653
  spanned: i,
595
654
  next: e[a]
596
655
  };
597
- }, Ce = (e, t, n, r) => {
598
- let { spanned: i, next: a } = Se(J.value, be.value, t, e?.span?.rows ?? 1), { spanned: o, next: s } = Se(ye.value, xe.value, n, e?.span?.cols ?? 1);
656
+ }, Ee = (e, t, n, r) => {
657
+ let { spanned: i, next: a } = Te(xe.value, Ce.value, t, e?.span?.rows ?? 1), { spanned: o, next: s } = Te(Se.value, we.value, n, e?.span?.cols ?? 1);
599
658
  return (r === "right" ? s === void 0 ? [] : i.map((e) => ({
600
659
  row: e,
601
660
  col: s
@@ -603,51 +662,51 @@ var he = {
603
662
  row: a,
604
663
  col: e
605
664
  }))).map((e) => {
606
- let t = ce.value.get(`${e.row},${e.col}`) ?? e;
665
+ let t = ue.value.get(`${e.row},${e.col}`) ?? e;
607
666
  return H(t.row, t.col);
608
667
  });
609
- }, we = (e, t, n) => {
610
- let r = U(e)?.borders, i = q(r?.right, ...Ce(e, t, n, "right").map((e) => U(e)?.borders?.left)), a = q(r?.bottom, ...Ce(e, t, n, "bottom").map((e) => U(e)?.borders?.top)), o = h.value?.gridlines;
668
+ }, De = (e, t, n) => {
669
+ let r = U(e)?.borders, i = ye(r?.right, ...Ee(e, t, n, "right").map((e) => U(e)?.borders?.left)), a = ye(r?.bottom, ...Ee(e, t, n, "bottom").map((e) => U(e)?.borders?.top)), o = h.value?.gridlines;
611
670
  return [
612
- i ? K.right(i) : o && "inset calc(var(--border) * -1) 0 0 var(--pk-spreadsheet-gridline)",
613
- a ? K.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
614
- ...ve(e, t, n)
671
+ i ? q.right(i) : o && "inset calc(var(--border) * -1) 0 0 var(--pk-spreadsheet-gridline)",
672
+ a ? q.bottom(a) : o && "inset 0 calc(var(--border) * -1) 0 var(--pk-spreadsheet-gridline)",
673
+ ...be(e, t, n)
615
674
  ].filter(Boolean).join(", ");
616
- }, Te = (e) => $e + B.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), Ee = (e) => et + j.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), De = y(() => {
675
+ }, Oe = (e) => at + z.value.filter((t) => t.row < e).reduce((e, t) => e + t.height, 0), ke = (e) => ot + k.value.filter((t) => t.col < e).reduce((e, t) => e + t.width, 0), J = v(() => {
617
676
  let e = h.value?.frozen;
618
677
  return {
619
- top: Te((e?.rows ?? 0) + 1),
620
- left: Ee((e?.cols ?? 0) + 1)
678
+ top: Oe((e?.rows ?? 0) + 1),
679
+ left: ke((e?.cols ?? 0) + 1)
621
680
  };
622
- }), ke = (e, t) => {
681
+ }), Y = (e, t) => {
623
682
  let n = h.value?.frozen;
624
683
  if (!n) return {};
625
684
  let r = {};
626
- return e <= n.rows && (r.position = "sticky", r.top = `${Te(e)}px`, r.scrollMarginTop = r.top, r.zIndex = 0), t <= n.cols && (r.position = "sticky", r.left = `${Ee(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
627
- }, Y = N({
685
+ 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 = `${ke(t)}px`, r.scrollMarginLeft = r.left, r.zIndex = +(e <= n.rows)), r;
686
+ }, X = P({
628
687
  row: 1,
629
688
  col: 1
630
- }), X = N({
689
+ }), Z = P({
631
690
  row: 1,
632
691
  col: 1
633
692
  });
634
- z(h, () => {
635
- Y.value = {
693
+ B(h, () => {
694
+ X.value = {
636
695
  row: 1,
637
696
  col: 1
638
- }, X.value = {
697
+ }, Z.value = {
639
698
  row: 1,
640
699
  col: 1
641
700
  };
642
701
  });
643
- let Z = y(() => ({
644
- r1: Math.min(Y.value.row, X.value.row),
645
- r2: Math.max(Y.value.row, X.value.row),
646
- c1: Math.min(Y.value.col, X.value.col),
647
- c2: Math.max(Y.value.col, X.value.col)
648
- })), Ae = (e, t) => e >= Z.value.r1 && e <= Z.value.r2 && t >= Z.value.c1 && t <= Z.value.c2, je = (e, t) => X.value.row === e && X.value.col === t, Me = (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" : ""}` : "", rt = (e, t) => {
649
- let { r1: n, r2: r, c1: i, c2: a } = Z.value;
650
- if (n === r && i === a || !Ae(e, t)) return [];
702
+ let Q = v(() => ({
703
+ r1: Math.min(X.value.row, Z.value.row),
704
+ r2: Math.max(X.value.row, Z.value.row),
705
+ c1: Math.min(X.value.col, Z.value.col),
706
+ c2: Math.max(X.value.col, Z.value.col)
707
+ })), je = (e, t) => e >= Q.value.r1 && e <= Q.value.r2 && t >= Q.value.c1 && t <= Q.value.c2, Me = (e, t) => Z.value.row === e && Z.value.col === t, Ne = (e) => e >= Q.value.r1 && e <= Q.value.r2 ? `${Q.value.c1}:${Q.value.c2}:${Z.value.row === e ? Z.value.col : 0}:${e === Q.value.r1 ? "t" : ""}${e === Q.value.r2 ? "b" : ""}` : "", Pe = (e, t) => {
708
+ let { r1: n, r2: r, c1: i, c2: a } = Q.value;
709
+ if (n === r && i === a || !je(e, t)) return [];
651
710
  let o = H(e, t)?.span, s = e + (o?.rows ?? 1) - 1, c = t + (o?.cols ?? 1) - 1, l = "var(--spacing-2)", u = "var(--pk-spreadsheet-green)";
652
711
  return [
653
712
  e === n && `inset 0 ${l} 0 ${u}`,
@@ -655,20 +714,20 @@ var he = {
655
714
  t === i && `inset ${l} 0 0 ${u}`,
656
715
  c >= a && `inset calc(${l} * -1) 0 0 ${u}`
657
716
  ].filter((e) => !!e);
658
- }, it = N(!1), at = (e, t, n) => {
659
- f.value?.focus({ preventScroll: !0 }), X.value = {
717
+ }, Fe = P(!1), Ie = (e, t, n) => {
718
+ f.value?.focus({ preventScroll: !0 }), Z.value = {
660
719
  row: e,
661
720
  col: t
662
- }, n.shiftKey || (Y.value = {
721
+ }, n.shiftKey || (X.value = {
663
722
  row: e,
664
723
  col: t
665
- }), it.value = !0;
666
- }, ot = (e, t) => {
667
- it.value && (X.value = {
724
+ }), Fe.value = !0;
725
+ }, lt = (e, t) => {
726
+ Fe.value && (Z.value = {
668
727
  row: e,
669
728
  col: t
670
729
  });
671
- }, st, ct = () => {
730
+ }, ut, dt = () => {
672
731
  let e = [...f.value?.querySelectorAll(".pk-spreadsheet-preview__cell--range, [data-focus]") ?? []].map((e) => e.getBoundingClientRect());
673
732
  if (e.length) return {
674
733
  start: {
@@ -677,80 +736,80 @@ var he = {
677
736
  },
678
737
  bottom: Math.max(...e.map((e) => e.bottom))
679
738
  };
680
- }, lt = () => h.value ? {
681
- ...Oe(h.value, Z.value),
682
- measure: ct
739
+ }, ft = () => h.value ? {
740
+ ...Ae(h.value, Q.value),
741
+ measure: dt
683
742
  } : void 0;
684
- z([Z, it], () => {
685
- clearTimeout(st), !it.value && (st = setTimeout(() => {
686
- let e = Z.value, t = e.r2 > e.r1 || e.c2 > e.c1;
687
- s("select", t ? lt() : void 0);
743
+ B([Q, Fe], () => {
744
+ clearTimeout(ut), !Fe.value && (ut = setTimeout(() => {
745
+ let e = Q.value, t = e.r2 > e.r1 || e.c2 > e.c1;
746
+ s("select", t ? ft() : void 0);
688
747
  }, 150));
689
748
  });
690
- let ut = () => {
691
- clearTimeout(st), s("select", lt());
692
- }, Q, dt;
693
- z(h, () => {
694
- dt = void 0;
749
+ let pt = () => {
750
+ clearTimeout(ut), s("select", ft());
751
+ }, $, mt;
752
+ B(h, () => {
753
+ mt = void 0;
695
754
  });
696
- let ft = (e) => {
755
+ let ht = (e) => {
697
756
  let [t, n] = ((e?.closest?.("[data-cell]"))?.dataset.cell ?? "").split(":").map(Number);
698
757
  return t && n ? {
699
758
  row: t,
700
759
  col: n
701
760
  } : void 0;
702
- }, $ = () => {
703
- clearTimeout(Q?.timer), Q?.active && (it.value = !1), Q = void 0;
761
+ }, gt = () => {
762
+ clearTimeout($?.timer), $?.active && (Fe.value = !1), $ = void 0;
704
763
  };
705
- ne(() => {
706
- $(), clearTimeout(st);
764
+ re(() => {
765
+ gt(), clearTimeout(ut);
707
766
  });
708
- let pt = () => void te(ut), mt = (e) => {
709
- $();
710
- let t = e.touches[0], n = e.touches.length === 1 ? ft(e.target) : void 0;
711
- t && n && (Q = {
767
+ let _t = () => void ne(pt), vt = (e) => {
768
+ gt();
769
+ let t = e.touches[0], n = e.touches.length === 1 ? ht(e.target) : void 0;
770
+ t && n && ($ = {
712
771
  ...n,
713
772
  x: t.clientX,
714
773
  y: t.clientY,
715
774
  active: !1,
716
775
  timer: setTimeout(() => {
717
- Q && (Q.active = !0, f.value?.focus({ preventScroll: !0 }), Y.value = {
718
- row: Q.row,
719
- col: Q.col
720
- }, X.value = {
721
- row: Q.row,
722
- col: Q.col
723
- }, it.value = !0);
724
- }, tt)
776
+ $ && ($.active = !0, f.value?.focus({ preventScroll: !0 }), X.value = {
777
+ row: $.row,
778
+ col: $.col
779
+ }, Z.value = {
780
+ row: $.row,
781
+ col: $.col
782
+ }, Fe.value = !0);
783
+ }, st)
725
784
  });
726
- }, ht = (e) => {
785
+ }, yt = (e) => {
727
786
  let t = e.touches[0];
728
- if (!Q || !t) return;
729
- if (!Q.active) {
730
- (!e.cancelable || Math.hypot(t.clientX - Q.x, t.clientY - Q.y) > nt) && $();
787
+ if (!$ || !t) return;
788
+ if (!$.active) {
789
+ (!e.cancelable || Math.hypot(t.clientX - $.x, t.clientY - $.y) > ct) && gt();
731
790
  return;
732
791
  }
733
792
  e.preventDefault();
734
- let n = f.value?.getRootNode(), r = ft(n?.elementFromPoint(t.clientX, t.clientY) ?? null);
735
- r && (X.value = r);
736
- }, gt = (e) => {
737
- if (!Q) return;
738
- let { row: t, col: n, active: r } = Q;
739
- $(), e.preventDefault();
740
- let i = Z.value, a = i.r1 === i.r2 && i.c1 === i.c2;
793
+ let n = f.value?.getRootNode(), r = ht(n?.elementFromPoint(t.clientX, t.clientY) ?? null);
794
+ r && (Z.value = r);
795
+ }, bt = (e) => {
796
+ if (!$) return;
797
+ let { row: t, col: n, active: r } = $;
798
+ gt(), e.preventDefault();
799
+ let i = Q.value, a = i.r1 === i.r2 && i.c1 === i.c2;
741
800
  if (r) {
742
- a && pt();
801
+ a && _t();
743
802
  return;
744
803
  }
745
- let o = a && je(t, n) && dt === `${t}:${n}`;
746
- dt = `${t}:${n}`, f.value?.focus({ preventScroll: !0 }), Y.value = {
804
+ let o = a && Me(t, n) && mt === `${t}:${n}`;
805
+ mt = `${t}:${n}`, f.value?.focus({ preventScroll: !0 }), X.value = {
747
806
  row: t,
748
807
  col: n
749
- }, X.value = {
808
+ }, Z.value = {
750
809
  row: t,
751
810
  col: n
752
- }, o && pt();
753
- }, _t = (e) => {
811
+ }, o && _t();
812
+ }, xt = (e) => {
754
813
  let t = {
755
814
  ArrowUp: [-1, 0],
756
815
  ArrowDown: [1, 0],
@@ -761,7 +820,7 @@ var he = {
761
820
  }[e.key];
762
821
  if (!t) return;
763
822
  e.preventDefault();
764
- let n = B.value.map((e) => e.row), r = j.value.map((e) => e.col), i = (e) => ce.value.get(`${e.row},${e.col}`) ?? e, a = i(X.value), o = n.indexOf(X.value.row), s = r.indexOf(X.value.col), c = a;
823
+ let n = z.value.map((e) => e.row), r = k.value.map((e) => e.col), i = (e) => ue.value.get(`${e.row},${e.col}`) ?? e, a = i(Z.value), o = n.indexOf(Z.value.row), s = r.indexOf(Z.value.col), c = a;
765
824
  for (;;) {
766
825
  let e = Math.min(n.length - 1, Math.max(0, o + t[0])), l = Math.min(r.length - 1, Math.max(0, s + t[1]));
767
826
  if (e === o && l === s || (o = e, s = l, c = i({
@@ -769,12 +828,12 @@ var he = {
769
828
  col: r[s]
770
829
  }), c.row !== a.row || c.col !== a.col)) break;
771
830
  }
772
- X.value = c, e.shiftKey || (Y.value = c), te(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
831
+ Z.value = c, e.shiftKey || (X.value = c), ne(() => f.value?.querySelector("[data-focus]")?.scrollIntoView({
773
832
  block: "nearest",
774
833
  inline: "nearest"
775
834
  }));
776
- }, vt = y(() => H(X.value.row, X.value.col)), yt = y(() => {
777
- let { r1: e, r2: t, c1: n, c2: r } = Z.value;
835
+ }, St = v(() => H(Z.value.row, Z.value.col)), Ct = v(() => {
836
+ let { r1: e, r2: t, c1: n, c2: r } = Q.value;
778
837
  if (e === t && n === r) return;
779
838
  let i = 0, a = 0, o = 0, s;
780
839
  for (let c = e; c <= t; c++) for (let e = n; e <= r; e++) {
@@ -783,154 +842,162 @@ var he = {
783
842
  }
784
843
  if (i) return {
785
844
  count: i,
786
- sum: s ? W(s, a) : void 0,
787
- average: s ? W(s, a / o) : void 0
845
+ sum: s ? me(s, a) : void 0,
846
+ average: s ? me(s, a / o) : void 0
788
847
  };
789
- }), bt = (e) => {
848
+ }), wt = (e) => {
790
849
  d.value = Math.min(2, Math.max(.5, Math.round((d.value + e) * 10) / 10));
791
850
  };
792
851
  return (t, n) => {
793
852
  let r = a;
794
- return M(), S("div", Ne, [
795
- C("div", Pe, [
796
- C("span", {
853
+ return N(), x("div", Re, [
854
+ S("div", ze, [
855
+ S("span", {
797
856
  class: "pk-spreadsheet-preview__ref",
798
857
  "aria-label": L(c)("chatFilePreview.cell")
799
- }, I(O(X.value.col)) + I(X.value.row), 9, Fe),
800
- n[6] ||= C("span", {
858
+ }, I(E(Z.value.col)) + I(Z.value.row), 9, Be),
859
+ n[6] ||= S("span", {
801
860
  class: "pk-spreadsheet-preview__fx",
802
861
  "aria-hidden": "true"
803
862
  }, "fx", -1),
804
- C("output", {
863
+ S("output", {
805
864
  class: "pk-spreadsheet-preview__formula",
806
865
  "aria-label": L(c)("chatFilePreview.formulaBar")
807
- }, I(he(vt.value)), 9, Ie)
866
+ }, I(G(St.value)), 9, Ve)
808
867
  ]),
809
- C("div", {
868
+ S("div", {
810
869
  ref_key: "scrollEl",
811
870
  ref: f,
812
871
  class: "pk-spreadsheet-preview__scroll",
813
872
  tabindex: "0",
814
873
  role: "grid",
815
874
  "aria-label": h.value?.name,
816
- onKeydown: _t,
817
- onMouseup: n[2] ||= (e) => it.value = !1,
818
- onMouseleave: n[3] ||= (e) => it.value = !1,
819
- onTouchstart: mt,
820
- onTouchmove: ht,
821
- onTouchend: gt,
822
- onTouchcancel: $
823
- }, [h.value ? (M(), S("table", {
824
- key: 0,
825
- class: k(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": h.value.gridlines }]),
826
- style: A({
827
- zoom: d.value,
828
- width: `${ie.value}px`,
829
- "--pk-spreadsheet-stuck-top": `${De.value.top}px`,
830
- "--pk-spreadsheet-stuck-left": `${De.value.left}px`
831
- })
875
+ onKeydown: xt,
876
+ onMouseup: n[2] ||= (e) => Fe.value = !1,
877
+ onMouseleave: n[3] ||= (e) => Fe.value = !1,
878
+ onTouchstart: vt,
879
+ onTouchmove: yt,
880
+ onTouchend: bt,
881
+ onTouchcancel: gt
832
882
  }, [
833
- C("colgroup", null, [C("col", { style: A({ width: `${et}px` }) }, null, 4), (M(!0), S(v, null, P(j.value, (e) => (M(), S("col", {
834
- key: e.col,
835
- style: A({ width: `${e.width}px` })
836
- }, null, 4))), 128))]),
837
- C("thead", null, [C("tr", { style: A({ height: `${$e}px` }) }, [n[7] ||= C("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (M(!0), S(v, null, P(j.value, (e) => (M(), S("th", {
838
- key: e.col,
839
- scope: "col",
840
- class: k(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Z.value.c1 && e.col <= Z.value.c2 }]),
841
- style: A(h.value.frozen && e.col <= h.value.frozen.cols ? {
842
- left: `${Ee(e.col)}px`,
843
- zIndex: 2
844
- } : void 0)
845
- }, I(O(e.col)), 7))), 128))], 4)]),
846
- C("tbody", null, [(M(!0), S(v, null, P(B.value, (e, t, n, r) => {
847
- let i = [
848
- e,
849
- h.value,
850
- F.value,
851
- L(l),
852
- Me(e.row),
853
- b.value.get(e.row)
854
- ];
855
- if (r && r.el && r.key === e.row && D(r, i)) return r;
856
- let a = (M(), S("tr", {
857
- key: e.row,
858
- style: A({ height: `${e.height}px` })
859
- }, [C("th", {
860
- scope: "row",
861
- class: k(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Z.value.r1 && e.row <= Z.value.r2 }]),
862
- style: A(h.value.frozen && e.row <= h.value.frozen.rows ? {
863
- ...ke(e.row, 0),
864
- left: 0,
865
- zIndex: 4
883
+ h.value ? (N(), x("table", {
884
+ key: 0,
885
+ class: A(["pk-spreadsheet-preview__grid", { "pk-spreadsheet-preview__grid--lines": h.value.gridlines }]),
886
+ style: j({
887
+ zoom: d.value,
888
+ width: `${M.value}px`,
889
+ "--pk-spreadsheet-stuck-top": `${J.value.top}px`,
890
+ "--pk-spreadsheet-stuck-left": `${J.value.left}px`
891
+ })
892
+ }, [
893
+ S("colgroup", null, [S("col", { style: j({ width: `${ot}px` }) }, null, 4), (N(!0), x(_, null, F(k.value, (e) => (N(), x("col", {
894
+ key: e.col,
895
+ style: j({ width: `${e.width}px` })
896
+ }, null, 4))), 128))]),
897
+ S("thead", null, [S("tr", { style: j({ height: `${at}px` }) }, [n[7] ||= S("th", { class: "pk-spreadsheet-preview__corner" }, null, -1), (N(!0), x(_, null, F(k.value, (e) => (N(), x("th", {
898
+ key: e.col,
899
+ scope: "col",
900
+ class: A(["pk-spreadsheet-preview__head", { "pk-spreadsheet-preview__head--current": e.col >= Q.value.c1 && e.col <= Q.value.c2 }]),
901
+ style: j(h.value.frozen && e.col <= h.value.frozen.cols ? {
902
+ left: `${ke(e.col)}px`,
903
+ zIndex: 2
866
904
  } : void 0)
867
- }, I(e.row), 7), (M(!0), S(v, null, P(j.value, (t) => (M(), S(v, { key: t.col }, [ce.value.has(`${e.row},${t.col}`) ? x("", !0) : (M(), S("td", {
868
- key: 0,
869
- rowspan: de(e.row, t.col)?.rows,
870
- colspan: de(e.row, t.col)?.cols,
871
- class: k(["pk-spreadsheet-preview__cell", {
872
- "pk-spreadsheet-preview__cell--range": Ae(e.row, t.col) && !je(e.row, t.col),
873
- "pk-spreadsheet-preview__cell--missing": H(e.row, t.col)?.missing,
874
- "pk-spreadsheet-preview__cell--marked": E(e.row, t.col)
875
- }]),
876
- style: A(ge(H(e.row, t.col), e.row, t.col)),
877
- "data-focus": je(e.row, t.col) ? "" : void 0,
878
- "data-cell": `${e.row}:${t.col}`,
879
- title: H(e.row, t.col)?.missing ? L(c)("chatFilePreview.missingValue") : void 0,
880
- onMousedown: V((n) => at(e.row, t.col, n), ["prevent"]),
881
- onMouseenter: (n) => ot(e.row, t.col),
882
- onDblclick: ut
883
- }, I(me(H(e.row, t.col))), 47, Re))], 64))), 128))], 4));
884
- return a.memo = i, a;
885
- }, n, 0), 128))])
886
- ], 6)) : x("", !0), h.value && (h.value.moreRows || h.value.moreColumns) ? (M(), S("p", ze, [h.value.moreRows ? (M(), S(v, { key: 0 }, [w(I(L(c)("chatFilePreview.moreRows", h.value.moreRows)), 1)], 64)) : x("", !0), h.value.moreColumns ? (M(), S(v, { key: 1 }, [w(I(L(c)("chatFilePreview.moreColumns", h.value.moreColumns)), 1)], 64)) : x("", !0)])) : x("", !0)], 40, Le),
887
- C("nav", {
905
+ }, I(E(e.col)), 7))), 128))], 4)]),
906
+ S("tbody", null, [(N(!0), x(_, null, F(z.value, (e, t, n, r) => {
907
+ let i = [
908
+ e,
909
+ h.value,
910
+ ae.value,
911
+ L(l),
912
+ Ne(e.row),
913
+ te.value.get(e.row)
914
+ ];
915
+ if (r && r.el && r.key === e.row && O(r, i)) return r;
916
+ let a = (N(), x("tr", {
917
+ key: e.row,
918
+ style: j({ height: `${e.height}px` })
919
+ }, [S("th", {
920
+ scope: "row",
921
+ class: A(["pk-spreadsheet-preview__row", { "pk-spreadsheet-preview__row--current": e.row >= Q.value.r1 && e.row <= Q.value.r2 }]),
922
+ style: j(h.value.frozen && e.row <= h.value.frozen.rows ? {
923
+ ...Y(e.row, 0),
924
+ left: 0,
925
+ zIndex: 4
926
+ } : void 0)
927
+ }, I(e.row), 7), (N(!0), x(_, null, F(k.value, (t) => (N(), x(_, { key: t.col }, [ue.value.has(`${e.row},${t.col}`) ? b("", !0) : (N(), x("td", {
928
+ key: 0,
929
+ rowspan: pe(e.row, t.col)?.rows,
930
+ colspan: pe(e.row, t.col)?.cols,
931
+ class: A(["pk-spreadsheet-preview__cell", {
932
+ "pk-spreadsheet-preview__cell--range": je(e.row, t.col) && !Me(e.row, t.col),
933
+ "pk-spreadsheet-preview__cell--missing": H(e.row, t.col)?.missing,
934
+ "pk-spreadsheet-preview__cell--marked": y(e.row, t.col)
935
+ }]),
936
+ style: j(_e(H(e.row, t.col), e.row, t.col)),
937
+ "data-focus": Me(e.row, t.col) ? "" : void 0,
938
+ "data-cell": `${e.row}:${t.col}`,
939
+ title: H(e.row, t.col)?.missing ? L(c)("chatFilePreview.missingValue") : void 0,
940
+ onMousedown: V((n) => Ie(e.row, t.col, n), ["prevent"]),
941
+ onMouseenter: (n) => lt(e.row, t.col),
942
+ onDblclick: pt
943
+ }, I(ge(H(e.row, t.col))), 47, Ue))], 64))), 128))], 4));
944
+ return a.memo = i, a;
945
+ }, n, 0), 128))])
946
+ ], 6)) : b("", !0),
947
+ ce.value.length ? (N(), x("div", We, [(N(!0), x(_, null, F(ce.value, (e) => (N(), x("div", {
948
+ key: e.key,
949
+ class: "pk-spreadsheet-preview__chart",
950
+ style: j(e.css)
951
+ }, [w(Le, { preview: e.chart }, null, 8, ["preview"])], 4))), 128))])) : b("", !0),
952
+ h.value && (h.value.moreRows || h.value.moreColumns) ? (N(), x("p", Ge, [h.value.moreRows ? (N(), x(_, { key: 0 }, [C(I(L(c)("chatFilePreview.moreRows", h.value.moreRows)), 1)], 64)) : b("", !0), h.value.moreColumns ? (N(), x(_, { key: 1 }, [C(I(L(c)("chatFilePreview.moreColumns", h.value.moreColumns)), 1)], 64)) : b("", !0)])) : b("", !0)
953
+ ], 40, He),
954
+ S("nav", {
888
955
  class: "pk-spreadsheet-preview__sheets",
889
956
  "aria-label": L(c)("chatFilePreview.sheets")
890
- }, [(M(!0), S(v, null, P(e.preview.sheets, (e, t) => (M(), S("button", {
957
+ }, [(N(!0), x(_, null, F(e.preview.sheets, (e, t) => (N(), x("button", {
891
958
  key: e.name,
892
959
  type: "button",
893
960
  class: "pk-spreadsheet-preview__sheet",
894
961
  "aria-current": t === u.value ? "page" : void 0,
895
962
  onClick: (e) => u.value = t
896
- }, I(e.name), 9, Ve))), 128))], 8, Be),
897
- C("div", He, [C("p", Ue, [e.preview.staleFormulas ? (M(), S("span", {
963
+ }, I(e.name), 9, qe))), 128))], 8, Ke),
964
+ S("div", Je, [S("p", Ye, [e.preview.staleFormulas ? (N(), x("span", {
898
965
  key: 0,
899
966
  class: "pk-spreadsheet-preview__note",
900
967
  title: L(c)("chatFilePreview.staleFormulas")
901
- }, I(L(c)("chatFilePreview.staleFormulas")), 9, We)) : e.preview.computedFormulas ? (M(), S("span", {
968
+ }, I(L(c)("chatFilePreview.staleFormulas")), 9, Xe)) : e.preview.computedFormulas ? (N(), x("span", {
902
969
  key: 1,
903
970
  class: "pk-spreadsheet-preview__note",
904
971
  title: L(c)("chatFilePreview.computedFormulas")
905
- }, I(L(c)("chatFilePreview.computedFormulas")), 9, Ge)) : x("", !0), yt.value ? (M(), S("span", Ke, [
906
- yt.value.average ? (M(), S("span", qe, I(L(c)("chatFilePreview.average")) + " " + I(yt.value.average), 1)) : x("", !0),
907
- C("span", null, I(L(c)("chatFilePreview.count")) + " " + I(yt.value.count), 1),
908
- yt.value.sum ? (M(), S("span", Je, I(L(c)("chatFilePreview.sum")) + " " + I(yt.value.sum), 1)) : x("", !0)
909
- ])) : x("", !0)]), C("div", Ye, [
910
- T(r, {
972
+ }, I(L(c)("chatFilePreview.computedFormulas")), 9, Ze)) : b("", !0), Ct.value ? (N(), x("span", Qe, [
973
+ Ct.value.average ? (N(), x("span", $e, I(L(c)("chatFilePreview.average")) + " " + I(Ct.value.average), 1)) : b("", !0),
974
+ S("span", null, I(L(c)("chatFilePreview.count")) + " " + I(Ct.value.count), 1),
975
+ Ct.value.sum ? (N(), x("span", et, I(L(c)("chatFilePreview.sum")) + " " + I(Ct.value.sum), 1)) : b("", !0)
976
+ ])) : b("", !0)]), S("div", tt, [
977
+ w(r, {
911
978
  modifiers: "action-quiet",
912
979
  icon: "ri:subtract-line",
913
980
  "aria-label": L(c)("chatFilePreview.zoomOut"),
914
981
  disabled: d.value <= .5,
915
- onClick: n[4] ||= (e) => bt(-.1)
982
+ onClick: n[4] ||= (e) => wt(-.1)
916
983
  }, null, 8, ["aria-label", "disabled"]),
917
- C("span", Xe, I(Math.round(d.value * 100)) + "% ", 1),
918
- T(r, {
984
+ S("span", nt, I(Math.round(d.value * 100)) + "% ", 1),
985
+ w(r, {
919
986
  modifiers: "action-quiet",
920
987
  icon: "ri:add-line",
921
988
  "aria-label": L(c)("chatFilePreview.zoomIn"),
922
989
  disabled: d.value >= 2,
923
- onClick: n[5] ||= (e) => bt(.1)
990
+ onClick: n[5] ||= (e) => wt(.1)
924
991
  }, null, 8, ["aria-label", "disabled"])
925
992
  ])])
926
993
  ]);
927
994
  };
928
995
  }
929
- }), it = ["src"], at = {
930
- key: 1,
996
+ }), ut = ["src"], dt = {
997
+ key: 2,
931
998
  class: "pk-word-preview__image",
932
999
  "data-quote-skip": ""
933
- }, ot = ["title"], st = ["title"], ct = ["data-quote-skip"], lt = /* @__PURE__ */ E({
1000
+ }, ft = ["title"], pt = ["title"], $ = ["data-quote-skip"], mt = /* @__PURE__ */ E({
934
1001
  __name: "PkWordPreviewRuns",
935
1002
  props: {
936
1003
  runs: {},
@@ -939,13 +1006,16 @@ var he = {
939
1006
  numbers: {}
940
1007
  },
941
1008
  setup(e) {
942
- let t = e, { t: n } = le({ useScope: "global" }), r = ee(m, void 0), i = (e) => e.picture ? f(r?.value, e.picture.ref) : void 0, a = (e) => t.page ? p(e) : "inline", o = (e) => {
1009
+ let t = e, { t: n } = de({ useScope: "global" }), r = D(g, void 0), i = D(m, void 0), a = (e) => e.picture ? p(r?.value, e.picture.ref) : void 0, s = (e) => e.chart ? i?.value?.[e.chart.ref] : void 0, l = (e) => t.page ? d(e) : "inline", u = (e) => l(e) === "page" ? {
1010
+ ...e,
1011
+ anchor: void 0
1012
+ } : e, f = (e) => {
943
1013
  let n = {
944
1014
  width: `${e.width}pt`,
945
1015
  aspectRatio: `${e.width} / ${e.height}`
946
1016
  }, r = e.anchor, i = t.page;
947
1017
  if (!r || !i) return n;
948
- let a = r.xFrom === "page" ? r.x - i.margins.left : r.x, o = p(e);
1018
+ let a = r.xFrom === "page" ? r.x - i.margins.left : r.x, o = d(e);
949
1019
  if (o === "around") {
950
1020
  let t = i.width - i.margins.left - i.margins.right, o = a + e.width / 2 < t / 2;
951
1021
  return {
@@ -966,49 +1036,56 @@ var he = {
966
1036
  top: `${r.y}pt`,
967
1037
  zIndex: r.wrap === "behind" ? -1 : 1
968
1038
  };
969
- }, c = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, l = y(() => {
970
- let e = s(t.runs, t.mode ?? "markup"), n = (e) => !!e.picture && !!t.page && ["around", "block"].includes(p(e.picture));
1039
+ }, h = (e) => e.field && t.numbers ? String(t.numbers[e.field]) : e.text, ee = v(() => {
1040
+ let e = c(t.runs, t.mode ?? "markup"), n = (e) => {
1041
+ let n = e.picture ?? (e.chart && u(e.chart));
1042
+ return !!n && !!t.page && ["around", "block"].includes(d(n));
1043
+ };
971
1044
  return [...e.filter(n), ...e.filter((e) => !n(e))];
972
- }), u = y(() => !t.mode || t.mode === "markup"), h = (e) => {
1045
+ }), te = v(() => !t.mode || t.mode === "markup"), y = (e) => {
973
1046
  let t = {};
974
- e.font && (t.fontFamily = d(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");
1047
+ e.font && (t.fontFamily = o(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");
975
1048
  let n = [e.underline ? "underline" : "", e.strike ? "line-through" : ""].filter(Boolean).join(" ");
976
1049
  return n && (t.textDecoration = n), e.caps && (t.textTransform = "uppercase"), e.vertAlign && (t.verticalAlign = e.vertAlign, t.fontSize = `${(e.size ?? 11) * .65}pt`), t;
977
- }, g = (e) => {
978
- let t = h(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
1050
+ }, S = (e) => {
1051
+ let t = y(e), n = new Set(String(t.textDecoration ?? "").split(" ").filter(Boolean));
979
1052
  return n.add(e.change === "deleted" ? "line-through" : "underline"), {
980
1053
  ...t,
981
1054
  textDecoration: [...n].join(" ")
982
1055
  };
983
- }, _ = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
984
- return (e, t) => (M(!0), S(v, null, P(l.value, (e, t) => (M(), S(v, { key: t }, [e.image ? (M(), S(v, { key: 0 }, [e.picture && i(e) ? (M(), S(v, { key: 0 }, [a(e.picture) === "page" ? x("", !0) : (M(), S("img", {
1056
+ }, C = (e) => e.author ? n("chatFilePreview.revisionBy", { author: e.author }) : void 0;
1057
+ return (e, t) => (N(!0), x(_, null, F(ee.value, (e, t) => (N(), x(_, { key: t }, [e.image ? (N(), x(_, { key: 0 }, [e.chart && s(e) ? (N(), x("span", {
985
1058
  key: 0,
986
- class: k(["pk-word-preview__picture", `pk-word-preview__picture--${a(e.picture)}`]),
987
- style: A(o(e.picture)),
988
- src: i(e),
1059
+ class: A(["pk-word-preview__chart", `pk-word-preview__chart--${l(u(e.chart))}`]),
1060
+ style: j(f(u(e.chart)))
1061
+ }, [w(Le, { preview: s(e) }, null, 8, ["preview"])], 6)) : e.picture && a(e) ? (N(), x(_, { key: 1 }, [l(e.picture) === "page" ? b("", !0) : (N(), x("img", {
1062
+ key: 0,
1063
+ class: A(["pk-word-preview__picture", `pk-word-preview__picture--${l(e.picture)}`]),
1064
+ style: j(f(e.picture)),
1065
+ src: a(e),
989
1066
  alt: ""
990
- }, null, 14, it))], 64)) : (M(), S("span", at, I(L(n)("chatFilePreview.image")), 1))], 64)) : u.value && e.change === "deleted" ? (M(), S("del", {
1067
+ }, null, 14, ut))], 64)) : (N(), x("span", dt, I(L(n)("chatFilePreview.image")), 1))], 64)) : te.value && e.change === "deleted" ? (N(), x("del", {
991
1068
  key: 1,
992
1069
  class: "pk-word-preview__removed",
993
1070
  "data-quote-skip": "",
994
- style: A(g(e)),
995
- title: _(e)
996
- }, I(c(e)), 13, ot)) : u.value && e.change === "inserted" ? (M(), S("ins", {
1071
+ style: j(S(e)),
1072
+ title: C(e)
1073
+ }, I(h(e)), 13, ft)) : te.value && e.change === "inserted" ? (N(), x("ins", {
997
1074
  key: 2,
998
1075
  class: "pk-word-preview__added",
999
- style: A(g(e)),
1000
- title: _(e)
1001
- }, I(c(e)), 13, st)) : (M(), S("span", {
1076
+ style: j(S(e)),
1077
+ title: C(e)
1078
+ }, I(h(e)), 13, pt)) : (N(), x("span", {
1002
1079
  key: 3,
1003
- style: A(h(e)),
1080
+ style: j(y(e)),
1004
1081
  "data-quote-skip": e.label ? "" : void 0
1005
- }, I(c(e)), 13, ct))], 64))), 128));
1082
+ }, I(h(e)), 13, $))], 64))), 128));
1006
1083
  }
1007
- }), ut = { key: 0 }, Q = ["data-paragraph", "colspan"], dt = [
1084
+ }), ht = { key: 0 }, gt = ["data-paragraph", "colspan"], _t = [
1008
1085
  "data-paragraph",
1009
1086
  "role",
1010
1087
  "aria-level"
1011
- ], ft = { key: 1 }, $ = /* @__PURE__ */ E({
1088
+ ], vt = { key: 1 }, yt = /* @__PURE__ */ E({
1012
1089
  __name: "PkWordPreviewBlock",
1013
1090
  props: {
1014
1091
  block: {},
@@ -1019,7 +1096,7 @@ var he = {
1019
1096
  marked: {}
1020
1097
  },
1021
1098
  setup(e) {
1022
- let t = e, n = y(() => {
1099
+ let t = e, n = v(() => {
1023
1100
  if (t.block.kind === "table") return {};
1024
1101
  let e = t.block.style ?? {};
1025
1102
  return {
@@ -1033,36 +1110,36 @@ var he = {
1033
1110
  backgroundColor: e.shading,
1034
1111
  fontSize: e.size ? `${e.size}pt` : void 0
1035
1112
  };
1036
- }), r = y(() => {
1113
+ }), r = v(() => {
1037
1114
  if (t.block.kind === "table") return {};
1038
1115
  let e = -(t.block.style?.firstLine ?? 0);
1039
1116
  return e > 0 ? { minWidth: `calc(${e}pt * var(--pk-word-indent-scale, 1))` } : { paddingRight: "6pt" };
1040
- }), i = y(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), a = y(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), o = y(() => {
1117
+ }), i = v(() => t.mode === "markup" && t.block.kind !== "table" && t.block.runs.some((e) => e.change)), a = v(() => t.block.kind === "table" && t.row !== void 0 ? t.block.rows[t.row] : void 0), o = v(() => {
1041
1118
  if (t.block.kind !== "table") return [];
1042
1119
  let e = t.block.widths ?? [], n = e.reduce((e, t) => e + t, 0);
1043
1120
  return n ? e.map((e) => `${e / n * 100}%`) : [];
1044
- }), s = y(() => t.block.kind !== "table" && !!t.block.id && !!t.marked?.has(t.block.id)), c = (e) => !!e?.some((e) => t.marked?.has(e)), l = y(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
1045
- return (t, u) => e.block.kind === "table" && a.value ? (M(), S("table", {
1121
+ }), s = v(() => t.block.kind !== "table" && !!t.block.id && !!t.marked?.has(t.block.id)), c = (e) => !!e?.some((e) => t.marked?.has(e)), l = v(() => t.mode === "markup" && !!a.value?.some((e) => e.runs.some((e) => e.change)));
1122
+ return (t, u) => e.block.kind === "table" && a.value ? (N(), x("table", {
1046
1123
  key: 0,
1047
- class: k(["pk-word-preview__table", {
1124
+ class: A(["pk-word-preview__table", {
1048
1125
  "pk-word-preview__table--lines": e.block.borders,
1049
1126
  "pk-word-preview__table--next": e.row !== 0,
1050
1127
  "pk-word-preview__changed": l.value
1051
1128
  }])
1052
- }, [o.value.length ? (M(), S("colgroup", ut, [(M(!0), S(v, null, P(o.value, (e, t) => (M(), S("col", {
1129
+ }, [o.value.length ? (N(), x("colgroup", ht, [(N(!0), x(_, null, F(o.value, (e, t) => (N(), x("col", {
1053
1130
  key: t,
1054
- style: A({ width: e })
1055
- }, null, 4))), 128))])) : x("", !0), C("tbody", null, [C("tr", null, [(M(!0), S(v, null, P(a.value, (t, n) => (M(), S("td", {
1131
+ style: j({ width: e })
1132
+ }, null, 4))), 128))])) : b("", !0), S("tbody", null, [S("tr", null, [(N(!0), x(_, null, F(a.value, (t, n) => (N(), x("td", {
1056
1133
  key: n,
1057
1134
  "data-paragraph": t.ids?.join(" "),
1058
- class: k({ "pk-word-preview__marked": c(t.ids) }),
1135
+ class: A({ "pk-word-preview__marked": c(t.ids) }),
1059
1136
  colspan: t.span,
1060
- style: A({
1137
+ style: j({
1061
1138
  backgroundColor: t.fill,
1062
1139
  textAlign: t.align,
1063
1140
  fontSize: t.size ? `${t.size}pt` : void 0
1064
1141
  })
1065
- }, [T(lt, {
1142
+ }, [w(mt, {
1066
1143
  runs: t.runs,
1067
1144
  mode: e.mode,
1068
1145
  numbers: e.numbers
@@ -1070,24 +1147,24 @@ var he = {
1070
1147
  "runs",
1071
1148
  "mode",
1072
1149
  "numbers"
1073
- ])], 14, Q))), 128))])])], 2)) : e.block.kind === "table" ? x("", !0) : (M(), S("div", {
1150
+ ])], 14, gt))), 128))])])], 2)) : e.block.kind === "table" ? b("", !0) : (N(), x("div", {
1074
1151
  key: 1,
1075
- class: k(["pk-word-preview__block", {
1152
+ class: A(["pk-word-preview__block", {
1076
1153
  "pk-word-preview__changed": i.value,
1077
1154
  "pk-word-preview__marked": s.value
1078
1155
  }]),
1079
1156
  "data-paragraph": e.block.id,
1080
1157
  role: e.block.kind === "heading" ? "heading" : void 0,
1081
1158
  "aria-level": e.block.kind === "heading" ? Math.max(1, e.block.level) : void 0,
1082
- style: A(n.value)
1159
+ style: j(n.value)
1083
1160
  }, [
1084
- e.block.label ? (M(), S("span", {
1161
+ e.block.label ? (N(), x("span", {
1085
1162
  key: 0,
1086
1163
  class: "pk-word-preview__label",
1087
1164
  "data-quote-skip": "",
1088
- style: A(r.value)
1089
- }, I(e.block.label), 5)) : x("", !0),
1090
- T(lt, {
1165
+ style: j(r.value)
1166
+ }, I(e.block.label), 5)) : b("", !0),
1167
+ w(mt, {
1091
1168
  runs: e.block.runs,
1092
1169
  mode: e.mode,
1093
1170
  page: e.page,
@@ -1098,10 +1175,10 @@ var he = {
1098
1175
  "page",
1099
1176
  "numbers"
1100
1177
  ]),
1101
- !e.block.label && !e.block.runs.length ? (M(), S("br", ft)) : x("", !0)
1102
- ], 14, dt));
1178
+ !e.block.label && !e.block.runs.length ? (N(), x("br", vt)) : b("", !0)
1179
+ ], 14, _t));
1103
1180
  }
1104
- }), pt = { class: "pk-word-preview__part" }, mt = ["src"], ht = /* @__PURE__ */ E({
1181
+ }), bt = { class: "pk-word-preview__part" }, xt = ["src"], St = /* @__PURE__ */ E({
1105
1182
  __name: "PkWordPreviewPart",
1106
1183
  props: {
1107
1184
  blocks: {},
@@ -1111,13 +1188,13 @@ var he = {
1111
1188
  numbers: {}
1112
1189
  },
1113
1190
  setup(e) {
1114
- let t = e, n = ee(m, void 0), r = y(() => u(t.blocks, t.mode)), i = y(() => c(t.blocks, t.mode).flatMap((e) => {
1115
- let r = f(n?.value, e.ref);
1191
+ let t = e, n = D(g, void 0), r = v(() => u(t.blocks, t.mode)), i = v(() => f(t.blocks, t.mode).flatMap((e) => {
1192
+ let r = p(n?.value, e.ref);
1116
1193
  return r ? [{
1117
1194
  src: r,
1118
- css: h(e, t.section.page)
1195
+ css: s(e, t.section.page)
1119
1196
  }] : [];
1120
- })), a = y(() => {
1197
+ })), a = v(() => {
1121
1198
  let { margins: e } = t.section.page;
1122
1199
  return {
1123
1200
  left: `${e.left}pt`,
@@ -1125,10 +1202,10 @@ var he = {
1125
1202
  ...t.where === "header" ? { top: `${t.section.headerDistance}pt` } : { bottom: `${t.section.footerDistance}pt` }
1126
1203
  };
1127
1204
  });
1128
- return (t, n) => (M(), S("div", pt, [C("div", {
1205
+ return (t, n) => (N(), x("div", bt, [S("div", {
1129
1206
  class: "pk-word-preview__part-flow",
1130
- style: A(a.value)
1131
- }, [(M(!0), S(v, null, P(r.value, (t) => (M(), b($, {
1207
+ style: j(a.value)
1208
+ }, [(N(!0), x(_, null, F(r.value, (t) => (N(), y(yt, {
1132
1209
  key: t.key,
1133
1210
  block: e.blocks[t.block],
1134
1211
  row: t.row,
@@ -1141,47 +1218,47 @@ var he = {
1141
1218
  "mode",
1142
1219
  "page",
1143
1220
  "numbers"
1144
- ]))), 128))], 4), (M(!0), S(v, null, P(i.value, (e, t) => (M(), S("img", {
1221
+ ]))), 128))], 4), (N(!0), x(_, null, F(i.value, (e, t) => (N(), x("img", {
1145
1222
  key: t,
1146
1223
  class: "pk-word-preview__float",
1147
- style: A(e.css),
1224
+ style: j(e.css),
1148
1225
  src: e.src,
1149
1226
  alt: ""
1150
- }, null, 12, mt))), 128))]));
1227
+ }, null, 12, xt))), 128))]));
1151
1228
  }
1152
- }), gt = ["aria-label"], _t = {
1229
+ }), Ct = ["aria-label"], wt = {
1153
1230
  class: "pk-word-preview__tabs",
1154
1231
  role: "tablist"
1155
- }, vt = ["aria-selected"], yt = ["aria-selected"], bt = {
1232
+ }, Tt = ["aria-selected"], Et = ["aria-selected"], Dt = {
1156
1233
  key: 0,
1157
1234
  class: "pk-word-preview__list"
1158
- }, xt = ["aria-current", "onClick"], St = { class: "pk-word-preview__entry-text" }, Ct = {
1235
+ }, Ot = ["aria-current", "onClick"], kt = { class: "pk-word-preview__entry-text" }, At = {
1159
1236
  key: 0,
1160
1237
  class: "u-dot"
1161
- }, wt = {
1238
+ }, jt = {
1162
1239
  key: 0,
1163
1240
  class: "pk-word-preview__none"
1164
- }, Tt = {
1241
+ }, Mt = {
1165
1242
  key: 1,
1166
1243
  class: "pk-word-preview__list"
1167
- }, Et = ["onClick"], Dt = {
1244
+ }, Nt = ["onClick"], Pt = {
1168
1245
  key: 0,
1169
1246
  class: "pk-word-preview__removed"
1170
- }, Ot = {
1247
+ }, Ft = {
1171
1248
  key: 1,
1172
1249
  class: "pk-word-preview__added"
1173
- }, kt = { class: "pk-word-preview__main" }, At = ["aria-label"], jt = ["src"], Mt = {
1250
+ }, It = { class: "pk-word-preview__main" }, Lt = ["aria-label"], Rt = ["src"], zt = {
1174
1251
  key: 2,
1175
1252
  class: "pk-word-preview__truncated"
1176
- }, Nt = { class: "pk-word-preview__status" }, Pt = {
1253
+ }, Bt = { class: "pk-word-preview__status" }, Vt = {
1177
1254
  key: 0,
1178
1255
  class: "pk-word-preview__count"
1179
- }, Ft = { class: "pk-word-preview__count" }, It = {
1256
+ }, Ht = { class: "pk-word-preview__count" }, Ut = {
1180
1257
  key: 1,
1181
1258
  class: "pk-word-preview__legend"
1182
- }, Lt = ["title"], Rt = { class: "pk-word-preview__removed" }, zt = { class: "pk-word-preview__added" }, Bt = { class: "pk-word-preview__percent" }, Vt = ["data-part"], Ht = 96 / 72, Ut = .5, Wt = /* @__PURE__ */ E({
1259
+ }, Wt = ["title"], Gt = { class: "pk-word-preview__removed" }, Kt = { class: "pk-word-preview__added" }, qt = { class: "pk-word-preview__percent" }, Jt = ["data-part"], Yt = 96 / 72, Xt = .5, Zt = /* @__PURE__ */ E({
1183
1260
  __name: "PkWordPreview",
1184
- props: /*@__PURE__*/ O({
1261
+ props: /*@__PURE__*/ k({
1185
1262
  preview: {},
1186
1263
  mode: {},
1187
1264
  marked: {}
@@ -1194,26 +1271,26 @@ var he = {
1194
1271
  zoom: { default: 1 },
1195
1272
  zoomModifiers: {}
1196
1273
  }),
1197
- emits: /*@__PURE__*/ O(["select"], ["update:fit", "update:zoom"]),
1274
+ emits: /*@__PURE__*/ k(["select"], ["update:fit", "update:zoom"]),
1198
1275
  setup(e, { emit: t }) {
1199
- let n = e, r = t, { t: i } = le({ useScope: "global" });
1200
- ie(m, y(() => n.preview.images));
1201
- let o = (e) => s(e, n.mode), p = y(() => u(n.preview.blocks, n.mode)), _ = ae("rootEl"), w = ae("scrollEl"), E = ae("measureEl"), { width: ee } = ue(_), { width: D } = ue(w), O = y(() => ee.value >= 1e3), j = y(() => n.preview.sections?.length ? n.preview.sections : [{
1276
+ let n = e, r = t, { t: i } = de({ useScope: "global" });
1277
+ ae(g, v(() => n.preview.images)), ae(m, v(() => n.preview.charts));
1278
+ let l = (e) => c(e, n.mode), d = v(() => u(n.preview.blocks, n.mode)), te = se("rootEl"), C = se("scrollEl"), T = se("measureEl"), { width: E } = fe(te), { width: D } = fe(C), O = v(() => E.value >= 1e3), k = v(() => n.preview.sections?.length ? n.preview.sections : [{
1202
1279
  page: n.preview.page,
1203
1280
  headerDistance: 0,
1204
1281
  footerDistance: 0,
1205
1282
  headers: {},
1206
1283
  footers: {}
1207
- }]), F = y(() => j.value[0].page), oe = y(() => (D.value - 48) / (F.value.width * Ht)), B = y(() => ee.value === 0 || D.value === 0 || oe.value >= Ut), se = y(() => ({
1208
- fontFamily: d(n.preview.defaults.font),
1284
+ }]), M = v(() => k.value[0].page), oe = v(() => (D.value - 48) / (M.value.width * Yt)), z = v(() => E.value === 0 || D.value === 0 || oe.value >= Xt), ce = v(() => ({
1285
+ fontFamily: o(n.preview.defaults.font),
1209
1286
  fontSize: `${n.preview.defaults.size}pt`,
1210
1287
  color: n.preview.defaults.color ?? "#000000",
1211
- "--pk-word-line": l(n.preview.defaults.font),
1288
+ "--pk-word-line": h(n.preview.defaults.font),
1212
1289
  "--pk-word-size": `${n.preview.defaults.size}pt`
1213
- })), ce = y(() => F.value.width - F.value.margins.left - F.value.margins.right), V = y(() => ({
1214
- ...se.value,
1215
- width: `${ce.value}pt`
1216
- })), H = ae("flowEl"), { width: de } = ue(H), U = y(() => {
1290
+ })), le = v(() => M.value.width - M.value.margins.left - M.value.margins.right), ue = v(() => ({
1291
+ ...ce.value,
1292
+ width: `${le.value}pt`
1293
+ })), V = se("flowEl"), { width: H } = fe(V), pe = v(() => {
1217
1294
  let e = /* @__PURE__ */ new Map(), t = 0;
1218
1295
  for (let r of n.preview.blocks) {
1219
1296
  if (r.kind === "table") continue;
@@ -1226,37 +1303,37 @@ var he = {
1226
1303
  let r = 0;
1227
1304
  for (let [n, i] of [...e].sort((e, t) => e[0] - t[0])) if (r += i, r > t / 10) return n;
1228
1305
  return 0;
1229
- }), fe = y(() => ({
1230
- ...se.value,
1231
- "--pk-word-indent-shared": `${U.value}pt`,
1232
- "--pk-word-indent-scale": de.value ? Math.min(1, de.value / (ce.value * Ht)) : 1
1233
- })), W = N([]), pe = N({}), he = async () => {
1234
- await te();
1235
- let e = E.value?.querySelectorAll("[data-item]");
1306
+ }), U = v(() => ({
1307
+ ...ce.value,
1308
+ "--pk-word-indent-shared": `${pe.value}pt`,
1309
+ "--pk-word-indent-scale": H.value ? Math.min(1, H.value / (le.value * Yt)) : 1
1310
+ })), W = P([]), me = P({}), he = async () => {
1311
+ await ne();
1312
+ let e = T.value?.querySelectorAll("[data-item]");
1236
1313
  W.value = [...e ?? []].map((e) => e.getBoundingClientRect().height);
1237
- let t = E.value?.querySelectorAll("[data-part]");
1238
- pe.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
1314
+ let t = T.value?.querySelectorAll("[data-part]");
1315
+ me.value = Object.fromEntries([...t ?? []].map((e) => [e.dataset.part ?? "", e.getBoundingClientRect().height]));
1239
1316
  };
1240
- z([
1241
- p,
1242
- B,
1317
+ B([
1318
+ d,
1319
+ z,
1243
1320
  () => n.preview.parts
1244
- ], he, { flush: "post" }), re(() => {
1321
+ ], he, { flush: "post" }), ie(() => {
1245
1322
  he(), document.fonts?.ready.then(he);
1246
1323
  });
1247
- let G = y(() => {
1248
- if (!B.value || W.value.length !== p.value.length) return [{
1249
- items: p.value.map((e, t) => t),
1324
+ let G = v(() => {
1325
+ if (!z.value || W.value.length !== d.value.length) return [{
1326
+ items: d.value.map((e, t) => t),
1250
1327
  section: 0,
1251
1328
  number: 1,
1252
- top: F.value.margins.top,
1253
- bottom: F.value.margins.bottom
1329
+ top: M.value.margins.top,
1330
+ bottom: M.value.margins.bottom
1254
1331
  }];
1255
1332
  let e = [], t = 0, r = !0, i = 0, a, o = () => {
1256
- let n = j.value[t];
1333
+ let n = k.value[t];
1257
1334
  return r && n.pageStart !== void 0 ? n.pageStart : (a ?? e[e.length - 1]?.number ?? 0) + 1;
1258
1335
  }, s = (e) => {
1259
- let i = j.value[t], a = (t) => r && i.titlePage ? t.first : n.preview.evenAndOddHeaders && e % 2 == 0 ? t.even : t.default, o = a(i.headers), s = a(i.footers), c = (e) => e ? (pe.value[e] ?? 0) / Ht : 0;
1336
+ let i = k.value[t], a = (t) => r && i.titlePage ? t.first : n.preview.evenAndOddHeaders && e % 2 == 0 ? t.even : t.default, o = a(i.headers), s = a(i.footers), c = (e) => e ? (me.value[e] ?? 0) / Yt : 0;
1260
1337
  return {
1261
1338
  header: o,
1262
1339
  footer: s,
@@ -1272,16 +1349,16 @@ var he = {
1272
1349
  ...s(n)
1273
1350
  }), r = !1, i = 0;
1274
1351
  };
1275
- return p.value.forEach((n, l) => {
1276
- n.section !== void 0 && n.section !== t && j.value[n.section] && (t = n.section, r = n.breakBefore || !e.length, r || (a = j.value[t].pageStart));
1277
- let u = e[e.length - 1], d = u && j.value[u.section].page, f = d ? (d.height - u.top - u.bottom) * Ht : 0, m = W.value[l];
1278
- for (let e = l; p.value[e]?.keepNext && e + 1 < p.value.length && !p.value[e + 1].breakBefore; e++) m += W.value[e + 1];
1279
- (!u || u.items.length && (n.breakBefore || i + W.value[l] > f || i + m > f && m <= (() => {
1352
+ return d.value.forEach((n, l) => {
1353
+ n.section !== void 0 && n.section !== t && k.value[n.section] && (t = n.section, r = n.breakBefore || !e.length, r || (a = k.value[t].pageStart));
1354
+ let u = e[e.length - 1], f = u && k.value[u.section].page, p = f ? (f.height - u.top - u.bottom) * Yt : 0, m = W.value[l];
1355
+ for (let e = l; d.value[e]?.keepNext && e + 1 < d.value.length && !d.value[e + 1].breakBefore; e++) m += W.value[e + 1];
1356
+ (!u || u.items.length && (n.breakBefore || i + W.value[l] > p || i + m > p && m <= (() => {
1280
1357
  let e = s(o());
1281
- return (j.value[t].page.height - e.top - e.bottom) * Ht;
1358
+ return (k.value[t].page.height - e.top - e.bottom) * Yt;
1282
1359
  })())) && c(), e[e.length - 1].items.push(l), i += W.value[l];
1283
1360
  }), e.length || c(), e;
1284
- }), ge = y(() => {
1361
+ }), K = v(() => {
1285
1362
  let e = /* @__PURE__ */ new Map();
1286
1363
  for (let t of G.value) e.set(t.section, (e.get(t.section) ?? 0) + 1);
1287
1364
  return G.value.map((t) => ({
@@ -1290,129 +1367,129 @@ var he = {
1290
1367
  sectionPages: e.get(t.section) ?? 1
1291
1368
  }));
1292
1369
  }), _e = (e) => {
1293
- let t = j.value[e.section].page;
1370
+ let t = k.value[e.section].page;
1294
1371
  return {
1295
- ...se.value,
1372
+ ...ce.value,
1296
1373
  width: `${t.width}pt`,
1297
1374
  minHeight: `${t.height}pt`,
1298
1375
  padding: `${e.top}pt ${t.margins.right}pt ${e.bottom}pt ${t.margins.left}pt`
1299
1376
  };
1300
- }, K = (e) => {
1301
- let t = [...new Set(e.items.map((e) => p.value[e].block))];
1302
- return c(t.map((e) => n.preview.blocks[e]), n.mode).flatMap((t) => {
1303
- let r = f(n.preview.images, t.ref);
1377
+ }, ve = (e) => {
1378
+ let t = [...new Set(e.items.map((e) => d.value[e].block))];
1379
+ return f(t.map((e) => n.preview.blocks[e]), n.mode).flatMap((t) => {
1380
+ let r = p(n.preview.images, t.ref);
1304
1381
  return r ? [{
1305
1382
  src: r,
1306
- css: h(t, j.value[e.section].page)
1383
+ css: s(t, k.value[e.section].page)
1307
1384
  }] : [];
1308
1385
  });
1309
- }, q = R(e, "fit"), ve = R(e, "zoom"), J = y(() => q.value ? Math.min(1.25, Math.max(.3, oe.value)) : ve.value), ye = (e) => {
1310
- ve.value = Math.min(2, Math.max(.3, Math.round((J.value + e) * 10) / 10)), q.value = !1;
1311
- }, be = N(0), xe = N(), Se = () => {
1312
- let e = w.value?.getBoundingClientRect();
1386
+ }, q = R(e, "fit"), ye = R(e, "zoom"), be = v(() => q.value ? Math.min(1.25, Math.max(.3, oe.value)) : ye.value), xe = (e) => {
1387
+ ye.value = Math.min(2, Math.max(.3, Math.round((be.value + e) * 10) / 10)), q.value = !1;
1388
+ }, Se = P(0), Ce = P(), we = () => {
1389
+ let e = C.value?.getBoundingClientRect();
1313
1390
  if (!e) return;
1314
- let t = w.value?.querySelectorAll("[data-page]") ?? [], n = 0;
1391
+ let t = C.value?.querySelectorAll("[data-page]") ?? [], n = 0;
1315
1392
  for (let [r, i] of [...t].entries()) {
1316
1393
  if (i.getBoundingClientRect().top - e.top > e.height / 3) break;
1317
1394
  n = r;
1318
1395
  }
1319
- be.value = n;
1396
+ Se.value = n;
1320
1397
  let r;
1321
- for (let t of Oe.value) {
1322
- let n = w.value?.querySelector(`[data-key="${t.key}"]`);
1398
+ for (let t of J.value) {
1399
+ let n = C.value?.querySelector(`[data-key="${t.key}"]`);
1323
1400
  if (n) {
1324
1401
  if (n.getBoundingClientRect().top - e.top > 48) break;
1325
1402
  r = t.key;
1326
1403
  }
1327
1404
  }
1328
- xe.value = r ?? Oe.value[0]?.key;
1329
- }, Ce = 0, we = () => {
1330
- Ce ||= requestAnimationFrame(() => {
1331
- Ce = 0, Se();
1405
+ Ce.value = r ?? J.value[0]?.key;
1406
+ }, Te = 0, Ee = () => {
1407
+ Te ||= requestAnimationFrame(() => {
1408
+ Te = 0, we();
1332
1409
  });
1333
1410
  };
1334
- ne(() => cancelAnimationFrame(Ce)), z(G, () => te(we));
1335
- let { selection: Te } = me({
1336
- root: () => w.value?.getRootNode(),
1411
+ re(() => cancelAnimationFrame(Te)), B(G, () => ne(Ee));
1412
+ let { selection: De } = ge({
1413
+ root: () => C.value?.getRootNode(),
1337
1414
  touch: !0
1338
1415
  });
1339
- z(Te, (e) => {
1340
- let t = w.value;
1341
- r("select", e && t ? Ee(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
1416
+ B(De, (e) => {
1417
+ let t = C.value;
1418
+ r("select", e && t ? ke(t, e.range, ".pk-word-preview__measure, .pk-word-preview__part") : void 0);
1342
1419
  });
1343
- let De = (e) => o(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), Oe = y(() => p.value.flatMap((e) => {
1344
- let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label, De(t.runs)].filter(Boolean).join(" ") : "";
1420
+ let Oe = (e) => l(e).map((e) => e.text).join("").replace(/\s+/g, " ").trim(), J = v(() => d.value.flatMap((e) => {
1421
+ let t = n.preview.blocks[e.block], r = t.kind === "heading" ? [t.label, Oe(t.runs)].filter(Boolean).join(" ") : "";
1345
1422
  return t.kind === "heading" && t.level <= 3 && r ? [{
1346
1423
  key: e.key,
1347
1424
  level: t.level,
1348
1425
  text: r
1349
1426
  }] : [];
1350
- })), ke = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, Y = y(() => p.value.flatMap((e) => {
1427
+ })), Ae = (e) => e.length > 60 ? `${e.slice(0, 60)}…` : e, Y = v(() => d.value.flatMap((e) => {
1351
1428
  let t = n.preview.blocks[e.block], r = t.kind === "table" ? (t.rows[e.row ?? 0] ?? []).flatMap((e) => e.runs) : t.runs, i = r.filter((e) => e.change === "deleted").map((e) => e.text).join(" ").trim(), a = r.filter((e) => e.change === "inserted").map((e) => e.text).join(" ").trim();
1352
1429
  return i || a ? [{
1353
1430
  key: e.key,
1354
- removed: ke(i),
1355
- added: ke(a)
1431
+ removed: Ae(i),
1432
+ added: Ae(a)
1356
1433
  }] : [];
1357
1434
  })), X;
1358
- z([() => n.marked, G], ([e]) => {
1359
- !e || e === X || B.value && W.value.length !== p.value.length || g(w.value, ".pk-word-preview__marked") && (X = e);
1435
+ B([() => n.marked, G], ([e]) => {
1436
+ !e || e === X || z.value && W.value.length !== d.value.length || ee(C.value, ".pk-word-preview__marked") && (X = e);
1360
1437
  }, {
1361
1438
  flush: "post",
1362
1439
  immediate: !0
1363
1440
  });
1364
- let Z = N("outline"), Ae = N(!1), je = (e) => {
1365
- w.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
1441
+ let Z = P("outline"), Q = P(!1), je = (e) => {
1442
+ C.value?.querySelector(`[data-key="${e}"]`)?.scrollIntoView({
1366
1443
  block: "start",
1367
1444
  behavior: "smooth"
1368
- }), O.value || (Ae.value = !1);
1369
- }, Me = y(() => n.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => De(e.runs)) : [De(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), Ne = y(() => n.preview.revisionAuthors.join(", "));
1445
+ }), O.value || (Q.value = !1);
1446
+ }, Me = v(() => n.preview.blocks.flatMap((e) => e.kind === "table" ? e.rows.flat().map((e) => Oe(e.runs)) : [Oe(e.runs)]).join(" ").split(/\s+/).filter(Boolean).length), Ne = v(() => n.preview.revisionAuthors.join(", "));
1370
1447
  return (t, n) => {
1371
1448
  let r = a;
1372
- return M(), S("div", {
1449
+ return N(), x("div", {
1373
1450
  ref_key: "rootEl",
1374
- ref: _,
1375
- class: k(["pk-word-preview", { "pk-word-preview--paged": B.value }])
1451
+ ref: te,
1452
+ class: A(["pk-word-preview", { "pk-word-preview--paged": z.value }])
1376
1453
  }, [
1377
- (O.value || Ae.value) && (Oe.value.length || Y.value.length) ? (M(), S("aside", {
1454
+ (O.value || Q.value) && (J.value.length || Y.value.length) ? (N(), x("aside", {
1378
1455
  key: 0,
1379
- class: k(["pk-word-preview__side", { "pk-word-preview__side--over": !O.value }]),
1456
+ class: A(["pk-word-preview__side", { "pk-word-preview__side--over": !O.value }]),
1380
1457
  "aria-label": L(i)("chatFilePreview.outline")
1381
- }, [C("div", _t, [C("button", {
1458
+ }, [S("div", wt, [S("button", {
1382
1459
  type: "button",
1383
1460
  role: "tab",
1384
1461
  class: "pk-word-preview__tab",
1385
1462
  "aria-selected": Z.value === "outline",
1386
1463
  onClick: n[0] ||= (e) => Z.value = "outline"
1387
- }, I(L(i)("chatFilePreview.outline")), 9, vt), Y.value.length ? (M(), S("button", {
1464
+ }, I(L(i)("chatFilePreview.outline")), 9, Tt), Y.value.length ? (N(), x("button", {
1388
1465
  key: 0,
1389
1466
  type: "button",
1390
1467
  role: "tab",
1391
1468
  class: "pk-word-preview__tab",
1392
1469
  "aria-selected": Z.value === "changes",
1393
1470
  onClick: n[1] ||= (e) => Z.value = "changes"
1394
- }, I(L(i)("chatFilePreview.changes", { count: Y.value.length })), 9, yt)) : x("", !0)]), Z.value === "outline" || !Y.value.length ? (M(), S("nav", bt, [(M(!0), S(v, null, P(Oe.value, (e) => (M(), S("button", {
1471
+ }, I(L(i)("chatFilePreview.changes", { count: Y.value.length })), 9, Et)) : b("", !0)]), Z.value === "outline" || !Y.value.length ? (N(), x("nav", Dt, [(N(!0), x(_, null, F(J.value, (e) => (N(), x("button", {
1395
1472
  key: e.key,
1396
1473
  type: "button",
1397
- class: k(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
1398
- "aria-current": xe.value === e.key ? "location" : void 0,
1474
+ class: A(["pk-word-preview__entry", `pk-word-preview__entry--${Math.min(e.level, 3)}`]),
1475
+ "aria-current": Ce.value === e.key ? "location" : void 0,
1399
1476
  onClick: (t) => je(e.key)
1400
- }, [C("span", St, I(e.text), 1), Y.value.some((t) => t.key === e.key) ? (M(), S("span", Ct)) : x("", !0)], 10, xt))), 128)), Oe.value.length ? x("", !0) : (M(), S("p", wt, I(L(i)("chatFilePreview.noHeadings")), 1))])) : (M(), S("nav", Tt, [(M(!0), S(v, null, P(Y.value, (e) => (M(), S("button", {
1477
+ }, [S("span", kt, I(e.text), 1), Y.value.some((t) => t.key === e.key) ? (N(), x("span", At)) : b("", !0)], 10, Ot))), 128)), J.value.length ? b("", !0) : (N(), x("p", jt, I(L(i)("chatFilePreview.noHeadings")), 1))])) : (N(), x("nav", Mt, [(N(!0), x(_, null, F(Y.value, (e) => (N(), x("button", {
1401
1478
  key: e.key,
1402
1479
  type: "button",
1403
1480
  class: "pk-word-preview__entry pk-word-preview__entry--change",
1404
1481
  onClick: (t) => je(e.key)
1405
- }, [e.removed ? (M(), S("del", Dt, I(e.removed), 1)) : x("", !0), e.added ? (M(), S("ins", Ot, I(e.added), 1)) : x("", !0)], 8, Et))), 128))]))], 10, gt)) : x("", !0),
1406
- C("div", kt, [C("div", {
1482
+ }, [e.removed ? (N(), x("del", Pt, I(e.removed), 1)) : b("", !0), e.added ? (N(), x("ins", Ft, I(e.added), 1)) : b("", !0)], 8, Nt))), 128))]))], 10, Ct)) : b("", !0),
1483
+ S("div", It, [S("div", {
1407
1484
  ref_key: "scrollEl",
1408
- ref: w,
1485
+ ref: C,
1409
1486
  class: "pk-word-preview__scroll",
1410
- onScroll: we
1411
- }, [B.value ? (M(), S("div", {
1487
+ onScroll: Ee
1488
+ }, [z.value ? (N(), x("div", {
1412
1489
  key: 0,
1413
1490
  class: "pk-word-preview__pages",
1414
- style: A({ zoom: J.value })
1415
- }, [(M(!0), S(v, null, P(G.value, (t, n) => (M(), S("article", {
1491
+ style: j({ zoom: be.value })
1492
+ }, [(N(!0), x(_, null, F(G.value, (t, n) => (N(), x("article", {
1416
1493
  key: n,
1417
1494
  "data-page": "",
1418
1495
  class: "pk-word-preview__page",
@@ -1420,29 +1497,29 @@ var he = {
1420
1497
  page: n + 1,
1421
1498
  count: G.value.length
1422
1499
  }),
1423
- style: A(_e(t))
1500
+ style: j(_e(t))
1424
1501
  }, [
1425
- t.header && e.preview.parts?.[t.header] ? (M(), b(ht, {
1502
+ t.header && e.preview.parts?.[t.header] ? (N(), y(St, {
1426
1503
  key: 0,
1427
1504
  blocks: e.preview.parts[t.header],
1428
1505
  where: "header",
1429
- section: j.value[t.section],
1506
+ section: k.value[t.section],
1430
1507
  mode: e.mode,
1431
- numbers: ge.value[n]
1508
+ numbers: K.value[n]
1432
1509
  }, null, 8, [
1433
1510
  "blocks",
1434
1511
  "section",
1435
1512
  "mode",
1436
1513
  "numbers"
1437
- ])) : x("", !0),
1438
- (M(!0), S(v, null, P(t.items, (r) => (M(), b($, {
1439
- key: p.value[r].key,
1440
- "data-key": p.value[r].key,
1441
- block: e.preview.blocks[p.value[r].block],
1442
- row: p.value[r].row,
1514
+ ])) : b("", !0),
1515
+ (N(!0), x(_, null, F(t.items, (r) => (N(), y(yt, {
1516
+ key: d.value[r].key,
1517
+ "data-key": d.value[r].key,
1518
+ block: e.preview.blocks[d.value[r].block],
1519
+ row: d.value[r].row,
1443
1520
  mode: e.mode,
1444
- page: j.value[t.section].page,
1445
- numbers: ge.value[n],
1521
+ page: k.value[t.section].page,
1522
+ numbers: K.value[n],
1446
1523
  marked: e.marked
1447
1524
  }, null, 8, [
1448
1525
  "data-key",
@@ -1453,33 +1530,33 @@ var he = {
1453
1530
  "numbers",
1454
1531
  "marked"
1455
1532
  ]))), 128)),
1456
- (M(!0), S(v, null, P(K(t), (e, t) => (M(), S("img", {
1533
+ (N(!0), x(_, null, F(ve(t), (e, t) => (N(), x("img", {
1457
1534
  key: `image-${t}`,
1458
1535
  class: "pk-word-preview__float",
1459
- style: A(e.css),
1536
+ style: j(e.css),
1460
1537
  src: e.src,
1461
1538
  alt: ""
1462
- }, null, 12, jt))), 128)),
1463
- t.footer && e.preview.parts?.[t.footer] ? (M(), b(ht, {
1539
+ }, null, 12, Rt))), 128)),
1540
+ t.footer && e.preview.parts?.[t.footer] ? (N(), y(St, {
1464
1541
  key: 1,
1465
1542
  blocks: e.preview.parts[t.footer],
1466
1543
  where: "footer",
1467
- section: j.value[t.section],
1544
+ section: k.value[t.section],
1468
1545
  mode: e.mode,
1469
- numbers: ge.value[n]
1546
+ numbers: K.value[n]
1470
1547
  }, null, 8, [
1471
1548
  "blocks",
1472
1549
  "section",
1473
1550
  "mode",
1474
1551
  "numbers"
1475
- ])) : x("", !0)
1476
- ], 12, At))), 128))], 4)) : (M(), S("article", {
1552
+ ])) : b("", !0)
1553
+ ], 12, Lt))), 128))], 4)) : (N(), x("article", {
1477
1554
  key: 1,
1478
1555
  ref_key: "flowEl",
1479
- ref: H,
1556
+ ref: V,
1480
1557
  class: "pk-word-preview__page pk-word-preview__page--flow",
1481
- style: A(fe.value)
1482
- }, [(M(!0), S(v, null, P(p.value, (t) => (M(), b($, {
1558
+ style: j(U.value)
1559
+ }, [(N(!0), x(_, null, F(d.value, (t) => (N(), y(yt, {
1483
1560
  key: t.key,
1484
1561
  "data-key": t.key,
1485
1562
  block: e.preview.blocks[t.block],
@@ -1492,22 +1569,22 @@ var he = {
1492
1569
  "row",
1493
1570
  "mode",
1494
1571
  "marked"
1495
- ]))), 128))], 4)), e.preview.truncated ? (M(), S("p", Mt, I(L(i)("chatFilePreview.truncated")), 1)) : x("", !0)], 544), C("div", Nt, [
1496
- B.value ? (M(), S("span", Pt, I(L(i)("chatFilePreview.pageOf", {
1497
- page: be.value + 1,
1572
+ ]))), 128))], 4)), e.preview.truncated ? (N(), x("p", zt, I(L(i)("chatFilePreview.truncated")), 1)) : b("", !0)], 544), S("div", Bt, [
1573
+ z.value ? (N(), x("span", Vt, I(L(i)("chatFilePreview.pageOf", {
1574
+ page: Se.value + 1,
1498
1575
  count: G.value.length
1499
- })), 1)) : x("", !0),
1500
- C("span", Ft, I(L(i)("chatFilePreview.words", Me.value)), 1),
1501
- e.mode === "markup" && e.preview.revisionAuthors.length ? (M(), S("span", It, [
1502
- C("span", {
1576
+ })), 1)) : b("", !0),
1577
+ S("span", Ht, I(L(i)("chatFilePreview.words", Me.value)), 1),
1578
+ e.mode === "markup" && e.preview.revisionAuthors.length ? (N(), x("span", Ut, [
1579
+ S("span", {
1503
1580
  class: "pk-word-preview__legend-text",
1504
1581
  title: L(i)("chatFilePreview.revisionsOf", { authors: Ne.value })
1505
- }, I(L(i)("chatFilePreview.revisionsOf", { authors: Ne.value })), 9, Lt),
1506
- C("del", Rt, I(L(i)("chatFilePreview.removed")), 1),
1507
- C("ins", zt, I(L(i)("chatFilePreview.added")), 1)
1508
- ])) : x("", !0),
1509
- n[6] ||= C("span", { class: "pk-word-preview__spacer" }, null, -1),
1510
- !O.value && (Oe.value.length || Y.value.length) ? (M(), b(r, {
1582
+ }, I(L(i)("chatFilePreview.revisionsOf", { authors: Ne.value })), 9, Wt),
1583
+ S("del", Gt, I(L(i)("chatFilePreview.removed")), 1),
1584
+ S("ins", Kt, I(L(i)("chatFilePreview.added")), 1)
1585
+ ])) : b("", !0),
1586
+ n[6] ||= S("span", { class: "pk-word-preview__spacer" }, null, -1),
1587
+ !O.value && (J.value.length || Y.value.length) ? (N(), y(r, {
1511
1588
  key: 2,
1512
1589
  class: "pk-word-preview__outline-toggle",
1513
1590
  modifiers: "action-quiet",
@@ -1515,16 +1592,16 @@ var he = {
1515
1592
  label: L(i)("chatFilePreview.outline"),
1516
1593
  title: L(i)("chatFilePreview.outline"),
1517
1594
  "aria-label": L(i)("chatFilePreview.outline"),
1518
- "aria-expanded": Ae.value,
1519
- onClick: n[2] ||= (e) => Ae.value = !Ae.value
1595
+ "aria-expanded": Q.value,
1596
+ onClick: n[2] ||= (e) => Q.value = !Q.value
1520
1597
  }, null, 8, [
1521
1598
  "label",
1522
1599
  "title",
1523
1600
  "aria-label",
1524
1601
  "aria-expanded"
1525
- ])) : x("", !0),
1526
- B.value ? (M(), S(v, { key: 3 }, [
1527
- T(r, {
1602
+ ])) : b("", !0),
1603
+ z.value ? (N(), x(_, { key: 3 }, [
1604
+ w(r, {
1528
1605
  class: "pk-word-preview__fit",
1529
1606
  modifiers: "action-quiet",
1530
1607
  icon: "ri:expand-width-line",
@@ -1539,83 +1616,83 @@ var he = {
1539
1616
  "aria-label",
1540
1617
  "disabled"
1541
1618
  ]),
1542
- T(r, {
1619
+ w(r, {
1543
1620
  modifiers: "action-quiet",
1544
1621
  icon: "ri:subtract-line",
1545
1622
  "aria-label": L(i)("chatFilePreview.zoomOut"),
1546
- disabled: J.value <= .3,
1547
- onClick: n[4] ||= (e) => ye(-.1)
1623
+ disabled: be.value <= .3,
1624
+ onClick: n[4] ||= (e) => xe(-.1)
1548
1625
  }, null, 8, ["aria-label", "disabled"]),
1549
- C("span", Bt, I(Math.round(J.value * 100)) + "% ", 1),
1550
- T(r, {
1626
+ S("span", qt, I(Math.round(be.value * 100)) + "% ", 1),
1627
+ w(r, {
1551
1628
  modifiers: "action-quiet",
1552
1629
  icon: "ri:add-line",
1553
1630
  "aria-label": L(i)("chatFilePreview.zoomIn"),
1554
- disabled: J.value >= 2,
1555
- onClick: n[5] ||= (e) => ye(.1)
1631
+ disabled: be.value >= 2,
1632
+ onClick: n[5] ||= (e) => xe(.1)
1556
1633
  }, null, 8, ["aria-label", "disabled"])
1557
- ], 64)) : x("", !0)
1634
+ ], 64)) : b("", !0)
1558
1635
  ])]),
1559
- B.value ? (M(), S("div", {
1636
+ z.value ? (N(), x("div", {
1560
1637
  key: 1,
1561
1638
  ref_key: "measureEl",
1562
- ref: E,
1639
+ ref: T,
1563
1640
  class: "pk-word-preview__measure",
1564
1641
  "aria-hidden": "true",
1565
- style: A(V.value)
1566
- }, [(M(!0), S(v, null, P(p.value, (t) => (M(), S("div", {
1642
+ style: j(ue.value)
1643
+ }, [(N(!0), x(_, null, F(d.value, (t) => (N(), x("div", {
1567
1644
  key: t.key,
1568
1645
  "data-item": ""
1569
- }, [T($, {
1646
+ }, [w(yt, {
1570
1647
  block: e.preview.blocks[t.block],
1571
1648
  row: t.row,
1572
1649
  mode: e.mode,
1573
- page: F.value
1650
+ page: M.value
1574
1651
  }, null, 8, [
1575
1652
  "block",
1576
1653
  "row",
1577
1654
  "mode",
1578
1655
  "page"
1579
- ])]))), 128)), (M(!0), S(v, null, P(e.preview.parts, (t, n) => (M(), S("div", {
1656
+ ])]))), 128)), (N(!0), x(_, null, F(e.preview.parts, (t, n) => (N(), x("div", {
1580
1657
  key: n,
1581
1658
  "data-part": n
1582
- }, [(M(!0), S(v, null, P(L(u)(t, e.mode), (n) => (M(), b($, {
1659
+ }, [(N(!0), x(_, null, F(L(u)(t, e.mode), (n) => (N(), y(yt, {
1583
1660
  key: n.key,
1584
1661
  block: t[n.block],
1585
1662
  row: n.row,
1586
1663
  mode: e.mode,
1587
- page: F.value
1664
+ page: M.value
1588
1665
  }, null, 8, [
1589
1666
  "block",
1590
1667
  "row",
1591
1668
  "mode",
1592
1669
  "page"
1593
- ]))), 128))], 8, Vt))), 128))], 4)) : x("", !0)
1670
+ ]))), 128))], 8, Jt))), 128))], 4)) : b("", !0)
1594
1671
  ], 2);
1595
1672
  };
1596
1673
  }
1597
- }), Gt = ["aria-label"], Kt = { class: "pk-file-preview__head" }, qt = { class: "pk-file-preview__file" }, Jt = {
1674
+ }), Qt = ["aria-label"], $t = { class: "pk-file-preview__head" }, en = { class: "pk-file-preview__file" }, tn = {
1598
1675
  class: "pk-file-preview__tile",
1599
1676
  "aria-hidden": "true"
1600
- }, Yt = { class: "pk-file-preview__name" }, Xt = { class: "pk-file-preview__title" }, Zt = {
1677
+ }, nn = { class: "pk-file-preview__name" }, rn = { class: "pk-file-preview__title" }, an = {
1601
1678
  class: "pk-file-preview__note",
1602
1679
  role: "status"
1603
- }, Qt = {
1680
+ }, on = {
1604
1681
  key: 0,
1605
1682
  class: "pk-file-preview__progress",
1606
1683
  "aria-hidden": "true"
1607
- }, $t = {
1684
+ }, sn = {
1608
1685
  key: 1,
1609
1686
  class: "pk-file-preview__tools"
1610
- }, en = ["aria-label"], tn = { class: "pk-file-preview__version" }, nn = { class: "pk-file-preview__mode-long" }, rn = { class: "pk-file-preview__mode-short" }, an = { class: "pk-file-preview__actions" }, on = { class: "pk-file-preview__body" }, sn = {
1687
+ }, cn = ["aria-label"], ln = { class: "pk-file-preview__version" }, un = { class: "pk-file-preview__mode-long" }, dn = { class: "pk-file-preview__mode-short" }, fn = { class: "pk-file-preview__actions" }, pn = { class: "pk-file-preview__body" }, mn = {
1611
1688
  key: 0,
1612
1689
  class: "pk-file-preview__skeleton vv-skeleton"
1613
- }, cn = {
1690
+ }, hn = {
1614
1691
  key: 1,
1615
1692
  class: "pk-file-preview__empty"
1616
- }, ln = /*@__PURE__*/ E({
1693
+ }, gn = /*@__PURE__*/ E({
1617
1694
  __name: "PkFilePreview",
1618
- props: /*@__PURE__*/ O({
1695
+ props: /*@__PURE__*/ k({
1619
1696
  kind: {},
1620
1697
  filename: {},
1621
1698
  version: {},
@@ -1644,7 +1721,7 @@ var he = {
1644
1721
  },
1645
1722
  fitModifiers: {}
1646
1723
  }),
1647
- emits: /*@__PURE__*/ O([
1724
+ emits: /*@__PURE__*/ k([
1648
1725
  "close",
1649
1726
  "version",
1650
1727
  "restore",
@@ -1658,13 +1735,13 @@ var he = {
1658
1735
  "update:fit"
1659
1736
  ]),
1660
1737
  setup(e, { emit: n }) {
1661
- let r = e, i = n, { t: o, locale: s } = le({ useScope: "global" }), c = N(!1), l;
1662
- z(() => r.working, (e, t) => {
1738
+ let r = e, i = n, { t: o, locale: s } = de({ useScope: "global" }), c = P(!1), l;
1739
+ B(() => r.working, (e, t) => {
1663
1740
  e ? (l = t === void 0 ? void 0 : r.version, c.value = !1) : l !== void 0 && (c.value = r.version === l, l = void 0);
1664
- }, { immediate: !0 }), z(() => [r.version, r.fileId], () => {
1741
+ }, { immediate: !0 }), B(() => [r.version, r.fileId], () => {
1665
1742
  r.working || (c.value = !1);
1666
1743
  });
1667
- let u = y(() => r.versions ?? []), d = y(() => r.version ? u.value.indexOf(r.version) : -1), f = y(() => d.value > 0 ? u.value[d.value - 1] : void 0), p = y(() => d.value >= 0 && d.value < u.value.length - 1 ? u.value[d.value + 1] : void 0), m = R(e, "mode"), h = R(e, "sheet"), g = R(e, "zoom"), E = R(e, "fit"), ee = y(() => [
1744
+ let u = v(() => r.versions ?? []), d = v(() => r.version ? u.value.indexOf(r.version) : -1), f = v(() => d.value > 0 ? u.value[d.value - 1] : void 0), p = v(() => d.value >= 0 && d.value < u.value.length - 1 ? u.value[d.value + 1] : void 0), m = R(e, "mode"), h = R(e, "sheet"), g = R(e, "zoom"), ee = R(e, "fit"), T = v(() => [
1668
1745
  {
1669
1746
  value: "markup",
1670
1747
  label: o("chatFilePreview.modeMarkup")
@@ -1677,48 +1754,48 @@ var he = {
1677
1754
  value: "original",
1678
1755
  label: o("chatFilePreview.modeOriginal")
1679
1756
  }
1680
- ]), D = y(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
1681
- z(() => r.version, () => {
1757
+ ]), E = v(() => r.preview?.kind === "word" && r.preview.revisionAuthors.length > 0);
1758
+ B(() => r.version, () => {
1682
1759
  m.value = "markup";
1683
1760
  });
1684
- let O = ae("rootEl"), A = F(), ne = N(!1), re = () => {
1685
- A.value = void 0, ne.value = !1;
1761
+ let D = se("rootEl"), O = oe(), k = P(!1), j = () => {
1762
+ O.value = void 0, k.value = !1;
1686
1763
  };
1687
- z(() => [
1764
+ B(() => [
1688
1765
  r.version,
1689
1766
  r.preview,
1690
1767
  m.value,
1691
1768
  h.value
1692
- ], re);
1693
- let j = (e) => {
1694
- ne.value || (A.value = e);
1695
- }, ie = y(() => A.value?.format === "docx" && W());
1696
- z(ne, async (e, t) => {
1697
- let n = A.value;
1698
- t && !e && n?.format === "docx" && (await te(), n.restore());
1769
+ ], j);
1770
+ let re = (e) => {
1771
+ k.value || (O.value = e);
1772
+ }, ie = v(() => O.value?.format === "docx" && me());
1773
+ B(k, async (e, t) => {
1774
+ let n = O.value;
1775
+ t && !e && n?.format === "docx" && (await ne(), n.restore());
1699
1776
  });
1700
- let oe = y(() => !r.version || r.version === u.value[u.value.length - 1]), se = () => {
1777
+ let M = v(() => !r.version || r.version === u.value[u.value.length - 1]), ae = () => {
1701
1778
  let e = u.value[u.value.length - 1];
1702
1779
  e && i("version", e);
1703
- }, ce = y(() => {
1704
- let e = A.value;
1705
- return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > ge;
1706
- }), V = y(() => A.value?.format === "docx" && m.value === "original"), ue = y(() => ce.value || V.value), de = y(() => V.value ? o("selectionActions.hintOriginal") : ce.value ? o(A.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: A.value?.format === "docx" ? 200 : ge }) : void 0), U = (e) => e[s.value] ?? e[s.value.split("-")[0]] ?? Object.values(e)[0] ?? "", fe = ["explain", "summarize"], pe = y(() => {
1707
- let e = A.value, t = r.selectionActions;
1780
+ }, z = v(() => {
1781
+ let e = O.value;
1782
+ return e?.format === "docx" ? e.paragraphCount > 200 : (e?.cells ?? 0) > _e;
1783
+ }), le = v(() => O.value?.format === "docx" && m.value === "original"), ue = v(() => z.value || le.value), V = v(() => le.value ? o("selectionActions.hintOriginal") : z.value ? o(O.value?.format === "docx" ? "selectionActions.hintParagraphs" : "selectionActions.hintCells", { count: O.value?.format === "docx" ? 200 : _e }) : void 0), fe = (e) => e[s.value] ?? e[s.value.split("-")[0]] ?? Object.values(e)[0] ?? "", pe = ["explain", "summarize"], U = v(() => {
1784
+ let e = O.value, t = r.selectionActions;
1708
1785
  if (!e || !t) return [];
1709
1786
  let n = e.format;
1710
- return [...(n === "docx" && ue.value ? fe : t.builtIns).map((e) => ({
1787
+ return [...(n === "docx" && ue.value ? pe : t.builtIns).map((e) => ({
1711
1788
  id: e,
1712
1789
  label: o(`selectionActions.builtIn.${e}`),
1713
1790
  ...e === "translate" && { asks: o("selectionActions.translateAsks") },
1714
1791
  prompt: (t) => o(`selectionActions.prompt.${n}.${e}`, { language: t ?? "" })
1715
1792
  })), ...(ue.value ? [] : t.actions).map((e) => ({
1716
1793
  id: e.id,
1717
- label: U(e.label),
1794
+ label: fe(e.label),
1718
1795
  icon: e.icon,
1719
- prompt: () => U(e.prompt)
1796
+ prompt: () => fe(e.prompt)
1720
1797
  }))];
1721
- }), me = (e) => {
1798
+ }), W = (e) => {
1722
1799
  if (e.format === "docx") return o("selectionActions.labelParagraphs", {
1723
1800
  file: r.filename,
1724
1801
  count: e.paragraphCount
@@ -1740,14 +1817,14 @@ var he = {
1740
1817
  fileId: r.fileId,
1741
1818
  version: r.version ?? 1,
1742
1819
  storedFileName: r.storedFileName,
1743
- label: me(e).slice(0, 200)
1820
+ label: W(e).slice(0, 200)
1744
1821
  };
1745
1822
  if (e.format === "docx") {
1746
1823
  let { measure: n, ...r } = e;
1747
1824
  return {
1748
1825
  ...t,
1749
1826
  ...r,
1750
- ...V.value && { original: !0 }
1827
+ ...le.value && { original: !0 }
1751
1828
  };
1752
1829
  }
1753
1830
  let { measure: n, cells: i, ...a } = e;
@@ -1755,23 +1832,23 @@ var he = {
1755
1832
  ...t,
1756
1833
  ...a
1757
1834
  };
1758
- }, G = (e, t) => {
1759
- let n = A.value, r = n && he(n);
1835
+ }, ge = (e, t) => {
1836
+ let n = O.value, r = n && he(n);
1760
1837
  r && (i("selectionSend", e, r, {
1761
1838
  id: t,
1762
1839
  size: n.format === "docx" ? n.paragraphCount : n.cells
1763
- }), re(), document.getSelection()?.removeAllRanges());
1764
- }, _e = (e, t) => {
1765
- let n = pe.value.find((t) => t.id === e);
1766
- n && G(n.prompt(t), e);
1767
- }, K = N(0);
1768
- H(O, "scroll", () => K.value++, {
1840
+ }), j(), document.getSelection()?.removeAllRanges());
1841
+ }, G = (e, t) => {
1842
+ let n = U.value.find((t) => t.id === e);
1843
+ n && ge(n.prompt(t), e);
1844
+ }, K = P(0);
1845
+ H(D, "scroll", () => K.value++, {
1769
1846
  capture: !0,
1770
1847
  passive: !0
1771
1848
  }), H(window, "resize", () => K.value++, { passive: !0 });
1772
- let q = y(() => {
1849
+ let ve = v(() => {
1773
1850
  K.value;
1774
- let e = A.value?.measure(), t = O.value?.getBoundingClientRect();
1851
+ let e = O.value?.measure(), t = D.value?.getBoundingClientRect();
1775
1852
  if (e && t) return {
1776
1853
  start: {
1777
1854
  top: e.start.top - t.top,
@@ -1787,53 +1864,53 @@ var he = {
1787
1864
  };
1788
1865
  });
1789
1866
  return (n, r) => {
1790
- let s = _, l = a;
1791
- return M(), S("section", {
1867
+ let s = te, l = a;
1868
+ return N(), x("section", {
1792
1869
  ref_key: "rootEl",
1793
- ref: O,
1870
+ ref: D,
1794
1871
  class: "pk-file-preview",
1795
1872
  "aria-label": e.filename,
1796
1873
  tabindex: "-1",
1797
1874
  autofocus: ""
1798
1875
  }, [
1799
- C("header", Kt, [
1800
- C("div", qt, [C("span", Jt, [T(s, {
1876
+ S("header", $t, [
1877
+ S("div", en, [S("span", tn, [w(s, {
1801
1878
  name: e.kind === "word" ? "ri:file-word-2-line" : "ri:file-excel-2-line",
1802
- class: k(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
1803
- }, null, 8, ["name", "class"])]), C("div", Yt, [C("strong", Xt, I(e.filename), 1), C("span", Zt, [e.working ? (M(), S(v, { key: 0 }, [r[14] ||= C("span", {
1879
+ class: A(e.kind === "word" ? "pk-file-preview__icon--word" : "pk-file-preview__icon--sheet")
1880
+ }, null, 8, ["name", "class"])]), S("div", nn, [S("strong", rn, I(e.filename), 1), S("span", an, [e.working ? (N(), x(_, { key: 0 }, [r[14] ||= S("span", {
1804
1881
  class: "pk-file-preview__spinner",
1805
1882
  "aria-hidden": "true"
1806
- }, null, -1), w(" " + I(L(o)("chatFilePreview.working")), 1)], 64)) : c.value ? (M(), S(v, { key: 1 }, [w(I(L(o)("chatFilePreview.answeredInChat")) + " ", 1), T(l, {
1883
+ }, null, -1), C(" " + I(L(o)("chatFilePreview.working")), 1)], 64)) : c.value ? (N(), x(_, { key: 1 }, [C(I(L(o)("chatFilePreview.answeredInChat")) + " ", 1), w(l, {
1807
1884
  modifiers: "link",
1808
1885
  class: "pk-file-preview__show-chat",
1809
1886
  label: L(o)("chatFilePreview.showChat"),
1810
1887
  onClick: r[0] ||= (e) => i("showChat")
1811
- }, null, 8, ["label"])], 64)) : (M(), S(v, { key: 2 }, [w(I(L(o)("chatFilePreview.readOnly")), 1)], 64))])])]),
1812
- e.working ? (M(), S("div", Qt)) : x("", !0),
1813
- e.version && u.value.length > 1 || D.value ? (M(), S("div", $t, [e.version && u.value.length > 1 ? (M(), S("nav", {
1888
+ }, null, 8, ["label"])], 64)) : (N(), x(_, { key: 2 }, [C(I(L(o)("chatFilePreview.readOnly")), 1)], 64))])])]),
1889
+ e.working ? (N(), x("div", on)) : b("", !0),
1890
+ e.version && u.value.length > 1 || E.value ? (N(), x("div", sn, [e.version && u.value.length > 1 ? (N(), x("nav", {
1814
1891
  key: 0,
1815
1892
  class: "pk-file-preview__versions",
1816
1893
  "aria-label": L(o)("chatFilePreview.versions")
1817
1894
  }, [
1818
- T(l, {
1895
+ w(l, {
1819
1896
  modifiers: "action-quiet",
1820
1897
  icon: "ri:arrow-left-s-line",
1821
1898
  "aria-label": L(o)("chatFilePreview.previousVersion"),
1822
1899
  disabled: !f.value,
1823
1900
  onClick: r[1] ||= (e) => f.value && i("version", f.value)
1824
1901
  }, null, 8, ["aria-label", "disabled"]),
1825
- C("span", tn, I(L(o)("chatFilePreview.versionOf", {
1902
+ S("span", ln, I(L(o)("chatFilePreview.versionOf", {
1826
1903
  version: e.version,
1827
1904
  count: u.value.length
1828
1905
  })), 1),
1829
- T(l, {
1906
+ w(l, {
1830
1907
  modifiers: "action-quiet",
1831
1908
  icon: "ri:arrow-right-s-line",
1832
1909
  "aria-label": L(o)("chatFilePreview.nextVersion"),
1833
1910
  disabled: !p.value,
1834
1911
  onClick: r[2] ||= (e) => p.value && i("version", p.value)
1835
1912
  }, null, 8, ["aria-label", "disabled"])
1836
- ], 8, en)) : x("", !0), D.value ? (M(), b(t, {
1913
+ ], 8, cn)) : b("", !0), E.value ? (N(), y(t, {
1837
1914
  key: 1,
1838
1915
  modelValue: m.value,
1839
1916
  "onUpdate:modelValue": r[3] ||= (e) => m.value = e,
@@ -1841,24 +1918,24 @@ var he = {
1841
1918
  segmented: "",
1842
1919
  class: "pk-file-preview__modes u-segmented-fit mb-0",
1843
1920
  "aria-label": L(o)("chatFilePreview.modes"),
1844
- options: ee.value
1921
+ options: T.value
1845
1922
  }, {
1846
- markup: B(() => [C("span", nn, I(L(o)("chatFilePreview.modeMarkup")), 1), C("span", rn, I(L(o)("chatFilePreview.modeMarkupShort")), 1)]),
1923
+ markup: ce(() => [S("span", un, I(L(o)("chatFilePreview.modeMarkup")), 1), S("span", dn, I(L(o)("chatFilePreview.modeMarkupShort")), 1)]),
1847
1924
  _: 1
1848
1925
  }, 8, [
1849
1926
  "modelValue",
1850
1927
  "aria-label",
1851
1928
  "options"
1852
- ])) : x("", !0)])) : x("", !0),
1853
- C("div", an, [
1854
- e.restorable ? (M(), b(l, {
1929
+ ])) : b("", !0)])) : b("", !0),
1930
+ S("div", fn, [
1931
+ e.restorable ? (N(), y(l, {
1855
1932
  key: 0,
1856
1933
  modifiers: "action-quiet",
1857
1934
  icon: "ri:arrow-go-back-line",
1858
1935
  label: L(o)("chatFilePreview.restore"),
1859
1936
  onClick: r[4] ||= (e) => i("restore")
1860
- }, null, 8, ["label"])) : x("", !0),
1861
- T(l, {
1937
+ }, null, 8, ["label"])) : b("", !0),
1938
+ w(l, {
1862
1939
  href: e.downloadUrl,
1863
1940
  download: "",
1864
1941
  modifiers: "action-quiet",
@@ -1870,22 +1947,22 @@ var he = {
1870
1947
  "title",
1871
1948
  "aria-label"
1872
1949
  ]),
1873
- e.resize === "expand" ? (M(), b(l, {
1950
+ e.resize === "expand" ? (N(), y(l, {
1874
1951
  key: 1,
1875
1952
  modifiers: "action-quiet",
1876
1953
  icon: "ri:fullscreen-line",
1877
1954
  title: L(o)("chatFilePreview.expand"),
1878
1955
  "aria-label": L(o)("chatFilePreview.expand"),
1879
1956
  onClick: r[5] ||= (e) => i("resize")
1880
- }, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (M(), b(l, {
1957
+ }, null, 8, ["title", "aria-label"])) : e.resize === "shrink" ? (N(), y(l, {
1881
1958
  key: 2,
1882
1959
  modifiers: "action-quiet",
1883
1960
  icon: "ri:fullscreen-exit-line",
1884
1961
  title: L(o)("chatFilePreview.shrink"),
1885
1962
  "aria-label": L(o)("chatFilePreview.shrink"),
1886
1963
  onClick: r[6] ||= (e) => i("resize")
1887
- }, null, 8, ["title", "aria-label"])) : x("", !0),
1888
- T(l, {
1964
+ }, null, 8, ["title", "aria-label"])) : b("", !0),
1965
+ w(l, {
1889
1966
  modifiers: "action-quiet",
1890
1967
  icon: "ri:close-line",
1891
1968
  title: L(o)("chatFilePreview.close"),
@@ -1894,26 +1971,26 @@ var he = {
1894
1971
  }, null, 8, ["title", "aria-label"])
1895
1972
  ])
1896
1973
  ]),
1897
- C("div", on, [e.loading ? (M(), S("div", sn, [(M(), S(v, null, P(8, (e) => C("div", {
1974
+ S("div", pn, [e.loading ? (N(), x("div", mn, [(N(), x(_, null, F(8, (e) => S("div", {
1898
1975
  key: e,
1899
- class: k(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
1900
- }, null, 2)), 64))])) : e.error || !e.preview ? (M(), S("p", cn, I(L(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (M(), b(Wt, {
1976
+ class: A(["vv-skeleton__item pk-file-preview__skeleton-line", e % 3 ? "w-full" : "w-128"])
1977
+ }, null, 2)), 64))])) : e.error || !e.preview ? (N(), x("p", hn, I(L(o)("chatFilePreview.unavailable")), 1)) : e.preview.kind === "word" ? (N(), y(Zt, {
1901
1978
  key: 2,
1902
1979
  zoom: g.value,
1903
1980
  "onUpdate:zoom": r[8] ||= (e) => g.value = e,
1904
- fit: E.value,
1905
- "onUpdate:fit": r[9] ||= (e) => E.value = e,
1981
+ fit: ee.value,
1982
+ "onUpdate:fit": r[9] ||= (e) => ee.value = e,
1906
1983
  preview: e.preview,
1907
- mode: D.value ? m.value : "markup",
1984
+ mode: E.value ? m.value : "markup",
1908
1985
  marked: e.changes?.kind === "word" ? e.changes.paragraphs : void 0,
1909
- onSelect: j
1986
+ onSelect: re
1910
1987
  }, null, 8, [
1911
1988
  "zoom",
1912
1989
  "fit",
1913
1990
  "preview",
1914
1991
  "mode",
1915
1992
  "marked"
1916
- ])) : (M(), b(rt, {
1993
+ ])) : (N(), y(lt, {
1917
1994
  key: 3,
1918
1995
  sheet: h.value,
1919
1996
  "onUpdate:sheet": r[10] ||= (e) => h.value = e,
@@ -1921,28 +1998,28 @@ var he = {
1921
1998
  "onUpdate:zoom": r[11] ||= (e) => g.value = e,
1922
1999
  preview: e.preview,
1923
2000
  marked: e.changes?.kind === "spreadsheet" ? e.changes.cells : void 0,
1924
- onSelect: j
2001
+ onSelect: re
1925
2002
  }, null, 8, [
1926
2003
  "sheet",
1927
2004
  "zoom",
1928
2005
  "preview",
1929
2006
  "marked"
1930
2007
  ]))]),
1931
- e.selectionActions && A.value && q.value ? (M(), b(Me, {
2008
+ e.selectionActions && O.value && ve.value ? (N(), y(Ne, {
1932
2009
  key: 0,
1933
- asking: ne.value,
1934
- "onUpdate:asking": r[12] ||= (e) => ne.value = e,
2010
+ asking: k.value,
2011
+ "onUpdate:asking": r[12] ||= (e) => k.value = e,
1935
2012
  strategy: "absolute",
1936
- anchor: q.value,
1937
- actions: pe.value,
1938
- hint: de.value,
2013
+ anchor: ve.value,
2014
+ actions: U.value,
2015
+ hint: V.value,
1939
2016
  touch: ie.value,
1940
- note: oe.value ? void 0 : L(o)("selectionActions.notLatest", { version: e.version }),
2017
+ note: M.value ? void 0 : L(o)("selectionActions.notLatest", { version: e.version }),
1941
2018
  "note-action": L(o)("selectionActions.openLatest"),
1942
- onAction: _e,
1943
- onAsk: r[13] ||= (e) => G(e, "ask"),
1944
- onNote: se,
1945
- onClose: re
2019
+ onAction: G,
2020
+ onAsk: r[13] ||= (e) => ge(e, "ask"),
2021
+ onNote: ae,
2022
+ onClose: j
1946
2023
  }, null, 8, [
1947
2024
  "asking",
1948
2025
  "anchor",
@@ -1951,11 +2028,11 @@ var he = {
1951
2028
  "touch",
1952
2029
  "note",
1953
2030
  "note-action"
1954
- ])) : x("", !0)
1955
- ], 8, Gt);
2031
+ ])) : b("", !0)
2032
+ ], 8, Qt);
1956
2033
  };
1957
2034
  }
1958
- }), un = /* @__PURE__ */ e({ default: () => dn }), dn = ln;
1959
- export { G as i, un as n, he as r, dn as t };
2035
+ }), _n = /* @__PURE__ */ e({ default: () => vn }), vn = gn;
2036
+ export { K as i, _n as n, G as r, vn as t };
1960
2037
 
1961
- //# sourceMappingURL=PkFilePreview-k5gEl3n8.js.map
2038
+ //# sourceMappingURL=PkFilePreview-CmsT6lSP.js.map