@zinejs/core 0.9.1 → 0.9.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -281,28 +281,28 @@ function ee(e, t) {
281
281
  //#endregion
282
282
  //#region src/renderer/select.ts
283
283
  var te = {
284
- css: async () => new (await (import("./cssRenderer-Deskm2ND.js"))).CssRenderer(),
285
- webgl2: async () => new (await (import("./webglRenderer-CmQ_mUrX.js"))).WebglRenderer()
286
- }, ne = !0;
287
- function w(e) {
288
- return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
289
- }
284
+ css: async () => new (await (import("./cssRenderer-CTaM4cAj.js"))).CssRenderer(),
285
+ webgl2: async () => new (await (import("./webglRenderer-DQn4pc1S.js"))).WebglRenderer()
286
+ }, w = !0;
290
287
  function T(e) {
291
- return e.gpu && ne ? ["webgl2", "css"] : ["css"];
288
+ return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
292
289
  }
293
- function E() {
294
- return { gpu: D() };
290
+ function E(e) {
291
+ return e.gpu && w ? ["webgl2", "css"] : ["css"];
295
292
  }
296
293
  function D() {
294
+ return { gpu: ne() };
295
+ }
296
+ function ne() {
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 O(e = "auto", t = E()) {
304
- if (w(e)) return e;
305
- let n = Array.isArray(e) ? e : e === "auto" ? T(t) : [e];
303
+ async function O(e = "auto", t = D()) {
304
+ if (T(e)) return e;
305
+ let n = Array.isArray(e) ? e : e === "auto" ? E(t) : [e];
306
306
  for (let e of n) {
307
307
  if (e === "webgl2" && !t.gpu) continue;
308
308
  let n = te[e];
@@ -395,12 +395,81 @@ var ae = class {
395
395
  throw this.#a.delete(e), t;
396
396
  }), this.#a.set(e, t)), t;
397
397
  }
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, U = .12, oe = 360, W = 28, G = 260, K = 7e3, q = 2200, J = "zine:hints-learned", Y = "zine:sound-muted";
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();
398
+ }, k = {
399
+ prevPage: "Previous page",
400
+ nextPage: "Next page",
401
+ firstPage: "First page",
402
+ lastPage: "Last page",
403
+ zoomIn: "Zoom in",
404
+ zoomOut: "Zoom out",
405
+ fullscreen: "Fullscreen",
406
+ mute: "Mute page sound",
407
+ unmute: "Unmute page sound",
408
+ share: "Share",
409
+ downloadPdf: "Download PDF",
410
+ showOnePage: "Show one page",
411
+ showTwoPages: "Show two pages",
412
+ print: "Print",
413
+ more: "More",
414
+ controlsLabel: "Flipbook controls",
415
+ showThumbnails: "Show thumbnails",
416
+ hideThumbnails: "Hide thumbnails",
417
+ showOutline: "Show outline",
418
+ hideOutline: "Hide outline",
419
+ searchOpen: "Search",
420
+ searchClose: "Hide search",
421
+ pageWidgetLabel: "Page",
422
+ pageNumberLabel: "Page number",
423
+ roledescription: "flipbook",
424
+ thumbnailsLabel: "Pages",
425
+ outlineLabel: "Outline",
426
+ outlineLoading: "Loading…",
427
+ outlineEmpty: "This document has no outline.",
428
+ untitled: "Untitled",
429
+ searchResultsLabel: "Search results",
430
+ searchPlaceholder: "Search…",
431
+ searchInputLabel: "Search the document",
432
+ searching: "Searching…",
433
+ loadingOpening: "Opening document…",
434
+ loadingPreparing: "Preparing pages…",
435
+ shareFallbackTitle: "Flipbook",
436
+ close: "Close",
437
+ copy: "Copy",
438
+ copied: "Copied",
439
+ copyManual: "Press Ctrl+C",
440
+ qrLabel: "QR code for this page",
441
+ linkLabel: "Link to this page",
442
+ email: "Email",
443
+ panHint: "Drag to move",
444
+ pageAnnounce: (e, t) => `Page ${e} of ${t}`,
445
+ pageTotal: (e) => `/ ${e}`,
446
+ downloadingPercent: (e) => `Downloading document… ${e}%`,
447
+ downloadingSize: (e) => `Downloading document… ${e.toFixed(1)} MB`,
448
+ zoomHint: ({ doubleClick: e, wheel: t, mac: n }) => {
449
+ let r = [];
450
+ return e && r.push("Double-click"), t && r.push(`${n ? "⌘" : "Ctrl"}-scroll`), `${r.join(" or ")} to zoom`;
451
+ },
452
+ noMatches: (e) => `No matches for “${e}”`,
453
+ searchHitLabel: (e) => `Page ${e}`,
454
+ searchHitAria: (e, t) => `Page ${e}: ${t}`,
455
+ shareOn: (e) => `Share on ${e}`,
456
+ thumbnailAria: (e) => e.length > 1 ? `Pages ${e[0]}–${e.at(-1)}` : `Page ${e[0] ?? ""}`,
457
+ outlineEntryAria: (e, t) => `${e}, page ${t}`
458
+ };
459
+ function oe(e) {
460
+ return e ? {
461
+ ...k,
462
+ ...e
463
+ } : k;
464
+ }
465
+ //#endregion
466
+ //#region src/zine.ts
467
+ var A = .25, j = .0015, M = 6, N = 250, P = 24, F = 2 * N, I = 1.2, L = 32, R = 60, z = 2.5, B = 1.5, V = 120, H = .85, U = .82, W = .12, G = 360, se = 28, K = 260, ce = 7e3, le = 2200, q = "zine:hints-learned", J = "zine:sound-muted";
468
+ function ue(e, t, n) {
469
+ let r = Math.max(0, t - L), i = Math.min(e.length, t + n + L), a = e.slice(r, i).replace(/\s+/g, " ").trim();
401
470
  return `${r > 0 ? "…" : ""}${a}${i < e.length ? "…" : ""}`;
402
471
  }
403
- var ce = class {
472
+ var Y = class {
404
473
  #e;
405
474
  #t;
406
475
  #n = new l();
@@ -414,141 +483,143 @@ var ce = class {
414
483
  #u;
415
484
  #d;
416
485
  #f;
417
- #p = null;
418
- #m = null;
419
- #h;
420
- #g;
486
+ #p;
487
+ #m;
488
+ #h = null;
489
+ #g = null;
421
490
  #_;
422
491
  #v;
423
- #y = null;
424
- #b = !1;
425
- #x = !1;
492
+ #y;
493
+ #b;
494
+ #x = null;
426
495
  #S = !1;
427
- #C = {
496
+ #C = !1;
497
+ #w = !1;
498
+ #T = {
428
499
  turn: !1,
429
500
  zoom: !1,
430
501
  pan: !1
431
502
  };
432
- #w = null;
433
- #T = null;
434
503
  #E = null;
435
504
  #D = null;
436
505
  #O = null;
437
506
  #k = null;
438
- #A = !1;
439
- #j = "";
440
- #M;
441
- #N;
507
+ #A = null;
508
+ #j = null;
509
+ #M = !1;
510
+ #N = "";
442
511
  #P;
443
- #F = !1;
444
- #I = null;
512
+ #F;
513
+ #I;
445
514
  #L = !1;
446
- #R;
447
- #z = null;
515
+ #R = null;
516
+ #z = !1;
448
517
  #B;
449
- #V;
518
+ #V = null;
450
519
  #H;
451
- #U = null;
452
- #W = null;
453
- #G = [];
454
- #K = 0;
455
- #q = 0;
456
- #J = {
520
+ #U;
521
+ #W;
522
+ #G = null;
523
+ #K = null;
524
+ #q = [];
525
+ #J = 0;
526
+ #Y = 0;
527
+ #X = {
457
528
  left: null,
458
529
  right: null
459
530
  };
460
- #Y;
461
- #X;
462
531
  #Z;
463
532
  #Q;
464
533
  #$;
465
- #ee = null;
466
- #te = !1;
467
- #ne = 1;
468
- #re = 0;
469
- #ie = 0;
470
- #ae = null;
471
- #oe = !1;
472
- #se = !1;
473
- #ce = null;
474
- #le = null;
534
+ #ee;
535
+ #te;
536
+ #ne = null;
537
+ #re = !1;
538
+ #ie = 1;
539
+ #ae = 0;
540
+ #oe = 0;
541
+ #se = null;
542
+ #ce = !1;
543
+ #le = !1;
475
544
  #ue = null;
476
545
  #de = null;
477
546
  #fe = null;
478
547
  #pe = null;
479
548
  #me = null;
480
- #he = 0;
549
+ #he = null;
481
550
  #ge = null;
482
- #_e = !1;
483
- #ve = 1;
551
+ #_e = 0;
552
+ #ve = null;
484
553
  #ye = !1;
485
- #be = null;
486
- #xe = null;
554
+ #be = 1;
555
+ #xe = !1;
487
556
  #Se = null;
488
557
  #Ce = null;
489
558
  #we = null;
490
559
  #Te = null;
491
- #Ee = -Infinity;
560
+ #Ee = null;
492
561
  #De = null;
493
- #Oe = null;
494
- #ke = /* @__PURE__ */ new Set();
495
- #Ae;
496
- #je = null;
562
+ #Oe = -Infinity;
563
+ #ke = null;
564
+ #Ae = null;
565
+ #je = /* @__PURE__ */ new Set();
497
566
  #Me;
498
567
  #Ne = null;
499
568
  #Pe;
500
- #Fe;
501
- #Ie = null;
502
- #Le = null;
503
- #Re = "download";
504
- #ze = 1;
505
- #Be = 0;
506
- #Ve = null;
507
- #He;
569
+ #Fe = null;
570
+ #Ie;
571
+ #Le;
572
+ #Re = null;
573
+ #ze = null;
574
+ #Be = "download";
575
+ #Ve = 1;
576
+ #He = 0;
577
+ #Ue = null;
578
+ #We;
508
579
  debug = { setFlipProgress: (e, t) => {
509
- this.#ae?.setFlipProgress(e, t);
580
+ this.#se?.setFlipProgress(e, t);
510
581
  } };
511
582
  constructor(e, t) {
512
- ue(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 = re(t.source, {
583
+ fe(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 = re(t.source, {
513
584
  frontCover: t.frontCover,
514
585
  backCover: t.backCover,
515
586
  pages: t.pages
516
587
  });
517
588
  let n = t.direction ?? "ltr";
518
- this.#a = n, this.#V = (t.deepLink ?? !0) && b(), this.#H = 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;
589
+ this.#a = n, this.#U = (t.deepLink ?? !0) && b(), this.#W = 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.fit ?? "contain", this.#f = oe(t.strings), this.#p = t.clickZoneSize ?? 64, this.#m = t.cursorHints ?? !0;
519
590
  let r = t.hints ?? !0;
520
- this.#h = r === !0 || r !== !1 && (r.enabled ?? !0), this.#g = r !== !0 && r !== !1 && (r.persist ?? !1), this.#g && this.#yt();
591
+ this.#_ = r === !0 || r !== !1 && (r.enabled ?? !0), this.#v = r !== !0 && r !== !1 && (r.persist ?? !1), this.#v && this.#xt();
521
592
  let i = t.sound ?? !1;
522
- this.#_ = i !== !1, this.#v = i === !0 || i === !1 ? {} : i, this.#b = typeof i == "object" && i ? i.muted ?? !1 : !1, this.#x = typeof i == "object" && i ? i.persist ?? !1 : !1, this.#_ && this.#x && this.#Ye(), this.#P = t.singlePageThreshold ?? 640, this.#R = t.responsiveSpread ?? !0, this.#Ae = t.controls ?? !0, this.#Me = t.contextMenu ?? !t.disableContextMenu, this.#Pe = new Set(t.hideControls ?? []), this.#Fe = t.loading ?? !0, this.#B = t.startPage, typeof this.#t.open != "function" && this.#wn(), this.#Y = t.flipDuration ?? 800, this.#X = t.zoom?.enabled ?? !0, this.#Z = t.zoom?.wheel ?? !0;
593
+ this.#y = i !== !1, this.#b = i === !0 || i === !1 ? {} : i, this.#S = typeof i == "object" && i ? i.muted ?? !1 : !1, this.#C = typeof i == "object" && i ? i.persist ?? !1 : !1, this.#y && this.#C && this.#Ze(), this.#I = t.singlePageThreshold ?? 640, this.#B = t.responsiveSpread ?? !0, this.#Me = t.controls ?? !0, this.#Pe = t.contextMenu ?? !t.disableContextMenu, this.#Ie = new Set(t.hideControls ?? []), this.#Le = t.loading ?? !0, this.#H = t.startPage, typeof this.#t.open != "function" && this.#En(), this.#Z = t.flipDuration ?? 800, this.#Q = t.zoom?.enabled ?? !0, this.#$ = t.zoom?.wheel ?? !0;
523
594
  let a = t.zoom?.doubleClick, o = a === !1 ? [] : [...a ?? [
524
595
  1,
525
596
  2,
526
597
  4
527
598
  ]].sort((e, t) => e - t);
528
- this.#Q = o.length > 0 ? o : null, this.#$ = t.zoom?.max ?? 4;
529
- let s = this.#X && this.#Q !== null, c = t.zoom?.doubleClickInFlipZone ?? this.#u === "half";
530
- this.#M = this.#u !== "off" && s && c && t.clickFlipDelay !== 0, this.#N = this.#M ? t.clickFlipDelay ?? M : 0, this.#He = this.#Ut(t.renderer ?? "auto");
599
+ this.#ee = o.length > 0 ? o : null, this.#te = t.zoom?.max ?? 4;
600
+ let s = this.#Q && this.#ee !== null, c = t.zoom?.doubleClickInFlipZone ?? this.#u === "half";
601
+ this.#P = this.#u !== "off" && s && c && t.clickFlipDelay !== 0, this.#F = this.#P ? t.clickFlipDelay ?? N : 0, this.#We = this.#Gt(t.renderer ?? "auto");
531
602
  }
532
603
  get ready() {
533
- return this.#He;
604
+ return this.#We;
534
605
  }
535
606
  getPageCount() {
536
607
  return this.#t.pageCount;
537
608
  }
538
609
  getPage() {
539
- return this.#q;
610
+ return this.#Y;
540
611
  }
541
612
  get container() {
542
613
  return this.#e;
543
614
  }
544
615
  getPageBox() {
545
- return this.#ae?.measure().book ?? null;
616
+ return this.#se?.measure().book ?? null;
546
617
  }
547
618
  getSpreads() {
548
- return this.#G;
619
+ return this.#q;
549
620
  }
550
621
  getSpreadIndex() {
551
- return this.#K;
622
+ return this.#J;
552
623
  }
553
624
  getDirection() {
554
625
  return this.#a;
@@ -557,44 +628,44 @@ var ce = class {
557
628
  return this.#o;
558
629
  }
559
630
  isSinglePage() {
560
- return this.#F;
631
+ return this.#L;
561
632
  }
562
633
  setSpreadMode(e) {
563
- e !== this.#o && (this.#o = e, this.#L = !1, this.#cn(), this.#ln());
634
+ e !== this.#o && (this.#o = e, this.#z = !1, this.#un(), this.#dn());
564
635
  }
565
636
  toggleSpreadMode() {
566
637
  this.setSpreadMode(this.#o === "single" ? this.#s === "single" ? "double" : this.#s : "single");
567
638
  }
568
639
  getResponsiveSpread() {
569
- return this.#R;
640
+ return this.#B;
570
641
  }
571
642
  isResponsiveSingle() {
572
- return this.#L && this.#o !== "single";
643
+ return this.#z && this.#o !== "single";
573
644
  }
574
645
  setResponsiveSpread(e) {
575
- if (e !== this.#R) {
576
- if (this.#R = e, e) {
577
- let e = this.#ae?.measure().containerWidth;
646
+ if (e !== this.#B) {
647
+ if (this.#B = e, e) {
648
+ let e = this.#se?.measure().containerWidth;
578
649
  if (e === void 0) return;
579
- this.#L = !1, this.#sn(e);
650
+ this.#z = !1, this.#ln(e);
580
651
  } else {
581
- if (!this.#L) return;
582
- this.#L = !1, this.#cn();
652
+ if (!this.#z) return;
653
+ this.#z = !1, this.#un();
583
654
  }
584
- this.#ln();
655
+ this.#dn();
585
656
  }
586
657
  }
587
658
  getPageImage(e) {
588
- return this.#xn(e);
659
+ return this.#Cn(e);
589
660
  }
590
661
  canFlipNext() {
591
- return this.#K + 1 < this.#G.length;
662
+ return this.#J + 1 < this.#q.length;
592
663
  }
593
664
  canFlipPrev() {
594
- return this.#K > 0;
665
+ return this.#J > 0;
595
666
  }
596
667
  getMaxZoom() {
597
- return this.#$;
668
+ return this.#te;
598
669
  }
599
670
  canSearch() {
600
671
  return typeof this.#t.getText == "function";
@@ -611,7 +682,7 @@ var ce = class {
611
682
  async print() {
612
683
  let e = await this.getSourceFile(), t = this.#e.ownerDocument;
613
684
  if (!e || !t) return !1;
614
- let { url: n, revoke: r } = await this.#Ue(e, t), i = t.createElement("iframe");
685
+ let { url: n, revoke: r } = await this.#Ge(e, t), i = t.createElement("iframe");
615
686
  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) => {
616
687
  let a = !1, o = (t) => {
617
688
  a || (a = !0, setTimeout(() => {
@@ -633,11 +704,11 @@ var ce = class {
633
704
  return typeof this.#t.getOutline == "function";
634
705
  }
635
706
  getOutline() {
636
- if (!this.#Oe) {
707
+ if (!this.#Ae) {
637
708
  let e = this.#t.getOutline;
638
- this.#Oe = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
709
+ this.#Ae = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
639
710
  }
640
- return this.#Oe;
711
+ return this.#Ae;
641
712
  }
642
713
  async getSourceFile() {
643
714
  let e = this.#t.getDownload;
@@ -648,11 +719,11 @@ var ce = class {
648
719
  if (!e) return !1;
649
720
  let t = this.#e.ownerDocument;
650
721
  if (!t) return !1;
651
- let { url: n, revoke: r } = await this.#Ue(e, t), i = t.createElement("a");
722
+ let { url: n, revoke: r } = await this.#Ge(e, t), i = t.createElement("a");
652
723
  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;
653
724
  }
654
- async #Ue(e, t) {
655
- if (e.revoke || !this.#We(e.url, t)) return {
725
+ async #Ge(e, t) {
726
+ if (e.revoke || !this.#Ke(e.url, t)) return {
656
727
  url: e.url,
657
728
  revoke: e.revoke ?? !1
658
729
  };
@@ -669,7 +740,7 @@ var ce = class {
669
740
  };
670
741
  }
671
742
  }
672
- #We(e, t) {
743
+ #Ke(e, t) {
673
744
  let n = t.defaultView?.location?.href;
674
745
  if (!n) return !1;
675
746
  try {
@@ -696,82 +767,85 @@ var ce = class {
696
767
  let i = t.toLowerCase().indexOf(r);
697
768
  i < 0 || a.push({
698
769
  page: e,
699
- excerpt: se(t, i, r.length)
770
+ excerpt: ue(t, i, r.length)
700
771
  });
701
772
  }
702
773
  return a;
703
774
  }
704
775
  flipNext() {
705
- this.#Ge(1);
776
+ this.#qe(1);
706
777
  }
707
778
  flipPrev() {
708
- this.#Ge(-1);
779
+ this.#qe(-1);
709
780
  }
710
- #Ge(e) {
711
- this.#Ke(() => this.#$e(this.#K + e));
781
+ #qe(e) {
782
+ this.#Je(() => this.#tt(this.#J + e));
712
783
  }
713
784
  flipTo(e) {
714
785
  let t = X(e, 0, Math.max(0, this.#t.pageCount - 1));
715
- this.#Ke(() => this.#$e(this.#Cn(t)));
786
+ this.#Je(() => this.#tt(this.#Tn(t)));
716
787
  }
717
- #Ke(e) {
718
- this.#i.state === "idle" ? e() : this.#me ? (this.#pe = null, this.#qe(), e()) : this.#pe = e;
788
+ #Je(e) {
789
+ this.#i.state === "idle" ? e() : this.#ge ? (this.#he = null, this.#Ye(), e()) : this.#he = e;
719
790
  }
720
- #qe() {
721
- let e = this.#me;
722
- e && (this.#me = null, this.#ce !== null && (cancelAnimationFrame(this.#ce), this.#ce = null), this.#ae?.setFlipProgress(e.toT, e.direction), e.onDone());
791
+ #Ye() {
792
+ let e = this.#ge;
793
+ e && (this.#ge = null, this.#ue !== null && (cancelAnimationFrame(this.#ue), this.#ue = null), this.#se?.setFlipProgress(e.toT, e.direction), e.onDone());
723
794
  }
724
- #Je() {
725
- let e = this.#pe;
795
+ #Xe() {
796
+ let e = this.#he;
726
797
  if (!e) {
727
- this.#_n();
798
+ this.#yn();
728
799
  return;
729
800
  }
730
- this.#pe = null, e();
801
+ this.#he = null, e();
731
802
  }
732
803
  getZoom() {
733
- return this.#ne;
804
+ return this.#ie;
734
805
  }
735
806
  setZoom(e, t) {
736
- if (!this.#ae || !this.#X) return;
737
- this.#wt(), this.#Dt();
738
- let n = X(e, 1, this.#$), r = this.#ae.measure(), i = r.screenAt?.(this.#ne), a = t ?? (i ? {
739
- x: i.x + this.#re + i.width / 2,
740
- y: i.y + this.#ie + i.height / 2
807
+ if (!this.#se || !this.#Q) return;
808
+ this.#Et(), this.#kt();
809
+ let n = X(e, 1, this.#te), r = this.#se.measure(), i = r.screenAt?.(this.#ie), a = t ?? (i ? {
810
+ x: i.x + this.#ae + i.width / 2,
811
+ y: i.y + this.#oe + i.height / 2
741
812
  } : null) ?? {
742
813
  x: r.containerWidth / 2,
743
814
  y: r.containerHeight / 2
744
- }, o = this.#ne, s = n === 1 ? 0 : a.x - n / o * (a.x - this.#re), c = n === 1 ? 0 : a.y - n / o * (a.y - this.#ie);
745
- [s, c] = this.#Qe(s, c, n, r.containerWidth, r.containerHeight), this.#ne = n, this.#re = s, this.#ie = c, this.#ae.setViewTransform(n, s, c), o > 1 != n > 1 && this.#Ze(), this.#pn(), this.#_t(), o <= 1 && n > 1 && (this.#bt("zoom"), this.#Ot()), this.#n.emit("zoomChanged", { scale: n });
815
+ }, o = this.#ie, s = n === 1 ? 0 : a.x - n / o * (a.x - this.#ae), c = n === 1 ? 0 : a.y - n / o * (a.y - this.#oe);
816
+ [s, c] = this.#et(s, c, n, r.containerWidth, r.containerHeight), this.#ie = n, this.#ae = s, this.#oe = c, this.#se.setViewTransform(n, s, c), o > 1 != n > 1 && this.#$e(), this.#hn(), this.#yt(), o <= 1 && n > 1 && (this.#St("zoom"), this.#At()), this.#n.emit("zoomChanged", { scale: n });
746
817
  }
747
818
  resetZoom() {
748
819
  this.setZoom(1);
749
820
  }
821
+ get strings() {
822
+ return this.#f;
823
+ }
750
824
  isSoundEnabled() {
751
- return this.#_;
825
+ return this.#y;
752
826
  }
753
827
  isSoundMuted() {
754
- return this.#_ && this.#b;
828
+ return this.#y && this.#S;
755
829
  }
756
830
  setSoundMuted(e) {
757
- this.#_ && (this.#b = e, this.#y?.setMuted(e), this.#x && this.#Xe(e), e || this.#Wt());
831
+ this.#y && (this.#S = e, this.#x?.setMuted(e), this.#C && this.#Qe(e), e || this.#Kt());
758
832
  }
759
- #Ye() {
833
+ #Ze() {
760
834
  try {
761
- let e = localStorage.getItem(Y);
762
- (e === "true" || e === "false") && (this.#b = e === "true");
835
+ let e = localStorage.getItem(J);
836
+ (e === "true" || e === "false") && (this.#S = e === "true");
763
837
  } catch {}
764
838
  }
765
- #Xe(e) {
839
+ #Qe(e) {
766
840
  try {
767
- localStorage.setItem(Y, String(e));
841
+ localStorage.setItem(J, String(e));
768
842
  } catch {}
769
843
  }
770
- #Ze() {
771
- this.#e.style.touchAction = this.#ne > 1 ? "none" : "pan-y";
844
+ #$e() {
845
+ this.#e.style.touchAction = this.#ie > 1 ? "none" : "pan-y";
772
846
  }
773
- #Qe(e, t, n, r, i) {
774
- let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#ae?.measure().screenAt?.(n) ?? {
847
+ #et(e, t, n, r, i) {
848
+ let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#se?.measure().screenAt?.(n) ?? {
775
849
  x: 0,
776
850
  y: 0,
777
851
  width: r * n,
@@ -783,31 +857,32 @@ var ce = class {
783
857
  return this.#n.on(e, t);
784
858
  }
785
859
  destroy() {
786
- this.#se = !0, this.#ce !== null && cancelAnimationFrame(this.#ce), this.#me = null, this.#pe = null, this.#Pt(), this.#St(), this.#wt(), this.#Dt(), this.#Nt(), this.#At(), this.#y?.destroy(), this.#y = null, this.#ee?.disconnect(), this.#U?.stop(), this.#U = null, this.#W?.(), this.#V && x(), this.#je?.(), this.#Ne?.(), this.#Yt(), this.#De?.(), this.#Se?.(), this.#we?.(), this.#Ce?.(), this.#m?.(), this.#xe?.(), this.#Ve !== null && clearTimeout(this.#Ve), this.#Be++, this.#ae?.destroy(), this.#ae = null, this.#t.destroy(), this.#n.clear();
860
+ this.#le = !0, this.#ue !== null && cancelAnimationFrame(this.#ue), this.#ge = null, this.#he = null, this.#It(), this.#wt(), this.#Et(), this.#kt(), this.#Ft(), this.#Mt(), this.#x?.destroy(), this.#x = null, this.#ne?.disconnect(), this.#G?.stop(), this.#G = null, this.#K?.(), this.#U && x(), this.#Ne?.(), this.#Fe?.(), this.#Zt(), this.#ke?.(), this.#we?.(), this.#Ee?.(), this.#Te?.(), this.#g?.(), this.#Ce?.(), this.#Ue !== null && clearTimeout(this.#Ue), this.#He++, this.#se?.destroy(), this.#se = null, this.#t.destroy(), this.#n.clear();
787
861
  }
788
- #$e(e) {
789
- if (e < 0 || e >= this.#G.length || e === this.#K || (this.#wt(), this.#Dt(), this.#i.send("flip") === null)) return;
790
- let t = e > this.#K ? "forward" : "backward", n = this.#it(e);
862
+ #tt(e) {
863
+ if (e < 0 || e >= this.#q.length || e === this.#J || (this.#Et(), this.#kt(), this.#i.send("flip") === null)) return;
864
+ let t = e > this.#J ? "forward" : "backward", n = this.#ot(e);
791
865
  this.#n.emit("flipStart", {
792
- from: this.#q,
866
+ from: this.#Y,
793
867
  to: n
794
- }), this.#Gt(), this.#et(e, t, n, ++this.#he);
868
+ }), this.#qt(), this.#nt(e, t, n, ++this.#_e);
795
869
  }
796
- async #et(e, t, n, r) {
797
- let i = this.#G[e], a = i ? await this.#bn(i) : {
870
+ async #nt(e, t, n, r) {
871
+ let i = this.#q[e], a = i ? await this.#Sn(i) : {
798
872
  left: null,
799
873
  right: null
800
874
  };
801
- r === this.#he && (this.#ae?.beginFlip(this.#J, a, t, {
802
- fill: this.#F,
803
- curl: this.#an(),
875
+ r === this.#_e && (this.#se?.beginFlip(this.#X, a, t, {
876
+ fill: this.#L,
877
+ fit: this.#d,
878
+ curl: this.#sn(),
804
879
  anchor: { y: this.#l }
805
- }), this.#tt(0, 1, t, () => this.#rt(e, n, a), () => this.#nt(n)));
880
+ }), this.#rt(0, 1, t, () => this.#at(e, n, a), () => this.#it(n)));
806
881
  }
807
- #tt(e, t, n, r, i) {
808
- let a = this.#in() * Math.abs(t - e);
882
+ #rt(e, t, n, r, i) {
883
+ let a = this.#on() * Math.abs(t - e);
809
884
  if (a <= 0) {
810
- this.#ae?.setFlipProgress(t, n), r();
885
+ this.#se?.setFlipProgress(t, n), r();
811
886
  return;
812
887
  }
813
888
  let o = {
@@ -815,60 +890,60 @@ var ce = class {
815
890
  direction: n,
816
891
  onDone: r
817
892
  };
818
- this.#me = o;
893
+ this.#ge = o;
819
894
  let s = performance.now(), c = !1, l = (u) => {
820
- if (this.#me !== o) return;
821
- let d = Math.min(1, (u - s) / a), f = le(d);
822
- i && !c && f >= (this.#F ? H : V) && (c = !0, i()), d < 1 ? (this.#ae?.setFlipProgress(e + (t - e) * f, n), this.#ce = requestAnimationFrame(l)) : (this.#ae?.setFlipProgress(t, n), this.#ce = null, this.#me = null, r());
895
+ if (this.#ge !== o) return;
896
+ let d = Math.min(1, (u - s) / a), f = de(d);
897
+ i && !c && f >= (this.#L ? U : H) && (c = !0, i()), d < 1 ? (this.#se?.setFlipProgress(e + (t - e) * f, n), this.#ue = requestAnimationFrame(l)) : (this.#se?.setFlipProgress(t, n), this.#ue = null, this.#ge = null, r());
823
898
  };
824
- this.#ce = requestAnimationFrame(l);
899
+ this.#ue = requestAnimationFrame(l);
825
900
  }
826
- #nt(e) {
827
- this.#q !== e && (this.#q = e, this.#rn(), this.#n.emit("pageChanged", { page: e }));
901
+ #it(e) {
902
+ this.#Y !== e && (this.#Y = e, this.#an(), this.#n.emit("pageChanged", { page: e }));
828
903
  }
829
- #rt(e, t, n) {
830
- let r = this.#G[e];
831
- this.#K = e, this.#J = n, r && this.#un(r, n), this.#Sn(), this.#i.send("settle"), this.#Ee = performance.now(), this.#nt(t), this.#bt("turn"), this.#_t(), this.#n.emit("flipEnd", { page: t }), this.#Je();
904
+ #at(e, t, n) {
905
+ let r = this.#q[e];
906
+ this.#J = e, this.#X = n, r && this.#fn(r, n), this.#wn(), this.#i.send("settle"), this.#Oe = performance.now(), this.#it(t), this.#St("turn"), this.#yt(), this.#n.emit("flipEnd", { page: t }), this.#Xe();
832
907
  }
833
- #it(e) {
834
- let t = this.#G[e];
835
- if (!t) return this.#q;
908
+ #ot(e) {
909
+ let t = this.#q[e];
910
+ if (!t) return this.#Y;
836
911
  let n = [t.left, t.right].filter((e) => e !== null);
837
- return n.length > 0 ? Math.min(...n) : this.#q;
912
+ return n.length > 0 ? Math.min(...n) : this.#Y;
838
913
  }
839
- #at(e, t) {
840
- if (this.#_e || !this.#ae) return;
841
- if (this.#Dt(), this.#Pt(), this.#ne > 1) {
914
+ #st(e, t) {
915
+ if (this.#ye || !this.#se) return;
916
+ if (this.#kt(), this.#It(), this.#ie > 1) {
842
917
  if (this.#i.send("panStart") === null) return;
843
- this.#ge = {
844
- baseTx: this.#re,
845
- baseTy: this.#ie
918
+ this.#ve = {
919
+ baseTx: this.#ae,
920
+ baseTy: this.#oe
846
921
  };
847
922
  return;
848
923
  }
849
- let n = this.#ft(), r = this.#pt(e, t);
850
- this.#de = r;
851
- 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;
924
+ let n = this.#mt(), r = this.#ht(e, t);
925
+ this.#pe = r;
926
+ let i = Math.min(n.width, n.height) * A, 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;
852
927
  if (this.#i.state !== "idle") {
853
- if (!this.#me || !s) {
854
- this.#ue = null;
928
+ if (!this.#ge || !s) {
929
+ this.#fe = null;
855
930
  return;
856
931
  }
857
- this.#qe();
932
+ this.#Ye();
858
933
  }
859
934
  if (!s) return;
860
935
  this.#l = X(r.y / n.height, 0, 1);
861
- let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#K + (l ? 1 : -1);
862
- u < 0 || u >= this.#G.length || (this.#ue = {
936
+ let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#J + (l ? 1 : -1);
937
+ u < 0 || u >= this.#q.length || (this.#fe = {
863
938
  direction: l ? "forward" : "backward",
864
939
  targetIndex: u,
865
- toPage: this.#it(u),
940
+ toPage: this.#ot(u),
866
941
  width: n.width
867
942
  });
868
943
  }
869
- #ot() {
870
- let e = this.#ue;
871
- e && (this.#ue = null, this.#i.send("grab") !== null && (this.#le = {
944
+ #ct() {
945
+ let e = this.#fe;
946
+ e && (this.#fe = null, this.#i.send("grab") !== null && (this.#de = {
872
947
  direction: e.direction,
873
948
  targetIndex: e.targetIndex,
874
949
  toPage: e.toPage,
@@ -879,75 +954,76 @@ var ce = class {
879
954
  width: e.width,
880
955
  t: 0
881
956
  }, this.#n.emit("flipStart", {
882
- from: this.#q,
957
+ from: this.#Y,
883
958
  to: e.toPage
884
- }), this.#st(e.targetIndex, e.direction)));
959
+ }), this.#lt(e.targetIndex, e.direction)));
885
960
  }
886
- async #st(e, t) {
887
- let n = this.#G[e], r = n ? await this.#bn(n) : {
961
+ async #lt(e, t) {
962
+ let n = this.#q[e], r = n ? await this.#Sn(n) : {
888
963
  left: null,
889
964
  right: null
890
965
  };
891
- this.#le?.targetIndex === e && (this.#le.toContent = r, this.#ae?.beginFlip(this.#J, r, t, {
892
- fill: this.#F,
893
- curl: this.#an(),
966
+ this.#de?.targetIndex === e && (this.#de.toContent = r, this.#se?.beginFlip(this.#X, r, t, {
967
+ fill: this.#L,
968
+ fit: this.#d,
969
+ curl: this.#sn(),
894
970
  anchor: { y: this.#l }
895
- }), this.#ae?.setFlipProgress(this.#le.t, t));
896
- }
897
- #ct(e, t) {
898
- if (this.#_e) return;
899
- if (this.#ge) {
900
- if (!this.#ae) return;
901
- let n = this.#ae.measure(), [r, i] = this.#Qe(this.#ge.baseTx + e, this.#ge.baseTy + t, this.#ne, n.containerWidth, n.containerHeight);
902
- this.#re = r, this.#ie = i, this.#ae.setViewTransform(this.#ne, r, i), this.#pn(), this.#bt("pan"), this.#At();
971
+ }), this.#se?.setFlipProgress(this.#de.t, t));
972
+ }
973
+ #ut(e, t) {
974
+ if (this.#ye) return;
975
+ if (this.#ve) {
976
+ if (!this.#se) return;
977
+ let n = this.#se.measure(), [r, i] = this.#et(this.#ve.baseTx + e, this.#ve.baseTy + t, this.#ie, n.containerWidth, n.containerHeight);
978
+ this.#ae = r, this.#oe = i, this.#se.setViewTransform(this.#ie, r, i), this.#hn(), this.#St("pan"), this.#Mt();
903
979
  return;
904
980
  }
905
- this.#ue && Math.hypot(e, t) > j && this.#ot();
906
- let n = this.#le;
907
- n && (n.t = X((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#ae?.setFlipProgress(n.t, n.direction));
908
- }
909
- #lt(e) {
910
- if (this.#_e) return;
911
- if (this.#ge) {
912
- this.#ge = null, this.#i.send("panEnd"), this.#_t();
981
+ this.#fe && Math.hypot(e, t) > M && this.#ct();
982
+ let n = this.#de;
983
+ n && (n.t = X((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#se?.setFlipProgress(n.t, n.direction));
984
+ }
985
+ #dt(e) {
986
+ if (this.#ye) return;
987
+ if (this.#ve) {
988
+ this.#ve = null, this.#i.send("panEnd"), this.#yt();
913
989
  return;
914
990
  }
915
- let t = this.#le;
991
+ let t = this.#de;
916
992
  if (!t) {
917
- this.#ue = null, this.#ut(e) || this.#dt(e);
993
+ this.#fe = null, this.#ft(e) || this.#pt(e);
918
994
  return;
919
995
  }
920
- this.#le = null, this.#i.send("release");
996
+ this.#de = null, this.#i.send("release");
921
997
  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;
922
- i || t.t >= .5 && !a ? (this.#Gt(), this.#tt(t.t, 1, t.direction, () => this.#rt(t.targetIndex, t.toPage, t.toContent), () => this.#nt(t.toPage))) : this.#tt(t.t, 0, t.direction, () => this.#Ft());
998
+ i || t.t >= .5 && !a ? (this.#qt(), this.#rt(t.t, 1, t.direction, () => this.#at(t.targetIndex, t.toPage, t.toContent), () => this.#it(t.toPage))) : this.#rt(t.t, 0, t.direction, () => this.#Lt());
923
999
  }
924
- #ut(e) {
925
- if (this.#ne > 1 || !e.swipe || Math.abs(e.dx) <= Math.abs(e.dy)) return !1;
1000
+ #ft(e) {
1001
+ if (this.#ie > 1 || !e.swipe || Math.abs(e.dx) <= Math.abs(e.dy)) return !1;
926
1002
  let t = this.#a === "rtl" ? e.dx > 0 : e.dx < 0, n = t ? "forward" : "backward";
927
- if (!this.#ht(n)) return this.#Et(n), !1;
1003
+ if (!this.#_t(n)) return this.#Ot(n), !1;
928
1004
  let r = t ? 1 : -1;
929
- return this.#Ke(() => this.#$e(this.#K + r)), !0;
1005
+ return this.#Je(() => this.#tt(this.#J + r)), !0;
930
1006
  }
931
- #dt(e) {
932
- if (this.#u === "off" || this.#ne > 1 || !this.#de || Math.abs(e.dx) > j || Math.abs(e.dy) > j) return;
933
- let t = this.#mt(this.#de);
1007
+ #pt(e) {
1008
+ if (this.#u === "off" || this.#ie > 1 || !this.#pe || Math.abs(e.dx) > M || Math.abs(e.dy) > M) return;
1009
+ let t = this.#gt(this.#pe);
934
1010
  if (!t) return;
935
- if (!this.#ht(t)) {
936
- this.#Et(t);
1011
+ if (!this.#_t(t)) {
1012
+ this.#Ot(t);
937
1013
  return;
938
1014
  }
939
- this.#l = X(this.#de.y / this.#ft().height, 0, 1);
940
- let n = t === "forward" ? 1 : -1, r = () => this.#$e(this.#K + n);
941
- if (this.#Pt(), this.#N <= 0) {
942
- this.#Ke(r);
1015
+ this.#l = X(this.#pe.y / this.#mt().height, 0, 1);
1016
+ let n = t === "forward" ? 1 : -1, r = () => this.#tt(this.#J + n);
1017
+ if (this.#It(), this.#F <= 0) {
1018
+ this.#Je(r);
943
1019
  return;
944
1020
  }
945
- this.#fe = setTimeout(() => {
946
- this.#fe = null, this.#Ke(r);
947
- }, this.#N);
1021
+ this.#me = setTimeout(() => {
1022
+ this.#me = null, this.#Je(r);
1023
+ }, this.#F);
948
1024
  }
949
- #ft() {
950
- let e = this.#ae.measure();
1025
+ #mt() {
1026
+ let e = this.#se.measure();
951
1027
  return e.content ?? e.book ?? {
952
1028
  x: 0,
953
1029
  y: 0,
@@ -955,364 +1031,365 @@ var ce = class {
955
1031
  height: e.containerHeight
956
1032
  };
957
1033
  }
958
- #pt(e, t) {
959
- let n = this.#e.getBoundingClientRect(), r = this.#ft();
1034
+ #ht(e, t) {
1035
+ let n = this.#e.getBoundingClientRect(), r = this.#mt();
960
1036
  return {
961
1037
  x: e - n.left - r.x,
962
1038
  y: t - n.top - r.y
963
1039
  };
964
1040
  }
965
- #mt(e) {
966
- if (!this.#ae) return null;
967
- let t = this.#ft().width, n;
968
- 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;
1041
+ #gt(e) {
1042
+ if (!this.#se) return null;
1043
+ let t = this.#mt().width, n;
1044
+ if (n = this.#u === "half" ? e.x > t / 2 ? "right" : "left" : e.x <= this.#p ? "left" : e.x >= t - this.#p ? "right" : null, !n) return null;
969
1045
  let r = this.#a === "rtl" ? "left" : "right";
970
1046
  return n === r ? "forward" : "backward";
971
1047
  }
972
- #ht(e) {
973
- let t = this.#K + (e === "forward" ? 1 : -1);
974
- return t >= 0 && t < this.#G.length;
1048
+ #_t(e) {
1049
+ let t = this.#J + (e === "forward" ? 1 : -1);
1050
+ return t >= 0 && t < this.#q.length;
975
1051
  }
976
- #gt() {
1052
+ #vt() {
977
1053
  let e = (e) => {
978
1054
  let t = e;
979
- this.#p = {
1055
+ this.#h = {
980
1056
  x: t.clientX,
981
1057
  y: t.clientY
982
- }, this.#_t();
1058
+ }, this.#yt();
983
1059
  }, t = () => {
984
- this.#p = null, this.#_t();
1060
+ this.#h = null, this.#yt();
985
1061
  };
986
- this.#e.addEventListener("pointermove", e), this.#e.addEventListener("pointerleave", t), this.#m = () => {
1062
+ this.#e.addEventListener("pointermove", e), this.#e.addEventListener("pointerleave", t), this.#g = () => {
987
1063
  this.#e.removeEventListener("pointermove", e), this.#e.removeEventListener("pointerleave", t);
988
1064
  };
989
1065
  }
990
- #_t() {
991
- if (!this.#f || !this.#ae) return;
1066
+ #yt() {
1067
+ if (!this.#m || !this.#se) return;
992
1068
  let e = "";
993
- this.#le || this.#ge ? e = "grabbing" : this.#p && (e = this.#vt(this.#p.x, this.#p.y)), this.#e.style.cursor = e;
1069
+ this.#de || this.#ve ? e = "grabbing" : this.#h && (e = this.#bt(this.#h.x, this.#h.y)), this.#e.style.cursor = e;
994
1070
  }
995
- #vt(e, t) {
996
- if (!this.#ae) return "";
997
- let n = this.#ft(), r = this.#pt(e, t);
1071
+ #bt(e, t) {
1072
+ if (!this.#se) return "";
1073
+ let n = this.#mt(), r = this.#ht(e, t);
998
1074
  if (r.x < 0 || r.y < 0 || r.x > n.width || r.y > n.height) return "";
999
- if (this.#ne > 1) return "grab";
1000
- let i = this.#mt(r);
1001
- return i && this.#ht(i) ? "pointer" : this.#X && this.#Q !== null ? "zoom-in" : "";
1075
+ if (this.#ie > 1) return "grab";
1076
+ let i = this.#gt(r);
1077
+ return i && this.#_t(i) ? "pointer" : this.#Q && this.#ee !== null ? "zoom-in" : "";
1002
1078
  }
1003
- #yt() {
1079
+ #xt() {
1004
1080
  try {
1005
- let e = localStorage.getItem(J);
1081
+ let e = localStorage.getItem(q);
1006
1082
  if (!e) return;
1007
1083
  let t = JSON.parse(e);
1008
- this.#C = {
1084
+ this.#T = {
1009
1085
  turn: t.turn === !0,
1010
1086
  zoom: t.zoom === !0,
1011
1087
  pan: t.pan === !0
1012
1088
  };
1013
1089
  } catch {}
1014
1090
  }
1015
- #bt(e) {
1016
- if (!this.#C[e] && (this.#C[e] = !0, e === "turn" && this.#St(), e === "zoom" && this.#Nt(), this.#g)) try {
1017
- localStorage.setItem(J, JSON.stringify(this.#C));
1091
+ #St(e) {
1092
+ if (!this.#T[e] && (this.#T[e] = !0, e === "turn" && this.#wt(), e === "zoom" && this.#Ft(), this.#v)) try {
1093
+ localStorage.setItem(q, JSON.stringify(this.#T));
1018
1094
  } catch {}
1019
1095
  }
1020
- #xt() {
1021
- !this.#h || this.#ye || this.#C.turn || (this.#St(), this.#w = setTimeout(() => {
1022
- this.#w = null, this.#Ct();
1023
- }, K));
1096
+ #Ct() {
1097
+ !this.#_ || this.#xe || this.#T.turn || (this.#wt(), this.#E = setTimeout(() => {
1098
+ this.#E = null, this.#Tt();
1099
+ }, ce));
1024
1100
  }
1025
- #St() {
1026
- this.#w !== null && (clearTimeout(this.#w), this.#w = null);
1101
+ #wt() {
1102
+ this.#E !== null && (clearTimeout(this.#E), this.#E = null);
1027
1103
  }
1028
- async #Ct() {
1029
- if (!this.#h || this.#ye || this.#C.turn || !this.#ae || typeof requestAnimationFrame != "function" || this.#i.state !== "idle") return;
1030
- let e = this.#K + 1, t = this.#G[e];
1104
+ async #Tt() {
1105
+ if (!this.#_ || this.#xe || this.#T.turn || !this.#se || typeof requestAnimationFrame != "function" || this.#i.state !== "idle") return;
1106
+ let e = this.#J + 1, t = this.#q[e];
1031
1107
  if (!t) return;
1032
- let n = await this.#bn(t);
1033
- if (this.#se || this.#C.turn || this.#i.state !== "idle" || this.#T) return;
1034
- this.#l = 1, this.#ae.beginFlip(this.#J, n, "forward", {
1035
- fill: this.#F,
1036
- curl: this.#an(),
1108
+ let n = await this.#Sn(t);
1109
+ if (this.#le || this.#T.turn || this.#i.state !== "idle" || this.#D) return;
1110
+ this.#l = 1, this.#se.beginFlip(this.#X, n, "forward", {
1111
+ fill: this.#L,
1112
+ fit: this.#d,
1113
+ curl: this.#sn(),
1037
1114
  anchor: { y: this.#l }
1038
1115
  });
1039
1116
  let r = {};
1040
- this.#T = r;
1041
- let i = performance.now(), a = oe * 2, o = () => {
1042
- if (this.#T !== r) return;
1043
- let e = Math.min(1, (performance.now() - i) / a), t = U * Math.sin(e * Math.PI);
1044
- this.#ae?.setFlipProgress(Math.max(0, t), "forward"), e < 1 ? this.#ce = requestAnimationFrame(o) : (this.#ce = null, this.#T = null, this.#Tt());
1117
+ this.#D = r;
1118
+ let i = performance.now(), a = G * 2, o = () => {
1119
+ if (this.#D !== r) return;
1120
+ let e = Math.min(1, (performance.now() - i) / a), t = W * Math.sin(e * Math.PI);
1121
+ this.#se?.setFlipProgress(Math.max(0, t), "forward"), e < 1 ? this.#ue = requestAnimationFrame(o) : (this.#ue = null, this.#D = null, this.#Dt());
1045
1122
  };
1046
- this.#ce = requestAnimationFrame(o);
1123
+ this.#ue = requestAnimationFrame(o);
1047
1124
  }
1048
- #wt() {
1049
- this.#T && (this.#T = null, this.#ce !== null && (cancelAnimationFrame(this.#ce), this.#ce = null), this.#Tt());
1125
+ #Et() {
1126
+ this.#D && (this.#D = null, this.#ue !== null && (cancelAnimationFrame(this.#ue), this.#ue = null), this.#Dt());
1050
1127
  }
1051
- #Tt() {
1052
- let e = this.#G[this.#K];
1053
- e && this.#i.state === "idle" && this.#un(e, this.#J);
1128
+ #Dt() {
1129
+ let e = this.#q[this.#J];
1130
+ e && this.#i.state === "idle" && this.#fn(e, this.#X);
1054
1131
  }
1055
- #Et(e) {
1056
- if (!this.#ae || typeof requestAnimationFrame != "function" || this.#ye || this.#i.state !== "idle" || this.#ne > 1 || this.#E) return;
1132
+ #Ot(e) {
1133
+ if (!this.#se || typeof requestAnimationFrame != "function" || this.#xe || this.#i.state !== "idle" || this.#ie > 1 || this.#O) return;
1057
1134
  let t = e === "forward", n = (this.#a === "rtl" ? !t : t) ? -1 : 1, r = {};
1058
- this.#E = r;
1135
+ this.#O = r;
1059
1136
  let i = performance.now(), a = () => {
1060
- if (this.#E !== r) return;
1061
- let e = Math.min(1, (performance.now() - i) / G), t = W * Math.sin(e * Math.PI);
1062
- this.#ae?.setViewTransform(1, n * t, 0), e < 1 ? this.#ce = requestAnimationFrame(a) : (this.#ce = null, this.#E = null, this.#ae?.setViewTransform(1, 0, 0));
1137
+ if (this.#O !== r) return;
1138
+ let e = Math.min(1, (performance.now() - i) / K), t = se * Math.sin(e * Math.PI);
1139
+ this.#se?.setViewTransform(1, n * t, 0), e < 1 ? this.#ue = requestAnimationFrame(a) : (this.#ue = null, this.#O = null, this.#se?.setViewTransform(1, 0, 0));
1063
1140
  };
1064
- this.#ce = requestAnimationFrame(a);
1141
+ this.#ue = requestAnimationFrame(a);
1065
1142
  }
1066
- #Dt() {
1067
- this.#E && (this.#E = null, this.#ce !== null && (cancelAnimationFrame(this.#ce), this.#ce = null), this.#ae?.setViewTransform(1, 0, 0));
1143
+ #kt() {
1144
+ this.#O && (this.#O = null, this.#ue !== null && (cancelAnimationFrame(this.#ue), this.#ue = null), this.#se?.setViewTransform(1, 0, 0));
1068
1145
  }
1069
- #Ot() {
1070
- this.#C.pan || this.#kt("Drag to move");
1146
+ #At() {
1147
+ this.#T.pan || this.#jt(this.#f.panHint);
1071
1148
  }
1072
- #kt(e) {
1073
- if (!this.#h) return;
1149
+ #jt(e) {
1150
+ if (!this.#_) return;
1074
1151
  let t = this.#e.ownerDocument;
1075
1152
  if (!t || typeof this.#e.appendChild != "function") return;
1076
- this.#At();
1153
+ this.#Mt();
1077
1154
  let n = t.createElement("div");
1078
1155
  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;";
1079
- let r = !this.#ye && typeof requestAnimationFrame == "function";
1080
- r && (n.style.transition = "opacity 200ms ease"), this.#e.appendChild(n), this.#D = n, r ? requestAnimationFrame(() => {
1081
- this.#D === n && (n.style.opacity = "1");
1082
- }) : n.style.opacity = "1", this.#O = setTimeout(() => this.#At(), q);
1083
- }
1084
- #At() {
1085
- this.#O !== null && (clearTimeout(this.#O), this.#O = null), this.#D?.remove(), this.#D = null;
1086
- }
1087
- #jt(e, t) {
1088
- !this.#h || this.#C.zoom || this.#A || this.#j === "mouse" && this.#vt(e, t) === "zoom-in" && (this.#i.state === "animating" || performance.now() - this.#Ee <= P || (this.#Nt(), this.#k = setTimeout(() => {
1089
- this.#k = null, !(this.#C.zoom || this.#A) && (this.#A = !0, this.#kt(this.#Mt()));
1090
- }, M)));
1156
+ let r = !this.#xe && typeof requestAnimationFrame == "function";
1157
+ r && (n.style.transition = "opacity 200ms ease"), this.#e.appendChild(n), this.#k = n, r ? requestAnimationFrame(() => {
1158
+ this.#k === n && (n.style.opacity = "1");
1159
+ }) : n.style.opacity = "1", this.#A = setTimeout(() => this.#Mt(), le);
1091
1160
  }
1092
1161
  #Mt() {
1093
- let e = [];
1094
- if (this.#Q !== null && e.push("Double-click"), this.#Z) {
1095
- let t = this.#e.ownerDocument?.defaultView?.navigator, n = /Mac|iPhone|iPad/.test(t?.platform ?? "");
1096
- e.push(`${n ? "⌘" : "Ctrl"}-scroll`);
1097
- }
1098
- return `${e.join(" or ")} to zoom`;
1162
+ this.#A !== null && (clearTimeout(this.#A), this.#A = null), this.#k?.remove(), this.#k = null;
1099
1163
  }
1100
- #Nt() {
1101
- this.#k !== null && (clearTimeout(this.#k), this.#k = null);
1164
+ #Nt(e, t) {
1165
+ !this.#_ || this.#T.zoom || this.#M || this.#N === "mouse" && this.#bt(e, t) === "zoom-in" && (this.#i.state === "animating" || performance.now() - this.#Oe <= F || (this.#Ft(), this.#j = setTimeout(() => {
1166
+ this.#j = null, !(this.#T.zoom || this.#M) && (this.#M = !0, this.#jt(this.#Pt()));
1167
+ }, N)));
1102
1168
  }
1103
1169
  #Pt() {
1104
- this.#fe !== null && (clearTimeout(this.#fe), this.#fe = null);
1170
+ let e = this.#e.ownerDocument?.defaultView?.navigator, t = /Mac|iPhone|iPad/.test(e?.platform ?? "");
1171
+ return this.#f.zoomHint({
1172
+ doubleClick: this.#ee !== null,
1173
+ wheel: this.#$,
1174
+ mac: t
1175
+ });
1105
1176
  }
1106
1177
  #Ft() {
1107
- let e = this.#G[this.#K];
1108
- e && this.#un(e, this.#J), this.#i.send("settle"), this.#_t(), this.#n.emit("flipEnd", { page: this.#q }), this.#Je();
1178
+ this.#j !== null && (clearTimeout(this.#j), this.#j = null);
1109
1179
  }
1110
1180
  #It() {
1111
- if (this.#ue = null, this.#Pt(), this.#le) {
1112
- this.#le = null, this.#i.send("release"), this.#i.send("settle");
1113
- let e = this.#G[this.#K];
1114
- e && this.#un(e, this.#J);
1115
- } else this.#ge && (this.#ge = null, this.#i.send("panEnd"));
1116
- this.#_e = !0, this.#ve = this.#ne;
1117
- }
1118
- #Lt(e, t, n) {
1119
- if (!this.#_e) return;
1181
+ this.#me !== null && (clearTimeout(this.#me), this.#me = null);
1182
+ }
1183
+ #Lt() {
1184
+ let e = this.#q[this.#J];
1185
+ e && this.#fn(e, this.#X), this.#i.send("settle"), this.#yt(), this.#n.emit("flipEnd", { page: this.#Y }), this.#Xe();
1186
+ }
1187
+ #Rt() {
1188
+ if (this.#fe = null, this.#It(), this.#de) {
1189
+ this.#de = null, this.#i.send("release"), this.#i.send("settle");
1190
+ let e = this.#q[this.#J];
1191
+ e && this.#fn(e, this.#X);
1192
+ } else this.#ve && (this.#ve = null, this.#i.send("panEnd"));
1193
+ this.#ye = !0, this.#be = this.#ie;
1194
+ }
1195
+ #zt(e, t, n) {
1196
+ if (!this.#ye) return;
1120
1197
  let r = this.#e.getBoundingClientRect();
1121
- this.setZoom(this.#ve * n, {
1198
+ this.setZoom(this.#be * n, {
1122
1199
  x: e - r.left,
1123
1200
  y: t - r.top
1124
1201
  });
1125
1202
  }
1126
- #Rt() {
1127
- this.#_e = !1;
1203
+ #Bt() {
1204
+ this.#ye = !1;
1128
1205
  }
1129
- #zt() {
1130
- if (!this.#H) return;
1206
+ #Vt() {
1207
+ if (!this.#W) return;
1131
1208
  let e = (e) => e.preventDefault();
1132
- this.#e.addEventListener("contextmenu", e), this.#Ce = () => this.#e.removeEventListener("contextmenu", e);
1209
+ this.#e.addEventListener("contextmenu", e), this.#Te = () => this.#e.removeEventListener("contextmenu", e);
1133
1210
  }
1134
- #Bt() {
1211
+ #Ht() {
1135
1212
  let e = (e) => {
1136
- if (!this.#Z || !this.#X || !(e.ctrlKey || e.metaKey)) return;
1213
+ if (!this.#$ || !this.#Q || !(e.ctrlKey || e.metaKey)) return;
1137
1214
  e.preventDefault();
1138
- let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * A);
1139
- this.setZoom(this.#ne * n, {
1215
+ let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * j);
1216
+ this.setZoom(this.#ie * n, {
1140
1217
  x: e.clientX - t.left,
1141
1218
  y: e.clientY - t.top
1142
1219
  });
1143
1220
  };
1144
- this.#e.addEventListener("wheel", e, { passive: !1 }), this.#Se = () => this.#e.removeEventListener("wheel", e);
1221
+ this.#e.addEventListener("wheel", e, { passive: !1 }), this.#we = () => this.#e.removeEventListener("wheel", e);
1145
1222
  }
1146
- #Vt() {
1223
+ #Ut() {
1147
1224
  let e = (e) => {
1148
- this.#j = e.pointerType;
1225
+ this.#N = e.pointerType;
1149
1226
  }, t = (e) => {
1150
- let t = this.#Q;
1151
- if (!this.#X || t === null || !this.#ae) return;
1152
- let n = performance.now(), r = this.#Te;
1153
- if (!(r !== null && n - r.t <= M && Math.hypot(e.clientX - r.x, e.clientY - r.y) <= N)) {
1154
- this.#Te = {
1227
+ let t = this.#ee;
1228
+ if (!this.#Q || t === null || !this.#se) return;
1229
+ let n = performance.now(), r = this.#De;
1230
+ if (!(r !== null && n - r.t <= N && Math.hypot(e.clientX - r.x, e.clientY - r.y) <= P)) {
1231
+ this.#De = {
1155
1232
  t: n,
1156
1233
  x: e.clientX,
1157
1234
  y: e.clientY
1158
- }, this.#jt(e.clientX, e.clientY);
1235
+ }, this.#Nt(e.clientX, e.clientY);
1159
1236
  return;
1160
1237
  }
1161
- this.#Te = null, this.#Nt(), this.#Ht(e.clientX, e.clientY, t);
1238
+ this.#De = null, this.#Ft(), this.#Wt(e.clientX, e.clientY, t);
1162
1239
  };
1163
- this.#e.addEventListener("pointerdown", e), this.#e.addEventListener("click", t), this.#we = () => {
1240
+ this.#e.addEventListener("pointerdown", e), this.#e.addEventListener("click", t), this.#Ee = () => {
1164
1241
  this.#e.removeEventListener("pointerdown", e), this.#e.removeEventListener("click", t);
1165
1242
  };
1166
1243
  }
1167
- #Ht(e, t, n) {
1168
- if (this.#ne <= 1 && this.#u !== "off" && !this.#M) {
1169
- let n = this.#pt(e, t), r = this.#mt(n);
1170
- if (r !== null && this.#ht(r) || this.#i.state === "animating" || performance.now() - this.#Ee <= P) return;
1244
+ #Wt(e, t, n) {
1245
+ if (this.#ie <= 1 && this.#u !== "off" && !this.#P) {
1246
+ let n = this.#ht(e, t), r = this.#gt(n);
1247
+ if (r !== null && this.#_t(r) || this.#i.state === "animating" || performance.now() - this.#Oe <= F) return;
1171
1248
  }
1172
- this.#Pt();
1173
- let r = n.find((e) => e > this.#ne + 1e-6) ?? n[0] ?? this.#ne, i = this.#e.getBoundingClientRect();
1249
+ this.#It();
1250
+ let r = n.find((e) => e > this.#ie + 1e-6) ?? n[0] ?? this.#ie, i = this.#e.getBoundingClientRect();
1174
1251
  this.setZoom(r, {
1175
1252
  x: e - i.left,
1176
1253
  y: t - i.top
1177
1254
  });
1178
1255
  }
1179
- async #Ut(e) {
1256
+ async #Gt(e) {
1180
1257
  let t = O(e);
1181
- if (this.#t.onProgress?.((e) => this.#Kt(e)), typeof this.#t.open == "function") {
1182
- this.#qt();
1258
+ if (this.#t.onProgress?.((e) => this.#Jt(e)), typeof this.#t.open == "function") {
1259
+ this.#Yt();
1183
1260
  try {
1184
- await this.#t.open(), this.#wn();
1261
+ await this.#t.open(), this.#En();
1185
1262
  } catch (e) {
1186
- throw this.#Yt(), e;
1263
+ throw this.#Zt(), e;
1187
1264
  }
1188
- this.#Jt("preparing");
1265
+ this.#Xt("preparing");
1189
1266
  }
1190
- this.#t.prefetch([this.#q]);
1191
- let n = await t, r = await this.#Xt(n);
1192
- this.#ae = r, this.#t.onPageUpdate?.((e) => this.#fn(e)), this.#sn(r.measure().containerWidth);
1267
+ this.#t.prefetch([this.#Y]);
1268
+ let n = await t, r = await this.#Qt(n);
1269
+ this.#se = r, this.#t.onPageUpdate?.((e) => this.#mn(e)), this.#ln(r.measure().containerWidth);
1193
1270
  let i = new m({
1194
- onStart: (e) => this.#at(e.x, e.y),
1195
- onMove: (e) => this.#ct(e.dx, e.dy),
1196
- onEnd: (e) => this.#lt(e)
1271
+ onStart: (e) => this.#st(e.x, e.y),
1272
+ onMove: (e) => this.#ut(e.dx, e.dy),
1273
+ onEnd: (e) => this.#dt(e)
1197
1274
  }), a = new _({
1198
- onPinchStart: () => this.#It(),
1199
- onPinchMove: (e) => this.#Lt(e.centerX, e.centerY, e.scale),
1200
- onPinchEnd: () => this.#Rt()
1275
+ onPinchStart: () => this.#Rt(),
1276
+ onPinchMove: (e) => this.#zt(e.centerX, e.centerY, e.scale),
1277
+ onPinchEnd: () => this.#Bt()
1201
1278
  });
1202
- this.#xe = h(this.#e, {
1279
+ this.#Ce = h(this.#e, {
1203
1280
  pointer: i,
1204
1281
  pinch: a
1205
- }), this.#Ze(), this.#Bt(), this.#Vt(), this.#zt(), this.#gt(), this.#Qt(), this.#De = this.#tn(), await this.#ln(), this.#Yt(), this.#vn(), this.#Sn(), this.#rn(), this.#en(), await this.#$t(), this.#Wt(), this.#n.emit("ready"), this.#Ct(), this.#xt();
1282
+ }), this.#$e(), this.#Ht(), this.#Ut(), this.#Vt(), this.#vt(), this.#en(), this.#ke = this.#rn(), await this.#dn(), this.#Zt(), this.#bn(), this.#wn(), this.#an(), this.#nn(), await this.#tn(), this.#Kt(), this.#n.emit("ready"), this.#Tt(), this.#Ct();
1206
1283
  }
1207
- async #Wt() {
1208
- if (!(!this.#_ || this.#b || this.#S || this.#se)) {
1209
- this.#S = !0;
1284
+ async #Kt() {
1285
+ if (!(!this.#y || this.#S || this.#w || this.#le)) {
1286
+ this.#w = !0;
1210
1287
  try {
1211
1288
  let { FlipSound: e } = await import("./flipSound-BFXSkWBo.js");
1212
- if (this.#se) return;
1213
- this.#y = new e(this.#v), this.#y.setMuted(this.#b);
1289
+ if (this.#le) return;
1290
+ this.#x = new e(this.#b), this.#x.setMuted(this.#S);
1214
1291
  } catch {}
1215
1292
  }
1216
1293
  }
1217
- #Gt() {
1218
- this.#y?.play();
1294
+ #qt() {
1295
+ this.#x?.play();
1219
1296
  }
1220
- #Kt(e) {
1221
- this.#Le = e, this.#n.emit("progress", e), this.#Ie?.update(e);
1297
+ #Jt(e) {
1298
+ this.#ze = e, this.#n.emit("progress", e), this.#Re?.update(e);
1222
1299
  }
1223
- async #qt() {
1224
- if (this.#Fe === !1 || this.#se) return;
1300
+ async #Yt() {
1301
+ if (this.#Le === !1 || this.#le) return;
1225
1302
  let e = this.#e;
1226
1303
  if (!(!e.ownerDocument || typeof e.appendChild != "function")) try {
1227
- let { mountLoading: t } = await import("./loading-DF88K9yJ.js");
1228
- if (this.#Re === "done" || this.#se) return;
1229
- this.#Ie = t(e), this.#Le && this.#Ie.update(this.#Le), this.#Re === "preparing" && this.#Ie.preparing();
1304
+ let { mountLoading: t } = await import("./loading-BgbqJz5k.js");
1305
+ if (this.#Be === "done" || this.#le) return;
1306
+ this.#Re = t(e, this.#f), this.#ze && this.#Re.update(this.#ze), this.#Be === "preparing" && this.#Re.preparing();
1230
1307
  } catch {}
1231
1308
  }
1232
- #Jt(e) {
1233
- this.#Re !== "done" && (this.#Re = e, this.#Ie?.preparing());
1309
+ #Xt(e) {
1310
+ this.#Be !== "done" && (this.#Be = e, this.#Re?.preparing());
1234
1311
  }
1235
- #Yt() {
1236
- this.#Re = "done", this.#Ie?.destroy(), this.#Ie = null;
1312
+ #Zt() {
1313
+ this.#Be = "done", this.#Re?.destroy(), this.#Re = null;
1237
1314
  }
1238
- async #Xt(e) {
1315
+ async #Qt(e) {
1239
1316
  try {
1240
1317
  return await e.mount(this.#e), e.onFatal?.(() => {
1241
- this.#Zt();
1318
+ this.#$t();
1242
1319
  }), e;
1243
1320
  } catch {
1244
1321
  e.destroy();
1245
1322
  let t = await O("css");
1246
- return await t.mount(this.#e), this.#oe = !0, this.#n.emit("rendererFallback", {
1323
+ return await t.mount(this.#e), this.#ce = !0, this.#n.emit("rendererFallback", {
1247
1324
  from: "webgl2",
1248
1325
  to: "css"
1249
1326
  }), t;
1250
1327
  }
1251
1328
  }
1252
- async #Zt() {
1253
- if (this.#oe || this.#se) return;
1254
- this.#oe = !0, this.#ae?.destroy(), this.#ae = null;
1329
+ async #$t() {
1330
+ if (this.#ce || this.#le) return;
1331
+ this.#ce = !0, this.#se?.destroy(), this.#se = null;
1255
1332
  let e = await O("css");
1256
- if (this.#se) {
1333
+ if (this.#le) {
1257
1334
  e.destroy();
1258
1335
  return;
1259
1336
  }
1260
- await e.mount(this.#e), this.#ae = e, this.#sn(e.measure().containerWidth), await this.#ln(), this.#n.emit("rendererFallback", {
1337
+ await e.mount(this.#e), this.#se = e, this.#ln(e.measure().containerWidth), await this.#dn(), this.#n.emit("rendererFallback", {
1261
1338
  from: "webgl2",
1262
1339
  to: "css"
1263
1340
  });
1264
1341
  }
1265
- #Qt() {
1342
+ #en() {
1266
1343
  if (typeof matchMedia != "function") return;
1267
1344
  let e = matchMedia("(prefers-reduced-motion: reduce)");
1268
- this.#ye = e.matches, e.addEventListener?.("change", (e) => {
1269
- this.#ye = e.matches;
1345
+ this.#xe = e.matches, e.addEventListener?.("change", (e) => {
1346
+ this.#xe = e.matches;
1270
1347
  });
1271
1348
  }
1272
- async #$t() {
1273
- let e = this.#Ae !== !1, t = this.#Me !== !1;
1274
- if (!e && !t || this.#se) return;
1349
+ async #tn() {
1350
+ let e = this.#Me !== !1, t = this.#Pe !== !1;
1351
+ if (!e && !t || this.#le) return;
1275
1352
  let n = this.#e;
1276
1353
  if (!(!n.ownerDocument || typeof n.appendChild != "function")) try {
1277
- let { mountControls: e, mountContextMenu: t } = await import("./controls-DzVdwPJB.js");
1278
- if (this.#se) return;
1279
- if (this.#Ae !== !1) {
1280
- let t = this.#Ae === !0 ? {} : this.#Ae;
1281
- this.#je = e(this, n, t, this.#Pe);
1282
- }
1354
+ let { mountControls: e, mountContextMenu: t } = await import("./controls-Dh1okIx6.js");
1355
+ if (this.#le) return;
1283
1356
  if (this.#Me !== !1) {
1284
- let e = this.#Me === !0 ? {} : this.#Me;
1285
- this.#Ne = t(this, n, e, this.#Pe);
1357
+ let t = this.#Me === !0 ? {} : this.#Me;
1358
+ this.#Ne = e(this, n, t, this.#Ie);
1359
+ }
1360
+ if (this.#Pe !== !1) {
1361
+ let e = this.#Pe === !0 ? {} : this.#Pe;
1362
+ this.#Fe = t(this, n, e, this.#Ie);
1286
1363
  }
1287
1364
  } catch {}
1288
1365
  }
1289
- #en() {
1290
- if (!this.#V || globalThis.location === void 0) return;
1366
+ #nn() {
1367
+ if (!this.#U || globalThis.location === void 0) return;
1291
1368
  let e = globalThis;
1292
- this.#U = ee(e, (e) => {
1293
- e !== this.#q && this.flipTo(e);
1294
- }), this.#U.push(this.#q), this.#W = this.#n.on("pageChanged", ({ page: e }) => {
1295
- this.#U?.push(e);
1369
+ this.#G = ee(e, (e) => {
1370
+ e !== this.#Y && this.flipTo(e);
1371
+ }), this.#G.push(this.#Y), this.#K = this.#n.on("pageChanged", ({ page: e }) => {
1372
+ this.#G?.push(e);
1296
1373
  });
1297
1374
  }
1298
- pageLink(e = this.#q) {
1375
+ pageLink(e = this.#Y) {
1299
1376
  let t = globalThis.location?.href ?? "";
1300
1377
  if (!t) return "";
1301
1378
  let n = new URL(t);
1302
1379
  return n.hash = C(n.hash, X(e, 0, Math.max(0, this.#t.pageCount - 1))), n.toString();
1303
1380
  }
1304
- #tn() {
1381
+ #rn() {
1305
1382
  let e = this.#e, t = e.ownerDocument;
1306
1383
  if (!t || typeof e.setAttribute != "function") return null;
1307
- e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription", "flipbook");
1308
- let n = (e) => this.#nn(e);
1384
+ e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription", this.#f.roledescription);
1385
+ let n = (e) => this.#in(e);
1309
1386
  e.addEventListener("keydown", n);
1310
1387
  let r = t.createElement("div");
1311
- 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.#be = r, () => {
1312
- e.removeEventListener("keydown", n), r.remove(), this.#be = null;
1388
+ 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.#Se = r, () => {
1389
+ e.removeEventListener("keydown", n), r.remove(), this.#Se = null;
1313
1390
  };
1314
1391
  }
1315
- #nn(e) {
1392
+ #in(e) {
1316
1393
  let t = this.#a === "rtl" ? "ArrowLeft" : "ArrowRight";
1317
1394
  switch (e.key) {
1318
1395
  case "ArrowRight":
@@ -1328,98 +1405,104 @@ var ce = class {
1328
1405
  default: break;
1329
1406
  }
1330
1407
  }
1331
- #rn() {
1332
- this.#be && (this.#be.textContent = `Page ${this.#q + 1} of ${this.#t.pageCount}`);
1408
+ #an() {
1409
+ this.#Se && (this.#Se.textContent = this.#f.pageAnnounce(this.#Y + 1, this.#t.pageCount));
1333
1410
  }
1334
- #in() {
1335
- return this.#ye ? B : this.#Y * (this.#F ? F : 1);
1411
+ #on() {
1412
+ return this.#xe ? V : this.#Z * (this.#L ? I : 1);
1336
1413
  }
1337
- #an() {
1338
- return this.#ye ? "simple" : this.#c;
1414
+ #sn() {
1415
+ return this.#xe ? "simple" : this.#c;
1339
1416
  }
1340
1417
  update() {
1341
- !this.#ae || this.#i.state !== "idle" || (this.#sn(this.#ae.measure().containerWidth), this.#ln(), this.#_t());
1418
+ !this.#se || this.#i.state !== "idle" || (this.#ln(this.#se.measure().containerWidth), this.#dn(), this.#yt());
1342
1419
  }
1343
- #on() {
1344
- return this.#L || this.#o === "single" ? "single" : this.#o;
1420
+ #cn() {
1421
+ return this.#z || this.#o === "single" ? "single" : this.#o;
1345
1422
  }
1346
- #sn(e) {
1347
- let t = this.#R && o(e, this.#P);
1348
- t !== this.#L && (this.#L = t, this.#cn());
1423
+ #ln(e) {
1424
+ let t = this.#B && o(e, this.#I);
1425
+ t !== this.#z && (this.#z = t, this.#un());
1349
1426
  }
1350
- #cn() {
1351
- let e = this.#on(), t = e !== this.#I;
1352
- this.#I = e, this.#F = e === "single", this.#G = a(this.#t.pageCount, {
1427
+ #un() {
1428
+ let e = this.#cn(), t = e !== this.#R;
1429
+ this.#R = e, this.#L = e === "single", this.#q = a(this.#t.pageCount, {
1353
1430
  direction: this.#a,
1354
1431
  mode: e
1355
- }), this.#K = this.#Cn(this.#q), t && this.#n.emit("spreadChanged", {
1432
+ }), this.#J = this.#Tn(this.#Y), t && this.#n.emit("spreadChanged", {
1356
1433
  mode: e,
1357
- singlePage: this.#F
1434
+ singlePage: this.#L
1358
1435
  });
1359
1436
  }
1360
- async #ln() {
1361
- let e = this.#G[this.#K];
1362
- !e || !this.#ae || (this.#J = await this.#bn(e), this.#un(e, this.#J));
1437
+ async #dn() {
1438
+ let e = this.#q[this.#J];
1439
+ !e || !this.#se || (this.#X = await this.#Sn(e), this.#fn(e, this.#X));
1363
1440
  }
1364
- #un(e, t) {
1365
- this.#ae?.renderSpread(e, t, { fill: this.#F }), this.#dn(), this.#ze = 1, this.#pn();
1441
+ #fn(e, t) {
1442
+ this.#se?.renderSpread(e, t, {
1443
+ fill: this.#L,
1444
+ fit: this.#d
1445
+ }), this.#pn(), this.#Ve = 1, this.#hn();
1366
1446
  }
1367
- #dn() {
1368
- let e = this.#ae?.measure().book;
1369
- if (!e || e.width <= 0 || e.height <= 0) return;
1370
- let t = e.width / e.height;
1371
- this.#z !== null && Math.abs(t - this.#z) < .005 || (this.#z = t, this.#e.style.aspectRatio = t.toFixed(4));
1447
+ #pn() {
1448
+ let e = this.#se?.measure(), t = e?.containerAspect;
1449
+ if (t === void 0) {
1450
+ let n = e?.book;
1451
+ if (!n || n.width <= 0 || n.height <= 0) return;
1452
+ t = n.width / n.height;
1453
+ }
1454
+ t <= 0 || this.#V !== null && Math.abs(t - this.#V) < .005 || (this.#V = t, this.#e.style.aspectRatio = t.toFixed(4));
1372
1455
  }
1373
- #fn(e) {
1456
+ #mn(e) {
1374
1457
  if (this.#i.state !== "idle") {
1375
- this.#ke.add(e);
1458
+ this.#je.add(e);
1376
1459
  return;
1377
1460
  }
1378
- let t = this.#G[this.#K];
1461
+ let t = this.#q[this.#J];
1379
1462
  if (!(!t || !(t.left === e || t.right === e))) {
1380
- if (this.#ne > 1) {
1381
- this.#pn();
1463
+ if (this.#ie > 1) {
1464
+ this.#hn();
1382
1465
  return;
1383
1466
  }
1384
- this.#ln();
1467
+ this.#dn();
1385
1468
  }
1386
1469
  }
1387
- #pn() {
1388
- this.#Ve !== null && clearTimeout(this.#Ve);
1389
- let e = this.#hn();
1390
- if (e !== this.#ze) {
1470
+ #hn() {
1471
+ this.#Ue !== null && clearTimeout(this.#Ue);
1472
+ let e = this.#_n();
1473
+ if (e !== this.#Ve) {
1391
1474
  if (e === 1) {
1392
- this.#Be++, this.#ze = 1, this.#ln();
1475
+ this.#He++, this.#Ve = 1, this.#dn();
1393
1476
  return;
1394
1477
  }
1395
- this.#Ve = setTimeout(() => {
1396
- this.#Ve = null, this.#gn();
1397
- }, L);
1478
+ this.#Ue = setTimeout(() => {
1479
+ this.#Ue = null, this.#vn();
1480
+ }, R);
1398
1481
  }
1399
1482
  }
1400
- #mn() {
1401
- let e = this.#ae?.measure(), t = e?.content ?? e?.book;
1483
+ #gn() {
1484
+ let e = this.#se?.measure(), t = e?.content ?? e?.book;
1402
1485
  if (!t || t.width <= 0) return 1;
1403
- let n = this.#J, r = +!!n.left + +!!n.right;
1486
+ let n = this.#X, r = +!!n.left + +!!n.right;
1404
1487
  if (r === 0) return 1;
1405
1488
  let i = t.width / r, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = 0;
1406
1489
  for (let e of [n.left, n.right]) {
1407
1490
  if (!e || e.width <= 0) continue;
1408
- let t = e.width / this.#ze;
1491
+ let t = e.width / this.#Ve;
1409
1492
  o = Math.max(o, i * a / t);
1410
1493
  }
1411
1494
  return o === 0 ? 1 : o;
1412
1495
  }
1413
- #hn() {
1414
- let e = Math.max(1, z / (typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1)), t = this.#ne <= 1 ? 1 : this.#ne, n = this.#mn() * Math.max(t, e);
1415
- return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2, R);
1416
- }
1417
- async #gn() {
1418
- let e = this.#G[this.#K];
1419
- if (!this.#ae || !e) return;
1420
- let t = this.#hn();
1421
- if (t === 1 || t === this.#ze || this.#i.state !== "idle") return;
1422
- let n = ++this.#Be, r = {
1496
+ #_n() {
1497
+ let e = Math.max(1, B / (typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1)), t = this.#ie <= 1 ? 1 : this.#ie, n = this.#gn() * Math.max(t, e);
1498
+ return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2, z);
1499
+ }
1500
+ async #vn() {
1501
+ let e = this.#q[this.#J];
1502
+ if (!this.#se || !e) return;
1503
+ let t = this.#_n();
1504
+ if (t === 1 || t === this.#Ve || this.#i.state !== "idle") return;
1505
+ let n = ++this.#He, r = {
1423
1506
  x: 0,
1424
1507
  y: 0,
1425
1508
  width: 1,
@@ -1430,7 +1513,7 @@ var ce = class {
1430
1513
  return await this.#t.get(e, {
1431
1514
  scale: t,
1432
1515
  region: r,
1433
- maxSize: this.#ae?.maxTextureSize
1516
+ maxSize: this.#se?.maxTextureSize
1434
1517
  });
1435
1518
  } catch (t) {
1436
1519
  return this.#n.emit("sourceError", {
@@ -1439,34 +1522,37 @@ var ce = class {
1439
1522
  }), null;
1440
1523
  }
1441
1524
  }));
1442
- if (n !== this.#Be || this.#hn() !== t || this.#i.state !== "idle") return;
1443
- let a = i[0] ?? this.#J.left, o = i[1] ?? this.#J.right;
1444
- a === this.#J.left && o === this.#J.right || (this.#ze = t, this.#J = {
1525
+ if (n !== this.#He || this.#_n() !== t || this.#i.state !== "idle") return;
1526
+ let a = i[0] ?? this.#X.left, o = i[1] ?? this.#X.right;
1527
+ a === this.#X.left && o === this.#X.right || (this.#Ve = t, this.#X = {
1445
1528
  left: a,
1446
1529
  right: o
1447
- }, this.#ae.renderSpread(e, this.#J, { fill: this.#F }));
1530
+ }, this.#se.renderSpread(e, this.#X, {
1531
+ fill: this.#L,
1532
+ fit: this.#d
1533
+ }));
1448
1534
  }
1449
- #_n() {
1450
- if (this.#ke.size === 0) return;
1451
- let e = this.#G[this.#K], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#ke.has(e));
1452
- this.#ke.clear(), t && (this.#ne > 1 ? this.#pn() : this.#ln());
1535
+ #yn() {
1536
+ if (this.#je.size === 0) return;
1537
+ let e = this.#q[this.#J], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#je.has(e));
1538
+ this.#je.clear(), t && (this.#ie > 1 ? this.#hn() : this.#dn());
1453
1539
  }
1454
- #vn() {
1455
- typeof ResizeObserver > "u" || (this.#ee = new ResizeObserver(() => this.#yn()), this.#ee.observe(this.#e));
1540
+ #bn() {
1541
+ typeof ResizeObserver > "u" || (this.#ne = new ResizeObserver(() => this.#xn()), this.#ne.observe(this.#e));
1456
1542
  }
1457
- #yn() {
1458
- this.#te || (this.#te = !0, requestAnimationFrame(() => {
1459
- this.#te = !1, this.update();
1543
+ #xn() {
1544
+ this.#re || (this.#re = !0, requestAnimationFrame(() => {
1545
+ this.#re = !1, this.update();
1460
1546
  }));
1461
1547
  }
1462
- async #bn(e) {
1463
- let [t, n] = await Promise.all([this.#xn(e.left), this.#xn(e.right)]);
1548
+ async #Sn(e) {
1549
+ let [t, n] = await Promise.all([this.#Cn(e.left), this.#Cn(e.right)]);
1464
1550
  return {
1465
1551
  left: t,
1466
1552
  right: n
1467
1553
  };
1468
1554
  }
1469
- async #xn(e) {
1555
+ async #Cn(e) {
1470
1556
  if (e === null) return null;
1471
1557
  try {
1472
1558
  return await this.#t.get(e);
@@ -1477,30 +1563,30 @@ var ce = class {
1477
1563
  }), null;
1478
1564
  }
1479
1565
  }
1480
- #Sn() {
1481
- let { toMount: e } = this.#r.update(this.#K, this.#G.length), t = [];
1566
+ #wn() {
1567
+ let { toMount: e } = this.#r.update(this.#J, this.#q.length), t = [];
1482
1568
  for (let n of e) {
1483
- let e = this.#G[n];
1569
+ let e = this.#q[n];
1484
1570
  e?.left != null && t.push(e.left), e?.right != null && t.push(e.right);
1485
1571
  }
1486
1572
  this.#t.prefetch(t);
1487
1573
  }
1488
- #Cn(e) {
1489
- let t = this.#G.findIndex((t) => t.left === e || t.right === e);
1574
+ #Tn(e) {
1575
+ let t = this.#q.findIndex((t) => t.left === e || t.right === e);
1490
1576
  return t === -1 ? 0 : t;
1491
1577
  }
1492
- #wn() {
1578
+ #En() {
1493
1579
  let e = this.#t.pageCount;
1494
1580
  if (!Number.isInteger(e) || e < 1) throw Error(`Zine: source has ${e} pages; a Source must have at least 1 page.`);
1495
- let t = this.#B;
1581
+ let t = this.#H;
1496
1582
  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}).`);
1497
- let n = this.#on();
1498
- this.#F = n === "single", this.#G = a(e, {
1583
+ let n = this.#cn();
1584
+ this.#L = n === "single", this.#q = a(e, {
1499
1585
  direction: this.#a,
1500
1586
  mode: n
1501
1587
  });
1502
- let r = this.#V ? S(globalThis.location?.hash ?? "") : null;
1503
- this.#q = X(r ?? t ?? 0, 0, e - 1), this.#K = this.#Cn(this.#q);
1588
+ let r = this.#U ? S(globalThis.location?.hash ?? "") : null;
1589
+ this.#Y = X(r ?? t ?? 0, 0, e - 1), this.#J = this.#Tn(this.#Y);
1504
1590
  }
1505
1591
  };
1506
1592
  function X(e, t, n) {
@@ -1513,13 +1599,13 @@ function Z(e, t, n) {
1513
1599
  }
1514
1600
  return [n - (e + t), -e];
1515
1601
  }
1516
- function le(e) {
1602
+ function de(e) {
1517
1603
  return e < .5 ? 2 * e * e : 1 - (-2 * e + 2) ** 2 / 2;
1518
1604
  }
1519
1605
  function Q(e) {
1520
1606
  return e === null ? "null" : Array.isArray(e) ? "array" : typeof e;
1521
1607
  }
1522
- function ue(n, r) {
1608
+ function fe(n, r) {
1523
1609
  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)}.`);
1524
1610
  if (typeof r != "object" || !r) throw Error("Zine: an options object with a `source` is required.");
1525
1611
  let i = r, a = i.source;
@@ -1534,12 +1620,16 @@ function ue(n, r) {
1534
1620
  "half",
1535
1621
  "off"
1536
1622
  ].includes(c)) throw Error(`Zine: clickToFlip must be 'edge', 'half', or 'off'; got ${JSON.stringify(c)}.`);
1537
- let l = i.curl;
1538
- if (l !== void 0) {
1539
- if (typeof l == "object" && l) {
1540
- if (typeof l.deform != "function") throw Error("Zine: a curl model must have a deform() function.");
1541
- } else if (e.includes(l)) throw Error(`Zine: the '${String(l)}' curl is not bundled. Import it and pass the model: import { ${String(l)} } from '@zinejs/core/curls' → curl: ${String(l)}`);
1542
- else if (!t.includes(l)) throw Error(`Zine: curl must be ${t.join(" or ")}, or a model imported from '@zinejs/core/curls' (${e.join(", ")}); got ${JSON.stringify(l)}.`);
1623
+ let l = i.fit;
1624
+ if (l !== void 0 && l !== "contain" && l !== "fill") throw Error(`Zine: fit must be 'contain' or 'fill'; got ${JSON.stringify(l)}.`);
1625
+ let u = i.strings;
1626
+ if (u !== void 0 && (typeof u != "object" || !u)) throw Error(`Zine: strings must be an object of text overrides; got ${Q(u)}.`);
1627
+ let d = i.curl;
1628
+ if (d !== void 0) {
1629
+ if (typeof d == "object" && d) {
1630
+ if (typeof d.deform != "function") throw Error("Zine: a curl model must have a deform() function.");
1631
+ } else if (e.includes(d)) throw Error(`Zine: the '${String(d)}' curl is not bundled. Import it and pass the model: import { ${String(d)} } from '@zinejs/core/curls' → curl: ${String(d)}`);
1632
+ else if (!t.includes(d)) throw Error(`Zine: curl must be ${t.join(" or ")}, or a model imported from '@zinejs/core/curls' (${e.join(", ")}); got ${JSON.stringify(d)}.`);
1543
1633
  }
1544
1634
  for (let e of [
1545
1635
  "deepLink",
@@ -1547,62 +1637,62 @@ function ue(n, r) {
1547
1637
  "responsiveSpread",
1548
1638
  "loading"
1549
1639
  ]) if (i[e] !== void 0 && typeof i[e] != "boolean") throw Error(`Zine: ${e} must be a boolean; got ${Q(i[e])}.`);
1550
- let u = i.controls;
1551
- if (u !== void 0 && typeof u != "boolean" && (typeof u != "object" || !u)) throw Error(`Zine: controls must be a boolean or an options object; got ${Q(u)}.`);
1552
- let d = u?.position;
1553
- if (d !== void 0 && ![
1640
+ let f = i.controls;
1641
+ if (f !== void 0 && typeof f != "boolean" && (typeof f != "object" || !f)) throw Error(`Zine: controls must be a boolean or an options object; got ${Q(f)}.`);
1642
+ let p = f?.position;
1643
+ if (p !== void 0 && ![
1554
1644
  "top",
1555
1645
  "bottom",
1556
1646
  "left",
1557
1647
  "right"
1558
- ].includes(d)) throw Error(`Zine: controls.position must be 'top', 'bottom', 'left', or 'right'; got ${JSON.stringify(d)}.`);
1559
- let f = u?.colorScheme;
1560
- if (f !== void 0 && ![
1648
+ ].includes(p)) throw Error(`Zine: controls.position must be 'top', 'bottom', 'left', or 'right'; got ${JSON.stringify(p)}.`);
1649
+ let m = f?.colorScheme;
1650
+ if (m !== void 0 && ![
1561
1651
  "light",
1562
1652
  "dark",
1563
1653
  "auto"
1564
- ].includes(f)) throw Error(`Zine: controls.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(f)}.`);
1565
- let p = u?.arrows;
1566
- 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)}.`);
1567
- let m = i.contextMenu;
1568
- 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)}.`);
1569
- let h = m?.colorScheme;
1570
- if (h !== void 0 && ![
1654
+ ].includes(m)) throw Error(`Zine: controls.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(m)}.`);
1655
+ let h = f?.arrows;
1656
+ if (h !== void 0 && typeof h != "boolean" && !["desktop", "mobile"].includes(h)) throw Error(`Zine: controls.arrows must be a boolean, 'desktop', or 'mobile'; got ${JSON.stringify(h)}.`);
1657
+ let g = i.contextMenu;
1658
+ if (g !== void 0 && typeof g != "boolean" && (typeof g != "object" || !g)) throw Error(`Zine: contextMenu must be a boolean or an options object; got ${Q(g)}.`);
1659
+ let _ = g?.colorScheme;
1660
+ if (_ !== void 0 && ![
1571
1661
  "light",
1572
1662
  "dark",
1573
1663
  "auto"
1574
- ].includes(h)) throw Error(`Zine: contextMenu.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(h)}.`);
1575
- 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.");
1576
- let g = i.hideControls;
1577
- 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)}.`);
1578
- let _ = i.sound;
1579
- if (_ !== void 0 && typeof _ != "boolean" && (typeof _ != "object" || !_)) throw Error(`Zine: sound must be a boolean or an options object; got ${Q(_)}.`);
1580
- if (typeof _ == "object" && _) {
1581
- let e = _;
1664
+ ].includes(_)) throw Error(`Zine: contextMenu.colorScheme must be 'light', 'dark', or 'auto'; got ${JSON.stringify(_)}.`);
1665
+ if (i.disableContextMenu === !0 && g !== void 0 && g !== !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.");
1666
+ let v = i.hideControls;
1667
+ if (v !== void 0 && (!Array.isArray(v) || v.some((e) => typeof e != "string"))) throw Error(`Zine: hideControls must be an array of control-id strings; got ${Q(v)}.`);
1668
+ let y = i.sound;
1669
+ if (y !== void 0 && typeof y != "boolean" && (typeof y != "object" || !y)) throw Error(`Zine: sound must be a boolean or an options object; got ${Q(y)}.`);
1670
+ if (typeof y == "object" && y) {
1671
+ let e = y;
1582
1672
  if (e.url !== void 0 && typeof e.url != "string") throw Error(`Zine: sound.url must be a string URL; got ${Q(e.url)}.`);
1583
1673
  if (e.volume !== void 0 && (typeof e.volume != "number" || e.volume < 0 || e.volume > 1)) throw Error(`Zine: sound.volume must be a number between 0 and 1; got ${JSON.stringify(e.volume)}.`);
1584
1674
  if (e.muted !== void 0 && typeof e.muted != "boolean") throw Error(`Zine: sound.muted must be a boolean; got ${Q(e.muted)}.`);
1585
1675
  if (e.persist !== void 0 && typeof e.persist != "boolean") throw Error(`Zine: sound.persist must be a boolean; got ${Q(e.persist)}.`);
1586
1676
  }
1587
- let v = i.spreadMode;
1588
- if (v !== void 0 && ![
1677
+ let b = i.spreadMode;
1678
+ if (b !== void 0 && ![
1589
1679
  "double",
1590
1680
  "single",
1591
1681
  "cover",
1592
1682
  "book"
1593
- ].includes(v)) throw Error(`Zine: spreadMode must be 'double', 'single', 'cover', or 'book'; got ${JSON.stringify(v)}.`);
1683
+ ].includes(b)) throw Error(`Zine: spreadMode must be 'double', 'single', 'cover', or 'book'; got ${JSON.stringify(b)}.`);
1594
1684
  for (let e of ["frontCover", "backCover"]) {
1595
1685
  let t = i[e];
1596
1686
  if (t !== void 0 && typeof t != "string") throw Error(`Zine: ${e} must be an image URL string; got ${JSON.stringify(t)}.`);
1597
1687
  }
1598
- let y = i.pages;
1599
- if (y !== void 0 && (typeof y != "object" || !y || Array.isArray(y))) throw Error("Zine: pages must be an object mapping page indices to image URLs.");
1600
- $(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), de(i.zoom), fe(i.renderer);
1688
+ let x = i.pages;
1689
+ if (x !== void 0 && (typeof x != "object" || !x || Array.isArray(x))) throw Error("Zine: pages must be an object mapping page indices to image URLs.");
1690
+ $(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), pe(i.zoom), me(i.renderer);
1601
1691
  }
1602
1692
  function $(e, t, n) {
1603
1693
  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)}.`);
1604
1694
  }
1605
- function de(e) {
1695
+ function pe(e) {
1606
1696
  if (e === void 0) return;
1607
1697
  if (typeof e != "object" || !e || Array.isArray(e)) throw Error("Zine: zoom must be an object, e.g. { max: 4 }.");
1608
1698
  let t = e;
@@ -1615,7 +1705,7 @@ function de(e) {
1615
1705
  }
1616
1706
  $(t.max, "zoom.max", 1);
1617
1707
  }
1618
- function fe(e) {
1708
+ function me(e) {
1619
1709
  if (e !== void 0) {
1620
1710
  if (typeof e == "string") {
1621
1711
  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.`);
@@ -1630,7 +1720,7 @@ function fe(e) {
1630
1720
  }
1631
1721
  //#endregion
1632
1722
  //#region src/source/imageSource.ts
1633
- var pe = class {
1723
+ var he = class {
1634
1724
  pageCount;
1635
1725
  fit;
1636
1726
  #e;
@@ -1667,6 +1757,6 @@ var pe = class {
1667
1757
  }
1668
1758
  };
1669
1759
  //#endregion
1670
- export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, pe as ImageSource, ce as Zine, n as defineControl, r as getControl };
1760
+ export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, he as ImageSource, Y as Zine, k as defaultStrings, n as defineControl, r as getControl };
1671
1761
 
1672
1762
  //# sourceMappingURL=index.js.map