@eternalheart/vue-file-preview 1.6.13 → 1.7.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +2 -0
- package/README.zh-CN.md +2 -0
- package/lib/FilePreviewContent.vue.d.ts +17 -6
- package/lib/FilePreviewEmbed.vue.d.ts +14 -6
- package/lib/FilePreviewModal.vue.d.ts +14 -6
- package/lib/chunks/{EmptyState.vue_vue_type_script_setup_true_lang-C7qk6wj0.mjs → EmptyState.vue_vue_type_script_setup_true_lang--ZOobbGi.mjs} +1 -1
- package/lib/chunks/{avifLoader-CAUzjn-d-C0KRpetN.mjs → avifLoader-CAUzjn-d-CnJpGYJ2.mjs} +1 -1
- package/lib/chunks/{heicLoader-D_9PukkA-Czof_5FJ.mjs → heicLoader-D_9PukkA-g_dLrWLP.mjs} +1 -1
- package/lib/chunks/index-6XZXYqbp.mjs +125 -0
- package/lib/chunks/{index-B21EAyWz.mjs → index-BPSzwMOC.mjs} +51 -51
- package/lib/chunks/index-BYQ9S7Mk.mjs +104 -0
- package/lib/chunks/{index-8Vpbg2kS.mjs → index-Bf94DwQu.mjs} +105 -104
- package/lib/chunks/index-BfOWoMpY.mjs +359 -0
- package/lib/chunks/index-Bg8poMIm.mjs +117 -0
- package/lib/chunks/index-BzwJ0VWu.mjs +108 -0
- package/lib/chunks/index-C41YET0_.mjs +51 -0
- package/lib/chunks/{index-BvBqDq3O.mjs → index-C4hIk6pa.mjs} +2023 -2023
- package/lib/chunks/{index-BASg1cr4.mjs → index-C8lyQPe3.mjs} +1018 -1018
- package/lib/chunks/{index-C9mAajbD.mjs → index-CWPdNhoe.mjs} +200 -200
- package/lib/chunks/{index-BuqPb5mP.mjs → index-CrVQPnFj.mjs} +112 -112
- package/lib/chunks/{index-D30L8tm9.mjs → index-D5IF9F-D.mjs} +57 -57
- package/lib/chunks/{index-DN4Ui0Gh.mjs → index-DFeKS8tR.mjs} +120 -120
- package/lib/chunks/index-DM8Dfl-m.mjs +52 -0
- package/lib/chunks/index-DZe0BxAB.mjs +90 -0
- package/lib/chunks/{index-BlrFFeqc.mjs → index-GFcSJEwj.mjs} +75 -75
- package/lib/chunks/{index-Dkro_8Fy.mjs → index-LPGxJDnT.mjs} +32 -32
- package/lib/chunks/index-aKiIuKKx.mjs +157 -0
- package/lib/chunks/{index-DZZN3kYi.mjs → index-c-pYJEmH.mjs} +1589 -1394
- package/lib/chunks/{index-CxKZKUJj.mjs → index-z9RqL2wI.mjs} +1651 -1651
- package/lib/chunks/index-zLQlyNR2.mjs +383 -0
- package/lib/chunks/{jp2Loader-Dig19xyo-CKUaGhPl.mjs → jp2Loader-Dig19xyo-fCO1knZ0.mjs} +1 -1
- package/lib/chunks/{psdLoader-C0tKUXXl-CYWoQis5.mjs → psdLoader-C0tKUXXl-DihMskai.mjs} +1 -1
- package/lib/chunks/{rawLoader-C-tPeFAB-C35zC8nZ.mjs → rawLoader-C-tPeFAB-BSfDPl-z.mjs} +5 -5
- package/lib/chunks/{tiffLoader-BlhByX8w-BOxg_Du5.mjs → tiffLoader-BlhByX8w-JY5DaTre.mjs} +1 -1
- package/lib/chunks/{useShikiHighlight-BPmcxA-h.mjs → useShikiHighlight-C-ztcJBE.mjs} +1 -1
- package/lib/composables/useAudioPlayer.d.ts +1 -1
- package/lib/composables/usePreviewEvents.d.ts +27 -0
- package/lib/composables/useRequest.d.ts +16 -4
- package/lib/composables/useThemeMode.d.ts +1 -1
- package/lib/composables/useTranslator.d.ts +2 -2
- package/lib/core/events.d.ts +52 -0
- package/lib/core/i18n/index.d.ts +29 -0
- package/lib/core/i18n/messages/en-US.d.ts +5 -0
- package/lib/core/i18n/messages/index.d.ts +9 -0
- package/lib/core/i18n/messages/zh-CN.d.ts +5 -0
- package/lib/core/i18n/types.d.ts +23 -0
- package/lib/core/index.d.ts +34 -0
- package/lib/core/loaders/avifLoader.d.ts +22 -0
- package/lib/core/loaders/heicLoader.d.ts +21 -0
- package/lib/core/loaders/jp2Loader.d.ts +16 -0
- package/lib/core/loaders/jp2Worker.d.ts +1 -0
- package/lib/core/loaders/psdLoader.d.ts +14 -0
- package/lib/core/loaders/rawLoader.d.ts +14 -0
- package/lib/core/loaders/registry.d.ts +32 -0
- package/lib/core/loaders/tiffLoader.d.ts +28 -0
- package/lib/core/loaders/types.d.ts +56 -0
- package/lib/core/types.d.ts +89 -0
- package/lib/core/utils/csvParser.d.ts +31 -0
- package/lib/core/utils/emptyState.d.ts +28 -0
- package/lib/core/utils/excelDataConverter.d.ts +61 -0
- package/lib/core/utils/fileNormalizer.d.ts +21 -0
- package/lib/core/utils/fileType.d.ts +21 -0
- package/lib/core/utils/legacy-office/doc.d.ts +25 -0
- package/lib/core/utils/legacy-office/index.d.ts +8 -0
- package/lib/core/utils/legacy-office/ole.d.ts +8 -0
- package/lib/core/utils/legacy-office/ppt.d.ts +79 -0
- package/lib/core/utils/legacy-office/xls.d.ts +28 -0
- package/lib/core/utils/mimeTypes.d.ts +29 -0
- package/lib/core/utils/ooxml/docx.d.ts +17 -0
- package/lib/core/utils/ooxml/index.d.ts +4 -0
- package/lib/core/utils/ooxml/pptx.d.ts +7 -0
- package/lib/core/utils/ooxml/xml.d.ts +15 -0
- package/lib/core/utils/ooxml/zip.d.ts +3 -0
- package/lib/core/utils/pdfWorker.d.ts +61 -0
- package/lib/core/utils/previewMode.d.ts +7 -0
- package/lib/core/utils/request.d.ts +49 -0
- package/lib/core/utils/subtitleParser.d.ts +44 -0
- package/lib/core/utils/textDecoder.d.ts +30 -0
- package/lib/core/utils/uint8ArrayPolyfill.d.ts +18 -0
- package/lib/core/utils/zipReader.d.ts +51 -0
- package/lib/core/workers/imageDecoder.worker.d.ts +31 -0
- package/lib/core/workers/workerClient.d.ts +14 -0
- package/lib/i18n/localeKey.d.ts +1 -1
- package/lib/index.cjs +60 -60
- package/lib/index.css +1 -1
- package/lib/index.d.ts +11 -9
- package/lib/index.mjs +15 -12
- package/lib/renderers/Audio/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/index.vue.d.ts +1 -1
- package/lib/renderers/Cad/toolbar.d.ts +2 -2
- package/lib/renderers/Csv/index.vue.d.ts +1 -1
- package/lib/renderers/Doc/index.vue.d.ts +1 -1
- package/lib/renderers/Docx/index.vue.d.ts +1 -1
- package/lib/renderers/Epub/index.vue.d.ts +1 -1
- package/lib/renderers/Font/index.vue.d.ts +1 -1
- package/lib/renderers/Image/index.vue.d.ts +2 -2
- package/lib/renderers/Json/index.vue.d.ts +2 -2
- package/lib/renderers/Markdown/index.vue.d.ts +1 -1
- package/lib/renderers/Mobi/index.vue.d.ts +1 -1
- package/lib/renderers/Msg/index.vue.d.ts +1 -1
- package/lib/renderers/Pdf/index.vue.d.ts +1 -1
- package/lib/renderers/Ppt/index.vue.d.ts +1 -1
- package/lib/renderers/Pptx/index.vue.d.ts +2 -2
- package/lib/renderers/Subtitle/index.vue.d.ts +1 -1
- package/lib/renderers/Text/index.vue.d.ts +2 -2
- package/lib/renderers/Unsupported/index.vue.d.ts +1 -1
- package/lib/renderers/Video/index.vue.d.ts +1 -1
- package/lib/renderers/Xlsx/index.vue.d.ts +2 -2
- package/lib/renderers/Xml/index.vue.d.ts +1 -1
- package/lib/renderers/Zip/TreeItem.vue.d.ts +1 -1
- package/lib/renderers/Zip/index.vue.d.ts +1 -1
- package/lib/renderers/base.types.d.ts +1 -1
- package/lib/renderers/registry.d.ts +1 -1
- package/lib/types.d.ts +3 -3
- package/package.json +2 -2
- package/lib/chunks/index--612Smof.mjs +0 -383
- package/lib/chunks/index-BB0i4QqI.mjs +0 -117
- package/lib/chunks/index-BVdrGK3Q.mjs +0 -356
- package/lib/chunks/index-Bp9CuvMZ.mjs +0 -157
- package/lib/chunks/index-Bxpf9v5j.mjs +0 -104
- package/lib/chunks/index-CDg6vIbT.mjs +0 -51
- package/lib/chunks/index-CWE-hKSs.mjs +0 -90
- package/lib/chunks/index-CY3xzGgt.mjs +0 -108
- package/lib/chunks/index-VdzIFJJW.mjs +0 -118
- package/lib/chunks/index-aoXgVLBb.mjs +0 -52
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
import { defineComponent as
|
|
2
|
-
import { u as
|
|
3
|
-
import { List as
|
|
1
|
+
import { defineComponent as ge, ref as u, watch as ce, onMounted as ve, onBeforeUnmount as de, openBlock as N, createElementBlock as D, createBlock as Ne, createCommentVNode as W, createElementVNode as c, toDisplayString as me, unref as B, normalizeStyle as U, createVNode as be, h as R } from "vue";
|
|
2
|
+
import { u as Re, a as ze, b as Ae, J as he, e as Le } from "./index-c-pYJEmH.mjs";
|
|
3
|
+
import { List as Pe, ChevronLeft as Fe, ChevronRight as He, Minimize2 as $e, Maximize2 as De, X as We } from "lucide-vue-next";
|
|
4
4
|
import "foliate-js/view.js";
|
|
5
|
-
import { _ as
|
|
6
|
-
import { T as
|
|
7
|
-
const
|
|
5
|
+
import { _ as Be } from "./RendererError.vue_vue_type_script_setup_true_lang-FmkMQHB8.mjs";
|
|
6
|
+
import { T as Ue } from "./base.types-DaftHyg7.mjs";
|
|
7
|
+
const je = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-center vfp-bg-surface-1 vfp-overflow-hidden" }, qe = {
|
|
8
8
|
key: 1,
|
|
9
9
|
class: "vfp-absolute vfp-inset-0 vfp-renderer-loading vfp-z-10"
|
|
10
|
-
},
|
|
10
|
+
}, Ge = { class: "vfp-renderer-loading-content" }, Ve = { class: "vfp-renderer-loading-text" }, Xe = { class: "vfp-flex vfp-items-center vfp-justify-between vfp-px-4 vfp-py-3 vfp-border-b vfp-border-line-weak vfp-flex-shrink-0" }, Oe = { class: "vfp-text-fg-primary vfp-font-medium vfp-text-sm" }, Je = { class: "vfp-flex-1 vfp-overflow-y-auto vfp-py-4 vfp-px-1" }, xe = ge({
|
|
11
11
|
name: "MobiTocList",
|
|
12
12
|
props: {
|
|
13
13
|
items: { type: Array, required: !0 },
|
|
@@ -16,14 +16,14 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
16
16
|
},
|
|
17
17
|
emits: ["select"],
|
|
18
18
|
render() {
|
|
19
|
-
return
|
|
19
|
+
return R(
|
|
20
20
|
"ul",
|
|
21
21
|
{ style: { listStyle: "none", padding: 0, margin: this.depth > 0 ? "0 0 0 16px" : 0 } },
|
|
22
22
|
this.items.map(
|
|
23
23
|
(l, j) => {
|
|
24
|
-
var
|
|
25
|
-
return
|
|
26
|
-
l.href ?
|
|
24
|
+
var z, q, G;
|
|
25
|
+
return R("li", { key: `${l.href ?? l.label}-${j}` }, [
|
|
26
|
+
l.href ? R(
|
|
27
27
|
"button",
|
|
28
28
|
{
|
|
29
29
|
onClick: () => this.$emit("select", l.href),
|
|
@@ -34,13 +34,13 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
34
34
|
title: l.label,
|
|
35
35
|
style: "background: none; border: none; cursor: pointer"
|
|
36
36
|
},
|
|
37
|
-
(
|
|
38
|
-
) :
|
|
37
|
+
(z = l.label) == null ? void 0 : z.trim()
|
|
38
|
+
) : R(
|
|
39
39
|
"div",
|
|
40
40
|
{ class: "vfp-w-full vfp-py-2 vfp-px-3 vfp-text-sm vfp-text-fg-tertiary vfp-truncate" },
|
|
41
41
|
(q = l.label) == null ? void 0 : q.trim()
|
|
42
42
|
),
|
|
43
|
-
(G = l.subitems) != null && G.length ?
|
|
43
|
+
(G = l.subitems) != null && G.length ? R(xe, {
|
|
44
44
|
items: l.subitems,
|
|
45
45
|
activeHref: this.activeHref,
|
|
46
46
|
depth: this.depth + 1,
|
|
@@ -51,13 +51,13 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
51
51
|
)
|
|
52
52
|
);
|
|
53
53
|
}
|
|
54
|
-
}),
|
|
55
|
-
...
|
|
54
|
+
}), Ke = { name: "MobiRenderer" }, Qe = /* @__PURE__ */ ge({
|
|
55
|
+
...Ke,
|
|
56
56
|
props: {
|
|
57
57
|
url: {}
|
|
58
58
|
},
|
|
59
59
|
setup(l, { expose: j }) {
|
|
60
|
-
const
|
|
60
|
+
const z = `
|
|
61
61
|
@namespace epub "http://www.idpf.org/2007/ops";
|
|
62
62
|
:root {
|
|
63
63
|
--theme-bg-color: #ffffff;
|
|
@@ -101,28 +101,28 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
101
101
|
} finally {
|
|
102
102
|
a !== void 0 && window.clearTimeout(a);
|
|
103
103
|
}
|
|
104
|
-
},
|
|
104
|
+
}, k = l, Y = new Ue(), { t: f } = Re(), ye = ze(), Z = Ae(), X = u(null);
|
|
105
105
|
let e = null, O = 1;
|
|
106
|
-
const
|
|
107
|
-
ce([
|
|
106
|
+
const h = u(1), T = u(1), g = u(!0), x = u(null), y = u([]), n = u(!1), E = u(""), v = u(!1);
|
|
107
|
+
ce([h, T, v, n, g, () => y.value.length], () => {
|
|
108
108
|
Y.notify();
|
|
109
109
|
});
|
|
110
110
|
const A = (o, t) => {
|
|
111
111
|
Number.isFinite(t) && t > 0 && (O = t);
|
|
112
112
|
const a = Number.isFinite(o) ? o : 0;
|
|
113
|
-
|
|
114
|
-
},
|
|
113
|
+
h.value = Math.max(1, a + 1), T.value = O;
|
|
114
|
+
}, _e = () => {
|
|
115
115
|
e == null || e.prev().catch(() => {
|
|
116
116
|
});
|
|
117
|
-
},
|
|
117
|
+
}, we = () => {
|
|
118
118
|
e == null || e.next().catch(() => {
|
|
119
119
|
});
|
|
120
|
-
}, we = () => {
|
|
121
|
-
n.value = !n.value;
|
|
122
120
|
}, ke = () => {
|
|
121
|
+
n.value = !n.value;
|
|
122
|
+
}, Te = () => {
|
|
123
123
|
v.value = !v.value, e != null && e.renderer && e.renderer.setAttribute("max-inline-size", v.value ? "9999" : "720");
|
|
124
|
-
},
|
|
125
|
-
|
|
124
|
+
}, Ee = (o) => {
|
|
125
|
+
E.value = o, n.value = !1, e == null || e.goTo(o).catch(() => {
|
|
126
126
|
});
|
|
127
127
|
};
|
|
128
128
|
j({
|
|
@@ -131,9 +131,9 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
131
131
|
items: [
|
|
132
132
|
{
|
|
133
133
|
type: "button",
|
|
134
|
-
icon:
|
|
135
|
-
tooltip:
|
|
136
|
-
action:
|
|
134
|
+
icon: Pe,
|
|
135
|
+
tooltip: f.value("toolbar.toc"),
|
|
136
|
+
action: ke,
|
|
137
137
|
disabled: y.value.length === 0,
|
|
138
138
|
active: n.value
|
|
139
139
|
}
|
|
@@ -143,22 +143,22 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
143
143
|
items: [
|
|
144
144
|
{
|
|
145
145
|
type: "button",
|
|
146
|
-
icon:
|
|
147
|
-
tooltip:
|
|
148
|
-
action:
|
|
149
|
-
disabled:
|
|
146
|
+
icon: Fe,
|
|
147
|
+
tooltip: f.value("toolbar.prev_page"),
|
|
148
|
+
action: _e,
|
|
149
|
+
disabled: h.value <= 1
|
|
150
150
|
},
|
|
151
151
|
{
|
|
152
152
|
type: "text",
|
|
153
|
-
content: `${
|
|
153
|
+
content: `${h.value} / ${T.value}`,
|
|
154
154
|
minWidth: "4rem"
|
|
155
155
|
},
|
|
156
156
|
{
|
|
157
157
|
type: "button",
|
|
158
|
-
icon:
|
|
159
|
-
tooltip:
|
|
160
|
-
action:
|
|
161
|
-
disabled:
|
|
158
|
+
icon: He,
|
|
159
|
+
tooltip: f.value("toolbar.next_page"),
|
|
160
|
+
action: we,
|
|
161
|
+
disabled: h.value >= T.value
|
|
162
162
|
}
|
|
163
163
|
]
|
|
164
164
|
},
|
|
@@ -166,9 +166,9 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
166
166
|
items: [
|
|
167
167
|
{
|
|
168
168
|
type: "button",
|
|
169
|
-
icon: v.value ?
|
|
170
|
-
tooltip: v.value ?
|
|
171
|
-
action:
|
|
169
|
+
icon: v.value ? $e : De,
|
|
170
|
+
tooltip: v.value ? f.value("toolbar.normal_width") : f.value("toolbar.full_width"),
|
|
171
|
+
action: Te,
|
|
172
172
|
active: v.value
|
|
173
173
|
}
|
|
174
174
|
]
|
|
@@ -176,53 +176,54 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
176
176
|
],
|
|
177
177
|
onToolbarChange: (o) => Y.subscribe(o)
|
|
178
178
|
});
|
|
179
|
-
const
|
|
179
|
+
const I = (o) => {
|
|
180
180
|
var t;
|
|
181
181
|
(t = o.filename) != null && t.includes("paginator") && o.preventDefault();
|
|
182
182
|
};
|
|
183
|
-
|
|
184
|
-
const
|
|
183
|
+
ve(() => window.addEventListener("error", I)), de(() => window.removeEventListener("error", I));
|
|
184
|
+
const ee = async () => {
|
|
185
185
|
var d, J, L;
|
|
186
|
+
Z.begin(k.url);
|
|
186
187
|
const o = X.value;
|
|
187
188
|
if (!o) return;
|
|
188
|
-
g.value = !0, x.value = null, y.value = [], n.value = !1,
|
|
189
|
+
g.value = !0, x.value = null, y.value = [], n.value = !1, E.value = "", O = 1, h.value = 1, T.value = 1, o.replaceChildren(), e = null;
|
|
189
190
|
let t = !1;
|
|
190
191
|
const a = /* @__PURE__ */ new Map();
|
|
191
192
|
try {
|
|
192
|
-
const
|
|
193
|
-
o.appendChild(
|
|
194
|
-
var
|
|
195
|
-
const i =
|
|
193
|
+
const s = document.createElement("foliate-view");
|
|
194
|
+
o.appendChild(s), e = s, s.addEventListener("relocate", (oe) => {
|
|
195
|
+
var re, le, ne, ie, se, fe, pe;
|
|
196
|
+
const i = oe.detail;
|
|
196
197
|
if (!i) return;
|
|
197
|
-
const
|
|
198
|
-
if (r && typeof r.page == "number" && Number.isFinite(r.page) && typeof r.pages == "number" && Number.isFinite(r.pages) && r.pages > 2 &&
|
|
198
|
+
const ae = ((re = e == null ? void 0 : e.book) == null ? void 0 : re.sections.length) ?? 0, r = e == null ? void 0 : e.renderer, P = ((ne = (le = r == null ? void 0 : r.getContents) == null ? void 0 : le.call(r)[0]) == null ? void 0 : ne.index) ?? -1;
|
|
199
|
+
if (r && typeof r.page == "number" && Number.isFinite(r.page) && typeof r.pages == "number" && Number.isFinite(r.pages) && r.pages > 2 && P >= 0) {
|
|
199
200
|
t = !0;
|
|
200
|
-
const
|
|
201
|
-
a.set(
|
|
201
|
+
const b = r.pages - 2;
|
|
202
|
+
a.set(P, b);
|
|
202
203
|
let _ = 0;
|
|
203
|
-
for (let w = 0; w <
|
|
204
|
+
for (let w = 0; w < P; w++)
|
|
204
205
|
_ += a.get(w) ?? 0;
|
|
205
|
-
const C = _ + Math.min(
|
|
206
|
+
const C = _ + Math.min(b, Math.max(1, r.page)), M = (i.fraction ?? 0) >= 0.999;
|
|
206
207
|
let H;
|
|
207
|
-
if (
|
|
208
|
-
H =
|
|
209
|
-
else if (
|
|
208
|
+
if (ae === 1)
|
|
209
|
+
H = b;
|
|
210
|
+
else if (M)
|
|
210
211
|
H = C;
|
|
211
212
|
else {
|
|
212
|
-
const w = ((
|
|
213
|
+
const w = ((ie = e == null ? void 0 : e.book) == null ? void 0 : ie.sections) ?? [], ue = ((se = w[P]) == null ? void 0 : se.size) ?? 0, Me = ue > 0 ? b / ue : 0;
|
|
213
214
|
let Q = 0;
|
|
214
|
-
for (let
|
|
215
|
-
if (a.has(
|
|
216
|
-
Q += a.get(
|
|
215
|
+
for (let S = 0; S < ae; S++)
|
|
216
|
+
if (a.has(S))
|
|
217
|
+
Q += a.get(S);
|
|
217
218
|
else {
|
|
218
|
-
const
|
|
219
|
-
Q += Math.max(1, Math.round(
|
|
219
|
+
const Se = ((fe = w[S]) == null ? void 0 : fe.size) ?? 0;
|
|
220
|
+
Q += Math.max(1, Math.round(Se * Me));
|
|
220
221
|
}
|
|
221
222
|
H = Math.max(C, Q);
|
|
222
223
|
}
|
|
223
224
|
A(C - 1, H);
|
|
224
225
|
const $ = i.tocItem;
|
|
225
|
-
$ != null && $.href && (
|
|
226
|
+
$ != null && $.href && (E.value = $.href);
|
|
226
227
|
return;
|
|
227
228
|
}
|
|
228
229
|
const m = i.location;
|
|
@@ -231,33 +232,33 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
231
232
|
const _ = (i.fraction ?? 0) >= 0.999 ? m.current + 1 : m.total;
|
|
232
233
|
A(m.current, _);
|
|
233
234
|
} else {
|
|
234
|
-
const
|
|
235
|
-
A(Math.round((_ + C) /
|
|
235
|
+
const b = ((pe = e == null ? void 0 : e.book) == null ? void 0 : pe.sections) ?? [], _ = i.index ?? 0, C = i.fraction ?? 0, M = Math.max(b.length, 1);
|
|
236
|
+
A(Math.round((_ + C) / M * M), M);
|
|
236
237
|
}
|
|
237
|
-
const
|
|
238
|
-
|
|
238
|
+
const F = i.tocItem;
|
|
239
|
+
F != null && F.href && (E.value = F.href);
|
|
239
240
|
});
|
|
240
|
-
const K = await
|
|
241
|
+
const K = await ye.value(k.url);
|
|
241
242
|
if (!K.ok) throw new he("request.failed", { status: K.status });
|
|
242
243
|
const Ce = await K.blob();
|
|
243
|
-
let
|
|
244
|
+
let te = "book.mobi";
|
|
244
245
|
try {
|
|
245
|
-
const i = new URL(
|
|
246
|
-
i && (
|
|
246
|
+
const i = new URL(k.url, window.location.href).pathname.split("/").pop();
|
|
247
|
+
i && (te = decodeURIComponent(i));
|
|
247
248
|
} catch {
|
|
248
249
|
}
|
|
249
|
-
await
|
|
250
|
-
const p =
|
|
251
|
-
p && (p.setAttribute("animated", ""), p.setAttribute("max-inline-size", "720"), p.setAttribute("margin", "48"), p.setAttribute("gap", "5%"), await V(p), (d = p.setStyles) == null || d.call(p,
|
|
252
|
-
} catch (
|
|
253
|
-
console.error(
|
|
250
|
+
await s.open(new File([Ce], te));
|
|
251
|
+
const p = s.renderer;
|
|
252
|
+
p && (p.setAttribute("animated", ""), p.setAttribute("max-inline-size", "720"), p.setAttribute("margin", "48"), p.setAttribute("gap", "5%"), await V(p), (d = p.setStyles) == null || d.call(p, z)), y.value = ((J = s.book) == null ? void 0 : J.toc) ?? [], g.value = !1, t || A(0, ((L = s.book) == null ? void 0 : L.sections.length) ?? 1);
|
|
253
|
+
} catch (s) {
|
|
254
|
+
console.error(f.value("mobi.load_failed") + ":", s), x.value = f.value("mobi.load_failed"), g.value = !1, Z.error(s);
|
|
254
255
|
}
|
|
255
256
|
};
|
|
256
|
-
return
|
|
257
|
-
|
|
258
|
-
}), ce(() =>
|
|
259
|
-
o && o !== t &&
|
|
260
|
-
}),
|
|
257
|
+
return ve(() => {
|
|
258
|
+
k.url && ee();
|
|
259
|
+
}), ce(() => k.url, (o, t) => {
|
|
260
|
+
o && o !== t && ee();
|
|
261
|
+
}), de(() => {
|
|
261
262
|
var o, t, a, d;
|
|
262
263
|
try {
|
|
263
264
|
(o = e == null ? void 0 : e.close) == null || o.call(e);
|
|
@@ -268,51 +269,51 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
268
269
|
} catch {
|
|
269
270
|
}
|
|
270
271
|
e = null, (d = X.value) == null || d.replaceChildren();
|
|
271
|
-
}), (o, t) => (
|
|
272
|
-
x.value ? (
|
|
272
|
+
}), (o, t) => (N(), D("div", je, [
|
|
273
|
+
x.value ? (N(), Ne(Be, {
|
|
273
274
|
key: 0,
|
|
274
275
|
message: x.value,
|
|
275
276
|
class: "vfp-absolute vfp-inset-0"
|
|
276
277
|
}, null, 8, ["message"])) : W("", !0),
|
|
277
|
-
g.value && !x.value ? (
|
|
278
|
-
|
|
279
|
-
t[2] || (t[2] =
|
|
280
|
-
|
|
278
|
+
g.value && !x.value ? (N(), D("div", qe, [
|
|
279
|
+
c("div", Ge, [
|
|
280
|
+
t[2] || (t[2] = c("div", { class: "vfp-renderer-spinner" }, null, -1)),
|
|
281
|
+
c("span", Ve, me(B(f)("common.loading")), 1)
|
|
281
282
|
])
|
|
282
283
|
])) : W("", !0),
|
|
283
|
-
y.value.length > 0 ? (
|
|
284
|
+
y.value.length > 0 ? (N(), D("div", {
|
|
284
285
|
key: 2,
|
|
285
286
|
class: "vfp-absolute vfp-inset-0 vfp-z-20 vfp-flex vfp-transition-opacity vfp-duration-300",
|
|
286
287
|
style: U({ opacity: n.value ? 1 : 0, pointerEvents: n.value ? "auto" : "none" })
|
|
287
288
|
}, [
|
|
288
|
-
|
|
289
|
+
c("div", {
|
|
289
290
|
class: "vfp-w-72 vfp-max-w-[80%] vfp-h-full vfp-bg-surface-overlay vfp-backdrop-blur-xl vfp-border-r vfp-border-line-weak vfp-flex vfp-flex-col vfp-shadow-2xl vfp-transition-transform vfp-duration-300",
|
|
290
291
|
style: U({ transform: n.value ? "translateX(0)" : "translateX(-100%)" })
|
|
291
292
|
}, [
|
|
292
|
-
|
|
293
|
-
|
|
294
|
-
|
|
293
|
+
c("div", Xe, [
|
|
294
|
+
c("span", Oe, me(B(f)("toolbar.toc")), 1),
|
|
295
|
+
c("button", {
|
|
295
296
|
class: "toc-close-btn",
|
|
296
297
|
onClick: t[0] || (t[0] = (a) => n.value = !1)
|
|
297
298
|
}, [
|
|
298
|
-
|
|
299
|
+
be(B(We), { class: "vfp-w-4 vfp-h-4" })
|
|
299
300
|
])
|
|
300
301
|
]),
|
|
301
|
-
|
|
302
|
-
|
|
302
|
+
c("div", Je, [
|
|
303
|
+
be(B(xe), {
|
|
303
304
|
items: y.value,
|
|
304
|
-
"active-href":
|
|
305
|
-
onSelect:
|
|
305
|
+
"active-href": E.value,
|
|
306
|
+
onSelect: Ee
|
|
306
307
|
}, null, 8, ["items", "active-href"])
|
|
307
308
|
])
|
|
308
309
|
], 4),
|
|
309
|
-
|
|
310
|
+
c("div", {
|
|
310
311
|
class: "vfp-flex-1 vfp-transition-opacity vfp-duration-300",
|
|
311
312
|
style: U({ background: n.value ? "rgba(0,0,0,0.3)" : "transparent" }),
|
|
312
313
|
onClick: t[1] || (t[1] = (a) => n.value = !1)
|
|
313
314
|
}, null, 4)
|
|
314
315
|
], 4)) : W("", !0),
|
|
315
|
-
x.value ? W("", !0) : (
|
|
316
|
+
x.value ? W("", !0) : (N(), D("div", {
|
|
316
317
|
key: 3,
|
|
317
318
|
ref_key: "hostRef",
|
|
318
319
|
ref: X,
|
|
@@ -327,7 +328,7 @@ const Be = { class: "vfp-relative vfp-w-full vfp-h-full vfp-flex vfp-justify-cen
|
|
|
327
328
|
}, null, 4))
|
|
328
329
|
]));
|
|
329
330
|
}
|
|
330
|
-
}),
|
|
331
|
+
}), rt = /* @__PURE__ */ Le(Qe, [["__scopeId", "data-v-e2b96a42"]]);
|
|
331
332
|
export {
|
|
332
|
-
|
|
333
|
+
rt as default
|
|
333
334
|
};
|