react-iiif-vault 1.0.8 → 1.0.10

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (67) hide show
  1. package/.build/types/canvas-panel/Viewer.d.ts +1 -1
  2. package/.build/types/canvas-panel/index.d.ts +2 -1
  3. package/.build/types/canvas-panel/render/Audio.d.ts +1 -1
  4. package/.build/types/canvas-panel/render/Canvas.d.ts +2 -2
  5. package/.build/types/canvas-panel/render/CanvasBackground.d.ts +1 -1
  6. package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +1 -1
  7. package/.build/types/canvas-panel/render/Image.d.ts +1 -1
  8. package/.build/types/canvas-panel/render/Model.d.ts +1 -1
  9. package/.build/types/canvas-panel/render/Video.d.ts +1 -1
  10. package/.build/types/canvas-panel/render/VideoYouTube.d.ts +1 -1
  11. package/.build/types/components/CanvasAnnotations.d.ts +10 -0
  12. package/.build/types/components/CombinedMetadata.d.ts +4 -0
  13. package/.build/types/components/Image.d.ts +15 -0
  14. package/.build/types/components/ManifestMetadata.d.ts +4 -0
  15. package/.build/types/components/Metadata.d.ts +39 -0
  16. package/.build/types/components/SequenceThumbnails.d.ts +29 -0
  17. package/.build/types/components/SingleCanvasThumbnail.d.ts +20 -0
  18. package/.build/types/context/AnnotationContext.d.ts +1 -1
  19. package/.build/types/context/AnnotationPageContext.d.ts +1 -1
  20. package/.build/types/context/CanvasContext.d.ts +1 -1
  21. package/.build/types/context/CollectionContext.d.ts +1 -1
  22. package/.build/types/context/ContextBridge.d.ts +1 -1
  23. package/.build/types/context/ManifestContext.d.ts +1 -1
  24. package/.build/types/context/MediaContext.d.ts +1 -1
  25. package/.build/types/context/RangeContext.d.ts +1 -1
  26. package/.build/types/context/ResourceContext.d.ts +2 -2
  27. package/.build/types/context/VaultContext.d.ts +1 -1
  28. package/.build/types/demo/media-controls.d.ts +1 -1
  29. package/.build/types/demo/viewer-controls.d.ts +1 -1
  30. package/.build/types/features/rendering-strategy/3d-strategy.d.ts +1 -1
  31. package/.build/types/features/rendering-strategy/image-strategy.d.ts +1 -1
  32. package/.build/types/features/rendering-strategy/resource-types.d.ts +7 -7
  33. package/.build/types/features/rendering-strategy/strategies.d.ts +5 -5
  34. package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +1 -1
  35. package/.build/types/hooks/useEventListener.d.ts +1 -1
  36. package/.build/types/hooks/useExistingVault.d.ts +2 -1
  37. package/.build/types/hooks/useExternalResource.d.ts +1 -1
  38. package/.build/types/hooks/useImage.d.ts +10 -0
  39. package/.build/types/hooks/useLoadImageService.d.ts +1 -1
  40. package/.build/types/hooks/useRenderingStrategy.d.ts +3 -3
  41. package/.build/types/hooks/useSimpleMediaPlayer.d.ts +2 -2
  42. package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +81 -81
  43. package/.build/types/index.d.ts +8 -0
  44. package/.build/types/utility/i18n-utils.d.ts +8 -6
  45. package/.build/types/viewers/SimpleViewerContext.d.ts +2 -2
  46. package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +2 -0
  47. package/.build/types/viewers/SimpleViewerContext.types.d.ts +8 -4
  48. package/README.md +495 -177
  49. package/dist/bundle/cjs/index.js +7 -6
  50. package/dist/bundle/cjs/index.js.map +1 -1
  51. package/dist/bundle/esm/index.mjs +2391 -1186
  52. package/dist/bundle/esm/index.mjs.map +1 -1
  53. package/dist/canvas-panel/cjs/canvas-panel.js +5 -5
  54. package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
  55. package/dist/canvas-panel/esm/canvas-panel.mjs +596 -547
  56. package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
  57. package/dist/index.umd.js +78 -76
  58. package/dist/index.umd.js.map +1 -1
  59. package/dist/react17/cjs/index.js +7 -6
  60. package/dist/react17/cjs/index.js.map +1 -1
  61. package/dist/react17/esm/index.mjs +2391 -1186
  62. package/dist/react17/esm/index.mjs.map +1 -1
  63. package/dist/utils/cjs/utils.js +1 -1
  64. package/dist/utils/cjs/utils.js.map +1 -1
  65. package/dist/utils/esm/utils.mjs +21 -21
  66. package/dist/utils/esm/utils.mjs.map +1 -1
  67. package/package.json +24 -22
@@ -1,404 +1,450 @@
1
- import { jsx as l, jsxs as M, Fragment as z } from "react/jsx-runtime";
2
- import * as se from "react";
3
- import B, { useContext as R, useMemo as x, useState as T, useEffect as k, useCallback as b, createContext as U, useRef as $, useLayoutEffect as Te, Fragment as ne, useReducer as gt, forwardRef as Ve, useImperativeHandle as vt } from "react";
4
- import { AtlasAuto as mt, ModeContext as pt, mergeStyles as yt, RegionHighlight as xt, TileSet as St, HTMLPortal as wt } from "@atlas-viewer/atlas";
5
- import { globalVault as Le, Vault as Ie } from "@iiif/helpers/vault";
6
- import { createStylesHelper as ge } from "@iiif/helpers/styles";
7
- import { expandTarget as le } from "@iiif/helpers/annotation-targets";
1
+ import { jsx as d, jsxs as X, Fragment as Oe } from "react/jsx-runtime";
2
+ import Ie, { createContext as xe, Component as wn, createElement as St, isValidElement as Pn, useContext as ue, useMemo as N, useState as ie, useEffect as be, useCallback as Q, useRef as Ee, useLayoutEffect as st, Fragment as Ye, useReducer as On, forwardRef as ct, useImperativeHandle as It } from "react";
3
+ import { AtlasAuto as Sn, ModeContext as xn, mergeStyles as Tn, RegionHighlight as En, TileSet as In, HTMLPortal as Cn, useCanvas as jn } from "@atlas-viewer/atlas";
4
+ import { globalVault as Ct, Vault as xt } from "@iiif/helpers/vault";
5
+ import { createStylesHelper as ut } from "@iiif/helpers/styles";
6
+ import { expandTarget as ot } from "@iiif/helpers/annotation-targets";
8
7
  export * from "@iiif/helpers/annotation-targets";
9
- import { expandTarget as Ct } from "@iiif/helpers";
10
- import { ImageServiceLoader as bt, getImageServices as de } from "@atlas-viewer/iiif-image-api";
11
- import { createThumbnailHelper as Pt } from "@iiif/helpers/thumbnail";
12
- function fe(e, t) {
13
- return fe = Object.setPrototypeOf || function(r, i) {
14
- return r.__proto__ = i, r;
15
- }, fe(e, t);
16
- }
17
- function Et(e, t) {
18
- e.prototype = Object.create(t.prototype), e.prototype.constructor = e, fe(e, t);
19
- }
20
- var It = function(t, n) {
21
- return t === void 0 && (t = []), n === void 0 && (n = []), t.length !== n.length || t.some(function(r, i) {
22
- return !Object.is(r, n[i]);
23
- });
24
- }, Ae = {
8
+ import { expandTarget as Mn } from "@iiif/helpers";
9
+ import { ImageServiceLoader as Rn, getImageServices as it, createImageServiceRequest as Ln, imageServiceRequestToString as An } from "@atlas-viewer/iiif-image-api";
10
+ import { createThumbnailHelper as kn } from "@iiif/helpers/thumbnail";
11
+ import Nn from "react-dom";
12
+ const Vn = xe(null), tt = {
13
+ didCatch: !1,
25
14
  error: null
26
- }, At = /* @__PURE__ */ function(e) {
27
- Et(t, e);
28
- function t() {
29
- for (var r, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
30
- o[a] = arguments[a];
31
- return r = e.call.apply(e, [this].concat(o)) || this, r.state = Ae, r.resetErrorBoundary = function() {
32
- for (var s, c = arguments.length, d = new Array(c), u = 0; u < c; u++)
33
- d[u] = arguments[u];
34
- r.props.onReset == null || (s = r.props).onReset.apply(s, d), r.reset();
35
- }, r;
15
+ };
16
+ class _n extends wn {
17
+ constructor(t) {
18
+ super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = tt;
36
19
  }
37
- t.getDerivedStateFromError = function(i) {
20
+ static getDerivedStateFromError(t) {
38
21
  return {
39
- error: i
22
+ didCatch: !0,
23
+ error: t
40
24
  };
41
- };
42
- var n = t.prototype;
43
- return n.reset = function() {
44
- this.setState(Ae);
45
- }, n.componentDidCatch = function(i, o) {
46
- var a, s;
47
- (a = (s = this.props).onError) == null || a.call(s, i, o);
48
- }, n.componentDidUpdate = function(i, o) {
49
- var a = this.state.error, s = this.props.resetKeys;
50
- if (a !== null && o.error !== null && It(i.resetKeys, s)) {
51
- var c, d;
52
- (c = (d = this.props).onResetKeysChange) == null || c.call(d, i.resetKeys, s), this.reset();
53
- }
54
- }, n.render = function() {
55
- var i = this.state.error, o = this.props, a = o.fallbackRender, s = o.FallbackComponent, c = o.fallback;
56
- if (i !== null) {
57
- var d = {
25
+ }
26
+ resetErrorBoundary() {
27
+ const {
28
+ error: t
29
+ } = this.state;
30
+ if (t !== null) {
31
+ for (var n, o, r = arguments.length, a = new Array(r), i = 0; i < r; i++)
32
+ a[i] = arguments[i];
33
+ (n = (o = this.props).onReset) === null || n === void 0 || n.call(o, {
34
+ args: a,
35
+ reason: "imperative-api"
36
+ }), this.setState(tt);
37
+ }
38
+ }
39
+ componentDidCatch(t, n) {
40
+ var o, r;
41
+ (o = (r = this.props).onError) === null || o === void 0 || o.call(r, t, n);
42
+ }
43
+ componentDidUpdate(t, n) {
44
+ const {
45
+ didCatch: o
46
+ } = this.state, {
47
+ resetKeys: r
48
+ } = this.props;
49
+ if (o && n.error !== null && Dn(t.resetKeys, r)) {
50
+ var a, i;
51
+ (a = (i = this.props).onReset) === null || a === void 0 || a.call(i, {
52
+ next: r,
53
+ prev: t.resetKeys,
54
+ reason: "keys"
55
+ }), this.setState(tt);
56
+ }
57
+ }
58
+ render() {
59
+ const {
60
+ children: t,
61
+ fallbackRender: n,
62
+ FallbackComponent: o,
63
+ fallback: r
64
+ } = this.props, {
65
+ didCatch: a,
66
+ error: i
67
+ } = this.state;
68
+ let s = t;
69
+ if (a) {
70
+ const f = {
58
71
  error: i,
59
72
  resetErrorBoundary: this.resetErrorBoundary
60
73
  };
61
- if (/* @__PURE__ */ se.isValidElement(c))
62
- return c;
63
- if (typeof a == "function")
64
- return a(d);
65
- if (s)
66
- return /* @__PURE__ */ se.createElement(s, d);
67
- throw new Error("react-error-boundary requires either a fallback, fallbackRender, or FallbackComponent prop");
68
- }
69
- return this.props.children;
70
- }, t;
71
- }(se.Component);
72
- const Mt = {
74
+ if (typeof n == "function")
75
+ s = n(f);
76
+ else if (o)
77
+ s = St(o, f);
78
+ else if (r === null || Pn(r))
79
+ s = r;
80
+ else
81
+ throw i;
82
+ }
83
+ return St(Vn.Provider, {
84
+ value: {
85
+ didCatch: a,
86
+ error: i,
87
+ resetErrorBoundary: this.resetErrorBoundary
88
+ }
89
+ }, s);
90
+ }
91
+ }
92
+ function Dn() {
93
+ let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
94
+ return e.length !== t.length || e.some((n, o) => !Object.is(n, t[o]));
95
+ }
96
+ const Bn = {
73
97
  collection: void 0,
74
98
  manifest: void 0,
75
99
  range: void 0,
76
100
  canvas: void 0,
77
101
  annotation: void 0,
78
102
  annotationPage: void 0
79
- }, ve = B.createContext(Mt), H = () => R(ve);
80
- function K({ value: e, children: t }) {
81
- const n = H(), r = x(() => ({
103
+ }, lt = Ie.createContext(Bn), je = () => ue(lt);
104
+ function Le({ value: e, children: t }) {
105
+ const n = je(), o = N(() => ({
82
106
  ...n,
83
107
  ...e
84
108
  }), [e, n]);
85
- return /* @__PURE__ */ l(ve.Provider, { value: r, children: t });
109
+ return /* @__PURE__ */ d(lt.Provider, { value: o, children: t });
86
110
  }
87
- const ie = B.createContext({
111
+ const Ke = Ie.createContext({
88
112
  vault: null,
89
113
  setVaultInstance: (e) => {
90
114
  }
91
115
  });
92
- function Oe({
116
+ function ft({
93
117
  vault: e,
94
118
  vaultOptions: t,
95
119
  useGlobal: n,
96
- resources: r,
97
- children: i
120
+ resources: o,
121
+ children: r
98
122
  }) {
99
- const [o, a] = T(() => e || (n ? Le(t) : t ? new Ie(t) : new Ie()));
100
- return /* @__PURE__ */ l(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ l(K, { value: r || {}, children: i }) });
123
+ const [a, i] = ie(() => e || (n ? Ct(t) : t ? new xt(t) : new xt()));
124
+ return /* @__PURE__ */ d(Ke.Provider, { value: { vault: a, setVaultInstance: i }, children: /* @__PURE__ */ d(Le, { value: o || {}, children: r }) });
101
125
  }
102
- const I = () => {
103
- const { vault: e } = R(ie);
104
- if (e === null)
105
- throw new Error("Vault not found. Ensure you have your provider set up correctly.");
106
- return e;
107
- };
108
- function ke(e, { noCache: t = !1 } = {}) {
109
- const n = typeof e == "string" ? e : e.id, r = I(), [i, o] = T(n), [a, s] = T(void 0), c = x(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, u] = T(c);
110
- return k(() => {
126
+ function dt(e) {
127
+ const t = ue(Ke);
128
+ return e || (t && t.vault ? t.vault : Ct());
129
+ }
130
+ function jt(e, { noCache: t = !1 } = {}) {
131
+ const n = typeof e == "string" ? e : e.id, o = dt(), [r, a] = ie(n), [i, s] = ie(void 0), f = N(() => o.get(n, { skipSelfReturn: !0 }) || void 0, [n, o]), [h, u] = ie(f);
132
+ return be(() => {
111
133
  (async () => {
112
134
  try {
113
- const f = c && !t ? c : await r.load(n), m = f ? f.id || f["@id"] : null;
114
- f && i !== m && o(m), u(f);
115
- } catch (f) {
116
- s(f);
135
+ const y = f && !t ? f : await o.load(n), x = y ? y.id || y["@id"] : null;
136
+ y && r !== x && a(x), u(y);
137
+ } catch (y) {
138
+ s(y);
117
139
  }
118
140
  })();
119
141
  }, [n, t]), {
120
- isLoaded: !!d,
121
- id: i,
142
+ isLoaded: !!h,
143
+ id: r,
122
144
  requestId: n,
123
- error: a,
124
- resource: d,
125
- cached: !!(d && d === c)
145
+ error: i,
146
+ resource: h,
147
+ cached: !!(h && h === f)
126
148
  };
127
149
  }
128
- function Rt(e, t) {
129
- const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = ke(
150
+ function qn(e, t) {
151
+ const { id: n, isLoaded: o, error: r, resource: a, requestId: i, cached: s } = jt(
130
152
  e,
131
153
  t
132
154
  );
133
- return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
155
+ return { id: n, isLoaded: o, error: r, manifest: a, requestId: i, cached: s };
134
156
  }
135
- function Tt({ manifest: e, children: t }) {
136
- return /* @__PURE__ */ l(K, { value: { manifest: e }, children: t });
157
+ function Fn({ manifest: e, children: t }) {
158
+ return /* @__PURE__ */ d(Le, { value: { manifest: e }, children: t });
137
159
  }
138
- function me({ canvas: e, children: t }) {
139
- return /* @__PURE__ */ l(K, { value: { canvas: e }, children: t });
160
+ function Qe({ canvas: e, children: t }) {
161
+ return /* @__PURE__ */ d(Le, { value: { canvas: e }, children: t });
140
162
  }
141
- function V(e, t = []) {
142
- const n = I(), [r, i] = T(() => e(n.getState(), n));
143
- return k(() => n.subscribe(
144
- (o) => e(o, n),
145
- (o) => {
146
- i(o);
163
+ const ae = () => {
164
+ const { vault: e } = ue(Ke);
165
+ if (e === null)
166
+ throw new Error("Vault not found. Ensure you have your provider set up correctly.");
167
+ return e;
168
+ };
169
+ function ye(e, t = []) {
170
+ const n = ae(), [o, r] = ie(() => e(n.getState(), n));
171
+ return be(() => n.subscribe(
172
+ (a) => e(a, n),
173
+ (a) => {
174
+ r(a);
147
175
  },
148
176
  !1
149
- ), t), r;
177
+ ), t), o;
150
178
  }
151
- const oe = B.createContext([]);
152
- function Fe() {
153
- const e = R(oe);
154
- return V(
179
+ const Ge = Ie.createContext([]);
180
+ function Mt() {
181
+ const e = ue(Ge);
182
+ return ye(
155
183
  (t) => e.map((n) => t.iiif.entities.Canvas[n]).filter(Boolean),
156
184
  [e]
157
185
  );
158
186
  }
159
- function W(e = {}, t = []) {
160
- const { id: n, selector: r } = e, i = H();
161
- I();
162
- const o = n || i.manifest, a = V(
163
- (s) => o ? s.iiif.entities.Manifest[o] : void 0,
164
- [o]
187
+ function Ce(e = {}, t = []) {
188
+ const { id: n, selector: o } = e, r = je();
189
+ ae();
190
+ const a = n || r.manifest, i = ye(
191
+ (s) => a ? s.iiif.entities.Manifest[a] : void 0,
192
+ [a]
165
193
  );
166
- return x(() => {
167
- if (a)
168
- return r ? r(a) : a;
169
- }, [a, r, ...t]);
194
+ return N(() => {
195
+ if (i)
196
+ return o ? o(i) : i;
197
+ }, [i, o, ...t]);
170
198
  }
171
- function Vt({ range: e, children: t }) {
172
- return /* @__PURE__ */ l(K, { value: { range: e }, children: t });
199
+ function Un({ range: e, children: t }) {
200
+ return /* @__PURE__ */ d(Le, { value: { range: e }, children: t });
173
201
  }
174
- function Lt(e, t) {
202
+ function $n(e, t) {
175
203
  for (const n of t.items) {
176
204
  if (n.type === "Canvas")
177
205
  return n;
178
206
  if (n.type === "SpecificResource")
179
207
  return n.source;
180
208
  if (n.type === "Range") {
181
- const r = Lt(e, e.get(n));
182
- if (r)
183
- return r;
209
+ const o = $n(e, e.get(n));
210
+ if (o)
211
+ return o;
184
212
  }
185
213
  }
186
214
  return null;
187
215
  }
188
- function Ne(e, t) {
189
- var r;
216
+ function Rt(e, t) {
217
+ var o;
190
218
  const n = [];
191
- for (const i of t.items)
192
- 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(...Ne(e, e.get(i))), i.type === "SpecificResource") {
193
- const o = typeof i.source == "string" ? i.source : i.source.id;
194
- n.push({ id: o, type: "Canvas" });
219
+ for (const r of t.items)
220
+ if (r.type === "SpecificResource" && ((o = r.source) == null ? void 0 : o.type) === "Canvas" && (r.source.id.indexOf("#") !== -1 ? n.push({ id: r.source.id.split("#")[0], type: "Canvas" }) : n.push(r.source)), r.type === "Range" && n.push(...Rt(e, e.get(r))), r.type === "SpecificResource") {
221
+ const a = typeof r.source == "string" ? r.source : r.source.id;
222
+ n.push({ id: a, type: "Canvas" });
195
223
  }
196
224
  return n;
197
225
  }
198
- function sr(e, t, n) {
199
- for (const r of t.structures) {
200
- const i = De(e, e.get(r), n);
201
- if (i)
202
- return i;
226
+ function Po(e, t, n) {
227
+ for (const o of t.structures) {
228
+ const r = Lt(e, e.get(o), n);
229
+ if (r)
230
+ return r;
203
231
  }
204
232
  return null;
205
233
  }
206
- function De(e, t, n) {
207
- var r, i, o;
208
- for (const a of t.items) {
209
- const s = (i = (r = a == null ? void 0 : a.source) == null ? void 0 : r.id) == null ? void 0 : i.split("#")[0];
210
- if (a.type === "SpecificResource" && a.source === n || a.type === "SpecificResource" && ((o = a.source) == null ? void 0 : o.type) === "Canvas" && n === s)
234
+ function Lt(e, t, n) {
235
+ var o, r, a;
236
+ for (const i of t.items) {
237
+ const s = (r = (o = i == null ? void 0 : i.source) == null ? void 0 : o.id) == null ? void 0 : r.split("#")[0];
238
+ if (i.type === "SpecificResource" && i.source === n || i.type === "SpecificResource" && ((a = i.source) == null ? void 0 : a.type) === "Canvas" && n === s)
211
239
  return t;
212
- if (a.type === "Range") {
213
- const c = De(e, e.get(a), n);
214
- if (c)
215
- return c;
240
+ if (i.type === "Range") {
241
+ const f = Lt(e, e.get(i), n);
242
+ if (f)
243
+ return f;
216
244
  }
217
245
  }
218
246
  return null;
219
247
  }
220
- function cr(e, t, n, r = !1) {
221
- const i = t.behavior, o = n ? e.get(n) : null;
222
- if (!o)
248
+ function Oo(e, t, n, o = !1) {
249
+ const r = t.behavior, a = n ? e.get(n) : null;
250
+ if (!a)
223
251
  return [];
224
- const a = o.behavior, s = r ? !1 : i.includes("paged"), c = s ? !1 : i.includes("continuous"), d = s || c ? !1 : i.includes("individuals"), u = a.includes("facing-pages"), f = a.includes("non-paged");
225
- if (u || f || d || r)
226
- return [{ id: o.id, type: "Canvas" }];
227
- const [m, p] = _e(e, t);
228
- if (c)
229
- return m;
230
- const g = m.findIndex((h) => h.id === n);
231
- if (g === -1)
252
+ const i = a.behavior, s = o ? !1 : r.includes("paged"), f = s ? !1 : r.includes("continuous"), h = s || f ? !1 : r.includes("individuals"), u = i.includes("facing-pages"), y = i.includes("non-paged");
253
+ if (u || y || h || o)
254
+ return [{ id: a.id, type: "Canvas" }];
255
+ const [x, M] = At(e, t);
256
+ if (f)
257
+ return x;
258
+ const I = x.findIndex((b) => b.id === n);
259
+ if (I === -1)
232
260
  return [];
233
- for (const h of p)
234
- if (h.includes(g))
235
- return h.map((y) => m[y]);
236
- return [{ id: o.id, type: "Canvas" }];
237
- }
238
- function _e(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
239
- 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 : Ne(e, t);
240
- if (a)
241
- return [c, [c.map((g, h) => h)]];
242
- if (s || !o || n)
243
- return [c, c.map((g, h) => [h])];
244
- const d = [];
261
+ for (const b of M)
262
+ if (b.includes(I))
263
+ return b.map((E) => x[E]);
264
+ return [{ id: a.id, type: "Canvas" }];
265
+ }
266
+ function At(e, t, { disablePaging: n, skipNonPaged: o } = {}) {
267
+ const r = t.behavior, a = r.includes("paged"), i = a ? !1 : r.includes("continuous"), s = a || i ? !1 : r.includes("individuals"), f = t.type === "Manifest" ? t.items : Rt(e, t);
268
+ if (i)
269
+ return [f, [f.map((I, b) => b)]];
270
+ if (s || !a || n)
271
+ return [f, f.map((I, b) => [b])];
272
+ const h = [];
245
273
  let u = [];
246
- const f = () => {
247
- u.length && (d.push([...u]), u = []);
274
+ const y = () => {
275
+ u.length && (h.push([...u]), u = []);
248
276
  };
249
- let m = 0, p = !1;
250
- for (let g = 0; g < c.length; g++) {
251
- const h = e.get(c[g]);
252
- if (h.behavior.includes("non-paged")) {
253
- g === m && m++, r || (f(), d.push([g]), f());
277
+ let x = 0, M = !1;
278
+ for (let I = 0; I < f.length; I++) {
279
+ const b = e.get(f[I]);
280
+ if (b.behavior.includes("non-paged")) {
281
+ I === x && x++, o || (y(), h.push([I]), y());
254
282
  continue;
255
283
  }
256
- if (g === m || h.behavior.includes("facing-pages")) {
257
- u.length && (p = !0), f(), d.push([g]), f();
284
+ if (I === x || b.behavior.includes("facing-pages")) {
285
+ u.length && (M = !0), y(), h.push([I]), y();
258
286
  continue;
259
287
  }
260
- if (u.push(g), p) {
261
- f(), p = !1;
288
+ if (u.push(I), M) {
289
+ y(), M = !1;
262
290
  continue;
263
291
  }
264
- u.length > 1 && f();
292
+ u.length > 1 && y();
265
293
  }
266
- return u.length && f(), [c, d];
267
- }
268
- function Ot(e = {}, t = []) {
269
- const { id: n, selector: r } = e, i = H(), o = n || i.range, a = V((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
270
- return x(() => {
271
- if (a)
272
- return r ? r(a) : a;
273
- }, [a, r, ...t]);
274
- }
275
- function kt({ startCanvas: e, disablePaging: t }) {
276
- var g;
277
- const n = I(), r = W(), i = Ot(), [o, a] = T(void 0), s = i || r;
294
+ return u.length && y(), [f, h];
295
+ }
296
+ function kt(e = {}, t = []) {
297
+ const { id: n, selector: o } = e, r = je(), a = n || r.range, i = ye((s) => a ? s.iiif.entities.Range[a] : void 0, [a]);
298
+ return N(() => {
299
+ if (i)
300
+ return o ? o(i) : i;
301
+ }, [i, o, ...t]);
302
+ }
303
+ function Wn({ startCanvas: e, disablePaging: t }) {
304
+ var I;
305
+ const n = ae(), o = Ce(), r = kt(), [a, i] = ie(void 0), s = r || o;
278
306
  if (!s)
279
307
  throw new Error("Nothing selected");
280
- const [c, d] = x(
281
- () => _e(n, s, { disablePaging: t }),
282
- [n, s]
283
- ), u = b(
284
- (h) => {
285
- const y = d.findIndex((w) => w.includes(h));
286
- a(y === -1 ? 0 : y);
308
+ const [f, h] = N(
309
+ () => At(n, s, { disablePaging: t }),
310
+ [n, s, t]
311
+ ), u = Q(
312
+ (b) => {
313
+ const E = h.findIndex((C) => C.includes(b));
314
+ i(E === -1 ? 0 : E);
287
315
  },
288
- [c, d]
289
- ), f = b(
290
- (h) => {
291
- const y = c.findIndex((w) => w.id === h);
292
- y !== -1 ? u(y) : a(0);
316
+ [f, h]
317
+ ), y = Q(
318
+ (b) => {
319
+ const E = f.findIndex((C) => C.id === b);
320
+ E !== -1 ? u(E) : i(0);
293
321
  },
294
- [c, d]
295
- ), m = b(() => {
296
- a((h) => h >= d.length ? h : h + 1);
297
- }, [d]), p = b(() => {
298
- a((h) => h <= 0 ? 0 : h - 1);
299
- }, [d]);
300
- return typeof o > "u" && (e ? f(e) : a(0)), {
301
- visibleItems: ((g = d[o]) == null ? void 0 : g.map((h) => c[h].id)) || [],
302
- cursor: o,
303
- items: c,
304
- sequence: d,
305
- setSequenceIndex: a,
322
+ [f, h]
323
+ ), x = Q(() => {
324
+ i((b) => b >= h.length - 1 ? b : b + 1);
325
+ }, [h]), M = Q(() => {
326
+ i((b) => b <= 0 ? 0 : b - 1);
327
+ }, [h]);
328
+ return typeof a > "u" && (e ? y(e) : i(0)), {
329
+ visibleItems: ((I = h[a]) == null ? void 0 : I.map((b) => f[b].id)) || [],
330
+ cursor: a,
331
+ items: f,
332
+ sequence: h,
333
+ hasPrevious: a > 0,
334
+ hasNext: a < h.length - 1,
335
+ setSequenceIndex: i,
306
336
  setCanvasIndex: u,
307
- setCanvasId: f,
308
- next: m,
309
- previous: p
337
+ setCanvasId: y,
338
+ next: x,
339
+ previous: M
310
340
  };
311
341
  }
312
- const Z = () => {
313
- }, ae = U({
314
- setCurrentCanvasId: Z,
315
- setCurrentCanvasIndex: Z,
316
- nextCanvas: Z,
317
- previousCanvas: Z,
342
+ const De = () => {
343
+ }, Xe = xe({
344
+ setCurrentCanvasId: De,
345
+ setCurrentCanvasIndex: De,
346
+ nextCanvas: De,
347
+ previousCanvas: De,
318
348
  items: [],
319
349
  sequence: [],
320
- setSequenceIndex: Z,
321
- currentSequenceIndex: 0
350
+ setSequenceIndex: De,
351
+ currentSequenceIndex: 0,
352
+ hasNext: !1,
353
+ hasPrevious: !1
322
354
  });
323
- function Ft(e) {
324
- const t = W(), { cursor: n, visibleItems: r, next: i, sequence: o, items: a, setCanvasIndex: s, setCanvasId: c, previous: d, setSequenceIndex: u } = kt({
355
+ function Hn(e) {
356
+ const t = Ce(), {
357
+ cursor: n,
358
+ visibleItems: o,
359
+ next: r,
360
+ sequence: a,
361
+ items: i,
362
+ setCanvasIndex: s,
363
+ setCanvasId: f,
364
+ previous: h,
365
+ setSequenceIndex: u,
366
+ hasNext: y,
367
+ hasPrevious: x
368
+ } = Wn({
325
369
  startCanvas: e.startCanvas,
326
370
  disablePaging: e.pagingEnabled === !1
327
- }), f = x(
371
+ }), M = N(
328
372
  () => ({
329
- sequence: o,
330
- items: a,
373
+ sequence: a,
374
+ items: i,
331
375
  // Extra functions.
332
- setCurrentCanvasId: c,
333
- nextCanvas: i,
334
- previousCanvas: d,
335
- totalCanvases: a.length,
376
+ setCurrentCanvasId: f,
377
+ nextCanvas: r,
378
+ previousCanvas: h,
379
+ totalCanvases: i.length,
336
380
  setCurrentCanvasIndex: s,
337
381
  setSequenceIndex: u,
338
- currentSequenceIndex: n
382
+ currentSequenceIndex: n,
383
+ hasNext: y,
384
+ hasPrevious: x
339
385
  }),
340
- [o, a, c, i, d, a, s, u, n]
386
+ [a, i, f, r, h, i, s, u, n]
341
387
  );
342
- return t ? r.length === 0 ? null : /* @__PURE__ */ l(ae.Provider, { value: f, children: /* @__PURE__ */ l(oe.Provider, { value: r, children: /* @__PURE__ */ l(me, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ l("div", { children: "Sorry, something went wrong." }));
343
- }
344
- function Nt(e) {
345
- const t = Rt(e.manifest);
346
- if (!t)
347
- return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ l("div", { children: "Sorry, something went wrong." });
348
- if (t.error)
349
- return /* @__PURE__ */ l("div", { children: t.error.toString() });
350
- if (!t.isLoaded)
351
- return /* @__PURE__ */ l("div", { children: "Loading..." });
352
- const n = /* @__PURE__ */ l(Ft, { ...e, children: e.children });
353
- return /* @__PURE__ */ l(Tt, { manifest: t.id, children: e.rangeId ? /* @__PURE__ */ l(Vt, { range: e.rangeId, children: n }) : n });
354
- }
355
- function Dt() {
356
- return R(ae);
357
- }
358
- function _t() {
388
+ return t ? o.length === 0 ? null : /* @__PURE__ */ d(Xe.Provider, { value: M, children: /* @__PURE__ */ d(Ge.Provider, { value: o, children: /* @__PURE__ */ d(Qe, { canvas: o[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ d("div", { children: "Sorry, something went wrong." }));
389
+ }
390
+ function Yn(e) {
391
+ const t = dt(e.vault), n = qn(e.manifest);
392
+ if (!n)
393
+ return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ d("div", { children: "Sorry, something went wrong." });
394
+ if (n.error)
395
+ return /* @__PURE__ */ d("div", { children: n.error.toString() });
396
+ if (!n.isLoaded)
397
+ return /* @__PURE__ */ d("div", { children: "Loading..." });
398
+ const o = /* @__PURE__ */ d(Hn, { ...e, children: e.children });
399
+ return /* @__PURE__ */ d(ft, { vault: t, children: /* @__PURE__ */ d(Fn, { manifest: n.id, children: e.rangeId ? /* @__PURE__ */ d(Un, { range: e.rangeId, children: o }) : o }) });
400
+ }
401
+ function Nt() {
402
+ return ue(Xe);
403
+ }
404
+ function zn() {
359
405
  return {
360
- VaultContext: R(ie),
361
- ResourceContext: R(ve),
362
- SimpleViewerReactContext: R(ae),
363
- VisibleCanvasReactContext: R(oe)
406
+ VaultContext: ue(Ke),
407
+ ResourceContext: ue(lt),
408
+ SimpleViewerReactContext: ue(Xe),
409
+ VisibleCanvasReactContext: ue(Ge)
364
410
  };
365
411
  }
366
- function Ut(e) {
367
- return /* @__PURE__ */ l(Oe, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ l(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ l(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
412
+ function Kn(e) {
413
+ return /* @__PURE__ */ d(ft, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ d(Ge.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ d(Xe.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
368
414
  }
369
- const N = function(e) {
415
+ const Te = function(e) {
370
416
  return function() {
371
417
  const t = { type: e, getType: () => e, toString: () => e };
372
- return (n, r) => ({
418
+ return (n, o) => ({
373
419
  ...t,
374
420
  ...n !== void 0 && { payload: n },
375
- ...r !== void 0 && { meta: r }
421
+ ...o !== void 0 && { meta: o }
376
422
  });
377
423
  };
378
- }, jt = "@iiif/IMPORT_ENTITIES", qt = "@iiif/MODIFY_ENTITY_FIELD", $t = "@iiif/REORDER_ENTITY_FIELD", Bt = "@iiif/ADD_REFERENCE", Ht = "@iiif/UPDATE_REFERENCE", Yt = "@iiif/REMOVE_REFERENCE", zt = "@iiif/ADD_METADATA", Kt = "@iiif/REMOVE_METADATA", Wt = "@iiif/UPDATE_METADATA", Gt = "@iiif/REORDER_METADATA", Qt = N(jt)(), Jt = N(qt)(), Zt = N($t)(), Xt = N(Bt)(), en = N(Yt)(), tn = N(Ht)(), nn = N(zt)(), rn = N(Wt)(), on = N(Kt)(), an = N(Gt)(), ce = {
379
- importEntities: Qt,
380
- modifyEntityField: Jt,
381
- reorderEntityField: Zt,
382
- addReference: Xt,
383
- removeReference: en,
384
- updateReference: tn,
385
- addMetadata: nn,
386
- removeMetadata: on,
387
- updateMetadata: rn,
388
- reorderMetadata: an
424
+ }, Qn = "@iiif/IMPORT_ENTITIES", Gn = "@iiif/MODIFY_ENTITY_FIELD", Xn = "@iiif/REORDER_ENTITY_FIELD", Jn = "@iiif/ADD_REFERENCE", Zn = "@iiif/UPDATE_REFERENCE", er = "@iiif/REMOVE_REFERENCE", tr = "@iiif/ADD_METADATA", nr = "@iiif/REMOVE_METADATA", rr = "@iiif/UPDATE_METADATA", or = "@iiif/REORDER_METADATA", ir = Te(Qn)(), ar = Te(Gn)(), sr = Te(Xn)(), cr = Te(Jn)(), ur = Te(er)(), lr = Te(Zn)(), fr = Te(tr)(), dr = Te(rr)(), pr = Te(nr)(), hr = Te(or)(), nt = {
425
+ importEntities: ir,
426
+ modifyEntityField: ar,
427
+ reorderEntityField: sr,
428
+ addReference: cr,
429
+ removeReference: ur,
430
+ updateReference: lr,
431
+ addMetadata: fr,
432
+ removeMetadata: pr,
433
+ updateMetadata: dr,
434
+ reorderMetadata: hr
389
435
  };
390
- function sn() {
391
- const t = I().getStore();
392
- return x(() => (n) => t.dispatch(n), [t]);
436
+ function yr() {
437
+ const t = ae().getStore();
438
+ return N(() => (n) => t.dispatch(n), [t]);
393
439
  }
394
- function Me(e) {
440
+ function Tt(e) {
395
441
  return typeof e != "string" && e && e.bindToVault;
396
442
  }
397
- function cn() {
398
- const e = I(), t = $([]), n = sn(), r = x(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
399
- Te(() => {
443
+ function gr() {
444
+ const e = ae(), t = Ee([]), n = yr(), o = N(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
445
+ st(() => {
400
446
  const s = {
401
- id: r,
447
+ id: o,
402
448
  type: "AnnotationPage",
403
449
  behavior: [],
404
450
  label: null,
@@ -415,7 +461,7 @@ function cn() {
415
461
  service: []
416
462
  };
417
463
  n(
418
- ce.importEntities({
464
+ nt.importEntities({
419
465
  entities: {
420
466
  AnnotationPage: {
421
467
  [s.id]: s
@@ -423,39 +469,39 @@ function cn() {
423
469
  }
424
470
  })
425
471
  );
426
- }, [r]);
427
- const i = V(
428
- (s) => r ? s.iiif.entities.AnnotationPage[r] : null,
429
- [r]
430
- ), o = b(
431
- (s, c) => {
432
- if (r) {
433
- if (Me(s)) {
434
- const f = s;
435
- f.__vault || f.bindToVault(e), s = typeof f.source == "string" ? f.source : f.source.id, t.current[s] = f;
472
+ }, [o]);
473
+ const r = ye(
474
+ (s) => o ? s.iiif.entities.AnnotationPage[o] : null,
475
+ [o]
476
+ ), a = Q(
477
+ (s, f) => {
478
+ if (o) {
479
+ if (Tt(s)) {
480
+ const y = s;
481
+ y.__vault || y.bindToVault(e), s = typeof y.source == "string" ? y.source : y.source.id, t.current[s] = y;
436
482
  } else
437
483
  typeof s != "string" && (s = s.id);
438
- const d = e.get({ id: r, type: "AnnotationPage" }), u = e.get({ id: s, type: "Annotation" });
439
- d && u && (d.items.find((f) => f.id === u.id) || n(
440
- ce.addReference({
441
- id: r,
484
+ const h = e.get({ id: o, type: "AnnotationPage" }), u = e.get({ id: s, type: "Annotation" });
485
+ h && u && (h.items.find((y) => y.id === u.id) || n(
486
+ nt.addReference({
487
+ id: o,
442
488
  type: "AnnotationPage",
443
489
  key: "items",
444
490
  reference: {
445
491
  id: s,
446
492
  type: "Annotation"
447
493
  },
448
- index: c
494
+ index: f
449
495
  })
450
496
  ));
451
497
  }
452
498
  },
453
- [r]
454
- ), a = b(
499
+ [o]
500
+ ), i = Q(
455
501
  (s) => {
456
- r && (Me(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(
457
- ce.removeReference({
458
- id: r,
502
+ o && (Tt(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: o, type: "AnnotationPage" }) && n(
503
+ nt.removeReference({
504
+ id: o,
459
505
  type: "AnnotationPage",
460
506
  key: "items",
461
507
  reference: {
@@ -465,19 +511,19 @@ function cn() {
465
511
  })
466
512
  ));
467
513
  },
468
- [r]
514
+ [o]
469
515
  );
470
516
  return [
471
- i,
517
+ r,
472
518
  {
473
- addAnnotation: o,
474
- removeAnnotation: a
519
+ addAnnotation: a,
520
+ removeAnnotation: i
475
521
  }
476
522
  ];
477
523
  }
478
- const Ue = U(null);
479
- function un() {
480
- const e = R(Ue);
524
+ const Vt = xe(null);
525
+ function mr() {
526
+ const e = ue(Vt);
481
527
  return [
482
528
  e.fullPage,
483
529
  {
@@ -486,274 +532,274 @@ function un() {
486
532
  }
487
533
  ];
488
534
  }
489
- function ln({ children: e }) {
490
- const [t, { addAnnotation: n, removeAnnotation: r }] = cn();
491
- return /* @__PURE__ */ l(
492
- Ue.Provider,
535
+ function vr({ children: e }) {
536
+ const [t, { addAnnotation: n, removeAnnotation: o }] = gr();
537
+ return /* @__PURE__ */ d(
538
+ Vt.Provider,
493
539
  {
494
- value: x(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
540
+ value: N(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: o }), [t]),
495
541
  children: e
496
542
  }
497
543
  );
498
544
  }
499
- function dn({
545
+ function br({
500
546
  width: e,
501
547
  style: t,
502
548
  height: n,
503
- error: r,
504
- resetErrorBoundary: i
549
+ error: o,
550
+ resetErrorBoundary: r
505
551
  }) {
506
- return /* @__PURE__ */ M("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
507
- /* @__PURE__ */ l("h3", { children: "Error occurred" }),
508
- /* @__PURE__ */ l("p", { children: r.message }),
509
- /* @__PURE__ */ l("button", { onClick: i, children: "Reset" })
552
+ return /* @__PURE__ */ X("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
553
+ /* @__PURE__ */ d("h3", { children: "Error occurred" }),
554
+ /* @__PURE__ */ d("p", { children: o.message }),
555
+ /* @__PURE__ */ d("button", { onClick: r, children: "Reset" })
510
556
  ] });
511
557
  }
512
- const pe = U(null);
513
- function fn() {
514
- return R(pe);
558
+ const pt = xe(null);
559
+ function wr() {
560
+ return ue(pt);
515
561
  }
516
- const je = U(
562
+ const _t = xe(
517
563
  () => {
518
564
  }
519
- ), qe = U(
565
+ ), Dt = xe(
520
566
  () => {
521
567
  }
522
568
  );
523
- function G(e, t, n, r, i = []) {
524
- const o = R(e === "portal" ? qe : je);
525
- k(() => (e !== "none" && o(t, n, r), () => {
526
- o(t, null);
527
- }), [t, e, o, ...i]);
528
- }
529
- function j(e = {}, t = []) {
530
- const { id: n, selector: r } = e, i = H(), o = n || i.canvas, a = V((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
531
- return x(() => {
532
- if (a)
533
- return r ? r(a) : a;
534
- }, [a, r, ...t]);
535
- }
536
- const $e = U(() => {
569
+ function Ve(e, t, n, o, r = []) {
570
+ const a = ue(e === "portal" ? Dt : _t);
571
+ be(() => (e !== "none" && a(t, n, o), () => {
572
+ a(t, null);
573
+ }), [t, e, a, ...r]);
574
+ }
575
+ function Se(e = {}, t = []) {
576
+ const { id: n, selector: o } = e, r = je(), a = n || r.canvas, i = ye((s) => a ? s.iiif.entities.Canvas[a] : void 0, [a]);
577
+ return N(() => {
578
+ if (i)
579
+ return o ? o(i) : i;
580
+ }, [i, o, ...t]);
581
+ }
582
+ const Bt = xe(() => {
537
583
  });
538
- function hn(e) {
539
- const t = j(), n = R($e);
540
- k(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
584
+ function Pr(e) {
585
+ const t = Se(), n = ue(Bt);
586
+ be(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
541
587
  }, [t, e]);
542
588
  }
543
- function gn({
589
+ function Or({
544
590
  children: e,
545
591
  errorFallback: t,
546
592
  outerContainerProps: n = {},
547
- worldScale: r,
548
- ...i
593
+ worldScale: o,
594
+ ...r
549
595
  }) {
550
- const [o, a] = T(), s = _t(), c = t || dn, [d, u] = T({}), f = Object.entries(d), [m, p] = T({}), g = Object.entries(m), [h, y] = T({}), w = x(() => r || Math.max(...Object.values(h)), [h]), A = x(() => ({ maxOverZoom: w || 1, ...i.runtimeOptions || {} }), [w, i.runtimeOptions]), S = b((P, L) => {
551
- y((F) => {
552
- if (L === -1) {
553
- const { [P]: v, ..._ } = F;
554
- return _;
596
+ const [a, i] = ie(), s = zn(), f = t || br, [h, u] = ie({}), y = Object.entries(h), [x, M] = ie({}), I = Object.entries(x), [b, E] = ie({}), C = N(() => o || Math.max(...Object.values(b)), [b]), A = N(() => ({ maxOverZoom: C || 1, ...r.runtimeOptions || {} }), [C, r.runtimeOptions]), S = Q((R, B) => {
597
+ E((j) => {
598
+ if (B === -1) {
599
+ const { [R]: O, ...U } = j;
600
+ return U;
555
601
  }
556
- return { ...F, [P]: L };
602
+ return { ...j, [R]: B };
557
603
  });
558
- }, []), D = b((P, L, F) => {
559
- u(({ [P]: v, ..._ }) => L ? {
560
- ..._,
561
- [P]: { element: L, props: F }
562
- } : _);
563
- }, []), X = b((P, L, F) => {
564
- p(({ [P]: v, ..._ }) => L ? {
565
- ..._,
566
- [P]: { element: L, props: F }
567
- } : _);
604
+ }, []), F = Q((R, B, j) => {
605
+ u(({ [R]: O, ...U }) => B ? {
606
+ ...U,
607
+ [R]: { element: B, props: j }
608
+ } : U);
609
+ }, []), L = Q((R, B, j) => {
610
+ M(({ [R]: O, ...U }) => B ? {
611
+ ...U,
612
+ [R]: { element: B, props: j }
613
+ } : U);
568
614
  }, []);
569
- return /* @__PURE__ */ M(At, { resetKeys: [], fallbackRender: (P) => /* @__PURE__ */ l(c, { ...i, ...P }), children: [
570
- /* @__PURE__ */ l(
571
- mt,
615
+ return /* @__PURE__ */ X(_n, { resetKeys: [], fallbackRender: (R) => /* @__PURE__ */ d(f, { ...r, ...R }), children: [
616
+ /* @__PURE__ */ d(
617
+ Sn,
572
618
  {
573
- ...i,
574
- containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
575
- htmlChildren: /* @__PURE__ */ l(z, { children: f.map(([P, { element: L, props: F }]) => /* @__PURE__ */ l(B.Fragment, { children: /* @__PURE__ */ l(L, { ...F || {} }) }, P)) }),
576
- onCreated: (P) => {
577
- a(P), i.onCreated && i.onCreated(P);
619
+ ...r,
620
+ containerProps: { style: { position: "relative" }, ...r.containerProps || {} },
621
+ htmlChildren: /* @__PURE__ */ d(Oe, { children: y.map(([R, { element: B, props: j }]) => /* @__PURE__ */ d(Ie.Fragment, { children: /* @__PURE__ */ d(B, { ...j || {} }) }, R)) }),
622
+ onCreated: (R) => {
623
+ i(R), r.onCreated && r.onCreated(R);
578
624
  },
579
625
  runtimeOptions: A,
580
- children: /* @__PURE__ */ l(pe.Provider, { value: o, children: /* @__PURE__ */ l($e.Provider, { value: S, children: /* @__PURE__ */ l(je.Provider, { value: D, children: /* @__PURE__ */ l(qe.Provider, { value: X, children: /* @__PURE__ */ l(Ut, { bridge: s, children: /* @__PURE__ */ l(pt.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ l(ln, { children: e }) }) }) }) }) }) })
626
+ children: /* @__PURE__ */ d(pt.Provider, { value: a, children: /* @__PURE__ */ d(Bt.Provider, { value: S, children: /* @__PURE__ */ d(_t.Provider, { value: F, children: /* @__PURE__ */ d(Dt.Provider, { value: L, children: /* @__PURE__ */ d(Kn, { bridge: s, children: /* @__PURE__ */ d(xn.Provider, { value: r.mode || "explore", children: /* @__PURE__ */ d(vr, { children: e }) }) }) }) }) }) })
581
627
  }
582
628
  ),
583
- /* @__PURE__ */ l("div", { children: g.map(([P, { element: L, props: F }]) => /* @__PURE__ */ l(B.Fragment, { children: /* @__PURE__ */ l(L, { ...F || {} }) }, P)) })
629
+ /* @__PURE__ */ d("div", { children: I.map(([R, { element: B, props: j }]) => /* @__PURE__ */ d(Ie.Fragment, { children: /* @__PURE__ */ d(B, { ...j || {} }) }, R)) })
584
630
  ] });
585
631
  }
586
- const ee = {}, Be = {
632
+ const We = {}, qt = {
587
633
  get(e) {
588
634
  return e;
589
635
  },
590
- setMetaValue([e, t, n], r) {
591
- const i = Be.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
592
- ee[e] = {
593
- ...ee[e] || {},
636
+ setMetaValue([e, t, n], o) {
637
+ const r = qt.getResourceMeta(e, t), a = r ? r[n] : void 0, i = typeof o == "function" ? o(a) : o;
638
+ We[e] = {
639
+ ...We[e] || {},
594
640
  [t]: {
595
- ...(ee[e] || {})[t] || {},
596
- [n]: a
641
+ ...(We[e] || {})[t] || {},
642
+ [n]: i
597
643
  }
598
644
  };
599
645
  },
600
646
  getResourceMeta: (e, t) => {
601
- const n = ee[e];
647
+ const n = We[e];
602
648
  if (n)
603
649
  return t ? n[t] : n;
604
650
  }
605
651
  };
606
- function He(e = Be) {
652
+ function Ft(e = qt) {
607
653
  return {
608
- addEventListener(t, n, r, i) {
654
+ addEventListener(t, n, o, r) {
609
655
  if (t)
610
656
  return e.setMetaValue(
611
657
  [t.id, "eventManager", n],
612
- (o) => {
613
- const a = o || [];
614
- for (const s of a)
615
- if (s.callback === r)
616
- return a;
617
- return [...a, { callback: r, scope: i }];
658
+ (a) => {
659
+ const i = a || [];
660
+ for (const s of i)
661
+ if (s.callback === o)
662
+ return i;
663
+ return [...i, { callback: o, scope: r }];
618
664
  }
619
- ), r;
665
+ ), o;
620
666
  },
621
- removeEventListener(t, n, r) {
667
+ removeEventListener(t, n, o) {
622
668
  t && e.setMetaValue(
623
669
  [t.id, "eventManager", n],
624
- (i) => (i || []).filter((o) => o.callback !== r)
670
+ (r) => (r || []).filter((a) => a.callback !== o)
625
671
  );
626
672
  },
627
673
  getListenersAsProps(t, n) {
628
- const r = typeof t == "string" ? { id: t } : t;
629
- if (!r || !r.id)
674
+ const o = typeof t == "string" ? { id: t } : t;
675
+ if (!o || !o.id)
630
676
  return {};
631
- const i = e.getResourceMeta(r.id, "eventManager"), o = {};
632
- if (i && r)
633
- for (const a of Object.keys(i))
634
- o[a] = (s) => {
635
- const c = e.get(r);
636
- for (const { callback: d, scope: u } of i[a] || [])
637
- (!u || n && u.indexOf(n) !== -1) && d(s, c);
677
+ const r = e.getResourceMeta(o.id, "eventManager"), a = {};
678
+ if (r && o)
679
+ for (const i of Object.keys(r))
680
+ a[i] = (s) => {
681
+ const f = e.get(o);
682
+ for (const { callback: h, scope: u } of r[i] || [])
683
+ (!u || n && u.indexOf(n) !== -1) && h(s, f);
638
684
  };
639
- return o;
685
+ return a;
640
686
  }
641
687
  };
642
688
  }
643
- function Ye(e, t) {
644
- const n = I(), r = x(() => He(n), [n]), i = V(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
645
- return x(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
689
+ function Ut(e, t) {
690
+ const n = ae(), o = N(() => Ft(n), [n]), r = ye(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
691
+ return N(() => e ? o.getListenersAsProps(e, t) : {}, [r, e, n, t]);
646
692
  }
647
- function re(e, t) {
648
- const n = I(), r = x(() => ge(n), [n]);
649
- return V(() => {
693
+ function ze(e, t) {
694
+ const n = ae(), o = N(() => ut(n), [n]);
695
+ return ye(() => {
650
696
  if (!e)
651
697
  return null;
652
- const i = r.getAppliedStyles(e.id);
653
- return i ? t ? i[t] : i : void 0;
698
+ const r = o.getAppliedStyles(e.id);
699
+ return r ? t ? r[t] : r : void 0;
654
700
  }, [e, t]);
655
701
  }
656
- function ze(e = {}, t = []) {
657
- const { id: n, selector: r } = e, i = H(), o = I(), a = n || i.annotation, s = V(
658
- (d) => a ? d.iiif.entities.Annotation[a] : void 0,
659
- [a]
660
- ), c = V(
661
- (d) => s && s.body ? s.body.map((u) => u ? u.type === "SpecificResource" ? {
702
+ function $t(e = {}, t = []) {
703
+ const { id: n, selector: o } = e, r = je(), a = ae(), i = n || r.annotation, s = ye(
704
+ (h) => i ? h.iiif.entities.Annotation[i] : void 0,
705
+ [i]
706
+ ), f = ye(
707
+ (h) => s && s.body ? s.body.map((u) => u ? u.type === "SpecificResource" ? {
662
708
  ...u,
663
- source: o.get(u)
664
- } : u ? d.iiif.entities[u.type][u.id] : null : null).filter(Boolean) : [],
709
+ source: a.get(u)
710
+ } : u ? h.iiif.entities[u.type][u.id] : null : null).filter(Boolean) : [],
665
711
  [s]
666
712
  );
667
- return x(() => {
713
+ return N(() => {
668
714
  if (!s)
669
715
  return;
670
- const d = {
716
+ const h = {
671
717
  ...s,
672
- body: c,
673
- target: le(s.target, { typeMap: o.getState().iiif.mapping })
718
+ body: f,
719
+ target: ot(s.target, { typeMap: a.getState().iiif.mapping })
674
720
  };
675
- return r ? r(d) : d;
676
- }, [s, r, c, ...t]);
721
+ return o ? o(h) : h;
722
+ }, [s, o, f, ...t]);
677
723
  }
678
- const Ke = ({
724
+ const Wt = ({
679
725
  id: e,
680
726
  style: t,
681
727
  className: n,
682
- interactive: r
728
+ interactive: o
683
729
  }) => {
684
- const i = ze({ id: e }), o = re(i, "atlas"), a = re(i, "html"), s = Ye(i, ["atlas"]), c = j(), d = x(() => yt(t, o), [t, o]);
685
- 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__ */ l(
686
- xt,
730
+ const r = $t({ id: e }), a = ze(r, "atlas"), i = ze(r, "html"), s = Ut(r, ["atlas"]), f = Se(), h = N(() => Tn(t, a), [t, a]);
731
+ return f && r && r.target && r.target.selector && r.target.selector.type === "BoxSelector" && r.target.source && (r.target.source.id === f.id || r.target.source === f.id) ? /* @__PURE__ */ d(
732
+ En,
687
733
  {
688
- id: i.id,
734
+ id: r.id,
689
735
  isEditing: !0,
690
- region: i.target.selector.spatial,
691
- style: d,
692
- className: (a == null ? void 0 : a.className) || n,
693
- interactive: !!(a != null && a.href || r),
694
- href: (a == null ? void 0 : a.href) || null,
695
- title: (a == null ? void 0 : a.title) || null,
696
- hrefTarget: (a == null ? void 0 : a.target) || null,
736
+ region: r.target.selector.spatial,
737
+ style: h,
738
+ className: (i == null ? void 0 : i.className) || n,
739
+ interactive: !!(i != null && i.href || o),
740
+ href: (i == null ? void 0 : i.href) || null,
741
+ title: (i == null ? void 0 : i.title) || null,
742
+ hrefTarget: (i == null ? void 0 : i.target) || null,
697
743
  onClick: () => {
698
744
  },
699
745
  ...s
700
746
  }
701
747
  ) : null;
702
748
  };
703
- function vn(e = {}, t = []) {
704
- const { id: n, selector: r } = e, i = H(), o = n || i.annotationPage, a = V(
705
- (s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
706
- [o]
749
+ function Sr(e = {}, t = []) {
750
+ const { id: n, selector: o } = e, r = je(), a = n || r.annotationPage, i = ye(
751
+ (s) => a ? s.iiif.entities.AnnotationPage[a] : void 0,
752
+ [a]
707
753
  );
708
- return x(() => {
709
- if (a)
710
- return r ? r(a) : a;
711
- }, [a, ...t]);
754
+ return N(() => {
755
+ if (i)
756
+ return o ? o(i) : i;
757
+ }, [i, ...t]);
712
758
  }
713
- const he = ({
759
+ const at = ({
714
760
  className: e,
715
761
  page: t
716
762
  }) => {
717
- var o;
718
- const n = vn({ id: t.id }) || t, r = re(n, "atlas"), i = re(n, "html");
719
- return V((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ l(ne, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ l(
720
- Ke,
763
+ var a;
764
+ const n = Sr({ id: t.id }) || t, o = ze(n, "atlas"), r = ze(n, "html");
765
+ return ye((i) => n.id ? i.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ d(Ye, { children: (a = n.items) == null ? void 0 : a.map((i) => /* @__PURE__ */ d(
766
+ Wt,
721
767
  {
722
- id: a.id,
723
- style: r,
724
- className: (i == null ? void 0 : i.className) || e
768
+ id: i.id,
769
+ style: o,
770
+ className: (r == null ? void 0 : r.className) || e
725
771
  },
726
- a.id
772
+ i.id
727
773
  )) });
728
774
  };
729
- function We({
775
+ function Ht({
730
776
  id: e,
731
777
  image: t,
732
778
  thumbnail: n,
733
- isStatic: r,
734
- x: i = 0,
735
- y: o = 0,
736
- children: a,
779
+ isStatic: o,
780
+ x: r = 0,
781
+ y: a = 0,
782
+ children: i,
737
783
  selector: s,
738
- onClick: c,
739
- enableSizes: d
784
+ onClick: f,
785
+ enableSizes: h
740
786
  }) {
741
- var f, m;
742
- const u = x(() => {
787
+ var y, x;
788
+ const u = N(() => {
743
789
  if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
744
790
  return s.spatial;
745
791
  }, [s]);
746
- return /* @__PURE__ */ l(
792
+ return /* @__PURE__ */ d(
747
793
  "world-object",
748
794
  {
749
- x: i + t.target.spatial.x,
750
- y: o + t.target.spatial.y,
795
+ x: r + t.target.spatial.x,
796
+ y: a + t.target.spatial.y,
751
797
  width: t.target.spatial.width,
752
798
  height: t.target.spatial.height,
753
- onClick: c,
754
- children: t.service ? /* @__PURE__ */ M(ne, { children: [
755
- /* @__PURE__ */ l(
756
- St,
799
+ onClick: f,
800
+ children: t.service ? /* @__PURE__ */ X(Ye, { children: [
801
+ /* @__PURE__ */ d(
802
+ In,
757
803
  {
758
804
  tiles: {
759
805
  id: t.service.id || t.service["@id"] || "unknown",
@@ -762,20 +808,20 @@ function We({
762
808
  imageService: t.service,
763
809
  thumbnail: n && n.type === "fixed" ? n : void 0
764
810
  },
765
- enableSizes: d,
811
+ enableSizes: h,
766
812
  x: 0,
767
813
  y: 0,
768
- width: (f = t.target) == null ? void 0 : f.spatial.width,
769
- height: (m = t.target) == null ? void 0 : m.spatial.height,
814
+ width: (y = t.target) == null ? void 0 : y.spatial.width,
815
+ height: (x = t.target) == null ? void 0 : x.spatial.height,
770
816
  crop: u
771
817
  }
772
818
  ),
773
- a
774
- ] }, "service") : /* @__PURE__ */ M(ne, { children: [
775
- /* @__PURE__ */ l(
819
+ i
820
+ ] }, "service") : /* @__PURE__ */ X(Ye, { children: [
821
+ /* @__PURE__ */ d(
776
822
  "world-image",
777
823
  {
778
- onClick: c,
824
+ onClick: f,
779
825
  uri: t.id,
780
826
  target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
781
827
  display: t.width && t.height ? {
@@ -785,20 +831,20 @@ function We({
785
831
  crop: u
786
832
  }
787
833
  ),
788
- a
834
+ i
789
835
  ] }, "no-service")
790
836
  },
791
837
  e + (t.service ? "server" : "no-service")
792
838
  );
793
839
  }
794
- function ur(e) {
840
+ function So(e) {
795
841
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
796
842
  }
797
- function Ge(e, t) {
798
- const { selector: n, source: r } = Ct(t);
799
- if (r.id !== e.id)
800
- return [null, r];
801
- const i = {
843
+ function Yt(e, t) {
844
+ const { selector: n, source: o } = Mn(t);
845
+ if (o.id !== e.id)
846
+ return [null, o];
847
+ const r = {
802
848
  type: "BoxSelector",
803
849
  spatial: {
804
850
  x: 0,
@@ -811,294 +857,294 @@ function Ge(e, t) {
811
857
  n ? n.type === "TemporalSelector" ? {
812
858
  type: "TemporalBoxSelector",
813
859
  temporal: n.temporal,
814
- spatial: i.spatial
860
+ spatial: r.spatial
815
861
  } : n : null,
816
- r
862
+ o
817
863
  ];
818
864
  }
819
- const mn = {
865
+ const xr = {
820
866
  makeChoice: () => {
821
867
  }
822
- }, ue = { type: "unknown" }, E = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), pn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
823
- function yn(e, t) {
824
- var r;
825
- const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
868
+ }, rt = { type: "unknown" }, ne = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), Tr = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
869
+ function Er(e, t) {
870
+ var o;
871
+ const n = (o = e == null ? void 0 : e.iiif) == null ? void 0 : o.meta[t];
826
872
  return n ? n.annotationPageManager : null;
827
873
  }
828
- function xn(e, t) {
829
- return V(
874
+ function Ir(e, t) {
875
+ return ye(
830
876
  (n) => {
831
- const r = [];
877
+ const o = [];
832
878
  if (!e)
833
- return r;
834
- const i = Object.keys(n.iiif.entities.AnnotationPage);
835
- for (const o of i)
836
- if (!t || t.indexOf(o) !== -1) {
837
- const a = yn(n, o);
838
- a && a.views && a.views[e] && r.push(o);
879
+ return o;
880
+ const r = Object.keys(n.iiif.entities.AnnotationPage);
881
+ for (const a of r)
882
+ if (!t || t.indexOf(a) !== -1) {
883
+ const i = Er(n, a);
884
+ i && i.views && i.views[e] && o.push(a);
839
885
  }
840
- return r;
886
+ return o;
841
887
  },
842
888
  [e, t]
843
889
  );
844
890
  }
845
- function Sn({
891
+ function Cr({
846
892
  canvas: e,
847
893
  manifest: t,
848
894
  all: n,
849
- canvases: r
895
+ canvases: o
850
896
  }) {
851
- const i = [];
897
+ const r = [];
852
898
  if (t)
853
- for (const o of t.annotations)
854
- i.indexOf(o.id) === -1 && i.push(o.id);
899
+ for (const a of t.annotations)
900
+ r.indexOf(a.id) === -1 && r.push(a.id);
855
901
  if (n) {
856
- if (r && r.length)
857
- for (const o of r)
858
- for (const a of o.annotations)
859
- i.indexOf(a.id) === -1 && i.push(a.id);
902
+ if (o && o.length)
903
+ for (const a of o)
904
+ for (const i of a.annotations)
905
+ r.indexOf(i.id) === -1 && r.push(i.id);
860
906
  } else if (e)
861
- for (const o of e.annotations)
862
- i.indexOf(o.id) === -1 && i.push(o.id);
863
- return i;
907
+ for (const a of e.annotations)
908
+ r.indexOf(a.id) === -1 && r.push(a.id);
909
+ return r;
864
910
  }
865
- function wn(e, t) {
866
- var r;
867
- const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
911
+ function jr(e, t) {
912
+ var o;
913
+ const n = (o = e == null ? void 0 : e.iiif) == null ? void 0 : o.meta[t];
868
914
  return n ? n.annotationPageManager : null;
869
915
  }
870
- function Cn(e, t = {}) {
871
- const n = I(), r = W(), i = j(), o = Fe(), a = x(() => Sn({
916
+ function zt(e, t = {}) {
917
+ const n = ae(), o = Ce(), r = Se(), a = Mt(), i = N(() => Cr({
872
918
  all: t.all,
873
- manifest: r,
874
- canvas: i,
875
- canvases: o
876
- }), [t.all, i, o, r]), s = xn(e, t.all ? void 0 : a), c = b(
919
+ manifest: o,
920
+ canvas: r,
921
+ canvases: a
922
+ }), [t.all, r, a, o]), s = Ir(e, t.all ? void 0 : i), f = Q(
877
923
  (u) => {
878
924
  e && n.setMetaValue(
879
925
  [u, "annotationPageManager", "views"],
880
- (f) => f && !f[e] ? f : {
881
- ...f || {},
926
+ (y) => y && !y[e] ? y : {
927
+ ...y || {},
882
928
  [e]: !1
883
929
  }
884
930
  );
885
931
  },
886
932
  [e, n]
887
- ), d = b(
888
- (u, f = {}) => {
933
+ ), h = Q(
934
+ (u, y = {}) => {
889
935
  if (!e)
890
936
  return;
891
- const m = n.getState(), p = [];
892
- if (f != null && f.deselectOthers) {
893
- const g = Object.keys(m.iiif.entities.AnnotationPage);
894
- for (const h of g) {
895
- const y = wn(m, h);
896
- y && y.views && y.views[e] && p.push(h);
937
+ const x = n.getState(), M = [];
938
+ if (y != null && y.deselectOthers) {
939
+ const I = Object.keys(x.iiif.entities.AnnotationPage);
940
+ for (const b of I) {
941
+ const E = jr(x, b);
942
+ E && E.views && E.views[e] && M.push(b);
897
943
  }
898
944
  }
899
- for (const g of p)
900
- c(g);
945
+ for (const I of M)
946
+ f(I);
901
947
  n.setMetaValue(
902
948
  [u, "annotationPageManager", "views"],
903
- (g) => g && g[e] ? g : {
904
- ...g || {},
949
+ (I) => I && I[e] ? I : {
950
+ ...I || {},
905
951
  [e]: !0
906
952
  }
907
953
  );
908
954
  },
909
- [e, c, n]
955
+ [e, f, n]
910
956
  );
911
957
  return {
912
- availablePageIds: a,
958
+ availablePageIds: i,
913
959
  enabledPageIds: s,
914
- setPageEnabled: d,
915
- setPageDisabled: c
960
+ setPageEnabled: h,
961
+ setPageDisabled: f
916
962
  };
917
963
  }
918
- function bn(e, t) {
919
- return V((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
920
- }
921
- const Pn = B.createContext(new bt());
922
- function ye() {
923
- return R(Pn);
924
- }
925
- function En() {
926
- const e = ye(), [t, n] = T({}), r = $(!1);
927
- return k(() => () => {
928
- r.current = !0;
929
- }, []), [b(
930
- (o, { height: a, width: s }) => {
931
- if (o) {
932
- const c = o.id || o["@id"], d = e.loadServiceSync({
933
- id: c,
934
- width: o.width || s,
935
- height: o.height || a,
936
- source: o
964
+ function Mr(e, t) {
965
+ return ye((n, o) => o.get(e.map((r) => ({ id: r, type: t }))), [e, t]);
966
+ }
967
+ const Rr = Ie.createContext(new Rn());
968
+ function Je() {
969
+ return ue(Rr);
970
+ }
971
+ function Lr() {
972
+ const e = Je(), [t, n] = ie({}), o = Ee(!1);
973
+ return be(() => () => {
974
+ o.current = !0;
975
+ }, []), [Q(
976
+ (a, { height: i, width: s }) => {
977
+ if (a) {
978
+ const f = a.id || a["@id"], h = e.loadServiceSync({
979
+ id: f,
980
+ width: a.width || s,
981
+ height: a.height || i,
982
+ source: a
937
983
  });
938
- d ? o = d : t[c] || (r.current || n((u) => ({
984
+ h ? a = h : t[f] || (o.current || n((u) => ({
939
985
  ...u,
940
- [c]: "loading"
986
+ [f]: "loading"
941
987
  })), e.loadService({
942
- id: c,
943
- width: o.width || s,
944
- height: o.height || a
988
+ id: f,
989
+ width: a.width || s,
990
+ height: a.height || i
945
991
  }).then(() => {
946
- r.current || n((u) => ({
992
+ o.current || n((u) => ({
947
993
  ...u,
948
- [c]: "done"
994
+ [f]: "done"
949
995
  }));
950
996
  }));
951
997
  }
952
- return o;
998
+ return a;
953
999
  },
954
1000
  [e, t]
955
1001
  ), t];
956
1002
  }
957
- function xe(e = {}) {
958
- const t = ze(), n = j(e.canvasId ? { id: e.canvasId } : void 0);
959
- return V(
960
- (r, i) => {
1003
+ function ht(e = {}) {
1004
+ const t = $t(), n = Se(e.canvasId ? { id: e.canvasId } : void 0);
1005
+ return ye(
1006
+ (o, r) => {
961
1007
  if (!n)
962
1008
  return [];
963
1009
  if (t && e.enableSingleAnnotation)
964
1010
  return [t];
965
- const o = i.get(n.items), a = [];
966
- for (const s of o)
967
- a.push(...i.get(s.items));
968
- return a;
1011
+ const a = r.get(n.items), i = [];
1012
+ for (const s of a)
1013
+ i.push(...r.get(s.items));
1014
+ return i;
969
1015
  },
970
1016
  [n]
971
1017
  );
972
1018
  }
973
- function In(e) {
1019
+ function Ar(e) {
974
1020
  return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
975
1021
  }
976
- const te = {}, Qe = {
1022
+ const He = {}, Kt = {
977
1023
  get(e) {
978
1024
  return e;
979
1025
  },
980
- setMetaValue([e, t, n], r) {
981
- const i = Qe.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
982
- te[e] = {
983
- ...te[e] || {},
1026
+ setMetaValue([e, t, n], o) {
1027
+ const r = Kt.getResourceMeta(e, t), a = r ? r[n] : void 0, i = typeof o == "function" ? o(a) : o;
1028
+ He[e] = {
1029
+ ...He[e] || {},
984
1030
  [t]: {
985
- ...(te[e] || {})[t] || {},
986
- [n]: a
1031
+ ...(He[e] || {})[t] || {},
1032
+ [n]: i
987
1033
  }
988
1034
  };
989
1035
  },
990
1036
  getResourceMeta: (e, t) => {
991
- const n = te[e];
1037
+ const n = He[e];
992
1038
  if (n)
993
1039
  return t ? n[t] : n;
994
1040
  }
995
1041
  };
996
- function An(e = Qe) {
997
- function t(i) {
998
- const o = i ? typeof i == "string" ? e.get(i) : i : null;
999
- if (!o)
1042
+ function kr(e = Kt) {
1043
+ function t(r) {
1044
+ const a = r ? typeof r == "string" ? e.get(r) : r : null;
1045
+ if (!a)
1000
1046
  return [];
1001
- const a = e.get(o.items, { parent: o }), s = [];
1002
- for (const c of a)
1003
- s.push(...e.get(c.items, { parent: c }));
1047
+ const i = e.get(a.items, { parent: a }), s = [];
1048
+ for (const f of i)
1049
+ s.push(...e.get(f.items, { parent: f }));
1004
1050
  return s;
1005
1051
  }
1006
- function n(i, o = []) {
1007
- const a = Array.isArray(i) ? i : t(i), s = [];
1008
- let c = null;
1009
- const d = [];
1010
- for (const u of a) {
1052
+ function n(r, a = []) {
1053
+ const i = Array.isArray(r) ? r : t(r), s = [];
1054
+ let f = null;
1055
+ const h = [];
1056
+ for (const u of i) {
1011
1057
  if (u.type !== "Annotation")
1012
1058
  throw new Error("getPaintables() accept either a canvas or list of annotations");
1013
- const f = Array.from(Array.isArray(u.body) ? u.body : [u.body]);
1014
- for (const m of f) {
1015
- const [p, { selector: g }] = In(m), h = e.get(p), y = (h.type || "unknown").toLowerCase();
1016
- if (y === "choice") {
1017
- const w = e.get(h.items, { parent: h.id }), A = o.length ? o.map((S) => w.find((D) => D.id === S)).filter(Boolean) : [w[0]];
1018
- A.length === 0 && A.push(w[0]), c = {
1059
+ const y = Array.from(Array.isArray(u.body) ? u.body : [u.body]);
1060
+ for (const x of y) {
1061
+ const [M, { selector: I }] = Ar(x), b = e.get(M), E = (b.type || "unknown").toLowerCase();
1062
+ if (E === "choice") {
1063
+ const C = e.get(b.items, { parent: b.id }), A = a.length ? a.map((S) => C.find((F) => F.id === S)).filter(Boolean) : [C[0]];
1064
+ A.length === 0 && A.push(C[0]), f = {
1019
1065
  type: "single-choice",
1020
- items: w.map((S) => ({
1066
+ items: C.map((S) => ({
1021
1067
  id: S.id,
1022
1068
  label: S.label,
1023
1069
  selected: A.indexOf(S) !== -1
1024
1070
  })),
1025
- label: p.label
1026
- }, f.push(...A);
1071
+ label: M.label
1072
+ }, y.push(...A);
1027
1073
  continue;
1028
1074
  }
1029
- s.indexOf(y) === -1 && s.push(y), d.push({
1030
- type: y,
1075
+ s.indexOf(E) === -1 && s.push(E), h.push({
1076
+ type: E,
1031
1077
  annotationId: u.id,
1032
- resource: h,
1078
+ resource: b,
1033
1079
  target: u.target,
1034
- selector: g
1080
+ selector: I
1035
1081
  });
1036
1082
  }
1037
1083
  }
1038
1084
  return {
1039
1085
  types: s,
1040
- items: d,
1041
- choice: c
1086
+ items: h,
1087
+ choice: f
1042
1088
  };
1043
1089
  }
1044
- function r(i) {
1045
- const { choice: o } = n(i);
1046
- return o;
1090
+ function o(r) {
1091
+ const { choice: a } = n(r);
1092
+ return a;
1047
1093
  }
1048
1094
  return {
1049
1095
  getAllPaintingAnnotations: t,
1050
1096
  getPaintables: n,
1051
- extractChoices: r
1097
+ extractChoices: o
1052
1098
  };
1053
1099
  }
1054
- function Mn(e, t = []) {
1055
- const n = I(), r = x(() => An(n), []), i = xe({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = T((e == null ? void 0 : e.defaultChoices) || []), s = x(
1056
- () => r.getPaintables(i, o),
1057
- [n, i, o, ...t]
1058
- ), d = { makeChoice: b(
1059
- (u, { deselectOthers: f = !0, deselect: m = !1 } = {}) => {
1100
+ function Nr(e, t = []) {
1101
+ const n = ae(), o = N(() => kr(n), []), r = ht({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [a, i] = ie((e == null ? void 0 : e.defaultChoices) || []), s = N(
1102
+ () => o.getPaintables(r, a),
1103
+ [n, r, a, ...t]
1104
+ ), h = { makeChoice: Q(
1105
+ (u, { deselectOthers: y = !0, deselect: x = !1 } = {}) => {
1060
1106
  if (s.choice) {
1061
1107
  if (s.choice.type !== "single-choice")
1062
1108
  throw new Error("Complex choice not supported yet");
1063
- a((p) => {
1064
- if (m) {
1065
- const h = p.filter((y) => y !== u);
1066
- if (h.length === 0) {
1067
- const y = s.items[0].resource.id;
1068
- return y ? [y] : [];
1109
+ i((M) => {
1110
+ if (x) {
1111
+ const b = M.filter((E) => E !== u);
1112
+ if (b.length === 0) {
1113
+ const E = s.items[0].resource.id;
1114
+ return E ? [E] : [];
1069
1115
  }
1070
- return h;
1116
+ return b;
1071
1117
  }
1072
- if (f)
1118
+ if (y)
1073
1119
  return [u];
1074
- const g = [...p];
1075
- if (g.length === 0 && s.items.length) {
1076
- const h = s.items[0].resource.id;
1077
- h && g.push(h);
1120
+ const I = [...M];
1121
+ if (I.length === 0 && s.items.length) {
1122
+ const b = s.items[0].resource.id;
1123
+ b && I.push(b);
1078
1124
  }
1079
- return p.indexOf(u) !== -1 ? p : [...p, u];
1125
+ return M.indexOf(u) !== -1 ? M : [...M, u];
1080
1126
  });
1081
1127
  }
1082
1128
  },
1083
1129
  [s.choice]
1084
1130
  ) };
1085
- return [s, d];
1131
+ return [s, h];
1086
1132
  }
1087
- const Rn = ["model/gltf-binary"];
1088
- function Tn(e, t) {
1089
- const r = t.items[0].resource;
1090
- return r.format ? Rn.indexOf(r.format) === -1 ? E(`3D format: ${r.format} is unsupported`) : {
1133
+ const Vr = ["model/gltf-binary"];
1134
+ function _r(e, t) {
1135
+ const o = t.items[0].resource;
1136
+ return o.format ? Vr.indexOf(o.format) === -1 ? ne(`3D format: ${o.format} is unsupported`) : {
1091
1137
  type: "3d-model",
1092
- model: r
1093
- } : E("Unknown format");
1138
+ model: o
1139
+ } : ne("Unknown format");
1094
1140
  }
1095
- function Vn(e, t) {
1096
- var r;
1141
+ function Dr(e, t) {
1142
+ var o;
1097
1143
  if (!e.duration)
1098
- return E("No duration on canvas");
1144
+ return ne("No duration on canvas");
1099
1145
  if (t.items.length > 1)
1100
- return E("Only one audio source supported");
1101
- const n = (r = t.items[0]) == null ? void 0 : r.resource;
1146
+ return ne("Only one audio source supported");
1147
+ const n = (o = t.items[0]) == null ? void 0 : o.resource;
1102
1148
  return n ? n.format ? {
1103
1149
  type: "media",
1104
1150
  media: {
@@ -1125,18 +1171,18 @@ function Vn(e, t) {
1125
1171
  annotations: {
1126
1172
  pages: []
1127
1173
  }
1128
- } : E("Audio does not have format") : E("Unknown audio");
1129
- }
1130
- function Ln(e, t, n) {
1131
- const r = [];
1132
- for (const i of t.items) {
1133
- const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
1134
- if (!o.id)
1135
- return E("No resource Identifier");
1136
- let a;
1137
- if (o.service) {
1138
- const p = de(o);
1139
- p[0] && (a = n(p[0], e));
1174
+ } : ne("Audio does not have format") : ne("Unknown audio");
1175
+ }
1176
+ function Br(e, t, n) {
1177
+ const o = [];
1178
+ for (const r of t.items) {
1179
+ const a = r.resource && r.resource.type === "SpecificResource" ? r.resource.source : r.resource;
1180
+ if (!a.id)
1181
+ return ne("No resource Identifier");
1182
+ let i;
1183
+ if (a.service) {
1184
+ const M = it(a);
1185
+ M[0] && (i = n(M[0], e));
1140
1186
  }
1141
1187
  const s = {
1142
1188
  type: "BoxSelector",
@@ -1146,20 +1192,20 @@ function Ln(e, t, n) {
1146
1192
  width: Number(e.width),
1147
1193
  height: Number(e.height)
1148
1194
  }
1149
- }, [c, d] = Ge(e, i.target);
1150
- if (d.id !== e.id)
1195
+ }, [f, h] = Yt(e, r.target);
1196
+ if (!(h.id === e.id || decodeURIComponent(h.id || "") === (e.id || "")))
1151
1197
  continue;
1152
- i.resource.width && i.resource.height && (i.resource.width, i.resource.height);
1153
- let u = i.resource.type === "SpecificResource" ? le(i.resource) : null;
1154
- if (i.selector) {
1155
- const p = le({
1198
+ r.resource.width && r.resource.height && (r.resource.width, r.resource.height);
1199
+ let u = r.resource.type === "SpecificResource" ? ot(r.resource) : null;
1200
+ if (r.selector) {
1201
+ const M = ot({
1156
1202
  type: "SpecificResource",
1157
- source: i.resource,
1158
- selector: i.selector
1203
+ source: r.resource,
1204
+ selector: r.selector
1159
1205
  });
1160
- p && (u = p);
1206
+ M && (u = M);
1161
1207
  }
1162
- const f = u && u.selector && (u.selector.type === "BoxSelector" || u.selector.type === "TemporalBoxSelector") ? {
1208
+ const y = u && u.selector && (u.selector.type === "BoxSelector" || u.selector.type === "TemporalBoxSelector") ? {
1163
1209
  type: "BoxSelector",
1164
1210
  spatial: {
1165
1211
  x: u.selector.spatial.x,
@@ -1168,73 +1214,73 @@ function Ln(e, t, n) {
1168
1214
  height: u.selector.spatial.height
1169
1215
  }
1170
1216
  } : void 0;
1171
- a && !a.id && (a.id = a["@id"]);
1172
- const m = {
1173
- id: o.id,
1217
+ i && !i.id && (i.id = i["@id"]);
1218
+ const x = {
1219
+ id: a.id,
1174
1220
  type: "Image",
1175
- annotationId: i.annotationId,
1176
- width: Number(c || f ? o.width : e.width),
1177
- height: Number(c || f ? o.height : e.height),
1178
- service: a,
1179
- sizes: a && a.sizes ? a.sizes : o.width && o.height ? [{ width: o.width, height: o.height }] : [],
1180
- target: c && c.type !== "PointSelector" ? c : s,
1181
- selector: f
1221
+ annotationId: r.annotationId,
1222
+ width: Number(f || y ? a.width : e.width),
1223
+ height: Number(f || y ? a.height : e.height),
1224
+ service: i,
1225
+ sizes: i && i.sizes ? i.sizes : a.width && a.height ? [{ width: a.width, height: a.height }] : [],
1226
+ target: f && f.type !== "PointSelector" ? f : s,
1227
+ selector: y
1182
1228
  };
1183
- r.push(m);
1229
+ o.push(x);
1184
1230
  }
1185
1231
  return {
1186
1232
  type: "images",
1187
- image: r[0],
1188
- images: r,
1233
+ image: o[0],
1234
+ images: o,
1189
1235
  choice: t.choice
1190
1236
  };
1191
1237
  }
1192
- function Je(e, t = {}, n) {
1193
- const r = e.language || n || "none";
1238
+ function Qt(e, t = {}, n) {
1239
+ const o = e.language || n || "none";
1194
1240
  switch (e.type) {
1195
1241
  case "TextualBody": {
1196
- typeof e.value < "u" && (t[r] = e.value);
1242
+ typeof e.value < "u" && (t[o] = e.value);
1197
1243
  break;
1198
1244
  }
1199
1245
  case "List":
1200
1246
  case "Composite":
1201
1247
  case "Choice":
1202
- e.items && e.items.forEach((i) => Je(i, t, r));
1248
+ e.items && e.items.forEach((r) => Qt(r, t, o));
1203
1249
  }
1204
1250
  return t;
1205
1251
  }
1206
- function On(e, t) {
1252
+ function qr(e, t) {
1207
1253
  const n = [];
1208
- return t.items.forEach((r) => {
1209
- if (r.resource) {
1210
- const [i] = Ge(e, r.target);
1211
- n.push({ annotationId: r.annotationId, text: Je(r.resource), target: i });
1254
+ return t.items.forEach((o) => {
1255
+ if (o.resource) {
1256
+ const [r] = Yt(e, o.target);
1257
+ n.push({ annotationId: o.annotationId, text: Qt(o.resource), target: r });
1212
1258
  }
1213
1259
  }), {
1214
1260
  type: "textual-content",
1215
1261
  items: n
1216
1262
  };
1217
1263
  }
1218
- const kn = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1219
- function Fn(e, t) {
1264
+ const Fr = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
1265
+ function Ur(e, t) {
1220
1266
  var s;
1221
- const n = t.items.filter((c) => c.type === "video");
1222
- let r = !1;
1223
- if (e.duration || (r = !0), n.length > 1)
1224
- return E("Only one video source supported");
1225
- const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
1226
- (c) => (c.profile || "").includes("youtube.com")
1267
+ const n = t.items.filter((f) => f.type === "video");
1268
+ let o = !1;
1269
+ if (e.duration || (o = !0), n.length > 1)
1270
+ return ne("Only one video source supported");
1271
+ const r = (s = n[0]) == null ? void 0 : s.resource, a = !!(r.service || []).find(
1272
+ (f) => (f.profile || "").includes("youtube.com")
1227
1273
  );
1228
- if (!o && r)
1229
- return E("Video does not have duration");
1230
- if (!i)
1231
- return E("Unknown video");
1232
- if ((!i.format || i.format === "text/html") && !o)
1233
- return E("Video does not have format");
1234
- const a = {
1274
+ if (!a && o)
1275
+ return ne("Video does not have duration");
1276
+ if (!r)
1277
+ return ne("Unknown video");
1278
+ if ((!r.format || r.format === "text/html") && !a)
1279
+ return ne("Video does not have format");
1280
+ const i = {
1235
1281
  annotationId: t.items[0].annotationId,
1236
1282
  duration: e.duration,
1237
- url: i.id,
1283
+ url: r.id,
1238
1284
  type: "Video",
1239
1285
  items: [],
1240
1286
  target: {
@@ -1244,7 +1290,7 @@ function Fn(e, t) {
1244
1290
  endTime: e.duration
1245
1291
  }
1246
1292
  },
1247
- format: i.format,
1293
+ format: r.format,
1248
1294
  selector: {
1249
1295
  type: "TemporalSelector",
1250
1296
  temporal: {
@@ -1253,77 +1299,77 @@ function Fn(e, t) {
1253
1299
  }
1254
1300
  }
1255
1301
  };
1256
- if (o) {
1257
- a.type = "VideoYouTube";
1258
- const c = i.id.match(kn);
1259
- if (!c[1])
1260
- return E("Video is not known youtube video");
1261
- a.youTubeId = c[1];
1302
+ if (a) {
1303
+ i.type = "VideoYouTube";
1304
+ const f = r.id.match(Fr);
1305
+ if (!f[1])
1306
+ return ne("Video is not known youtube video");
1307
+ i.youTubeId = f[1];
1262
1308
  }
1263
1309
  return {
1264
1310
  type: "media",
1265
- media: a,
1311
+ media: i,
1266
1312
  annotations: {
1267
1313
  pages: []
1268
1314
  }
1269
1315
  };
1270
1316
  }
1271
- function Nn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
1317
+ function $r({ canvas: e, paintables: t, supports: n, loadImageService: o }) {
1272
1318
  if (!e)
1273
- return console.log("No canvas"), ue;
1319
+ return console.log("No canvas"), rt;
1274
1320
  if (t.types.length === 0)
1275
- return n.indexOf("empty") !== -1 ? pn(e.width, e.height) : (console.log("No paintables"), ue);
1321
+ return n.indexOf("empty") !== -1 ? Tr(e.width, e.height) : (console.log("No paintables"), rt);
1276
1322
  if (t.types.length !== 1)
1277
1323
  if (t.types.length === 2 && t.types.indexOf("text") !== -1)
1278
- t.types = t.types.filter((o) => o !== "text");
1324
+ t.types = t.types.filter((a) => a !== "text");
1279
1325
  else
1280
- return n.indexOf("complex-timeline") === -1 ? E("Complex timeline not supported") : E("ComplexTimelineStrategy not yet supported");
1281
- const i = t.types[0];
1282
- return i === "image" ? n.indexOf("images") === -1 ? E("Image not supported") : Ln(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? E("3D not supported") : Tn(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? E("Textual content not supported") : On(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? E("Media not supported") : Vn(e, t) : i === "video" ? n.indexOf("media") === -1 ? E("Media not supported") : Fn(e, t) : ue;
1326
+ return n.indexOf("complex-timeline") === -1 ? ne("Complex timeline not supported") : ne("ComplexTimelineStrategy not yet supported");
1327
+ const r = t.types[0];
1328
+ return r === "image" ? n.indexOf("images") === -1 ? ne("Image not supported") : Br(e, t, o) : r === "Model" || r === "model" ? n.indexOf("3d-model") === -1 ? ne("3D not supported") : _r(e, t) : r === "textualbody" ? n.indexOf("textual-content") === -1 ? ne("Textual content not supported") : qr(e, t) : r === "sound" || r === "audio" ? n.indexOf("media") === -1 ? ne("Media not supported") : Dr(e, t) : r === "video" ? n.indexOf("media") === -1 ? ne("Media not supported") : Ur(e, t) : rt;
1283
1329
  }
1284
- function Dn(e) {
1285
- const t = W(), n = j(), r = I(), [i, o] = En(), { enabledPageIds: a } = Cn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1330
+ function Wr(e) {
1331
+ const t = Ce(), n = Se(), o = ae(), [r, a] = Lr(), { enabledPageIds: i } = zt((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
1286
1332
  all: !1
1287
- }), s = bn(a, "AnnotationPage"), c = (e == null ? void 0 : e.strategies) || [
1333
+ }), s = Mr(i, "AnnotationPage"), f = (e == null ? void 0 : e.strategies) || [
1288
1334
  "empty",
1289
1335
  "images",
1290
1336
  "media",
1291
1337
  "textual-content",
1292
1338
  "complex-timeline"
1293
- ], [d, u] = Mn(e, [o]), f = x(() => Nn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, u.makeChoice]);
1294
- return x(() => f.type === "unknown" ? [f, mn] : [
1339
+ ], [h, u] = Nr(e, [a]), y = N(() => $r({ canvas: n, paintables: h, supports: f, loadImageService: r }), [n, h, o, u.makeChoice]);
1340
+ return N(() => y.type === "unknown" ? [y, xr] : [
1295
1341
  {
1296
- ...f,
1342
+ ...y,
1297
1343
  annotations: { pages: s }
1298
1344
  },
1299
1345
  u
1300
- ], [f, s]);
1346
+ ], [y, s]);
1301
1347
  }
1302
- const _n = (e, t = []) => {
1303
- const n = I();
1304
- k(() => {
1348
+ const Hr = (e, t = []) => {
1349
+ const n = ae();
1350
+ be(() => {
1305
1351
  e(n);
1306
1352
  }, [n, ...t]);
1307
1353
  };
1308
- function Un(e, t, { canvasId: n, manifestId: r } = {}) {
1309
- const i = I(), o = ye(), a = x(() => Pt(i, { imageServiceLoader: o }), [i, o]), [s, c] = T(), d = W(r ? { id: r } : void 0), u = j(n ? { id: n } : void 0), f = u || d, m = $(!1);
1310
- if (k(() => (m.current = !1, () => {
1311
- m.current = !0;
1312
- }), []), !f)
1354
+ function Gt(e, t, { canvasId: n, manifestId: o } = {}) {
1355
+ const r = ae(), a = Je(), i = N(() => kn(r, { imageServiceLoader: a }), [r, a]), [s, f] = ie(), h = Ce(o ? { id: o } : void 0), u = Se(n ? { id: n } : void 0), y = u || h, x = Ee(!1);
1356
+ if (be(() => (x.current = !1, () => {
1357
+ x.current = !0;
1358
+ }), []), !y)
1313
1359
  throw new Error("Must be called under a manifest or canvas context.");
1314
- return _n(
1315
- (p) => {
1316
- a.getBestThumbnailAtSize(f, e, t).then((g) => {
1317
- g.best && !m.current && c(g.best);
1360
+ return Hr(
1361
+ (M) => {
1362
+ i.getBestThumbnailAtSize(y, e, t).then((I) => {
1363
+ I.best && !x.current && f(I.best);
1318
1364
  });
1319
1365
  },
1320
- [f]
1366
+ [y]
1321
1367
  ), s;
1322
1368
  }
1323
- function jn(e) {
1369
+ function Yr(e) {
1324
1370
  return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
1325
1371
  }
1326
- function qn(e, t) {
1372
+ function zr(e, t) {
1327
1373
  switch (t.type) {
1328
1374
  case "FINISHED":
1329
1375
  return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
@@ -1346,120 +1392,120 @@ function qn(e, t) {
1346
1392
  }
1347
1393
  return e;
1348
1394
  }
1349
- function $n(e) {
1395
+ function Kr(e) {
1350
1396
  const t = Math.round(e);
1351
1397
  return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
1352
1398
  }
1353
- function Se(e) {
1354
- const [t, n] = gt(qn, jn(e.duration)), r = $(null), i = $(null), o = $(null), a = $(!1), s = b(() => {
1355
- i.current && r.current && (i.current.innerHTML = $n(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" })));
1356
- }, [e.duration]), c = b(() => {
1357
- r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
1399
+ function yt(e) {
1400
+ const [t, n] = On(zr, Yr(e.duration)), o = Ee(null), r = Ee(null), a = Ee(null), i = Ee(!1), s = Q(() => {
1401
+ r.current && o.current && (r.current.innerHTML = Kr(o.current.currentTime), a.current && (a.current.style.width = `${o.current.currentTime / e.duration * 100}%`), i.current !== o.current.muted && (i.current = o.current.muted, n(o.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
1402
+ }, [e.duration]), f = Q(() => {
1403
+ o.current && (n({ type: "PLAY_REQUESTED" }), o.current.play().then(() => {
1358
1404
  n({ type: "PLAY" });
1359
1405
  }), s());
1360
- }, [s]), d = b(() => {
1361
- r.current && (r.current.duration > 0 && r.current.paused ? c() : u());
1362
- }, [s]), u = b(() => {
1363
- r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
1364
- }, [s]), f = b(() => {
1365
- r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1366
- }, []), m = b(() => {
1367
- r.current && (r.current.muted = !0, n({ type: "MUTE" }));
1368
- }, []), p = b(() => {
1369
- r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
1370
- }, []), g = b((w) => {
1371
- r.current && (r.current.muted = !1, r.current.volume = w / 100, n({ type: "SET_VOLUME", volume: w }));
1372
- }, []), h = b((w) => {
1373
- r.current && (r.current.currentTime = Math.max(0, Math.min(w * e.duration, e.duration)), s());
1374
- }, []), y = b((w) => {
1375
- r.current && (r.current.currentTime = Math.max(0, Math.min(w, e.duration)), s());
1406
+ }, [s]), h = Q(() => {
1407
+ o.current && (o.current.duration > 0 && o.current.paused ? f() : u());
1408
+ }, [s]), u = Q(() => {
1409
+ o.current && (o.current.pause(), n({ type: "PAUSE" }), s());
1410
+ }, [s]), y = Q(() => {
1411
+ o.current && (o.current.muted = !o.current.muted, n(o.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
1412
+ }, []), x = Q(() => {
1413
+ o.current && (o.current.muted = !0, n({ type: "MUTE" }));
1414
+ }, []), M = Q(() => {
1415
+ o.current && (o.current.muted = !1, n({ type: "UNMUTE" }));
1416
+ }, []), I = Q((C) => {
1417
+ o.current && (o.current.muted = !1, o.current.volume = C / 100, n({ type: "SET_VOLUME", volume: C }));
1418
+ }, []), b = Q((C) => {
1419
+ o.current && (o.current.currentTime = Math.max(0, Math.min(C * e.duration, e.duration)), s());
1420
+ }, []), E = Q((C) => {
1421
+ o.current && (o.current.currentTime = Math.max(0, Math.min(C, e.duration)), s());
1376
1422
  }, []);
1377
- return k(() => {
1378
- const w = setInterval(() => {
1423
+ return be(() => {
1424
+ const C = setInterval(() => {
1379
1425
  s();
1380
1426
  }, 350);
1381
- return () => clearInterval(w);
1382
- }, [s, e.duration]), k(() => {
1383
- const w = () => {
1427
+ return () => clearInterval(C);
1428
+ }, [s, e.duration]), be(() => {
1429
+ const C = () => {
1384
1430
  n({ type: "FINISHED" });
1385
- }, A = r.current;
1386
- return A == null || A.addEventListener("ended", w), () => A == null ? void 0 : A.removeEventListener("ended", w);
1431
+ }, A = o.current;
1432
+ return A == null || A.addEventListener("ended", C), () => A == null ? void 0 : A.removeEventListener("ended", C);
1387
1433
  }, []), [
1388
- { element: r, currentTime: i, progress: o },
1434
+ { element: o, currentTime: r, progress: a },
1389
1435
  t,
1390
1436
  {
1391
- play: c,
1437
+ play: f,
1392
1438
  pause: u,
1393
- playPause: d,
1394
- mute: m,
1395
- unmute: p,
1396
- toggleMute: f,
1397
- setVolume: g,
1398
- setDurationPercent: h,
1399
- setTime: y
1439
+ playPause: h,
1440
+ mute: x,
1441
+ unmute: M,
1442
+ toggleMute: y,
1443
+ setVolume: I,
1444
+ setDurationPercent: b,
1445
+ setTime: E
1400
1446
  }
1401
1447
  ];
1402
1448
  }
1403
- const Ze = U(null), Xe = U(null), et = U(null);
1404
- function lr() {
1405
- const e = R(Ze);
1449
+ const Xt = xe(null), Jt = xe(null), Zt = xe(null);
1450
+ function xo() {
1451
+ const e = ue(Xt);
1406
1452
  if (!e)
1407
1453
  throw new Error("Ctx not found");
1408
1454
  return e;
1409
1455
  }
1410
- function dr() {
1411
- const e = R(Xe);
1456
+ function To() {
1457
+ const e = ue(Jt);
1412
1458
  if (!e)
1413
1459
  throw new Error("Ctx not found");
1414
1460
  return e;
1415
1461
  }
1416
- function fr() {
1417
- const e = R(et);
1462
+ function Eo() {
1463
+ const e = ue(Zt);
1418
1464
  if (!e)
1419
1465
  throw new Error("Ctx not found");
1420
1466
  return e;
1421
1467
  }
1422
- function tt({
1468
+ function en({
1423
1469
  actions: e,
1424
1470
  state: t,
1425
1471
  children: n,
1426
- currentTime: r,
1427
- progress: i,
1428
- element: o
1472
+ currentTime: o,
1473
+ progress: r,
1474
+ element: a
1429
1475
  }) {
1430
- return /* @__PURE__ */ l(et.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ l(Xe.Provider, { value: e, children: /* @__PURE__ */ l(Ze.Provider, { value: t, children: n }) }) });
1476
+ return /* @__PURE__ */ d(Zt.Provider, { value: { currentTime: o, progress: r, element: a }, children: /* @__PURE__ */ d(Jt.Provider, { value: e, children: /* @__PURE__ */ d(Xt.Provider, { value: t, children: n }) }) });
1431
1477
  }
1432
- function nt({ media: e, children: t }) {
1433
- const [{ element: n, currentTime: r, progress: i }, o, a] = Se({ duration: e.duration });
1434
- return /* @__PURE__ */ M(
1435
- tt,
1478
+ function tn({ media: e, children: t }) {
1479
+ const [{ element: n, currentTime: o, progress: r }, a, i] = yt({ duration: e.duration });
1480
+ return /* @__PURE__ */ X(
1481
+ en,
1436
1482
  {
1437
- state: o,
1438
- actions: a,
1439
- currentTime: r,
1440
- progress: i,
1483
+ state: a,
1484
+ actions: i,
1485
+ currentTime: o,
1486
+ progress: r,
1441
1487
  element: n,
1442
1488
  children: [
1443
- /* @__PURE__ */ l("audio", { ref: n, src: e.url }),
1489
+ /* @__PURE__ */ d("audio", { ref: n, src: e.url }),
1444
1490
  t
1445
1491
  ]
1446
1492
  }
1447
1493
  );
1448
1494
  }
1449
- function rt({
1495
+ function nn({
1450
1496
  media: e,
1451
1497
  mediaControlsDeps: t,
1452
1498
  children: n
1453
1499
  }) {
1454
- return G("portal", "audio", nt, { media: e, children: n }, [e, ...t || []]), null;
1500
+ return Ve("portal", "audio", tn, { media: e, children: n }, [e, ...t || []]), null;
1455
1501
  }
1456
- function it({
1502
+ function rn({
1457
1503
  element: e,
1458
1504
  media: t,
1459
1505
  playPause: n
1460
1506
  }) {
1461
- return /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1462
- /* @__PURE__ */ l("style", { children: `
1507
+ return /* @__PURE__ */ X("div", { className: "video-container", part: "video-container", onClick: n, children: [
1508
+ /* @__PURE__ */ d("style", { children: `
1463
1509
  .video-container {
1464
1510
  position: absolute;
1465
1511
  top: 0;
@@ -1473,37 +1519,37 @@ function it({
1473
1519
  pointer-events: visible;
1474
1520
  }
1475
1521
  ` }),
1476
- /* @__PURE__ */ l("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1522
+ /* @__PURE__ */ d("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
1477
1523
  ] });
1478
1524
  }
1479
- function ot({
1525
+ function on({
1480
1526
  media: e,
1481
1527
  mediaControlsDeps: t,
1482
1528
  children: n
1483
1529
  }) {
1484
- const [{ element: r, currentTime: i, progress: o }, a, s] = Se({ duration: e.duration });
1485
- return G("overlay", "video-element", it, {
1486
- element: r,
1530
+ const [{ element: o, currentTime: r, progress: a }, i, s] = yt({ duration: e.duration });
1531
+ return Ve("overlay", "video-element", rn, {
1532
+ element: o,
1487
1533
  media: e,
1488
1534
  playPause: s.playPause
1489
- }), G(
1535
+ }), Ve(
1490
1536
  "portal",
1491
1537
  "custom-controls",
1492
- tt,
1538
+ en,
1493
1539
  {
1494
- state: a,
1540
+ state: i,
1495
1541
  actions: s,
1496
- currentTime: i,
1497
- progress: o,
1498
- element: r,
1542
+ currentTime: r,
1543
+ progress: a,
1544
+ element: o,
1499
1545
  children: n
1500
1546
  },
1501
- [i, a, e, ...t || []]
1547
+ [r, i, e, ...t || []]
1502
1548
  ), null;
1503
1549
  }
1504
- function at({ model: e }) {
1505
- return /* @__PURE__ */ M(z, { children: [
1506
- /* @__PURE__ */ l("style", { children: `
1550
+ function an({ model: e }) {
1551
+ return /* @__PURE__ */ X(Oe, { children: [
1552
+ /* @__PURE__ */ d("style", { children: `
1507
1553
  .model-container {
1508
1554
  position: absolute;
1509
1555
  top: 0;
@@ -1517,7 +1563,7 @@ function at({ model: e }) {
1517
1563
  pointer-events: visible;
1518
1564
  }
1519
1565
  ` }),
1520
- /* @__PURE__ */ l("div", { className: "model-container", children: /* @__PURE__ */ l(
1566
+ /* @__PURE__ */ d("div", { className: "model-container", children: /* @__PURE__ */ d(
1521
1567
  "model-viewer",
1522
1568
  {
1523
1569
  "interaction-prompt": "none",
@@ -1529,12 +1575,12 @@ function at({ model: e }) {
1529
1575
  ) })
1530
1576
  ] });
1531
1577
  }
1532
- function st({ model: e, name: t }) {
1533
- return G("overlay", `model-${t}`, at, { model: e }, [e]), null;
1578
+ function sn({ model: e, name: t }) {
1579
+ return Ve("overlay", `model-${t}`, an, { model: e }, [e]), null;
1534
1580
  }
1535
- function ct({ style: e }) {
1536
- const t = j();
1537
- return !t || !t.height || !t.width ? null : /* @__PURE__ */ l(
1581
+ function cn({ style: e }) {
1582
+ const t = Se();
1583
+ return !t || !t.height || !t.width ? null : /* @__PURE__ */ d(
1538
1584
  "box",
1539
1585
  {
1540
1586
  interactive: !1,
@@ -1543,104 +1589,111 @@ function ct({ style: e }) {
1543
1589
  }
1544
1590
  );
1545
1591
  }
1546
- const ut = B.createContext("en");
1547
- function hr(e) {
1548
- return /* @__PURE__ */ l(ut.Provider, { value: e.language, children: e.children });
1592
+ const un = Ie.createContext("en");
1593
+ function Io(e) {
1594
+ return /* @__PURE__ */ d(un.Provider, { value: e.language, children: e.children });
1549
1595
  }
1550
- function we() {
1551
- return B.useContext(ut);
1596
+ function gt() {
1597
+ return Ie.useContext(un);
1552
1598
  }
1553
- function Re(e) {
1599
+ function Et(e) {
1554
1600
  return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
1555
1601
  }
1556
- function Bn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
1557
- const o = we();
1558
- return x(() => Re(o) === Re(t), [o, t]) ? e ? /* @__PURE__ */ l(e, { ...i, children: n }) : /* @__PURE__ */ l("span", { ...i, children: n }) : e ? /* @__PURE__ */ l(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ l("span", { ...i, lang: t, dir: r, children: n });
1602
+ function Qr({ as: e, language: t, children: n, viewingDirection: o, ...r }) {
1603
+ const a = gt();
1604
+ return N(() => Et(a) === Et(t), [a, t]) ? e ? /* @__PURE__ */ d(e, { ...r, children: n }) : /* @__PURE__ */ d("span", { ...r, children: n }) : e ? /* @__PURE__ */ d(e, { ...r, lang: t, dir: o, children: n }) : /* @__PURE__ */ d("span", { ...r, lang: t, dir: o, children: n });
1559
1605
  }
1560
- function lt(e, t, n) {
1606
+ function ln(e, t, n) {
1561
1607
  if (t.length === 0)
1562
1608
  return;
1563
1609
  if (t.length === 1)
1564
1610
  return t[0];
1565
1611
  if (t.indexOf(e) !== -1)
1566
1612
  return e;
1567
- const r = e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : null;
1568
- if (r && t.indexOf(r) !== -1)
1569
- return r;
1570
- for (const i of n)
1571
- if (t.indexOf(i) !== -1)
1572
- return i;
1613
+ const o = e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : null;
1614
+ if (o && t.indexOf(o) !== -1)
1615
+ return o;
1616
+ for (const r of n)
1617
+ if (t.indexOf(r) !== -1)
1618
+ return r;
1573
1619
  return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
1574
1620
  }
1575
- const Hn = (e, t = []) => {
1576
- const n = we();
1577
- return x(() => {
1578
- const r = e();
1579
- return lt(n, r, []);
1621
+ const Gr = (e, t = []) => {
1622
+ const n = gt();
1623
+ return N(() => {
1624
+ const o = e();
1625
+ return ln(n, o, []);
1580
1626
  }, [n, ...t]);
1581
1627
  };
1582
- function Yn(e, t) {
1583
- const n = Hn(() => Object.keys(e || {}), [e]);
1628
+ function Xr(e, t, n = `
1629
+ `) {
1630
+ const o = Gr(() => Object.keys(e || {}), [e]);
1584
1631
  return [
1585
- x(() => {
1632
+ N(() => {
1586
1633
  if (!e)
1587
1634
  return t || "";
1588
1635
  if (typeof e == "string")
1589
1636
  return e;
1590
- const r = n ? e[n] : void 0;
1591
- return r ? typeof r == "string" ? r : r.join(`
1592
- `) : "";
1593
- }, [n, t, e]),
1594
- n
1637
+ const r = o ? e[o] : void 0;
1638
+ return r ? typeof r == "string" ? r : r.join(n) : "";
1639
+ }, [o, t, e]),
1640
+ o
1595
1641
  ];
1596
1642
  }
1597
- function gr() {
1598
- const e = we();
1599
- return function(n, r, i) {
1600
- const o = Object.keys(n || {}), a = lt(e, o, []);
1643
+ function Co() {
1644
+ const e = gt();
1645
+ return function(n, o, r) {
1646
+ const a = Object.keys(n || {}), i = ln(e, a, []);
1601
1647
  if (!n)
1602
- return r || "";
1648
+ return o || "";
1603
1649
  if (typeof n == "string")
1604
1650
  return n;
1605
- const s = a ? n[a] : void 0;
1606
- return s ? typeof s == "string" ? s : s.join(typeof i < "u" ? i : `
1651
+ const s = i ? n[i] : void 0;
1652
+ return s ? typeof s == "string" ? s : s.join(typeof r < "u" ? r : `
1607
1653
  `) : "";
1608
1654
  };
1609
1655
  }
1610
- const zn = ({ as: e, defaultText: t, enableDangerouslySetInnerHTML: n, children: r, ...i }) => {
1611
- const [o, a] = Yn(r, t);
1612
- return a ? /* @__PURE__ */ l(
1613
- Bn,
1656
+ function Ne({
1657
+ as: e,
1658
+ defaultText: t,
1659
+ enableDangerouslySetInnerHTML: n,
1660
+ children: o,
1661
+ separator: r,
1662
+ ...a
1663
+ }) {
1664
+ const [i, s] = Xr(o, t, r);
1665
+ return s ? /* @__PURE__ */ d(
1666
+ Qr,
1614
1667
  {
1615
- ...i,
1668
+ ...a,
1616
1669
  as: e,
1617
- language: a,
1618
- title: n ? void 0 : o,
1670
+ language: s,
1671
+ title: n ? void 0 : i,
1619
1672
  dangerouslySetInnerHTML: n ? {
1620
- __html: o
1673
+ __html: i
1621
1674
  } : void 0,
1622
- children: n ? void 0 : o
1675
+ children: n ? void 0 : i
1623
1676
  }
1624
- ) : e ? /* @__PURE__ */ l(e, { ...i, children: o }) : /* @__PURE__ */ l(
1677
+ ) : e ? /* @__PURE__ */ d(e, { ...a, children: i }) : /* @__PURE__ */ d(
1625
1678
  "span",
1626
1679
  {
1627
- ...i,
1628
- title: n ? void 0 : o,
1680
+ ...a,
1681
+ title: n ? void 0 : i,
1629
1682
  dangerouslySetInnerHTML: n ? {
1630
- __html: o
1683
+ __html: i
1631
1684
  } : void 0,
1632
- children: n ? void 0 : o
1685
+ children: n ? void 0 : i
1633
1686
  }
1634
1687
  );
1635
- };
1636
- function Kn({
1688
+ }
1689
+ function Jr({
1637
1690
  element: e,
1638
1691
  media: t,
1639
1692
  playPause: n
1640
1693
  }) {
1641
- const r = $(null);
1642
- return t.youTubeId ? /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
1643
- /* @__PURE__ */ l("style", { children: `
1694
+ const o = Ee(null);
1695
+ return t.youTubeId ? /* @__PURE__ */ X("div", { className: "video-container", part: "video-container", onClick: n, children: [
1696
+ /* @__PURE__ */ d("style", { children: `
1644
1697
  .video-container {
1645
1698
  position: absolute;
1646
1699
  top: 0;
@@ -1659,11 +1712,11 @@ function Kn({
1659
1712
  object-fit: contain;
1660
1713
  }
1661
1714
  ` }),
1662
- /* @__PURE__ */ l(
1715
+ /* @__PURE__ */ d(
1663
1716
  "iframe",
1664
1717
  {
1665
1718
  className: "video-yt",
1666
- ref: r,
1719
+ ref: o,
1667
1720
  src: `https://www.youtube.com/embed/${t.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
1668
1721
  referrerPolicy: "no-referrer",
1669
1722
  sandbox: "allow-scripts allow-same-origin allow-presentation"
@@ -1671,328 +1724,1472 @@ function Kn({
1671
1724
  )
1672
1725
  ] }) : null;
1673
1726
  }
1674
- function Wn({
1727
+ function Zr({
1675
1728
  media: e,
1676
1729
  mediaControlsDeps: t,
1677
1730
  children: n
1678
1731
  }) {
1679
- const [{ element: r, currentTime: i, progress: o }, a, s] = Se({ duration: e.duration });
1680
- return G("overlay", "video-element", Kn, {
1681
- element: r,
1732
+ const [{ element: o, currentTime: r, progress: a }, i, s] = yt({ duration: e.duration });
1733
+ return Ve("overlay", "video-element", Jr, {
1734
+ element: o,
1682
1735
  media: e,
1683
1736
  playPause: s.playPause
1684
1737
  }), null;
1685
1738
  }
1686
- function dt({
1739
+ function fn({
1687
1740
  x: e,
1688
1741
  y: t,
1689
1742
  onChoiceChange: n,
1690
- registerActions: r,
1691
- defaultChoices: i,
1692
- isStatic: o,
1693
- renderViewerControls: a,
1743
+ registerActions: o,
1744
+ defaultChoices: r,
1745
+ isStatic: a,
1746
+ renderViewerControls: i,
1694
1747
  renderMediaControls: s,
1695
- viewControlsDeps: c,
1696
- mediaControlsDeps: d,
1748
+ viewControlsDeps: f,
1749
+ mediaControlsDeps: h,
1697
1750
  strategies: u,
1698
- throwOnUnknown: f,
1699
- backgroundStyle: m,
1700
- alwaysShowBackground: p,
1701
- keepCanvasScale: g = !1,
1702
- enableSizes: h = !1,
1703
- enableYouTube: y = !0,
1704
- onClickPaintingAnnotation: w,
1751
+ throwOnUnknown: y,
1752
+ backgroundStyle: x,
1753
+ alwaysShowBackground: M,
1754
+ keepCanvasScale: I = !1,
1755
+ enableSizes: b = !1,
1756
+ enableYouTube: E = !0,
1757
+ onClickPaintingAnnotation: C,
1705
1758
  children: A
1706
1759
  }) {
1707
- const S = j(), D = Ye(S, ["deep-zoom"]), [X] = un(), P = fn(), L = I(), F = x(() => ge(L), [L]), [v, _] = Dn({
1760
+ const S = Se(), F = Ut(S, ["deep-zoom"]), [L] = mr(), R = wr(), B = ae(), j = N(() => ut(B), [B]), [O, U] = Wr({
1708
1761
  strategies: u || ["images"],
1709
- defaultChoices: i == null ? void 0 : i.map(({ id: C }) => C)
1710
- }), Ce = v.type === "images" ? v.choice : void 0, ft = x(() => g ? 1 : Math.max(
1762
+ defaultChoices: r == null ? void 0 : r.map(({ id: V }) => V)
1763
+ }), H = O.type === "images" ? O.choice : void 0, G = N(() => I ? 1 : Math.max(
1711
1764
  1,
1712
- ...v.type === "images" ? v.images.map((C) => {
1713
- var Y;
1714
- return (C.width || 0) / ((Y = C.target) == null ? void 0 : Y.spatial.width);
1765
+ ...O.type === "images" ? O.images.map((V) => {
1766
+ var te;
1767
+ return (V.width || 0) / ((te = V.target) == null ? void 0 : te.spatial.width);
1715
1768
  }) : []
1716
- ), [g, v]);
1717
- hn(ft), k(() => {
1718
- r && r(_);
1719
- }, [v.annotations]), k(() => {
1720
- if (i)
1721
- for (const C of i)
1722
- typeof C.opacity < "u" && F.applyStyles({ id: C.id }, "atlas", {
1723
- opacity: C.opacity
1769
+ ), [I, O]);
1770
+ Pr(G), be(() => {
1771
+ o && o(U);
1772
+ }, [O.annotations]), be(() => {
1773
+ if (r)
1774
+ for (const V of r)
1775
+ typeof V.opacity < "u" && j.applyStyles({ id: V.id }, "atlas", {
1776
+ opacity: V.opacity
1724
1777
  });
1725
- }, [i]), Te(() => {
1726
- n && n(Ce);
1727
- }, [Ce]), G(
1728
- P && (v.type === "images" || v.type === "empty" || v.type === "textual-content" && a) ? "overlay" : "none",
1778
+ }, [r]), st(() => {
1779
+ n && n(H);
1780
+ }, [H]), Ve(
1781
+ R && (O.type === "images" || O.type === "empty" || O.type === "textual-content" && i) ? "overlay" : "none",
1729
1782
  `canvas-portal-controls-${S == null ? void 0 : S.id}`,
1730
- pe.Provider,
1731
- a ? {
1732
- value: P || null,
1733
- children: a(v)
1783
+ pt.Provider,
1784
+ i ? {
1785
+ value: R || null,
1786
+ children: i(O)
1734
1787
  } : {},
1735
- [S, P, v, ...c || []]
1788
+ [S, R, O, ...f || []]
1736
1789
  );
1737
- const q = Un({ maxWidth: 256, maxHeight: 256 });
1790
+ const Y = Gt({ maxWidth: 256, maxHeight: 256 });
1738
1791
  if (!S)
1739
1792
  return null;
1740
- const be = S.accompanyingCanvas, Q = q && q.type === "fixed" ? /* @__PURE__ */ l("world-object", { height: S.height, width: S.width, x: e, y: t, children: /* @__PURE__ */ l(
1793
+ const Z = S.accompanyingCanvas, ee = Y && Y.type === "fixed" ? /* @__PURE__ */ d("world-object", { height: S.height, width: S.width, x: e, y: t, children: /* @__PURE__ */ d(
1741
1794
  "world-image",
1742
1795
  {
1743
- uri: q.id,
1796
+ uri: Y.id,
1744
1797
  target: { x: 0, y: 0, width: S.width, height: S.height },
1745
- display: q.width && q.height ? {
1746
- width: q.width,
1747
- height: q.height
1798
+ display: Y.width && Y.height ? {
1799
+ width: Y.width,
1800
+ height: Y.height
1748
1801
  } : void 0,
1749
1802
  crop: void 0
1750
1803
  }
1751
1804
  ) }) : null;
1752
- if (v.type === "unknown") {
1753
- if (Q)
1754
- return Q;
1755
- if (f)
1756
- throw new Error(v.reason || "Unknown image strategy");
1805
+ if (O.type === "unknown") {
1806
+ if (ee)
1807
+ return ee;
1808
+ if (y)
1809
+ throw new Error(O.reason || "Unknown image strategy");
1757
1810
  return null;
1758
1811
  }
1759
- const Pe = /* @__PURE__ */ M(ne, { children: [
1760
- X ? /* @__PURE__ */ l(he, { page: X }) : null,
1761
- v.annotations && v.annotations.pages ? v.annotations.pages.map((C) => /* @__PURE__ */ l(he, { page: C }, C.id)) : null,
1812
+ const se = /* @__PURE__ */ X(Ye, { children: [
1813
+ L ? /* @__PURE__ */ d(at, { page: L }) : null,
1814
+ O.annotations && O.annotations.pages ? O.annotations.pages.map((V) => /* @__PURE__ */ d(at, { page: V }, V.id)) : null,
1762
1815
  A
1763
- ] }), ht = v.type === "images" ? v.images.length : 0;
1764
- return /* @__PURE__ */ M(z, { children: [
1765
- /* @__PURE__ */ M(
1816
+ ] }), me = O.type === "images" ? O.images.length : 0;
1817
+ return /* @__PURE__ */ X(Oe, { children: [
1818
+ /* @__PURE__ */ X(
1766
1819
  "world-object",
1767
1820
  {
1768
1821
  height: S.height,
1769
1822
  width: S.width,
1770
1823
  x: e,
1771
1824
  y: t,
1772
- ...D,
1825
+ ...F,
1773
1826
  children: [
1774
- v.type === "empty" || p ? /* @__PURE__ */ l(ct, { style: m }) : null,
1775
- v.type === "textual-content" ? v.items.map((C, Y) => {
1776
- var J;
1777
- return /* @__PURE__ */ M(z, { children: [
1778
- /* @__PURE__ */ l(
1779
- wt,
1827
+ O.type === "empty" || M ? /* @__PURE__ */ d(cn, { style: x }) : null,
1828
+ O.type === "textual-content" ? O.items.map((V, te) => {
1829
+ var $;
1830
+ return /* @__PURE__ */ X(Oe, { children: [
1831
+ /* @__PURE__ */ d(
1832
+ Cn,
1780
1833
  {
1781
- onClick: w ? (Ee) => {
1782
- Ee.stopPropagation(), w(C.annotationId, C, Ee);
1834
+ onClick: C ? (le) => {
1835
+ le.stopPropagation(), C(V.annotationId, V, le);
1783
1836
  } : void 0,
1784
- target: ((J = C.target) == null ? void 0 : J.spatial) || void 0,
1785
- children: /* @__PURE__ */ l("div", { "data-textual-content": !0, children: /* @__PURE__ */ l(zn, { enableDangerouslySetInnerHTML: !0, children: C.text }) })
1837
+ target: (($ = V.target) == null ? void 0 : $.spatial) || void 0,
1838
+ children: /* @__PURE__ */ d("div", { "data-textual-content": !0, children: /* @__PURE__ */ d(Ne, { enableDangerouslySetInnerHTML: !0, children: V.text }) })
1786
1839
  },
1787
- Y
1840
+ te
1788
1841
  ),
1789
- Pe
1842
+ se
1790
1843
  ] });
1791
1844
  }) : null,
1792
- v.type === "images" ? /* @__PURE__ */ M(z, { children: [
1793
- v.images.map((C, Y) => /* @__PURE__ */ l(
1794
- We,
1845
+ O.type === "images" ? /* @__PURE__ */ X(Oe, { children: [
1846
+ O.images.map((V, te) => /* @__PURE__ */ d(
1847
+ Ht,
1795
1848
  {
1796
- isStatic: o,
1797
- image: C,
1798
- id: C.id,
1799
- thumbnail: Y === 0 ? q : void 0,
1800
- selector: C.selector,
1801
- enableSizes: h,
1802
- onClick: w ? (J) => {
1803
- J.stopPropagation(), w(C.annotationId, C, J);
1849
+ isStatic: a,
1850
+ image: V,
1851
+ id: V.id,
1852
+ thumbnail: te === 0 ? Y : void 0,
1853
+ selector: V.selector,
1854
+ enableSizes: b,
1855
+ onClick: C ? ($) => {
1856
+ $.stopPropagation(), C(V.annotationId, V, $);
1804
1857
  } : void 0
1805
1858
  },
1806
- C.id + Y
1859
+ V.id + te
1807
1860
  )),
1808
- Pe
1861
+ se
1809
1862
  ] }) : null,
1810
- v.type === "3d-model" ? /* @__PURE__ */ l(st, { model: v.model }) : null,
1811
- v.type === "media" ? /* @__PURE__ */ l(z, { children: v.media.type === "Sound" ? /* @__PURE__ */ M(rt, { media: v.media, mediaControlsDeps: d, children: [
1812
- Q,
1813
- s ? s(v) : null
1814
- ] }) : v.media.type === "Video" ? /* @__PURE__ */ M(ot, { media: v.media, mediaControlsDeps: d, children: [
1815
- Q,
1816
- s ? s(v) : null
1817
- ] }) : v.media.type === "VideoYouTube" && y ? /* @__PURE__ */ M(Wn, { media: v.media, mediaControlsDeps: d, children: [
1818
- Q,
1819
- s ? s(v) : null
1863
+ O.type === "3d-model" ? /* @__PURE__ */ d(sn, { model: O.model }) : null,
1864
+ O.type === "media" ? /* @__PURE__ */ d(Oe, { children: O.media.type === "Sound" ? /* @__PURE__ */ X(nn, { media: O.media, mediaControlsDeps: h, children: [
1865
+ ee,
1866
+ s ? s(O) : null
1867
+ ] }) : O.media.type === "Video" ? /* @__PURE__ */ X(on, { media: O.media, mediaControlsDeps: h, children: [
1868
+ ee,
1869
+ s ? s(O) : null
1870
+ ] }) : O.media.type === "VideoYouTube" && E ? /* @__PURE__ */ X(Zr, { media: O.media, mediaControlsDeps: h, children: [
1871
+ ee,
1872
+ s ? s(O) : null
1820
1873
  ] }) : null }) : null
1821
1874
  ]
1822
1875
  },
1823
- `${S.id}/${v.type}/${ht}`
1876
+ `${S.id}/${O.type}/${me}`
1824
1877
  ),
1825
- v.type === "media" && v.media.type === "Sound" && be ? /* @__PURE__ */ l(me, { canvas: be.id, children: /* @__PURE__ */ l(dt, { renderViewerControls: a }) }) : null
1878
+ O.type === "media" && O.media.type === "Sound" && Z ? /* @__PURE__ */ d(Qe, { canvas: Z.id, children: /* @__PURE__ */ d(fn, { renderViewerControls: i }) }) : null
1826
1879
  ] });
1827
1880
  }
1828
- function Gn() {
1829
- const e = R(ie);
1830
- return e && e.vault ? e.vault : Le();
1831
- }
1832
- const Qn = Ve(function(t, n) {
1833
- const r = W(), i = Fe(), o = Dt(), { ViewerControls: a, MediaControls: s } = t.components || {};
1834
- if (vt(n, () => o, [o]), !r)
1835
- return /* @__PURE__ */ l("div", {});
1836
- let c = 0;
1837
- return /* @__PURE__ */ M(z, { children: [
1881
+ const eo = ct(function(t, n) {
1882
+ const o = Ce(), r = Mt(), a = Nt(), { ViewerControls: i, MediaControls: s } = t.components || {};
1883
+ if (It(n, () => a, [a]), !o)
1884
+ return /* @__PURE__ */ d("div", {});
1885
+ let f = 0;
1886
+ return /* @__PURE__ */ X(Oe, { children: [
1838
1887
  t.header,
1839
- /* @__PURE__ */ l(
1840
- O.Viewer,
1888
+ /* @__PURE__ */ d(
1889
+ ge.Viewer,
1841
1890
  {
1842
1891
  height: t.height,
1843
1892
  mode: t.mode,
1844
- children: i.map((d, u) => {
1845
- const f = c;
1846
- return c += d.width + (t.spacing || 0), /* @__PURE__ */ l(me, { canvas: d.id, children: /* @__PURE__ */ l(
1847
- O.RenderCanvas,
1893
+ children: r.map((h, u) => {
1894
+ const y = f;
1895
+ return f += h.width + (t.spacing || 0), /* @__PURE__ */ d(Qe, { canvas: h.id, children: /* @__PURE__ */ d(
1896
+ ge.RenderCanvas,
1848
1897
  {
1849
1898
  strategies: ["3d-model", "media", "images", "empty", "textual-content"],
1850
- renderViewerControls: u === 0 && a ? () => /* @__PURE__ */ l(a, {}) : void 0,
1851
- renderMediaControls: u === 0 && s ? () => /* @__PURE__ */ l(s, {}) : void 0,
1852
- x: f,
1899
+ renderViewerControls: u === 0 && i ? () => /* @__PURE__ */ d(i, {}) : void 0,
1900
+ renderMediaControls: u === 0 && s ? () => /* @__PURE__ */ d(s, {}) : void 0,
1901
+ x: y,
1853
1902
  ...t.canvasProps || {},
1854
1903
  children: t.annotations
1855
1904
  },
1856
- d.id
1857
- ) }, d.id);
1905
+ h.id
1906
+ ) }, h.id);
1858
1907
  })
1859
1908
  },
1860
- t.reuseAtlas ? "" : o.currentSequenceIndex
1909
+ t.reuseAtlas ? "" : a.currentSequenceIndex
1861
1910
  ),
1862
1911
  t.children
1863
1912
  ] });
1864
- }), O = Ve(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: c, ...d }, u) {
1865
- const f = Gn();
1866
- return /* @__PURE__ */ l(Oe, { vault: f, children: /* @__PURE__ */ l(Nt, { ...d, children: /* @__PURE__ */ l(
1867
- Qn,
1913
+ }), ge = ct(function({ children: t, height: n, annotations: o, canvasProps: r, spacing: a, header: i, components: s, mode: f, reuseAtlas: h, ...u }, y) {
1914
+ const x = dt();
1915
+ return /* @__PURE__ */ d(ft, { vault: x, children: /* @__PURE__ */ d(Yn, { ...u, children: /* @__PURE__ */ d(
1916
+ eo,
1868
1917
  {
1869
- ref: u,
1918
+ ref: y,
1870
1919
  height: n,
1871
1920
  components: s,
1872
- spacing: o,
1873
- canvasProps: i,
1874
- annotations: r,
1875
- header: a,
1876
- mode: c,
1921
+ spacing: a,
1922
+ canvasProps: r,
1923
+ annotations: o,
1924
+ header: i,
1925
+ mode: f,
1926
+ reuseAtlas: h,
1877
1927
  children: t
1878
1928
  }
1879
1929
  ) }) });
1880
1930
  });
1881
- O.RenderImage = We;
1882
- O.RenderCanvas = dt;
1883
- O.RenderAnnotationPage = he;
1884
- O.RenderAnnotation = Ke;
1885
- O.Viewer = gn;
1886
- O.CanvasBackground = ct;
1887
- O.Audio = rt;
1888
- O.Video = ot;
1889
- O.Model = st;
1890
- O.AudioHTML = nt;
1891
- O.VideoHTML = it;
1892
- O.ModelHTML = at;
1893
- function vr({ annotation: e, children: t }) {
1894
- return /* @__PURE__ */ l(K, { value: { annotation: e }, children: t });
1895
- }
1896
- function mr({ annotationPage: e, children: t }) {
1897
- return /* @__PURE__ */ l(K, { value: { annotationPage: e }, children: t });
1898
- }
1899
- function pr({ collection: e, children: t }) {
1900
- return /* @__PURE__ */ l(K, { value: { collection: e }, children: t });
1901
- }
1902
- function yr(e, t = {}) {
1903
- return xe(t);
1904
- }
1905
- function xr(e, t = !1) {
1906
- }
1907
- function Sr(e) {
1908
- const n = H().manifest, r = e ? e.map((i) => typeof i == "string" ? i : i == null ? void 0 : i.id) : [];
1909
- return V(
1910
- (i) => {
1911
- const o = n ? i.iiif.entities.Manifest[n] : void 0, a = (o == null ? void 0 : o.items) || [];
1931
+ ge.RenderImage = Ht;
1932
+ ge.RenderCanvas = fn;
1933
+ ge.RenderAnnotationPage = at;
1934
+ ge.RenderAnnotation = Wt;
1935
+ ge.Viewer = Or;
1936
+ ge.CanvasBackground = cn;
1937
+ ge.Audio = nn;
1938
+ ge.Video = on;
1939
+ ge.Model = sn;
1940
+ ge.AudioHTML = tn;
1941
+ ge.VideoHTML = rn;
1942
+ ge.ModelHTML = an;
1943
+ const jo = ct(
1944
+ function({ canvasId: t }, n) {
1945
+ const o = jn(), r = zt(t || (o == null ? void 0 : o.id)), a = ae();
1946
+ return It(n, () => r, [t, o]), !o || r.enabledPageIds.length === 0 ? null : /* @__PURE__ */ d(Oe, { children: r.enabledPageIds.map((i) => /* @__PURE__ */ d(ge.RenderAnnotationPage, { page: a.get(i) }, i)) });
1947
+ }
1948
+ );
1949
+ function dn({
1950
+ metadata: e = [],
1951
+ config: t,
1952
+ labelWidth: n = 16,
1953
+ showEmptyMessage: o = !0,
1954
+ allowHtml: r,
1955
+ emptyFallback: a,
1956
+ classes: i = {},
1957
+ emptyMessage: s = "No metadata available",
1958
+ emptyValueFallback: f = "No value",
1959
+ emptyLabelFallback: h = "",
1960
+ separator: u,
1961
+ tableFooter: y,
1962
+ tableHeader: x
1963
+ }) {
1964
+ const M = N(() => {
1965
+ const b = (t || []).reduce((C, A) => [...C, ...A.keys], []), E = {};
1966
+ for (const C of e) {
1967
+ const A = C && C.label ? Object.values(C.label) : [];
1968
+ for (const S of A)
1969
+ if (S && S.length && (b.indexOf(`metadata.${S[0]}`) !== -1 || b.length === 0) && C) {
1970
+ const F = `metadata.${S[0]}`;
1971
+ E[F] = E[F] ? E[F] : [], E[F].push(C);
1972
+ break;
1973
+ }
1974
+ }
1975
+ return E;
1976
+ }, [t, e]);
1977
+ return Object.keys(M).length === 0 && o ? /* @__PURE__ */ d(Oe, { children: a }) || /* @__PURE__ */ d("div", { className: i.empty, children: s }) : t && t.length ? /* @__PURE__ */ X("table", { className: i.container, children: [
1978
+ x,
1979
+ /* @__PURE__ */ d("tbody", { children: t.map((b, E) => {
1980
+ const C = [];
1981
+ for (const A of b.keys)
1982
+ for (const S of M[A] || [])
1983
+ C.push(
1984
+ /* @__PURE__ */ d(
1985
+ Ne,
1986
+ {
1987
+ enableDangerouslySetInnerHTML: r,
1988
+ defaultText: f,
1989
+ separator: u,
1990
+ children: S.value
1991
+ },
1992
+ E + "__" + A
1993
+ )
1994
+ );
1995
+ return C.length === 0 ? null : /* @__PURE__ */ X("tr", { className: i.row, children: [
1996
+ /* @__PURE__ */ d("td", { className: i.label, style: n ? { minWidth: n } : {}, children: /* @__PURE__ */ d(
1997
+ Ne,
1998
+ {
1999
+ enableDangerouslySetInnerHTML: r,
2000
+ separator: u,
2001
+ defaultText: h,
2002
+ children: b.label
2003
+ }
2004
+ ) }),
2005
+ /* @__PURE__ */ d("td", { className: i.value, children: C })
2006
+ ] }, E);
2007
+ }) }),
2008
+ y
2009
+ ] }) : /* @__PURE__ */ X("table", { className: i.container, children: [
2010
+ x,
2011
+ /* @__PURE__ */ d("tbody", { children: e && e.length ? e.map((b, E) => b ? /* @__PURE__ */ X("tr", { className: i.row, children: [
2012
+ /* @__PURE__ */ d("td", { className: i.label, style: n ? { minWidth: n } : {}, children: /* @__PURE__ */ d(
2013
+ Ne,
2014
+ {
2015
+ enableDangerouslySetInnerHTML: r,
2016
+ defaultText: f,
2017
+ separator: u,
2018
+ children: b.label
2019
+ }
2020
+ ) }),
2021
+ /* @__PURE__ */ d("td", { className: i.value, children: /* @__PURE__ */ d(
2022
+ Ne,
2023
+ {
2024
+ enableDangerouslySetInnerHTML: r,
2025
+ defaultText: f,
2026
+ separator: u,
2027
+ children: b.value
2028
+ }
2029
+ ) })
2030
+ ] }, E) : null) : null }),
2031
+ y
2032
+ ] });
2033
+ }
2034
+ function Mo(e) {
2035
+ const t = Ce(), n = Se(), o = kt(), r = N(() => {
2036
+ const a = (t == null ? void 0 : t.metadata) || [], i = (n == null ? void 0 : n.metadata) || [], s = (o == null ? void 0 : o.metadata) || [];
2037
+ return [...a, ...i, ...s];
2038
+ }, [t, n, o]);
2039
+ return /* @__PURE__ */ d(dn, { metadata: r, ...e });
2040
+ }
2041
+ function pn(e, t = {}, n = []) {
2042
+ return N(() => {
2043
+ var i, s;
2044
+ if (!e)
2045
+ return null;
2046
+ let o = t.quality;
2047
+ e && e.extraQualities && t.quality && (e.extraQualities.includes(t.quality) || (console.log("Invalid quality", t.quality, e.extraQualities), o = "default"));
2048
+ const r = Ln(e);
2049
+ return An({
2050
+ identifier: r.identifier,
2051
+ server: r.server,
2052
+ scheme: r.scheme,
2053
+ type: "image",
2054
+ size: {
2055
+ max: !((i = t.size) != null && i.width) && !((s = t.size) != null && s.height),
2056
+ confined: !1,
2057
+ upscaled: !1,
2058
+ ...t.size || {}
2059
+ },
2060
+ format: t.format || "jpg",
2061
+ // This isn't how it should be modelled, always full,
2062
+ // region: data.selector ? data.selector : { full: true },
2063
+ region: t.region || { full: !0 },
2064
+ rotation: t != null && t.rotation ? Number.isInteger(t.rotation) ? { angle: t.rotation } : t.rotation : { angle: 0 },
2065
+ quality: o || "default",
2066
+ prefix: r.prefix,
2067
+ originalPath: r.originalPath
2068
+ });
2069
+ }, [...n]);
2070
+ }
2071
+ function to(e) {
2072
+ const t = typeof e.src == "string" ? e.src : e.src.id, n = Je(), [o, r] = ie(!1);
2073
+ let a;
2074
+ if (t) {
2075
+ const s = n.loadServiceSync({ id: t });
2076
+ s && (a = s);
2077
+ }
2078
+ !a && !o && n.loadService({ id: t }).then(() => {
2079
+ r(!0);
2080
+ });
2081
+ const i = pn(
2082
+ a,
2083
+ {
2084
+ size: e.size,
2085
+ selector: e.region,
2086
+ rotation: e.rotation,
2087
+ format: e.format,
2088
+ region: e.region,
2089
+ quality: e.quality
2090
+ },
2091
+ [o, e.src, e.size, e.region, e.rotation, e.format, e.region, e.quality]
2092
+ );
2093
+ return be(() => () => {
2094
+ r(!1);
2095
+ }, [t]), i ? /* @__PURE__ */ d("img", { src: i, alt: e.alt, className: e.className, style: e.style }) : /* @__PURE__ */ d(no, { ...e, fetchImageService: !1 });
2096
+ }
2097
+ function no(e) {
2098
+ if (e.fetchImageService)
2099
+ return /* @__PURE__ */ d(to, { ...e });
2100
+ const t = typeof e.src == "string" ? { id: e.src, profile: "level0" } : e.src, n = pn(
2101
+ t,
2102
+ {
2103
+ size: e.size,
2104
+ selector: e.region,
2105
+ rotation: e.rotation,
2106
+ format: e.format,
2107
+ region: e.region,
2108
+ quality: e.quality
2109
+ },
2110
+ [e.src, e.size, e.region, e.rotation, e.format, e.region, e.quality]
2111
+ );
2112
+ return n ? /* @__PURE__ */ d("img", { src: n, alt: e.alt, className: e.className, style: e.style }) : null;
2113
+ }
2114
+ function Ro(e) {
2115
+ const t = Ce();
2116
+ return /* @__PURE__ */ d(dn, { metadata: (t == null ? void 0 : t.metadata) || [], ...e });
2117
+ }
2118
+ var hn = { exports: {} };
2119
+ (() => {
2120
+ var e = { 296: (r, a, i) => {
2121
+ var s = /^\s+|\s+$/g, f = /^[-+]0x[0-9a-f]+$/i, h = /^0b[01]+$/i, u = /^0o[0-7]+$/i, y = parseInt, x = typeof i.g == "object" && i.g && i.g.Object === Object && i.g, M = typeof self == "object" && self && self.Object === Object && self, I = x || M || Function("return this")(), b = Object.prototype.toString, E = Math.max, C = Math.min, A = function() {
2122
+ return I.Date.now();
2123
+ };
2124
+ function S(L) {
2125
+ var R = typeof L;
2126
+ return !!L && (R == "object" || R == "function");
2127
+ }
2128
+ function F(L) {
2129
+ if (typeof L == "number")
2130
+ return L;
2131
+ if (function(j) {
2132
+ return typeof j == "symbol" || /* @__PURE__ */ function(O) {
2133
+ return !!O && typeof O == "object";
2134
+ }(j) && b.call(j) == "[object Symbol]";
2135
+ }(L))
2136
+ return NaN;
2137
+ if (S(L)) {
2138
+ var R = typeof L.valueOf == "function" ? L.valueOf() : L;
2139
+ L = S(R) ? R + "" : R;
2140
+ }
2141
+ if (typeof L != "string")
2142
+ return L === 0 ? L : +L;
2143
+ L = L.replace(s, "");
2144
+ var B = h.test(L);
2145
+ return B || u.test(L) ? y(L.slice(2), B ? 2 : 8) : f.test(L) ? NaN : +L;
2146
+ }
2147
+ r.exports = function(L, R, B) {
2148
+ var j, O, U, H, G, Y, Z = 0, ee = !1, se = !1, me = !0;
2149
+ if (typeof L != "function")
2150
+ throw new TypeError("Expected a function");
2151
+ function V(re) {
2152
+ var oe = j, de = O;
2153
+ return j = O = void 0, Z = re, H = L.apply(de, oe);
2154
+ }
2155
+ function te(re) {
2156
+ var oe = re - Y;
2157
+ return Y === void 0 || oe >= R || oe < 0 || se && re - Z >= U;
2158
+ }
2159
+ function $() {
2160
+ var re = A();
2161
+ if (te(re))
2162
+ return le(re);
2163
+ G = setTimeout($, function(oe) {
2164
+ var de = R - (oe - Y);
2165
+ return se ? C(de, U - (oe - Z)) : de;
2166
+ }(re));
2167
+ }
2168
+ function le(re) {
2169
+ return G = void 0, me && j ? V(re) : (j = O = void 0, H);
2170
+ }
2171
+ function fe() {
2172
+ var re = A(), oe = te(re);
2173
+ if (j = arguments, O = this, Y = re, oe) {
2174
+ if (G === void 0)
2175
+ return function(de) {
2176
+ return Z = de, G = setTimeout($, R), ee ? V(de) : H;
2177
+ }(Y);
2178
+ if (se)
2179
+ return G = setTimeout($, R), V(Y);
2180
+ }
2181
+ return G === void 0 && (G = setTimeout($, R)), H;
2182
+ }
2183
+ return R = F(R) || 0, S(B) && (ee = !!B.leading, U = (se = "maxWait" in B) ? E(F(B.maxWait) || 0, R) : U, me = "trailing" in B ? !!B.trailing : me), fe.cancel = function() {
2184
+ G !== void 0 && clearTimeout(G), Z = 0, j = Y = O = G = void 0;
2185
+ }, fe.flush = function() {
2186
+ return G === void 0 ? H : le(A());
2187
+ }, fe;
2188
+ };
2189
+ }, 96: (r, a, i) => {
2190
+ var s = "Expected a function", f = NaN, h = "[object Symbol]", u = /^\s+|\s+$/g, y = /^[-+]0x[0-9a-f]+$/i, x = /^0b[01]+$/i, M = /^0o[0-7]+$/i, I = parseInt, b = typeof i.g == "object" && i.g && i.g.Object === Object && i.g, E = typeof self == "object" && self && self.Object === Object && self, C = b || E || Function("return this")(), A = Object.prototype.toString, S = Math.max, F = Math.min, L = function() {
2191
+ return C.Date.now();
2192
+ };
2193
+ function R(j) {
2194
+ var O = typeof j;
2195
+ return !!j && (O == "object" || O == "function");
2196
+ }
2197
+ function B(j) {
2198
+ if (typeof j == "number")
2199
+ return j;
2200
+ if (function(H) {
2201
+ return typeof H == "symbol" || /* @__PURE__ */ function(G) {
2202
+ return !!G && typeof G == "object";
2203
+ }(H) && A.call(H) == h;
2204
+ }(j))
2205
+ return f;
2206
+ if (R(j)) {
2207
+ var O = typeof j.valueOf == "function" ? j.valueOf() : j;
2208
+ j = R(O) ? O + "" : O;
2209
+ }
2210
+ if (typeof j != "string")
2211
+ return j === 0 ? j : +j;
2212
+ j = j.replace(u, "");
2213
+ var U = x.test(j);
2214
+ return U || M.test(j) ? I(j.slice(2), U ? 2 : 8) : y.test(j) ? f : +j;
2215
+ }
2216
+ r.exports = function(j, O, U) {
2217
+ var H = !0, G = !0;
2218
+ if (typeof j != "function")
2219
+ throw new TypeError(s);
2220
+ return R(U) && (H = "leading" in U ? !!U.leading : H, G = "trailing" in U ? !!U.trailing : G), function(Y, Z, ee) {
2221
+ var se, me, V, te, $, le, fe = 0, re = !1, oe = !1, de = !0;
2222
+ if (typeof Y != "function")
2223
+ throw new TypeError(s);
2224
+ function _e(pe) {
2225
+ var ve = se, Pe = me;
2226
+ return se = me = void 0, fe = pe, te = Y.apply(Pe, ve);
2227
+ }
2228
+ function Be(pe) {
2229
+ var ve = pe - le;
2230
+ return le === void 0 || ve >= Z || ve < 0 || oe && pe - fe >= V;
2231
+ }
2232
+ function we() {
2233
+ var pe = L();
2234
+ if (Be(pe))
2235
+ return qe(pe);
2236
+ $ = setTimeout(we, function(ve) {
2237
+ var Pe = Z - (ve - le);
2238
+ return oe ? F(Pe, V - (ve - fe)) : Pe;
2239
+ }(pe));
2240
+ }
2241
+ function qe(pe) {
2242
+ return $ = void 0, de && se ? _e(pe) : (se = me = void 0, te);
2243
+ }
2244
+ function Me() {
2245
+ var pe = L(), ve = Be(pe);
2246
+ if (se = arguments, me = this, le = pe, ve) {
2247
+ if ($ === void 0)
2248
+ return function(Pe) {
2249
+ return fe = Pe, $ = setTimeout(we, Z), re ? _e(Pe) : te;
2250
+ }(le);
2251
+ if (oe)
2252
+ return $ = setTimeout(we, Z), _e(le);
2253
+ }
2254
+ return $ === void 0 && ($ = setTimeout(we, Z)), te;
2255
+ }
2256
+ return Z = B(Z) || 0, R(ee) && (re = !!ee.leading, V = (oe = "maxWait" in ee) ? S(B(ee.maxWait) || 0, Z) : V, de = "trailing" in ee ? !!ee.trailing : de), Me.cancel = function() {
2257
+ $ !== void 0 && clearTimeout($), fe = 0, se = le = me = $ = void 0;
2258
+ }, Me.flush = function() {
2259
+ return $ === void 0 ? te : qe(L());
2260
+ }, Me;
2261
+ }(j, O, { leading: H, maxWait: O, trailing: G });
2262
+ };
2263
+ }, 703: (r, a, i) => {
2264
+ var s = i(414);
2265
+ function f() {
2266
+ }
2267
+ function h() {
2268
+ }
2269
+ h.resetWarningCache = f, r.exports = function() {
2270
+ function u(M, I, b, E, C, A) {
2271
+ if (A !== s) {
2272
+ var S = new Error("Calling PropTypes validators directly is not supported by the `prop-types` package. Use PropTypes.checkPropTypes() to call them. Read more at http://fb.me/use-check-prop-types");
2273
+ throw S.name = "Invariant Violation", S;
2274
+ }
2275
+ }
2276
+ function y() {
2277
+ return u;
2278
+ }
2279
+ u.isRequired = u;
2280
+ var x = { array: u, bigint: u, bool: u, func: u, number: u, object: u, string: u, symbol: u, any: u, arrayOf: y, element: u, elementType: u, instanceOf: y, node: u, objectOf: y, oneOf: y, oneOfType: y, shape: y, exact: y, checkPropTypes: h, resetWarningCache: f };
2281
+ return x.PropTypes = x, x;
2282
+ };
2283
+ }, 697: (r, a, i) => {
2284
+ r.exports = i(703)();
2285
+ }, 414: (r) => {
2286
+ r.exports = "SECRET_DO_NOT_PASS_THIS_OR_YOU_WILL_BE_FIRED";
2287
+ } }, t = {};
2288
+ function n(r) {
2289
+ var a = t[r];
2290
+ if (a !== void 0)
2291
+ return a.exports;
2292
+ var i = t[r] = { exports: {} };
2293
+ return e[r](i, i.exports, n), i.exports;
2294
+ }
2295
+ n.n = (r) => {
2296
+ var a = r && r.__esModule ? () => r.default : () => r;
2297
+ return n.d(a, { a }), a;
2298
+ }, n.d = (r, a) => {
2299
+ for (var i in a)
2300
+ n.o(a, i) && !n.o(r, i) && Object.defineProperty(r, i, { enumerable: !0, get: a[i] });
2301
+ }, n.g = function() {
2302
+ if (typeof globalThis == "object")
2303
+ return globalThis;
2304
+ try {
2305
+ return this || new Function("return this")();
2306
+ } catch {
2307
+ if (typeof window == "object")
2308
+ return window;
2309
+ }
2310
+ }(), n.o = (r, a) => Object.prototype.hasOwnProperty.call(r, a), n.r = (r) => {
2311
+ typeof Symbol < "u" && Symbol.toStringTag && Object.defineProperty(r, Symbol.toStringTag, { value: "Module" }), Object.defineProperty(r, "__esModule", { value: !0 });
2312
+ };
2313
+ var o = {};
2314
+ (() => {
2315
+ n.r(o), n.d(o, { LazyLoadComponent: () => mt, LazyLoadImage: () => bn, trackWindowScroll: () => le });
2316
+ const r = Ie;
2317
+ var a = n.n(r), i = n(697);
2318
+ const s = Nn;
2319
+ var f = n.n(s);
2320
+ function h() {
2321
+ return typeof window < "u" && "IntersectionObserver" in window && "isIntersecting" in window.IntersectionObserverEntry.prototype;
2322
+ }
2323
+ function u(g) {
2324
+ return u = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2325
+ return typeof c;
2326
+ } : function(c) {
2327
+ return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2328
+ }, u(g);
2329
+ }
2330
+ function y(g, c) {
2331
+ var m = Object.keys(g);
2332
+ if (Object.getOwnPropertySymbols) {
2333
+ var v = Object.getOwnPropertySymbols(g);
2334
+ c && (v = v.filter(function(k) {
2335
+ return Object.getOwnPropertyDescriptor(g, k).enumerable;
2336
+ })), m.push.apply(m, v);
2337
+ }
2338
+ return m;
2339
+ }
2340
+ function x(g, c, m) {
2341
+ return (c = I(c)) in g ? Object.defineProperty(g, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : g[c] = m, g;
2342
+ }
2343
+ function M(g, c) {
2344
+ for (var m = 0; m < c.length; m++) {
2345
+ var v = c[m];
2346
+ v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, I(v.key), v);
2347
+ }
2348
+ }
2349
+ function I(g) {
2350
+ var c = function(m, v) {
2351
+ if (u(m) !== "object" || m === null)
2352
+ return m;
2353
+ var k = m[Symbol.toPrimitive];
2354
+ if (k !== void 0) {
2355
+ var _ = k.call(m, "string");
2356
+ if (u(_) !== "object")
2357
+ return _;
2358
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2359
+ }
2360
+ return String(m);
2361
+ }(g);
2362
+ return u(c) === "symbol" ? c : String(c);
2363
+ }
2364
+ function b(g, c) {
2365
+ return b = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2366
+ return m.__proto__ = v, m;
2367
+ }, b(g, c);
2368
+ }
2369
+ function E(g) {
2370
+ return E = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2371
+ return c.__proto__ || Object.getPrototypeOf(c);
2372
+ }, E(g);
2373
+ }
2374
+ var C = function(g) {
2375
+ g.forEach(function(c) {
2376
+ c.isIntersecting && c.target.onVisible();
2377
+ });
2378
+ }, A = {}, S = function(g) {
2379
+ (function(l, p) {
2380
+ if (typeof p != "function" && p !== null)
2381
+ throw new TypeError("Super expression must either be null or a function");
2382
+ l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && b(l, p);
2383
+ })(q, g);
2384
+ var c, m, v, k, _ = (v = q, k = function() {
2385
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2386
+ return !1;
2387
+ if (typeof Proxy == "function")
2388
+ return !0;
2389
+ try {
2390
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2391
+ })), !0;
2392
+ } catch {
2393
+ return !1;
2394
+ }
2395
+ }(), function() {
2396
+ var l, p = E(v);
2397
+ if (k) {
2398
+ var T = E(this).constructor;
2399
+ l = Reflect.construct(p, arguments, T);
2400
+ } else
2401
+ l = p.apply(this, arguments);
2402
+ return function(P, w) {
2403
+ if (w && (u(w) === "object" || typeof w == "function"))
2404
+ return w;
2405
+ if (w !== void 0)
2406
+ throw new TypeError("Derived constructors may only return object or undefined");
2407
+ return function(D) {
2408
+ if (D === void 0)
2409
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2410
+ return D;
2411
+ }(P);
2412
+ }(this, l);
2413
+ });
2414
+ function q(l) {
2415
+ var p;
2416
+ if (function(P, w) {
2417
+ if (!(P instanceof w))
2418
+ throw new TypeError("Cannot call a class as a function");
2419
+ }(this, q), (p = _.call(this, l)).supportsObserver = !l.scrollPosition && l.useIntersectionObserver && h(), p.supportsObserver) {
2420
+ var T = l.threshold;
2421
+ p.observer = function(P) {
2422
+ return A[P] = A[P] || new IntersectionObserver(C, { rootMargin: P + "px" }), A[P];
2423
+ }(T);
2424
+ }
2425
+ return p;
2426
+ }
2427
+ return c = q, m = [{ key: "componentDidMount", value: function() {
2428
+ this.placeholder && this.observer && (this.placeholder.onVisible = this.props.onVisible, this.observer.observe(this.placeholder)), this.supportsObserver || this.updateVisibility();
2429
+ } }, { key: "componentWillUnmount", value: function() {
2430
+ this.observer && this.placeholder && this.observer.unobserve(this.placeholder);
2431
+ } }, { key: "componentDidUpdate", value: function() {
2432
+ this.supportsObserver || this.updateVisibility();
2433
+ } }, { key: "getPlaceholderBoundingBox", value: function() {
2434
+ var l = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : this.props.scrollPosition, p = this.placeholder.getBoundingClientRect(), T = f().findDOMNode(this.placeholder).style, P = parseInt(T.getPropertyValue("margin-left"), 10) || 0, w = parseInt(T.getPropertyValue("margin-top"), 10) || 0;
2435
+ return { bottom: l.y + p.bottom + w, left: l.x + p.left + P, right: l.x + p.right + P, top: l.y + p.top + w };
2436
+ } }, { key: "isPlaceholderInViewport", value: function() {
2437
+ if (typeof window > "u" || !this.placeholder)
2438
+ return !1;
2439
+ var l = this.props, p = l.scrollPosition, T = l.threshold, P = this.getPlaceholderBoundingBox(p), w = p.y + window.innerHeight, D = p.x, z = p.x + window.innerWidth, K = p.y;
2440
+ return K - T <= P.bottom && w + T >= P.top && D - T <= P.right && z + T >= P.left;
2441
+ } }, { key: "updateVisibility", value: function() {
2442
+ this.isPlaceholderInViewport() && this.props.onVisible();
2443
+ } }, { key: "render", value: function() {
2444
+ var l = this, p = this.props, T = p.className, P = p.height, w = p.placeholder, D = p.style, z = p.width;
2445
+ if (w && typeof w.type != "function")
2446
+ return a().cloneElement(w, { ref: function(W) {
2447
+ return l.placeholder = W;
2448
+ } });
2449
+ var K = function(W) {
2450
+ for (var ce = 1; ce < arguments.length; ce++) {
2451
+ var J = arguments[ce] != null ? arguments[ce] : {};
2452
+ ce % 2 ? y(Object(J), !0).forEach(function(he) {
2453
+ x(W, he, J[he]);
2454
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(W, Object.getOwnPropertyDescriptors(J)) : y(Object(J)).forEach(function(he) {
2455
+ Object.defineProperty(W, he, Object.getOwnPropertyDescriptor(J, he));
2456
+ });
2457
+ }
2458
+ return W;
2459
+ }({ display: "inline-block" }, D);
2460
+ return z !== void 0 && (K.width = z), P !== void 0 && (K.height = P), a().createElement("span", { className: T, ref: function(W) {
2461
+ return l.placeholder = W;
2462
+ }, style: K }, w);
2463
+ } }], m && M(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2464
+ }(a().Component);
2465
+ S.propTypes = { onVisible: i.PropTypes.func.isRequired, className: i.PropTypes.string, height: i.PropTypes.oneOfType([i.PropTypes.number, i.PropTypes.string]), placeholder: i.PropTypes.element, threshold: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool, scrollPosition: i.PropTypes.shape({ x: i.PropTypes.number.isRequired, y: i.PropTypes.number.isRequired }), width: i.PropTypes.oneOfType([i.PropTypes.number, i.PropTypes.string]) }, S.defaultProps = { className: "", placeholder: null, threshold: 100, useIntersectionObserver: !0 };
2466
+ const F = S;
2467
+ var L = n(296), R = n.n(L), B = n(96), j = n.n(B), O = function(g) {
2468
+ var c = getComputedStyle(g, null);
2469
+ return c.getPropertyValue("overflow") + c.getPropertyValue("overflow-y") + c.getPropertyValue("overflow-x");
2470
+ };
2471
+ const U = function(g) {
2472
+ if (!(g instanceof HTMLElement))
2473
+ return window;
2474
+ for (var c = g; c && c instanceof HTMLElement; ) {
2475
+ if (/(scroll|auto)/.test(O(c)))
2476
+ return c;
2477
+ c = c.parentNode;
2478
+ }
2479
+ return window;
2480
+ };
2481
+ function H(g) {
2482
+ return H = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2483
+ return typeof c;
2484
+ } : function(c) {
2485
+ return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2486
+ }, H(g);
2487
+ }
2488
+ var G = ["delayMethod", "delayTime"];
2489
+ function Y() {
2490
+ return Y = Object.assign ? Object.assign.bind() : function(g) {
2491
+ for (var c = 1; c < arguments.length; c++) {
2492
+ var m = arguments[c];
2493
+ for (var v in m)
2494
+ Object.prototype.hasOwnProperty.call(m, v) && (g[v] = m[v]);
2495
+ }
2496
+ return g;
2497
+ }, Y.apply(this, arguments);
2498
+ }
2499
+ function Z(g, c) {
2500
+ for (var m = 0; m < c.length; m++) {
2501
+ var v = c[m];
2502
+ v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2503
+ if (H(_) !== "object" || _ === null)
2504
+ return _;
2505
+ var l = _[Symbol.toPrimitive];
2506
+ if (l !== void 0) {
2507
+ var p = l.call(_, "string");
2508
+ if (H(p) !== "object")
2509
+ return p;
2510
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2511
+ }
2512
+ return String(_);
2513
+ }(v.key), H(k) === "symbol" ? k : String(k)), v);
2514
+ }
2515
+ var k;
2516
+ }
2517
+ function ee(g, c) {
2518
+ return ee = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2519
+ return m.__proto__ = v, m;
2520
+ }, ee(g, c);
2521
+ }
2522
+ function se(g, c) {
2523
+ if (c && (H(c) === "object" || typeof c == "function"))
2524
+ return c;
2525
+ if (c !== void 0)
2526
+ throw new TypeError("Derived constructors may only return object or undefined");
2527
+ return me(g);
2528
+ }
2529
+ function me(g) {
2530
+ if (g === void 0)
2531
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2532
+ return g;
2533
+ }
2534
+ function V(g) {
2535
+ return V = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2536
+ return c.__proto__ || Object.getPrototypeOf(c);
2537
+ }, V(g);
2538
+ }
2539
+ var te = function() {
2540
+ return typeof window > "u" ? 0 : window.scrollX || window.pageXOffset;
2541
+ }, $ = function() {
2542
+ return typeof window > "u" ? 0 : window.scrollY || window.pageYOffset;
2543
+ };
2544
+ const le = function(g) {
2545
+ var c = function(m) {
2546
+ (function(T, P) {
2547
+ if (typeof P != "function" && P !== null)
2548
+ throw new TypeError("Super expression must either be null or a function");
2549
+ T.prototype = Object.create(P && P.prototype, { constructor: { value: T, writable: !0, configurable: !0 } }), Object.defineProperty(T, "prototype", { writable: !1 }), P && ee(T, P);
2550
+ })(p, m);
2551
+ var v, k, _, q, l = (_ = p, q = function() {
2552
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2553
+ return !1;
2554
+ if (typeof Proxy == "function")
2555
+ return !0;
2556
+ try {
2557
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2558
+ })), !0;
2559
+ } catch {
2560
+ return !1;
2561
+ }
2562
+ }(), function() {
2563
+ var T, P = V(_);
2564
+ if (q) {
2565
+ var w = V(this).constructor;
2566
+ T = Reflect.construct(P, arguments, w);
2567
+ } else
2568
+ T = P.apply(this, arguments);
2569
+ return se(this, T);
2570
+ });
2571
+ function p(T) {
2572
+ var P;
2573
+ if (function(D, z) {
2574
+ if (!(D instanceof z))
2575
+ throw new TypeError("Cannot call a class as a function");
2576
+ }(this, p), (P = l.call(this, T)).useIntersectionObserver = T.useIntersectionObserver && h(), P.useIntersectionObserver)
2577
+ return se(P);
2578
+ var w = P.onChangeScroll.bind(me(P));
2579
+ return T.delayMethod === "debounce" ? P.delayedScroll = R()(w, T.delayTime) : T.delayMethod === "throttle" && (P.delayedScroll = j()(w, T.delayTime)), P.state = { scrollPosition: { x: te(), y: $() } }, P.baseComponentRef = a().createRef(), P;
2580
+ }
2581
+ return v = p, (k = [{ key: "componentDidMount", value: function() {
2582
+ this.addListeners();
2583
+ } }, { key: "componentWillUnmount", value: function() {
2584
+ this.removeListeners();
2585
+ } }, { key: "componentDidUpdate", value: function() {
2586
+ typeof window > "u" || this.useIntersectionObserver || U(f().findDOMNode(this.baseComponentRef.current)) !== this.scrollElement && (this.removeListeners(), this.addListeners());
2587
+ } }, { key: "addListeners", value: function() {
2588
+ typeof window > "u" || this.useIntersectionObserver || (this.scrollElement = U(f().findDOMNode(this.baseComponentRef.current)), this.scrollElement.addEventListener("scroll", this.delayedScroll, { passive: !0 }), window.addEventListener("resize", this.delayedScroll, { passive: !0 }), this.scrollElement !== window && window.addEventListener("scroll", this.delayedScroll, { passive: !0 }));
2589
+ } }, { key: "removeListeners", value: function() {
2590
+ typeof window > "u" || this.useIntersectionObserver || (this.scrollElement.removeEventListener("scroll", this.delayedScroll), window.removeEventListener("resize", this.delayedScroll), this.scrollElement !== window && window.removeEventListener("scroll", this.delayedScroll));
2591
+ } }, { key: "onChangeScroll", value: function() {
2592
+ this.useIntersectionObserver || this.setState({ scrollPosition: { x: te(), y: $() } });
2593
+ } }, { key: "render", value: function() {
2594
+ var T = this.props, P = (T.delayMethod, T.delayTime, function(D, z) {
2595
+ if (D == null)
2596
+ return {};
2597
+ var K, W, ce = function(he, ke) {
2598
+ if (he == null)
2599
+ return {};
2600
+ var Re, $e, Pt = {}, Ot = Object.keys(he);
2601
+ for ($e = 0; $e < Ot.length; $e++)
2602
+ Re = Ot[$e], ke.indexOf(Re) >= 0 || (Pt[Re] = he[Re]);
2603
+ return Pt;
2604
+ }(D, z);
2605
+ if (Object.getOwnPropertySymbols) {
2606
+ var J = Object.getOwnPropertySymbols(D);
2607
+ for (W = 0; W < J.length; W++)
2608
+ K = J[W], z.indexOf(K) >= 0 || Object.prototype.propertyIsEnumerable.call(D, K) && (ce[K] = D[K]);
2609
+ }
2610
+ return ce;
2611
+ }(T, G)), w = this.useIntersectionObserver ? null : this.state.scrollPosition;
2612
+ return a().createElement(g, Y({ forwardRef: this.baseComponentRef, scrollPosition: w }, P));
2613
+ } }]) && Z(v.prototype, k), Object.defineProperty(v, "prototype", { writable: !1 }), p;
2614
+ }(a().Component);
2615
+ return c.propTypes = { delayMethod: i.PropTypes.oneOf(["debounce", "throttle"]), delayTime: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool }, c.defaultProps = { delayMethod: "throttle", delayTime: 300, useIntersectionObserver: !0 }, c;
2616
+ };
2617
+ function fe(g) {
2618
+ return fe = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2619
+ return typeof c;
2620
+ } : function(c) {
2621
+ return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2622
+ }, fe(g);
2623
+ }
2624
+ function re(g, c) {
2625
+ for (var m = 0; m < c.length; m++) {
2626
+ var v = c[m];
2627
+ v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2628
+ if (fe(_) !== "object" || _ === null)
2629
+ return _;
2630
+ var l = _[Symbol.toPrimitive];
2631
+ if (l !== void 0) {
2632
+ var p = l.call(_, "string");
2633
+ if (fe(p) !== "object")
2634
+ return p;
2635
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2636
+ }
2637
+ return String(_);
2638
+ }(v.key), fe(k) === "symbol" ? k : String(k)), v);
2639
+ }
2640
+ var k;
2641
+ }
2642
+ function oe(g, c) {
2643
+ return oe = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2644
+ return m.__proto__ = v, m;
2645
+ }, oe(g, c);
2646
+ }
2647
+ function de(g) {
2648
+ return de = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2649
+ return c.__proto__ || Object.getPrototypeOf(c);
2650
+ }, de(g);
2651
+ }
2652
+ var _e = function(g) {
2653
+ (function(l, p) {
2654
+ if (typeof p != "function" && p !== null)
2655
+ throw new TypeError("Super expression must either be null or a function");
2656
+ l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && oe(l, p);
2657
+ })(q, g);
2658
+ var c, m, v, k, _ = (v = q, k = function() {
2659
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2660
+ return !1;
2661
+ if (typeof Proxy == "function")
2662
+ return !0;
2663
+ try {
2664
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2665
+ })), !0;
2666
+ } catch {
2667
+ return !1;
2668
+ }
2669
+ }(), function() {
2670
+ var l, p = de(v);
2671
+ if (k) {
2672
+ var T = de(this).constructor;
2673
+ l = Reflect.construct(p, arguments, T);
2674
+ } else
2675
+ l = p.apply(this, arguments);
2676
+ return function(P, w) {
2677
+ if (w && (fe(w) === "object" || typeof w == "function"))
2678
+ return w;
2679
+ if (w !== void 0)
2680
+ throw new TypeError("Derived constructors may only return object or undefined");
2681
+ return function(D) {
2682
+ if (D === void 0)
2683
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2684
+ return D;
2685
+ }(P);
2686
+ }(this, l);
2687
+ });
2688
+ function q(l) {
2689
+ return function(p, T) {
2690
+ if (!(p instanceof T))
2691
+ throw new TypeError("Cannot call a class as a function");
2692
+ }(this, q), _.call(this, l);
2693
+ }
2694
+ return c = q, (m = [{ key: "render", value: function() {
2695
+ return a().createElement(F, this.props);
2696
+ } }]) && re(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2697
+ }(a().Component);
2698
+ const Be = le(_e);
2699
+ function we(g) {
2700
+ return we = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2701
+ return typeof c;
2702
+ } : function(c) {
2703
+ return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2704
+ }, we(g);
2705
+ }
2706
+ function qe(g, c) {
2707
+ for (var m = 0; m < c.length; m++) {
2708
+ var v = c[m];
2709
+ v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, (k = function(_, q) {
2710
+ if (we(_) !== "object" || _ === null)
2711
+ return _;
2712
+ var l = _[Symbol.toPrimitive];
2713
+ if (l !== void 0) {
2714
+ var p = l.call(_, "string");
2715
+ if (we(p) !== "object")
2716
+ return p;
2717
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2718
+ }
2719
+ return String(_);
2720
+ }(v.key), we(k) === "symbol" ? k : String(k)), v);
2721
+ }
2722
+ var k;
2723
+ }
2724
+ function Me(g, c) {
2725
+ return Me = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2726
+ return m.__proto__ = v, m;
2727
+ }, Me(g, c);
2728
+ }
2729
+ function pe(g) {
2730
+ if (g === void 0)
2731
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2732
+ return g;
2733
+ }
2734
+ function ve(g) {
2735
+ return ve = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2736
+ return c.__proto__ || Object.getPrototypeOf(c);
2737
+ }, ve(g);
2738
+ }
2739
+ var Pe = function(g) {
2740
+ (function(l, p) {
2741
+ if (typeof p != "function" && p !== null)
2742
+ throw new TypeError("Super expression must either be null or a function");
2743
+ l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && Me(l, p);
2744
+ })(q, g);
2745
+ var c, m, v, k, _ = (v = q, k = function() {
2746
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2747
+ return !1;
2748
+ if (typeof Proxy == "function")
2749
+ return !0;
2750
+ try {
2751
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2752
+ })), !0;
2753
+ } catch {
2754
+ return !1;
2755
+ }
2756
+ }(), function() {
2757
+ var l, p = ve(v);
2758
+ if (k) {
2759
+ var T = ve(this).constructor;
2760
+ l = Reflect.construct(p, arguments, T);
2761
+ } else
2762
+ l = p.apply(this, arguments);
2763
+ return function(P, w) {
2764
+ if (w && (we(w) === "object" || typeof w == "function"))
2765
+ return w;
2766
+ if (w !== void 0)
2767
+ throw new TypeError("Derived constructors may only return object or undefined");
2768
+ return pe(P);
2769
+ }(this, l);
2770
+ });
2771
+ function q(l) {
2772
+ var p;
2773
+ (function(z, K) {
2774
+ if (!(z instanceof K))
2775
+ throw new TypeError("Cannot call a class as a function");
2776
+ })(this, q), p = _.call(this, l);
2777
+ var T = l.afterLoad, P = l.beforeLoad, w = l.scrollPosition, D = l.visibleByDefault;
2778
+ return p.state = { visible: D }, D && (P(), T()), p.onVisible = p.onVisible.bind(pe(p)), p.isScrollTracked = !!(w && Number.isFinite(w.x) && w.x >= 0 && Number.isFinite(w.y) && w.y >= 0), p;
2779
+ }
2780
+ return c = q, (m = [{ key: "componentDidUpdate", value: function(l, p) {
2781
+ p.visible !== this.state.visible && this.props.afterLoad();
2782
+ } }, { key: "onVisible", value: function() {
2783
+ this.props.beforeLoad(), this.setState({ visible: !0 });
2784
+ } }, { key: "render", value: function() {
2785
+ if (this.state.visible)
2786
+ return this.props.children;
2787
+ var l = this.props, p = l.className, T = l.delayMethod, P = l.delayTime, w = l.height, D = l.placeholder, z = l.scrollPosition, K = l.style, W = l.threshold, ce = l.useIntersectionObserver, J = l.width;
2788
+ return this.isScrollTracked || ce && h() ? a().createElement(F, { className: p, height: w, onVisible: this.onVisible, placeholder: D, scrollPosition: z, style: K, threshold: W, useIntersectionObserver: ce, width: J }) : a().createElement(Be, { className: p, delayMethod: T, delayTime: P, height: w, onVisible: this.onVisible, placeholder: D, style: K, threshold: W, width: J });
2789
+ } }]) && qe(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2790
+ }(a().Component);
2791
+ Pe.propTypes = { afterLoad: i.PropTypes.func, beforeLoad: i.PropTypes.func, useIntersectionObserver: i.PropTypes.bool, visibleByDefault: i.PropTypes.bool }, Pe.defaultProps = { afterLoad: function() {
2792
+ return {};
2793
+ }, beforeLoad: function() {
2794
+ return {};
2795
+ }, useIntersectionObserver: !0, visibleByDefault: !1 };
2796
+ const mt = Pe;
2797
+ function Ae(g) {
2798
+ return Ae = typeof Symbol == "function" && typeof Symbol.iterator == "symbol" ? function(c) {
2799
+ return typeof c;
2800
+ } : function(c) {
2801
+ return c && typeof Symbol == "function" && c.constructor === Symbol && c !== Symbol.prototype ? "symbol" : typeof c;
2802
+ }, Ae(g);
2803
+ }
2804
+ var gn = ["afterLoad", "beforeLoad", "delayMethod", "delayTime", "effect", "placeholder", "placeholderSrc", "scrollPosition", "threshold", "useIntersectionObserver", "visibleByDefault", "wrapperClassName", "wrapperProps"];
2805
+ function vt(g, c) {
2806
+ var m = Object.keys(g);
2807
+ if (Object.getOwnPropertySymbols) {
2808
+ var v = Object.getOwnPropertySymbols(g);
2809
+ c && (v = v.filter(function(k) {
2810
+ return Object.getOwnPropertyDescriptor(g, k).enumerable;
2811
+ })), m.push.apply(m, v);
2812
+ }
2813
+ return m;
2814
+ }
2815
+ function bt(g) {
2816
+ for (var c = 1; c < arguments.length; c++) {
2817
+ var m = arguments[c] != null ? arguments[c] : {};
2818
+ c % 2 ? vt(Object(m), !0).forEach(function(v) {
2819
+ mn(g, v, m[v]);
2820
+ }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(g, Object.getOwnPropertyDescriptors(m)) : vt(Object(m)).forEach(function(v) {
2821
+ Object.defineProperty(g, v, Object.getOwnPropertyDescriptor(m, v));
2822
+ });
2823
+ }
2824
+ return g;
2825
+ }
2826
+ function mn(g, c, m) {
2827
+ return (c = wt(c)) in g ? Object.defineProperty(g, c, { value: m, enumerable: !0, configurable: !0, writable: !0 }) : g[c] = m, g;
2828
+ }
2829
+ function Fe() {
2830
+ return Fe = Object.assign ? Object.assign.bind() : function(g) {
2831
+ for (var c = 1; c < arguments.length; c++) {
2832
+ var m = arguments[c];
2833
+ for (var v in m)
2834
+ Object.prototype.hasOwnProperty.call(m, v) && (g[v] = m[v]);
2835
+ }
2836
+ return g;
2837
+ }, Fe.apply(this, arguments);
2838
+ }
2839
+ function vn(g, c) {
2840
+ for (var m = 0; m < c.length; m++) {
2841
+ var v = c[m];
2842
+ v.enumerable = v.enumerable || !1, v.configurable = !0, "value" in v && (v.writable = !0), Object.defineProperty(g, wt(v.key), v);
2843
+ }
2844
+ }
2845
+ function wt(g) {
2846
+ var c = function(m, v) {
2847
+ if (Ae(m) !== "object" || m === null)
2848
+ return m;
2849
+ var k = m[Symbol.toPrimitive];
2850
+ if (k !== void 0) {
2851
+ var _ = k.call(m, "string");
2852
+ if (Ae(_) !== "object")
2853
+ return _;
2854
+ throw new TypeError("@@toPrimitive must return a primitive value.");
2855
+ }
2856
+ return String(m);
2857
+ }(g);
2858
+ return Ae(c) === "symbol" ? c : String(c);
2859
+ }
2860
+ function Ze(g, c) {
2861
+ return Ze = Object.setPrototypeOf ? Object.setPrototypeOf.bind() : function(m, v) {
2862
+ return m.__proto__ = v, m;
2863
+ }, Ze(g, c);
2864
+ }
2865
+ function Ue(g) {
2866
+ return Ue = Object.setPrototypeOf ? Object.getPrototypeOf.bind() : function(c) {
2867
+ return c.__proto__ || Object.getPrototypeOf(c);
2868
+ }, Ue(g);
2869
+ }
2870
+ var et = function(g) {
2871
+ (function(l, p) {
2872
+ if (typeof p != "function" && p !== null)
2873
+ throw new TypeError("Super expression must either be null or a function");
2874
+ l.prototype = Object.create(p && p.prototype, { constructor: { value: l, writable: !0, configurable: !0 } }), Object.defineProperty(l, "prototype", { writable: !1 }), p && Ze(l, p);
2875
+ })(q, g);
2876
+ var c, m, v, k, _ = (v = q, k = function() {
2877
+ if (typeof Reflect > "u" || !Reflect.construct || Reflect.construct.sham)
2878
+ return !1;
2879
+ if (typeof Proxy == "function")
2880
+ return !0;
2881
+ try {
2882
+ return Boolean.prototype.valueOf.call(Reflect.construct(Boolean, [], function() {
2883
+ })), !0;
2884
+ } catch {
2885
+ return !1;
2886
+ }
2887
+ }(), function() {
2888
+ var l, p = Ue(v);
2889
+ if (k) {
2890
+ var T = Ue(this).constructor;
2891
+ l = Reflect.construct(p, arguments, T);
2892
+ } else
2893
+ l = p.apply(this, arguments);
2894
+ return function(P, w) {
2895
+ if (w && (Ae(w) === "object" || typeof w == "function"))
2896
+ return w;
2897
+ if (w !== void 0)
2898
+ throw new TypeError("Derived constructors may only return object or undefined");
2899
+ return function(D) {
2900
+ if (D === void 0)
2901
+ throw new ReferenceError("this hasn't been initialised - super() hasn't been called");
2902
+ return D;
2903
+ }(P);
2904
+ }(this, l);
2905
+ });
2906
+ function q(l) {
2907
+ var p;
2908
+ return function(T, P) {
2909
+ if (!(T instanceof P))
2910
+ throw new TypeError("Cannot call a class as a function");
2911
+ }(this, q), (p = _.call(this, l)).state = { loaded: !1 }, p;
2912
+ }
2913
+ return c = q, (m = [{ key: "onImageLoad", value: function() {
2914
+ var l = this;
2915
+ return this.state.loaded ? null : function(p) {
2916
+ l.props.onLoad(p), l.props.afterLoad(), l.setState({ loaded: !0 });
2917
+ };
2918
+ } }, { key: "getImg", value: function() {
2919
+ var l = this.props, p = (l.afterLoad, l.beforeLoad, l.delayMethod, l.delayTime, l.effect, l.placeholder, l.placeholderSrc, l.scrollPosition, l.threshold, l.useIntersectionObserver, l.visibleByDefault, l.wrapperClassName, l.wrapperProps, function(T, P) {
2920
+ if (T == null)
2921
+ return {};
2922
+ var w, D, z = function(W, ce) {
2923
+ if (W == null)
2924
+ return {};
2925
+ var J, he, ke = {}, Re = Object.keys(W);
2926
+ for (he = 0; he < Re.length; he++)
2927
+ J = Re[he], ce.indexOf(J) >= 0 || (ke[J] = W[J]);
2928
+ return ke;
2929
+ }(T, P);
2930
+ if (Object.getOwnPropertySymbols) {
2931
+ var K = Object.getOwnPropertySymbols(T);
2932
+ for (D = 0; D < K.length; D++)
2933
+ w = K[D], P.indexOf(w) >= 0 || Object.prototype.propertyIsEnumerable.call(T, w) && (z[w] = T[w]);
2934
+ }
2935
+ return z;
2936
+ }(l, gn));
2937
+ return a().createElement("img", Fe({}, p, { onLoad: this.onImageLoad() }));
2938
+ } }, { key: "getLazyLoadImage", value: function() {
2939
+ var l = this.props, p = l.beforeLoad, T = l.className, P = l.delayMethod, w = l.delayTime, D = l.height, z = l.placeholder, K = l.scrollPosition, W = l.style, ce = l.threshold, J = l.useIntersectionObserver, he = l.visibleByDefault, ke = l.width;
2940
+ return a().createElement(mt, { beforeLoad: p, className: T, delayMethod: P, delayTime: w, height: D, placeholder: z, scrollPosition: K, style: W, threshold: ce, useIntersectionObserver: J, visibleByDefault: he, width: ke }, this.getImg());
2941
+ } }, { key: "getWrappedLazyLoadImage", value: function(l) {
2942
+ var p = this.props, T = p.effect, P = p.height, w = p.placeholderSrc, D = p.width, z = p.wrapperClassName, K = p.wrapperProps, W = this.state.loaded, ce = W ? " lazy-load-image-loaded" : "", J = W || !w ? {} : { backgroundImage: "url(".concat(w, ")"), backgroundSize: "100% 100%" };
2943
+ return a().createElement("span", Fe({ className: z + " lazy-load-image-background " + T + ce, style: bt(bt({}, J), {}, { color: "transparent", display: "inline-block", height: P, width: D }) }, K), l);
2944
+ } }, { key: "render", value: function() {
2945
+ var l = this.props, p = l.effect, T = l.placeholderSrc, P = l.visibleByDefault, w = l.wrapperClassName, D = l.wrapperProps, z = this.getLazyLoadImage();
2946
+ return (p || T) && !P || w || D ? this.getWrappedLazyLoadImage(z) : z;
2947
+ } }]) && vn(c.prototype, m), Object.defineProperty(c, "prototype", { writable: !1 }), q;
2948
+ }(a().Component);
2949
+ et.propTypes = { onLoad: i.PropTypes.func, afterLoad: i.PropTypes.func, beforeLoad: i.PropTypes.func, delayMethod: i.PropTypes.string, delayTime: i.PropTypes.number, effect: i.PropTypes.string, placeholderSrc: i.PropTypes.string, threshold: i.PropTypes.number, useIntersectionObserver: i.PropTypes.bool, visibleByDefault: i.PropTypes.bool, wrapperClassName: i.PropTypes.string, wrapperProps: i.PropTypes.object }, et.defaultProps = { onLoad: function() {
2950
+ }, afterLoad: function() {
2951
+ return {};
2952
+ }, beforeLoad: function() {
2953
+ return {};
2954
+ }, delayMethod: "throttle", delayTime: 300, effect: "", placeholderSrc: null, threshold: 100, useIntersectionObserver: !0, visibleByDefault: !1, wrapperClassName: "" };
2955
+ const bn = et;
2956
+ })(), hn.exports = o;
2957
+ })();
2958
+ var ro = hn.exports;
2959
+ function oo(e, t, n = [], o = !1, r = []) {
2960
+ if (r.length && (t = t.filter((i) => r.indexOf(i) === -1)), !t || t.length === 0)
2961
+ return;
2962
+ if (t.length === 1)
2963
+ return t[0];
2964
+ if (!e)
2965
+ return t.indexOf("none") !== -1 ? "none" : t[0];
2966
+ if (t.indexOf(e) !== -1)
2967
+ return e;
2968
+ const a = e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : null;
2969
+ if (a && t.indexOf(a) !== -1)
2970
+ return a;
2971
+ for (const i of n)
2972
+ if (t.indexOf(i) !== -1)
2973
+ return i;
2974
+ if (!o && e) {
2975
+ const i = t.map((s) => s.indexOf("-") !== -1 ? s.slice(0, s.indexOf("-")) : null).indexOf(e);
2976
+ if (i !== -1)
2977
+ return t[i];
2978
+ for (const s of n) {
2979
+ const f = s.indexOf("-") !== -1 ? s.slice(0, s.indexOf("-")) : null, h = f ? t.indexOf(f) : -1;
2980
+ if (h !== -1)
2981
+ return t[h];
2982
+ }
2983
+ }
2984
+ return t.indexOf("none") !== -1 ? "none" : t.indexOf("@none") !== -1 ? "@none" : t[0];
2985
+ }
2986
+ function yn(e, t, n = {}) {
2987
+ const {
2988
+ strictFallback: o = !1,
2989
+ defaultText: r = "",
2990
+ separator: a = `
2991
+ `,
2992
+ fallbackLanguages: i = [],
2993
+ closest: s,
2994
+ skipLanguages: f
2995
+ } = n, h = Object.keys(e || {}), u = s ? t : oo(t, h, i, o, f);
2996
+ if (!e)
2997
+ return r;
2998
+ if (typeof e == "string")
2999
+ return e;
3000
+ const y = u ? e[u] : void 0;
3001
+ if (y && u) {
3002
+ if (typeof y == "string")
3003
+ return y;
3004
+ if (y.length === 1 && y[0] === "") {
3005
+ const x = n.skipLanguages || [];
3006
+ return yn(e, t, {
3007
+ ...n,
3008
+ skipLanguages: [...x, u]
3009
+ });
3010
+ }
3011
+ return y.join(a);
3012
+ }
3013
+ return "";
3014
+ }
3015
+ function io(e, t = {}) {
3016
+ return yn(
3017
+ e,
3018
+ t.language || (typeof navigator < "u" ? navigator.language : "en"),
3019
+ t
3020
+ );
3021
+ }
3022
+ const ao = ro.LazyLoadComponent;
3023
+ function so(e) {
3024
+ const { size: t, visible: n, classes: o, canvasId: r, figure: a } = e, i = (t == null ? void 0 : t.width) || 128, s = (t == null ? void 0 : t.height) || (t == null ? void 0 : t.width) || 128, f = /* @__PURE__ */ d(co, { ...e }), h = /* @__PURE__ */ d(ao, { threshold: 300, style: { height: s, width: i }, visibleByDefault: n, children: r ? /* @__PURE__ */ d(Qe, { canvas: r, children: f }) : f });
3025
+ return a ? /* @__PURE__ */ d("figure", { className: o == null ? void 0 : o.figure, children: h }) : h;
3026
+ }
3027
+ function co({ fallback: e, size: t, classes: n, showLabel: o, alt: r, dereference: a = !1 }) {
3028
+ const i = Se(), s = (t == null ? void 0 : t.width) || 128, f = (t == null ? void 0 : t.height) || (t == null ? void 0 : t.width) || 128, h = r || io(i == null ? void 0 : i.label) || "", u = Gt({ width: s, height: f }, a);
3029
+ return !u || u.type !== "fixed" ? /* @__PURE__ */ d(Oe, { children: e }) : /* @__PURE__ */ X(Oe, { children: [
3030
+ /* @__PURE__ */ d("div", { className: n == null ? void 0 : n.imageWrapper, children: /* @__PURE__ */ d("img", { className: n == null ? void 0 : n.img, src: u.id, alt: h }) }),
3031
+ o ? /* @__PURE__ */ d(Ne, { as: "figcaption", className: n == null ? void 0 : n.label, children: i == null ? void 0 : i.label }) : null
3032
+ ] });
3033
+ }
3034
+ function Lo({ flat: e, size: t, classes: n = {}, showLabel: o, figure: r, fallback: a }) {
3035
+ var M, I, b, E, C, A;
3036
+ const i = Ee(null), { items: s, sequence: f, currentSequenceIndex: h, setSequenceIndex: u } = Nt(), y = {
3037
+ row: ((M = n.selected) == null ? void 0 : M.row) || n.row,
3038
+ item: ((I = n.selected) == null ? void 0 : I.item) || n.item,
3039
+ figure: ((b = n.selected) == null ? void 0 : b.figure) || n.figure,
3040
+ img: ((E = n.selected) == null ? void 0 : E.img) || n.img,
3041
+ label: ((C = n.selected) == null ? void 0 : C.label) || n.label,
3042
+ imageWrapper: ((A = n.selected) == null ? void 0 : A.imageWrapper) || n.imageWrapper
3043
+ };
3044
+ st(() => {
3045
+ if (!i.current)
3046
+ return;
3047
+ const S = i.current.querySelector("[data-selected=true]");
3048
+ S && S.scrollIntoView({ behavior: "smooth", block: "nearest", inline: "center" });
3049
+ }, [h]);
3050
+ const x = [];
3051
+ for (const S of f) {
3052
+ const F = [], L = f[h] === S;
3053
+ for (const R of S) {
3054
+ const B = s[R];
3055
+ F.push(
3056
+ /* @__PURE__ */ d("div", { className: L ? y.item : n.item, children: /* @__PURE__ */ d(
3057
+ so,
3058
+ {
3059
+ classes: L ? y : n,
3060
+ canvasId: B.id,
3061
+ size: t,
3062
+ showLabel: o,
3063
+ figure: r,
3064
+ placeholder: /* @__PURE__ */ d("div", { style: { height: 128, width: 128 } }),
3065
+ fallback: a
3066
+ }
3067
+ ) }, R)
3068
+ );
3069
+ }
3070
+ if (e) {
3071
+ x.push(F);
3072
+ continue;
3073
+ }
3074
+ x.push(
3075
+ /* @__PURE__ */ d(
3076
+ "div",
3077
+ {
3078
+ onClick: (R) => {
3079
+ u(f.indexOf(S));
3080
+ },
3081
+ "data-selected": L,
3082
+ className: L ? y.row : n.row,
3083
+ children: F
3084
+ }
3085
+ )
3086
+ );
3087
+ }
3088
+ return /* @__PURE__ */ d("div", { ref: i, className: n.container, children: x });
3089
+ }
3090
+ function Ao({ annotation: e, children: t }) {
3091
+ return /* @__PURE__ */ d(Le, { value: { annotation: e }, children: t });
3092
+ }
3093
+ function ko({ annotationPage: e, children: t }) {
3094
+ return /* @__PURE__ */ d(Le, { value: { annotationPage: e }, children: t });
3095
+ }
3096
+ function No({ collection: e, children: t }) {
3097
+ return /* @__PURE__ */ d(Le, { value: { collection: e }, children: t });
3098
+ }
3099
+ function Vo(e, t = {}) {
3100
+ return ht(t);
3101
+ }
3102
+ function _o(e, t = !1) {
3103
+ }
3104
+ function Do(e) {
3105
+ const n = je().manifest, o = e ? e.map((r) => typeof r == "string" ? r : r == null ? void 0 : r.id) : [];
3106
+ return ye(
3107
+ (r) => {
3108
+ const a = n ? r.iiif.entities.Manifest[n] : void 0, i = (a == null ? void 0 : a.items) || [];
1912
3109
  if (typeof e > "u")
1913
- return a;
3110
+ return i;
1914
3111
  const s = [];
1915
- for (const c of (o == null ? void 0 : o.items) || [])
1916
- r.indexOf(c.id) !== -1 && s.push(c);
3112
+ for (const f of (a == null ? void 0 : a.items) || [])
3113
+ o.indexOf(f.id) !== -1 && s.push(f);
1917
3114
  return s;
1918
3115
  },
1919
- [r.join("/")]
3116
+ [o.join("/")]
1920
3117
  );
1921
3118
  }
1922
- function wr(e, t = []) {
1923
- const { id: n, selector: r } = e, i = H(), o = n || i.collection, a = V(
1924
- (s) => o ? s.iiif.entities.Collection[o] : void 0,
1925
- [o]
3119
+ function Bo(e, t = []) {
3120
+ const { id: n, selector: o } = e, r = je(), a = n || r.collection, i = ye(
3121
+ (s) => a ? s.iiif.entities.Collection[a] : void 0,
3122
+ [a]
1926
3123
  );
1927
- return x(() => {
1928
- if (a)
1929
- return r ? r(a) : a;
1930
- }, [a, r, ...t]);
1931
- }
1932
- function Cr(e, t, n, r, i = []) {
1933
- const o = I(), a = x(() => He(o), [o]);
1934
- k(() => {
3124
+ return N(() => {
3125
+ if (i)
3126
+ return o ? o(i) : i;
3127
+ }, [i, o, ...t]);
3128
+ }
3129
+ function qo(e, t, n, o, r = []) {
3130
+ const a = ae(), i = N(() => Ft(a), [a]);
3131
+ be(() => {
1935
3132
  const s = e;
1936
- return s ? (a.addEventListener(s, t, n, r), () => {
1937
- a.removeEventListener(s, t, n);
3133
+ return s ? (i.addEventListener(s, t, n, o), () => {
3134
+ i.removeEventListener(s, t, n);
1938
3135
  }) : () => {
1939
3136
  };
1940
- }, [a, e, t, ...i]);
3137
+ }, [i, e, t, ...r]);
1941
3138
  }
1942
- function br(e, t) {
1943
- const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = ke(
3139
+ function Fo(e, t) {
3140
+ const { id: n, isLoaded: o, error: r, resource: a, requestId: i, cached: s } = jt(
1944
3141
  e,
1945
3142
  t
1946
3143
  );
1947
- return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
3144
+ return { id: n, isLoaded: o, error: r, manifest: a, requestId: i, cached: s };
1948
3145
  }
1949
- function Jn({ cacheKey: e } = {}) {
1950
- const t = j(), n = xe(), r = I(), i = ye(), [o, a] = T(void 0), [s, c] = T(!1), [d, u] = T("idle"), [f, m] = T(void 0), p = t ? t.id : "undefined", g = x(() => {
3146
+ function uo({ cacheKey: e } = {}) {
3147
+ const t = Se(), n = ht(), o = ae(), r = Je(), [a, i] = ie(void 0), [s, f] = ie(!1), [h, u] = ie("idle"), [y, x] = ie(void 0), M = t ? t.id : "undefined", I = N(() => {
1951
3148
  try {
1952
3149
  if (t && n.length) {
1953
- const y = n[0], w = r.get(y.body[0]), S = de(w)[0];
1954
- return S && i.loadServiceSync({
3150
+ const E = n[0], C = o.get(E.body[0]), S = it(C)[0];
3151
+ return S && r.loadServiceSync({
1955
3152
  id: S.id || S["@id"],
1956
3153
  width: S.width || t.width,
1957
3154
  height: S.height || t.height
1958
3155
  }) || void 0;
1959
3156
  }
1960
- } catch (y) {
1961
- console.error(y);
3157
+ } catch (E) {
3158
+ console.error(E);
1962
3159
  }
1963
- }, [p, e, t]), h = d === "success" && o ? o : g;
1964
- return k(() => {
3160
+ }, [M, e, t]), b = h === "success" && a ? a : I;
3161
+ return be(() => {
1965
3162
  (async () => {
1966
3163
  try {
1967
3164
  if (t && n.length) {
1968
- const y = n[0], w = r.get(y.body[0]), S = de(w)[0];
3165
+ const E = n[0], C = o.get(E.body[0]), S = it(C)[0];
1969
3166
  if (!S)
1970
3167
  return;
1971
- c(!0), u("loading");
3168
+ f(!0), u("loading");
1972
3169
  try {
1973
- const D = await i.loadService({
3170
+ const F = await r.loadService({
1974
3171
  id: S.id || S["@id"],
1975
3172
  width: S.width || t.width,
1976
3173
  height: S.height || t.height
1977
3174
  }) || void 0;
1978
- a(D), u("success"), c(!1);
1979
- } catch (D) {
1980
- u("error"), m(D);
3175
+ i(F), u("success"), f(!1);
3176
+ } catch (F) {
3177
+ u("error"), x(F);
1981
3178
  }
1982
3179
  }
1983
- } catch (y) {
1984
- u("error"), m(y);
3180
+ } catch (E) {
3181
+ u("error"), x(E);
1985
3182
  }
1986
3183
  })();
1987
- }, [p, e]), x(() => ({
1988
- data: h,
3184
+ }, [M, e]), N(() => ({
3185
+ data: b,
1989
3186
  isFetching: s,
1990
- status: d,
1991
- error: f
1992
- }), [h, s, d, f]);
3187
+ status: h,
3188
+ error: y
3189
+ }), [b, s, h, y]);
1993
3190
  }
1994
- function Pr() {
1995
- const e = Jn();
3191
+ function Uo() {
3192
+ const e = uo();
1996
3193
  return {
1997
3194
  isLoading: e.isFetching,
1998
3195
  tile: e.data ? {
@@ -2004,106 +3201,114 @@ function Pr() {
2004
3201
  } : null
2005
3202
  };
2006
3203
  }
2007
- function Er() {
2008
- const e = W();
3204
+ function $o() {
3205
+ const e = Ce();
2009
3206
  return e ? e.service.find(
2010
3207
  (t) => t.profile === "SearchService1" || t.profile === "http://iiif.io/api/search/1/search"
2011
3208
  ) : void 0;
2012
3209
  }
2013
- function Ir() {
2014
- const e = I();
2015
- return x(() => ge(e), [e]);
3210
+ function Wo() {
3211
+ const e = ae();
3212
+ return N(() => ut(e), [e]);
2016
3213
  }
2017
3214
  export {
2018
- vr as AnnotationContext,
2019
- mr as AnnotationPageContext,
2020
- me as CanvasContext,
2021
- O as CanvasPanel,
2022
- pr as CollectionContext,
2023
- Ut as ContextBridge,
2024
- Pn as ImageServiceLoaderContext,
2025
- Ft as InnerViewerProvider,
2026
- hr as LanguageProvider,
2027
- Bn as LanguageString,
2028
- zn as LocaleString,
2029
- Tt as ManifestContext,
2030
- tt as MediaPlayerProvider,
2031
- Vt as RangeContext,
2032
- ie as ReactVaultContext,
2033
- K as ResourceProvider,
2034
- ve as ResourceReactContext,
2035
- Nt as SimpleViewerProvider,
2036
- ae as SimpleViewerReactContext,
2037
- Oe as VaultProvider,
2038
- pe as ViewerPresetContext,
2039
- ln as VirtualAnnotationProvider,
2040
- oe as VisibleCanvasReactContext,
2041
- mn as emptyActions,
2042
- pn as emptyStrategy,
2043
- Ne as findAllCanvasesInRange,
2044
- Lt as findFirstCanvasFromRange,
2045
- sr as findManifestSelectedRange,
2046
- De as findSelectedRange,
2047
- Sn as flattenAnnotationPageIds,
2048
- $n as formatTime,
2049
- Tn as get3dStrategy,
2050
- Ln as getImageStrategy,
2051
- _e as getManifestSequence,
2052
- Ge as getParsedTargetSelector,
2053
- Nn as getRenderingStrategy,
2054
- On as getTextualContentStrategy,
2055
- Fn as getVideoStrategy,
2056
- cr as getVisibleCanvasesFromCanvasId,
2057
- ur as parseSpecificResource,
2058
- ue as unknownResponse,
2059
- E as unsupportedStrategy,
2060
- ze as useAnnotation,
2061
- vn as useAnnotationPage,
2062
- Cn as useAnnotationPageManager,
2063
- yr as useAnnotationsAtTime,
2064
- j as useCanvas,
2065
- xr as useCanvasClock,
2066
- kt as useCanvasSequence,
2067
- Sr as useCanvasSubset,
2068
- Hn as useClosestLanguage,
2069
- wr as useCollection,
2070
- _t as useContextBridge,
2071
- gr as useCreateLocaleString,
2072
- sn as useDispatch,
2073
- Cr as useEventListener,
2074
- Gn as useExistingVault,
2075
- br as useExternalCollection,
2076
- Rt as useExternalManifest,
2077
- ke as useExternalResource,
2078
- we as useIIIFLanguage,
2079
- Jn as useImageService,
2080
- ye as useImageServiceLoader,
2081
- Pr as useImageTile,
2082
- En as useLoadImageService,
2083
- Yn as useLocaleString,
2084
- W as useManifest,
2085
- dr as useMediaActions,
2086
- fr as useMediaElements,
2087
- lr as useMediaState,
2088
- Mn as usePaintables,
2089
- xe as usePaintingAnnotations,
2090
- Ot as useRange,
2091
- Dn as useRenderingStrategy,
2092
- H as useResourceContext,
2093
- Ye as useResourceEvents,
2094
- bn as useResources,
2095
- Er as useSearchService,
2096
- Se as useSimpleMediaPlayer,
2097
- Dt as useSimpleViewer,
2098
- Ir as useStyleHelper,
2099
- re as useStyles,
2100
- Un as useThumbnail,
2101
- I as useVault,
2102
- _n as useVaultEffect,
2103
- V as useVaultSelector,
2104
- fn as useViewerPreset,
2105
- cn as useVirtualAnnotationPage,
2106
- un as useVirtualAnnotationPageContext,
2107
- Fe as useVisibleCanvases
3215
+ Ao as AnnotationContext,
3216
+ ko as AnnotationPageContext,
3217
+ jo as CanvasAnnotations,
3218
+ Qe as CanvasContext,
3219
+ ge as CanvasPanel,
3220
+ No as CollectionContext,
3221
+ Mo as CombinedMetadata,
3222
+ Kn as ContextBridge,
3223
+ no as Image,
3224
+ Rr as ImageServiceLoaderContext,
3225
+ Hn as InnerViewerProvider,
3226
+ Io as LanguageProvider,
3227
+ Qr as LanguageString,
3228
+ Ne as LocaleString,
3229
+ Fn as ManifestContext,
3230
+ Ro as ManifestMetadata,
3231
+ en as MediaPlayerProvider,
3232
+ dn as Metadata,
3233
+ Un as RangeContext,
3234
+ Ke as ReactVaultContext,
3235
+ Le as ResourceProvider,
3236
+ lt as ResourceReactContext,
3237
+ Lo as SequenceThumbnails,
3238
+ Yn as SimpleViewerProvider,
3239
+ Xe as SimpleViewerReactContext,
3240
+ so as SingleCanvasThumbnail,
3241
+ ft as VaultProvider,
3242
+ pt as ViewerPresetContext,
3243
+ vr as VirtualAnnotationProvider,
3244
+ Ge as VisibleCanvasReactContext,
3245
+ xr as emptyActions,
3246
+ Tr as emptyStrategy,
3247
+ Rt as findAllCanvasesInRange,
3248
+ $n as findFirstCanvasFromRange,
3249
+ Po as findManifestSelectedRange,
3250
+ Lt as findSelectedRange,
3251
+ Cr as flattenAnnotationPageIds,
3252
+ Kr as formatTime,
3253
+ _r as get3dStrategy,
3254
+ Br as getImageStrategy,
3255
+ At as getManifestSequence,
3256
+ Yt as getParsedTargetSelector,
3257
+ $r as getRenderingStrategy,
3258
+ qr as getTextualContentStrategy,
3259
+ Ur as getVideoStrategy,
3260
+ Oo as getVisibleCanvasesFromCanvasId,
3261
+ So as parseSpecificResource,
3262
+ rt as unknownResponse,
3263
+ ne as unsupportedStrategy,
3264
+ $t as useAnnotation,
3265
+ Sr as useAnnotationPage,
3266
+ zt as useAnnotationPageManager,
3267
+ Vo as useAnnotationsAtTime,
3268
+ Se as useCanvas,
3269
+ _o as useCanvasClock,
3270
+ Wn as useCanvasSequence,
3271
+ Do as useCanvasSubset,
3272
+ Gr as useClosestLanguage,
3273
+ Bo as useCollection,
3274
+ zn as useContextBridge,
3275
+ Co as useCreateLocaleString,
3276
+ yr as useDispatch,
3277
+ qo as useEventListener,
3278
+ dt as useExistingVault,
3279
+ Fo as useExternalCollection,
3280
+ qn as useExternalManifest,
3281
+ jt as useExternalResource,
3282
+ gt as useIIIFLanguage,
3283
+ pn as useImage,
3284
+ uo as useImageService,
3285
+ Je as useImageServiceLoader,
3286
+ Uo as useImageTile,
3287
+ Lr as useLoadImageService,
3288
+ Xr as useLocaleString,
3289
+ Ce as useManifest,
3290
+ To as useMediaActions,
3291
+ Eo as useMediaElements,
3292
+ xo as useMediaState,
3293
+ Nr as usePaintables,
3294
+ ht as usePaintingAnnotations,
3295
+ kt as useRange,
3296
+ Wr as useRenderingStrategy,
3297
+ je as useResourceContext,
3298
+ Ut as useResourceEvents,
3299
+ Mr as useResources,
3300
+ $o as useSearchService,
3301
+ yt as useSimpleMediaPlayer,
3302
+ Nt as useSimpleViewer,
3303
+ Wo as useStyleHelper,
3304
+ ze as useStyles,
3305
+ Gt as useThumbnail,
3306
+ ae as useVault,
3307
+ Hr as useVaultEffect,
3308
+ ye as useVaultSelector,
3309
+ wr as useViewerPreset,
3310
+ gr as useVirtualAnnotationPage,
3311
+ mr as useVirtualAnnotationPageContext,
3312
+ Mt as useVisibleCanvases
2108
3313
  };
2109
3314
  //# sourceMappingURL=index.mjs.map