react-iiif-vault 1.0.9 → 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,17 +1,17 @@
1
- import { jsx as c, jsxs as I, Fragment as $ } from "react/jsx-runtime";
2
- import B, { createContext as F, Component as nt, createElement as we, isValidElement as rt, useContext as R, useMemo as y, useState as L, useEffect as N, useCallback as P, useRef as q, useLayoutEffect as Ce, Fragment as te, useReducer as it, forwardRef as Ee, useImperativeHandle as ot } from "react";
3
- import { AtlasAuto as at, ModeContext as st, mergeStyles as ut, RegionHighlight as ct, TileSet as lt, HTMLPortal as dt } from "@atlas-viewer/atlas";
4
- import { globalVault as Ie, Vault as Se } from "@iiif/helpers/vault";
5
- import { createStylesHelper as Me } from "@iiif/helpers/styles";
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
+ import { AtlasAuto as st, ModeContext as ut, mergeStyles as ct, RegionHighlight as lt, TileSet as dt, HTMLPortal as ft } from "@atlas-viewer/atlas";
4
+ import { globalVault as Ae, Vault as be } from "@iiif/helpers/vault";
5
+ import { createStylesHelper as Te } from "@iiif/helpers/styles";
6
6
  import { expandTarget as le } from "@iiif/helpers/annotation-targets";
7
- import { expandTarget as ft } from "@iiif/helpers";
8
- import { ImageServiceLoader as ht, getImageServices as gt } from "@atlas-viewer/iiif-image-api";
9
- import { createThumbnailHelper as mt } from "@iiif/helpers/thumbnail";
10
- const vt = F(null), se = {
7
+ import { expandTarget as ht } from "@iiif/helpers";
8
+ import { ImageServiceLoader as gt, getImageServices as mt } from "@atlas-viewer/iiif-image-api";
9
+ import { createThumbnailHelper as vt } from "@iiif/helpers/thumbnail";
10
+ const pt = F(null), se = {
11
11
  didCatch: !1,
12
12
  error: null
13
13
  };
14
- class pt extends nt {
14
+ class yt extends rt {
15
15
  constructor(t) {
16
16
  super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = se;
17
17
  }
@@ -44,7 +44,7 @@ class pt extends nt {
44
44
  } = this.state, {
45
45
  resetKeys: i
46
46
  } = this.props;
47
- if (r && n.error !== null && yt(t.resetKeys, i)) {
47
+ if (r && n.error !== null && xt(t.resetKeys, i)) {
48
48
  var o, a;
49
49
  (o = (a = this.props).onReset) === null || o === void 0 || o.call(a, {
50
50
  next: i,
@@ -65,20 +65,20 @@ class pt extends nt {
65
65
  } = this.state;
66
66
  let s = t;
67
67
  if (o) {
68
- const u = {
68
+ const c = {
69
69
  error: a,
70
70
  resetErrorBoundary: this.resetErrorBoundary
71
71
  };
72
72
  if (typeof n == "function")
73
- s = n(u);
73
+ s = n(c);
74
74
  else if (r)
75
- s = we(r, u);
76
- else if (i === null || rt(i))
75
+ s = Pe(r, c);
76
+ else if (i === null || it(i))
77
77
  s = i;
78
78
  else
79
79
  throw a;
80
80
  }
81
- return we(vt.Provider, {
81
+ return Pe(pt.Provider, {
82
82
  value: {
83
83
  didCatch: o,
84
84
  error: a,
@@ -87,53 +87,51 @@ class pt extends nt {
87
87
  }, s);
88
88
  }
89
89
  }
90
- function yt() {
90
+ function xt() {
91
91
  let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
92
92
  return e.length !== t.length || e.some((n, r) => !Object.is(n, t[r]));
93
93
  }
94
- const xt = {
94
+ const wt = {
95
95
  collection: void 0,
96
96
  manifest: void 0,
97
97
  range: void 0,
98
98
  canvas: void 0,
99
99
  annotation: void 0,
100
100
  annotationPage: void 0
101
- }, fe = B.createContext(xt), z = () => R(fe);
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]);
107
- return /* @__PURE__ */ c(fe.Provider, { value: r, children: t });
107
+ return /* @__PURE__ */ u(fe.Provider, { value: r, children: t });
108
108
  }
109
109
  const ie = B.createContext({
110
110
  vault: null,
111
111
  setVaultInstance: (e) => {
112
112
  }
113
113
  });
114
- function Ae({
114
+ function he({
115
115
  vault: e,
116
116
  vaultOptions: t,
117
117
  useGlobal: n,
118
118
  resources: r,
119
119
  children: i
120
120
  }) {
121
- const [o, a] = L(() => e || (n ? Ie(t) : t ? new Se(t) : new Se()));
122
- return /* @__PURE__ */ c(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ c(re, { value: r || {}, children: i }) });
121
+ const [o, a] = L(() => e || (n ? Ae(t) : t ? new be(t) : new be()));
122
+ return /* @__PURE__ */ u(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ u(re, { value: r || {}, children: i }) });
123
123
  }
124
- const T = () => {
125
- const { vault: e } = R(ie);
126
- if (e === null)
127
- throw new Error("Vault not found. Ensure you have your provider set up correctly.");
128
- return e;
129
- };
130
- function wt(e, { noCache: t = !1 } = {}) {
131
- const n = typeof e == "string" ? e : e.id, r = T(), [i, o] = L(n), [a, s] = L(void 0), u = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(u);
124
+ function ge(e) {
125
+ const t = T(ie);
126
+ return e || (t && t.vault ? t.vault : Ae());
127
+ }
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 = w(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
132
130
  return N(() => {
133
131
  (async () => {
134
132
  try {
135
- const f = u && !t ? u : await r.load(n), v = f ? f.id || f["@id"] : null;
136
- 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);
137
135
  } catch (f) {
138
136
  s(f);
139
137
  }
@@ -144,24 +142,30 @@ function wt(e, { noCache: t = !1 } = {}) {
144
142
  requestId: n,
145
143
  error: a,
146
144
  resource: d,
147
- cached: !!(d && d === u)
145
+ cached: !!(d && d === c)
148
146
  };
149
147
  }
150
- function St(e, t) {
151
- const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = wt(
148
+ function Pt(e, t) {
149
+ const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = St(
152
150
  e,
153
151
  t
154
152
  );
155
153
  return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
156
154
  }
157
- function Pt({ manifest: e, children: t }) {
158
- return /* @__PURE__ */ c(re, { value: { manifest: e }, children: t });
155
+ function bt({ manifest: e, children: t }) {
156
+ return /* @__PURE__ */ u(re, { value: { manifest: e }, children: t });
159
157
  }
160
- function he({ canvas: e, children: t }) {
161
- return /* @__PURE__ */ c(re, { value: { canvas: e }, children: t });
158
+ function me({ canvas: e, children: t }) {
159
+ return /* @__PURE__ */ u(re, { value: { canvas: e }, children: t });
162
160
  }
163
- function V(e, t = []) {
164
- const n = T(), [r, i] = L(() => e(n.getState(), n));
161
+ const O = () => {
162
+ const { vault: e } = T(ie);
163
+ if (e === null)
164
+ throw new Error("Vault not found. Ensure you have your provider set up correctly.");
165
+ return e;
166
+ };
167
+ function R(e, t = []) {
168
+ const n = O(), [r, i] = L(() => e(n.getState(), n));
165
169
  return N(() => n.subscribe(
166
170
  (o) => e(o, n),
167
171
  (o) => {
@@ -171,112 +175,117 @@ function V(e, t = []) {
171
175
  ), t), r;
172
176
  }
173
177
  const oe = B.createContext([]);
174
- function Te() {
175
- const e = R(oe);
176
- return V(
178
+ function Re() {
179
+ const e = T(oe);
180
+ return R(
177
181
  (t) => e.map((n) => t.iiif.entities.Canvas[n]).filter(Boolean),
178
182
  [e]
179
183
  );
180
184
  }
181
185
  function K(e = {}, t = []) {
182
186
  const { id: n, selector: r } = e, i = z();
183
- T();
184
- const o = n || i.manifest, a = V(
187
+ O();
188
+ const o = n || i.manifest, a = R(
185
189
  (s) => o ? s.iiif.entities.Manifest[o] : void 0,
186
190
  [o]
187
191
  );
188
- return y(() => {
192
+ return w(() => {
189
193
  if (a)
190
194
  return r ? r(a) : a;
191
195
  }, [a, r, ...t]);
192
196
  }
193
- function bt({ range: e, children: t }) {
194
- return /* @__PURE__ */ c(re, { value: { range: e }, children: t });
197
+ function Ct({ range: e, children: t }) {
198
+ return /* @__PURE__ */ u(re, { value: { range: e }, children: t });
195
199
  }
196
- function Re(e, t) {
200
+ function Ve(e, t) {
197
201
  var r;
198
202
  const n = [];
199
203
  for (const i of t.items)
200
- if (i.type === "SpecificResource" && ((r = i.source) == null ? void 0 : r.type) === "Canvas" && (i.source.id.indexOf("#") !== -1 ? n.push({ id: i.source.id.split("#")[0], type: "Canvas" }) : n.push(i.source)), i.type === "Range" && n.push(...Re(e, e.get(i))), i.type === "SpecificResource") {
204
+ if (i.type === "SpecificResource" && ((r = i.source) == null ? void 0 : r.type) === "Canvas" && (i.source.id.indexOf("#") !== -1 ? n.push({ id: i.source.id.split("#")[0], type: "Canvas" }) : n.push(i.source)), i.type === "Range" && n.push(...Ve(e, e.get(i))), i.type === "SpecificResource") {
201
205
  const o = typeof i.source == "string" ? i.source : i.source.id;
202
206
  n.push({ id: o, type: "Canvas" });
203
207
  }
204
208
  return n;
205
209
  }
206
- function Ct(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
207
- const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), u = t.type === "Manifest" ? t.items : Re(e, t);
210
+ function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
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);
208
212
  if (a)
209
- return [u, [u.map((m, g) => g)]];
213
+ return [c, [c.map((g, x) => x)]];
210
214
  if (s || !o || n)
211
- return [u, u.map((m, g) => [g])];
215
+ return [c, c.map((g, x) => [x])];
212
216
  const d = [];
213
217
  let l = [];
214
218
  const f = () => {
215
219
  l.length && (d.push([...l]), l = []);
216
220
  };
217
- let v = 0, p = !1;
218
- for (let m = 0; m < u.length; m++) {
219
- const g = e.get(u[m]);
220
- if (g.behavior.includes("non-paged")) {
221
- 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());
222
226
  continue;
223
227
  }
224
- if (m === v || g.behavior.includes("facing-pages")) {
225
- 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();
226
230
  continue;
227
231
  }
228
- if (l.push(m), p) {
232
+ if (l.push(g), p) {
229
233
  f(), p = !1;
230
234
  continue;
231
235
  }
232
236
  l.length > 1 && f();
233
237
  }
234
- return l.length && f(), [u, d];
238
+ return l.length && f(), [c, d];
235
239
  }
236
- function Et(e = {}, t = []) {
237
- const { id: n, selector: r } = e, i = z(), o = n || i.range, a = V((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
238
- return y(() => {
240
+ function It(e = {}, t = []) {
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 w(() => {
239
243
  if (a)
240
244
  return r ? r(a) : a;
241
245
  }, [a, r, ...t]);
242
246
  }
243
- function It({ startCanvas: e, disablePaging: t }) {
244
- var m;
245
- const n = T(), r = K(), i = Et(), [o, a] = L(void 0), s = i || r;
247
+ function Mt({ startCanvas: e, disablePaging: t }) {
248
+ var x;
249
+ const n = O(), r = K(), i = It(), [o, a] = L(void 0), s = i || r;
246
250
  if (!s)
247
251
  throw new Error("Nothing selected");
248
- const [u, d] = y(
249
- () => Ct(n, s, { disablePaging: t }),
250
- [n, s]
251
- ), l = P(
252
- (g) => {
253
- const w = d.findIndex((x) => x.includes(g));
254
- a(w === -1 ? 0 : w);
252
+ const [c, d] = w(
253
+ () => Et(n, s, { disablePaging: t }),
254
+ [n, s, t]
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);
255
264
  },
256
- [u, d]
257
- ), f = P(
258
- (g) => {
259
- const w = u.findIndex((x) => x.id === g);
260
- w !== -1 ? l(w) : a(0);
265
+ [c, d]
266
+ ), m = b(
267
+ (v) => {
268
+ const y = c.findIndex((C) => C.id === v);
269
+ y !== -1 ? f(y) : a(0);
261
270
  },
262
- [u, d]
263
- ), v = P(() => {
264
- a((g) => g >= d.length - 1 ? g : g + 1);
265
- }, [d]), p = P(() => {
266
- a((g) => g <= 0 ? 0 : g - 1);
271
+ [c, d]
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);
267
276
  }, [d]);
268
- return typeof o > "u" && (e ? f(e) : a(0)), {
269
- visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => u[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)) || [],
270
279
  cursor: o,
271
- items: u,
280
+ items: c,
272
281
  sequence: d,
273
282
  hasPrevious: o > 0,
274
283
  hasNext: o < d.length - 1,
275
284
  setSequenceIndex: a,
276
- setCanvasIndex: l,
277
- setCanvasId: f,
278
- next: v,
279
- previous: p
285
+ setCanvasIndex: f,
286
+ setCanvasId: m,
287
+ next: p,
288
+ previous: g
280
289
  };
281
290
  }
282
291
  const J = () => {
@@ -292,7 +301,7 @@ const J = () => {
292
301
  hasNext: !1,
293
302
  hasPrevious: !1
294
303
  });
295
- function Mt(e) {
304
+ function At(e) {
296
305
  const t = K(), {
297
306
  cursor: n,
298
307
  visibleItems: r,
@@ -300,20 +309,20 @@ function Mt(e) {
300
309
  sequence: o,
301
310
  items: a,
302
311
  setCanvasIndex: s,
303
- setCanvasId: u,
312
+ setCanvasId: c,
304
313
  previous: d,
305
314
  setSequenceIndex: l,
306
315
  hasNext: f,
307
- hasPrevious: v
308
- } = It({
316
+ hasPrevious: m
317
+ } = Mt({
309
318
  startCanvas: e.startCanvas,
310
319
  disablePaging: e.pagingEnabled === !1
311
- }), p = y(
320
+ }), p = w(
312
321
  () => ({
313
322
  sequence: o,
314
323
  items: a,
315
324
  // Extra functions.
316
- setCurrentCanvasId: u,
325
+ setCurrentCanvasId: c,
317
326
  nextCanvas: i,
318
327
  previousCanvas: d,
319
328
  totalCanvases: a.length,
@@ -321,36 +330,36 @@ function Mt(e) {
321
330
  setSequenceIndex: l,
322
331
  currentSequenceIndex: n,
323
332
  hasNext: f,
324
- hasPrevious: v
333
+ hasPrevious: m
325
334
  }),
326
- [o, a, u, i, d, a, s, l, n]
335
+ [o, a, c, i, d, a, s, l, n]
327
336
  );
328
- return t ? r.length === 0 ? null : /* @__PURE__ */ c(ae.Provider, { value: p, children: /* @__PURE__ */ c(oe.Provider, { value: r, children: /* @__PURE__ */ c(he, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ c("div", { children: "Sorry, something went wrong." }));
329
- }
330
- function At(e) {
331
- const t = St(e.manifest);
332
- if (!t)
333
- return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ c("div", { children: "Sorry, something went wrong." });
334
- if (t.error)
335
- return /* @__PURE__ */ c("div", { children: t.error.toString() });
336
- if (!t.isLoaded)
337
- return /* @__PURE__ */ c("div", { children: "Loading..." });
338
- const n = /* @__PURE__ */ c(Mt, { ...e, children: e.children });
339
- return /* @__PURE__ */ c(Pt, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ c(bt, { range: e.rangeId, children: n }) : n });
340
- }
341
- function Tt() {
342
- return R(ae);
337
+ return t ? r.length === 0 ? null : /* @__PURE__ */ u(ae.Provider, { value: p, children: /* @__PURE__ */ u(oe.Provider, { value: r, children: /* @__PURE__ */ u(me, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." }));
338
+ }
339
+ function Tt(e) {
340
+ const t = ge(e.vault), n = Pt(e.manifest);
341
+ if (!n)
342
+ return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." });
343
+ if (n.error)
344
+ return /* @__PURE__ */ u("div", { children: n.error.toString() });
345
+ if (!n.isLoaded)
346
+ return /* @__PURE__ */ u("div", { children: "Loading..." });
347
+ const r = /* @__PURE__ */ u(At, { ...e, children: e.children });
348
+ return /* @__PURE__ */ u(he, { vault: t, children: /* @__PURE__ */ u(bt, { manifest: n.id, children: e.rangeId ? /* @__PURE__ */ u(Ct, { range: e.rangeId, children: r }) : r }) });
343
349
  }
344
350
  function Rt() {
351
+ return T(ae);
352
+ }
353
+ function Vt() {
345
354
  return {
346
- VaultContext: R(ie),
347
- ResourceContext: R(fe),
348
- SimpleViewerReactContext: R(ae),
349
- VisibleCanvasReactContext: R(oe)
355
+ VaultContext: T(ie),
356
+ ResourceContext: T(fe),
357
+ SimpleViewerReactContext: T(ae),
358
+ VisibleCanvasReactContext: T(oe)
350
359
  };
351
360
  }
352
- function Vt(e) {
353
- return /* @__PURE__ */ c(Ae, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ c(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ c(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
361
+ function Ot(e) {
362
+ return /* @__PURE__ */ u(he, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ u(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ u(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
354
363
  }
355
364
  const U = function(e) {
356
365
  return function() {
@@ -361,28 +370,28 @@ const U = function(e) {
361
370
  ...r !== void 0 && { meta: r }
362
371
  });
363
372
  };
364
- }, Ot = "@iiif/IMPORT_ENTITIES", Lt = "@iiif/MODIFY_ENTITY_FIELD", kt = "@iiif/REORDER_ENTITY_FIELD", Nt = "@iiif/ADD_REFERENCE", Ft = "@iiif/UPDATE_REFERENCE", Ut = "@iiif/REMOVE_REFERENCE", Dt = "@iiif/ADD_METADATA", _t = "@iiif/REMOVE_METADATA", qt = "@iiif/UPDATE_METADATA", Bt = "@iiif/REORDER_METADATA", jt = U(Ot)(), Ht = U(Lt)(), $t = U(kt)(), Yt = U(Nt)(), zt = U(Ut)(), Kt = U(Ft)(), Wt = U(Dt)(), Gt = U(qt)(), Qt = U(_t)(), Jt = U(Bt)(), ue = {
365
- importEntities: jt,
366
- modifyEntityField: Ht,
367
- reorderEntityField: $t,
368
- addReference: Yt,
369
- removeReference: zt,
370
- updateReference: Kt,
371
- addMetadata: Wt,
372
- removeMetadata: Qt,
373
- updateMetadata: Gt,
374
- reorderMetadata: Jt
373
+ }, Lt = "@iiif/IMPORT_ENTITIES", kt = "@iiif/MODIFY_ENTITY_FIELD", Nt = "@iiif/REORDER_ENTITY_FIELD", Ft = "@iiif/ADD_REFERENCE", Ut = "@iiif/UPDATE_REFERENCE", Dt = "@iiif/REMOVE_REFERENCE", _t = "@iiif/ADD_METADATA", qt = "@iiif/REMOVE_METADATA", Bt = "@iiif/UPDATE_METADATA", jt = "@iiif/REORDER_METADATA", Ht = U(Lt)(), $t = U(kt)(), Yt = U(Nt)(), zt = U(Ft)(), Kt = U(Dt)(), Wt = U(Ut)(), Gt = U(_t)(), Qt = U(Bt)(), Jt = U(qt)(), Zt = U(jt)(), ue = {
374
+ importEntities: Ht,
375
+ modifyEntityField: $t,
376
+ reorderEntityField: Yt,
377
+ addReference: zt,
378
+ removeReference: Kt,
379
+ updateReference: Wt,
380
+ addMetadata: Gt,
381
+ removeMetadata: Jt,
382
+ updateMetadata: Qt,
383
+ reorderMetadata: Zt
375
384
  };
376
- function Zt() {
377
- const t = T().getStore();
378
- return y(() => (n) => t.dispatch(n), [t]);
385
+ function Xt() {
386
+ const t = O().getStore();
387
+ return w(() => (n) => t.dispatch(n), [t]);
379
388
  }
380
- function Pe(e) {
389
+ function Ce(e) {
381
390
  return typeof e != "string" && e && e.bindToVault;
382
391
  }
383
- function Xt() {
384
- const e = T(), t = q([]), n = Zt(), r = y(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
385
- Ce(() => {
392
+ function en() {
393
+ const e = O(), t = _([]), n = Xt(), r = w(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
394
+ Ie(() => {
386
395
  const s = {
387
396
  id: r,
388
397
  type: "AnnotationPage",
@@ -410,13 +419,13 @@ function Xt() {
410
419
  })
411
420
  );
412
421
  }, [r]);
413
- const i = V(
422
+ const i = R(
414
423
  (s) => r ? s.iiif.entities.AnnotationPage[r] : null,
415
424
  [r]
416
- ), o = P(
417
- (s, u) => {
425
+ ), o = b(
426
+ (s, c) => {
418
427
  if (r) {
419
- if (Pe(s)) {
428
+ if (Ce(s)) {
420
429
  const f = s;
421
430
  f.__vault || f.bindToVault(e), s = typeof f.source == "string" ? f.source : f.source.id, t.current[s] = f;
422
431
  } else
@@ -431,15 +440,15 @@ function Xt() {
431
440
  id: s,
432
441
  type: "Annotation"
433
442
  },
434
- index: u
443
+ index: c
435
444
  })
436
445
  ));
437
446
  }
438
447
  },
439
448
  [r]
440
- ), a = P(
449
+ ), a = b(
441
450
  (s) => {
442
- r && (Pe(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(
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(
443
452
  ue.removeReference({
444
453
  id: r,
445
454
  type: "AnnotationPage",
@@ -461,9 +470,9 @@ function Xt() {
461
470
  }
462
471
  ];
463
472
  }
464
- const Ve = F(null);
465
- function en() {
466
- const e = R(Ve);
473
+ const Oe = F(null);
474
+ function tn() {
475
+ const e = T(Oe);
467
476
  return [
468
477
  e.fullPage,
469
478
  {
@@ -472,109 +481,109 @@ function en() {
472
481
  }
473
482
  ];
474
483
  }
475
- function tn({ children: e }) {
476
- const [t, { addAnnotation: n, removeAnnotation: r }] = Xt();
477
- return /* @__PURE__ */ c(
478
- Ve.Provider,
484
+ function nn({ children: e }) {
485
+ const [t, { addAnnotation: n, removeAnnotation: r }] = en();
486
+ return /* @__PURE__ */ u(
487
+ Oe.Provider,
479
488
  {
480
- value: y(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
489
+ value: w(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
481
490
  children: e
482
491
  }
483
492
  );
484
493
  }
485
- function nn({
494
+ function rn({
486
495
  width: e,
487
496
  style: t,
488
497
  height: n,
489
498
  error: r,
490
499
  resetErrorBoundary: i
491
500
  }) {
492
- return /* @__PURE__ */ I("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
493
- /* @__PURE__ */ c("h3", { children: "Error occurred" }),
494
- /* @__PURE__ */ c("p", { children: r.message }),
495
- /* @__PURE__ */ c("button", { onClick: i, children: "Reset" })
501
+ return /* @__PURE__ */ M("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
502
+ /* @__PURE__ */ u("h3", { children: "Error occurred" }),
503
+ /* @__PURE__ */ u("p", { children: r.message }),
504
+ /* @__PURE__ */ u("button", { onClick: i, children: "Reset" })
496
505
  ] });
497
506
  }
498
- const ge = F(null);
499
- function rn() {
500
- return R(ge);
507
+ const ve = F(null);
508
+ function on() {
509
+ return T(ve);
501
510
  }
502
- const Oe = F(
511
+ const Le = F(
503
512
  () => {
504
513
  }
505
- ), Le = F(
514
+ ), ke = F(
506
515
  () => {
507
516
  }
508
517
  );
509
518
  function Y(e, t, n, r, i = []) {
510
- const o = R(e === "portal" ? Le : Oe);
519
+ const o = T(e === "portal" ? ke : Le);
511
520
  N(() => (e !== "none" && o(t, n, r), () => {
512
521
  o(t, null);
513
522
  }), [t, e, o, ...i]);
514
523
  }
515
524
  function j(e = {}, t = []) {
516
- const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = V((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
517
- return y(() => {
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]);
526
+ return w(() => {
518
527
  if (a)
519
528
  return r ? r(a) : a;
520
529
  }, [a, r, ...t]);
521
530
  }
522
- const ke = F(() => {
531
+ const Ne = F(() => {
523
532
  });
524
- function on(e) {
525
- const t = j(), n = R(ke);
533
+ function an(e) {
534
+ const t = j(), n = T(Ne);
526
535
  N(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
527
536
  }, [t, e]);
528
537
  }
529
- function an({
538
+ function sn({
530
539
  children: e,
531
540
  errorFallback: t,
532
541
  outerContainerProps: n = {},
533
542
  worldScale: r,
534
543
  ...i
535
544
  }) {
536
- const [o, a] = L(), s = Rt(), u = t || nn, [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) => {
537
- 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) => {
538
547
  if (A === -1) {
539
- const { [C]: h, ...D } = k;
548
+ const { [E]: h, ...D } = k;
540
549
  return D;
541
550
  }
542
- return { ...k, [C]: A };
551
+ return { ...k, [E]: A };
543
552
  });
544
- }, []), W = P((C, A, k) => {
545
- l(({ [C]: h, ...D }) => A ? {
553
+ }, []), W = b((E, A, k) => {
554
+ l(({ [E]: h, ...D }) => A ? {
546
555
  ...D,
547
- [C]: { element: A, props: k }
556
+ [E]: { element: A, props: k }
548
557
  } : D);
549
- }, []), Z = P((C, A, k) => {
550
- p(({ [C]: h, ...D }) => A ? {
558
+ }, []), Z = b((E, A, k) => {
559
+ p(({ [E]: h, ...D }) => A ? {
551
560
  ...D,
552
- [C]: { element: A, props: k }
561
+ [E]: { element: A, props: k }
553
562
  } : D);
554
563
  }, []);
555
- return /* @__PURE__ */ I(pt, { resetKeys: [], fallbackRender: (C) => /* @__PURE__ */ c(u, { ...i, ...C }), children: [
556
- /* @__PURE__ */ c(
557
- at,
564
+ return /* @__PURE__ */ M(yt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ u(c, { ...i, ...E }), children: [
565
+ /* @__PURE__ */ u(
566
+ st,
558
567
  {
559
568
  ...i,
560
569
  containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
561
- htmlChildren: /* @__PURE__ */ c($, { children: f.map(([C, { element: A, props: k }]) => /* @__PURE__ */ c(B.Fragment, { children: /* @__PURE__ */ c(A, { ...k || {} }) }, C)) }),
562
- onCreated: (C) => {
563
- 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);
564
573
  },
565
- runtimeOptions: M,
566
- children: /* @__PURE__ */ c(ge.Provider, { value: o, children: /* @__PURE__ */ c(ke.Provider, { value: b, children: /* @__PURE__ */ c(Oe.Provider, { value: W, children: /* @__PURE__ */ c(Le.Provider, { value: Z, children: /* @__PURE__ */ c(Vt, { bridge: s, children: /* @__PURE__ */ c(st.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ c(tn, { 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 }) }) }) }) }) }) })
567
576
  }
568
577
  ),
569
- /* @__PURE__ */ c("div", { children: m.map(([C, { element: A, props: k }]) => /* @__PURE__ */ c(B.Fragment, { children: /* @__PURE__ */ c(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)) })
570
579
  ] });
571
580
  }
572
- const X = {}, Ne = {
581
+ const X = {}, Fe = {
573
582
  get(e) {
574
583
  return e;
575
584
  },
576
585
  setMetaValue([e, t, n], r) {
577
- const i = Ne.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
586
+ const i = Fe.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
578
587
  X[e] = {
579
588
  ...X[e] || {},
580
589
  [t]: {
@@ -589,7 +598,7 @@ const X = {}, Ne = {
589
598
  return t ? n[t] : n;
590
599
  }
591
600
  };
592
- function sn(e = Ne) {
601
+ function un(e = Fe) {
593
602
  return {
594
603
  addEventListener(t, n, r, i) {
595
604
  if (t)
@@ -618,58 +627,58 @@ function sn(e = Ne) {
618
627
  if (i && r)
619
628
  for (const a of Object.keys(i))
620
629
  o[a] = (s) => {
621
- const u = e.get(r);
630
+ const c = e.get(r);
622
631
  for (const { callback: d, scope: l } of i[a] || [])
623
- (!l || n && l.indexOf(n) !== -1) && d(s, u);
632
+ (!l || n && l.indexOf(n) !== -1) && d(s, c);
624
633
  };
625
634
  return o;
626
635
  }
627
636
  };
628
637
  }
629
- function Fe(e, t) {
630
- const n = T(), r = y(() => sn(n), [n]), i = V(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
631
- return y(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
638
+ function Ue(e, 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]);
632
641
  }
633
642
  function ne(e, t) {
634
- const n = T(), r = y(() => Me(n), [n]);
635
- return V(() => {
643
+ const n = O(), r = w(() => Te(n), [n]);
644
+ return R(() => {
636
645
  if (!e)
637
646
  return null;
638
647
  const i = r.getAppliedStyles(e.id);
639
648
  return i ? t ? i[t] : i : void 0;
640
649
  }, [e, t]);
641
650
  }
642
- function Ue(e = {}, t = []) {
643
- const { id: n, selector: r } = e, i = z(), o = T(), a = n || i.annotation, s = V(
651
+ function De(e = {}, t = []) {
652
+ const { id: n, selector: r } = e, i = z(), o = O(), a = n || i.annotation, s = R(
644
653
  (d) => a ? d.iiif.entities.Annotation[a] : void 0,
645
654
  [a]
646
- ), u = V(
655
+ ), c = R(
647
656
  (d) => s && s.body ? s.body.map((l) => l ? l.type === "SpecificResource" ? {
648
657
  ...l,
649
658
  source: o.get(l)
650
659
  } : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
651
660
  [s]
652
661
  );
653
- return y(() => {
662
+ return w(() => {
654
663
  if (!s)
655
664
  return;
656
665
  const d = {
657
666
  ...s,
658
- body: u,
667
+ body: c,
659
668
  target: le(s.target, { typeMap: o.getState().iiif.mapping })
660
669
  };
661
670
  return r ? r(d) : d;
662
- }, [s, r, u, ...t]);
671
+ }, [s, r, c, ...t]);
663
672
  }
664
- const De = ({
673
+ const _e = ({
665
674
  id: e,
666
675
  style: t,
667
676
  className: n,
668
677
  interactive: r
669
678
  }) => {
670
- const i = Ue({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Fe(i, ["atlas"]), u = j(), d = y(() => ut(t, o), [t, o]);
671
- return u && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === u.id || i.target.source === u.id) ? /* @__PURE__ */ c(
672
- ct,
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]);
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(
681
+ lt,
673
682
  {
674
683
  id: i.id,
675
684
  isEditing: !0,
@@ -686,12 +695,12 @@ const De = ({
686
695
  }
687
696
  ) : null;
688
697
  };
689
- function un(e = {}, t = []) {
690
- const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a = V(
698
+ function cn(e = {}, t = []) {
699
+ const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a = R(
691
700
  (s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
692
701
  [o]
693
702
  );
694
- return y(() => {
703
+ return w(() => {
695
704
  if (a)
696
705
  return r ? r(a) : a;
697
706
  }, [a, ...t]);
@@ -701,9 +710,9 @@ const de = ({
701
710
  page: t
702
711
  }) => {
703
712
  var o;
704
- const n = un({ id: t.id }) || t, r = ne(n, "atlas"), i = ne(n, "html");
705
- return V((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ c(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ c(
706
- De,
713
+ const n = cn({ id: t.id }) || t, r = ne(n, "atlas"), i = ne(n, "html");
714
+ return R((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ u(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ u(
715
+ _e,
707
716
  {
708
717
  id: a.id,
709
718
  style: r,
@@ -712,7 +721,7 @@ const de = ({
712
721
  a.id
713
722
  )) });
714
723
  };
715
- function _e({
724
+ function qe({
716
725
  id: e,
717
726
  image: t,
718
727
  thumbnail: n,
@@ -721,25 +730,25 @@ function _e({
721
730
  y: o = 0,
722
731
  children: a,
723
732
  selector: s,
724
- onClick: u,
733
+ onClick: c,
725
734
  enableSizes: d
726
735
  }) {
727
- var f, v;
728
- const l = y(() => {
736
+ var f, m;
737
+ const l = w(() => {
729
738
  if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
730
739
  return s.spatial;
731
740
  }, [s]);
732
- return /* @__PURE__ */ c(
741
+ return /* @__PURE__ */ u(
733
742
  "world-object",
734
743
  {
735
744
  x: i + t.target.spatial.x,
736
745
  y: o + t.target.spatial.y,
737
746
  width: t.target.spatial.width,
738
747
  height: t.target.spatial.height,
739
- onClick: u,
740
- children: t.service ? /* @__PURE__ */ I(te, { children: [
741
- /* @__PURE__ */ c(
742
- lt,
748
+ onClick: c,
749
+ children: t.service ? /* @__PURE__ */ M(te, { children: [
750
+ /* @__PURE__ */ u(
751
+ dt,
743
752
  {
744
753
  tiles: {
745
754
  id: t.service.id || t.service["@id"] || "unknown",
@@ -752,16 +761,16 @@ function _e({
752
761
  x: 0,
753
762
  y: 0,
754
763
  width: (f = t.target) == null ? void 0 : f.spatial.width,
755
- height: (v = t.target) == null ? void 0 : v.spatial.height,
764
+ height: (m = t.target) == null ? void 0 : m.spatial.height,
756
765
  crop: l
757
766
  }
758
767
  ),
759
768
  a
760
- ] }, "service") : /* @__PURE__ */ I(te, { children: [
761
- /* @__PURE__ */ c(
769
+ ] }, "service") : /* @__PURE__ */ M(te, { children: [
770
+ /* @__PURE__ */ u(
762
771
  "world-image",
763
772
  {
764
- onClick: u,
773
+ onClick: c,
765
774
  uri: t.id,
766
775
  target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
767
776
  display: t.width && t.height ? {
@@ -777,8 +786,8 @@ function _e({
777
786
  e + (t.service ? "server" : "no-service")
778
787
  );
779
788
  }
780
- function qe(e, t) {
781
- const { selector: n, source: r } = ft(t);
789
+ function Be(e, t) {
790
+ const { selector: n, source: r } = ht(t);
782
791
  if (r.id !== e.id)
783
792
  return [null, r];
784
793
  const i = {
@@ -799,17 +808,17 @@ function qe(e, t) {
799
808
  r
800
809
  ];
801
810
  }
802
- const cn = {
811
+ const ln = {
803
812
  makeChoice: () => {
804
813
  }
805
- }, ce = { type: "unknown" }, E = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), ln = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
806
- function dn(e, t) {
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: [] });
815
+ function fn(e, t) {
807
816
  var r;
808
817
  const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
809
818
  return n ? n.annotationPageManager : null;
810
819
  }
811
- function fn(e, t) {
812
- return V(
820
+ function hn(e, t) {
821
+ return R(
813
822
  (n) => {
814
823
  const r = [];
815
824
  if (!e)
@@ -817,7 +826,7 @@ function fn(e, t) {
817
826
  const i = Object.keys(n.iiif.entities.AnnotationPage);
818
827
  for (const o of i)
819
828
  if (!t || t.indexOf(o) !== -1) {
820
- const a = dn(n, o);
829
+ const a = fn(n, o);
821
830
  a && a.views && a.views[e] && r.push(o);
822
831
  }
823
832
  return r;
@@ -825,7 +834,7 @@ function fn(e, t) {
825
834
  [e, t]
826
835
  );
827
836
  }
828
- function hn({
837
+ function gn({
829
838
  canvas: e,
830
839
  manifest: t,
831
840
  all: n,
@@ -845,18 +854,18 @@ function hn({
845
854
  i.indexOf(o.id) === -1 && i.push(o.id);
846
855
  return i;
847
856
  }
848
- function gn(e, t) {
857
+ function mn(e, t) {
849
858
  var r;
850
859
  const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
851
860
  return n ? n.annotationPageManager : null;
852
861
  }
853
- function mn(e, t = {}) {
854
- const n = T(), r = K(), i = j(), o = Te(), a = y(() => hn({
862
+ function vn(e, t = {}) {
863
+ const n = O(), r = K(), i = j(), o = Re(), a = w(() => gn({
855
864
  all: t.all,
856
865
  manifest: r,
857
866
  canvas: i,
858
867
  canvases: o
859
- }), [t.all, i, o, r]), s = fn(e, t.all ? void 0 : a), u = P(
868
+ }), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = b(
860
869
  (l) => {
861
870
  e && n.setMetaValue(
862
871
  [l, "annotationPageManager", "views"],
@@ -867,68 +876,68 @@ function mn(e, t = {}) {
867
876
  );
868
877
  },
869
878
  [e, n]
870
- ), d = P(
879
+ ), d = b(
871
880
  (l, f = {}) => {
872
881
  if (!e)
873
882
  return;
874
- const v = n.getState(), p = [];
883
+ const m = n.getState(), p = [];
875
884
  if (f != null && f.deselectOthers) {
876
- const m = Object.keys(v.iiif.entities.AnnotationPage);
877
- for (const g of m) {
878
- const w = gn(v, g);
879
- 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);
880
889
  }
881
890
  }
882
- for (const m of p)
883
- u(m);
891
+ for (const g of p)
892
+ c(g);
884
893
  n.setMetaValue(
885
894
  [l, "annotationPageManager", "views"],
886
- (m) => m && m[e] ? m : {
887
- ...m || {},
895
+ (g) => g && g[e] ? g : {
896
+ ...g || {},
888
897
  [e]: !0
889
898
  }
890
899
  );
891
900
  },
892
- [e, u, n]
901
+ [e, c, n]
893
902
  );
894
903
  return {
895
904
  availablePageIds: a,
896
905
  enabledPageIds: s,
897
906
  setPageEnabled: d,
898
- setPageDisabled: u
907
+ setPageDisabled: c
899
908
  };
900
909
  }
901
- function vn(e, t) {
902
- return V((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
910
+ function pn(e, t) {
911
+ return R((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
903
912
  }
904
- const pn = B.createContext(new ht());
905
- function Be() {
906
- return R(pn);
913
+ const yn = B.createContext(new gt());
914
+ function je() {
915
+ return T(yn);
907
916
  }
908
- function yn() {
909
- const e = Be(), [t, n] = L({}), r = q(!1);
917
+ function xn() {
918
+ const e = je(), [t, n] = L({}), r = _(!1);
910
919
  return N(() => () => {
911
920
  r.current = !0;
912
- }, []), [P(
921
+ }, []), [b(
913
922
  (o, { height: a, width: s }) => {
914
923
  if (o) {
915
- const u = o.id || o["@id"], d = e.loadServiceSync({
916
- id: u,
924
+ const c = o.id || o["@id"], d = e.loadServiceSync({
925
+ id: c,
917
926
  width: o.width || s,
918
927
  height: o.height || a,
919
928
  source: o
920
929
  });
921
- d ? o = d : t[u] || (r.current || n((l) => ({
930
+ d ? o = d : t[c] || (r.current || n((l) => ({
922
931
  ...l,
923
- [u]: "loading"
932
+ [c]: "loading"
924
933
  })), e.loadService({
925
- id: u,
934
+ id: c,
926
935
  width: o.width || s,
927
936
  height: o.height || a
928
937
  }).then(() => {
929
938
  r.current || n((l) => ({
930
939
  ...l,
931
- [u]: "done"
940
+ [c]: "done"
932
941
  }));
933
942
  }));
934
943
  }
@@ -937,9 +946,9 @@ function yn() {
937
946
  [e, t]
938
947
  ), t];
939
948
  }
940
- function xn(e = {}) {
941
- const t = Ue(), n = j(e.canvasId ? { id: e.canvasId } : void 0);
942
- return V(
949
+ function wn(e = {}) {
950
+ const t = De(), n = j(e.canvasId ? { id: e.canvasId } : void 0);
951
+ return R(
943
952
  (r, i) => {
944
953
  if (!n)
945
954
  return [];
@@ -953,15 +962,15 @@ function xn(e = {}) {
953
962
  [n]
954
963
  );
955
964
  }
956
- function wn(e) {
965
+ function Sn(e) {
957
966
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
958
967
  }
959
- const ee = {}, je = {
968
+ const ee = {}, He = {
960
969
  get(e) {
961
970
  return e;
962
971
  },
963
972
  setMetaValue([e, t, n], r) {
964
- const i = je.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
973
+ const i = He.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
965
974
  ee[e] = {
966
975
  ...ee[e] || {},
967
976
  [t]: {
@@ -976,52 +985,52 @@ const ee = {}, je = {
976
985
  return t ? n[t] : n;
977
986
  }
978
987
  };
979
- function Sn(e = je) {
988
+ function Pn(e = He) {
980
989
  function t(i) {
981
990
  const o = i ? typeof i == "string" ? e.get(i) : i : null;
982
991
  if (!o)
983
992
  return [];
984
993
  const a = e.get(o.items, { parent: o }), s = [];
985
- for (const u of a)
986
- s.push(...e.get(u.items, { parent: u }));
994
+ for (const c of a)
995
+ s.push(...e.get(c.items, { parent: c }));
987
996
  return s;
988
997
  }
989
998
  function n(i, o = []) {
990
999
  const a = Array.isArray(i) ? i : t(i), s = [];
991
- let u = null;
1000
+ let c = null;
992
1001
  const d = [];
993
1002
  for (const l of a) {
994
1003
  if (l.type !== "Annotation")
995
1004
  throw new Error("getPaintables() accept either a canvas or list of annotations");
996
1005
  const f = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
997
- for (const v of f) {
998
- const [p, { selector: m }] = wn(v), g = e.get(p), w = (g.type || "unknown").toLowerCase();
999
- if (w === "choice") {
1000
- 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]];
1001
- M.length === 0 && M.push(x[0]), u = {
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 = {
1002
1011
  type: "single-choice",
1003
- items: x.map((b) => ({
1004
- id: b.id,
1005
- label: b.label,
1006
- selected: M.indexOf(b) !== -1
1012
+ items: y.map((S) => ({
1013
+ id: S.id,
1014
+ label: S.label,
1015
+ selected: C.indexOf(S) !== -1
1007
1016
  })),
1008
1017
  label: p.label
1009
- }, f.push(...M);
1018
+ }, f.push(...C);
1010
1019
  continue;
1011
1020
  }
1012
- s.indexOf(w) === -1 && s.push(w), d.push({
1013
- type: w,
1021
+ s.indexOf(v) === -1 && s.push(v), d.push({
1022
+ type: v,
1014
1023
  annotationId: l.id,
1015
- resource: g,
1024
+ resource: x,
1016
1025
  target: l.target,
1017
- selector: m
1026
+ selector: g
1018
1027
  });
1019
1028
  }
1020
1029
  }
1021
1030
  return {
1022
1031
  types: s,
1023
1032
  items: d,
1024
- choice: u
1033
+ choice: c
1025
1034
  };
1026
1035
  }
1027
1036
  function r(i) {
@@ -1034,30 +1043,30 @@ function Sn(e = je) {
1034
1043
  extractChoices: r
1035
1044
  };
1036
1045
  }
1037
- function Pn(e, t = []) {
1038
- const n = T(), r = y(() => Sn(n), []), i = xn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = y(
1046
+ function bn(e, t = []) {
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(
1039
1048
  () => r.getPaintables(i, o),
1040
1049
  [n, i, o, ...t]
1041
- ), d = { makeChoice: P(
1042
- (l, { deselectOthers: f = !0, deselect: v = !1 } = {}) => {
1050
+ ), d = { makeChoice: b(
1051
+ (l, { deselectOthers: f = !0, deselect: m = !1 } = {}) => {
1043
1052
  if (s.choice) {
1044
1053
  if (s.choice.type !== "single-choice")
1045
1054
  throw new Error("Complex choice not supported yet");
1046
1055
  a((p) => {
1047
- if (v) {
1048
- const g = p.filter((w) => w !== l);
1049
- if (g.length === 0) {
1050
- const w = s.items[0].resource.id;
1051
- 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] : [];
1052
1061
  }
1053
- return g;
1062
+ return x;
1054
1063
  }
1055
1064
  if (f)
1056
1065
  return [l];
1057
- const m = [...p];
1058
- if (m.length === 0 && s.items.length) {
1059
- const g = s.items[0].resource.id;
1060
- 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);
1061
1070
  }
1062
1071
  return p.indexOf(l) !== -1 ? p : [...p, l];
1063
1072
  });
@@ -1067,20 +1076,20 @@ function Pn(e, t = []) {
1067
1076
  ) };
1068
1077
  return [s, d];
1069
1078
  }
1070
- const bn = ["model/gltf-binary"];
1071
- function Cn(e, t) {
1079
+ const Cn = ["model/gltf-binary"];
1080
+ function En(e, t) {
1072
1081
  const r = t.items[0].resource;
1073
- return r.format ? bn.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`) : {
1074
1083
  type: "3d-model",
1075
1084
  model: r
1076
- } : E("Unknown format");
1085
+ } : I("Unknown format");
1077
1086
  }
1078
- function En(e, t) {
1087
+ function In(e, t) {
1079
1088
  var r;
1080
1089
  if (!e.duration)
1081
- return E("No duration on canvas");
1090
+ return I("No duration on canvas");
1082
1091
  if (t.items.length > 1)
1083
- return E("Only one audio source supported");
1092
+ return I("Only one audio source supported");
1084
1093
  const n = (r = t.items[0]) == null ? void 0 : r.resource;
1085
1094
  return n ? n.format ? {
1086
1095
  type: "media",
@@ -1108,17 +1117,17 @@ function En(e, t) {
1108
1117
  annotations: {
1109
1118
  pages: []
1110
1119
  }
1111
- } : E("Audio does not have format") : E("Unknown audio");
1120
+ } : I("Audio does not have format") : I("Unknown audio");
1112
1121
  }
1113
- function In(e, t, n) {
1122
+ function Mn(e, t, n) {
1114
1123
  const r = [];
1115
1124
  for (const i of t.items) {
1116
1125
  const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
1117
1126
  if (!o.id)
1118
- return E("No resource Identifier");
1127
+ return I("No resource Identifier");
1119
1128
  let a;
1120
1129
  if (o.service) {
1121
- const p = gt(o);
1130
+ const p = mt(o);
1122
1131
  p[0] && (a = n(p[0], e));
1123
1132
  }
1124
1133
  const s = {
@@ -1129,7 +1138,7 @@ function In(e, t, n) {
1129
1138
  width: Number(e.width),
1130
1139
  height: Number(e.height)
1131
1140
  }
1132
- }, [u, d] = qe(e, i.target);
1141
+ }, [c, d] = Be(e, i.target);
1133
1142
  if (!(d.id === e.id || decodeURIComponent(d.id || "") === (e.id || "")))
1134
1143
  continue;
1135
1144
  i.resource.width && i.resource.height && (i.resource.width, i.resource.height);
@@ -1152,18 +1161,18 @@ function In(e, t, n) {
1152
1161
  }
1153
1162
  } : void 0;
1154
1163
  a && !a.id && (a.id = a["@id"]);
1155
- const v = {
1164
+ const m = {
1156
1165
  id: o.id,
1157
1166
  type: "Image",
1158
1167
  annotationId: i.annotationId,
1159
- width: Number(u || f ? o.width : e.width),
1160
- height: Number(u || f ? o.height : e.height),
1168
+ width: Number(c || f ? o.width : e.width),
1169
+ height: Number(c || f ? o.height : e.height),
1161
1170
  service: a,
1162
1171
  sizes: a && a.sizes ? a.sizes : o.width && o.height ? [{ width: o.width, height: o.height }] : [],
1163
- target: u && u.type !== "PointSelector" ? u : s,
1172
+ target: c && c.type !== "PointSelector" ? c : s,
1164
1173
  selector: f
1165
1174
  };
1166
- r.push(v);
1175
+ r.push(m);
1167
1176
  }
1168
1177
  return {
1169
1178
  type: "images",
@@ -1172,7 +1181,7 @@ function In(e, t, n) {
1172
1181
  choice: t.choice
1173
1182
  };
1174
1183
  }
1175
- function He(e, t = {}, n) {
1184
+ function $e(e, t = {}, n) {
1176
1185
  const r = e.language || n || "none";
1177
1186
  switch (e.type) {
1178
1187
  case "TextualBody": {
@@ -1182,38 +1191,38 @@ function He(e, t = {}, n) {
1182
1191
  case "List":
1183
1192
  case "Composite":
1184
1193
  case "Choice":
1185
- e.items && e.items.forEach((i) => He(i, t, r));
1194
+ e.items && e.items.forEach((i) => $e(i, t, r));
1186
1195
  }
1187
1196
  return t;
1188
1197
  }
1189
- function Mn(e, t) {
1198
+ function An(e, t) {
1190
1199
  const n = [];
1191
1200
  return t.items.forEach((r) => {
1192
1201
  if (r.resource) {
1193
- const [i] = qe(e, r.target);
1194
- n.push({ annotationId: r.annotationId, text: He(r.resource), target: i });
1202
+ const [i] = Be(e, r.target);
1203
+ n.push({ annotationId: r.annotationId, text: $e(r.resource), target: i });
1195
1204
  }
1196
1205
  }), {
1197
1206
  type: "textual-content",
1198
1207
  items: n
1199
1208
  };
1200
1209
  }
1201
- const An = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1202
- function Tn(e, t) {
1210
+ const Tn = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1211
+ function Rn(e, t) {
1203
1212
  var s;
1204
- const n = t.items.filter((u) => u.type === "video");
1213
+ const n = t.items.filter((c) => c.type === "video");
1205
1214
  let r = !1;
1206
1215
  if (e.duration || (r = !0), n.length > 1)
1207
- return E("Only one video source supported");
1216
+ return I("Only one video source supported");
1208
1217
  const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1209
- (u) => (u.profile || "").includes("youtube.com")
1218
+ (c) => (c.profile || "").includes("youtube.com")
1210
1219
  );
1211
1220
  if (!o && r)
1212
- return E("Video does not have duration");
1221
+ return I("Video does not have duration");
1213
1222
  if (!i)
1214
- return E("Unknown video");
1223
+ return I("Unknown video");
1215
1224
  if ((!i.format || i.format === "text/html") && !o)
1216
- return E("Video does not have format");
1225
+ return I("Video does not have format");
1217
1226
  const a = {
1218
1227
  annotationId: t.items[0].annotationId,
1219
1228
  duration: e.duration,
@@ -1238,10 +1247,10 @@ function Tn(e, t) {
1238
1247
  };
1239
1248
  if (o) {
1240
1249
  a.type = "VideoYouTube";
1241
- const u = i.id.match(An);
1242
- if (!u[1])
1243
- return E("Video is not known youtube video");
1244
- a.youTubeId = u[1];
1250
+ const c = i.id.match(Tn);
1251
+ if (!c[1])
1252
+ return I("Video is not known youtube video");
1253
+ a.youTubeId = c[1];
1245
1254
  }
1246
1255
  return {
1247
1256
  type: "media",
@@ -1251,30 +1260,30 @@ function Tn(e, t) {
1251
1260
  }
1252
1261
  };
1253
1262
  }
1254
- function Rn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1263
+ function Vn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1255
1264
  if (!e)
1256
1265
  return console.log("No canvas"), ce;
1257
1266
  if (t.types.length === 0)
1258
- return n.indexOf("empty") !== -1 ? ln(e.width, e.height) : (console.log("No paintables"), ce);
1267
+ return n.indexOf("empty") !== -1 ? dn(e.width, e.height) : (console.log("No paintables"), ce);
1259
1268
  if (t.types.length !== 1)
1260
1269
  if (t.types.length === 2 && t.types.indexOf("text") !== -1)
1261
1270
  t.types = t.types.filter((o) => o !== "text");
1262
1271
  else
1263
- 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");
1264
1273
  const i = t.types[0];
1265
- return i === "image" ? n.indexOf("images") === -1 ? E("Image not supported") : In(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? E("3D not supported") : Cn(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? E("Textual content not supported") : Mn(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? E("Media not supported") : En(e, t) : i === "video" ? n.indexOf("media") === -1 ? E("Media not supported") : Tn(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;
1266
1275
  }
1267
- function Vn(e) {
1268
- const t = K(), n = j(), r = T(), [i, o] = yn(), { enabledPageIds: a } = mn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1276
+ function On(e) {
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), {
1269
1278
  all: !1
1270
- }), s = vn(a, "AnnotationPage"), u = (e == null ? void 0 : e.strategies) || [
1279
+ }), s = pn(a, "AnnotationPage"), c = (e == null ? void 0 : e.strategies) || [
1271
1280
  "empty",
1272
1281
  "images",
1273
1282
  "media",
1274
1283
  "textual-content",
1275
1284
  "complex-timeline"
1276
- ], [d, l] = Pn(e, [o]), f = y(() => Rn({ canvas: n, paintables: d, supports: u, loadImageService: i }), [n, d, r, l.makeChoice]);
1277
- return y(() => f.type === "unknown" ? [f, cn] : [
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] : [
1278
1287
  {
1279
1288
  ...f,
1280
1289
  annotations: { pages: s }
@@ -1282,31 +1291,31 @@ function Vn(e) {
1282
1291
  l
1283
1292
  ], [f, s]);
1284
1293
  }
1285
- const On = (e, t = []) => {
1286
- const n = T();
1294
+ const Ln = (e, t = []) => {
1295
+ const n = O();
1287
1296
  N(() => {
1288
1297
  e(n);
1289
1298
  }, [n, ...t]);
1290
1299
  };
1291
- function Ln(e, t, { canvasId: n, manifestId: r } = {}) {
1292
- const i = T(), o = Be(), a = y(() => mt(i, { imageServiceLoader: o }), [i, o]), [s, u] = L(), d = K(r ? { id: r } : void 0), l = j(n ? { id: n } : void 0), f = l || d, v = q(!1);
1293
- if (N(() => (v.current = !1, () => {
1294
- v.current = !0;
1300
+ function kn(e, t, { canvasId: n, manifestId: r } = {}) {
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;
1295
1304
  }), []), !f)
1296
1305
  throw new Error("Must be called under a manifest or canvas context.");
1297
- return On(
1306
+ return Ln(
1298
1307
  (p) => {
1299
- a.getBestThumbnailAtSize(f, e, t).then((m) => {
1300
- m.best && !v.current && u(m.best);
1308
+ a.getBestThumbnailAtSize(f, e, t).then((g) => {
1309
+ g.best && !m.current && c(g.best);
1301
1310
  });
1302
1311
  },
1303
1312
  [f]
1304
1313
  ), s;
1305
1314
  }
1306
- function kn(e) {
1315
+ function Nn(e) {
1307
1316
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
1308
1317
  }
1309
- function Nn(e, t) {
1318
+ function Fn(e, t) {
1310
1319
  switch (t.type) {
1311
1320
  case "FINISHED":
1312
1321
  return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -1329,62 +1338,62 @@ function Nn(e, t) {
1329
1338
  }
1330
1339
  return e;
1331
1340
  }
1332
- function Fn(e) {
1341
+ function Un(e) {
1333
1342
  const t = Math.round(e);
1334
1343
  return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
1335
1344
  }
1336
- function me(e) {
1337
- const [t, n] = it(Nn, kn(e.duration)), r = q(null), i = q(null), o = q(null), a = q(!1), s = P(() => {
1338
- i.current && r.current && (i.current.innerHTML = Fn(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" })));
1339
- }, [e.duration]), u = P(() => {
1345
+ function pe(e) {
1346
+ const [t, n] = ot(Fn, Nn(e.duration)), r = _(null), i = _(null), o = _(null), a = _(!1), s = b(() => {
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" })));
1348
+ }, [e.duration]), c = b(() => {
1340
1349
  r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
1341
1350
  n({ type: "PLAY" });
1342
1351
  }), s());
1343
- }, [s]), d = P(() => {
1344
- r.current && (r.current.duration > 0 && r.current.paused ? u() : l());
1345
- }, [s]), l = P(() => {
1352
+ }, [s]), d = b(() => {
1353
+ r.current && (r.current.duration > 0 && r.current.paused ? c() : l());
1354
+ }, [s]), l = b(() => {
1346
1355
  r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
1347
- }, [s]), f = P(() => {
1356
+ }, [s]), f = b(() => {
1348
1357
  r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1349
- }, []), v = P(() => {
1358
+ }, []), m = b(() => {
1350
1359
  r.current && (r.current.muted = !0, n({ type: "MUTE" }));
1351
- }, []), p = P(() => {
1360
+ }, []), p = b(() => {
1352
1361
  r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
1353
- }, []), m = P((x) => {
1354
- r.current && (r.current.muted = !1, r.current.volume = x / 100, n({ type: "SET_VOLUME", volume: x }));
1355
- }, []), g = P((x) => {
1356
- r.current && (r.current.currentTime = Math.max(0, Math.min(x * e.duration, e.duration)), s());
1357
- }, []), w = P((x) => {
1358
- 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());
1359
1368
  }, []);
1360
1369
  return N(() => {
1361
- const x = setInterval(() => {
1370
+ const y = setInterval(() => {
1362
1371
  s();
1363
1372
  }, 350);
1364
- return () => clearInterval(x);
1373
+ return () => clearInterval(y);
1365
1374
  }, [s, e.duration]), N(() => {
1366
- const x = () => {
1375
+ const y = () => {
1367
1376
  n({ type: "FINISHED" });
1368
- }, M = r.current;
1369
- 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);
1370
1379
  }, []), [
1371
1380
  { element: r, currentTime: i, progress: o },
1372
1381
  t,
1373
1382
  {
1374
- play: u,
1383
+ play: c,
1375
1384
  pause: l,
1376
1385
  playPause: d,
1377
- mute: v,
1386
+ mute: m,
1378
1387
  unmute: p,
1379
1388
  toggleMute: f,
1380
- setVolume: m,
1381
- setDurationPercent: g,
1382
- setTime: w
1389
+ setVolume: g,
1390
+ setDurationPercent: x,
1391
+ setTime: v
1383
1392
  }
1384
1393
  ];
1385
1394
  }
1386
- const Un = F(null), Dn = F(null), _n = F(null);
1387
- function $e({
1395
+ const Dn = F(null), _n = F(null), qn = F(null);
1396
+ function Ye({
1388
1397
  actions: e,
1389
1398
  state: t,
1390
1399
  children: n,
@@ -1392,12 +1401,12 @@ function $e({
1392
1401
  progress: i,
1393
1402
  element: o
1394
1403
  }) {
1395
- return /* @__PURE__ */ c(_n.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ c(Dn.Provider, { value: e, children: /* @__PURE__ */ c(Un.Provider, { value: t, children: n }) }) });
1404
+ return /* @__PURE__ */ u(qn.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ u(_n.Provider, { value: e, children: /* @__PURE__ */ u(Dn.Provider, { value: t, children: n }) }) });
1396
1405
  }
1397
- function Ye({ media: e, children: t }) {
1398
- const [{ element: n, currentTime: r, progress: i }, o, a] = me({ duration: e.duration });
1399
- return /* @__PURE__ */ I(
1400
- $e,
1406
+ function ze({ media: e, children: t }) {
1407
+ const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
1408
+ return /* @__PURE__ */ M(
1409
+ Ye,
1401
1410
  {
1402
1411
  state: o,
1403
1412
  actions: a,
@@ -1405,26 +1414,26 @@ function Ye({ media: e, children: t }) {
1405
1414
  progress: i,
1406
1415
  element: n,
1407
1416
  children: [
1408
- /* @__PURE__ */ c("audio", { ref: n, src: e.url }),
1417
+ /* @__PURE__ */ u("audio", { ref: n, src: e.url }),
1409
1418
  t
1410
1419
  ]
1411
1420
  }
1412
1421
  );
1413
1422
  }
1414
- function ze({
1423
+ function Ke({
1415
1424
  media: e,
1416
1425
  mediaControlsDeps: t,
1417
1426
  children: n
1418
1427
  }) {
1419
- return Y("portal", "audio", Ye, { media: e, children: n }, [e, ...t || []]), null;
1428
+ return Y("portal", "audio", ze, { media: e, children: n }, [e, ...t || []]), null;
1420
1429
  }
1421
- function Ke({
1430
+ function We({
1422
1431
  element: e,
1423
1432
  media: t,
1424
1433
  playPause: n
1425
1434
  }) {
1426
- return /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1427
- /* @__PURE__ */ c("style", { children: `
1435
+ return /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1436
+ /* @__PURE__ */ u("style", { children: `
1428
1437
  .video-container {
1429
1438
  position: absolute;
1430
1439
  top: 0;
@@ -1438,23 +1447,23 @@ function Ke({
1438
1447
  pointer-events: visible;
1439
1448
  }
1440
1449
  ` }),
1441
- /* @__PURE__ */ c("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1450
+ /* @__PURE__ */ u("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1442
1451
  ] });
1443
1452
  }
1444
- function We({
1453
+ function Ge({
1445
1454
  media: e,
1446
1455
  mediaControlsDeps: t,
1447
1456
  children: n
1448
1457
  }) {
1449
- const [{ element: r, currentTime: i, progress: o }, a, s] = me({ duration: e.duration });
1450
- return Y("overlay", "video-element", Ke, {
1458
+ const [{ element: r, currentTime: i, progress: o }, a, s] = pe({ duration: e.duration });
1459
+ return Y("overlay", "video-element", We, {
1451
1460
  element: r,
1452
1461
  media: e,
1453
1462
  playPause: s.playPause
1454
1463
  }), Y(
1455
1464
  "portal",
1456
1465
  "custom-controls",
1457
- $e,
1466
+ Ye,
1458
1467
  {
1459
1468
  state: a,
1460
1469
  actions: s,
@@ -1466,9 +1475,9 @@ function We({
1466
1475
  [i, a, e, ...t || []]
1467
1476
  ), null;
1468
1477
  }
1469
- function Ge({ model: e }) {
1470
- return /* @__PURE__ */ I($, { children: [
1471
- /* @__PURE__ */ c("style", { children: `
1478
+ function Qe({ model: e }) {
1479
+ return /* @__PURE__ */ M($, { children: [
1480
+ /* @__PURE__ */ u("style", { children: `
1472
1481
  .model-container {
1473
1482
  position: absolute;
1474
1483
  top: 0;
@@ -1482,7 +1491,7 @@ function Ge({ model: e }) {
1482
1491
  pointer-events: visible;
1483
1492
  }
1484
1493
  ` }),
1485
- /* @__PURE__ */ c("div", { className: "model-container", children: /* @__PURE__ */ c(
1494
+ /* @__PURE__ */ u("div", { className: "model-container", children: /* @__PURE__ */ u(
1486
1495
  "model-viewer",
1487
1496
  {
1488
1497
  "interaction-prompt": "none",
@@ -1494,12 +1503,12 @@ function Ge({ model: e }) {
1494
1503
  ) })
1495
1504
  ] });
1496
1505
  }
1497
- function Qe({ model: e, name: t }) {
1498
- return Y("overlay", `model-${t}`, Ge, { model: e }, [e]), null;
1506
+ function Je({ model: e, name: t }) {
1507
+ return Y("overlay", `model-${t}`, Qe, { model: e }, [e]), null;
1499
1508
  }
1500
- function Je({ style: e }) {
1509
+ function Ze({ style: e }) {
1501
1510
  const t = j();
1502
- return !t || !t.height || !t.width ? null : /* @__PURE__ */ c(
1511
+ return !t || !t.height || !t.width ? null : /* @__PURE__ */ u(
1503
1512
  "box",
1504
1513
  {
1505
1514
  interactive: !1,
@@ -1508,18 +1517,18 @@ function Je({ style: e }) {
1508
1517
  }
1509
1518
  );
1510
1519
  }
1511
- const qn = B.createContext("en");
1512
- function Ze() {
1513
- return B.useContext(qn);
1520
+ const Bn = B.createContext("en");
1521
+ function Xe() {
1522
+ return B.useContext(Bn);
1514
1523
  }
1515
- function be(e) {
1524
+ function Ee(e) {
1516
1525
  return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
1517
1526
  }
1518
- function Bn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1519
- const o = Ze();
1520
- return y(() => be(o) === be(t), [o, t]) ? e ? /* @__PURE__ */ c(e, { ...i, children: n }) : /* @__PURE__ */ c("span", { ...i, children: n }) : e ? /* @__PURE__ */ c(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ c("span", { ...i, lang: t, dir: r, children: n });
1527
+ function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1528
+ const o = Xe();
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 });
1521
1530
  }
1522
- function jn(e, t, n) {
1531
+ function Hn(e, t, n) {
1523
1532
  if (t.length === 0)
1524
1533
  return;
1525
1534
  if (t.length === 1)
@@ -1534,18 +1543,18 @@ function jn(e, t, n) {
1534
1543
  return i;
1535
1544
  return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
1536
1545
  }
1537
- const Hn = (e, t = []) => {
1538
- const n = Ze();
1539
- return y(() => {
1546
+ const $n = (e, t = []) => {
1547
+ const n = Xe();
1548
+ return w(() => {
1540
1549
  const r = e();
1541
- return jn(n, r, []);
1550
+ return Hn(n, r, []);
1542
1551
  }, [n, ...t]);
1543
1552
  };
1544
- function $n(e, t, n = `
1553
+ function Yn(e, t, n = `
1545
1554
  `) {
1546
- const r = Hn(() => Object.keys(e || {}), [e]);
1555
+ const r = $n(() => Object.keys(e || {}), [e]);
1547
1556
  return [
1548
- y(() => {
1557
+ w(() => {
1549
1558
  if (!e)
1550
1559
  return t || "";
1551
1560
  if (typeof e == "string")
@@ -1556,7 +1565,7 @@ function $n(e, t, n = `
1556
1565
  r
1557
1566
  ];
1558
1567
  }
1559
- function Yn({
1568
+ function zn({
1560
1569
  as: e,
1561
1570
  defaultText: t,
1562
1571
  enableDangerouslySetInnerHTML: n,
@@ -1564,9 +1573,9 @@ function Yn({
1564
1573
  separator: i,
1565
1574
  ...o
1566
1575
  }) {
1567
- const [a, s] = $n(r, t, i);
1568
- return s ? /* @__PURE__ */ c(
1569
- Bn,
1576
+ const [a, s] = Yn(r, t, i);
1577
+ return s ? /* @__PURE__ */ u(
1578
+ jn,
1570
1579
  {
1571
1580
  ...o,
1572
1581
  as: e,
@@ -1577,7 +1586,7 @@ function Yn({
1577
1586
  } : void 0,
1578
1587
  children: n ? void 0 : a
1579
1588
  }
1580
- ) : e ? /* @__PURE__ */ c(e, { ...o, children: a }) : /* @__PURE__ */ c(
1589
+ ) : e ? /* @__PURE__ */ u(e, { ...o, children: a }) : /* @__PURE__ */ u(
1581
1590
  "span",
1582
1591
  {
1583
1592
  ...o,
@@ -1589,14 +1598,14 @@ function Yn({
1589
1598
  }
1590
1599
  );
1591
1600
  }
1592
- function zn({
1601
+ function Kn({
1593
1602
  element: e,
1594
1603
  media: t,
1595
1604
  playPause: n
1596
1605
  }) {
1597
- const r = q(null);
1598
- return t.youTubeId ? /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
1599
- /* @__PURE__ */ c("style", { children: `
1606
+ const r = _(null);
1607
+ return t.youTubeId ? /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1608
+ /* @__PURE__ */ u("style", { children: `
1600
1609
  .video-container {
1601
1610
  position: absolute;
1602
1611
  top: 0;
@@ -1615,7 +1624,7 @@ function zn({
1615
1624
  object-fit: contain;
1616
1625
  }
1617
1626
  ` }),
1618
- /* @__PURE__ */ c(
1627
+ /* @__PURE__ */ u(
1619
1628
  "iframe",
1620
1629
  {
1621
1630
  className: "video-yt",
@@ -1627,19 +1636,19 @@ function zn({
1627
1636
  )
1628
1637
  ] }) : null;
1629
1638
  }
1630
- function Kn({
1639
+ function Wn({
1631
1640
  media: e,
1632
1641
  mediaControlsDeps: t,
1633
1642
  children: n
1634
1643
  }) {
1635
- const [{ element: r, currentTime: i, progress: o }, a, s] = me({ duration: e.duration });
1636
- return Y("overlay", "video-element", zn, {
1644
+ const [{ element: r, currentTime: i, progress: o }, a, s] = pe({ duration: e.duration });
1645
+ return Y("overlay", "video-element", Kn, {
1637
1646
  element: r,
1638
1647
  media: e,
1639
1648
  playPause: s.playPause
1640
1649
  }), null;
1641
1650
  }
1642
- function Xe({
1651
+ function et({
1643
1652
  x: e,
1644
1653
  y: t,
1645
1654
  onChoiceChange: n,
@@ -1648,59 +1657,59 @@ function Xe({
1648
1657
  isStatic: o,
1649
1658
  renderViewerControls: a,
1650
1659
  renderMediaControls: s,
1651
- viewControlsDeps: u,
1660
+ viewControlsDeps: c,
1652
1661
  mediaControlsDeps: d,
1653
1662
  strategies: l,
1654
1663
  throwOnUnknown: f,
1655
- backgroundStyle: v,
1664
+ backgroundStyle: m,
1656
1665
  alwaysShowBackground: p,
1657
- keepCanvasScale: m = !1,
1658
- enableSizes: g = !1,
1659
- enableYouTube: w = !0,
1660
- onClickPaintingAnnotation: x,
1661
- children: M
1666
+ keepCanvasScale: g = !1,
1667
+ enableSizes: x = !1,
1668
+ enableYouTube: v = !0,
1669
+ onClickPaintingAnnotation: y,
1670
+ children: C
1662
1671
  }) {
1663
- const b = j(), W = Fe(b, ["deep-zoom"]), [Z] = en(), C = rn(), A = T(), k = y(() => Me(A), [A]), [h, D] = Vn({
1672
+ const S = j(), W = Ue(S, ["deep-zoom"]), [Z] = tn(), E = on(), A = O(), k = w(() => Te(A), [A]), [h, D] = On({
1664
1673
  strategies: l || ["images"],
1665
- defaultChoices: i == null ? void 0 : i.map(({ id: S }) => S)
1666
- }), ve = h.type === "images" ? h.choice : void 0, et = 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(
1667
1676
  1,
1668
- ...h.type === "images" ? h.images.map((S) => {
1677
+ ...h.type === "images" ? h.images.map((P) => {
1669
1678
  var H;
1670
- 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);
1671
1680
  }) : []
1672
- ), [m, h]);
1673
- on(et), N(() => {
1681
+ ), [g, h]);
1682
+ an(tt), N(() => {
1674
1683
  r && r(D);
1675
1684
  }, [h.annotations]), N(() => {
1676
1685
  if (i)
1677
- for (const S of i)
1678
- typeof S.opacity < "u" && k.applyStyles({ id: S.id }, "atlas", {
1679
- opacity: S.opacity
1686
+ for (const P of i)
1687
+ typeof P.opacity < "u" && k.applyStyles({ id: P.id }, "atlas", {
1688
+ opacity: P.opacity
1680
1689
  });
1681
- }, [i]), Ce(() => {
1682
- n && n(ve);
1683
- }, [ve]), Y(
1684
- C && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
1685
- `canvas-portal-controls-${b == null ? void 0 : b.id}`,
1686
- ge.Provider,
1690
+ }, [i]), Ie(() => {
1691
+ n && n(ye);
1692
+ }, [ye]), Y(
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}`,
1695
+ ve.Provider,
1687
1696
  a ? {
1688
- value: C || null,
1697
+ value: E || null,
1689
1698
  children: a(h)
1690
1699
  } : {},
1691
- [b, C, h, ...u || []]
1700
+ [S, E, h, ...c || []]
1692
1701
  );
1693
- const _ = Ln({ maxWidth: 256, maxHeight: 256 });
1694
- if (!b)
1702
+ const q = kn({ maxWidth: 256, maxHeight: 256 });
1703
+ if (!S)
1695
1704
  return null;
1696
- const pe = b.accompanyingCanvas, G = _ && _.type === "fixed" ? /* @__PURE__ */ c("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ c(
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(
1697
1706
  "world-image",
1698
1707
  {
1699
- uri: _.id,
1700
- target: { x: 0, y: 0, width: b.width, height: b.height },
1701
- display: _.width && _.height ? {
1702
- width: _.width,
1703
- 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
1704
1713
  } : void 0,
1705
1714
  crop: void 0
1706
1715
  }
@@ -1712,99 +1721,95 @@ function Xe({
1712
1721
  throw new Error(h.reason || "Unknown image strategy");
1713
1722
  return null;
1714
1723
  }
1715
- const ye = /* @__PURE__ */ I(te, { children: [
1716
- Z ? /* @__PURE__ */ c(de, { page: Z }) : null,
1717
- h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ c(de, { page: S }, S.id)) : null,
1718
- M
1719
- ] }), tt = h.type === "images" ? h.images.length : 0;
1720
- return /* @__PURE__ */ I($, { children: [
1721
- /* @__PURE__ */ I(
1724
+ const we = /* @__PURE__ */ M(te, { children: [
1725
+ Z ? /* @__PURE__ */ u(de, { page: Z }) : null,
1726
+ h.annotations && h.annotations.pages ? h.annotations.pages.map((P) => /* @__PURE__ */ u(de, { page: P }, P.id)) : null,
1727
+ C
1728
+ ] }), nt = h.type === "images" ? h.images.length : 0;
1729
+ return /* @__PURE__ */ M($, { children: [
1730
+ /* @__PURE__ */ M(
1722
1731
  "world-object",
1723
1732
  {
1724
- height: b.height,
1725
- width: b.width,
1733
+ height: S.height,
1734
+ width: S.width,
1726
1735
  x: e,
1727
1736
  y: t,
1728
1737
  ...W,
1729
1738
  children: [
1730
- h.type === "empty" || p ? /* @__PURE__ */ c(Je, { style: v }) : null,
1731
- 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) => {
1732
1741
  var Q;
1733
- return /* @__PURE__ */ I($, { children: [
1734
- /* @__PURE__ */ c(
1735
- dt,
1742
+ return /* @__PURE__ */ M($, { children: [
1743
+ /* @__PURE__ */ u(
1744
+ ft,
1736
1745
  {
1737
- onClick: x ? (xe) => {
1738
- xe.stopPropagation(), x(S.annotationId, S, xe);
1746
+ onClick: y ? (Se) => {
1747
+ Se.stopPropagation(), y(P.annotationId, P, Se);
1739
1748
  } : void 0,
1740
- target: ((Q = S.target) == null ? void 0 : Q.spatial) || void 0,
1741
- children: /* @__PURE__ */ c("div", { "data-textual-content": !0, children: /* @__PURE__ */ c(Yn, { 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 }) })
1742
1751
  },
1743
1752
  H
1744
1753
  ),
1745
- ye
1754
+ we
1746
1755
  ] });
1747
1756
  }) : null,
1748
- h.type === "images" ? /* @__PURE__ */ I($, { children: [
1749
- h.images.map((S, H) => /* @__PURE__ */ c(
1750
- _e,
1757
+ h.type === "images" ? /* @__PURE__ */ M($, { children: [
1758
+ h.images.map((P, H) => /* @__PURE__ */ u(
1759
+ qe,
1751
1760
  {
1752
1761
  isStatic: o,
1753
- image: S,
1754
- id: S.id,
1755
- thumbnail: H === 0 ? _ : void 0,
1756
- selector: S.selector,
1757
- enableSizes: g,
1758
- onClick: x ? (Q) => {
1759
- 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);
1760
1769
  } : void 0
1761
1770
  },
1762
- S.id + H
1771
+ P.id + H
1763
1772
  )),
1764
- ye
1773
+ we
1765
1774
  ] }) : null,
1766
- h.type === "3d-model" ? /* @__PURE__ */ c(Qe, { model: h.model }) : null,
1767
- h.type === "media" ? /* @__PURE__ */ c($, { children: h.media.type === "Sound" ? /* @__PURE__ */ I(ze, { media: h.media, mediaControlsDeps: d, children: [
1775
+ h.type === "3d-model" ? /* @__PURE__ */ u(Je, { model: h.model }) : null,
1776
+ h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ M(Ke, { media: h.media, mediaControlsDeps: d, children: [
1768
1777
  G,
1769
1778
  s ? s(h) : null
1770
- ] }) : h.media.type === "Video" ? /* @__PURE__ */ I(We, { media: h.media, mediaControlsDeps: d, children: [
1779
+ ] }) : h.media.type === "Video" ? /* @__PURE__ */ M(Ge, { media: h.media, mediaControlsDeps: d, children: [
1771
1780
  G,
1772
1781
  s ? s(h) : null
1773
- ] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */ I(Kn, { media: h.media, mediaControlsDeps: d, children: [
1782
+ ] }) : h.media.type === "VideoYouTube" && v ? /* @__PURE__ */ M(Wn, { media: h.media, mediaControlsDeps: d, children: [
1774
1783
  G,
1775
1784
  s ? s(h) : null
1776
1785
  ] }) : null }) : null
1777
1786
  ]
1778
1787
  },
1779
- `${b.id}/${h.type}/${tt}`
1788
+ `${S.id}/${h.type}/${nt}`
1780
1789
  ),
1781
- h.type === "media" && h.media.type === "Sound" && pe ? /* @__PURE__ */ c(he, { canvas: pe.id, children: /* @__PURE__ */ c(Xe, { renderViewerControls: a }) }) : null
1790
+ h.type === "media" && h.media.type === "Sound" && xe ? /* @__PURE__ */ u(me, { canvas: xe.id, children: /* @__PURE__ */ u(et, { renderViewerControls: a }) }) : null
1782
1791
  ] });
1783
1792
  }
1784
- function Wn() {
1785
- const e = R(ie);
1786
- return e && e.vault ? e.vault : Ie();
1787
- }
1788
- const Gn = Ee(function(t, n) {
1789
- const r = K(), i = Te(), o = Tt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1790
- if (ot(n, () => o, [o]), !r)
1791
- return /* @__PURE__ */ c("div", {});
1792
- let u = 0;
1793
- return /* @__PURE__ */ I($, { children: [
1793
+ const Gn = Me(function(t, n) {
1794
+ const r = K(), i = Re(), o = Rt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1795
+ if (at(n, () => o, [o]), !r)
1796
+ return /* @__PURE__ */ u("div", {});
1797
+ let c = 0;
1798
+ return /* @__PURE__ */ M($, { children: [
1794
1799
  t.header,
1795
- /* @__PURE__ */ c(
1796
- O.Viewer,
1800
+ /* @__PURE__ */ u(
1801
+ V.Viewer,
1797
1802
  {
1798
1803
  height: t.height,
1799
1804
  mode: t.mode,
1800
1805
  children: i.map((d, l) => {
1801
- const f = u;
1802
- return u += d.width + (t.spacing || 0), /* @__PURE__ */ c(he, { canvas: d.id, children: /* @__PURE__ */ c(
1803
- O.RenderCanvas,
1806
+ const f = c;
1807
+ return c += d.width + (t.spacing || 0), /* @__PURE__ */ u(me, { canvas: d.id, children: /* @__PURE__ */ u(
1808
+ V.RenderCanvas,
1804
1809
  {
1805
1810
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
1806
- renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ c(a, {}) : void 0,
1807
- renderMediaControls: l === 0 && s ? () => /* @__PURE__ */ c(s, {}) : void 0,
1811
+ renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ u(a, {}) : void 0,
1812
+ renderMediaControls: l === 0 && s ? () => /* @__PURE__ */ u(s, {}) : void 0,
1808
1813
  x: f,
1809
1814
  ...t.canvasProps || {},
1810
1815
  children: t.annotations
@@ -1817,20 +1822,9 @@ const Gn = Ee(function(t, n) {
1817
1822
  ),
1818
1823
  t.children
1819
1824
  ] });
1820
- }), O = Ee(function({
1821
- children: t,
1822
- height: n,
1823
- annotations: r,
1824
- canvasProps: i,
1825
- spacing: o,
1826
- header: a,
1827
- components: s,
1828
- mode: u,
1829
- reuseAtlas: d,
1830
- ...l
1831
- }, f) {
1832
- const v = Wn();
1833
- return /* @__PURE__ */ c(Ae, { vault: v, children: /* @__PURE__ */ c(At, { ...l, children: /* @__PURE__ */ c(
1825
+ }), V = Me(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: c, reuseAtlas: d, ...l }, f) {
1826
+ const m = ge();
1827
+ return /* @__PURE__ */ u(he, { vault: m, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
1834
1828
  Gn,
1835
1829
  {
1836
1830
  ref: f,
@@ -1840,25 +1834,25 @@ const Gn = Ee(function(t, n) {
1840
1834
  canvasProps: i,
1841
1835
  annotations: r,
1842
1836
  header: a,
1843
- mode: u,
1837
+ mode: c,
1844
1838
  reuseAtlas: d,
1845
1839
  children: t
1846
1840
  }
1847
1841
  ) }) });
1848
1842
  });
1849
- O.RenderImage = _e;
1850
- O.RenderCanvas = Xe;
1851
- O.RenderAnnotationPage = de;
1852
- O.RenderAnnotation = De;
1853
- O.Viewer = an;
1854
- O.CanvasBackground = Je;
1855
- O.Audio = ze;
1856
- O.Video = We;
1857
- O.Model = Qe;
1858
- O.AudioHTML = Ye;
1859
- O.VideoHTML = Ke;
1860
- O.ModelHTML = Ge;
1843
+ V.RenderImage = qe;
1844
+ V.RenderCanvas = et;
1845
+ V.RenderAnnotationPage = de;
1846
+ V.RenderAnnotation = _e;
1847
+ V.Viewer = sn;
1848
+ V.CanvasBackground = Ze;
1849
+ V.Audio = Ke;
1850
+ V.Video = Ge;
1851
+ V.Model = Je;
1852
+ V.AudioHTML = ze;
1853
+ V.VideoHTML = We;
1854
+ V.ModelHTML = Qe;
1861
1855
  export {
1862
- O as CanvasPanel
1856
+ V as CanvasPanel
1863
1857
  };
1864
1858
  //# sourceMappingURL=canvas-panel.mjs.map