@zinejs/core 0.7.1 → 0.7.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -244,44 +244,33 @@ var _ = class {
244
244
  b: n
245
245
  };
246
246
  }
247
- };
248
- //#endregion
249
- //#region src/geometry/hitTest.ts
250
- function v(e, t, n) {
251
- let { width: r, height: i } = t;
252
- if (e.x < 0 || e.x > r || e.y < 0 || e.y > i) return "outside";
253
- let a = e.x <= n || e.x >= r - n, o = e.y <= n || e.y >= i - n;
254
- return a && o ? "corner" : "page";
255
- }
256
- //#endregion
257
- //#region src/engine/deeplink.ts
258
- var y = "page", b = !1;
259
- function x() {
260
- return b ? !1 : (b = !0, !0);
247
+ }, v = "page", y = !1;
248
+ function ee() {
249
+ return y ? !1 : (y = !0, !0);
261
250
  }
262
- function S() {
263
- b = !1;
251
+ function b() {
252
+ y = !1;
264
253
  }
265
- function C(e) {
266
- let t = new URLSearchParams(e.replace(/^#/, "")).get(y);
254
+ function x(e) {
255
+ let t = new URLSearchParams(e.replace(/^#/, "")).get(v);
267
256
  if (t === null) return null;
268
257
  let n = Number(t);
269
258
  return Number.isInteger(n) && n >= 1 ? n - 1 : null;
270
259
  }
271
- function w(e, t) {
260
+ function S(e, t) {
272
261
  let n = new URLSearchParams(e.replace(/^#/, ""));
273
- return n.set(y, String(t + 1)), `#${n.toString()}`;
262
+ return n.set(v, String(t + 1)), `#${n.toString()}`;
274
263
  }
275
- function T(e, t) {
264
+ function C(e, t) {
276
265
  let n = null, r = () => {
277
- let r = C(e.location.hash);
266
+ let r = x(e.location.hash);
278
267
  r === null || r === n || (n = r, t(r));
279
268
  };
280
269
  return e.addEventListener("hashchange", r), {
281
270
  push(t) {
282
271
  if (t === n) return;
283
272
  n = t;
284
- let r = w(e.location.hash, t);
273
+ let r = S(e.location.hash, t);
285
274
  r !== e.location.hash && e.history?.replaceState?.(e.history.state, "", r);
286
275
  },
287
276
  stop() {
@@ -291,49 +280,49 @@ function T(e, t) {
291
280
  }
292
281
  //#endregion
293
282
  //#region src/renderer/select.ts
294
- var E = {
283
+ var w = {
295
284
  css: async () => new (await (import("./cssRenderer-Deskm2ND.js"))).CssRenderer(),
296
285
  webgl2: async () => new (await (import("./webglRenderer-D_XGumQT.js"))).WebglRenderer()
297
- }, D = !0;
298
- function O(e) {
286
+ }, T = !0;
287
+ function E(e) {
299
288
  return typeof e == "object" && !!e && !Array.isArray(e) && typeof e.mount == "function";
300
289
  }
301
- function k(e) {
302
- return e.gpu && D ? ["webgl2", "css"] : ["css"];
290
+ function D(e) {
291
+ return e.gpu && T ? ["webgl2", "css"] : ["css"];
303
292
  }
304
- function A() {
305
- return { gpu: j() };
293
+ function O() {
294
+ return { gpu: k() };
306
295
  }
307
- function j() {
296
+ function k() {
308
297
  try {
309
298
  return !!document.createElement("canvas").getContext("webgl2");
310
299
  } catch {
311
300
  return !1;
312
301
  }
313
302
  }
314
- async function M(e = "auto", t = A()) {
315
- if (O(e)) return e;
316
- let n = Array.isArray(e) ? e : e === "auto" ? k(t) : [e];
303
+ async function A(e = "auto", t = O()) {
304
+ if (E(e)) return e;
305
+ let n = Array.isArray(e) ? e : e === "auto" ? D(t) : [e];
317
306
  for (let e of n) {
318
307
  if (e === "webgl2" && !t.gpu) continue;
319
- let n = E[e];
308
+ let n = w[e];
320
309
  if (n) return n();
321
310
  }
322
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'.`);
323
312
  }
324
313
  //#endregion
325
314
  //#region src/source/compose.ts
326
- function N(e, t) {
315
+ function j(e, t) {
327
316
  let n = typeof t.frontCover == "string", r = typeof t.backCover == "string", i = t.pages != null && Object.keys(t.pages).length > 0;
328
- return !n && !r && !i ? e : new F(e, t);
317
+ return !n && !r && !i ? e : new N(e, t);
329
318
  }
330
- function P(e) {
319
+ function M(e) {
331
320
  return fetch(e).then((t) => {
332
321
  if (!t.ok) throw Error(`zine: could not load image "${e}" (HTTP ${t.status}).`);
333
322
  return t.blob();
334
323
  }).then((e) => createImageBitmap(e));
335
324
  }
336
- var F = class {
325
+ var N = class {
337
326
  #e;
338
327
  #t;
339
328
  #n;
@@ -401,13 +390,13 @@ var F = class {
401
390
  }
402
391
  #s(e) {
403
392
  let t = this.#a.get(e);
404
- return t === void 0 && (t = P(e).catch((t) => {
393
+ return t === void 0 && (t = M(e).catch((t) => {
405
394
  throw this.#a.delete(e), t;
406
395
  }), this.#a.set(e, t)), t;
407
396
  }
408
- }, I = .25, L = .0015, R = 6, z = 250, B = 1.55, V = 32, H = 60, U = 2.5, W = 120;
397
+ }, P = .25, F = .0015, I = 6, L = 250, R = 24, z = 1.55, B = 32, V = 60, H = 2.5, U = 1.5, W = 120;
409
398
  function G(e, t, n) {
410
- let r = Math.max(0, t - V), i = Math.min(e.length, t + n + V), a = e.slice(r, i).replace(/\s+/g, " ").trim();
399
+ let r = Math.max(0, t - B), i = Math.min(e.length, t + n + B), a = e.slice(r, i).replace(/\s+/g, " ").trim();
411
400
  return `${r > 0 ? "…" : ""}${a}${i < e.length ? "…" : ""}`;
412
401
  }
413
402
  var K = class {
@@ -475,24 +464,25 @@ var K = class {
475
464
  #ie = null;
476
465
  #ae = null;
477
466
  #oe = null;
478
- #se = /* @__PURE__ */ new Set();
479
- #ce;
480
- #le = null;
481
- #ue = 1;
482
- #de = 0;
483
- #fe = null;
484
- #pe;
467
+ #se = null;
468
+ #ce = /* @__PURE__ */ new Set();
469
+ #le;
470
+ #ue = null;
471
+ #de = 1;
472
+ #fe = 0;
473
+ #pe = null;
474
+ #me;
485
475
  debug = { setFlipProgress: (e, t) => {
486
476
  this.#z?.setFlipProgress(e, t);
487
477
  } };
488
478
  constructor(e, t) {
489
- Q(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 = N(t.source, {
479
+ Q(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 = j(t.source, {
490
480
  frontCover: t.frontCover,
491
481
  backCover: t.backCover,
492
482
  pages: t.pages
493
483
  });
494
484
  let n = t.direction ?? "ltr";
495
- this.#a = n, this.#x = (t.deepLink ?? !0) && x(), this.#S = 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.#m = t.singlePageThreshold ?? 640, this.#v = t.responsiveSpread ?? !0, this.#ce = t.controls ?? !0, this.#b = t.startPage, typeof this.#t.open != "function" && this.#ht(), this.#k = t.flipDuration ?? 800, this.#A = t.zoom?.enabled ?? !0, this.#j = t.zoom?.wheel ?? !0;
485
+ this.#a = n, this.#x = (t.deepLink ?? !0) && ee(), this.#S = 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.#m = t.singlePageThreshold ?? 640, this.#v = t.responsiveSpread ?? !0, this.#le = t.controls ?? !0, this.#b = t.startPage, typeof this.#t.open != "function" && this.#yt(), this.#k = t.flipDuration ?? 800, this.#A = t.zoom?.enabled ?? !0, this.#j = t.zoom?.wheel ?? !0;
496
486
  let r = t.zoom?.doubleClick, i = r === !1 ? [] : [...r ?? [
497
487
  1,
498
488
  2,
@@ -500,10 +490,10 @@ var K = class {
500
490
  ]].sort((e, t) => e - t);
501
491
  this.#M = i.length > 0 ? i : null, this.#N = t.zoom?.max ?? 4;
502
492
  let a = this.#A && this.#M !== null, o = t.zoom?.doubleClickInFlipZone ?? this.#u === "half";
503
- this.#f = this.#u !== "off" && a && o && t.clickFlipDelay !== 0, this.#p = this.#f ? t.clickFlipDelay ?? z : 0, this.#pe = this.#Ve(t.renderer ?? "auto");
493
+ this.#f = this.#u !== "off" && a && o && t.clickFlipDelay !== 0, this.#p = this.#f ? t.clickFlipDelay ?? L : 0, this.#me = this.#We(t.renderer ?? "auto");
504
494
  }
505
495
  get ready() {
506
- return this.#pe;
496
+ return this.#me;
507
497
  }
508
498
  getPageCount() {
509
499
  return this.#t.pageCount;
@@ -530,7 +520,7 @@ var K = class {
530
520
  return this.#h;
531
521
  }
532
522
  setSpreadMode(e) {
533
- e !== this.#o && (this.#o = e, this.#_ = !1, this.#et(), this.#tt());
523
+ e !== this.#o && (this.#o = e, this.#_ = !1, this.#rt(), this.#it());
534
524
  }
535
525
  toggleSpreadMode() {
536
526
  this.setSpreadMode(this.#o === "single" ? this.#s === "single" ? "double" : this.#s : "single");
@@ -546,16 +536,16 @@ var K = class {
546
536
  if (this.#v = e, e) {
547
537
  let e = this.#z?.measure().containerWidth;
548
538
  if (e === void 0) return;
549
- this.#_ = !1, this.#$e(e);
539
+ this.#_ = !1, this.#nt(e);
550
540
  } else {
551
541
  if (!this.#_) return;
552
- this.#_ = !1, this.#et();
542
+ this.#_ = !1, this.#rt();
553
543
  }
554
- this.#tt();
544
+ this.#it();
555
545
  }
556
546
  }
557
547
  getPageImage(e) {
558
- return this.#ft(e);
548
+ return this.#gt(e);
559
549
  }
560
550
  canFlipNext() {
561
551
  return this.#E + 1 < this.#T.length;
@@ -603,11 +593,11 @@ var K = class {
603
593
  return typeof this.#t.getOutline == "function";
604
594
  }
605
595
  getOutline() {
606
- if (!this.#oe) {
596
+ if (!this.#se) {
607
597
  let e = this.#t.getOutline;
608
- this.#oe = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
598
+ this.#se = typeof e == "function" ? Promise.resolve(e.call(this.#t)).catch(() => []) : Promise.resolve([]);
609
599
  }
610
- return this.#oe;
600
+ return this.#se;
611
601
  }
612
602
  async getSourceFile() {
613
603
  let e = this.#t.getDownload;
@@ -645,29 +635,29 @@ var K = class {
645
635
  return a;
646
636
  }
647
637
  flipNext() {
648
- this.#me(1);
638
+ this.#he(1);
649
639
  }
650
640
  flipPrev() {
651
- this.#me(-1);
641
+ this.#he(-1);
652
642
  }
653
- #me(e) {
654
- this.#he(() => this.#ye(this.#E + e));
643
+ #he(e) {
644
+ this.#ge(() => this.#be(this.#E + e));
655
645
  }
656
646
  flipTo(e) {
657
647
  let t = q(e, 0, Math.max(0, this.#t.pageCount - 1));
658
- this.#he(() => this.#ye(this.#mt(t)));
648
+ this.#ge(() => this.#be(this.#vt(t)));
659
649
  }
660
- #he(e) {
661
- this.#i.state === "idle" ? e() : this.#J ? (this.#q = null, this.#ge(), e()) : this.#q = e;
650
+ #ge(e) {
651
+ this.#i.state === "idle" ? e() : this.#J ? (this.#q = null, this.#_e(), e()) : this.#q = e;
662
652
  }
663
- #ge() {
653
+ #_e() {
664
654
  let e = this.#J;
665
655
  e && (this.#J = null, this.#H !== null && (cancelAnimationFrame(this.#H), this.#H = null), this.#z?.setFlipProgress(e.toT, e.direction), e.onDone());
666
656
  }
667
- #_e() {
657
+ #ve() {
668
658
  let e = this.#q;
669
659
  if (!e) {
670
- this.#ct();
660
+ this.#ft();
671
661
  return;
672
662
  }
673
663
  this.#q = null, e();
@@ -684,12 +674,12 @@ var K = class {
684
674
  x: r.containerWidth / 2,
685
675
  y: r.containerHeight / 2
686
676
  }, o = this.#I, s = n === 1 ? 0 : a.x - n / o * (a.x - this.#L), c = n === 1 ? 0 : a.y - n / o * (a.y - this.#R);
687
- [s, c] = this.#ve(s, c, n, r.containerWidth, r.containerHeight), this.#I = n, this.#L = s, this.#R = c, this.#z.setViewTransform(n, s, c), this.#at(), this.#n.emit("zoomChanged", { scale: n });
677
+ [s, c] = this.#ye(s, c, n, r.containerWidth, r.containerHeight), this.#I = n, this.#L = s, this.#R = c, this.#z.setViewTransform(n, s, c), this.#ct(), this.#n.emit("zoomChanged", { scale: n });
688
678
  }
689
679
  resetZoom() {
690
680
  this.setZoom(1);
691
681
  }
692
- #ve(e, t, n, r, i) {
682
+ #ye(e, t, n, r, i) {
693
683
  let a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = (e) => Math.round(e * a) / a || 0, s = this.#z?.measure().screenAt?.(n) ?? {
694
684
  x: 0,
695
685
  y: 0,
@@ -702,29 +692,29 @@ var K = class {
702
692
  return this.#n.on(e, t);
703
693
  }
704
694
  destroy() {
705
- this.#V = !0, this.#H !== null && cancelAnimationFrame(this.#H), this.#J = null, this.#q = null, this.#Ne(), this.#P?.disconnect(), this.#C?.stop(), this.#C = null, this.#w?.(), this.#x && S(), this.#le?.(), this.#ae?.(), this.#ne?.(), this.#ie?.(), this.#re?.(), this.#te?.(), this.#fe !== null && clearTimeout(this.#fe), this.#de++, this.#z?.destroy(), this.#z = null, this.#t.destroy(), this.#n.clear();
695
+ this.#V = !0, this.#H !== null && cancelAnimationFrame(this.#H), this.#J = null, this.#q = null, this.#Fe(), this.#P?.disconnect(), this.#C?.stop(), this.#C = null, this.#w?.(), this.#x && b(), this.#ue?.(), this.#oe?.(), this.#ne?.(), this.#ie?.(), this.#re?.(), this.#te?.(), this.#pe !== null && clearTimeout(this.#pe), this.#fe++, this.#z?.destroy(), this.#z = null, this.#t.destroy(), this.#n.clear();
706
696
  }
707
- #ye(e) {
697
+ #be(e) {
708
698
  if (e < 0 || e >= this.#T.length || e === this.#E || this.#i.send("flip") === null) return;
709
- let t = e > this.#E ? "forward" : "backward", n = this.#Ce(e);
699
+ let t = e > this.#E ? "forward" : "backward", n = this.#we(e);
710
700
  this.#n.emit("flipStart", {
711
701
  from: this.#D,
712
702
  to: n
713
- }), this.#be(e, t, n, ++this.#Y);
703
+ }), this.#xe(e, t, n, ++this.#Y);
714
704
  }
715
- async #be(e, t, n, r) {
716
- let i = this.#T[e], a = i ? await this.#dt(i) : {
705
+ async #xe(e, t, n, r) {
706
+ let i = this.#T[e], a = i ? await this.#ht(i) : {
717
707
  left: null,
718
708
  right: null
719
709
  };
720
710
  r === this.#Y && (this.#z?.beginFlip(this.#O, a, t, {
721
711
  fill: this.#h,
722
- curl: this.#Ze(),
712
+ curl: this.#et(),
723
713
  anchor: { y: this.#l }
724
- }), this.#xe(0, 1, t, () => this.#Se(e, n, a)));
714
+ }), this.#Se(0, 1, t, () => this.#Ce(e, n, a)));
725
715
  }
726
- #xe(e, t, n, r) {
727
- let i = this.#Xe() * Math.abs(t - e);
716
+ #Se(e, t, n, r) {
717
+ let i = this.#$e() * Math.abs(t - e);
728
718
  if (i <= 0) {
729
719
  this.#z?.setFlipProgress(t, n), r();
730
720
  return;
@@ -742,19 +732,19 @@ var K = class {
742
732
  };
743
733
  this.#H = requestAnimationFrame(s);
744
734
  }
745
- #Se(e, t, n) {
735
+ #Ce(e, t, n) {
746
736
  let r = this.#T[e];
747
- this.#E = e, this.#D = t, this.#O = n, r && this.#nt(r, n), this.#pt(), this.#i.send("settle"), this.#Ye(), this.#n.emit("pageChanged", { page: t }), this.#n.emit("flipEnd", { page: t }), this.#_e();
737
+ this.#E = e, this.#D = t, this.#O = n, r && this.#at(r, n), this.#_t(), this.#i.send("settle"), this.#Qe(), this.#n.emit("pageChanged", { page: t }), this.#n.emit("flipEnd", { page: t }), this.#ve();
748
738
  }
749
- #Ce(e) {
739
+ #we(e) {
750
740
  let t = this.#T[e];
751
741
  if (!t) return this.#D;
752
742
  let n = [t.left, t.right].filter((e) => e !== null);
753
743
  return n.length > 0 ? Math.min(...n) : this.#D;
754
744
  }
755
- #we(e, t) {
745
+ #Te(e, t) {
756
746
  if (this.#Z || !this.#z) return;
757
- if (this.#Ne(), this.#I > 1) {
747
+ if (this.#Fe(), this.#I > 1) {
758
748
  if (this.#i.send("panStart") === null) return;
759
749
  this.#X = {
760
750
  baseTx: this.#L,
@@ -762,26 +752,27 @@ var K = class {
762
752
  };
763
753
  return;
764
754
  }
765
- let n = this.#Ae(), r = this.#je(e, t);
766
- if (this.#G = r, this.#i.state !== "idle") {
767
- this.#W = null;
768
- return;
755
+ let n = this.#je(), r = this.#Me(e, t);
756
+ this.#G = r;
757
+ let i = Math.min(n.width, n.height) * P, 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;
758
+ if (this.#i.state !== "idle") {
759
+ if (!this.#J || !s) {
760
+ this.#W = null;
761
+ return;
762
+ }
763
+ this.#_e();
769
764
  }
770
- let i = Math.min(n.width, n.height) * I;
771
- if (v(r, {
772
- width: n.width,
773
- height: n.height
774
- }, i) !== "corner") return;
765
+ if (!s) return;
775
766
  this.#l = q(r.y / n.height, 0, 1);
776
- let a = r.x > n.width / 2, o = this.#a === "rtl" ? !a : a, s = this.#E + (o ? 1 : -1);
777
- s < 0 || s >= this.#T.length || (this.#W = {
778
- direction: o ? "forward" : "backward",
779
- targetIndex: s,
780
- toPage: this.#Ce(s),
767
+ let c = r.x > n.width / 2, l = this.#a === "rtl" ? !c : c, u = this.#E + (l ? 1 : -1);
768
+ u < 0 || u >= this.#T.length || (this.#W = {
769
+ direction: l ? "forward" : "backward",
770
+ targetIndex: u,
771
+ toPage: this.#we(u),
781
772
  width: n.width
782
773
  });
783
774
  }
784
- #Te() {
775
+ #Ee() {
785
776
  let e = this.#W;
786
777
  e && (this.#W = null, this.#i.send("grab") !== null && (this.#U = {
787
778
  direction: e.direction,
@@ -796,32 +787,32 @@ var K = class {
796
787
  }, this.#n.emit("flipStart", {
797
788
  from: this.#D,
798
789
  to: e.toPage
799
- }), this.#Ee(e.targetIndex, e.direction)));
790
+ }), this.#De(e.targetIndex, e.direction)));
800
791
  }
801
- async #Ee(e, t) {
802
- let n = this.#T[e], r = n ? await this.#dt(n) : {
792
+ async #De(e, t) {
793
+ let n = this.#T[e], r = n ? await this.#ht(n) : {
803
794
  left: null,
804
795
  right: null
805
796
  };
806
797
  this.#U?.targetIndex === e && (this.#U.toContent = r, this.#z?.beginFlip(this.#O, r, t, {
807
798
  fill: this.#h,
808
- curl: this.#Ze(),
799
+ curl: this.#et(),
809
800
  anchor: { y: this.#l }
810
801
  }), this.#z?.setFlipProgress(this.#U.t, t));
811
802
  }
812
- #De(e, t) {
803
+ #Oe(e, t) {
813
804
  if (this.#Z) return;
814
805
  if (this.#X) {
815
806
  if (!this.#z) return;
816
- let n = this.#z.measure(), [r, i] = this.#ve(this.#X.baseTx + e, this.#X.baseTy + t, this.#I, n.containerWidth, n.containerHeight);
817
- this.#L = r, this.#R = i, this.#z.setViewTransform(this.#I, r, i), this.#at();
807
+ let n = this.#z.measure(), [r, i] = this.#ye(this.#X.baseTx + e, this.#X.baseTy + t, this.#I, n.containerWidth, n.containerHeight);
808
+ this.#L = r, this.#R = i, this.#z.setViewTransform(this.#I, r, i), this.#ct();
818
809
  return;
819
810
  }
820
- this.#W && Math.hypot(e, t) > R && this.#Te();
811
+ this.#W && Math.hypot(e, t) > I && this.#Ee();
821
812
  let n = this.#U;
822
813
  n && (n.t = q((n.direction === "forward" ? -e : e) / n.width, 0, 1), this.#z?.setFlipProgress(n.t, n.direction));
823
814
  }
824
- #Oe(e) {
815
+ #ke(e) {
825
816
  if (this.#Z) return;
826
817
  if (this.#X) {
827
818
  this.#X = null, this.#i.send("panEnd");
@@ -829,30 +820,28 @@ var K = class {
829
820
  }
830
821
  let t = this.#U;
831
822
  if (!t) {
832
- this.#W = null, this.#ke(e);
823
+ this.#W = null, this.#Ae(e);
833
824
  return;
834
825
  }
835
826
  this.#U = null, this.#i.send("release");
836
827
  let n = e.swipe && (t.direction === "forward" ? e.dx < 0 : e.dx > 0);
837
- t.t >= .5 || n ? this.#xe(t.t, 1, t.direction, () => this.#Se(t.targetIndex, t.toPage, t.toContent)) : this.#xe(t.t, 0, t.direction, () => this.#Pe());
838
- }
839
- #ke(e) {
840
- if (this.#u === "off" || this.#I > 1 || !this.#G || Math.abs(e.dx) > R || Math.abs(e.dy) > R) return;
841
- let t = this.#Me(this.#G);
842
- if (!t) return;
843
- let n = t === "forward" ? 1 : -1;
844
- if (this.#E + n < 0 || this.#E + n >= this.#T.length) return;
845
- this.#l = q(this.#G.y / this.#Ae().height, 0, 1);
846
- let r = () => this.#ye(this.#E + n);
847
- if (this.#Ne(), this.#p <= 0) {
848
- this.#he(r);
828
+ t.t >= .5 || n ? this.#Se(t.t, 1, t.direction, () => this.#Ce(t.targetIndex, t.toPage, t.toContent)) : this.#Se(t.t, 0, t.direction, () => this.#Ie());
829
+ }
830
+ #Ae(e) {
831
+ if (this.#u === "off" || this.#I > 1 || !this.#G || Math.abs(e.dx) > I || Math.abs(e.dy) > I) return;
832
+ let t = this.#Ne(this.#G);
833
+ if (!t || !this.#Pe(t)) return;
834
+ this.#l = q(this.#G.y / this.#je().height, 0, 1);
835
+ let n = t === "forward" ? 1 : -1, r = () => this.#be(this.#E + n);
836
+ if (this.#Fe(), this.#p <= 0) {
837
+ this.#ge(r);
849
838
  return;
850
839
  }
851
840
  this.#K = setTimeout(() => {
852
- this.#K = null, this.#he(r);
841
+ this.#K = null, this.#ge(r);
853
842
  }, this.#p);
854
843
  }
855
- #Ae() {
844
+ #je() {
856
845
  let e = this.#z.measure();
857
846
  return e.content ?? e.book ?? {
858
847
  x: 0,
@@ -861,36 +850,40 @@ var K = class {
861
850
  height: e.containerHeight
862
851
  };
863
852
  }
864
- #je(e, t) {
865
- let n = this.#e.getBoundingClientRect(), r = this.#Ae();
853
+ #Me(e, t) {
854
+ let n = this.#e.getBoundingClientRect(), r = this.#je();
866
855
  return {
867
856
  x: e - n.left - r.x,
868
857
  y: t - n.top - r.y
869
858
  };
870
859
  }
871
- #Me(e) {
860
+ #Ne(e) {
872
861
  if (!this.#z) return null;
873
- let t = this.#Ae().width, n;
862
+ let t = this.#je().width, n;
874
863
  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;
875
864
  let r = this.#a === "rtl" ? "left" : "right";
876
865
  return n === r ? "forward" : "backward";
877
866
  }
878
- #Ne() {
867
+ #Pe(e) {
868
+ let t = this.#E + (e === "forward" ? 1 : -1);
869
+ return t >= 0 && t < this.#T.length;
870
+ }
871
+ #Fe() {
879
872
  this.#K !== null && (clearTimeout(this.#K), this.#K = null);
880
873
  }
881
- #Pe() {
874
+ #Ie() {
882
875
  let e = this.#T[this.#E];
883
- e && this.#nt(e, this.#O), this.#i.send("settle"), this.#n.emit("flipEnd", { page: this.#D }), this.#_e();
876
+ e && this.#at(e, this.#O), this.#i.send("settle"), this.#n.emit("flipEnd", { page: this.#D }), this.#ve();
884
877
  }
885
- #Fe() {
886
- if (this.#W = null, this.#Ne(), this.#U) {
878
+ #Le() {
879
+ if (this.#W = null, this.#Fe(), this.#U) {
887
880
  this.#U = null, this.#i.send("release"), this.#i.send("settle");
888
881
  let e = this.#T[this.#E];
889
- e && this.#nt(e, this.#O);
882
+ e && this.#at(e, this.#O);
890
883
  } else this.#X && (this.#X = null, this.#i.send("panEnd"));
891
884
  this.#Z = !0, this.#Q = this.#I;
892
885
  }
893
- #Ie(e, t, n) {
886
+ #Re(e, t, n) {
894
887
  if (!this.#Z) return;
895
888
  let r = this.#e.getBoundingClientRect();
896
889
  this.setZoom(this.#Q * n, {
@@ -898,19 +891,19 @@ var K = class {
898
891
  y: t - r.top
899
892
  });
900
893
  }
901
- #Le() {
894
+ #ze() {
902
895
  this.#Z = !1;
903
896
  }
904
- #Re() {
897
+ #Be() {
905
898
  if (!this.#S) return;
906
899
  let e = (e) => e.preventDefault();
907
900
  this.#e.addEventListener("contextmenu", e), this.#re = () => this.#e.removeEventListener("contextmenu", e);
908
901
  }
909
- #ze() {
902
+ #Ve() {
910
903
  let e = (e) => {
911
904
  if (!this.#j || !this.#A || !(e.ctrlKey || e.metaKey)) return;
912
905
  e.preventDefault();
913
- let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * L);
906
+ let t = this.#e.getBoundingClientRect(), n = Math.exp(-e.deltaY * F);
914
907
  this.setZoom(this.#I * n, {
915
908
  x: e.clientX - t.left,
916
909
  y: e.clientY - t.top
@@ -918,90 +911,102 @@ var K = class {
918
911
  };
919
912
  this.#e.addEventListener("wheel", e, { passive: !1 }), this.#ne = () => this.#e.removeEventListener("wheel", e);
920
913
  }
921
- #Be() {
914
+ #He() {
922
915
  let e = (e) => {
923
916
  let t = this.#M;
924
917
  if (!this.#A || t === null || !this.#z) return;
925
- if (this.#I <= 1 && this.#u !== "off" && !this.#f) {
926
- let t = this.#je(e.clientX, e.clientY);
927
- if (this.#Me(t) !== null) return;
918
+ let n = performance.now(), r = this.#ae;
919
+ if (!(r !== null && n - r.t <= L && Math.hypot(e.clientX - r.x, e.clientY - r.y) <= R)) {
920
+ this.#ae = {
921
+ t: n,
922
+ x: e.clientX,
923
+ y: e.clientY
924
+ };
925
+ return;
928
926
  }
929
- this.#Ne(), e.preventDefault();
930
- let n = t.find((e) => e > this.#I + 1e-6) ?? t[0] ?? this.#I, r = this.#e.getBoundingClientRect();
931
- this.setZoom(n, {
932
- x: e.clientX - r.left,
933
- y: e.clientY - r.top
934
- });
927
+ this.#ae = null, this.#Ue(e.clientX, e.clientY, t);
935
928
  };
936
- this.#e.addEventListener("dblclick", e), this.#ie = () => this.#e.removeEventListener("dblclick", e);
929
+ this.#e.addEventListener("click", e), this.#ie = () => this.#e.removeEventListener("click", e);
937
930
  }
938
- async #Ve(e) {
939
- let t = M(e);
940
- typeof this.#t.open == "function" && (await this.#t.open(), this.#ht()), this.#t.prefetch([this.#D]);
941
- let n = await t, r = await this.#He(n);
942
- this.#z = r, this.#t.onPageUpdate?.((e) => this.#it(e)), this.#$e(r.measure().containerWidth);
931
+ #Ue(e, t, n) {
932
+ if (this.#I <= 1 && this.#u !== "off" && !this.#f) {
933
+ let n = this.#Me(e, t), r = this.#Ne(n);
934
+ if (r !== null && this.#Pe(r)) return;
935
+ }
936
+ this.#Fe();
937
+ let r = n.find((e) => e > this.#I + 1e-6) ?? n[0] ?? this.#I, i = this.#e.getBoundingClientRect();
938
+ this.setZoom(r, {
939
+ x: e - i.left,
940
+ y: t - i.top
941
+ });
942
+ }
943
+ async #We(e) {
944
+ let t = A(e);
945
+ typeof this.#t.open == "function" && (await this.#t.open(), this.#yt()), this.#t.prefetch([this.#D]);
946
+ let n = await t, r = await this.#Ge(n);
947
+ this.#z = r, this.#t.onPageUpdate?.((e) => this.#st(e)), this.#nt(r.measure().containerWidth);
943
948
  let i = new m({
944
- onStart: (e) => this.#we(e.x, e.y),
945
- onMove: (e) => this.#De(e.dx, e.dy),
946
- onEnd: (e) => this.#Oe(e)
949
+ onStart: (e) => this.#Te(e.x, e.y),
950
+ onMove: (e) => this.#Oe(e.dx, e.dy),
951
+ onEnd: (e) => this.#ke(e)
947
952
  }), a = new _({
948
- onPinchStart: () => this.#Fe(),
949
- onPinchMove: (e) => this.#Ie(e.centerX, e.centerY, e.scale),
950
- onPinchEnd: () => this.#Le()
953
+ onPinchStart: () => this.#Le(),
954
+ onPinchMove: (e) => this.#Re(e.centerX, e.centerY, e.scale),
955
+ onPinchEnd: () => this.#ze()
951
956
  });
952
957
  this.#te = h(this.#e, {
953
958
  pointer: i,
954
959
  pinch: a
955
- }), this.#ze(), this.#Be(), this.#Re(), this.#We(), this.#ae = this.#qe(), await this.#tt(), this.#lt(), this.#pt(), this.#Ye(), this.#Ke(), await this.#Ge(), this.#n.emit("ready");
960
+ }), this.#Ve(), this.#He(), this.#Be(), this.#qe(), this.#oe = this.#Xe(), await this.#it(), this.#pt(), this.#_t(), this.#Qe(), this.#Ye(), await this.#Je(), this.#n.emit("ready");
956
961
  }
957
- async #He(e) {
962
+ async #Ge(e) {
958
963
  try {
959
964
  return await e.mount(this.#e), e.onFatal?.(() => {
960
- this.#Ue();
965
+ this.#Ke();
961
966
  }), e;
962
967
  } catch {
963
968
  e.destroy();
964
- let t = await M("css");
969
+ let t = await A("css");
965
970
  return await t.mount(this.#e), this.#B = !0, this.#n.emit("rendererFallback", {
966
971
  from: "webgl2",
967
972
  to: "css"
968
973
  }), t;
969
974
  }
970
975
  }
971
- async #Ue() {
976
+ async #Ke() {
972
977
  if (this.#B || this.#V) return;
973
978
  this.#B = !0, this.#z?.destroy(), this.#z = null;
974
- let e = await M("css");
979
+ let e = await A("css");
975
980
  if (this.#V) {
976
981
  e.destroy();
977
982
  return;
978
983
  }
979
- await e.mount(this.#e), this.#z = e, this.#$e(e.measure().containerWidth), await this.#tt(), this.#n.emit("rendererFallback", {
984
+ await e.mount(this.#e), this.#z = e, this.#nt(e.measure().containerWidth), await this.#it(), this.#n.emit("rendererFallback", {
980
985
  from: "webgl2",
981
986
  to: "css"
982
987
  });
983
988
  }
984
- #We() {
989
+ #qe() {
985
990
  if (typeof matchMedia != "function") return;
986
991
  let e = matchMedia("(prefers-reduced-motion: reduce)");
987
992
  this.#$ = e.matches, e.addEventListener?.("change", (e) => {
988
993
  this.#$ = e.matches;
989
994
  });
990
995
  }
991
- async #Ge() {
992
- if (this.#ce === !1 || this.#V) return;
996
+ async #Je() {
997
+ if (this.#le === !1 || this.#V) return;
993
998
  let e = this.#e;
994
999
  if (!(!e.ownerDocument || typeof e.appendChild != "function")) try {
995
1000
  let { mountControls: t } = await import("./controls-BrPo8pKL.js");
996
1001
  if (this.#V) return;
997
- let n = this.#ce === !0 ? {} : this.#ce;
998
- this.#le = t(this, e, n);
1002
+ let n = this.#le === !0 ? {} : this.#le;
1003
+ this.#ue = t(this, e, n);
999
1004
  } catch {}
1000
1005
  }
1001
- #Ke() {
1006
+ #Ye() {
1002
1007
  if (!this.#x || globalThis.location === void 0) return;
1003
1008
  let e = globalThis;
1004
- this.#C = T(e, (e) => {
1009
+ this.#C = C(e, (e) => {
1005
1010
  e !== this.#D && this.flipTo(e);
1006
1011
  }), this.#C.push(this.#D), this.#w = this.#n.on("pageChanged", ({ page: e }) => {
1007
1012
  this.#C?.push(e);
@@ -1011,20 +1016,20 @@ var K = class {
1011
1016
  let t = globalThis.location?.href ?? "";
1012
1017
  if (!t) return "";
1013
1018
  let n = new URL(t);
1014
- return n.hash = w(n.hash, q(e, 0, Math.max(0, this.#t.pageCount - 1))), n.toString();
1019
+ return n.hash = S(n.hash, q(e, 0, Math.max(0, this.#t.pageCount - 1))), n.toString();
1015
1020
  }
1016
- #qe() {
1021
+ #Xe() {
1017
1022
  let e = this.#e, t = e.ownerDocument;
1018
1023
  if (!t || typeof e.setAttribute != "function") return null;
1019
1024
  e.hasAttribute("tabindex") || (e.tabIndex = 0), e.setAttribute("aria-roledescription", "flipbook");
1020
- let n = (e) => this.#Je(e);
1025
+ let n = (e) => this.#Ze(e);
1021
1026
  e.addEventListener("keydown", n);
1022
1027
  let r = t.createElement("div");
1023
1028
  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.#ee = r, () => {
1024
1029
  e.removeEventListener("keydown", n), r.remove(), this.#ee = null;
1025
1030
  };
1026
1031
  }
1027
- #Je(e) {
1032
+ #Ze(e) {
1028
1033
  let t = this.#a === "rtl" ? "ArrowLeft" : "ArrowRight";
1029
1034
  switch (e.key) {
1030
1035
  case "ArrowRight":
@@ -1040,78 +1045,92 @@ var K = class {
1040
1045
  default: break;
1041
1046
  }
1042
1047
  }
1043
- #Ye() {
1048
+ #Qe() {
1044
1049
  this.#ee && (this.#ee.textContent = `Page ${this.#D + 1} of ${this.#t.pageCount}`);
1045
1050
  }
1046
- #Xe() {
1047
- return this.#$ ? W : this.#k * (this.#h ? B : 1);
1051
+ #$e() {
1052
+ return this.#$ ? W : this.#k * (this.#h ? z : 1);
1048
1053
  }
1049
- #Ze() {
1054
+ #et() {
1050
1055
  return this.#$ ? "simple" : this.#c;
1051
1056
  }
1052
1057
  update() {
1053
- !this.#z || this.#i.state !== "idle" || (this.#$e(this.#z.measure().containerWidth), this.#tt());
1058
+ !this.#z || this.#i.state !== "idle" || (this.#nt(this.#z.measure().containerWidth), this.#it());
1054
1059
  }
1055
- #Qe() {
1060
+ #tt() {
1056
1061
  return this.#_ || this.#o === "single" ? "single" : this.#o;
1057
1062
  }
1058
- #$e(e) {
1063
+ #nt(e) {
1059
1064
  let t = this.#v && o(e, this.#m);
1060
- t !== this.#_ && (this.#_ = t, this.#et());
1065
+ t !== this.#_ && (this.#_ = t, this.#rt());
1061
1066
  }
1062
- #et() {
1063
- let e = this.#Qe(), t = e !== this.#g;
1067
+ #rt() {
1068
+ let e = this.#tt(), t = e !== this.#g;
1064
1069
  this.#g = e, this.#h = e === "single", this.#T = a(this.#t.pageCount, {
1065
1070
  direction: this.#a,
1066
1071
  mode: e
1067
- }), this.#E = this.#mt(this.#D), t && this.#n.emit("spreadChanged", {
1072
+ }), this.#E = this.#vt(this.#D), t && this.#n.emit("spreadChanged", {
1068
1073
  mode: e,
1069
1074
  singlePage: this.#h
1070
1075
  });
1071
1076
  }
1072
- async #tt() {
1077
+ async #it() {
1073
1078
  let e = this.#T[this.#E];
1074
- !e || !this.#z || (this.#O = await this.#dt(e), this.#nt(e, this.#O));
1079
+ !e || !this.#z || (this.#O = await this.#ht(e), this.#at(e, this.#O));
1075
1080
  }
1076
- #nt(e, t) {
1077
- this.#z?.renderSpread(e, t, { fill: this.#h }), this.#rt(), this.#ue = 1, this.#at();
1081
+ #at(e, t) {
1082
+ this.#z?.renderSpread(e, t, { fill: this.#h }), this.#ot(), this.#de = 1, this.#ct();
1078
1083
  }
1079
- #rt() {
1084
+ #ot() {
1080
1085
  let e = this.#z?.measure().book;
1081
1086
  if (!e || e.width <= 0 || e.height <= 0) return;
1082
1087
  let t = (e.width / e.height).toFixed(4);
1083
1088
  t !== this.#y && (this.#y = t, this.#e.style.aspectRatio = t);
1084
1089
  }
1085
- #it(e) {
1090
+ #st(e) {
1086
1091
  if (this.#i.state !== "idle") {
1087
- this.#se.add(e);
1092
+ this.#ce.add(e);
1088
1093
  return;
1089
1094
  }
1090
1095
  let t = this.#T[this.#E];
1091
- t && (t.left === e || t.right === e) && this.#tt();
1096
+ t && (t.left === e || t.right === e) && this.#it();
1092
1097
  }
1093
- #at() {
1094
- this.#fe !== null && clearTimeout(this.#fe);
1095
- let e = this.#ot();
1096
- if (e !== this.#ue) {
1098
+ #ct() {
1099
+ this.#pe !== null && clearTimeout(this.#pe);
1100
+ let e = this.#ut();
1101
+ if (e !== this.#de) {
1097
1102
  if (e === 1) {
1098
- this.#de++, this.#ue = 1, this.#tt();
1103
+ this.#fe++, this.#de = 1, this.#it();
1099
1104
  return;
1100
1105
  }
1101
- this.#fe = setTimeout(() => {
1102
- this.#fe = null, this.#st();
1103
- }, H);
1106
+ this.#pe = setTimeout(() => {
1107
+ this.#pe = null, this.#dt();
1108
+ }, V);
1104
1109
  }
1105
1110
  }
1106
- #ot() {
1107
- return this.#I <= 1 ? 1 : Math.min(Math.ceil(this.#I * 2) / 2, U);
1111
+ #lt() {
1112
+ let e = this.#z?.measure(), t = e?.content ?? e?.book;
1113
+ if (!t || t.width <= 0) return 1;
1114
+ let n = this.#O, r = +!!n.left + +!!n.right;
1115
+ if (r === 0) return 1;
1116
+ let i = t.width / r, a = typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1, o = 0;
1117
+ for (let e of [n.left, n.right]) {
1118
+ if (!e || e.width <= 0) continue;
1119
+ let t = e.width / this.#de;
1120
+ o = Math.max(o, i * a / t);
1121
+ }
1122
+ return o === 0 ? 1 : o;
1108
1123
  }
1109
- async #st() {
1124
+ #ut() {
1125
+ let e = Math.max(1, U / (typeof devicePixelRatio == "number" && devicePixelRatio > 0 ? devicePixelRatio : 1)), t = this.#I <= 1 ? 1 : this.#I, n = this.#lt() * Math.max(t, e);
1126
+ return n <= 1.001 ? 1 : Math.min(Math.ceil(n * 2) / 2, H);
1127
+ }
1128
+ async #dt() {
1110
1129
  let e = this.#T[this.#E];
1111
1130
  if (!this.#z || !e) return;
1112
- let t = this.#ot();
1113
- if (t === 1 || t === this.#ue) return;
1114
- let n = ++this.#de, r = {
1131
+ let t = this.#ut();
1132
+ if (t === 1 || t === this.#de) return;
1133
+ let n = ++this.#fe, r = {
1115
1134
  x: 0,
1116
1135
  y: 0,
1117
1136
  width: 1,
@@ -1130,34 +1149,34 @@ var K = class {
1130
1149
  }), null;
1131
1150
  }
1132
1151
  }));
1133
- if (n !== this.#de || this.#ot() !== t) return;
1152
+ if (n !== this.#fe || this.#ut() !== t) return;
1134
1153
  let a = i[0] ?? null, o = i[1] ?? null;
1135
- a === this.#O.left && o === this.#O.right || (this.#ue = t, this.#O = {
1154
+ a === this.#O.left && o === this.#O.right || (this.#de = t, this.#O = {
1136
1155
  left: a,
1137
1156
  right: o
1138
1157
  }, this.#z.renderSpread(e, this.#O, { fill: this.#h }));
1139
1158
  }
1140
- #ct() {
1141
- if (this.#se.size === 0) return;
1142
- let e = this.#T[this.#E], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#se.has(e));
1143
- this.#se.clear(), t && this.#tt();
1159
+ #ft() {
1160
+ if (this.#ce.size === 0) return;
1161
+ let e = this.#T[this.#E], t = e !== void 0 && [e.left, e.right].some((e) => e !== null && this.#ce.has(e));
1162
+ this.#ce.clear(), t && this.#it();
1144
1163
  }
1145
- #lt() {
1146
- typeof ResizeObserver > "u" || (this.#P = new ResizeObserver(() => this.#ut()), this.#P.observe(this.#e));
1164
+ #pt() {
1165
+ typeof ResizeObserver > "u" || (this.#P = new ResizeObserver(() => this.#mt()), this.#P.observe(this.#e));
1147
1166
  }
1148
- #ut() {
1167
+ #mt() {
1149
1168
  this.#F || (this.#F = !0, requestAnimationFrame(() => {
1150
1169
  this.#F = !1, this.update();
1151
1170
  }));
1152
1171
  }
1153
- async #dt(e) {
1154
- let [t, n] = await Promise.all([this.#ft(e.left), this.#ft(e.right)]);
1172
+ async #ht(e) {
1173
+ let [t, n] = await Promise.all([this.#gt(e.left), this.#gt(e.right)]);
1155
1174
  return {
1156
1175
  left: t,
1157
1176
  right: n
1158
1177
  };
1159
1178
  }
1160
- async #ft(e) {
1179
+ async #gt(e) {
1161
1180
  if (e === null) return null;
1162
1181
  try {
1163
1182
  return await this.#t.get(e);
@@ -1168,7 +1187,7 @@ var K = class {
1168
1187
  }), null;
1169
1188
  }
1170
1189
  }
1171
- #pt() {
1190
+ #_t() {
1172
1191
  let { toMount: e } = this.#r.update(this.#E, this.#T.length), t = [];
1173
1192
  for (let n of e) {
1174
1193
  let e = this.#T[n];
@@ -1176,22 +1195,22 @@ var K = class {
1176
1195
  }
1177
1196
  this.#t.prefetch(t);
1178
1197
  }
1179
- #mt(e) {
1198
+ #vt(e) {
1180
1199
  let t = this.#T.findIndex((t) => t.left === e || t.right === e);
1181
1200
  return t === -1 ? 0 : t;
1182
1201
  }
1183
- #ht() {
1202
+ #yt() {
1184
1203
  let e = this.#t.pageCount;
1185
1204
  if (!Number.isInteger(e) || e < 1) throw Error(`Zine: source has ${e} pages; a Source must have at least 1 page.`);
1186
1205
  let t = this.#b;
1187
1206
  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}).`);
1188
- let n = this.#Qe();
1207
+ let n = this.#tt();
1189
1208
  this.#h = n === "single", this.#T = a(e, {
1190
1209
  direction: this.#a,
1191
1210
  mode: n
1192
1211
  });
1193
- let r = this.#x ? C(globalThis.location?.hash ?? "") : null;
1194
- this.#D = q(r ?? t ?? 0, 0, e - 1), this.#E = this.#mt(this.#D);
1212
+ let r = this.#x ? x(globalThis.location?.hash ?? "") : null;
1213
+ this.#D = q(r ?? t ?? 0, 0, e - 1), this.#E = this.#vt(this.#D);
1195
1214
  }
1196
1215
  };
1197
1216
  function q(e, t, n) {
@@ -1262,12 +1281,12 @@ function Q(n, r) {
1262
1281
  }
1263
1282
  let p = i.pages;
1264
1283
  if (p !== void 0 && (typeof p != "object" || !p || Array.isArray(p))) throw Error("Zine: pages must be an object mapping page indices to image URLs.");
1265
- $(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), ee(i.zoom), te(i.renderer);
1284
+ $(i.width, "width", 1), $(i.height, "height", 1), $(i.flipDuration, "flipDuration", 0), $(i.clickZoneSize, "clickZoneSize", 0), $(i.clickFlipDelay, "clickFlipDelay", 0), $(i.singlePageThreshold, "singlePageThreshold", 0), te(i.zoom), ne(i.renderer);
1266
1285
  }
1267
1286
  function $(e, t, n) {
1268
1287
  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)}.`);
1269
1288
  }
1270
- function ee(e) {
1289
+ function te(e) {
1271
1290
  if (e === void 0) return;
1272
1291
  if (typeof e != "object" || !e || Array.isArray(e)) throw Error("Zine: zoom must be an object, e.g. { max: 4 }.");
1273
1292
  let t = e;
@@ -1280,7 +1299,7 @@ function ee(e) {
1280
1299
  }
1281
1300
  $(t.max, "zoom.max", 1);
1282
1301
  }
1283
- function te(e) {
1302
+ function ne(e) {
1284
1303
  if (e !== void 0) {
1285
1304
  if (typeof e == "string") {
1286
1305
  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.`);
@@ -1295,7 +1314,7 @@ function te(e) {
1295
1314
  }
1296
1315
  //#endregion
1297
1316
  //#region src/source/imageSource.ts
1298
- var ne = class {
1317
+ var re = class {
1299
1318
  pageCount;
1300
1319
  fit;
1301
1320
  #e;
@@ -1332,6 +1351,6 @@ var ne = class {
1332
1351
  }
1333
1352
  };
1334
1353
  //#endregion
1335
- export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, ne as ImageSource, K as Zine, n as defineControl, r as getControl };
1354
+ export { t as CURL_TYPES, i as DEFAULT_ITEMS, e as IMPORTABLE_CURLS, re as ImageSource, K as Zine, n as defineControl, r as getControl };
1336
1355
 
1337
1356
  //# sourceMappingURL=index.js.map