react-iiif-vault 1.0.10 → 1.0.11
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle/cjs/index.js +3 -3
- package/dist/bundle/cjs/index.js.map +1 -1
- package/dist/bundle/esm/index.mjs +360 -355
- package/dist/bundle/esm/index.mjs.map +1 -1
- package/dist/canvas-panel/cjs/canvas-panel.js +2 -2
- package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
- package/dist/canvas-panel/esm/canvas-panel.mjs +233 -228
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
- package/dist/index.umd.js +26 -26
- package/dist/index.umd.js.map +1 -1
- package/dist/react17/cjs/index.js +3 -3
- package/dist/react17/cjs/index.js.map +1 -1
- package/dist/react17/esm/index.mjs +360 -355
- package/dist/react17/esm/index.mjs.map +1 -1
- package/package.json +1 -1
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { jsx as u, jsxs as
|
|
2
|
-
import B, { createContext as F, Component as rt, createElement as Pe, isValidElement as it, useContext as T, useMemo as
|
|
1
|
+
import { jsx as u, jsxs as M, Fragment as $ } from "react/jsx-runtime";
|
|
2
|
+
import B, { createContext as F, Component as rt, createElement as Pe, isValidElement as it, useContext as T, useMemo as w, useState as L, useEffect as N, useRef as _, useCallback as b, useLayoutEffect as Ie, Fragment as te, useReducer as ot, forwardRef as Me, useImperativeHandle as at } from "react";
|
|
3
3
|
import { AtlasAuto as st, ModeContext as ut, mergeStyles as ct, RegionHighlight as lt, TileSet as dt, HTMLPortal as ft } from "@atlas-viewer/atlas";
|
|
4
4
|
import { globalVault as Ae, Vault as be } from "@iiif/helpers/vault";
|
|
5
5
|
import { createStylesHelper as Te } from "@iiif/helpers/styles";
|
|
@@ -100,7 +100,7 @@ const wt = {
|
|
|
100
100
|
annotationPage: void 0
|
|
101
101
|
}, fe = B.createContext(wt), z = () => T(fe);
|
|
102
102
|
function re({ value: e, children: t }) {
|
|
103
|
-
const n = z(), r =
|
|
103
|
+
const n = z(), r = w(() => ({
|
|
104
104
|
...n,
|
|
105
105
|
...e
|
|
106
106
|
}), [e, n]);
|
|
@@ -126,12 +126,12 @@ function ge(e) {
|
|
|
126
126
|
return e || (t && t.vault ? t.vault : Ae());
|
|
127
127
|
}
|
|
128
128
|
function St(e, { noCache: t = !1 } = {}) {
|
|
129
|
-
const n = typeof e == "string" ? e : e.id, r = ge(), [i, o] = L(n), [a, s] = L(void 0), c =
|
|
129
|
+
const n = typeof e == "string" ? e : e.id, r = ge(), [i, o] = L(n), [a, s] = L(void 0), c = w(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
|
|
130
130
|
return N(() => {
|
|
131
131
|
(async () => {
|
|
132
132
|
try {
|
|
133
|
-
const f = c && !t ? c : await r.load(n),
|
|
134
|
-
f && i !==
|
|
133
|
+
const f = c && !t ? c : await r.load(n), m = f ? f.id || f["@id"] : null;
|
|
134
|
+
f && i !== m && o(m), l(f);
|
|
135
135
|
} catch (f) {
|
|
136
136
|
s(f);
|
|
137
137
|
}
|
|
@@ -189,7 +189,7 @@ function K(e = {}, t = []) {
|
|
|
189
189
|
(s) => o ? s.iiif.entities.Manifest[o] : void 0,
|
|
190
190
|
[o]
|
|
191
191
|
);
|
|
192
|
-
return
|
|
192
|
+
return w(() => {
|
|
193
193
|
if (a)
|
|
194
194
|
return r ? r(a) : a;
|
|
195
195
|
}, [a, r, ...t]);
|
|
@@ -210,26 +210,26 @@ function Ve(e, t) {
|
|
|
210
210
|
function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
|
|
211
211
|
const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"), c = t.type === "Manifest" ? t.items : Ve(e, t);
|
|
212
212
|
if (a)
|
|
213
|
-
return [c, [c.map((
|
|
213
|
+
return [c, [c.map((g, x) => x)]];
|
|
214
214
|
if (s || !o || n)
|
|
215
|
-
return [c, c.map((
|
|
215
|
+
return [c, c.map((g, x) => [x])];
|
|
216
216
|
const d = [];
|
|
217
217
|
let l = [];
|
|
218
218
|
const f = () => {
|
|
219
219
|
l.length && (d.push([...l]), l = []);
|
|
220
220
|
};
|
|
221
|
-
let
|
|
222
|
-
for (let
|
|
223
|
-
const
|
|
224
|
-
if (
|
|
225
|
-
|
|
221
|
+
let m = 0, p = !1;
|
|
222
|
+
for (let g = 0; g < c.length; g++) {
|
|
223
|
+
const x = e.get(c[g]);
|
|
224
|
+
if (x.behavior.includes("non-paged")) {
|
|
225
|
+
g === m && m++, r || (f(), d.push([g]), f());
|
|
226
226
|
continue;
|
|
227
227
|
}
|
|
228
|
-
if (
|
|
229
|
-
l.length && (p = !0), f(), d.push([
|
|
228
|
+
if (g === m || x.behavior.includes("facing-pages")) {
|
|
229
|
+
l.length && (p = !0), f(), d.push([g]), f();
|
|
230
230
|
continue;
|
|
231
231
|
}
|
|
232
|
-
if (l.push(
|
|
232
|
+
if (l.push(g), p) {
|
|
233
233
|
f(), p = !1;
|
|
234
234
|
continue;
|
|
235
235
|
}
|
|
@@ -239,48 +239,53 @@ function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
|
|
|
239
239
|
}
|
|
240
240
|
function It(e = {}, t = []) {
|
|
241
241
|
const { id: n, selector: r } = e, i = z(), o = n || i.range, a = R((s) => o ? s.iiif.entities.Range[o] : void 0, [o]);
|
|
242
|
-
return
|
|
242
|
+
return w(() => {
|
|
243
243
|
if (a)
|
|
244
244
|
return r ? r(a) : a;
|
|
245
245
|
}, [a, r, ...t]);
|
|
246
246
|
}
|
|
247
247
|
function Mt({ startCanvas: e, disablePaging: t }) {
|
|
248
|
-
var
|
|
248
|
+
var x;
|
|
249
249
|
const n = O(), r = K(), i = It(), [o, a] = L(void 0), s = i || r;
|
|
250
250
|
if (!s)
|
|
251
251
|
throw new Error("Nothing selected");
|
|
252
|
-
const [c, d] =
|
|
252
|
+
const [c, d] = w(
|
|
253
253
|
() => Et(n, s, { disablePaging: t }),
|
|
254
254
|
[n, s, t]
|
|
255
|
-
), l =
|
|
256
|
-
|
|
257
|
-
|
|
258
|
-
|
|
255
|
+
), l = _(d);
|
|
256
|
+
if (l.current !== d) {
|
|
257
|
+
const y = l.current[o][0], C = d.findIndex((S) => S.includes(y));
|
|
258
|
+
l.current = d, a(C);
|
|
259
|
+
}
|
|
260
|
+
const f = b(
|
|
261
|
+
(v) => {
|
|
262
|
+
const y = d.findIndex((C) => C.includes(v));
|
|
263
|
+
a(y === -1 ? 0 : y);
|
|
259
264
|
},
|
|
260
265
|
[c, d]
|
|
261
|
-
),
|
|
262
|
-
(
|
|
263
|
-
const
|
|
264
|
-
|
|
266
|
+
), m = b(
|
|
267
|
+
(v) => {
|
|
268
|
+
const y = c.findIndex((C) => C.id === v);
|
|
269
|
+
y !== -1 ? f(y) : a(0);
|
|
265
270
|
},
|
|
266
271
|
[c, d]
|
|
267
|
-
),
|
|
268
|
-
a((
|
|
269
|
-
}, [d]),
|
|
270
|
-
a((
|
|
272
|
+
), p = b(() => {
|
|
273
|
+
a((v) => v >= d.length - 1 ? v : v + 1);
|
|
274
|
+
}, [d]), g = b(() => {
|
|
275
|
+
a((v) => v <= 0 ? 0 : v - 1);
|
|
271
276
|
}, [d]);
|
|
272
|
-
return typeof o > "u" && (e ?
|
|
273
|
-
visibleItems: ((
|
|
277
|
+
return typeof o > "u" && (e ? m(e) : a(0)), {
|
|
278
|
+
visibleItems: ((x = d[o]) == null ? void 0 : x.map((v) => c[v].id)) || [],
|
|
274
279
|
cursor: o,
|
|
275
280
|
items: c,
|
|
276
281
|
sequence: d,
|
|
277
282
|
hasPrevious: o > 0,
|
|
278
283
|
hasNext: o < d.length - 1,
|
|
279
284
|
setSequenceIndex: a,
|
|
280
|
-
setCanvasIndex:
|
|
281
|
-
setCanvasId:
|
|
282
|
-
next:
|
|
283
|
-
previous:
|
|
285
|
+
setCanvasIndex: f,
|
|
286
|
+
setCanvasId: m,
|
|
287
|
+
next: p,
|
|
288
|
+
previous: g
|
|
284
289
|
};
|
|
285
290
|
}
|
|
286
291
|
const J = () => {
|
|
@@ -308,11 +313,11 @@ function At(e) {
|
|
|
308
313
|
previous: d,
|
|
309
314
|
setSequenceIndex: l,
|
|
310
315
|
hasNext: f,
|
|
311
|
-
hasPrevious:
|
|
316
|
+
hasPrevious: m
|
|
312
317
|
} = Mt({
|
|
313
318
|
startCanvas: e.startCanvas,
|
|
314
319
|
disablePaging: e.pagingEnabled === !1
|
|
315
|
-
}), p =
|
|
320
|
+
}), p = w(
|
|
316
321
|
() => ({
|
|
317
322
|
sequence: o,
|
|
318
323
|
items: a,
|
|
@@ -325,7 +330,7 @@ function At(e) {
|
|
|
325
330
|
setSequenceIndex: l,
|
|
326
331
|
currentSequenceIndex: n,
|
|
327
332
|
hasNext: f,
|
|
328
|
-
hasPrevious:
|
|
333
|
+
hasPrevious: m
|
|
329
334
|
}),
|
|
330
335
|
[o, a, c, i, d, a, s, l, n]
|
|
331
336
|
);
|
|
@@ -379,13 +384,13 @@ const U = function(e) {
|
|
|
379
384
|
};
|
|
380
385
|
function Xt() {
|
|
381
386
|
const t = O().getStore();
|
|
382
|
-
return
|
|
387
|
+
return w(() => (n) => t.dispatch(n), [t]);
|
|
383
388
|
}
|
|
384
389
|
function Ce(e) {
|
|
385
390
|
return typeof e != "string" && e && e.bindToVault;
|
|
386
391
|
}
|
|
387
392
|
function en() {
|
|
388
|
-
const e = O(), t =
|
|
393
|
+
const e = O(), t = _([]), n = Xt(), r = w(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
|
|
389
394
|
Ie(() => {
|
|
390
395
|
const s = {
|
|
391
396
|
id: r,
|
|
@@ -417,7 +422,7 @@ function en() {
|
|
|
417
422
|
const i = R(
|
|
418
423
|
(s) => r ? s.iiif.entities.AnnotationPage[r] : null,
|
|
419
424
|
[r]
|
|
420
|
-
), o =
|
|
425
|
+
), o = b(
|
|
421
426
|
(s, c) => {
|
|
422
427
|
if (r) {
|
|
423
428
|
if (Ce(s)) {
|
|
@@ -441,7 +446,7 @@ function en() {
|
|
|
441
446
|
}
|
|
442
447
|
},
|
|
443
448
|
[r]
|
|
444
|
-
), a =
|
|
449
|
+
), a = b(
|
|
445
450
|
(s) => {
|
|
446
451
|
r && (Ce(s) ? s = typeof s.source == "string" ? s.source : s.source.id : typeof s != "string" && (s = s.id), t.current[s] && t.current[s].beforeRemove(), e.get({ id: r, type: "AnnotationPage" }) && n(
|
|
447
452
|
ue.removeReference({
|
|
@@ -481,7 +486,7 @@ function nn({ children: e }) {
|
|
|
481
486
|
return /* @__PURE__ */ u(
|
|
482
487
|
Oe.Provider,
|
|
483
488
|
{
|
|
484
|
-
value:
|
|
489
|
+
value: w(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
|
|
485
490
|
children: e
|
|
486
491
|
}
|
|
487
492
|
);
|
|
@@ -493,7 +498,7 @@ function rn({
|
|
|
493
498
|
error: r,
|
|
494
499
|
resetErrorBoundary: i
|
|
495
500
|
}) {
|
|
496
|
-
return /* @__PURE__ */
|
|
501
|
+
return /* @__PURE__ */ M("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
|
|
497
502
|
/* @__PURE__ */ u("h3", { children: "Error occurred" }),
|
|
498
503
|
/* @__PURE__ */ u("p", { children: r.message }),
|
|
499
504
|
/* @__PURE__ */ u("button", { onClick: i, children: "Reset" })
|
|
@@ -518,7 +523,7 @@ function Y(e, t, n, r, i = []) {
|
|
|
518
523
|
}
|
|
519
524
|
function j(e = {}, t = []) {
|
|
520
525
|
const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = R((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
|
|
521
|
-
return
|
|
526
|
+
return w(() => {
|
|
522
527
|
if (a)
|
|
523
528
|
return r ? r(a) : a;
|
|
524
529
|
}, [a, r, ...t]);
|
|
@@ -537,40 +542,40 @@ function sn({
|
|
|
537
542
|
worldScale: r,
|
|
538
543
|
...i
|
|
539
544
|
}) {
|
|
540
|
-
const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [
|
|
541
|
-
|
|
545
|
+
const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [m, p] = L({}), g = Object.entries(m), [x, v] = L({}), y = w(() => r || Math.max(...Object.values(x)), [x]), C = w(() => ({ maxOverZoom: y || 1, ...i.runtimeOptions || {} }), [y, i.runtimeOptions]), S = b((E, A) => {
|
|
546
|
+
v((k) => {
|
|
542
547
|
if (A === -1) {
|
|
543
|
-
const { [
|
|
548
|
+
const { [E]: h, ...D } = k;
|
|
544
549
|
return D;
|
|
545
550
|
}
|
|
546
|
-
return { ...k, [
|
|
551
|
+
return { ...k, [E]: A };
|
|
547
552
|
});
|
|
548
|
-
}, []), W =
|
|
549
|
-
l(({ [
|
|
553
|
+
}, []), W = b((E, A, k) => {
|
|
554
|
+
l(({ [E]: h, ...D }) => A ? {
|
|
550
555
|
...D,
|
|
551
|
-
[
|
|
556
|
+
[E]: { element: A, props: k }
|
|
552
557
|
} : D);
|
|
553
|
-
}, []), Z =
|
|
554
|
-
p(({ [
|
|
558
|
+
}, []), Z = b((E, A, k) => {
|
|
559
|
+
p(({ [E]: h, ...D }) => A ? {
|
|
555
560
|
...D,
|
|
556
|
-
[
|
|
561
|
+
[E]: { element: A, props: k }
|
|
557
562
|
} : D);
|
|
558
563
|
}, []);
|
|
559
|
-
return /* @__PURE__ */
|
|
564
|
+
return /* @__PURE__ */ M(yt, { resetKeys: [], fallbackRender: (E) => /* @__PURE__ */ u(c, { ...i, ...E }), children: [
|
|
560
565
|
/* @__PURE__ */ u(
|
|
561
566
|
st,
|
|
562
567
|
{
|
|
563
568
|
...i,
|
|
564
569
|
containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
|
|
565
|
-
htmlChildren: /* @__PURE__ */ u($, { children: f.map(([
|
|
566
|
-
onCreated: (
|
|
567
|
-
a(
|
|
570
|
+
htmlChildren: /* @__PURE__ */ u($, { children: f.map(([E, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, E)) }),
|
|
571
|
+
onCreated: (E) => {
|
|
572
|
+
a(E), i.onCreated && i.onCreated(E);
|
|
568
573
|
},
|
|
569
|
-
runtimeOptions:
|
|
570
|
-
children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value:
|
|
574
|
+
runtimeOptions: C,
|
|
575
|
+
children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value: S, children: /* @__PURE__ */ u(Le.Provider, { value: W, children: /* @__PURE__ */ u(ke.Provider, { value: Z, children: /* @__PURE__ */ u(Ot, { bridge: s, children: /* @__PURE__ */ u(ut.Provider, { value: i.mode || "explore", children: /* @__PURE__ */ u(nn, { children: e }) }) }) }) }) }) })
|
|
571
576
|
}
|
|
572
577
|
),
|
|
573
|
-
/* @__PURE__ */ u("div", { children:
|
|
578
|
+
/* @__PURE__ */ u("div", { children: g.map(([E, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, E)) })
|
|
574
579
|
] });
|
|
575
580
|
}
|
|
576
581
|
const X = {}, Fe = {
|
|
@@ -631,11 +636,11 @@ function un(e = Fe) {
|
|
|
631
636
|
};
|
|
632
637
|
}
|
|
633
638
|
function Ue(e, t) {
|
|
634
|
-
const n = O(), r =
|
|
635
|
-
return
|
|
639
|
+
const n = O(), r = w(() => un(n), [n]), i = R(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
|
|
640
|
+
return w(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
|
|
636
641
|
}
|
|
637
642
|
function ne(e, t) {
|
|
638
|
-
const n = O(), r =
|
|
643
|
+
const n = O(), r = w(() => Te(n), [n]);
|
|
639
644
|
return R(() => {
|
|
640
645
|
if (!e)
|
|
641
646
|
return null;
|
|
@@ -654,7 +659,7 @@ function De(e = {}, t = []) {
|
|
|
654
659
|
} : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
|
|
655
660
|
[s]
|
|
656
661
|
);
|
|
657
|
-
return
|
|
662
|
+
return w(() => {
|
|
658
663
|
if (!s)
|
|
659
664
|
return;
|
|
660
665
|
const d = {
|
|
@@ -671,7 +676,7 @@ const _e = ({
|
|
|
671
676
|
className: n,
|
|
672
677
|
interactive: r
|
|
673
678
|
}) => {
|
|
674
|
-
const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d =
|
|
679
|
+
const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d = w(() => ct(t, o), [t, o]);
|
|
675
680
|
return c && i && i.target && i.target.selector && i.target.selector.type === "BoxSelector" && i.target.source && (i.target.source.id === c.id || i.target.source === c.id) ? /* @__PURE__ */ u(
|
|
676
681
|
lt,
|
|
677
682
|
{
|
|
@@ -695,7 +700,7 @@ function cn(e = {}, t = []) {
|
|
|
695
700
|
(s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
|
|
696
701
|
[o]
|
|
697
702
|
);
|
|
698
|
-
return
|
|
703
|
+
return w(() => {
|
|
699
704
|
if (a)
|
|
700
705
|
return r ? r(a) : a;
|
|
701
706
|
}, [a, ...t]);
|
|
@@ -728,8 +733,8 @@ function qe({
|
|
|
728
733
|
onClick: c,
|
|
729
734
|
enableSizes: d
|
|
730
735
|
}) {
|
|
731
|
-
var f,
|
|
732
|
-
const l =
|
|
736
|
+
var f, m;
|
|
737
|
+
const l = w(() => {
|
|
733
738
|
if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
|
|
734
739
|
return s.spatial;
|
|
735
740
|
}, [s]);
|
|
@@ -741,7 +746,7 @@ function qe({
|
|
|
741
746
|
width: t.target.spatial.width,
|
|
742
747
|
height: t.target.spatial.height,
|
|
743
748
|
onClick: c,
|
|
744
|
-
children: t.service ? /* @__PURE__ */
|
|
749
|
+
children: t.service ? /* @__PURE__ */ M(te, { children: [
|
|
745
750
|
/* @__PURE__ */ u(
|
|
746
751
|
dt,
|
|
747
752
|
{
|
|
@@ -756,12 +761,12 @@ function qe({
|
|
|
756
761
|
x: 0,
|
|
757
762
|
y: 0,
|
|
758
763
|
width: (f = t.target) == null ? void 0 : f.spatial.width,
|
|
759
|
-
height: (
|
|
764
|
+
height: (m = t.target) == null ? void 0 : m.spatial.height,
|
|
760
765
|
crop: l
|
|
761
766
|
}
|
|
762
767
|
),
|
|
763
768
|
a
|
|
764
|
-
] }, "service") : /* @__PURE__ */
|
|
769
|
+
] }, "service") : /* @__PURE__ */ M(te, { children: [
|
|
765
770
|
/* @__PURE__ */ u(
|
|
766
771
|
"world-image",
|
|
767
772
|
{
|
|
@@ -806,7 +811,7 @@ function Be(e, t) {
|
|
|
806
811
|
const ln = {
|
|
807
812
|
makeChoice: () => {
|
|
808
813
|
}
|
|
809
|
-
}, ce = { type: "unknown" },
|
|
814
|
+
}, ce = { type: "unknown" }, I = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), dn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
|
|
810
815
|
function fn(e, t) {
|
|
811
816
|
var r;
|
|
812
817
|
const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
|
|
@@ -855,12 +860,12 @@ function mn(e, t) {
|
|
|
855
860
|
return n ? n.annotationPageManager : null;
|
|
856
861
|
}
|
|
857
862
|
function vn(e, t = {}) {
|
|
858
|
-
const n = O(), r = K(), i = j(), o = Re(), a =
|
|
863
|
+
const n = O(), r = K(), i = j(), o = Re(), a = w(() => gn({
|
|
859
864
|
all: t.all,
|
|
860
865
|
manifest: r,
|
|
861
866
|
canvas: i,
|
|
862
867
|
canvases: o
|
|
863
|
-
}), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c =
|
|
868
|
+
}), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = b(
|
|
864
869
|
(l) => {
|
|
865
870
|
e && n.setMetaValue(
|
|
866
871
|
[l, "annotationPageManager", "views"],
|
|
@@ -871,24 +876,24 @@ function vn(e, t = {}) {
|
|
|
871
876
|
);
|
|
872
877
|
},
|
|
873
878
|
[e, n]
|
|
874
|
-
), d =
|
|
879
|
+
), d = b(
|
|
875
880
|
(l, f = {}) => {
|
|
876
881
|
if (!e)
|
|
877
882
|
return;
|
|
878
|
-
const
|
|
883
|
+
const m = n.getState(), p = [];
|
|
879
884
|
if (f != null && f.deselectOthers) {
|
|
880
|
-
const
|
|
881
|
-
for (const
|
|
882
|
-
const
|
|
883
|
-
|
|
885
|
+
const g = Object.keys(m.iiif.entities.AnnotationPage);
|
|
886
|
+
for (const x of g) {
|
|
887
|
+
const v = mn(m, x);
|
|
888
|
+
v && v.views && v.views[e] && p.push(x);
|
|
884
889
|
}
|
|
885
890
|
}
|
|
886
|
-
for (const
|
|
887
|
-
c(
|
|
891
|
+
for (const g of p)
|
|
892
|
+
c(g);
|
|
888
893
|
n.setMetaValue(
|
|
889
894
|
[l, "annotationPageManager", "views"],
|
|
890
|
-
(
|
|
891
|
-
...
|
|
895
|
+
(g) => g && g[e] ? g : {
|
|
896
|
+
...g || {},
|
|
892
897
|
[e]: !0
|
|
893
898
|
}
|
|
894
899
|
);
|
|
@@ -910,10 +915,10 @@ function je() {
|
|
|
910
915
|
return T(yn);
|
|
911
916
|
}
|
|
912
917
|
function xn() {
|
|
913
|
-
const e = je(), [t, n] = L({}), r =
|
|
918
|
+
const e = je(), [t, n] = L({}), r = _(!1);
|
|
914
919
|
return N(() => () => {
|
|
915
920
|
r.current = !0;
|
|
916
|
-
}, []), [
|
|
921
|
+
}, []), [b(
|
|
917
922
|
(o, { height: a, width: s }) => {
|
|
918
923
|
if (o) {
|
|
919
924
|
const c = o.id || o["@id"], d = e.loadServiceSync({
|
|
@@ -998,27 +1003,27 @@ function Pn(e = He) {
|
|
|
998
1003
|
if (l.type !== "Annotation")
|
|
999
1004
|
throw new Error("getPaintables() accept either a canvas or list of annotations");
|
|
1000
1005
|
const f = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
|
|
1001
|
-
for (const
|
|
1002
|
-
const [p, { selector:
|
|
1003
|
-
if (
|
|
1004
|
-
const
|
|
1005
|
-
|
|
1006
|
+
for (const m of f) {
|
|
1007
|
+
const [p, { selector: g }] = Sn(m), x = e.get(p), v = (x.type || "unknown").toLowerCase();
|
|
1008
|
+
if (v === "choice") {
|
|
1009
|
+
const y = e.get(x.items, { parent: x.id }), C = o.length ? o.map((S) => y.find((W) => W.id === S)).filter(Boolean) : [y[0]];
|
|
1010
|
+
C.length === 0 && C.push(y[0]), c = {
|
|
1006
1011
|
type: "single-choice",
|
|
1007
|
-
items:
|
|
1008
|
-
id:
|
|
1009
|
-
label:
|
|
1010
|
-
selected:
|
|
1012
|
+
items: y.map((S) => ({
|
|
1013
|
+
id: S.id,
|
|
1014
|
+
label: S.label,
|
|
1015
|
+
selected: C.indexOf(S) !== -1
|
|
1011
1016
|
})),
|
|
1012
1017
|
label: p.label
|
|
1013
|
-
}, f.push(...
|
|
1018
|
+
}, f.push(...C);
|
|
1014
1019
|
continue;
|
|
1015
1020
|
}
|
|
1016
|
-
s.indexOf(
|
|
1017
|
-
type:
|
|
1021
|
+
s.indexOf(v) === -1 && s.push(v), d.push({
|
|
1022
|
+
type: v,
|
|
1018
1023
|
annotationId: l.id,
|
|
1019
|
-
resource:
|
|
1024
|
+
resource: x,
|
|
1020
1025
|
target: l.target,
|
|
1021
|
-
selector:
|
|
1026
|
+
selector: g
|
|
1022
1027
|
});
|
|
1023
1028
|
}
|
|
1024
1029
|
}
|
|
@@ -1039,29 +1044,29 @@ function Pn(e = He) {
|
|
|
1039
1044
|
};
|
|
1040
1045
|
}
|
|
1041
1046
|
function bn(e, t = []) {
|
|
1042
|
-
const n = O(), r =
|
|
1047
|
+
const n = O(), r = w(() => Pn(n), []), i = wn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = w(
|
|
1043
1048
|
() => r.getPaintables(i, o),
|
|
1044
1049
|
[n, i, o, ...t]
|
|
1045
|
-
), d = { makeChoice:
|
|
1046
|
-
(l, { deselectOthers: f = !0, deselect:
|
|
1050
|
+
), d = { makeChoice: b(
|
|
1051
|
+
(l, { deselectOthers: f = !0, deselect: m = !1 } = {}) => {
|
|
1047
1052
|
if (s.choice) {
|
|
1048
1053
|
if (s.choice.type !== "single-choice")
|
|
1049
1054
|
throw new Error("Complex choice not supported yet");
|
|
1050
1055
|
a((p) => {
|
|
1051
|
-
if (
|
|
1052
|
-
const
|
|
1053
|
-
if (
|
|
1054
|
-
const
|
|
1055
|
-
return
|
|
1056
|
+
if (m) {
|
|
1057
|
+
const x = p.filter((v) => v !== l);
|
|
1058
|
+
if (x.length === 0) {
|
|
1059
|
+
const v = s.items[0].resource.id;
|
|
1060
|
+
return v ? [v] : [];
|
|
1056
1061
|
}
|
|
1057
|
-
return
|
|
1062
|
+
return x;
|
|
1058
1063
|
}
|
|
1059
1064
|
if (f)
|
|
1060
1065
|
return [l];
|
|
1061
|
-
const
|
|
1062
|
-
if (
|
|
1063
|
-
const
|
|
1064
|
-
|
|
1066
|
+
const g = [...p];
|
|
1067
|
+
if (g.length === 0 && s.items.length) {
|
|
1068
|
+
const x = s.items[0].resource.id;
|
|
1069
|
+
x && g.push(x);
|
|
1065
1070
|
}
|
|
1066
1071
|
return p.indexOf(l) !== -1 ? p : [...p, l];
|
|
1067
1072
|
});
|
|
@@ -1074,17 +1079,17 @@ function bn(e, t = []) {
|
|
|
1074
1079
|
const Cn = ["model/gltf-binary"];
|
|
1075
1080
|
function En(e, t) {
|
|
1076
1081
|
const r = t.items[0].resource;
|
|
1077
|
-
return r.format ? Cn.indexOf(r.format) === -1 ?
|
|
1082
|
+
return r.format ? Cn.indexOf(r.format) === -1 ? I(`3D format: ${r.format} is unsupported`) : {
|
|
1078
1083
|
type: "3d-model",
|
|
1079
1084
|
model: r
|
|
1080
|
-
} :
|
|
1085
|
+
} : I("Unknown format");
|
|
1081
1086
|
}
|
|
1082
1087
|
function In(e, t) {
|
|
1083
1088
|
var r;
|
|
1084
1089
|
if (!e.duration)
|
|
1085
|
-
return
|
|
1090
|
+
return I("No duration on canvas");
|
|
1086
1091
|
if (t.items.length > 1)
|
|
1087
|
-
return
|
|
1092
|
+
return I("Only one audio source supported");
|
|
1088
1093
|
const n = (r = t.items[0]) == null ? void 0 : r.resource;
|
|
1089
1094
|
return n ? n.format ? {
|
|
1090
1095
|
type: "media",
|
|
@@ -1112,14 +1117,14 @@ function In(e, t) {
|
|
|
1112
1117
|
annotations: {
|
|
1113
1118
|
pages: []
|
|
1114
1119
|
}
|
|
1115
|
-
} :
|
|
1120
|
+
} : I("Audio does not have format") : I("Unknown audio");
|
|
1116
1121
|
}
|
|
1117
1122
|
function Mn(e, t, n) {
|
|
1118
1123
|
const r = [];
|
|
1119
1124
|
for (const i of t.items) {
|
|
1120
1125
|
const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
|
|
1121
1126
|
if (!o.id)
|
|
1122
|
-
return
|
|
1127
|
+
return I("No resource Identifier");
|
|
1123
1128
|
let a;
|
|
1124
1129
|
if (o.service) {
|
|
1125
1130
|
const p = mt(o);
|
|
@@ -1156,7 +1161,7 @@ function Mn(e, t, n) {
|
|
|
1156
1161
|
}
|
|
1157
1162
|
} : void 0;
|
|
1158
1163
|
a && !a.id && (a.id = a["@id"]);
|
|
1159
|
-
const
|
|
1164
|
+
const m = {
|
|
1160
1165
|
id: o.id,
|
|
1161
1166
|
type: "Image",
|
|
1162
1167
|
annotationId: i.annotationId,
|
|
@@ -1167,7 +1172,7 @@ function Mn(e, t, n) {
|
|
|
1167
1172
|
target: c && c.type !== "PointSelector" ? c : s,
|
|
1168
1173
|
selector: f
|
|
1169
1174
|
};
|
|
1170
|
-
r.push(
|
|
1175
|
+
r.push(m);
|
|
1171
1176
|
}
|
|
1172
1177
|
return {
|
|
1173
1178
|
type: "images",
|
|
@@ -1208,16 +1213,16 @@ function Rn(e, t) {
|
|
|
1208
1213
|
const n = t.items.filter((c) => c.type === "video");
|
|
1209
1214
|
let r = !1;
|
|
1210
1215
|
if (e.duration || (r = !0), n.length > 1)
|
|
1211
|
-
return
|
|
1216
|
+
return I("Only one video source supported");
|
|
1212
1217
|
const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
|
|
1213
1218
|
(c) => (c.profile || "").includes("youtube.com")
|
|
1214
1219
|
);
|
|
1215
1220
|
if (!o && r)
|
|
1216
|
-
return
|
|
1221
|
+
return I("Video does not have duration");
|
|
1217
1222
|
if (!i)
|
|
1218
|
-
return
|
|
1223
|
+
return I("Unknown video");
|
|
1219
1224
|
if ((!i.format || i.format === "text/html") && !o)
|
|
1220
|
-
return
|
|
1225
|
+
return I("Video does not have format");
|
|
1221
1226
|
const a = {
|
|
1222
1227
|
annotationId: t.items[0].annotationId,
|
|
1223
1228
|
duration: e.duration,
|
|
@@ -1244,7 +1249,7 @@ function Rn(e, t) {
|
|
|
1244
1249
|
a.type = "VideoYouTube";
|
|
1245
1250
|
const c = i.id.match(Tn);
|
|
1246
1251
|
if (!c[1])
|
|
1247
|
-
return
|
|
1252
|
+
return I("Video is not known youtube video");
|
|
1248
1253
|
a.youTubeId = c[1];
|
|
1249
1254
|
}
|
|
1250
1255
|
return {
|
|
@@ -1264,9 +1269,9 @@ function Vn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
|
|
|
1264
1269
|
if (t.types.length === 2 && t.types.indexOf("text") !== -1)
|
|
1265
1270
|
t.types = t.types.filter((o) => o !== "text");
|
|
1266
1271
|
else
|
|
1267
|
-
return n.indexOf("complex-timeline") === -1 ?
|
|
1272
|
+
return n.indexOf("complex-timeline") === -1 ? I("Complex timeline not supported") : I("ComplexTimelineStrategy not yet supported");
|
|
1268
1273
|
const i = t.types[0];
|
|
1269
|
-
return i === "image" ? n.indexOf("images") === -1 ?
|
|
1274
|
+
return i === "image" ? n.indexOf("images") === -1 ? I("Image not supported") : Mn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? I("3D not supported") : En(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? I("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? I("Media not supported") : In(e, t) : i === "video" ? n.indexOf("media") === -1 ? I("Media not supported") : Rn(e, t) : ce;
|
|
1270
1275
|
}
|
|
1271
1276
|
function On(e) {
|
|
1272
1277
|
const t = K(), n = j(), r = O(), [i, o] = xn(), { enabledPageIds: a } = vn((e == null ? void 0 : e.annotationPageManagerId) || (t == null ? void 0 : t.id) || (n == null ? void 0 : n.id), {
|
|
@@ -1277,8 +1282,8 @@ function On(e) {
|
|
|
1277
1282
|
"media",
|
|
1278
1283
|
"textual-content",
|
|
1279
1284
|
"complex-timeline"
|
|
1280
|
-
], [d, l] = bn(e, [o]), f =
|
|
1281
|
-
return
|
|
1285
|
+
], [d, l] = bn(e, [o]), f = w(() => Vn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, l.makeChoice]);
|
|
1286
|
+
return w(() => f.type === "unknown" ? [f, ln] : [
|
|
1282
1287
|
{
|
|
1283
1288
|
...f,
|
|
1284
1289
|
annotations: { pages: s }
|
|
@@ -1293,15 +1298,15 @@ const Ln = (e, t = []) => {
|
|
|
1293
1298
|
}, [n, ...t]);
|
|
1294
1299
|
};
|
|
1295
1300
|
function kn(e, t, { canvasId: n, manifestId: r } = {}) {
|
|
1296
|
-
const i = O(), o = je(), a =
|
|
1297
|
-
if (N(() => (
|
|
1298
|
-
|
|
1301
|
+
const i = O(), o = je(), a = w(() => vt(i, { imageServiceLoader: o }), [i, o]), [s, c] = L(), d = K(r ? { id: r } : void 0), l = j(n ? { id: n } : void 0), f = l || d, m = _(!1);
|
|
1302
|
+
if (N(() => (m.current = !1, () => {
|
|
1303
|
+
m.current = !0;
|
|
1299
1304
|
}), []), !f)
|
|
1300
1305
|
throw new Error("Must be called under a manifest or canvas context.");
|
|
1301
1306
|
return Ln(
|
|
1302
1307
|
(p) => {
|
|
1303
|
-
a.getBestThumbnailAtSize(f, e, t).then((
|
|
1304
|
-
|
|
1308
|
+
a.getBestThumbnailAtSize(f, e, t).then((g) => {
|
|
1309
|
+
g.best && !m.current && c(g.best);
|
|
1305
1310
|
});
|
|
1306
1311
|
},
|
|
1307
1312
|
[f]
|
|
@@ -1338,39 +1343,39 @@ function Un(e) {
|
|
|
1338
1343
|
return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
|
|
1339
1344
|
}
|
|
1340
1345
|
function pe(e) {
|
|
1341
|
-
const [t, n] = ot(Fn, Nn(e.duration)), r =
|
|
1346
|
+
const [t, n] = ot(Fn, Nn(e.duration)), r = _(null), i = _(null), o = _(null), a = _(!1), s = b(() => {
|
|
1342
1347
|
i.current && r.current && (i.current.innerHTML = Un(r.current.currentTime), o.current && (o.current.style.width = `${r.current.currentTime / e.duration * 100}%`), a.current !== r.current.muted && (a.current = r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" })));
|
|
1343
|
-
}, [e.duration]), c =
|
|
1348
|
+
}, [e.duration]), c = b(() => {
|
|
1344
1349
|
r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
|
|
1345
1350
|
n({ type: "PLAY" });
|
|
1346
1351
|
}), s());
|
|
1347
|
-
}, [s]), d =
|
|
1352
|
+
}, [s]), d = b(() => {
|
|
1348
1353
|
r.current && (r.current.duration > 0 && r.current.paused ? c() : l());
|
|
1349
|
-
}, [s]), l =
|
|
1354
|
+
}, [s]), l = b(() => {
|
|
1350
1355
|
r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
|
|
1351
|
-
}, [s]), f =
|
|
1356
|
+
}, [s]), f = b(() => {
|
|
1352
1357
|
r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
|
|
1353
|
-
}, []),
|
|
1358
|
+
}, []), m = b(() => {
|
|
1354
1359
|
r.current && (r.current.muted = !0, n({ type: "MUTE" }));
|
|
1355
|
-
}, []), p =
|
|
1360
|
+
}, []), p = b(() => {
|
|
1356
1361
|
r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
|
|
1357
|
-
}, []),
|
|
1358
|
-
r.current && (r.current.muted = !1, r.current.volume =
|
|
1359
|
-
}, []),
|
|
1360
|
-
r.current && (r.current.currentTime = Math.max(0, Math.min(
|
|
1361
|
-
}, []),
|
|
1362
|
-
r.current && (r.current.currentTime = Math.max(0, Math.min(
|
|
1362
|
+
}, []), g = b((y) => {
|
|
1363
|
+
r.current && (r.current.muted = !1, r.current.volume = y / 100, n({ type: "SET_VOLUME", volume: y }));
|
|
1364
|
+
}, []), x = b((y) => {
|
|
1365
|
+
r.current && (r.current.currentTime = Math.max(0, Math.min(y * e.duration, e.duration)), s());
|
|
1366
|
+
}, []), v = b((y) => {
|
|
1367
|
+
r.current && (r.current.currentTime = Math.max(0, Math.min(y, e.duration)), s());
|
|
1363
1368
|
}, []);
|
|
1364
1369
|
return N(() => {
|
|
1365
|
-
const
|
|
1370
|
+
const y = setInterval(() => {
|
|
1366
1371
|
s();
|
|
1367
1372
|
}, 350);
|
|
1368
|
-
return () => clearInterval(
|
|
1373
|
+
return () => clearInterval(y);
|
|
1369
1374
|
}, [s, e.duration]), N(() => {
|
|
1370
|
-
const
|
|
1375
|
+
const y = () => {
|
|
1371
1376
|
n({ type: "FINISHED" });
|
|
1372
|
-
},
|
|
1373
|
-
return
|
|
1377
|
+
}, C = r.current;
|
|
1378
|
+
return C == null || C.addEventListener("ended", y), () => C == null ? void 0 : C.removeEventListener("ended", y);
|
|
1374
1379
|
}, []), [
|
|
1375
1380
|
{ element: r, currentTime: i, progress: o },
|
|
1376
1381
|
t,
|
|
@@ -1378,12 +1383,12 @@ function pe(e) {
|
|
|
1378
1383
|
play: c,
|
|
1379
1384
|
pause: l,
|
|
1380
1385
|
playPause: d,
|
|
1381
|
-
mute:
|
|
1386
|
+
mute: m,
|
|
1382
1387
|
unmute: p,
|
|
1383
1388
|
toggleMute: f,
|
|
1384
|
-
setVolume:
|
|
1385
|
-
setDurationPercent:
|
|
1386
|
-
setTime:
|
|
1389
|
+
setVolume: g,
|
|
1390
|
+
setDurationPercent: x,
|
|
1391
|
+
setTime: v
|
|
1387
1392
|
}
|
|
1388
1393
|
];
|
|
1389
1394
|
}
|
|
@@ -1400,7 +1405,7 @@ function Ye({
|
|
|
1400
1405
|
}
|
|
1401
1406
|
function ze({ media: e, children: t }) {
|
|
1402
1407
|
const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
|
|
1403
|
-
return /* @__PURE__ */
|
|
1408
|
+
return /* @__PURE__ */ M(
|
|
1404
1409
|
Ye,
|
|
1405
1410
|
{
|
|
1406
1411
|
state: o,
|
|
@@ -1427,7 +1432,7 @@ function We({
|
|
|
1427
1432
|
media: t,
|
|
1428
1433
|
playPause: n
|
|
1429
1434
|
}) {
|
|
1430
|
-
return /* @__PURE__ */
|
|
1435
|
+
return /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
|
|
1431
1436
|
/* @__PURE__ */ u("style", { children: `
|
|
1432
1437
|
.video-container {
|
|
1433
1438
|
position: absolute;
|
|
@@ -1471,7 +1476,7 @@ function Ge({
|
|
|
1471
1476
|
), null;
|
|
1472
1477
|
}
|
|
1473
1478
|
function Qe({ model: e }) {
|
|
1474
|
-
return /* @__PURE__ */
|
|
1479
|
+
return /* @__PURE__ */ M($, { children: [
|
|
1475
1480
|
/* @__PURE__ */ u("style", { children: `
|
|
1476
1481
|
.model-container {
|
|
1477
1482
|
position: absolute;
|
|
@@ -1521,7 +1526,7 @@ function Ee(e) {
|
|
|
1521
1526
|
}
|
|
1522
1527
|
function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
|
|
1523
1528
|
const o = Xe();
|
|
1524
|
-
return
|
|
1529
|
+
return w(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */ u(e, { ...i, children: n }) : /* @__PURE__ */ u("span", { ...i, children: n }) : e ? /* @__PURE__ */ u(e, { ...i, lang: t, dir: r, children: n }) : /* @__PURE__ */ u("span", { ...i, lang: t, dir: r, children: n });
|
|
1525
1530
|
}
|
|
1526
1531
|
function Hn(e, t, n) {
|
|
1527
1532
|
if (t.length === 0)
|
|
@@ -1540,7 +1545,7 @@ function Hn(e, t, n) {
|
|
|
1540
1545
|
}
|
|
1541
1546
|
const $n = (e, t = []) => {
|
|
1542
1547
|
const n = Xe();
|
|
1543
|
-
return
|
|
1548
|
+
return w(() => {
|
|
1544
1549
|
const r = e();
|
|
1545
1550
|
return Hn(n, r, []);
|
|
1546
1551
|
}, [n, ...t]);
|
|
@@ -1549,7 +1554,7 @@ function Yn(e, t, n = `
|
|
|
1549
1554
|
`) {
|
|
1550
1555
|
const r = $n(() => Object.keys(e || {}), [e]);
|
|
1551
1556
|
return [
|
|
1552
|
-
|
|
1557
|
+
w(() => {
|
|
1553
1558
|
if (!e)
|
|
1554
1559
|
return t || "";
|
|
1555
1560
|
if (typeof e == "string")
|
|
@@ -1598,8 +1603,8 @@ function Kn({
|
|
|
1598
1603
|
media: t,
|
|
1599
1604
|
playPause: n
|
|
1600
1605
|
}) {
|
|
1601
|
-
const r =
|
|
1602
|
-
return t.youTubeId ? /* @__PURE__ */
|
|
1606
|
+
const r = _(null);
|
|
1607
|
+
return t.youTubeId ? /* @__PURE__ */ M("div", { className: "video-container", part: "video-container", onClick: n, children: [
|
|
1603
1608
|
/* @__PURE__ */ u("style", { children: `
|
|
1604
1609
|
.video-container {
|
|
1605
1610
|
position: absolute;
|
|
@@ -1656,55 +1661,55 @@ function et({
|
|
|
1656
1661
|
mediaControlsDeps: d,
|
|
1657
1662
|
strategies: l,
|
|
1658
1663
|
throwOnUnknown: f,
|
|
1659
|
-
backgroundStyle:
|
|
1664
|
+
backgroundStyle: m,
|
|
1660
1665
|
alwaysShowBackground: p,
|
|
1661
|
-
keepCanvasScale:
|
|
1662
|
-
enableSizes:
|
|
1663
|
-
enableYouTube:
|
|
1664
|
-
onClickPaintingAnnotation:
|
|
1665
|
-
children:
|
|
1666
|
+
keepCanvasScale: g = !1,
|
|
1667
|
+
enableSizes: x = !1,
|
|
1668
|
+
enableYouTube: v = !0,
|
|
1669
|
+
onClickPaintingAnnotation: y,
|
|
1670
|
+
children: C
|
|
1666
1671
|
}) {
|
|
1667
|
-
const
|
|
1672
|
+
const S = j(), W = Ue(S, ["deep-zoom"]), [Z] = tn(), E = on(), A = O(), k = w(() => Te(A), [A]), [h, D] = On({
|
|
1668
1673
|
strategies: l || ["images"],
|
|
1669
|
-
defaultChoices: i == null ? void 0 : i.map(({ id:
|
|
1670
|
-
}), ye = h.type === "images" ? h.choice : void 0, tt =
|
|
1674
|
+
defaultChoices: i == null ? void 0 : i.map(({ id: P }) => P)
|
|
1675
|
+
}), ye = h.type === "images" ? h.choice : void 0, tt = w(() => g ? 1 : Math.max(
|
|
1671
1676
|
1,
|
|
1672
|
-
...h.type === "images" ? h.images.map((
|
|
1677
|
+
...h.type === "images" ? h.images.map((P) => {
|
|
1673
1678
|
var H;
|
|
1674
|
-
return (
|
|
1679
|
+
return (P.width || 0) / ((H = P.target) == null ? void 0 : H.spatial.width);
|
|
1675
1680
|
}) : []
|
|
1676
|
-
), [
|
|
1681
|
+
), [g, h]);
|
|
1677
1682
|
an(tt), N(() => {
|
|
1678
1683
|
r && r(D);
|
|
1679
1684
|
}, [h.annotations]), N(() => {
|
|
1680
1685
|
if (i)
|
|
1681
|
-
for (const
|
|
1682
|
-
typeof
|
|
1683
|
-
opacity:
|
|
1686
|
+
for (const P of i)
|
|
1687
|
+
typeof P.opacity < "u" && k.applyStyles({ id: P.id }, "atlas", {
|
|
1688
|
+
opacity: P.opacity
|
|
1684
1689
|
});
|
|
1685
1690
|
}, [i]), Ie(() => {
|
|
1686
1691
|
n && n(ye);
|
|
1687
1692
|
}, [ye]), Y(
|
|
1688
|
-
|
|
1689
|
-
`canvas-portal-controls-${
|
|
1693
|
+
E && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
|
|
1694
|
+
`canvas-portal-controls-${S == null ? void 0 : S.id}`,
|
|
1690
1695
|
ve.Provider,
|
|
1691
1696
|
a ? {
|
|
1692
|
-
value:
|
|
1697
|
+
value: E || null,
|
|
1693
1698
|
children: a(h)
|
|
1694
1699
|
} : {},
|
|
1695
|
-
[
|
|
1700
|
+
[S, E, h, ...c || []]
|
|
1696
1701
|
);
|
|
1697
|
-
const
|
|
1698
|
-
if (!
|
|
1702
|
+
const q = kn({ maxWidth: 256, maxHeight: 256 });
|
|
1703
|
+
if (!S)
|
|
1699
1704
|
return null;
|
|
1700
|
-
const xe =
|
|
1705
|
+
const xe = S.accompanyingCanvas, G = q && q.type === "fixed" ? /* @__PURE__ */ u("world-object", { height: S.height, width: S.width, x: e, y: t, children: /* @__PURE__ */ u(
|
|
1701
1706
|
"world-image",
|
|
1702
1707
|
{
|
|
1703
|
-
uri:
|
|
1704
|
-
target: { x: 0, y: 0, width:
|
|
1705
|
-
display:
|
|
1706
|
-
width:
|
|
1707
|
-
height:
|
|
1708
|
+
uri: q.id,
|
|
1709
|
+
target: { x: 0, y: 0, width: S.width, height: S.height },
|
|
1710
|
+
display: q.width && q.height ? {
|
|
1711
|
+
width: q.width,
|
|
1712
|
+
height: q.height
|
|
1708
1713
|
} : void 0,
|
|
1709
1714
|
crop: void 0
|
|
1710
1715
|
}
|
|
@@ -1716,71 +1721,71 @@ function et({
|
|
|
1716
1721
|
throw new Error(h.reason || "Unknown image strategy");
|
|
1717
1722
|
return null;
|
|
1718
1723
|
}
|
|
1719
|
-
const we = /* @__PURE__ */
|
|
1724
|
+
const we = /* @__PURE__ */ M(te, { children: [
|
|
1720
1725
|
Z ? /* @__PURE__ */ u(de, { page: Z }) : null,
|
|
1721
|
-
h.annotations && h.annotations.pages ? h.annotations.pages.map((
|
|
1722
|
-
|
|
1726
|
+
h.annotations && h.annotations.pages ? h.annotations.pages.map((P) => /* @__PURE__ */ u(de, { page: P }, P.id)) : null,
|
|
1727
|
+
C
|
|
1723
1728
|
] }), nt = h.type === "images" ? h.images.length : 0;
|
|
1724
|
-
return /* @__PURE__ */
|
|
1725
|
-
/* @__PURE__ */
|
|
1729
|
+
return /* @__PURE__ */ M($, { children: [
|
|
1730
|
+
/* @__PURE__ */ M(
|
|
1726
1731
|
"world-object",
|
|
1727
1732
|
{
|
|
1728
|
-
height:
|
|
1729
|
-
width:
|
|
1733
|
+
height: S.height,
|
|
1734
|
+
width: S.width,
|
|
1730
1735
|
x: e,
|
|
1731
1736
|
y: t,
|
|
1732
1737
|
...W,
|
|
1733
1738
|
children: [
|
|
1734
|
-
h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style:
|
|
1735
|
-
h.type === "textual-content" ? h.items.map((
|
|
1739
|
+
h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style: m }) : null,
|
|
1740
|
+
h.type === "textual-content" ? h.items.map((P, H) => {
|
|
1736
1741
|
var Q;
|
|
1737
|
-
return /* @__PURE__ */
|
|
1742
|
+
return /* @__PURE__ */ M($, { children: [
|
|
1738
1743
|
/* @__PURE__ */ u(
|
|
1739
1744
|
ft,
|
|
1740
1745
|
{
|
|
1741
|
-
onClick:
|
|
1742
|
-
Se.stopPropagation(),
|
|
1746
|
+
onClick: y ? (Se) => {
|
|
1747
|
+
Se.stopPropagation(), y(P.annotationId, P, Se);
|
|
1743
1748
|
} : void 0,
|
|
1744
|
-
target: ((Q =
|
|
1745
|
-
children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children:
|
|
1749
|
+
target: ((Q = P.target) == null ? void 0 : Q.spatial) || void 0,
|
|
1750
|
+
children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children: P.text }) })
|
|
1746
1751
|
},
|
|
1747
1752
|
H
|
|
1748
1753
|
),
|
|
1749
1754
|
we
|
|
1750
1755
|
] });
|
|
1751
1756
|
}) : null,
|
|
1752
|
-
h.type === "images" ? /* @__PURE__ */
|
|
1753
|
-
h.images.map((
|
|
1757
|
+
h.type === "images" ? /* @__PURE__ */ M($, { children: [
|
|
1758
|
+
h.images.map((P, H) => /* @__PURE__ */ u(
|
|
1754
1759
|
qe,
|
|
1755
1760
|
{
|
|
1756
1761
|
isStatic: o,
|
|
1757
|
-
image:
|
|
1758
|
-
id:
|
|
1759
|
-
thumbnail: H === 0 ?
|
|
1760
|
-
selector:
|
|
1761
|
-
enableSizes:
|
|
1762
|
-
onClick:
|
|
1763
|
-
Q.stopPropagation(),
|
|
1762
|
+
image: P,
|
|
1763
|
+
id: P.id,
|
|
1764
|
+
thumbnail: H === 0 ? q : void 0,
|
|
1765
|
+
selector: P.selector,
|
|
1766
|
+
enableSizes: x,
|
|
1767
|
+
onClick: y ? (Q) => {
|
|
1768
|
+
Q.stopPropagation(), y(P.annotationId, P, Q);
|
|
1764
1769
|
} : void 0
|
|
1765
1770
|
},
|
|
1766
|
-
|
|
1771
|
+
P.id + H
|
|
1767
1772
|
)),
|
|
1768
1773
|
we
|
|
1769
1774
|
] }) : null,
|
|
1770
1775
|
h.type === "3d-model" ? /* @__PURE__ */ u(Je, { model: h.model }) : null,
|
|
1771
|
-
h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */
|
|
1776
|
+
h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ M(Ke, { media: h.media, mediaControlsDeps: d, children: [
|
|
1772
1777
|
G,
|
|
1773
1778
|
s ? s(h) : null
|
|
1774
|
-
] }) : h.media.type === "Video" ? /* @__PURE__ */
|
|
1779
|
+
] }) : h.media.type === "Video" ? /* @__PURE__ */ M(Ge, { media: h.media, mediaControlsDeps: d, children: [
|
|
1775
1780
|
G,
|
|
1776
1781
|
s ? s(h) : null
|
|
1777
|
-
] }) : h.media.type === "VideoYouTube" &&
|
|
1782
|
+
] }) : h.media.type === "VideoYouTube" && v ? /* @__PURE__ */ M(Wn, { media: h.media, mediaControlsDeps: d, children: [
|
|
1778
1783
|
G,
|
|
1779
1784
|
s ? s(h) : null
|
|
1780
1785
|
] }) : null }) : null
|
|
1781
1786
|
]
|
|
1782
1787
|
},
|
|
1783
|
-
`${
|
|
1788
|
+
`${S.id}/${h.type}/${nt}`
|
|
1784
1789
|
),
|
|
1785
1790
|
h.type === "media" && h.media.type === "Sound" && xe ? /* @__PURE__ */ u(me, { canvas: xe.id, children: /* @__PURE__ */ u(et, { renderViewerControls: a }) }) : null
|
|
1786
1791
|
] });
|
|
@@ -1790,7 +1795,7 @@ const Gn = Me(function(t, n) {
|
|
|
1790
1795
|
if (at(n, () => o, [o]), !r)
|
|
1791
1796
|
return /* @__PURE__ */ u("div", {});
|
|
1792
1797
|
let c = 0;
|
|
1793
|
-
return /* @__PURE__ */
|
|
1798
|
+
return /* @__PURE__ */ M($, { children: [
|
|
1794
1799
|
t.header,
|
|
1795
1800
|
/* @__PURE__ */ u(
|
|
1796
1801
|
V.Viewer,
|
|
@@ -1818,8 +1823,8 @@ const Gn = Me(function(t, n) {
|
|
|
1818
1823
|
t.children
|
|
1819
1824
|
] });
|
|
1820
1825
|
}), V = Me(function({ children: t, height: n, annotations: r, canvasProps: i, spacing: o, header: a, components: s, mode: c, reuseAtlas: d, ...l }, f) {
|
|
1821
|
-
const
|
|
1822
|
-
return /* @__PURE__ */ u(he, { vault:
|
|
1826
|
+
const m = ge();
|
|
1827
|
+
return /* @__PURE__ */ u(he, { vault: m, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
|
|
1823
1828
|
Gn,
|
|
1824
1829
|
{
|
|
1825
1830
|
ref: f,
|