react-iiif-vault 1.0.7 → 1.0.9

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