react-iiif-vault 1.0.3 → 1.0.4

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.
@@ -24,9 +24,9 @@ var fn = function(e, r) {
24
24
  for (var i, n = arguments.length, s = new Array(n), a = 0; a < n; a++)
25
25
  s[a] = arguments[a];
26
26
  return i = t.call.apply(t, [this].concat(s)) || this, i.state = zt, i.resetErrorBoundary = function() {
27
- for (var o, u = arguments.length, p = new Array(u), l = 0; l < u; l++)
28
- p[l] = arguments[l];
29
- i.props.onReset == null || (o = i.props).onReset.apply(o, p), i.reset();
27
+ for (var o, u = arguments.length, h = new Array(u), l = 0; l < u; l++)
28
+ h[l] = arguments[l];
29
+ i.props.onReset == null || (o = i.props).onReset.apply(o, h), i.reset();
30
30
  }, i;
31
31
  }
32
32
  e.getDerivedStateFromError = function(n) {
@@ -43,22 +43,22 @@ var fn = function(e, r) {
43
43
  }, r.componentDidUpdate = function(n, s) {
44
44
  var a = this.state.error, o = this.props.resetKeys;
45
45
  if (a !== null && s.error !== null && fn(n.resetKeys, o)) {
46
- var u, p;
47
- (u = (p = this.props).onResetKeysChange) == null || u.call(p, n.resetKeys, o), this.reset();
46
+ var u, h;
47
+ (u = (h = this.props).onResetKeysChange) == null || u.call(h, n.resetKeys, o), this.reset();
48
48
  }
49
49
  }, r.render = function() {
50
50
  var n = this.state.error, s = this.props, a = s.fallbackRender, o = s.FallbackComponent, u = s.fallback;
51
51
  if (n !== null) {
52
- var p = {
52
+ var h = {
53
53
  error: n,
54
54
  resetErrorBoundary: this.resetErrorBoundary
55
55
  };
56
56
  if (/* @__PURE__ */ ot.isValidElement(u))
57
57
  return u;
58
58
  if (typeof a == "function")
59
- return a(p);
59
+ return a(h);
60
60
  if (o)
61
- return /* @__PURE__ */ ot.createElement(o, p);
61
+ return /* @__PURE__ */ ot.createElement(o, h);
62
62
  throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
63
63
  }
64
64
  return this.props.children;
@@ -145,20 +145,20 @@ function Gt(t, e, { waitTimeout: r = 30 } = {}) {
145
145
  const s = t.getStore(), a = s.getState(), o = a.iiif.requests[i];
146
146
  if (o) {
147
147
  if (o.loadingState === wt) {
148
- const p = ct(a, i);
149
- if (p)
150
- return p;
148
+ const h = ct(a, i);
149
+ if (h)
150
+ return h;
151
151
  }
152
152
  switch (o.loadingState) {
153
153
  case xt:
154
154
  break;
155
155
  case Ir:
156
156
  return (async () => {
157
- let p, l = !1;
157
+ let h, l = !1;
158
158
  try {
159
- const h = await Promise.race([
159
+ const p = await Promise.race([
160
160
  new Promise((v, m) => {
161
- l || (p = s.subscribe(() => {
161
+ l || (h = s.subscribe(() => {
162
162
  const d = s.getState();
163
163
  if (d.iiif.requests[i].loadingState === xt) {
164
164
  m();
@@ -179,33 +179,33 @@ function Gt(t, e, { waitTimeout: r = 30 } = {}) {
179
179
  )
180
180
  )
181
181
  ]);
182
- if (p && p(), h)
183
- return h;
182
+ if (h && h(), p)
183
+ return p;
184
184
  } catch {
185
- p && p();
185
+ h && h();
186
186
  }
187
187
  })();
188
188
  }
189
189
  }
190
190
  t.dispatch(Pn({ id: i }));
191
- const u = (p) => {
192
- if (!p)
191
+ const u = (h) => {
192
+ if (!h)
193
193
  return;
194
- !p.id && !p["@id"] && (p["@type"] && (p["@id"] = i), p.id = i);
195
- const l = $n(i, p);
194
+ !h.id && !h["@id"] && (h["@type"] && (h["@id"] = i), h.id = i);
195
+ const l = $n(i, h);
196
196
  return t.dispatch(Mt({ actions: l })), ct(s.getState(), i);
197
197
  };
198
198
  try {
199
- const p = e(i, n);
200
- return qn(p) ? (async () => {
199
+ const h = e(i, n);
200
+ return qn(h) ? (async () => {
201
201
  try {
202
- return u(await p);
202
+ return u(await h);
203
203
  } catch (l) {
204
204
  throw t.dispatch(St({ id: i, message: l.toString() })), l;
205
205
  }
206
- })() : u(p);
207
- } catch (p) {
208
- throw t.dispatch(St({ id: i, message: p.toString() })), p;
206
+ })() : u(h);
207
+ } catch (h) {
208
+ throw t.dispatch(St({ id: i, message: h.toString() })), h;
209
209
  }
210
210
  };
211
211
  }
@@ -229,8 +229,8 @@ const Jt = (t) => {
229
229
  const r = /* @__PURE__ */ new Set(), i = (a, o) => {
230
230
  const u = typeof a == "function" ? a(e) : a;
231
231
  if (!Object.is(u, e)) {
232
- const p = e;
233
- e = o ?? typeof u != "object" ? u : Object.assign({}, e, u), r.forEach((l) => l(e, p));
232
+ const h = e;
233
+ e = o ?? typeof u != "object" ? u : Object.assign({}, e, u), r.forEach((l) => l(e, h));
234
234
  }
235
235
  }, n = () => e, s = { setState: i, getState: n, subscribe: (a) => (r.add(a), () => r.delete(a)), destroy: () => {
236
236
  r.clear();
@@ -257,14 +257,14 @@ const Jt = (t) => {
257
257
  return Ct.set(r.name, n), { type: "tracked", store: t, ...n };
258
258
  }, Hn = (t, e = {}) => (r, i, n) => {
259
259
  const { enabled: s, anonymousActionType: a, store: o, ...u } = e;
260
- let p;
260
+ let h;
261
261
  try {
262
- p = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
262
+ h = (s ?? !1) && window.__REDUX_DEVTOOLS_EXTENSION__;
263
263
  } catch {
264
264
  }
265
- if (!p)
265
+ if (!h)
266
266
  return t(r, i, n);
267
- const { connection: l, ...h } = Nn(o, p, u);
267
+ const { connection: l, ...p } = Nn(o, h, u);
268
268
  let v = !0;
269
269
  n.setState = (g, A, b) => {
270
270
  const w = r(g, A);
@@ -286,11 +286,11 @@ const Jt = (t) => {
286
286
  const A = v;
287
287
  v = !1, r(...g), v = A;
288
288
  }, d = t(n.setState, i, n);
289
- if (h.type === "untracked" ? l == null || l.init(d) : (h.stores[h.store] = n, l == null || l.init(
289
+ if (p.type === "untracked" ? l == null || l.init(d) : (p.stores[p.store] = n, l == null || l.init(
290
290
  Object.fromEntries(
291
- Object.entries(h.stores).map(([g, A]) => [
291
+ Object.entries(p.stores).map(([g, A]) => [
292
292
  g,
293
- g === h.store ? d : A.getState()
293
+ g === p.store ? d : A.getState()
294
294
  ])
295
295
  )
296
296
  )), n.dispatchFromDevtools && typeof n.dispatch == "function") {
@@ -393,11 +393,11 @@ const Jt = (t) => {
393
393
  return i.subscribe = (s, a, o) => {
394
394
  let u = s;
395
395
  if (a) {
396
- const p = (o == null ? void 0 : o.equalityFn) || Object.is;
396
+ const h = (o == null ? void 0 : o.equalityFn) || Object.is;
397
397
  let l = s(i.getState());
398
- u = (h) => {
399
- const v = s(h);
400
- if (!p(l, v)) {
398
+ u = (p) => {
399
+ const v = s(p);
400
+ if (!h(l, v)) {
401
401
  const m = l;
402
402
  a(l = v, m);
403
403
  }
@@ -477,12 +477,12 @@ const Gn = (t = Lr(), e) => {
477
477
  const n = Object.keys(C(e).entities), s = { ...t };
478
478
  for (const a of n) {
479
479
  const o = C(e).entities[a], u = { ...t[a] || {} };
480
- let p = !1;
480
+ let h = !1;
481
481
  const l = Object.keys(o || {}) || [];
482
482
  if (o && l) {
483
- for (const h of l)
484
- p = !0, u[h] = t[a][h] ? Yn(t[a][h], o[h]) : o[h];
485
- p && (s[a] = u);
483
+ for (const p of l)
484
+ h = !0, u[p] = t[a][p] ? Yn(t[a][p], o[p]) : o[p];
485
+ h && (s[a] = u);
486
486
  }
487
487
  }
488
488
  return s;
@@ -890,29 +890,29 @@ let Rt = class {
890
890
  const { skipSelfReturn: n = !0 } = i || {};
891
891
  let s = i.parent ? typeof i.parent == "string" ? i.parent : i.parent.id : void 0;
892
892
  if (Array.isArray(e))
893
- return e.map((h) => this.get(h, i));
893
+ return e.map((p) => this.get(p, i));
894
894
  const a = this.getState();
895
895
  if (on(e) && !i.preserveSpecificResources && (e = e.source), typeof e == "string") {
896
- const h = Zt(r || a.iiif.mapping[e]);
897
- if (!h)
896
+ const p = Zt(r || a.iiif.mapping[e]);
897
+ if (!p)
898
898
  return n ? null : { id: e, type: "unknown" };
899
- e = { id: e, type: h };
899
+ e = { id: e, type: p };
900
900
  }
901
901
  if (e && e.partOf && !s && !i.skipPartOfCheck) {
902
- const h = Array.isArray(e.partOf) ? e.partOf[0] : e.partOf;
903
- h && (typeof h == "string" && (s = h), typeof h.id == "string" && (s = h.id));
902
+ const p = Array.isArray(e.partOf) ? e.partOf[0] : e.partOf;
903
+ p && (typeof p == "string" && (s = p), typeof p.id == "string" && (s = p.id));
904
904
  }
905
- const o = Zt(r || (e == null ? void 0 : e.type)), u = e == null ? void 0 : e.id, p = a.iiif.entities[o];
906
- if (!p) {
907
- const h = a.iiif.requests[u];
908
- return h && h.resourceUri !== u ? this.get(h.resourceUri, i) : n ? null : e;
905
+ const o = Zt(r || (e == null ? void 0 : e.type)), u = e == null ? void 0 : e.id, h = a.iiif.entities[o];
906
+ if (!h) {
907
+ const p = a.iiif.requests[u];
908
+ return p && p.resourceUri !== u ? this.get(p.resourceUri, i) : n ? null : e;
909
909
  }
910
- const l = p[e.id];
910
+ const l = h[e.id];
911
911
  if (l && l[Ke]) {
912
- const h = l[Ke].find((v) => s ? v[Ze] === s : v[Ze] === l.id);
913
- return pr(l, h);
912
+ const p = l[Ke].find((v) => s ? v[Ze] === s : v[Ze] === l.id);
913
+ return pr(l, p);
914
914
  }
915
- return p[e.id] || (n ? null : e);
915
+ return h[e.id] || (n ? null : e);
916
916
  }
917
917
  select(e) {
918
918
  return e(this.getState());
@@ -1057,23 +1057,23 @@ const W = () => {
1057
1057
  return t;
1058
1058
  };
1059
1059
  function as(t, { noCache: e = !1 } = {}) {
1060
- const r = typeof t == "string" ? t : t.id, i = W(), [n, s] = J(r), [a, o] = J(void 0), u = j(() => i.get(r, { skipSelfReturn: !0 }) || void 0, [r, i]), [p, l] = J(u);
1060
+ const r = typeof t == "string" ? t : t.id, i = W(), [n, s] = J(r), [a, o] = J(void 0), u = j(() => i.get(r, { skipSelfReturn: !0 }) || void 0, [r, i]), [h, l] = J(u);
1061
1061
  return re(() => {
1062
1062
  (async () => {
1063
1063
  try {
1064
- const h = u && !e ? u : await i.load(r), v = h ? h.id || h["@id"] : null;
1065
- h && n !== v && s(v), l(h);
1066
- } catch (h) {
1067
- o(h);
1064
+ const p = u && !e ? u : await i.load(r), v = p ? p.id || p["@id"] : null;
1065
+ p && n !== v && s(v), l(p);
1066
+ } catch (p) {
1067
+ o(p);
1068
1068
  }
1069
1069
  })();
1070
1070
  }, [r, e]), {
1071
- isLoaded: !!p,
1071
+ isLoaded: !!h,
1072
1072
  id: n,
1073
1073
  requestId: r,
1074
1074
  error: a,
1075
- resource: p,
1076
- cached: !!(p && p === u)
1075
+ resource: h,
1076
+ cached: !!(h && h === u)
1077
1077
  };
1078
1078
  }
1079
1079
  function os(t, e) {
@@ -1138,29 +1138,29 @@ function ls(t, e, { disablePaging: r, skipNonPaged: i } = {}) {
1138
1138
  return [u, [u.map((d, g) => g)]];
1139
1139
  if (o || !s || r)
1140
1140
  return [u, u.map((d, g) => [g])];
1141
- const p = [];
1141
+ const h = [];
1142
1142
  let l = [];
1143
- const h = () => {
1144
- l.length && (p.push([...l]), l = []);
1143
+ const p = () => {
1144
+ l.length && (h.push([...l]), l = []);
1145
1145
  };
1146
1146
  let v = 0, m = !1;
1147
1147
  for (let d = 0; d < u.length; d++) {
1148
1148
  const g = t.get(u[d]);
1149
1149
  if (g.behavior.includes("non-paged")) {
1150
- d === v && v++, i || (h(), p.push([d]), h());
1150
+ d === v && v++, i || (p(), h.push([d]), p());
1151
1151
  continue;
1152
1152
  }
1153
1153
  if (d === v || g.behavior.includes("facing-pages")) {
1154
- l.length && (m = !0), h(), p.push([d]), h();
1154
+ l.length && (m = !0), p(), h.push([d]), p();
1155
1155
  continue;
1156
1156
  }
1157
1157
  if (l.push(d), m) {
1158
- h(), m = !1;
1158
+ p(), m = !1;
1159
1159
  continue;
1160
1160
  }
1161
- l.length > 1 && h();
1161
+ l.length > 1 && p();
1162
1162
  }
1163
- return l.length && h(), [u, p];
1163
+ return l.length && p(), [u, h];
1164
1164
  }
1165
1165
  function fs(t = {}, e = []) {
1166
1166
  const { id: r, selector: i } = t, n = Ee(), s = r || n.range, a = Y((o) => s ? o.iiif.entities.Range[s] : void 0, [s]);
@@ -1174,34 +1174,34 @@ function ps({ startCanvas: t, disablePaging: e }) {
1174
1174
  const r = W(), i = Pe(), n = fs(), [s, a] = J(void 0), o = n || i;
1175
1175
  if (!o)
1176
1176
  throw new Error("Nothing selected");
1177
- const [u, p] = j(
1177
+ const [u, h] = j(
1178
1178
  () => ls(r, o, { disablePaging: e }),
1179
1179
  [r, o]
1180
1180
  ), l = D(
1181
1181
  (g) => {
1182
- const A = p.findIndex((b) => b.includes(g));
1182
+ const A = h.findIndex((b) => b.includes(g));
1183
1183
  a(A === -1 ? 0 : A);
1184
1184
  },
1185
- [u, p]
1186
- ), h = D(
1185
+ [u, h]
1186
+ ), p = D(
1187
1187
  (g) => {
1188
1188
  const A = u.findIndex((b) => b.id === g);
1189
1189
  A !== -1 ? l(A) : a(0);
1190
1190
  },
1191
- [u, p]
1191
+ [u, h]
1192
1192
  ), v = D(() => {
1193
- a((g) => g >= p.length ? g : g + 1);
1194
- }, [p]), m = D(() => {
1193
+ a((g) => g >= h.length ? g : g + 1);
1194
+ }, [h]), m = D(() => {
1195
1195
  a((g) => g <= 0 ? 0 : g - 1);
1196
- }, [p]);
1197
- return typeof s > "u" && (t ? h(t) : a(0)), {
1198
- visibleItems: ((d = p[s]) == null ? void 0 : d.map((g) => u[g].id)) || [],
1196
+ }, [h]);
1197
+ return typeof s > "u" && (t ? p(t) : a(0)), {
1198
+ visibleItems: ((d = h[s]) == null ? void 0 : d.map((g) => u[g].id)) || [],
1199
1199
  cursor: s,
1200
1200
  items: u,
1201
- sequence: p,
1201
+ sequence: h,
1202
1202
  setSequenceIndex: a,
1203
1203
  setCanvasIndex: l,
1204
- setCanvasId: h,
1204
+ setCanvasId: p,
1205
1205
  next: v,
1206
1206
  previous: m
1207
1207
  };
@@ -1218,25 +1218,25 @@ const Le = () => {
1218
1218
  currentSequenceIndex: 0
1219
1219
  });
1220
1220
  function hs(t) {
1221
- const e = Pe(), { cursor: r, visibleItems: i, next: n, sequence: s, items: a, setCanvasIndex: o, setCanvasId: u, previous: p, setSequenceIndex: l } = ps({
1221
+ const e = Pe(), { cursor: r, visibleItems: i, next: n, sequence: s, items: a, setCanvasIndex: o, setCanvasId: u, previous: h, setSequenceIndex: l } = ps({
1222
1222
  startCanvas: t.startCanvas,
1223
1223
  disablePaging: t.pagingEnabled === !1
1224
- }), h = j(
1224
+ }), p = j(
1225
1225
  () => ({
1226
1226
  sequence: s,
1227
1227
  items: a,
1228
1228
  // Extra functions.
1229
1229
  setCurrentCanvasId: u,
1230
1230
  nextCanvas: n,
1231
- previousCanvas: p,
1231
+ previousCanvas: h,
1232
1232
  totalCanvases: a.length,
1233
1233
  setCurrentCanvasIndex: o,
1234
1234
  setSequenceIndex: l,
1235
1235
  currentSequenceIndex: r
1236
1236
  }),
1237
- [s, a, u, n, p, a, o, l, r]
1237
+ [s, a, u, n, h, a, o, l, r]
1238
1238
  );
1239
- return e ? /* @__PURE__ */ x(it.Provider, { value: h, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Lt, { canvas: i[0], children: t.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1239
+ return e ? i.length === 0 ? null : /* @__PURE__ */ x(it.Provider, { value: p, children: /* @__PURE__ */ x(rt.Provider, { value: i, children: /* @__PURE__ */ x(Lt, { canvas: i[0], children: t.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ x("div", { children: "Sorry, something went wrong." }));
1240
1240
  }
1241
1241
  function ds(t) {
1242
1242
  const e = os(t.manifest);
@@ -1328,12 +1328,12 @@ function _s() {
1328
1328
  (o, u) => {
1329
1329
  if (i) {
1330
1330
  if (Xt(o)) {
1331
- const h = o;
1332
- h.__vault || h.bindToVault(t), o = typeof h.source == "string" ? h.source : h.source.id, e.current[o] = h;
1331
+ const p = o;
1332
+ p.__vault || p.bindToVault(t), o = typeof p.source == "string" ? p.source : p.source.id, e.current[o] = p;
1333
1333
  } else
1334
1334
  typeof o != "string" && (o = o.id);
1335
- const p = t.get({ id: i, type: "AnnotationPage" }), l = t.get({ id: o, type: "Annotation" });
1336
- p && l && (p.items.find((h) => h.id === l.id) || r(
1335
+ const h = t.get({ id: i, type: "AnnotationPage" }), l = t.get({ id: o, type: "Annotation" });
1336
+ h && l && (h.items.find((p) => p.id === l.id) || r(
1337
1337
  pt.addReference({
1338
1338
  id: i,
1339
1339
  type: "AnnotationPage",
@@ -1444,7 +1444,7 @@ function zs({
1444
1444
  worldScale: i,
1445
1445
  ...n
1446
1446
  }) {
1447
- const [s, a] = J(), o = vs(), u = e || Ns, [p, l] = J({}), h = Object.entries(p), [v, m] = J({}), d = Object.entries(v), [g, A] = J({}), b = j(() => i || Math.max(...Object.values(g)), [g]), w = j(() => ({ maxOverZoom: b || 1, ...n.runtimeOptions || {} }), [b, n.runtimeOptions]), R = D((T, P) => {
1447
+ const [s, a] = J(), o = vs(), u = e || Ns, [h, l] = J({}), p = Object.entries(h), [v, m] = J({}), d = Object.entries(v), [g, A] = J({}), b = j(() => i || Math.max(...Object.values(g)), [g]), w = j(() => ({ maxOverZoom: b || 1, ...n.runtimeOptions || {} }), [b, n.runtimeOptions]), R = D((T, P) => {
1448
1448
  A((E) => {
1449
1449
  if (P === -1) {
1450
1450
  const { [T]: M, ...$ } = E;
@@ -1469,7 +1469,7 @@ function zs({
1469
1469
  {
1470
1470
  ...n,
1471
1471
  containerProps: { style: { position: "relative" }, ...n.containerProps || {} },
1472
- htmlChildren: /* @__PURE__ */ x(Me, { children: h.map(([T, { element: P, props: E }]) => /* @__PURE__ */ x(ge.Fragment, { children: /* @__PURE__ */ x(P, { ...E || {} }) }, T)) }),
1472
+ htmlChildren: /* @__PURE__ */ x(Me, { children: p.map(([T, { element: P, props: E }]) => /* @__PURE__ */ x(ge.Fragment, { children: /* @__PURE__ */ x(P, { ...E || {} }) }, T)) }),
1473
1473
  onCreated: (T) => {
1474
1474
  a(T), n.onCreated && n.onCreated(T);
1475
1475
  },
@@ -1530,8 +1530,8 @@ function Ws(t = Br) {
1530
1530
  for (const a of Object.keys(n))
1531
1531
  s[a] = (o) => {
1532
1532
  const u = t.get(i);
1533
- for (const { callback: p, scope: l } of n[a] || [])
1534
- (!l || r && l.indexOf(r) !== -1) && p(o, u);
1533
+ for (const { callback: h, scope: l } of n[a] || [])
1534
+ (!l || r && l.indexOf(r) !== -1) && h(o, u);
1535
1535
  };
1536
1536
  return s;
1537
1537
  }
@@ -1588,8 +1588,8 @@ var Qs = Object.defineProperty, Ys = (t, e, r) => e in t ? Qs(t, e, { enumerable
1588
1588
  try {
1589
1589
  for (var o = e[Symbol.iterator](), u; !(n = (u = o.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
1590
1590
  ;
1591
- } catch (p) {
1592
- s = !0, a = p;
1591
+ } catch (h) {
1592
+ s = !0, a = h;
1593
1593
  } finally {
1594
1594
  try {
1595
1595
  !n && o.return && o.return();
@@ -1610,9 +1610,9 @@ var Qs = Object.defineProperty, Ys = (t, e, r) => e in t ? Qs(t, e, { enumerable
1610
1610
  }(), je = Math.PI * 2, ht = function(t, e, r, i, n, s, a) {
1611
1611
  var o = t.x, u = t.y;
1612
1612
  o *= e, u *= r;
1613
- var p = i * o - n * u, l = n * o + i * u;
1613
+ var h = i * o - n * u, l = n * o + i * u;
1614
1614
  return {
1615
- x: p + s,
1615
+ x: h + s,
1616
1616
  y: l + a
1617
1617
  };
1618
1618
  }, Js = function(t, e) {
@@ -1630,13 +1630,13 @@ var Qs = Object.defineProperty, Ys = (t, e, r) => e in t ? Qs(t, e, { enumerable
1630
1630
  }, er = function(t, e, r, i) {
1631
1631
  var n = t * i - e * r < 0 ? -1 : 1, s = t * r + e * i;
1632
1632
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
1633
- }, Ks = function(t, e, r, i, n, s, a, o, u, p, l, h) {
1634
- var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(h, 2), A = v * m - v * g - m * d;
1633
+ }, Ks = function(t, e, r, i, n, s, a, o, u, h, l, p) {
1634
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(p, 2), A = v * m - v * g - m * d;
1635
1635
  A < 0 && (A = 0), A /= v * g + m * d, A = Math.sqrt(A) * (a === o ? -1 : 1);
1636
- var b = A * n / s * h, w = A * -s / n * l, R = p * b - u * w + (t + r) / 2, O = u * b + p * w + (e + i) / 2, F = (l - b) / n, T = (h - w) / s, P = (-l - b) / n, E = (-h - w) / s, M = er(1, 0, F, T), $ = er(F, T, P, E);
1636
+ var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = er(1, 0, F, T), $ = er(F, T, P, E);
1637
1637
  return o === 0 && $ > 0 && ($ -= je), o === 1 && $ < 0 && ($ += je), [R, O, M, $];
1638
1638
  }, Zs = function(t) {
1639
- var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, p = t.largeArcFlag, l = p === void 0 ? 0 : p, h = t.sweepFlag, v = h === void 0 ? 0 : h, m = [];
1639
+ var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, h = t.largeArcFlag, l = h === void 0 ? 0 : h, p = t.sweepFlag, v = p === void 0 ? 0 : p, m = [];
1640
1640
  if (s === 0 || a === 0)
1641
1641
  return [];
1642
1642
  var d = Math.sin(u * je / 360), g = Math.cos(u * je / 360), A = g * (e - i) / 2 + d * (r - n) / 2, b = -d * (e - i) / 2 + g * (r - n) / 2;
@@ -1722,7 +1722,7 @@ function aa(t) {
1722
1722
  const oa = /* @__PURE__ */ Yr(sa);
1723
1723
  function ca(t) {
1724
1724
  const e = na(t), r = oa(e);
1725
- let i, n = 0, s = 0, a = 0, o = 0, u, p, l = 0, h = 0;
1725
+ let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
1726
1726
  const v = [];
1727
1727
  for (let m = 0; m < r.length; m++) {
1728
1728
  let d = r[m];
@@ -1739,21 +1739,21 @@ function ca(t) {
1739
1739
  break;
1740
1740
  case "S":
1741
1741
  {
1742
- let A = l, b = h;
1742
+ let A = l, b = p;
1743
1743
  (i === "C" || i == "S") && (A += A - a, b += b - o), d = ["C", A, b, d[1], d[2], d[3], d[4]];
1744
1744
  }
1745
1745
  break;
1746
1746
  case "T":
1747
- i === "Q" || i == "T" ? (u = l * 2 - u, p = h * 2 - p) : (u = l, p = h), d = ["Q", u, p, d[1], d[2]];
1747
+ i === "Q" || i == "T" ? (u = l * 2 - u, h = p * 2 - h) : (u = l, h = p), d = ["Q", u, h, d[1], d[2]];
1748
1748
  break;
1749
1749
  case "Q":
1750
- u = d[1], p = d[2];
1750
+ u = d[1], h = d[2];
1751
1751
  break;
1752
1752
  case "A":
1753
1753
  {
1754
1754
  const A = Zs({
1755
1755
  px: l,
1756
- py: h,
1756
+ py: p,
1757
1757
  cx: d[6],
1758
1758
  cy: d[7],
1759
1759
  rx: d[1],
@@ -1773,7 +1773,7 @@ function ca(t) {
1773
1773
  d = ["L", n, s];
1774
1774
  break;
1775
1775
  }
1776
- i = g, l = d[d.length - 2], h = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = h), v.push(d);
1776
+ i = g, l = d[d.length - 2], p = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = p), v.push(d);
1777
1777
  }
1778
1778
  return v;
1779
1779
  }
@@ -1837,16 +1837,16 @@ class Gr {
1837
1837
  };
1838
1838
  }
1839
1839
  mapToBasic() {
1840
- const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, p = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, h = (s - e) * u - (a - r) * o, v = p / h, m = l / h, d = Math.abs(h) / (Math.hypot(o, u) * Math.abs(m - v));
1841
- return { x0: e, x2: s, scale: d, cross: h };
1840
+ const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, h = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, p = (s - e) * u - (a - r) * o, v = h / p, m = l / p, d = Math.abs(p) / (Math.hypot(o, u) * Math.abs(m - v));
1841
+ return { x0: e, x2: s, scale: d, cross: p };
1842
1842
  }
1843
1843
  subdivide(e) {
1844
- const r = this.mapToBasic(), i = $e(r.x0), n = $e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = Ie(i), u = Ie(n), p = [0];
1844
+ const r = this.mapToBasic(), i = $e(r.x0), n = $e(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = Ie(i), u = Ie(n), h = [0];
1845
1845
  for (let l = 1; l < a; l++) {
1846
- const h = (Ie(i + (n - i) * l / a) - o) / (u - o);
1847
- p.push(h);
1846
+ const p = (Ie(i + (n - i) * l / a) - o) / (u - o);
1847
+ h.push(p);
1848
1848
  }
1849
- return p.push(1), p.map((l) => this.eval(l));
1849
+ return h.push(1), h.map((l) => this.eval(l));
1850
1850
  }
1851
1851
  }
1852
1852
  class jt {
@@ -1897,16 +1897,16 @@ class jt {
1897
1897
  val: T
1898
1898
  }), u += T;
1899
1899
  }
1900
- const p = 0.5 * u / n, l = Math.ceil(p), h = [{ x: this.c[0], y: this.c[1] }];
1900
+ const h = 0.5 * u / n, l = Math.ceil(h), p = [{ x: this.c[0], y: this.c[1] }];
1901
1901
  let v = 0, m = 0;
1902
1902
  for (let d = 1; d < l; d++) {
1903
1903
  const g = u * d / l;
1904
1904
  for (; v + o[m].val < g; )
1905
1905
  v += o[m].val, m++;
1906
1906
  const A = o[m].a0, b = o[m].a2, w = Ie(A), R = Ie(b), O = A + (b - A) * (g - v) / o[m].val, F = (Ie(O) - w) / (R - w);
1907
- h.push(o[m].quad.eval(F));
1907
+ p.push(o[m].quad.eval(F));
1908
1908
  }
1909
- return h.push({ x: this.c[6], y: this.c[7] }), h;
1909
+ return p.push({ x: this.c[6], y: this.c[7] }), p;
1910
1910
  }
1911
1911
  }
1912
1912
  const pa = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, ha = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, tr = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
@@ -2031,8 +2031,8 @@ function Qe(t, {
2031
2031
  selectors: [],
2032
2032
  iiifRenderingHints: i
2033
2033
  });
2034
- const h = Jr(l);
2035
- h && (n = h.points, u = h.shapeType, s = [
2034
+ const p = Jr(l);
2035
+ p && (n = p.points, u = p.shapeType, s = [
2036
2036
  Math.min(...n.map((v) => v[0])),
2037
2037
  // llx
2038
2038
  Math.min(...n.map((v) => v[1])),
@@ -2041,9 +2041,9 @@ function Qe(t, {
2041
2041
  // urx
2042
2042
  Math.max(...n.map((v) => v[1]))
2043
2043
  // ury
2044
- ], { style: a, svg: o } = va(h.element) ?? { svg: o });
2044
+ ], { style: a, svg: o } = va(p.element) ?? { svg: o });
2045
2045
  }
2046
- const p = {
2046
+ const h = {
2047
2047
  type: "SvgSelector",
2048
2048
  svg: o,
2049
2049
  svgShape: u,
@@ -2052,8 +2052,8 @@ function Qe(t, {
2052
2052
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2053
2053
  };
2054
2054
  return ee({
2055
- selector: p,
2056
- selectors: [p],
2055
+ selector: h,
2056
+ selectors: [h],
2057
2057
  iiifRenderingHints: i
2058
2058
  });
2059
2059
  }
@@ -2113,8 +2113,8 @@ function Jr(t) {
2113
2113
  continue;
2114
2114
  const o = [];
2115
2115
  for (let u = 0; u <= 360; u += 12) {
2116
- const p = Math.tan(u / 360 * Math.PI), l = s * (1 - p ** 2) / (1 + p ** 2), h = a * 2 * p / (1 + p ** 2);
2117
- o.push([i + l, n + h]);
2116
+ const h = Math.tan(u / 360 * Math.PI), l = s * (1 - h ** 2) / (1 + h ** 2), p = a * 2 * h / (1 + h ** 2);
2117
+ o.push([i + l, n + p]);
2118
2118
  }
2119
2119
  return { element: r, points: o, shapeType: "ellipse" };
2120
2120
  }
@@ -2310,24 +2310,24 @@ function Ce(t, e = {}) {
2310
2310
  }
2311
2311
  function Kr(t = {}, e = []) {
2312
2312
  const { id: r, selector: i } = t, n = Ee(), s = W(), a = r || n.annotation, o = Y(
2313
- (p) => a ? p.iiif.entities.Annotation[a] : void 0,
2313
+ (h) => a ? h.iiif.entities.Annotation[a] : void 0,
2314
2314
  [a]
2315
2315
  ), u = Y(
2316
- (p) => o && o.body ? o.body.map((l) => l ? l.type === "SpecificResource" ? {
2316
+ (h) => o && o.body ? o.body.map((l) => l ? l.type === "SpecificResource" ? {
2317
2317
  ...l,
2318
2318
  source: s.get(l)
2319
- } : l ? p.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2319
+ } : l ? h.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
2320
2320
  [o]
2321
2321
  );
2322
2322
  return j(() => {
2323
2323
  if (!o)
2324
2324
  return;
2325
- const p = {
2325
+ const h = {
2326
2326
  ...o,
2327
2327
  body: u,
2328
2328
  target: Ce(o.target, { typeMap: s.getState().iiif.mapping })
2329
2329
  };
2330
- return i ? i(p) : p;
2330
+ return i ? i(h) : h;
2331
2331
  }, [o, i, u, ...e]);
2332
2332
  }
2333
2333
  const Zr = ({
@@ -2336,14 +2336,14 @@ const Zr = ({
2336
2336
  className: r,
2337
2337
  interactive: i
2338
2338
  }) => {
2339
- const n = Kr({ id: t }), s = Xe(n, "atlas"), a = Xe(n, "html"), o = zr(n, ["atlas"]), u = me(), p = j(() => Xi(e, s), [e, s]);
2339
+ const n = Kr({ id: t }), s = Xe(n, "atlas"), a = Xe(n, "html"), o = zr(n, ["atlas"]), u = me(), h = j(() => Xi(e, s), [e, s]);
2340
2340
  return u && n && n.target && n.target.selector && n.target.selector.type === "BoxSelector" && n.target.source && (n.target.source.id === u.id || n.target.source === u.id) ? /* @__PURE__ */ x(
2341
2341
  en,
2342
2342
  {
2343
2343
  id: n.id,
2344
2344
  isEditing: !0,
2345
2345
  region: n.target.selector.spatial,
2346
- style: p,
2346
+ style: h,
2347
2347
  className: (a == null ? void 0 : a.className) || r,
2348
2348
  interactive: !!(a != null && a.href || i),
2349
2349
  href: (a == null ? void 0 : a.href) || null,
@@ -2391,9 +2391,9 @@ function Xr({
2391
2391
  children: a,
2392
2392
  selector: o,
2393
2393
  onClick: u,
2394
- enableSizes: p
2394
+ enableSizes: h
2395
2395
  }) {
2396
- var h, v;
2396
+ var p, v;
2397
2397
  const l = j(() => {
2398
2398
  if (!(!o || o.spatial.x === 0 && o.spatial.y === 0))
2399
2399
  return o.spatial;
@@ -2417,10 +2417,10 @@ function Xr({
2417
2417
  imageService: e.service,
2418
2418
  thumbnail: r && r.type === "fixed" ? r : void 0
2419
2419
  },
2420
- enableSizes: p,
2420
+ enableSizes: h,
2421
2421
  x: 0,
2422
2422
  y: 0,
2423
- width: (h = e.target) == null ? void 0 : h.spatial.width,
2423
+ width: (p = e.target) == null ? void 0 : p.spatial.width,
2424
2424
  height: (v = e.target) == null ? void 0 : v.spatial.height,
2425
2425
  crop: l
2426
2426
  }
@@ -2452,8 +2452,8 @@ var Aa = Object.defineProperty, xa = (t, e, r) => e in t ? Aa(t, e, { enumerable
2452
2452
  try {
2453
2453
  for (var o = e[Symbol.iterator](), u; !(n = (u = o.next()).done) && (i.push(u.value), !(r && i.length === r)); n = !0)
2454
2454
  ;
2455
- } catch (p) {
2456
- s = !0, a = p;
2455
+ } catch (h) {
2456
+ s = !0, a = h;
2457
2457
  } finally {
2458
2458
  try {
2459
2459
  !n && o.return && o.return();
@@ -2474,9 +2474,9 @@ var Aa = Object.defineProperty, xa = (t, e, r) => e in t ? Aa(t, e, { enumerable
2474
2474
  }(), De = Math.PI * 2, yt = function(t, e, r, i, n, s, a) {
2475
2475
  var o = t.x, u = t.y;
2476
2476
  o *= e, u *= r;
2477
- var p = i * o - n * u, l = n * o + i * u;
2477
+ var h = i * o - n * u, l = n * o + i * u;
2478
2478
  return {
2479
- x: p + s,
2479
+ x: h + s,
2480
2480
  y: l + a
2481
2481
  };
2482
2482
  }, Sa = function(t, e) {
@@ -2494,13 +2494,13 @@ var Aa = Object.defineProperty, xa = (t, e, r) => e in t ? Aa(t, e, { enumerable
2494
2494
  }, rr = function(t, e, r, i) {
2495
2495
  var n = t * i - e * r < 0 ? -1 : 1, s = t * r + e * i;
2496
2496
  return s > 1 && (s = 1), s < -1 && (s = -1), n * Math.acos(s);
2497
- }, Ma = function(t, e, r, i, n, s, a, o, u, p, l, h) {
2498
- var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(h, 2), A = v * m - v * g - m * d;
2497
+ }, Ma = function(t, e, r, i, n, s, a, o, u, h, l, p) {
2498
+ var v = Math.pow(n, 2), m = Math.pow(s, 2), d = Math.pow(l, 2), g = Math.pow(p, 2), A = v * m - v * g - m * d;
2499
2499
  A < 0 && (A = 0), A /= v * g + m * d, A = Math.sqrt(A) * (a === o ? -1 : 1);
2500
- var b = A * n / s * h, w = A * -s / n * l, R = p * b - u * w + (t + r) / 2, O = u * b + p * w + (e + i) / 2, F = (l - b) / n, T = (h - w) / s, P = (-l - b) / n, E = (-h - w) / s, M = rr(1, 0, F, T), $ = rr(F, T, P, E);
2500
+ var b = A * n / s * p, w = A * -s / n * l, R = h * b - u * w + (t + r) / 2, O = u * b + h * w + (e + i) / 2, F = (l - b) / n, T = (p - w) / s, P = (-l - b) / n, E = (-p - w) / s, M = rr(1, 0, F, T), $ = rr(F, T, P, E);
2501
2501
  return o === 0 && $ > 0 && ($ -= De), o === 1 && $ < 0 && ($ += De), [R, O, M, $];
2502
2502
  }, Ca = function(t) {
2503
- var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, p = t.largeArcFlag, l = p === void 0 ? 0 : p, h = t.sweepFlag, v = h === void 0 ? 0 : h, m = [];
2503
+ var e = t.px, r = t.py, i = t.cx, n = t.cy, s = t.rx, a = t.ry, o = t.xAxisRotation, u = o === void 0 ? 0 : o, h = t.largeArcFlag, l = h === void 0 ? 0 : h, p = t.sweepFlag, v = p === void 0 ? 0 : p, m = [];
2504
2504
  if (s === 0 || a === 0)
2505
2505
  return [];
2506
2506
  var d = Math.sin(u * De / 360), g = Math.cos(u * De / 360), A = g * (e - i) / 2 + d * (r - n) / 2, b = -d * (e - i) / 2 + g * (r - n) / 2;
@@ -2586,7 +2586,7 @@ function Fa(t) {
2586
2586
  const ja = /* @__PURE__ */ ei(La);
2587
2587
  function $a(t) {
2588
2588
  const e = Pa(t), r = ja(e);
2589
- let i, n = 0, s = 0, a = 0, o = 0, u, p, l = 0, h = 0;
2589
+ let i, n = 0, s = 0, a = 0, o = 0, u, h, l = 0, p = 0;
2590
2590
  const v = [];
2591
2591
  for (let m = 0; m < r.length; m++) {
2592
2592
  let d = r[m];
@@ -2603,21 +2603,21 @@ function $a(t) {
2603
2603
  break;
2604
2604
  case "S":
2605
2605
  {
2606
- let A = l, b = h;
2606
+ let A = l, b = p;
2607
2607
  (i === "C" || i == "S") && (A += A - a, b += b - o), d = ["C", A, b, d[1], d[2], d[3], d[4]];
2608
2608
  }
2609
2609
  break;
2610
2610
  case "T":
2611
- i === "Q" || i == "T" ? (u = l * 2 - u, p = h * 2 - p) : (u = l, p = h), d = ["Q", u, p, d[1], d[2]];
2611
+ i === "Q" || i == "T" ? (u = l * 2 - u, h = p * 2 - h) : (u = l, h = p), d = ["Q", u, h, d[1], d[2]];
2612
2612
  break;
2613
2613
  case "Q":
2614
- u = d[1], p = d[2];
2614
+ u = d[1], h = d[2];
2615
2615
  break;
2616
2616
  case "A":
2617
2617
  {
2618
2618
  const A = Ca({
2619
2619
  px: l,
2620
- py: h,
2620
+ py: p,
2621
2621
  cx: d[6],
2622
2622
  cy: d[7],
2623
2623
  rx: d[1],
@@ -2637,7 +2637,7 @@ function $a(t) {
2637
2637
  d = ["L", n, s];
2638
2638
  break;
2639
2639
  }
2640
- i = g, l = d[d.length - 2], h = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = h), v.push(d);
2640
+ i = g, l = d[d.length - 2], p = d[d.length - 1], ["C", "Q", "A"].indexOf(g) > -1 ? (a = d[d.length - 4], o = d[d.length - 3]) : (a = l, o = p), v.push(d);
2641
2641
  }
2642
2642
  return v;
2643
2643
  }
@@ -2701,16 +2701,16 @@ class ti {
2701
2701
  };
2702
2702
  }
2703
2703
  mapToBasic() {
2704
- const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, p = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, h = (s - e) * u - (a - r) * o, v = p / h, m = l / h, d = Math.abs(h) / (Math.hypot(o, u) * Math.abs(m - v));
2705
- return { x0: e, x2: s, scale: d, cross: h };
2704
+ const { x: e, y: r } = this.start, { x: i, y: n } = this.control, { x: s, y: a } = this.end, o = 2 * i - e - s, u = 2 * n - r - a, h = (i - e) * o + (n - r) * u, l = (s - i) * o + (a - n) * u, p = (s - e) * u - (a - r) * o, v = h / p, m = l / p, d = Math.abs(p) / (Math.hypot(o, u) * Math.abs(m - v));
2705
+ return { x0: e, x2: s, scale: d, cross: p };
2706
2706
  }
2707
2707
  subdivide(e) {
2708
- const r = this.mapToBasic(), i = qe(r.x0), n = qe(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = ke(i), u = ke(n), p = [0];
2708
+ const r = this.mapToBasic(), i = qe(r.x0), n = qe(r.x2), s = 0.5 * Math.abs(n - i) * Math.sqrt(r.scale / e), a = Math.ceil(s), o = ke(i), u = ke(n), h = [0];
2709
2709
  for (let l = 1; l < a; l++) {
2710
- const h = (ke(i + (n - i) * l / a) - o) / (u - o);
2711
- p.push(h);
2710
+ const p = (ke(i + (n - i) * l / a) - o) / (u - o);
2711
+ h.push(p);
2712
2712
  }
2713
- return p.push(1), p.map((l) => this.eval(l));
2713
+ return h.push(1), h.map((l) => this.eval(l));
2714
2714
  }
2715
2715
  }
2716
2716
  class $t {
@@ -2761,16 +2761,16 @@ class $t {
2761
2761
  val: T
2762
2762
  }), u += T;
2763
2763
  }
2764
- const p = 0.5 * u / n, l = Math.ceil(p), h = [{ x: this.c[0], y: this.c[1] }];
2764
+ const h = 0.5 * u / n, l = Math.ceil(h), p = [{ x: this.c[0], y: this.c[1] }];
2765
2765
  let v = 0, m = 0;
2766
2766
  for (let d = 1; d < l; d++) {
2767
2767
  const g = u * d / l;
2768
2768
  for (; v + o[m].val < g; )
2769
2769
  v += o[m].val, m++;
2770
2770
  const A = o[m].a0, b = o[m].a2, w = ke(A), R = ke(b), O = A + (b - A) * (g - v) / o[m].val, F = (ke(O) - w) / (R - w);
2771
- h.push(o[m].quad.eval(F));
2771
+ p.push(o[m].quad.eval(F));
2772
2772
  }
2773
- return h.push({ x: this.c[6], y: this.c[7] }), h;
2773
+ return p.push({ x: this.c[6], y: this.c[7] }), p;
2774
2774
  }
2775
2775
  }
2776
2776
  const Ua = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/, Va = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/, ir = /^rgba\((\d+),(\d+),(\d+),([0-9.]+)\)$/;
@@ -2895,8 +2895,8 @@ function Ge(t, {
2895
2895
  selectors: [],
2896
2896
  iiifRenderingHints: i
2897
2897
  });
2898
- const h = ri(l);
2899
- h && (n = h.points, u = h.shapeType, s = [
2898
+ const p = ri(l);
2899
+ p && (n = p.points, u = p.shapeType, s = [
2900
2900
  Math.min(...n.map((v) => v[0])),
2901
2901
  // llx
2902
2902
  Math.min(...n.map((v) => v[1])),
@@ -2905,9 +2905,9 @@ function Ge(t, {
2905
2905
  // urx
2906
2906
  Math.max(...n.map((v) => v[1]))
2907
2907
  // ury
2908
- ], { style: a, svg: o } = Ba(h.element) ?? { svg: o });
2908
+ ], { style: a, svg: o } = Ba(p.element) ?? { svg: o });
2909
2909
  }
2910
- const p = {
2910
+ const h = {
2911
2911
  type: "SvgSelector",
2912
2912
  svg: o,
2913
2913
  svgShape: u,
@@ -2916,8 +2916,8 @@ function Ge(t, {
2916
2916
  spatial: s ? { unit: "pixel", x: s[0], y: s[1], width: s[2] - s[0], height: s[3] - s[1] } : void 0
2917
2917
  };
2918
2918
  return te({
2919
- selector: p,
2920
- selectors: [p],
2919
+ selector: h,
2920
+ selectors: [h],
2921
2921
  iiifRenderingHints: i
2922
2922
  });
2923
2923
  }
@@ -2977,8 +2977,8 @@ function ri(t) {
2977
2977
  continue;
2978
2978
  const o = [];
2979
2979
  for (let u = 0; u <= 360; u += 12) {
2980
- const p = Math.tan(u / 360 * Math.PI), l = s * (1 - p ** 2) / (1 + p ** 2), h = a * 2 * p / (1 + p ** 2);
2981
- o.push([i + l, n + h]);
2980
+ const h = Math.tan(u / 360 * Math.PI), l = s * (1 - h ** 2) / (1 + h ** 2), p = a * 2 * h / (1 + h ** 2);
2981
+ o.push([i + l, n + p]);
2982
2982
  }
2983
2983
  return { element: r, points: o, shapeType: "ellipse" };
2984
2984
  }
@@ -3931,7 +3931,7 @@ var cr = { exports: {} };
3931
3931
  (function(s, a) {
3932
3932
  a(e);
3933
3933
  })(Ra, function(s) {
3934
- const a = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", o = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", u = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", p = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", l = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", h = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", v = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", m = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", d = "http://iiif.io/api/image/1/level1.json", g = "http://iiif.io/api/image/1/profiles/level1.json", A = "http://iiif.io/api/image/1/level2.json", b = "http://iiif.io/api/image/1/profiles/level2.json", w = "http://iiif.io/api/image/2/level1.json", R = "http://iiif.io/api/image/2/profiles/level1.json", O = "http://iiif.io/api/image/2/level2.json", F = "http://iiif.io/api/image/2/profiles/level2.json", T = "level1", P = "level2", E = "http://iiif.io/api/image/2/level1", M = "http://iiif.io/api/image/2/level2", $ = [E, M, a, o, u, p, l, h, v, m, d, g, A, b, w, R, O, F, T, P], ie = ["http://iiif.io/api/image/2/level0", E, M, "http://library.stanford.edu/iiif/image-api/compliance.html#level0", a, o, "http://library.stanford.edu/iiif/image-api/conformance.html#level0", u, p, "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", l, h, "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", v, m, "http://iiif.io/api/image/1/level0.json", "http://iiif.io/api/image/1/profiles/level0.json", d, g, A, b, "http://iiif.io/api/image/2/level0.json", "http://iiif.io/api/image/2/profiles/level0.json", w, R, O, F, "level0", T, P], K = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
3934
+ const a = "http://library.stanford.edu/iiif/image-api/compliance.html#level1", o = "http://library.stanford.edu/iiif/image-api/compliance.html#level2", u = "http://library.stanford.edu/iiif/image-api/conformance.html#level1", h = "http://library.stanford.edu/iiif/image-api/conformance.html#level2", l = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1", p = "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2", v = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1", m = "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2", d = "http://iiif.io/api/image/1/level1.json", g = "http://iiif.io/api/image/1/profiles/level1.json", A = "http://iiif.io/api/image/1/level2.json", b = "http://iiif.io/api/image/1/profiles/level2.json", w = "http://iiif.io/api/image/2/level1.json", R = "http://iiif.io/api/image/2/profiles/level1.json", O = "http://iiif.io/api/image/2/level2.json", F = "http://iiif.io/api/image/2/profiles/level2.json", T = "level1", P = "level2", E = "http://iiif.io/api/image/2/level1", M = "http://iiif.io/api/image/2/level2", $ = [E, M, a, o, u, h, l, p, v, m, d, g, A, b, w, R, O, F, T, P], ie = ["http://iiif.io/api/image/2/level0", E, M, "http://library.stanford.edu/iiif/image-api/compliance.html#level0", a, o, "http://library.stanford.edu/iiif/image-api/conformance.html#level0", u, h, "http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0", l, p, "http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0", v, m, "http://iiif.io/api/image/1/level0.json", "http://iiif.io/api/image/1/profiles/level0.json", d, g, A, b, "http://iiif.io/api/image/2/level0.json", "http://iiif.io/api/image/2/profiles/level0.json", w, R, O, F, "level0", T, P], K = ["sc:Collection", "sc:Manifest", "sc:Canvas", "sc:AnnotationList", "oa:Annotation", "sc:Range", "sc:Layer", "sc:Sequence", "oa:Choice", "Service", "ContentResource"];
3935
3935
  class U {
3936
3936
  constructor(c, y = {}) {
3937
3937
  n(this, "traversals"), n(this, "options"), this.traversals = { collection: [], manifest: [], canvas: [], annotationList: [], sequence: [], annotation: [], contentResource: [], choice: [], range: [], service: [], layer: [], ...c }, this.options = { convertPropsToArray: !0, mergeMemberProperties: !0, allowUndefinedReturn: !1, ...y };
@@ -4419,19 +4419,19 @@ function qo(t, e = {}) {
4419
4419
  (l) => {
4420
4420
  t && r.setMetaValue(
4421
4421
  [l, "annotationPageManager", "views"],
4422
- (h) => h && !h[t] ? h : {
4423
- ...h || {},
4422
+ (p) => p && !p[t] ? p : {
4423
+ ...p || {},
4424
4424
  [t]: !1
4425
4425
  }
4426
4426
  );
4427
4427
  },
4428
4428
  [t, r]
4429
- ), p = D(
4430
- (l, h = {}) => {
4429
+ ), h = D(
4430
+ (l, p = {}) => {
4431
4431
  if (!t)
4432
4432
  return;
4433
4433
  const v = r.getState(), m = [];
4434
- if (h != null && h.deselectOthers) {
4434
+ if (p != null && p.deselectOthers) {
4435
4435
  const d = Object.keys(v.iiif.entities.AnnotationPage);
4436
4436
  for (const g of d) {
4437
4437
  const A = Do(v, g);
@@ -4453,7 +4453,7 @@ function qo(t, e = {}) {
4453
4453
  return {
4454
4454
  availablePageIds: a,
4455
4455
  enabledPageIds: o,
4456
- setPageEnabled: p,
4456
+ setPageEnabled: h,
4457
4457
  setPageDisabled: u
4458
4458
  };
4459
4459
  }
@@ -4471,13 +4471,13 @@ function Vo() {
4471
4471
  }, []), [D(
4472
4472
  (s, { height: a, width: o }) => {
4473
4473
  if (s) {
4474
- const u = s.id || s["@id"], p = t.loadServiceSync({
4474
+ const u = s.id || s["@id"], h = t.loadServiceSync({
4475
4475
  id: u,
4476
4476
  width: s.width || o,
4477
4477
  height: s.height || a,
4478
4478
  source: s
4479
4479
  });
4480
- p ? s = p : e[u] || (i.current || r((l) => ({
4480
+ h ? s = h : e[u] || (i.current || r((l) => ({
4481
4481
  ...l,
4482
4482
  [u]: "loading"
4483
4483
  })), t.loadService({
@@ -4548,12 +4548,12 @@ function Bo(t = Ti) {
4548
4548
  function r(n, s = []) {
4549
4549
  const a = Array.isArray(n) ? n : e(n), o = [];
4550
4550
  let u = null;
4551
- const p = [];
4551
+ const h = [];
4552
4552
  for (const l of a) {
4553
4553
  if (l.type !== "Annotation")
4554
4554
  throw new Error("getPaintables() accept either a canvas or list of annotations");
4555
- const h = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4556
- for (const v of h) {
4555
+ const p = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
4556
+ for (const v of p) {
4557
4557
  const [m, { selector: d }] = Ho(v), g = t.get(m), A = (g.type || "unknown").toLowerCase();
4558
4558
  if (A === "choice") {
4559
4559
  const b = t.get(g.items, { parent: g.id }), w = s.length ? s.map((R) => b.find((O) => O.id === R)).filter(Boolean) : [b[0]];
@@ -4565,10 +4565,10 @@ function Bo(t = Ti) {
4565
4565
  selected: w.indexOf(R) !== -1
4566
4566
  })),
4567
4567
  label: m.label
4568
- }, h.push(...w);
4568
+ }, p.push(...w);
4569
4569
  continue;
4570
4570
  }
4571
- o.indexOf(A) === -1 && o.push(A), p.push({
4571
+ o.indexOf(A) === -1 && o.push(A), h.push({
4572
4572
  type: A,
4573
4573
  annotationId: l.id,
4574
4574
  resource: g,
@@ -4579,7 +4579,7 @@ function Bo(t = Ti) {
4579
4579
  }
4580
4580
  return {
4581
4581
  types: o,
4582
- items: p,
4582
+ items: h,
4583
4583
  choice: u
4584
4584
  };
4585
4585
  }
@@ -4597,8 +4597,8 @@ function zo(t, e = []) {
4597
4597
  const r = W(), i = j(() => Bo(r), []), n = No({ enableSingleAnnotation: t == null ? void 0 : t.enableSingleAnnotation }), [s, a] = J((t == null ? void 0 : t.defaultChoices) || []), o = j(
4598
4598
  () => i.getPaintables(n, s),
4599
4599
  [r, n, s, ...e]
4600
- ), p = { makeChoice: D(
4601
- (l, { deselectOthers: h = !0, deselect: v = !1 } = {}) => {
4600
+ ), h = { makeChoice: D(
4601
+ (l, { deselectOthers: p = !0, deselect: v = !1 } = {}) => {
4602
4602
  if (o.choice) {
4603
4603
  if (o.choice.type !== "single-choice")
4604
4604
  throw new Error("Complex choice not supported yet");
@@ -4611,7 +4611,7 @@ function zo(t, e = []) {
4611
4611
  }
4612
4612
  return g;
4613
4613
  }
4614
- if (h)
4614
+ if (p)
4615
4615
  return [l];
4616
4616
  const d = [...m];
4617
4617
  if (d.length === 0 && o.items.length) {
@@ -4624,9 +4624,52 @@ function zo(t, e = []) {
4624
4624
  },
4625
4625
  [o.choice]
4626
4626
  ) };
4627
- return [o, p];
4627
+ return [o, h];
4628
+ }
4629
+ const Wo = ["model/gltf-binary"];
4630
+ function Qo(t, e) {
4631
+ const i = e.items[0].resource;
4632
+ return i.format ? Wo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4633
+ type: "3d-model",
4634
+ model: i
4635
+ } : _("Unknown format");
4628
4636
  }
4629
- function Wo(t, e, r) {
4637
+ function Yo(t, e) {
4638
+ var i;
4639
+ if (!t.duration)
4640
+ return _("No duration on canvas");
4641
+ if (e.items.length > 1)
4642
+ return _("Only one audio source supported");
4643
+ const r = (i = e.items[0]) == null ? void 0 : i.resource;
4644
+ return r ? r.format ? {
4645
+ type: "media",
4646
+ media: {
4647
+ annotationId: e.items[0].annotationId,
4648
+ duration: t.duration,
4649
+ url: r.id,
4650
+ type: "Sound",
4651
+ target: {
4652
+ type: "TemporalSelector",
4653
+ temporal: {
4654
+ startTime: 0,
4655
+ endTime: t.duration
4656
+ }
4657
+ },
4658
+ format: r.format,
4659
+ selector: {
4660
+ type: "TemporalSelector",
4661
+ temporal: {
4662
+ startTime: 0,
4663
+ endTime: t.duration
4664
+ }
4665
+ }
4666
+ },
4667
+ annotations: {
4668
+ pages: []
4669
+ }
4670
+ } : _("Audio does not have format") : _("Unknown audio");
4671
+ }
4672
+ function Go(t, e, r) {
4630
4673
  const i = [];
4631
4674
  for (const n of e.items) {
4632
4675
  const s = n.resource && n.resource.type === "SpecificResource" ? n.resource.source : n.resource;
@@ -4645,8 +4688,8 @@ function Wo(t, e, r) {
4645
4688
  width: Number(t.width),
4646
4689
  height: Number(t.height)
4647
4690
  }
4648
- }, [u, p] = Ci(t, n.target);
4649
- if (p.id !== t.id)
4691
+ }, [u, h] = Ci(t, n.target);
4692
+ if (h.id !== t.id)
4650
4693
  continue;
4651
4694
  n.resource.width && n.resource.height && (n.resource.width, n.resource.height);
4652
4695
  let l = n.resource.type === "SpecificResource" ? Ce(n.resource) : null;
@@ -4658,7 +4701,7 @@ function Wo(t, e, r) {
4658
4701
  });
4659
4702
  m && (l = m);
4660
4703
  }
4661
- const h = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4704
+ const p = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
4662
4705
  type: "BoxSelector",
4663
4706
  spatial: {
4664
4707
  x: l.selector.spatial.x,
@@ -4672,12 +4715,12 @@ function Wo(t, e, r) {
4672
4715
  id: s.id,
4673
4716
  type: "Image",
4674
4717
  annotationId: n.annotationId,
4675
- width: Number(u || h ? s.width : t.width),
4676
- height: Number(u || h ? s.height : t.height),
4718
+ width: Number(u || p ? s.width : t.width),
4719
+ height: Number(u || p ? s.height : t.height),
4677
4720
  service: a,
4678
4721
  sizes: a && a.sizes ? a.sizes : s.width && s.height ? [{ width: s.width, height: s.height }] : [],
4679
4722
  target: u && u.type !== "PointSelector" ? u : o,
4680
- selector: h
4723
+ selector: p
4681
4724
  };
4682
4725
  i.push(v);
4683
4726
  }
@@ -4688,51 +4731,34 @@ function Wo(t, e, r) {
4688
4731
  choice: e.choice
4689
4732
  };
4690
4733
  }
4691
- const Qo = ["model/gltf-binary"];
4692
- function Yo(t, e) {
4693
- const i = e.items[0].resource;
4694
- return i.format ? Qo.indexOf(i.format) === -1 ? _(`3D format: ${i.format} is unsupported`) : {
4695
- type: "3d-model",
4696
- model: i
4697
- } : _("Unknown format");
4734
+ function Ii(t, e = {}, r) {
4735
+ const i = t.language || r || "none";
4736
+ switch (t.type) {
4737
+ case "TextualBody": {
4738
+ typeof t.value < "u" && (e[i] = t.value);
4739
+ break;
4740
+ }
4741
+ case "List":
4742
+ case "Composite":
4743
+ case "Choice":
4744
+ t.items && t.items.forEach((n) => Ii(n, e, i));
4745
+ }
4746
+ return e;
4698
4747
  }
4699
- function Go(t, e) {
4700
- var i;
4701
- if (!t.duration)
4702
- return _("No duration on canvas");
4703
- if (e.items.length > 1)
4704
- return _("Only one audio source supported");
4705
- const r = (i = e.items[0]) == null ? void 0 : i.resource;
4706
- return r ? r.format ? {
4707
- type: "media",
4708
- media: {
4709
- annotationId: e.items[0].annotationId,
4710
- duration: t.duration,
4711
- url: r.id,
4712
- type: "Sound",
4713
- target: {
4714
- type: "TemporalSelector",
4715
- temporal: {
4716
- startTime: 0,
4717
- endTime: t.duration
4718
- }
4719
- },
4720
- format: r.format,
4721
- selector: {
4722
- type: "TemporalSelector",
4723
- temporal: {
4724
- startTime: 0,
4725
- endTime: t.duration
4726
- }
4727
- }
4728
- },
4729
- annotations: {
4730
- pages: []
4748
+ function Jo(t, e) {
4749
+ const r = [];
4750
+ return e.items.forEach((i) => {
4751
+ if (i.resource) {
4752
+ const [n] = Ci(t, i.target);
4753
+ r.push({ annotationId: i.annotationId, text: Ii(i.resource), target: n });
4731
4754
  }
4732
- } : _("Audio does not have format") : _("Unknown audio");
4755
+ }), {
4756
+ type: "textual-content",
4757
+ items: r
4758
+ };
4733
4759
  }
4734
- const Jo = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4735
- function Ko(t, e) {
4760
+ const Ko = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
4761
+ function Zo(t, e) {
4736
4762
  var a;
4737
4763
  const r = e.items.filter((o) => o.type === "video");
4738
4764
  if (!t.duration)
@@ -4770,7 +4796,7 @@ function Ko(t, e) {
4770
4796
  };
4771
4797
  if (n) {
4772
4798
  s.type = "VideoYouTube";
4773
- const o = i.id.match(Jo);
4799
+ const o = i.id.match(Ko);
4774
4800
  if (!o[1])
4775
4801
  return _("Video is not known youtube video");
4776
4802
  s.youTubeId = o[1];
@@ -4783,33 +4809,20 @@ function Ko(t, e) {
4783
4809
  }
4784
4810
  };
4785
4811
  }
4786
- function Ii(t, e = {}, r) {
4787
- const i = t.language || r || "none";
4788
- switch (t.type) {
4789
- case "TextualBody": {
4790
- typeof t.value < "u" && (e[i] = t.value);
4791
- break;
4792
- }
4793
- case "List":
4794
- case "Composite":
4795
- case "Choice":
4796
- t.items && t.items.forEach((n) => Ii(n, e, i));
4797
- }
4798
- return e;
4799
- }
4800
- function Zo(t, e) {
4801
- const r = [];
4802
- return e.items.forEach((i) => {
4803
- if (i.resource) {
4804
- const [n] = Ci(t, i.target);
4805
- r.push({ annotationId: i.annotationId, text: Ii(i.resource), target: n });
4806
- }
4807
- }), {
4808
- type: "textual-content",
4809
- items: r
4810
- };
4811
- }
4812
- function Xo(t) {
4812
+ function Xo({ canvas: t, paintables: e, supports: r, loadImageService: i }) {
4813
+ if (!t)
4814
+ return console.log("No canvas"), gt;
4815
+ if (e.types.length === 0)
4816
+ return r.indexOf("empty") !== -1 ? Lo(t.width, t.height) : (console.log("No paintables"), gt);
4817
+ if (e.types.length !== 1)
4818
+ if (e.types.length === 2 && e.types.indexOf("text") !== -1)
4819
+ e.types = e.types.filter((s) => s !== "text");
4820
+ else
4821
+ return r.indexOf("complex-timeline") === -1 ? _("Complex timeline not supported") : _("ComplexTimelineStrategy not yet supported");
4822
+ const n = e.types[0];
4823
+ return n === "image" ? r.indexOf("images") === -1 ? _("Image not supported") : Go(t, e, i) : n === "Model" || n === "model" ? r.indexOf("3d-model") === -1 ? _("3D not supported") : Qo(t, e) : n === "textualbody" ? r.indexOf("textual-content") === -1 ? _("Textual content not supported") : Jo(t, e) : n === "sound" || n === "audio" ? r.indexOf("media") === -1 ? _("Media not supported") : Yo(t, e) : n === "video" ? r.indexOf("media") === -1 ? _("Media not supported") : Zo(t, e) : gt;
4824
+ }
4825
+ function ec(t) {
4813
4826
  const e = Pe(), r = me(), i = W(), [n, s] = Vo(), { enabledPageIds: a } = qo((t == null ? void 0 : t.annotationPageManagerId) || (e == null ? void 0 : e.id) || (r == null ? void 0 : r.id), {
4814
4827
  all: !1
4815
4828
  }), o = _o(a, "AnnotationPage"), u = (t == null ? void 0 : t.strategies) || [
@@ -4818,28 +4831,16 @@ function Xo(t) {
4818
4831
  "media",
4819
4832
  "textual-content",
4820
4833
  "complex-timeline"
4821
- ], [p, l] = zo(t, [s]), h = j(() => {
4822
- if (!r)
4823
- return console.log("No canvas"), gt;
4824
- if (p.types.length === 0)
4825
- return u.indexOf("empty") !== -1 ? Lo(r.width, r.height) : (console.log("No paintables"), gt);
4826
- if (p.types.length !== 1)
4827
- if (p.types.length === 2 && p.types.indexOf("text") !== -1)
4828
- p.types = p.types.filter((m) => m !== "text");
4829
- else
4830
- return u.indexOf("complex-timeline") === -1 ? _("Complex timeline not supported") : _("ComplexTimelineStrategy not yet supported");
4831
- const v = p.types[0];
4832
- return v === "image" ? u.indexOf("images") === -1 ? _("Image not supported") : Wo(r, p, n) : v === "Model" || v === "model" ? u.indexOf("3d-model") === -1 ? _("3D not supported") : Yo(r, p) : v === "textualbody" ? u.indexOf("textual-content") === -1 ? _("Textual content not supported") : Zo(r, p) : v === "sound" || v === "audio" ? u.indexOf("media") === -1 ? _("Media not supported") : Go(r, p) : v === "video" ? u.indexOf("media") === -1 ? _("Media not supported") : Ko(r, p) : (console.log("No idea"), gt);
4833
- }, [r, p, i, l.makeChoice]);
4834
- return j(() => h.type === "unknown" ? [h, Po] : [
4834
+ ], [h, l] = zo(t, [s]), p = j(() => Xo({ canvas: r, paintables: h, supports: u, loadImageService: n }), [r, h, i, l.makeChoice]);
4835
+ return j(() => p.type === "unknown" ? [p, Po] : [
4835
4836
  {
4836
- ...h,
4837
+ ...p,
4837
4838
  annotations: { pages: o }
4838
4839
  },
4839
4840
  l
4840
- ], [h, o]);
4841
+ ], [p, o]);
4841
4842
  }
4842
- const ec = (t, e = []) => {
4843
+ const tc = (t, e = []) => {
4843
4844
  const r = W();
4844
4845
  re(() => {
4845
4846
  t(r);
@@ -4863,52 +4864,52 @@ const ec = (t, e = []) => {
4863
4864
  if (r)
4864
4865
  return e ? r[e] : r;
4865
4866
  }
4866
- }, tc = new hr();
4867
- function rc(t = ki, e = {}) {
4868
- const r = e.imageServiceLoader || tc;
4867
+ }, rc = new hr();
4868
+ function ic(t = ki, e = {}) {
4869
+ const r = e.imageServiceLoader || rc;
4869
4870
  async function i(n, s, a = !1, o = [], u) {
4870
- const p = () => r.getThumbnailFromResource(void 0, s, a, o);
4871
+ const h = () => r.getThumbnailFromResource(void 0, s, a, o);
4871
4872
  if (!n)
4872
4873
  return await r.getThumbnailFromResource(void 0, s, a, o);
4873
4874
  if (typeof n == "string") {
4874
- const h = Bt(n);
4875
- return h && o.push(h), await r.getThumbnailFromResource(void 0, s, a, o);
4875
+ const p = Bt(n);
4876
+ return p && o.push(p), await r.getThumbnailFromResource(void 0, s, a, o);
4876
4877
  }
4877
4878
  const l = t.get(n, { skipSelfReturn: !1 });
4878
4879
  if (typeof l == "string")
4879
4880
  return { best: Bt(l), fallback: [], log: [] };
4880
4881
  if (!l)
4881
- return await p();
4882
- switch (await (async (h) => {
4883
- if (h && h.thumbnail && h.thumbnail.length) {
4884
- const v = t.get(h.thumbnail[0]), m = await r.getImageCandidates(v, a);
4882
+ return await h();
4883
+ switch (await (async (p) => {
4884
+ if (p && p.thumbnail && p.thumbnail.length) {
4885
+ const v = t.get(p.thumbnail[0]), m = await r.getImageCandidates(v, a);
4885
4886
  m && m.length && o.push(...m);
4886
4887
  }
4887
4888
  })(l), l.type) {
4888
4889
  case "Annotation": {
4889
- const h = Array.isArray(l.body) ? l.body : [l.body], v = t.get(h[0]);
4890
+ const p = Array.isArray(l.body) ? l.body : [l.body], v = t.get(p[0]);
4890
4891
  return u && !v.width && (v.width = u.width, v.height = u.height), await r.getThumbnailFromResource(v, s, a, o);
4891
4892
  }
4892
4893
  case "Canvas": {
4893
- const h = l;
4894
- return i(h.items[0], s, a, o, {
4895
- width: h.width,
4896
- height: h.height
4894
+ const p = l;
4895
+ return i(p.items[0], s, a, o, {
4896
+ width: p.width,
4897
+ height: p.height
4897
4898
  });
4898
4899
  }
4899
4900
  case "AnnotationPage":
4900
4901
  return i(l.items[0], s, a, o, u);
4901
4902
  case "Choice": {
4902
- const h = l;
4903
- return !h.items || h.items[0] ? await p() : i(h.items[0], s, a, o, u);
4903
+ const p = l;
4904
+ return !p.items || p.items[0] ? await h() : i(p.items[0], s, a, o, u);
4904
4905
  }
4905
4906
  case "Collection": {
4906
- const h = l.items[0];
4907
- return h ? i(h, s, a, o, u) : await p();
4907
+ const p = l.items[0];
4908
+ return p ? i(p, s, a, o, u) : await h();
4908
4909
  }
4909
4910
  case "Manifest": {
4910
- const h = l.items[0];
4911
- return h ? i(h, s, a, o, u) : await p();
4911
+ const p = l.items[0];
4912
+ return p ? i(p, s, a, o, u) : await h();
4912
4913
  }
4913
4914
  case "SpecificResource":
4914
4915
  case "Image":
@@ -4919,31 +4920,31 @@ function rc(t = ki, e = {}) {
4919
4920
  case "Video":
4920
4921
  return u && !l.width && (l.width = u.width, l.height = u.height), r.getThumbnailFromResource(l, s, a, o);
4921
4922
  }
4922
- return await p();
4923
+ return await h();
4923
4924
  }
4924
4925
  return {
4925
4926
  getBestThumbnailAtSize: i
4926
4927
  };
4927
4928
  }
4928
- function ic(t, e, { canvasId: r, manifestId: i } = {}) {
4929
- const n = W(), s = Ri(), a = j(() => rc(n, { imageServiceLoader: s }), [n, s]), [o, u] = J(), p = Pe(i ? { id: i } : void 0), l = me(r ? { id: r } : void 0), h = l || p, v = ve(!1);
4929
+ function nc(t, e, { canvasId: r, manifestId: i } = {}) {
4930
+ const n = W(), s = Ri(), a = j(() => ic(n, { imageServiceLoader: s }), [n, s]), [o, u] = J(), h = Pe(i ? { id: i } : void 0), l = me(r ? { id: r } : void 0), p = l || h, v = ve(!1);
4930
4931
  if (re(() => (v.current = !1, () => {
4931
4932
  v.current = !0;
4932
- }), []), !h)
4933
+ }), []), !p)
4933
4934
  throw new Error("Must be called under a manifest or canvas context.");
4934
- return ec(
4935
+ return tc(
4935
4936
  (m) => {
4936
- a.getBestThumbnailAtSize(h, t, e).then((d) => {
4937
+ a.getBestThumbnailAtSize(p, t, e).then((d) => {
4937
4938
  d.best && !v.current && u(d.best);
4938
4939
  });
4939
4940
  },
4940
- [h]
4941
+ [p]
4941
4942
  ), o;
4942
4943
  }
4943
- function nc(t) {
4944
+ function sc(t) {
4944
4945
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: t };
4945
4946
  }
4946
- function sc(t, e) {
4947
+ function ac(t, e) {
4947
4948
  switch (e.type) {
4948
4949
  case "FINISHED":
4949
4950
  return { ...t, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -4966,22 +4967,22 @@ function sc(t, e) {
4966
4967
  }
4967
4968
  return t;
4968
4969
  }
4969
- function ac(t) {
4970
+ function oc(t) {
4970
4971
  const e = Math.round(t);
4971
4972
  return `${Math.floor(e / 60)}:${`${e % 60}`.padStart(2, "0")}`;
4972
4973
  }
4973
4974
  function _t(t) {
4974
- const [e, r] = Gi(sc, nc(t.duration)), i = ve(null), n = ve(null), s = ve(null), a = ve(!1), o = D(() => {
4975
- n.current && i.current && (n.current.innerHTML = ac(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / t.duration * 100}%`), a.current !== i.current.muted && (a.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
4975
+ const [e, r] = Gi(ac, sc(t.duration)), i = ve(null), n = ve(null), s = ve(null), a = ve(!1), o = D(() => {
4976
+ n.current && i.current && (n.current.innerHTML = oc(i.current.currentTime), s.current && (s.current.style.width = `${i.current.currentTime / t.duration * 100}%`), a.current !== i.current.muted && (a.current = i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
4976
4977
  }, [t.duration]), u = D(() => {
4977
4978
  i.current && (r({ type: "PLAY_REQUESTED" }), i.current.play().then(() => {
4978
4979
  r({ type: "PLAY" });
4979
4980
  }), o());
4980
- }, [o]), p = D(() => {
4981
+ }, [o]), h = D(() => {
4981
4982
  i.current && (i.current.duration > 0 && i.current.paused ? u() : l());
4982
4983
  }, [o]), l = D(() => {
4983
4984
  i.current && (i.current.pause(), r({ type: "PAUSE" }), o());
4984
- }, [o]), h = D(() => {
4985
+ }, [o]), p = D(() => {
4985
4986
  i.current && (i.current.muted = !i.current.muted, r(i.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
4986
4987
  }, []), v = D(() => {
4987
4988
  i.current && (i.current.muted = !0, r({ type: "MUTE" }));
@@ -5010,17 +5011,17 @@ function _t(t) {
5010
5011
  {
5011
5012
  play: u,
5012
5013
  pause: l,
5013
- playPause: p,
5014
+ playPause: h,
5014
5015
  mute: v,
5015
5016
  unmute: m,
5016
- toggleMute: h,
5017
+ toggleMute: p,
5017
5018
  setVolume: d,
5018
5019
  setDurationPercent: g,
5019
5020
  setTime: A
5020
5021
  }
5021
5022
  ];
5022
5023
  }
5023
- const oc = ce(null), cc = ce(null), uc = ce(null);
5024
+ const cc = ce(null), uc = ce(null), lc = ce(null);
5024
5025
  function Oi({
5025
5026
  actions: t,
5026
5027
  state: e,
@@ -5029,7 +5030,7 @@ function Oi({
5029
5030
  progress: n,
5030
5031
  element: s
5031
5032
  }) {
5032
- return /* @__PURE__ */ x(uc.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(cc.Provider, { value: t, children: /* @__PURE__ */ x(oc.Provider, { value: e, children: r }) }) });
5033
+ return /* @__PURE__ */ x(lc.Provider, { value: { currentTime: i, progress: n, element: s }, children: /* @__PURE__ */ x(uc.Provider, { value: t, children: /* @__PURE__ */ x(cc.Provider, { value: e, children: r }) }) });
5033
5034
  }
5034
5035
  function Ei({ media: t, children: e }) {
5035
5036
  const [{ element: r, currentTime: i, progress: n }, s, a] = _t({ duration: t.duration });
@@ -5145,18 +5146,18 @@ function Di({ style: t }) {
5145
5146
  }
5146
5147
  );
5147
5148
  }
5148
- const lc = ge.createContext("en");
5149
+ const fc = ge.createContext("en");
5149
5150
  function qi() {
5150
- return ge.useContext(lc);
5151
+ return ge.useContext(fc);
5151
5152
  }
5152
5153
  function ur(t) {
5153
5154
  return t.indexOf("-") !== -1 ? t.slice(0, t.indexOf("-")) : t;
5154
5155
  }
5155
- function fc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5156
+ function pc({ as: t, language: e, children: r, viewingDirection: i, ...n }) {
5156
5157
  const s = qi();
5157
5158
  return j(() => ur(s) === ur(e), [s, e]) ? t ? /* @__PURE__ */ x(t, { ...n, children: r }) : /* @__PURE__ */ x("span", { ...n, children: r }) : t ? /* @__PURE__ */ x(t, { ...n, lang: e, dir: i, children: r }) : /* @__PURE__ */ x("span", { ...n, lang: e, dir: i, children: r });
5158
5159
  }
5159
- function pc(t, e, r) {
5160
+ function hc(t, e, r) {
5160
5161
  if (e.length === 0)
5161
5162
  return;
5162
5163
  if (e.length === 1)
@@ -5171,15 +5172,15 @@ function pc(t, e, r) {
5171
5172
  return n;
5172
5173
  return e.indexOf("none") !== -1 ? "none" : e.indexOf("@none") !== -1 ? "@none" : e[0];
5173
5174
  }
5174
- const hc = (t, e = []) => {
5175
+ const dc = (t, e = []) => {
5175
5176
  const r = qi();
5176
5177
  return j(() => {
5177
5178
  const i = t();
5178
- return pc(r, i, []);
5179
+ return hc(r, i, []);
5179
5180
  }, [r, ...e]);
5180
5181
  };
5181
- function dc(t, e) {
5182
- const r = hc(() => Object.keys(t || {}), [t]);
5182
+ function yc(t, e) {
5183
+ const r = dc(() => Object.keys(t || {}), [t]);
5183
5184
  return [
5184
5185
  j(() => {
5185
5186
  if (!t)
@@ -5193,10 +5194,10 @@ function dc(t, e) {
5193
5194
  r
5194
5195
  ];
5195
5196
  }
5196
- const yc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5197
- const [s, a] = dc(i, e);
5197
+ const vc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children: i, ...n }) => {
5198
+ const [s, a] = yc(i, e);
5198
5199
  return a ? /* @__PURE__ */ x(
5199
- fc,
5200
+ pc,
5200
5201
  {
5201
5202
  ...n,
5202
5203
  as: t,
@@ -5219,7 +5220,7 @@ const yc = ({ as: t, defaultText: e, enableDangerouslySetInnerHTML: r, children:
5219
5220
  }
5220
5221
  );
5221
5222
  };
5222
- function vc({
5223
+ function gc({
5223
5224
  element: t,
5224
5225
  media: e,
5225
5226
  playPause: r
@@ -5257,13 +5258,13 @@ function vc({
5257
5258
  )
5258
5259
  ] }) : null;
5259
5260
  }
5260
- function gc({
5261
+ function mc({
5261
5262
  media: t,
5262
5263
  mediaControlsDeps: e,
5263
5264
  children: r
5264
5265
  }) {
5265
5266
  const [{ element: i, currentTime: n, progress: s }, a, o] = _t({ duration: t.duration });
5266
- return Oe("overlay", "video-element", vc, {
5267
+ return Oe("overlay", "video-element", gc, {
5267
5268
  element: i,
5268
5269
  media: t,
5269
5270
  playPause: o.playPause
@@ -5279,9 +5280,9 @@ function _i({
5279
5280
  renderViewerControls: a,
5280
5281
  renderMediaControls: o,
5281
5282
  viewControlsDeps: u,
5282
- mediaControlsDeps: p,
5283
+ mediaControlsDeps: h,
5283
5284
  strategies: l,
5284
- throwOnUnknown: h,
5285
+ throwOnUnknown: p,
5285
5286
  backgroundStyle: v,
5286
5287
  alwaysShowBackground: m,
5287
5288
  keepCanvasScale: d = !1,
@@ -5290,7 +5291,7 @@ function _i({
5290
5291
  onClickPaintingAnnotation: b,
5291
5292
  children: w
5292
5293
  }) {
5293
- const R = me(), O = zr(R, ["deep-zoom"]), [F] = Us(), T = Hs(), P = W(), E = j(() => Qr(P), [P]), [M, $] = Xo({
5294
+ const R = me(), O = zr(R, ["deep-zoom"]), [F] = Us(), T = Hs(), P = W(), E = j(() => Qr(P), [P]), [M, $] = ec({
5294
5295
  strategies: l || ["images"],
5295
5296
  defaultChoices: n == null ? void 0 : n.map(({ id: k }) => k)
5296
5297
  }), ie = M.type === "images" ? M.choice : void 0, K = j(() => d ? 1 : Math.max(
@@ -5320,7 +5321,7 @@ function _i({
5320
5321
  } : {},
5321
5322
  [R, T, M, ...u || []]
5322
5323
  );
5323
- const U = ic({ maxWidth: 256, maxHeight: 256 });
5324
+ const U = nc({ maxWidth: 256, maxHeight: 256 });
5324
5325
  if (!R)
5325
5326
  return null;
5326
5327
  const N = R.accompanyingCanvas, X = U && U.type === "fixed" ? /* @__PURE__ */ x("world-object", { height: R.height, width: R.width, x: t, y: e, children: /* @__PURE__ */ x(
@@ -5338,7 +5339,7 @@ function _i({
5338
5339
  if (M.type === "unknown") {
5339
5340
  if (X)
5340
5341
  return X;
5341
- if (h)
5342
+ if (p)
5342
5343
  throw new Error(M.reason || "Unknown image strategy");
5343
5344
  return null;
5344
5345
  }
@@ -5368,7 +5369,7 @@ function _i({
5368
5369
  pe.stopPropagation(), b(k.annotationId, k, pe);
5369
5370
  } : void 0,
5370
5371
  target: ((Z = k.target) == null ? void 0 : Z.spatial) || void 0,
5371
- children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(yc, { enableDangerouslySetInnerHTML: !0, children: k.text }) })
5372
+ children: /* @__PURE__ */ x("div", { "data-textual-content": !0, children: /* @__PURE__ */ x(vc, { enableDangerouslySetInnerHTML: !0, children: k.text }) })
5372
5373
  },
5373
5374
  H
5374
5375
  ),
@@ -5394,13 +5395,13 @@ function _i({
5394
5395
  ne
5395
5396
  ] }) : null,
5396
5397
  M.type === "3d-model" ? /* @__PURE__ */ x($i, { model: M.model }) : null,
5397
- M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ V(Pi, { media: M.media, mediaControlsDeps: p, children: [
5398
+ M.type === "media" ? /* @__PURE__ */ x(Me, { children: M.media.type === "Sound" ? /* @__PURE__ */ V(Pi, { media: M.media, mediaControlsDeps: h, children: [
5398
5399
  X,
5399
5400
  o ? o(M) : null
5400
- ] }) : M.media.type === "Video" ? /* @__PURE__ */ V(Fi, { media: M.media, mediaControlsDeps: p, children: [
5401
+ ] }) : M.media.type === "Video" ? /* @__PURE__ */ V(Fi, { media: M.media, mediaControlsDeps: h, children: [
5401
5402
  X,
5402
5403
  o ? o(M) : null
5403
- ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(gc, { media: M.media, mediaControlsDeps: p, children: [
5404
+ ] }) : M.media.type === "VideoYouTube" && A ? /* @__PURE__ */ V(mc, { media: M.media, mediaControlsDeps: h, children: [
5404
5405
  X,
5405
5406
  o ? o(M) : null
5406
5407
  ] }) : null }) : null
@@ -5411,11 +5412,11 @@ function _i({
5411
5412
  M.type === "media" && M.media.type === "Sound" && N ? /* @__PURE__ */ x(Lt, { canvas: N.id, children: /* @__PURE__ */ x(_i, { renderViewerControls: a }) }) : null
5412
5413
  ] });
5413
5414
  }
5414
- function mc() {
5415
+ function bc() {
5415
5416
  const t = Q(tt);
5416
5417
  return t && t.vault ? t.vault : $r();
5417
5418
  }
5418
- const bc = fr(function(e, r) {
5419
+ const Ac = fr(function(e, r) {
5419
5420
  const i = Pe(), n = qr(), s = ys(), { ViewerControls: a, MediaControls: o } = e.components || {};
5420
5421
  if (Ji(r, () => s, [s]), !i)
5421
5422
  return /* @__PURE__ */ x("div", {});
@@ -5427,30 +5428,30 @@ const bc = fr(function(e, r) {
5427
5428
  {
5428
5429
  height: e.height,
5429
5430
  mode: e.mode,
5430
- children: n.map((p, l) => {
5431
- const h = u;
5432
- return u += p.width + (e.spacing || 0), /* @__PURE__ */ x(Lt, { canvas: p.id, children: /* @__PURE__ */ x(
5431
+ children: n.map((h, l) => {
5432
+ const p = u;
5433
+ return u += h.width + (e.spacing || 0), /* @__PURE__ */ x(Lt, { canvas: h.id, children: /* @__PURE__ */ x(
5433
5434
  G.RenderCanvas,
5434
5435
  {
5435
5436
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
5436
5437
  renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ x(a, {}) : void 0,
5437
5438
  renderMediaControls: l === 0 && o ? () => /* @__PURE__ */ x(o, {}) : void 0,
5438
- x: h,
5439
+ x: p,
5439
5440
  ...e.canvasProps || {},
5440
5441
  children: e.annotations
5441
5442
  },
5442
- p.id
5443
- ) }, p.id);
5443
+ h.id
5444
+ ) }, h.id);
5444
5445
  })
5445
5446
  },
5446
5447
  e.reuseAtlas ? "" : s.currentSequenceIndex
5447
5448
  ),
5448
5449
  e.children
5449
5450
  ] });
5450
- }), G = fr(function({ children: e, height: r, annotations: i, canvasProps: n, spacing: s, header: a, components: o, mode: u, ...p }, l) {
5451
- const h = mc();
5452
- return /* @__PURE__ */ x(Dr, { vault: h, children: /* @__PURE__ */ x(ds, { ...p, children: /* @__PURE__ */ x(
5453
- bc,
5451
+ }), G = fr(function({ children: e, height: r, annotations: i, canvasProps: n, spacing: s, header: a, components: o, mode: u, ...h }, l) {
5452
+ const p = bc();
5453
+ return /* @__PURE__ */ x(Dr, { vault: p, children: /* @__PURE__ */ x(ds, { ...h, children: /* @__PURE__ */ x(
5454
+ Ac,
5454
5455
  {
5455
5456
  ref: l,
5456
5457
  height: r,