flipbookengine 0.5.4 → 0.6.5
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/CHANGELOG.md +75 -57
- package/README.md +295 -281
- package/dist/components/TableOfContents.d.ts +8 -0
- package/dist/components/Toolbar.d.ts +1 -0
- package/dist/core/LayoutManager.d.ts +1 -1
- package/dist/core/PdfRenderer.d.ts +12 -2
- package/dist/{engine-7jWE07Zq.js → engine-DhQ2zxpm.js} +1334 -1192
- package/dist/engine-DhQ2zxpm.js.map +1 -0
- package/dist/engine.d.ts +16 -1
- package/dist/flipbook-engine.css +1 -1
- package/dist/flipbook-engine.iife.js +24 -24
- package/dist/flipbook-engine.iife.js.map +1 -1
- package/dist/flipbook-engine.js +5 -3
- package/dist/flipbook-engine.react.js +1 -1
- package/dist/flipbook-engine.vue.js +1 -1
- package/dist/i18n/locales/en.d.ts +1 -0
- package/dist/i18n/locales/tr.d.ts +1 -0
- package/dist/i18n/service.d.ts +3 -0
- package/dist/index.d.ts +5 -1
- package/dist/model/pages.d.ts +2 -0
- package/dist/model/toc.d.ts +13 -0
- package/dist/state/store.d.ts +5 -2
- package/dist/theme/theme.d.ts +16 -0
- package/package.json +1 -1
- package/dist/engine-7jWE07Zq.js.map +0 -1
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
var
|
|
2
|
-
var
|
|
1
|
+
var ke = Object.defineProperty;
|
|
2
|
+
var _t = (e) => {
|
|
3
3
|
throw TypeError(e);
|
|
4
4
|
};
|
|
5
|
-
var
|
|
6
|
-
var
|
|
7
|
-
var
|
|
8
|
-
import * as
|
|
9
|
-
var
|
|
10
|
-
function
|
|
5
|
+
var Ce = (e, t, i) => t in e ? ke(e, t, { enumerable: !0, configurable: !0, writable: !0, value: i }) : e[t] = i;
|
|
6
|
+
var v = (e, t, i) => Ce(e, typeof t != "symbol" ? t + "" : t, i), yt = (e, t, i) => t.has(e) || _t("Cannot " + i);
|
|
7
|
+
var B = (e, t, i) => (yt(e, t, "read from private field"), i ? i.call(e) : t.get(e)), rt = (e, t, i) => t.has(e) ? _t("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(e) : t.set(e, i), at = (e, t, i, o) => (yt(e, t, "write to private field"), o ? o.call(e, i) : t.set(e, i), i), J = (e, t, i) => (yt(e, t, "access private method"), i);
|
|
8
|
+
import * as Gt from "pdfjs-dist";
|
|
9
|
+
var Ae = Symbol.for("preact-signals");
|
|
10
|
+
function zt() {
|
|
11
11
|
if (j > 1)
|
|
12
12
|
j--;
|
|
13
13
|
else {
|
|
@@ -17,155 +17,155 @@ function It() {
|
|
|
17
17
|
for (ct = void 0; r !== void 0; )
|
|
18
18
|
r.S.v === r.v && (r.S.i = r.i), r = r.o;
|
|
19
19
|
}(); tt !== void 0; ) {
|
|
20
|
-
var
|
|
21
|
-
for (tt = void 0, lt++;
|
|
22
|
-
var o =
|
|
23
|
-
if (
|
|
24
|
-
|
|
20
|
+
var i = tt;
|
|
21
|
+
for (tt = void 0, lt++; i !== void 0; ) {
|
|
22
|
+
var o = i.u;
|
|
23
|
+
if (i.u = void 0, i.f &= -3, !(8 & i.f) && ne(i)) try {
|
|
24
|
+
i.c();
|
|
25
25
|
} catch (r) {
|
|
26
26
|
t || (e = r, t = !0);
|
|
27
27
|
}
|
|
28
|
-
|
|
28
|
+
i = o;
|
|
29
29
|
}
|
|
30
30
|
}
|
|
31
31
|
if (lt = 0, j--, t) throw e;
|
|
32
32
|
}
|
|
33
33
|
}
|
|
34
|
-
var
|
|
34
|
+
var M = void 0;
|
|
35
35
|
function wt(e) {
|
|
36
|
-
var t =
|
|
37
|
-
|
|
36
|
+
var t = M;
|
|
37
|
+
M = void 0;
|
|
38
38
|
try {
|
|
39
39
|
return e();
|
|
40
40
|
} finally {
|
|
41
|
-
|
|
41
|
+
M = t;
|
|
42
42
|
}
|
|
43
43
|
}
|
|
44
|
-
var tt = void 0, j = 0, lt = 0,
|
|
45
|
-
function
|
|
46
|
-
if (
|
|
44
|
+
var tt = void 0, j = 0, lt = 0, Ut = 0, ct = void 0, dt = 0;
|
|
45
|
+
function se(e) {
|
|
46
|
+
if (M !== void 0) {
|
|
47
47
|
var t = e.n;
|
|
48
|
-
if (t === void 0 || t.t !==
|
|
49
|
-
return t = { i: 0, S: e, p:
|
|
48
|
+
if (t === void 0 || t.t !== M)
|
|
49
|
+
return t = { i: 0, S: e, p: M.s, n: void 0, t: M, e: void 0, x: void 0, r: t }, M.s !== void 0 && (M.s.n = t), M.s = t, e.n = t, 32 & M.f && e.S(t), t;
|
|
50
50
|
if (t.i === -1)
|
|
51
|
-
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p =
|
|
51
|
+
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = M.s, t.n = void 0, M.s.n = t, M.s = t), t;
|
|
52
52
|
}
|
|
53
53
|
}
|
|
54
|
-
function
|
|
54
|
+
function z(e, t) {
|
|
55
55
|
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
|
|
56
56
|
}
|
|
57
|
-
|
|
58
|
-
|
|
57
|
+
z.prototype.brand = Ae;
|
|
58
|
+
z.prototype.h = function() {
|
|
59
59
|
return !0;
|
|
60
60
|
};
|
|
61
|
-
|
|
62
|
-
var t = this,
|
|
63
|
-
|
|
61
|
+
z.prototype.S = function(e) {
|
|
62
|
+
var t = this, i = this.t;
|
|
63
|
+
i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : wt(function() {
|
|
64
64
|
var o;
|
|
65
65
|
(o = t.W) == null || o.call(t);
|
|
66
66
|
}));
|
|
67
67
|
};
|
|
68
|
-
|
|
68
|
+
z.prototype.U = function(e) {
|
|
69
69
|
var t = this;
|
|
70
70
|
if (this.t !== void 0) {
|
|
71
|
-
var
|
|
72
|
-
|
|
71
|
+
var i = e.e, o = e.x;
|
|
72
|
+
i !== void 0 && (i.x = o, e.e = void 0), o !== void 0 && (o.e = i, e.x = void 0), e === this.t && (this.t = o, o === void 0 && wt(function() {
|
|
73
73
|
var r;
|
|
74
74
|
(r = t.Z) == null || r.call(t);
|
|
75
75
|
}));
|
|
76
76
|
}
|
|
77
77
|
};
|
|
78
|
-
|
|
78
|
+
z.prototype.subscribe = function(e) {
|
|
79
79
|
var t = this;
|
|
80
|
-
return
|
|
81
|
-
var
|
|
80
|
+
return _(function() {
|
|
81
|
+
var i = t.value;
|
|
82
82
|
wt(function() {
|
|
83
|
-
return e(
|
|
83
|
+
return e(i);
|
|
84
84
|
});
|
|
85
85
|
}, { name: "sub" });
|
|
86
86
|
};
|
|
87
|
-
|
|
87
|
+
z.prototype.valueOf = function() {
|
|
88
88
|
return this.value;
|
|
89
89
|
};
|
|
90
|
-
|
|
90
|
+
z.prototype.toString = function() {
|
|
91
91
|
return this.value + "";
|
|
92
92
|
};
|
|
93
|
-
|
|
93
|
+
z.prototype.toJSON = function() {
|
|
94
94
|
return this.value;
|
|
95
95
|
};
|
|
96
|
-
|
|
96
|
+
z.prototype.peek = function() {
|
|
97
97
|
var e = this;
|
|
98
98
|
return wt(function() {
|
|
99
99
|
return e.value;
|
|
100
100
|
});
|
|
101
101
|
};
|
|
102
|
-
Object.defineProperty(
|
|
103
|
-
var e =
|
|
102
|
+
Object.defineProperty(z.prototype, "value", { get: function() {
|
|
103
|
+
var e = se(this);
|
|
104
104
|
return e !== void 0 && (e.i = this.i), this.v;
|
|
105
105
|
}, set: function(e) {
|
|
106
106
|
if (e !== this.v) {
|
|
107
107
|
if (lt > 100) throw new Error("Cycle detected");
|
|
108
|
-
(function(
|
|
109
|
-
j !== 0 && lt === 0 &&
|
|
108
|
+
(function(i) {
|
|
109
|
+
j !== 0 && lt === 0 && i.l !== Ut && (i.l = Ut, ct = { S: i, v: i.v, i: i.i, o: ct });
|
|
110
110
|
})(this), this.v = e, this.i++, dt++, j++;
|
|
111
111
|
try {
|
|
112
112
|
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
113
113
|
} finally {
|
|
114
|
-
|
|
114
|
+
zt();
|
|
115
115
|
}
|
|
116
116
|
}
|
|
117
117
|
} });
|
|
118
|
-
function
|
|
119
|
-
return new
|
|
118
|
+
function D(e, t) {
|
|
119
|
+
return new z(e, t);
|
|
120
120
|
}
|
|
121
|
-
function
|
|
121
|
+
function ne(e) {
|
|
122
122
|
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
123
123
|
return !1;
|
|
124
124
|
}
|
|
125
|
-
function
|
|
125
|
+
function oe(e) {
|
|
126
126
|
for (var t = e.s; t !== void 0; t = t.n) {
|
|
127
|
-
var
|
|
128
|
-
if (
|
|
127
|
+
var i = t.S.n;
|
|
128
|
+
if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
129
129
|
e.s = t;
|
|
130
130
|
break;
|
|
131
131
|
}
|
|
132
132
|
}
|
|
133
133
|
}
|
|
134
|
-
function
|
|
135
|
-
for (var t = e.s,
|
|
134
|
+
function re(e) {
|
|
135
|
+
for (var t = e.s, i = void 0; t !== void 0; ) {
|
|
136
136
|
var o = t.p;
|
|
137
|
-
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) :
|
|
137
|
+
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
|
|
138
138
|
}
|
|
139
|
-
e.s =
|
|
139
|
+
e.s = i;
|
|
140
140
|
}
|
|
141
141
|
function q(e, t) {
|
|
142
|
-
|
|
142
|
+
z.call(this, void 0, t), this.x = e, this.s = void 0, this.g = dt - 1, this.f = 4;
|
|
143
143
|
}
|
|
144
|
-
q.prototype = new
|
|
144
|
+
q.prototype = new z();
|
|
145
145
|
q.prototype.h = function() {
|
|
146
146
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
147
147
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === dt)) return !0;
|
|
148
|
-
if (this.g = dt, this.f |= 1, this.i > 0 && !
|
|
148
|
+
if (this.g = dt, this.f |= 1, this.i > 0 && !ne(this))
|
|
149
149
|
return this.f &= -2, !0;
|
|
150
|
-
var e =
|
|
150
|
+
var e = M;
|
|
151
151
|
try {
|
|
152
|
-
|
|
152
|
+
oe(this), M = this;
|
|
153
153
|
var t = this.x();
|
|
154
154
|
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
155
|
-
} catch (
|
|
156
|
-
this.v =
|
|
155
|
+
} catch (i) {
|
|
156
|
+
this.v = i, this.f |= 16, this.i++;
|
|
157
157
|
}
|
|
158
|
-
return
|
|
158
|
+
return M = e, re(this), this.f &= -2, !0;
|
|
159
159
|
};
|
|
160
160
|
q.prototype.S = function(e) {
|
|
161
161
|
if (this.t === void 0) {
|
|
162
162
|
this.f |= 36;
|
|
163
163
|
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
164
164
|
}
|
|
165
|
-
|
|
165
|
+
z.prototype.S.call(this, e);
|
|
166
166
|
};
|
|
167
167
|
q.prototype.U = function(e) {
|
|
168
|
-
if (this.t !== void 0 && (
|
|
168
|
+
if (this.t !== void 0 && (z.prototype.U.call(this, e), this.t === void 0)) {
|
|
169
169
|
this.f &= -33;
|
|
170
170
|
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
171
171
|
}
|
|
@@ -178,35 +178,35 @@ q.prototype.N = function() {
|
|
|
178
178
|
};
|
|
179
179
|
Object.defineProperty(q.prototype, "value", { get: function() {
|
|
180
180
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
181
|
-
var e =
|
|
181
|
+
var e = se(this);
|
|
182
182
|
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
183
183
|
return this.v;
|
|
184
184
|
} });
|
|
185
185
|
function w(e, t) {
|
|
186
186
|
return new q(e, t);
|
|
187
187
|
}
|
|
188
|
-
function
|
|
188
|
+
function ae(e) {
|
|
189
189
|
var t = e.m;
|
|
190
190
|
if (e.m = void 0, typeof t == "function") {
|
|
191
191
|
j++;
|
|
192
|
-
var
|
|
193
|
-
|
|
192
|
+
var i = M;
|
|
193
|
+
M = void 0;
|
|
194
194
|
try {
|
|
195
195
|
t();
|
|
196
196
|
} catch (o) {
|
|
197
|
-
throw e.f &= -2, e.f |= 8,
|
|
197
|
+
throw e.f &= -2, e.f |= 8, Ft(e), o;
|
|
198
198
|
} finally {
|
|
199
|
-
|
|
199
|
+
M = i, zt();
|
|
200
200
|
}
|
|
201
201
|
}
|
|
202
202
|
}
|
|
203
|
-
function
|
|
203
|
+
function Ft(e) {
|
|
204
204
|
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
205
|
-
e.x = void 0, e.s = void 0,
|
|
205
|
+
e.x = void 0, e.s = void 0, ae(e);
|
|
206
206
|
}
|
|
207
|
-
function
|
|
208
|
-
if (
|
|
209
|
-
|
|
207
|
+
function Ee(e) {
|
|
208
|
+
if (M !== this) throw new Error("Out-of-order effect");
|
|
209
|
+
re(this), M = e, this.f &= -2, 8 & this.f && Ft(this), zt();
|
|
210
210
|
}
|
|
211
211
|
function X(e, t) {
|
|
212
212
|
this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t == null ? void 0 : t.name;
|
|
@@ -223,69 +223,69 @@ X.prototype.c = function() {
|
|
|
223
223
|
};
|
|
224
224
|
X.prototype.S = function() {
|
|
225
225
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
226
|
-
this.f |= 1, this.f &= -9,
|
|
227
|
-
var e =
|
|
228
|
-
return
|
|
226
|
+
this.f |= 1, this.f &= -9, ae(this), oe(this), j++;
|
|
227
|
+
var e = M;
|
|
228
|
+
return M = this, Ee.bind(this, e);
|
|
229
229
|
};
|
|
230
230
|
X.prototype.N = function() {
|
|
231
231
|
2 & this.f || (this.f |= 2, this.u = tt, tt = this);
|
|
232
232
|
};
|
|
233
233
|
X.prototype.d = function() {
|
|
234
|
-
this.f |= 8, 1 & this.f ||
|
|
234
|
+
this.f |= 8, 1 & this.f || Ft(this);
|
|
235
235
|
};
|
|
236
236
|
X.prototype.dispose = function() {
|
|
237
237
|
this.d();
|
|
238
238
|
};
|
|
239
|
-
function
|
|
240
|
-
var
|
|
239
|
+
function _(e, t) {
|
|
240
|
+
var i = new X(e, t);
|
|
241
241
|
try {
|
|
242
|
-
|
|
242
|
+
i.c();
|
|
243
243
|
} catch (r) {
|
|
244
|
-
throw
|
|
244
|
+
throw i.d(), r;
|
|
245
245
|
}
|
|
246
|
-
var o =
|
|
246
|
+
var o = i.d.bind(i);
|
|
247
247
|
return o[Symbol.dispose] = o, o;
|
|
248
248
|
}
|
|
249
|
-
var
|
|
250
|
-
function
|
|
249
|
+
var he = /* @__PURE__ */ Symbol.for("Serenity.initPropHook");
|
|
250
|
+
function Me(e) {
|
|
251
251
|
return !!(e && typeof e.nodeType == "number");
|
|
252
252
|
}
|
|
253
253
|
function vt(e) {
|
|
254
254
|
return typeof e == "string";
|
|
255
255
|
}
|
|
256
|
-
function
|
|
256
|
+
function le(e) {
|
|
257
257
|
return typeof e == "number";
|
|
258
258
|
}
|
|
259
|
-
function
|
|
259
|
+
function W(e) {
|
|
260
260
|
return typeof e == "object" && e !== null;
|
|
261
261
|
}
|
|
262
|
-
function
|
|
262
|
+
function De(e) {
|
|
263
263
|
return !!(e && e.isComponent);
|
|
264
264
|
}
|
|
265
|
-
function
|
|
266
|
-
return
|
|
265
|
+
function Ot(e) {
|
|
266
|
+
return W(e) && typeof e.length == "number" && typeof e.nodeType != "number";
|
|
267
267
|
}
|
|
268
|
-
function
|
|
269
|
-
return typeof e == "function" && typeof e[
|
|
268
|
+
function Re(e) {
|
|
269
|
+
return typeof e == "function" && typeof e[he] == "function";
|
|
270
270
|
}
|
|
271
271
|
function it(e) {
|
|
272
272
|
return e != null && typeof e != "boolean";
|
|
273
273
|
}
|
|
274
274
|
function st(e) {
|
|
275
|
-
return Array.isArray(e) ? e.map(st).filter(Boolean).join(" ") :
|
|
275
|
+
return Array.isArray(e) ? e.map(st).filter(Boolean).join(" ") : W(e) ? Symbol.iterator in e ? st(Array.from(e)) : Object.keys(e).filter((t) => e[t]).join(" ") : it(e) ? "" + e : "";
|
|
276
276
|
}
|
|
277
|
-
function
|
|
277
|
+
function Ie(e) {
|
|
278
278
|
return e != null && typeof e == "object" && "current" in e;
|
|
279
279
|
}
|
|
280
|
-
function
|
|
281
|
-
|
|
280
|
+
function Wt(e, t) {
|
|
281
|
+
Ie(e) ? e.current = t : typeof e == "function" && e(t);
|
|
282
282
|
}
|
|
283
|
-
function
|
|
284
|
-
t = { ...t, children:
|
|
283
|
+
function Le(e, t, i) {
|
|
284
|
+
t = { ...t, children: i };
|
|
285
285
|
const o = new e(t), r = o.render();
|
|
286
|
-
return "ref" in t &&
|
|
286
|
+
return "ref" in t && Wt(t.ref, o), r;
|
|
287
287
|
}
|
|
288
|
-
var
|
|
288
|
+
var ze = "http://www.w3.org/1998/Math/MathML", Fe = /* @__PURE__ */ new Set(["math", "annotation", "annotation-xml", "maction", "merror", "mfrac", "mi", "mmultiscripts", "mn", "mo", "mover", "mpadded", "mphantom", "mprescripts", "mroot", "mrow", "ms", "mspace", "msqrt", "mstyle", "msub", "msubsup", "msup", "mtable", "mtd", "mtext", "mtr", "munder", "munderover", "semantics", "menclose", "mfenced"]), Oe = /* @__PURE__ */ new Set([
|
|
289
289
|
// "a",
|
|
290
290
|
"animate",
|
|
291
291
|
"animateMotion",
|
|
@@ -350,30 +350,30 @@ var Ee = "http://www.w3.org/1998/Math/MathML", Me = /* @__PURE__ */ new Set(["ma
|
|
|
350
350
|
"tspan",
|
|
351
351
|
"use",
|
|
352
352
|
"view"
|
|
353
|
-
]),
|
|
354
|
-
function
|
|
355
|
-
const t = globalThis[
|
|
356
|
-
return arguments.length && (globalThis[
|
|
353
|
+
]), jt = /^(a(ll|t|u)|base[FP]|c(al|lipPathU|on)|di|ed|ex|filter[RU]|g(lyphR|r)|ke|l(en|im)|ma(rker[HUW]|s)|n|pat|pr|point[^e]|re[^n]|s[puy]|st[^or]|ta|textL|vi|xC|y|z)/, We = "http://www.w3.org/2000/svg", Vt = /* @__PURE__ */ Symbol.for("Serenity.jsxNamespaceURI");
|
|
354
|
+
function Ne(e) {
|
|
355
|
+
const t = globalThis[Vt];
|
|
356
|
+
return arguments.length && (globalThis[Vt] = e), t;
|
|
357
357
|
}
|
|
358
|
-
var
|
|
359
|
-
function
|
|
360
|
-
return e != null && e[
|
|
358
|
+
var $e = /* @__PURE__ */ Symbol.for("Serenity.jsxTypeKey"), He = "ShadowRoot";
|
|
359
|
+
function Be(e) {
|
|
360
|
+
return e != null && e[$e] === He;
|
|
361
361
|
}
|
|
362
|
-
var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"),
|
|
363
|
-
function
|
|
362
|
+
var bt = /* @__PURE__ */ Symbol.for("Serenity.disposingListeners"), Pt = /* @__PURE__ */ Symbol.for("Serenity.lifecycleRoot");
|
|
363
|
+
function Nt() {
|
|
364
364
|
return globalThis[bt] || (globalThis[bt] = /* @__PURE__ */ new WeakMap());
|
|
365
365
|
}
|
|
366
|
-
function
|
|
367
|
-
e && e.target && (!e.currentTarget || e.currentTarget === e.target) &&
|
|
366
|
+
function $t(e) {
|
|
367
|
+
e && e.target && (!e.currentTarget || e.currentTarget === e.target) && _e(e == null ? void 0 : e.target);
|
|
368
368
|
}
|
|
369
|
-
function
|
|
369
|
+
function _e(e, t) {
|
|
370
370
|
if (!e)
|
|
371
371
|
return;
|
|
372
|
-
const
|
|
372
|
+
const i = Nt();
|
|
373
373
|
function o(r) {
|
|
374
|
-
const h =
|
|
374
|
+
const h = i.get(r);
|
|
375
375
|
if (h) {
|
|
376
|
-
|
|
376
|
+
i.delete(r), r.removeEventListener("disposing", $t);
|
|
377
377
|
for (const u of h)
|
|
378
378
|
try {
|
|
379
379
|
u.callback(r);
|
|
@@ -383,70 +383,70 @@ function Oe(e, t) {
|
|
|
383
383
|
}
|
|
384
384
|
o(e);
|
|
385
385
|
}
|
|
386
|
-
function
|
|
386
|
+
function At(e, t, i) {
|
|
387
387
|
if (!e || !t)
|
|
388
388
|
return e;
|
|
389
|
-
const o =
|
|
389
|
+
const o = Nt();
|
|
390
390
|
let r = o.get(e);
|
|
391
391
|
if (!r)
|
|
392
392
|
return typeof e.addEventListener != "function" || (o.set(e, r = [{
|
|
393
393
|
callback: t,
|
|
394
|
-
regKey:
|
|
395
|
-
}]), e.addEventListener("disposing",
|
|
394
|
+
regKey: i
|
|
395
|
+
}]), e.addEventListener("disposing", $t, { once: !0 })), e;
|
|
396
396
|
const h = r.find((u) => u.callback === t);
|
|
397
|
-
return h ? (h.regKey, e) : (r.push({ callback: t, regKey:
|
|
397
|
+
return h ? (h.regKey, e) : (r.push({ callback: t, regKey: i }), e);
|
|
398
398
|
}
|
|
399
|
-
function
|
|
399
|
+
function Zt(e, t, i) {
|
|
400
400
|
if (!e || !t)
|
|
401
401
|
return e;
|
|
402
|
-
const o =
|
|
402
|
+
const o = Nt(), r = o.get(e);
|
|
403
403
|
if (r) {
|
|
404
404
|
for (let h = r.length - 1; h >= 0; h--) {
|
|
405
405
|
const u = r[h];
|
|
406
406
|
t && t === u.callback && r.splice(h, 1);
|
|
407
407
|
}
|
|
408
|
-
r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing",
|
|
408
|
+
r.length === 0 && (o.delete(e), typeof e.removeEventListener == "function" && e.removeEventListener("disposing", $t));
|
|
409
409
|
}
|
|
410
410
|
return e;
|
|
411
411
|
}
|
|
412
|
-
function
|
|
412
|
+
function Ge(...e) {
|
|
413
413
|
if (e.length > 0) {
|
|
414
|
-
const t = globalThis[
|
|
415
|
-
return globalThis[
|
|
414
|
+
const t = globalThis[Pt] || null;
|
|
415
|
+
return globalThis[Pt] = e[0] || null, t;
|
|
416
416
|
}
|
|
417
|
-
return globalThis[
|
|
417
|
+
return globalThis[Pt] || null;
|
|
418
418
|
}
|
|
419
419
|
function Z(e) {
|
|
420
420
|
return e != null && typeof e == "object" && typeof e.subscribe == "function" && typeof e.peek == "function" && "value" in e;
|
|
421
421
|
}
|
|
422
|
-
var ot,
|
|
423
|
-
constructor(e, t,
|
|
424
|
-
rt(this,
|
|
422
|
+
var ot, $, G, Et, Mt, ie, Ue = (ie = class {
|
|
423
|
+
constructor(e, t, i) {
|
|
424
|
+
rt(this, G);
|
|
425
425
|
rt(this, ot);
|
|
426
|
-
rt(this,
|
|
427
|
-
this.signal = e, this.isInitial = !0, this.hasChanged = !1, this.lifecycleRoot = t, at(this,
|
|
426
|
+
rt(this, $);
|
|
427
|
+
this.signal = e, this.isInitial = !0, this.hasChanged = !1, this.lifecycleRoot = t, at(this, $, i);
|
|
428
428
|
}
|
|
429
429
|
get lifecycleNode() {
|
|
430
|
-
return
|
|
430
|
+
return B(this, $);
|
|
431
431
|
}
|
|
432
432
|
get effectDisposer() {
|
|
433
|
-
return
|
|
433
|
+
return B(this, ot);
|
|
434
434
|
}
|
|
435
435
|
set effectDisposer(e) {
|
|
436
|
-
J(this,
|
|
436
|
+
J(this, G, Et).call(this), at(this, ot, e), J(this, G, Mt).call(this);
|
|
437
437
|
}
|
|
438
438
|
set lifecycleNode(e) {
|
|
439
|
-
e !==
|
|
439
|
+
e !== B(this, $) && (J(this, G, Et).call(this), at(this, $, e), J(this, G, Mt).call(this));
|
|
440
440
|
}
|
|
441
|
-
}, ot = new WeakMap(),
|
|
441
|
+
}, ot = new WeakMap(), $ = new WeakMap(), G = new WeakSet(), Et = function() {
|
|
442
442
|
var e;
|
|
443
|
-
|
|
444
|
-
},
|
|
443
|
+
Zt(B(this, $), this.effectDisposer), Zt(B(this, $), (e = this.signal) == null ? void 0 : e.derivedDisposer);
|
|
444
|
+
}, Mt = function() {
|
|
445
445
|
var e;
|
|
446
|
-
|
|
447
|
-
},
|
|
448
|
-
function nt(e, t,
|
|
449
|
-
const o =
|
|
446
|
+
At(B(this, $), this.effectDisposer), At(B(this, $), (e = this.signal) == null ? void 0 : e.derivedDisposer);
|
|
447
|
+
}, ie);
|
|
448
|
+
function nt(e, t, i) {
|
|
449
|
+
const o = i != null && i.useLifecycleRoot ? Ge() : void 0, r = new Ue(e, o, i == null ? void 0 : i.lifecycleNode), h = r.signal.subscribe(function(u) {
|
|
450
450
|
r.newValue = u, r.isInitial && (this != null && this.dispose) && (r.effectDisposer = this.dispose.bind(this)), r.hasChanged = !r.isInitial && r.prevValue !== r.newValue;
|
|
451
451
|
try {
|
|
452
452
|
t(r);
|
|
@@ -456,78 +456,78 @@ function nt(e, t, s) {
|
|
|
456
456
|
});
|
|
457
457
|
return h && !r.effectDisposer && (r.effectDisposer = h), r.effectDisposer;
|
|
458
458
|
}
|
|
459
|
-
function
|
|
459
|
+
function qt(e, t) {
|
|
460
460
|
e instanceof window.HTMLTemplateElement ? e.content.appendChild(t) : e.appendChild(t);
|
|
461
461
|
}
|
|
462
|
-
var
|
|
463
|
-
function
|
|
464
|
-
return e instanceof Comment && e.data.startsWith(
|
|
462
|
+
var xt = 0, Dt = "__domwisefrag_";
|
|
463
|
+
function ce(e) {
|
|
464
|
+
return e instanceof Comment && e.data.startsWith(Dt);
|
|
465
465
|
}
|
|
466
|
-
function
|
|
467
|
-
return e instanceof DocumentFragment &&
|
|
466
|
+
function Xt(e) {
|
|
467
|
+
return e instanceof DocumentFragment && ce(e.firstChild);
|
|
468
468
|
}
|
|
469
|
-
function
|
|
470
|
-
var
|
|
471
|
-
typeof e.replaceWith == "function" ? e.replaceWith(t) : (
|
|
469
|
+
function je(e, t) {
|
|
470
|
+
var i;
|
|
471
|
+
typeof e.replaceWith == "function" ? e.replaceWith(t) : (i = e.parentNode) == null || i.replaceChild(t, e);
|
|
472
472
|
}
|
|
473
|
-
function
|
|
474
|
-
return e instanceof DocumentFragment ? (++
|
|
473
|
+
function Yt(e) {
|
|
474
|
+
return e instanceof DocumentFragment ? (++xt, e.prepend(document.createComment(Dt + xt)), e.append(document.createComment(Dt + xt)), e) : e instanceof Node ? e : it(e) ? document.createTextNode(e) : document.createComment("");
|
|
475
475
|
}
|
|
476
|
-
function
|
|
477
|
-
let
|
|
476
|
+
function Ve(e, t) {
|
|
477
|
+
let i;
|
|
478
478
|
nt(t, (o) => {
|
|
479
479
|
var u;
|
|
480
480
|
if (o.isInitial) {
|
|
481
|
-
|
|
482
|
-
let
|
|
483
|
-
ut(e,
|
|
481
|
+
i = Yt(o.newValue);
|
|
482
|
+
let c = Xt(i) ? i.firstChild : i;
|
|
483
|
+
ut(e, i), o.lifecycleNode = (i = c) ?? e;
|
|
484
484
|
return;
|
|
485
485
|
}
|
|
486
486
|
if (!o.hasChanged)
|
|
487
487
|
return;
|
|
488
|
-
const r =
|
|
489
|
-
if (
|
|
490
|
-
let
|
|
491
|
-
for (; (
|
|
488
|
+
const r = Yt(o.newValue);
|
|
489
|
+
if (ce(i)) {
|
|
490
|
+
let c;
|
|
491
|
+
for (; (c = i.nextSibling) && ((u = c.parentNode) == null || u.removeChild(c), !(c instanceof Comment && c.data === i.data)); )
|
|
492
492
|
;
|
|
493
493
|
}
|
|
494
|
-
let h =
|
|
495
|
-
|
|
494
|
+
let h = Xt(r) ? r.firstChild : r;
|
|
495
|
+
je(i, r), o.lifecycleNode = (i = h) ?? e;
|
|
496
496
|
});
|
|
497
497
|
}
|
|
498
498
|
function ut(e, t) {
|
|
499
499
|
if (it(t))
|
|
500
|
-
if (
|
|
501
|
-
for (const
|
|
502
|
-
ut(e,
|
|
503
|
-
else if (vt(t) ||
|
|
504
|
-
|
|
505
|
-
else if (
|
|
506
|
-
|
|
507
|
-
else if (
|
|
508
|
-
const
|
|
509
|
-
ut(
|
|
510
|
-
} else Z(t) &&
|
|
500
|
+
if (Ot(t))
|
|
501
|
+
for (const i of [...t])
|
|
502
|
+
ut(e, i);
|
|
503
|
+
else if (vt(t) || le(t))
|
|
504
|
+
qt(e, document.createTextNode(t));
|
|
505
|
+
else if (Me(t))
|
|
506
|
+
qt(e, t);
|
|
507
|
+
else if (Be(t)) {
|
|
508
|
+
const i = e.attachShadow(t.attr);
|
|
509
|
+
ut(i, t.children), Wt(t.ref, i);
|
|
510
|
+
} else Z(t) && Ve(e, t);
|
|
511
511
|
}
|
|
512
|
-
function
|
|
513
|
-
return e == null || (
|
|
514
|
-
Z(
|
|
512
|
+
function de(e) {
|
|
513
|
+
return e == null || (Ot(e) ? e = Array.from(e).map((t) => Z(t) ? t.peek() : t) : W(e) && (e = { ...e }, Object.entries(e).forEach(([t, i]) => {
|
|
514
|
+
Z(i) && (e[t] = i.peek());
|
|
515
515
|
}))), e;
|
|
516
516
|
}
|
|
517
|
-
function
|
|
517
|
+
function Ze(e, t) {
|
|
518
518
|
if (t == null || t === !1 || t === !0)
|
|
519
519
|
return;
|
|
520
|
-
t =
|
|
521
|
-
const
|
|
522
|
-
for (let o of
|
|
520
|
+
t = de(t);
|
|
521
|
+
const i = (st(t) ?? "").split(" ");
|
|
522
|
+
for (let o of i)
|
|
523
523
|
o && e.classList.remove(o);
|
|
524
524
|
}
|
|
525
|
-
function
|
|
525
|
+
function qe(e, t, i) {
|
|
526
526
|
if (t == null || t === !1) {
|
|
527
|
-
|
|
527
|
+
Ze(e, i);
|
|
528
528
|
return;
|
|
529
529
|
}
|
|
530
|
-
|
|
530
|
+
i = de(i), Ot(t) ? t = Array.from(t).map((o) => {
|
|
531
531
|
let r = o;
|
|
532
532
|
return Z(o) && nt(o, (h) => {
|
|
533
533
|
if (h.isInitial) {
|
|
@@ -538,7 +538,7 @@ function _e(e, t, s) {
|
|
|
538
538
|
}, {
|
|
539
539
|
lifecycleNode: e
|
|
540
540
|
}), r;
|
|
541
|
-
}) :
|
|
541
|
+
}) : W(t) && (t = { ...t }, Object.entries(t).forEach(([o, r]) => {
|
|
542
542
|
Z(r) && nt(r, (h) => {
|
|
543
543
|
if (h.isInitial) {
|
|
544
544
|
t[o] = h.newValue;
|
|
@@ -548,22 +548,22 @@ function _e(e, t, s) {
|
|
|
548
548
|
}, {
|
|
549
549
|
lifecycleNode: e
|
|
550
550
|
});
|
|
551
|
-
})), St(e, t,
|
|
551
|
+
})), St(e, t, i);
|
|
552
552
|
}
|
|
553
|
-
function St(e, t,
|
|
553
|
+
function St(e, t, i) {
|
|
554
554
|
const o = (st(t) ?? "").split(" ");
|
|
555
|
-
if (
|
|
556
|
-
const r = (st(
|
|
555
|
+
if (i) {
|
|
556
|
+
const r = (st(i) ?? "").split(" ");
|
|
557
557
|
for (let h of r)
|
|
558
558
|
h && !o.includes(h) && e.classList.remove(h);
|
|
559
559
|
}
|
|
560
560
|
for (let r of o)
|
|
561
561
|
r && e.classList.add(r);
|
|
562
562
|
}
|
|
563
|
-
function
|
|
563
|
+
function Xe(e, t) {
|
|
564
564
|
return e + t.charAt(0).toUpperCase() + t.substring(1);
|
|
565
565
|
}
|
|
566
|
-
var
|
|
566
|
+
var Ye = /* @__PURE__ */ (() => {
|
|
567
567
|
let e = {
|
|
568
568
|
animationIterationCount: 0,
|
|
569
569
|
borderImageOutset: 0,
|
|
@@ -610,51 +610,51 @@ var Ue = /* @__PURE__ */ (() => {
|
|
|
610
610
|
strokeWidth: 0
|
|
611
611
|
};
|
|
612
612
|
const t = ["Webkit", "ms", "Moz", "O"];
|
|
613
|
-
return Object.keys(e).forEach((
|
|
613
|
+
return Object.keys(e).forEach((i) => {
|
|
614
614
|
t.forEach((o) => {
|
|
615
|
-
e[
|
|
615
|
+
e[Xe(o, i)] = 0;
|
|
616
616
|
});
|
|
617
617
|
}), e;
|
|
618
618
|
})();
|
|
619
|
-
function
|
|
620
|
-
t.indexOf("-") === 0 ? e.style.setProperty(t,
|
|
619
|
+
function Rt(e, t, i) {
|
|
620
|
+
t.indexOf("-") === 0 ? e.style.setProperty(t, i) : le(i) && Ye[t] !== 0 ? e.style[t] = i + "px" : e.style[t] = i;
|
|
621
621
|
}
|
|
622
|
-
function
|
|
622
|
+
function Qt(e, t) {
|
|
623
623
|
if (!(t == null || t === !1 || t === !0)) {
|
|
624
624
|
if (vt(t)) {
|
|
625
625
|
e.removeAttribute("style");
|
|
626
626
|
return;
|
|
627
627
|
}
|
|
628
|
-
|
|
629
|
-
|
|
628
|
+
W(t) && Object.keys(t).forEach((i) => {
|
|
629
|
+
Rt(e, i, "");
|
|
630
630
|
});
|
|
631
631
|
}
|
|
632
632
|
}
|
|
633
|
-
function
|
|
633
|
+
function Qe(e, t, i) {
|
|
634
634
|
if (t == null || t === !1 || t === !0) {
|
|
635
|
-
|
|
635
|
+
Qt(e, i);
|
|
636
636
|
return;
|
|
637
637
|
}
|
|
638
638
|
if (vt(t)) {
|
|
639
639
|
e.setAttribute("style", t);
|
|
640
640
|
return;
|
|
641
641
|
}
|
|
642
|
-
if (
|
|
643
|
-
|
|
642
|
+
if (W(t)) {
|
|
643
|
+
W(i) ? (t = { ...t }, Object.keys(i).forEach((o) => {
|
|
644
644
|
o in t || (t[o] = "");
|
|
645
|
-
})) :
|
|
646
|
-
Z(r) ? nt(r, (h) =>
|
|
645
|
+
})) : Qt(e, i), Object.entries(t).forEach(([o, r]) => {
|
|
646
|
+
Z(r) ? nt(r, (h) => Rt(e, o, h.newValue), {
|
|
647
647
|
lifecycleNode: e
|
|
648
|
-
}) :
|
|
648
|
+
}) : Rt(e, o, r);
|
|
649
649
|
});
|
|
650
650
|
return;
|
|
651
651
|
}
|
|
652
652
|
}
|
|
653
|
-
var
|
|
653
|
+
var Ke = "http://www.w3.org/1999/xlink", Je = "http://www.w3.org/XML/1998/namespace";
|
|
654
654
|
function ht(e, t) {
|
|
655
|
-
return e.replace(/[A-Z]/g, (
|
|
655
|
+
return e.replace(/[A-Z]/g, (i) => t + i.toLowerCase());
|
|
656
656
|
}
|
|
657
|
-
var
|
|
657
|
+
var ti = /* @__PURE__ */ new Map([
|
|
658
658
|
["autoComplete", "autocomplete"],
|
|
659
659
|
["autoFocus", "autofocus"],
|
|
660
660
|
["className", "class"],
|
|
@@ -673,58 +673,58 @@ var qe = /* @__PURE__ */ new Map([
|
|
|
673
673
|
["onDoubleClick", "onDblClick"],
|
|
674
674
|
["onDoubleClickCapture", "onDblClickCapture"]
|
|
675
675
|
]);
|
|
676
|
-
function
|
|
676
|
+
function Kt(e, t, i, o) {
|
|
677
677
|
switch (t) {
|
|
678
678
|
case "dataset":
|
|
679
679
|
o != null && Object.entries(o).forEach(([h, u]) => {
|
|
680
680
|
u != null && delete e.dataset[h];
|
|
681
|
-
}), Object.entries(
|
|
681
|
+
}), Object.entries(i).forEach(([h, u]) => {
|
|
682
682
|
u != null && (e.dataset[h] = u);
|
|
683
683
|
});
|
|
684
684
|
return;
|
|
685
685
|
case "textContent":
|
|
686
|
-
it(
|
|
686
|
+
it(i) ? e[t] = i : it(o) && (e[t] = "");
|
|
687
687
|
return;
|
|
688
688
|
case "dangerouslySetInnerHTML":
|
|
689
|
-
|
|
689
|
+
W(i) ? e.innerHTML = i.__html : W(o) && (e.innerHTML = "");
|
|
690
690
|
return;
|
|
691
691
|
case "value":
|
|
692
|
-
if (
|
|
692
|
+
if (i == null) {
|
|
693
693
|
o != null && (e[t] = null);
|
|
694
694
|
return;
|
|
695
695
|
} else {
|
|
696
696
|
if (e instanceof window.HTMLSelectElement)
|
|
697
697
|
return;
|
|
698
698
|
if (e instanceof window.HTMLTextAreaElement) {
|
|
699
|
-
e.value =
|
|
699
|
+
e.value = i;
|
|
700
700
|
return;
|
|
701
701
|
}
|
|
702
702
|
}
|
|
703
703
|
break;
|
|
704
704
|
case "class":
|
|
705
|
-
|
|
705
|
+
qe(e, i, o);
|
|
706
706
|
return;
|
|
707
707
|
case "spellcheck":
|
|
708
|
-
e.spellcheck =
|
|
708
|
+
e.spellcheck = i === "" || i === !0 || i === "true" ? !0 : i === !1 || i === "false" ? !1 : i;
|
|
709
709
|
return;
|
|
710
710
|
case "draggable":
|
|
711
|
-
|
|
711
|
+
i === !1 || i === "false" ? i = "false" : i === "" ? i = null : (i === !0 || i === "true") && (i = "true");
|
|
712
712
|
break;
|
|
713
713
|
case "contenteditable":
|
|
714
|
-
|
|
714
|
+
i === !1 ? i = "false" : (i === "" || i === !0) && (i = "true");
|
|
715
715
|
break;
|
|
716
716
|
case "ref":
|
|
717
717
|
case "namespaceURI":
|
|
718
718
|
return;
|
|
719
719
|
case "style":
|
|
720
|
-
|
|
720
|
+
Qe(e, i, o);
|
|
721
721
|
return;
|
|
722
722
|
case "on":
|
|
723
723
|
case "onCapture":
|
|
724
724
|
const r = t === "onCapture";
|
|
725
725
|
o != null && Object.entries(o).forEach(([h, u]) => {
|
|
726
|
-
(
|
|
727
|
-
}), Object.entries(
|
|
726
|
+
(i == null || i[h] !== u) && e.removeEventListener(h, u, r);
|
|
727
|
+
}), Object.entries(i).forEach(([h, u]) => {
|
|
728
728
|
(o == null || o[h] !== u) && e.addEventListener(h, u, r);
|
|
729
729
|
});
|
|
730
730
|
return;
|
|
@@ -735,84 +735,84 @@ function Yt(e, t, s, o) {
|
|
|
735
735
|
case "xlinkShow":
|
|
736
736
|
case "xlinkTitle":
|
|
737
737
|
case "xlinkType":
|
|
738
|
-
e.setAttributeNS(
|
|
738
|
+
e.setAttributeNS(Ke, ht(t, ":"), i);
|
|
739
739
|
return;
|
|
740
740
|
case "xmlnsXlink":
|
|
741
|
-
e.setAttribute("xmlns:xlink",
|
|
741
|
+
e.setAttribute("xmlns:xlink", i);
|
|
742
742
|
return;
|
|
743
743
|
case "xmlBase":
|
|
744
744
|
case "xmlLang":
|
|
745
745
|
case "xmlSpace":
|
|
746
|
-
e.setAttributeNS(
|
|
746
|
+
e.setAttributeNS(Je, ht(t, ":"), i);
|
|
747
747
|
return;
|
|
748
748
|
}
|
|
749
|
-
if (typeof
|
|
749
|
+
if (typeof i == "function") {
|
|
750
750
|
if (t[0] === "o" && t[1] === "n") {
|
|
751
|
-
if (o != null && o ===
|
|
751
|
+
if (o != null && o === i)
|
|
752
752
|
return;
|
|
753
753
|
let r = t.toLowerCase();
|
|
754
754
|
const h = r.endsWith("capture");
|
|
755
755
|
let u;
|
|
756
|
-
!h && (e[r] === null || o != null && e[r] === o) ? (e[r] =
|
|
756
|
+
!h && (e[r] === null || o != null && e[r] === o) ? (e[r] = i, At(e, ii.bind(e, r))) : h ? (u = r.substring(2, r.length - 7), o != null && e.removeEventListener(u, o, !0), e.addEventListener(u, i, !0)) : (r in window ? u = r.substring(2) : u = r[2] + t.slice(3), o != null && e.removeEventListener(u, o), e.addEventListener(u, i));
|
|
757
757
|
} else
|
|
758
|
-
console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`,
|
|
758
|
+
console.warn(`A function was provided for JSX ${e.tagName} element ${t} which does not start with "on":`, i, e.tagName);
|
|
759
759
|
return;
|
|
760
760
|
}
|
|
761
|
-
if (
|
|
762
|
-
if (o ===
|
|
761
|
+
if (W(o)) {
|
|
762
|
+
if (o === i)
|
|
763
763
|
return;
|
|
764
764
|
delete e[t];
|
|
765
765
|
}
|
|
766
766
|
if (o === !0) {
|
|
767
|
-
if (o ===
|
|
767
|
+
if (o === i)
|
|
768
768
|
return;
|
|
769
769
|
e.removeAttribute(t);
|
|
770
770
|
}
|
|
771
771
|
if (o !== !1 && o != null) {
|
|
772
|
-
if (o ===
|
|
772
|
+
if (o === i)
|
|
773
773
|
return;
|
|
774
|
-
e instanceof SVGElement && !
|
|
774
|
+
e instanceof SVGElement && !jt.test(t) ? e.removeAttributeNS(ht(t, "-"), i) : e.removeAttribute(t);
|
|
775
775
|
}
|
|
776
|
-
if (
|
|
777
|
-
e[t] =
|
|
776
|
+
if (W(i)) {
|
|
777
|
+
e[t] = i;
|
|
778
778
|
return;
|
|
779
779
|
}
|
|
780
|
-
if (
|
|
780
|
+
if (i === !0) {
|
|
781
781
|
e.setAttribute(t, "");
|
|
782
782
|
return;
|
|
783
783
|
}
|
|
784
|
-
|
|
784
|
+
i !== !1 && i != null && (e instanceof SVGElement && !jt.test(t) ? e.setAttribute(ht(t, "-"), i) : e.setAttribute(t, i));
|
|
785
785
|
}
|
|
786
|
-
function
|
|
787
|
-
for (let [
|
|
788
|
-
|
|
786
|
+
function ei(e, t) {
|
|
787
|
+
for (let [i, o] of Object.entries(t))
|
|
788
|
+
i = ti.get(i) ?? i, Z(o) ? nt(o, (r) => Kt(e, i, r.newValue, r.prevValue), {
|
|
789
789
|
lifecycleNode: e
|
|
790
|
-
}) :
|
|
790
|
+
}) : Re(o) ? o[he](e, i) : Kt(e, i, o);
|
|
791
791
|
return e;
|
|
792
792
|
}
|
|
793
|
-
function
|
|
793
|
+
function ii(e) {
|
|
794
794
|
this[e] = null;
|
|
795
795
|
}
|
|
796
|
-
function
|
|
797
|
-
let { children:
|
|
798
|
-
r || (
|
|
796
|
+
function g(e, t) {
|
|
797
|
+
let { children: i, ...o } = t || {}, r = o.namespaceURI;
|
|
798
|
+
r || (Oe.has(e) ? r = We : Fe.has(e) ? r = ze : r = Ne());
|
|
799
799
|
let h;
|
|
800
800
|
if (vt(e)) {
|
|
801
|
-
if (h = r ? document.createElementNS(r, e) : document.createElement(e),
|
|
801
|
+
if (h = r ? document.createElementNS(r, e) : document.createElement(e), ei(h, o), ut(h, i), h instanceof window.HTMLSelectElement && o.value != null)
|
|
802
802
|
if (o.multiple === !0 && Array.isArray(o.value)) {
|
|
803
|
-
const u = o.value.map((
|
|
804
|
-
h.querySelectorAll("option").forEach((
|
|
803
|
+
const u = o.value.map((c) => String(c));
|
|
804
|
+
h.querySelectorAll("option").forEach((c) => c.selected = u.includes(c.value));
|
|
805
805
|
} else
|
|
806
806
|
h.value = o.value;
|
|
807
|
-
|
|
807
|
+
Wt(o.ref, h);
|
|
808
808
|
} else if (typeof e == "function")
|
|
809
|
-
|
|
809
|
+
W(e.defaultProps) && (o = { ...e.defaultProps, ...o }), h = De(e) ? Le(e, o, i) : e({ ...o, children: i });
|
|
810
810
|
else
|
|
811
811
|
throw new TypeError(`Invalid JSX element type: ${e}`);
|
|
812
812
|
return h;
|
|
813
813
|
}
|
|
814
|
-
var
|
|
815
|
-
function
|
|
814
|
+
var si = /* @__PURE__ */ Symbol.for("preact-signals");
|
|
815
|
+
function Ht() {
|
|
816
816
|
if (V > 1)
|
|
817
817
|
V--;
|
|
818
818
|
else {
|
|
@@ -822,158 +822,158 @@ function $t() {
|
|
|
822
822
|
for (pt = void 0; r !== void 0; )
|
|
823
823
|
r.S.v === r.v && (r.S.i = r.i), r = r.o;
|
|
824
824
|
}(); et !== void 0; ) {
|
|
825
|
-
var
|
|
826
|
-
for (et = void 0, gt++;
|
|
827
|
-
var o =
|
|
828
|
-
if (
|
|
829
|
-
|
|
825
|
+
var i = et;
|
|
826
|
+
for (et = void 0, gt++; i !== void 0; ) {
|
|
827
|
+
var o = i.u;
|
|
828
|
+
if (i.u = void 0, i.f &= -3, !(8 & i.f) && pe(i)) try {
|
|
829
|
+
i.c();
|
|
830
830
|
} catch (r) {
|
|
831
831
|
t || (e = r, t = !0);
|
|
832
832
|
}
|
|
833
|
-
|
|
833
|
+
i = o;
|
|
834
834
|
}
|
|
835
835
|
}
|
|
836
836
|
if (gt = 0, V--, t) throw e;
|
|
837
837
|
}
|
|
838
838
|
}
|
|
839
|
-
var
|
|
840
|
-
function
|
|
841
|
-
var t =
|
|
842
|
-
|
|
839
|
+
var x = void 0;
|
|
840
|
+
function ue(e) {
|
|
841
|
+
var t = x;
|
|
842
|
+
x = void 0;
|
|
843
843
|
try {
|
|
844
844
|
return e();
|
|
845
845
|
} finally {
|
|
846
|
-
|
|
846
|
+
x = t;
|
|
847
847
|
}
|
|
848
848
|
}
|
|
849
|
-
var et = void 0, V = 0, gt = 0,
|
|
850
|
-
function
|
|
851
|
-
if (
|
|
849
|
+
var et = void 0, V = 0, gt = 0, Jt = 0, pt = void 0, ft = 0;
|
|
850
|
+
function ge(e) {
|
|
851
|
+
if (x !== void 0) {
|
|
852
852
|
var t = e.n;
|
|
853
|
-
if (t === void 0 || t.t !==
|
|
854
|
-
return t = { i: 0, S: e, p:
|
|
853
|
+
if (t === void 0 || t.t !== x)
|
|
854
|
+
return t = { i: 0, S: e, p: x.s, n: void 0, t: x, e: void 0, x: void 0, r: t }, x.s !== void 0 && (x.s.n = t), x.s = t, e.n = t, 32 & x.f && e.S(t), t;
|
|
855
855
|
if (t.i === -1)
|
|
856
|
-
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p =
|
|
856
|
+
return t.i = 0, t.n !== void 0 && (t.n.p = t.p, t.p !== void 0 && (t.p.n = t.n), t.p = x.s, t.n = void 0, x.s.n = t, x.s = t), t;
|
|
857
857
|
}
|
|
858
858
|
}
|
|
859
|
-
function
|
|
859
|
+
function F(e, t) {
|
|
860
860
|
this.v = e, this.i = 0, this.n = void 0, this.t = void 0, this.l = 0, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
|
|
861
861
|
}
|
|
862
|
-
|
|
863
|
-
|
|
862
|
+
F.prototype.brand = si;
|
|
863
|
+
F.prototype.h = function() {
|
|
864
864
|
return !0;
|
|
865
865
|
};
|
|
866
|
-
|
|
867
|
-
var t = this,
|
|
868
|
-
|
|
866
|
+
F.prototype.S = function(e) {
|
|
867
|
+
var t = this, i = this.t;
|
|
868
|
+
i !== e && e.e === void 0 && (e.x = i, this.t = e, i !== void 0 ? i.e = e : ue(function() {
|
|
869
869
|
var o;
|
|
870
870
|
(o = t.W) == null || o.call(t);
|
|
871
871
|
}));
|
|
872
872
|
};
|
|
873
|
-
|
|
873
|
+
F.prototype.U = function(e) {
|
|
874
874
|
var t = this;
|
|
875
875
|
if (this.t !== void 0) {
|
|
876
|
-
var
|
|
877
|
-
|
|
876
|
+
var i = e.e, o = e.x;
|
|
877
|
+
i !== void 0 && (i.x = o, e.e = void 0), o !== void 0 && (o.e = i, e.x = void 0), e === this.t && (this.t = o, o === void 0 && ue(function() {
|
|
878
878
|
var r;
|
|
879
879
|
(r = t.Z) == null || r.call(t);
|
|
880
880
|
}));
|
|
881
881
|
}
|
|
882
882
|
};
|
|
883
|
-
|
|
883
|
+
F.prototype.subscribe = function(e) {
|
|
884
884
|
var t = this;
|
|
885
|
-
return
|
|
886
|
-
var
|
|
887
|
-
|
|
885
|
+
return oi(function() {
|
|
886
|
+
var i = t.value, o = x;
|
|
887
|
+
x = void 0;
|
|
888
888
|
try {
|
|
889
|
-
e(
|
|
889
|
+
e(i);
|
|
890
890
|
} finally {
|
|
891
|
-
|
|
891
|
+
x = o;
|
|
892
892
|
}
|
|
893
893
|
}, { name: "sub" });
|
|
894
894
|
};
|
|
895
|
-
|
|
895
|
+
F.prototype.valueOf = function() {
|
|
896
896
|
return this.value;
|
|
897
897
|
};
|
|
898
|
-
|
|
898
|
+
F.prototype.toString = function() {
|
|
899
899
|
return this.value + "";
|
|
900
900
|
};
|
|
901
|
-
|
|
901
|
+
F.prototype.toJSON = function() {
|
|
902
902
|
return this.value;
|
|
903
903
|
};
|
|
904
|
-
|
|
905
|
-
var e =
|
|
906
|
-
|
|
904
|
+
F.prototype.peek = function() {
|
|
905
|
+
var e = x;
|
|
906
|
+
x = void 0;
|
|
907
907
|
try {
|
|
908
908
|
return this.value;
|
|
909
909
|
} finally {
|
|
910
|
-
|
|
910
|
+
x = e;
|
|
911
911
|
}
|
|
912
912
|
};
|
|
913
|
-
Object.defineProperty(
|
|
914
|
-
var e =
|
|
913
|
+
Object.defineProperty(F.prototype, "value", { get: function() {
|
|
914
|
+
var e = ge(this);
|
|
915
915
|
return e !== void 0 && (e.i = this.i), this.v;
|
|
916
916
|
}, set: function(e) {
|
|
917
917
|
if (e !== this.v) {
|
|
918
918
|
if (gt > 100) throw new Error("Cycle detected");
|
|
919
|
-
(function(
|
|
920
|
-
V !== 0 && gt === 0 &&
|
|
919
|
+
(function(i) {
|
|
920
|
+
V !== 0 && gt === 0 && i.l !== Jt && (i.l = Jt, pt = { S: i, v: i.v, i: i.i, o: pt });
|
|
921
921
|
})(this), this.v = e, this.i++, ft++, V++;
|
|
922
922
|
try {
|
|
923
923
|
for (var t = this.t; t !== void 0; t = t.x) t.t.N();
|
|
924
924
|
} finally {
|
|
925
|
-
|
|
925
|
+
Ht();
|
|
926
926
|
}
|
|
927
927
|
}
|
|
928
928
|
} });
|
|
929
|
-
function
|
|
929
|
+
function pe(e) {
|
|
930
930
|
for (var t = e.s; t !== void 0; t = t.n) if (t.S.i !== t.i || !t.S.h() || t.S.i !== t.i) return !0;
|
|
931
931
|
return !1;
|
|
932
932
|
}
|
|
933
|
-
function
|
|
933
|
+
function fe(e) {
|
|
934
934
|
for (var t = e.s; t !== void 0; t = t.n) {
|
|
935
|
-
var
|
|
936
|
-
if (
|
|
935
|
+
var i = t.S.n;
|
|
936
|
+
if (i !== void 0 && (t.r = i), t.S.n = t, t.i = -1, t.n === void 0) {
|
|
937
937
|
e.s = t;
|
|
938
938
|
break;
|
|
939
939
|
}
|
|
940
940
|
}
|
|
941
941
|
}
|
|
942
|
-
function
|
|
943
|
-
for (var t = e.s,
|
|
942
|
+
function me(e) {
|
|
943
|
+
for (var t = e.s, i = void 0; t !== void 0; ) {
|
|
944
944
|
var o = t.p;
|
|
945
|
-
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) :
|
|
945
|
+
t.i === -1 ? (t.S.U(t), o !== void 0 && (o.n = t.n), t.n !== void 0 && (t.n.p = o)) : i = t, t.S.n = t.r, t.r !== void 0 && (t.r = void 0), t = o;
|
|
946
946
|
}
|
|
947
|
-
e.s =
|
|
947
|
+
e.s = i;
|
|
948
948
|
}
|
|
949
949
|
function Y(e, t) {
|
|
950
|
-
|
|
950
|
+
F.call(this, void 0), this.x = e, this.s = void 0, this.g = ft - 1, this.f = 4, this.W = t == null ? void 0 : t.watched, this.Z = t == null ? void 0 : t.unwatched, this.name = t == null ? void 0 : t.name;
|
|
951
951
|
}
|
|
952
|
-
Y.prototype = new
|
|
952
|
+
Y.prototype = new F();
|
|
953
953
|
Y.prototype.h = function() {
|
|
954
954
|
if (this.f &= -3, 1 & this.f) return !1;
|
|
955
955
|
if ((36 & this.f) == 32 || (this.f &= -5, this.g === ft)) return !0;
|
|
956
|
-
if (this.g = ft, this.f |= 1, this.i > 0 && !
|
|
956
|
+
if (this.g = ft, this.f |= 1, this.i > 0 && !pe(this))
|
|
957
957
|
return this.f &= -2, !0;
|
|
958
|
-
var e =
|
|
958
|
+
var e = x;
|
|
959
959
|
try {
|
|
960
|
-
|
|
960
|
+
fe(this), x = this;
|
|
961
961
|
var t = this.x();
|
|
962
962
|
(16 & this.f || this.v !== t || this.i === 0) && (this.v = t, this.f &= -17, this.i++);
|
|
963
|
-
} catch (
|
|
964
|
-
this.v =
|
|
963
|
+
} catch (i) {
|
|
964
|
+
this.v = i, this.f |= 16, this.i++;
|
|
965
965
|
}
|
|
966
|
-
return
|
|
966
|
+
return x = e, me(this), this.f &= -2, !0;
|
|
967
967
|
};
|
|
968
968
|
Y.prototype.S = function(e) {
|
|
969
969
|
if (this.t === void 0) {
|
|
970
970
|
this.f |= 36;
|
|
971
971
|
for (var t = this.s; t !== void 0; t = t.n) t.S.S(t);
|
|
972
972
|
}
|
|
973
|
-
|
|
973
|
+
F.prototype.S.call(this, e);
|
|
974
974
|
};
|
|
975
975
|
Y.prototype.U = function(e) {
|
|
976
|
-
if (this.t !== void 0 && (
|
|
976
|
+
if (this.t !== void 0 && (F.prototype.U.call(this, e), this.t === void 0)) {
|
|
977
977
|
this.f &= -33;
|
|
978
978
|
for (var t = this.s; t !== void 0; t = t.n) t.S.U(t);
|
|
979
979
|
}
|
|
@@ -986,32 +986,32 @@ Y.prototype.N = function() {
|
|
|
986
986
|
};
|
|
987
987
|
Object.defineProperty(Y.prototype, "value", { get: function() {
|
|
988
988
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
989
|
-
var e =
|
|
989
|
+
var e = ge(this);
|
|
990
990
|
if (this.h(), e !== void 0 && (e.i = this.i), 16 & this.f) throw this.v;
|
|
991
991
|
return this.v;
|
|
992
992
|
} });
|
|
993
|
-
function
|
|
993
|
+
function we(e) {
|
|
994
994
|
var t = e.m;
|
|
995
995
|
if (e.m = void 0, typeof t == "function") {
|
|
996
996
|
V++;
|
|
997
|
-
var
|
|
998
|
-
|
|
997
|
+
var i = x;
|
|
998
|
+
x = void 0;
|
|
999
999
|
try {
|
|
1000
1000
|
t();
|
|
1001
1001
|
} catch (o) {
|
|
1002
|
-
throw e.f &= -2, e.f |= 8,
|
|
1002
|
+
throw e.f &= -2, e.f |= 8, Bt(e), o;
|
|
1003
1003
|
} finally {
|
|
1004
|
-
|
|
1004
|
+
x = i, Ht();
|
|
1005
1005
|
}
|
|
1006
1006
|
}
|
|
1007
1007
|
}
|
|
1008
|
-
function
|
|
1008
|
+
function Bt(e) {
|
|
1009
1009
|
for (var t = e.s; t !== void 0; t = t.n) t.S.U(t);
|
|
1010
|
-
e.x = void 0, e.s = void 0,
|
|
1010
|
+
e.x = void 0, e.s = void 0, we(e);
|
|
1011
1011
|
}
|
|
1012
|
-
function
|
|
1013
|
-
if (
|
|
1014
|
-
|
|
1012
|
+
function ni(e) {
|
|
1013
|
+
if (x !== this) throw new Error("Out-of-order effect");
|
|
1014
|
+
me(this), x = e, this.f &= -2, 8 & this.f && Bt(this), Ht();
|
|
1015
1015
|
}
|
|
1016
1016
|
function Q(e, t) {
|
|
1017
1017
|
this.x = e, this.m = void 0, this.s = void 0, this.u = void 0, this.f = 32, this.name = t == null ? void 0 : t.name;
|
|
@@ -1028,30 +1028,30 @@ Q.prototype.c = function() {
|
|
|
1028
1028
|
};
|
|
1029
1029
|
Q.prototype.S = function() {
|
|
1030
1030
|
if (1 & this.f) throw new Error("Cycle detected");
|
|
1031
|
-
this.f |= 1, this.f &= -9,
|
|
1032
|
-
var e =
|
|
1033
|
-
return
|
|
1031
|
+
this.f |= 1, this.f &= -9, we(this), fe(this), V++;
|
|
1032
|
+
var e = x;
|
|
1033
|
+
return x = this, ni.bind(this, e);
|
|
1034
1034
|
};
|
|
1035
1035
|
Q.prototype.N = function() {
|
|
1036
1036
|
2 & this.f || (this.f |= 2, this.u = et, et = this);
|
|
1037
1037
|
};
|
|
1038
1038
|
Q.prototype.d = function() {
|
|
1039
|
-
this.f |= 8, 1 & this.f ||
|
|
1039
|
+
this.f |= 8, 1 & this.f || Bt(this);
|
|
1040
1040
|
};
|
|
1041
1041
|
Q.prototype.dispose = function() {
|
|
1042
1042
|
this.d();
|
|
1043
1043
|
};
|
|
1044
|
-
function
|
|
1045
|
-
var
|
|
1044
|
+
function oi(e, t) {
|
|
1045
|
+
var i = new Q(e, t);
|
|
1046
1046
|
try {
|
|
1047
|
-
|
|
1047
|
+
i.c();
|
|
1048
1048
|
} catch (r) {
|
|
1049
|
-
throw
|
|
1049
|
+
throw i.d(), r;
|
|
1050
1050
|
}
|
|
1051
|
-
var o =
|
|
1051
|
+
var o = i.d.bind(i);
|
|
1052
1052
|
return o[Symbol.dispose] = o, o;
|
|
1053
1053
|
}
|
|
1054
|
-
const
|
|
1054
|
+
const ri = {
|
|
1055
1055
|
emptyStateTitle: "No data available.",
|
|
1056
1056
|
thumbnails: "Thumbnails",
|
|
1057
1057
|
singlePageMode: "Single Page Mode",
|
|
@@ -1064,8 +1064,9 @@ const ti = {
|
|
|
1064
1064
|
settings: "Settings",
|
|
1065
1065
|
downloadCatalog: "Download Catalog",
|
|
1066
1066
|
play: "Play",
|
|
1067
|
-
pause: "Pause"
|
|
1068
|
-
|
|
1067
|
+
pause: "Pause",
|
|
1068
|
+
tableOfContents: "Table of Contents"
|
|
1069
|
+
}, ai = {
|
|
1069
1070
|
emptyStateTitle: "Veri bulunamadi.",
|
|
1070
1071
|
thumbnails: "Küçük Resimler",
|
|
1071
1072
|
singlePageMode: "Tek Sayfa Modu",
|
|
@@ -1078,25 +1079,26 @@ const ti = {
|
|
|
1078
1079
|
settings: "Ayarlar",
|
|
1079
1080
|
downloadCatalog: "Kataloğu İndir",
|
|
1080
1081
|
play: "Otomatik Oynat",
|
|
1081
|
-
pause: "Duraklat"
|
|
1082
|
-
|
|
1083
|
-
|
|
1084
|
-
|
|
1082
|
+
pause: "Duraklat",
|
|
1083
|
+
tableOfContents: "İçindekiler"
|
|
1084
|
+
}, Tt = {
|
|
1085
|
+
en: ri,
|
|
1086
|
+
tr: ai
|
|
1085
1087
|
};
|
|
1086
|
-
function
|
|
1088
|
+
function ve(e = {}) {
|
|
1087
1089
|
var r;
|
|
1088
|
-
const t = e.locale ?? "en",
|
|
1090
|
+
const t = e.locale ?? "en", i = Tt[t] ?? Tt.en, o = ((r = e.messages) == null ? void 0 : r[t]) ?? {};
|
|
1089
1091
|
return {
|
|
1090
|
-
...
|
|
1091
|
-
...
|
|
1092
|
+
...Tt.en,
|
|
1093
|
+
...i,
|
|
1092
1094
|
...o
|
|
1093
1095
|
};
|
|
1094
1096
|
}
|
|
1095
|
-
function
|
|
1096
|
-
const t = w(() =>
|
|
1097
|
-
return /* @__PURE__ */
|
|
1098
|
-
/* @__PURE__ */
|
|
1099
|
-
/* @__PURE__ */
|
|
1097
|
+
function hi(e) {
|
|
1098
|
+
const t = w(() => ve({ locale: e.store.locale.value, messages: e.store.messages.value }));
|
|
1099
|
+
return /* @__PURE__ */ g("div", { class: "bk-toolbar", role: "toolbar", "aria-label": "Flipbook controls", children: [
|
|
1100
|
+
/* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
|
|
1101
|
+
/* @__PURE__ */ g(
|
|
1100
1102
|
"button",
|
|
1101
1103
|
{
|
|
1102
1104
|
type: "button",
|
|
@@ -1105,15 +1107,34 @@ function si(e) {
|
|
|
1105
1107
|
"aria-label": w(() => t.value.thumbnails || "Thumbnails"),
|
|
1106
1108
|
"aria-pressed": w(() => e.store.showThumbs.value ? "true" : "false"),
|
|
1107
1109
|
title: w(() => t.value.thumbnails || "Thumbnails"),
|
|
1108
|
-
children: /* @__PURE__ */
|
|
1109
|
-
/* @__PURE__ */
|
|
1110
|
-
/* @__PURE__ */
|
|
1111
|
-
/* @__PURE__ */
|
|
1112
|
-
/* @__PURE__ */
|
|
1110
|
+
children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1111
|
+
/* @__PURE__ */ g("rect", { x: "3", y: "3", width: "7", height: "7" }),
|
|
1112
|
+
/* @__PURE__ */ g("rect", { x: "14", y: "3", width: "7", height: "7" }),
|
|
1113
|
+
/* @__PURE__ */ g("rect", { x: "14", y: "14", width: "7", height: "7" }),
|
|
1114
|
+
/* @__PURE__ */ g("rect", { x: "3", y: "14", width: "7", height: "7" })
|
|
1113
1115
|
] })
|
|
1114
1116
|
}
|
|
1115
1117
|
),
|
|
1116
|
-
/* @__PURE__ */
|
|
1118
|
+
w(() => e.store.toc.value.length ? /* @__PURE__ */ g(
|
|
1119
|
+
"button",
|
|
1120
|
+
{
|
|
1121
|
+
type: "button",
|
|
1122
|
+
class: w(() => e.store.showToc.value ? "bk-btn active" : "bk-btn"),
|
|
1123
|
+
onClick: e.onToggleToc,
|
|
1124
|
+
"aria-label": w(() => t.value.tableOfContents || "Table of Contents"),
|
|
1125
|
+
"aria-pressed": w(() => e.store.showToc.value ? "true" : "false"),
|
|
1126
|
+
title: w(() => t.value.tableOfContents || "Table of Contents"),
|
|
1127
|
+
children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1128
|
+
/* @__PURE__ */ g("line", { x1: "8", y1: "6", x2: "21", y2: "6" }),
|
|
1129
|
+
/* @__PURE__ */ g("line", { x1: "8", y1: "12", x2: "21", y2: "12" }),
|
|
1130
|
+
/* @__PURE__ */ g("line", { x1: "8", y1: "18", x2: "21", y2: "18" }),
|
|
1131
|
+
/* @__PURE__ */ g("line", { x1: "3", y1: "6", x2: "3.01", y2: "6" }),
|
|
1132
|
+
/* @__PURE__ */ g("line", { x1: "3", y1: "12", x2: "3.01", y2: "12" }),
|
|
1133
|
+
/* @__PURE__ */ g("line", { x1: "3", y1: "18", x2: "3.01", y2: "18" })
|
|
1134
|
+
] })
|
|
1135
|
+
}
|
|
1136
|
+
) : null),
|
|
1137
|
+
/* @__PURE__ */ g(
|
|
1117
1138
|
"button",
|
|
1118
1139
|
{
|
|
1119
1140
|
type: "button",
|
|
@@ -1122,16 +1143,16 @@ function si(e) {
|
|
|
1122
1143
|
"aria-label": w(() => t.value.singlePageMode || "Single Page"),
|
|
1123
1144
|
"aria-pressed": w(() => e.store.isSingleMode.value ? "true" : "false"),
|
|
1124
1145
|
title: w(() => t.value.singlePageMode || "Single Page"),
|
|
1125
|
-
children: /* @__PURE__ */
|
|
1126
|
-
/* @__PURE__ */
|
|
1127
|
-
/* @__PURE__ */
|
|
1128
|
-
/* @__PURE__ */
|
|
1129
|
-
/* @__PURE__ */
|
|
1130
|
-
/* @__PURE__ */
|
|
1146
|
+
children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1147
|
+
/* @__PURE__ */ g("path", { d: "M14 2H6a2 2 0 0 0-2 2v16a2 2 0 0 0 2 2h12a2 2 0 0 0 2-2V8z" }),
|
|
1148
|
+
/* @__PURE__ */ g("polyline", { points: "14 2 14 8 20 8" }),
|
|
1149
|
+
/* @__PURE__ */ g("line", { x1: "16", y1: "13", x2: "8", y2: "13" }),
|
|
1150
|
+
/* @__PURE__ */ g("line", { x1: "16", y1: "17", x2: "8", y2: "17" }),
|
|
1151
|
+
/* @__PURE__ */ g("polyline", { points: "10 9 9 9 8 9" })
|
|
1131
1152
|
] })
|
|
1132
1153
|
}
|
|
1133
1154
|
),
|
|
1134
|
-
/* @__PURE__ */
|
|
1155
|
+
/* @__PURE__ */ g(
|
|
1135
1156
|
"button",
|
|
1136
1157
|
{
|
|
1137
1158
|
type: "button",
|
|
@@ -1141,34 +1162,34 @@ function si(e) {
|
|
|
1141
1162
|
"aria-pressed": w(() => e.store.isAutoPlaying.value ? "true" : "false"),
|
|
1142
1163
|
title: w(() => e.store.isAutoPlaying.value ? t.value.pause || "Pause" : t.value.play || "Play"),
|
|
1143
1164
|
children: [
|
|
1144
|
-
/* @__PURE__ */
|
|
1145
|
-
/* @__PURE__ */
|
|
1146
|
-
/* @__PURE__ */
|
|
1165
|
+
/* @__PURE__ */ g("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1166
|
+
/* @__PURE__ */ g("rect", { x: "6", y: "4", width: "4", height: "16" }),
|
|
1167
|
+
/* @__PURE__ */ g("rect", { x: "14", y: "4", width: "4", height: "16" })
|
|
1147
1168
|
] }),
|
|
1148
|
-
/* @__PURE__ */
|
|
1169
|
+
/* @__PURE__ */ g("svg", { style: { display: w(() => e.store.isAutoPlaying.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polygon", { points: "5 3 19 12 5 21 5 3" }) })
|
|
1149
1170
|
]
|
|
1150
1171
|
}
|
|
1151
1172
|
)
|
|
1152
1173
|
] }),
|
|
1153
|
-
/* @__PURE__ */
|
|
1154
|
-
/* @__PURE__ */
|
|
1155
|
-
/* @__PURE__ */
|
|
1156
|
-
const
|
|
1157
|
-
if (e.store.isSingleMode.value ||
|
|
1158
|
-
return `${
|
|
1159
|
-
const r =
|
|
1174
|
+
/* @__PURE__ */ g("div", { class: "bk-btn-group bk-btn-group--center", children: [
|
|
1175
|
+
/* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onPrevPage, "aria-label": w(() => t.value.previous || "Previous"), title: w(() => t.value.previous || "Previous"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polyline", { points: "15 18 9 12 15 6" }) }) }),
|
|
1176
|
+
/* @__PURE__ */ g("span", { class: "bz-page-info", "aria-live": "polite", "aria-atomic": "true", children: w(() => {
|
|
1177
|
+
const i = e.store.currentPage.value, o = e.store.totalPages.value;
|
|
1178
|
+
if (e.store.isSingleMode.value || i === 0 || i >= o - 1)
|
|
1179
|
+
return `${i + 1} / ${o}`;
|
|
1180
|
+
const r = i % 2 === 1 ? i : i - 1;
|
|
1160
1181
|
return `${r + 1}-${r + 2} / ${o}`;
|
|
1161
1182
|
}) }),
|
|
1162
|
-
/* @__PURE__ */
|
|
1183
|
+
/* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onNextPage, "aria-label": w(() => t.value.next || "Next"), title: w(() => t.value.next || "Next"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("polyline", { points: "9 18 15 12 9 6" }) }) })
|
|
1163
1184
|
] }),
|
|
1164
|
-
/* @__PURE__ */
|
|
1165
|
-
/* @__PURE__ */
|
|
1166
|
-
/* @__PURE__ */
|
|
1167
|
-
/* @__PURE__ */
|
|
1168
|
-
/* @__PURE__ */
|
|
1169
|
-
/* @__PURE__ */
|
|
1185
|
+
/* @__PURE__ */ g("div", { class: "bk-btn-group", children: [
|
|
1186
|
+
/* @__PURE__ */ g("button", { type: "button", class: "bk-btn", onClick: e.onZoomIn, "aria-label": w(() => t.value.zoomIn || "Zoom In"), title: w(() => t.value.zoomIn || "Zoom In"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1187
|
+
/* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1188
|
+
/* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
|
|
1189
|
+
/* @__PURE__ */ g("line", { x1: "11", y1: "8", x2: "11", y2: "14" }),
|
|
1190
|
+
/* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
|
|
1170
1191
|
] }) }),
|
|
1171
|
-
/* @__PURE__ */
|
|
1192
|
+
/* @__PURE__ */ g(
|
|
1172
1193
|
"button",
|
|
1173
1194
|
{
|
|
1174
1195
|
type: "button",
|
|
@@ -1176,20 +1197,20 @@ function si(e) {
|
|
|
1176
1197
|
onClick: e.onZoomOut,
|
|
1177
1198
|
"aria-label": w(() => t.value.zoomOut || "Zoom Out"),
|
|
1178
1199
|
title: w(() => t.value.zoomOut || "Zoom Out"),
|
|
1179
|
-
children: /* @__PURE__ */
|
|
1180
|
-
/* @__PURE__ */
|
|
1181
|
-
/* @__PURE__ */
|
|
1182
|
-
/* @__PURE__ */
|
|
1200
|
+
children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1201
|
+
/* @__PURE__ */ g("circle", { cx: "11", cy: "11", r: "8" }),
|
|
1202
|
+
/* @__PURE__ */ g("line", { x1: "21", y1: "21", x2: "16.65", y2: "16.65" }),
|
|
1203
|
+
/* @__PURE__ */ g("line", { x1: "8", y1: "11", x2: "14", y2: "11" })
|
|
1183
1204
|
] })
|
|
1184
1205
|
}
|
|
1185
1206
|
),
|
|
1186
|
-
/* @__PURE__ */
|
|
1187
|
-
w(() => e.store.allowDownload.value && e.store.hasDownloadUrl.value && e.onDownload ? /* @__PURE__ */
|
|
1188
|
-
/* @__PURE__ */
|
|
1189
|
-
/* @__PURE__ */
|
|
1190
|
-
/* @__PURE__ */
|
|
1207
|
+
/* @__PURE__ */ g("button", { type: "button", class: "bk-btn bk-btn--fullscreen", onClick: e.onToggleFullscreen, "aria-label": w(() => t.value.fullscreen || "Fullscreen"), title: w(() => t.value.fullscreen || "Fullscreen"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: /* @__PURE__ */ g("path", { d: "M8 3H5a2 2 0 0 0-2 2v3m18 0V5a2 2 0 0 0-2-2h-3m0 18h3a2 2 0 0 0 2-2v-3M3 16v3a2 2 0 0 0 2 2h3" }) }) }),
|
|
1208
|
+
w(() => e.store.allowDownload.value && e.store.hasDownloadUrl.value && e.onDownload ? /* @__PURE__ */ g("button", { type: "button", class: "bk-btn bk-btn--download", onClick: e.onDownload, "aria-label": w(() => t.value.downloadCatalog || "Download"), title: w(() => t.value.downloadCatalog || "Download"), children: /* @__PURE__ */ g("svg", { xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1209
|
+
/* @__PURE__ */ g("path", { d: "M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4" }),
|
|
1210
|
+
/* @__PURE__ */ g("polyline", { points: "7 10 12 15 17 10" }),
|
|
1211
|
+
/* @__PURE__ */ g("line", { x1: "12", y1: "15", x2: "12", y2: "3" })
|
|
1191
1212
|
] }) }) : null),
|
|
1192
|
-
/* @__PURE__ */
|
|
1213
|
+
/* @__PURE__ */ g(
|
|
1193
1214
|
"button",
|
|
1194
1215
|
{
|
|
1195
1216
|
type: "button",
|
|
@@ -1199,15 +1220,15 @@ function si(e) {
|
|
|
1199
1220
|
"aria-pressed": w(() => e.store.soundEnabled.value ? "true" : "false"),
|
|
1200
1221
|
title: "Sound",
|
|
1201
1222
|
children: [
|
|
1202
|
-
/* @__PURE__ */
|
|
1203
|
-
/* @__PURE__ */
|
|
1204
|
-
/* @__PURE__ */
|
|
1205
|
-
/* @__PURE__ */
|
|
1223
|
+
/* @__PURE__ */ g("svg", { style: { display: w(() => e.store.soundEnabled.value ? "block" : "none") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1224
|
+
/* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1225
|
+
/* @__PURE__ */ g("path", { d: "M15.54 8.46a5 5 0 0 1 0 7.07" }),
|
|
1226
|
+
/* @__PURE__ */ g("path", { d: "M19.07 4.93a10 10 0 0 1 0 14.14" })
|
|
1206
1227
|
] }),
|
|
1207
|
-
/* @__PURE__ */
|
|
1208
|
-
/* @__PURE__ */
|
|
1209
|
-
/* @__PURE__ */
|
|
1210
|
-
/* @__PURE__ */
|
|
1228
|
+
/* @__PURE__ */ g("svg", { style: { display: w(() => e.store.soundEnabled.value ? "none" : "block") }, xmlns: "http://www.w3.org/2000/svg", width: "18", height: "18", viewBox: "0 0 24 24", fill: "none", stroke: "currentColor", "stroke-width": "2", "stroke-linecap": "round", "stroke-linejoin": "round", children: [
|
|
1229
|
+
/* @__PURE__ */ g("polygon", { points: "11 5 6 9 2 9 2 15 6 15 11 19 11 5" }),
|
|
1230
|
+
/* @__PURE__ */ g("line", { x1: "23", y1: "9", x2: "17", y2: "15" }),
|
|
1231
|
+
/* @__PURE__ */ g("line", { x1: "17", y1: "9", x2: "23", y2: "15" })
|
|
1211
1232
|
] })
|
|
1212
1233
|
]
|
|
1213
1234
|
}
|
|
@@ -1215,49 +1236,85 @@ function si(e) {
|
|
|
1215
1236
|
] })
|
|
1216
1237
|
] });
|
|
1217
1238
|
}
|
|
1218
|
-
function
|
|
1219
|
-
return /* @__PURE__ */
|
|
1239
|
+
function li(e) {
|
|
1240
|
+
return /* @__PURE__ */ g("div", { class: "bk-thumbs", style: w(() => e.store.showThumbs.value ? "display:flex;" : "display:none;"), children: e.store.pages.value.map((t, i) => {
|
|
1220
1241
|
const o = () => {
|
|
1221
1242
|
const r = e.store.currentPage.value;
|
|
1222
1243
|
if (e.store.isSingleMode.value || r === 0 || r >= e.store.pages.value.length - 1)
|
|
1223
|
-
return r ===
|
|
1244
|
+
return r === i;
|
|
1224
1245
|
const h = r % 2 === 1 ? r : r - 1;
|
|
1225
|
-
return
|
|
1246
|
+
return i === h || i === h + 1;
|
|
1226
1247
|
};
|
|
1227
|
-
return /* @__PURE__ */
|
|
1248
|
+
return /* @__PURE__ */ g(
|
|
1228
1249
|
"div",
|
|
1229
1250
|
{
|
|
1230
1251
|
class: w(() => `thumb-item ${o() ? "active" : ""}`),
|
|
1231
1252
|
role: "button",
|
|
1232
1253
|
tabindex: "0",
|
|
1233
|
-
"aria-label": `Go to page ${
|
|
1254
|
+
"aria-label": `Go to page ${i + 1}`,
|
|
1234
1255
|
"aria-current": w(() => o() ? "page" : void 0),
|
|
1235
|
-
onClick: () => e.onThumbClick(
|
|
1256
|
+
onClick: () => e.onThumbClick(i),
|
|
1236
1257
|
onKeyDown: (r) => {
|
|
1237
|
-
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(
|
|
1258
|
+
(r.key === "Enter" || r.key === " ") && (r.preventDefault(), e.onThumbClick(i));
|
|
1238
1259
|
},
|
|
1239
|
-
children: [
|
|
1240
|
-
/* @__PURE__ */
|
|
1260
|
+
children: /* @__PURE__ */ g("div", { class: "thumb-img-wrapper", children: [
|
|
1261
|
+
/* @__PURE__ */ g(
|
|
1241
1262
|
"img",
|
|
1242
1263
|
{
|
|
1243
|
-
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
|
|
1244
|
-
class: "thumb-img"
|
|
1264
|
+
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
|
|
1265
|
+
class: `thumb-img ${t.cropMode !== "full" ? "thumb-img--split thumb-img--" + t.cropMode : ""}`,
|
|
1245
1266
|
src: t.thumb || t.low || t.normal,
|
|
1246
|
-
alt: `Page ${
|
|
1267
|
+
alt: `Page ${i + 1}`,
|
|
1247
1268
|
loading: "lazy",
|
|
1248
1269
|
onError: (r) => {
|
|
1249
1270
|
r.currentTarget.style.display = "none";
|
|
1250
1271
|
}
|
|
1251
1272
|
}
|
|
1252
|
-
)
|
|
1253
|
-
/* @__PURE__ */
|
|
1254
|
-
]
|
|
1273
|
+
),
|
|
1274
|
+
/* @__PURE__ */ g("span", { class: "thumb-page-number", children: i + 1 })
|
|
1275
|
+
] })
|
|
1255
1276
|
}
|
|
1256
1277
|
);
|
|
1257
1278
|
}) });
|
|
1258
1279
|
}
|
|
1259
|
-
function
|
|
1260
|
-
return /* @__PURE__ */
|
|
1280
|
+
function ye(e, t, i) {
|
|
1281
|
+
return /* @__PURE__ */ g("ol", { class: "bk-toc-list", children: e.map((o) => {
|
|
1282
|
+
var r;
|
|
1283
|
+
return /* @__PURE__ */ g("li", { class: "bk-toc-item", children: [
|
|
1284
|
+
/* @__PURE__ */ g(
|
|
1285
|
+
"button",
|
|
1286
|
+
{
|
|
1287
|
+
type: "button",
|
|
1288
|
+
class: w(() => t.currentPage.value === o.pageIndex ? "bk-toc-entry active" : "bk-toc-entry"),
|
|
1289
|
+
"aria-current": w(() => t.currentPage.value === o.pageIndex ? "page" : void 0),
|
|
1290
|
+
onClick: () => i(o.pageIndex),
|
|
1291
|
+
children: [
|
|
1292
|
+
/* @__PURE__ */ g("span", { class: "bk-toc-title", children: o.title }),
|
|
1293
|
+
/* @__PURE__ */ g("span", { class: "bk-toc-page", children: o.pageIndex + 1 })
|
|
1294
|
+
]
|
|
1295
|
+
}
|
|
1296
|
+
),
|
|
1297
|
+
(r = o.children) != null && r.length ? ye(o.children, t, i) : null
|
|
1298
|
+
] });
|
|
1299
|
+
}) });
|
|
1300
|
+
}
|
|
1301
|
+
function ci(e) {
|
|
1302
|
+
const t = w(() => ve({ locale: e.store.locale.value, messages: e.store.messages.value }));
|
|
1303
|
+
return /* @__PURE__ */ g(
|
|
1304
|
+
"nav",
|
|
1305
|
+
{
|
|
1306
|
+
class: "bk-toc",
|
|
1307
|
+
"aria-label": w(() => t.value.tableOfContents || "Table of Contents"),
|
|
1308
|
+
style: w(() => e.store.showToc.value && e.store.toc.value.length ? "display:flex;" : "display:none;"),
|
|
1309
|
+
children: [
|
|
1310
|
+
/* @__PURE__ */ g("div", { class: "bk-toc-heading", children: w(() => t.value.tableOfContents || "Table of Contents") }),
|
|
1311
|
+
ye(e.store.toc.value, e.store, e.onEntryClick)
|
|
1312
|
+
]
|
|
1313
|
+
}
|
|
1314
|
+
);
|
|
1315
|
+
}
|
|
1316
|
+
function di(e) {
|
|
1317
|
+
return /* @__PURE__ */ g(
|
|
1261
1318
|
"div",
|
|
1262
1319
|
{
|
|
1263
1320
|
role: "region",
|
|
@@ -1267,56 +1324,56 @@ function oi(e) {
|
|
|
1267
1324
|
return e.store.isDoublePageLayout.value && (t += "double-mode "), e.store.isFrontCover.value && (t += "bk-is-cover "), e.store.isBackCover.value && (t += "bk-is-back-cover "), e.store.zoomState.value.isActive && (t += "zoomed "), t.trim();
|
|
1268
1325
|
}),
|
|
1269
1326
|
ref: e.bookWrapperRef,
|
|
1270
|
-
children: /* @__PURE__ */
|
|
1327
|
+
children: /* @__PURE__ */ g(
|
|
1271
1328
|
"div",
|
|
1272
1329
|
{
|
|
1273
1330
|
class: "bk-book-sizer",
|
|
1274
1331
|
ref: e.bookSizerRef,
|
|
1275
1332
|
children: [
|
|
1276
|
-
/* @__PURE__ */
|
|
1333
|
+
/* @__PURE__ */ g(
|
|
1277
1334
|
"div",
|
|
1278
1335
|
{
|
|
1279
1336
|
ref: e.bookContainerRef,
|
|
1280
1337
|
class: w(() => "bk-book " + (e.store.flipState.value !== "read" ? "is-flipping" : "")),
|
|
1281
1338
|
style: w(() => `display: ${e.store.isSingleMode.value ? "none" : "block"};`),
|
|
1282
|
-
children: e.store.pages.value.map((t,
|
|
1283
|
-
const o =
|
|
1284
|
-
return /* @__PURE__ */
|
|
1339
|
+
children: e.store.pages.value.map((t, i) => {
|
|
1340
|
+
const o = i === 0 || i === e.store.pages.value.length - 1;
|
|
1341
|
+
return /* @__PURE__ */ g(
|
|
1285
1342
|
"div",
|
|
1286
1343
|
{
|
|
1287
|
-
class: `bz-page ${
|
|
1344
|
+
class: `bz-page ${i === 0 ? "bz-page--cover" : ""} ${i === e.store.pages.value.length - 1 ? "bz-page--back" : ""}`,
|
|
1288
1345
|
"data-density": o ? "hard" : "soft",
|
|
1289
|
-
"data-idx":
|
|
1290
|
-
children: /* @__PURE__ */
|
|
1291
|
-
/* @__PURE__ */
|
|
1346
|
+
"data-idx": i,
|
|
1347
|
+
children: /* @__PURE__ */ g("div", { class: "bz-page-content", style: "position:relative; width:100%; height:100%; overflow:hidden;", children: [
|
|
1348
|
+
/* @__PURE__ */ g(
|
|
1292
1349
|
"img",
|
|
1293
1350
|
{
|
|
1294
|
-
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
|
|
1351
|
+
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
|
|
1295
1352
|
src: t.low || t.normal,
|
|
1296
1353
|
"data-src": t.normal,
|
|
1297
1354
|
class: `page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
|
|
1298
|
-
alt: `Page ${
|
|
1355
|
+
alt: `Page ${i + 1}`,
|
|
1299
1356
|
loading: "lazy"
|
|
1300
1357
|
}
|
|
1301
1358
|
),
|
|
1302
|
-
/* @__PURE__ */
|
|
1359
|
+
/* @__PURE__ */ g("div", { class: "page-shadow" })
|
|
1303
1360
|
] })
|
|
1304
1361
|
}
|
|
1305
1362
|
);
|
|
1306
1363
|
})
|
|
1307
1364
|
}
|
|
1308
1365
|
),
|
|
1309
|
-
/* @__PURE__ */
|
|
1366
|
+
/* @__PURE__ */ g(
|
|
1310
1367
|
"div",
|
|
1311
1368
|
{
|
|
1312
1369
|
class: "bk-single-view",
|
|
1313
1370
|
style: w(() => `display: ${e.store.isSingleMode.value ? "flex" : "none"}; width: 100%; height: 100%; justify-content: center; align-items: center; position: absolute; top: 0; left: 0; z-index: 10;`),
|
|
1314
1371
|
children: w(() => {
|
|
1315
1372
|
const t = e.store.pages.value[e.store.currentPage.value];
|
|
1316
|
-
return t ? /* @__PURE__ */
|
|
1373
|
+
return t ? /* @__PURE__ */ g(
|
|
1317
1374
|
"img",
|
|
1318
1375
|
{
|
|
1319
|
-
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.pageNumber : void 0,
|
|
1376
|
+
"data-pdf-page": t.assetId.startsWith("pdf-page-") ? t.sourcePageNumber ?? t.pageNumber : void 0,
|
|
1320
1377
|
class: `bk-single-img page-content ${t.cropMode !== "full" ? "page-content--split page-content--" + t.cropMode : ""}`,
|
|
1321
1378
|
src: e.store.zoomState.value.isActive ? t.normal : t.low || t.normal,
|
|
1322
1379
|
alt: `Page ${e.store.currentPage.value + 1}`,
|
|
@@ -1332,10 +1389,10 @@ function oi(e) {
|
|
|
1332
1389
|
}
|
|
1333
1390
|
);
|
|
1334
1391
|
}
|
|
1335
|
-
function
|
|
1336
|
-
const t = w(() => e.store.showArrows.value && e.store.currentPage.value > 0),
|
|
1337
|
-
return /* @__PURE__ */
|
|
1338
|
-
/* @__PURE__ */
|
|
1392
|
+
function ui(e) {
|
|
1393
|
+
const t = w(() => e.store.showArrows.value && e.store.currentPage.value > 0), i = w(() => !e.store.showArrows.value || e.store.totalPages.value <= 1 ? !1 : e.store.currentPage.value < e.store.totalPages.value - 1);
|
|
1394
|
+
return /* @__PURE__ */ g("div", { class: "bk-nav-arrows", style: w(() => e.store.showArrows.value ? "display: flex;" : "display: none;"), children: [
|
|
1395
|
+
/* @__PURE__ */ g(
|
|
1339
1396
|
"button",
|
|
1340
1397
|
{
|
|
1341
1398
|
type: "button",
|
|
@@ -1345,55 +1402,59 @@ function ri(e) {
|
|
|
1345
1402
|
o.preventDefault(), e.onPrevPage();
|
|
1346
1403
|
},
|
|
1347
1404
|
"aria-label": "Previous Page",
|
|
1348
|
-
children: /* @__PURE__ */
|
|
1405
|
+
children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-left" })
|
|
1349
1406
|
}
|
|
1350
1407
|
),
|
|
1351
|
-
/* @__PURE__ */
|
|
1408
|
+
/* @__PURE__ */ g(
|
|
1352
1409
|
"button",
|
|
1353
1410
|
{
|
|
1354
1411
|
type: "button",
|
|
1355
1412
|
class: "bk-nav-arrow bk-nav-next",
|
|
1356
|
-
style: w(() =>
|
|
1413
|
+
style: w(() => i.value ? "visibility: visible;" : "visibility: hidden;"),
|
|
1357
1414
|
onClick: (o) => {
|
|
1358
1415
|
o.preventDefault(), e.onNextPage();
|
|
1359
1416
|
},
|
|
1360
1417
|
"aria-label": "Next Page",
|
|
1361
|
-
children: /* @__PURE__ */
|
|
1418
|
+
children: /* @__PURE__ */ g("div", { class: "bk-arrow-icon bk-arrow-right" })
|
|
1362
1419
|
}
|
|
1363
1420
|
)
|
|
1364
1421
|
] });
|
|
1365
1422
|
}
|
|
1366
|
-
function
|
|
1423
|
+
function gi(e) {
|
|
1367
1424
|
const t = () => {
|
|
1368
1425
|
e.store.showThumbs.value = !e.store.showThumbs.value;
|
|
1369
|
-
},
|
|
1370
|
-
e.store.
|
|
1426
|
+
}, i = () => {
|
|
1427
|
+
e.store.showToc.value = !e.store.showToc.value;
|
|
1371
1428
|
}, o = () => {
|
|
1372
|
-
e.store.
|
|
1429
|
+
e.store.isSingleMode.value = !e.store.isSingleMode.value;
|
|
1373
1430
|
}, r = () => {
|
|
1374
|
-
|
|
1375
|
-
(b = e.interactionManagerRef.current) == null || b.zoomIn();
|
|
1431
|
+
e.store.isAutoPlaying.value = !e.store.isAutoPlaying.value;
|
|
1376
1432
|
}, h = () => {
|
|
1377
|
-
var
|
|
1378
|
-
(
|
|
1379
|
-
}, u = () =>
|
|
1380
|
-
var
|
|
1381
|
-
|
|
1382
|
-
},
|
|
1383
|
-
|
|
1384
|
-
|
|
1385
|
-
|
|
1386
|
-
|
|
1387
|
-
|
|
1433
|
+
var S;
|
|
1434
|
+
(S = e.interactionManagerRef.current) == null || S.zoomIn();
|
|
1435
|
+
}, u = () => {
|
|
1436
|
+
var S;
|
|
1437
|
+
(S = e.interactionManagerRef.current) == null || S.zoomOut();
|
|
1438
|
+
}, c = () => e.onToggleFullscreen(), b = (S) => {
|
|
1439
|
+
e.store.currentPage.value = S, e.store.showToc.value = !1;
|
|
1440
|
+
}, P = (S) => {
|
|
1441
|
+
var T;
|
|
1442
|
+
e.store.currentPage.value !== S && (e.store.currentPage.value = S, (T = e.pageFlipAdapterRef.current) == null || T.playSound());
|
|
1443
|
+
}, k = () => {
|
|
1444
|
+
var S;
|
|
1445
|
+
(S = e.pageFlipAdapterRef.current) == null || S.turnToNextPage();
|
|
1446
|
+
}, I = () => {
|
|
1447
|
+
var S;
|
|
1448
|
+
(S = e.pageFlipAdapterRef.current) == null || S.turnToPrevPage();
|
|
1388
1449
|
};
|
|
1389
|
-
return /* @__PURE__ */
|
|
1450
|
+
return /* @__PURE__ */ g(
|
|
1390
1451
|
"div",
|
|
1391
1452
|
{
|
|
1392
1453
|
class: w(() => `bk-wrapper bk-theme-${e.store.themeMode.value} ${e.className || ""}`),
|
|
1393
1454
|
children: [
|
|
1394
|
-
/* @__PURE__ */
|
|
1395
|
-
/* @__PURE__ */
|
|
1396
|
-
|
|
1455
|
+
/* @__PURE__ */ g("div", { class: "bk-main-area", children: [
|
|
1456
|
+
/* @__PURE__ */ g(
|
|
1457
|
+
di,
|
|
1397
1458
|
{
|
|
1398
1459
|
store: e.store,
|
|
1399
1460
|
bookWrapperRef: e.bookWrapperRef,
|
|
@@ -1401,78 +1462,80 @@ function ai(e) {
|
|
|
1401
1462
|
bookContainerRef: e.bookContainerRef
|
|
1402
1463
|
}
|
|
1403
1464
|
),
|
|
1404
|
-
/* @__PURE__ */
|
|
1405
|
-
|
|
1465
|
+
/* @__PURE__ */ g(
|
|
1466
|
+
ui,
|
|
1406
1467
|
{
|
|
1407
1468
|
store: e.store,
|
|
1408
|
-
onPrevPage:
|
|
1409
|
-
onNextPage:
|
|
1469
|
+
onPrevPage: I,
|
|
1470
|
+
onNextPage: k
|
|
1410
1471
|
}
|
|
1411
1472
|
),
|
|
1412
|
-
e.store.whiteLabel.value ? null : /* @__PURE__ */
|
|
1473
|
+
e.store.whiteLabel.value ? null : /* @__PURE__ */ g("div", { class: "bk-watermark", children: [
|
|
1413
1474
|
"Powered by ",
|
|
1414
|
-
/* @__PURE__ */
|
|
1415
|
-
] })
|
|
1475
|
+
/* @__PURE__ */ g("a", { href: "https://flipbookengine.com", target: "_blank", rel: "noopener", style: "text-decoration: underline;", children: "FlipbookEngine" })
|
|
1476
|
+
] }),
|
|
1477
|
+
/* @__PURE__ */ g(ci, { store: e.store, onEntryClick: b })
|
|
1416
1478
|
] }),
|
|
1417
|
-
/* @__PURE__ */
|
|
1418
|
-
|
|
1479
|
+
/* @__PURE__ */ g(
|
|
1480
|
+
hi,
|
|
1419
1481
|
{
|
|
1420
1482
|
store: e.store,
|
|
1421
1483
|
onToggleThumbs: t,
|
|
1422
|
-
|
|
1423
|
-
|
|
1424
|
-
|
|
1484
|
+
onToggleToc: i,
|
|
1485
|
+
onToggleSingleMode: o,
|
|
1486
|
+
onZoomIn: h,
|
|
1487
|
+
onZoomOut: u,
|
|
1425
1488
|
onDownload: e.onDownload,
|
|
1426
|
-
onNextPage:
|
|
1427
|
-
onPrevPage:
|
|
1489
|
+
onNextPage: k,
|
|
1490
|
+
onPrevPage: I,
|
|
1428
1491
|
onSoundToggle: () => e.store.soundEnabled.value = !e.store.soundEnabled.value,
|
|
1429
|
-
onToggleAutoPlay:
|
|
1430
|
-
onToggleFullscreen:
|
|
1492
|
+
onToggleAutoPlay: r,
|
|
1493
|
+
onToggleFullscreen: c
|
|
1431
1494
|
}
|
|
1432
1495
|
),
|
|
1433
|
-
/* @__PURE__ */
|
|
1434
|
-
|
|
1496
|
+
/* @__PURE__ */ g(
|
|
1497
|
+
li,
|
|
1435
1498
|
{
|
|
1436
1499
|
store: e.store,
|
|
1437
|
-
onThumbClick:
|
|
1500
|
+
onThumbClick: P
|
|
1438
1501
|
}
|
|
1439
1502
|
)
|
|
1440
1503
|
]
|
|
1441
1504
|
}
|
|
1442
1505
|
);
|
|
1443
1506
|
}
|
|
1444
|
-
var
|
|
1507
|
+
var pi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : typeof global < "u" ? global : typeof self < "u" ? self : {}, It = { exports: {} };
|
|
1445
1508
|
(function(e, t) {
|
|
1446
|
-
(function(
|
|
1509
|
+
(function(i, o) {
|
|
1447
1510
|
o(t);
|
|
1448
|
-
})(
|
|
1511
|
+
})(pi, function(i) {
|
|
1449
1512
|
class o {
|
|
1450
|
-
constructor(
|
|
1451
|
-
this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = n, this.nowDrawingDensity = this.createdDensity, this.render =
|
|
1513
|
+
constructor(s, n) {
|
|
1514
|
+
this.state = { angle: 0, area: [], position: { x: 0, y: 0 }, hardAngle: 0, hardDrawingAngle: 0 }, this.createdDensity = n, this.nowDrawingDensity = this.createdDensity, this.render = s;
|
|
1452
1515
|
}
|
|
1453
|
-
setDensity(
|
|
1454
|
-
this.createdDensity =
|
|
1516
|
+
setDensity(s) {
|
|
1517
|
+
this.createdDensity = s, this.nowDrawingDensity = s;
|
|
1455
1518
|
}
|
|
1456
|
-
setDrawingDensity(
|
|
1457
|
-
this.nowDrawingDensity =
|
|
1519
|
+
setDrawingDensity(s) {
|
|
1520
|
+
this.nowDrawingDensity = s;
|
|
1458
1521
|
}
|
|
1459
|
-
setPosition(
|
|
1460
|
-
this.state.position =
|
|
1522
|
+
setPosition(s) {
|
|
1523
|
+
this.state.position = s;
|
|
1461
1524
|
}
|
|
1462
|
-
setAngle(
|
|
1463
|
-
this.state.angle =
|
|
1525
|
+
setAngle(s) {
|
|
1526
|
+
this.state.angle = s;
|
|
1464
1527
|
}
|
|
1465
|
-
setArea(
|
|
1466
|
-
this.state.area =
|
|
1528
|
+
setArea(s) {
|
|
1529
|
+
this.state.area = s;
|
|
1467
1530
|
}
|
|
1468
|
-
setHardDrawingAngle(
|
|
1469
|
-
this.state.hardDrawingAngle =
|
|
1531
|
+
setHardDrawingAngle(s) {
|
|
1532
|
+
this.state.hardDrawingAngle = s;
|
|
1470
1533
|
}
|
|
1471
|
-
setHardAngle(
|
|
1472
|
-
this.state.hardAngle =
|
|
1534
|
+
setHardAngle(s) {
|
|
1535
|
+
this.state.hardAngle = s, this.state.hardDrawingAngle = s;
|
|
1473
1536
|
}
|
|
1474
|
-
setOrientation(
|
|
1475
|
-
this.orientation =
|
|
1537
|
+
setOrientation(s) {
|
|
1538
|
+
this.orientation = s;
|
|
1476
1539
|
}
|
|
1477
1540
|
getDrawingDensity() {
|
|
1478
1541
|
return this.nowDrawingDensity;
|
|
@@ -1485,23 +1548,23 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1485
1548
|
}
|
|
1486
1549
|
}
|
|
1487
1550
|
class r extends o {
|
|
1488
|
-
constructor(
|
|
1489
|
-
super(
|
|
1551
|
+
constructor(s, n, a) {
|
|
1552
|
+
super(s, a), this.image = null, this.isLoad = !1, this.loadingAngle = 0, this.image = new Image(), this.image.src = n;
|
|
1490
1553
|
}
|
|
1491
|
-
draw(
|
|
1554
|
+
draw(s) {
|
|
1492
1555
|
const n = this.render.getContext(), a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, d = this.render.getRect().height;
|
|
1493
1556
|
n.save(), n.translate(a.x, a.y), n.beginPath();
|
|
1494
|
-
for (let
|
|
1557
|
+
for (let p of this.state.area) p !== null && (p = this.render.convertToGlobal(p), n.lineTo(p.x - a.x, p.y - a.y));
|
|
1495
1558
|
n.rotate(this.state.angle), n.clip(), this.isLoad ? n.drawImage(this.image, 0, 0, l, d) : this.drawLoader(n, { x: 0, y: 0 }, l, d), n.restore();
|
|
1496
1559
|
}
|
|
1497
|
-
simpleDraw(
|
|
1498
|
-
const n = this.render.getRect(), a = this.render.getContext(), l = n.pageWidth, d = n.height,
|
|
1499
|
-
this.isLoad ? a.drawImage(this.image,
|
|
1560
|
+
simpleDraw(s) {
|
|
1561
|
+
const n = this.render.getRect(), a = this.render.getContext(), l = n.pageWidth, d = n.height, p = s === 1 ? n.left + n.pageWidth : n.left, y = n.top;
|
|
1562
|
+
this.isLoad ? a.drawImage(this.image, p, y, l, d) : this.drawLoader(a, { x: p, y }, l, d);
|
|
1500
1563
|
}
|
|
1501
|
-
drawLoader(
|
|
1502
|
-
|
|
1564
|
+
drawLoader(s, n, a, l) {
|
|
1565
|
+
s.beginPath(), s.strokeStyle = "rgb(200, 200, 200)", s.fillStyle = "rgb(255, 255, 255)", s.lineWidth = 1, s.rect(n.x + 1, n.y + 1, a - 1, l - 1), s.stroke(), s.fill();
|
|
1503
1566
|
const d = { x: n.x + a / 2, y: n.y + l / 2 };
|
|
1504
|
-
|
|
1567
|
+
s.beginPath(), s.lineWidth = 10, s.arc(d.x, d.y, 20, this.loadingAngle, 3 * Math.PI / 2 + this.loadingAngle), s.stroke(), s.closePath(), this.loadingAngle += 0.07, this.loadingAngle >= 2 * Math.PI && (this.loadingAngle = 0);
|
|
1505
1568
|
}
|
|
1506
1569
|
load() {
|
|
1507
1570
|
this.isLoad || (this.image.onload = () => {
|
|
@@ -1518,8 +1581,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1518
1581
|
}
|
|
1519
1582
|
}
|
|
1520
1583
|
class h {
|
|
1521
|
-
constructor(
|
|
1522
|
-
this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = n, this.app =
|
|
1584
|
+
constructor(s, n) {
|
|
1585
|
+
this.pages = [], this.currentPageIndex = 0, this.currentSpreadIndex = 0, this.landscapeSpread = [], this.portraitSpread = [], this.render = n, this.app = s, this.currentPageIndex = 0, this.isShowCover = this.app.getSettings().showCover;
|
|
1523
1586
|
}
|
|
1524
1587
|
destroy() {
|
|
1525
1588
|
this.pages = [];
|
|
@@ -1527,16 +1590,16 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1527
1590
|
createSpread() {
|
|
1528
1591
|
this.landscapeSpread = [], this.portraitSpread = [];
|
|
1529
1592
|
for (let n = 0; n < this.pages.length; n++) this.portraitSpread.push([n]);
|
|
1530
|
-
let
|
|
1531
|
-
this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([
|
|
1532
|
-
for (let n =
|
|
1593
|
+
let s = 0;
|
|
1594
|
+
this.isShowCover && (this.pages[0].setDensity("hard"), this.landscapeSpread.push([s]), s++);
|
|
1595
|
+
for (let n = s; n < this.pages.length; n += 2) n < this.pages.length - 1 ? this.landscapeSpread.push([n, n + 1]) : (this.landscapeSpread.push([n]), this.pages[n].setDensity("hard"));
|
|
1533
1596
|
}
|
|
1534
1597
|
getSpread() {
|
|
1535
1598
|
return this.render.getOrientation() === "landscape" ? this.landscapeSpread : this.portraitSpread;
|
|
1536
1599
|
}
|
|
1537
|
-
getSpreadIndexByPage(
|
|
1600
|
+
getSpreadIndexByPage(s) {
|
|
1538
1601
|
const n = this.getSpread();
|
|
1539
|
-
for (let a = 0; a < n.length; a++) if (
|
|
1602
|
+
for (let a = 0; a < n.length; a++) if (s === n[a][0] || s === n[a][1]) return a;
|
|
1540
1603
|
return null;
|
|
1541
1604
|
}
|
|
1542
1605
|
getPageCount() {
|
|
@@ -1545,32 +1608,32 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1545
1608
|
getPages() {
|
|
1546
1609
|
return this.pages;
|
|
1547
1610
|
}
|
|
1548
|
-
getPage(
|
|
1549
|
-
if (
|
|
1611
|
+
getPage(s) {
|
|
1612
|
+
if (s >= 0 && s < this.pages.length) return this.pages[s];
|
|
1550
1613
|
throw new Error("Invalid page number");
|
|
1551
1614
|
}
|
|
1552
|
-
nextBy(
|
|
1553
|
-
const n = this.pages.indexOf(
|
|
1615
|
+
nextBy(s) {
|
|
1616
|
+
const n = this.pages.indexOf(s);
|
|
1554
1617
|
return n < this.pages.length - 1 ? this.pages[n + 1] : null;
|
|
1555
1618
|
}
|
|
1556
|
-
prevBy(
|
|
1557
|
-
const n = this.pages.indexOf(
|
|
1619
|
+
prevBy(s) {
|
|
1620
|
+
const n = this.pages.indexOf(s);
|
|
1558
1621
|
return n > 0 ? this.pages[n - 1] : null;
|
|
1559
1622
|
}
|
|
1560
|
-
getFlippingPage(
|
|
1623
|
+
getFlippingPage(s) {
|
|
1561
1624
|
const n = this.currentSpreadIndex;
|
|
1562
|
-
if (this.render.getOrientation() === "portrait") return
|
|
1625
|
+
if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[n].newTemporaryCopy() : this.pages[n - 1];
|
|
1563
1626
|
{
|
|
1564
|
-
const a =
|
|
1565
|
-
return a.length === 1 ||
|
|
1627
|
+
const a = s === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
|
|
1628
|
+
return a.length === 1 || s === 0 ? this.pages[a[0]] : this.pages[a[1]];
|
|
1566
1629
|
}
|
|
1567
1630
|
}
|
|
1568
|
-
getBottomPage(
|
|
1631
|
+
getBottomPage(s) {
|
|
1569
1632
|
const n = this.currentSpreadIndex;
|
|
1570
|
-
if (this.render.getOrientation() === "portrait") return
|
|
1633
|
+
if (this.render.getOrientation() === "portrait") return s === 0 ? this.pages[n + 1] : this.pages[n - 1];
|
|
1571
1634
|
{
|
|
1572
|
-
const a =
|
|
1573
|
-
return a.length === 1 ? this.pages[a[0]] :
|
|
1635
|
+
const a = s === 0 ? this.getSpread()[n + 1] : this.getSpread()[n - 1];
|
|
1636
|
+
return a.length === 1 ? this.pages[a[0]] : s === 0 ? this.pages[a[1]] : this.pages[a[0]];
|
|
1574
1637
|
}
|
|
1575
1638
|
}
|
|
1576
1639
|
showNext() {
|
|
@@ -1582,84 +1645,84 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1582
1645
|
getCurrentPageIndex() {
|
|
1583
1646
|
return this.currentPageIndex;
|
|
1584
1647
|
}
|
|
1585
|
-
show(
|
|
1586
|
-
if (
|
|
1587
|
-
const n = this.getSpreadIndexByPage(
|
|
1648
|
+
show(s = null) {
|
|
1649
|
+
if (s === null && (s = this.currentPageIndex), s < 0 || s >= this.pages.length) return;
|
|
1650
|
+
const n = this.getSpreadIndexByPage(s);
|
|
1588
1651
|
n !== null && (this.currentSpreadIndex = n, this.showSpread());
|
|
1589
1652
|
}
|
|
1590
1653
|
getCurrentSpreadIndex() {
|
|
1591
1654
|
return this.currentSpreadIndex;
|
|
1592
1655
|
}
|
|
1593
|
-
setCurrentSpreadIndex(
|
|
1594
|
-
if (!(
|
|
1595
|
-
this.currentSpreadIndex =
|
|
1656
|
+
setCurrentSpreadIndex(s) {
|
|
1657
|
+
if (!(s >= 0 && s < this.getSpread().length)) throw new Error("Invalid page");
|
|
1658
|
+
this.currentSpreadIndex = s;
|
|
1596
1659
|
}
|
|
1597
1660
|
showSpread() {
|
|
1598
|
-
const
|
|
1599
|
-
|
|
1661
|
+
const s = this.getSpread()[this.currentSpreadIndex];
|
|
1662
|
+
s.length === 2 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(this.pages[s[1]])) : this.render.getOrientation() === "landscape" && s[0] === this.pages.length - 1 ? (this.render.setLeftPage(this.pages[s[0]]), this.render.setRightPage(null)) : (this.render.setLeftPage(null), this.render.setRightPage(this.pages[s[0]])), this.currentPageIndex = s[0], this.app.updatePageIndex(this.currentPageIndex);
|
|
1600
1663
|
}
|
|
1601
1664
|
}
|
|
1602
1665
|
class u extends h {
|
|
1603
|
-
constructor(
|
|
1604
|
-
super(
|
|
1666
|
+
constructor(s, n, a) {
|
|
1667
|
+
super(s, n), this.imagesHref = a;
|
|
1605
1668
|
}
|
|
1606
1669
|
load() {
|
|
1607
|
-
for (const
|
|
1608
|
-
const n = new r(this.render,
|
|
1670
|
+
for (const s of this.imagesHref) {
|
|
1671
|
+
const n = new r(this.render, s, "soft");
|
|
1609
1672
|
n.load(), this.pages.push(n);
|
|
1610
1673
|
}
|
|
1611
1674
|
this.createSpread();
|
|
1612
1675
|
}
|
|
1613
1676
|
}
|
|
1614
|
-
class
|
|
1615
|
-
static GetDistanceBetweenTwoPoint(
|
|
1616
|
-
return
|
|
1617
|
-
}
|
|
1618
|
-
static GetSegmentLength(
|
|
1619
|
-
return
|
|
1620
|
-
}
|
|
1621
|
-
static GetAngleBetweenTwoLine(
|
|
1622
|
-
const a =
|
|
1623
|
-
return Math.acos((a * l + d *
|
|
1624
|
-
}
|
|
1625
|
-
static PointInRect(
|
|
1626
|
-
return n === null ? null : n.x >=
|
|
1627
|
-
}
|
|
1628
|
-
static GetRotatedPoint(
|
|
1629
|
-
return { x:
|
|
1630
|
-
}
|
|
1631
|
-
static LimitPointToCircle(
|
|
1632
|
-
if (
|
|
1633
|
-
const l =
|
|
1634
|
-
let
|
|
1635
|
-
a.x < 0 && (
|
|
1636
|
-
let
|
|
1637
|
-
return l -
|
|
1638
|
-
}
|
|
1639
|
-
static GetIntersectBetweenTwoSegment(
|
|
1640
|
-
return
|
|
1641
|
-
}
|
|
1642
|
-
static GetIntersectBeetwenTwoLine(
|
|
1643
|
-
const a =
|
|
1644
|
-
if (isFinite(
|
|
1645
|
-
if (Math.abs(
|
|
1677
|
+
class c {
|
|
1678
|
+
static GetDistanceBetweenTwoPoint(s, n) {
|
|
1679
|
+
return s === null || n === null ? 1 / 0 : Math.sqrt(Math.pow(n.x - s.x, 2) + Math.pow(n.y - s.y, 2));
|
|
1680
|
+
}
|
|
1681
|
+
static GetSegmentLength(s) {
|
|
1682
|
+
return c.GetDistanceBetweenTwoPoint(s[0], s[1]);
|
|
1683
|
+
}
|
|
1684
|
+
static GetAngleBetweenTwoLine(s, n) {
|
|
1685
|
+
const a = s[0].y - s[1].y, l = n[0].y - n[1].y, d = s[1].x - s[0].x, p = n[1].x - n[0].x;
|
|
1686
|
+
return Math.acos((a * l + d * p) / (Math.sqrt(a * a + d * d) * Math.sqrt(l * l + p * p)));
|
|
1687
|
+
}
|
|
1688
|
+
static PointInRect(s, n) {
|
|
1689
|
+
return n === null ? null : n.x >= s.left && n.x <= s.width + s.left && n.y >= s.top && n.y <= s.top + s.height ? n : null;
|
|
1690
|
+
}
|
|
1691
|
+
static GetRotatedPoint(s, n, a) {
|
|
1692
|
+
return { x: s.x * Math.cos(a) + s.y * Math.sin(a) + n.x, y: s.y * Math.cos(a) - s.x * Math.sin(a) + n.y };
|
|
1693
|
+
}
|
|
1694
|
+
static LimitPointToCircle(s, n, a) {
|
|
1695
|
+
if (c.GetDistanceBetweenTwoPoint(s, a) <= n) return a;
|
|
1696
|
+
const l = s.x, d = s.y, p = a.x, y = a.y;
|
|
1697
|
+
let f = Math.sqrt(Math.pow(n, 2) * Math.pow(l - p, 2) / (Math.pow(l - p, 2) + Math.pow(d - y, 2))) + l;
|
|
1698
|
+
a.x < 0 && (f *= -1);
|
|
1699
|
+
let E = (f - l) * (d - y) / (l - p) + d;
|
|
1700
|
+
return l - p + d === 0 && (E = n), { x: f, y: E };
|
|
1701
|
+
}
|
|
1702
|
+
static GetIntersectBetweenTwoSegment(s, n, a) {
|
|
1703
|
+
return c.PointInRect(s, c.GetIntersectBeetwenTwoLine(n, a));
|
|
1704
|
+
}
|
|
1705
|
+
static GetIntersectBeetwenTwoLine(s, n) {
|
|
1706
|
+
const a = s[0].y - s[1].y, l = n[0].y - n[1].y, d = s[1].x - s[0].x, p = n[1].x - n[0].x, y = s[0].x * s[1].y - s[1].x * s[0].y, f = n[0].x * n[1].y - n[1].x * n[0].y, E = a * f - l * y, R = d * f - p * y, O = -(y * p - f * d) / (a * p - l * d), K = -(a * f - l * y) / (a * p - l * d);
|
|
1707
|
+
if (isFinite(O) && isFinite(K)) return { x: O, y: K };
|
|
1708
|
+
if (Math.abs(E - R) < 0.1) throw new Error("Segment included");
|
|
1646
1709
|
return null;
|
|
1647
1710
|
}
|
|
1648
|
-
static GetCordsFromTwoPoint(
|
|
1649
|
-
const a = Math.abs(
|
|
1650
|
-
function
|
|
1651
|
-
return
|
|
1711
|
+
static GetCordsFromTwoPoint(s, n) {
|
|
1712
|
+
const a = Math.abs(s.x - n.x), l = Math.abs(s.y - n.y), d = Math.max(a, l), p = [s];
|
|
1713
|
+
function y(f, E, R, O, K) {
|
|
1714
|
+
return E > f ? f + K * (R / O) : E < f ? f - K * (R / O) : f;
|
|
1652
1715
|
}
|
|
1653
|
-
for (let
|
|
1654
|
-
return
|
|
1716
|
+
for (let f = 1; f <= d; f += 1) p.push({ x: y(s.x, n.x, a, d, f), y: y(s.y, n.y, l, d, f) });
|
|
1717
|
+
return p;
|
|
1655
1718
|
}
|
|
1656
1719
|
}
|
|
1657
|
-
class
|
|
1658
|
-
constructor(
|
|
1659
|
-
super(
|
|
1720
|
+
class b extends o {
|
|
1721
|
+
constructor(s, n, a) {
|
|
1722
|
+
super(s, a), this.copiedElement = null, this.temporaryCopy = null, this.isLoad = !1, this.element = n, this.element.classList.add("stf__item"), this.element.classList.add("--" + a);
|
|
1660
1723
|
}
|
|
1661
1724
|
newTemporaryCopy() {
|
|
1662
|
-
return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new
|
|
1725
|
+
return this.nowDrawingDensity === "hard" ? this : (this.temporaryCopy === null && (this.copiedElement = this.element.cloneNode(!0), this.element.parentElement.appendChild(this.copiedElement), this.temporaryCopy = new b(this.render, this.copiedElement, this.nowDrawingDensity)), this.getTemporaryCopy());
|
|
1663
1726
|
}
|
|
1664
1727
|
getTemporaryCopy() {
|
|
1665
1728
|
return this.temporaryCopy;
|
|
@@ -1667,10 +1730,10 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1667
1730
|
hideTemporaryCopy() {
|
|
1668
1731
|
this.temporaryCopy !== null && (this.copiedElement.remove(), this.copiedElement = null, this.temporaryCopy = null);
|
|
1669
1732
|
}
|
|
1670
|
-
draw(
|
|
1671
|
-
const n =
|
|
1733
|
+
draw(s) {
|
|
1734
|
+
const n = s || this.nowDrawingDensity, a = this.render.convertToGlobal(this.state.position), l = this.render.getRect().pageWidth, d = this.render.getRect().height;
|
|
1672
1735
|
this.element.classList.remove("--simple");
|
|
1673
|
-
const
|
|
1736
|
+
const p = `
|
|
1674
1737
|
display: block;
|
|
1675
1738
|
z-index: ${this.element.style.zIndex};
|
|
1676
1739
|
left: 0;
|
|
@@ -1678,10 +1741,10 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1678
1741
|
width: ${l}px;
|
|
1679
1742
|
height: ${d}px;
|
|
1680
1743
|
`;
|
|
1681
|
-
n === "hard" ? this.drawHard(
|
|
1744
|
+
n === "hard" ? this.drawHard(p) : this.drawSoft(a, p);
|
|
1682
1745
|
}
|
|
1683
|
-
drawHard(
|
|
1684
|
-
const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l =
|
|
1746
|
+
drawHard(s = "") {
|
|
1747
|
+
const n = this.render.getRect().left + this.render.getRect().width / 2, a = this.state.hardDrawingAngle, l = s + `
|
|
1685
1748
|
backface-visibility: hidden;
|
|
1686
1749
|
-webkit-backface-visibility: hidden;
|
|
1687
1750
|
clip-path: none;
|
|
@@ -1691,24 +1754,24 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1691
1754
|
transform: translate3d(${n}px, 0, 0) rotateY(${a}deg);`);
|
|
1692
1755
|
this.element.style.cssText = l;
|
|
1693
1756
|
}
|
|
1694
|
-
drawSoft(
|
|
1757
|
+
drawSoft(s, n = "") {
|
|
1695
1758
|
let a = "polygon( ";
|
|
1696
1759
|
for (const d of this.state.area) if (d !== null) {
|
|
1697
|
-
let
|
|
1698
|
-
|
|
1760
|
+
let p = this.render.getDirection() === 1 ? { x: -d.x + this.state.position.x, y: d.y - this.state.position.y } : { x: d.x - this.state.position.x, y: d.y - this.state.position.y };
|
|
1761
|
+
p = c.GetRotatedPoint(p, { x: 0, y: 0 }, this.state.angle), a += p.x + "px " + p.y + "px, ";
|
|
1699
1762
|
}
|
|
1700
1763
|
a = a.slice(0, -2), a += ")";
|
|
1701
|
-
const l = n + `transform-origin: 0 0; clip-path: ${a}; -webkit-clip-path: ${a};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${
|
|
1764
|
+
const l = n + `transform-origin: 0 0; clip-path: ${a}; -webkit-clip-path: ${a};` + (this.render.isSafari() && this.state.angle === 0 ? `transform: translate(${s.x}px, ${s.y}px);` : `transform: translate3d(${s.x}px, ${s.y}px, 0) rotate(${this.state.angle}rad);`);
|
|
1702
1765
|
this.element.style.cssText = l;
|
|
1703
1766
|
}
|
|
1704
|
-
simpleDraw(
|
|
1705
|
-
const n = this.render.getRect(), a = n.pageWidth, l = n.height, d =
|
|
1767
|
+
simpleDraw(s) {
|
|
1768
|
+
const n = this.render.getRect(), a = n.pageWidth, l = n.height, d = s === 1 ? n.left + n.pageWidth : n.left, p = n.top;
|
|
1706
1769
|
this.element.classList.add("--simple"), this.element.style.cssText = `
|
|
1707
1770
|
position: absolute;
|
|
1708
1771
|
display: block;
|
|
1709
1772
|
height: ${l}px;
|
|
1710
1773
|
left: ${d}px;
|
|
1711
|
-
top: ${
|
|
1774
|
+
top: ${p}px;
|
|
1712
1775
|
width: ${a}px;
|
|
1713
1776
|
z-index: ${this.render.getSettings().startZIndex + 1};`;
|
|
1714
1777
|
}
|
|
@@ -1718,44 +1781,44 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1718
1781
|
load() {
|
|
1719
1782
|
this.isLoad = !0;
|
|
1720
1783
|
}
|
|
1721
|
-
setOrientation(
|
|
1722
|
-
super.setOrientation(
|
|
1784
|
+
setOrientation(s) {
|
|
1785
|
+
super.setOrientation(s), this.element.classList.remove("--left", "--right"), this.element.classList.add(s === 1 ? "--right" : "--left");
|
|
1723
1786
|
}
|
|
1724
|
-
setDrawingDensity(
|
|
1725
|
-
this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" +
|
|
1787
|
+
setDrawingDensity(s) {
|
|
1788
|
+
this.element.classList.remove("--soft", "--hard"), this.element.classList.add("--" + s), super.setDrawingDensity(s);
|
|
1726
1789
|
}
|
|
1727
1790
|
}
|
|
1728
1791
|
class P extends h {
|
|
1729
|
-
constructor(
|
|
1730
|
-
super(
|
|
1792
|
+
constructor(s, n, a, l) {
|
|
1793
|
+
super(s, n), this.element = a, this.pagesElement = l;
|
|
1731
1794
|
}
|
|
1732
1795
|
load() {
|
|
1733
|
-
for (const
|
|
1734
|
-
const n = new
|
|
1796
|
+
for (const s of this.pagesElement) {
|
|
1797
|
+
const n = new b(this.render, s, s.dataset.density === "hard" ? "hard" : "soft");
|
|
1735
1798
|
n.load(), this.pages.push(n);
|
|
1736
1799
|
}
|
|
1737
1800
|
this.createSpread();
|
|
1738
1801
|
}
|
|
1739
1802
|
}
|
|
1740
|
-
class
|
|
1741
|
-
constructor(
|
|
1742
|
-
this.direction =
|
|
1803
|
+
class k {
|
|
1804
|
+
constructor(s, n, a, l) {
|
|
1805
|
+
this.direction = s, this.corner = n, this.topIntersectPoint = null, this.sideIntersectPoint = null, this.bottomIntersectPoint = null, this.pageWidth = parseInt(a, 10), this.pageHeight = parseInt(l, 10);
|
|
1743
1806
|
}
|
|
1744
|
-
calc(
|
|
1807
|
+
calc(s) {
|
|
1745
1808
|
try {
|
|
1746
|
-
return this.position = this.calcAngleAndPosition(
|
|
1809
|
+
return this.position = this.calcAngleAndPosition(s), this.calculateIntersectPoint(this.position), !0;
|
|
1747
1810
|
} catch {
|
|
1748
1811
|
return !1;
|
|
1749
1812
|
}
|
|
1750
1813
|
}
|
|
1751
1814
|
getFlippingClipArea() {
|
|
1752
|
-
const
|
|
1815
|
+
const s = [];
|
|
1753
1816
|
let n = !1;
|
|
1754
|
-
return
|
|
1817
|
+
return s.push(this.rect.topLeft), s.push(this.topIntersectPoint), this.sideIntersectPoint === null ? n = !0 : (s.push(this.sideIntersectPoint), this.bottomIntersectPoint === null && (n = !1)), s.push(this.bottomIntersectPoint), (n || this.corner === "bottom") && s.push(this.rect.bottomLeft), s;
|
|
1755
1818
|
}
|
|
1756
1819
|
getBottomClipArea() {
|
|
1757
|
-
const
|
|
1758
|
-
return
|
|
1820
|
+
const s = [];
|
|
1821
|
+
return s.push(this.topIntersectPoint), this.corner === "top" ? s.push({ x: this.pageWidth, y: 0 }) : (this.topIntersectPoint !== null && s.push({ x: this.pageWidth, y: 0 }), s.push({ x: this.pageWidth, y: this.pageHeight })), this.sideIntersectPoint !== null ? c.GetDistanceBetweenTwoPoint(this.sideIntersectPoint, this.topIntersectPoint) >= 10 && s.push(this.sideIntersectPoint) : this.corner === "top" && s.push({ x: this.pageWidth, y: this.pageHeight }), s.push(this.bottomIntersectPoint), s.push(this.topIntersectPoint), s;
|
|
1759
1822
|
}
|
|
1760
1823
|
getAngle() {
|
|
1761
1824
|
return this.direction === 0 ? -this.angle : this.angle;
|
|
@@ -1785,126 +1848,126 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1785
1848
|
return this.corner === "top" ? this.topIntersectPoint : this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.topIntersectPoint;
|
|
1786
1849
|
}
|
|
1787
1850
|
getShadowAngle() {
|
|
1788
|
-
const
|
|
1789
|
-
return this.direction === 0 ?
|
|
1851
|
+
const s = c.GetAngleBetweenTwoLine(this.getSegmentToShadowLine(), [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]);
|
|
1852
|
+
return this.direction === 0 ? s : Math.PI - s;
|
|
1790
1853
|
}
|
|
1791
|
-
calcAngleAndPosition(
|
|
1792
|
-
let n =
|
|
1854
|
+
calcAngleAndPosition(s) {
|
|
1855
|
+
let n = s;
|
|
1793
1856
|
if (this.updateAngleAndGeometry(n), n = this.corner === "top" ? this.checkPositionAtCenterLine(n, { x: 0, y: 0 }, { x: 0, y: this.pageHeight }) : this.checkPositionAtCenterLine(n, { x: 0, y: this.pageHeight }, { x: 0, y: 0 }), Math.abs(n.x - this.pageWidth) < 1 && Math.abs(n.y) < 1) throw new Error("Point is too small");
|
|
1794
1857
|
return n;
|
|
1795
1858
|
}
|
|
1796
|
-
updateAngleAndGeometry(
|
|
1797
|
-
this.angle = this.calculateAngle(
|
|
1859
|
+
updateAngleAndGeometry(s) {
|
|
1860
|
+
this.angle = this.calculateAngle(s), this.rect = this.getPageRect(s);
|
|
1798
1861
|
}
|
|
1799
|
-
calculateAngle(
|
|
1800
|
-
const n = this.pageWidth -
|
|
1862
|
+
calculateAngle(s) {
|
|
1863
|
+
const n = this.pageWidth - s.x + 1, a = this.corner === "bottom" ? this.pageHeight - s.y : s.y;
|
|
1801
1864
|
let l = 2 * Math.acos(n / Math.sqrt(a * a + n * n));
|
|
1802
1865
|
a < 0 && (l = -l);
|
|
1803
1866
|
const d = Math.PI - l;
|
|
1804
1867
|
if (!isFinite(l) || d >= 0 && d < 3e-3) throw new Error("The G point is too small");
|
|
1805
1868
|
return this.corner === "bottom" && (l = -l), l;
|
|
1806
1869
|
}
|
|
1807
|
-
getPageRect(
|
|
1808
|
-
return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }],
|
|
1870
|
+
getPageRect(s) {
|
|
1871
|
+
return this.corner === "top" ? this.getRectFromBasePoint([{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }, { x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }], s) : this.getRectFromBasePoint([{ x: 0, y: -this.pageHeight }, { x: this.pageWidth, y: -this.pageHeight }, { x: 0, y: 0 }, { x: this.pageWidth, y: 0 }], s);
|
|
1809
1872
|
}
|
|
1810
|
-
getRectFromBasePoint(
|
|
1811
|
-
return { topLeft: this.getRotatedPoint(
|
|
1873
|
+
getRectFromBasePoint(s, n) {
|
|
1874
|
+
return { topLeft: this.getRotatedPoint(s[0], n), topRight: this.getRotatedPoint(s[1], n), bottomLeft: this.getRotatedPoint(s[2], n), bottomRight: this.getRotatedPoint(s[3], n) };
|
|
1812
1875
|
}
|
|
1813
|
-
getRotatedPoint(
|
|
1814
|
-
return { x:
|
|
1876
|
+
getRotatedPoint(s, n) {
|
|
1877
|
+
return { x: s.x * Math.cos(this.angle) + s.y * Math.sin(this.angle) + n.x, y: s.y * Math.cos(this.angle) - s.x * Math.sin(this.angle) + n.y };
|
|
1815
1878
|
}
|
|
1816
|
-
calculateIntersectPoint(
|
|
1879
|
+
calculateIntersectPoint(s) {
|
|
1817
1880
|
const n = { left: -1, top: -1, width: this.pageWidth + 2, height: this.pageHeight + 2 };
|
|
1818
|
-
this.corner === "top" ? (this.topIntersectPoint =
|
|
1881
|
+
this.corner === "top" ? (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.bottomLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }])) : (this.topIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.topLeft, this.rect.topRight], [{ x: 0, y: 0 }, { x: this.pageWidth, y: 0 }]), this.sideIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [s, this.rect.topLeft], [{ x: this.pageWidth, y: 0 }, { x: this.pageWidth, y: this.pageHeight }]), this.bottomIntersectPoint = c.GetIntersectBetweenTwoSegment(n, [this.rect.bottomLeft, this.rect.bottomRight], [{ x: 0, y: this.pageHeight }, { x: this.pageWidth, y: this.pageHeight }]));
|
|
1819
1882
|
}
|
|
1820
|
-
checkPositionAtCenterLine(
|
|
1821
|
-
let l =
|
|
1822
|
-
const d =
|
|
1883
|
+
checkPositionAtCenterLine(s, n, a) {
|
|
1884
|
+
let l = s;
|
|
1885
|
+
const d = c.LimitPointToCircle(n, this.pageWidth, l);
|
|
1823
1886
|
l !== d && (l = d, this.updateAngleAndGeometry(l));
|
|
1824
|
-
const
|
|
1825
|
-
let
|
|
1826
|
-
if (this.corner === "bottom" && (
|
|
1827
|
-
const
|
|
1828
|
-
|
|
1887
|
+
const p = Math.sqrt(Math.pow(this.pageWidth, 2) + Math.pow(this.pageHeight, 2));
|
|
1888
|
+
let y = this.rect.bottomRight, f = this.rect.topLeft;
|
|
1889
|
+
if (this.corner === "bottom" && (y = this.rect.topRight, f = this.rect.bottomLeft), y.x <= 0) {
|
|
1890
|
+
const E = c.LimitPointToCircle(a, p, f);
|
|
1891
|
+
E !== l && (l = E, this.updateAngleAndGeometry(l));
|
|
1829
1892
|
}
|
|
1830
1893
|
return l;
|
|
1831
1894
|
}
|
|
1832
1895
|
getSegmentToShadowLine() {
|
|
1833
|
-
const
|
|
1834
|
-
return [
|
|
1896
|
+
const s = this.getShadowStartPoint();
|
|
1897
|
+
return [s, s !== this.sideIntersectPoint && this.sideIntersectPoint !== null ? this.sideIntersectPoint : this.bottomIntersectPoint];
|
|
1835
1898
|
}
|
|
1836
1899
|
}
|
|
1837
|
-
class
|
|
1838
|
-
constructor(
|
|
1839
|
-
this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render =
|
|
1900
|
+
class I {
|
|
1901
|
+
constructor(s, n) {
|
|
1902
|
+
this.flippingPage = null, this.bottomPage = null, this.calc = null, this.state = "read", this.render = s, this.app = n;
|
|
1840
1903
|
}
|
|
1841
|
-
fold(
|
|
1842
|
-
this.setState("user_fold"), this.calc === null && this.start(
|
|
1904
|
+
fold(s) {
|
|
1905
|
+
this.setState("user_fold"), this.calc === null && this.start(s), this.do(this.render.convertToPage(s));
|
|
1843
1906
|
}
|
|
1844
|
-
flip(
|
|
1845
|
-
if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(
|
|
1907
|
+
flip(s) {
|
|
1908
|
+
if (this.app.getSettings().disableFlipByClick && !this.isPointOnCorners(s) || (this.calc !== null && this.render.finishAnimation(), !this.start(s))) return;
|
|
1846
1909
|
const n = this.getBoundsRect();
|
|
1847
1910
|
this.setState("flipping");
|
|
1848
1911
|
const a = n.height / 10, l = this.calc.getCorner() === "bottom" ? n.height - a : a, d = this.calc.getCorner() === "bottom" ? n.height : 0;
|
|
1849
1912
|
this.calc.calc({ x: n.pageWidth - a, y: l }), this.animateFlippingTo({ x: n.pageWidth - a, y: l }, { x: -n.pageWidth, y: d }, !0);
|
|
1850
1913
|
}
|
|
1851
|
-
start(
|
|
1914
|
+
start(s) {
|
|
1852
1915
|
this.reset();
|
|
1853
|
-
const n = this.render.convertToBook(
|
|
1916
|
+
const n = this.render.convertToBook(s), a = this.getBoundsRect(), l = this.getDirectionByPoint(n), d = n.y >= a.height / 2 ? "bottom" : "top";
|
|
1854
1917
|
if (!this.checkDirection(l)) return !1;
|
|
1855
1918
|
try {
|
|
1856
1919
|
if (this.flippingPage = this.app.getPageCollection().getFlippingPage(l), this.bottomPage = this.app.getPageCollection().getBottomPage(l), this.render.getOrientation() === "landscape") if (l === 1) {
|
|
1857
|
-
const
|
|
1858
|
-
|
|
1920
|
+
const p = this.app.getPageCollection().nextBy(this.flippingPage);
|
|
1921
|
+
p !== null && this.flippingPage.getDensity() !== p.getDensity() && (this.flippingPage.setDrawingDensity("hard"), p.setDrawingDensity("hard"));
|
|
1859
1922
|
} else {
|
|
1860
|
-
const
|
|
1861
|
-
|
|
1923
|
+
const p = this.app.getPageCollection().prevBy(this.flippingPage);
|
|
1924
|
+
p !== null && this.flippingPage.getDensity() !== p.getDensity() && (this.flippingPage.setDrawingDensity("hard"), p.setDrawingDensity("hard"));
|
|
1862
1925
|
}
|
|
1863
|
-
return this.render.setDirection(l), this.calc = new
|
|
1926
|
+
return this.render.setDirection(l), this.calc = new k(l, d, a.pageWidth.toString(10), a.height.toString(10)), !0;
|
|
1864
1927
|
} catch {
|
|
1865
1928
|
return !1;
|
|
1866
1929
|
}
|
|
1867
1930
|
}
|
|
1868
|
-
do(
|
|
1869
|
-
if (this.calc !== null && this.calc.calc(
|
|
1931
|
+
do(s) {
|
|
1932
|
+
if (this.calc !== null && this.calc.calc(s)) {
|
|
1870
1933
|
const n = this.calc.getFlippingProgress();
|
|
1871
1934
|
this.bottomPage.setArea(this.calc.getBottomClipArea()), this.bottomPage.setPosition(this.calc.getBottomPagePosition()), this.bottomPage.setAngle(0), this.bottomPage.setHardAngle(0), this.flippingPage.setArea(this.calc.getFlippingClipArea()), this.flippingPage.setPosition(this.calc.getActiveCorner()), this.flippingPage.setAngle(this.calc.getAngle()), this.calc.getDirection() === 0 ? this.flippingPage.setHardAngle(90 * (200 - 2 * n) / 100) : this.flippingPage.setHardAngle(-90 * (200 - 2 * n) / 100), this.render.setPageRect(this.calc.getRect()), this.render.setBottomPage(this.bottomPage), this.render.setFlippingPage(this.flippingPage), this.render.setShadowData(this.calc.getShadowStartPoint(), this.calc.getShadowAngle(), n, this.calc.getDirection());
|
|
1872
1935
|
}
|
|
1873
1936
|
}
|
|
1874
|
-
flipToPage(
|
|
1875
|
-
const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(
|
|
1937
|
+
flipToPage(s, n) {
|
|
1938
|
+
const a = this.app.getPageCollection().getCurrentSpreadIndex(), l = this.app.getPageCollection().getSpreadIndexByPage(s);
|
|
1876
1939
|
try {
|
|
1877
1940
|
l > a && (this.app.getPageCollection().setCurrentSpreadIndex(l - 1), this.flipNext(n)), l < a && (this.app.getPageCollection().setCurrentSpreadIndex(l + 1), this.flipPrev(n));
|
|
1878
1941
|
} catch {
|
|
1879
1942
|
}
|
|
1880
1943
|
}
|
|
1881
|
-
flipNext(
|
|
1882
|
-
this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y:
|
|
1944
|
+
flipNext(s) {
|
|
1945
|
+
this.flip({ x: this.render.getRect().left + 2 * this.render.getRect().pageWidth - 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
|
|
1883
1946
|
}
|
|
1884
|
-
flipPrev(
|
|
1885
|
-
this.flip({ x: 10, y:
|
|
1947
|
+
flipPrev(s) {
|
|
1948
|
+
this.flip({ x: 10, y: s === "top" ? 1 : this.render.getRect().height - 2 });
|
|
1886
1949
|
}
|
|
1887
1950
|
stopMove() {
|
|
1888
1951
|
if (this.calc === null) return;
|
|
1889
|
-
const
|
|
1890
|
-
|
|
1952
|
+
const s = this.calc.getPosition(), n = this.getBoundsRect(), a = this.calc.getCorner() === "bottom" ? n.height : 0;
|
|
1953
|
+
s.x <= 0 ? this.animateFlippingTo(s, { x: -n.pageWidth, y: a }, !0) : this.animateFlippingTo(s, { x: n.pageWidth, y: a }, !1);
|
|
1891
1954
|
}
|
|
1892
|
-
showCorner(
|
|
1955
|
+
showCorner(s) {
|
|
1893
1956
|
if (!this.checkState("read", "fold_corner")) return;
|
|
1894
1957
|
const n = this.getBoundsRect(), a = n.pageWidth;
|
|
1895
|
-
if (this.isPointOnCorners(
|
|
1896
|
-
if (!this.start(
|
|
1958
|
+
if (this.isPointOnCorners(s)) if (this.calc === null) {
|
|
1959
|
+
if (!this.start(s)) return;
|
|
1897
1960
|
this.setState("fold_corner"), this.calc.calc({ x: a - 1, y: 1 });
|
|
1898
|
-
const l = 50, d = this.calc.getCorner() === "bottom" ? n.height - 1 : 1,
|
|
1899
|
-
this.animateFlippingTo({ x: a - 1, y: d }, { x: a - l, y:
|
|
1900
|
-
} else this.do(this.render.convertToPage(
|
|
1961
|
+
const l = 50, d = this.calc.getCorner() === "bottom" ? n.height - 1 : 1, p = this.calc.getCorner() === "bottom" ? n.height - l : l;
|
|
1962
|
+
this.animateFlippingTo({ x: a - 1, y: d }, { x: a - l, y: p }, !1, !1);
|
|
1963
|
+
} else this.do(this.render.convertToPage(s));
|
|
1901
1964
|
else this.setState("read"), this.render.finishAnimation(), this.stopMove();
|
|
1902
1965
|
}
|
|
1903
|
-
animateFlippingTo(
|
|
1904
|
-
const d =
|
|
1905
|
-
for (const
|
|
1906
|
-
const
|
|
1907
|
-
this.render.startAnimation(
|
|
1966
|
+
animateFlippingTo(s, n, a, l = !0) {
|
|
1967
|
+
const d = c.GetCordsFromTwoPoint(s, n), p = [];
|
|
1968
|
+
for (const f of d) p.push(() => this.do(f));
|
|
1969
|
+
const y = this.getAnimationDuration(d.length);
|
|
1970
|
+
this.render.startAnimation(p, y, () => {
|
|
1908
1971
|
this.calc && (a && (this.calc.getDirection() === 1 ? this.app.turnToPrevPage() : this.app.turnToNextPage()), l && (this.render.setBottomPage(null), this.render.setFlippingPage(null), this.render.clearShadow(), this.setState("read"), this.reset()));
|
|
1909
1972
|
});
|
|
1910
1973
|
}
|
|
@@ -1914,22 +1977,22 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1914
1977
|
getState() {
|
|
1915
1978
|
return this.state;
|
|
1916
1979
|
}
|
|
1917
|
-
setState(
|
|
1918
|
-
this.state !==
|
|
1980
|
+
setState(s) {
|
|
1981
|
+
this.state !== s && (this.app.updateState(s), this.state = s);
|
|
1919
1982
|
}
|
|
1920
|
-
getDirectionByPoint(
|
|
1983
|
+
getDirectionByPoint(s) {
|
|
1921
1984
|
const n = this.getBoundsRect();
|
|
1922
1985
|
if (this.render.getOrientation() === "portrait") {
|
|
1923
|
-
if (
|
|
1924
|
-
} else if (
|
|
1986
|
+
if (s.x - n.pageWidth <= n.width / 5) return 1;
|
|
1987
|
+
} else if (s.x < n.width / 2) return 1;
|
|
1925
1988
|
return 0;
|
|
1926
1989
|
}
|
|
1927
|
-
getAnimationDuration(
|
|
1990
|
+
getAnimationDuration(s) {
|
|
1928
1991
|
const n = this.app.getSettings().flippingTime;
|
|
1929
|
-
return
|
|
1992
|
+
return s >= 1e3 ? n : s / 1e3 * n;
|
|
1930
1993
|
}
|
|
1931
|
-
checkDirection(
|
|
1932
|
-
return
|
|
1994
|
+
checkDirection(s) {
|
|
1995
|
+
return s === 0 ? this.app.getCurrentPageIndex() < this.app.getPageCount() - 1 : this.app.getCurrentPageIndex() >= 1;
|
|
1933
1996
|
}
|
|
1934
1997
|
reset() {
|
|
1935
1998
|
this.calc = null, this.flippingPage = null, this.bottomPage = null;
|
|
@@ -1937,56 +2000,56 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
1937
2000
|
getBoundsRect() {
|
|
1938
2001
|
return this.render.getRect();
|
|
1939
2002
|
}
|
|
1940
|
-
checkState(...
|
|
1941
|
-
for (const n of
|
|
2003
|
+
checkState(...s) {
|
|
2004
|
+
for (const n of s) if (this.state === n) return !0;
|
|
1942
2005
|
return !1;
|
|
1943
2006
|
}
|
|
1944
|
-
isPointOnCorners(
|
|
1945
|
-
const n = this.getBoundsRect(), a = n.pageWidth, l = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, d = this.render.convertToBook(
|
|
2007
|
+
isPointOnCorners(s) {
|
|
2008
|
+
const n = this.getBoundsRect(), a = n.pageWidth, l = Math.sqrt(Math.pow(a, 2) + Math.pow(n.height, 2)) / 5, d = this.render.convertToBook(s);
|
|
1946
2009
|
return d.x > 0 && d.y > 0 && d.x < n.width && d.y < n.height && (d.x < l || d.x > n.width - l) && (d.y < l || d.y > n.height - l);
|
|
1947
2010
|
}
|
|
1948
2011
|
}
|
|
1949
|
-
class
|
|
1950
|
-
constructor(
|
|
1951
|
-
this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = n, this.app =
|
|
2012
|
+
class S {
|
|
2013
|
+
constructor(s, n) {
|
|
2014
|
+
this.leftPage = null, this.rightPage = null, this.flippingPage = null, this.bottomPage = null, this.direction = null, this.orientation = null, this.shadow = null, this.animation = null, this.pageRect = null, this.boundsRect = null, this.timer = 0, this.safari = !1, this.setting = n, this.app = s;
|
|
1952
2015
|
const a = new RegExp("Version\\/[\\d\\.]+.*Safari/");
|
|
1953
2016
|
this.safari = a.exec(window.navigator.userAgent) !== null;
|
|
1954
2017
|
}
|
|
1955
|
-
render(
|
|
2018
|
+
render(s) {
|
|
1956
2019
|
if (this.animation !== null) {
|
|
1957
|
-
const n = Math.round((
|
|
2020
|
+
const n = Math.round((s - this.animation.startedAt) / this.animation.durationFrame);
|
|
1958
2021
|
n < this.animation.frames.length ? this.animation.frames[n]() : (this.animation.onAnimateEnd(), this.animation = null);
|
|
1959
2022
|
}
|
|
1960
|
-
this.timer =
|
|
2023
|
+
this.timer = s, this.drawFrame();
|
|
1961
2024
|
}
|
|
1962
2025
|
start() {
|
|
1963
2026
|
this.update();
|
|
1964
|
-
const
|
|
1965
|
-
this.render(n), requestAnimationFrame(
|
|
2027
|
+
const s = (n) => {
|
|
2028
|
+
this.render(n), requestAnimationFrame(s);
|
|
1966
2029
|
};
|
|
1967
|
-
requestAnimationFrame(
|
|
2030
|
+
requestAnimationFrame(s);
|
|
1968
2031
|
}
|
|
1969
|
-
startAnimation(
|
|
1970
|
-
this.finishAnimation(), this.animation = { frames:
|
|
2032
|
+
startAnimation(s, n, a) {
|
|
2033
|
+
this.finishAnimation(), this.animation = { frames: s, duration: n, durationFrame: n / s.length, onAnimateEnd: a, startedAt: this.timer };
|
|
1971
2034
|
}
|
|
1972
2035
|
finishAnimation() {
|
|
1973
2036
|
this.animation !== null && (this.animation.frames[this.animation.frames.length - 1](), this.animation.onAnimateEnd !== null && this.animation.onAnimateEnd()), this.animation = null;
|
|
1974
2037
|
}
|
|
1975
2038
|
update() {
|
|
1976
2039
|
this.boundsRect = null;
|
|
1977
|
-
const
|
|
1978
|
-
this.orientation !==
|
|
2040
|
+
const s = this.calculateBoundsRect();
|
|
2041
|
+
this.orientation !== s && (this.orientation = s, this.app.updateOrientation(s));
|
|
1979
2042
|
}
|
|
1980
2043
|
calculateBoundsRect() {
|
|
1981
|
-
let
|
|
2044
|
+
let s = "landscape";
|
|
1982
2045
|
const n = this.getBlockWidth(), a = n / 2, l = this.getBlockHeight() / 2, d = this.setting.width / this.setting.height;
|
|
1983
|
-
let
|
|
1984
|
-
return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (
|
|
2046
|
+
let p = this.setting.width, y = this.setting.height, f = a - p;
|
|
2047
|
+
return this.setting.size === "stretch" ? (n < 2 * this.setting.minWidth && this.app.getSettings().usePortrait && (s = "portrait"), p = s === "portrait" ? this.getBlockWidth() : this.getBlockWidth() / 2, p > this.setting.maxWidth && (p = this.setting.maxWidth), y = p / d, y > this.getBlockHeight() && (y = this.getBlockHeight(), p = y * d), f = s === "portrait" ? a - p / 2 - p : a - p) : n < 2 * p && this.app.getSettings().usePortrait && (s = "portrait", f = a - p / 2 - p), this.boundsRect = { left: f, top: l - y / 2, width: 2 * p, height: y, pageWidth: p }, s;
|
|
1985
2048
|
}
|
|
1986
|
-
setShadowData(
|
|
2049
|
+
setShadowData(s, n, a, l) {
|
|
1987
2050
|
if (!this.app.getSettings().drawShadow) return;
|
|
1988
2051
|
const d = 100 * this.getSettings().maxShadowOpacity;
|
|
1989
|
-
this.shadow = { pos:
|
|
2052
|
+
this.shadow = { pos: s, angle: n, width: 3 * this.getRect().pageWidth / 4 * a / 100, opacity: (100 - a) * d / 100 / 100, direction: l, progress: 2 * a };
|
|
1990
2053
|
}
|
|
1991
2054
|
clearShadow() {
|
|
1992
2055
|
this.shadow = null;
|
|
@@ -2009,48 +2072,48 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2009
2072
|
getOrientation() {
|
|
2010
2073
|
return this.orientation;
|
|
2011
2074
|
}
|
|
2012
|
-
setPageRect(
|
|
2013
|
-
this.pageRect =
|
|
2075
|
+
setPageRect(s) {
|
|
2076
|
+
this.pageRect = s;
|
|
2014
2077
|
}
|
|
2015
|
-
setDirection(
|
|
2016
|
-
this.direction =
|
|
2078
|
+
setDirection(s) {
|
|
2079
|
+
this.direction = s;
|
|
2017
2080
|
}
|
|
2018
|
-
setRightPage(
|
|
2019
|
-
|
|
2081
|
+
setRightPage(s) {
|
|
2082
|
+
s !== null && s.setOrientation(1), this.rightPage = s;
|
|
2020
2083
|
}
|
|
2021
|
-
setLeftPage(
|
|
2022
|
-
|
|
2084
|
+
setLeftPage(s) {
|
|
2085
|
+
s !== null && s.setOrientation(0), this.leftPage = s;
|
|
2023
2086
|
}
|
|
2024
|
-
setBottomPage(
|
|
2025
|
-
|
|
2087
|
+
setBottomPage(s) {
|
|
2088
|
+
s !== null && s.setOrientation(this.direction === 1 ? 0 : 1), this.bottomPage = s;
|
|
2026
2089
|
}
|
|
2027
|
-
setFlippingPage(
|
|
2028
|
-
|
|
2090
|
+
setFlippingPage(s) {
|
|
2091
|
+
s !== null && s.setOrientation(this.direction === 0 && this.orientation !== "portrait" ? 0 : 1), this.flippingPage = s;
|
|
2029
2092
|
}
|
|
2030
|
-
convertToBook(
|
|
2093
|
+
convertToBook(s) {
|
|
2031
2094
|
const n = this.getRect();
|
|
2032
|
-
return { x:
|
|
2095
|
+
return { x: s.x - n.left, y: s.y - n.top };
|
|
2033
2096
|
}
|
|
2034
2097
|
isSafari() {
|
|
2035
2098
|
return this.safari;
|
|
2036
2099
|
}
|
|
2037
|
-
convertToPage(
|
|
2100
|
+
convertToPage(s, n) {
|
|
2038
2101
|
n || (n = this.direction);
|
|
2039
2102
|
const a = this.getRect();
|
|
2040
|
-
return { x: n === 0 ?
|
|
2103
|
+
return { x: n === 0 ? s.x - a.left - a.width / 2 : a.width / 2 - s.x + a.left, y: s.y - a.top };
|
|
2041
2104
|
}
|
|
2042
|
-
convertToGlobal(
|
|
2043
|
-
if (n || (n = this.direction),
|
|
2105
|
+
convertToGlobal(s, n) {
|
|
2106
|
+
if (n || (n = this.direction), s == null) return null;
|
|
2044
2107
|
const a = this.getRect();
|
|
2045
|
-
return { x: n === 0 ?
|
|
2108
|
+
return { x: n === 0 ? s.x + a.left + a.width / 2 : a.width / 2 - s.x + a.left, y: s.y + a.top };
|
|
2046
2109
|
}
|
|
2047
|
-
convertRectToGlobal(
|
|
2048
|
-
return n || (n = this.direction), { topLeft: this.convertToGlobal(
|
|
2110
|
+
convertRectToGlobal(s, n) {
|
|
2111
|
+
return n || (n = this.direction), { topLeft: this.convertToGlobal(s.topLeft, n), topRight: this.convertToGlobal(s.topRight, n), bottomLeft: this.convertToGlobal(s.bottomLeft, n), bottomRight: this.convertToGlobal(s.bottomRight, n) };
|
|
2049
2112
|
}
|
|
2050
2113
|
}
|
|
2051
|
-
class
|
|
2052
|
-
constructor(
|
|
2053
|
-
super(
|
|
2114
|
+
class T extends S {
|
|
2115
|
+
constructor(s, n, a) {
|
|
2116
|
+
super(s, n), this.canvas = a, this.ctx = a.getContext("2d");
|
|
2054
2117
|
}
|
|
2055
2118
|
getContext() {
|
|
2056
2119
|
return this.ctx;
|
|
@@ -2059,79 +2122,79 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2059
2122
|
}
|
|
2060
2123
|
drawFrame() {
|
|
2061
2124
|
this.clear(), this.orientation !== "portrait" && this.leftPage != null && this.leftPage.simpleDraw(0), this.rightPage != null && this.rightPage.simpleDraw(1), this.bottomPage != null && this.bottomPage.draw(), this.drawBookShadow(), this.flippingPage != null && this.flippingPage.draw(), this.shadow != null && (this.drawOuterShadow(), this.drawInnerShadow());
|
|
2062
|
-
const
|
|
2063
|
-
this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(
|
|
2125
|
+
const s = this.getRect();
|
|
2126
|
+
this.orientation === "portrait" && (this.ctx.beginPath(), this.ctx.rect(s.left + s.pageWidth, s.top, s.width, s.height), this.ctx.clip());
|
|
2064
2127
|
}
|
|
2065
2128
|
drawBookShadow() {
|
|
2066
|
-
const
|
|
2129
|
+
const s = this.getRect();
|
|
2067
2130
|
this.ctx.save(), this.ctx.beginPath();
|
|
2068
|
-
const n =
|
|
2069
|
-
this.ctx.rect(
|
|
2070
|
-
const a = { x:
|
|
2131
|
+
const n = s.width / 20;
|
|
2132
|
+
this.ctx.rect(s.left, s.top, s.width, s.height);
|
|
2133
|
+
const a = { x: s.left + s.width / 2 - n / 2, y: 0 };
|
|
2071
2134
|
this.ctx.translate(a.x, a.y);
|
|
2072
2135
|
const l = this.ctx.createLinearGradient(0, 0, n, 0);
|
|
2073
|
-
l.addColorStop(0, "rgba(0, 0, 0, 0)"), l.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), l.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), l.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), l.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), l.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = l, this.ctx.fillRect(0, 0, n, 2 *
|
|
2136
|
+
l.addColorStop(0, "rgba(0, 0, 0, 0)"), l.addColorStop(0.4, "rgba(0, 0, 0, 0.2)"), l.addColorStop(0.49, "rgba(0, 0, 0, 0.1)"), l.addColorStop(0.5, "rgba(0, 0, 0, 0.5)"), l.addColorStop(0.51, "rgba(0, 0, 0, 0.4)"), l.addColorStop(1, "rgba(0, 0, 0, 0)"), this.ctx.clip(), this.ctx.fillStyle = l, this.ctx.fillRect(0, 0, n, 2 * s.height), this.ctx.restore();
|
|
2074
2137
|
}
|
|
2075
2138
|
drawOuterShadow() {
|
|
2076
|
-
const
|
|
2077
|
-
this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(
|
|
2139
|
+
const s = this.getRect();
|
|
2140
|
+
this.ctx.save(), this.ctx.beginPath(), this.ctx.rect(s.left, s.top, s.width, s.height);
|
|
2078
2141
|
const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y });
|
|
2079
2142
|
this.ctx.translate(n.x, n.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
|
|
2080
2143
|
const a = this.ctx.createLinearGradient(0, 0, this.shadow.width, 0);
|
|
2081
|
-
this.shadow.direction === 0 ? (this.ctx.translate(0, -100), a.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), a.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = a, this.ctx.fillRect(0, 0, this.shadow.width, 2 *
|
|
2144
|
+
this.shadow.direction === 0 ? (this.ctx.translate(0, -100), a.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), a.addColorStop(1, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(-this.shadow.width, -100), a.addColorStop(0, "rgba(0, 0, 0, 0)"), a.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")")), this.ctx.clip(), this.ctx.fillStyle = a, this.ctx.fillRect(0, 0, this.shadow.width, 2 * s.height), this.ctx.restore();
|
|
2082
2145
|
}
|
|
2083
2146
|
drawInnerShadow() {
|
|
2084
|
-
const
|
|
2147
|
+
const s = this.getRect();
|
|
2085
2148
|
this.ctx.save(), this.ctx.beginPath();
|
|
2086
2149
|
const n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.convertRectToGlobal(this.pageRect);
|
|
2087
2150
|
this.ctx.moveTo(a.topLeft.x, a.topLeft.y), this.ctx.lineTo(a.topRight.x, a.topRight.y), this.ctx.lineTo(a.bottomRight.x, a.bottomRight.y), this.ctx.lineTo(a.bottomLeft.x, a.bottomLeft.y), this.ctx.translate(n.x, n.y), this.ctx.rotate(Math.PI + this.shadow.angle + Math.PI / 2);
|
|
2088
2151
|
const l = 3 * this.shadow.width / 4, d = this.ctx.createLinearGradient(0, 0, l, 0);
|
|
2089
|
-
this.shadow.direction === 0 ? (this.ctx.translate(-l, -100), d.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), d.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = d, this.ctx.fillRect(0, 0, l, 2 *
|
|
2152
|
+
this.shadow.direction === 0 ? (this.ctx.translate(-l, -100), d.addColorStop(1, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.9, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.7, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0, "rgba(0, 0, 0, 0)")) : (this.ctx.translate(0, -100), d.addColorStop(0, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(0.1, "rgba(0, 0, 0, 0.05)"), d.addColorStop(0.3, "rgba(0, 0, 0, " + this.shadow.opacity + ")"), d.addColorStop(1, "rgba(0, 0, 0, 0)")), this.ctx.clip(), this.ctx.fillStyle = d, this.ctx.fillRect(0, 0, l, 2 * s.height), this.ctx.restore();
|
|
2090
2153
|
}
|
|
2091
2154
|
clear() {
|
|
2092
2155
|
this.ctx.fillStyle = "white", this.ctx.fillRect(0, 0, this.canvas.width, this.canvas.height);
|
|
2093
2156
|
}
|
|
2094
2157
|
}
|
|
2095
|
-
class
|
|
2096
|
-
constructor(
|
|
2158
|
+
class A {
|
|
2159
|
+
constructor(s, n, a) {
|
|
2097
2160
|
this.touchPoint = null, this.swipeTimeout = 250, this.onResize = () => {
|
|
2098
2161
|
this.update();
|
|
2099
2162
|
}, this.onMouseDown = (d) => {
|
|
2100
2163
|
if (this.checkTarget(d.target)) {
|
|
2101
|
-
const
|
|
2102
|
-
this.app.startUserTouch(
|
|
2164
|
+
const p = this.getMousePos(d.clientX, d.clientY);
|
|
2165
|
+
this.app.startUserTouch(p), d.preventDefault();
|
|
2103
2166
|
}
|
|
2104
2167
|
}, this.onTouchStart = (d) => {
|
|
2105
2168
|
if (this.checkTarget(d.target) && d.changedTouches.length > 0) {
|
|
2106
|
-
const
|
|
2107
|
-
this.touchPoint = { point:
|
|
2108
|
-
this.touchPoint !== null && this.app.startUserTouch(
|
|
2169
|
+
const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
|
|
2170
|
+
this.touchPoint = { point: y, time: Date.now() }, setTimeout(() => {
|
|
2171
|
+
this.touchPoint !== null && this.app.startUserTouch(y);
|
|
2109
2172
|
}, this.swipeTimeout), this.app.getSettings().mobileScrollSupport || d.preventDefault();
|
|
2110
2173
|
}
|
|
2111
2174
|
}, this.onMouseUp = (d) => {
|
|
2112
|
-
const
|
|
2113
|
-
this.app.userStop(
|
|
2175
|
+
const p = this.getMousePos(d.clientX, d.clientY);
|
|
2176
|
+
this.app.userStop(p);
|
|
2114
2177
|
}, this.onMouseMove = (d) => {
|
|
2115
|
-
const
|
|
2116
|
-
this.app.userMove(
|
|
2178
|
+
const p = this.getMousePos(d.clientX, d.clientY);
|
|
2179
|
+
this.app.userMove(p, !1);
|
|
2117
2180
|
}, this.onTouchMove = (d) => {
|
|
2118
2181
|
if (d.changedTouches.length > 0) {
|
|
2119
|
-
const
|
|
2120
|
-
this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x -
|
|
2182
|
+
const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
|
|
2183
|
+
this.app.getSettings().mobileScrollSupport ? (this.touchPoint !== null && (Math.abs(this.touchPoint.point.x - y.x) > 10 || this.app.getState() !== "read") && d.cancelable && this.app.userMove(y, !0), this.app.getState() !== "read" && d.preventDefault()) : this.app.userMove(y, !0);
|
|
2121
2184
|
}
|
|
2122
2185
|
}, this.onTouchEnd = (d) => {
|
|
2123
2186
|
if (d.changedTouches.length > 0) {
|
|
2124
|
-
const
|
|
2125
|
-
let
|
|
2187
|
+
const p = d.changedTouches[0], y = this.getMousePos(p.clientX, p.clientY);
|
|
2188
|
+
let f = !1;
|
|
2126
2189
|
if (this.touchPoint !== null) {
|
|
2127
|
-
const
|
|
2128
|
-
Math.abs(
|
|
2190
|
+
const E = y.x - this.touchPoint.point.x, R = Math.abs(y.y - this.touchPoint.point.y);
|
|
2191
|
+
Math.abs(E) > this.swipeDistance && R < 2 * this.swipeDistance && Date.now() - this.touchPoint.time < this.swipeTimeout && (E > 0 ? this.app.flipPrev(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom") : this.app.flipNext(this.touchPoint.point.y < this.app.getRender().getRect().height / 2 ? "top" : "bottom"), f = !0), this.touchPoint = null;
|
|
2129
2192
|
}
|
|
2130
|
-
this.app.userStop(
|
|
2193
|
+
this.app.userStop(y, f);
|
|
2131
2194
|
}
|
|
2132
|
-
}, this.parentElement =
|
|
2195
|
+
}, this.parentElement = s, s.classList.add("stf__parent"), s.insertAdjacentHTML("afterbegin", '<div class="stf__wrapper"></div>'), this.wrapper = s.querySelector(".stf__wrapper"), this.app = n;
|
|
2133
2196
|
const l = this.app.getSettings().usePortrait ? 1 : 2;
|
|
2134
|
-
|
|
2197
|
+
s.style.minWidth = a.minWidth * l + "px", s.style.minHeight = a.minHeight + "px", a.size === "fixed" && (s.style.minWidth = a.width * l + "px", s.style.minHeight = a.height + "px"), a.autoSize && (s.style.width = "100%", s.style.maxWidth = 2 * a.maxWidth + "px"), s.style.display = "block", window.addEventListener("resize", this.onResize, !1), this.swipeDistance = a.swipeDistance;
|
|
2135
2198
|
}
|
|
2136
2199
|
destroy() {
|
|
2137
2200
|
this.app.getSettings().useMouseEvents && this.removeHandlers(), this.distElement.remove(), this.wrapper.remove();
|
|
@@ -2142,8 +2205,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2142
2205
|
getWrapper() {
|
|
2143
2206
|
return this.wrapper;
|
|
2144
2207
|
}
|
|
2145
|
-
setOrientationStyle(
|
|
2146
|
-
this.wrapper.classList.remove("--portrait", "--landscape"),
|
|
2208
|
+
setOrientationStyle(s) {
|
|
2209
|
+
this.wrapper.classList.remove("--portrait", "--landscape"), s === "portrait" ? (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / this.app.getSettings().width * 100 + "%"), this.wrapper.classList.add("--portrait")) : (this.app.getSettings().autoSize && (this.wrapper.style.paddingBottom = this.app.getSettings().height / (2 * this.app.getSettings().width) * 100 + "%"), this.wrapper.classList.add("--landscape")), this.update();
|
|
2147
2210
|
}
|
|
2148
2211
|
removeHandlers() {
|
|
2149
2212
|
window.removeEventListener("resize", this.onResize), this.distElement.removeEventListener("mousedown", this.onMouseDown), this.distElement.removeEventListener("touchstart", this.onTouchStart), window.removeEventListener("mousemove", this.onMouseMove), window.removeEventListener("touchmove", this.onTouchMove), window.removeEventListener("mouseup", this.onMouseUp), window.removeEventListener("touchend", this.onTouchEnd);
|
|
@@ -2151,38 +2214,38 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2151
2214
|
setHandlers() {
|
|
2152
2215
|
window.addEventListener("resize", this.onResize, !1), this.app.getSettings().useMouseEvents && (this.distElement.addEventListener("mousedown", this.onMouseDown), this.distElement.addEventListener("touchstart", this.onTouchStart), window.addEventListener("mousemove", this.onMouseMove), window.addEventListener("touchmove", this.onTouchMove, { passive: !this.app.getSettings().mobileScrollSupport }), window.addEventListener("mouseup", this.onMouseUp), window.addEventListener("touchend", this.onTouchEnd));
|
|
2153
2216
|
}
|
|
2154
|
-
getMousePos(
|
|
2217
|
+
getMousePos(s, n) {
|
|
2155
2218
|
const a = this.distElement.getBoundingClientRect();
|
|
2156
|
-
return { x:
|
|
2219
|
+
return { x: s - a.left, y: n - a.top };
|
|
2157
2220
|
}
|
|
2158
|
-
checkTarget(
|
|
2159
|
-
return !this.app.getSettings().clickEventForward || !["a", "button"].includes(
|
|
2221
|
+
checkTarget(s) {
|
|
2222
|
+
return !this.app.getSettings().clickEventForward || !["a", "button"].includes(s.tagName.toLowerCase());
|
|
2160
2223
|
}
|
|
2161
2224
|
}
|
|
2162
|
-
class
|
|
2163
|
-
constructor(
|
|
2164
|
-
super(
|
|
2225
|
+
class L extends A {
|
|
2226
|
+
constructor(s, n, a, l) {
|
|
2227
|
+
super(s, n, a), this.wrapper.insertAdjacentHTML("afterbegin", '<div class="stf__block"></div>'), this.distElement = s.querySelector(".stf__block"), this.items = l;
|
|
2165
2228
|
for (const d of l) this.distElement.appendChild(d);
|
|
2166
2229
|
this.setHandlers();
|
|
2167
2230
|
}
|
|
2168
2231
|
clear() {
|
|
2169
|
-
for (const
|
|
2232
|
+
for (const s of this.items) this.parentElement.appendChild(s);
|
|
2170
2233
|
}
|
|
2171
|
-
updateItems(
|
|
2234
|
+
updateItems(s) {
|
|
2172
2235
|
this.removeHandlers(), this.distElement.innerHTML = "";
|
|
2173
|
-
for (const n of
|
|
2174
|
-
this.items =
|
|
2236
|
+
for (const n of s) this.distElement.appendChild(n);
|
|
2237
|
+
this.items = s, this.setHandlers();
|
|
2175
2238
|
}
|
|
2176
2239
|
update() {
|
|
2177
2240
|
this.app.getRender().update();
|
|
2178
2241
|
}
|
|
2179
2242
|
}
|
|
2180
|
-
class
|
|
2181
|
-
constructor(
|
|
2182
|
-
super(
|
|
2243
|
+
class U extends A {
|
|
2244
|
+
constructor(s, n, a) {
|
|
2245
|
+
super(s, n, a), this.wrapper.innerHTML = '<canvas class="stf__canvas"></canvas>', this.canvas = s.querySelectorAll("canvas")[0], this.distElement = this.canvas, this.resizeCanvas(), this.setHandlers();
|
|
2183
2246
|
}
|
|
2184
2247
|
resizeCanvas() {
|
|
2185
|
-
const
|
|
2248
|
+
const s = getComputedStyle(this.canvas), n = parseInt(s.getPropertyValue("width"), 10), a = parseInt(s.getPropertyValue("height"), 10);
|
|
2186
2249
|
this.canvas.width = n, this.canvas.height = a;
|
|
2187
2250
|
}
|
|
2188
2251
|
getCanvas() {
|
|
@@ -2192,9 +2255,9 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2192
2255
|
this.resizeCanvas(), this.app.getRender().update();
|
|
2193
2256
|
}
|
|
2194
2257
|
}
|
|
2195
|
-
class
|
|
2196
|
-
constructor(
|
|
2197
|
-
super(
|
|
2258
|
+
class N extends S {
|
|
2259
|
+
constructor(s, n, a) {
|
|
2260
|
+
super(s, n), this.outerShadow = null, this.innerShadow = null, this.hardShadow = null, this.hardInnerShadow = null, this.element = a, this.createShadows();
|
|
2198
2261
|
}
|
|
2199
2262
|
createShadows() {
|
|
2200
2263
|
this.element.insertAdjacentHTML("beforeend", `<div class="stf__outerShadow"></div>
|
|
@@ -2209,82 +2272,82 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2209
2272
|
this.element.querySelector(".stf__outerShadow") || this.createShadows();
|
|
2210
2273
|
}
|
|
2211
2274
|
drawHardInnerShadow() {
|
|
2212
|
-
const
|
|
2213
|
-
let a = (100 - n) * (2.5 *
|
|
2214
|
-
a >
|
|
2275
|
+
const s = this.getRect(), n = this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress;
|
|
2276
|
+
let a = (100 - n) * (2.5 * s.pageWidth) / 100 + 20;
|
|
2277
|
+
a > s.pageWidth && (a = s.pageWidth);
|
|
2215
2278
|
let l = `
|
|
2216
2279
|
display: block;
|
|
2217
2280
|
z-index: ${(this.getSettings().startZIndex + 5).toString(10)};
|
|
2218
2281
|
width: ${a}px;
|
|
2219
|
-
height: ${
|
|
2282
|
+
height: ${s.height}px;
|
|
2220
2283
|
background: linear-gradient(to right,
|
|
2221
2284
|
rgba(0, 0, 0, ${this.shadow.opacity * n / 100}) 5%,
|
|
2222
2285
|
rgba(0, 0, 0, 0) 100%);
|
|
2223
|
-
left: ${
|
|
2286
|
+
left: ${s.left + s.width / 2}px;
|
|
2224
2287
|
transform-origin: 0 0;
|
|
2225
2288
|
`;
|
|
2226
2289
|
l += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0);" : "transform: translate3d(0, 0, 0) rotateY(180deg);", this.hardInnerShadow.style.cssText = l;
|
|
2227
2290
|
}
|
|
2228
2291
|
drawHardOuterShadow() {
|
|
2229
|
-
const
|
|
2230
|
-
let n = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 *
|
|
2231
|
-
n >
|
|
2292
|
+
const s = this.getRect();
|
|
2293
|
+
let n = (100 - (this.shadow.progress > 100 ? 200 - this.shadow.progress : this.shadow.progress)) * (2.5 * s.pageWidth) / 100 + 20;
|
|
2294
|
+
n > s.pageWidth && (n = s.pageWidth);
|
|
2232
2295
|
let a = `
|
|
2233
2296
|
display: block;
|
|
2234
2297
|
z-index: ${(this.getSettings().startZIndex + 4).toString(10)};
|
|
2235
2298
|
width: ${n}px;
|
|
2236
|
-
height: ${
|
|
2299
|
+
height: ${s.height}px;
|
|
2237
2300
|
background: linear-gradient(to left, rgba(0, 0, 0, ${this.shadow.opacity}) 5%, rgba(0, 0, 0, 0) 100%);
|
|
2238
|
-
left: ${
|
|
2301
|
+
left: ${s.left + s.width / 2}px;
|
|
2239
2302
|
transform-origin: 0 0;
|
|
2240
2303
|
`;
|
|
2241
2304
|
a += this.getDirection() === 0 && this.shadow.progress > 100 || this.getDirection() === 1 && this.shadow.progress <= 100 ? "transform: translate3d(0, 0, 0) rotateY(180deg);" : "transform: translate3d(0, 0, 0);", this.hardShadow.style.cssText = a;
|
|
2242
2305
|
}
|
|
2243
2306
|
drawInnerShadow() {
|
|
2244
|
-
const
|
|
2245
|
-
let
|
|
2246
|
-
for (const R of
|
|
2247
|
-
let
|
|
2248
|
-
|
|
2307
|
+
const s = this.getRect(), n = 3 * this.shadow.width / 4, a = this.getDirection() === 0 ? n : 0, l = this.getDirection() === 0 ? "to left" : "to right", d = this.convertToGlobal(this.shadow.pos), p = this.shadow.angle + 3 * Math.PI / 2, y = [this.pageRect.topLeft, this.pageRect.topRight, this.pageRect.bottomRight, this.pageRect.bottomLeft];
|
|
2308
|
+
let f = "polygon( ";
|
|
2309
|
+
for (const R of y) {
|
|
2310
|
+
let O = this.getDirection() === 1 ? { x: -R.x + this.shadow.pos.x, y: R.y - this.shadow.pos.y } : { x: R.x - this.shadow.pos.x, y: R.y - this.shadow.pos.y };
|
|
2311
|
+
O = c.GetRotatedPoint(O, { x: a, y: 100 }, p), f += O.x + "px " + O.y + "px, ";
|
|
2249
2312
|
}
|
|
2250
|
-
|
|
2251
|
-
const
|
|
2313
|
+
f = f.slice(0, -2), f += ")";
|
|
2314
|
+
const E = `
|
|
2252
2315
|
display: block;
|
|
2253
2316
|
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2254
2317
|
width: ${n}px;
|
|
2255
|
-
height: ${2 *
|
|
2318
|
+
height: ${2 * s.height}px;
|
|
2256
2319
|
background: linear-gradient(${l},
|
|
2257
2320
|
rgba(0, 0, 0, ${this.shadow.opacity}) 5%,
|
|
2258
2321
|
rgba(0, 0, 0, 0.05) 15%,
|
|
2259
2322
|
rgba(0, 0, 0, ${this.shadow.opacity}) 35%,
|
|
2260
2323
|
rgba(0, 0, 0, 0) 100%);
|
|
2261
2324
|
transform-origin: ${a}px 100px;
|
|
2262
|
-
transform: translate3d(${d.x - a}px, ${d.y - 100}px, 0) rotate(${
|
|
2263
|
-
clip-path: ${
|
|
2264
|
-
-webkit-clip-path: ${
|
|
2325
|
+
transform: translate3d(${d.x - a}px, ${d.y - 100}px, 0) rotate(${p}rad);
|
|
2326
|
+
clip-path: ${f};
|
|
2327
|
+
-webkit-clip-path: ${f};
|
|
2265
2328
|
`;
|
|
2266
|
-
this.innerShadow.style.cssText =
|
|
2329
|
+
this.innerShadow.style.cssText = E;
|
|
2267
2330
|
}
|
|
2268
2331
|
drawOuterShadow() {
|
|
2269
|
-
const
|
|
2270
|
-
let
|
|
2271
|
-
for (const
|
|
2272
|
-
let R = this.getDirection() === 1 ? { x: -
|
|
2273
|
-
R =
|
|
2332
|
+
const s = this.getRect(), n = this.convertToGlobal({ x: this.shadow.pos.x, y: this.shadow.pos.y }), a = this.shadow.angle + 3 * Math.PI / 2, l = this.getDirection() === 1 ? this.shadow.width : 0, d = this.getDirection() === 0 ? "to right" : "to left", p = [{ x: 0, y: 0 }, { x: s.pageWidth, y: 0 }, { x: s.pageWidth, y: s.height }, { x: 0, y: s.height }];
|
|
2333
|
+
let y = "polygon( ";
|
|
2334
|
+
for (const E of p) if (E !== null) {
|
|
2335
|
+
let R = this.getDirection() === 1 ? { x: -E.x + this.shadow.pos.x, y: E.y - this.shadow.pos.y } : { x: E.x - this.shadow.pos.x, y: E.y - this.shadow.pos.y };
|
|
2336
|
+
R = c.GetRotatedPoint(R, { x: l, y: 100 }, a), y += R.x + "px " + R.y + "px, ";
|
|
2274
2337
|
}
|
|
2275
|
-
|
|
2276
|
-
const
|
|
2338
|
+
y = y.slice(0, -2), y += ")";
|
|
2339
|
+
const f = `
|
|
2277
2340
|
display: block;
|
|
2278
2341
|
z-index: ${(this.getSettings().startZIndex + 10).toString(10)};
|
|
2279
2342
|
width: ${this.shadow.width}px;
|
|
2280
|
-
height: ${2 *
|
|
2343
|
+
height: ${2 * s.height}px;
|
|
2281
2344
|
background: linear-gradient(${d}, rgba(0, 0, 0, ${this.shadow.opacity}), rgba(0, 0, 0, 0));
|
|
2282
2345
|
transform-origin: ${l}px 100px;
|
|
2283
2346
|
transform: translate3d(${n.x - l}px, ${n.y - 100}px, 0) rotate(${a}rad);
|
|
2284
|
-
clip-path: ${
|
|
2285
|
-
-webkit-clip-path: ${
|
|
2347
|
+
clip-path: ${y};
|
|
2348
|
+
-webkit-clip-path: ${y};
|
|
2286
2349
|
`;
|
|
2287
|
-
this.outerShadow.style.cssText =
|
|
2350
|
+
this.outerShadow.style.cssText = f;
|
|
2288
2351
|
}
|
|
2289
2352
|
drawLeftPage() {
|
|
2290
2353
|
this.orientation !== "portrait" && this.leftPage !== null && (this.direction === 1 && this.flippingPage !== null && this.flippingPage.getDrawingDensity() === "hard" ? (this.leftPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.leftPage.setHardDrawingAngle(180 + this.flippingPage.getHardAngle()), this.leftPage.draw(this.flippingPage.getDrawingDensity())) : this.leftPage.simpleDraw(0));
|
|
@@ -2294,37 +2357,37 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2294
2357
|
}
|
|
2295
2358
|
drawBottomPage() {
|
|
2296
2359
|
if (this.bottomPage === null) return;
|
|
2297
|
-
const
|
|
2298
|
-
this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(
|
|
2360
|
+
const s = this.flippingPage != null ? this.flippingPage.getDrawingDensity() : null;
|
|
2361
|
+
this.orientation === "portrait" && this.direction === 1 || (this.bottomPage.getElement().style.zIndex = (this.getSettings().startZIndex + 3).toString(10), this.bottomPage.draw(s));
|
|
2299
2362
|
}
|
|
2300
2363
|
drawFrame() {
|
|
2301
2364
|
this.clear(), this.drawLeftPage(), this.drawRightPage(), this.drawBottomPage(), this.flippingPage != null && (this.flippingPage.getElement().style.zIndex = (this.getSettings().startZIndex + 5).toString(10), this.flippingPage.draw()), this.shadow != null && this.flippingPage !== null && (this.flippingPage.getDrawingDensity() === "soft" ? (this.drawOuterShadow(), this.drawInnerShadow()) : (this.drawHardOuterShadow(), this.drawHardInnerShadow()));
|
|
2302
2365
|
}
|
|
2303
2366
|
clear() {
|
|
2304
|
-
for (const
|
|
2367
|
+
for (const s of this.app.getPageCollection().getPages()) s !== this.leftPage && s !== this.rightPage && s !== this.flippingPage && s !== this.bottomPage && (s.getElement().style.cssText = "display: none"), s.getTemporaryCopy() !== this.flippingPage && s.hideTemporaryCopy();
|
|
2305
2368
|
}
|
|
2306
2369
|
update() {
|
|
2307
2370
|
super.update(), this.rightPage !== null && this.rightPage.setOrientation(1), this.leftPage !== null && this.leftPage.setOrientation(0);
|
|
2308
2371
|
}
|
|
2309
2372
|
}
|
|
2310
|
-
class
|
|
2373
|
+
class H {
|
|
2311
2374
|
constructor() {
|
|
2312
2375
|
this._default = { startPage: 0, size: "fixed", width: 0, height: 0, minWidth: 0, maxWidth: 0, minHeight: 0, maxHeight: 0, drawShadow: !0, flippingTime: 1e3, usePortrait: !0, startZIndex: 0, autoSize: !0, maxShadowOpacity: 1, showCover: !1, mobileScrollSupport: !0, swipeDistance: 30, clickEventForward: !0, useMouseEvents: !0, showPageCorners: !0, disableFlipByClick: !1 };
|
|
2313
2376
|
}
|
|
2314
|
-
getSettings(
|
|
2377
|
+
getSettings(s) {
|
|
2315
2378
|
const n = this._default;
|
|
2316
|
-
if (Object.assign(n,
|
|
2379
|
+
if (Object.assign(n, s), n.size !== "stretch" && n.size !== "fixed") throw new Error('Invalid size type. Available only "fixed" and "stretch" value');
|
|
2317
2380
|
if (n.width <= 0 || n.height <= 0) throw new Error("Invalid width or height");
|
|
2318
2381
|
if (n.flippingTime <= 0) throw new Error("Invalid flipping time");
|
|
2319
2382
|
return n.size === "stretch" ? (n.minWidth <= 0 && (n.minWidth = 100), n.maxWidth < n.minWidth && (n.maxWidth = 2e3), n.minHeight <= 0 && (n.minHeight = 100), n.maxHeight < n.minHeight && (n.maxHeight = 2e3)) : (n.minWidth = n.width, n.maxWidth = n.width, n.minHeight = n.height, n.maxHeight = n.height), n;
|
|
2320
2383
|
}
|
|
2321
2384
|
}
|
|
2322
|
-
(function(
|
|
2323
|
-
|
|
2324
|
-
var n =
|
|
2385
|
+
(function(m, s) {
|
|
2386
|
+
s === void 0 && (s = {});
|
|
2387
|
+
var n = s.insertAt;
|
|
2325
2388
|
if (typeof document < "u") {
|
|
2326
2389
|
var a = document.head || document.getElementsByTagName("head")[0], l = document.createElement("style");
|
|
2327
|
-
l.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(l, a.firstChild) : a.appendChild(l), l.styleSheet ? l.styleSheet.cssText =
|
|
2390
|
+
l.type = "text/css", n === "top" && a.firstChild ? a.insertBefore(l, a.firstChild) : a.appendChild(l), l.styleSheet ? l.styleSheet.cssText = m : l.appendChild(document.createTextNode(m));
|
|
2328
2391
|
}
|
|
2329
2392
|
})(`.stf__parent {
|
|
2330
2393
|
position: relative;
|
|
@@ -2386,22 +2449,22 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2386
2449
|
position: absolute;
|
|
2387
2450
|
left: 0;
|
|
2388
2451
|
top: 0;
|
|
2389
|
-
}`),
|
|
2452
|
+
}`), i.PageFlip = class extends class {
|
|
2390
2453
|
constructor() {
|
|
2391
2454
|
this.events = /* @__PURE__ */ new Map();
|
|
2392
2455
|
}
|
|
2393
|
-
on(
|
|
2394
|
-
return this.events.has(
|
|
2456
|
+
on(m, s) {
|
|
2457
|
+
return this.events.has(m) ? this.events.get(m).push(s) : this.events.set(m, [s]), this;
|
|
2395
2458
|
}
|
|
2396
|
-
off(
|
|
2397
|
-
this.events.delete(
|
|
2459
|
+
off(m) {
|
|
2460
|
+
this.events.delete(m);
|
|
2398
2461
|
}
|
|
2399
|
-
trigger(
|
|
2400
|
-
if (this.events.has(
|
|
2462
|
+
trigger(m, s, n = null) {
|
|
2463
|
+
if (this.events.has(m)) for (const a of this.events.get(m)) a({ data: n, object: s });
|
|
2401
2464
|
}
|
|
2402
2465
|
} {
|
|
2403
|
-
constructor(
|
|
2404
|
-
super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new
|
|
2466
|
+
constructor(m, s) {
|
|
2467
|
+
super(), this.isUserTouch = !1, this.isUserMove = !1, this.setting = null, this.pages = null, this.setting = new H().getSettings(s), this.block = m;
|
|
2405
2468
|
}
|
|
2406
2469
|
destroy() {
|
|
2407
2470
|
this.ui.destroy(), this.block.remove();
|
|
@@ -2409,25 +2472,25 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2409
2472
|
update() {
|
|
2410
2473
|
this.render.update(), this.pages.show();
|
|
2411
2474
|
}
|
|
2412
|
-
loadFromImages(
|
|
2413
|
-
this.ui = new
|
|
2414
|
-
const
|
|
2415
|
-
this.render = new
|
|
2475
|
+
loadFromImages(m) {
|
|
2476
|
+
this.ui = new U(this.block, this, this.setting);
|
|
2477
|
+
const s = this.ui.getCanvas();
|
|
2478
|
+
this.render = new T(this, this.setting, s), this.flipController = new I(this.render, this), this.pages = new u(this, this.render, m), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
|
|
2416
2479
|
this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
|
|
2417
2480
|
}, 1);
|
|
2418
2481
|
}
|
|
2419
|
-
loadFromHTML(
|
|
2420
|
-
this.ui = new
|
|
2482
|
+
loadFromHTML(m) {
|
|
2483
|
+
this.ui = new L(this.block, this, this.setting, m), this.render = new N(this, this.setting, this.ui.getDistElement()), this.flipController = new I(this.render, this), this.pages = new P(this, this.render, this.ui.getDistElement(), m), this.pages.load(), this.render.start(), this.pages.show(this.setting.startPage), setTimeout(() => {
|
|
2421
2484
|
this.ui.update(), this.trigger("init", this, { page: this.setting.startPage, mode: this.render.getOrientation() });
|
|
2422
2485
|
}, 1);
|
|
2423
2486
|
}
|
|
2424
|
-
updateFromImages(
|
|
2425
|
-
const
|
|
2426
|
-
this.pages.destroy(), this.pages = new u(this, this.render,
|
|
2487
|
+
updateFromImages(m) {
|
|
2488
|
+
const s = this.pages.getCurrentPageIndex();
|
|
2489
|
+
this.pages.destroy(), this.pages = new u(this, this.render, m), this.pages.load(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
|
|
2427
2490
|
}
|
|
2428
|
-
updateFromHtml(
|
|
2429
|
-
const
|
|
2430
|
-
this.pages.destroy(), this.pages = new P(this, this.render, this.ui.getDistElement(),
|
|
2491
|
+
updateFromHtml(m) {
|
|
2492
|
+
const s = this.pages.getCurrentPageIndex();
|
|
2493
|
+
this.pages.destroy(), this.pages = new P(this, this.render, this.ui.getDistElement(), m), this.pages.load(), this.ui.updateItems(m), this.render.reload(), this.pages.show(s), this.trigger("update", this, { page: s, mode: this.render.getOrientation() });
|
|
2431
2494
|
}
|
|
2432
2495
|
clear() {
|
|
2433
2496
|
this.pages.destroy(), this.ui.clear();
|
|
@@ -2438,26 +2501,26 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2438
2501
|
turnToNextPage() {
|
|
2439
2502
|
this.pages.showNext();
|
|
2440
2503
|
}
|
|
2441
|
-
turnToPage(
|
|
2442
|
-
this.pages.show(
|
|
2504
|
+
turnToPage(m) {
|
|
2505
|
+
this.pages.show(m);
|
|
2443
2506
|
}
|
|
2444
|
-
flipNext(
|
|
2445
|
-
this.flipController.flipNext(
|
|
2507
|
+
flipNext(m = "top") {
|
|
2508
|
+
this.flipController.flipNext(m);
|
|
2446
2509
|
}
|
|
2447
|
-
flipPrev(
|
|
2448
|
-
this.flipController.flipPrev(
|
|
2510
|
+
flipPrev(m = "top") {
|
|
2511
|
+
this.flipController.flipPrev(m);
|
|
2449
2512
|
}
|
|
2450
|
-
flip(
|
|
2451
|
-
this.flipController.flipToPage(
|
|
2513
|
+
flip(m, s = "top") {
|
|
2514
|
+
this.flipController.flipToPage(m, s);
|
|
2452
2515
|
}
|
|
2453
|
-
updateState(
|
|
2454
|
-
this.trigger("changeState", this,
|
|
2516
|
+
updateState(m) {
|
|
2517
|
+
this.trigger("changeState", this, m);
|
|
2455
2518
|
}
|
|
2456
|
-
updatePageIndex(
|
|
2457
|
-
this.trigger("flip", this,
|
|
2519
|
+
updatePageIndex(m) {
|
|
2520
|
+
this.trigger("flip", this, m);
|
|
2458
2521
|
}
|
|
2459
|
-
updateOrientation(
|
|
2460
|
-
this.ui.setOrientationStyle(
|
|
2522
|
+
updateOrientation(m) {
|
|
2523
|
+
this.ui.setOrientationStyle(m), this.update(), this.trigger("changeOrientation", this, m);
|
|
2461
2524
|
}
|
|
2462
2525
|
getPageCount() {
|
|
2463
2526
|
return this.pages.getPageCount();
|
|
@@ -2465,8 +2528,8 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2465
2528
|
getCurrentPageIndex() {
|
|
2466
2529
|
return this.pages.getCurrentPageIndex();
|
|
2467
2530
|
}
|
|
2468
|
-
getPage(
|
|
2469
|
-
return this.pages.getPage(
|
|
2531
|
+
getPage(m) {
|
|
2532
|
+
return this.pages.getPage(m);
|
|
2470
2533
|
}
|
|
2471
2534
|
getRender() {
|
|
2472
2535
|
return this.render;
|
|
@@ -2492,21 +2555,21 @@ var hi = typeof globalThis < "u" ? globalThis : typeof window < "u" ? window : t
|
|
|
2492
2555
|
getPageCollection() {
|
|
2493
2556
|
return this.pages;
|
|
2494
2557
|
}
|
|
2495
|
-
startUserTouch(
|
|
2496
|
-
this.mousePosition =
|
|
2558
|
+
startUserTouch(m) {
|
|
2559
|
+
this.mousePosition = m, this.isUserTouch = !0, this.isUserMove = !1;
|
|
2497
2560
|
}
|
|
2498
|
-
userMove(
|
|
2499
|
-
this.isUserTouch ||
|
|
2561
|
+
userMove(m, s) {
|
|
2562
|
+
this.isUserTouch || s || !this.setting.showPageCorners ? this.isUserTouch && c.GetDistanceBetweenTwoPoint(this.mousePosition, m) > 5 && (this.isUserMove = !0, this.flipController.fold(m)) : this.flipController.showCorner(m);
|
|
2500
2563
|
}
|
|
2501
|
-
userStop(
|
|
2502
|
-
this.isUserTouch && (this.isUserTouch = !1,
|
|
2564
|
+
userStop(m, s = !1) {
|
|
2565
|
+
this.isUserTouch && (this.isUserTouch = !1, s || (this.isUserMove ? this.flipController.stopMove() : this.flipController.flip(m)));
|
|
2503
2566
|
}
|
|
2504
|
-
}, Object.defineProperty(
|
|
2567
|
+
}, Object.defineProperty(i, "__esModule", { value: !0 });
|
|
2505
2568
|
});
|
|
2506
|
-
})(
|
|
2507
|
-
var
|
|
2569
|
+
})(It, It.exports);
|
|
2570
|
+
var fi = It.exports;
|
|
2508
2571
|
/**
|
|
2509
|
-
* @license FlipbookEngine v0.5
|
|
2572
|
+
* @license FlipbookEngine v0.6.5
|
|
2510
2573
|
* Copyright (c) 2026 Murat Dogan
|
|
2511
2574
|
*
|
|
2512
2575
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
@@ -2519,32 +2582,32 @@ var li = Dt.exports;
|
|
|
2519
2582
|
* you must purchase a Commercial License from:
|
|
2520
2583
|
* https://flipbookengine.com/pricing
|
|
2521
2584
|
*/
|
|
2522
|
-
function
|
|
2585
|
+
function mi() {
|
|
2523
2586
|
return typeof window < "u" && typeof window.matchMedia == "function" && window.matchMedia("(prefers-reduced-motion: reduce)").matches;
|
|
2524
2587
|
}
|
|
2525
|
-
function
|
|
2588
|
+
function wi(e, t = mi()) {
|
|
2526
2589
|
return t ? 0 : typeof e == "number" && e >= 0 ? e : 1e3;
|
|
2527
2590
|
}
|
|
2528
|
-
class
|
|
2529
|
-
constructor(t,
|
|
2530
|
-
|
|
2531
|
-
|
|
2532
|
-
|
|
2533
|
-
|
|
2534
|
-
|
|
2535
|
-
|
|
2536
|
-
|
|
2537
|
-
|
|
2538
|
-
|
|
2539
|
-
|
|
2540
|
-
this.bookContainer = t, this.options =
|
|
2591
|
+
class vi {
|
|
2592
|
+
constructor(t, i, o) {
|
|
2593
|
+
v(this, "pageFlip", null);
|
|
2594
|
+
v(this, "bookContainer");
|
|
2595
|
+
v(this, "options");
|
|
2596
|
+
v(this, "store");
|
|
2597
|
+
v(this, "unsubs", []);
|
|
2598
|
+
v(this, "audioEl", null);
|
|
2599
|
+
v(this, "audioUnlockHandler", null);
|
|
2600
|
+
v(this, "isLibraryFlipping", !1);
|
|
2601
|
+
v(this, "autoPlayTimer", null);
|
|
2602
|
+
v(this, "layoutUpdateTimer", null);
|
|
2603
|
+
this.bookContainer = t, this.options = i, this.store = o, i.soundUrl && (this.audioEl = new Audio(i.soundUrl), this.unlockAudio());
|
|
2541
2604
|
}
|
|
2542
2605
|
unlockAudio() {
|
|
2543
2606
|
if (!this.audioEl) return;
|
|
2544
2607
|
const t = () => {
|
|
2545
2608
|
if (this.audioEl) {
|
|
2546
|
-
const
|
|
2547
|
-
|
|
2609
|
+
const i = this.audioEl.play();
|
|
2610
|
+
i && typeof i.then == "function" && i.then(() => {
|
|
2548
2611
|
this.audioEl.pause(), this.audioEl.currentTime = 0;
|
|
2549
2612
|
}).catch(() => {
|
|
2550
2613
|
});
|
|
@@ -2553,10 +2616,10 @@ class ui {
|
|
|
2553
2616
|
};
|
|
2554
2617
|
this.audioUnlockHandler = t, document.addEventListener("touchstart", t, { once: !0 }), document.addEventListener("click", t, { once: !0 });
|
|
2555
2618
|
}
|
|
2556
|
-
init(t,
|
|
2557
|
-
this.pageFlip = new
|
|
2619
|
+
init(t, i) {
|
|
2620
|
+
this.pageFlip = new fi.PageFlip(this.bookContainer, {
|
|
2558
2621
|
width: t,
|
|
2559
|
-
height:
|
|
2622
|
+
height: i,
|
|
2560
2623
|
size: "stretch",
|
|
2561
2624
|
minWidth: 100,
|
|
2562
2625
|
maxWidth: 3e3,
|
|
@@ -2565,9 +2628,10 @@ class ui {
|
|
|
2565
2628
|
drawShadow: !0,
|
|
2566
2629
|
showCover: !0,
|
|
2567
2630
|
usePortrait: !0,
|
|
2568
|
-
|
|
2631
|
+
// Keep native mobile scrolling available; this avoids preventDefault on non-cancelable touchstart events.
|
|
2632
|
+
mobileScrollSupport: !0,
|
|
2569
2633
|
maxShadowOpacity: this.options.maxShadowOpacity || 0.5,
|
|
2570
|
-
flippingTime:
|
|
2634
|
+
flippingTime: wi(this.options.flippingTime)
|
|
2571
2635
|
});
|
|
2572
2636
|
const o = this.bookContainer.querySelectorAll(".bz-page");
|
|
2573
2637
|
this.pageFlip.loadFromHTML(Array.from(o)), this.bindEvents(), this.setupSignalSync();
|
|
@@ -2583,24 +2647,24 @@ class ui {
|
|
|
2583
2647
|
}
|
|
2584
2648
|
setupSignalSync() {
|
|
2585
2649
|
this.unsubs.push(
|
|
2586
|
-
|
|
2587
|
-
const t = this.store.currentPage.value,
|
|
2588
|
-
if (!this.pageFlip || this.isLibraryFlipping ||
|
|
2650
|
+
_(() => {
|
|
2651
|
+
const t = this.store.currentPage.value, i = this.store.flipState.peek();
|
|
2652
|
+
if (!this.pageFlip || this.isLibraryFlipping || i !== "read") return;
|
|
2589
2653
|
const o = this.pageFlip.getCurrentPageIndex();
|
|
2590
2654
|
if (o !== t && !this.store.isSingleMode.value) {
|
|
2591
|
-
const r = (
|
|
2655
|
+
const r = (c) => c === 0 ? 0 : Math.ceil(c / 2), h = r(t), u = r(o);
|
|
2592
2656
|
h === u + 1 ? this.pageFlip.flipNext() : h === u - 1 ? this.pageFlip.flipPrev() : h !== u && this.pageFlip.turnToPage(t);
|
|
2593
2657
|
}
|
|
2594
2658
|
})
|
|
2595
2659
|
), this.unsubs.push(
|
|
2596
|
-
|
|
2660
|
+
_(() => {
|
|
2597
2661
|
this.store.isSingleMode.value, this.pageFlip && (this.layoutUpdateTimer && clearTimeout(this.layoutUpdateTimer), this.layoutUpdateTimer = setTimeout(() => {
|
|
2598
2662
|
this.layoutUpdateTimer = null, this.pageFlip && this.pageFlip.update(), window.dispatchEvent(new Event("resize"));
|
|
2599
2663
|
}, 50));
|
|
2600
2664
|
})
|
|
2601
2665
|
), this.unsubs.push(
|
|
2602
|
-
|
|
2603
|
-
const t = this.store.isAutoPlaying.value,
|
|
2666
|
+
_(() => {
|
|
2667
|
+
const t = this.store.isAutoPlaying.value, i = this.store.autoPlayInterval.value || 3e3;
|
|
2604
2668
|
this.autoPlayTimer && (clearInterval(this.autoPlayTimer), this.autoPlayTimer = null), t && (this.autoPlayTimer = setInterval(() => {
|
|
2605
2669
|
const o = this.store.pages.value.length - 1;
|
|
2606
2670
|
if (this.store.currentPage.peek() >= o || this.store.currentPage.peek() >= o - 1 && !this.store.isSingleMode.peek()) {
|
|
@@ -2608,7 +2672,7 @@ class ui {
|
|
|
2608
2672
|
return;
|
|
2609
2673
|
}
|
|
2610
2674
|
this.turnToNextPage();
|
|
2611
|
-
},
|
|
2675
|
+
}, i));
|
|
2612
2676
|
})
|
|
2613
2677
|
);
|
|
2614
2678
|
}
|
|
@@ -2628,7 +2692,7 @@ class ui {
|
|
|
2628
2692
|
if (this.store.soundEnabled.value && this.audioEl) {
|
|
2629
2693
|
this.audioEl.currentTime = 0;
|
|
2630
2694
|
const t = this.audioEl.play();
|
|
2631
|
-
t && typeof t.catch == "function" && t.catch((
|
|
2695
|
+
t && typeof t.catch == "function" && t.catch((i) => console.warn("Flipbook Audio Play Error:", i));
|
|
2632
2696
|
}
|
|
2633
2697
|
}
|
|
2634
2698
|
update() {
|
|
@@ -2639,7 +2703,7 @@ class ui {
|
|
|
2639
2703
|
}
|
|
2640
2704
|
}
|
|
2641
2705
|
/**
|
|
2642
|
-
* @license FlipbookEngine v0.5
|
|
2706
|
+
* @license FlipbookEngine v0.6.5
|
|
2643
2707
|
* Copyright (c) 2026 Murat Dogan
|
|
2644
2708
|
*
|
|
2645
2709
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
@@ -2652,26 +2716,26 @@ class ui {
|
|
|
2652
2716
|
* you must purchase a Commercial License from:
|
|
2653
2717
|
* https://flipbookengine.com/pricing
|
|
2654
2718
|
*/
|
|
2655
|
-
class
|
|
2656
|
-
constructor(t,
|
|
2657
|
-
|
|
2658
|
-
|
|
2659
|
-
|
|
2660
|
-
|
|
2661
|
-
|
|
2662
|
-
|
|
2663
|
-
|
|
2664
|
-
|
|
2665
|
-
|
|
2666
|
-
|
|
2667
|
-
this.pageViewport = t, this.store =
|
|
2668
|
-
}
|
|
2669
|
-
init(t,
|
|
2670
|
-
this.wrapperElement = t, this.sizerElement =
|
|
2719
|
+
class yi {
|
|
2720
|
+
constructor(t, i) {
|
|
2721
|
+
v(this, "wrapperElement", null);
|
|
2722
|
+
v(this, "sizerElement", null);
|
|
2723
|
+
v(this, "pageViewport");
|
|
2724
|
+
v(this, "store");
|
|
2725
|
+
v(this, "resizeObserver", null);
|
|
2726
|
+
v(this, "orientationMediaQuery", null);
|
|
2727
|
+
v(this, "orientationChangeHandler", null);
|
|
2728
|
+
v(this, "unsubs", []);
|
|
2729
|
+
v(this, "updateTimer", null);
|
|
2730
|
+
v(this, "onResizeCallback");
|
|
2731
|
+
this.pageViewport = t, this.store = i;
|
|
2732
|
+
}
|
|
2733
|
+
init(t, i) {
|
|
2734
|
+
this.wrapperElement = t, this.sizerElement = i, this.setupResizeObserver(), this.setupOrientationMedia(), this.setupStateSync(), this.updateBookAspectRatio();
|
|
2671
2735
|
}
|
|
2672
2736
|
setupStateSync() {
|
|
2673
2737
|
this.unsubs.push(
|
|
2674
|
-
|
|
2738
|
+
_(() => {
|
|
2675
2739
|
this.store.isSingleMode.value, this.store.orientation.value, this.scheduleAspectRatioUpdate();
|
|
2676
2740
|
})
|
|
2677
2741
|
);
|
|
@@ -2684,21 +2748,21 @@ class gi {
|
|
|
2684
2748
|
setupOrientationMedia() {
|
|
2685
2749
|
if (typeof window < "u" && window.matchMedia) {
|
|
2686
2750
|
this.orientationMediaQuery = window.matchMedia("(orientation: portrait)");
|
|
2687
|
-
const t = (
|
|
2688
|
-
|
|
2751
|
+
const t = (i) => {
|
|
2752
|
+
i.matches, this.updateBookAspectRatio();
|
|
2689
2753
|
};
|
|
2690
2754
|
this.orientationChangeHandler = t, this.orientationMediaQuery.addEventListener ? this.orientationMediaQuery.addEventListener("change", t) : this.orientationMediaQuery.addListener(t), t(this.orientationMediaQuery);
|
|
2691
2755
|
}
|
|
2692
2756
|
}
|
|
2693
2757
|
updateBookAspectRatio() {
|
|
2694
2758
|
if (!this.wrapperElement || !this.sizerElement) return;
|
|
2695
|
-
const t = this.wrapperElement.clientWidth,
|
|
2696
|
-
if (t === 0 ||
|
|
2759
|
+
const t = this.wrapperElement.clientWidth, i = this.wrapperElement.clientHeight;
|
|
2760
|
+
if (t === 0 || i === 0) return;
|
|
2697
2761
|
const o = this.pageViewport.width, r = this.pageViewport.height, u = this.store.isDoublePageLayout.value ? o * 2 / r : o / r;
|
|
2698
|
-
let
|
|
2699
|
-
|
|
2700
|
-
let P = Math.ceil(
|
|
2701
|
-
P % 2 !== 0 && (P += 1), this.sizerElement.style.width = `${P}px`, this.sizerElement.style.height = `${Math.floor(
|
|
2762
|
+
let c = t, b = t / u;
|
|
2763
|
+
b > i && (b = i, c = i * u);
|
|
2764
|
+
let P = Math.ceil(c);
|
|
2765
|
+
P % 2 !== 0 && (P += 1), this.sizerElement.style.width = `${P}px`, this.sizerElement.style.height = `${Math.floor(b)}px`, this.sizerElement.style.aspectRatio = "", this.onResizeCallback && this.onResizeCallback();
|
|
2702
2766
|
}
|
|
2703
2767
|
destroy() {
|
|
2704
2768
|
this.updateTimer && (clearTimeout(this.updateTimer), this.updateTimer = null), this.unsubs.forEach((t) => t()), this.unsubs = [], this.resizeObserver && this.wrapperElement && (this.resizeObserver.unobserve(this.wrapperElement), this.resizeObserver.disconnect(), this.resizeObserver = null), this.orientationMediaQuery && (this.orientationChangeHandler && (this.orientationMediaQuery.removeEventListener ? this.orientationMediaQuery.removeEventListener("change", this.orientationChangeHandler) : this.orientationMediaQuery.removeListener(this.orientationChangeHandler)), this.orientationChangeHandler = null, this.orientationMediaQuery = null);
|
|
@@ -2710,7 +2774,7 @@ class gi {
|
|
|
2710
2774
|
}
|
|
2711
2775
|
}
|
|
2712
2776
|
/**
|
|
2713
|
-
* @license FlipbookEngine v0.5
|
|
2777
|
+
* @license FlipbookEngine v0.6.5
|
|
2714
2778
|
* Copyright (c) 2026 Murat Dogan
|
|
2715
2779
|
*
|
|
2716
2780
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
@@ -2723,16 +2787,16 @@ class gi {
|
|
|
2723
2787
|
* you must purchase a Commercial License from:
|
|
2724
2788
|
* https://flipbookengine.com/pricing
|
|
2725
2789
|
*/
|
|
2726
|
-
class
|
|
2727
|
-
constructor(t,
|
|
2728
|
-
|
|
2729
|
-
|
|
2730
|
-
|
|
2731
|
-
|
|
2732
|
-
|
|
2733
|
-
|
|
2790
|
+
class bi {
|
|
2791
|
+
constructor(t, i, o) {
|
|
2792
|
+
v(this, "container");
|
|
2793
|
+
v(this, "pageFlipAdapter");
|
|
2794
|
+
v(this, "store");
|
|
2795
|
+
v(this, "touchStartX", null);
|
|
2796
|
+
v(this, "unsubs", []);
|
|
2797
|
+
v(this, "listenerAbortController");
|
|
2734
2798
|
var h;
|
|
2735
|
-
this.container = t, this.pageFlipAdapter =
|
|
2799
|
+
this.container = t, this.pageFlipAdapter = i, this.store = o;
|
|
2736
2800
|
const r = ((h = t.ownerDocument.defaultView) == null ? void 0 : h.AbortController) ?? globalThis.AbortController;
|
|
2737
2801
|
this.listenerAbortController = new r();
|
|
2738
2802
|
}
|
|
@@ -2741,7 +2805,7 @@ class pi {
|
|
|
2741
2805
|
}
|
|
2742
2806
|
setupStateSync() {
|
|
2743
2807
|
this.unsubs.push(
|
|
2744
|
-
|
|
2808
|
+
_(() => {
|
|
2745
2809
|
this.store.isZoomed.value = this.store.zoomState.value.isActive, this.store.zoomState.value.isActive ? (this.container.style.transform = `translate(${this.store.zoomState.value.translateX}px, ${this.store.zoomState.value.translateY}px) scale(${this.store.zoomState.value.scale})`, this.container.style.transition = "none") : (this.container.style.transform = "", this.container.style.transition = "transform 0.3s ease");
|
|
2746
2810
|
})
|
|
2747
2811
|
);
|
|
@@ -2755,19 +2819,19 @@ class pi {
|
|
|
2755
2819
|
}, { passive: !1, signal: this.listenerAbortController.signal });
|
|
2756
2820
|
}
|
|
2757
2821
|
bindMouseDrag() {
|
|
2758
|
-
let t = !1,
|
|
2822
|
+
let t = !1, i = 0, o = 0, r = 0, h = 0;
|
|
2759
2823
|
this.container.addEventListener("mousedown", (u) => {
|
|
2760
|
-
this.store.zoomState.value.isActive && (t = !0,
|
|
2824
|
+
this.store.zoomState.value.isActive && (t = !0, i = u.clientX, o = u.clientY, r = this.store.zoomState.value.translateX, h = this.store.zoomState.value.translateY, this.container.style.cursor = "grabbing");
|
|
2761
2825
|
}, { signal: this.listenerAbortController.signal }), window.addEventListener("mousemove", (u) => {
|
|
2762
2826
|
if (!t || !this.store.zoomState.value.isActive) return;
|
|
2763
|
-
const
|
|
2764
|
-
this.updateZoomPan(r +
|
|
2827
|
+
const c = u.clientX - i, b = u.clientY - o;
|
|
2828
|
+
this.updateZoomPan(r + c, h + b);
|
|
2765
2829
|
}, { signal: this.listenerAbortController.signal }), window.addEventListener("mouseup", () => {
|
|
2766
2830
|
t && (t = !1, this.container.style.cursor = this.store.zoomState.value.isActive ? "grab" : "");
|
|
2767
2831
|
}, { signal: this.listenerAbortController.signal });
|
|
2768
2832
|
}
|
|
2769
2833
|
bindTouch() {
|
|
2770
|
-
let t = !1,
|
|
2834
|
+
let t = !1, i = 0, o = 0;
|
|
2771
2835
|
this.container.addEventListener("touchstart", (r) => {
|
|
2772
2836
|
if (r.touches.length === 1)
|
|
2773
2837
|
if (!this.store.zoomState.value.isActive)
|
|
@@ -2775,13 +2839,13 @@ class pi {
|
|
|
2775
2839
|
else {
|
|
2776
2840
|
t = !0, this.touchStartX = r.touches[0].clientX;
|
|
2777
2841
|
const h = r.touches[0].clientY;
|
|
2778
|
-
|
|
2842
|
+
i = this.store.zoomState.value.translateX, o = this.store.zoomState.value.translateY, this.container._touchStartY = h;
|
|
2779
2843
|
}
|
|
2780
2844
|
}, { passive: !0, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchmove", (r) => {
|
|
2781
2845
|
if (t && this.store.zoomState.value.isActive && r.touches.length === 1 && this.touchStartX !== null) {
|
|
2782
2846
|
r.preventDefault();
|
|
2783
2847
|
const h = r.touches[0].clientX - this.touchStartX, u = r.touches[0].clientY - this.container._touchStartY;
|
|
2784
|
-
this.updateZoomPan(
|
|
2848
|
+
this.updateZoomPan(i + h, o + u);
|
|
2785
2849
|
}
|
|
2786
2850
|
}, { passive: !1, signal: this.listenerAbortController.signal }), this.container.addEventListener("touchend", (r) => {
|
|
2787
2851
|
if (this.touchStartX !== null && !this.store.zoomState.value.isActive && this.store.isSingleMode.value && r.changedTouches.length === 1) {
|
|
@@ -2803,126 +2867,159 @@ class pi {
|
|
|
2803
2867
|
let t = this.store.zoomState.value.scale - 0.5;
|
|
2804
2868
|
t <= 1 ? (t = 1, this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !1, translateX: 0, translateY: 0, scale: 1 }, this.container.style.cursor = "") : this.store.zoomState.value = { ...this.store.zoomState.value, isActive: !0, scale: t };
|
|
2805
2869
|
}
|
|
2806
|
-
updateZoomPan(t,
|
|
2870
|
+
updateZoomPan(t, i) {
|
|
2807
2871
|
this.store.zoomState.value = {
|
|
2808
2872
|
...this.store.zoomState.value,
|
|
2809
2873
|
translateX: t,
|
|
2810
|
-
translateY:
|
|
2874
|
+
translateY: i
|
|
2811
2875
|
};
|
|
2812
2876
|
}
|
|
2813
2877
|
destroy() {
|
|
2814
2878
|
this.listenerAbortController.abort(), this.unsubs.forEach((t) => t()), this.unsubs = [];
|
|
2815
2879
|
}
|
|
2816
2880
|
}
|
|
2881
|
+
function be(e, t, i) {
|
|
2882
|
+
if (!e || typeof e.title != "string" || !e.title.trim() || !Number.isFinite(e.pageIndex)) return null;
|
|
2883
|
+
const o = Math.max(0, t - 1), r = Array.isArray(e.children) ? e.children.map((h, u) => be(h, t, i + "-" + u)).filter((h) => h !== null) : [];
|
|
2884
|
+
return {
|
|
2885
|
+
id: e.id ?? i,
|
|
2886
|
+
title: e.title.trim(),
|
|
2887
|
+
pageIndex: Math.max(0, Math.min(o, Math.trunc(e.pageIndex))),
|
|
2888
|
+
...r.length ? { children: r } : {}
|
|
2889
|
+
};
|
|
2890
|
+
}
|
|
2891
|
+
function Pe(e, t) {
|
|
2892
|
+
return Array.isArray(e) ? e.map((i, o) => be(i, t, "toc-" + o)).filter((i) => i !== null) : [];
|
|
2893
|
+
}
|
|
2817
2894
|
/**
|
|
2818
|
-
* @license FlipbookEngine v0.5
|
|
2895
|
+
* @license FlipbookEngine v0.6.5
|
|
2819
2896
|
* Copyright (c) 2026 Murat Dogan
|
|
2820
2897
|
*
|
|
2821
2898
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
2822
2899
|
*/
|
|
2823
|
-
const
|
|
2824
|
-
function
|
|
2825
|
-
const e =
|
|
2826
|
-
return { currentPage: e, totalPages: t, isSingleMode:
|
|
2827
|
-
t.value =
|
|
2900
|
+
const te = () => ({ isActive: !1, translateX: 0, translateY: 0, isDragging: !1, scale: 1 });
|
|
2901
|
+
function xe() {
|
|
2902
|
+
const e = D(0), t = D(0), i = D(!1), o = D(!1), r = D(!1), h = D(!0), u = D("landscape"), c = D("read"), b = D("auto"), P = D(!0), k = D(!1), I = D("#7367f0"), S = D(!1), T = D(!1), A = D(!1), L = D(3e3), U = D(!0), N = D("en"), H = D({}), m = D(te()), s = D([]), n = D([]), a = w(() => !i.value && u.value === "landscape"), l = w(() => a.value && e.value === 0), d = w(() => a.value && e.value >= t.value - 1);
|
|
2903
|
+
return { currentPage: e, totalPages: t, isSingleMode: i, showThumbs: o, showToc: r, showArrows: h, orientation: u, flipState: c, themeMode: b, allowDownload: P, hasDownloadUrl: k, primaryColor: I, whiteLabel: S, isZoomed: T, isAutoPlaying: A, autoPlayInterval: L, soundEnabled: U, locale: N, messages: H, zoomState: m, pages: s, toc: n, isDoublePageLayout: a, isFrontCover: l, isBackCover: d, init: (f, E, R, O) => {
|
|
2904
|
+
t.value = E, s.value = R, k.value = O, f.theme !== void 0 && (b.value = f.theme), f.primaryColor !== void 0 && (I.value = f.primaryColor), f.showThumbs !== void 0 && (o.value = f.showThumbs), f.showToc !== void 0 && (r.value = f.showToc), n.value = Pe(f.toc ?? [], E), f.showArrows !== void 0 && (h.value = f.showArrows), f.allowDownload !== void 0 && (P.value = f.allowDownload), f.whiteLabel !== void 0 && (S.value = f.whiteLabel), f.soundEnabled !== void 0 && (U.value = f.soundEnabled), f.locale !== void 0 && (N.value = f.locale), f.messages !== void 0 && (H.value = f.messages), f.isSingleMode !== void 0 && (i.value = f.isSingleMode), f.singleMode !== void 0 && (i.value = f.singleMode), f.autoPlay !== void 0 && (A.value = f.autoPlay), f.autoPlayInterval !== void 0 && (L.value = f.autoPlayInterval), e.value = 0;
|
|
2828
2905
|
}, reset: () => {
|
|
2829
|
-
e.value = 0, t.value = 0,
|
|
2906
|
+
e.value = 0, t.value = 0, i.value = !1, o.value = !1, h.value = !0, u.value = "landscape", c.value = "read", b.value = "auto", P.value = !0, k.value = !1, I.value = "#7367f0", S.value = !1, T.value = !1, A.value = !1, L.value = 3e3, U.value = !0, N.value = "en", H.value = {}, m.value = te(), s.value = [], n.value = [];
|
|
2830
2907
|
} };
|
|
2831
2908
|
}
|
|
2832
|
-
const
|
|
2833
|
-
|
|
2834
|
-
|
|
2835
|
-
|
|
2836
|
-
|
|
2837
|
-
|
|
2838
|
-
|
|
2839
|
-
|
|
2840
|
-
|
|
2841
|
-
|
|
2842
|
-
|
|
2843
|
-
|
|
2844
|
-
|
|
2845
|
-
|
|
2846
|
-
|
|
2847
|
-
|
|
2848
|
-
|
|
2849
|
-
|
|
2850
|
-
|
|
2851
|
-
|
|
2852
|
-
|
|
2853
|
-
|
|
2854
|
-
|
|
2855
|
-
|
|
2856
|
-
|
|
2909
|
+
const C = xe();
|
|
2910
|
+
C.currentPage;
|
|
2911
|
+
C.totalPages;
|
|
2912
|
+
C.isSingleMode;
|
|
2913
|
+
C.showThumbs;
|
|
2914
|
+
C.showToc;
|
|
2915
|
+
C.showArrows;
|
|
2916
|
+
C.orientation;
|
|
2917
|
+
C.flipState;
|
|
2918
|
+
C.themeMode;
|
|
2919
|
+
C.allowDownload;
|
|
2920
|
+
C.hasDownloadUrl;
|
|
2921
|
+
C.primaryColor;
|
|
2922
|
+
C.whiteLabel;
|
|
2923
|
+
C.isZoomed;
|
|
2924
|
+
C.isAutoPlaying;
|
|
2925
|
+
C.autoPlayInterval;
|
|
2926
|
+
C.soundEnabled;
|
|
2927
|
+
C.locale;
|
|
2928
|
+
C.messages;
|
|
2929
|
+
C.zoomState;
|
|
2930
|
+
C.pages;
|
|
2931
|
+
C.toc;
|
|
2932
|
+
C.isDoublePageLayout;
|
|
2933
|
+
C.isFrontCover;
|
|
2934
|
+
C.isBackCover;
|
|
2935
|
+
function Pi(e) {
|
|
2857
2936
|
if (!e || typeof e != "object") return !1;
|
|
2858
2937
|
const t = e;
|
|
2859
2938
|
return typeof t.normal == "string" && typeof t.low == "string" && typeof t.thumb == "string";
|
|
2860
2939
|
}
|
|
2861
|
-
function
|
|
2940
|
+
function xi(e) {
|
|
2862
2941
|
return Array.isArray(e.pageNumbers) && e.pageNumbers.length > 0 ? e.pageNumbers : typeof e.pageNumber == "number" ? e.kind === "spread" ? [e.pageNumber, e.pageNumber + 1] : [e.pageNumber] : [];
|
|
2863
2942
|
}
|
|
2864
|
-
function
|
|
2943
|
+
function Si(e) {
|
|
2865
2944
|
return e === "rtl" ? ["right", "left"] : ["left", "right"];
|
|
2866
2945
|
}
|
|
2867
|
-
function
|
|
2946
|
+
function Ti(e) {
|
|
2868
2947
|
const t = [];
|
|
2869
|
-
let
|
|
2948
|
+
let i = 1;
|
|
2870
2949
|
return e.forEach((o, r) => {
|
|
2871
|
-
const h = o.kind ?? "single", u = o.id ?? `asset-${r}`,
|
|
2950
|
+
const h = o.kind ?? "single", u = o.id ?? `asset-${r}`, c = o.splitDirection ?? "ltr", b = xi(o);
|
|
2872
2951
|
if (h === "spread") {
|
|
2873
|
-
const
|
|
2874
|
-
|
|
2952
|
+
const k = b.length >= 2 ? b.slice(0, 2) : [i, i + 1], I = Si(c);
|
|
2953
|
+
k.forEach((S, T) => {
|
|
2875
2954
|
t.push({
|
|
2876
2955
|
index: t.length,
|
|
2877
2956
|
assetId: u,
|
|
2878
|
-
pageNumber:
|
|
2879
|
-
|
|
2957
|
+
pageNumber: S,
|
|
2958
|
+
sourcePageNumber: S,
|
|
2959
|
+
cropMode: I[T] ?? "full",
|
|
2880
2960
|
normal: o.normal,
|
|
2881
2961
|
low: o.low,
|
|
2882
2962
|
thumb: o.thumb
|
|
2883
2963
|
});
|
|
2884
|
-
}),
|
|
2964
|
+
}), i = k[k.length - 1] + 1;
|
|
2885
2965
|
return;
|
|
2886
2966
|
}
|
|
2887
|
-
const P =
|
|
2967
|
+
const P = b[0] ?? i;
|
|
2888
2968
|
t.push({
|
|
2889
2969
|
index: t.length,
|
|
2890
2970
|
assetId: u,
|
|
2891
2971
|
pageNumber: P,
|
|
2972
|
+
sourcePageNumber: P,
|
|
2892
2973
|
cropMode: "full",
|
|
2893
2974
|
normal: o.normal,
|
|
2894
2975
|
low: o.low,
|
|
2895
2976
|
thumb: o.thumb
|
|
2896
|
-
}),
|
|
2977
|
+
}), i = P + 1;
|
|
2897
2978
|
}), t;
|
|
2898
2979
|
}
|
|
2899
|
-
function
|
|
2900
|
-
e
|
|
2901
|
-
|
|
2902
|
-
|
|
2903
|
-
|
|
2904
|
-
|
|
2980
|
+
function ki(e) {
|
|
2981
|
+
return e ? 'url("' + e.replace(/["\\\r\n]/g, (i) => "\\" + i) + '")' : void 0;
|
|
2982
|
+
}
|
|
2983
|
+
function ee(e, t) {
|
|
2984
|
+
e.classList.add("bk-container"), e.classList.remove("bk-theme-light", "bk-theme-dark"), e.classList.add("bk-theme-" + (t.theme ?? "auto")), t.primaryColor && e.style.setProperty("--flipbook-accent", t.primaryColor);
|
|
2985
|
+
const i = t.background ?? {}, o = t.backgroundColor || t.backgroundImage ? { color: t.backgroundColor, image: t.backgroundImage } : void 0, r = (u, c) => {
|
|
2986
|
+
const b = {
|
|
2987
|
+
["--flipbook-bg-" + u + "-color"]: c == null ? void 0 : c.color,
|
|
2988
|
+
["--flipbook-bg-" + u + "-image"]: ki(c == null ? void 0 : c.image),
|
|
2989
|
+
["--flipbook-bg-" + u + "-size"]: c == null ? void 0 : c.size,
|
|
2990
|
+
["--flipbook-bg-" + u + "-position"]: c == null ? void 0 : c.position,
|
|
2991
|
+
["--flipbook-bg-" + u + "-repeat"]: c == null ? void 0 : c.repeat
|
|
2992
|
+
};
|
|
2993
|
+
Object.entries(b).forEach(([P, k]) => {
|
|
2994
|
+
k ? e.style.setProperty(P, k) : e.style.removeProperty(P);
|
|
2995
|
+
});
|
|
2996
|
+
};
|
|
2997
|
+
r("light", i.light ?? o), r("dark", i.dark);
|
|
2998
|
+
const h = t.cssVariables ?? {};
|
|
2999
|
+
Object.entries(h).forEach(([u, c]) => {
|
|
3000
|
+
const b = u.startsWith("--") ? u : "--" + u;
|
|
3001
|
+
e.style.setProperty(b, c);
|
|
2905
3002
|
});
|
|
2906
3003
|
}
|
|
2907
|
-
class
|
|
3004
|
+
class Ci {
|
|
2908
3005
|
constructor(t = 32) {
|
|
2909
|
-
|
|
2910
|
-
|
|
2911
|
-
|
|
3006
|
+
v(this, "entries", /* @__PURE__ */ new Map());
|
|
3007
|
+
v(this, "hits", 0);
|
|
3008
|
+
v(this, "misses", 0);
|
|
2912
3009
|
if (this.maxEntries = t, !Number.isInteger(t) || t < 0)
|
|
2913
3010
|
throw new RangeError("PDF render cache size must be a non-negative integer.");
|
|
2914
3011
|
}
|
|
2915
3012
|
get(t) {
|
|
2916
|
-
const
|
|
2917
|
-
if (
|
|
3013
|
+
const i = this.entries.get(t);
|
|
3014
|
+
if (i === void 0) {
|
|
2918
3015
|
this.misses++;
|
|
2919
3016
|
return;
|
|
2920
3017
|
}
|
|
2921
|
-
return this.hits++, this.entries.delete(t), this.entries.set(t,
|
|
3018
|
+
return this.hits++, this.entries.delete(t), this.entries.set(t, i), i;
|
|
2922
3019
|
}
|
|
2923
|
-
set(t,
|
|
2924
|
-
if (!(this.maxEntries === 0 || !
|
|
2925
|
-
for (this.entries.delete(t), this.entries.set(t,
|
|
3020
|
+
set(t, i) {
|
|
3021
|
+
if (!(this.maxEntries === 0 || !i))
|
|
3022
|
+
for (this.entries.delete(t), this.entries.set(t, i); this.entries.size > this.maxEntries; ) {
|
|
2926
3023
|
const o = this.entries.keys().next().value;
|
|
2927
3024
|
if (o === void 0) break;
|
|
2928
3025
|
this.entries.delete(o);
|
|
@@ -2938,101 +3035,116 @@ class yi {
|
|
|
2938
3035
|
return { size: this.size, maxEntries: this.maxEntries, hits: this.hits, misses: this.misses };
|
|
2939
3036
|
}
|
|
2940
3037
|
}
|
|
2941
|
-
|
|
3038
|
+
const kt = 1190.55, Ct = 841.89;
|
|
3039
|
+
function Ai(e, t) {
|
|
3040
|
+
const i = Math.max(e, t), o = Math.min(e, t), r = i / o, h = Math.abs(i - kt) / kt <= 0.08 && Math.abs(o - Ct) / Ct <= 0.08;
|
|
3041
|
+
return e >= t && h && Math.abs(r - kt / Ct) <= 0.04;
|
|
3042
|
+
}
|
|
3043
|
+
class Ei {
|
|
2942
3044
|
constructor(t = {}) {
|
|
2943
|
-
|
|
2944
|
-
|
|
2945
|
-
|
|
2946
|
-
|
|
2947
|
-
const
|
|
3045
|
+
v(this, "pdfDoc", null);
|
|
3046
|
+
v(this, "loadingTask", null);
|
|
3047
|
+
v(this, "options");
|
|
3048
|
+
v(this, "cache");
|
|
3049
|
+
const i = Number.isFinite(t.cacheSize) ? Math.max(0, Math.floor(t.cacheSize)) : 32;
|
|
2948
3050
|
this.options = {
|
|
2949
3051
|
scale: t.scale || 1.5,
|
|
2950
3052
|
quality: t.quality || 0.85,
|
|
2951
3053
|
format: t.format || "image/webp",
|
|
2952
3054
|
workerSrc: t.workerSrc || "",
|
|
2953
3055
|
concurrency: Math.max(1, Math.floor(t.concurrency || 3)),
|
|
2954
|
-
cacheSize:
|
|
2955
|
-
}, this.cache = new
|
|
3056
|
+
cacheSize: i
|
|
3057
|
+
}, this.cache = new Ci(this.options.cacheSize), this.options.workerSrc && (Gt.GlobalWorkerOptions.workerSrc = this.options.workerSrc);
|
|
2956
3058
|
}
|
|
2957
3059
|
/** Loads a PDF document and cancels PDF.js loading when the signal aborts. */
|
|
2958
|
-
async loadDocument(t,
|
|
2959
|
-
this.throwIfAborted(
|
|
2960
|
-
const o =
|
|
3060
|
+
async loadDocument(t, i) {
|
|
3061
|
+
this.throwIfAborted(i), this.cache.clear();
|
|
3062
|
+
const o = Gt.getDocument(t);
|
|
2961
3063
|
this.loadingTask = o;
|
|
2962
3064
|
const r = () => {
|
|
2963
3065
|
var h;
|
|
2964
3066
|
return (h = o.destroy) == null ? void 0 : h.call(o);
|
|
2965
3067
|
};
|
|
2966
|
-
|
|
3068
|
+
i == null || i.addEventListener("abort", r, { once: !0 });
|
|
2967
3069
|
try {
|
|
2968
|
-
return this.pdfDoc = await o.promise, this.throwIfAborted(
|
|
3070
|
+
return this.pdfDoc = await o.promise, this.throwIfAborted(i), this.pdfDoc.numPages;
|
|
2969
3071
|
} catch (h) {
|
|
2970
|
-
throw
|
|
3072
|
+
throw i != null && i.aborted ? this.createAbortError() : h;
|
|
2971
3073
|
} finally {
|
|
2972
|
-
|
|
3074
|
+
i == null || i.removeEventListener("abort", r), this.loadingTask === o && (this.loadingTask = null);
|
|
2973
3075
|
}
|
|
2974
3076
|
}
|
|
2975
3077
|
/** Renders a specific page to a Data URL. The page index is 1-based. */
|
|
2976
|
-
async renderPageToDataUrl(t,
|
|
3078
|
+
async renderPageToDataUrl(t, i) {
|
|
2977
3079
|
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
2978
|
-
this.throwIfAborted(
|
|
3080
|
+
this.throwIfAborted(i);
|
|
2979
3081
|
const o = this.cache.get(t);
|
|
2980
3082
|
if (o !== void 0) return o;
|
|
2981
3083
|
try {
|
|
2982
3084
|
const r = await this.pdfDoc.getPage(t);
|
|
2983
|
-
this.throwIfAborted(
|
|
3085
|
+
this.throwIfAborted(i);
|
|
2984
3086
|
const h = r.getViewport({ scale: this.options.scale }), u = document.createElement("canvas");
|
|
2985
3087
|
u.width = h.width, u.height = h.height;
|
|
2986
|
-
const
|
|
2987
|
-
if (
|
|
2988
|
-
const
|
|
2989
|
-
var
|
|
2990
|
-
return (
|
|
3088
|
+
const c = u.getContext("2d");
|
|
3089
|
+
if (c) {
|
|
3090
|
+
const b = r.render({ canvasContext: c, viewport: h }), P = () => {
|
|
3091
|
+
var I;
|
|
3092
|
+
return (I = b.cancel) == null ? void 0 : I.call(b);
|
|
2991
3093
|
};
|
|
2992
|
-
|
|
3094
|
+
i == null || i.addEventListener("abort", P, { once: !0 });
|
|
2993
3095
|
try {
|
|
2994
|
-
await
|
|
3096
|
+
await b.promise, this.throwIfAborted(i);
|
|
2995
3097
|
} finally {
|
|
2996
|
-
|
|
3098
|
+
i == null || i.removeEventListener("abort", P);
|
|
2997
3099
|
}
|
|
2998
|
-
const
|
|
2999
|
-
return this.cache.set(t,
|
|
3100
|
+
const k = u.toDataURL(this.options.format, this.options.quality);
|
|
3101
|
+
return this.cache.set(t, k), k;
|
|
3000
3102
|
}
|
|
3001
3103
|
throw new Error("Unable to create a PDF canvas rendering context.");
|
|
3002
3104
|
} catch (r) {
|
|
3003
|
-
throw
|
|
3105
|
+
throw i != null && i.aborted ? this.createAbortError() : r;
|
|
3106
|
+
}
|
|
3107
|
+
}
|
|
3108
|
+
/** Returns source page dimensions and whether the page should be split. */
|
|
3109
|
+
async getPageLayouts(t = "auto") {
|
|
3110
|
+
if (!this.pdfDoc) return [];
|
|
3111
|
+
const i = [];
|
|
3112
|
+
for (let o = 1; o <= this.pdfDoc.numPages; o++) {
|
|
3113
|
+
const h = (await this.pdfDoc.getPage(o)).getViewport({ scale: 1 }), u = t === "split" ? h.width >= h.height : t === "auto" && Ai(h.width, h.height);
|
|
3114
|
+
i.push({ width: h.width, height: h.height, split: u });
|
|
3004
3115
|
}
|
|
3116
|
+
return i;
|
|
3005
3117
|
}
|
|
3006
|
-
/** Calculates the best viewport dimensions based on the first page. */
|
|
3007
|
-
async calculateViewportDimensions(t = 420) {
|
|
3118
|
+
/** Calculates the best viewport dimensions based on the first logical page. */
|
|
3119
|
+
async calculateViewportDimensions(t = 420, i) {
|
|
3008
3120
|
if (!this.pdfDoc) throw new Error("PDF document is not loaded.");
|
|
3009
|
-
const o =
|
|
3010
|
-
return
|
|
3121
|
+
const o = await this.pdfDoc.getPage(1), r = i ? { width: i.split ? i.width / 2 : i.width, height: i.height } : o.getViewport({ scale: 1 }), h = r.width / r.height;
|
|
3122
|
+
return h >= 1 ? { width: Math.round(t * h), height: t } : { width: t, height: Math.round(t / h) };
|
|
3011
3123
|
}
|
|
3012
3124
|
/** Renders pages concurrently with a bounded worker pool and preserves page order. */
|
|
3013
|
-
async renderAllPages(t,
|
|
3125
|
+
async renderAllPages(t, i) {
|
|
3014
3126
|
if (!this.pdfDoc) return [];
|
|
3015
3127
|
this.throwIfAborted(t);
|
|
3016
3128
|
const o = this.pdfDoc.numPages, r = new Array(o);
|
|
3017
3129
|
let h = 1, u = 0;
|
|
3018
|
-
const
|
|
3130
|
+
const c = async () => {
|
|
3019
3131
|
for (; ; ) {
|
|
3020
3132
|
this.throwIfAborted(t);
|
|
3021
3133
|
const P = h++;
|
|
3022
3134
|
if (P > o) return;
|
|
3023
|
-
const
|
|
3135
|
+
const k = await this.renderPageToDataUrl(P, t);
|
|
3024
3136
|
r[P - 1] = {
|
|
3025
3137
|
index: P - 1,
|
|
3026
3138
|
assetId: `pdf-page-${P}`,
|
|
3027
3139
|
pageNumber: P,
|
|
3028
3140
|
cropMode: "full",
|
|
3029
|
-
normal:
|
|
3030
|
-
low:
|
|
3031
|
-
thumb:
|
|
3032
|
-
}, u++,
|
|
3141
|
+
normal: k,
|
|
3142
|
+
low: k,
|
|
3143
|
+
thumb: k
|
|
3144
|
+
}, u++, i == null || i({ completed: u, total: o });
|
|
3033
3145
|
}
|
|
3034
|
-
},
|
|
3035
|
-
return await Promise.all(Array.from({ length:
|
|
3146
|
+
}, b = Math.min(this.options.concurrency, o);
|
|
3147
|
+
return await Promise.all(Array.from({ length: b }, () => c())), this.throwIfAborted(t), r;
|
|
3036
3148
|
}
|
|
3037
3149
|
getCacheStats() {
|
|
3038
3150
|
return this.cache.getStats();
|
|
@@ -3045,12 +3157,12 @@ class bi {
|
|
|
3045
3157
|
return t.name = "AbortError", t;
|
|
3046
3158
|
}
|
|
3047
3159
|
destroy() {
|
|
3048
|
-
var t,
|
|
3049
|
-
(
|
|
3160
|
+
var t, i, o, r;
|
|
3161
|
+
(i = (t = this.loadingTask) == null ? void 0 : t.destroy) == null || i.call(t), this.loadingTask = null, this.pdfDoc && ((r = (o = this.pdfDoc).destroy) == null || r.call(o), this.pdfDoc = null), this.cache.clear();
|
|
3050
3162
|
}
|
|
3051
3163
|
}
|
|
3052
3164
|
/**
|
|
3053
|
-
* @license FlipbookEngine v0.5
|
|
3165
|
+
* @license FlipbookEngine v0.6.5
|
|
3054
3166
|
* Copyright (c) 2026 Murat Dogan
|
|
3055
3167
|
*
|
|
3056
3168
|
* This source code is dual-licensed under the AGPLv3 and a Commercial License.
|
|
@@ -3064,30 +3176,32 @@ class bi {
|
|
|
3064
3176
|
* https://flipbookengine.com/pricing
|
|
3065
3177
|
*/
|
|
3066
3178
|
const mt = class mt {
|
|
3067
|
-
constructor(t,
|
|
3068
|
-
|
|
3069
|
-
|
|
3070
|
-
|
|
3179
|
+
constructor(t, i = {}) {
|
|
3180
|
+
v(this, "container", null);
|
|
3181
|
+
v(this, "options");
|
|
3182
|
+
v(this, "store", xe());
|
|
3071
3183
|
// Core Managers
|
|
3072
|
-
|
|
3073
|
-
|
|
3074
|
-
|
|
3075
|
-
|
|
3076
|
-
|
|
3077
|
-
|
|
3078
|
-
|
|
3079
|
-
|
|
3080
|
-
|
|
3081
|
-
|
|
3082
|
-
|
|
3083
|
-
|
|
3084
|
-
|
|
3085
|
-
|
|
3086
|
-
|
|
3087
|
-
|
|
3184
|
+
v(this, "pageFlipAdapter", null);
|
|
3185
|
+
v(this, "layoutManager", null);
|
|
3186
|
+
v(this, "interactionManager", null);
|
|
3187
|
+
v(this, "pdfRenderer", null);
|
|
3188
|
+
v(this, "listeners", {});
|
|
3189
|
+
v(this, "initializationTimer", null);
|
|
3190
|
+
v(this, "initGeneration", 0);
|
|
3191
|
+
v(this, "initAbortController", null);
|
|
3192
|
+
v(this, "eventsReady", !1);
|
|
3193
|
+
v(this, "lastEventState", { currentPage: 0, zoom: 1, zoomActive: !1, showThumbs: !1, showToc: !1, isSingle: !1, orientation: "" });
|
|
3194
|
+
v(this, "eventSyncStop", null);
|
|
3195
|
+
v(this, "qualityObserver", null);
|
|
3196
|
+
v(this, "pdfLazyStop", null);
|
|
3197
|
+
v(this, "hasActiveSession", !1);
|
|
3198
|
+
v(this, "pdfPageRequests", /* @__PURE__ */ new Map());
|
|
3199
|
+
v(this, "pdfRenderedPages", /* @__PURE__ */ new Set());
|
|
3200
|
+
v(this, "pdfRenderedSources", /* @__PURE__ */ new Map());
|
|
3201
|
+
v(this, "pdfSourcePageCount", 0);
|
|
3088
3202
|
this.selector = t, this.options = {
|
|
3089
3203
|
allowDownload: !0,
|
|
3090
|
-
showThumbs: !
|
|
3204
|
+
showThumbs: !1,
|
|
3091
3205
|
primaryColor: "#7367f0",
|
|
3092
3206
|
theme: "auto",
|
|
3093
3207
|
soundUrl: "https://flipbookengine.com/Content/page-flip.mp3",
|
|
@@ -3097,32 +3211,33 @@ const mt = class mt {
|
|
|
3097
3211
|
pdfRenderFormat: "image/webp",
|
|
3098
3212
|
pdfRenderConcurrency: 3,
|
|
3099
3213
|
pdfRenderCacheSize: 32,
|
|
3100
|
-
|
|
3214
|
+
pdfPageMode: "auto",
|
|
3215
|
+
...i
|
|
3101
3216
|
}, this.setupEventSync();
|
|
3102
3217
|
}
|
|
3103
|
-
async init(t,
|
|
3218
|
+
async init(t, i) {
|
|
3104
3219
|
if (typeof this.selector == "string" ? this.container = document.querySelector(this.selector) : this.container = this.selector, !this.container) return;
|
|
3105
3220
|
this.eventsReady = !1, this.destroy(!0);
|
|
3106
3221
|
const o = this.initGeneration, r = new AbortController();
|
|
3107
3222
|
this.initAbortController = r;
|
|
3108
3223
|
let h = [], u = { ...mt.DEFAULT_PAGE_VIEWPORT };
|
|
3109
|
-
if (
|
|
3224
|
+
if (i && i.length > 0) {
|
|
3110
3225
|
if (r.signal.aborted) return;
|
|
3111
|
-
const
|
|
3112
|
-
h =
|
|
3113
|
-
const
|
|
3114
|
-
if (
|
|
3115
|
-
const
|
|
3116
|
-
if (
|
|
3117
|
-
const
|
|
3118
|
-
u =
|
|
3226
|
+
const T = i.filter(Pi);
|
|
3227
|
+
h = Ti(T);
|
|
3228
|
+
const A = h[0];
|
|
3229
|
+
if (A) {
|
|
3230
|
+
const L = await this.loadImageSize(A.low || A.normal);
|
|
3231
|
+
if (L) {
|
|
3232
|
+
const N = (A.cropMode !== "full" ? L.width / 2 : L.width) / L.height, H = 420;
|
|
3233
|
+
u = N >= 1 ? { width: Math.round(H * N), height: H } : { width: H, height: Math.round(H / N) };
|
|
3119
3234
|
}
|
|
3120
3235
|
}
|
|
3121
3236
|
} else if (t) {
|
|
3122
3237
|
if (r.signal.aborted) return;
|
|
3123
|
-
let
|
|
3238
|
+
let T = "load";
|
|
3124
3239
|
try {
|
|
3125
|
-
this.pdfRenderer = new
|
|
3240
|
+
this.pdfRenderer = new Ei({
|
|
3126
3241
|
scale: this.options.pdfRenderScale,
|
|
3127
3242
|
quality: this.options.pdfRenderQuality,
|
|
3128
3243
|
format: this.options.pdfRenderFormat,
|
|
@@ -3130,26 +3245,28 @@ const mt = class mt {
|
|
|
3130
3245
|
cacheSize: this.options.pdfRenderCacheSize,
|
|
3131
3246
|
workerSrc: this.options.pdfWorkerSrc
|
|
3132
3247
|
}), this.emit("progress", { phase: "loading", completed: 0, total: 0 });
|
|
3133
|
-
const
|
|
3134
|
-
|
|
3135
|
-
|
|
3136
|
-
|
|
3137
|
-
|
|
3138
|
-
|
|
3139
|
-
|
|
3248
|
+
const A = await this.pdfRenderer.loadDocument(t, r.signal);
|
|
3249
|
+
T = "render", this.emit("progress", { phase: "loading", completed: 1, total: A });
|
|
3250
|
+
const L = await this.pdfRenderer.getPageLayouts(this.options.pdfPageMode);
|
|
3251
|
+
u = L.length ? await this.pdfRenderer.calculateViewportDimensions(420, L[0]) : await this.pdfRenderer.calculateViewportDimensions(), h = L.length ? this.createPdfPlaceholders(L) : Array.from({ length: A }, (U, N) => this.createPdfPlaceholder(N + 1)), this.pdfSourcePageCount = A;
|
|
3252
|
+
} catch (A) {
|
|
3253
|
+
r.signal.aborted || (console.error("PDF load failed:", A), this.emit("error", {
|
|
3254
|
+
code: T === "load" ? "PDF_LOAD_FAILED" : "PDF_RENDER_FAILED",
|
|
3255
|
+
message: A instanceof Error ? A.message : "Unable to load PDF.",
|
|
3256
|
+
cause: A
|
|
3140
3257
|
}));
|
|
3141
3258
|
return;
|
|
3142
3259
|
}
|
|
3143
3260
|
}
|
|
3144
3261
|
if (r.signal.aborted || o !== this.initGeneration || !h.length) return;
|
|
3145
|
-
this.store.init(this.options, h.length, h, !!t),
|
|
3146
|
-
let
|
|
3147
|
-
const
|
|
3148
|
-
pageFlipAdapterRef:
|
|
3149
|
-
interactionManagerRef:
|
|
3150
|
-
bookWrapperRef: (
|
|
3151
|
-
bookSizerRef: (
|
|
3152
|
-
bookContainerRef: (
|
|
3262
|
+
this.store.init(this.options, h.length, h, !!t), ee(this.container, this.options), this.container.innerHTML = "";
|
|
3263
|
+
let c, b, P;
|
|
3264
|
+
const k = { current: null }, I = { current: null }, S = gi({
|
|
3265
|
+
pageFlipAdapterRef: k,
|
|
3266
|
+
interactionManagerRef: I,
|
|
3267
|
+
bookWrapperRef: (T) => c = T,
|
|
3268
|
+
bookSizerRef: (T) => b = T,
|
|
3269
|
+
bookContainerRef: (T) => P = T,
|
|
3153
3270
|
className: this.options.className,
|
|
3154
3271
|
store: this.store,
|
|
3155
3272
|
onToggleFullscreen: () => this.toggleFullscreen(),
|
|
@@ -3157,91 +3274,108 @@ const mt = class mt {
|
|
|
3157
3274
|
t && (this.options.onDownload ? this.options.onDownload(t) : window.open(t, "_blank"));
|
|
3158
3275
|
}
|
|
3159
3276
|
});
|
|
3160
|
-
this.container.appendChild(
|
|
3277
|
+
this.container.appendChild(S), this.setupQualityLoading(), this.layoutManager = new yi(u, this.store), this.layoutManager.onResizeCallback = () => {
|
|
3161
3278
|
this.pageFlipAdapter && this.pageFlipAdapter.update();
|
|
3162
|
-
}, this.layoutManager.init(
|
|
3163
|
-
const
|
|
3164
|
-
r.signal.removeEventListener("abort",
|
|
3279
|
+
}, this.layoutManager.init(c, b), this.pageFlipAdapter = new vi(P, this.options, this.store), k.current = this.pageFlipAdapter, await new Promise((T) => {
|
|
3280
|
+
const A = () => {
|
|
3281
|
+
r.signal.removeEventListener("abort", A), T();
|
|
3165
3282
|
};
|
|
3166
|
-
r.signal.addEventListener("abort",
|
|
3167
|
-
if (this.initializationTimer = null, r.signal.removeEventListener("abort",
|
|
3168
|
-
|
|
3283
|
+
r.signal.addEventListener("abort", A, { once: !0 }), this.initializationTimer = setTimeout(async () => {
|
|
3284
|
+
if (this.initializationTimer = null, r.signal.removeEventListener("abort", A), r.signal.aborted || o !== this.initGeneration || !this.pageFlipAdapter) {
|
|
3285
|
+
T();
|
|
3169
3286
|
return;
|
|
3170
3287
|
}
|
|
3171
|
-
if (this.pageFlipAdapter.init(u.width, u.height), this.interactionManager = new
|
|
3288
|
+
if (this.pageFlipAdapter.init(u.width, u.height), this.interactionManager = new bi(c, this.pageFlipAdapter, this.store), this.interactionManager.init(), I.current = this.interactionManager, this.setupPdfLazyLoading(), this.pdfRenderer && t)
|
|
3172
3289
|
try {
|
|
3173
3290
|
await this.renderPdfPage(1, r.signal);
|
|
3174
3291
|
} catch {
|
|
3175
|
-
|
|
3292
|
+
T();
|
|
3176
3293
|
return;
|
|
3177
3294
|
}
|
|
3178
3295
|
if (r.signal.aborted || o !== this.initGeneration) {
|
|
3179
|
-
|
|
3296
|
+
T();
|
|
3180
3297
|
return;
|
|
3181
3298
|
}
|
|
3182
|
-
this.eventsReady = !0, this.captureEventState(), this.hasActiveSession = !0, this.emit("init", { totalPages: h.length }),
|
|
3299
|
+
this.eventsReady = !0, this.captureEventState(), this.hasActiveSession = !0, this.emit("init", { totalPages: h.length }), T();
|
|
3183
3300
|
}, 10);
|
|
3184
3301
|
}), this.initAbortController === r && (this.initAbortController = null);
|
|
3185
3302
|
}
|
|
3186
3303
|
createPdfPlaceholder(t) {
|
|
3187
|
-
const
|
|
3188
|
-
return {
|
|
3189
|
-
|
|
3190
|
-
|
|
3191
|
-
|
|
3192
|
-
|
|
3193
|
-
|
|
3194
|
-
|
|
3195
|
-
|
|
3196
|
-
|
|
3304
|
+
const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=";
|
|
3305
|
+
return { index: t - 1, assetId: "pdf-page-" + t + "-full", pageNumber: t, sourcePageNumber: t, cropMode: "full", normal: i, low: i, thumb: i };
|
|
3306
|
+
}
|
|
3307
|
+
createPdfPlaceholders(t) {
|
|
3308
|
+
const i = "data:image/gif;base64,R0lGODlhAQABAAD/ACwAAAAAAQABAAACADs=", o = [];
|
|
3309
|
+
return t.forEach((r, h) => {
|
|
3310
|
+
const u = h + 1;
|
|
3311
|
+
(r.split ? ["left", "right"] : ["full"]).forEach((b) => {
|
|
3312
|
+
const P = o.length + 1;
|
|
3313
|
+
o.push({
|
|
3314
|
+
index: o.length,
|
|
3315
|
+
assetId: `pdf-page-${u}-${b}`,
|
|
3316
|
+
pageNumber: P,
|
|
3317
|
+
sourcePageNumber: u,
|
|
3318
|
+
cropMode: b,
|
|
3319
|
+
normal: i,
|
|
3320
|
+
low: i,
|
|
3321
|
+
thumb: i
|
|
3322
|
+
});
|
|
3323
|
+
});
|
|
3324
|
+
}), o;
|
|
3197
3325
|
}
|
|
3198
|
-
renderPdfPage(t,
|
|
3326
|
+
renderPdfPage(t, i) {
|
|
3199
3327
|
const o = this.pdfRenderer, r = this.initGeneration;
|
|
3200
3328
|
if (!o) return Promise.resolve("");
|
|
3201
3329
|
const h = this.pdfPageRequests.get(t);
|
|
3202
3330
|
if (h) return h;
|
|
3203
|
-
if (this.pdfRenderedPages.has(t))
|
|
3204
|
-
|
|
3205
|
-
|
|
3206
|
-
|
|
3207
|
-
|
|
3208
|
-
|
|
3209
|
-
|
|
3210
|
-
|
|
3331
|
+
if (this.pdfRenderedPages.has(t)) {
|
|
3332
|
+
const c = this.pdfRenderedSources.get(t);
|
|
3333
|
+
return c && this.hydratePdfImages(t, c), Promise.resolve(c || "");
|
|
3334
|
+
}
|
|
3335
|
+
const u = o.renderPageToDataUrl(t, i).then((c) => {
|
|
3336
|
+
if (r !== this.initGeneration || i != null && i.aborted) throw this.createAbortError();
|
|
3337
|
+
if (!c) throw new Error("PDF page " + t + " produced no image.");
|
|
3338
|
+
return this.pdfRenderedPages.add(t), this.pdfRenderedSources.set(t, c), this.hydratePdfImages(t, c), this.emit("progress", {
|
|
3211
3339
|
phase: "rendering",
|
|
3212
3340
|
completed: this.pdfRenderedPages.size,
|
|
3213
|
-
total: this.store.totalPages.value
|
|
3214
|
-
}),
|
|
3215
|
-
}).catch((
|
|
3216
|
-
throw r !== this.initGeneration && (
|
|
3341
|
+
total: this.pdfSourcePageCount || this.store.totalPages.value
|
|
3342
|
+
}), c;
|
|
3343
|
+
}).catch((c) => {
|
|
3344
|
+
throw r !== this.initGeneration && (c == null ? void 0 : c.name) !== "AbortError" ? this.createAbortError() : ((c == null ? void 0 : c.name) === "AbortError" || this.emit("error", {
|
|
3217
3345
|
code: "PDF_RENDER_FAILED",
|
|
3218
|
-
message:
|
|
3219
|
-
cause:
|
|
3220
|
-
}),
|
|
3346
|
+
message: c instanceof Error ? c.message : "Unable to render PDF page.",
|
|
3347
|
+
cause: c
|
|
3348
|
+
}), c);
|
|
3221
3349
|
}).finally(() => {
|
|
3222
3350
|
this.pdfPageRequests.get(t) === u && this.pdfPageRequests.delete(t);
|
|
3223
3351
|
});
|
|
3224
3352
|
return this.pdfPageRequests.set(t, u), u;
|
|
3225
3353
|
}
|
|
3354
|
+
hydratePdfImages(t, i) {
|
|
3355
|
+
var o;
|
|
3356
|
+
(o = this.container) == null || o.querySelectorAll("img").forEach((r) => {
|
|
3357
|
+
r.dataset.pdfPage === String(t) && (r.src = i, delete r.dataset.pdfPage);
|
|
3358
|
+
});
|
|
3359
|
+
}
|
|
3226
3360
|
setupPdfLazyLoading() {
|
|
3227
3361
|
var t;
|
|
3228
|
-
(t = this.pdfLazyStop) == null || t.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop =
|
|
3229
|
-
const
|
|
3230
|
-
[
|
|
3231
|
-
this.renderPdfPage(
|
|
3362
|
+
(t = this.pdfLazyStop) == null || t.call(this), this.pdfLazyStop = null, this.pdfRenderer && (this.pdfLazyStop = _(() => {
|
|
3363
|
+
const i = this.store.pages.value[this.store.currentPage.value], o = this.store.pages.value[this.store.currentPage.value + 1];
|
|
3364
|
+
(/* @__PURE__ */ new Set([(i == null ? void 0 : i.sourcePageNumber) ?? (i == null ? void 0 : i.pageNumber), (o == null ? void 0 : o.sourcePageNumber) ?? (o == null ? void 0 : o.pageNumber)])).forEach((h) => {
|
|
3365
|
+
h && this.renderPdfPage(h).catch(() => {
|
|
3232
3366
|
});
|
|
3233
3367
|
});
|
|
3234
3368
|
}));
|
|
3235
3369
|
}
|
|
3236
3370
|
loadImageSize(t) {
|
|
3237
|
-
return new Promise((
|
|
3371
|
+
return new Promise((i) => {
|
|
3238
3372
|
const o = new Image();
|
|
3239
|
-
o.onload = () =>
|
|
3373
|
+
o.onload = () => i({ width: o.naturalWidth || o.width, height: o.naturalHeight || o.height }), o.onerror = () => i(null), o.src = t;
|
|
3240
3374
|
});
|
|
3241
3375
|
}
|
|
3242
3376
|
goToPage(t) {
|
|
3243
|
-
const
|
|
3244
|
-
this.store.currentPage.value = Math.max(0, Math.min(
|
|
3377
|
+
const i = Math.max(0, this.store.totalPages.value - 1);
|
|
3378
|
+
this.store.currentPage.value = Math.max(0, Math.min(i, Math.trunc(t)));
|
|
3245
3379
|
}
|
|
3246
3380
|
getTotalPages() {
|
|
3247
3381
|
return this.store.totalPages.value;
|
|
@@ -3253,7 +3387,7 @@ const mt = class mt {
|
|
|
3253
3387
|
return this.store.zoomState.value.scale;
|
|
3254
3388
|
}
|
|
3255
3389
|
setZoom(t) {
|
|
3256
|
-
const
|
|
3390
|
+
const i = Number.isFinite(t) ? t : 1, o = Math.max(0.5, Math.min(5, i));
|
|
3257
3391
|
this.store.zoomState.value = {
|
|
3258
3392
|
...this.store.zoomState.value,
|
|
3259
3393
|
scale: o,
|
|
@@ -3265,55 +3399,59 @@ const mt = class mt {
|
|
|
3265
3399
|
this.pageFlipAdapter && this.pageFlipAdapter.turnToNextPage();
|
|
3266
3400
|
}
|
|
3267
3401
|
toggleFullscreen() {
|
|
3268
|
-
var
|
|
3402
|
+
var i, o;
|
|
3269
3403
|
const t = this.container;
|
|
3270
|
-
t && (document.fullscreenElement ? (o = document.exitFullscreen) == null || o.call(document).catch((r) => console.warn("Exit fullscreen err:", r)) : (
|
|
3404
|
+
t && (document.fullscreenElement ? (o = document.exitFullscreen) == null || o.call(document).catch((r) => console.warn("Exit fullscreen err:", r)) : (i = t.requestFullscreen) == null || i.call(t).catch((r) => console.warn("Fullscreen err:", r)));
|
|
3271
3405
|
}
|
|
3272
|
-
setLocale(t,
|
|
3273
|
-
const o =
|
|
3406
|
+
setLocale(t, i) {
|
|
3407
|
+
const o = i ? { ...this.options.messages, [t]: i[t] ?? i } : this.options.messages;
|
|
3274
3408
|
this.options = { ...this.options, locale: t, messages: o }, this.store.locale.value = t, o && (this.store.messages.value = o);
|
|
3275
3409
|
}
|
|
3276
3410
|
prevPage() {
|
|
3277
3411
|
this.pageFlipAdapter && this.pageFlipAdapter.turnToPrevPage();
|
|
3278
3412
|
}
|
|
3279
3413
|
setSingleMode(t) {
|
|
3280
|
-
this.store.isSingleMode.value = t
|
|
3414
|
+
this.store.isSingleMode.value = t, t && this.pdfRenderer && setTimeout(() => {
|
|
3415
|
+
const i = this.store.pages.value[this.store.currentPage.value], o = (i == null ? void 0 : i.sourcePageNumber) ?? (i == null ? void 0 : i.pageNumber);
|
|
3416
|
+
o && this.renderPdfPage(o).catch(() => {
|
|
3417
|
+
});
|
|
3418
|
+
}, 0);
|
|
3281
3419
|
}
|
|
3282
3420
|
updateOptions(t) {
|
|
3283
|
-
this.options = { ...this.options, ...t }, t.theme !== void 0 && (this.store.themeMode.value = t.theme), t.primaryColor !== void 0 && (this.store.primaryColor.value = t.primaryColor), t.showThumbs !== void 0 && (this.store.showThumbs.value = t.showThumbs), t.showArrows !== void 0 && (this.store.showArrows.value = t.showArrows), t.allowDownload !== void 0 && (this.store.allowDownload.value = t.allowDownload), t.whiteLabel !== void 0 && (this.store.whiteLabel.value = t.whiteLabel), t.soundEnabled !== void 0 && (this.store.soundEnabled.value = t.soundEnabled), t.locale !== void 0 && (this.store.locale.value = t.locale), t.messages !== void 0 && (this.store.messages.value = t.messages), t.singleMode !== void 0 && (this.store.isSingleMode.value = t.singleMode), t.isSingleMode !== void 0 && (this.store.isSingleMode.value = t.isSingleMode), t.autoPlay !== void 0 && (this.store.isAutoPlaying.value = t.autoPlay), t.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = t.autoPlayInterval), this.container &&
|
|
3421
|
+
this.options = { ...this.options, ...t }, t.theme !== void 0 && (this.store.themeMode.value = t.theme), t.primaryColor !== void 0 && (this.store.primaryColor.value = t.primaryColor), t.showThumbs !== void 0 && (this.store.showThumbs.value = t.showThumbs), t.showToc !== void 0 && (this.store.showToc.value = t.showToc), t.toc !== void 0 && (this.store.toc.value = Pe(t.toc, this.store.totalPages.value)), t.showArrows !== void 0 && (this.store.showArrows.value = t.showArrows), t.allowDownload !== void 0 && (this.store.allowDownload.value = t.allowDownload), t.whiteLabel !== void 0 && (this.store.whiteLabel.value = t.whiteLabel), t.soundEnabled !== void 0 && (this.store.soundEnabled.value = t.soundEnabled), t.locale !== void 0 && (this.store.locale.value = t.locale), t.messages !== void 0 && (this.store.messages.value = t.messages), t.singleMode !== void 0 && (this.store.isSingleMode.value = t.singleMode), t.isSingleMode !== void 0 && (this.store.isSingleMode.value = t.isSingleMode), t.autoPlay !== void 0 && (this.store.isAutoPlaying.value = t.autoPlay), t.autoPlayInterval !== void 0 && (this.store.autoPlayInterval.value = t.autoPlayInterval), this.container && ee(this.container, this.options);
|
|
3284
3422
|
}
|
|
3285
|
-
async setPages(t,
|
|
3423
|
+
async setPages(t, i) {
|
|
3286
3424
|
if (!(t != null && t.length)) {
|
|
3287
|
-
|
|
3425
|
+
i && await this.init(i);
|
|
3288
3426
|
return;
|
|
3289
3427
|
}
|
|
3290
|
-
await this.init(
|
|
3428
|
+
await this.init(i || "", t);
|
|
3291
3429
|
}
|
|
3292
3430
|
setupQualityLoading() {
|
|
3293
3431
|
var r;
|
|
3294
3432
|
if (this.teardownQualityLoading(), !this.container) return;
|
|
3295
|
-
const t = Array.from(this.container.querySelectorAll("img[data-src], img[data-pdf-page]")),
|
|
3433
|
+
const t = Array.from(this.container.querySelectorAll("img[data-src], img[data-pdf-page]")), i = (h) => {
|
|
3296
3434
|
const u = Number(h.dataset.pdfPage);
|
|
3297
3435
|
if (Number.isInteger(u) && u > 0) {
|
|
3298
3436
|
this.renderPdfPage(u).catch(() => {
|
|
3299
3437
|
});
|
|
3300
3438
|
return;
|
|
3301
3439
|
}
|
|
3302
|
-
const
|
|
3303
|
-
|
|
3440
|
+
const c = h.dataset.src;
|
|
3441
|
+
c && (h.src = c, delete h.dataset.src);
|
|
3304
3442
|
}, o = (r = this.container.ownerDocument.defaultView) == null ? void 0 : r.IntersectionObserver;
|
|
3305
3443
|
if (!o) {
|
|
3306
3444
|
const h = /* @__PURE__ */ new Set();
|
|
3307
3445
|
t.forEach((u) => {
|
|
3308
|
-
const
|
|
3309
|
-
Number.isInteger(
|
|
3446
|
+
const c = Number(u.dataset.pdfPage);
|
|
3447
|
+
Number.isInteger(c) && c > 0 ? h.size < 2 && (h.add(c), i(u)) : i(u);
|
|
3310
3448
|
});
|
|
3311
3449
|
return;
|
|
3312
3450
|
}
|
|
3313
3451
|
this.qualityObserver = new o((h) => {
|
|
3314
3452
|
h.forEach((u) => {
|
|
3315
|
-
var
|
|
3316
|
-
u.isIntersecting && (
|
|
3453
|
+
var c;
|
|
3454
|
+
u.isIntersecting && (i(u.target), (c = this.qualityObserver) == null || c.unobserve(u.target));
|
|
3317
3455
|
});
|
|
3318
3456
|
}, { root: this.container, rootMargin: "240px" }), t.forEach((h) => {
|
|
3319
3457
|
var u;
|
|
@@ -3325,12 +3463,13 @@ const mt = class mt {
|
|
|
3325
3463
|
(t = this.qualityObserver) == null || t.disconnect(), this.qualityObserver = null;
|
|
3326
3464
|
}
|
|
3327
3465
|
setupEventSync() {
|
|
3328
|
-
this.eventSyncStop =
|
|
3466
|
+
this.eventSyncStop = _(() => {
|
|
3329
3467
|
const t = {
|
|
3330
3468
|
currentPage: this.store.currentPage.value,
|
|
3331
3469
|
zoom: this.store.zoomState.value.scale,
|
|
3332
3470
|
zoomActive: this.store.zoomState.value.isActive,
|
|
3333
3471
|
showThumbs: this.store.showThumbs.value,
|
|
3472
|
+
showToc: this.store.showToc.value,
|
|
3334
3473
|
isSingle: this.store.isSingleMode.value,
|
|
3335
3474
|
orientation: this.store.orientation.value
|
|
3336
3475
|
};
|
|
@@ -3343,7 +3482,7 @@ const mt = class mt {
|
|
|
3343
3482
|
pageNumber: t.currentPage + 1,
|
|
3344
3483
|
totalPages: this.store.totalPages.value,
|
|
3345
3484
|
isSingle: t.isSingle
|
|
3346
|
-
}), (t.zoom !== this.lastEventState.zoom || t.zoomActive !== this.lastEventState.zoomActive) && this.emit("zoomChange", { zoom: t.zoom, isActive: t.zoomActive }), t.showThumbs !== this.lastEventState.showThumbs && this.emit("thumbsToggle", { showThumbs: t.showThumbs }), t.isSingle !== this.lastEventState.isSingle && this.emit("singlePageModeChange", { isSingle: t.isSingle }), t.orientation !== this.lastEventState.orientation && this.emit("orientationChange", { orientation: t.orientation }), this.lastEventState = t;
|
|
3485
|
+
}), (t.zoom !== this.lastEventState.zoom || t.zoomActive !== this.lastEventState.zoomActive) && this.emit("zoomChange", { zoom: t.zoom, isActive: t.zoomActive }), t.showThumbs !== this.lastEventState.showThumbs && this.emit("thumbsToggle", { showThumbs: t.showThumbs }), t.showToc !== this.lastEventState.showToc && this.emit("tocToggle", { showToc: t.showToc }), t.isSingle !== this.lastEventState.isSingle && this.emit("singlePageModeChange", { isSingle: t.isSingle }), t.orientation !== this.lastEventState.orientation && this.emit("orientationChange", { orientation: t.orientation }), this.lastEventState = t;
|
|
3347
3486
|
});
|
|
3348
3487
|
}
|
|
3349
3488
|
captureEventState() {
|
|
@@ -3352,42 +3491,45 @@ const mt = class mt {
|
|
|
3352
3491
|
zoom: this.store.zoomState.value.scale,
|
|
3353
3492
|
zoomActive: this.store.zoomState.value.isActive,
|
|
3354
3493
|
showThumbs: this.store.showThumbs.value,
|
|
3494
|
+
showToc: this.store.showToc.value,
|
|
3355
3495
|
isSingle: this.store.isSingleMode.value,
|
|
3356
3496
|
orientation: this.store.orientation.value
|
|
3357
3497
|
};
|
|
3358
3498
|
}
|
|
3359
3499
|
destroy(t = !1) {
|
|
3360
3500
|
var o, r;
|
|
3361
|
-
const
|
|
3362
|
-
this.initGeneration++, (o = this.initAbortController) == null || o.abort(), this.initAbortController = null, this.initializationTimer && (clearTimeout(this.initializationTimer), this.initializationTimer = null), this.pageFlipAdapter && this.pageFlipAdapter.destroy(), this.layoutManager && this.layoutManager.destroy(), this.interactionManager && this.interactionManager.destroy(), this.teardownQualityLoading(), (r = this.pdfLazyStop) == null || r.call(this), this.pdfLazyStop = null, this.pdfPageRequests.clear(), this.pdfRenderedPages.clear(), this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, this.eventsReady = !1, this.hasActiveSession = !1, this.store.reset(), !t && this.container && (this.container.innerHTML = ""),
|
|
3501
|
+
const i = this.hasActiveSession || !!this.initAbortController || !!this.pageFlipAdapter || !!this.layoutManager || !!this.interactionManager || !!this.pdfRenderer;
|
|
3502
|
+
this.initGeneration++, (o = this.initAbortController) == null || o.abort(), this.initAbortController = null, this.initializationTimer && (clearTimeout(this.initializationTimer), this.initializationTimer = null), this.pageFlipAdapter && this.pageFlipAdapter.destroy(), this.layoutManager && this.layoutManager.destroy(), this.interactionManager && this.interactionManager.destroy(), this.teardownQualityLoading(), (r = this.pdfLazyStop) == null || r.call(this), this.pdfLazyStop = null, this.pdfPageRequests.clear(), this.pdfRenderedPages.clear(), this.pdfRenderedSources.clear(), this.pdfSourcePageCount = 0, this.pdfRenderer && this.pdfRenderer.destroy(), this.pageFlipAdapter = null, this.layoutManager = null, this.interactionManager = null, this.pdfRenderer = null, this.eventsReady = !1, this.hasActiveSession = !1, this.store.reset(), !t && this.container && (this.container.innerHTML = ""), i && this.emit("destroy", void 0);
|
|
3363
3503
|
}
|
|
3364
3504
|
createAbortError() {
|
|
3365
3505
|
const t = new Error("Flipbook initialization was aborted.");
|
|
3366
3506
|
return t.name = "AbortError", t;
|
|
3367
3507
|
}
|
|
3368
|
-
on(t,
|
|
3508
|
+
on(t, i) {
|
|
3369
3509
|
const o = this.listeners[t] ?? /* @__PURE__ */ new Set();
|
|
3370
|
-
return o.add(
|
|
3510
|
+
return o.add(i), this.listeners[t] = o, () => this.off(t, i);
|
|
3371
3511
|
}
|
|
3372
|
-
off(t,
|
|
3512
|
+
off(t, i) {
|
|
3373
3513
|
var o;
|
|
3374
|
-
(o = this.listeners[t]) == null || o.delete(
|
|
3514
|
+
(o = this.listeners[t]) == null || o.delete(i);
|
|
3375
3515
|
}
|
|
3376
|
-
emit(t,
|
|
3516
|
+
emit(t, i) {
|
|
3377
3517
|
var o;
|
|
3378
3518
|
(o = this.listeners[t]) == null || o.forEach((r) => {
|
|
3379
|
-
r(
|
|
3519
|
+
r(i);
|
|
3380
3520
|
});
|
|
3381
3521
|
}
|
|
3382
3522
|
};
|
|
3383
|
-
|
|
3384
|
-
let
|
|
3385
|
-
const
|
|
3386
|
-
|
|
3387
|
-
|
|
3523
|
+
v(mt, "DEFAULT_PAGE_VIEWPORT", { width: 420, height: 594 });
|
|
3524
|
+
let Lt = mt;
|
|
3525
|
+
const Se = globalThis, Te = Se.FlipbookEngine || {};
|
|
3526
|
+
Te.FlipbookEngine = Lt;
|
|
3527
|
+
Se.FlipbookEngine = Te;
|
|
3388
3528
|
export {
|
|
3389
|
-
|
|
3390
|
-
|
|
3391
|
-
|
|
3529
|
+
Lt as F,
|
|
3530
|
+
Pi as a,
|
|
3531
|
+
Pe as b,
|
|
3532
|
+
Ai as i,
|
|
3533
|
+
Ti as n
|
|
3392
3534
|
};
|
|
3393
|
-
//# sourceMappingURL=engine-
|
|
3535
|
+
//# sourceMappingURL=engine-DhQ2zxpm.js.map
|