@zinejs/core 0.8.2 → 0.9.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +27 -49
- package/dist/{bundled-Cp43MIt0.js → bundled-ESapkNsS.js} +34 -34
- package/dist/bundled-ESapkNsS.js.map +1 -0
- package/dist/controls/contextMenu.d.ts +16 -0
- package/dist/controls/controls.d.ts +10 -3
- package/dist/controls/icons.d.ts +2 -2
- package/dist/controls/menu.d.ts +68 -0
- package/dist/controls/search.d.ts +15 -2
- package/dist/controls/styles.d.ts +1 -1
- package/dist/controls/toolbar.d.ts +1 -1
- package/dist/controls/types.d.ts +6 -0
- package/dist/{controls-DgEXR2zi.js → controls-CcOu_19g.js} +340 -196
- package/dist/controls-CcOu_19g.js.map +1 -0
- package/dist/curls.js +1 -1
- package/dist/geometry/curls/cone.d.ts +4 -3
- package/dist/index.js +617 -436
- package/dist/index.js.map +1 -1
- package/dist/index.umd.js +26 -7
- package/dist/index.umd.js.map +1 -1
- package/dist/loading/loading.d.ts +1 -1
- package/dist/loading-DF88K9yJ.js +45 -0
- package/dist/loading-DF88K9yJ.js.map +1 -0
- package/dist/renderer/gl/texture.d.ts +13 -2
- package/dist/renderer/types.d.ts +6 -0
- package/dist/renderer/webglRenderer.d.ts +1 -0
- package/dist/{share-WXdscwp3.js → share-BrQa6aYm.js} +2 -2
- package/dist/{share-WXdscwp3.js.map → share-BrQa6aYm.js.map} +1 -1
- package/dist/source/types.d.ts +5 -0
- package/dist/styles-D_zOGk2q.js +40 -0
- package/dist/styles-D_zOGk2q.js.map +1 -0
- package/dist/{webglRenderer-nGRruZk2.js → webglRenderer-CmQ_mUrX.js} +113 -101
- package/dist/webglRenderer-CmQ_mUrX.js.map +1 -0
- package/dist/zine.d.ts +52 -1
- package/options.schema.json +49 -0
- package/package.json +2 -2
- package/dist/bundled-Cp43MIt0.js.map +0 -1
- package/dist/controls-DgEXR2zi.js.map +0 -1
- package/dist/loading-BBK6YbSW.js +0 -45
- package/dist/loading-BBK6YbSW.js.map +0 -1
- package/dist/styles-B8fFoYm_.js +0 -40
- package/dist/styles-B8fFoYm_.js.map +0 -1
- package/dist/webglRenderer-nGRruZk2.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -245,32 +245,32 @@ var _ = class {
|
|
|
245
245
|
};
|
|
246
246
|
}
|
|
247
247
|
}, v = "page", y = !1;
|
|
248
|
-
function
|
|
248
|
+
function ee() {
|
|
249
249
|
return y ? !1 : (y = !0, !0);
|
|
250
250
|
}
|
|
251
|
-
function
|
|
251
|
+
function b() {
|
|
252
252
|
y = !1;
|
|
253
253
|
}
|
|
254
|
-
function
|
|
254
|
+
function x(e) {
|
|
255
255
|
let t = new URLSearchParams(e.replace(/^#/, "")).get(v);
|
|
256
256
|
if (t === null) return null;
|
|
257
257
|
let n = Number(t);
|
|
258
258
|
return Number.isInteger(n) && n >= 1 ? n - 1 : null;
|
|
259
259
|
}
|
|
260
|
-
function
|
|
260
|
+
function S(e, t) {
|
|
261
261
|
let n = new URLSearchParams(e.replace(/^#/, ""));
|
|
262
262
|
return n.set(v, String(t + 1)), `#${n.toString()}`;
|
|
263
263
|
}
|
|
264
|
-
function
|
|
264
|
+
function C(e, t) {
|
|
265
265
|
let n = null, r = () => {
|
|
266
|
-
let r =
|
|
266
|
+
let r = x(e.location.hash);
|
|
267
267
|
r === null || r === n || (n = r, t(r));
|
|
268
268
|
};
|
|
269
269
|
return e.addEventListener("hashchange", r), {
|
|
270
270
|
push(t) {
|
|
271
271
|
if (t === n) return;
|
|
272
272
|
n = t;
|
|
273
|
-
let r =
|
|
273
|
+
let r = S(e.location.hash, t);
|
|
274
274
|
r !== e.location.hash && e.history?.replaceState?.(e.history.state, "", r);
|
|
275
275
|
},
|
|
276
276
|
stop() {
|
|
@@ -280,49 +280,49 @@ function w(e, t) {
|
|
|
280
280
|
}
|
|
281
281
|
//#endregion
|
|
282
282
|
//#region src/renderer/select.ts
|
|
283
|
-
var
|
|
283
|
+
var w = {
|
|
284
284
|
css: async () => new (await (import("./cssRenderer-Deskm2ND.js"))).CssRenderer(),
|
|
285
|
-
webgl2: async () => new (await (import("./webglRenderer-
|
|
286
|
-
},
|
|
287
|
-
function
|
|
285
|
+
webgl2: async () => new (await (import("./webglRenderer-CmQ_mUrX.js"))).WebglRenderer()
|
|
286
|
+
}, T = !0;
|
|
287
|
+
function te(e) {
|
|
288
288
|
return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
|
|
289
289
|
}
|
|
290
|
-
function
|
|
291
|
-
return e.gpu &&
|
|
290
|
+
function ne(e) {
|
|
291
|
+
return e.gpu && T ? ["webgl2", "css"] : ["css"];
|
|
292
292
|
}
|
|
293
|
-
function
|
|
294
|
-
return { gpu:
|
|
293
|
+
function re() {
|
|
294
|
+
return { gpu: ie() };
|
|
295
295
|
}
|
|
296
|
-
function
|
|
296
|
+
function ie() {
|
|
297
297
|
try {
|
|
298
298
|
return !!document.createElement("canvas").getContext("webgl2");
|
|
299
299
|
} catch {
|
|
300
300
|
return !1;
|
|
301
301
|
}
|
|
302
302
|
}
|
|
303
|
-
async function
|
|
304
|
-
if (
|
|
305
|
-
let n = Array.isArray(e) ? e : e === "auto" ?
|
|
303
|
+
async function E(e = "auto", t = re()) {
|
|
304
|
+
if (te(e)) return e;
|
|
305
|
+
let n = Array.isArray(e) ? e : e === "auto" ? ne(t) : [e];
|
|
306
306
|
for (let e of n) {
|
|
307
307
|
if (e === "webgl2" && !t.gpu) continue;
|
|
308
|
-
let n =
|
|
308
|
+
let n = w[e];
|
|
309
309
|
if (n) return n();
|
|
310
310
|
}
|
|
311
311
|
throw n.length === 1 && n[0] === "webgl2" && !t.gpu ? Error("renderer: 'webgl2' was forced but this device has no WebGL2. Use 'css' or 'auto'.") : Error(`renderer: none of [${n.join(", ")}] could be loaded — use 'css' or 'auto'.`);
|
|
312
312
|
}
|
|
313
313
|
//#endregion
|
|
314
314
|
//#region src/source/compose.ts
|
|
315
|
-
function
|
|
315
|
+
function ae(e, t) {
|
|
316
316
|
let n = typeof t.frontCover == "string", r = typeof t.backCover == "string", i = t.pages != null && Object.keys(t.pages).length > 0;
|
|
317
|
-
return !n && !r && !i ? e : new
|
|
317
|
+
return !n && !r && !i ? e : new O(e, t);
|
|
318
318
|
}
|
|
319
|
-
function
|
|
319
|
+
function D(e) {
|
|
320
320
|
return fetch(e).then((t) => {
|
|
321
321
|
if (!t.ok) throw Error(`zine: could not load image "${e}" (HTTP ${t.status}).`);
|
|
322
322
|
return t.blob();
|
|
323
323
|
}).then((e) => createImageBitmap(e));
|
|
324
324
|
}
|
|
325
|
-
var
|
|
325
|
+
var O = class {
|
|
326
326
|
#e;
|
|
327
327
|
#t;
|
|
328
328
|
#n;
|
|
@@ -391,16 +391,16 @@ var M = class {
|
|
|
391
391
|
}
|
|
392
392
|
#s(e) {
|
|
393
393
|
let t = this.#a.get(e);
|
|
394
|
-
return t === void 0 && (t =
|
|
394
|
+
return t === void 0 && (t = D(e).catch((t) => {
|
|
395
395
|
throw this.#a.delete(e), t;
|
|
396
396
|
}), this.#a.set(e, t)), t;
|
|
397
397
|
}
|
|
398
|
-
},
|
|
399
|
-
function
|
|
400
|
-
let r = Math.max(0, t -
|
|
398
|
+
}, k = .25, A = .0015, j = 6, M = 250, N = 24, P = 2 * M, F = 1.2, I = 32, L = 60, R = 2.5, z = 1.5, B = 120, V = .85, H = .82, oe = .12, U = 360, W = 28, G = 260, K = 7e3, q = 2200, J = "zine:hints-learned";
|
|
399
|
+
function se(e, t, n) {
|
|
400
|
+
let r = Math.max(0, t - I), i = Math.min(e.length, t + n + I), a = e.slice(r, i).replace(/\s+/g, " ").trim();
|
|
401
401
|
return `${r > 0 ? "…" : ""}${a}${i < e.length ? "…" : ""}`;
|
|
402
402
|
}
|
|
403
|
-
var
|
|
403
|
+
var ce = class {
|
|
404
404
|
#e;
|
|
405
405
|
#t;
|
|
406
406
|
#n = new l();
|
|
@@ -414,110 +414,133 @@ var J = class {
|
|
|
414
414
|
#u;
|
|
415
415
|
#d;
|
|
416
416
|
#f;
|
|
417
|
-
#p;
|
|
418
|
-
#m;
|
|
419
|
-
#h
|
|
420
|
-
#g
|
|
421
|
-
#_ =
|
|
422
|
-
|
|
423
|
-
|
|
424
|
-
|
|
425
|
-
|
|
426
|
-
#
|
|
417
|
+
#p = null;
|
|
418
|
+
#m = null;
|
|
419
|
+
#h;
|
|
420
|
+
#g;
|
|
421
|
+
#_ = {
|
|
422
|
+
turn: !1,
|
|
423
|
+
zoom: !1,
|
|
424
|
+
pan: !1
|
|
425
|
+
};
|
|
426
|
+
#v = null;
|
|
427
|
+
#y = null;
|
|
428
|
+
#b = null;
|
|
429
|
+
#x = null;
|
|
430
|
+
#S = null;
|
|
427
431
|
#C = null;
|
|
428
|
-
#w =
|
|
429
|
-
#T =
|
|
430
|
-
#E
|
|
431
|
-
#D
|
|
432
|
-
#O
|
|
432
|
+
#w = !1;
|
|
433
|
+
#T = "";
|
|
434
|
+
#E;
|
|
435
|
+
#D;
|
|
436
|
+
#O;
|
|
437
|
+
#k = !1;
|
|
438
|
+
#A = null;
|
|
439
|
+
#j = !1;
|
|
440
|
+
#M;
|
|
441
|
+
#N = "";
|
|
442
|
+
#P;
|
|
443
|
+
#F;
|
|
444
|
+
#I;
|
|
445
|
+
#L = null;
|
|
446
|
+
#R = null;
|
|
447
|
+
#z = [];
|
|
448
|
+
#B = 0;
|
|
449
|
+
#V = 0;
|
|
450
|
+
#H = {
|
|
433
451
|
left: null,
|
|
434
452
|
right: null
|
|
435
453
|
};
|
|
436
|
-
#
|
|
437
|
-
#
|
|
438
|
-
#
|
|
439
|
-
#
|
|
440
|
-
#
|
|
441
|
-
#P = null;
|
|
442
|
-
#F = !1;
|
|
443
|
-
#I = 1;
|
|
444
|
-
#L = 0;
|
|
445
|
-
#R = 0;
|
|
446
|
-
#z = null;
|
|
447
|
-
#B = !1;
|
|
448
|
-
#V = !1;
|
|
449
|
-
#H = null;
|
|
450
|
-
#U = null;
|
|
451
|
-
#W = null;
|
|
452
|
-
#G = null;
|
|
453
|
-
#K = null;
|
|
454
|
-
#q = null;
|
|
454
|
+
#U;
|
|
455
|
+
#W;
|
|
456
|
+
#G;
|
|
457
|
+
#K;
|
|
458
|
+
#q;
|
|
455
459
|
#J = null;
|
|
456
|
-
#Y =
|
|
457
|
-
#X =
|
|
458
|
-
#Z =
|
|
459
|
-
#Q =
|
|
460
|
-
#$ =
|
|
461
|
-
#ee =
|
|
462
|
-
#te =
|
|
460
|
+
#Y = !1;
|
|
461
|
+
#X = 1;
|
|
462
|
+
#Z = 0;
|
|
463
|
+
#Q = 0;
|
|
464
|
+
#$ = null;
|
|
465
|
+
#ee = !1;
|
|
466
|
+
#te = !1;
|
|
463
467
|
#ne = null;
|
|
464
468
|
#re = null;
|
|
465
469
|
#ie = null;
|
|
466
470
|
#ae = null;
|
|
467
|
-
#oe =
|
|
471
|
+
#oe = null;
|
|
468
472
|
#se = null;
|
|
469
473
|
#ce = null;
|
|
470
|
-
#le =
|
|
471
|
-
#ue;
|
|
472
|
-
#de =
|
|
473
|
-
#fe;
|
|
474
|
-
#pe =
|
|
474
|
+
#le = 0;
|
|
475
|
+
#ue = null;
|
|
476
|
+
#de = !1;
|
|
477
|
+
#fe = 1;
|
|
478
|
+
#pe = !1;
|
|
475
479
|
#me = null;
|
|
476
|
-
#he =
|
|
477
|
-
#ge =
|
|
478
|
-
#_e =
|
|
480
|
+
#he = null;
|
|
481
|
+
#ge = null;
|
|
482
|
+
#_e = null;
|
|
479
483
|
#ve = null;
|
|
480
|
-
#ye;
|
|
484
|
+
#ye = null;
|
|
485
|
+
#be = -Infinity;
|
|
486
|
+
#xe = null;
|
|
487
|
+
#Se = null;
|
|
488
|
+
#Ce = /* @__PURE__ */ new Set();
|
|
489
|
+
#we;
|
|
490
|
+
#Te = null;
|
|
491
|
+
#Ee;
|
|
492
|
+
#De = null;
|
|
493
|
+
#Oe;
|
|
494
|
+
#ke;
|
|
495
|
+
#Ae = null;
|
|
496
|
+
#je = null;
|
|
497
|
+
#Me = "download";
|
|
498
|
+
#Ne = 1;
|
|
499
|
+
#Pe = 0;
|
|
500
|
+
#Fe = null;
|
|
501
|
+
#Ie;
|
|
481
502
|
debug = { setFlipProgress: (e, t) => {
|
|
482
|
-
this
|
|
503
|
+
this.#$?.setFlipProgress(e, t);
|
|
483
504
|
} };
|
|
484
505
|
constructor(e, t) {
|
|
485
|
-
|
|
506
|
+
le(e, t), this.#e = e, t.width !== void 0 && (e.style.width = `${t.width}px`), t.height !== void 0 && (e.style.height = `${t.height}px`), this.#t = ae(t.source, {
|
|
486
507
|
frontCover: t.frontCover,
|
|
487
508
|
backCover: t.backCover,
|
|
488
509
|
pages: t.pages
|
|
489
510
|
});
|
|
490
511
|
let n = t.direction ?? "ltr";
|
|
491
|
-
this.#a = n, this.#
|
|
492
|
-
let r = t.
|
|
512
|
+
this.#a = n, this.#F = (t.deepLink ?? !0) && ee(), this.#I = t.disableContextMenu ?? !1, this.#o = t.spreadMode ?? "cover", this.#s = this.#o, this.#c = t.curl ?? "cone", this.#u = t.clickToFlip ?? "edge", this.#d = t.clickZoneSize ?? 64, this.#f = t.cursorHints ?? !0;
|
|
513
|
+
let r = t.hints ?? !0;
|
|
514
|
+
this.#h = r === !0 || r !== !1 && (r.enabled ?? !0), this.#g = r !== !0 && r !== !1 && (r.persist ?? !1), this.#g && this.#dt(), this.#O = t.singlePageThreshold ?? 640, this.#M = t.responsiveSpread ?? !0, this.#we = t.controls ?? !0, this.#Ee = t.contextMenu ?? !t.disableContextMenu, this.#Oe = new Set(t.hideControls ?? []), this.#ke = t.loading ?? !0, this.#P = t.startPage, typeof this.#t.open != "function" && this.#mn(), this.#U = t.flipDuration ?? 800, this.#W = t.zoom?.enabled ?? !0, this.#G = t.zoom?.wheel ?? !0;
|
|
515
|
+
let i = t.zoom?.doubleClick, a = i === !1 ? [] : [...i ?? [
|
|
493
516
|
1,
|
|
494
517
|
2,
|
|
495
518
|
4
|
|
496
519
|
]].sort((e, t) => e - t);
|
|
497
|
-
this.#
|
|
498
|
-
let
|
|
499
|
-
this.#
|
|
520
|
+
this.#K = a.length > 0 ? a : null, this.#q = t.zoom?.max ?? 4;
|
|
521
|
+
let o = this.#W && this.#K !== null, s = t.zoom?.doubleClickInFlipZone ?? this.#u === "half";
|
|
522
|
+
this.#E = this.#u !== "off" && o && s && t.clickFlipDelay !== 0, this.#D = this.#E ? t.clickFlipDelay ?? M : 0, this.#Ie = this.#Ft(t.renderer ?? "auto");
|
|
500
523
|
}
|
|
501
524
|
get ready() {
|
|
502
|
-
return this.#
|
|
525
|
+
return this.#Ie;
|
|
503
526
|
}
|
|
504
527
|
getPageCount() {
|
|
505
528
|
return this.#t.pageCount;
|
|
506
529
|
}
|
|
507
530
|
getPage() {
|
|
508
|
-
return this.#
|
|
531
|
+
return this.#V;
|
|
509
532
|
}
|
|
510
533
|
get container() {
|
|
511
534
|
return this.#e;
|
|
512
535
|
}
|
|
513
536
|
getPageBox() {
|
|
514
|
-
return this
|
|
537
|
+
return this.#$?.measure().book ?? null;
|
|
515
538
|
}
|
|
516
539
|
getSpreads() {
|
|
517
|
-
return this.#
|
|
540
|
+
return this.#z;
|
|
518
541
|
}
|
|
519
542
|
getSpreadIndex() {
|
|
520
|
-
return this.#
|
|
543
|
+
return this.#B;
|
|
521
544
|
}
|
|
522
545
|
getDirection() {
|
|
523
546
|
return this.#a;
|
|
@@ -526,44 +549,44 @@ var J = class {
|
|
|
526
549
|
return this.#o;
|
|
527
550
|
}
|
|
528
551
|
isSinglePage() {
|
|
529
|
-
return this.#
|
|
552
|
+
return this.#k;
|
|
530
553
|
}
|
|
531
554
|
setSpreadMode(e) {
|
|
532
|
-
e !== this.#o && (this.#o = e, this.#
|
|
555
|
+
e !== this.#o && (this.#o = e, this.#j = !1, this.#Qt(), this.#$t());
|
|
533
556
|
}
|
|
534
557
|
toggleSpreadMode() {
|
|
535
558
|
this.setSpreadMode(this.#o === "single" ? this.#s === "single" ? "double" : this.#s : "single");
|
|
536
559
|
}
|
|
537
560
|
getResponsiveSpread() {
|
|
538
|
-
return this.#
|
|
561
|
+
return this.#M;
|
|
539
562
|
}
|
|
540
563
|
isResponsiveSingle() {
|
|
541
|
-
return this.#
|
|
564
|
+
return this.#j && this.#o !== "single";
|
|
542
565
|
}
|
|
543
566
|
setResponsiveSpread(e) {
|
|
544
|
-
if (e !== this.#
|
|
545
|
-
if (this.#
|
|
546
|
-
let e = this
|
|
567
|
+
if (e !== this.#M) {
|
|
568
|
+
if (this.#M = e, e) {
|
|
569
|
+
let e = this.#$?.measure().containerWidth;
|
|
547
570
|
if (e === void 0) return;
|
|
548
|
-
this.#
|
|
571
|
+
this.#j = !1, this.#Zt(e);
|
|
549
572
|
} else {
|
|
550
|
-
if (!this.#
|
|
551
|
-
this.#
|
|
573
|
+
if (!this.#j) return;
|
|
574
|
+
this.#j = !1, this.#Qt();
|
|
552
575
|
}
|
|
553
|
-
this
|
|
576
|
+
this.#$t();
|
|
554
577
|
}
|
|
555
578
|
}
|
|
556
579
|
getPageImage(e) {
|
|
557
|
-
return this.#
|
|
580
|
+
return this.#dn(e);
|
|
558
581
|
}
|
|
559
582
|
canFlipNext() {
|
|
560
|
-
return this.#
|
|
583
|
+
return this.#B + 1 < this.#z.length;
|
|
561
584
|
}
|
|
562
585
|
canFlipPrev() {
|
|
563
|
-
return this.#
|
|
586
|
+
return this.#B > 0;
|
|
564
587
|
}
|
|
565
588
|
getMaxZoom() {
|
|
566
|
-
return this.#
|
|
589
|
+
return this.#q;
|
|
567
590
|
}
|
|
568
591
|
canSearch() {
|
|
569
592
|
return typeof this.#t.getText == "function";
|
|
@@ -580,7 +603,7 @@ var J = class {
|
|
|
580
603
|
async print() {
|
|
581
604
|
let e = await this.getSourceFile(), t = this.#e.ownerDocument;
|
|
582
605
|
if (!e || !t) return !1;
|
|
583
|
-
let { url: n, revoke: r } = await this.#
|
|
606
|
+
let { url: n, revoke: r } = await this.#Le(e, t), i = t.createElement("iframe");
|
|
584
607
|
return i.style.cssText = "position:fixed;right:0;bottom:0;width:1px;height:1px;opacity:0;border:0;", i.setAttribute("aria-hidden", "true"), i.src = n, new Promise((e) => {
|
|
585
608
|
let a = !1, o = (t) => {
|
|
586
609
|
a || (a = !0, setTimeout(() => {
|
|
@@ -602,11 +625,11 @@ var J = class {
|
|
|
602
625
|
return typeof this.#t.getOutline == "function";
|
|
603
626
|
}
|
|
604
627
|
getOutline() {
|
|
605
|
-
if (!this.#
|
|
628
|
+
if (!this.#Se) {
|
|
606
629
|
let e = this.#t.getOutline;
|
|
607
|
-
this.#
|
|
630
|
+
this.#Se = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
|
|
608
631
|
}
|
|
609
|
-
return this.#
|
|
632
|
+
return this.#Se;
|
|
610
633
|
}
|
|
611
634
|
async getSourceFile() {
|
|
612
635
|
let e = this.#t.getDownload;
|
|
@@ -617,11 +640,11 @@ var J = class {
|
|
|
617
640
|
if (!e) return !1;
|
|
618
641
|
let t = this.#e.ownerDocument;
|
|
619
642
|
if (!t) return !1;
|
|
620
|
-
let { url: n, revoke: r } = await this.#
|
|
643
|
+
let { url: n, revoke: r } = await this.#Le(e, t), i = t.createElement("a");
|
|
621
644
|
return i.href = n, i.download = e.filename, i.rel = "noopener", t.body.appendChild(i), i.click(), i.remove(), r && setTimeout(() => URL.revokeObjectURL(n), 1e4), !0;
|
|
622
645
|
}
|
|
623
|
-
async #
|
|
624
|
-
if (e.revoke || !this.#
|
|
646
|
+
async #Le(e, t) {
|
|
647
|
+
if (e.revoke || !this.#Re(e.url, t)) return {
|
|
625
648
|
url: e.url,
|
|
626
649
|
revoke: e.revoke ?? !1
|
|
627
650
|
};
|
|
@@ -638,7 +661,7 @@ var J = class {
|
|
|
638
661
|
};
|
|
639
662
|
}
|
|
640
663
|
}
|
|
641
|
-
#
|
|
664
|
+
#Re(e, t) {
|
|
642
665
|
let n = t.defaultView?.location?.href;
|
|
643
666
|
if (!n) return !1;
|
|
644
667
|
try {
|
|
@@ -665,61 +688,62 @@ var J = class {
|
|
|
665
688
|
let i = t.toLowerCase().indexOf(r);
|
|
666
689
|
i < 0 || a.push({
|
|
667
690
|
page: e,
|
|
668
|
-
excerpt:
|
|
691
|
+
excerpt: se(t, i, r.length)
|
|
669
692
|
});
|
|
670
693
|
}
|
|
671
694
|
return a;
|
|
672
695
|
}
|
|
673
696
|
flipNext() {
|
|
674
|
-
this.#
|
|
697
|
+
this.#ze(1);
|
|
675
698
|
}
|
|
676
699
|
flipPrev() {
|
|
677
|
-
this.#
|
|
700
|
+
this.#ze(-1);
|
|
678
701
|
}
|
|
679
|
-
#
|
|
680
|
-
this.#
|
|
702
|
+
#ze(e) {
|
|
703
|
+
this.#Be(() => this.#Ge(this.#B + e));
|
|
681
704
|
}
|
|
682
705
|
flipTo(e) {
|
|
683
706
|
let t = Y(e, 0, Math.max(0, this.#t.pageCount - 1));
|
|
684
|
-
this.#
|
|
707
|
+
this.#Be(() => this.#Ge(this.#pn(t)));
|
|
685
708
|
}
|
|
686
|
-
#
|
|
687
|
-
this.#i.state === "idle" ? e() : this.#
|
|
709
|
+
#Be(e) {
|
|
710
|
+
this.#i.state === "idle" ? e() : this.#ce ? (this.#se = null, this.#Ve(), e()) : this.#se = e;
|
|
688
711
|
}
|
|
689
|
-
#
|
|
690
|
-
let e = this.#
|
|
691
|
-
e && (this.#
|
|
712
|
+
#Ve() {
|
|
713
|
+
let e = this.#ce;
|
|
714
|
+
e && (this.#ce = null, this.#ne !== null && (cancelAnimationFrame(this.#ne), this.#ne = null), this.#$?.setFlipProgress(e.toT, e.direction), e.onDone());
|
|
692
715
|
}
|
|
693
|
-
#
|
|
694
|
-
let e = this.#
|
|
716
|
+
#He() {
|
|
717
|
+
let e = this.#se;
|
|
695
718
|
if (!e) {
|
|
696
|
-
this.#
|
|
719
|
+
this.#sn();
|
|
697
720
|
return;
|
|
698
721
|
}
|
|
699
|
-
this.#
|
|
722
|
+
this.#se = null, e();
|
|
700
723
|
}
|
|
701
724
|
getZoom() {
|
|
702
|
-
return this.#
|
|
725
|
+
return this.#X;
|
|
703
726
|
}
|
|
704
727
|
setZoom(e, t) {
|
|
705
|
-
if (!this
|
|
706
|
-
|
|
707
|
-
|
|
708
|
-
|
|
728
|
+
if (!this.#$ || !this.#W) return;
|
|
729
|
+
this.#gt(), this.#yt();
|
|
730
|
+
let n = Y(e, 1, this.#q), r = this.#$.measure(), i = r.screenAt?.(this.#X), a = t ?? (i ? {
|
|
731
|
+
x: i.x + this.#Z + i.width / 2,
|
|
732
|
+
y: i.y + this.#Q + i.height / 2
|
|
709
733
|
} : null) ?? {
|
|
710
734
|
x: r.containerWidth / 2,
|
|
711
735
|
y: r.containerHeight / 2
|
|
712
|
-
}, o = this.#
|
|
713
|
-
[s, c] = this.#
|
|
736
|
+
}, o = this.#X, s = n === 1 ? 0 : a.x - n / o * (a.x - this.#Z), c = n === 1 ? 0 : a.y - n / o * (a.y - this.#Q);
|
|
737
|
+
[s, c] = this.#We(s, c, n, r.containerWidth, r.containerHeight), this.#X = n, this.#Z = s, this.#Q = c, this.#$.setViewTransform(n, s, c), o > 1 != n > 1 && this.#Ue(), this.#rn(), this.#lt(), o <= 1 && n > 1 && (this.#ft("zoom"), this.#bt()), this.#n.emit("zoomChanged", { scale: n });
|
|
714
738
|
}
|
|
715
739
|
resetZoom() {
|
|
716
740
|
this.setZoom(1);
|
|
717
741
|
}
|
|
718
|
-
#
|
|
719
|
-
this.#e.style.touchAction = this.#
|
|
742
|
+
#Ue() {
|
|
743
|
+
this.#e.style.touchAction = this.#X > 1 ? "none" : "pan-y";
|
|
720
744
|
}
|
|
721
|
-
#
|
|
722
|
-
let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this
|
|
745
|
+
#We(e, t, n, r, i) {
|
|
746
|
+
let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#$?.measure().screenAt?.(n) ?? {
|
|
723
747
|
x: 0,
|
|
724
748
|
y: 0,
|
|
725
749
|
width: r * n,
|
|
@@ -731,31 +755,31 @@ var J = class {
|
|
|
731
755
|
return this.#n.on(e, t);
|
|
732
756
|
}
|
|
733
757
|
destroy() {
|
|
734
|
-
this.#
|
|
758
|
+
this.#te = !0, this.#ne !== null && cancelAnimationFrame(this.#ne), this.#ce = null, this.#se = null, this.#Et(), this.#mt(), this.#gt(), this.#yt(), this.#Tt(), this.#St(), this.#J?.disconnect(), this.#L?.stop(), this.#L = null, this.#R?.(), this.#F && b(), this.#Te?.(), this.#De?.(), this.#zt(), this.#xe?.(), this.#ge?.(), this.#ve?.(), this.#_e?.(), this.#m?.(), this.#he?.(), this.#Fe !== null && clearTimeout(this.#Fe), this.#Pe++, this.#$?.destroy(), this.#$ = null, this.#t.destroy(), this.#n.clear();
|
|
735
759
|
}
|
|
736
|
-
#
|
|
737
|
-
if (e < 0 || e >= this.#
|
|
738
|
-
let t = e > this.#
|
|
760
|
+
#Ge(e) {
|
|
761
|
+
if (e < 0 || e >= this.#z.length || e === this.#B || (this.#gt(), this.#yt(), this.#i.send("flip") === null)) return;
|
|
762
|
+
let t = e > this.#B ? "forward" : "backward", n = this.#Xe(e);
|
|
739
763
|
this.#n.emit("flipStart", {
|
|
740
|
-
from: this.#
|
|
764
|
+
from: this.#V,
|
|
741
765
|
to: n
|
|
742
|
-
}), this.#
|
|
766
|
+
}), this.#Ke(e, t, n, ++this.#le);
|
|
743
767
|
}
|
|
744
|
-
async #
|
|
745
|
-
let i = this.#
|
|
768
|
+
async #Ke(e, t, n, r) {
|
|
769
|
+
let i = this.#z[e], a = i ? await this.#un(i) : {
|
|
746
770
|
left: null,
|
|
747
771
|
right: null
|
|
748
772
|
};
|
|
749
|
-
r === this.#
|
|
750
|
-
fill: this.#
|
|
751
|
-
curl: this.#
|
|
773
|
+
r === this.#le && (this.#$?.beginFlip(this.#H, a, t, {
|
|
774
|
+
fill: this.#k,
|
|
775
|
+
curl: this.#Yt(),
|
|
752
776
|
anchor: { y: this.#l }
|
|
753
|
-
}), this.#
|
|
777
|
+
}), this.#qe(0, 1, t, () => this.#Ye(e, n, a), () => this.#Je(n)));
|
|
754
778
|
}
|
|
755
|
-
#
|
|
756
|
-
let a = this.#
|
|
779
|
+
#qe(e, t, n, r, i) {
|
|
780
|
+
let a = this.#Jt() * Math.abs(t - e);
|
|
757
781
|
if (a <= 0) {
|
|
758
|
-
this
|
|
782
|
+
this.#$?.setFlipProgress(t, n), r();
|
|
759
783
|
return;
|
|
760
784
|
}
|
|
761
785
|
let o = {
|
|
@@ -763,60 +787,60 @@ var J = class {
|
|
|
763
787
|
direction: n,
|
|
764
788
|
onDone: r
|
|
765
789
|
};
|
|
766
|
-
this.#
|
|
790
|
+
this.#ce = o;
|
|
767
791
|
let s = performance.now(), c = !1, l = (u) => {
|
|
768
|
-
if (this.#
|
|
769
|
-
let d = Math.min(1, (u - s) / a), f =
|
|
770
|
-
i && !c && f >= (this.#
|
|
792
|
+
if (this.#ce !== o) return;
|
|
793
|
+
let d = Math.min(1, (u - s) / a), f = Z(d);
|
|
794
|
+
i && !c && f >= (this.#k ? H : V) && (c = !0, i()), d < 1 ? (this.#$?.setFlipProgress(e + (t - e) * f, n), this.#ne = requestAnimationFrame(l)) : (this.#$?.setFlipProgress(t, n), this.#ne = null, this.#ce = null, r());
|
|
771
795
|
};
|
|
772
|
-
this.#
|
|
796
|
+
this.#ne = requestAnimationFrame(l);
|
|
773
797
|
}
|
|
774
|
-
#
|
|
775
|
-
this.#
|
|
798
|
+
#Je(e) {
|
|
799
|
+
this.#V !== e && (this.#V = e, this.#qt(), this.#n.emit("pageChanged", { page: e }));
|
|
776
800
|
}
|
|
777
|
-
#
|
|
778
|
-
let r = this.#
|
|
779
|
-
this.#
|
|
801
|
+
#Ye(e, t, n) {
|
|
802
|
+
let r = this.#z[e];
|
|
803
|
+
this.#B = e, this.#H = n, r && this.#en(r, n), this.#fn(), this.#i.send("settle"), this.#be = performance.now(), this.#Je(t), this.#ft("turn"), this.#lt(), this.#n.emit("flipEnd", { page: t }), this.#He();
|
|
780
804
|
}
|
|
781
|
-
#
|
|
782
|
-
let t = this.#
|
|
783
|
-
if (!t) return this.#
|
|
805
|
+
#Xe(e) {
|
|
806
|
+
let t = this.#z[e];
|
|
807
|
+
if (!t) return this.#V;
|
|
784
808
|
let n = [t.left, t.right].filter((e) => e !== null);
|
|
785
|
-
return n.length > 0 ? Math.min(...n) : this.#
|
|
809
|
+
return n.length > 0 ? Math.min(...n) : this.#V;
|
|
786
810
|
}
|
|
787
|
-
#
|
|
788
|
-
if (this.#
|
|
789
|
-
if (this.#
|
|
811
|
+
#Ze(e, t) {
|
|
812
|
+
if (this.#de || !this.#$) return;
|
|
813
|
+
if (this.#yt(), this.#Et(), this.#X > 1) {
|
|
790
814
|
if (this.#i.send("panStart") === null) return;
|
|
791
|
-
this.#
|
|
792
|
-
baseTx: this.#
|
|
793
|
-
baseTy: this.#
|
|
815
|
+
this.#ue = {
|
|
816
|
+
baseTx: this.#Z,
|
|
817
|
+
baseTy: this.#Q
|
|
794
818
|
};
|
|
795
819
|
return;
|
|
796
820
|
}
|
|
797
|
-
let n = this.#
|
|
798
|
-
this.#
|
|
799
|
-
let i = Math.min(n.width, n.height) *
|
|
821
|
+
let n = this.#it(), r = this.#at(e, t);
|
|
822
|
+
this.#ae = r;
|
|
823
|
+
let i = Math.min(n.width, n.height) * k, a = r.x >= 0 && r.x <= n.width && r.y >= 0 && r.y <= n.height, o = r.x <= i || r.x >= n.width - i, s = a && o;
|
|
800
824
|
if (this.#i.state !== "idle") {
|
|
801
|
-
if (!this.#
|
|
802
|
-
this.#
|
|
825
|
+
if (!this.#ce || !s) {
|
|
826
|
+
this.#ie = null;
|
|
803
827
|
return;
|
|
804
828
|
}
|
|
805
|
-
this.#
|
|
829
|
+
this.#Ve();
|
|
806
830
|
}
|
|
807
831
|
if (!s) return;
|
|
808
832
|
this.#l = Y(r.y / n.height, 0, 1);
|
|
809
|
-
let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#
|
|
810
|
-
u < 0 || u >= this.#
|
|
833
|
+
let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#B + (l ? 1 : -1);
|
|
834
|
+
u < 0 || u >= this.#z.length || (this.#ie = {
|
|
811
835
|
direction: l ? "forward" : "backward",
|
|
812
836
|
targetIndex: u,
|
|
813
|
-
toPage: this.#
|
|
837
|
+
toPage: this.#Xe(u),
|
|
814
838
|
width: n.width
|
|
815
839
|
});
|
|
816
840
|
}
|
|
817
|
-
#
|
|
818
|
-
let e = this.#
|
|
819
|
-
e && (this.#
|
|
841
|
+
#Qe() {
|
|
842
|
+
let e = this.#ie;
|
|
843
|
+
e && (this.#ie = null, this.#i.send("grab") !== null && (this.#re = {
|
|
820
844
|
direction: e.direction,
|
|
821
845
|
targetIndex: e.targetIndex,
|
|
822
846
|
toPage: e.toPage,
|
|
@@ -827,71 +851,75 @@ var J = class {
|
|
|
827
851
|
width: e.width,
|
|
828
852
|
t: 0
|
|
829
853
|
}, this.#n.emit("flipStart", {
|
|
830
|
-
from: this.#
|
|
854
|
+
from: this.#V,
|
|
831
855
|
to: e.toPage
|
|
832
|
-
}), this
|
|
856
|
+
}), this.#$e(e.targetIndex, e.direction)));
|
|
833
857
|
}
|
|
834
|
-
async
|
|
835
|
-
let n = this.#
|
|
858
|
+
async #$e(e, t) {
|
|
859
|
+
let n = this.#z[e], r = n ? await this.#un(n) : {
|
|
836
860
|
left: null,
|
|
837
861
|
right: null
|
|
838
862
|
};
|
|
839
|
-
this.#
|
|
840
|
-
fill: this.#
|
|
841
|
-
curl: this.#
|
|
863
|
+
this.#re?.targetIndex === e && (this.#re.toContent = r, this.#$?.beginFlip(this.#H, r, t, {
|
|
864
|
+
fill: this.#k,
|
|
865
|
+
curl: this.#Yt(),
|
|
842
866
|
anchor: { y: this.#l }
|
|
843
|
-
}), this
|
|
844
|
-
}
|
|
845
|
-
#
|
|
846
|
-
if (this.#
|
|
847
|
-
if (this.#
|
|
848
|
-
if (!this
|
|
849
|
-
let n = this
|
|
850
|
-
this.#
|
|
867
|
+
}), this.#$?.setFlipProgress(this.#re.t, t));
|
|
868
|
+
}
|
|
869
|
+
#et(e, t) {
|
|
870
|
+
if (this.#de) return;
|
|
871
|
+
if (this.#ue) {
|
|
872
|
+
if (!this.#$) return;
|
|
873
|
+
let n = this.#$.measure(), [r, i] = this.#We(this.#ue.baseTx + e, this.#ue.baseTy + t, this.#X, n.containerWidth, n.containerHeight);
|
|
874
|
+
this.#Z = r, this.#Q = i, this.#$.setViewTransform(this.#X, r, i), this.#rn(), this.#ft("pan"), this.#St();
|
|
851
875
|
return;
|
|
852
876
|
}
|
|
853
|
-
this.#
|
|
854
|
-
let n = this.#
|
|
855
|
-
n && (n.t = Y((n.direction === "forward" ? -e : e) / n.width, 0, 1), this
|
|
856
|
-
}
|
|
857
|
-
#
|
|
858
|
-
if (this.#
|
|
859
|
-
if (this.#
|
|
860
|
-
this.#
|
|
877
|
+
this.#ie && Math.hypot(e, t) > j && this.#Qe();
|
|
878
|
+
let n = this.#re;
|
|
879
|
+
n && (n.t = Y((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#$?.setFlipProgress(n.t, n.direction));
|
|
880
|
+
}
|
|
881
|
+
#tt(e) {
|
|
882
|
+
if (this.#de) return;
|
|
883
|
+
if (this.#ue) {
|
|
884
|
+
this.#ue = null, this.#i.send("panEnd"), this.#lt();
|
|
861
885
|
return;
|
|
862
886
|
}
|
|
863
|
-
let t = this.#
|
|
887
|
+
let t = this.#re;
|
|
864
888
|
if (!t) {
|
|
865
|
-
this.#
|
|
889
|
+
this.#ie = null, this.#nt(e) || this.#rt(e);
|
|
866
890
|
return;
|
|
867
891
|
}
|
|
868
|
-
this.#
|
|
892
|
+
this.#re = null, this.#i.send("release");
|
|
869
893
|
let n = e.swipe && Math.abs(e.vx) > Math.abs(e.vy), r = t.direction === "forward" ? e.vx < 0 : e.vx > 0, i = n && r, a = n && !r;
|
|
870
|
-
i || t.t >= .5 && !a ? this.#
|
|
894
|
+
i || t.t >= .5 && !a ? this.#qe(t.t, 1, t.direction, () => this.#Ye(t.targetIndex, t.toPage, t.toContent), () => this.#Je(t.toPage)) : this.#qe(t.t, 0, t.direction, () => this.#Dt());
|
|
871
895
|
}
|
|
872
|
-
#
|
|
873
|
-
if (this.#
|
|
896
|
+
#nt(e) {
|
|
897
|
+
if (this.#X > 1 || !e.swipe || Math.abs(e.dx) <= Math.abs(e.dy)) return !1;
|
|
874
898
|
let t = this.#a === "rtl" ? e.dx > 0 : e.dx < 0, n = t ? "forward" : "backward";
|
|
875
|
-
if (!this.#
|
|
899
|
+
if (!this.#st(n)) return this.#vt(n), !1;
|
|
876
900
|
let r = t ? 1 : -1;
|
|
877
|
-
return this.#
|
|
901
|
+
return this.#Be(() => this.#Ge(this.#B + r)), !0;
|
|
878
902
|
}
|
|
879
|
-
#
|
|
880
|
-
if (this.#u === "off" || this.#
|
|
881
|
-
let t = this.#
|
|
882
|
-
if (!t
|
|
883
|
-
|
|
884
|
-
|
|
885
|
-
if (this.#Ge(), this.#p <= 0) {
|
|
886
|
-
this.#Ce(r);
|
|
903
|
+
#rt(e) {
|
|
904
|
+
if (this.#u === "off" || this.#X > 1 || !this.#ae || Math.abs(e.dx) > j || Math.abs(e.dy) > j) return;
|
|
905
|
+
let t = this.#ot(this.#ae);
|
|
906
|
+
if (!t) return;
|
|
907
|
+
if (!this.#st(t)) {
|
|
908
|
+
this.#vt(t);
|
|
887
909
|
return;
|
|
888
910
|
}
|
|
889
|
-
this.#
|
|
890
|
-
|
|
891
|
-
|
|
911
|
+
this.#l = Y(this.#ae.y / this.#it().height, 0, 1);
|
|
912
|
+
let n = t === "forward" ? 1 : -1, r = () => this.#Ge(this.#B + n);
|
|
913
|
+
if (this.#Et(), this.#D <= 0) {
|
|
914
|
+
this.#Be(r);
|
|
915
|
+
return;
|
|
916
|
+
}
|
|
917
|
+
this.#oe = setTimeout(() => {
|
|
918
|
+
this.#oe = null, this.#Be(r);
|
|
919
|
+
}, this.#D);
|
|
892
920
|
}
|
|
893
|
-
#
|
|
894
|
-
let e = this
|
|
921
|
+
#it() {
|
|
922
|
+
let e = this.#$.measure();
|
|
895
923
|
return e.content ?? e.book ?? {
|
|
896
924
|
x: 0,
|
|
897
925
|
y: 0,
|
|
@@ -899,213 +927,351 @@ var J = class {
|
|
|
899
927
|
height: e.containerHeight
|
|
900
928
|
};
|
|
901
929
|
}
|
|
902
|
-
#
|
|
903
|
-
let n = this.#e.getBoundingClientRect(), r = this.#
|
|
930
|
+
#at(e, t) {
|
|
931
|
+
let n = this.#e.getBoundingClientRect(), r = this.#it();
|
|
904
932
|
return {
|
|
905
933
|
x: e - n.left - r.x,
|
|
906
934
|
y: t - n.top - r.y
|
|
907
935
|
};
|
|
908
936
|
}
|
|
909
|
-
#
|
|
910
|
-
if (!this
|
|
911
|
-
let t = this.#
|
|
937
|
+
#ot(e) {
|
|
938
|
+
if (!this.#$) return null;
|
|
939
|
+
let t = this.#it().width, n;
|
|
912
940
|
if (n = this.#u === "half" ? e.x > t / 2 ? "right" : "left" : e.x <= this.#d ? "left" : e.x >= t - this.#d ? "right" : null, !n) return null;
|
|
913
941
|
let r = this.#a === "rtl" ? "left" : "right";
|
|
914
942
|
return n === r ? "forward" : "backward";
|
|
915
943
|
}
|
|
916
|
-
#
|
|
917
|
-
let t = this.#
|
|
918
|
-
return t >= 0 && t < this.#
|
|
944
|
+
#st(e) {
|
|
945
|
+
let t = this.#B + (e === "forward" ? 1 : -1);
|
|
946
|
+
return t >= 0 && t < this.#z.length;
|
|
947
|
+
}
|
|
948
|
+
#ct() {
|
|
949
|
+
let e = (e) => {
|
|
950
|
+
let t = e;
|
|
951
|
+
this.#p = {
|
|
952
|
+
x: t.clientX,
|
|
953
|
+
y: t.clientY
|
|
954
|
+
}, this.#lt();
|
|
955
|
+
}, t = () => {
|
|
956
|
+
this.#p = null, this.#lt();
|
|
957
|
+
};
|
|
958
|
+
this.#e.addEventListener("pointermove", e), this.#e.addEventListener("pointerleave", t), this.#m = () => {
|
|
959
|
+
this.#e.removeEventListener("pointermove", e), this.#e.removeEventListener("pointerleave", t);
|
|
960
|
+
};
|
|
961
|
+
}
|
|
962
|
+
#lt() {
|
|
963
|
+
if (!this.#f || !this.#$) return;
|
|
964
|
+
let e = "";
|
|
965
|
+
this.#re || this.#ue ? e = "grabbing" : this.#p && (e = this.#ut(this.#p.x, this.#p.y)), this.#e.style.cursor = e;
|
|
966
|
+
}
|
|
967
|
+
#ut(e, t) {
|
|
968
|
+
if (!this.#$) return "";
|
|
969
|
+
let n = this.#it(), r = this.#at(e, t);
|
|
970
|
+
if (r.x < 0 || r.y < 0 || r.x > n.width || r.y > n.height) return "";
|
|
971
|
+
if (this.#X > 1) return "grab";
|
|
972
|
+
let i = this.#ot(r);
|
|
973
|
+
return i && this.#st(i) ? "pointer" : this.#W && this.#K !== null ? "zoom-in" : "";
|
|
974
|
+
}
|
|
975
|
+
#dt() {
|
|
976
|
+
try {
|
|
977
|
+
let e = localStorage.getItem(J);
|
|
978
|
+
if (!e) return;
|
|
979
|
+
let t = JSON.parse(e);
|
|
980
|
+
this.#_ = {
|
|
981
|
+
turn: t.turn === !0,
|
|
982
|
+
zoom: t.zoom === !0,
|
|
983
|
+
pan: t.pan === !0
|
|
984
|
+
};
|
|
985
|
+
} catch {}
|
|
986
|
+
}
|
|
987
|
+
#ft(e) {
|
|
988
|
+
if (!this.#_[e] && (this.#_[e] = !0, e === "turn" && this.#mt(), e === "zoom" && this.#Tt(), this.#g)) try {
|
|
989
|
+
localStorage.setItem(J, JSON.stringify(this.#_));
|
|
990
|
+
} catch {}
|
|
991
|
+
}
|
|
992
|
+
#pt() {
|
|
993
|
+
!this.#h || this.#pe || this.#_.turn || (this.#mt(), this.#v = setTimeout(() => {
|
|
994
|
+
this.#v = null, this.#ht();
|
|
995
|
+
}, K));
|
|
996
|
+
}
|
|
997
|
+
#mt() {
|
|
998
|
+
this.#v !== null && (clearTimeout(this.#v), this.#v = null);
|
|
999
|
+
}
|
|
1000
|
+
async #ht() {
|
|
1001
|
+
if (!this.#h || this.#pe || this.#_.turn || !this.#$ || typeof requestAnimationFrame != "function" || this.#i.state !== "idle") return;
|
|
1002
|
+
let e = this.#B + 1, t = this.#z[e];
|
|
1003
|
+
if (!t) return;
|
|
1004
|
+
let n = await this.#un(t);
|
|
1005
|
+
if (this.#te || this.#_.turn || this.#i.state !== "idle" || this.#y) return;
|
|
1006
|
+
this.#l = 1, this.#$.beginFlip(this.#H, n, "forward", {
|
|
1007
|
+
fill: this.#k,
|
|
1008
|
+
curl: this.#Yt(),
|
|
1009
|
+
anchor: { y: this.#l }
|
|
1010
|
+
});
|
|
1011
|
+
let r = {};
|
|
1012
|
+
this.#y = r;
|
|
1013
|
+
let i = performance.now(), a = U * 2, o = () => {
|
|
1014
|
+
if (this.#y !== r) return;
|
|
1015
|
+
let e = Math.min(1, (performance.now() - i) / a), t = oe * Math.sin(e * Math.PI);
|
|
1016
|
+
this.#$?.setFlipProgress(Math.max(0, t), "forward"), e < 1 ? this.#ne = requestAnimationFrame(o) : (this.#ne = null, this.#y = null, this.#_t());
|
|
1017
|
+
};
|
|
1018
|
+
this.#ne = requestAnimationFrame(o);
|
|
1019
|
+
}
|
|
1020
|
+
#gt() {
|
|
1021
|
+
this.#y && (this.#y = null, this.#ne !== null && (cancelAnimationFrame(this.#ne), this.#ne = null), this.#_t());
|
|
919
1022
|
}
|
|
920
|
-
#
|
|
921
|
-
|
|
1023
|
+
#_t() {
|
|
1024
|
+
let e = this.#z[this.#B];
|
|
1025
|
+
e && this.#i.state === "idle" && this.#en(e, this.#H);
|
|
1026
|
+
}
|
|
1027
|
+
#vt(e) {
|
|
1028
|
+
if (!this.#$ || typeof requestAnimationFrame != "function" || this.#pe || this.#i.state !== "idle" || this.#X > 1 || this.#b) return;
|
|
1029
|
+
let t = e === "forward", n = (this.#a === "rtl" ? !t : t) ? -1 : 1, r = {};
|
|
1030
|
+
this.#b = r;
|
|
1031
|
+
let i = performance.now(), a = () => {
|
|
1032
|
+
if (this.#b !== r) return;
|
|
1033
|
+
let e = Math.min(1, (performance.now() - i) / G), t = W * Math.sin(e * Math.PI);
|
|
1034
|
+
this.#$?.setViewTransform(1, n * t, 0), e < 1 ? this.#ne = requestAnimationFrame(a) : (this.#ne = null, this.#b = null, this.#$?.setViewTransform(1, 0, 0));
|
|
1035
|
+
};
|
|
1036
|
+
this.#ne = requestAnimationFrame(a);
|
|
922
1037
|
}
|
|
923
|
-
#
|
|
924
|
-
|
|
925
|
-
e && this.#yt(e, this.#O), this.#i.send("settle"), this.#n.emit("flipEnd", { page: this.#D }), this.#Te();
|
|
1038
|
+
#yt() {
|
|
1039
|
+
this.#b && (this.#b = null, this.#ne !== null && (cancelAnimationFrame(this.#ne), this.#ne = null), this.#$?.setViewTransform(1, 0, 0));
|
|
926
1040
|
}
|
|
927
|
-
#
|
|
928
|
-
|
|
929
|
-
this.#U = null, this.#i.send("release"), this.#i.send("settle");
|
|
930
|
-
let e = this.#T[this.#E];
|
|
931
|
-
e && this.#yt(e, this.#O);
|
|
932
|
-
} else this.#X && (this.#X = null, this.#i.send("panEnd"));
|
|
933
|
-
this.#Z = !0, this.#Q = this.#I;
|
|
1041
|
+
#bt() {
|
|
1042
|
+
this.#_.pan || this.#xt("Drag to move");
|
|
934
1043
|
}
|
|
935
|
-
#
|
|
936
|
-
if (!this.#
|
|
1044
|
+
#xt(e) {
|
|
1045
|
+
if (!this.#h) return;
|
|
1046
|
+
let t = this.#e.ownerDocument;
|
|
1047
|
+
if (!t || typeof this.#e.appendChild != "function") return;
|
|
1048
|
+
this.#St();
|
|
1049
|
+
let n = t.createElement("div");
|
|
1050
|
+
n.className = "zine-hint-caption", n.setAttribute("aria-hidden", "true"), n.textContent = e, n.style.cssText = "position:absolute;left:50%;bottom:16px;transform:translateX(-50%);z-index:3;pointer-events:none;padding:6px 12px;border-radius:999px;font:500 13px/1.2 system-ui,sans-serif;color:#fff;background:rgba(24,24,27,0.82);box-shadow:0 1px 4px rgba(0,0,0,0.35);white-space:nowrap;opacity:0;";
|
|
1051
|
+
let r = !this.#pe && typeof requestAnimationFrame == "function";
|
|
1052
|
+
r && (n.style.transition = "opacity 200ms ease"), this.#e.appendChild(n), this.#x = n, r ? requestAnimationFrame(() => {
|
|
1053
|
+
this.#x === n && (n.style.opacity = "1");
|
|
1054
|
+
}) : n.style.opacity = "1", this.#S = setTimeout(() => this.#St(), q);
|
|
1055
|
+
}
|
|
1056
|
+
#St() {
|
|
1057
|
+
this.#S !== null && (clearTimeout(this.#S), this.#S = null), this.#x?.remove(), this.#x = null;
|
|
1058
|
+
}
|
|
1059
|
+
#Ct(e, t) {
|
|
1060
|
+
!this.#h || this.#_.zoom || this.#w || this.#T === "mouse" && this.#ut(e, t) === "zoom-in" && (this.#i.state === "animating" || performance.now() - this.#be <= P || (this.#Tt(), this.#C = setTimeout(() => {
|
|
1061
|
+
this.#C = null, !(this.#_.zoom || this.#w) && (this.#w = !0, this.#xt(this.#wt()));
|
|
1062
|
+
}, M)));
|
|
1063
|
+
}
|
|
1064
|
+
#wt() {
|
|
1065
|
+
let e = [];
|
|
1066
|
+
if (this.#K !== null && e.push("Double-click"), this.#G) {
|
|
1067
|
+
let t = this.#e.ownerDocument?.defaultView?.navigator, n = /Mac|iPhone|iPad/.test(t?.platform ?? "");
|
|
1068
|
+
e.push(`${n ? "⌘" : "Ctrl"}-scroll`);
|
|
1069
|
+
}
|
|
1070
|
+
return `${e.join(" or ")} to zoom`;
|
|
1071
|
+
}
|
|
1072
|
+
#Tt() {
|
|
1073
|
+
this.#C !== null && (clearTimeout(this.#C), this.#C = null);
|
|
1074
|
+
}
|
|
1075
|
+
#Et() {
|
|
1076
|
+
this.#oe !== null && (clearTimeout(this.#oe), this.#oe = null);
|
|
1077
|
+
}
|
|
1078
|
+
#Dt() {
|
|
1079
|
+
let e = this.#z[this.#B];
|
|
1080
|
+
e && this.#en(e, this.#H), this.#i.send("settle"), this.#lt(), this.#n.emit("flipEnd", { page: this.#V }), this.#He();
|
|
1081
|
+
}
|
|
1082
|
+
#Ot() {
|
|
1083
|
+
if (this.#ie = null, this.#Et(), this.#re) {
|
|
1084
|
+
this.#re = null, this.#i.send("release"), this.#i.send("settle");
|
|
1085
|
+
let e = this.#z[this.#B];
|
|
1086
|
+
e && this.#en(e, this.#H);
|
|
1087
|
+
} else this.#ue && (this.#ue = null, this.#i.send("panEnd"));
|
|
1088
|
+
this.#de = !0, this.#fe = this.#X;
|
|
1089
|
+
}
|
|
1090
|
+
#kt(e, t, n) {
|
|
1091
|
+
if (!this.#de) return;
|
|
937
1092
|
let r = this.#e.getBoundingClientRect();
|
|
938
|
-
this.setZoom(this.#
|
|
1093
|
+
this.setZoom(this.#fe * n, {
|
|
939
1094
|
x: e - r.left,
|
|
940
1095
|
y: t - r.top
|
|
941
1096
|
});
|
|
942
1097
|
}
|
|
943
|
-
#
|
|
944
|
-
this.#
|
|
1098
|
+
#At() {
|
|
1099
|
+
this.#de = !1;
|
|
945
1100
|
}
|
|
946
|
-
#
|
|
947
|
-
if (!this.#
|
|
1101
|
+
#jt() {
|
|
1102
|
+
if (!this.#I) return;
|
|
948
1103
|
let e = (e) => e.preventDefault();
|
|
949
|
-
this.#e.addEventListener("contextmenu", e), this.#
|
|
1104
|
+
this.#e.addEventListener("contextmenu", e), this.#_e = () => this.#e.removeEventListener("contextmenu", e);
|
|
950
1105
|
}
|
|
951
|
-
#
|
|
1106
|
+
#Mt() {
|
|
952
1107
|
let e = (e) => {
|
|
953
|
-
if (!this.#
|
|
1108
|
+
if (!this.#G || !this.#W || !(e.ctrlKey || e.metaKey)) return;
|
|
954
1109
|
e.preventDefault();
|
|
955
|
-
let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY *
|
|
956
|
-
this.setZoom(this.#
|
|
1110
|
+
let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * A);
|
|
1111
|
+
this.setZoom(this.#X * n, {
|
|
957
1112
|
x: e.clientX - t.left,
|
|
958
1113
|
y: e.clientY - t.top
|
|
959
1114
|
});
|
|
960
1115
|
};
|
|
961
|
-
this.#e.addEventListener("wheel", e, { passive: !1 }), this.#
|
|
1116
|
+
this.#e.addEventListener("wheel", e, { passive: !1 }), this.#ge = () => this.#e.removeEventListener("wheel", e);
|
|
962
1117
|
}
|
|
963
|
-
#
|
|
1118
|
+
#Nt() {
|
|
964
1119
|
let e = (e) => {
|
|
965
|
-
|
|
966
|
-
|
|
967
|
-
let
|
|
968
|
-
if (!
|
|
969
|
-
|
|
1120
|
+
this.#T = e.pointerType;
|
|
1121
|
+
}, t = (e) => {
|
|
1122
|
+
let t = this.#K;
|
|
1123
|
+
if (!this.#W || t === null || !this.#$) return;
|
|
1124
|
+
let n = performance.now(), r = this.#ye;
|
|
1125
|
+
if (!(r !== null && n - r.t <= M && Math.hypot(e.clientX - r.x, e.clientY - r.y) <= N)) {
|
|
1126
|
+
this.#ye = {
|
|
970
1127
|
t: n,
|
|
971
1128
|
x: e.clientX,
|
|
972
1129
|
y: e.clientY
|
|
973
|
-
};
|
|
1130
|
+
}, this.#Ct(e.clientX, e.clientY);
|
|
974
1131
|
return;
|
|
975
1132
|
}
|
|
976
|
-
this.#
|
|
1133
|
+
this.#ye = null, this.#Tt(), this.#Pt(e.clientX, e.clientY, t);
|
|
1134
|
+
};
|
|
1135
|
+
this.#e.addEventListener("pointerdown", e), this.#e.addEventListener("click", t), this.#ve = () => {
|
|
1136
|
+
this.#e.removeEventListener("pointerdown", e), this.#e.removeEventListener("click", t);
|
|
977
1137
|
};
|
|
978
|
-
this.#e.addEventListener("click", e), this.#ie = () => this.#e.removeEventListener("click", e);
|
|
979
1138
|
}
|
|
980
|
-
|
|
981
|
-
if (this.#
|
|
982
|
-
let n = this.#
|
|
983
|
-
if (r !== null && this.#
|
|
1139
|
+
#Pt(e, t, n) {
|
|
1140
|
+
if (this.#X <= 1 && this.#u !== "off" && !this.#E) {
|
|
1141
|
+
let n = this.#at(e, t), r = this.#ot(n);
|
|
1142
|
+
if (r !== null && this.#st(r) || this.#i.state === "animating" || performance.now() - this.#be <= P) return;
|
|
984
1143
|
}
|
|
985
|
-
this.#
|
|
986
|
-
let r = n.find((e) => e > this.#
|
|
1144
|
+
this.#Et();
|
|
1145
|
+
let r = n.find((e) => e > this.#X + 1e-6) ?? n[0] ?? this.#X, i = this.#e.getBoundingClientRect();
|
|
987
1146
|
this.setZoom(r, {
|
|
988
1147
|
x: e - i.left,
|
|
989
1148
|
y: t - i.top
|
|
990
1149
|
});
|
|
991
1150
|
}
|
|
992
|
-
async #
|
|
993
|
-
let t =
|
|
994
|
-
if (this.#t.onProgress?.((e) => this.#
|
|
995
|
-
this.#
|
|
1151
|
+
async #Ft(e) {
|
|
1152
|
+
let t = E(e);
|
|
1153
|
+
if (this.#t.onProgress?.((e) => this.#It(e)), typeof this.#t.open == "function") {
|
|
1154
|
+
this.#Lt();
|
|
996
1155
|
try {
|
|
997
|
-
await this.#t.open(), this.#
|
|
1156
|
+
await this.#t.open(), this.#mn();
|
|
998
1157
|
} catch (e) {
|
|
999
|
-
throw this.#
|
|
1158
|
+
throw this.#zt(), e;
|
|
1000
1159
|
}
|
|
1001
|
-
this.#
|
|
1160
|
+
this.#Rt("preparing");
|
|
1002
1161
|
}
|
|
1003
|
-
this.#t.prefetch([this.#
|
|
1004
|
-
let n = await t, r = await this.#
|
|
1005
|
-
this
|
|
1162
|
+
this.#t.prefetch([this.#V]);
|
|
1163
|
+
let n = await t, r = await this.#Bt(n);
|
|
1164
|
+
this.#$ = r, this.#t.onPageUpdate?.((e) => this.#nn(e)), this.#Zt(r.measure().containerWidth);
|
|
1006
1165
|
let i = new m({
|
|
1007
|
-
onStart: (e) => this.#
|
|
1008
|
-
onMove: (e) => this.#
|
|
1009
|
-
onEnd: (e) => this.#
|
|
1166
|
+
onStart: (e) => this.#Ze(e.x, e.y),
|
|
1167
|
+
onMove: (e) => this.#et(e.dx, e.dy),
|
|
1168
|
+
onEnd: (e) => this.#tt(e)
|
|
1010
1169
|
}), a = new _({
|
|
1011
|
-
onPinchStart: () => this.#
|
|
1012
|
-
onPinchMove: (e) => this.#
|
|
1013
|
-
onPinchEnd: () => this.#
|
|
1170
|
+
onPinchStart: () => this.#Ot(),
|
|
1171
|
+
onPinchMove: (e) => this.#kt(e.centerX, e.centerY, e.scale),
|
|
1172
|
+
onPinchEnd: () => this.#At()
|
|
1014
1173
|
});
|
|
1015
|
-
this.#
|
|
1174
|
+
this.#he = h(this.#e, {
|
|
1016
1175
|
pointer: i,
|
|
1017
1176
|
pinch: a
|
|
1018
|
-
}), this.#
|
|
1177
|
+
}), this.#Ue(), this.#Mt(), this.#Nt(), this.#jt(), this.#ct(), this.#Ht(), this.#xe = this.#Gt(), await this.#$t(), this.#zt(), this.#cn(), this.#fn(), this.#qt(), this.#Wt(), await this.#Ut(), this.#n.emit("ready"), this.#ht(), this.#pt();
|
|
1019
1178
|
}
|
|
1020
|
-
#
|
|
1021
|
-
this.#
|
|
1179
|
+
#It(e) {
|
|
1180
|
+
this.#je = e, this.#n.emit("progress", e), this.#Ae?.update(e);
|
|
1022
1181
|
}
|
|
1023
|
-
async #
|
|
1024
|
-
if (this.#
|
|
1182
|
+
async #Lt() {
|
|
1183
|
+
if (this.#ke === !1 || this.#te) return;
|
|
1025
1184
|
let e = this.#e;
|
|
1026
1185
|
if (!(!e.ownerDocument || typeof e.appendChild != "function")) try {
|
|
1027
|
-
let { mountLoading: t } = await import("./loading-
|
|
1028
|
-
if (this.#
|
|
1029
|
-
this.#
|
|
1186
|
+
let { mountLoading: t } = await import("./loading-DF88K9yJ.js");
|
|
1187
|
+
if (this.#Me === "done" || this.#te) return;
|
|
1188
|
+
this.#Ae = t(e), this.#je && this.#Ae.update(this.#je), this.#Me === "preparing" && this.#Ae.preparing();
|
|
1030
1189
|
} catch {}
|
|
1031
1190
|
}
|
|
1032
|
-
#
|
|
1033
|
-
this.#
|
|
1191
|
+
#Rt(e) {
|
|
1192
|
+
this.#Me !== "done" && (this.#Me = e, this.#Ae?.preparing());
|
|
1034
1193
|
}
|
|
1035
|
-
#
|
|
1036
|
-
this.#
|
|
1194
|
+
#zt() {
|
|
1195
|
+
this.#Me = "done", this.#Ae?.destroy(), this.#Ae = null;
|
|
1037
1196
|
}
|
|
1038
|
-
async #
|
|
1197
|
+
async #Bt(e) {
|
|
1039
1198
|
try {
|
|
1040
1199
|
return await e.mount(this.#e), e.onFatal?.(() => {
|
|
1041
|
-
this.#
|
|
1200
|
+
this.#Vt();
|
|
1042
1201
|
}), e;
|
|
1043
1202
|
} catch {
|
|
1044
1203
|
e.destroy();
|
|
1045
|
-
let t = await
|
|
1046
|
-
return await t.mount(this.#e), this.#
|
|
1204
|
+
let t = await E("css");
|
|
1205
|
+
return await t.mount(this.#e), this.#ee = !0, this.#n.emit("rendererFallback", {
|
|
1047
1206
|
from: "webgl2",
|
|
1048
1207
|
to: "css"
|
|
1049
1208
|
}), t;
|
|
1050
1209
|
}
|
|
1051
1210
|
}
|
|
1052
|
-
async #
|
|
1053
|
-
if (this.#
|
|
1054
|
-
this.#
|
|
1055
|
-
let e = await
|
|
1056
|
-
if (this.#
|
|
1211
|
+
async #Vt() {
|
|
1212
|
+
if (this.#ee || this.#te) return;
|
|
1213
|
+
this.#ee = !0, this.#$?.destroy(), this.#$ = null;
|
|
1214
|
+
let e = await E("css");
|
|
1215
|
+
if (this.#te) {
|
|
1057
1216
|
e.destroy();
|
|
1058
1217
|
return;
|
|
1059
1218
|
}
|
|
1060
|
-
await e.mount(this.#e), this
|
|
1219
|
+
await e.mount(this.#e), this.#$ = e, this.#Zt(e.measure().containerWidth), await this.#$t(), this.#n.emit("rendererFallback", {
|
|
1061
1220
|
from: "webgl2",
|
|
1062
1221
|
to: "css"
|
|
1063
1222
|
});
|
|
1064
1223
|
}
|
|
1065
|
-
#
|
|
1224
|
+
#Ht() {
|
|
1066
1225
|
if (typeof matchMedia != "function") return;
|
|
1067
1226
|
let e = matchMedia("(prefers-reduced-motion: reduce)");
|
|
1068
|
-
this
|
|
1069
|
-
this
|
|
1227
|
+
this.#pe = e.matches, e.addEventListener?.("change", (e) => {
|
|
1228
|
+
this.#pe = e.matches;
|
|
1070
1229
|
});
|
|
1071
1230
|
}
|
|
1072
|
-
async #
|
|
1073
|
-
|
|
1074
|
-
|
|
1075
|
-
|
|
1076
|
-
|
|
1077
|
-
|
|
1078
|
-
|
|
1079
|
-
|
|
1231
|
+
async #Ut() {
|
|
1232
|
+
let e = this.#we !== !1, t = this.#Ee !== !1;
|
|
1233
|
+
if (!e && !t || this.#te) return;
|
|
1234
|
+
let n = this.#e;
|
|
1235
|
+
if (!(!n.ownerDocument || typeof n.appendChild != "function")) try {
|
|
1236
|
+
let { mountControls: e, mountContextMenu: t } = await import("./controls-CcOu_19g.js");
|
|
1237
|
+
if (this.#te) return;
|
|
1238
|
+
if (this.#we !== !1) {
|
|
1239
|
+
let t = this.#we === !0 ? {} : this.#we;
|
|
1240
|
+
this.#Te = e(this, n, t, this.#Oe);
|
|
1241
|
+
}
|
|
1242
|
+
if (this.#Ee !== !1) {
|
|
1243
|
+
let e = this.#Ee === !0 ? {} : this.#Ee;
|
|
1244
|
+
this.#De = t(this, n, e, this.#Oe);
|
|
1245
|
+
}
|
|
1080
1246
|
} catch {}
|
|
1081
1247
|
}
|
|
1082
|
-
#
|
|
1083
|
-
if (!this.#
|
|
1248
|
+
#Wt() {
|
|
1249
|
+
if (!this.#F || globalThis.location === void 0) return;
|
|
1084
1250
|
let e = globalThis;
|
|
1085
|
-
this.#
|
|
1086
|
-
e !== this.#
|
|
1087
|
-
}), this.#
|
|
1088
|
-
this.#
|
|
1251
|
+
this.#L = C(e, (e) => {
|
|
1252
|
+
e !== this.#V && this.flipTo(e);
|
|
1253
|
+
}), this.#L.push(this.#V), this.#R = this.#n.on("pageChanged", ({ page: e }) => {
|
|
1254
|
+
this.#L?.push(e);
|
|
1089
1255
|
});
|
|
1090
1256
|
}
|
|
1091
|
-
pageLink(e = this.#
|
|
1257
|
+
pageLink(e = this.#V) {
|
|
1092
1258
|
let t = globalThis.location?.href ?? "";
|
|
1093
1259
|
if (!t) return "";
|
|
1094
1260
|
let n = new URL(t);
|
|
1095
|
-
return n.hash =
|
|
1261
|
+
return n.hash = S(n.hash, Y(e, 0, Math.max(0, this.#t.pageCount - 1))), n.toString();
|
|
1096
1262
|
}
|
|
1097
|
-
#
|
|
1263
|
+
#Gt() {
|
|
1098
1264
|
let e = this.#e, t = e.ownerDocument;
|
|
1099
1265
|
if (!t || typeof e.setAttribute != "function") return null;
|
|
1100
1266
|
e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription", "flipbook");
|
|
1101
|
-
let n = (e) => this.#
|
|
1267
|
+
let n = (e) => this.#Kt(e);
|
|
1102
1268
|
e.addEventListener("keydown", n);
|
|
1103
1269
|
let r = t.createElement("div");
|
|
1104
|
-
return r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", e.appendChild(r), this.#
|
|
1105
|
-
e.removeEventListener("keydown", n), r.remove(), this.#
|
|
1270
|
+
return r.setAttribute("aria-live", "polite"), r.setAttribute("aria-atomic", "true"), r.style.cssText = "position:absolute;width:1px;height:1px;margin:-1px;padding:0;overflow:hidden;clip:rect(0 0 0 0);white-space:nowrap;border:0;", e.appendChild(r), this.#me = r, () => {
|
|
1271
|
+
e.removeEventListener("keydown", n), r.remove(), this.#me = null;
|
|
1106
1272
|
};
|
|
1107
1273
|
}
|
|
1108
|
-
#
|
|
1274
|
+
#Kt(e) {
|
|
1109
1275
|
let t = this.#a === "rtl" ? "ArrowLeft" : "ArrowRight";
|
|
1110
1276
|
switch (e.key) {
|
|
1111
1277
|
case "ArrowRight":
|
|
@@ -1121,92 +1287,98 @@ var J = class {
|
|
|
1121
1287
|
default: break;
|
|
1122
1288
|
}
|
|
1123
1289
|
}
|
|
1124
|
-
#
|
|
1125
|
-
this.#
|
|
1290
|
+
#qt() {
|
|
1291
|
+
this.#me && (this.#me.textContent = `Page ${this.#V + 1} of ${this.#t.pageCount}`);
|
|
1126
1292
|
}
|
|
1127
|
-
#
|
|
1128
|
-
return this
|
|
1293
|
+
#Jt() {
|
|
1294
|
+
return this.#pe ? B : this.#U * (this.#k ? F : 1);
|
|
1129
1295
|
}
|
|
1130
|
-
#
|
|
1131
|
-
return this
|
|
1296
|
+
#Yt() {
|
|
1297
|
+
return this.#pe ? "simple" : this.#c;
|
|
1132
1298
|
}
|
|
1133
1299
|
update() {
|
|
1134
|
-
!this
|
|
1300
|
+
!this.#$ || this.#i.state !== "idle" || (this.#Zt(this.#$.measure().containerWidth), this.#$t(), this.#lt());
|
|
1135
1301
|
}
|
|
1136
|
-
#
|
|
1137
|
-
return this.#
|
|
1302
|
+
#Xt() {
|
|
1303
|
+
return this.#j || this.#o === "single" ? "single" : this.#o;
|
|
1138
1304
|
}
|
|
1139
|
-
#
|
|
1140
|
-
let t = this.#
|
|
1141
|
-
t !== this.#
|
|
1305
|
+
#Zt(e) {
|
|
1306
|
+
let t = this.#M && o(e, this.#O);
|
|
1307
|
+
t !== this.#j && (this.#j = t, this.#Qt());
|
|
1142
1308
|
}
|
|
1143
|
-
#
|
|
1144
|
-
let e = this.#
|
|
1145
|
-
this.#
|
|
1309
|
+
#Qt() {
|
|
1310
|
+
let e = this.#Xt(), t = e !== this.#A;
|
|
1311
|
+
this.#A = e, this.#k = e === "single", this.#z = a(this.#t.pageCount, {
|
|
1146
1312
|
direction: this.#a,
|
|
1147
1313
|
mode: e
|
|
1148
|
-
}), this.#
|
|
1314
|
+
}), this.#B = this.#pn(this.#V), t && this.#n.emit("spreadChanged", {
|
|
1149
1315
|
mode: e,
|
|
1150
|
-
singlePage: this.#
|
|
1316
|
+
singlePage: this.#k
|
|
1151
1317
|
});
|
|
1152
1318
|
}
|
|
1153
|
-
async
|
|
1154
|
-
let e = this.#
|
|
1155
|
-
!e || !this
|
|
1319
|
+
async #$t() {
|
|
1320
|
+
let e = this.#z[this.#B];
|
|
1321
|
+
!e || !this.#$ || (this.#H = await this.#un(e), this.#en(e, this.#H));
|
|
1156
1322
|
}
|
|
1157
|
-
#
|
|
1158
|
-
this
|
|
1323
|
+
#en(e, t) {
|
|
1324
|
+
this.#$?.renderSpread(e, t, { fill: this.#k }), this.#tn(), this.#Ne = 1, this.#rn();
|
|
1159
1325
|
}
|
|
1160
|
-
#
|
|
1161
|
-
let e = this
|
|
1326
|
+
#tn() {
|
|
1327
|
+
let e = this.#$?.measure().book;
|
|
1162
1328
|
if (!e || e.width <= 0 || e.height <= 0) return;
|
|
1163
1329
|
let t = (e.width / e.height).toFixed(4);
|
|
1164
|
-
t !== this.#
|
|
1330
|
+
t !== this.#N && (this.#N = t, this.#e.style.aspectRatio = t);
|
|
1165
1331
|
}
|
|
1166
|
-
#
|
|
1332
|
+
#nn(e) {
|
|
1167
1333
|
if (this.#i.state !== "idle") {
|
|
1168
|
-
this.#
|
|
1334
|
+
this.#Ce.add(e);
|
|
1169
1335
|
return;
|
|
1170
1336
|
}
|
|
1171
|
-
let t = this.#
|
|
1172
|
-
t
|
|
1337
|
+
let t = this.#z[this.#B];
|
|
1338
|
+
if (!(!t || !(t.left === e || t.right === e))) {
|
|
1339
|
+
if (this.#X > 1) {
|
|
1340
|
+
this.#rn();
|
|
1341
|
+
return;
|
|
1342
|
+
}
|
|
1343
|
+
this.#$t();
|
|
1344
|
+
}
|
|
1173
1345
|
}
|
|
1174
|
-
#
|
|
1175
|
-
this.#
|
|
1176
|
-
let e = this.#
|
|
1177
|
-
if (e !== this.#
|
|
1346
|
+
#rn() {
|
|
1347
|
+
this.#Fe !== null && clearTimeout(this.#Fe);
|
|
1348
|
+
let e = this.#an();
|
|
1349
|
+
if (e !== this.#Ne) {
|
|
1178
1350
|
if (e === 1) {
|
|
1179
|
-
this.#
|
|
1351
|
+
this.#Pe++, this.#Ne = 1, this.#$t();
|
|
1180
1352
|
return;
|
|
1181
1353
|
}
|
|
1182
|
-
this.#
|
|
1183
|
-
this.#
|
|
1184
|
-
},
|
|
1354
|
+
this.#Fe = setTimeout(() => {
|
|
1355
|
+
this.#Fe = null, this.#on();
|
|
1356
|
+
}, L);
|
|
1185
1357
|
}
|
|
1186
1358
|
}
|
|
1187
|
-
#
|
|
1188
|
-
let e = this
|
|
1359
|
+
#in() {
|
|
1360
|
+
let e = this.#$?.measure(), t = e?.content ?? e?.book;
|
|
1189
1361
|
if (!t || t.width <= 0) return 1;
|
|
1190
|
-
let n = this.#
|
|
1362
|
+
let n = this.#H, r = +!!n.left + +!!n.right;
|
|
1191
1363
|
if (r === 0) return 1;
|
|
1192
1364
|
let i = t.width / r, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = 0;
|
|
1193
1365
|
for (let e of [n.left, n.right]) {
|
|
1194
1366
|
if (!e || e.width <= 0) continue;
|
|
1195
|
-
let t = e.width / this.#
|
|
1367
|
+
let t = e.width / this.#Ne;
|
|
1196
1368
|
o = Math.max(o, i * a / t);
|
|
1197
1369
|
}
|
|
1198
1370
|
return o === 0 ? 1 : o;
|
|
1199
1371
|
}
|
|
1200
|
-
#
|
|
1201
|
-
let e = Math.max(1,
|
|
1202
|
-
return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2,
|
|
1203
|
-
}
|
|
1204
|
-
async #
|
|
1205
|
-
let e = this.#
|
|
1206
|
-
if (!this
|
|
1207
|
-
let t = this.#
|
|
1208
|
-
if (t === 1 || t === this.#
|
|
1209
|
-
let n = ++this.#
|
|
1372
|
+
#an() {
|
|
1373
|
+
let e = Math.max(1, z / (typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1)), t = this.#X <= 1 ? 1 : this.#X, n = this.#in() * Math.max(t, e);
|
|
1374
|
+
return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2, R);
|
|
1375
|
+
}
|
|
1376
|
+
async #on() {
|
|
1377
|
+
let e = this.#z[this.#B];
|
|
1378
|
+
if (!this.#$ || !e) return;
|
|
1379
|
+
let t = this.#an();
|
|
1380
|
+
if (t === 1 || t === this.#Ne || this.#i.state !== "idle") return;
|
|
1381
|
+
let n = ++this.#Pe, r = {
|
|
1210
1382
|
x: 0,
|
|
1211
1383
|
y: 0,
|
|
1212
1384
|
width: 1,
|
|
@@ -1216,7 +1388,8 @@ var J = class {
|
|
|
1216
1388
|
try {
|
|
1217
1389
|
return await this.#t.get(e, {
|
|
1218
1390
|
scale: t,
|
|
1219
|
-
region: r
|
|
1391
|
+
region: r,
|
|
1392
|
+
maxSize: this.#$?.maxTextureSize
|
|
1220
1393
|
});
|
|
1221
1394
|
} catch (t) {
|
|
1222
1395
|
return this.#n.emit("sourceError", {
|
|
@@ -1225,34 +1398,34 @@ var J = class {
|
|
|
1225
1398
|
}), null;
|
|
1226
1399
|
}
|
|
1227
1400
|
}));
|
|
1228
|
-
if (n !== this.#
|
|
1229
|
-
let a = i[0] ??
|
|
1230
|
-
a === this.#
|
|
1401
|
+
if (n !== this.#Pe || this.#an() !== t || this.#i.state !== "idle") return;
|
|
1402
|
+
let a = i[0] ?? this.#H.left, o = i[1] ?? this.#H.right;
|
|
1403
|
+
a === this.#H.left && o === this.#H.right || (this.#Ne = t, this.#H = {
|
|
1231
1404
|
left: a,
|
|
1232
1405
|
right: o
|
|
1233
|
-
}, this
|
|
1406
|
+
}, this.#$.renderSpread(e, this.#H, { fill: this.#k }));
|
|
1234
1407
|
}
|
|
1235
|
-
#
|
|
1236
|
-
if (this.#
|
|
1237
|
-
let e = this.#
|
|
1238
|
-
this.#
|
|
1408
|
+
#sn() {
|
|
1409
|
+
if (this.#Ce.size === 0) return;
|
|
1410
|
+
let e = this.#z[this.#B], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#Ce.has(e));
|
|
1411
|
+
this.#Ce.clear(), t && (this.#X > 1 ? this.#rn() : this.#$t());
|
|
1239
1412
|
}
|
|
1240
|
-
#
|
|
1241
|
-
typeof ResizeObserver > "u" || (this.#
|
|
1413
|
+
#cn() {
|
|
1414
|
+
typeof ResizeObserver > "u" || (this.#J = new ResizeObserver(() => this.#ln()), this.#J.observe(this.#e));
|
|
1242
1415
|
}
|
|
1243
|
-
#
|
|
1244
|
-
this.#
|
|
1245
|
-
this.#
|
|
1416
|
+
#ln() {
|
|
1417
|
+
this.#Y || (this.#Y = !0, requestAnimationFrame(() => {
|
|
1418
|
+
this.#Y = !1, this.update();
|
|
1246
1419
|
}));
|
|
1247
1420
|
}
|
|
1248
|
-
async #
|
|
1249
|
-
let [t, n] = await Promise.all([this.#
|
|
1421
|
+
async #un(e) {
|
|
1422
|
+
let [t, n] = await Promise.all([this.#dn(e.left), this.#dn(e.right)]);
|
|
1250
1423
|
return {
|
|
1251
1424
|
left: t,
|
|
1252
1425
|
right: n
|
|
1253
1426
|
};
|
|
1254
1427
|
}
|
|
1255
|
-
async #
|
|
1428
|
+
async #dn(e) {
|
|
1256
1429
|
if (e === null) return null;
|
|
1257
1430
|
try {
|
|
1258
1431
|
return await this.#t.get(e);
|
|
@@ -1263,30 +1436,30 @@ var J = class {
|
|
|
1263
1436
|
}), null;
|
|
1264
1437
|
}
|
|
1265
1438
|
}
|
|
1266
|
-
#
|
|
1267
|
-
let { toMount: e } = this.#r.update(this.#
|
|
1439
|
+
#fn() {
|
|
1440
|
+
let { toMount: e } = this.#r.update(this.#B, this.#z.length), t = [];
|
|
1268
1441
|
for (let n of e) {
|
|
1269
|
-
let e = this.#
|
|
1442
|
+
let e = this.#z[n];
|
|
1270
1443
|
e?.left != null && t.push(e.left), e?.right != null && t.push(e.right);
|
|
1271
1444
|
}
|
|
1272
1445
|
this.#t.prefetch(t);
|
|
1273
1446
|
}
|
|
1274
|
-
#
|
|
1275
|
-
let t = this.#
|
|
1447
|
+
#pn(e) {
|
|
1448
|
+
let t = this.#z.findIndex((t) => t.left === e || t.right === e);
|
|
1276
1449
|
return t === -1 ? 0 : t;
|
|
1277
1450
|
}
|
|
1278
|
-
#
|
|
1451
|
+
#mn() {
|
|
1279
1452
|
let e = this.#t.pageCount;
|
|
1280
1453
|
if (!Number.isInteger(e) || e < 1) throw Error(`Zine: source has ${e} pages; a Source must have at least 1 page.`);
|
|
1281
|
-
let t = this.#
|
|
1454
|
+
let t = this.#P;
|
|
1282
1455
|
if (t !== void 0 && (!Number.isInteger(t) || t < 0 || t >= e)) throw Error(`Zine: startPage ${JSON.stringify(t)} is out of range for a ${e}-page book (valid 0..${e - 1}).`);
|
|
1283
|
-
let n = this.#
|
|
1284
|
-
this.#
|
|
1456
|
+
let n = this.#Xt();
|
|
1457
|
+
this.#k = n === "single", this.#z = a(e, {
|
|
1285
1458
|
direction: this.#a,
|
|
1286
1459
|
mode: n
|
|
1287
1460
|
});
|
|
1288
|
-
let r = this.#
|
|
1289
|
-
this.#
|
|
1461
|
+
let r = this.#F ? x(globalThis.location?.hash ?? "") : null;
|
|
1462
|
+
this.#V = Y(r ?? t ?? 0, 0, e - 1), this.#B = this.#pn(this.#V);
|
|
1290
1463
|
}
|
|
1291
1464
|
};
|
|
1292
1465
|
function Y(e, t, n) {
|
|
@@ -1302,13 +1475,10 @@ function X(e, t, n) {
|
|
|
1302
1475
|
function Z(e) {
|
|
1303
1476
|
return e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2;
|
|
1304
1477
|
}
|
|
1305
|
-
function ne(e) {
|
|
1306
|
-
return 1 - (1 - Z(e)) ** 1.3;
|
|
1307
|
-
}
|
|
1308
1478
|
function Q(e) {
|
|
1309
1479
|
return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
|
|
1310
1480
|
}
|
|
1311
|
-
function
|
|
1481
|
+
function le(n, r) {
|
|
1312
1482
|
if (typeof n != "object" || !n || typeof n.appendChild != "function" || typeof n.addEventListener != "function") throw Error(`Zine: container must be a DOM element; received ${Q(n)}.`);
|
|
1313
1483
|
if (typeof r != "object" || !r) throw Error("Zine: an options object with a `source` is required.");
|
|
1314
1484
|
let i = r, a = i.source;
|
|
@@ -1353,25 +1523,36 @@ function re(n, r) {
|
|
|
1353
1523
|
].includes(f)) throw Error(`Zine: controls.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(f)}.`);
|
|
1354
1524
|
let p = u?.arrows;
|
|
1355
1525
|
if (p !== void 0 && typeof p != "boolean" && !["desktop", "mobile"].includes(p)) throw Error(`Zine: controls.arrows must be a boolean, 'desktop', or 'mobile'; got ${JSON.stringify(p)}.`);
|
|
1356
|
-
let m = i.
|
|
1357
|
-
if (m !== void 0 && !
|
|
1526
|
+
let m = i.contextMenu;
|
|
1527
|
+
if (m !== void 0 && typeof m != "boolean" && (typeof m != "object" || !m)) throw Error(`Zine: contextMenu must be a boolean or an options object; got ${Q(m)}.`);
|
|
1528
|
+
let h = m?.colorScheme;
|
|
1529
|
+
if (h !== void 0 && ![
|
|
1530
|
+
"light",
|
|
1531
|
+
"dark",
|
|
1532
|
+
"auto"
|
|
1533
|
+
].includes(h)) throw Error(`Zine: contextMenu.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(h)}.`);
|
|
1534
|
+
if (i.disableContextMenu === !0 && m !== void 0 && m !== !1) throw Error("Zine: disableContextMenu and contextMenu are mutually exclusive — one removes the browser's right-click menu, the other replaces it. Enable only one.");
|
|
1535
|
+
let g = i.hideControls;
|
|
1536
|
+
if (g !== void 0 && (!Array.isArray(g) || g.some((e) => typeof e != "string"))) throw Error(`Zine: hideControls must be an array of control-id strings; got ${Q(g)}.`);
|
|
1537
|
+
let _ = i.spreadMode;
|
|
1538
|
+
if (_ !== void 0 && ![
|
|
1358
1539
|
"double",
|
|
1359
1540
|
"single",
|
|
1360
1541
|
"cover",
|
|
1361
1542
|
"book"
|
|
1362
|
-
].includes(
|
|
1543
|
+
].includes(_)) throw Error(`Zine: spreadMode must be 'double', 'single', 'cover', or 'book'; got ${JSON.stringify(_)}.`);
|
|
1363
1544
|
for (let e of ["frontCover", "backCover"]) {
|
|
1364
1545
|
let t = i[e];
|
|
1365
1546
|
if (t !== void 0 && typeof t != "string") throw Error(`Zine: ${e} must be an image URL string; got ${JSON.stringify(t)}.`);
|
|
1366
1547
|
}
|
|
1367
|
-
let
|
|
1368
|
-
if (
|
|
1369
|
-
$(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0),
|
|
1548
|
+
let v = i.pages;
|
|
1549
|
+
if (v !== void 0 && (typeof v != "object" || !v || Array.isArray(v))) throw Error("Zine: pages must be an object mapping page indices to image URLs.");
|
|
1550
|
+
$(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), ue(i.zoom), de(i.renderer);
|
|
1370
1551
|
}
|
|
1371
1552
|
function $(e, t, n) {
|
|
1372
1553
|
if (e !== void 0 && (typeof e != "number" || !Number.isFinite(e) || e < n)) throw Error(`Zine: ${t} must be a number >= ${n}; got ${JSON.stringify(e)}.`);
|
|
1373
1554
|
}
|
|
1374
|
-
function
|
|
1555
|
+
function ue(e) {
|
|
1375
1556
|
if (e === void 0) return;
|
|
1376
1557
|
if (typeof e != "object" || !e || Array.isArray(e)) throw Error("Zine: zoom must be an object, e.g. { max: 4 }.");
|
|
1377
1558
|
let t = e;
|
|
@@ -1384,7 +1565,7 @@ function ie(e) {
|
|
|
1384
1565
|
}
|
|
1385
1566
|
$(t.max, "zoom.max", 1);
|
|
1386
1567
|
}
|
|
1387
|
-
function
|
|
1568
|
+
function de(e) {
|
|
1388
1569
|
if (e !== void 0) {
|
|
1389
1570
|
if (typeof e == "string") {
|
|
1390
1571
|
if (e !== "auto" && e !== "css" && e !== "webgl2") throw Error(`Zine: renderer '${e}' is not recognized; use 'auto', 'css', 'webgl2', an array of those, or a custom Renderer.`);
|
|
@@ -1399,7 +1580,7 @@ function ae(e) {
|
|
|
1399
1580
|
}
|
|
1400
1581
|
//#endregion
|
|
1401
1582
|
//#region src/source/imageSource.ts
|
|
1402
|
-
var
|
|
1583
|
+
var fe = class {
|
|
1403
1584
|
pageCount;
|
|
1404
1585
|
fit;
|
|
1405
1586
|
#e;
|
|
@@ -1436,6 +1617,6 @@ var oe = class {
|
|
|
1436
1617
|
}
|
|
1437
1618
|
};
|
|
1438
1619
|
//#endregion
|
|
1439
|
-
export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS,
|
|
1620
|
+
export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, fe as ImageSource, ce as Zine, n as defineControl, r as getControl };
|
|
1440
1621
|
|
|
1441
1622
|
//# sourceMappingURL=index.js.map
|