react-iiif-vault 1.0.10 → 1.0.11

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.
@@ -1,5 +1,5 @@
1
- import { jsx as u, jsxs as I, Fragment as $ } from "react/jsx-runtime";
2
- import B, { createContext as F, Component as rt, createElement as Pe, isValidElement as it, useContext as T, useMemo as y, useState as L, useEffect as N, useCallback as P, useRef as q, useLayoutEffect as Ie, Fragment as te, useReducer as ot, forwardRef as Me, useImperativeHandle as at } from "react";
1
+ import { jsx as u, jsxs as M, Fragment as $ } from "react/jsx-runtime";
2
+ import B, { createContext as F, Component as rt, createElement as Pe, isValidElement as it, useContext as T, useMemo as w, useState as L, useEffect as N, useRef as _, useCallback as b, useLayoutEffect as Ie, Fragment as te, useReducer as ot, forwardRef as Me, useImperativeHandle as at } from "react";
3
3
  import { AtlasAuto as st, ModeContext as ut, mergeStyles as ct, RegionHighlight as lt, TileSet as dt, HTMLPortal as ft } from "@atlas-viewer/atlas";
4
4
  import { globalVault as Ae, Vault as be } from "@iiif/helpers/vault";
5
5
  import { createStylesHelper as Te } from "@iiif/helpers/styles";
@@ -100,7 +100,7 @@ const wt = {
100
100
  annotationPage: void 0
101
101
  }, fe = B.createContext(wt), z = () => T(fe);
102
102
  function re({ value: e, children: t }) {
103
- const n = z(), r = y(() => ({
103
+ const n = z(), r = w(() => ({
104
104
  ...n,
105
105
  ...e
106
106
  }), [e, n]);
@@ -126,12 +126,12 @@ function ge(e) {
126
126
  return e || (t && t.vault ? t.vault : Ae());
127
127
  }
128
128
  function St(e, { noCache: t = !1 } = {}) {
129
- const n = typeof e == "string" ? e : e.id, r = ge(), [i, o] = L(n), [a, s] = L(void 0), c = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
129
+ const n = typeof e == "string" ? e : e.id, r = ge(), [i, o] = L(n), [a, s] = L(void 0), c = w(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
130
130
  return N(() => {
131
131
  (async () => {
132
132
  try {
133
- const f = c && !t ? c : await r.load(n), v = f ? f.id || f["@id"] : null;
134
- f && i !== v && o(v), l(f);
133
+ const f = c && !t ? c : await r.load(n), m = f ? f.id || f["@id"] : null;
134
+ f && i !== m && o(m), l(f);
135
135
  } catch (f) {
136
136
  s(f);
137
137
  }
@@ -189,7 +189,7 @@ function K(e = {}, t = []) {
189
189
  (s) => o ? s.iiif.entities.Manifest[o] : void 0,
190
190
  [o]
191
191
  );
192
- return y(() => {
192
+ return w(() => {
193
193
  if (a)
194
194
  return r ? r(a) : a;
195
195
  }, [a, r, ...t]);
@@ -210,26 +210,26 @@ function Ve(e, t) {
210
210
  function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
211
211
  const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), c = t.type === "Manifest" ? t.items : Ve(e, t);
212
212
  if (a)
213
- return [c, [c.map((m, g) => g)]];
213
+ return [c, [c.map((g, x) => x)]];
214
214
  if (s || !o || n)
215
- return [c, c.map((m, g) => [g])];
215
+ return [c, c.map((g, x) => [x])];
216
216
  const d = [];
217
217
  let l = [];
218
218
  const f = () => {
219
219
  l.length && (d.push([...l]), l = []);
220
220
  };
221
- let v = 0, p = !1;
222
- for (let m = 0; m < c.length; m++) {
223
- const g = e.get(c[m]);
224
- if (g.behavior.includes("non-paged")) {
225
- m === v && v++, r || (f(), d.push([m]), f());
221
+ let m = 0, p = !1;
222
+ for (let g = 0; g < c.length; g++) {
223
+ const x = e.get(c[g]);
224
+ if (x.behavior.includes("non-paged")) {
225
+ g === m && m++, r || (f(), d.push([g]), f());
226
226
  continue;
227
227
  }
228
- if (m === v || g.behavior.includes("facing-pages")) {
229
- l.length && (p = !0), f(), d.push([m]), f();
228
+ if (g === m || x.behavior.includes("facing-pages")) {
229
+ l.length && (p = !0), f(), d.push([g]), f();
230
230
  continue;
231
231
  }
232
- if (l.push(m), p) {
232
+ if (l.push(g), p) {
233
233
  f(), p = !1;
234
234
  continue;
235
235
  }
@@ -239,48 +239,53 @@ function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
239
239
  }
240
240
  function It(e = {}, t = []) {
241
241
  const { id: n, selector: r } = e, i = z(), o = n || i.range, a = R((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
242
- return y(() => {
242
+ return w(() => {
243
243
  if (a)
244
244
  return r ? r(a) : a;
245
245
  }, [a, r, ...t]);
246
246
  }
247
247
  function Mt({ startCanvas: e, disablePaging: t }) {
248
- var m;
248
+ var x;
249
249
  const n = O(), r = K(), i = It(), [o, a] = L(void 0), s = i || r;
250
250
  if (!s)
251
251
  throw new Error("Nothing selected");
252
- const [c, d] = y(
252
+ const [c, d] = w(
253
253
  () => Et(n, s, { disablePaging: t }),
254
254
  [n, s, t]
255
- ), l = P(
256
- (g) => {
257
- const w = d.findIndex((x) => x.includes(g));
258
- a(w === -1 ? 0 : w);
255
+ ), l = _(d);
256
+ if (l.current !== d) {
257
+ const y = l.current[o][0], C = d.findIndex((S) => S.includes(y));
258
+ l.current = d, a(C);
259
+ }
260
+ const f = b(
261
+ (v) => {
262
+ const y = d.findIndex((C) => C.includes(v));
263
+ a(y === -1 ? 0 : y);
259
264
  },
260
265
  [c, d]
261
- ), f = P(
262
- (g) => {
263
- const w = c.findIndex((x) => x.id === g);
264
- w !== -1 ? l(w) : a(0);
266
+ ), m = b(
267
+ (v) => {
268
+ const y = c.findIndex((C) => C.id === v);
269
+ y !== -1 ? f(y) : a(0);
265
270
  },
266
271
  [c, d]
267
- ), v = P(() => {
268
- a((g) => g >= d.length - 1 ? g : g + 1);
269
- }, [d]), p = P(() => {
270
- a((g) => g <= 0 ? 0 : g - 1);
272
+ ), p = b(() => {
273
+ a((v) => v >= d.length - 1 ? v : v + 1);
274
+ }, [d]), g = b(() => {
275
+ a((v) => v <= 0 ? 0 : v - 1);
271
276
  }, [d]);
272
- return typeof o > "u" && (e ? f(e) : a(0)), {
273
- visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => c[g].id)) || [],
277
+ return typeof o > "u" && (e ? m(e) : a(0)), {
278
+ visibleItems: ((x = d[o]) == null ? void 0 : x.map((v) => c[v].id)) || [],
274
279
  cursor: o,
275
280
  items: c,
276
281
  sequence: d,
277
282
  hasPrevious: o > 0,
278
283
  hasNext: o < d.length - 1,
279
284
  setSequenceIndex: a,
280
- setCanvasIndex: l,
281
- setCanvasId: f,
282
- next: v,
283
- previous: p
285
+ setCanvasIndex: f,
286
+ setCanvasId: m,
287
+ next: p,
288
+ previous: g
284
289
  };
285
290
  }
286
291
  const J = () => {
@@ -308,11 +313,11 @@ function At(e) {
308
313
  previous: d,
309
314
  setSequenceIndex: l,
310
315
  hasNext: f,
311
- hasPrevious: v
316
+ hasPrevious: m
312
317
  } = Mt({
313
318
  startCanvas: e.startCanvas,
314
319
  disablePaging: e.pagingEnabled === !1
315
- }), p = y(
320
+ }), p = w(
316
321
  () => ({
317
322
  sequence: o,
318
323
  items: a,
@@ -325,7 +330,7 @@ function At(e) {
325
330
  setSequenceIndex: l,
326
331
  currentSequenceIndex: n,
327
332
  hasNext: f,
328
- hasPrevious: v
333
+ hasPrevious: m
329
334
  }),
330
335
  [o, a, c, i, d, a, s, l, n]
331
336
  );
@@ -379,13 +384,13 @@ const U = function(e) {
379
384
  };
380
385
  function Xt() {
381
386
  const t = O().getStore();
382
- return y(() => (n) => t.dispatch(n), [t]);
387
+ return w(() => (n) => t.dispatch(n), [t]);
383
388
  }
384
389
  function Ce(e) {
385
390
  return typeof e != "string" && e && e.bindToVault;
386
391
  }
387
392
  function en() {
388
- const e = O(), t = q([]), n = Xt(), r = y(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
393
+ const e = O(), t = _([]), n = Xt(), r = w(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
389
394
  Ie(() => {
390
395
  const s = {
391
396
  id: r,
@@ -417,7 +422,7 @@ function en() {
417
422
  const i = R(
418
423
  (s) => r ? s.iiif.entities.AnnotationPage[r] : null,
419
424
  [r]
420
- ), o = P(
425
+ ), o = b(
421
426
  (s, c) => {
422
427
  if (r) {
423
428
  if (Ce(s)) {
@@ -441,7 +446,7 @@ function en() {
441
446
  }
442
447
  },
443
448
  [r]
444
- ), a = P(
449
+ ), a = b(
445
450
  (s) => {
446
451
  r && (Ce(s) ? s = typeof s.source == "string" ? s.source : s.source.id : typeof s != "string" && (s = s.id), t.current[s] && t.current[s].beforeRemove(), e.get({ id: r, type: "AnnotationPage" }) && n(
447
452
  ue.removeReference({
@@ -481,7 +486,7 @@ function nn({ children: e }) {
481
486
  return /* @__PURE__ */ u(
482
487
  Oe.Provider,
483
488
  {
484
- value: y(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
489
+ value: w(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
485
490
  children: e
486
491
  }
487
492
  );
@@ -493,7 +498,7 @@ function rn({
493
498
  error: r,
494
499
  resetErrorBoundary: i
495
500
  }) {
496
- return /* @__PURE__ */ I("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
501
+ return /* @__PURE__ */ M("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
497
502
  /* @__PURE__ */ u("h3", { children: "Error occurred" }),
498
503
  /* @__PURE__ */ u("p", { children: r.message }),
499
504
  /* @__PURE__ */ u("button", { onClick: i, children: "Reset" })
@@ -518,7 +523,7 @@ function Y(e, t, n, r, i = []) {
518
523
  }
519
524
  function j(e = {}, t = []) {
520
525
  const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = R((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
521
- return y(() => {
526
+ return w(() => {
522
527
  if (a)
523
528
  return r ? r(a) : a;
524
529
  }, [a, r, ...t]);
@@ -537,40 +542,40 @@ function sn({
537
542
  worldScale: r,
538
543
  ...i
539
544
  }) {
540
- const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [v, p] = L({}), m = Object.entries(v), [g, w] = L({}), x = y(() => r || Math.max(...Object.values(g)), [g]), M = y(() => ({ maxOverZoom: x || 1, ...i.runtimeOptions || {} }), [x, i.runtimeOptions]), b = P((C, A) => {
541
- w((k) => {
545
+ const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [m, p] = L({}), g = Object.entries(m), [x, v] = L({}), y = w(() => r || Math.max(...Object.values(x)), [x]), C = w(() => ({ maxOverZoom: y || 1, ...i.runtimeOptions || {} }), [y, i.runtimeOptions]), S = b((E, A) => {
546
+ v((k) => {
542
547
  if (A === -1) {
543
- const { [C]: h, ...D } = k;
548
+ const { [E]: h, ...D } = k;
544
549
  return D;
545
550
  }
546
- return { ...k, [C]: A };
551
+ return { ...k, [E]: A };
547
552
  });
548
- }, []), W = P((C, A, k) => {
549
- l(({ [C]: h, ...D }) => A ? {
553
+ }, []), W = b((E, A, k) => {
554
+ l(({ [E]: h, ...D }) => A ? {
550
555
  ...D,
551
- [C]: { element: A, props: k }
556
+ [E]: { element: A, props: k }
552
557
  } : D);
553
- }, []), Z = P((C, A, k) => {
554
- p(({ [C]: h, ...D }) => A ? {
558
+ }, []), Z = b((E, A, k) => {
559
+ p(({ [E]: h, ...D }) => A ? {
555
560
  ...D,
556
- [C]: { element: A, props: k }
561
+ [E]: { element: A, props: k }
557
562
  } : D);
558
563
  }, []);
559
- return /* @__PURE__ */ I(yt, { resetKeys: [], fallbackRender: (C) => /* @__PURE__ */ u(c, { ...i, ...C }), children: [
564
+ return /* @__PURE__ */ M(yt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ u(c, { ...i, ...E }), children: [
560
565
  /* @__PURE__ */ u(
561
566
  st,
562
567
  {
563
568
  ...i,
564
569
  containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
565
- htmlChildren: /* @__PURE__ */ u($, { children: f.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) }),
566
- onCreated: (C) => {
567
- a(C), i.onCreated && i.onCreated(C);
570
+ htmlChildren: /* @__PURE__ */ u($, { children: f.map(([E, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, E)) }),
571
+ onCreated: (E) => {
572
+ a(E), i.onCreated && i.onCreated(E);
568
573
  },
569
- runtimeOptions: M,
570
- children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value: b, children: /* @__PURE__ */ u(Le.Provider, { value: W, children: /* @__PURE__ */ u(ke.Provider, { value: Z, children: /* @__PURE__ */ u(Ot, { bridge: s, children: /* @__PURE__ */ u(ut.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ u(nn, { children: e }) }) }) }) }) }) })
574
+ runtimeOptions: C,
575
+ children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value: S, children: /* @__PURE__ */ u(Le.Provider, { value: W, children: /* @__PURE__ */ u(ke.Provider, { value: Z, children: /* @__PURE__ */ u(Ot, { bridge: s, children: /* @__PURE__ */ u(ut.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ u(nn, { children: e }) }) }) }) }) }) })
571
576
  }
572
577
  ),
573
- /* @__PURE__ */ u("div", { children: m.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) })
578
+ /* @__PURE__ */ u("div", { children: g.map(([E, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, E)) })
574
579
  ] });
575
580
  }
576
581
  const X = {}, Fe = {
@@ -631,11 +636,11 @@ function un(e = Fe) {
631
636
  };
632
637
  }
633
638
  function Ue(e, t) {
634
- const n = O(), r = y(() => un(n), [n]), i = R(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
635
- return y(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
639
+ const n = O(), r = w(() => un(n), [n]), i = R(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
640
+ return w(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
636
641
  }
637
642
  function ne(e, t) {
638
- const n = O(), r = y(() => Te(n), [n]);
643
+ const n = O(), r = w(() => Te(n), [n]);
639
644
  return R(() => {
640
645
  if (!e)
641
646
  return null;
@@ -654,7 +659,7 @@ function De(e = {}, t = []) {
654
659
  } : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
655
660
  [s]
656
661
  );
657
- return y(() => {
662
+ return w(() => {
658
663
  if (!s)
659
664
  return;
660
665
  const d = {
@@ -671,7 +676,7 @@ const _e = ({
671
676
  className: n,
672
677
  interactive: r
673
678
  }) => {
674
- const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d = y(() => ct(t, o), [t, o]);
679
+ const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d = w(() => ct(t, o), [t, o]);
675
680
  return c && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === c.id || i.target.source === c.id) ? /* @__PURE__ */ u(
676
681
  lt,
677
682
  {
@@ -695,7 +700,7 @@ function cn(e = {}, t = []) {
695
700
  (s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
696
701
  [o]
697
702
  );
698
- return y(() => {
703
+ return w(() => {
699
704
  if (a)
700
705
  return r ? r(a) : a;
701
706
  }, [a, ...t]);
@@ -728,8 +733,8 @@ function qe({
728
733
  onClick: c,
729
734
  enableSizes: d
730
735
  }) {
731
- var f, v;
732
- const l = y(() => {
736
+ var f, m;
737
+ const l = w(() => {
733
738
  if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
734
739
  return s.spatial;
735
740
  }, [s]);
@@ -741,7 +746,7 @@ function qe({
741
746
  width: t.target.spatial.width,
742
747
  height: t.target.spatial.height,
743
748
  onClick: c,
744
- children: t.service ? /* @__PURE__ */ I(te, { children: [
749
+ children: t.service ? /* @__PURE__ */ M(te, { children: [
745
750
  /* @__PURE__ */ u(
746
751
  dt,
747
752
  {
@@ -756,12 +761,12 @@ function qe({
756
761
  x: 0,
757
762
  y: 0,
758
763
  width: (f = t.target) == null ? void 0 : f.spatial.width,
759
- height: (v = t.target) == null ? void 0 : v.spatial.height,
764
+ height: (m = t.target) == null ? void 0 : m.spatial.height,
760
765
  crop: l
761
766
  }
762
767
  ),
763
768
  a
764
- ] }, "service") : /* @__PURE__ */ I(te, { children: [
769
+ ] }, "service") : /* @__PURE__ */ M(te, { children: [
765
770
  /* @__PURE__ */ u(
766
771
  "world-image",
767
772
  {
@@ -806,7 +811,7 @@ function Be(e, t) {
806
811
  const ln = {
807
812
  makeChoice: () => {
808
813
  }
809
- }, ce = { type: "unknown" }, E = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), dn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
814
+ }, ce = { type: "unknown" }, I = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), dn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
810
815
  function fn(e, t) {
811
816
  var r;
812
817
  const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
@@ -855,12 +860,12 @@ function mn(e, t) {
855
860
  return n ? n.annotationPageManager : null;
856
861
  }
857
862
  function vn(e, t = {}) {
858
- const n = O(), r = K(), i = j(), o = Re(), a = y(() => gn({
863
+ const n = O(), r = K(), i = j(), o = Re(), a = w(() => gn({
859
864
  all: t.all,
860
865
  manifest: r,
861
866
  canvas: i,
862
867
  canvases: o
863
- }), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = P(
868
+ }), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = b(
864
869
  (l) => {
865
870
  e && n.setMetaValue(
866
871
  [l, "annotationPageManager", "views"],
@@ -871,24 +876,24 @@ function vn(e, t = {}) {
871
876
  );
872
877
  },
873
878
  [e, n]
874
- ), d = P(
879
+ ), d = b(
875
880
  (l, f = {}) => {
876
881
  if (!e)
877
882
  return;
878
- const v = n.getState(), p = [];
883
+ const m = n.getState(), p = [];
879
884
  if (f != null && f.deselectOthers) {
880
- const m = Object.keys(v.iiif.entities.AnnotationPage);
881
- for (const g of m) {
882
- const w = mn(v, g);
883
- w && w.views && w.views[e] && p.push(g);
885
+ const g = Object.keys(m.iiif.entities.AnnotationPage);
886
+ for (const x of g) {
887
+ const v = mn(m, x);
888
+ v && v.views && v.views[e] && p.push(x);
884
889
  }
885
890
  }
886
- for (const m of p)
887
- c(m);
891
+ for (const g of p)
892
+ c(g);
888
893
  n.setMetaValue(
889
894
  [l, "annotationPageManager", "views"],
890
- (m) => m && m[e] ? m : {
891
- ...m || {},
895
+ (g) => g && g[e] ? g : {
896
+ ...g || {},
892
897
  [e]: !0
893
898
  }
894
899
  );
@@ -910,10 +915,10 @@ function je() {
910
915
  return T(yn);
911
916
  }
912
917
  function xn() {
913
- const e = je(), [t, n] = L({}), r = q(!1);
918
+ const e = je(), [t, n] = L({}), r = _(!1);
914
919
  return N(() => () => {
915
920
  r.current = !0;
916
- }, []), [P(
921
+ }, []), [b(
917
922
  (o, { height: a, width: s }) => {
918
923
  if (o) {
919
924
  const c = o.id || o["@id"], d = e.loadServiceSync({
@@ -998,27 +1003,27 @@ function Pn(e = He) {
998
1003
  if (l.type !== "Annotation")
999
1004
  throw new Error("getPaintables() accept either a canvas or list of annotations");
1000
1005
  const f = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
1001
- for (const v of f) {
1002
- const [p, { selector: m }] = Sn(v), g = e.get(p), w = (g.type || "unknown").toLowerCase();
1003
- if (w === "choice") {
1004
- const x = e.get(g.items, { parent: g.id }), M = o.length ? o.map((b) => x.find((W) => W.id === b)).filter(Boolean) : [x[0]];
1005
- M.length === 0 && M.push(x[0]), c = {
1006
+ for (const m of f) {
1007
+ const [p, { selector: g }] = Sn(m), x = e.get(p), v = (x.type || "unknown").toLowerCase();
1008
+ if (v === "choice") {
1009
+ const y = e.get(x.items, { parent: x.id }), C = o.length ? o.map((S) => y.find((W) => W.id === S)).filter(Boolean) : [y[0]];
1010
+ C.length === 0 && C.push(y[0]), c = {
1006
1011
  type: "single-choice",
1007
- items: x.map((b) => ({
1008
- id: b.id,
1009
- label: b.label,
1010
- selected: M.indexOf(b) !== -1
1012
+ items: y.map((S) => ({
1013
+ id: S.id,
1014
+ label: S.label,
1015
+ selected: C.indexOf(S) !== -1
1011
1016
  })),
1012
1017
  label: p.label
1013
- }, f.push(...M);
1018
+ }, f.push(...C);
1014
1019
  continue;
1015
1020
  }
1016
- s.indexOf(w) === -1 && s.push(w), d.push({
1017
- type: w,
1021
+ s.indexOf(v) === -1 && s.push(v), d.push({
1022
+ type: v,
1018
1023
  annotationId: l.id,
1019
- resource: g,
1024
+ resource: x,
1020
1025
  target: l.target,
1021
- selector: m
1026
+ selector: g
1022
1027
  });
1023
1028
  }
1024
1029
  }
@@ -1039,29 +1044,29 @@ function Pn(e = He) {
1039
1044
  };
1040
1045
  }
1041
1046
  function bn(e, t = []) {
1042
- const n = O(), r = y(() => Pn(n), []), i = wn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = y(
1047
+ const n = O(), r = w(() => Pn(n), []), i = wn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = w(
1043
1048
  () => r.getPaintables(i, o),
1044
1049
  [n, i, o, ...t]
1045
- ), d = { makeChoice: P(
1046
- (l, { deselectOthers: f = !0, deselect: v = !1 } = {}) => {
1050
+ ), d = { makeChoice: b(
1051
+ (l, { deselectOthers: f = !0, deselect: m = !1 } = {}) => {
1047
1052
  if (s.choice) {
1048
1053
  if (s.choice.type !== "single-choice")
1049
1054
  throw new Error("Complex choice not supported yet");
1050
1055
  a((p) => {
1051
- if (v) {
1052
- const g = p.filter((w) => w !== l);
1053
- if (g.length === 0) {
1054
- const w = s.items[0].resource.id;
1055
- return w ? [w] : [];
1056
+ if (m) {
1057
+ const x = p.filter((v) => v !== l);
1058
+ if (x.length === 0) {
1059
+ const v = s.items[0].resource.id;
1060
+ return v ? [v] : [];
1056
1061
  }
1057
- return g;
1062
+ return x;
1058
1063
  }
1059
1064
  if (f)
1060
1065
  return [l];
1061
- const m = [...p];
1062
- if (m.length === 0 && s.items.length) {
1063
- const g = s.items[0].resource.id;
1064
- g && m.push(g);
1066
+ const g = [...p];
1067
+ if (g.length === 0 && s.items.length) {
1068
+ const x = s.items[0].resource.id;
1069
+ x && g.push(x);
1065
1070
  }
1066
1071
  return p.indexOf(l) !== -1 ? p : [...p, l];
1067
1072
  });
@@ -1074,17 +1079,17 @@ function bn(e, t = []) {
1074
1079
  const Cn = ["model/gltf-binary"];
1075
1080
  function En(e, t) {
1076
1081
  const r = t.items[0].resource;
1077
- return r.format ? Cn.indexOf(r.format) === -1 ? E(`3D format: ${r.format} is unsupported`) : {
1082
+ return r.format ? Cn.indexOf(r.format) === -1 ? I(`3D format: ${r.format} is unsupported`) : {
1078
1083
  type: "3d-model",
1079
1084
  model: r
1080
- } : E("Unknown format");
1085
+ } : I("Unknown format");
1081
1086
  }
1082
1087
  function In(e, t) {
1083
1088
  var r;
1084
1089
  if (!e.duration)
1085
- return E("No duration on canvas");
1090
+ return I("No duration on canvas");
1086
1091
  if (t.items.length > 1)
1087
- return E("Only one audio source supported");
1092
+ return I("Only one audio source supported");
1088
1093
  const n = (r = t.items[0]) == null ? void 0 : r.resource;
1089
1094
  return n ? n.format ? {
1090
1095
  type: "media",
@@ -1112,14 +1117,14 @@ function In(e, t) {
1112
1117
  annotations: {
1113
1118
  pages: []
1114
1119
  }
1115
- } : E("Audio does not have format") : E("Unknown audio");
1120
+ } : I("Audio does not have format") : I("Unknown audio");
1116
1121
  }
1117
1122
  function Mn(e, t, n) {
1118
1123
  const r = [];
1119
1124
  for (const i of t.items) {
1120
1125
  const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
1121
1126
  if (!o.id)
1122
- return E("No resource Identifier");
1127
+ return I("No resource Identifier");
1123
1128
  let a;
1124
1129
  if (o.service) {
1125
1130
  const p = mt(o);
@@ -1156,7 +1161,7 @@ function Mn(e, t, n) {
1156
1161
  }
1157
1162
  } : void 0;
1158
1163
  a && !a.id && (a.id = a["@id"]);
1159
- const v = {
1164
+ const m = {
1160
1165
  id: o.id,
1161
1166
  type: "Image",
1162
1167
  annotationId: i.annotationId,
@@ -1167,7 +1172,7 @@ function Mn(e, t, n) {
1167
1172
  target: c && c.type !== "PointSelector" ? c : s,
1168
1173
  selector: f
1169
1174
  };
1170
- r.push(v);
1175
+ r.push(m);
1171
1176
  }
1172
1177
  return {
1173
1178
  type: "images",
@@ -1208,16 +1213,16 @@ function Rn(e, t) {
1208
1213
  const n = t.items.filter((c) => c.type === "video");
1209
1214
  let r = !1;
1210
1215
  if (e.duration || (r = !0), n.length > 1)
1211
- return E("Only one video source supported");
1216
+ return I("Only one video source supported");
1212
1217
  const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1213
1218
  (c) => (c.profile || "").includes("youtube.com")
1214
1219
  );
1215
1220
  if (!o && r)
1216
- return E("Video does not have duration");
1221
+ return I("Video does not have duration");
1217
1222
  if (!i)
1218
- return E("Unknown video");
1223
+ return I("Unknown video");
1219
1224
  if ((!i.format || i.format === "text/html") && !o)
1220
- return E("Video does not have format");
1225
+ return I("Video does not have format");
1221
1226
  const a = {
1222
1227
  annotationId: t.items[0].annotationId,
1223
1228
  duration: e.duration,
@@ -1244,7 +1249,7 @@ function Rn(e, t) {
1244
1249
  a.type = "VideoYouTube";
1245
1250
  const c = i.id.match(Tn);
1246
1251
  if (!c[1])
1247
- return E("Video is not known youtube video");
1252
+ return I("Video is not known youtube video");
1248
1253
  a.youTubeId = c[1];
1249
1254
  }
1250
1255
  return {
@@ -1264,9 +1269,9 @@ function Vn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1264
1269
  if (t.types.length === 2 && t.types.indexOf("text") !== -1)
1265
1270
  t.types = t.types.filter((o) => o !== "text");
1266
1271
  else
1267
- return n.indexOf("complex-timeline") === -1 ? E("Complex timeline not supported") : E("ComplexTimelineStrategy not yet supported");
1272
+ return n.indexOf("complex-timeline") === -1 ? I("Complex timeline not supported") : I("ComplexTimelineStrategy not yet supported");
1268
1273
  const i = t.types[0];
1269
- return i === "image" ? n.indexOf("images") === -1 ? E("Image not supported") : Mn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? E("3D not supported") : En(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? E("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? E("Media not supported") : In(e, t) : i === "video" ? n.indexOf("media") === -1 ? E("Media not supported") : Rn(e, t) : ce;
1274
+ return i === "image" ? n.indexOf("images") === -1 ? I("Image not supported") : Mn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? I("3D not supported") : En(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? I("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? I("Media not supported") : In(e, t) : i === "video" ? n.indexOf("media") === -1 ? I("Media not supported") : Rn(e, t) : ce;
1270
1275
  }
1271
1276
  function On(e) {
1272
1277
  const t = K(), n = j(), r = O(), [i, o] = xn(), { enabledPageIds: a } = vn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
@@ -1277,8 +1282,8 @@ function On(e) {
1277
1282
  "media",
1278
1283
  "textual-content",
1279
1284
  "complex-timeline"
1280
- ], [d, l] = bn(e, [o]), f = y(() => Vn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, l.makeChoice]);
1281
- return y(() => f.type === "unknown" ? [f, ln] : [
1285
+ ], [d, l] = bn(e, [o]), f = w(() => Vn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, l.makeChoice]);
1286
+ return w(() => f.type === "unknown" ? [f, ln] : [
1282
1287
  {
1283
1288
  ...f,
1284
1289
  annotations: { pages: s }
@@ -1293,15 +1298,15 @@ const Ln = (e, t = []) => {
1293
1298
  }, [n, ...t]);
1294
1299
  };
1295
1300
  function kn(e, t, { canvasId: n, manifestId: r } = {}) {
1296
- const i = O(), o = je(), a = y(() => vt(i, { imageServiceLoader: o }), [i, o]), [s, c] = L(), d = K(r ? { id: r } : void 0), l = j(n ? { id: n } : void 0), f = l || d, v = q(!1);
1297
- if (N(() => (v.current = !1, () => {
1298
- v.current = !0;
1301
+ const i = O(), o = je(), a = w(() => vt(i, { imageServiceLoader: o }), [i, o]), [s, c] = L(), d = K(r ? { id: r } : void 0), l = j(n ? { id: n } : void 0), f = l || d, m = _(!1);
1302
+ if (N(() => (m.current = !1, () => {
1303
+ m.current = !0;
1299
1304
  }), []), !f)
1300
1305
  throw new Error("Must be called under a manifest or canvas context.");
1301
1306
  return Ln(
1302
1307
  (p) => {
1303
- a.getBestThumbnailAtSize(f, e, t).then((m) => {
1304
- m.best && !v.current && c(m.best);
1308
+ a.getBestThumbnailAtSize(f, e, t).then((g) => {
1309
+ g.best && !m.current && c(g.best);
1305
1310
  });
1306
1311
  },
1307
1312
  [f]
@@ -1338,39 +1343,39 @@ function Un(e) {
1338
1343
  return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
1339
1344
  }
1340
1345
  function pe(e) {
1341
- const [t, n] = ot(Fn, Nn(e.duration)), r = q(null), i = q(null), o = q(null), a = q(!1), s = P(() => {
1346
+ const [t, n] = ot(Fn, Nn(e.duration)), r = _(null), i = _(null), o = _(null), a = _(!1), s = b(() => {
1342
1347
  i.current && r.current && (i.current.innerHTML = Un(r.current.currentTime), o.current && (o.current.style.width = `${r.current.currentTime / e.duration * 100}%`), a.current !== r.current.muted && (a.current = r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
1343
- }, [e.duration]), c = P(() => {
1348
+ }, [e.duration]), c = b(() => {
1344
1349
  r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
1345
1350
  n({ type: "PLAY" });
1346
1351
  }), s());
1347
- }, [s]), d = P(() => {
1352
+ }, [s]), d = b(() => {
1348
1353
  r.current && (r.current.duration > 0 && r.current.paused ? c() : l());
1349
- }, [s]), l = P(() => {
1354
+ }, [s]), l = b(() => {
1350
1355
  r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
1351
- }, [s]), f = P(() => {
1356
+ }, [s]), f = b(() => {
1352
1357
  r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1353
- }, []), v = P(() => {
1358
+ }, []), m = b(() => {
1354
1359
  r.current && (r.current.muted = !0, n({ type: "MUTE" }));
1355
- }, []), p = P(() => {
1360
+ }, []), p = b(() => {
1356
1361
  r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
1357
- }, []), m = P((x) => {
1358
- r.current && (r.current.muted = !1, r.current.volume = x / 100, n({ type: "SET_VOLUME", volume: x }));
1359
- }, []), g = P((x) => {
1360
- r.current && (r.current.currentTime = Math.max(0, Math.min(x * e.duration, e.duration)), s());
1361
- }, []), w = P((x) => {
1362
- r.current && (r.current.currentTime = Math.max(0, Math.min(x, e.duration)), s());
1362
+ }, []), g = b((y) => {
1363
+ r.current && (r.current.muted = !1, r.current.volume = y / 100, n({ type: "SET_VOLUME", volume: y }));
1364
+ }, []), x = b((y) => {
1365
+ r.current && (r.current.currentTime = Math.max(0, Math.min(y * e.duration, e.duration)), s());
1366
+ }, []), v = b((y) => {
1367
+ r.current && (r.current.currentTime = Math.max(0, Math.min(y, e.duration)), s());
1363
1368
  }, []);
1364
1369
  return N(() => {
1365
- const x = setInterval(() => {
1370
+ const y = setInterval(() => {
1366
1371
  s();
1367
1372
  }, 350);
1368
- return () => clearInterval(x);
1373
+ return () => clearInterval(y);
1369
1374
  }, [s, e.duration]), N(() => {
1370
- const x = () => {
1375
+ const y = () => {
1371
1376
  n({ type: "FINISHED" });
1372
- }, M = r.current;
1373
- return M == null || M.addEventListener("ended", x), () => M == null ? void 0 : M.removeEventListener("ended", x);
1377
+ }, C = r.current;
1378
+ return C == null || C.addEventListener("ended", y), () => C == null ? void 0 : C.removeEventListener("ended", y);
1374
1379
  }, []), [
1375
1380
  { element: r, currentTime: i, progress: o },
1376
1381
  t,
@@ -1378,12 +1383,12 @@ function pe(e) {
1378
1383
  play: c,
1379
1384
  pause: l,
1380
1385
  playPause: d,
1381
- mute: v,
1386
+ mute: m,
1382
1387
  unmute: p,
1383
1388
  toggleMute: f,
1384
- setVolume: m,
1385
- setDurationPercent: g,
1386
- setTime: w
1389
+ setVolume: g,
1390
+ setDurationPercent: x,
1391
+ setTime: v
1387
1392
  }
1388
1393
  ];
1389
1394
  }
@@ -1400,7 +1405,7 @@ function Ye({
1400
1405
  }
1401
1406
  function ze({ media: e, children: t }) {
1402
1407
  const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
1403
- return /* @__PURE__ */ I(
1408
+ return /* @__PURE__ */ M(
1404
1409
  Ye,
1405
1410
  {
1406
1411
  state: o,
@@ -1427,7 +1432,7 @@ function We({
1427
1432
  media: t,
1428
1433
  playPause: n
1429
1434
  }) {
1430
- return /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1435
+ return /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1431
1436
  /* @__PURE__ */ u("style", { children: `
1432
1437
  .video-container {
1433
1438
  position: absolute;
@@ -1471,7 +1476,7 @@ function Ge({
1471
1476
  ), null;
1472
1477
  }
1473
1478
  function Qe({ model: e }) {
1474
- return /* @__PURE__ */ I($, { children: [
1479
+ return /* @__PURE__ */ M($, { children: [
1475
1480
  /* @__PURE__ */ u("style", { children: `
1476
1481
  .model-container {
1477
1482
  position: absolute;
@@ -1521,7 +1526,7 @@ function Ee(e) {
1521
1526
  }
1522
1527
  function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1523
1528
  const o = Xe();
1524
- return y(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ u(e, { ...i, children: n }) : /* @__PURE__ */ u("span", { ...i, children: n }) : e ? /* @__PURE__ */ u(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ u("span", { ...i, lang: t, dir: r, children: n });
1529
+ return w(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ u(e, { ...i, children: n }) : /* @__PURE__ */ u("span", { ...i, children: n }) : e ? /* @__PURE__ */ u(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ u("span", { ...i, lang: t, dir: r, children: n });
1525
1530
  }
1526
1531
  function Hn(e, t, n) {
1527
1532
  if (t.length === 0)
@@ -1540,7 +1545,7 @@ function Hn(e, t, n) {
1540
1545
  }
1541
1546
  const $n = (e, t = []) => {
1542
1547
  const n = Xe();
1543
- return y(() => {
1548
+ return w(() => {
1544
1549
  const r = e();
1545
1550
  return Hn(n, r, []);
1546
1551
  }, [n, ...t]);
@@ -1549,7 +1554,7 @@ function Yn(e, t, n = `
1549
1554
  `) {
1550
1555
  const r = $n(() => Object.keys(e || {}), [e]);
1551
1556
  return [
1552
- y(() => {
1557
+ w(() => {
1553
1558
  if (!e)
1554
1559
  return t || "";
1555
1560
  if (typeof e == "string")
@@ -1598,8 +1603,8 @@ function Kn({
1598
1603
  media: t,
1599
1604
  playPause: n
1600
1605
  }) {
1601
- const r = q(null);
1602
- return t.youTubeId ? /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1606
+ const r = _(null);
1607
+ return t.youTubeId ? /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1603
1608
  /* @__PURE__ */ u("style", { children: `
1604
1609
  .video-container {
1605
1610
  position: absolute;
@@ -1656,55 +1661,55 @@ function et({
1656
1661
  mediaControlsDeps: d,
1657
1662
  strategies: l,
1658
1663
  throwOnUnknown: f,
1659
- backgroundStyle: v,
1664
+ backgroundStyle: m,
1660
1665
  alwaysShowBackground: p,
1661
- keepCanvasScale: m = !1,
1662
- enableSizes: g = !1,
1663
- enableYouTube: w = !0,
1664
- onClickPaintingAnnotation: x,
1665
- children: M
1666
+ keepCanvasScale: g = !1,
1667
+ enableSizes: x = !1,
1668
+ enableYouTube: v = !0,
1669
+ onClickPaintingAnnotation: y,
1670
+ children: C
1666
1671
  }) {
1667
- const b = j(), W = Ue(b, ["deep-zoom"]), [Z] = tn(), C = on(), A = O(), k = y(() => Te(A), [A]), [h, D] = On({
1672
+ const S = j(), W = Ue(S, ["deep-zoom"]), [Z] = tn(), E = on(), A = O(), k = w(() => Te(A), [A]), [h, D] = On({
1668
1673
  strategies: l || ["images"],
1669
- defaultChoices: i == null ? void 0 : i.map(({ id: S }) => S)
1670
- }), ye = h.type === "images" ? h.choice : void 0, tt = y(() => m ? 1 : Math.max(
1674
+ defaultChoices: i == null ? void 0 : i.map(({ id: P }) => P)
1675
+ }), ye = h.type === "images" ? h.choice : void 0, tt = w(() => g ? 1 : Math.max(
1671
1676
  1,
1672
- ...h.type === "images" ? h.images.map((S) => {
1677
+ ...h.type === "images" ? h.images.map((P) => {
1673
1678
  var H;
1674
- return (S.width || 0) / ((H = S.target) == null ? void 0 : H.spatial.width);
1679
+ return (P.width || 0) / ((H = P.target) == null ? void 0 : H.spatial.width);
1675
1680
  }) : []
1676
- ), [m, h]);
1681
+ ), [g, h]);
1677
1682
  an(tt), N(() => {
1678
1683
  r && r(D);
1679
1684
  }, [h.annotations]), N(() => {
1680
1685
  if (i)
1681
- for (const S of i)
1682
- typeof S.opacity < "u" && k.applyStyles({ id: S.id }, "atlas", {
1683
- opacity: S.opacity
1686
+ for (const P of i)
1687
+ typeof P.opacity < "u" && k.applyStyles({ id: P.id }, "atlas", {
1688
+ opacity: P.opacity
1684
1689
  });
1685
1690
  }, [i]), Ie(() => {
1686
1691
  n && n(ye);
1687
1692
  }, [ye]), Y(
1688
- C && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
1689
- `canvas-portal-controls-${b == null ? void 0 : b.id}`,
1693
+ E && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
1694
+ `canvas-portal-controls-${S == null ? void 0 : S.id}`,
1690
1695
  ve.Provider,
1691
1696
  a ? {
1692
- value: C || null,
1697
+ value: E || null,
1693
1698
  children: a(h)
1694
1699
  } : {},
1695
- [b, C, h, ...c || []]
1700
+ [S, E, h, ...c || []]
1696
1701
  );
1697
- const _ = kn({ maxWidth: 256, maxHeight: 256 });
1698
- if (!b)
1702
+ const q = kn({ maxWidth: 256, maxHeight: 256 });
1703
+ if (!S)
1699
1704
  return null;
1700
- const xe = b.accompanyingCanvas, G = _ && _.type === "fixed" ? /* @__PURE__ */ u("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ u(
1705
+ const xe = S.accompanyingCanvas, G = q && q.type === "fixed" ? /* @__PURE__ */ u("world-object", { height: S.height, width: S.width, x: e, y: t, children: /* @__PURE__ */ u(
1701
1706
  "world-image",
1702
1707
  {
1703
- uri: _.id,
1704
- target: { x: 0, y: 0, width: b.width, height: b.height },
1705
- display: _.width && _.height ? {
1706
- width: _.width,
1707
- height: _.height
1708
+ uri: q.id,
1709
+ target: { x: 0, y: 0, width: S.width, height: S.height },
1710
+ display: q.width && q.height ? {
1711
+ width: q.width,
1712
+ height: q.height
1708
1713
  } : void 0,
1709
1714
  crop: void 0
1710
1715
  }
@@ -1716,71 +1721,71 @@ function et({
1716
1721
  throw new Error(h.reason || "Unknown image strategy");
1717
1722
  return null;
1718
1723
  }
1719
- const we = /* @__PURE__ */ I(te, { children: [
1724
+ const we = /* @__PURE__ */ M(te, { children: [
1720
1725
  Z ? /* @__PURE__ */ u(de, { page: Z }) : null,
1721
- h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ u(de, { page: S }, S.id)) : null,
1722
- M
1726
+ h.annotations && h.annotations.pages ? h.annotations.pages.map((P) => /* @__PURE__ */ u(de, { page: P }, P.id)) : null,
1727
+ C
1723
1728
  ] }), nt = h.type === "images" ? h.images.length : 0;
1724
- return /* @__PURE__ */ I($, { children: [
1725
- /* @__PURE__ */ I(
1729
+ return /* @__PURE__ */ M($, { children: [
1730
+ /* @__PURE__ */ M(
1726
1731
  "world-object",
1727
1732
  {
1728
- height: b.height,
1729
- width: b.width,
1733
+ height: S.height,
1734
+ width: S.width,
1730
1735
  x: e,
1731
1736
  y: t,
1732
1737
  ...W,
1733
1738
  children: [
1734
- h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style: v }) : null,
1735
- h.type === "textual-content" ? h.items.map((S, H) => {
1739
+ h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style: m }) : null,
1740
+ h.type === "textual-content" ? h.items.map((P, H) => {
1736
1741
  var Q;
1737
- return /* @__PURE__ */ I($, { children: [
1742
+ return /* @__PURE__ */ M($, { children: [
1738
1743
  /* @__PURE__ */ u(
1739
1744
  ft,
1740
1745
  {
1741
- onClick: x ? (Se) => {
1742
- Se.stopPropagation(), x(S.annotationId, S, Se);
1746
+ onClick: y ? (Se) => {
1747
+ Se.stopPropagation(), y(P.annotationId, P, Se);
1743
1748
  } : void 0,
1744
- target: ((Q = S.target) == null ? void 0 : Q.spatial) || void 0,
1745
- children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
1749
+ target: ((Q = P.target) == null ? void 0 : Q.spatial) || void 0,
1750
+ children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children: P.text }) })
1746
1751
  },
1747
1752
  H
1748
1753
  ),
1749
1754
  we
1750
1755
  ] });
1751
1756
  }) : null,
1752
- h.type === "images" ? /* @__PURE__ */ I($, { children: [
1753
- h.images.map((S, H) => /* @__PURE__ */ u(
1757
+ h.type === "images" ? /* @__PURE__ */ M($, { children: [
1758
+ h.images.map((P, H) => /* @__PURE__ */ u(
1754
1759
  qe,
1755
1760
  {
1756
1761
  isStatic: o,
1757
- image: S,
1758
- id: S.id,
1759
- thumbnail: H === 0 ? _ : void 0,
1760
- selector: S.selector,
1761
- enableSizes: g,
1762
- onClick: x ? (Q) => {
1763
- Q.stopPropagation(), x(S.annotationId, S, Q);
1762
+ image: P,
1763
+ id: P.id,
1764
+ thumbnail: H === 0 ? q : void 0,
1765
+ selector: P.selector,
1766
+ enableSizes: x,
1767
+ onClick: y ? (Q) => {
1768
+ Q.stopPropagation(), y(P.annotationId, P, Q);
1764
1769
  } : void 0
1765
1770
  },
1766
- S.id + H
1771
+ P.id + H
1767
1772
  )),
1768
1773
  we
1769
1774
  ] }) : null,
1770
1775
  h.type === "3d-model" ? /* @__PURE__ */ u(Je, { model: h.model }) : null,
1771
- h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ I(Ke, { media: h.media, mediaControlsDeps: d, children: [
1776
+ h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ M(Ke, { media: h.media, mediaControlsDeps: d, children: [
1772
1777
  G,
1773
1778
  s ? s(h) : null
1774
- ] }) : h.media.type === "Video" ? /* @__PURE__ */ I(Ge, { media: h.media, mediaControlsDeps: d, children: [
1779
+ ] }) : h.media.type === "Video" ? /* @__PURE__ */ M(Ge, { media: h.media, mediaControlsDeps: d, children: [
1775
1780
  G,
1776
1781
  s ? s(h) : null
1777
- ] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */ I(Wn, { media: h.media, mediaControlsDeps: d, children: [
1782
+ ] }) : h.media.type === "VideoYouTube" && v ? /* @__PURE__ */ M(Wn, { media: h.media, mediaControlsDeps: d, children: [
1778
1783
  G,
1779
1784
  s ? s(h) : null
1780
1785
  ] }) : null }) : null
1781
1786
  ]
1782
1787
  },
1783
- `${b.id}/${h.type}/${nt}`
1788
+ `${S.id}/${h.type}/${nt}`
1784
1789
  ),
1785
1790
  h.type === "media" && h.media.type === "Sound" && xe ? /* @__PURE__ */ u(me, { canvas: xe.id, children: /* @__PURE__ */ u(et, { renderViewerControls: a }) }) : null
1786
1791
  ] });
@@ -1790,7 +1795,7 @@ const Gn = Me(function(t, n) {
1790
1795
  if (at(n, () => o, [o]), !r)
1791
1796
  return /* @__PURE__ */ u("div", {});
1792
1797
  let c = 0;
1793
- return /* @__PURE__ */ I($, { children: [
1798
+ return /* @__PURE__ */ M($, { children: [
1794
1799
  t.header,
1795
1800
  /* @__PURE__ */ u(
1796
1801
  V.Viewer,
@@ -1818,8 +1823,8 @@ const Gn = Me(function(t, n) {
1818
1823
  t.children
1819
1824
  ] });
1820
1825
  }), V = Me(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: c, reuseAtlas: d, ...l }, f) {
1821
- const v = ge();
1822
- return /* @__PURE__ */ u(he, { vault: v, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
1826
+ const m = ge();
1827
+ return /* @__PURE__ */ u(he, { vault: m, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
1823
1828
  Gn,
1824
1829
  {
1825
1830
  ref: f,