@embedpdf-editor/chapter-snippet 0.3.0 → 0.3.1

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.
@@ -297,26 +297,26 @@ function _unsupportedIterableToArray(r, a) {
297
297
  }
298
298
 
299
299
  var n$1,
300
- l$2,
300
+ l$1,
301
301
  u$2,
302
- i$1,
302
+ i$2,
303
303
  o$1,
304
304
  r$3,
305
305
  e$2,
306
306
  f$2,
307
- c$1,
307
+ c$2,
308
308
  s$2,
309
309
  a$2,
310
- h$1,
311
- p$1 = {},
310
+ h$2,
311
+ p$2 = {},
312
312
  v$1 = [],
313
313
  y$1 = /acit|ex(?:s|g|n|p|$)|rph|grid|ows|mnc|ntw|ine[ch]|zoo|^ord|itera/i,
314
- d$1 = Array.isArray;
314
+ d$2 = Array.isArray;
315
315
  function w$1(n, l) {
316
316
  for (var u in l) n[u] = l[u];
317
317
  return n;
318
318
  }
319
- function g$1(n) {
319
+ function g$2(n) {
320
320
  n && n.parentNode && n.parentNode.removeChild(n);
321
321
  }
322
322
  function _$1(l, u, t) {
@@ -344,7 +344,7 @@ function m$1(n, t, i, o, r) {
344
344
  __i: -1,
345
345
  __u: 0
346
346
  };
347
- return null == r && null != l$2.vnode && l$2.vnode(e), e;
347
+ return null == r && null != l$1.vnode && l$1.vnode(e), e;
348
348
  }
349
349
  function k$2(n) {
350
350
  return n.children;
@@ -368,10 +368,10 @@ function C$1(n) {
368
368
  }
369
369
  }
370
370
  function M(n) {
371
- (!n.__d && (n.__d = true) && i$1.push(n) && !$$2.__r++ || o$1 != l$2.debounceRendering) && ((o$1 = l$2.debounceRendering) || r$3)($$2);
371
+ (!n.__d && (n.__d = true) && i$2.push(n) && !$$2.__r++ || o$1 != l$1.debounceRendering) && ((o$1 = l$1.debounceRendering) || r$3)($$2);
372
372
  }
373
373
  function $$2() {
374
- for (var n, u, t, o, r, f, c, s = 1; i$1.length;) i$1.length > s && i$1.sort(e$2), n = i$1.shift(), s = i$1.length, n.__d && (t = void 0, o = void 0, r = (o = (u = n).__v).__e, f = [], c = [], u.__P && ((t = w$1({}, o)).__v = o.__v + 1, l$2.vnode && l$2.vnode(t), O$1(u.__P, t, o, u.__n, u.__P.namespaceURI, 32 & o.__u ? [r] : null, f, null == r ? S(o) : r, !!(32 & o.__u), c), t.__v = o.__v, t.__.__k[t.__i] = t, N$2(f, t, c), o.__e = o.__ = null, t.__e != r && C$1(t)));
374
+ for (var n, u, t, o, r, f, c, s = 1; i$2.length;) i$2.length > s && i$2.sort(e$2), n = i$2.shift(), s = i$2.length, n.__d && (t = void 0, o = void 0, r = (o = (u = n).__v).__e, f = [], c = [], u.__P && ((t = w$1({}, o)).__v = o.__v + 1, l$1.vnode && l$1.vnode(t), O$1(u.__P, t, o, u.__n, u.__P.namespaceURI, 32 & o.__u ? [r] : null, f, null == r ? S(o) : r, !!(32 & o.__u), c), t.__v = o.__v, t.__.__k[t.__i] = t, N$2(f, t, c), o.__e = o.__ = null, t.__e != r && C$1(t)));
375
375
  $$2.__r = 0;
376
376
  }
377
377
  function I(n, l, u, t, i, o, r, e, f, c, s) {
@@ -384,7 +384,7 @@ function I(n, l, u, t, i, o, r, e, f, c, s) {
384
384
  _,
385
385
  m = t && t.__k || v$1,
386
386
  b = l.length;
387
- for (f = P$1(u, l, m, f, b), a = 0; a < b; a++) null != (y = u.__k[a]) && (h = -1 == y.__i ? p$1 : m[y.__i] || p$1, y.__i = a, g = O$1(n, y, h, i, o, r, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && B$2(h.ref, null, y), s.push(y.ref, y.__c || d, y)), null == w && null != d && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = A$1(y, f, n, _) : "function" == typeof y.type && void 0 !== g ? f = g : d && (f = d.nextSibling), y.__u &= -7);
387
+ for (f = P$1(u, l, m, f, b), a = 0; a < b; a++) null != (y = u.__k[a]) && (h = -1 == y.__i ? p$2 : m[y.__i] || p$2, y.__i = a, g = O$1(n, y, h, i, o, r, e, f, c, s), d = y.__e, y.ref && h.ref != y.ref && (h.ref && B$2(h.ref, null, y), s.push(y.ref, y.__c || d, y)), null == w && null != d && (w = d), (_ = !!(4 & y.__u)) || h.__k === y.__k ? f = A$1(y, f, n, _) : "function" == typeof y.type && void 0 !== g ? f = g : d && (f = d.nextSibling), y.__u &= -7);
388
388
  return u.__e = w, f;
389
389
  }
390
390
  function P$1(n, l, u, t, i) {
@@ -396,7 +396,7 @@ function P$1(n, l, u, t, i) {
396
396
  s = u.length,
397
397
  a = s,
398
398
  h = 0;
399
- for (n.__k = new Array(i), o = 0; o < i; o++) null != (r = l[o]) && "boolean" != typeof r && "function" != typeof r ? ("string" == typeof r || "number" == typeof r || "bigint" == typeof r || r.constructor == String ? r = n.__k[o] = m$1(null, r, null, null, null) : d$1(r) ? r = n.__k[o] = m$1(k$2, {
399
+ for (n.__k = new Array(i), o = 0; o < i; o++) null != (r = l[o]) && "boolean" != typeof r && "function" != typeof r ? ("string" == typeof r || "number" == typeof r || "bigint" == typeof r || r.constructor == String ? r = n.__k[o] = m$1(null, r, null, null, null) : d$2(r) ? r = n.__k[o] = m$1(k$2, {
400
400
  children: r
401
401
  }, null, null, null) : void 0 === r.constructor && r.__b > 0 ? r = n.__k[o] = m$1(r.type, r.props, r.key, r.ref ? r.ref : null, r.__v) : n.__k[o] = r, f = o + h, r.__ = n, r.__b = n.__b + 1, e = null, -1 != (c = r.__i = L$1(r, u, f, a)) && (a--, (e = u[c]) && (e.__u |= 2)), null == e || null == e.__v ? (-1 == c && (i > s ? h-- : i < s && h++), "function" != typeof r.type && (r.__u |= 4)) : c != f && (c == f - 1 ? h-- : c == f + 1 ? h++ : (c > f ? h-- : h++, r.__u |= 4))) : n.__k[o] = null;
402
402
  if (a) for (o = 0; o < s; o++) null != (e = u[o]) && 0 == (2 & e.__u) && (e.__e == t && (t = S(e)), D$2(e, e));
@@ -415,7 +415,7 @@ function A$1(n, l, u, t) {
415
415
  return l;
416
416
  }
417
417
  function H$1(n, l) {
418
- return l = l || [], null == n || "boolean" == typeof n || (d$1(n) ? n.some(function (n) {
418
+ return l = l || [], null == n || "boolean" == typeof n || (d$2(n) ? n.some(function (n) {
419
419
  H$1(n, l);
420
420
  }) : l.push(n)), l;
421
421
  }
@@ -441,7 +441,7 @@ function j$2(n, l, u, t, i) {
441
441
  if ("string" == typeof t && (n.style.cssText = t = ""), t) for (l in t) u && l in u || T$3(n.style, l, "");
442
442
  if (u) for (l in u) t && u[l] == t[l] || T$3(n.style, l, u[l]);
443
443
  }
444
- } else if ("o" == l[0] && "n" == l[1]) o = l != (l = l.replace(f$2, "$1")), r = l.toLowerCase(), l = r in n || "onFocusOut" == l || "onFocusIn" == l ? r.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + o] = u, u ? t ? u.u = t.u : (u.u = c$1, n.addEventListener(l, o ? a$2 : s$2, o)) : n.removeEventListener(l, o ? a$2 : s$2, o);else {
444
+ } else if ("o" == l[0] && "n" == l[1]) o = l != (l = l.replace(f$2, "$1")), r = l.toLowerCase(), l = r in n || "onFocusOut" == l || "onFocusIn" == l ? r.slice(2) : l.slice(2), n.l || (n.l = {}), n.l[l + o] = u, u ? t ? u.u = t.u : (u.u = c$2, n.addEventListener(l, o ? a$2 : s$2, o)) : n.removeEventListener(l, o ? a$2 : s$2, o);else {
445
445
  if ("http://www.w3.org/2000/svg" == i) l = l.replace(/xlink(H|:h)/, "h").replace(/sName$/, "s");else if ("width" != l && "height" != l && "href" != l && "list" != l && "form" != l && "tabIndex" != l && "download" != l && "rowSpan" != l && "colSpan" != l && "role" != l && "popover" != l && l in n) try {
446
446
  n[l] = null == u ? "" : u;
447
447
  break n;
@@ -453,8 +453,8 @@ function F$2(n) {
453
453
  return function (u) {
454
454
  if (this.l) {
455
455
  var t = this.l[u.type + n];
456
- if (null == u.t) u.t = c$1++;else if (u.t < t.u) return;
457
- return t(l$2.event ? l$2.event(u) : u);
456
+ if (null == u.t) u.t = c$2++;else if (u.t < t.u) return;
457
+ return t(l$1.event ? l$1.event(u) : u);
458
458
  }
459
459
  };
460
460
  }
@@ -478,7 +478,7 @@ function O$1(n, u, t, i, o, r, e, f, c, s) {
478
478
  T,
479
479
  j = u.type;
480
480
  if (void 0 !== u.constructor) return null;
481
- 128 & t.__u && (c = !!(32 & t.__u), r = [f = u.__e = t.__e]), (a = l$2.__b) && a(u);
481
+ 128 & t.__u && (c = !!(32 & t.__u), r = [f = u.__e = t.__e]), (a = l$1.__b) && a(u);
482
482
  n: if ("function" == typeof j) try {
483
483
  if (b = u.props, S = "prototype" in j && j.prototype.render, C = (a = j.contextType) && i[a.__c], M = a ? C ? C.props.value : a.__ : i, t.__c ? m = (h = u.__c = t.__c).__ = h.__E : (S ? u.__c = h = new j(b, M) : (u.__c = h = new x$1(b, M), h.constructor = j, h.render = E$2), C && C.sub(h), h.state || (h.state = {}), h.__n = i, p = h.__d = !0, h.__h = [], h._sb = []), S && null == h.__s && (h.__s = h.state), S && null != j.getDerivedStateFromProps && (h.__s == h.state && (h.__s = w$1({}, h.__s)), w$1(h.__s, j.getDerivedStateFromProps(b, h.__s))), v = h.props, y = h.state, h.__v = u, p) S && null == j.getDerivedStateFromProps && null != h.componentWillMount && h.componentWillMount(), S && null != h.componentDidMount && h.__h.push(h.componentDidMount);else {
484
484
  if (S && null == j.getDerivedStateFromProps && b !== v && null != h.componentWillReceiveProps && h.componentWillReceiveProps(b, M), u.__v == t.__v || !h.__e && null != h.shouldComponentUpdate && !1 === h.shouldComponentUpdate(b, h.__s, M)) {
@@ -492,44 +492,44 @@ function O$1(n, u, t, i, o, r, e, f, c, s) {
492
492
  h.componentDidUpdate(v, y, _);
493
493
  });
494
494
  }
495
- if (h.context = M, h.props = b, h.__P = n, h.__e = !1, P = l$2.__r, A = 0, S) {
495
+ if (h.context = M, h.props = b, h.__P = n, h.__e = !1, P = l$1.__r, A = 0, S) {
496
496
  for (h.state = h.__s, h.__d = !1, P && P(u), a = h.render(h.props, h.state, h.context), H = 0; H < h._sb.length; H++) h.__h.push(h._sb[H]);
497
497
  h._sb = [];
498
498
  } else do {
499
499
  h.__d = !1, P && P(u), a = h.render(h.props, h.state, h.context), h.state = h.__s;
500
500
  } while (h.__d && ++A < 25);
501
- h.state = h.__s, null != h.getChildContext && (i = w$1(w$1({}, i), h.getChildContext())), S && !p && null != h.getSnapshotBeforeUpdate && (_ = h.getSnapshotBeforeUpdate(v, y)), L = a, null != a && a.type === k$2 && null == a.key && (L = V$2(a.props.children)), f = I(n, d$1(L) ? L : [L], u, t, i, o, r, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), m && (h.__E = h.__ = null);
501
+ h.state = h.__s, null != h.getChildContext && (i = w$1(w$1({}, i), h.getChildContext())), S && !p && null != h.getSnapshotBeforeUpdate && (_ = h.getSnapshotBeforeUpdate(v, y)), L = a, null != a && a.type === k$2 && null == a.key && (L = V$2(a.props.children)), f = I(n, d$2(L) ? L : [L], u, t, i, o, r, e, f, c, s), h.base = u.__e, u.__u &= -161, h.__h.length && e.push(h), m && (h.__E = h.__ = null);
502
502
  } catch (n) {
503
503
  if (u.__v = null, c || null != r) {
504
504
  if (n.then) {
505
505
  for (u.__u |= c ? 160 : 128; f && 8 == f.nodeType && f.nextSibling;) f = f.nextSibling;
506
506
  r[r.indexOf(f)] = null, u.__e = f;
507
507
  } else {
508
- for (T = r.length; T--;) g$1(r[T]);
508
+ for (T = r.length; T--;) g$2(r[T]);
509
509
  z$1(u);
510
510
  }
511
511
  } else u.__e = t.__e, u.__k = t.__k, n.then || z$1(u);
512
- l$2.__e(n, u, t);
512
+ l$1.__e(n, u, t);
513
513
  } else null == r && u.__v == t.__v ? (u.__k = t.__k, u.__e = t.__e) : f = u.__e = q$3(t.__e, u, t, i, o, r, e, c, s);
514
- return (a = l$2.diffed) && a(u), 128 & u.__u ? void 0 : f;
514
+ return (a = l$1.diffed) && a(u), 128 & u.__u ? void 0 : f;
515
515
  }
516
516
  function z$1(n) {
517
517
  n && n.__c && (n.__c.__e = true), n && n.__k && n.__k.forEach(z$1);
518
518
  }
519
519
  function N$2(n, u, t) {
520
520
  for (var i = 0; i < t.length; i++) B$2(t[i], t[++i], t[++i]);
521
- l$2.__c && l$2.__c(u, n), n.some(function (u) {
521
+ l$1.__c && l$1.__c(u, n), n.some(function (u) {
522
522
  try {
523
523
  n = u.__h, u.__h = [], n.some(function (n) {
524
524
  n.call(u);
525
525
  });
526
526
  } catch (n) {
527
- l$2.__e(n, u.__v);
527
+ l$1.__e(n, u.__v);
528
528
  }
529
529
  });
530
530
  }
531
531
  function V$2(n) {
532
- return "object" != typeof n || null == n || n.__b && n.__b > 0 ? n : d$1(n) ? n.map(V$2) : w$1({}, n);
532
+ return "object" != typeof n || null == n || n.__b && n.__b > 0 ? n : d$2(n) ? n.map(V$2) : w$1({}, n);
533
533
  }
534
534
  function q$3(u, t, i, o, r, e, f, c, s) {
535
535
  var a,
@@ -539,7 +539,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
539
539
  w,
540
540
  _,
541
541
  m,
542
- b = i.props || p$1,
542
+ b = i.props || p$2,
543
543
  k = t.props,
544
544
  x = t.type;
545
545
  if ("svg" == x ? r = "http://www.w3.org/2000/svg" : "math" == x ? r = "http://www.w3.org/1998/Math/MathML" : r || (r = "http://www.w3.org/1999/xhtml"), null != e) for (a = 0; a < e.length; a++) if ((w = e[a]) && "setAttribute" in w == !!x && (x ? w.localName == x : 3 == w.nodeType)) {
@@ -548,7 +548,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
548
548
  }
549
549
  if (null == u) {
550
550
  if (null == x) return document.createTextNode(k);
551
- u = document.createElementNS(r, x, k.is && k), c && (l$2.__m && l$2.__m(t, e), c = false), e = null;
551
+ u = document.createElementNS(r, x, k.is && k), c && (l$1.__m && l$1.__m(t, e), c = false), e = null;
552
552
  }
553
553
  if (null == x) b === k || c && u.data == k || (u.data = k);else {
554
554
  if (e = e && n$1.call(u.childNodes), !c && null != e) for (b = {}, a = 0; a < u.attributes.length; a++) b[(w = u.attributes[a]).name] = w.value;
@@ -557,7 +557,7 @@ function q$3(u, t, i, o, r, e, f, c, s) {
557
557
  j$2(u, a, null, w, r);
558
558
  }
559
559
  for (a in k) w = k[a], "children" == a ? y = w : "dangerouslySetInnerHTML" == a ? h = w : "value" == a ? _ = w : "checked" == a ? m = w : c && "function" != typeof w || b[a] === w || j$2(u, a, w, b[a], r);
560
- if (h) c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];else if (v && (u.innerHTML = ""), I("template" == t.type ? u.content : u, d$1(y) ? y : [y], t, i, o, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : r, e, f, e ? e[0] : i.__k && S(i, 0), c, s), null != e) for (a = e.length; a--;) g$1(e[a]);
560
+ if (h) c || v && (h.__html == v.__html || h.__html == u.innerHTML) || (u.innerHTML = h.__html), t.__k = [];else if (v && (u.innerHTML = ""), I("template" == t.type ? u.content : u, d$2(y) ? y : [y], t, i, o, "foreignObject" == x ? "http://www.w3.org/1999/xhtml" : r, e, f, e ? e[0] : i.__k && S(i, 0), c, s), null != e) for (a = e.length; a--;) g$2(e[a]);
561
561
  c || (a = "value", "progress" == x && null == _ ? u.removeAttribute("value") : null != _ && (_ !== u[a] || "progress" == x && !_ || "option" == x && _ != b[a]) && j$2(u, a, _, b[a], r), a = "checked", null != m && m != u[a] && j$2(u, a, m, b[a], r));
562
562
  }
563
563
  return u;
@@ -569,28 +569,28 @@ function B$2(n, u, t) {
569
569
  i && n.__u(), i && null == u || (n.__u = n(u));
570
570
  } else n.current = u;
571
571
  } catch (n) {
572
- l$2.__e(n, t);
572
+ l$1.__e(n, t);
573
573
  }
574
574
  }
575
575
  function D$2(n, u, t) {
576
576
  var i, o;
577
- if (l$2.unmount && l$2.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || B$2(i, null, u)), null != (i = n.__c)) {
577
+ if (l$1.unmount && l$1.unmount(n), (i = n.ref) && (i.current && i.current != n.__e || B$2(i, null, u)), null != (i = n.__c)) {
578
578
  if (i.componentWillUnmount) try {
579
579
  i.componentWillUnmount();
580
580
  } catch (n) {
581
- l$2.__e(n, u);
581
+ l$1.__e(n, u);
582
582
  }
583
583
  i.base = i.__P = null;
584
584
  }
585
585
  if (i = n.__k) for (o = 0; o < i.length; o++) i[o] && D$2(i[o], u, t || "function" != typeof n.type);
586
- t || g$1(n.__e), n.__c = n.__ = n.__e = void 0;
586
+ t || g$2(n.__e), n.__c = n.__ = n.__e = void 0;
587
587
  }
588
588
  function E$2(n, l, u) {
589
589
  return this.constructor(n, u);
590
590
  }
591
591
  function G$1(u, t, i) {
592
592
  var o, r, e, f;
593
- t == document && (t = document.documentElement), l$2.__ && l$2.__(u, t), r = (o = "function" == "undefined") ? null : t.__k, e = [], f = [], O$1(t, u = (t).__k = _$1(k$2, null, [u]), r || p$1, p$1, t.namespaceURI, r ? null : t.firstChild ? n$1.call(t.childNodes) : null, e, r ? r.__e : t.firstChild, o, f), N$2(e, u, f);
593
+ t == document && (t = document.documentElement), l$1.__ && l$1.__(u, t), r = (o = "function" == "undefined") ? null : t.__k, e = [], f = [], O$1(t, u = (t).__k = _$1(k$2, null, [u]), r || p$2, p$2, t.namespaceURI, r ? null : t.firstChild ? n$1.call(t.childNodes) : null, e, r ? r.__e : t.firstChild, o, f), N$2(e, u, f);
594
594
  }
595
595
  function Q$3(n) {
596
596
  function l(n) {
@@ -611,11 +611,11 @@ function Q$3(n) {
611
611
  };
612
612
  }), n.children;
613
613
  }
614
- return l.__c = "__cC" + h$1++, l.__ = n, l.Provider = l.__l = (l.Consumer = function (n, l) {
614
+ return l.__c = "__cC" + h$2++, l.__ = n, l.Provider = l.__l = (l.Consumer = function (n, l) {
615
615
  return n.children(l);
616
616
  }).contextType = l, l;
617
617
  }
618
- n$1 = v$1.slice, l$2 = {
618
+ n$1 = v$1.slice, l$1 = {
619
619
  __e: function (n, l, u, t) {
620
620
  for (var i, o, r; l = l.__;) if ((i = l.__c) && !i.__) try {
621
621
  if ((o = i.constructor) && null != o.getDerivedStateFromError && (i.setState(o.getDerivedStateFromError(n)), r = i.__d), null != i.componentDidCatch && (i.componentDidCatch(n, t || {}), r = i.__d), r) return i.__E = i;
@@ -629,9 +629,9 @@ n$1 = v$1.slice, l$2 = {
629
629
  u = null != this.__s && this.__s != this.state ? this.__s : this.__s = w$1({}, this.state), "function" == typeof n && (n = n(w$1({}, u), this.props)), n && w$1(u, n), null != n && this.__v && (l && this._sb.push(l), M(this));
630
630
  }, x$1.prototype.forceUpdate = function (n) {
631
631
  this.__v && (this.__e = true, n && this.__h.push(n), M(this));
632
- }, x$1.prototype.render = k$2, i$1 = [], r$3 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$2 = function (n, l) {
632
+ }, x$1.prototype.render = k$2, i$2 = [], r$3 = "function" == typeof Promise ? Promise.prototype.then.bind(Promise.resolve()) : setTimeout, e$2 = function (n, l) {
633
633
  return n.__v.__b - l.__v.__b;
634
- }, $$2.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$1 = 0, s$2 = F$2(false), a$2 = F$2(true), h$1 = 0;
634
+ }, $$2.__r = 0, f$2 = /(PointerCapture)$|Capture$/i, c$2 = 0, s$2 = F$2(false), a$2 = F$2(true), h$2 = 0;
635
635
 
636
636
  var f$1 = 0;
637
637
  function u$1(e, t, n, o, i, u) {
@@ -658,35 +658,35 @@ function u$1(e, t, n, o, i, u) {
658
658
  __self: u
659
659
  };
660
660
  if ("function" == typeof e && (a = e.defaultProps)) for (c in a) void 0 === p[c] && (p[c] = a[c]);
661
- return l$2.vnode && l$2.vnode(l), l;
661
+ return l$1.vnode && l$1.vnode(l), l;
662
662
  }
663
663
 
664
- var t$1,
664
+ var t$2,
665
665
  r$2,
666
666
  u,
667
- i,
667
+ i$1,
668
668
  o = 0,
669
669
  f = [],
670
- c = l$2,
671
- e$1 = c.__b,
672
- a$1 = c.__r,
673
- v = c.diffed,
674
- l$1 = c.__c,
675
- m = c.unmount,
676
- s$1 = c.__;
677
- function p(n, t) {
678
- c.__h && c.__h(r$2, n, o || t), o = 0;
670
+ c$1 = l$1,
671
+ e$1 = c$1.__b,
672
+ a$1 = c$1.__r,
673
+ v = c$1.diffed,
674
+ l = c$1.__c,
675
+ m = c$1.unmount,
676
+ s$1 = c$1.__;
677
+ function p$1(n, t) {
678
+ c$1.__h && c$1.__h(r$2, n, o || t), o = 0;
679
679
  var u = r$2.__H || (r$2.__H = {
680
680
  __: [],
681
681
  __h: []
682
682
  });
683
683
  return n >= u.__.length && u.__.push({}), u.__[n];
684
684
  }
685
- function d(n) {
686
- return o = 1, h(D$1, n);
685
+ function d$1(n) {
686
+ return o = 1, h$1(D$1, n);
687
687
  }
688
- function h(n, u, i) {
689
- var o = p(t$1++, 2);
688
+ function h$1(n, u, i) {
689
+ var o = p$1(t$2++, 2);
690
690
  if (o.t = n, !o.__c && (o.__ = [i ? i(u) : D$1(void 0, u), function (n) {
691
691
  var t = o.__N ? o.__N[0] : o.__[0],
692
692
  r = o.t(t, n);
@@ -722,8 +722,8 @@ function h(n, u, i) {
722
722
  return o.__N || o.__;
723
723
  }
724
724
  function y(n, u) {
725
- var i = p(t$1++, 3);
726
- !c.__s && C(i.__H, u) && (i.__ = n, i.u = u, r$2.__H.__h.push(i));
725
+ var i = p$1(t$2++, 3);
726
+ !c$1.__s && C(i.__H, u) && (i.__ = n, i.u = u, r$2.__H.__h.push(i));
727
727
  }
728
728
  function A(n) {
729
729
  return o = 5, T$2(function () {
@@ -733,7 +733,7 @@ function A(n) {
733
733
  }, []);
734
734
  }
735
735
  function T$2(n, r) {
736
- var u = p(t$1++, 7);
736
+ var u = p$1(t$2++, 7);
737
737
  return C(u.__H, r) && (u.__ = n(), u.__H = r, u.__h = n), u.__;
738
738
  }
739
739
  function q$2(n, t) {
@@ -743,33 +743,33 @@ function q$2(n, t) {
743
743
  }
744
744
  function x(n) {
745
745
  var u = r$2.context[n.__c],
746
- i = p(t$1++, 9);
746
+ i = p$1(t$2++, 9);
747
747
  return i.c = n, u ? (null == i.__ && (i.__ = true, u.sub(r$2)), u.props.value) : n.__;
748
748
  }
749
749
  function j$1() {
750
750
  for (var n; n = f.shift();) if (n.__P && n.__H) try {
751
751
  n.__H.__h.forEach(z), n.__H.__h.forEach(B$1), n.__H.__h = [];
752
752
  } catch (t) {
753
- n.__H.__h = [], c.__e(t, n.__v);
753
+ n.__H.__h = [], c$1.__e(t, n.__v);
754
754
  }
755
755
  }
756
- c.__b = function (n) {
756
+ c$1.__b = function (n) {
757
757
  r$2 = null, e$1 && e$1(n);
758
- }, c.__ = function (n, t) {
758
+ }, c$1.__ = function (n, t) {
759
759
  n && t.__k && t.__k.__m && (n.__m = t.__k.__m), s$1 && s$1(n, t);
760
- }, c.__r = function (n) {
761
- a$1 && a$1(n), t$1 = 0;
760
+ }, c$1.__r = function (n) {
761
+ a$1 && a$1(n), t$2 = 0;
762
762
  var i = (r$2 = n.__c).__H;
763
763
  i && (u === r$2 ? (i.__h = [], r$2.__h = [], i.__.forEach(function (n) {
764
764
  n.__N && (n.__ = n.__N), n.u = n.__N = void 0;
765
- })) : (i.__h.forEach(z), i.__h.forEach(B$1), i.__h = [], t$1 = 0)), u = r$2;
766
- }, c.diffed = function (n) {
765
+ })) : (i.__h.forEach(z), i.__h.forEach(B$1), i.__h = [], t$2 = 0)), u = r$2;
766
+ }, c$1.diffed = function (n) {
767
767
  v && v(n);
768
768
  var t = n.__c;
769
- t && t.__H && (t.__H.__h.length && (1 !== f.push(t) && i === c.requestAnimationFrame || ((i = c.requestAnimationFrame) || w)(j$1)), t.__H.__.forEach(function (n) {
769
+ t && t.__H && (t.__H.__h.length && (1 !== f.push(t) && i$1 === c$1.requestAnimationFrame || ((i$1 = c$1.requestAnimationFrame) || w)(j$1)), t.__H.__.forEach(function (n) {
770
770
  n.u && (n.__H = n.u), n.u = void 0;
771
771
  })), u = r$2 = null;
772
- }, c.__c = function (n, t) {
772
+ }, c$1.__c = function (n, t) {
773
773
  t.some(function (n) {
774
774
  try {
775
775
  n.__h.forEach(z), n.__h = n.__h.filter(function (n) {
@@ -778,10 +778,10 @@ c.__b = function (n) {
778
778
  } catch (r) {
779
779
  t.some(function (n) {
780
780
  n.__h && (n.__h = []);
781
- }), t = [], c.__e(r, n.__v);
781
+ }), t = [], c$1.__e(r, n.__v);
782
782
  }
783
- }), l$1 && l$1(n, t);
784
- }, c.unmount = function (n) {
783
+ }), l && l(n, t);
784
+ }, c$1.unmount = function (n) {
785
785
  m && m(n);
786
786
  var t,
787
787
  r = n.__c;
@@ -791,7 +791,7 @@ c.__b = function (n) {
791
791
  } catch (n) {
792
792
  t = n;
793
793
  }
794
- }), r.__H = void 0, t && c.__e(t, r.__v));
794
+ }), r.__H = void 0, t && c$1.__e(t, r.__v));
795
795
  };
796
796
  var k$1 = "function" == typeof requestAnimationFrame;
797
797
  function w(n) {
@@ -2452,9 +2452,9 @@ function usePdfiumEngine(config) {
2452
2452
  encoderPoolSize,
2453
2453
  fontFallback
2454
2454
  } = config ?? {};
2455
- const [engine, setEngine] = d(null);
2456
- const [loading, setLoading] = d(true);
2457
- const [error, setError] = d(null);
2455
+ const [engine, setEngine] = d$1(null);
2456
+ const [loading, setLoading] = d$1(true);
2457
+ const [error, setError] = d$1(null);
2458
2458
  const engineRef = A(null);
2459
2459
  y(() => {
2460
2460
  let cancelled = false;
@@ -5930,10 +5930,10 @@ function EmbedPDF({
5930
5930
  children,
5931
5931
  autoMountDomElements = true
5932
5932
  }) {
5933
- const [registry, setRegistry] = d(null);
5934
- const [coreState, setCoreState] = d(null);
5935
- const [isInitializing, setIsInitializing] = d(true);
5936
- const [pluginsReady, setPluginsReady] = d(false);
5933
+ const [registry, setRegistry] = d$1(null);
5934
+ const [coreState, setCoreState] = d$1(null);
5935
+ const [isInitializing, setIsInitializing] = d$1(true);
5936
+ const [pluginsReady, setPluginsReady] = d$1(false);
5937
5937
  const initRef = A(onInitialized);
5938
5938
  y(() => {
5939
5939
  initRef.current = onInitialized;
@@ -7080,7 +7080,7 @@ function useIsPageExclusive(documentId) {
7080
7080
  const {
7081
7081
  provides: cap
7082
7082
  } = useInteractionManagerCapability();
7083
- const [isPageExclusive, setIsPageExclusive] = d(() => {
7083
+ const [isPageExclusive, setIsPageExclusive] = d$1(() => {
7084
7084
  if (!cap) return false;
7085
7085
  const scope = cap.forDocument(documentId);
7086
7086
  const m = scope.getActiveInteractionMode();
@@ -10744,9 +10744,9 @@ function TextSelection({
10744
10744
  } = useSelectionPlugin();
10745
10745
  const documentState = useDocumentState(documentId);
10746
10746
  const page = (_b = (_a = documentState == null ? void 0 : documentState.document) == null ? void 0 : _a.pages) == null ? void 0 : _b[pageIndex];
10747
- const [rects, setRects] = d([]);
10748
- const [boundingRect, setBoundingRect] = d(null);
10749
- const [placement, setPlacement] = d(null);
10747
+ const [rects, setRects] = d$1([]);
10748
+ const [boundingRect, setBoundingRect] = d$1(null);
10749
+ const [placement, setPlacement] = d$1(null);
10750
10750
  y(() => {
10751
10751
  if (!selPlugin || !documentId) return;
10752
10752
  return selPlugin.registerSelectionOnPage({
@@ -10840,7 +10840,7 @@ const MarqueeSelection = ({
10840
10840
  plugin: selPlugin
10841
10841
  } = useSelectionPlugin();
10842
10842
  const documentState = useDocumentState(documentId);
10843
- const [rect, setRect] = d(null);
10843
+ const [rect, setRect] = d$1(null);
10844
10844
  const resolvedBorderColor = borderColor ?? stroke ?? "rgba(0,122,204,0.8)";
10845
10845
  const resolvedBackground = background ?? fill ?? "rgba(0,122,204,0.15)";
10846
10846
  const actualScale = T$2(() => {
@@ -18578,7 +18578,7 @@ const AnnotationPluginPackage = {
18578
18578
  initialState: (_, config) => initialState$8(config)
18579
18579
  };
18580
18580
 
18581
- function g(n, t) {
18581
+ function g$1(n, t) {
18582
18582
  for (var e in t) n[e] = t[e];
18583
18583
  return n;
18584
18584
  }
@@ -18593,20 +18593,20 @@ function N$1(n, t) {
18593
18593
  (N$1.prototype = new x$1()).isPureReactComponent = true, N$1.prototype.shouldComponentUpdate = function (n, t) {
18594
18594
  return E$1(this.props, n) || E$1(this.state, t);
18595
18595
  };
18596
- var T$1 = l$2.__b;
18597
- l$2.__b = function (n) {
18596
+ var T$1 = l$1.__b;
18597
+ l$1.__b = function (n) {
18598
18598
  n.type && n.type.__f && n.ref && (n.props.ref = n.ref, n.ref = null), T$1 && T$1(n);
18599
18599
  };
18600
- var U$1 = l$2.__e;
18601
- l$2.__e = function (n, t, e, r) {
18600
+ var U$1 = l$1.__e;
18601
+ l$1.__e = function (n, t, e, r) {
18602
18602
  if (n.then) for (var u, o = t; o = o.__;) if ((u = o.__c) && u.__c) return null == t.__e && (t.__e = e.__e, t.__k = e.__k), u.__c(n, t);
18603
18603
  U$1(n, t, e, r);
18604
18604
  };
18605
- var F$1 = l$2.unmount;
18605
+ var F$1 = l$1.unmount;
18606
18606
  function V$1(n, t, e) {
18607
18607
  return n && (n.__c && n.__c.__H && (n.__c.__H.__.forEach(function (n) {
18608
18608
  "function" == typeof n.__c && n.__c();
18609
- }), n.__c.__H = null), null != (n = g({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c.__e = true, n.__c = null), n.__k = n.__k && n.__k.map(function (n) {
18609
+ }), n.__c.__H = null), null != (n = g$1({}, n)).__c && (n.__c.__P === e && (n.__c.__P = t), n.__c.__e = true, n.__c = null), n.__k = n.__k && n.__k.map(function (n) {
18610
18610
  return V$1(n, t, e);
18611
18611
  })), n;
18612
18612
  }
@@ -18626,7 +18626,7 @@ function j(n) {
18626
18626
  function B() {
18627
18627
  this.i = null, this.l = null;
18628
18628
  }
18629
- l$2.unmount = function (n) {
18629
+ l$1.unmount = function (n) {
18630
18630
  var t = n.__c;
18631
18631
  t && (t.__z = true), t && t.__R && t.__R(), t && 32 & n.__u && (n.type = null), F$1 && F$1(n);
18632
18632
  }, (P.prototype = new x$1()).__c = function (n, t) {
@@ -18764,7 +18764,7 @@ x$1.prototype.isReactComponent = {}, ["componentWillMount", "componentWillReceiv
18764
18764
  }
18765
18765
  });
18766
18766
  });
18767
- var en = l$2.event;
18767
+ var en = l$1.event;
18768
18768
  function rn() {}
18769
18769
  function un() {
18770
18770
  return this.cancelBubble;
@@ -18772,7 +18772,7 @@ function un() {
18772
18772
  function on() {
18773
18773
  return this.defaultPrevented;
18774
18774
  }
18775
- l$2.event = function (n) {
18775
+ l$1.event = function (n) {
18776
18776
  return en && (n = en(n)), n.persist = rn, n.isPropagationStopped = un, n.isDefaultPrevented = on, n.nativeEvent = n;
18777
18777
  };
18778
18778
  var cn = {
@@ -18782,8 +18782,8 @@ var cn = {
18782
18782
  return this.class;
18783
18783
  }
18784
18784
  },
18785
- fn = l$2.vnode;
18786
- l$2.vnode = function (n) {
18785
+ fn = l$1.vnode;
18786
+ l$1.vnode = function (n) {
18787
18787
  "string" == typeof n.type && function (n) {
18788
18788
  var t = n.props,
18789
18789
  e = n.type,
@@ -18803,12 +18803,12 @@ l$2.vnode = function (n) {
18803
18803
  })), t.class && !t.className ? (u.class = t.class, Object.defineProperty(u, "className", cn)) : (t.className && !t.class || t.class && t.className) && (u.class = u.className = t.className), n.props = u;
18804
18804
  }(n), n.$$typeof = q$1, fn && fn(n);
18805
18805
  };
18806
- var an = l$2.__r;
18807
- l$2.__r = function (n) {
18806
+ var an = l$1.__r;
18807
+ l$1.__r = function (n) {
18808
18808
  an && an(n), n.__c;
18809
18809
  };
18810
- var sn = l$2.diffed;
18811
- l$2.diffed = function (n) {
18810
+ var sn = l$1.diffed;
18811
+ l$1.diffed = function (n) {
18812
18812
  sn && sn(n);
18813
18813
  var t = n.props,
18814
18814
  e = n.__e;
@@ -18821,7 +18821,7 @@ const RenderersContext = Q$3([]);
18821
18821
  function AnnotationRendererProvider({
18822
18822
  children
18823
18823
  }) {
18824
- const [renderers, setRenderers] = d([]);
18824
+ const [renderers, setRenderers] = d$1([]);
18825
18825
  const register = q$2(entries => {
18826
18826
  setRenderers(prev => {
18827
18827
  const ids = new Set(entries.map(e => e.id));
@@ -18907,7 +18907,7 @@ function AppearanceImage({
18907
18907
  appearance,
18908
18908
  style
18909
18909
  }) {
18910
- const [imageUrl, setImageUrl] = d(null);
18910
+ const [imageUrl, setImageUrl] = d$1(null);
18911
18911
  const urlRef = A(null);
18912
18912
  y(() => {
18913
18913
  const url = URL.createObjectURL(appearance.data);
@@ -18980,11 +18980,11 @@ function AnnotationContainer({
18980
18980
  ...props
18981
18981
  }) {
18982
18982
  var _a, _b, _c;
18983
- const [preview, setPreview] = d(trackedAnnotation.object);
18984
- const [liveRotation, setLiveRotation] = d(null);
18985
- const [cursorScreen, setCursorScreen] = d(null);
18986
- const [isHandleHovered, setIsHandleHovered] = d(false);
18987
- const [gestureActive, setGestureActive] = d(false);
18983
+ const [preview, setPreview] = d$1(trackedAnnotation.object);
18984
+ const [liveRotation, setLiveRotation] = d$1(null);
18985
+ const [cursorScreen, setCursorScreen] = d$1(null);
18986
+ const [isHandleHovered, setIsHandleHovered] = d$1(false);
18987
+ const [gestureActive, setGestureActive] = d$1(false);
18988
18988
  const {
18989
18989
  provides: annotationCapability
18990
18990
  } = useAnnotationCapability();
@@ -19587,9 +19587,9 @@ function GroupSelectionBox({
19587
19587
  const gestureBaseRef = A(null);
19588
19588
  const isDraggingRef = A(false);
19589
19589
  const isResizingRef = A(false);
19590
- const [liveRotation, setLiveRotation] = d(null);
19591
- const [cursorScreen, setCursorScreen] = d(null);
19592
- const [isHandleHovered, setIsHandleHovered] = d(false);
19590
+ const [liveRotation, setLiveRotation] = d$1(null);
19591
+ const [cursorScreen, setCursorScreen] = d$1(null);
19592
+ const [isHandleHovered, setIsHandleHovered] = d$1(false);
19593
19593
  const effectiveIsDraggable = canModifyAnnotations && isDraggable;
19594
19594
  const effectiveIsResizable = canModifyAnnotations && isResizable;
19595
19595
  const effectiveIsRotatable = canModifyAnnotations && isRotatable;
@@ -19597,7 +19597,7 @@ function GroupSelectionBox({
19597
19597
  const rects = selectedAnnotations.map(ta => ta.object.rect);
19598
19598
  return boundingRectOrEmpty(rects);
19599
19599
  }, [selectedAnnotations]);
19600
- const [previewGroupBox, setPreviewGroupBox] = d(groupBox);
19600
+ const [previewGroupBox, setPreviewGroupBox] = d$1(groupBox);
19601
19601
  y(() => {
19602
19602
  if (!isDraggingRef.current && !isResizingRef.current) {
19603
19603
  setPreviewGroupBox(groupBox);
@@ -21140,7 +21140,7 @@ function RenderAnnotation({
21140
21140
  const {
21141
21141
  provides: annotationProvides
21142
21142
  } = useAnnotationCapability();
21143
- const [imageUrl, setImageUrl] = d(null);
21143
+ const [imageUrl, setImageUrl] = d$1(null);
21144
21144
  const urlRef = A(null);
21145
21145
  const {
21146
21146
  width,
@@ -22125,17 +22125,17 @@ function Annotations(annotationsProps) {
22125
22125
  const {
22126
22126
  provides: selectionProvides
22127
22127
  } = useSelectionCapability();
22128
- const [annotations, setAnnotations] = d([]);
22128
+ const [annotations, setAnnotations] = d$1([]);
22129
22129
  const {
22130
22130
  register
22131
22131
  } = usePointerHandlers({
22132
22132
  documentId,
22133
22133
  pageIndex
22134
22134
  });
22135
- const [allSelectedIds, setAllSelectedIds] = d([]);
22136
- const [editingId, setEditingId] = d(null);
22137
- const [appearanceMap, setAppearanceMap] = d({});
22138
- const [, setLockedMode] = d({
22135
+ const [allSelectedIds, setAllSelectedIds] = d$1([]);
22136
+ const [editingId, setEditingId] = d$1(null);
22137
+ const [appearanceMap, setAppearanceMap] = d$1({});
22138
+ const [, setLockedMode] = d$1({
22139
22139
  type: LockModeType.None
22140
22140
  });
22141
22141
  const prevScaleRef = A(scale);
@@ -22379,9 +22379,9 @@ function TextMarkup({
22379
22379
  const {
22380
22380
  provides: annotationProvides
22381
22381
  } = useAnnotationCapability();
22382
- const [rects, setRects] = d([]);
22383
- const [boundingRect, setBoundingRect] = d(null);
22384
- const [activeTool, setActiveTool] = d(null);
22382
+ const [rects, setRects] = d$1([]);
22383
+ const [boundingRect, setBoundingRect] = d$1(null);
22384
+ const [activeTool, setActiveTool] = d$1(null);
22385
22385
  y(() => {
22386
22386
  if (!selectionProvides) return;
22387
22387
  return selectionProvides.forDocument(documentId).onSelectionChange(() => {
@@ -22518,7 +22518,7 @@ function AnnotationPaintLayer({
22518
22518
  const {
22519
22519
  plugin: annotationPlugin
22520
22520
  } = useAnnotationPlugin();
22521
- const [previews, setPreviews] = d(/* @__PURE__ */new Map());
22521
+ const [previews, setPreviews] = d$1(/* @__PURE__ */new Map());
22522
22522
  const fileInputRef = A(null);
22523
22523
  const services = T$2(() => ({
22524
22524
  requestFile: ({
@@ -24191,7 +24191,7 @@ function RedactHighlight({
24191
24191
  onClick,
24192
24192
  style
24193
24193
  }) {
24194
- const [isHovered, setIsHovered] = d(false);
24194
+ const [isHovered, setIsHovered] = d$1(false);
24195
24195
  const {
24196
24196
  object
24197
24197
  } = annotation;
@@ -24265,7 +24265,7 @@ function RedactArea({
24265
24265
  onClick,
24266
24266
  style
24267
24267
  }) {
24268
- const [isHovered, setIsHovered] = d(false);
24268
+ const [isHovered, setIsHovered] = d$1(false);
24269
24269
  const {
24270
24270
  object
24271
24271
  } = annotation;
@@ -24390,7 +24390,7 @@ const MarqueeRedact = ({
24390
24390
  plugin: redactionPlugin
24391
24391
  } = useRedactionPlugin();
24392
24392
  const documentState = useDocumentState(documentId);
24393
- const [rect, setRect] = d(null);
24393
+ const [rect, setRect] = d$1(null);
24394
24394
  const scale = scaleOverride ?? (documentState == null ? void 0 : documentState.scale) ?? 1;
24395
24395
  const strokeColor = stroke ?? (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
24396
24396
  y(() => {
@@ -24455,8 +24455,8 @@ function SelectionRedact({
24455
24455
  const {
24456
24456
  plugin: redactionPlugin
24457
24457
  } = useRedactionPlugin();
24458
- const [rects, setRects] = d([]);
24459
- const [boundingRect, setBoundingRect] = d(null);
24458
+ const [rects, setRects] = d$1([]);
24459
+ const [boundingRect, setBoundingRect] = d$1(null);
24460
24460
  const strokeColor = (redactionPlugin == null ? void 0 : redactionPlugin.getPreviewStrokeColor()) ?? "red";
24461
24461
  y(() => {
24462
24462
  if (!redactionPlugin) return;
@@ -24494,8 +24494,8 @@ function PendingRedactions({
24494
24494
  const {
24495
24495
  provides: redaction
24496
24496
  } = useRedactionCapability();
24497
- const [items, setItems] = d([]);
24498
- const [selectedId, setSelectedId] = d(null);
24497
+ const [items, setItems] = d$1([]);
24498
+ const [selectedId, setSelectedId] = d$1(null);
24499
24499
  y(() => {
24500
24500
  if (!redaction) return;
24501
24501
  const scoped = redaction.forDocument(documentId);
@@ -25319,7 +25319,7 @@ function RenderLayer({
25319
25319
  provides: renderProvides
25320
25320
  } = useRenderCapability();
25321
25321
  const documentState = useDocumentState(documentId);
25322
- const [imageUrl, setImageUrl] = d(null);
25322
+ const [imageUrl, setImageUrl] = d$1(null);
25323
25323
  const urlRef = A(null);
25324
25324
  const refreshVersion = T$2(() => {
25325
25325
  if (!documentState) return 0;
@@ -32395,7 +32395,7 @@ function lt$1({
32395
32395
  ...l
32396
32396
  }) {
32397
32397
  const {
32398
- provides: d$1
32398
+ provides: d
32399
32399
  } = useCapability(ot$1.id),
32400
32400
  {
32401
32401
  provides: c
@@ -32404,26 +32404,26 @@ function lt$1({
32404
32404
  provides: u
32405
32405
  } = useCapability(st$1.id),
32406
32406
  p = A(null),
32407
- [g, f] = d(null);
32407
+ [g, f] = d$1(null);
32408
32408
  y(() => {
32409
- if (!d$1) return;
32409
+ if (!d) return;
32410
32410
  let t = false;
32411
32411
  const e = () => {
32412
- t || d$1.registerViewport(p.current);
32412
+ t || d.registerViewport(p.current);
32413
32413
  };
32414
32414
  e();
32415
32415
  const a = requestAnimationFrame(() => {
32416
32416
  requestAnimationFrame(e);
32417
32417
  }),
32418
32418
  s = t => f(t),
32419
- i = d$1.onLayoutChange(s),
32420
- r = null == c ? void 0 : c.onDocumentOpened(() => s(d$1.getLayout())),
32421
- o = null == c ? void 0 : c.onDocumentClosed(() => s(d$1.getLayout())),
32422
- n = null == u ? void 0 : u.onChapterStatusChange(() => s(d$1.getLayout()));
32423
- return s(d$1.getLayout()), () => {
32424
- t = true, cancelAnimationFrame(a), i(), null == r || r(), null == o || o(), null == n || n(), d$1.registerViewport(null);
32425
- };
32426
- }, [d$1, c, u]);
32419
+ i = d.onLayoutChange(s),
32420
+ r = null == c ? void 0 : c.onDocumentOpened(() => s(d.getLayout())),
32421
+ o = null == c ? void 0 : c.onDocumentClosed(() => s(d.getLayout())),
32422
+ n = null == u ? void 0 : u.onChapterStatusChange(() => s(d.getLayout()));
32423
+ return s(d.getLayout()), () => {
32424
+ t = true, cancelAnimationFrame(a), i(), null == r || r(), null == o || o(), null == n || n(), d.registerViewport(null);
32425
+ };
32426
+ }, [d, c, u]);
32427
32427
  const m = (null == g ? void 0 : g.totalHeight) ?? 0,
32428
32428
  v = (null == g ? void 0 : g.totalWidth) ?? 0;
32429
32429
  return u$1("div", {
@@ -33549,7 +33549,7 @@ function $t$1({
33549
33549
  pdfPageWidth: o,
33550
33550
  pdfPageHeight: n,
33551
33551
  cssPageWidth: h,
33552
- cssPageHeight: d$1,
33552
+ cssPageHeight: d,
33553
33553
  color: c = "#f59e0b",
33554
33554
  ui: u,
33555
33555
  className: p,
@@ -33595,9 +33595,9 @@ function $t$1({
33595
33595
  ready: Promise.resolve()
33596
33596
  };
33597
33597
  })(),
33598
- [v, b] = d([]),
33599
- [P, w] = d(null),
33600
- [I, C] = d(null);
33598
+ [v, b] = d$1([]),
33599
+ [P, w] = d$1(null),
33600
+ [I, C] = d$1(null);
33601
33601
  if (y(() => {
33602
33602
  if (m) return m.onNotesChange(t => {
33603
33603
  b(t.filter(t => t.chapterId === a && t.localPageIndex === s));
@@ -33612,7 +33612,7 @@ function $t$1({
33612
33612
  return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
33613
33613
  }, [I]), !m || 0 === v.length || !o || !n) return null;
33614
33614
  const y$1 = h / o,
33615
- M = d$1 / n,
33615
+ M = d / n,
33616
33616
  S = (null == u ? void 0 : u.iconSize) ?? 16,
33617
33617
  x = (null == u ? void 0 : u.highlightColor) ?? "rgba(245, 158, 11, 0.08)";
33618
33618
  return u$1("div", {
@@ -33829,10 +33829,10 @@ const Tt$1 = {
33829
33829
  cursor: "pointer",
33830
33830
  textAlign: "left"
33831
33831
  };
33832
- const zt$1 = {
33832
+ const Dt$1 = {
33833
33833
  kind: "first-wins"
33834
33834
  };
33835
- function Dt$1(t, e, a) {
33835
+ function zt$1(t, e, a) {
33836
33836
  if (1 === e.length) return e[0].chapterId;
33837
33837
  switch (a.kind) {
33838
33838
  case "first-wins":
@@ -33885,8 +33885,8 @@ let Gt$1 = class Gt {
33885
33885
  return a ? this._pages.indexOf(a) : -1;
33886
33886
  }
33887
33887
  };
33888
- function Ot$1(t, e = zt$1) {
33889
- const a = function (t, e = zt$1) {
33888
+ function Ot$1(t, e = Dt$1) {
33889
+ const a = function (t, e = Dt$1) {
33890
33890
  const a = /* @__PURE__ */new Map();
33891
33891
  for (const i of t.chapters) {
33892
33892
  const [t, e] = i.globalPageRange;
@@ -33896,7 +33896,7 @@ function Ot$1(t, e = zt$1) {
33896
33896
  }
33897
33897
  }
33898
33898
  const s = /* @__PURE__ */new Map();
33899
- for (const [i, r] of a) s.set(i, Dt$1(i, r, e));
33899
+ for (const [i, r] of a) s.set(i, zt$1(i, r, e));
33900
33900
  return s;
33901
33901
  }(t, e),
33902
33902
  s = /* @__PURE__ */new Map();
@@ -33922,10 +33922,10 @@ function Ot$1(t, e = zt$1) {
33922
33922
  }
33923
33923
  const At$1 = class t extends BasePlugin {
33924
33924
  constructor(t, e) {
33925
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = zt$1, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33925
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Dt$1, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
33926
33926
  }
33927
33927
  async initialize(t) {
33928
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? zt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
33928
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Dt$1, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
33929
33929
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
33930
33930
  }), this.documentManager.provides().onDocumentClosed(t => {
33931
33931
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -34890,7 +34890,7 @@ function Qt({
34890
34890
  localPageIndex: o,
34891
34891
  pdfPageWidth: n,
34892
34892
  pdfPageHeight: l,
34893
- cssPageWidth: d$1,
34893
+ cssPageWidth: d,
34894
34894
  cssPageHeight: c,
34895
34895
  onBookmarkClick: u,
34896
34896
  ui: p,
@@ -34900,8 +34900,8 @@ function Qt({
34900
34900
  const {
34901
34901
  provides: m
34902
34902
  } = useCapability(Kt.id),
34903
- [v, b] = d([]),
34904
- [P, w] = d(null),
34903
+ [v, b] = d$1([]),
34904
+ [P, w] = d$1(null),
34905
34905
  I = A(null);
34906
34906
  if (y(() => {
34907
34907
  if (!m) return;
@@ -34917,7 +34917,7 @@ function Qt({
34917
34917
  };
34918
34918
  return document.addEventListener("mousedown", t), () => document.removeEventListener("mousedown", t);
34919
34919
  }, [P]), !m || 0 === v.length || !n || !l) return null;
34920
- const C = d$1 / n,
34920
+ const C = d / n,
34921
34921
  y$1 = c / l,
34922
34922
  M = (null == p ? void 0 : p.iconSize) ?? 16;
34923
34923
  return u$1("div", {
@@ -34961,7 +34961,7 @@ function Qt({
34961
34961
  lineRects: i,
34962
34962
  sx: C,
34963
34963
  sy: y$1,
34964
- cssPageWidth: d$1,
34964
+ cssPageWidth: d,
34965
34965
  iconSize: M
34966
34966
  }),
34967
34967
  h = Math.max(0, o - 6),
@@ -36509,10 +36509,10 @@ const $e = class t extends BasePlugin {
36509
36509
  };
36510
36510
  $e.id = "chapter-manager";
36511
36511
  let Te = $e;
36512
- const ze = {
36512
+ const De = {
36513
36513
  kind: "first-wins"
36514
36514
  };
36515
- function De(t, e, a) {
36515
+ function ze(t, e, a) {
36516
36516
  if (1 === e.length) return e[0].chapterId;
36517
36517
  switch (a.kind) {
36518
36518
  case "first-wins":
@@ -36565,8 +36565,8 @@ class Ge {
36565
36565
  return a ? this._pages.indexOf(a) : -1;
36566
36566
  }
36567
36567
  }
36568
- function Oe(t, e = ze) {
36569
- const a = function (t, e = ze) {
36568
+ function Oe(t, e = De) {
36569
+ const a = function (t, e = De) {
36570
36570
  const a = /* @__PURE__ */new Map();
36571
36571
  for (const i of t.chapters) {
36572
36572
  const [t, e] = i.globalPageRange;
@@ -36576,7 +36576,7 @@ function Oe(t, e = ze) {
36576
36576
  }
36577
36577
  }
36578
36578
  const s = /* @__PURE__ */new Map();
36579
- for (const [i, r] of a) s.set(i, De(i, r, e));
36579
+ for (const [i, r] of a) s.set(i, ze(i, r, e));
36580
36580
  return s;
36581
36581
  }(t, e),
36582
36582
  s = /* @__PURE__ */new Map();
@@ -36602,10 +36602,10 @@ function Oe(t, e = ze) {
36602
36602
  }
36603
36603
  const Ae = class t extends BasePlugin {
36604
36604
  constructor(t, e) {
36605
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = ze, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36605
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = De, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
36606
36606
  }
36607
36607
  async initialize(t) {
36608
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? ze, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36608
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? De, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
36609
36609
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
36610
36610
  }), this.documentManager.provides().onDocumentClosed(t => {
36611
36611
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -37288,7 +37288,7 @@ function Ye({
37288
37288
  pdfPageWidth: a,
37289
37289
  pdfPageHeight: o,
37290
37290
  cssPageWidth: l,
37291
- cssPageHeight: d$1,
37291
+ cssPageHeight: d,
37292
37292
  hoverUi: c
37293
37293
  }) {
37294
37294
  const u = Jt(e),
@@ -37299,9 +37299,9 @@ function Ye({
37299
37299
  provides: g
37300
37300
  } = useCapability(je.id),
37301
37301
  f = A(null),
37302
- [w, I] = d(null),
37303
- [C, y$1] = d(null),
37304
- [M, S] = d(null),
37302
+ [w, I] = d$1(null),
37303
+ [C, y$1] = d$1(null),
37304
+ [M, S] = d$1(null),
37305
37305
  x = c?.iconSize ?? 16;
37306
37306
  y(() => {
37307
37307
  if (!p) return;
@@ -37349,12 +37349,12 @@ function Ye({
37349
37349
  };
37350
37350
  }(w, {
37351
37351
  x: (t.clientX - s.left) / (l / a),
37352
- y: (t.clientY - s.top) / (d$1 / o)
37352
+ y: (t.clientY - s.top) / (d / o)
37353
37353
  });
37354
37354
  y$1(i?.lineRects ?? null);
37355
37355
  };
37356
37356
  return document.addEventListener("mousemove", t), () => document.removeEventListener("mousemove", t);
37357
- }, [w, a, o, l, d$1, p, u, M]);
37357
+ }, [w, a, o, l, d, p, u, M]);
37358
37358
  const L = k?.length ? We(e.chapterId, e.localPageIndex, k, {
37359
37359
  globalPageIndex: e.globalPageIndex,
37360
37360
  globalPageNumber: e.globalPageNumber
@@ -37370,13 +37370,13 @@ function Ye({
37370
37370
  }), y$1(null), S(null));
37371
37371
  }, [g, L, $]);
37372
37372
  if (!g || !a || !o) return null;
37373
- const z = l / a,
37374
- D = d$1 / o,
37373
+ const D = l / a,
37374
+ z = d / o,
37375
37375
  G = k?.[k.length - 1],
37376
- O = G ? Math.min((G.origin.x + G.size.width) * z + 6, Math.max(0, l - x - 2)) : 0,
37377
- A$1 = G ? G.origin.y * D + (G.size.height * D - x) / 2 : 0,
37378
- N = G ? Math.max(0, (G.origin.x + G.size.width) * z - 4) : 0,
37379
- V = G ? Math.max(0, G.origin.y * D - 4) : 0;
37376
+ O = G ? Math.min((G.origin.x + G.size.width) * D + 6, Math.max(0, l - x - 2)) : 0,
37377
+ A$1 = G ? G.origin.y * z + (G.size.height * z - x) / 2 : 0,
37378
+ N = G ? Math.max(0, (G.origin.x + G.size.width) * D - 4) : 0,
37379
+ V = G ? Math.max(0, G.origin.y * z - 4) : 0;
37380
37380
  return u$1("div", {
37381
37381
  ref: f,
37382
37382
  style: {
@@ -37391,7 +37391,7 @@ function Ye({
37391
37391
  left: `${N}px`,
37392
37392
  top: `${V}px`,
37393
37393
  width: `${x + 20}px`,
37394
- height: `${G.size.height * D + x + 12}px`,
37394
+ height: `${G.size.height * z + x + 12}px`,
37395
37395
  pointerEvents: "auto"
37396
37396
  },
37397
37397
  onMouseEnter: () => S(k),
@@ -38212,13 +38212,13 @@ function Sa(t, e) {
38212
38212
  provides: o
38213
38213
  } = useCapability(DocumentManagerPlugin.id),
38214
38214
  {
38215
- provides: d$1
38215
+ provides: d
38216
38216
  } = useCapability(Ca.id),
38217
38217
  c = false !== e?.enabled,
38218
38218
  u = e?.min ?? .5,
38219
38219
  p = e?.max ?? 3,
38220
38220
  g = e?.pageWidth,
38221
- [f, m] = d(() => e?.initial ?? 1),
38221
+ [f, m] = d$1(() => e?.initial ?? 1),
38222
38222
  v = A(f),
38223
38223
  b = q$2(e => {
38224
38224
  const s = Ma(e, u, p);
@@ -38241,16 +38241,16 @@ function Sa(t, e) {
38241
38241
  return y(() => {
38242
38242
  a && (g || b(e?.initial ?? 1));
38243
38243
  }, [b, g, a, e?.initial]), y(() => {
38244
- if (!d$1) return;
38244
+ if (!d) return;
38245
38245
  const e = t => {
38246
38246
  g ? P(t) : b(v.current);
38247
38247
  },
38248
- a = d$1.onChapterStatusChange(t => {
38248
+ a = d.onChapterStatusChange(t => {
38249
38249
  "loaded" === t.status && e(t.chapterId);
38250
38250
  });
38251
- for (const s of t.chapters) "loaded" === d$1.getChapterStatus(s.chapterId) && e(s.chapterId);
38251
+ for (const s of t.chapters) "loaded" === d.getChapterStatus(s.chapterId) && e(s.chapterId);
38252
38252
  return a;
38253
- }, [P, b, d$1, t.chapters, g]), {
38253
+ }, [P, b, d, t.chapters, g]), {
38254
38254
  scale: f,
38255
38255
  setScale: b,
38256
38256
  zoomEnabled: c,
@@ -38432,7 +38432,7 @@ function Ta({
38432
38432
  };
38433
38433
  }, [i, y]),
38434
38434
  S = T$2(() => u || C ? s => /* @__PURE__ */u$1(k$2, {
38435
- children: [C && /* @__PURE__ */u$1(za, {
38435
+ children: [C && /* @__PURE__ */u$1(Da, {
38436
38436
  item: s,
38437
38437
  hoverUi: p?.bookmarks?.hover
38438
38438
  }), u?.(s)]
@@ -38442,7 +38442,7 @@ function Ta({
38442
38442
  className: s,
38443
38443
  style: s ? void 0 : Xe,
38444
38444
  children: [/* @__PURE__ */u$1(lt$1, {
38445
- renderPage: e => /* @__PURE__ */u$1(Da, {
38445
+ renderPage: e => /* @__PURE__ */u$1(za, {
38446
38446
  item: e,
38447
38447
  showNoteMarkers: w,
38448
38448
  showBookmarkMarkers: I,
@@ -38458,7 +38458,7 @@ function Ta({
38458
38458
  }), f]
38459
38459
  });
38460
38460
  }
38461
- function za({
38461
+ function Da({
38462
38462
  item: e,
38463
38463
  hoverUi: a
38464
38464
  }) {
@@ -38474,7 +38474,7 @@ function za({
38474
38474
  hoverUi: a
38475
38475
  }) : null;
38476
38476
  }
38477
- function Da({
38477
+ function za({
38478
38478
  item: a,
38479
38479
  showNoteMarkers: s,
38480
38480
  showBookmarkMarkers: i,
@@ -38597,7 +38597,7 @@ function Da({
38597
38597
  })
38598
38598
  });
38599
38599
  }
38600
- class Ga {
38600
+ class Oa {
38601
38601
  constructor(t) {
38602
38602
  this.cb = t;
38603
38603
  }
@@ -38605,9 +38605,9 @@ class Ga {
38605
38605
  return this.cb(t, e);
38606
38606
  }
38607
38607
  }
38608
- const Oa = "chapter-scroll",
38609
- Aa = {
38610
- id: Oa,
38608
+ const Fa = "chapter-scroll",
38609
+ Ua = {
38610
+ id: Fa,
38611
38611
  name: "Chapter Scroll Plugin",
38612
38612
  version: "0.1.0",
38613
38613
  provides: ["chapter-scroll"],
@@ -38620,10 +38620,10 @@ const Oa = "chapter-scroll",
38620
38620
  pageGap: 20
38621
38621
  }
38622
38622
  };
38623
- const Na = {
38623
+ const _a = {
38624
38624
  kind: "first-wins"
38625
38625
  };
38626
- function Va(t, e, a) {
38626
+ function qa(t, e, a) {
38627
38627
  if (1 === e.length) return e[0].chapterId;
38628
38628
  switch (a.kind) {
38629
38629
  case "first-wins":
@@ -38642,7 +38642,7 @@ function Va(t, e, a) {
38642
38642
  return a.resolve(t, e);
38643
38643
  }
38644
38644
  }
38645
- class Ea {
38645
+ class Wa {
38646
38646
  constructor(t) {
38647
38647
  this._pages = t, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
38648
38648
  for (const e of t) {
@@ -38676,8 +38676,8 @@ class Ea {
38676
38676
  return a ? this._pages.indexOf(a) : -1;
38677
38677
  }
38678
38678
  }
38679
- function Ra(t, e = Na) {
38680
- const a = function (t, e = Na) {
38679
+ function Ha(t, e = _a) {
38680
+ const a = function (t, e = _a) {
38681
38681
  const a = /* @__PURE__ */new Map();
38682
38682
  for (const i of t.chapters) {
38683
38683
  const [t, e] = i.globalPageRange;
@@ -38687,7 +38687,7 @@ function Ra(t, e = Na) {
38687
38687
  }
38688
38688
  }
38689
38689
  const s = /* @__PURE__ */new Map();
38690
- for (const [i, r] of a) s.set(i, Va(i, r, e));
38690
+ for (const [i, r] of a) s.set(i, qa(i, r, e));
38691
38691
  return s;
38692
38692
  }(t, e),
38693
38693
  s = /* @__PURE__ */new Map();
@@ -38709,14 +38709,14 @@ function Ra(t, e = Na) {
38709
38709
  localPageIndex: l
38710
38710
  });
38711
38711
  }
38712
- return new Ea(r);
38712
+ return new Wa(r);
38713
38713
  }
38714
- const Fa = class t extends BasePlugin {
38714
+ const Ba = class t extends BasePlugin {
38715
38715
  constructor(t, e) {
38716
- super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = Na, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38716
+ super(t, e), this.statusChange$ = createBehaviorEmitter(), this.manifestChange$ = createEmitter(), this.overlapStrategy = _a, this.chapterStatus = /* @__PURE__ */new Map(), this.chapterLastUsed = /* @__PURE__ */new Map(), this.passwordAttempts = /* @__PURE__ */new Map(), this.pendingLoadPromises = /* @__PURE__ */new Map(), this.unloadTimer = null, this.documentManagerUnsubs = [], this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38717
38717
  }
38718
38718
  async initialize(t) {
38719
- if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? Na, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
38719
+ if (this.config = t, this.passwordProvider = t.passwordProvider, this.overlapStrategy = t.overlapStrategy ?? _a, this.documentManagerUnsubs.push(this.documentManager.provides().onDocumentOpened(t => {
38720
38720
  this.isOwnedChapter(t.id) && (this.passwordAttempts.delete(t.id), this.updateStatus(t.id, "loaded"));
38721
38721
  }), this.documentManager.provides().onDocumentClosed(t => {
38722
38722
  this.isOwnedChapter(t) && this.updateStatus(t, "closed");
@@ -38764,7 +38764,7 @@ const Fa = class t extends BasePlugin {
38764
38764
  i = new Set(e.chapters.map(t => t.chapterId));
38765
38765
  for (const t of s) i.has(t) || (this.closeChapter(t), this.chapterStatus.delete(t));
38766
38766
  for (const t of e.chapters) this.chapterStatus.has(t.chapterId) || this.chapterStatus.set(t.chapterId, "idle");
38767
- this.manifest = e, this.virtualPageMap = Ra(e, this.overlapStrategy), this.manifestChange$.emit({
38767
+ this.manifest = e, this.virtualPageMap = Ha(e, this.overlapStrategy), this.manifestChange$.emit({
38768
38768
  manifest: e,
38769
38769
  map: this.virtualPageMap
38770
38770
  }), this.eagerPrefetchFromManifest();
@@ -38937,9 +38937,9 @@ const Fa = class t extends BasePlugin {
38937
38937
  }));
38938
38938
  }
38939
38939
  };
38940
- Fa.id = "chapter-manager";
38941
- let Ua = Fa;
38942
- function _a(t, e) {
38940
+ Ba.id = "chapter-manager";
38941
+ let ja = Ba;
38942
+ function Za(t, e) {
38943
38943
  if (t === e) return true;
38944
38944
  if (t.totalHeight !== e.totalHeight || t.totalWidth !== e.totalWidth || t.pageGap !== e.pageGap || t.items.length !== e.items.length) return false;
38945
38945
  for (let a = 0; a < t.items.length; a++) {
@@ -38949,9 +38949,9 @@ function _a(t, e) {
38949
38949
  }
38950
38950
  return true;
38951
38951
  }
38952
- const qa = class extends BasePlugin {
38952
+ const Ya = class extends BasePlugin {
38953
38953
  constructor(t, e) {
38954
- super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, _a), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(Ua.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38954
+ super(t, e), this.layoutChange$ = createBehaviorEmitter(void 0, Za), this.visibleChange$ = createBehaviorEmitter(), this.virtualPageMap = null, this.pageSizes = /* @__PURE__ */new Map(), this.offsets = [], this.totalHeight = 0, this.totalWidth = 0, this.viewportEl = null, this.viewportObservers = null, this.currentVisible = [], this.currentGlobalPageIndex = 0, this.chapterManagerUnsubs = [], this.chapterManager = this.registry.getPlugin(ja.id), this.documentManager = this.registry.getPlugin(DocumentManagerPlugin.id);
38955
38955
  }
38956
38956
  async initialize(t) {
38957
38957
  this.config = {
@@ -39208,15 +39208,15 @@ const qa = class extends BasePlugin {
39208
39208
  a && this.scrollToIndex(a.globalPageIndex, e);
39209
39209
  }
39210
39210
  };
39211
- qa.id = "chapter-scroll";
39212
- let Wa = qa;
39213
- const Ha = {
39214
- manifest: Aa,
39215
- create: t => new Wa(Oa, t),
39211
+ Ya.id = "chapter-scroll";
39212
+ let Xa = Ya;
39213
+ const Ka = {
39214
+ manifest: Ua,
39215
+ create: t => new Xa(Fa, t),
39216
39216
  reducer: t => t,
39217
39217
  initialState: {}
39218
39218
  },
39219
- Ba = {
39219
+ Qa = {
39220
39220
  "annotation-toolbar": {
39221
39221
  id: "annotation-toolbar",
39222
39222
  position: {
@@ -39713,7 +39713,7 @@ const Ha = {
39713
39713
  }]
39714
39714
  }
39715
39715
  };
39716
- class ja {
39716
+ class Ja {
39717
39717
  constructor() {
39718
39718
  this.specs = [];
39719
39719
  }
@@ -39728,7 +39728,7 @@ class ja {
39728
39728
  return this.specs;
39729
39729
  }
39730
39730
  buildToolbars() {
39731
- const t = structuredClone(Ba);
39731
+ const t = structuredClone(Qa);
39732
39732
  for (const e of this.specs) {
39733
39733
  const a = t[e.toolbarSlot];
39734
39734
  if (!a) continue;
@@ -39748,12 +39748,12 @@ class ja {
39748
39748
  } : {}),
39749
39749
  categories: e.categories ?? []
39750
39750
  };
39751
- a.items = Za(a.items, s, e.position);
39751
+ a.items = ts(a.items, s, e.position);
39752
39752
  }
39753
39753
  return t;
39754
39754
  }
39755
39755
  }
39756
- function Za(t, e, a) {
39756
+ function ts(t, e, a) {
39757
39757
  return (null == a ? void 0 : a.after) || (null == a ? void 0 : a.before) ? function (t, e, a) {
39758
39758
  const s = t => {
39759
39759
  const i = [];
@@ -39771,14 +39771,14 @@ function Za(t, e, a) {
39771
39771
  } : t);
39772
39772
  }(t, e);
39773
39773
  }
39774
- const Ya = {
39774
+ const es = {
39775
39775
  annotate: "annotation-toolbar",
39776
39776
  shapes: "shapes-toolbar",
39777
39777
  insert: "insert-toolbar",
39778
39778
  form: "form-toolbar",
39779
39779
  redact: "redaction-toolbar"
39780
39780
  };
39781
- function Xa() {
39781
+ function as() {
39782
39782
  return {
39783
39783
  "mode:view": {
39784
39784
  id: "mode:view",
@@ -39895,7 +39895,7 @@ function Xa() {
39895
39895
  }
39896
39896
  };
39897
39897
  }
39898
- function Ka(t) {
39898
+ function ss(t) {
39899
39899
  const e = t.toolbar ?? {},
39900
39900
  a = e.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"],
39901
39901
  s = a.length > 0,
@@ -39905,13 +39905,13 @@ function Ka(t) {
39905
39905
  } = function (t = {}) {
39906
39906
  var e, a, s, i, r, o;
39907
39907
  const n = new Set(t.enabledModes ?? ["view", "annotate", "shapes", "insert", "form", "redact"]),
39908
- h = new ja();
39908
+ h = new Ja();
39909
39909
  (null == (e = t.customOperations) ? void 0 : e.length) && h.registerAll(t.customOperations);
39910
39910
  const l = h.buildToolbars(),
39911
39911
  d = {};
39912
39912
  for (const u of n) {
39913
39913
  if ("view" === u) continue;
39914
- const t = Ya[u];
39914
+ const t = es[u];
39915
39915
  l[t] && (d[t] = l[t]);
39916
39916
  }
39917
39917
  const c = function (t) {
@@ -39966,8 +39966,8 @@ function Ka(t) {
39966
39966
  enabledModes: a
39967
39967
  }),
39968
39968
  o = {
39969
- ...(s ? Xa() : {}),
39970
- ...(s ? Qa(r.list()) : {}),
39969
+ ...(s ? as() : {}),
39970
+ ...(s ? is(r.list()) : {}),
39971
39971
  ...(t.commands ?? {})
39972
39972
  },
39973
39973
  n = [createPluginRegistration(DocumentManagerPluginPackage, {
@@ -39979,7 +39979,7 @@ function Ka(t) {
39979
39979
  chapterPdfLoader: t.chapterPdfLoader,
39980
39980
  prefetchChapters: t.prefetchChapters,
39981
39981
  unloadTimeoutMs: t.unloadTimeoutMs
39982
- }), createPluginRegistration(Ha, {
39982
+ }), createPluginRegistration(Ka, {
39983
39983
  placeholderPageHeight: t.placeholderPageHeight,
39984
39984
  placeholderPageWidth: t.placeholderPageWidth
39985
39985
  }), createPluginRegistration(InteractionManagerPluginPackage), createPluginRegistration(RenderPluginPackage), createPluginRegistration(RotatePluginPackage), createPluginRegistration(SelectionPluginPackage, {
@@ -40008,7 +40008,7 @@ function Ka(t) {
40008
40008
  operationRegistry: r
40009
40009
  };
40010
40010
  }
40011
- function Qa(t) {
40011
+ function is(t) {
40012
40012
  const e = {};
40013
40013
  for (const a of t) a.handler && (e[a.commandId] = {
40014
40014
  id: a.commandId,
@@ -40027,10 +40027,10 @@ function Qa(t) {
40027
40027
  });
40028
40028
  return e;
40029
40029
  }
40030
- const Ja = sa(),
40031
- ts = {};
40032
- function es(t) {
40033
- return Ka({
40030
+ const rs = sa(),
40031
+ os = {};
40032
+ function ns(t) {
40033
+ return ss({
40034
40034
  ...t,
40035
40035
  toolbar: t.toolbar ?? {
40036
40036
  enabledModes: []
@@ -40038,11 +40038,11 @@ function es(t) {
40038
40038
  features: sa(t.features)
40039
40039
  });
40040
40040
  }
40041
- const as = {
40041
+ const hs = {
40042
40042
  overlapStrategy: {
40043
40043
  kind: "first-wins"
40044
40044
  },
40045
- passwordProvider: new Ga(async () => null),
40045
+ passwordProvider: new Oa(async () => null),
40046
40046
  prefetchChapters: 1,
40047
40047
  loadDefaultStampLibrary: false,
40048
40048
  unloadTimeoutMs: 12e4,
@@ -40050,7 +40050,7 @@ const as = {
40050
40050
  enabledModes: []
40051
40051
  }
40052
40052
  };
40053
- function ss(t) {
40053
+ function ls(t) {
40054
40054
  return function (t) {
40055
40055
  return "callbacks" in t.notes;
40056
40056
  }(t) ? {
@@ -40060,11 +40060,12 @@ function ss(t) {
40060
40060
  bookmarks: t.bookmarks.callbacks
40061
40061
  } : t;
40062
40062
  }
40063
- function is(t) {
40063
+ function ds(t) {
40064
40064
  return {
40065
+ ...hs,
40065
40066
  manifest: t.manifest,
40066
40067
  chapterPdfLoader: t.chapterPdfLoader,
40067
- ...as,
40068
+ overlapStrategy: t.overlapStrategy ?? hs.overlapStrategy,
40068
40069
  notes: {
40069
40070
  callbacks: t.notes
40070
40071
  },
@@ -40074,25 +40075,25 @@ function is(t) {
40074
40075
  features: sa(t.features)
40075
40076
  };
40076
40077
  }
40077
- function rs(t) {
40078
- const e = is(ss(t)),
40078
+ function cs(t) {
40079
+ const e = ds(ls(t)),
40079
40080
  {
40080
40081
  plugins: a
40081
- } = es(e);
40082
+ } = ns(e);
40082
40083
  return {
40083
40084
  plugins: a,
40084
40085
  features: e.features,
40085
40086
  editorOptions: e
40086
40087
  };
40087
40088
  }
40088
- function os(t) {
40089
+ function us(t) {
40089
40090
  const {
40090
40091
  features: e,
40091
40092
  ...a
40092
- } = is(ss(t));
40093
+ } = ds(ls(t));
40093
40094
  return a;
40094
40095
  }
40095
- const ns = {
40096
+ const ps = {
40096
40097
  display: "flex",
40097
40098
  height: "100%",
40098
40099
  minHeight: "120px",
@@ -40101,20 +40102,20 @@ const ns = {
40101
40102
  fontSize: "14px",
40102
40103
  color: "#64748b"
40103
40104
  };
40104
- function hs({
40105
+ function gs({
40105
40106
  chapterId: a,
40106
40107
  chapterManager: s,
40107
40108
  loadTimeoutMs: o,
40108
40109
  onLoadTimeout: n,
40109
40110
  children: l,
40110
- ...d$1
40111
+ ...d
40111
40112
  }) {
40112
40113
  const {
40113
40114
  provides: c
40114
40115
  } = useCapability(Ca.id),
40115
40116
  u = s ?? c,
40116
- [p, g] = d(false),
40117
- [f, m] = d(null);
40117
+ [p, g] = d$1(false),
40118
+ [f, m] = d$1(null);
40118
40119
  return y(() => {
40119
40120
  if (!u || !a) return;
40120
40121
  let t = false,
@@ -40138,20 +40139,20 @@ function hs({
40138
40139
  t = true, s(), r();
40139
40140
  };
40140
40141
  }, [u, a, o, n]), f ? /* @__PURE__ */u$1("div", {
40141
- style: ns,
40142
+ style: ps,
40142
40143
  children: f
40143
40144
  }) : u ? p ? /* @__PURE__ */u$1(Ta, {
40144
- ...d$1,
40145
+ ...d,
40145
40146
  children: l
40146
40147
  }) : /* @__PURE__ */u$1("div", {
40147
- style: ns,
40148
+ style: ps,
40148
40149
  children: ["正在加载 ", a, ".pdf…"]
40149
40150
  }) : /* @__PURE__ */u$1("div", {
40150
- style: ns,
40151
+ style: ps,
40151
40152
  children: "正在初始化章节管理器…"
40152
40153
  });
40153
40154
  }
40154
- function ls({
40155
+ function fs({
40155
40156
  engine: e,
40156
40157
  options: a,
40157
40158
  editorOptions: s,
@@ -40159,7 +40160,7 @@ function ls({
40159
40160
  className: n,
40160
40161
  viewportClassName: h,
40161
40162
  buildSelectionMenu: l,
40162
- onExtraSelectionAction: d$1,
40163
+ onExtraSelectionAction: d,
40163
40164
  renderPageOverlay: u,
40164
40165
  onRegistryReady: p,
40165
40166
  firstChapterGateId: g,
@@ -40171,12 +40172,12 @@ function ls({
40171
40172
  plugins: b,
40172
40173
  features: P
40173
40174
  } = T$2(() => function (t) {
40174
- if (t.options) return rs(t.options);
40175
+ if (t.options) return cs(t.options);
40175
40176
  if (!t.editorOptions) throw new Error("ChapterPdfViewer: 请传入 `options`(推荐),或同时传入 `editorOptions` 与 `features`");
40176
40177
  const e = sa(t.features),
40177
40178
  {
40178
40179
  plugins: a
40179
- } = es({
40180
+ } = ns({
40180
40181
  ...t.editorOptions,
40181
40182
  features: e
40182
40183
  });
@@ -40193,7 +40194,7 @@ function ls({
40193
40194
  editorOptions: s,
40194
40195
  features: r
40195
40196
  }), [s, r, a]),
40196
- [w, I] = d(null);
40197
+ [w, I] = d$1(null);
40197
40198
  return u$1("div", {
40198
40199
  className: n,
40199
40200
  style: n ? void 0 : Xe,
@@ -40211,12 +40212,12 @@ function ls({
40211
40212
  className: h,
40212
40213
  features: P,
40213
40214
  buildSelectionMenu: l,
40214
- onExtraSelectionAction: d$1,
40215
+ onExtraSelectionAction: d,
40215
40216
  renderPageOverlay: u,
40216
40217
  children: v
40217
40218
  },
40218
40219
  s = w?.getPlugin(Ca.id)?.provides() ?? null;
40219
- return g ? /* @__PURE__ */u$1(hs, {
40220
+ return g ? /* @__PURE__ */u$1(gs, {
40220
40221
  chapterId: g,
40221
40222
  chapterManager: s,
40222
40223
  loadTimeoutMs: f,
@@ -40230,6 +40231,59 @@ function ls({
40230
40231
  });
40231
40232
  }
40232
40233
 
40234
+ ({
40235
+ highlight: PdfAnnotationSubtype.HIGHLIGHT,
40236
+ underline: PdfAnnotationSubtype.UNDERLINE,
40237
+ squiggly: PdfAnnotationSubtype.SQUIGGLY,
40238
+ strikeout: PdfAnnotationSubtype.STRIKEOUT
40239
+ });
40240
+ function featureOn(value, defaults) {
40241
+ const partial = value;
40242
+ if (value === false) return {
40243
+ ...defaults,
40244
+ enabled: false
40245
+ };
40246
+ if (value === true || value === void 0) {
40247
+ return {
40248
+ ...defaults,
40249
+ enabled: defaults.enabled ?? true
40250
+ };
40251
+ }
40252
+ return {
40253
+ ...defaults,
40254
+ ...partial,
40255
+ enabled: (partial == null ? void 0 : partial.enabled) !== false
40256
+ };
40257
+ }
40258
+ function normalizeChapterViewerConfig(config) {
40259
+ const markup = featureOn(config == null ? void 0 : config.markup, {
40260
+ enabled: true
40261
+ });
40262
+ const bookmarks = featureOn(config == null ? void 0 : config.bookmarks, {
40263
+ enabled: true
40264
+ });
40265
+ const notes = featureOn(config == null ? void 0 : config.notes, {
40266
+ enabled: true
40267
+ });
40268
+ const zoom = featureOn(config == null ? void 0 : config.zoom, {
40269
+ enabled: true,
40270
+ min: 0.5,
40271
+ max: 3,
40272
+ initial: 1
40273
+ });
40274
+ const selectionToolbarDefault = (config == null ? void 0 : config.selectionToolbar) === void 0 ? markup.enabled !== false || notes.enabled !== false : config.selectionToolbar;
40275
+ const selectionToolbar = featureOn(selectionToolbarDefault, {
40276
+ enabled: true
40277
+ });
40278
+ return {
40279
+ markup,
40280
+ bookmarks,
40281
+ notes,
40282
+ zoom,
40283
+ selectionToolbar
40284
+ };
40285
+ }
40286
+
40233
40287
  var CHAPTER_SNIPPET_EVENTS = {
40234
40288
  noteRequestCreate: 'chapter-note-request-create',
40235
40289
  noteRequestEdit: 'chapter-note-request-edit',
@@ -40244,39 +40298,50 @@ function dispatch(host, name, detail) {
40244
40298
  composed: true
40245
40299
  }));
40246
40300
  }
40301
+ function isLegacyEditorInput(input) {
40302
+ return 'callbacks' in input.notes;
40303
+ }
40304
+ function getNoteCallbacks(input) {
40305
+ return isLegacyEditorInput(input) ? input.notes.callbacks : input.notes;
40306
+ }
40307
+ function getBookmarkCallbacks(input) {
40308
+ return isLegacyEditorInput(input) ? input.bookmarks.callbacks : input.bookmarks;
40309
+ }
40247
40310
  /**
40248
- * 将宿主传入的 editorInput 转为 editor-engine 选项,并把笔记/书签回调桥接为 CustomEvent。
40311
+ * 将宿主传入的 options/editorInput 转为 editor-engine 选项,并把笔记/书签回调桥接为 CustomEvent。
40249
40312
  */
40250
40313
  function buildEditorOptionsWithEvents(input, eventHost) {
40251
- var base = os(input);
40252
- var noteCallbacks = _objectSpread2(_objectSpread2({}, input.notes.callbacks), {}, {
40314
+ var base = us(input);
40315
+ var sourceNoteCallbacks = getNoteCallbacks(input);
40316
+ var sourceBookmarkCallbacks = getBookmarkCallbacks(input);
40317
+ var noteCallbacks = _objectSpread2(_objectSpread2({}, sourceNoteCallbacks), {}, {
40253
40318
  onRequestCreateNote: function onRequestCreateNote(payload) {
40254
- var _input$notes$callback, _input$notes$callback2;
40319
+ var _sourceNoteCallbacks$;
40255
40320
  dispatch(eventHost, CHAPTER_SNIPPET_EVENTS.noteRequestCreate, payload);
40256
- void ((_input$notes$callback = (_input$notes$callback2 = input.notes.callbacks).onRequestCreateNote) === null || _input$notes$callback === void 0 ? void 0 : _input$notes$callback.call(_input$notes$callback2, payload));
40321
+ void ((_sourceNoteCallbacks$ = sourceNoteCallbacks.onRequestCreateNote) === null || _sourceNoteCallbacks$ === void 0 ? void 0 : _sourceNoteCallbacks$.call(sourceNoteCallbacks, payload));
40257
40322
  },
40258
40323
  onRequestEditNote: function onRequestEditNote(noteId, anchor) {
40259
- var _input$notes$callback3, _input$notes$callback4;
40324
+ var _sourceNoteCallbacks$2;
40260
40325
  dispatch(eventHost, CHAPTER_SNIPPET_EVENTS.noteRequestEdit, {
40261
40326
  noteId: noteId,
40262
40327
  anchor: anchor
40263
40328
  });
40264
- (_input$notes$callback3 = (_input$notes$callback4 = input.notes.callbacks).onRequestEditNote) === null || _input$notes$callback3 === void 0 || _input$notes$callback3.call(_input$notes$callback4, noteId, anchor);
40329
+ (_sourceNoteCallbacks$2 = sourceNoteCallbacks.onRequestEditNote) === null || _sourceNoteCallbacks$2 === void 0 || _sourceNoteCallbacks$2.call(sourceNoteCallbacks, noteId, anchor);
40265
40330
  },
40266
- onDeleteNote: input.notes.callbacks.onDeleteNote,
40267
- onUpdateNote: input.notes.callbacks.onUpdateNote,
40268
- loadNotes: input.notes.callbacks.loadNotes
40331
+ onDeleteNote: sourceNoteCallbacks.onDeleteNote,
40332
+ onUpdateNote: sourceNoteCallbacks.onUpdateNote,
40333
+ loadNotes: sourceNoteCallbacks.loadNotes
40269
40334
  });
40270
- var bookmarkCallbacks = _objectSpread2(_objectSpread2({}, input.bookmarks.callbacks), {}, {
40335
+ var bookmarkCallbacks = _objectSpread2(_objectSpread2({}, sourceBookmarkCallbacks), {}, {
40271
40336
  onRequestRemove: function () {
40272
40337
  var _onRequestRemove = _asyncToGenerator(/*#__PURE__*/_regenerator().m(function _callee(bookmark) {
40273
- var _input$bookmarks$call, _input$bookmarks$call2;
40338
+ var _sourceBookmarkCallba;
40274
40339
  var result;
40275
40340
  return _regenerator().w(function (_context) {
40276
40341
  while (1) switch (_context.n) {
40277
40342
  case 0:
40278
40343
  _context.n = 1;
40279
- return (_input$bookmarks$call = (_input$bookmarks$call2 = input.bookmarks.callbacks).onRequestRemove) === null || _input$bookmarks$call === void 0 ? void 0 : _input$bookmarks$call.call(_input$bookmarks$call2, bookmark);
40344
+ return (_sourceBookmarkCallba = sourceBookmarkCallbacks.onRequestRemove) === null || _sourceBookmarkCallba === void 0 ? void 0 : _sourceBookmarkCallba.call(sourceBookmarkCallbacks, bookmark);
40280
40345
  case 1:
40281
40346
  result = _context.v;
40282
40347
  return _context.a(2, result !== null && result !== void 0 ? result : false);
@@ -40288,9 +40353,9 @@ function buildEditorOptionsWithEvents(input, eventHost) {
40288
40353
  }
40289
40354
  return onRequestRemove;
40290
40355
  }(),
40291
- onRemoveSuccess: input.bookmarks.callbacks.onRemoveSuccess,
40292
- load: input.bookmarks.callbacks.load,
40293
- persist: input.bookmarks.callbacks.persist
40356
+ onRemoveSuccess: sourceBookmarkCallbacks.onRemoveSuccess,
40357
+ load: sourceBookmarkCallbacks.load,
40358
+ persist: sourceBookmarkCallbacks.persist
40294
40359
  });
40295
40360
  return _objectSpread2(_objectSpread2({}, base), {}, {
40296
40361
  notes: {
@@ -40309,7 +40374,7 @@ function dispatchViewerReady(host, registry) {
40309
40374
 
40310
40375
  var DEFAULT_SNIPPET_WASM_URL = new URL('./pdfium.wasm', import.meta.url).href;
40311
40376
  function ChapterApp(_ref) {
40312
- var _config$wasmUrl, _config$worker, _config$fallbackToDir, _config$workerOpenTim, _config$editorInput$m;
40377
+ var _config$wasmUrl, _config$worker, _config$fallbackToDir, _config$workerOpenTim, _config$options, _editorInput$manifest;
40313
40378
  var config = _ref.config,
40314
40379
  eventHost = _ref.eventHost,
40315
40380
  onRegistryReady = _ref.onRegistryReady;
@@ -40317,7 +40382,8 @@ function ChapterApp(_ref) {
40317
40382
  var requestedWorker = (_config$worker = config.worker) !== null && _config$worker !== void 0 ? _config$worker : true;
40318
40383
  var fallbackToDirectEngine = (_config$fallbackToDir = config.fallbackToDirectEngine) !== null && _config$fallbackToDir !== void 0 ? _config$fallbackToDir : true;
40319
40384
  var workerOpenTimeoutMs = (_config$workerOpenTim = config.workerOpenTimeoutMs) !== null && _config$workerOpenTim !== void 0 ? _config$workerOpenTim : 8000;
40320
- var _useState = d(requestedWorker),
40385
+ var editorInput = (_config$options = config.options) !== null && _config$options !== void 0 ? _config$options : config.editorInput;
40386
+ var _useState = d$1(requestedWorker),
40321
40387
  _useState2 = _slicedToArray(_useState, 2),
40322
40388
  effectiveWorker = _useState2[0],
40323
40389
  setEffectiveWorker = _useState2[1];
@@ -40332,12 +40398,12 @@ function ChapterApp(_ref) {
40332
40398
  isLoading = _usePdfiumEngine.isLoading,
40333
40399
  error = _usePdfiumEngine.error;
40334
40400
  var features = T$2(function () {
40335
- return _objectSpread2(_objectSpread2({}, Ja), config.features);
40336
- }, [config.features]);
40401
+ return _objectSpread2(_objectSpread2(_objectSpread2({}, rs), editorInput && 'features' in editorInput ? normalizeChapterViewerConfig(editorInput.features) : undefined), config.features);
40402
+ }, [config.features, editorInput]);
40337
40403
  var editorOptions = T$2(function () {
40338
- return buildEditorOptionsWithEvents(config.editorInput, eventHost);
40339
- }, [config.editorInput, eventHost]);
40340
- var firstChapterId = (_config$editorInput$m = config.editorInput.manifest.chapters[0]) === null || _config$editorInput$m === void 0 ? void 0 : _config$editorInput$m.chapterId;
40404
+ return editorInput ? buildEditorOptionsWithEvents(editorInput, eventHost) : null;
40405
+ }, [editorInput, eventHost]);
40406
+ var firstChapterId = editorInput === null || editorInput === void 0 || (_editorInput$manifest = editorInput.manifest.chapters[0]) === null || _editorInput$manifest === void 0 ? void 0 : _editorInput$manifest.chapterId;
40341
40407
  var firstChapterLoadTimeoutMs = effectiveWorker && fallbackToDirectEngine ? workerOpenTimeoutMs : 0;
40342
40408
  var handleFirstChapterLoadTimeout = q$2(function () {
40343
40409
  if (!effectiveWorker || !fallbackToDirectEngine) return false;
@@ -40371,13 +40437,27 @@ function ChapterApp(_ref) {
40371
40437
  children: "\u6B63\u5728\u52A0\u8F7D PDFium\u2026"
40372
40438
  });
40373
40439
  }
40440
+ if (!editorInput || !editorOptions) {
40441
+ return u$1("div", {
40442
+ style: {
40443
+ display: 'flex',
40444
+ height: '100%',
40445
+ alignItems: 'center',
40446
+ justifyContent: 'center',
40447
+ padding: '16px',
40448
+ fontSize: '14px',
40449
+ color: '#64748b'
40450
+ },
40451
+ children: "\u7F3A\u5C11\u7AE0\u8282\u9605\u8BFB\u5668\u914D\u7F6E\uFF1A\u8BF7\u4F20\u5165 options\u3002"
40452
+ });
40453
+ }
40374
40454
  return u$1("div", {
40375
40455
  style: {
40376
40456
  width: '100%',
40377
40457
  height: '100%',
40378
40458
  minHeight: 0
40379
40459
  },
40380
- children: u$1(ls, {
40460
+ children: u$1(fs, {
40381
40461
  engine: engine,
40382
40462
  editorOptions: editorOptions,
40383
40463
  features: features,
@@ -40495,60 +40575,10 @@ var EmbedPdfChapterContainer = /*#__PURE__*/function (_BaseElement) {
40495
40575
  }]);
40496
40576
  }(BaseElement);
40497
40577
 
40498
- ({
40499
- highlight: PdfAnnotationSubtype.HIGHLIGHT,
40500
- underline: PdfAnnotationSubtype.UNDERLINE,
40501
- squiggly: PdfAnnotationSubtype.SQUIGGLY,
40502
- strikeout: PdfAnnotationSubtype.STRIKEOUT
40503
- });
40504
- function featureOn(value, defaults) {
40505
- const partial = value;
40506
- if (value === false) return {
40507
- ...defaults,
40508
- enabled: false
40509
- };
40510
- if (value === true || value === void 0) {
40511
- return {
40512
- ...defaults,
40513
- enabled: defaults.enabled ?? true
40514
- };
40515
- }
40516
- return {
40517
- ...defaults,
40518
- ...partial,
40519
- enabled: (partial == null ? void 0 : partial.enabled) !== false
40520
- };
40521
- }
40522
- function normalizeChapterViewerConfig(config) {
40523
- const markup = featureOn(config == null ? void 0 : config.markup, {
40524
- enabled: true
40525
- });
40526
- const bookmarks = featureOn(config == null ? void 0 : config.bookmarks, {
40527
- enabled: true
40528
- });
40529
- const notes = featureOn(config == null ? void 0 : config.notes, {
40530
- enabled: true
40531
- });
40532
- const zoom = featureOn(config == null ? void 0 : config.zoom, {
40533
- enabled: true,
40534
- min: 0.5,
40535
- max: 3,
40536
- initial: 1
40537
- });
40538
- const selectionToolbarDefault = (config == null ? void 0 : config.selectionToolbar) === void 0 ? markup.enabled !== false || notes.enabled !== false : config.selectionToolbar;
40539
- const selectionToolbar = featureOn(selectionToolbarDefault, {
40540
- enabled: true
40541
- });
40542
- return {
40543
- markup,
40544
- bookmarks,
40545
- notes,
40546
- zoom,
40547
- selectionToolbar
40548
- };
40549
- }
40550
-
40551
- class l {
40578
+ const t$1 = {
40579
+ kind: "first-wins"
40580
+ };
40581
+ class c {
40552
40582
  constructor(e) {
40553
40583
  this.cb = e;
40554
40584
  }
@@ -40556,54 +40586,100 @@ class l {
40556
40586
  return this.cb(e, t);
40557
40587
  }
40558
40588
  }
40589
+ function i(e) {
40590
+ return "last" === e ? {
40591
+ kind: "last-wins"
40592
+ } : {
40593
+ kind: "first-wins"
40594
+ };
40595
+ }
40596
+ function h(e) {
40597
+ const t = e.endPage - e.startPage + 1;
40598
+ return {
40599
+ chapterId: e.chapterId,
40600
+ title: e.title,
40601
+ globalPageRange: [e.startPage, e.endPage],
40602
+ localPageRange: [0, t - 1],
40603
+ ...(e.source ? {
40604
+ source: e.source
40605
+ } : {}),
40606
+ ...(e.encrypted ? {
40607
+ encrypted: e.encrypted
40608
+ } : {})
40609
+ };
40610
+ }
40611
+ function p(e) {
40612
+ const t = [],
40613
+ n = e => {
40614
+ for (const r of e) t.push(h(r)), r.children?.length && n(r.children);
40615
+ };
40616
+ return n(e), t;
40617
+ }
40618
+ function g(e) {
40619
+ return e.map(e => ({
40620
+ id: e.chapterId,
40621
+ title: e.title,
40622
+ startPage: e.startPage,
40623
+ endPage: e.endPage,
40624
+ children: e.children?.length ? g(e.children) : void 0
40625
+ }));
40626
+ }
40627
+ function d(e) {
40628
+ return {
40629
+ tree: g(e),
40630
+ manifest: {
40631
+ chapters: p(e)
40632
+ }
40633
+ };
40634
+ }
40559
40635
 
40560
40636
  function e(e2) {
40561
40637
  const t2 = [],
40562
- s2 = /* @__PURE__ */new Set();
40563
- for (const a2 of e2.chapters) {
40564
- s2.has(a2.chapterId) && t2.push(`Duplicate chapterId: ${a2.chapterId}`), s2.add(a2.chapterId);
40565
- const [e3, n2] = a2.globalPageRange,
40566
- [r2, o] = a2.localPageRange;
40567
- if (e3 > n2 && t2.push(`${a2.chapterId}: invalid globalPageRange [${e3},${n2}]`), r2 > o && t2.push(`${a2.chapterId}: invalid localPageRange [${r2},${o}]`), n2 - e3 !== o - r2 && t2.push(`${a2.chapterId}: page-count mismatch (global ${n2 - e3 + 1} vs local ${o - r2 + 1})`), a2.ownedGlobalPages) for (const s3 of a2.ownedGlobalPages) (s3 < e3 || s3 > n2) && t2.push(`${a2.chapterId}: ownedGlobalPages contains ${s3} outside range`);
40638
+ n2 = /* @__PURE__ */new Set();
40639
+ for (const r2 of e2.chapters) {
40640
+ n2.has(r2.chapterId) && t2.push(`Duplicate chapterId: ${r2.chapterId}`), n2.add(r2.chapterId);
40641
+ const [e3, s2] = r2.globalPageRange,
40642
+ [a2, o] = r2.localPageRange;
40643
+ if (e3 > s2 && t2.push(`${r2.chapterId}: invalid globalPageRange [${e3},${s2}]`), a2 > o && t2.push(`${r2.chapterId}: invalid localPageRange [${a2},${o}]`), s2 - e3 !== o - a2 && t2.push(`${r2.chapterId}: page-count mismatch (global ${s2 - e3 + 1} vs local ${o - a2 + 1})`), r2.ownedGlobalPages) for (const n3 of r2.ownedGlobalPages) (n3 < e3 || n3 > s2) && t2.push(`${r2.chapterId}: ownedGlobalPages contains ${n3} outside range`);
40568
40644
  }
40569
40645
  return t2;
40570
40646
  }
40571
40647
  const t = {
40572
40648
  kind: "first-wins"
40573
40649
  };
40574
- function s(e2, s2 = t) {
40575
- const n2 = /* @__PURE__ */new Map();
40650
+ function n(e2, n2 = t) {
40651
+ const s2 = /* @__PURE__ */new Map();
40576
40652
  for (const t2 of e2.chapters) {
40577
- const [e3, s3] = t2.globalPageRange;
40578
- for (let a2 = e3; a2 <= s3; a2++) {
40579
- const e4 = n2.get(a2);
40580
- e4 ? e4.push(t2) : n2.set(a2, [t2]);
40653
+ const [e3, n3] = t2.globalPageRange;
40654
+ for (let r2 = e3; r2 <= n3; r2++) {
40655
+ const e4 = s2.get(r2);
40656
+ e4 ? e4.push(t2) : s2.set(r2, [t2]);
40581
40657
  }
40582
40658
  }
40583
- const r2 = /* @__PURE__ */new Map();
40584
- for (const [t2, o] of n2) r2.set(t2, a(t2, o, s2));
40585
- return r2;
40659
+ const a2 = /* @__PURE__ */new Map();
40660
+ for (const [t2, o] of s2) a2.set(t2, r(t2, o, n2));
40661
+ return a2;
40586
40662
  }
40587
- function a(e2, t2, s2) {
40663
+ function r(e2, t2, n2) {
40588
40664
  if (1 === t2.length) return t2[0].chapterId;
40589
- switch (s2.kind) {
40665
+ switch (n2.kind) {
40590
40666
  case "first-wins":
40591
40667
  return t2[0].chapterId;
40592
40668
  case "last-wins":
40593
40669
  return t2[t2.length - 1].chapterId;
40594
40670
  case "explicit":
40595
40671
  {
40596
- const s3 = t2.find(t3 => {
40672
+ const n3 = t2.find(t3 => {
40597
40673
  var _a;
40598
40674
  return (_a = t3.ownedGlobalPages) == null ? void 0 : _a.includes(e2);
40599
40675
  });
40600
- return s3 ? s3.chapterId : t2[0].chapterId;
40676
+ return n3 ? n3.chapterId : t2[0].chapterId;
40601
40677
  }
40602
40678
  case "custom":
40603
- return s2.resolve(e2, t2);
40679
+ return n2.resolve(e2, t2);
40604
40680
  }
40605
40681
  }
40606
- class n {
40682
+ class s {
40607
40683
  constructor(e2) {
40608
40684
  this._pages = e2, this._byChapter = /* @__PURE__ */new Map(), this._byGlobalNumber = /* @__PURE__ */new Map();
40609
40685
  for (const t2 of e2) {
@@ -40625,8 +40701,8 @@ class n {
40625
40701
  return this._byGlobalNumber.get(e2) ?? null;
40626
40702
  }
40627
40703
  toGlobal(e2, t2) {
40628
- const s2 = this._byChapter.get(e2);
40629
- return s2 ? s2.find(e3 => e3.localPageIndex === t2) ?? null : null;
40704
+ const n2 = this._byChapter.get(e2);
40705
+ return n2 ? n2.find(e3 => e3.localPageIndex === t2) ?? null : null;
40630
40706
  }
40631
40707
  pagesOfChapter(e2) {
40632
40708
  return this._byChapter.get(e2) ?? [];
@@ -40637,28 +40713,28 @@ class n {
40637
40713
  return t2 ? this._pages.indexOf(t2) : -1;
40638
40714
  }
40639
40715
  }
40640
- function r(e2, a2 = t) {
40641
- const r2 = s(e2, a2),
40716
+ function a(e2, r2 = t) {
40717
+ const a2 = n(e2, r2),
40642
40718
  o = /* @__PURE__ */new Map();
40643
40719
  for (const t2 of e2.chapters) o.set(t2.chapterId, t2);
40644
- const l = Array.from(r2.keys()).sort((e3, t2) => e3 - t2),
40645
- c = [];
40646
- let h = 0;
40647
- for (const t2 of l) {
40648
- const e3 = r2.get(t2),
40649
- s2 = o.get(e3);
40650
- if (!s2) continue;
40651
- const [a3] = s2.globalPageRange,
40652
- [n2] = s2.localPageRange,
40653
- l2 = n2 + (t2 - a3);
40654
- c.push({
40655
- globalPageIndex: h++,
40720
+ const c = Array.from(a2.keys()).sort((e3, t2) => e3 - t2),
40721
+ l = [];
40722
+ let i = 0;
40723
+ for (const t2 of c) {
40724
+ const e3 = a2.get(t2),
40725
+ n2 = o.get(e3);
40726
+ if (!n2) continue;
40727
+ const [r3] = n2.globalPageRange,
40728
+ [s2] = n2.localPageRange,
40729
+ c2 = s2 + (t2 - r3);
40730
+ l.push({
40731
+ globalPageIndex: i++,
40656
40732
  globalPageNumber: t2,
40657
40733
  chapterId: e3,
40658
- localPageIndex: l2
40734
+ localPageIndex: c2
40659
40735
  });
40660
40736
  }
40661
- return new n(c);
40737
+ return new s(l);
40662
40738
  }
40663
40739
  const _ChapterManagerPlugin = class _ChapterManagerPlugin extends BasePlugin {
40664
40740
  constructor(id, registry) {
@@ -40740,7 +40816,7 @@ const _ChapterManagerPlugin = class _ChapterManagerPlugin extends BasePlugin {
40740
40816
  }
40741
40817
  }
40742
40818
  this.manifest = manifest2;
40743
- this.virtualPageMap = r(manifest2, this.overlapStrategy);
40819
+ this.virtualPageMap = a(manifest2, this.overlapStrategy);
40744
40820
  this.manifestChange$.emit({
40745
40821
  manifest: manifest2,
40746
40822
  map: this.virtualPageMap
@@ -44258,8 +44334,8 @@ var chapterSnippetRuntime = {
44258
44334
  version: version,
44259
44335
  EmbedPdfChapterContainer: EmbedPdfChapterContainer,
44260
44336
  CHAPTER_SNIPPET_EVENTS: CHAPTER_SNIPPET_EVENTS,
44261
- createChapterViewerEditorOptions: os,
44262
- DEFAULT_CHAPTER_VIEWER_FEATURES: Ja,
44337
+ createChapterViewerEditorOptions: us,
44338
+ DEFAULT_CHAPTER_VIEWER_FEATURES: rs,
44263
44339
  applySelectionMarkup: ea,
44264
44340
  buildParagraphBookmarkAnchor: We
44265
44341
  };
@@ -60720,5 +60796,5 @@ var directEngine = /*#__PURE__*/Object.freeze({
60720
60796
  createPdfiumEngine: createPdfiumEngine
60721
60797
  });
60722
60798
 
60723
- export { se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION, CHAPTER_SNIPPET_EVENTS, l as CallbackPasswordProvider, ChapterManagerPlugin, ts as DEFAULT_CHAPTER_VIEWER_CONFIG, Ja as DEFAULT_CHAPTER_VIEWER_FEATURES, EmbedPdfChapterContainer, ea as applySelectionMarkup, We as buildParagraphBookmarkAnchor, ge as chapterAnnotationsArchiveToJson, me as chapterAnnotationsSnapshotToJson, rs as createChapterViewerBundle, os as createChapterViewerEditorOptions, ChapterEmbedPDF as default, Pe as downloadChapterAnnotationsArchive, we as downloadChapterAnnotationsSnapshot, be as downloadJsonFile, ce as exportAllChapterAnnotations, le as exportChapterAnnotations, ue as importChapterAnnotations, pe as importChapterAnnotationsArchive, normalizeChapterViewerConfig, fe as parseChapterAnnotationsArchiveJson, ve as parseChapterAnnotationsSnapshotJson, version };
60799
+ export { se as CHAPTER_ANNOTATIONS_ARCHIVE_VERSION, CHAPTER_SNIPPET_EVENTS, c as CallbackPasswordProvider, ChapterManagerPlugin, os as DEFAULT_CHAPTER_VIEWER_CONFIG, rs as DEFAULT_CHAPTER_VIEWER_FEATURES, EmbedPdfChapterContainer, ea as applySelectionMarkup, d as buildChapterViewerCatalog, We as buildParagraphBookmarkAnchor, ge as chapterAnnotationsArchiveToJson, me as chapterAnnotationsSnapshotToJson, h as chapterDescriptorFromTreeNode, cs as createChapterViewerBundle, us as createChapterViewerEditorOptions, ChapterEmbedPDF as default, t$1 as defaultOverlapStrategy, Pe as downloadChapterAnnotationsArchive, we as downloadChapterAnnotationsSnapshot, be as downloadJsonFile, ce as exportAllChapterAnnotations, le as exportChapterAnnotations, p as flattenChapterTree, ue as importChapterAnnotations, pe as importChapterAnnotationsArchive, normalizeChapterViewerConfig, i as overlapStrategyForSamePageOwner, fe as parseChapterAnnotationsArchiveJson, ve as parseChapterAnnotationsSnapshotJson, g as toChapterTreeNodes, version };
60724
60800
  //# sourceMappingURL=embedpdf-chapter.js.map