react-iiif-vault 1.0.10 → 1.1.0

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