@eternalheart/vue-file-preview 1.7.0 → 1.7.2

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 (46) 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-Dna6LmVT.mjs} +1 -1
  7. package/lib/chunks/{avifLoader-CAUzjn-d-CnJpGYJ2.mjs → avifLoader-CAUzjn-d-dPsP28D5.mjs} +1 -1
  8. package/lib/chunks/{heicLoader-D_9PukkA-g_dLrWLP.mjs → heicLoader-D_9PukkA-T-k1DSgY.mjs} +1 -1
  9. package/lib/chunks/{index-c-pYJEmH.mjs → index-B5hprvcF.mjs} +1747 -1709
  10. package/lib/chunks/index-BN__EwfT.mjs +333 -0
  11. package/lib/chunks/{index-z9RqL2wI.mjs → index-BPutNVAf.mjs} +453 -453
  12. package/lib/chunks/{index-BfOWoMpY.mjs → index-B_Spz6Wn.mjs} +77 -77
  13. package/lib/chunks/{index-D5IF9F-D.mjs → index-BjHEHkZ8.mjs} +22 -22
  14. package/lib/chunks/{index-LPGxJDnT.mjs → index-BlZ6RmeR.mjs} +18 -18
  15. package/lib/chunks/{index-CrVQPnFj.mjs → index-C95y29OL.mjs} +18 -18
  16. package/lib/chunks/{index-DFeKS8tR.mjs → index-CegPYMyO.mjs} +22 -22
  17. package/lib/chunks/{index-C4hIk6pa.mjs → index-CqOGKCyE.mjs} +2 -2
  18. package/lib/chunks/{index-6XZXYqbp.mjs → index-Cv3Sg87O.mjs} +29 -32
  19. package/lib/chunks/{index-zLQlyNR2.mjs → index-DHba2Axz.mjs} +62 -62
  20. package/lib/chunks/{index-CWPdNhoe.mjs → index-DInI3RTN.mjs} +60 -60
  21. package/lib/chunks/{index-C8lyQPe3.mjs → index-DXzvgRuo.mjs} +3 -3
  22. package/lib/chunks/{index-BPSzwMOC.mjs → index-DcvlMm9Q.mjs} +46 -46
  23. package/lib/chunks/index-Dnyl1HQk.mjs +51 -0
  24. package/lib/chunks/{index-aKiIuKKx.mjs → index-JjVQZbDt.mjs} +50 -50
  25. package/lib/chunks/{index-DZe0BxAB.mjs → index-QPk2c2Tl.mjs} +20 -20
  26. package/lib/chunks/{index-DM8Dfl-m.mjs → index-TZv0MqBH.mjs} +15 -15
  27. package/lib/chunks/{index-BzwJ0VWu.mjs → index-cRhwUlQN.mjs} +33 -33
  28. package/lib/chunks/{index-BYQ9S7Mk.mjs → index-dOxDeWYi.mjs} +30 -30
  29. package/lib/chunks/{index-Bg8poMIm.mjs → index-eNZr1h6f.mjs} +29 -29
  30. package/lib/chunks/{index-Bf94DwQu.mjs → index-oJF-hur2.mjs} +24 -24
  31. package/lib/chunks/{jp2Loader-Dig19xyo-fCO1knZ0.mjs → jp2Loader-Dig19xyo-hrIg_KJ3.mjs} +1 -1
  32. package/lib/chunks/{psdLoader-C0tKUXXl-DihMskai.mjs → psdLoader-C0tKUXXl-B2cJ4s7t.mjs} +1 -1
  33. package/lib/chunks/{rawLoader-C-tPeFAB-BSfDPl-z.mjs → rawLoader-C-tPeFAB-BNV-Wmzr.mjs} +1 -1
  34. package/lib/chunks/{tiffLoader-BlhByX8w-JY5DaTre.mjs → tiffLoader-BlhByX8w-BzSrLE9Y.mjs} +1 -1
  35. package/lib/chunks/{useShikiHighlight-C-ztcJBE.mjs → useShikiHighlight-CpL0RAQg.mjs} +1 -1
  36. package/lib/composables/usePreviewEvents.d.ts +2 -2
  37. package/lib/composables/useRequest.d.ts +8 -2
  38. package/lib/core/events.d.ts +18 -1
  39. package/lib/core/index.d.ts +1 -1
  40. package/lib/index.cjs +54 -54
  41. package/lib/index.css +1 -1
  42. package/lib/index.d.ts +1 -1
  43. package/lib/index.mjs +5 -5
  44. package/package.json +1 -1
  45. package/lib/chunks/index-C41YET0_.mjs +0 -51
  46. package/lib/chunks/index-GFcSJEwj.mjs +0 -330
@@ -1,15 +1,15 @@
1
- import { defineComponent as W, ref as x, onMounted as L, watch as B, onBeforeUnmount as H, openBlock as d, createElementBlock as h, createElementVNode as g, toDisplayString as z, unref as T, createCommentVNode as _, createVNode as R, normalizeStyle as A } from "vue";
2
- import { u as C, a as G, b as N, J as v, m as V, t as F, Q as J, E as O, L as Q, k as q, p as I } from "./index-c-pYJEmH.mjs";
1
+ import { defineComponent as W, ref as g, onMounted as z, watch as L, onBeforeUnmount as B, openBlock as d, createElementBlock as h, createElementVNode as _, toDisplayString as H, unref as T, createCommentVNode as y, createVNode as F, normalizeStyle as R } from "vue";
2
+ import { u as A, a as C, b as G, J as v, L as N, E as U, U as V, z as J, t as O, F as q, p as I } from "./index-B5hprvcF.mjs";
3
3
  import P from "exceljs";
4
- import { S as U } from "./index-CyBXARuf.mjs";
5
- import { _ as X } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
- const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, j = {
4
+ import { S as X } from "./index-CyBXARuf.mjs";
5
+ import { _ as $ } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
6
+ const j = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, K = {
7
7
  key: 0,
8
8
  class: "vfp-renderer-overlay vfp-renderer-loading"
9
- }, K = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
9
+ }, Q = { class: "vfp-renderer-loading-content" }, Y = { class: "vfp-renderer-loading-text" }, Z = {
10
10
  key: 1,
11
11
  class: "vfp-renderer-overlay"
12
- }, ae = /* @__PURE__ */ W({
12
+ }, oe = /* @__PURE__ */ W({
13
13
  __name: "index",
14
14
  props: {
15
15
  url: {},
@@ -23,23 +23,23 @@ const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
23
23
  throw t instanceof TypeError && /sheets/i.test(t.message) ? new v("xlsx.invalid_format") : t;
24
24
  }
25
25
  }
26
- const m = E, { t: o } = C(), S = G(), y = N(), a = x(!0), n = x(null), l = x(null);
27
- let i = null, p = 100, f = null, u = null, c = { width: 0, height: 0 };
28
- const w = () => {
26
+ const p = E, { t: a } = A(), S = C(), m = G(), o = g(!0), n = g(null), l = g(null);
27
+ let i = null, w = 100, f = null, u = null, c = { width: 0, height: 0 };
28
+ const x = () => {
29
29
  if (!l.value) return { width: 800, height: 600 };
30
30
  const e = l.value.clientWidth, t = l.value.clientHeight, r = e > 100 ? e : 800, s = t > 100 ? t : 600;
31
31
  return { width: r, height: s };
32
32
  }, b = () => {
33
33
  if (!l.value || !i) return;
34
34
  l.value.innerHTML = "";
35
- const { width: e, height: t } = w(), r = e < 640;
36
- new U(l.value, {
35
+ const { width: e, height: t } = x(), r = e < 640;
36
+ new X(l.value, {
37
37
  mode: "read",
38
38
  showToolbar: !1,
39
39
  showContextmenu: !1,
40
40
  showGrid: !0,
41
41
  row: {
42
- len: p,
42
+ len: w,
43
43
  height: 25
44
44
  },
45
45
  col: {
@@ -54,84 +54,84 @@ const $ = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
54
54
  }
55
55
  }).loadData(i);
56
56
  }, k = async () => {
57
- if (y.begin(m.url), !!l.value) {
58
- a.value = !0, n.value = null;
57
+ if (m.begin(p.url), !!l.value) {
58
+ o.value = !0, n.value = null;
59
59
  try {
60
- const e = await S.value(m.url, {
60
+ const e = await S.value(p.url, {
61
61
  mode: "cors",
62
62
  credentials: "omit",
63
63
  redirect: "follow"
64
64
  });
65
65
  if (!e.ok)
66
- throw e.status === 404 ? new Error(o.value("xlsx.not_found")) : e.status === 403 ? new v("file.forbidden") : new v("file.load_failed_status", { status: e.status });
67
- const t = V(await e.arrayBuffer());
66
+ throw e.status === 404 ? new Error(a.value("xlsx.not_found")) : e.status === 403 ? new v("file.forbidden") : new v("file.load_failed_status", { status: e.status });
67
+ const t = N(await e.arrayBuffer());
68
68
  let r;
69
69
  if (t.byteLength === 0)
70
70
  r = [{ name: "Sheet1" }];
71
- else if (F(t)) {
72
- const s = J(t);
71
+ else if (U(t)) {
72
+ const s = V(t);
73
73
  if (!s || !Array.isArray(s.sheets))
74
74
  throw new v("xlsx.invalid_legacy_data");
75
- r = O(s);
75
+ r = J(s);
76
76
  } else
77
- r = Q(
77
+ r = O(
78
78
  await M(t)
79
79
  );
80
- i = r.length ? r : [{ name: "Sheet1" }], p = q(r), b(), a.value = !1;
80
+ i = r.length ? r : [{ name: "Sheet1" }], w = q(r), b(), o.value = !1, m.ready();
81
81
  } catch (e) {
82
- console.error(o.value("xlsx.parse_failed") + ":", e);
83
- let t = o.value("xlsx.parse_failed");
84
- e instanceof Error && (t = I(o.value, e)), n.value = t, a.value = !1, y.error(e);
82
+ console.error(a.value("xlsx.parse_failed") + ":", e);
83
+ let t = a.value("xlsx.parse_failed");
84
+ e instanceof Error && (t = I(a.value, e)), n.value = t, o.value = !1, m.error(e);
85
85
  }
86
86
  }
87
87
  };
88
- return L(() => {
88
+ return z(() => {
89
89
  if (!l.value) return;
90
90
  let e = !0;
91
91
  f = new ResizeObserver(() => {
92
92
  if (e) {
93
- e = !1, c = w();
93
+ e = !1, c = x();
94
94
  return;
95
95
  }
96
- const t = w(), r = Math.abs(c.width - t.width), s = Math.abs(c.height - t.height);
96
+ const t = x(), r = Math.abs(c.width - t.width), s = Math.abs(c.height - t.height);
97
97
  r < 10 && s < 10 || (c = t, u !== null && clearTimeout(u), u = window.setTimeout(() => {
98
98
  i && b();
99
99
  }, 500));
100
100
  }), f.observe(l.value), setTimeout(() => {
101
101
  requestAnimationFrame(() => k());
102
102
  }, 100);
103
- }), B(
104
- () => m.url,
103
+ }), L(
104
+ () => p.url,
105
105
  (e) => {
106
106
  e && k();
107
107
  }
108
- ), H(() => {
109
- f && f.disconnect(), u !== null && clearTimeout(u), i = null, p = 100, l.value && (l.value.innerHTML = "");
108
+ ), B(() => {
109
+ f && f.disconnect(), u !== null && clearTimeout(u), i = null, w = 100, l.value && (l.value.innerHTML = "");
110
110
  }), D({
111
111
  getToolbarGroups: () => []
112
- }), (e, t) => (d(), h("div", $, [
113
- a.value ? (d(), h("div", j, [
114
- g("div", K, [
115
- t[0] || (t[0] = g("div", { class: "vfp-renderer-spinner" }, null, -1)),
116
- g("p", Y, z(T(o)("xlsx.loading")), 1)
112
+ }), (e, t) => (d(), h("div", j, [
113
+ o.value ? (d(), h("div", K, [
114
+ _("div", Q, [
115
+ t[0] || (t[0] = _("div", { class: "vfp-renderer-spinner" }, null, -1)),
116
+ _("p", Y, H(T(a)("xlsx.loading")), 1)
117
117
  ])
118
- ])) : _("", !0),
119
- n.value && !a.value ? (d(), h("div", Z, [
120
- R(X, {
121
- message: T(o)("xlsx.load_failed"),
118
+ ])) : y("", !0),
119
+ n.value && !o.value ? (d(), h("div", Z, [
120
+ F($, {
121
+ message: T(a)("xlsx.load_failed"),
122
122
  detail: n.value
123
123
  }, null, 8, ["message", "detail"])
124
- ])) : _("", !0),
125
- n.value ? _("", !0) : (d(), h("div", {
124
+ ])) : y("", !0),
125
+ n.value ? y("", !0) : (d(), h("div", {
126
126
  key: 2,
127
127
  ref_key: "containerRef",
128
128
  ref: l,
129
129
  class: "xlsx-spreadsheet-container vfp-w-full vfp-h-full",
130
- style: A({ opacity: a.value ? 0 : 1 })
130
+ style: R({ opacity: o.value ? 0 : 1 })
131
131
  }, null, 4))
132
132
  ]));
133
133
  }
134
134
  });
135
135
  export {
136
- ae as default
136
+ oe as default
137
137
  };
@@ -0,0 +1,51 @@
1
+ import { defineComponent as m, ref as p, watch as g, openBlock as u, createElementBlock as c, createElementVNode as o, toDisplayString as h, unref as y, createBlock as w } from "vue";
2
+ import { u as k, a as x, b, J as T, s as B } from "./index-B5hprvcF.mjs";
3
+ import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
+ const G = {
5
+ key: 0,
6
+ class: "vfp-renderer-loading"
7
+ }, H = { class: "vfp-renderer-loading-content" }, L = { class: "vfp-renderer-loading-text" }, M = {
8
+ key: 2,
9
+ class: "vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
10
+ }, P = ["innerHTML"], N = /* @__PURE__ */ m({
11
+ __name: "index",
12
+ props: {
13
+ url: {}
14
+ },
15
+ setup(f, { expose: v }) {
16
+ const s = f, { t } = k(), d = x(), l = b(), n = p(""), i = p(!0), r = p(null), _ = async () => {
17
+ l.begin(s.url), i.value = !0, r.value = null, n.value = "";
18
+ try {
19
+ const e = await d.value(s.url);
20
+ if (!e.ok) throw new T("file.load_failed");
21
+ const a = await e.arrayBuffer();
22
+ n.value = await B(a), l.ready();
23
+ } catch (e) {
24
+ console.error(t.value("ppt.parse_failed") + ":", e), r.value = t.value("ppt.parse_failed"), l.error(e);
25
+ } finally {
26
+ i.value = !1;
27
+ }
28
+ };
29
+ return g(() => s.url, (e) => {
30
+ e && _();
31
+ }, { immediate: !0 }), v({
32
+ getToolbarGroups: () => []
33
+ }), (e, a) => i.value ? (u(), c("div", G, [
34
+ o("div", H, [
35
+ a[0] || (a[0] = o("div", { class: "vfp-renderer-spinner" }, null, -1)),
36
+ o("span", L, h(y(t)("common.loading")), 1)
37
+ ])
38
+ ])) : r.value ? (u(), w(E, {
39
+ key: 1,
40
+ message: r.value
41
+ }, null, 8, ["message"])) : (u(), c("div", M, [
42
+ o("div", {
43
+ class: "vfp-legacy-ppt-wrap",
44
+ innerHTML: n.value
45
+ }, null, 8, P)
46
+ ]));
47
+ }
48
+ });
49
+ export {
50
+ N as default
51
+ };
@@ -1,8 +1,8 @@
1
- import { defineComponent as N, ref as v, onMounted as q, watch as A, onBeforeUnmount as I, computed as O, openBlock as p, createElementBlock as h, createElementVNode as E, toDisplayString as S, unref as R, createCommentVNode as b, createVNode as z, normalizeStyle as $ } from "vue";
2
- import { u as G, a as J, b as U, s as j, J as k, V as K, p as Q } from "./index-c-pYJEmH.mjs";
3
- import { init as D } from "pptx-preview";
1
+ import { defineComponent as V, ref as v, onMounted as q, watch as A, onBeforeUnmount as I, computed as O, openBlock as p, createElementBlock as h, createElementVNode as k, toDisplayString as S, unref as C, createCommentVNode as b, createVNode as z, normalizeStyle as $ } from "vue";
2
+ import { u as G, a as J, b as U, T as j, J as D, R as K, p as Q } from "./index-B5hprvcF.mjs";
3
+ import { init as M } from "pptx-preview";
4
4
  import { _ as X } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
- import { _ as Y } from "./EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs";
5
+ import { _ as Y } from "./EmptyState.vue_vue_type_script_setup_true_lang-Dna6LmVT.mjs";
6
6
  const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-full vfp-h-full" }, ee = {
7
7
  key: 0,
8
8
  class: "vfp-renderer-overlay vfp-renderer-loading"
@@ -12,23 +12,23 @@ const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
12
12
  }, le = {
13
13
  key: 2,
14
14
  class: "vfp-renderer-overlay"
15
- }, de = /* @__PURE__ */ N({
15
+ }, de = /* @__PURE__ */ V({
16
16
  __name: "index",
17
17
  props: {
18
18
  url: {},
19
19
  tiled: { type: Boolean, default: !0 },
20
20
  emptyHint: {}
21
21
  },
22
- setup(H, { expose: V }) {
23
- const o = H, { t: s } = G(), W = J(), M = U(), n = v(!0), u = v(null), m = v(!1), w = v(0), i = v(null);
24
- let l = null, y = null, c = null, f = null, _ = { width: 0, height: 0 }, B = 9 / 16;
25
- const g = () => {
22
+ setup(H, { expose: W }) {
23
+ const o = H, { t: s } = G(), P = J(), m = U(), n = v(!0), u = v(null), w = v(!1), y = v(0), i = v(null);
24
+ let l = null, _ = null, c = null, f = null, g = { width: 0, height: 0 }, R = 9 / 16;
25
+ const x = () => {
26
26
  var d;
27
27
  if (!i.value) return { width: 960, height: 540 };
28
- const t = i.value.clientWidth, e = ((d = i.value.parentElement) == null ? void 0 : d.clientWidth) || 0, r = t > 100 ? t : e > 100 ? e : 300, a = Math.floor(r * B);
28
+ const t = i.value.clientWidth, e = ((d = i.value.parentElement) == null ? void 0 : d.clientWidth) || 0, r = t > 100 ? t : e > 100 ? e : 300, a = Math.floor(r * R);
29
29
  return { width: r, height: a };
30
- }, P = async () => {
31
- if (!(!i.value || !c || w.value === 0))
30
+ }, F = async () => {
31
+ if (!(!i.value || !c || y.value === 0))
32
32
  try {
33
33
  if (l)
34
34
  try {
@@ -36,38 +36,38 @@ const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
36
36
  } catch {
37
37
  }
38
38
  i.value.innerHTML = "";
39
- const t = g();
40
- l = D(i.value, {
39
+ const t = x();
40
+ l = M(i.value, {
41
41
  width: t.width,
42
- height: o.tiled ? t.height * w.value : t.height,
42
+ height: o.tiled ? t.height * y.value : t.height,
43
43
  mode: o.tiled ? "list" : "slide"
44
44
  }), await l.preview(c);
45
45
  } catch {
46
46
  }
47
- }, C = async () => {
48
- if (M.begin(o.url), !i.value) return;
49
- n.value = !0, u.value = null, m.value = !1;
47
+ }, B = async () => {
48
+ if (m.begin(o.url), !i.value) return;
49
+ n.value = !0, u.value = null, w.value = !1;
50
50
  let t = window.setTimeout(() => {
51
51
  u.value = s.value("pptx.timeout"), n.value = !1;
52
52
  }, 3e4);
53
53
  try {
54
- const e = await W.value(o.url, {
54
+ const e = await P.value(o.url, {
55
55
  mode: "cors",
56
56
  credentials: "omit",
57
57
  redirect: "follow"
58
58
  });
59
59
  if (!e.ok)
60
- throw e.status === 404 ? new Error(s.value("pptx.not_found")) : e.status === 403 ? new k("file.forbidden") : e.status >= 500 ? new k("file.server_error") : new k("file.load_failed_status", { status: e.status });
60
+ throw e.status === 404 ? new Error(s.value("pptx.not_found")) : e.status === 403 ? new D("file.forbidden") : e.status >= 500 ? new D("file.server_error") : new D("file.load_failed_status", { status: e.status });
61
61
  const r = await e.arrayBuffer();
62
62
  if (r.byteLength === 0) {
63
- t !== null && clearTimeout(t), m.value = !0, n.value = !1;
63
+ t !== null && clearTimeout(t), w.value = !0, n.value = !1, m.ready();
64
64
  return;
65
65
  }
66
- c = r, B = (await K(r)).ratio;
66
+ c = r, R = (await K(r)).ratio;
67
67
  const a = document.createElement("div");
68
68
  a.style.cssText = "position:absolute;left:-9999px;top:-9999px;visibility:hidden", document.body.appendChild(a);
69
69
  try {
70
- const d = D(a, {
70
+ const d = M(a, {
71
71
  width: 100,
72
72
  height: 100,
73
73
  mode: "slide"
@@ -77,68 +77,68 @@ const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
77
77
  } catch {
78
78
  throw new Error(s.value("pptx.invalid_format"));
79
79
  }
80
- const x = d.slideCount;
81
- if (!x || x === 0) throw new Error(s.value("pptx.no_pages"));
82
- d.destroy(), w.value = x, i.value && (i.value.innerHTML = "");
83
- const T = g();
84
- l = D(i.value, {
85
- width: T.width,
86
- height: o.tiled ? T.height * x : T.height,
80
+ const T = d.slideCount;
81
+ if (!T || T === 0) throw new Error(s.value("pptx.no_pages"));
82
+ d.destroy(), y.value = T, i.value && (i.value.innerHTML = "");
83
+ const E = x();
84
+ l = M(i.value, {
85
+ width: E.width,
86
+ height: o.tiled ? E.height * T : E.height,
87
87
  mode: o.tiled ? "list" : "slide"
88
- }), await l.preview(r), t !== null && (clearTimeout(t), t = null), n.value = !1;
88
+ }), await l.preview(r), t !== null && (clearTimeout(t), t = null), n.value = !1, m.ready();
89
89
  } finally {
90
90
  document.body.contains(a) && document.body.removeChild(a);
91
91
  }
92
92
  } catch (e) {
93
93
  t !== null && clearTimeout(t);
94
94
  let r = s.value("pptx.parse_failed");
95
- e instanceof Error ? r = Q(s.value, e) : typeof e == "string" && (r = e), u.value = r, n.value = !1, M.error(e);
95
+ e instanceof Error ? r = Q(s.value, e) : typeof e == "string" && (r = e), u.value = r, n.value = !1, m.error(e);
96
96
  }
97
97
  };
98
98
  q(() => {
99
99
  if (!i.value) return;
100
100
  let t = !0;
101
- y = new ResizeObserver(() => {
101
+ _ = new ResizeObserver(() => {
102
102
  if (t) {
103
- t = !1, _ = g();
103
+ t = !1, g = x();
104
104
  return;
105
105
  }
106
- const e = g(), r = Math.abs(_.width - e.width), a = Math.abs(_.height - e.height);
107
- r < 10 && a < 10 || (_ = e, f !== null && clearTimeout(f), f = window.setTimeout(() => {
108
- l && c && P();
106
+ const e = x(), r = Math.abs(g.width - e.width), a = Math.abs(g.height - e.height);
107
+ r < 10 && a < 10 || (g = e, f !== null && clearTimeout(f), f = window.setTimeout(() => {
108
+ l && c && F();
109
109
  }, 800));
110
- }), y.observe(i.value), setTimeout(() => {
111
- requestAnimationFrame(() => requestAnimationFrame(() => C()));
110
+ }), _.observe(i.value), setTimeout(() => {
111
+ requestAnimationFrame(() => requestAnimationFrame(() => B()));
112
112
  }, 150);
113
113
  }), A(
114
114
  () => o.url,
115
115
  (t) => {
116
- t && C();
116
+ t && B();
117
117
  }
118
118
  ), I(() => {
119
- if (y && y.disconnect(), f !== null && clearTimeout(f), c = null, w.value = 0, l)
119
+ if (_ && _.disconnect(), f !== null && clearTimeout(f), c = null, y.value = 0, l)
120
120
  try {
121
121
  l.destroy();
122
122
  } catch {
123
123
  }
124
124
  l = null;
125
125
  });
126
- const F = () => [], L = O(() => j(o.emptyHint, "structured"));
127
- return V({
128
- getToolbarGroups: F
126
+ const L = () => [], N = O(() => j(o.emptyHint, "structured"));
127
+ return W({
128
+ getToolbarGroups: L
129
129
  }), (t, e) => (p(), h("div", Z, [
130
130
  n.value ? (p(), h("div", ee, [
131
- E("div", te, [
132
- e[0] || (e[0] = E("div", { class: "vfp-renderer-spinner" }, null, -1)),
133
- E("p", re, S(R(s)("pptx.loading")), 1)
131
+ k("div", te, [
132
+ e[0] || (e[0] = k("div", { class: "vfp-renderer-spinner" }, null, -1)),
133
+ k("p", re, S(C(s)("pptx.loading")), 1)
134
134
  ])
135
135
  ])) : b("", !0),
136
- m.value && !n.value && L.value ? (p(), h("div", ie, [
136
+ w.value && !n.value && N.value ? (p(), h("div", ie, [
137
137
  z(Y)
138
138
  ])) : b("", !0),
139
139
  u.value && !n.value ? (p(), h("div", le, [
140
140
  z(X, {
141
- message: R(s)("pptx.load_failed"),
141
+ message: C(s)("pptx.load_failed"),
142
142
  detail: u.value
143
143
  }, null, 8, ["message", "detail"])
144
144
  ])) : b("", !0),
@@ -147,7 +147,7 @@ const Z = { class: "vfp-relative vfp-flex vfp-flex-col vfp-items-center vfp-w-fu
147
147
  ref_key: "containerRef",
148
148
  ref: i,
149
149
  class: "pptx-wrapper vfp-w-full vfp-max-w-full md:vfp-max-w-6xl",
150
- style: $({ opacity: n.value || m.value ? 0 : 1 })
150
+ style: $({ opacity: n.value || w.value ? 0 : 1 })
151
151
  }, null, 4))
152
152
  ]));
153
153
  }
@@ -1,6 +1,6 @@
1
- import { defineComponent as M, ref as u, watch as D, computed as H, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as v, unref as m, createBlock as P, normalizeStyle as B, Fragment as k, renderList as E } from "vue";
2
- import { u as F, a as G, b as N, h as X } from "./index-c-pYJEmH.mjs";
3
- import { u as j } from "./useShikiHighlight-C-ztcJBE.mjs";
1
+ import { defineComponent as M, ref as u, watch as D, computed as H, openBlock as l, createElementBlock as a, createElementVNode as t, toDisplayString as m, unref as g, createBlock as P, normalizeStyle as B, Fragment as k, renderList as E } from "vue";
2
+ import { u as F, a as G, b as N, f as X } from "./index-B5hprvcF.mjs";
3
+ import { u as j } from "./useShikiHighlight-CpL0RAQg.mjs";
4
4
  import { _ as q } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
5
5
  const A = {
6
6
  key: 0,
@@ -20,16 +20,16 @@ const A = {
20
20
  fileName: {}
21
21
  },
22
22
  setup(x, { expose: b }) {
23
- const f = x, { t: g } = F(), S = G(), _ = N(), i = u(""), d = u(!0), c = u(null), T = u("xml"), { lineHtmls: h } = j(i, T), $ = (e) => {
23
+ const f = x, { t: _ } = F(), S = G(), d = N(), i = u(""), v = u(!0), c = u(null), T = u("xml"), { lineHtmls: h } = j(i, T), $ = (e) => {
24
24
  const r = " ", o = /(>)(<)(\/*)/g, s = e.replace(o, `$1
25
25
  $2$3`);
26
26
  let n = 0;
27
27
  return s.split(`
28
28
  `).map((p) => {
29
- let y = 0;
30
- /^<\/\w/.test(p) ? n = Math.max(n - 1, 0) : /^<\w[^>]*[^/]>.*$/.test(p) && !/<.+<\/.+>$/.test(p) && (y = 1);
29
+ let w = 0;
30
+ /^<\/\w/.test(p) ? n = Math.max(n - 1, 0) : /^<\w[^>]*[^/]>.*$/.test(p) && !/<.+<\/.+>$/.test(p) && (w = 1);
31
31
  const L = r.repeat(n) + p;
32
- return n += y, L;
32
+ return n += w, L;
33
33
  }).join(`
34
34
  `);
35
35
  }, z = (e) => {
@@ -43,40 +43,40 @@ $2$3`);
43
43
  }
44
44
  };
45
45
  D(() => f.url, async () => {
46
- _.begin(f.url), d.value = !0, c.value = null;
46
+ d.begin(f.url), v.value = !0, c.value = null;
47
47
  try {
48
48
  const e = await X(f.url, { fetcher: S.value });
49
- i.value = z(e);
49
+ i.value = z(e), d.ready();
50
50
  } catch (e) {
51
- console.error(e), c.value = g.value("xml.load_failed"), _.error(e);
51
+ console.error(e), c.value = _.value("xml.load_failed"), d.error(e);
52
52
  } finally {
53
- d.value = !1;
53
+ v.value = !1;
54
54
  }
55
55
  }, { immediate: !0 });
56
- const w = H(() => i.value.split(`
56
+ const y = H(() => i.value.split(`
57
57
  `));
58
58
  return b({
59
59
  getToolbarGroups: () => []
60
- }), (e, r) => d.value ? (l(), a("div", A, [
60
+ }), (e, r) => v.value ? (l(), a("div", A, [
61
61
  t("div", C, [
62
62
  r[0] || (r[0] = t("div", { class: "vfp-renderer-spinner" }, null, -1)),
63
- t("span", I, v(m(g)("common.loading")), 1)
63
+ t("span", I, m(g(_)("common.loading")), 1)
64
64
  ])
65
65
  ])) : c.value ? (l(), P(q, {
66
66
  key: 1,
67
67
  message: c.value
68
- }, null, 8, ["message"])) : m(h).length === 0 ? (l(), a("div", O, [
69
- t("pre", R, v(i.value), 1)
68
+ }, null, 8, ["message"])) : g(h).length === 0 ? (l(), a("div", O, [
69
+ t("pre", R, m(i.value), 1)
70
70
  ])) : (l(), a("div", V, [
71
71
  t("div", {
72
72
  class: "vfp-code-block with-line-numbers vfp-w-full",
73
- style: B({ gridTemplateRows: `repeat(${w.value.length}, auto) minmax(1.5rem, 1fr)` })
73
+ style: B({ gridTemplateRows: `repeat(${y.value.length}, auto) minmax(1.5rem, 1fr)` })
74
74
  }, [
75
- (l(!0), a(k, null, E(w.value, (o, s) => (l(), a(k, { key: s }, [
76
- t("span", J, v(s + 1), 1),
75
+ (l(!0), a(k, null, E(y.value, (o, s) => (l(), a(k, { key: s }, [
76
+ t("span", J, m(s + 1), 1),
77
77
  t("span", {
78
78
  class: "vfp-code-line",
79
- innerHTML: m(h)[s] ?? ""
79
+ innerHTML: g(h)[s] ?? ""
80
80
  }, null, 8, K)
81
81
  ], 64))), 128)),
82
82
  r[1] || (r[1] = t("span", { class: "vfp-code-gutter-filler" }, null, -1)),
@@ -1,5 +1,5 @@
1
- import { defineComponent as m, ref as c, watch as h, openBlock as i, createElementBlock as u, createElementVNode as o, toDisplayString as g, unref as y, createBlock as w } from "vue";
2
- import { u as x, a as k, b, J as T, U as B } from "./index-c-pYJEmH.mjs";
1
+ import { defineComponent as m, ref as i, watch as h, openBlock as f, createElementBlock as u, createElementVNode as o, toDisplayString as g, unref as y, createBlock as w } from "vue";
2
+ import { u as x, a as k, b, J as T, q as B } from "./index-B5hprvcF.mjs";
3
3
  import { _ as E } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
4
4
  const D = {
5
5
  key: 0,
@@ -7,41 +7,41 @@ const D = {
7
7
  }, G = { class: "vfp-renderer-loading-content" }, H = { class: "vfp-renderer-loading-text" }, L = {
8
8
  key: 2,
9
9
  class: "vfp-docx-container vfp-w-full vfp-h-full vfp-overflow-auto vfp-py-6 vfp-px-4"
10
- }, M = { class: "vfp-flex vfp-flex-col vfp-items-center" }, U = { class: "vfp-legacy-doc-paper" }, C = ["innerHTML"], S = /* @__PURE__ */ m({
10
+ }, M = { class: "vfp-flex vfp-flex-col vfp-items-center" }, N = { class: "vfp-legacy-doc-paper" }, q = ["innerHTML"], S = /* @__PURE__ */ m({
11
11
  __name: "index",
12
12
  props: {
13
13
  url: {}
14
14
  },
15
- setup(p, { expose: d }) {
16
- const a = p, { t } = x(), v = k(), f = b(), l = c(""), n = c(!0), r = c(null), _ = async () => {
17
- f.begin(a.url), n.value = !0, r.value = null, l.value = "";
15
+ setup(d, { expose: p }) {
16
+ const a = d, { t } = x(), v = k(), l = b(), n = i(""), c = i(!0), r = i(null), _ = async () => {
17
+ l.begin(a.url), c.value = !0, r.value = null, n.value = "";
18
18
  try {
19
19
  const e = await v.value(a.url);
20
20
  if (!e.ok) throw new T("file.load_failed");
21
21
  const s = await e.arrayBuffer();
22
- l.value = await B(s);
22
+ n.value = await B(s), l.ready();
23
23
  } catch (e) {
24
- console.error(t.value("doc.parse_failed") + ":", e), r.value = t.value("doc.parse_failed"), f.error(e);
24
+ console.error(t.value("doc.parse_failed") + ":", e), r.value = t.value("doc.parse_failed"), l.error(e);
25
25
  } finally {
26
- n.value = !1;
26
+ c.value = !1;
27
27
  }
28
28
  };
29
29
  return h(() => a.url, (e) => {
30
30
  e && _();
31
- }, { immediate: !0 }), d({
31
+ }, { immediate: !0 }), p({
32
32
  getToolbarGroups: () => []
33
- }), (e, s) => n.value ? (i(), u("div", D, [
33
+ }), (e, s) => c.value ? (f(), u("div", D, [
34
34
  o("div", G, [
35
35
  s[0] || (s[0] = o("div", { class: "vfp-renderer-spinner" }, null, -1)),
36
36
  o("span", H, g(y(t)("common.loading")), 1)
37
37
  ])
38
- ])) : r.value ? (i(), w(E, {
38
+ ])) : r.value ? (f(), w(E, {
39
39
  key: 1,
40
40
  message: r.value
41
- }, null, 8, ["message"])) : (i(), u("div", L, [
41
+ }, null, 8, ["message"])) : (f(), u("div", L, [
42
42
  o("div", M, [
43
- o("div", U, [
44
- o("div", { innerHTML: l.value }, null, 8, C)
43
+ o("div", N, [
44
+ o("div", { innerHTML: n.value }, null, 8, q)
45
45
  ])
46
46
  ])
47
47
  ]));