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