@eternalheart/vue-file-preview 1.7.0 → 1.7.1

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 (45) hide show
  1. package/README.md +2 -0
  2. package/README.zh-CN.md +2 -0
  3. package/lib/FilePreviewContent.vue.d.ts +9 -1
  4. package/lib/FilePreviewEmbed.vue.d.ts +6 -1
  5. package/lib/FilePreviewModal.vue.d.ts +6 -1
  6. package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs → EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-CnJpGYJ2.mjs → avifLoader-CAUzjn-d-Cf00sjt2.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-g_dLrWLP.mjs → heicLoader-D_9PukkA-cn1P7b2x.mjs} +1 -1
  9. package/lib/chunks/{index-C8lyQPe3.mjs → index-0VXtKKev.mjs} +3 -3
  10. package/lib/chunks/index-0fXL30y0.mjs +333 -0
  11. package/lib/chunks/{index-CWPdNhoe.mjs → index-B1AwVHWI.mjs} +60 -60
  12. package/lib/chunks/{index-C4hIk6pa.mjs → index-B77rFiau.mjs} +2 -2
  13. package/lib/chunks/{index-BzwJ0VWu.mjs → index-BB10as16.mjs} +33 -33
  14. package/lib/chunks/{index-BfOWoMpY.mjs → index-BBIn-k4u.mjs} +77 -77
  15. package/lib/chunks/{index-6XZXYqbp.mjs → index-BSzaI9ea.mjs} +29 -32
  16. package/lib/chunks/{index-Bg8poMIm.mjs → index-BZvy39tn.mjs} +29 -29
  17. package/lib/chunks/{index-zLQlyNR2.mjs → index-BlJEM2Lb.mjs} +62 -62
  18. package/lib/chunks/{index-z9RqL2wI.mjs → index-CZlnxQFA.mjs} +453 -453
  19. package/lib/chunks/{index-BPSzwMOC.mjs → index-ClhTPqDI.mjs} +46 -46
  20. package/lib/chunks/{index-Bf94DwQu.mjs → index-D690gnNu.mjs} +24 -24
  21. package/lib/chunks/index-D7WykPYL.mjs +51 -0
  22. package/lib/chunks/{index-c-pYJEmH.mjs → index-DBzyeU0G.mjs} +1028 -989
  23. package/lib/chunks/{index-LPGxJDnT.mjs → index-DKFX5ToE.mjs} +18 -18
  24. package/lib/chunks/{index-aKiIuKKx.mjs → index-DRmKaFXK.mjs} +50 -50
  25. package/lib/chunks/{index-D5IF9F-D.mjs → index-DXf3wXT5.mjs} +22 -22
  26. package/lib/chunks/{index-CrVQPnFj.mjs → index-Dp7QQjNH.mjs} +18 -18
  27. package/lib/chunks/{index-BYQ9S7Mk.mjs → index-FzI__DHC.mjs} +30 -30
  28. package/lib/chunks/{index-DZe0BxAB.mjs → index-PWjCziZG.mjs} +20 -20
  29. package/lib/chunks/{index-DM8Dfl-m.mjs → index-bT6XWKO_.mjs} +15 -15
  30. package/lib/chunks/{index-DFeKS8tR.mjs → index-tX9VR6Vo.mjs} +22 -22
  31. package/lib/chunks/{jp2Loader-Dig19xyo-fCO1knZ0.mjs → jp2Loader-Dig19xyo-D-OEDL3n.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-DihMskai.mjs → psdLoader-C0tKUXXl-CVN06LUc.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-BSfDPl-z.mjs → rawLoader-C-tPeFAB-DBqcJPFK.mjs} +1 -1
  34. package/lib/chunks/{tiffLoader-BlhByX8w-JY5DaTre.mjs → tiffLoader-BlhByX8w-8-0icdyL.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-C-ztcJBE.mjs → useShikiHighlight-a_GUszuU.mjs} +1 -1
  36. package/lib/composables/usePreviewEvents.d.ts +2 -2
  37. package/lib/core/events.d.ts +18 -1
  38. package/lib/core/index.d.ts +1 -1
  39. package/lib/index.cjs +48 -48
  40. package/lib/index.css +1 -1
  41. package/lib/index.d.ts +1 -1
  42. package/lib/index.mjs +5 -5
  43. package/package.json +1 -1
  44. package/lib/chunks/index-C41YET0_.mjs +0 -51
  45. package/lib/chunks/index-GFcSJEwj.mjs +0 -330
@@ -1,7 +1,7 @@
1
- import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as j, openBlock as v, createElementBlock as u, normalizeStyle as W, Fragment as B, createElementVNode as i, normalizeClass as U, toDisplayString as T, unref as g, withDirectives as V, renderSlot as N, vShow as Z, resolveComponent as ve, createVNode as K, createBlock as D, resolveDynamicComponent as q, renderList as Q, createCommentVNode as ee, defineAsyncComponent as fe, withCtx as G, Teleport as de } from "vue";
2
- import { u as te, e as ne, S as pe, X as ue, a as ce, b as me, r as J, J as he, w as ge, x as we, z as xe, H as be } from "./index-c-pYJEmH.mjs";
1
+ import { defineComponent as O, ref as d, computed as C, onMounted as re, onBeforeUnmount as Y, watch as P, openBlock as v, createElementBlock as u, normalizeStyle as W, Fragment as B, createElementVNode as i, normalizeClass as U, toDisplayString as T, unref as g, withDirectives as V, renderSlot as N, vShow as Z, resolveComponent as ve, createVNode as j, createBlock as D, resolveDynamicComponent as q, renderList as Q, createCommentVNode as ee, defineAsyncComponent as fe, withCtx as G, Teleport as de } from "vue";
2
+ import { u as te, d as ne, j as pe, A as ue, a as ce, b as me, W as X, J as he, k as ge, l as we, H as be, m as xe } from "./index-DBzyeU0G.mjs";
3
3
  import { FileImage as ye, FileText as ke, FileCode as Le, File as ze, ChevronRight as Se, FolderOpen as Te, Folder as _e } from "lucide-vue-next";
4
- import { _ as A } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
+ import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
5
  import { T as $e } from "./base.types-DaftHyg7.mjs";
6
6
  const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-weak vfp-bg-surface-toolbar" }, Ce = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Ee = { class: "vfp-flex-1 vfp-min-h-0 vfp-min-w-0 vfp-w-full vfp-overflow-hidden" }, Me = { class: "vfp-flex-1 vfp-min-w-0 vfp-min-h-0 vfp-overflow-hidden" }, We = /* @__PURE__ */ O({
7
7
  name: "ResizableSplit",
@@ -26,46 +26,46 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
26
26
  }
27
27
  return n.initialLeftWidth;
28
28
  })()
29
- ), L = d(!1), z = d(!1), _ = d(!0), x = d("left");
29
+ ), z = d(!1), y = d(!1), _ = d(!0), b = d("left");
30
30
  let o = null, t = null;
31
- const y = () => {
32
- o && (z.value = o.matches);
33
- }, b = C(
34
- () => z.value && _.value ? { width: `${f.value}px` } : void 0
35
- ), a = C(() => z.value && _.value), S = (l) => {
31
+ const k = () => {
32
+ o && (y.value = o.matches);
33
+ }, x = C(
34
+ () => y.value && _.value ? { width: `${f.value}px` } : void 0
35
+ ), a = C(() => y.value && _.value), S = (l) => {
36
36
  if (!w.value) return;
37
- const c = w.value.getBoundingClientRect(), F = l.clientX - c.left, P = c.width - n.minRightWidth - 6, X = Math.min(n.maxLeftWidth, P);
37
+ const c = w.value.getBoundingClientRect(), F = l.clientX - c.left, K = c.width - n.minRightWidth - 6, A = Math.min(n.maxLeftWidth, K);
38
38
  f.value = Math.max(
39
39
  n.minLeftWidth,
40
- Math.min(X, F)
40
+ Math.min(A, F)
41
41
  );
42
42
  }, $ = () => {
43
- if (L.value && (L.value = !1, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), document.body.style.cursor = "", document.body.style.userSelect = "", n.storageKey))
43
+ if (z.value && (z.value = !1, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), document.body.style.cursor = "", document.body.style.userSelect = "", n.storageKey))
44
44
  try {
45
45
  window.localStorage.setItem(n.storageKey, String(f.value));
46
46
  } catch {
47
47
  }
48
48
  }, R = (l) => {
49
- l.preventDefault(), L.value = !0, window.addEventListener("mousemove", S), window.addEventListener("mouseup", $), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
49
+ l.preventDefault(), z.value = !0, window.addEventListener("mousemove", S), window.addEventListener("mouseup", $), document.body.style.cursor = "col-resize", document.body.style.userSelect = "none";
50
50
  };
51
51
  re(() => {
52
52
  if (typeof window < "u") {
53
- o = window.matchMedia(n.desktopMedia), y(), o.addEventListener("change", y);
53
+ o = window.matchMedia(n.desktopMedia), k(), o.addEventListener("change", k);
54
54
  const l = () => {
55
55
  w.value && (_.value = w.value.getBoundingClientRect().width >= n.minLeftWidth + n.minRightWidth + 6);
56
56
  };
57
57
  l(), t = typeof ResizeObserver < "u" ? new ResizeObserver(l) : null, t == null || t.observe(w.value);
58
58
  }
59
59
  }), Y(() => {
60
- o && o.removeEventListener("change", y), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), L.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
61
- }), j(
60
+ o && o.removeEventListener("change", k), t == null || t.disconnect(), t = null, window.removeEventListener("mousemove", S), window.removeEventListener("mouseup", $), z.value && (document.body.style.cursor = "", document.body.style.userSelect = "");
61
+ }), P(
62
62
  () => n.initialLeftWidth,
63
63
  (l) => {
64
64
  n.storageKey || (f.value = l);
65
65
  }
66
66
  );
67
67
  const E = (l) => {
68
- x.value = l;
68
+ b.value = l;
69
69
  };
70
70
  return I({ switchTab: E }), (l, c) => (v(), u("div", {
71
71
  ref_key: "containerRef",
@@ -77,36 +77,36 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
77
77
  i("div", Re, [
78
78
  i("button", {
79
79
  type: "button",
80
- class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", x.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
80
+ class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "left" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
81
81
  onClick: c[0] || (c[0] = (F) => E("left"))
82
82
  }, T(r.leftTabLabel ?? g(p)("zip.file_tree")), 3),
83
83
  i("button", {
84
84
  type: "button",
85
- class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", x.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
85
+ class: U(["vfp-flex-1 vfp-py-2.5 vfp-text-sm vfp-transition-colors", b.value === "right" ? "vfp-text-fg-primary vfp-border-b-2 vfp-border-fg-primary -vfp-mb-px" : "vfp-text-fg-secondary"]),
86
86
  onClick: c[1] || (c[1] = (F) => E("right"))
87
87
  }, T(r.rightTabLabel ?? g(p)("toolbar.preview")), 3)
88
88
  ]),
89
89
  V(i("div", Ce, [
90
90
  N(l.$slots, "left", {}, void 0, !0)
91
91
  ], 512), [
92
- [Z, x.value === "left"]
92
+ [Z, b.value === "left"]
93
93
  ]),
94
94
  V(i("div", Ee, [
95
95
  N(l.$slots, "right", {}, void 0, !0)
96
96
  ], 512), [
97
- [Z, x.value === "right"]
97
+ [Z, b.value === "right"]
98
98
  ])
99
99
  ], 64)) : (v(), u(B, { key: 1 }, [
100
100
  i("div", {
101
101
  class: "vfp-min-h-0 vfp-min-w-0 vfp-flex-shrink-0 vfp-w-full vfp-max-h-60 md:vfp-h-full md:vfp-max-h-none",
102
- style: W(b.value)
102
+ style: W(x.value)
103
103
  }, [
104
104
  N(l.$slots, "left", {}, void 0, !0)
105
105
  ], 4),
106
106
  i("div", {
107
107
  role: "separator",
108
108
  "aria-orientation": "vertical",
109
- class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", L.value ? "dragging" : ""]),
109
+ class: U(["split-divider vfp-hidden md:vfp-block vfp-relative vfp-w-1.5 vfp-flex-shrink-0 vfp-cursor-col-resize vfp-transition-colors", z.value ? "dragging" : ""]),
110
110
  style: W(a.value ? void 0 : { display: "none" }),
111
111
  onMousedown: R
112
112
  }, [...c[2] || (c[2] = [
@@ -128,33 +128,33 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
128
128
  },
129
129
  emits: ["toggle", "select", "hover", "leave"],
130
130
  setup(r, { emit: I }) {
131
- const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)), L = C(() => n.selectedPath === n.node.path), z = C(() => {
131
+ const n = r, p = I, w = C(() => ({ paddingLeft: `${n.depth * 14 + 10}px` })), f = C(() => n.expanded.has(n.node.path)), z = C(() => n.selectedPath === n.node.path), y = C(() => {
132
132
  const o = pe({ name: n.node.name, type: "" });
133
133
  return o === "image" ? ye : o === "text" || o === "markdown" || o === "json" || o === "csv" || o === "xml" || o === "subtitle" ? n.node.name.endsWith(".md") || n.node.name.endsWith(".markdown") ? ke : Le : ze;
134
134
  }), _ = (o) => {
135
135
  const t = o.currentTarget.getBoundingClientRect();
136
136
  p("hover", n.node.name || "/", t);
137
- }, x = () => p("leave");
137
+ }, b = () => p("leave");
138
138
  return (o, t) => {
139
- const y = ve("ZipTreeItem");
139
+ const k = ve("ZipTreeItem");
140
140
  return r.node.isDir ? (v(), u("div", Ie, [
141
141
  i("button", {
142
142
  type: "button",
143
143
  class: "tree-row dir-row",
144
144
  style: W(w.value),
145
- onClick: t[0] || (t[0] = (b) => p("toggle", r.node.path)),
145
+ onClick: t[0] || (t[0] = (x) => p("toggle", r.node.path)),
146
146
  onMouseenter: _,
147
- onMouseleave: x
147
+ onMouseleave: b
148
148
  }, [
149
- K(g(Se), {
149
+ j(g(Se), {
150
150
  class: U(["vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0 vfp-transition-transform", { "vfp-rotate-90": f.value }])
151
151
  }, null, 8, ["class"]),
152
152
  (v(), D(q(f.value ? g(Te) : g(_e)), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-amber-300/80" })),
153
153
  i("span", Fe, T(r.node.name || "/"), 1)
154
154
  ], 36),
155
- f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (b) => (v(), D(y, {
156
- key: b.path,
157
- node: b,
155
+ f.value && r.node.children ? (v(!0), u(B, { key: 0 }, Q(r.node.children, (x) => (v(), D(k, {
156
+ key: x.path,
157
+ node: x,
158
158
  depth: r.depth + 1,
159
159
  "selected-path": r.selectedPath,
160
160
  expanded: r.expanded,
@@ -166,29 +166,29 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
166
166
  ])) : (v(), u("button", {
167
167
  key: 1,
168
168
  type: "button",
169
- class: U(["tree-row file-row", { selected: L.value }]),
169
+ class: U(["tree-row file-row", { selected: z.value }]),
170
170
  style: W(w.value),
171
- onClick: t[5] || (t[5] = (b) => p("select", r.node)),
171
+ onClick: t[5] || (t[5] = (x) => p("select", r.node)),
172
172
  onMouseenter: _,
173
- onMouseleave: x
173
+ onMouseleave: b
174
174
  }, [
175
175
  t[6] || (t[6] = i("span", { class: "vfp-w-3.5 vfp-h-3.5 vfp-flex-shrink-0" }, null, -1)),
176
- (v(), D(q(z.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
176
+ (v(), D(q(y.value), { class: "vfp-w-4 vfp-h-4 vfp-flex-shrink-0 vfp-text-fg-tertiary" })),
177
177
  i("span", Ue, T(r.node.name), 1),
178
178
  i("span", Be, T(g(ue)(r.node.size)), 1)
179
179
  ], 38));
180
180
  };
181
181
  }
182
- }), Ke = /* @__PURE__ */ ne(Ne, [["__scopeId", "data-v-124c382d"]]), Pe = {
182
+ }), je = /* @__PURE__ */ ne(Ne, [["__scopeId", "data-v-124c382d"]]), Ke = {
183
183
  key: 0,
184
184
  class: "vfp-renderer-loading"
185
- }, je = { class: "vfp-renderer-loading-content" }, Oe = { class: "vfp-renderer-loading-text" }, Xe = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ve = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ze = {
185
+ }, Pe = { class: "vfp-renderer-loading-content" }, Oe = { class: "vfp-renderer-loading-text" }, Ae = { class: "vfp-w-full vfp-h-full vfp-overflow-auto" }, Ve = { class: "vfp-w-full vfp-h-full vfp-flex vfp-flex-col" }, Ze = {
186
186
  key: 0,
187
187
  class: "vfp-renderer-loading vfp-flex-1"
188
- }, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" }, Je = {
188
+ }, qe = { class: "vfp-renderer-loading-content" }, Ge = { class: "vfp-renderer-loading-text" }, Xe = {
189
189
  key: 1,
190
190
  class: "vfp-flex-1"
191
- }, Ae = {
191
+ }, Je = {
192
192
  key: 2,
193
193
  class: "vfp-flex-1 vfp-flex vfp-items-center vfp-justify-center vfp-text-fg-muted vfp-text-sm vfp-p-6"
194
194
  }, Ye = {
@@ -202,79 +202,79 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
202
202
  },
203
203
  setup(r, { expose: I }) {
204
204
  const n = fe(
205
- () => import("./index-c-pYJEmH.mjs").then((e) => e.a2)
206
- ), p = r, w = new $e(), { t: f } = te(), L = ce(), z = me(), _ = (e) => {
207
- z.error(e.error, e.stage);
208
- }, x = d(null), o = d(null), t = d(!0), y = d(null), b = d(/* @__PURE__ */ new Set([""])), a = d(null), S = d(!1), $ = d(null), R = d(null), E = d(null), l = d(null), c = () => {
205
+ () => import("./index-DBzyeU0G.mjs").then((e) => e.a2)
206
+ ), p = r, w = new $e(), { t: f } = te(), z = ce(), y = me(), _ = (e) => {
207
+ y.error(e.error, e.stage);
208
+ }, b = d(null), o = d(null), t = d(!0), k = d(null), x = d(/* @__PURE__ */ new Set([""])), a = d(null), S = d(!1), $ = d(null), R = d(null), E = d(null), l = d(null), c = () => {
209
209
  var e;
210
210
  (e = a.value) != null && e.blobUrl && URL.revokeObjectURL(a.value.blobUrl);
211
211
  }, F = async () => {
212
- z.begin(p.url), c(), a.value = null, t.value = !0, y.value = null;
212
+ y.begin(p.url), c(), a.value = null, t.value = !0, k.value = null;
213
213
  try {
214
- const e = await L.value(p.url);
214
+ const e = await z.value(p.url);
215
215
  if (!e.ok) throw new he("common.load_failed");
216
- const s = await e.arrayBuffer(), m = await ge(s), k = we(m), h = xe(k);
217
- x.value = m, o.value = h;
216
+ const s = await e.arrayBuffer(), m = await ge(s), L = we(m), h = be(L);
217
+ b.value = m, o.value = h;
218
218
  const M = /* @__PURE__ */ new Set([""]);
219
219
  if (h.children)
220
220
  for (const H of h.children) H.isDir && M.add(H.path);
221
- b.value = M;
221
+ x.value = M, y.ready();
222
222
  } catch (e) {
223
- console.error(e), y.value = f.value("zip.load_failed"), z.error(e);
223
+ console.error(e), k.value = f.value("zip.load_failed"), y.error(e);
224
224
  } finally {
225
225
  t.value = !1;
226
226
  }
227
227
  };
228
- j(() => p.url, (e) => {
228
+ P(() => p.url, (e) => {
229
229
  e && F();
230
230
  }, { immediate: !0 }), Y(() => {
231
231
  c();
232
232
  });
233
- const P = C(() => {
233
+ const K = C(() => {
234
234
  if (!o.value) return null;
235
235
  let e = 0, s = 0, m = 0;
236
- const k = (h) => {
236
+ const L = (h) => {
237
237
  var M;
238
- h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(k)) : (e++, m += h.size);
238
+ h.isDir ? (h.path && s++, (M = h.children) == null || M.forEach(L)) : (e++, m += h.size);
239
239
  };
240
- return k(o.value), { files: e, dirs: s, size: m };
240
+ return L(o.value), { files: e, dirs: s, size: m };
241
241
  });
242
- j(P, () => w.notify()), I({
242
+ P(K, () => w.notify()), I({
243
243
  getToolbarGroups: () => [],
244
244
  onToolbarChange: (e) => w.subscribe(e)
245
245
  });
246
246
  const le = (e) => {
247
- const s = new Set(b.value);
248
- s.has(e) ? s.delete(e) : s.add(e), b.value = s;
247
+ const s = new Set(x.value);
248
+ s.has(e) ? s.delete(e) : s.add(e), x.value = s;
249
249
  }, oe = (e, s) => {
250
250
  const m = typeof window < "u" ? window.innerWidth - 328 : s.right + 8;
251
251
  R.value = { text: e, x: Math.max(8, Math.min(s.right + 8, m)), y: s.top + s.height / 2 };
252
252
  }, ae = () => {
253
253
  R.value = null;
254
254
  }, se = async (e) => {
255
- var s, m, k;
256
- if (!(!x.value || e.isDir || ((s = a.value) == null ? void 0 : s.path) === e.path || l.value === e.path)) {
255
+ var s, m, L;
256
+ if (!(!b.value || e.isDir || ((s = a.value) == null ? void 0 : s.path) === e.path || l.value === e.path)) {
257
257
  l.value = e.path, c(), a.value = null, S.value = !0, $.value = null;
258
258
  try {
259
- const h = J(e.name), M = await be(x.value, e.path, h !== "application/octet-stream" ? h : void 0), H = URL.createObjectURL(M);
259
+ const h = X(e.name), M = await xe(b.value, e.path, h !== "application/octet-stream" ? h : void 0), H = URL.createObjectURL(M);
260
260
  a.value = { path: e.path, name: e.name, size: e.size, blobUrl: H }, (m = E.value) == null || m.switchTab("right");
261
261
  } catch (h) {
262
- console.error(h), $.value = f.value("zip.entry_read_failed"), (k = E.value) == null || k.switchTab("right");
262
+ console.error(h), $.value = f.value("zip.entry_read_failed"), (L = E.value) == null || L.switchTab("right");
263
263
  } finally {
264
264
  S.value = !1, l.value === e.path && (l.value = null);
265
265
  }
266
266
  }
267
- }, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type: J(a.value.name) }] : []);
268
- return (e, s) => t.value ? (v(), u("div", Pe, [
269
- i("div", je, [
267
+ }, ie = C(() => a.value ? [{ name: a.value.name, url: a.value.blobUrl, type: X(a.value.name) }] : []);
268
+ return (e, s) => t.value ? (v(), u("div", Ke, [
269
+ i("div", Pe, [
270
270
  s[0] || (s[0] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
271
271
  i("span", Oe, T(g(f)("common.loading")), 1)
272
272
  ])
273
- ])) : y.value || !o.value ? (v(), D(A, {
273
+ ])) : k.value || !o.value ? (v(), D(J, {
274
274
  key: 1,
275
- message: y.value || g(f)("zip.parse_failed")
275
+ message: k.value || g(f)("zip.parse_failed")
276
276
  }, null, 8, ["message"])) : (v(), u(B, { key: 2 }, [
277
- K(De, {
277
+ j(De, {
278
278
  ref_key: "splitRef",
279
279
  ref: E,
280
280
  "initial-left-width": 280,
@@ -286,15 +286,15 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
286
286
  "right-tab-label": g(f)("toolbar.preview")
287
287
  }, {
288
288
  left: G(() => [
289
- i("div", Xe, [
289
+ i("div", Ae, [
290
290
  (v(!0), u(B, null, Q(o.value.children || [], (m) => {
291
- var k;
292
- return v(), D(Ke, {
291
+ var L;
292
+ return v(), D(je, {
293
293
  key: m.path,
294
294
  node: m,
295
295
  depth: 0,
296
- "selected-path": ((k = a.value) == null ? void 0 : k.path) ?? null,
297
- expanded: b.value,
296
+ "selected-path": ((L = a.value) == null ? void 0 : L.path) ?? null,
297
+ expanded: x.value,
298
298
  onToggle: le,
299
299
  onSelect: se,
300
300
  onHover: oe,
@@ -310,17 +310,17 @@ const Re = { class: "vfp-flex vfp-flex-shrink-0 vfp-border-b vfp-border-line-wea
310
310
  s[1] || (s[1] = i("div", { class: "vfp-renderer-spinner" }, null, -1)),
311
311
  i("span", Ge, T(g(f)("common.loading")), 1)
312
312
  ])
313
- ])) : $.value ? (v(), u("div", Je, [
314
- K(A, { message: $.value }, null, 8, ["message"])
313
+ ])) : $.value ? (v(), u("div", Xe, [
314
+ j(J, { message: $.value }, null, 8, ["message"])
315
315
  ])) : a.value ? (v(), u("div", Ye, [
316
- K(g(n), {
316
+ j(g(n), {
317
317
  mode: "embed",
318
318
  files: ie.value,
319
319
  "current-index": 0,
320
320
  "zip-nesting-depth": r.nestingDepth + 1,
321
321
  onError: _
322
322
  }, null, 8, ["files", "zip-nesting-depth"])
323
- ])) : (v(), u("div", Ae, T(g(f)("zip.select_file")), 1))
323
+ ])) : (v(), u("div", Je, T(g(f)("zip.select_file")), 1))
324
324
  ])
325
325
  ]),
326
326
  _: 1
@@ -1,23 +1,23 @@
1
- import { defineComponent as z, ref as y, watch as T, computed as v, openBlock as r, createElementBlock as o, createElementVNode as s, toDisplayString as a, unref as n, createBlock as A, normalizeClass as B, Fragment as w, renderList as C, createCommentVNode as E } from "vue";
2
- import { u as D, a as I, b as M, o as O, W as p, h as P, e as R } from "./index-c-pYJEmH.mjs";
1
+ import { defineComponent as A, ref as h, watch as T, computed as p, openBlock as r, createElementBlock as o, createElementVNode as s, toDisplayString as a, unref as n, createBlock as D, normalizeClass as B, Fragment as w, renderList as C, createCommentVNode as E } from "vue";
2
+ import { u as I, a as J, b as M, i as O, o as f, f as P, d as R } from "./index-DBzyeU0G.mjs";
3
3
  import { _ as X } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
4
  const Y = {
5
5
  key: 0,
6
6
  class: "vfp-renderer-loading vfp-bg-[#0f0f12]"
7
- }, $ = { class: "vfp-renderer-loading-content" }, j = { class: "vfp-renderer-loading-text" }, q = { class: "content-scroll" }, H = { class: "timeline" }, J = { class: "cues" }, K = { class: "cue-meta" }, Q = { class: "cue-time" }, U = { class: "cue-time" }, Z = { class: "cue-id" }, ee = {
7
+ }, $ = { class: "vfp-renderer-loading-content" }, j = { class: "vfp-renderer-loading-text" }, q = { class: "content-scroll" }, H = { class: "timeline" }, K = { class: "cues" }, Q = { class: "cue-meta" }, U = { class: "cue-time" }, W = { class: "cue-time" }, Z = { class: "cue-id" }, ee = {
8
8
  key: 0,
9
9
  class: "cue-style"
10
10
  }, se = {
11
11
  key: 0,
12
12
  class: "cue-words"
13
- }, te = ["title"], le = { class: "cue-word-time" }, re = { class: "cue-word-text" }, ae = { class: "status-pill" }, oe = /* @__PURE__ */ z({
13
+ }, te = ["title"], le = { class: "cue-word-time" }, re = { class: "cue-word-text" }, ae = { class: "status-pill" }, oe = /* @__PURE__ */ A({
14
14
  __name: "index",
15
15
  props: {
16
16
  url: {},
17
17
  fileName: {}
18
18
  },
19
19
  setup(F, { expose: N }) {
20
- const i = F, { t: u } = D(), L = I(), f = M(), m = y(""), _ = y(!0), d = y(null), S = {
20
+ const i = F, { t: u } = I(), L = J(), d = M(), m = h(""), _ = h(!0), v = h(null), S = {
21
21
  srt: "srt",
22
22
  vtt: "vtt",
23
23
  lrc: "lrc",
@@ -32,16 +32,16 @@ const Y = {
32
32
  return S[t];
33
33
  };
34
34
  T(() => i.url, async () => {
35
- f.begin(i.url), _.value = !0, d.value = null;
35
+ d.begin(i.url), _.value = !0, v.value = null;
36
36
  try {
37
37
  m.value = await P(i.url, { fetcher: L.value });
38
38
  } catch (e) {
39
- console.error(e), d.value = u.value("subtitle.load_failed"), f.error(e);
39
+ console.error(e), v.value = u.value("subtitle.load_failed"), d.error(e);
40
40
  } finally {
41
41
  _.value = !1;
42
42
  }
43
43
  }, { immediate: !0 });
44
- const x = v(() => {
44
+ const x = p(() => {
45
45
  if (!m.value) return { value: null, error: null };
46
46
  try {
47
47
  return { value: O(m.value, G(i.fileName)), error: null };
@@ -49,19 +49,16 @@ const Y = {
49
49
  return console.error(e), { value: null, error: e };
50
50
  }
51
51
  });
52
- T(
53
- () => x.value.error,
54
- (e) => {
55
- e && f.error(e);
56
- }
57
- );
58
- const c = v(() => x.value.value), g = v(() => {
52
+ T(x, (e) => {
53
+ e.error ? d.error(e.error) : e.value && d.ready();
54
+ });
55
+ const c = p(() => x.value.value), y = p(() => {
59
56
  var e, t;
60
57
  return ((e = c.value) == null ? void 0 : e.format) === "lrc" || ((t = c.value) == null ? void 0 : t.format) === "elrc";
61
- }), b = v(() => {
58
+ }), b = p(() => {
62
59
  var e;
63
60
  return ((e = c.value) == null ? void 0 : e.metadata) ?? {};
64
- }), V = (e) => p(e).slice(3, 8);
61
+ }), V = (e) => f(e).slice(3, 8);
65
62
  return N({
66
63
  getToolbarGroups: () => []
67
64
  }), (e, t) => _.value ? (r(), o("div", Y, [
@@ -69,49 +66,49 @@ const Y = {
69
66
  t[0] || (t[0] = s("div", { class: "vfp-renderer-spinner" }, null, -1)),
70
67
  s("span", j, a(n(u)("common.loading")), 1)
71
68
  ])
72
- ])) : d.value || !c.value ? (r(), A(X, {
69
+ ])) : v.value || !c.value ? (r(), D(X, {
73
70
  key: 1,
74
- message: d.value || n(u)("subtitle.parse_failed"),
71
+ message: v.value || n(u)("subtitle.parse_failed"),
75
72
  class: "vfp-bg-[#0f0f12]"
76
73
  }, null, 8, ["message"])) : (r(), o("div", {
77
74
  key: 2,
78
- class: B(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]", g.value ? "flavor-lyric" : "flavor-subtitle"])
75
+ class: B(["vfp-relative vfp-w-full vfp-h-full vfp-bg-[#0f0f12]", y.value ? "flavor-lyric" : "flavor-subtitle"])
79
76
  }, [
80
77
  s("div", q, [
81
78
  s("div", H, [
82
79
  t[3] || (t[3] = s("div", { class: "timeline-line" }, null, -1)),
83
- s("ol", J, [
80
+ s("ol", K, [
84
81
  (r(!0), o(w, null, C(c.value.cues, (l, k) => (r(), o("li", {
85
82
  key: "cue-" + k,
86
83
  class: "cue-row"
87
84
  }, [
88
85
  t[2] || (t[2] = s("div", { class: "cue-dot" }, null, -1)),
89
- s("div", K, [
90
- s("span", Q, a(n(p)(l.start)), 1),
86
+ s("div", Q, [
87
+ s("span", U, a(n(f)(l.start)), 1),
91
88
  t[1] || (t[1] = s("span", { class: "cue-arrow" }, "→", -1)),
92
- s("span", U, a(n(p)(l.end)), 1),
89
+ s("span", W, a(n(f)(l.end)), 1),
93
90
  s("span", Z, "#" + a(l.id ?? k + 1), 1),
94
91
  l.style ? (r(), o("span", ee, a(l.style), 1)) : E("", !0)
95
92
  ]),
96
93
  l.words && l.words.length > 0 ? (r(), o("div", se, [
97
- (r(!0), o(w, null, C(l.words, (h, W) => (r(), o("span", {
98
- key: "w-" + W,
94
+ (r(!0), o(w, null, C(l.words, (g, z) => (r(), o("span", {
95
+ key: "w-" + z,
99
96
  class: "cue-word",
100
- title: n(p)(h.start)
97
+ title: n(f)(g.start)
101
98
  }, [
102
- s("span", le, a(V(h.start)), 1),
103
- s("span", re, a(h.text), 1)
99
+ s("span", le, a(V(g.start)), 1),
100
+ s("span", re, a(g.text), 1)
104
101
  ], 8, te))), 128))
105
102
  ])) : (r(), o("p", {
106
103
  key: 1,
107
- class: B(["cue-text", { lyric: g.value }])
104
+ class: B(["cue-text", { lyric: y.value }])
108
105
  }, a(l.text), 3))
109
106
  ]))), 128))
110
107
  ])
111
108
  ])
112
109
  ]),
113
110
  s("div", ae, [
114
- s("span", null, a(c.value.cues.length) + " " + a(g.value ? n(u)("subtitle.lines") : n(u)("subtitle.cues")), 1),
111
+ s("span", null, a(c.value.cues.length) + " " + a(y.value ? n(u)("subtitle.lines") : n(u)("subtitle.cues")), 1),
115
112
  b.value.length ? (r(), o(w, { key: 0 }, [
116
113
  t[4] || (t[4] = s("span", { class: "dot" }, "·", -1)),
117
114
  s("span", null, a(b.value.length), 1)
@@ -119,7 +116,7 @@ const Y = {
119
116
  ])
120
117
  ], 2));
121
118
  }
122
- }), ve = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-4f53a8e5"]]);
119
+ }), ve = /* @__PURE__ */ R(oe, [["__scopeId", "data-v-f89221c5"]]);
123
120
  export {
124
121
  ve as default
125
122
  };
@@ -1,14 +1,14 @@
1
- import { defineComponent as $, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as h, createBlock as E, normalizeClass as H, normalizeStyle as z, Fragment as C, renderList as G } from "vue";
1
+ import { defineComponent as $, ref as f, computed as d, watch as T, unref as m, openBlock as t, createElementBlock as i, createElementVNode as l, toDisplayString as _, createBlock as E, normalizeClass as H, normalizeStyle as z, Fragment as S, renderList as G } from "vue";
2
2
  import { WrapText as M, Code as P, Eye as W } from "lucide-vue-next";
3
- import { u as D, a as R, b as V, T as j, y as q, s as A, h as I } from "./index-c-pYJEmH.mjs";
4
- import { u as J } from "./useShikiHighlight-C-ztcJBE.mjs";
5
- import { _ as K } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
- import { _ as O } from "./EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs";
7
- import { T as Q } from "./base.types-DaftHyg7.mjs";
8
- const U = {
3
+ import { u as X, a as D, b as R, X as V, S as j, T as q, f as A } from "./index-DBzyeU0G.mjs";
4
+ import { u as I } from "./useShikiHighlight-a_GUszuU.mjs";
5
+ import { _ as J } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
+ import { _ as K } from "./EmptyState.vue_vue_type_script_setup_true_lang-DSQp7H-K.mjs";
7
+ import { T as O } from "./base.types-DaftHyg7.mjs";
8
+ const Q = {
9
9
  key: 0,
10
10
  class: "vfp-renderer-loading"
11
- }, X = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
11
+ }, U = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
12
12
  key: 3,
13
13
  class: "vfp-w-full vfp-h-full vfp-bg-surface-toolbar"
14
14
  }, ee = ["srcdoc", "title"], le = {
@@ -26,26 +26,26 @@ const U = {
26
26
  fileName: {},
27
27
  emptyHint: {}
28
28
  },
29
- setup(y, { expose: L }) {
30
- const v = y, _ = new Q(), { t: s } = D(), N = R(), b = V(), o = f(!0), a = f(!1), r = f(""), p = f(!0), c = f(null), n = d(() => j(v.fileName)), S = d(() => n.value !== "text" ? r.value : ""), { lineHtmls: w, loading: B } = J(S, n), x = d(() => n.value === "html"), F = d(
31
- () => !p.value && !c.value && q(r.value) && A(v.emptyHint, "textual")
29
+ setup(b, { expose: C }) {
30
+ const v = b, w = new O(), { t: s } = X(), L = D(), g = R(), o = f(!0), a = f(!1), r = f(""), p = f(!0), c = f(null), n = d(() => V(v.fileName)), N = d(() => n.value !== "text" ? r.value : ""), { lineHtmls: y, loading: B } = I(N, n), x = d(() => n.value === "html"), F = d(
31
+ () => !p.value && !c.value && j(r.value) && q(v.emptyHint, "textual")
32
32
  );
33
33
  T([o, a, p, x], () => {
34
- _.notify();
34
+ w.notify();
35
35
  }), T(() => v.url, async () => {
36
- b.begin(v.url), p.value = !0, c.value = null;
36
+ g.begin(v.url), p.value = !0, c.value = null;
37
37
  try {
38
- const e = await I(v.url, { fetcher: N.value });
39
- r.value = e;
38
+ const e = await A(v.url, { fetcher: L.value });
39
+ r.value = e, g.ready();
40
40
  } catch (e) {
41
- console.error(e), c.value = s.value("text.load_failed"), b.error(e);
41
+ console.error(e), c.value = s.value("text.load_failed"), g.error(e);
42
42
  } finally {
43
43
  p.value = !1;
44
44
  }
45
45
  }, { immediate: !0 });
46
46
  const k = d(() => r.value.split(`
47
47
  `));
48
- return L({
48
+ return C({
49
49
  getToolbarGroups: () => {
50
50
  const e = [];
51
51
  return e.push({
@@ -74,36 +74,36 @@ const U = {
74
74
  ]
75
75
  }), e;
76
76
  },
77
- onToolbarChange: (e) => _.subscribe(e)
78
- }), (e, u) => p.value || n.value !== "text" && m(B) ? (t(), i("div", U, [
79
- l("div", X, [
77
+ onToolbarChange: (e) => w.subscribe(e)
78
+ }), (e, u) => p.value || n.value !== "text" && m(B) ? (t(), i("div", Q, [
79
+ l("div", U, [
80
80
  u[0] || (u[0] = l("div", { class: "vfp-renderer-spinner" }, null, -1)),
81
- l("span", Y, h(m(s)("common.loading")), 1)
81
+ l("span", Y, _(m(s)("common.loading")), 1)
82
82
  ])
83
- ])) : c.value ? (t(), E(K, {
83
+ ])) : c.value ? (t(), E(J, {
84
84
  key: 1,
85
85
  message: c.value
86
- }, null, 8, ["message"])) : F.value ? (t(), E(O, { key: 2 })) : a.value && n.value === "html" ? (t(), i("div", Z, [
86
+ }, null, 8, ["message"])) : F.value ? (t(), E(K, { key: 2 })) : a.value && n.value === "html" ? (t(), i("div", Z, [
87
87
  l("iframe", {
88
88
  srcdoc: r.value,
89
89
  sandbox: "allow-same-origin",
90
90
  class: "vfp-w-full vfp-h-full vfp-border-0",
91
- title: y.fileName
91
+ title: b.fileName
92
92
  }, null, 8, ee)
93
- ])) : n.value === "text" || m(w).length === 0 ? (t(), i("div", le, [
93
+ ])) : n.value === "text" || m(y).length === 0 ? (t(), i("div", le, [
94
94
  l("pre", {
95
95
  class: H(["vfp-py-6 vfp-px-4 vfp-text-fg-primary vfp-font-mono vfp-text-sm", o.value ? "vfp-whitespace-pre-wrap vfp-break-words" : "vfp-whitespace-pre"])
96
- }, h(r.value), 3)
96
+ }, _(r.value), 3)
97
97
  ])) : (t(), i("div", te, [
98
98
  l("div", {
99
99
  class: H(["vfp-code-block with-line-numbers vfp-w-full", { "no-wrap": !o.value }]),
100
100
  style: z({ gridTemplateRows: `repeat(${k.value.length}, auto) minmax(1.5rem, 1fr)` })
101
101
  }, [
102
- (t(!0), i(C, null, G(k.value, (ne, g) => (t(), i(C, { key: g }, [
103
- l("span", oe, h(g + 1), 1),
102
+ (t(!0), i(S, null, G(k.value, (ne, h) => (t(), i(S, { key: h }, [
103
+ l("span", oe, _(h + 1), 1),
104
104
  l("span", {
105
105
  class: "vfp-code-line",
106
- innerHTML: m(w)[g] ?? ""
106
+ innerHTML: m(y)[h] ?? ""
107
107
  }, null, 8, ae)
108
108
  ], 64))), 128)),
109
109
  u[1] || (u[1] = l("span", { class: "vfp-code-gutter-filler" }, null, -1)),