react-iiif-vault 1.0.8 → 1.0.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/.build/types/canvas-panel/Viewer.d.ts +1 -1
- package/.build/types/canvas-panel/index.d.ts +2 -1
- package/.build/types/canvas-panel/render/Audio.d.ts +1 -1
- package/.build/types/canvas-panel/render/Canvas.d.ts +2 -2
- package/.build/types/canvas-panel/render/CanvasBackground.d.ts +1 -1
- package/.build/types/canvas-panel/render/DefaultCanvasFallback.d.ts +1 -1
- package/.build/types/canvas-panel/render/Image.d.ts +1 -1
- package/.build/types/canvas-panel/render/Model.d.ts +1 -1
- package/.build/types/canvas-panel/render/Video.d.ts +1 -1
- package/.build/types/canvas-panel/render/VideoYouTube.d.ts +1 -1
- package/.build/types/components/CanvasAnnotations.d.ts +10 -0
- package/.build/types/components/CombinedMetadata.d.ts +4 -0
- package/.build/types/components/Image.d.ts +15 -0
- package/.build/types/components/ManifestMetadata.d.ts +4 -0
- package/.build/types/components/Metadata.d.ts +39 -0
- package/.build/types/components/SequenceThumbnails.d.ts +29 -0
- package/.build/types/components/SingleCanvasThumbnail.d.ts +20 -0
- package/.build/types/context/AnnotationContext.d.ts +1 -1
- package/.build/types/context/AnnotationPageContext.d.ts +1 -1
- package/.build/types/context/CanvasContext.d.ts +1 -1
- package/.build/types/context/CollectionContext.d.ts +1 -1
- package/.build/types/context/ContextBridge.d.ts +1 -1
- package/.build/types/context/ManifestContext.d.ts +1 -1
- package/.build/types/context/MediaContext.d.ts +1 -1
- package/.build/types/context/RangeContext.d.ts +1 -1
- package/.build/types/context/ResourceContext.d.ts +2 -2
- package/.build/types/context/VaultContext.d.ts +1 -1
- package/.build/types/demo/media-controls.d.ts +1 -1
- package/.build/types/demo/viewer-controls.d.ts +1 -1
- package/.build/types/features/rendering-strategy/3d-strategy.d.ts +1 -1
- package/.build/types/features/rendering-strategy/image-strategy.d.ts +1 -1
- package/.build/types/features/rendering-strategy/resource-types.d.ts +7 -7
- package/.build/types/features/rendering-strategy/strategies.d.ts +5 -5
- package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +1 -1
- package/.build/types/hooks/useEventListener.d.ts +1 -1
- package/.build/types/hooks/useExistingVault.d.ts +2 -1
- package/.build/types/hooks/useExternalResource.d.ts +1 -1
- package/.build/types/hooks/useImage.d.ts +10 -0
- package/.build/types/hooks/useLoadImageService.d.ts +1 -1
- package/.build/types/hooks/useRenderingStrategy.d.ts +3 -3
- package/.build/types/hooks/useSimpleMediaPlayer.d.ts +2 -2
- package/.build/types/hooks/useVirtualAnnotationPageContext.d.ts +81 -81
- package/.build/types/index.d.ts +8 -0
- package/.build/types/utility/i18n-utils.d.ts +8 -6
- package/.build/types/viewers/SimpleViewerContext.d.ts +2 -2
- package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +2 -0
- package/.build/types/viewers/SimpleViewerContext.types.d.ts +8 -4
- package/README.md +495 -177
- package/dist/bundle/cjs/index.js +7 -6
- package/dist/bundle/cjs/index.js.map +1 -1
- package/dist/bundle/esm/index.mjs +2391 -1186
- package/dist/bundle/esm/index.mjs.map +1 -1
- package/dist/canvas-panel/cjs/canvas-panel.js +5 -5
- package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
- package/dist/canvas-panel/esm/canvas-panel.mjs +596 -547
- package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
- package/dist/index.umd.js +78 -76
- package/dist/index.umd.js.map +1 -1
- package/dist/react17/cjs/index.js +7 -6
- package/dist/react17/cjs/index.js.map +1 -1
- package/dist/react17/esm/index.mjs +2391 -1186
- package/dist/react17/esm/index.mjs.map +1 -1
- package/dist/utils/cjs/utils.js +1 -1
- package/dist/utils/cjs/utils.js.map +1 -1
- package/dist/utils/esm/utils.mjs +21 -21
- package/dist/utils/esm/utils.mjs.map +1 -1
- package/package.json +24 -22
|
@@ -1,116 +1,137 @@
|
|
|
1
|
-
import { jsx as
|
|
2
|
-
import
|
|
3
|
-
import
|
|
4
|
-
import {
|
|
5
|
-
import {
|
|
6
|
-
import { createStylesHelper as Me } from "@iiif/helpers/styles";
|
|
1
|
+
import { jsx as u, jsxs as I, 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 y, useState as L, useEffect as N, useCallback as P, useRef as q, useLayoutEffect as Ie, Fragment as te, useReducer as ot, forwardRef as Me, useImperativeHandle as at } from "react";
|
|
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
|
+
import { globalVault as Ae, Vault as be } from "@iiif/helpers/vault";
|
|
5
|
+
import { createStylesHelper as Te } from "@iiif/helpers/styles";
|
|
7
6
|
import { expandTarget as le } from "@iiif/helpers/annotation-targets";
|
|
8
|
-
import { expandTarget as
|
|
9
|
-
import { ImageServiceLoader as
|
|
10
|
-
import { createThumbnailHelper as
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
return r.__proto__ = i, r;
|
|
14
|
-
}, de(e, t);
|
|
15
|
-
}
|
|
16
|
-
function mt(e, t) {
|
|
17
|
-
e.prototype = Object.create(t.prototype), e.prototype.constructor = e, de(e, t);
|
|
18
|
-
}
|
|
19
|
-
var pt = function(t, n) {
|
|
20
|
-
return t === void 0 && (t = []), n === void 0 && (n = []), t.length !== n.length || t.some(function(r, i) {
|
|
21
|
-
return !Object.is(r, n[i]);
|
|
22
|
-
});
|
|
23
|
-
}, Pe = {
|
|
7
|
+
import { expandTarget as ht } from "@iiif/helpers";
|
|
8
|
+
import { ImageServiceLoader as gt, getImageServices as mt } from "@atlas-viewer/iiif-image-api";
|
|
9
|
+
import { createThumbnailHelper as vt } from "@iiif/helpers/thumbnail";
|
|
10
|
+
const pt = F(null), se = {
|
|
11
|
+
didCatch: !1,
|
|
24
12
|
error: null
|
|
25
|
-
}
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
o[a] = arguments[a];
|
|
30
|
-
return r = e.call.apply(e, [this].concat(o)) || this, r.state = Pe, r.resetErrorBoundary = function() {
|
|
31
|
-
for (var s, u = arguments.length, d = new Array(u), c = 0; c < u; c++)
|
|
32
|
-
d[c] = arguments[c];
|
|
33
|
-
r.props.onReset == null || (s = r.props).onReset.apply(s, d), r.reset();
|
|
34
|
-
}, r;
|
|
13
|
+
};
|
|
14
|
+
class yt extends rt {
|
|
15
|
+
constructor(t) {
|
|
16
|
+
super(t), this.resetErrorBoundary = this.resetErrorBoundary.bind(this), this.state = se;
|
|
35
17
|
}
|
|
36
|
-
|
|
18
|
+
static getDerivedStateFromError(t) {
|
|
37
19
|
return {
|
|
38
|
-
|
|
20
|
+
didCatch: !0,
|
|
21
|
+
error: t
|
|
39
22
|
};
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
23
|
+
}
|
|
24
|
+
resetErrorBoundary() {
|
|
25
|
+
const {
|
|
26
|
+
error: t
|
|
27
|
+
} = this.state;
|
|
28
|
+
if (t !== null) {
|
|
29
|
+
for (var n, r, i = arguments.length, o = new Array(i), a = 0; a < i; a++)
|
|
30
|
+
o[a] = arguments[a];
|
|
31
|
+
(n = (r = this.props).onReset) === null || n === void 0 || n.call(r, {
|
|
32
|
+
args: o,
|
|
33
|
+
reason: "imperative-api"
|
|
34
|
+
}), this.setState(se);
|
|
35
|
+
}
|
|
36
|
+
}
|
|
37
|
+
componentDidCatch(t, n) {
|
|
38
|
+
var r, i;
|
|
39
|
+
(r = (i = this.props).onError) === null || r === void 0 || r.call(i, t, n);
|
|
40
|
+
}
|
|
41
|
+
componentDidUpdate(t, n) {
|
|
42
|
+
const {
|
|
43
|
+
didCatch: r
|
|
44
|
+
} = this.state, {
|
|
45
|
+
resetKeys: i
|
|
46
|
+
} = this.props;
|
|
47
|
+
if (r && n.error !== null && xt(t.resetKeys, i)) {
|
|
48
|
+
var o, a;
|
|
49
|
+
(o = (a = this.props).onReset) === null || o === void 0 || o.call(a, {
|
|
50
|
+
next: i,
|
|
51
|
+
prev: t.resetKeys,
|
|
52
|
+
reason: "keys"
|
|
53
|
+
}), this.setState(se);
|
|
52
54
|
}
|
|
53
|
-
}
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
55
|
+
}
|
|
56
|
+
render() {
|
|
57
|
+
const {
|
|
58
|
+
children: t,
|
|
59
|
+
fallbackRender: n,
|
|
60
|
+
FallbackComponent: r,
|
|
61
|
+
fallback: i
|
|
62
|
+
} = this.props, {
|
|
63
|
+
didCatch: o,
|
|
64
|
+
error: a
|
|
65
|
+
} = this.state;
|
|
66
|
+
let s = t;
|
|
67
|
+
if (o) {
|
|
68
|
+
const c = {
|
|
69
|
+
error: a,
|
|
58
70
|
resetErrorBoundary: this.resetErrorBoundary
|
|
59
71
|
};
|
|
60
|
-
if (
|
|
61
|
-
|
|
62
|
-
if (
|
|
63
|
-
|
|
64
|
-
if (
|
|
65
|
-
|
|
66
|
-
|
|
72
|
+
if (typeof n == "function")
|
|
73
|
+
s = n(c);
|
|
74
|
+
else if (r)
|
|
75
|
+
s = Pe(r, c);
|
|
76
|
+
else if (i === null || it(i))
|
|
77
|
+
s = i;
|
|
78
|
+
else
|
|
79
|
+
throw a;
|
|
67
80
|
}
|
|
68
|
-
return
|
|
69
|
-
|
|
70
|
-
|
|
71
|
-
|
|
81
|
+
return Pe(pt.Provider, {
|
|
82
|
+
value: {
|
|
83
|
+
didCatch: o,
|
|
84
|
+
error: a,
|
|
85
|
+
resetErrorBoundary: this.resetErrorBoundary
|
|
86
|
+
}
|
|
87
|
+
}, s);
|
|
88
|
+
}
|
|
89
|
+
}
|
|
90
|
+
function xt() {
|
|
91
|
+
let e = arguments.length > 0 && arguments[0] !== void 0 ? arguments[0] : [], t = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : [];
|
|
92
|
+
return e.length !== t.length || e.some((n, r) => !Object.is(n, t[r]));
|
|
93
|
+
}
|
|
94
|
+
const wt = {
|
|
72
95
|
collection: void 0,
|
|
73
96
|
manifest: void 0,
|
|
74
97
|
range: void 0,
|
|
75
98
|
canvas: void 0,
|
|
76
99
|
annotation: void 0,
|
|
77
100
|
annotationPage: void 0
|
|
78
|
-
},
|
|
101
|
+
}, fe = B.createContext(wt), z = () => T(fe);
|
|
79
102
|
function re({ value: e, children: t }) {
|
|
80
103
|
const n = z(), r = y(() => ({
|
|
81
104
|
...n,
|
|
82
105
|
...e
|
|
83
106
|
}), [e, n]);
|
|
84
|
-
return /* @__PURE__ */
|
|
107
|
+
return /* @__PURE__ */ u(fe.Provider, { value: r, children: t });
|
|
85
108
|
}
|
|
86
|
-
const ie =
|
|
109
|
+
const ie = B.createContext({
|
|
87
110
|
vault: null,
|
|
88
111
|
setVaultInstance: (e) => {
|
|
89
112
|
}
|
|
90
113
|
});
|
|
91
|
-
function
|
|
114
|
+
function he({
|
|
92
115
|
vault: e,
|
|
93
116
|
vaultOptions: t,
|
|
94
117
|
useGlobal: n,
|
|
95
118
|
resources: r,
|
|
96
119
|
children: i
|
|
97
120
|
}) {
|
|
98
|
-
const [o, a] = L(() => e || (n ?
|
|
99
|
-
return /* @__PURE__ */
|
|
121
|
+
const [o, a] = L(() => e || (n ? Ae(t) : t ? new be(t) : new be()));
|
|
122
|
+
return /* @__PURE__ */ u(ie.Provider, { value: { vault: o, setVaultInstance: a }, children: /* @__PURE__ */ u(re, { value: r || {}, children: i }) });
|
|
100
123
|
}
|
|
101
|
-
|
|
102
|
-
const
|
|
103
|
-
|
|
104
|
-
|
|
105
|
-
|
|
106
|
-
};
|
|
107
|
-
function xt(e, { noCache: t = !1 } = {}) {
|
|
108
|
-
const n = typeof e == "string" ? e : e.id, r = T(), [i, o] = L(n), [a, s] = L(void 0), u = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, c] = L(u);
|
|
124
|
+
function ge(e) {
|
|
125
|
+
const t = T(ie);
|
|
126
|
+
return e || (t && t.vault ? t.vault : Ae());
|
|
127
|
+
}
|
|
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 = y(() => r.get(n, { skipSelfReturn: !0 }) || void 0, [n, r]), [d, l] = L(c);
|
|
109
130
|
return N(() => {
|
|
110
131
|
(async () => {
|
|
111
132
|
try {
|
|
112
|
-
const f =
|
|
113
|
-
f && i !==
|
|
133
|
+
const f = c && !t ? c : await r.load(n), v = f ? f.id || f["@id"] : null;
|
|
134
|
+
f && i !== v && o(v), l(f);
|
|
114
135
|
} catch (f) {
|
|
115
136
|
s(f);
|
|
116
137
|
}
|
|
@@ -121,24 +142,30 @@ function xt(e, { noCache: t = !1 } = {}) {
|
|
|
121
142
|
requestId: n,
|
|
122
143
|
error: a,
|
|
123
144
|
resource: d,
|
|
124
|
-
cached: !!(d && d ===
|
|
145
|
+
cached: !!(d && d === c)
|
|
125
146
|
};
|
|
126
147
|
}
|
|
127
|
-
function
|
|
128
|
-
const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } =
|
|
148
|
+
function Pt(e, t) {
|
|
149
|
+
const { id: n, isLoaded: r, error: i, resource: o, requestId: a, cached: s } = St(
|
|
129
150
|
e,
|
|
130
151
|
t
|
|
131
152
|
);
|
|
132
153
|
return { id: n, isLoaded: r, error: i, manifest: o, requestId: a, cached: s };
|
|
133
154
|
}
|
|
134
|
-
function
|
|
135
|
-
return /* @__PURE__ */
|
|
155
|
+
function bt({ manifest: e, children: t }) {
|
|
156
|
+
return /* @__PURE__ */ u(re, { value: { manifest: e }, children: t });
|
|
136
157
|
}
|
|
137
|
-
function
|
|
138
|
-
return /* @__PURE__ */
|
|
158
|
+
function me({ canvas: e, children: t }) {
|
|
159
|
+
return /* @__PURE__ */ u(re, { value: { canvas: e }, children: t });
|
|
139
160
|
}
|
|
140
|
-
|
|
141
|
-
const
|
|
161
|
+
const O = () => {
|
|
162
|
+
const { vault: e } = T(ie);
|
|
163
|
+
if (e === null)
|
|
164
|
+
throw new Error("Vault not found. Ensure you have your provider set up correctly.");
|
|
165
|
+
return e;
|
|
166
|
+
};
|
|
167
|
+
function R(e, t = []) {
|
|
168
|
+
const n = O(), [r, i] = L(() => e(n.getState(), n));
|
|
142
169
|
return N(() => n.subscribe(
|
|
143
170
|
(o) => e(o, n),
|
|
144
171
|
(o) => {
|
|
@@ -147,18 +174,18 @@ function V(e, t = []) {
|
|
|
147
174
|
!1
|
|
148
175
|
), t), r;
|
|
149
176
|
}
|
|
150
|
-
const oe =
|
|
177
|
+
const oe = B.createContext([]);
|
|
151
178
|
function Re() {
|
|
152
|
-
const e =
|
|
153
|
-
return
|
|
179
|
+
const e = T(oe);
|
|
180
|
+
return R(
|
|
154
181
|
(t) => e.map((n) => t.iiif.entities.Canvas[n]).filter(Boolean),
|
|
155
182
|
[e]
|
|
156
183
|
);
|
|
157
184
|
}
|
|
158
185
|
function K(e = {}, t = []) {
|
|
159
186
|
const { id: n, selector: r } = e, i = z();
|
|
160
|
-
|
|
161
|
-
const o = n || i.manifest, a =
|
|
187
|
+
O();
|
|
188
|
+
const o = n || i.manifest, a = R(
|
|
162
189
|
(s) => o ? s.iiif.entities.Manifest[o] : void 0,
|
|
163
190
|
[o]
|
|
164
191
|
);
|
|
@@ -167,8 +194,8 @@ function K(e = {}, t = []) {
|
|
|
167
194
|
return r ? r(a) : a;
|
|
168
195
|
}, [a, r, ...t]);
|
|
169
196
|
}
|
|
170
|
-
function
|
|
171
|
-
return /* @__PURE__ */
|
|
197
|
+
function Ct({ range: e, children: t }) {
|
|
198
|
+
return /* @__PURE__ */ u(re, { value: { range: e }, children: t });
|
|
172
199
|
}
|
|
173
200
|
function Ve(e, t) {
|
|
174
201
|
var r;
|
|
@@ -180,82 +207,84 @@ function Ve(e, t) {
|
|
|
180
207
|
}
|
|
181
208
|
return n;
|
|
182
209
|
}
|
|
183
|
-
function
|
|
184
|
-
const i = t.behavior, o = i.includes("paged"), a = o ? !1 : i.includes("continuous"), s = o || a ? !1 : i.includes("individuals"),
|
|
210
|
+
function Et(e, t, { disablePaging: n, skipNonPaged: r } = {}) {
|
|
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);
|
|
185
212
|
if (a)
|
|
186
|
-
return [
|
|
213
|
+
return [c, [c.map((m, g) => g)]];
|
|
187
214
|
if (s || !o || n)
|
|
188
|
-
return [
|
|
215
|
+
return [c, c.map((m, g) => [g])];
|
|
189
216
|
const d = [];
|
|
190
|
-
let
|
|
217
|
+
let l = [];
|
|
191
218
|
const f = () => {
|
|
192
|
-
|
|
219
|
+
l.length && (d.push([...l]), l = []);
|
|
193
220
|
};
|
|
194
|
-
let
|
|
195
|
-
for (let m = 0; m <
|
|
196
|
-
const g = e.get(
|
|
221
|
+
let v = 0, p = !1;
|
|
222
|
+
for (let m = 0; m < c.length; m++) {
|
|
223
|
+
const g = e.get(c[m]);
|
|
197
224
|
if (g.behavior.includes("non-paged")) {
|
|
198
|
-
m ===
|
|
225
|
+
m === v && v++, r || (f(), d.push([m]), f());
|
|
199
226
|
continue;
|
|
200
227
|
}
|
|
201
|
-
if (m ===
|
|
202
|
-
|
|
228
|
+
if (m === v || g.behavior.includes("facing-pages")) {
|
|
229
|
+
l.length && (p = !0), f(), d.push([m]), f();
|
|
203
230
|
continue;
|
|
204
231
|
}
|
|
205
|
-
if (
|
|
206
|
-
f(),
|
|
232
|
+
if (l.push(m), p) {
|
|
233
|
+
f(), p = !1;
|
|
207
234
|
continue;
|
|
208
235
|
}
|
|
209
|
-
|
|
236
|
+
l.length > 1 && f();
|
|
210
237
|
}
|
|
211
|
-
return
|
|
238
|
+
return l.length && f(), [c, d];
|
|
212
239
|
}
|
|
213
|
-
function
|
|
214
|
-
const { id: n, selector: r } = e, i = z(), o = n || i.range, a =
|
|
240
|
+
function It(e = {}, t = []) {
|
|
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]);
|
|
215
242
|
return y(() => {
|
|
216
243
|
if (a)
|
|
217
244
|
return r ? r(a) : a;
|
|
218
245
|
}, [a, r, ...t]);
|
|
219
246
|
}
|
|
220
|
-
function
|
|
247
|
+
function Mt({ startCanvas: e, disablePaging: t }) {
|
|
221
248
|
var m;
|
|
222
|
-
const n =
|
|
249
|
+
const n = O(), r = K(), i = It(), [o, a] = L(void 0), s = i || r;
|
|
223
250
|
if (!s)
|
|
224
251
|
throw new Error("Nothing selected");
|
|
225
|
-
const [
|
|
226
|
-
() =>
|
|
227
|
-
[n, s]
|
|
228
|
-
),
|
|
252
|
+
const [c, d] = y(
|
|
253
|
+
() => Et(n, s, { disablePaging: t }),
|
|
254
|
+
[n, s, t]
|
|
255
|
+
), l = P(
|
|
229
256
|
(g) => {
|
|
230
257
|
const w = d.findIndex((x) => x.includes(g));
|
|
231
258
|
a(w === -1 ? 0 : w);
|
|
232
259
|
},
|
|
233
|
-
[
|
|
260
|
+
[c, d]
|
|
234
261
|
), f = P(
|
|
235
262
|
(g) => {
|
|
236
|
-
const w =
|
|
237
|
-
w !== -1 ?
|
|
263
|
+
const w = c.findIndex((x) => x.id === g);
|
|
264
|
+
w !== -1 ? l(w) : a(0);
|
|
238
265
|
},
|
|
239
|
-
[
|
|
240
|
-
),
|
|
241
|
-
a((g) => g >= d.length ? g : g + 1);
|
|
242
|
-
}, [d]),
|
|
266
|
+
[c, d]
|
|
267
|
+
), v = P(() => {
|
|
268
|
+
a((g) => g >= d.length - 1 ? g : g + 1);
|
|
269
|
+
}, [d]), p = P(() => {
|
|
243
270
|
a((g) => g <= 0 ? 0 : g - 1);
|
|
244
271
|
}, [d]);
|
|
245
272
|
return typeof o > "u" && (e ? f(e) : a(0)), {
|
|
246
|
-
visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) =>
|
|
273
|
+
visibleItems: ((m = d[o]) == null ? void 0 : m.map((g) => c[g].id)) || [],
|
|
247
274
|
cursor: o,
|
|
248
|
-
items:
|
|
275
|
+
items: c,
|
|
249
276
|
sequence: d,
|
|
277
|
+
hasPrevious: o > 0,
|
|
278
|
+
hasNext: o < d.length - 1,
|
|
250
279
|
setSequenceIndex: a,
|
|
251
|
-
setCanvasIndex:
|
|
280
|
+
setCanvasIndex: l,
|
|
252
281
|
setCanvasId: f,
|
|
253
|
-
next:
|
|
254
|
-
previous:
|
|
282
|
+
next: v,
|
|
283
|
+
previous: p
|
|
255
284
|
};
|
|
256
285
|
}
|
|
257
286
|
const J = () => {
|
|
258
|
-
}, ae =
|
|
287
|
+
}, ae = F({
|
|
259
288
|
setCurrentCanvasId: J,
|
|
260
289
|
setCurrentCanvasIndex: J,
|
|
261
290
|
nextCanvas: J,
|
|
@@ -263,55 +292,71 @@ const J = () => {
|
|
|
263
292
|
items: [],
|
|
264
293
|
sequence: [],
|
|
265
294
|
setSequenceIndex: J,
|
|
266
|
-
currentSequenceIndex: 0
|
|
295
|
+
currentSequenceIndex: 0,
|
|
296
|
+
hasNext: !1,
|
|
297
|
+
hasPrevious: !1
|
|
267
298
|
});
|
|
268
299
|
function At(e) {
|
|
269
|
-
const t = K(), {
|
|
300
|
+
const t = K(), {
|
|
301
|
+
cursor: n,
|
|
302
|
+
visibleItems: r,
|
|
303
|
+
next: i,
|
|
304
|
+
sequence: o,
|
|
305
|
+
items: a,
|
|
306
|
+
setCanvasIndex: s,
|
|
307
|
+
setCanvasId: c,
|
|
308
|
+
previous: d,
|
|
309
|
+
setSequenceIndex: l,
|
|
310
|
+
hasNext: f,
|
|
311
|
+
hasPrevious: v
|
|
312
|
+
} = Mt({
|
|
270
313
|
startCanvas: e.startCanvas,
|
|
271
314
|
disablePaging: e.pagingEnabled === !1
|
|
272
|
-
}),
|
|
315
|
+
}), p = y(
|
|
273
316
|
() => ({
|
|
274
317
|
sequence: o,
|
|
275
318
|
items: a,
|
|
276
319
|
// Extra functions.
|
|
277
|
-
setCurrentCanvasId:
|
|
320
|
+
setCurrentCanvasId: c,
|
|
278
321
|
nextCanvas: i,
|
|
279
322
|
previousCanvas: d,
|
|
280
323
|
totalCanvases: a.length,
|
|
281
324
|
setCurrentCanvasIndex: s,
|
|
282
|
-
setSequenceIndex:
|
|
283
|
-
currentSequenceIndex: n
|
|
325
|
+
setSequenceIndex: l,
|
|
326
|
+
currentSequenceIndex: n,
|
|
327
|
+
hasNext: f,
|
|
328
|
+
hasPrevious: v
|
|
284
329
|
}),
|
|
285
|
-
[o, a,
|
|
330
|
+
[o, a, c, i, d, a, s, l, n]
|
|
286
331
|
);
|
|
287
|
-
return t ? r.length === 0 ? null : /* @__PURE__ */
|
|
288
|
-
}
|
|
289
|
-
function
|
|
290
|
-
const t =
|
|
291
|
-
if (!
|
|
292
|
-
return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */
|
|
293
|
-
if (
|
|
294
|
-
return /* @__PURE__ */
|
|
295
|
-
if (!
|
|
296
|
-
return /* @__PURE__ */
|
|
297
|
-
const
|
|
298
|
-
return /* @__PURE__ */
|
|
299
|
-
}
|
|
300
|
-
function
|
|
301
|
-
return
|
|
302
|
-
}
|
|
303
|
-
function
|
|
332
|
+
return t ? r.length === 0 ? null : /* @__PURE__ */ u(ae.Provider, { value: p, children: /* @__PURE__ */ u(oe.Provider, { value: r, children: /* @__PURE__ */ u(me, { canvas: r[0], children: e.children }) }) }) : (console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." }));
|
|
333
|
+
}
|
|
334
|
+
function Tt(e) {
|
|
335
|
+
const t = ge(e.vault), n = Pt(e.manifest);
|
|
336
|
+
if (!n)
|
|
337
|
+
return console.warn("The manifest passed to the provider is not a valid IIIF manifest."), /* @__PURE__ */ u("div", { children: "Sorry, something went wrong." });
|
|
338
|
+
if (n.error)
|
|
339
|
+
return /* @__PURE__ */ u("div", { children: n.error.toString() });
|
|
340
|
+
if (!n.isLoaded)
|
|
341
|
+
return /* @__PURE__ */ u("div", { children: "Loading..." });
|
|
342
|
+
const r = /* @__PURE__ */ u(At, { ...e, children: e.children });
|
|
343
|
+
return /* @__PURE__ */ u(he, { vault: t, children: /* @__PURE__ */ u(bt, { manifest: n.id, children: e.rangeId ? /* @__PURE__ */ u(Ct, { range: e.rangeId, children: r }) : r }) });
|
|
344
|
+
}
|
|
345
|
+
function Rt() {
|
|
346
|
+
return T(ae);
|
|
347
|
+
}
|
|
348
|
+
function Vt() {
|
|
304
349
|
return {
|
|
305
|
-
VaultContext:
|
|
306
|
-
ResourceContext:
|
|
307
|
-
SimpleViewerReactContext:
|
|
308
|
-
VisibleCanvasReactContext:
|
|
350
|
+
VaultContext: T(ie),
|
|
351
|
+
ResourceContext: T(fe),
|
|
352
|
+
SimpleViewerReactContext: T(ae),
|
|
353
|
+
VisibleCanvasReactContext: T(oe)
|
|
309
354
|
};
|
|
310
355
|
}
|
|
311
|
-
function
|
|
312
|
-
return /* @__PURE__ */
|
|
356
|
+
function Ot(e) {
|
|
357
|
+
return /* @__PURE__ */ u(he, { vault: e.bridge.VaultContext.vault || void 0, resources: e.bridge.ResourceContext, children: /* @__PURE__ */ u(oe.Provider, { value: e.bridge.VisibleCanvasReactContext, children: /* @__PURE__ */ u(ae.Provider, { value: e.bridge.SimpleViewerReactContext, children: e.children }) }) });
|
|
313
358
|
}
|
|
314
|
-
const
|
|
359
|
+
const U = function(e) {
|
|
315
360
|
return function() {
|
|
316
361
|
const t = { type: e, getType: () => e, toString: () => e };
|
|
317
362
|
return (n, r) => ({
|
|
@@ -320,28 +365,28 @@ const F = function(e) {
|
|
|
320
365
|
...r !== void 0 && { meta: r }
|
|
321
366
|
});
|
|
322
367
|
};
|
|
323
|
-
},
|
|
324
|
-
importEntities:
|
|
368
|
+
}, Lt = "@iiif/IMPORT_ENTITIES", kt = "@iiif/MODIFY_ENTITY_FIELD", Nt = "@iiif/REORDER_ENTITY_FIELD", Ft = "@iiif/ADD_REFERENCE", Ut = "@iiif/UPDATE_REFERENCE", Dt = "@iiif/REMOVE_REFERENCE", _t = "@iiif/ADD_METADATA", qt = "@iiif/REMOVE_METADATA", Bt = "@iiif/UPDATE_METADATA", jt = "@iiif/REORDER_METADATA", Ht = U(Lt)(), $t = U(kt)(), Yt = U(Nt)(), zt = U(Ft)(), Kt = U(Dt)(), Wt = U(Ut)(), Gt = U(_t)(), Qt = U(Bt)(), Jt = U(qt)(), Zt = U(jt)(), ue = {
|
|
369
|
+
importEntities: Ht,
|
|
325
370
|
modifyEntityField: $t,
|
|
326
|
-
reorderEntityField:
|
|
327
|
-
addReference:
|
|
328
|
-
removeReference:
|
|
329
|
-
updateReference:
|
|
330
|
-
addMetadata:
|
|
331
|
-
removeMetadata:
|
|
332
|
-
updateMetadata:
|
|
333
|
-
reorderMetadata:
|
|
371
|
+
reorderEntityField: Yt,
|
|
372
|
+
addReference: zt,
|
|
373
|
+
removeReference: Kt,
|
|
374
|
+
updateReference: Wt,
|
|
375
|
+
addMetadata: Gt,
|
|
376
|
+
removeMetadata: Jt,
|
|
377
|
+
updateMetadata: Qt,
|
|
378
|
+
reorderMetadata: Zt
|
|
334
379
|
};
|
|
335
|
-
function
|
|
336
|
-
const t =
|
|
380
|
+
function Xt() {
|
|
381
|
+
const t = O().getStore();
|
|
337
382
|
return y(() => (n) => t.dispatch(n), [t]);
|
|
338
383
|
}
|
|
339
|
-
function
|
|
384
|
+
function Ce(e) {
|
|
340
385
|
return typeof e != "string" && e && e.bindToVault;
|
|
341
386
|
}
|
|
342
|
-
function
|
|
343
|
-
const e =
|
|
344
|
-
|
|
387
|
+
function en() {
|
|
388
|
+
const e = O(), t = q([]), n = Xt(), r = y(() => `vault://annotation-page/${(/* @__PURE__ */ new Date()).getTime()}/${Math.round(Math.random() * 1e9).toString(16)}`, []);
|
|
389
|
+
Ie(() => {
|
|
345
390
|
const s = {
|
|
346
391
|
id: r,
|
|
347
392
|
type: "AnnotationPage",
|
|
@@ -369,19 +414,19 @@ function Zt() {
|
|
|
369
414
|
})
|
|
370
415
|
);
|
|
371
416
|
}, [r]);
|
|
372
|
-
const i =
|
|
417
|
+
const i = R(
|
|
373
418
|
(s) => r ? s.iiif.entities.AnnotationPage[r] : null,
|
|
374
419
|
[r]
|
|
375
420
|
), o = P(
|
|
376
|
-
(s,
|
|
421
|
+
(s, c) => {
|
|
377
422
|
if (r) {
|
|
378
|
-
if (
|
|
423
|
+
if (Ce(s)) {
|
|
379
424
|
const f = s;
|
|
380
425
|
f.__vault || f.bindToVault(e), s = typeof f.source == "string" ? f.source : f.source.id, t.current[s] = f;
|
|
381
426
|
} else
|
|
382
427
|
typeof s != "string" && (s = s.id);
|
|
383
|
-
const d = e.get({ id: r, type: "AnnotationPage" }),
|
|
384
|
-
d &&
|
|
428
|
+
const d = e.get({ id: r, type: "AnnotationPage" }), l = e.get({ id: s, type: "Annotation" });
|
|
429
|
+
d && l && (d.items.find((f) => f.id === l.id) || n(
|
|
385
430
|
ue.addReference({
|
|
386
431
|
id: r,
|
|
387
432
|
type: "AnnotationPage",
|
|
@@ -390,7 +435,7 @@ function Zt() {
|
|
|
390
435
|
id: s,
|
|
391
436
|
type: "Annotation"
|
|
392
437
|
},
|
|
393
|
-
index:
|
|
438
|
+
index: c
|
|
394
439
|
})
|
|
395
440
|
));
|
|
396
441
|
}
|
|
@@ -398,7 +443,7 @@ function Zt() {
|
|
|
398
443
|
[r]
|
|
399
444
|
), a = P(
|
|
400
445
|
(s) => {
|
|
401
|
-
r && (
|
|
446
|
+
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(
|
|
402
447
|
ue.removeReference({
|
|
403
448
|
id: r,
|
|
404
449
|
type: "AnnotationPage",
|
|
@@ -420,9 +465,9 @@ function Zt() {
|
|
|
420
465
|
}
|
|
421
466
|
];
|
|
422
467
|
}
|
|
423
|
-
const Oe =
|
|
424
|
-
function
|
|
425
|
-
const e =
|
|
468
|
+
const Oe = F(null);
|
|
469
|
+
function tn() {
|
|
470
|
+
const e = T(Oe);
|
|
426
471
|
return [
|
|
427
472
|
e.fullPage,
|
|
428
473
|
{
|
|
@@ -431,9 +476,9 @@ function Xt() {
|
|
|
431
476
|
}
|
|
432
477
|
];
|
|
433
478
|
}
|
|
434
|
-
function
|
|
435
|
-
const [t, { addAnnotation: n, removeAnnotation: r }] =
|
|
436
|
-
return /* @__PURE__ */
|
|
479
|
+
function nn({ children: e }) {
|
|
480
|
+
const [t, { addAnnotation: n, removeAnnotation: r }] = en();
|
|
481
|
+
return /* @__PURE__ */ u(
|
|
437
482
|
Oe.Provider,
|
|
438
483
|
{
|
|
439
484
|
value: y(() => ({ fullPage: t, addAnnotation: n, removeAnnotation: r }), [t]),
|
|
@@ -441,91 +486,91 @@ function en({ children: e }) {
|
|
|
441
486
|
}
|
|
442
487
|
);
|
|
443
488
|
}
|
|
444
|
-
function
|
|
489
|
+
function rn({
|
|
445
490
|
width: e,
|
|
446
491
|
style: t,
|
|
447
492
|
height: n,
|
|
448
493
|
error: r,
|
|
449
494
|
resetErrorBoundary: i
|
|
450
495
|
}) {
|
|
451
|
-
return /* @__PURE__ */
|
|
452
|
-
/* @__PURE__ */
|
|
453
|
-
/* @__PURE__ */
|
|
454
|
-
/* @__PURE__ */
|
|
496
|
+
return /* @__PURE__ */ I("div", { style: { width: e, height: n, minHeight: 500, ...t || {}, background: "#f9f9f9" }, children: [
|
|
497
|
+
/* @__PURE__ */ u("h3", { children: "Error occurred" }),
|
|
498
|
+
/* @__PURE__ */ u("p", { children: r.message }),
|
|
499
|
+
/* @__PURE__ */ u("button", { onClick: i, children: "Reset" })
|
|
455
500
|
] });
|
|
456
501
|
}
|
|
457
|
-
const
|
|
458
|
-
function
|
|
459
|
-
return
|
|
502
|
+
const ve = F(null);
|
|
503
|
+
function on() {
|
|
504
|
+
return T(ve);
|
|
460
505
|
}
|
|
461
|
-
const Le =
|
|
506
|
+
const Le = F(
|
|
462
507
|
() => {
|
|
463
508
|
}
|
|
464
|
-
), ke =
|
|
509
|
+
), ke = F(
|
|
465
510
|
() => {
|
|
466
511
|
}
|
|
467
512
|
);
|
|
468
513
|
function Y(e, t, n, r, i = []) {
|
|
469
|
-
const o =
|
|
514
|
+
const o = T(e === "portal" ? ke : Le);
|
|
470
515
|
N(() => (e !== "none" && o(t, n, r), () => {
|
|
471
516
|
o(t, null);
|
|
472
517
|
}), [t, e, o, ...i]);
|
|
473
518
|
}
|
|
474
|
-
function
|
|
475
|
-
const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a =
|
|
519
|
+
function j(e = {}, t = []) {
|
|
520
|
+
const { id: n, selector: r } = e, i = z(), o = n || i.canvas, a = R((s) => o ? s.iiif.entities.Canvas[o] : void 0, [o]);
|
|
476
521
|
return y(() => {
|
|
477
522
|
if (a)
|
|
478
523
|
return r ? r(a) : a;
|
|
479
524
|
}, [a, r, ...t]);
|
|
480
525
|
}
|
|
481
|
-
const Ne =
|
|
526
|
+
const Ne = F(() => {
|
|
482
527
|
});
|
|
483
|
-
function
|
|
484
|
-
const t =
|
|
528
|
+
function an(e) {
|
|
529
|
+
const t = j(), n = T(Ne);
|
|
485
530
|
N(() => t && t.id ? (n(t.id, e), () => n(t.id, -1)) : () => {
|
|
486
531
|
}, [t, e]);
|
|
487
532
|
}
|
|
488
|
-
function
|
|
533
|
+
function sn({
|
|
489
534
|
children: e,
|
|
490
535
|
errorFallback: t,
|
|
491
536
|
outerContainerProps: n = {},
|
|
492
537
|
worldScale: r,
|
|
493
538
|
...i
|
|
494
539
|
}) {
|
|
495
|
-
const [o, a] = L(), s =
|
|
540
|
+
const [o, a] = L(), s = Vt(), c = t || rn, [d, l] = L({}), f = Object.entries(d), [v, p] = L({}), m = Object.entries(v), [g, w] = L({}), x = y(() => r || Math.max(...Object.values(g)), [g]), M = y(() => ({ maxOverZoom: x || 1, ...i.runtimeOptions || {} }), [x, i.runtimeOptions]), b = P((C, A) => {
|
|
496
541
|
w((k) => {
|
|
497
|
-
if (
|
|
498
|
-
const { [
|
|
542
|
+
if (A === -1) {
|
|
543
|
+
const { [C]: h, ...D } = k;
|
|
499
544
|
return D;
|
|
500
545
|
}
|
|
501
|
-
return { ...k, [
|
|
546
|
+
return { ...k, [C]: A };
|
|
502
547
|
});
|
|
503
|
-
}, []), W = P((
|
|
504
|
-
|
|
548
|
+
}, []), W = P((C, A, k) => {
|
|
549
|
+
l(({ [C]: h, ...D }) => A ? {
|
|
505
550
|
...D,
|
|
506
|
-
[
|
|
551
|
+
[C]: { element: A, props: k }
|
|
507
552
|
} : D);
|
|
508
|
-
}, []), Z = P((
|
|
509
|
-
|
|
553
|
+
}, []), Z = P((C, A, k) => {
|
|
554
|
+
p(({ [C]: h, ...D }) => A ? {
|
|
510
555
|
...D,
|
|
511
|
-
[
|
|
556
|
+
[C]: { element: A, props: k }
|
|
512
557
|
} : D);
|
|
513
558
|
}, []);
|
|
514
|
-
return /* @__PURE__ */
|
|
515
|
-
/* @__PURE__ */
|
|
516
|
-
|
|
559
|
+
return /* @__PURE__ */ I(yt, { resetKeys: [], fallbackRender: (C) => /* @__PURE__ */ u(c, { ...i, ...C }), children: [
|
|
560
|
+
/* @__PURE__ */ u(
|
|
561
|
+
st,
|
|
517
562
|
{
|
|
518
563
|
...i,
|
|
519
564
|
containerProps: { style: { position: "relative" }, ...i.containerProps || {} },
|
|
520
|
-
htmlChildren: /* @__PURE__ */
|
|
521
|
-
onCreated: (
|
|
522
|
-
a(
|
|
565
|
+
htmlChildren: /* @__PURE__ */ u($, { children: f.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) }),
|
|
566
|
+
onCreated: (C) => {
|
|
567
|
+
a(C), i.onCreated && i.onCreated(C);
|
|
523
568
|
},
|
|
524
|
-
runtimeOptions:
|
|
525
|
-
children: /* @__PURE__ */
|
|
569
|
+
runtimeOptions: M,
|
|
570
|
+
children: /* @__PURE__ */ u(ve.Provider, { value: o, children: /* @__PURE__ */ u(Ne.Provider, { value: b, 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 }) }) }) }) }) }) })
|
|
526
571
|
}
|
|
527
572
|
),
|
|
528
|
-
/* @__PURE__ */
|
|
573
|
+
/* @__PURE__ */ u("div", { children: m.map(([C, { element: A, props: k }]) => /* @__PURE__ */ u(B.Fragment, { children: /* @__PURE__ */ u(A, { ...k || {} }) }, C)) })
|
|
529
574
|
] });
|
|
530
575
|
}
|
|
531
576
|
const X = {}, Fe = {
|
|
@@ -548,7 +593,7 @@ const X = {}, Fe = {
|
|
|
548
593
|
return t ? n[t] : n;
|
|
549
594
|
}
|
|
550
595
|
};
|
|
551
|
-
function
|
|
596
|
+
function un(e = Fe) {
|
|
552
597
|
return {
|
|
553
598
|
addEventListener(t, n, r, i) {
|
|
554
599
|
if (t)
|
|
@@ -577,36 +622,36 @@ function an(e = Fe) {
|
|
|
577
622
|
if (i && r)
|
|
578
623
|
for (const a of Object.keys(i))
|
|
579
624
|
o[a] = (s) => {
|
|
580
|
-
const
|
|
581
|
-
for (const { callback: d, scope:
|
|
582
|
-
(!
|
|
625
|
+
const c = e.get(r);
|
|
626
|
+
for (const { callback: d, scope: l } of i[a] || [])
|
|
627
|
+
(!l || n && l.indexOf(n) !== -1) && d(s, c);
|
|
583
628
|
};
|
|
584
629
|
return o;
|
|
585
630
|
}
|
|
586
631
|
};
|
|
587
632
|
}
|
|
588
|
-
function
|
|
589
|
-
const n =
|
|
633
|
+
function Ue(e, t) {
|
|
634
|
+
const n = O(), r = y(() => un(n), [n]), i = R(() => e && e.id ? n.getResourceMeta(e.id, "eventManager") : null, [e]);
|
|
590
635
|
return y(() => e ? r.getListenersAsProps(e, t) : {}, [i, e, n, t]);
|
|
591
636
|
}
|
|
592
637
|
function ne(e, t) {
|
|
593
|
-
const n =
|
|
594
|
-
return
|
|
638
|
+
const n = O(), r = y(() => Te(n), [n]);
|
|
639
|
+
return R(() => {
|
|
595
640
|
if (!e)
|
|
596
641
|
return null;
|
|
597
642
|
const i = r.getAppliedStyles(e.id);
|
|
598
643
|
return i ? t ? i[t] : i : void 0;
|
|
599
644
|
}, [e, t]);
|
|
600
645
|
}
|
|
601
|
-
function
|
|
602
|
-
const { id: n, selector: r } = e, i = z(), o =
|
|
646
|
+
function De(e = {}, t = []) {
|
|
647
|
+
const { id: n, selector: r } = e, i = z(), o = O(), a = n || i.annotation, s = R(
|
|
603
648
|
(d) => a ? d.iiif.entities.Annotation[a] : void 0,
|
|
604
649
|
[a]
|
|
605
|
-
),
|
|
606
|
-
(d) => s && s.body ? s.body.map((
|
|
607
|
-
...
|
|
608
|
-
source: o.get(
|
|
609
|
-
} :
|
|
650
|
+
), c = R(
|
|
651
|
+
(d) => s && s.body ? s.body.map((l) => l ? l.type === "SpecificResource" ? {
|
|
652
|
+
...l,
|
|
653
|
+
source: o.get(l)
|
|
654
|
+
} : l ? d.iiif.entities[l.type][l.id] : null : null).filter(Boolean) : [],
|
|
610
655
|
[s]
|
|
611
656
|
);
|
|
612
657
|
return y(() => {
|
|
@@ -614,11 +659,11 @@ function Ue(e = {}, t = []) {
|
|
|
614
659
|
return;
|
|
615
660
|
const d = {
|
|
616
661
|
...s,
|
|
617
|
-
body:
|
|
662
|
+
body: c,
|
|
618
663
|
target: le(s.target, { typeMap: o.getState().iiif.mapping })
|
|
619
664
|
};
|
|
620
665
|
return r ? r(d) : d;
|
|
621
|
-
}, [s, r,
|
|
666
|
+
}, [s, r, c, ...t]);
|
|
622
667
|
}
|
|
623
668
|
const _e = ({
|
|
624
669
|
id: e,
|
|
@@ -626,9 +671,9 @@ const _e = ({
|
|
|
626
671
|
className: n,
|
|
627
672
|
interactive: r
|
|
628
673
|
}) => {
|
|
629
|
-
const i =
|
|
630
|
-
return
|
|
631
|
-
|
|
674
|
+
const i = De({ id: e }), o = ne(i, "atlas"), a = ne(i, "html"), s = Ue(i, ["atlas"]), c = j(), d = y(() => ct(t, o), [t, o]);
|
|
675
|
+
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
|
+
lt,
|
|
632
677
|
{
|
|
633
678
|
id: i.id,
|
|
634
679
|
isEditing: !0,
|
|
@@ -645,8 +690,8 @@ const _e = ({
|
|
|
645
690
|
}
|
|
646
691
|
) : null;
|
|
647
692
|
};
|
|
648
|
-
function
|
|
649
|
-
const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a =
|
|
693
|
+
function cn(e = {}, t = []) {
|
|
694
|
+
const { id: n, selector: r } = e, i = z(), o = n || i.annotationPage, a = R(
|
|
650
695
|
(s) => o ? s.iiif.entities.AnnotationPage[o] : void 0,
|
|
651
696
|
[o]
|
|
652
697
|
);
|
|
@@ -655,13 +700,13 @@ function sn(e = {}, t = []) {
|
|
|
655
700
|
return r ? r(a) : a;
|
|
656
701
|
}, [a, ...t]);
|
|
657
702
|
}
|
|
658
|
-
const
|
|
703
|
+
const de = ({
|
|
659
704
|
className: e,
|
|
660
705
|
page: t
|
|
661
706
|
}) => {
|
|
662
707
|
var o;
|
|
663
|
-
const n =
|
|
664
|
-
return
|
|
708
|
+
const n = cn({ id: t.id }) || t, r = ne(n, "atlas"), i = ne(n, "html");
|
|
709
|
+
return R((a) => n.id ? a.iiif.entities.AnnotationPage[n.id] : null, []), /* @__PURE__ */ u(te, { children: (o = n.items) == null ? void 0 : o.map((a) => /* @__PURE__ */ u(
|
|
665
710
|
_e,
|
|
666
711
|
{
|
|
667
712
|
id: a.id,
|
|
@@ -671,7 +716,7 @@ const fe = ({
|
|
|
671
716
|
a.id
|
|
672
717
|
)) });
|
|
673
718
|
};
|
|
674
|
-
function
|
|
719
|
+
function qe({
|
|
675
720
|
id: e,
|
|
676
721
|
image: t,
|
|
677
722
|
thumbnail: n,
|
|
@@ -680,25 +725,25 @@ function je({
|
|
|
680
725
|
y: o = 0,
|
|
681
726
|
children: a,
|
|
682
727
|
selector: s,
|
|
683
|
-
onClick:
|
|
728
|
+
onClick: c,
|
|
684
729
|
enableSizes: d
|
|
685
730
|
}) {
|
|
686
|
-
var f,
|
|
687
|
-
const
|
|
731
|
+
var f, v;
|
|
732
|
+
const l = y(() => {
|
|
688
733
|
if (!(!s || s.spatial.x === 0 && s.spatial.y === 0))
|
|
689
734
|
return s.spatial;
|
|
690
735
|
}, [s]);
|
|
691
|
-
return /* @__PURE__ */
|
|
736
|
+
return /* @__PURE__ */ u(
|
|
692
737
|
"world-object",
|
|
693
738
|
{
|
|
694
739
|
x: i + t.target.spatial.x,
|
|
695
740
|
y: o + t.target.spatial.y,
|
|
696
741
|
width: t.target.spatial.width,
|
|
697
742
|
height: t.target.spatial.height,
|
|
698
|
-
onClick:
|
|
699
|
-
children: t.service ? /* @__PURE__ */
|
|
700
|
-
/* @__PURE__ */
|
|
701
|
-
|
|
743
|
+
onClick: c,
|
|
744
|
+
children: t.service ? /* @__PURE__ */ I(te, { children: [
|
|
745
|
+
/* @__PURE__ */ u(
|
|
746
|
+
dt,
|
|
702
747
|
{
|
|
703
748
|
tiles: {
|
|
704
749
|
id: t.service.id || t.service["@id"] || "unknown",
|
|
@@ -711,23 +756,23 @@ function je({
|
|
|
711
756
|
x: 0,
|
|
712
757
|
y: 0,
|
|
713
758
|
width: (f = t.target) == null ? void 0 : f.spatial.width,
|
|
714
|
-
height: (
|
|
715
|
-
crop:
|
|
759
|
+
height: (v = t.target) == null ? void 0 : v.spatial.height,
|
|
760
|
+
crop: l
|
|
716
761
|
}
|
|
717
762
|
),
|
|
718
763
|
a
|
|
719
|
-
] }, "service") : /* @__PURE__ */
|
|
720
|
-
/* @__PURE__ */
|
|
764
|
+
] }, "service") : /* @__PURE__ */ I(te, { children: [
|
|
765
|
+
/* @__PURE__ */ u(
|
|
721
766
|
"world-image",
|
|
722
767
|
{
|
|
723
|
-
onClick:
|
|
768
|
+
onClick: c,
|
|
724
769
|
uri: t.id,
|
|
725
770
|
target: { x: 0, y: 0, width: t.target.spatial.width, height: t.target.spatial.height },
|
|
726
771
|
display: t.width && t.height ? {
|
|
727
772
|
width: t.width,
|
|
728
773
|
height: t.height
|
|
729
774
|
} : void 0,
|
|
730
|
-
crop:
|
|
775
|
+
crop: l
|
|
731
776
|
}
|
|
732
777
|
),
|
|
733
778
|
a
|
|
@@ -736,8 +781,8 @@ function je({
|
|
|
736
781
|
e + (t.service ? "server" : "no-service")
|
|
737
782
|
);
|
|
738
783
|
}
|
|
739
|
-
function
|
|
740
|
-
const { selector: n, source: r } =
|
|
784
|
+
function Be(e, t) {
|
|
785
|
+
const { selector: n, source: r } = ht(t);
|
|
741
786
|
if (r.id !== e.id)
|
|
742
787
|
return [null, r];
|
|
743
788
|
const i = {
|
|
@@ -758,17 +803,17 @@ function qe(e, t) {
|
|
|
758
803
|
r
|
|
759
804
|
];
|
|
760
805
|
}
|
|
761
|
-
const
|
|
806
|
+
const ln = {
|
|
762
807
|
makeChoice: () => {
|
|
763
808
|
}
|
|
764
|
-
}, ce = { type: "unknown" },
|
|
765
|
-
function
|
|
809
|
+
}, ce = { type: "unknown" }, E = (e) => ({ type: "unknown", reason: e, annotations: { pages: [] } }), dn = (e, t) => ({ type: "empty", width: e, height: t, annotations: { pages: [] }, image: null, images: [] });
|
|
810
|
+
function fn(e, t) {
|
|
766
811
|
var r;
|
|
767
812
|
const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
|
|
768
813
|
return n ? n.annotationPageManager : null;
|
|
769
814
|
}
|
|
770
|
-
function
|
|
771
|
-
return
|
|
815
|
+
function hn(e, t) {
|
|
816
|
+
return R(
|
|
772
817
|
(n) => {
|
|
773
818
|
const r = [];
|
|
774
819
|
if (!e)
|
|
@@ -776,7 +821,7 @@ function dn(e, t) {
|
|
|
776
821
|
const i = Object.keys(n.iiif.entities.AnnotationPage);
|
|
777
822
|
for (const o of i)
|
|
778
823
|
if (!t || t.indexOf(o) !== -1) {
|
|
779
|
-
const a =
|
|
824
|
+
const a = fn(n, o);
|
|
780
825
|
a && a.views && a.views[e] && r.push(o);
|
|
781
826
|
}
|
|
782
827
|
return r;
|
|
@@ -784,7 +829,7 @@ function dn(e, t) {
|
|
|
784
829
|
[e, t]
|
|
785
830
|
);
|
|
786
831
|
}
|
|
787
|
-
function
|
|
832
|
+
function gn({
|
|
788
833
|
canvas: e,
|
|
789
834
|
manifest: t,
|
|
790
835
|
all: n,
|
|
@@ -804,21 +849,21 @@ function fn({
|
|
|
804
849
|
i.indexOf(o.id) === -1 && i.push(o.id);
|
|
805
850
|
return i;
|
|
806
851
|
}
|
|
807
|
-
function
|
|
852
|
+
function mn(e, t) {
|
|
808
853
|
var r;
|
|
809
854
|
const n = (r = e == null ? void 0 : e.iiif) == null ? void 0 : r.meta[t];
|
|
810
855
|
return n ? n.annotationPageManager : null;
|
|
811
856
|
}
|
|
812
|
-
function
|
|
813
|
-
const n =
|
|
857
|
+
function vn(e, t = {}) {
|
|
858
|
+
const n = O(), r = K(), i = j(), o = Re(), a = y(() => gn({
|
|
814
859
|
all: t.all,
|
|
815
860
|
manifest: r,
|
|
816
861
|
canvas: i,
|
|
817
862
|
canvases: o
|
|
818
|
-
}), [t.all, i, o, r]), s =
|
|
819
|
-
(
|
|
863
|
+
}), [t.all, i, o, r]), s = hn(e, t.all ? void 0 : a), c = P(
|
|
864
|
+
(l) => {
|
|
820
865
|
e && n.setMetaValue(
|
|
821
|
-
[
|
|
866
|
+
[l, "annotationPageManager", "views"],
|
|
822
867
|
(f) => f && !f[e] ? f : {
|
|
823
868
|
...f || {},
|
|
824
869
|
[e]: !1
|
|
@@ -827,67 +872,67 @@ function gn(e, t = {}) {
|
|
|
827
872
|
},
|
|
828
873
|
[e, n]
|
|
829
874
|
), d = P(
|
|
830
|
-
(
|
|
875
|
+
(l, f = {}) => {
|
|
831
876
|
if (!e)
|
|
832
877
|
return;
|
|
833
|
-
const
|
|
878
|
+
const v = n.getState(), p = [];
|
|
834
879
|
if (f != null && f.deselectOthers) {
|
|
835
|
-
const m = Object.keys(
|
|
880
|
+
const m = Object.keys(v.iiif.entities.AnnotationPage);
|
|
836
881
|
for (const g of m) {
|
|
837
|
-
const w =
|
|
838
|
-
w && w.views && w.views[e] &&
|
|
882
|
+
const w = mn(v, g);
|
|
883
|
+
w && w.views && w.views[e] && p.push(g);
|
|
839
884
|
}
|
|
840
885
|
}
|
|
841
|
-
for (const m of
|
|
842
|
-
|
|
886
|
+
for (const m of p)
|
|
887
|
+
c(m);
|
|
843
888
|
n.setMetaValue(
|
|
844
|
-
[
|
|
889
|
+
[l, "annotationPageManager", "views"],
|
|
845
890
|
(m) => m && m[e] ? m : {
|
|
846
891
|
...m || {},
|
|
847
892
|
[e]: !0
|
|
848
893
|
}
|
|
849
894
|
);
|
|
850
895
|
},
|
|
851
|
-
[e,
|
|
896
|
+
[e, c, n]
|
|
852
897
|
);
|
|
853
898
|
return {
|
|
854
899
|
availablePageIds: a,
|
|
855
900
|
enabledPageIds: s,
|
|
856
901
|
setPageEnabled: d,
|
|
857
|
-
setPageDisabled:
|
|
902
|
+
setPageDisabled: c
|
|
858
903
|
};
|
|
859
904
|
}
|
|
860
|
-
function
|
|
861
|
-
return
|
|
905
|
+
function pn(e, t) {
|
|
906
|
+
return R((n, r) => r.get(e.map((i) => ({ id: i, type: t }))), [e, t]);
|
|
862
907
|
}
|
|
863
|
-
const
|
|
864
|
-
function
|
|
865
|
-
return
|
|
908
|
+
const yn = B.createContext(new gt());
|
|
909
|
+
function je() {
|
|
910
|
+
return T(yn);
|
|
866
911
|
}
|
|
867
|
-
function
|
|
868
|
-
const e =
|
|
912
|
+
function xn() {
|
|
913
|
+
const e = je(), [t, n] = L({}), r = q(!1);
|
|
869
914
|
return N(() => () => {
|
|
870
915
|
r.current = !0;
|
|
871
916
|
}, []), [P(
|
|
872
917
|
(o, { height: a, width: s }) => {
|
|
873
918
|
if (o) {
|
|
874
|
-
const
|
|
875
|
-
id:
|
|
919
|
+
const c = o.id || o["@id"], d = e.loadServiceSync({
|
|
920
|
+
id: c,
|
|
876
921
|
width: o.width || s,
|
|
877
922
|
height: o.height || a,
|
|
878
923
|
source: o
|
|
879
924
|
});
|
|
880
|
-
d ? o = d : t[
|
|
881
|
-
...
|
|
882
|
-
[
|
|
925
|
+
d ? o = d : t[c] || (r.current || n((l) => ({
|
|
926
|
+
...l,
|
|
927
|
+
[c]: "loading"
|
|
883
928
|
})), e.loadService({
|
|
884
|
-
id:
|
|
929
|
+
id: c,
|
|
885
930
|
width: o.width || s,
|
|
886
931
|
height: o.height || a
|
|
887
932
|
}).then(() => {
|
|
888
|
-
r.current || n((
|
|
889
|
-
...
|
|
890
|
-
[
|
|
933
|
+
r.current || n((l) => ({
|
|
934
|
+
...l,
|
|
935
|
+
[c]: "done"
|
|
891
936
|
}));
|
|
892
937
|
}));
|
|
893
938
|
}
|
|
@@ -896,9 +941,9 @@ function vn() {
|
|
|
896
941
|
[e, t]
|
|
897
942
|
), t];
|
|
898
943
|
}
|
|
899
|
-
function
|
|
900
|
-
const t =
|
|
901
|
-
return
|
|
944
|
+
function wn(e = {}) {
|
|
945
|
+
const t = De(), n = j(e.canvasId ? { id: e.canvasId } : void 0);
|
|
946
|
+
return R(
|
|
902
947
|
(r, i) => {
|
|
903
948
|
if (!n)
|
|
904
949
|
return [];
|
|
@@ -912,15 +957,15 @@ function yn(e = {}) {
|
|
|
912
957
|
[n]
|
|
913
958
|
);
|
|
914
959
|
}
|
|
915
|
-
function
|
|
960
|
+
function Sn(e) {
|
|
916
961
|
return e.type === "SpecificResource" ? [e.source, { selector: e.selector }] : [e, { selector: null }];
|
|
917
962
|
}
|
|
918
|
-
const ee = {},
|
|
963
|
+
const ee = {}, He = {
|
|
919
964
|
get(e) {
|
|
920
965
|
return e;
|
|
921
966
|
},
|
|
922
967
|
setMetaValue([e, t, n], r) {
|
|
923
|
-
const i =
|
|
968
|
+
const i = He.getResourceMeta(e, t), o = i ? i[n] : void 0, a = typeof r == "function" ? r(o) : r;
|
|
924
969
|
ee[e] = {
|
|
925
970
|
...ee[e] || {},
|
|
926
971
|
[t]: {
|
|
@@ -935,44 +980,44 @@ const ee = {}, Be = {
|
|
|
935
980
|
return t ? n[t] : n;
|
|
936
981
|
}
|
|
937
982
|
};
|
|
938
|
-
function
|
|
983
|
+
function Pn(e = He) {
|
|
939
984
|
function t(i) {
|
|
940
985
|
const o = i ? typeof i == "string" ? e.get(i) : i : null;
|
|
941
986
|
if (!o)
|
|
942
987
|
return [];
|
|
943
988
|
const a = e.get(o.items, { parent: o }), s = [];
|
|
944
|
-
for (const
|
|
945
|
-
s.push(...e.get(
|
|
989
|
+
for (const c of a)
|
|
990
|
+
s.push(...e.get(c.items, { parent: c }));
|
|
946
991
|
return s;
|
|
947
992
|
}
|
|
948
993
|
function n(i, o = []) {
|
|
949
994
|
const a = Array.isArray(i) ? i : t(i), s = [];
|
|
950
|
-
let
|
|
995
|
+
let c = null;
|
|
951
996
|
const d = [];
|
|
952
|
-
for (const
|
|
953
|
-
if (
|
|
997
|
+
for (const l of a) {
|
|
998
|
+
if (l.type !== "Annotation")
|
|
954
999
|
throw new Error("getPaintables() accept either a canvas or list of annotations");
|
|
955
|
-
const f = Array.from(Array.isArray(
|
|
956
|
-
for (const
|
|
957
|
-
const [
|
|
1000
|
+
const f = Array.from(Array.isArray(l.body) ? l.body : [l.body]);
|
|
1001
|
+
for (const v of f) {
|
|
1002
|
+
const [p, { selector: m }] = Sn(v), g = e.get(p), w = (g.type || "unknown").toLowerCase();
|
|
958
1003
|
if (w === "choice") {
|
|
959
|
-
const x = e.get(g.items, { parent: g.id }),
|
|
960
|
-
|
|
1004
|
+
const x = e.get(g.items, { parent: g.id }), M = o.length ? o.map((b) => x.find((W) => W.id === b)).filter(Boolean) : [x[0]];
|
|
1005
|
+
M.length === 0 && M.push(x[0]), c = {
|
|
961
1006
|
type: "single-choice",
|
|
962
1007
|
items: x.map((b) => ({
|
|
963
1008
|
id: b.id,
|
|
964
1009
|
label: b.label,
|
|
965
|
-
selected:
|
|
1010
|
+
selected: M.indexOf(b) !== -1
|
|
966
1011
|
})),
|
|
967
|
-
label:
|
|
968
|
-
}, f.push(...
|
|
1012
|
+
label: p.label
|
|
1013
|
+
}, f.push(...M);
|
|
969
1014
|
continue;
|
|
970
1015
|
}
|
|
971
1016
|
s.indexOf(w) === -1 && s.push(w), d.push({
|
|
972
1017
|
type: w,
|
|
973
|
-
annotationId:
|
|
1018
|
+
annotationId: l.id,
|
|
974
1019
|
resource: g,
|
|
975
|
-
target:
|
|
1020
|
+
target: l.target,
|
|
976
1021
|
selector: m
|
|
977
1022
|
});
|
|
978
1023
|
}
|
|
@@ -980,7 +1025,7 @@ function wn(e = Be) {
|
|
|
980
1025
|
return {
|
|
981
1026
|
types: s,
|
|
982
1027
|
items: d,
|
|
983
|
-
choice:
|
|
1028
|
+
choice: c
|
|
984
1029
|
};
|
|
985
1030
|
}
|
|
986
1031
|
function r(i) {
|
|
@@ -993,18 +1038,18 @@ function wn(e = Be) {
|
|
|
993
1038
|
extractChoices: r
|
|
994
1039
|
};
|
|
995
1040
|
}
|
|
996
|
-
function
|
|
997
|
-
const n =
|
|
1041
|
+
function bn(e, t = []) {
|
|
1042
|
+
const n = O(), r = y(() => Pn(n), []), i = wn({ enableSingleAnnotation: e == null ? void 0 : e.enableSingleAnnotation }), [o, a] = L((e == null ? void 0 : e.defaultChoices) || []), s = y(
|
|
998
1043
|
() => r.getPaintables(i, o),
|
|
999
1044
|
[n, i, o, ...t]
|
|
1000
1045
|
), d = { makeChoice: P(
|
|
1001
|
-
(
|
|
1046
|
+
(l, { deselectOthers: f = !0, deselect: v = !1 } = {}) => {
|
|
1002
1047
|
if (s.choice) {
|
|
1003
1048
|
if (s.choice.type !== "single-choice")
|
|
1004
1049
|
throw new Error("Complex choice not supported yet");
|
|
1005
|
-
a((
|
|
1006
|
-
if (
|
|
1007
|
-
const g =
|
|
1050
|
+
a((p) => {
|
|
1051
|
+
if (v) {
|
|
1052
|
+
const g = p.filter((w) => w !== l);
|
|
1008
1053
|
if (g.length === 0) {
|
|
1009
1054
|
const w = s.items[0].resource.id;
|
|
1010
1055
|
return w ? [w] : [];
|
|
@@ -1012,13 +1057,13 @@ function Sn(e, t = []) {
|
|
|
1012
1057
|
return g;
|
|
1013
1058
|
}
|
|
1014
1059
|
if (f)
|
|
1015
|
-
return [
|
|
1016
|
-
const m = [...
|
|
1060
|
+
return [l];
|
|
1061
|
+
const m = [...p];
|
|
1017
1062
|
if (m.length === 0 && s.items.length) {
|
|
1018
1063
|
const g = s.items[0].resource.id;
|
|
1019
1064
|
g && m.push(g);
|
|
1020
1065
|
}
|
|
1021
|
-
return
|
|
1066
|
+
return p.indexOf(l) !== -1 ? p : [...p, l];
|
|
1022
1067
|
});
|
|
1023
1068
|
}
|
|
1024
1069
|
},
|
|
@@ -1026,20 +1071,20 @@ function Sn(e, t = []) {
|
|
|
1026
1071
|
) };
|
|
1027
1072
|
return [s, d];
|
|
1028
1073
|
}
|
|
1029
|
-
const
|
|
1030
|
-
function
|
|
1074
|
+
const Cn = ["model/gltf-binary"];
|
|
1075
|
+
function En(e, t) {
|
|
1031
1076
|
const r = t.items[0].resource;
|
|
1032
|
-
return r.format ?
|
|
1077
|
+
return r.format ? Cn.indexOf(r.format) === -1 ? E(`3D format: ${r.format} is unsupported`) : {
|
|
1033
1078
|
type: "3d-model",
|
|
1034
1079
|
model: r
|
|
1035
|
-
} :
|
|
1080
|
+
} : E("Unknown format");
|
|
1036
1081
|
}
|
|
1037
|
-
function
|
|
1082
|
+
function In(e, t) {
|
|
1038
1083
|
var r;
|
|
1039
1084
|
if (!e.duration)
|
|
1040
|
-
return
|
|
1085
|
+
return E("No duration on canvas");
|
|
1041
1086
|
if (t.items.length > 1)
|
|
1042
|
-
return
|
|
1087
|
+
return E("Only one audio source supported");
|
|
1043
1088
|
const n = (r = t.items[0]) == null ? void 0 : r.resource;
|
|
1044
1089
|
return n ? n.format ? {
|
|
1045
1090
|
type: "media",
|
|
@@ -1067,18 +1112,18 @@ function En(e, t) {
|
|
|
1067
1112
|
annotations: {
|
|
1068
1113
|
pages: []
|
|
1069
1114
|
}
|
|
1070
|
-
} :
|
|
1115
|
+
} : E("Audio does not have format") : E("Unknown audio");
|
|
1071
1116
|
}
|
|
1072
|
-
function
|
|
1117
|
+
function Mn(e, t, n) {
|
|
1073
1118
|
const r = [];
|
|
1074
1119
|
for (const i of t.items) {
|
|
1075
1120
|
const o = i.resource && i.resource.type === "SpecificResource" ? i.resource.source : i.resource;
|
|
1076
1121
|
if (!o.id)
|
|
1077
|
-
return
|
|
1122
|
+
return E("No resource Identifier");
|
|
1078
1123
|
let a;
|
|
1079
1124
|
if (o.service) {
|
|
1080
|
-
const
|
|
1081
|
-
|
|
1125
|
+
const p = mt(o);
|
|
1126
|
+
p[0] && (a = n(p[0], e));
|
|
1082
1127
|
}
|
|
1083
1128
|
const s = {
|
|
1084
1129
|
type: "BoxSelector",
|
|
@@ -1088,41 +1133,41 @@ function Cn(e, t, n) {
|
|
|
1088
1133
|
width: Number(e.width),
|
|
1089
1134
|
height: Number(e.height)
|
|
1090
1135
|
}
|
|
1091
|
-
}, [
|
|
1092
|
-
if (d.id
|
|
1136
|
+
}, [c, d] = Be(e, i.target);
|
|
1137
|
+
if (!(d.id === e.id || decodeURIComponent(d.id || "") === (e.id || "")))
|
|
1093
1138
|
continue;
|
|
1094
1139
|
i.resource.width && i.resource.height && (i.resource.width, i.resource.height);
|
|
1095
|
-
let
|
|
1140
|
+
let l = i.resource.type === "SpecificResource" ? le(i.resource) : null;
|
|
1096
1141
|
if (i.selector) {
|
|
1097
|
-
const
|
|
1142
|
+
const p = le({
|
|
1098
1143
|
type: "SpecificResource",
|
|
1099
1144
|
source: i.resource,
|
|
1100
1145
|
selector: i.selector
|
|
1101
1146
|
});
|
|
1102
|
-
|
|
1147
|
+
p && (l = p);
|
|
1103
1148
|
}
|
|
1104
|
-
const f =
|
|
1149
|
+
const f = l && l.selector && (l.selector.type === "BoxSelector" || l.selector.type === "TemporalBoxSelector") ? {
|
|
1105
1150
|
type: "BoxSelector",
|
|
1106
1151
|
spatial: {
|
|
1107
|
-
x:
|
|
1108
|
-
y:
|
|
1109
|
-
width:
|
|
1110
|
-
height:
|
|
1152
|
+
x: l.selector.spatial.x,
|
|
1153
|
+
y: l.selector.spatial.y,
|
|
1154
|
+
width: l.selector.spatial.width,
|
|
1155
|
+
height: l.selector.spatial.height
|
|
1111
1156
|
}
|
|
1112
1157
|
} : void 0;
|
|
1113
1158
|
a && !a.id && (a.id = a["@id"]);
|
|
1114
|
-
const
|
|
1159
|
+
const v = {
|
|
1115
1160
|
id: o.id,
|
|
1116
1161
|
type: "Image",
|
|
1117
1162
|
annotationId: i.annotationId,
|
|
1118
|
-
width: Number(
|
|
1119
|
-
height: Number(
|
|
1163
|
+
width: Number(c || f ? o.width : e.width),
|
|
1164
|
+
height: Number(c || f ? o.height : e.height),
|
|
1120
1165
|
service: a,
|
|
1121
1166
|
sizes: a && a.sizes ? a.sizes : o.width && o.height ? [{ width: o.width, height: o.height }] : [],
|
|
1122
|
-
target:
|
|
1167
|
+
target: c && c.type !== "PointSelector" ? c : s,
|
|
1123
1168
|
selector: f
|
|
1124
1169
|
};
|
|
1125
|
-
r.push(
|
|
1170
|
+
r.push(v);
|
|
1126
1171
|
}
|
|
1127
1172
|
return {
|
|
1128
1173
|
type: "images",
|
|
@@ -1131,7 +1176,7 @@ function Cn(e, t, n) {
|
|
|
1131
1176
|
choice: t.choice
|
|
1132
1177
|
};
|
|
1133
1178
|
}
|
|
1134
|
-
function
|
|
1179
|
+
function $e(e, t = {}, n) {
|
|
1135
1180
|
const r = e.language || n || "none";
|
|
1136
1181
|
switch (e.type) {
|
|
1137
1182
|
case "TextualBody": {
|
|
@@ -1141,7 +1186,7 @@ function He(e, t = {}, n) {
|
|
|
1141
1186
|
case "List":
|
|
1142
1187
|
case "Composite":
|
|
1143
1188
|
case "Choice":
|
|
1144
|
-
e.items && e.items.forEach((i) =>
|
|
1189
|
+
e.items && e.items.forEach((i) => $e(i, t, r));
|
|
1145
1190
|
}
|
|
1146
1191
|
return t;
|
|
1147
1192
|
}
|
|
@@ -1149,30 +1194,30 @@ function An(e, t) {
|
|
|
1149
1194
|
const n = [];
|
|
1150
1195
|
return t.items.forEach((r) => {
|
|
1151
1196
|
if (r.resource) {
|
|
1152
|
-
const [i] =
|
|
1153
|
-
n.push({ annotationId: r.annotationId, text:
|
|
1197
|
+
const [i] = Be(e, r.target);
|
|
1198
|
+
n.push({ annotationId: r.annotationId, text: $e(r.resource), target: i });
|
|
1154
1199
|
}
|
|
1155
1200
|
}), {
|
|
1156
1201
|
type: "textual-content",
|
|
1157
1202
|
items: n
|
|
1158
1203
|
};
|
|
1159
1204
|
}
|
|
1160
|
-
const
|
|
1161
|
-
function
|
|
1205
|
+
const Tn = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
|
|
1206
|
+
function Rn(e, t) {
|
|
1162
1207
|
var s;
|
|
1163
|
-
const n = t.items.filter((
|
|
1208
|
+
const n = t.items.filter((c) => c.type === "video");
|
|
1164
1209
|
let r = !1;
|
|
1165
1210
|
if (e.duration || (r = !0), n.length > 1)
|
|
1166
|
-
return
|
|
1211
|
+
return E("Only one video source supported");
|
|
1167
1212
|
const i = (s = n[0]) == null ? void 0 : s.resource, o = !!(i.service || []).find(
|
|
1168
|
-
(
|
|
1213
|
+
(c) => (c.profile || "").includes("youtube.com")
|
|
1169
1214
|
);
|
|
1170
1215
|
if (!o && r)
|
|
1171
|
-
return
|
|
1216
|
+
return E("Video does not have duration");
|
|
1172
1217
|
if (!i)
|
|
1173
|
-
return
|
|
1218
|
+
return E("Unknown video");
|
|
1174
1219
|
if ((!i.format || i.format === "text/html") && !o)
|
|
1175
|
-
return
|
|
1220
|
+
return E("Video does not have format");
|
|
1176
1221
|
const a = {
|
|
1177
1222
|
annotationId: t.items[0].annotationId,
|
|
1178
1223
|
duration: e.duration,
|
|
@@ -1197,10 +1242,10 @@ function Mn(e, t) {
|
|
|
1197
1242
|
};
|
|
1198
1243
|
if (o) {
|
|
1199
1244
|
a.type = "VideoYouTube";
|
|
1200
|
-
const
|
|
1201
|
-
if (!
|
|
1202
|
-
return
|
|
1203
|
-
a.youTubeId =
|
|
1245
|
+
const c = i.id.match(Tn);
|
|
1246
|
+
if (!c[1])
|
|
1247
|
+
return E("Video is not known youtube video");
|
|
1248
|
+
a.youTubeId = c[1];
|
|
1204
1249
|
}
|
|
1205
1250
|
return {
|
|
1206
1251
|
type: "media",
|
|
@@ -1210,62 +1255,62 @@ function Mn(e, t) {
|
|
|
1210
1255
|
}
|
|
1211
1256
|
};
|
|
1212
1257
|
}
|
|
1213
|
-
function
|
|
1258
|
+
function Vn({ canvas: e, paintables: t, supports: n, loadImageService: r }) {
|
|
1214
1259
|
if (!e)
|
|
1215
1260
|
return console.log("No canvas"), ce;
|
|
1216
1261
|
if (t.types.length === 0)
|
|
1217
|
-
return n.indexOf("empty") !== -1 ?
|
|
1262
|
+
return n.indexOf("empty") !== -1 ? dn(e.width, e.height) : (console.log("No paintables"), ce);
|
|
1218
1263
|
if (t.types.length !== 1)
|
|
1219
1264
|
if (t.types.length === 2 && t.types.indexOf("text") !== -1)
|
|
1220
1265
|
t.types = t.types.filter((o) => o !== "text");
|
|
1221
1266
|
else
|
|
1222
|
-
return n.indexOf("complex-timeline") === -1 ?
|
|
1267
|
+
return n.indexOf("complex-timeline") === -1 ? E("Complex timeline not supported") : E("ComplexTimelineStrategy not yet supported");
|
|
1223
1268
|
const i = t.types[0];
|
|
1224
|
-
return i === "image" ? n.indexOf("images") === -1 ?
|
|
1269
|
+
return i === "image" ? n.indexOf("images") === -1 ? E("Image not supported") : Mn(e, t, r) : i === "Model" || i === "model" ? n.indexOf("3d-model") === -1 ? E("3D not supported") : En(e, t) : i === "textualbody" ? n.indexOf("textual-content") === -1 ? E("Textual content not supported") : An(e, t) : i === "sound" || i === "audio" ? n.indexOf("media") === -1 ? E("Media not supported") : In(e, t) : i === "video" ? n.indexOf("media") === -1 ? E("Media not supported") : Rn(e, t) : ce;
|
|
1225
1270
|
}
|
|
1226
|
-
function
|
|
1227
|
-
const t = K(), n =
|
|
1271
|
+
function On(e) {
|
|
1272
|
+
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), {
|
|
1228
1273
|
all: !1
|
|
1229
|
-
}), s =
|
|
1274
|
+
}), s = pn(a, "AnnotationPage"), c = (e == null ? void 0 : e.strategies) || [
|
|
1230
1275
|
"empty",
|
|
1231
1276
|
"images",
|
|
1232
1277
|
"media",
|
|
1233
1278
|
"textual-content",
|
|
1234
1279
|
"complex-timeline"
|
|
1235
|
-
], [d,
|
|
1236
|
-
return y(() => f.type === "unknown" ? [f,
|
|
1280
|
+
], [d, l] = bn(e, [o]), f = y(() => Vn({ canvas: n, paintables: d, supports: c, loadImageService: i }), [n, d, r, l.makeChoice]);
|
|
1281
|
+
return y(() => f.type === "unknown" ? [f, ln] : [
|
|
1237
1282
|
{
|
|
1238
1283
|
...f,
|
|
1239
1284
|
annotations: { pages: s }
|
|
1240
1285
|
},
|
|
1241
|
-
|
|
1286
|
+
l
|
|
1242
1287
|
], [f, s]);
|
|
1243
1288
|
}
|
|
1244
|
-
const
|
|
1245
|
-
const n =
|
|
1289
|
+
const Ln = (e, t = []) => {
|
|
1290
|
+
const n = O();
|
|
1246
1291
|
N(() => {
|
|
1247
1292
|
e(n);
|
|
1248
1293
|
}, [n, ...t]);
|
|
1249
1294
|
};
|
|
1250
|
-
function
|
|
1251
|
-
const i =
|
|
1252
|
-
if (N(() => (
|
|
1253
|
-
|
|
1295
|
+
function kn(e, t, { canvasId: n, manifestId: r } = {}) {
|
|
1296
|
+
const i = O(), o = je(), a = y(() => 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, v = q(!1);
|
|
1297
|
+
if (N(() => (v.current = !1, () => {
|
|
1298
|
+
v.current = !0;
|
|
1254
1299
|
}), []), !f)
|
|
1255
1300
|
throw new Error("Must be called under a manifest or canvas context.");
|
|
1256
|
-
return
|
|
1257
|
-
(
|
|
1301
|
+
return Ln(
|
|
1302
|
+
(p) => {
|
|
1258
1303
|
a.getBestThumbnailAtSize(f, e, t).then((m) => {
|
|
1259
|
-
m.best && !
|
|
1304
|
+
m.best && !v.current && c(m.best);
|
|
1260
1305
|
});
|
|
1261
1306
|
},
|
|
1262
1307
|
[f]
|
|
1263
1308
|
), s;
|
|
1264
1309
|
}
|
|
1265
|
-
function
|
|
1310
|
+
function Nn(e) {
|
|
1266
1311
|
return { isMuted: !1, playRequested: !1, isPlaying: !1, isFinished: !1, volume: 100, duration: e };
|
|
1267
1312
|
}
|
|
1268
|
-
function
|
|
1313
|
+
function Fn(e, t) {
|
|
1269
1314
|
switch (t.type) {
|
|
1270
1315
|
case "FINISHED":
|
|
1271
1316
|
return { ...e, isFinished: !0, isPlaying: !1, playRequested: !1 };
|
|
@@ -1288,26 +1333,26 @@ function kn(e, t) {
|
|
|
1288
1333
|
}
|
|
1289
1334
|
return e;
|
|
1290
1335
|
}
|
|
1291
|
-
function
|
|
1336
|
+
function Un(e) {
|
|
1292
1337
|
const t = Math.round(e);
|
|
1293
1338
|
return `${Math.floor(t / 60)}:${`${t % 60}`.padStart(2, "0")}`;
|
|
1294
1339
|
}
|
|
1295
1340
|
function pe(e) {
|
|
1296
|
-
const [t, n] =
|
|
1297
|
-
i.current && r.current && (i.current.innerHTML =
|
|
1298
|
-
}, [e.duration]),
|
|
1341
|
+
const [t, n] = ot(Fn, Nn(e.duration)), r = q(null), i = q(null), o = q(null), a = q(!1), s = P(() => {
|
|
1342
|
+
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 = P(() => {
|
|
1299
1344
|
r.current && (n({ type: "PLAY_REQUESTED" }), r.current.play().then(() => {
|
|
1300
1345
|
n({ type: "PLAY" });
|
|
1301
1346
|
}), s());
|
|
1302
1347
|
}, [s]), d = P(() => {
|
|
1303
|
-
r.current && (r.current.duration > 0 && r.current.paused ?
|
|
1304
|
-
}, [s]),
|
|
1348
|
+
r.current && (r.current.duration > 0 && r.current.paused ? c() : l());
|
|
1349
|
+
}, [s]), l = P(() => {
|
|
1305
1350
|
r.current && (r.current.pause(), n({ type: "PAUSE" }), s());
|
|
1306
1351
|
}, [s]), f = P(() => {
|
|
1307
1352
|
r.current && (r.current.muted = !r.current.muted, n(r.current.muted ? { type: "MUTE" } : { type: "UNMUTE" }));
|
|
1308
|
-
}, []), p = P(() => {
|
|
1309
|
-
r.current && (r.current.muted = !0, n({ type: "MUTE" }));
|
|
1310
1353
|
}, []), v = P(() => {
|
|
1354
|
+
r.current && (r.current.muted = !0, n({ type: "MUTE" }));
|
|
1355
|
+
}, []), p = P(() => {
|
|
1311
1356
|
r.current && (r.current.muted = !1, n({ type: "UNMUTE" }));
|
|
1312
1357
|
}, []), m = P((x) => {
|
|
1313
1358
|
r.current && (r.current.muted = !1, r.current.volume = x / 100, n({ type: "SET_VOLUME", volume: x }));
|
|
@@ -1324,17 +1369,17 @@ function pe(e) {
|
|
|
1324
1369
|
}, [s, e.duration]), N(() => {
|
|
1325
1370
|
const x = () => {
|
|
1326
1371
|
n({ type: "FINISHED" });
|
|
1327
|
-
},
|
|
1328
|
-
return
|
|
1372
|
+
}, M = r.current;
|
|
1373
|
+
return M == null || M.addEventListener("ended", x), () => M == null ? void 0 : M.removeEventListener("ended", x);
|
|
1329
1374
|
}, []), [
|
|
1330
1375
|
{ element: r, currentTime: i, progress: o },
|
|
1331
1376
|
t,
|
|
1332
1377
|
{
|
|
1333
|
-
play:
|
|
1334
|
-
pause:
|
|
1378
|
+
play: c,
|
|
1379
|
+
pause: l,
|
|
1335
1380
|
playPause: d,
|
|
1336
|
-
mute:
|
|
1337
|
-
unmute:
|
|
1381
|
+
mute: v,
|
|
1382
|
+
unmute: p,
|
|
1338
1383
|
toggleMute: f,
|
|
1339
1384
|
setVolume: m,
|
|
1340
1385
|
setDurationPercent: g,
|
|
@@ -1342,7 +1387,7 @@ function pe(e) {
|
|
|
1342
1387
|
}
|
|
1343
1388
|
];
|
|
1344
1389
|
}
|
|
1345
|
-
const
|
|
1390
|
+
const Dn = F(null), _n = F(null), qn = F(null);
|
|
1346
1391
|
function Ye({
|
|
1347
1392
|
actions: e,
|
|
1348
1393
|
state: t,
|
|
@@ -1351,11 +1396,11 @@ function Ye({
|
|
|
1351
1396
|
progress: i,
|
|
1352
1397
|
element: o
|
|
1353
1398
|
}) {
|
|
1354
|
-
return /* @__PURE__ */
|
|
1399
|
+
return /* @__PURE__ */ u(qn.Provider, { value: { currentTime: r, progress: i, element: o }, children: /* @__PURE__ */ u(_n.Provider, { value: e, children: /* @__PURE__ */ u(Dn.Provider, { value: t, children: n }) }) });
|
|
1355
1400
|
}
|
|
1356
1401
|
function ze({ media: e, children: t }) {
|
|
1357
1402
|
const [{ element: n, currentTime: r, progress: i }, o, a] = pe({ duration: e.duration });
|
|
1358
|
-
return /* @__PURE__ */
|
|
1403
|
+
return /* @__PURE__ */ I(
|
|
1359
1404
|
Ye,
|
|
1360
1405
|
{
|
|
1361
1406
|
state: o,
|
|
@@ -1364,7 +1409,7 @@ function ze({ media: e, children: t }) {
|
|
|
1364
1409
|
progress: i,
|
|
1365
1410
|
element: n,
|
|
1366
1411
|
children: [
|
|
1367
|
-
/* @__PURE__ */
|
|
1412
|
+
/* @__PURE__ */ u("audio", { ref: n, src: e.url }),
|
|
1368
1413
|
t
|
|
1369
1414
|
]
|
|
1370
1415
|
}
|
|
@@ -1382,8 +1427,8 @@ function We({
|
|
|
1382
1427
|
media: t,
|
|
1383
1428
|
playPause: n
|
|
1384
1429
|
}) {
|
|
1385
|
-
return /* @__PURE__ */
|
|
1386
|
-
/* @__PURE__ */
|
|
1430
|
+
return /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
|
|
1431
|
+
/* @__PURE__ */ u("style", { children: `
|
|
1387
1432
|
.video-container {
|
|
1388
1433
|
position: absolute;
|
|
1389
1434
|
top: 0;
|
|
@@ -1397,7 +1442,7 @@ function We({
|
|
|
1397
1442
|
pointer-events: visible;
|
|
1398
1443
|
}
|
|
1399
1444
|
` }),
|
|
1400
|
-
/* @__PURE__ */
|
|
1445
|
+
/* @__PURE__ */ u("video", { ref: e, src: t.url, style: { width: "100%", objectFit: "contain" } })
|
|
1401
1446
|
] });
|
|
1402
1447
|
}
|
|
1403
1448
|
function Ge({
|
|
@@ -1426,8 +1471,8 @@ function Ge({
|
|
|
1426
1471
|
), null;
|
|
1427
1472
|
}
|
|
1428
1473
|
function Qe({ model: e }) {
|
|
1429
|
-
return /* @__PURE__ */
|
|
1430
|
-
/* @__PURE__ */
|
|
1474
|
+
return /* @__PURE__ */ I($, { children: [
|
|
1475
|
+
/* @__PURE__ */ u("style", { children: `
|
|
1431
1476
|
.model-container {
|
|
1432
1477
|
position: absolute;
|
|
1433
1478
|
top: 0;
|
|
@@ -1441,7 +1486,7 @@ function Qe({ model: e }) {
|
|
|
1441
1486
|
pointer-events: visible;
|
|
1442
1487
|
}
|
|
1443
1488
|
` }),
|
|
1444
|
-
/* @__PURE__ */
|
|
1489
|
+
/* @__PURE__ */ u("div", { className: "model-container", children: /* @__PURE__ */ u(
|
|
1445
1490
|
"model-viewer",
|
|
1446
1491
|
{
|
|
1447
1492
|
"interaction-prompt": "none",
|
|
@@ -1457,8 +1502,8 @@ function Je({ model: e, name: t }) {
|
|
|
1457
1502
|
return Y("overlay", `model-${t}`, Qe, { model: e }, [e]), null;
|
|
1458
1503
|
}
|
|
1459
1504
|
function Ze({ style: e }) {
|
|
1460
|
-
const t =
|
|
1461
|
-
return !t || !t.height || !t.width ? null : /* @__PURE__ */
|
|
1505
|
+
const t = j();
|
|
1506
|
+
return !t || !t.height || !t.width ? null : /* @__PURE__ */ u(
|
|
1462
1507
|
"box",
|
|
1463
1508
|
{
|
|
1464
1509
|
interactive: !1,
|
|
@@ -1467,18 +1512,18 @@ function Ze({ style: e }) {
|
|
|
1467
1512
|
}
|
|
1468
1513
|
);
|
|
1469
1514
|
}
|
|
1470
|
-
const
|
|
1515
|
+
const Bn = B.createContext("en");
|
|
1471
1516
|
function Xe() {
|
|
1472
|
-
return
|
|
1517
|
+
return B.useContext(Bn);
|
|
1473
1518
|
}
|
|
1474
1519
|
function Ee(e) {
|
|
1475
1520
|
return e.indexOf("-") !== -1 ? e.slice(0, e.indexOf("-")) : e;
|
|
1476
1521
|
}
|
|
1477
1522
|
function jn({ as: e, language: t, children: n, viewingDirection: r, ...i }) {
|
|
1478
1523
|
const o = Xe();
|
|
1479
|
-
return y(() => Ee(o) === Ee(t), [o, t]) ? e ? /* @__PURE__ */
|
|
1524
|
+
return y(() => 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 });
|
|
1480
1525
|
}
|
|
1481
|
-
function
|
|
1526
|
+
function Hn(e, t, n) {
|
|
1482
1527
|
if (t.length === 0)
|
|
1483
1528
|
return;
|
|
1484
1529
|
if (t.length === 1)
|
|
@@ -1497,58 +1542,65 @@ const $n = (e, t = []) => {
|
|
|
1497
1542
|
const n = Xe();
|
|
1498
1543
|
return y(() => {
|
|
1499
1544
|
const r = e();
|
|
1500
|
-
return
|
|
1545
|
+
return Hn(n, r, []);
|
|
1501
1546
|
}, [n, ...t]);
|
|
1502
1547
|
};
|
|
1503
|
-
function
|
|
1504
|
-
|
|
1548
|
+
function Yn(e, t, n = `
|
|
1549
|
+
`) {
|
|
1550
|
+
const r = $n(() => Object.keys(e || {}), [e]);
|
|
1505
1551
|
return [
|
|
1506
1552
|
y(() => {
|
|
1507
1553
|
if (!e)
|
|
1508
1554
|
return t || "";
|
|
1509
1555
|
if (typeof e == "string")
|
|
1510
1556
|
return e;
|
|
1511
|
-
const
|
|
1512
|
-
return
|
|
1513
|
-
|
|
1514
|
-
|
|
1515
|
-
n
|
|
1557
|
+
const i = r ? e[r] : void 0;
|
|
1558
|
+
return i ? typeof i == "string" ? i : i.join(n) : "";
|
|
1559
|
+
}, [r, t, e]),
|
|
1560
|
+
r
|
|
1516
1561
|
];
|
|
1517
1562
|
}
|
|
1518
|
-
|
|
1519
|
-
|
|
1520
|
-
|
|
1563
|
+
function zn({
|
|
1564
|
+
as: e,
|
|
1565
|
+
defaultText: t,
|
|
1566
|
+
enableDangerouslySetInnerHTML: n,
|
|
1567
|
+
children: r,
|
|
1568
|
+
separator: i,
|
|
1569
|
+
...o
|
|
1570
|
+
}) {
|
|
1571
|
+
const [a, s] = Yn(r, t, i);
|
|
1572
|
+
return s ? /* @__PURE__ */ u(
|
|
1521
1573
|
jn,
|
|
1522
1574
|
{
|
|
1523
|
-
...
|
|
1575
|
+
...o,
|
|
1524
1576
|
as: e,
|
|
1525
|
-
language:
|
|
1526
|
-
title: n ? void 0 :
|
|
1577
|
+
language: s,
|
|
1578
|
+
title: n ? void 0 : a,
|
|
1527
1579
|
dangerouslySetInnerHTML: n ? {
|
|
1528
|
-
__html:
|
|
1580
|
+
__html: a
|
|
1529
1581
|
} : void 0,
|
|
1530
|
-
children: n ? void 0 :
|
|
1582
|
+
children: n ? void 0 : a
|
|
1531
1583
|
}
|
|
1532
|
-
) : e ? /* @__PURE__ */
|
|
1584
|
+
) : e ? /* @__PURE__ */ u(e, { ...o, children: a }) : /* @__PURE__ */ u(
|
|
1533
1585
|
"span",
|
|
1534
1586
|
{
|
|
1535
|
-
...
|
|
1536
|
-
title: n ? void 0 :
|
|
1587
|
+
...o,
|
|
1588
|
+
title: n ? void 0 : a,
|
|
1537
1589
|
dangerouslySetInnerHTML: n ? {
|
|
1538
|
-
__html:
|
|
1590
|
+
__html: a
|
|
1539
1591
|
} : void 0,
|
|
1540
|
-
children: n ? void 0 :
|
|
1592
|
+
children: n ? void 0 : a
|
|
1541
1593
|
}
|
|
1542
1594
|
);
|
|
1543
|
-
}
|
|
1544
|
-
function
|
|
1595
|
+
}
|
|
1596
|
+
function Kn({
|
|
1545
1597
|
element: e,
|
|
1546
1598
|
media: t,
|
|
1547
1599
|
playPause: n
|
|
1548
1600
|
}) {
|
|
1549
|
-
const r =
|
|
1550
|
-
return t.youTubeId ? /* @__PURE__ */
|
|
1551
|
-
/* @__PURE__ */
|
|
1601
|
+
const r = q(null);
|
|
1602
|
+
return t.youTubeId ? /* @__PURE__ */ I("div", { className: "video-container", part: "video-container", onClick: n, children: [
|
|
1603
|
+
/* @__PURE__ */ u("style", { children: `
|
|
1552
1604
|
.video-container {
|
|
1553
1605
|
position: absolute;
|
|
1554
1606
|
top: 0;
|
|
@@ -1567,7 +1619,7 @@ function Yn({
|
|
|
1567
1619
|
object-fit: contain;
|
|
1568
1620
|
}
|
|
1569
1621
|
` }),
|
|
1570
|
-
/* @__PURE__ */
|
|
1622
|
+
/* @__PURE__ */ u(
|
|
1571
1623
|
"iframe",
|
|
1572
1624
|
{
|
|
1573
1625
|
className: "video-yt",
|
|
@@ -1579,13 +1631,13 @@ function Yn({
|
|
|
1579
1631
|
)
|
|
1580
1632
|
] }) : null;
|
|
1581
1633
|
}
|
|
1582
|
-
function
|
|
1634
|
+
function Wn({
|
|
1583
1635
|
media: e,
|
|
1584
1636
|
mediaControlsDeps: t,
|
|
1585
1637
|
children: n
|
|
1586
1638
|
}) {
|
|
1587
1639
|
const [{ element: r, currentTime: i, progress: o }, a, s] = pe({ duration: e.duration });
|
|
1588
|
-
return Y("overlay", "video-element",
|
|
1640
|
+
return Y("overlay", "video-element", Kn, {
|
|
1589
1641
|
element: r,
|
|
1590
1642
|
media: e,
|
|
1591
1643
|
playPause: s.playPause
|
|
@@ -1600,29 +1652,29 @@ function et({
|
|
|
1600
1652
|
isStatic: o,
|
|
1601
1653
|
renderViewerControls: a,
|
|
1602
1654
|
renderMediaControls: s,
|
|
1603
|
-
viewControlsDeps:
|
|
1655
|
+
viewControlsDeps: c,
|
|
1604
1656
|
mediaControlsDeps: d,
|
|
1605
|
-
strategies:
|
|
1657
|
+
strategies: l,
|
|
1606
1658
|
throwOnUnknown: f,
|
|
1607
|
-
backgroundStyle:
|
|
1608
|
-
alwaysShowBackground:
|
|
1659
|
+
backgroundStyle: v,
|
|
1660
|
+
alwaysShowBackground: p,
|
|
1609
1661
|
keepCanvasScale: m = !1,
|
|
1610
1662
|
enableSizes: g = !1,
|
|
1611
1663
|
enableYouTube: w = !0,
|
|
1612
1664
|
onClickPaintingAnnotation: x,
|
|
1613
|
-
children:
|
|
1665
|
+
children: M
|
|
1614
1666
|
}) {
|
|
1615
|
-
const b =
|
|
1616
|
-
strategies:
|
|
1667
|
+
const b = j(), W = Ue(b, ["deep-zoom"]), [Z] = tn(), C = on(), A = O(), k = y(() => Te(A), [A]), [h, D] = On({
|
|
1668
|
+
strategies: l || ["images"],
|
|
1617
1669
|
defaultChoices: i == null ? void 0 : i.map(({ id: S }) => S)
|
|
1618
|
-
}),
|
|
1670
|
+
}), ye = h.type === "images" ? h.choice : void 0, tt = y(() => m ? 1 : Math.max(
|
|
1619
1671
|
1,
|
|
1620
1672
|
...h.type === "images" ? h.images.map((S) => {
|
|
1621
|
-
var
|
|
1622
|
-
return (S.width || 0) / ((
|
|
1673
|
+
var H;
|
|
1674
|
+
return (S.width || 0) / ((H = S.target) == null ? void 0 : H.spatial.width);
|
|
1623
1675
|
}) : []
|
|
1624
1676
|
), [m, h]);
|
|
1625
|
-
|
|
1677
|
+
an(tt), N(() => {
|
|
1626
1678
|
r && r(D);
|
|
1627
1679
|
}, [h.annotations]), N(() => {
|
|
1628
1680
|
if (i)
|
|
@@ -1630,22 +1682,22 @@ function et({
|
|
|
1630
1682
|
typeof S.opacity < "u" && k.applyStyles({ id: S.id }, "atlas", {
|
|
1631
1683
|
opacity: S.opacity
|
|
1632
1684
|
});
|
|
1633
|
-
}, [i]),
|
|
1634
|
-
n && n(
|
|
1635
|
-
}, [
|
|
1636
|
-
|
|
1685
|
+
}, [i]), Ie(() => {
|
|
1686
|
+
n && n(ye);
|
|
1687
|
+
}, [ye]), Y(
|
|
1688
|
+
C && (h.type === "images" || h.type === "empty" || h.type === "textual-content" && a) ? "overlay" : "none",
|
|
1637
1689
|
`canvas-portal-controls-${b == null ? void 0 : b.id}`,
|
|
1638
|
-
|
|
1690
|
+
ve.Provider,
|
|
1639
1691
|
a ? {
|
|
1640
|
-
value:
|
|
1692
|
+
value: C || null,
|
|
1641
1693
|
children: a(h)
|
|
1642
1694
|
} : {},
|
|
1643
|
-
[b,
|
|
1695
|
+
[b, C, h, ...c || []]
|
|
1644
1696
|
);
|
|
1645
|
-
const _ =
|
|
1697
|
+
const _ = kn({ maxWidth: 256, maxHeight: 256 });
|
|
1646
1698
|
if (!b)
|
|
1647
1699
|
return null;
|
|
1648
|
-
const
|
|
1700
|
+
const xe = b.accompanyingCanvas, G = _ && _.type === "fixed" ? /* @__PURE__ */ u("world-object", { height: b.height, width: b.width, x: e, y: t, children: /* @__PURE__ */ u(
|
|
1649
1701
|
"world-image",
|
|
1650
1702
|
{
|
|
1651
1703
|
uri: _.id,
|
|
@@ -1664,13 +1716,13 @@ function et({
|
|
|
1664
1716
|
throw new Error(h.reason || "Unknown image strategy");
|
|
1665
1717
|
return null;
|
|
1666
1718
|
}
|
|
1667
|
-
const
|
|
1668
|
-
Z ? /* @__PURE__ */
|
|
1669
|
-
h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */
|
|
1670
|
-
|
|
1719
|
+
const we = /* @__PURE__ */ I(te, { children: [
|
|
1720
|
+
Z ? /* @__PURE__ */ u(de, { page: Z }) : null,
|
|
1721
|
+
h.annotations && h.annotations.pages ? h.annotations.pages.map((S) => /* @__PURE__ */ u(de, { page: S }, S.id)) : null,
|
|
1722
|
+
M
|
|
1671
1723
|
] }), nt = h.type === "images" ? h.images.length : 0;
|
|
1672
|
-
return /* @__PURE__ */
|
|
1673
|
-
/* @__PURE__ */
|
|
1724
|
+
return /* @__PURE__ */ I($, { children: [
|
|
1725
|
+
/* @__PURE__ */ I(
|
|
1674
1726
|
"world-object",
|
|
1675
1727
|
{
|
|
1676
1728
|
height: b.height,
|
|
@@ -1679,50 +1731,50 @@ function et({
|
|
|
1679
1731
|
y: t,
|
|
1680
1732
|
...W,
|
|
1681
1733
|
children: [
|
|
1682
|
-
h.type === "empty" ||
|
|
1683
|
-
h.type === "textual-content" ? h.items.map((S,
|
|
1734
|
+
h.type === "empty" || p ? /* @__PURE__ */ u(Ze, { style: v }) : null,
|
|
1735
|
+
h.type === "textual-content" ? h.items.map((S, H) => {
|
|
1684
1736
|
var Q;
|
|
1685
|
-
return /* @__PURE__ */
|
|
1686
|
-
/* @__PURE__ */
|
|
1687
|
-
|
|
1737
|
+
return /* @__PURE__ */ I($, { children: [
|
|
1738
|
+
/* @__PURE__ */ u(
|
|
1739
|
+
ft,
|
|
1688
1740
|
{
|
|
1689
|
-
onClick: x ? (
|
|
1690
|
-
|
|
1741
|
+
onClick: x ? (Se) => {
|
|
1742
|
+
Se.stopPropagation(), x(S.annotationId, S, Se);
|
|
1691
1743
|
} : void 0,
|
|
1692
1744
|
target: ((Q = S.target) == null ? void 0 : Q.spatial) || void 0,
|
|
1693
|
-
children: /* @__PURE__ */
|
|
1745
|
+
children: /* @__PURE__ */ u("div", { "data-textual-content": !0, children: /* @__PURE__ */ u(zn, { enableDangerouslySetInnerHTML: !0, children: S.text }) })
|
|
1694
1746
|
},
|
|
1695
|
-
|
|
1747
|
+
H
|
|
1696
1748
|
),
|
|
1697
|
-
|
|
1749
|
+
we
|
|
1698
1750
|
] });
|
|
1699
1751
|
}) : null,
|
|
1700
|
-
h.type === "images" ? /* @__PURE__ */
|
|
1701
|
-
h.images.map((S,
|
|
1702
|
-
|
|
1752
|
+
h.type === "images" ? /* @__PURE__ */ I($, { children: [
|
|
1753
|
+
h.images.map((S, H) => /* @__PURE__ */ u(
|
|
1754
|
+
qe,
|
|
1703
1755
|
{
|
|
1704
1756
|
isStatic: o,
|
|
1705
1757
|
image: S,
|
|
1706
1758
|
id: S.id,
|
|
1707
|
-
thumbnail:
|
|
1759
|
+
thumbnail: H === 0 ? _ : void 0,
|
|
1708
1760
|
selector: S.selector,
|
|
1709
1761
|
enableSizes: g,
|
|
1710
1762
|
onClick: x ? (Q) => {
|
|
1711
1763
|
Q.stopPropagation(), x(S.annotationId, S, Q);
|
|
1712
1764
|
} : void 0
|
|
1713
1765
|
},
|
|
1714
|
-
S.id +
|
|
1766
|
+
S.id + H
|
|
1715
1767
|
)),
|
|
1716
|
-
|
|
1768
|
+
we
|
|
1717
1769
|
] }) : null,
|
|
1718
|
-
h.type === "3d-model" ? /* @__PURE__ */
|
|
1719
|
-
h.type === "media" ? /* @__PURE__ */
|
|
1770
|
+
h.type === "3d-model" ? /* @__PURE__ */ u(Je, { model: h.model }) : null,
|
|
1771
|
+
h.type === "media" ? /* @__PURE__ */ u($, { children: h.media.type === "Sound" ? /* @__PURE__ */ I(Ke, { media: h.media, mediaControlsDeps: d, children: [
|
|
1720
1772
|
G,
|
|
1721
1773
|
s ? s(h) : null
|
|
1722
|
-
] }) : h.media.type === "Video" ? /* @__PURE__ */
|
|
1774
|
+
] }) : h.media.type === "Video" ? /* @__PURE__ */ I(Ge, { media: h.media, mediaControlsDeps: d, children: [
|
|
1723
1775
|
G,
|
|
1724
1776
|
s ? s(h) : null
|
|
1725
|
-
] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */
|
|
1777
|
+
] }) : h.media.type === "VideoYouTube" && w ? /* @__PURE__ */ I(Wn, { media: h.media, mediaControlsDeps: d, children: [
|
|
1726
1778
|
G,
|
|
1727
1779
|
s ? s(h) : null
|
|
1728
1780
|
] }) : null }) : null
|
|
@@ -1730,33 +1782,29 @@ function et({
|
|
|
1730
1782
|
},
|
|
1731
1783
|
`${b.id}/${h.type}/${nt}`
|
|
1732
1784
|
),
|
|
1733
|
-
h.type === "media" && h.media.type === "Sound" &&
|
|
1785
|
+
h.type === "media" && h.media.type === "Sound" && xe ? /* @__PURE__ */ u(me, { canvas: xe.id, children: /* @__PURE__ */ u(et, { renderViewerControls: a }) }) : null
|
|
1734
1786
|
] });
|
|
1735
1787
|
}
|
|
1736
|
-
function
|
|
1737
|
-
const
|
|
1738
|
-
|
|
1739
|
-
}
|
|
1740
|
-
|
|
1741
|
-
|
|
1742
|
-
if (it(n, () => o, [o]), !r)
|
|
1743
|
-
return /* @__PURE__ */ l("div", {});
|
|
1744
|
-
let u = 0;
|
|
1745
|
-
return /* @__PURE__ */ A(H, { children: [
|
|
1788
|
+
const Gn = Me(function(t, n) {
|
|
1789
|
+
const r = K(), i = Re(), o = Rt(), { ViewerControls: a, MediaControls: s } = t.components || {};
|
|
1790
|
+
if (at(n, () => o, [o]), !r)
|
|
1791
|
+
return /* @__PURE__ */ u("div", {});
|
|
1792
|
+
let c = 0;
|
|
1793
|
+
return /* @__PURE__ */ I($, { children: [
|
|
1746
1794
|
t.header,
|
|
1747
|
-
/* @__PURE__ */
|
|
1748
|
-
|
|
1795
|
+
/* @__PURE__ */ u(
|
|
1796
|
+
V.Viewer,
|
|
1749
1797
|
{
|
|
1750
1798
|
height: t.height,
|
|
1751
1799
|
mode: t.mode,
|
|
1752
|
-
children: i.map((d,
|
|
1753
|
-
const f =
|
|
1754
|
-
return
|
|
1755
|
-
|
|
1800
|
+
children: i.map((d, l) => {
|
|
1801
|
+
const f = c;
|
|
1802
|
+
return c += d.width + (t.spacing || 0), /* @__PURE__ */ u(me, { canvas: d.id, children: /* @__PURE__ */ u(
|
|
1803
|
+
V.RenderCanvas,
|
|
1756
1804
|
{
|
|
1757
1805
|
strategies: ["3d-model", "media", "images", "empty", "textual-content"],
|
|
1758
|
-
renderViewerControls:
|
|
1759
|
-
renderMediaControls:
|
|
1806
|
+
renderViewerControls: l === 0 && a ? () => /* @__PURE__ */ u(a, {}) : void 0,
|
|
1807
|
+
renderMediaControls: l === 0 && s ? () => /* @__PURE__ */ u(s, {}) : void 0,
|
|
1760
1808
|
x: f,
|
|
1761
1809
|
...t.canvasProps || {},
|
|
1762
1810
|
children: t.annotations
|
|
@@ -1769,36 +1817,37 @@ const Wn = Ae(function(t, n) {
|
|
|
1769
1817
|
),
|
|
1770
1818
|
t.children
|
|
1771
1819
|
] });
|
|
1772
|
-
}),
|
|
1773
|
-
const
|
|
1774
|
-
return /* @__PURE__ */
|
|
1775
|
-
|
|
1820
|
+
}), 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 v = ge();
|
|
1822
|
+
return /* @__PURE__ */ u(he, { vault: v, children: /* @__PURE__ */ u(Tt, { ...l, children: /* @__PURE__ */ u(
|
|
1823
|
+
Gn,
|
|
1776
1824
|
{
|
|
1777
|
-
ref:
|
|
1825
|
+
ref: f,
|
|
1778
1826
|
height: n,
|
|
1779
1827
|
components: s,
|
|
1780
1828
|
spacing: o,
|
|
1781
1829
|
canvasProps: i,
|
|
1782
1830
|
annotations: r,
|
|
1783
1831
|
header: a,
|
|
1784
|
-
mode:
|
|
1832
|
+
mode: c,
|
|
1833
|
+
reuseAtlas: d,
|
|
1785
1834
|
children: t
|
|
1786
1835
|
}
|
|
1787
1836
|
) }) });
|
|
1788
1837
|
});
|
|
1789
|
-
|
|
1790
|
-
|
|
1791
|
-
|
|
1792
|
-
|
|
1793
|
-
|
|
1794
|
-
|
|
1795
|
-
|
|
1796
|
-
|
|
1797
|
-
|
|
1798
|
-
|
|
1799
|
-
|
|
1800
|
-
|
|
1838
|
+
V.RenderImage = qe;
|
|
1839
|
+
V.RenderCanvas = et;
|
|
1840
|
+
V.RenderAnnotationPage = de;
|
|
1841
|
+
V.RenderAnnotation = _e;
|
|
1842
|
+
V.Viewer = sn;
|
|
1843
|
+
V.CanvasBackground = Ze;
|
|
1844
|
+
V.Audio = Ke;
|
|
1845
|
+
V.Video = Ge;
|
|
1846
|
+
V.Model = Je;
|
|
1847
|
+
V.AudioHTML = ze;
|
|
1848
|
+
V.VideoHTML = We;
|
|
1849
|
+
V.ModelHTML = Qe;
|
|
1801
1850
|
export {
|
|
1802
|
-
|
|
1851
|
+
V as CanvasPanel
|
|
1803
1852
|
};
|
|
1804
1853
|
//# sourceMappingURL=canvas-panel.mjs.map
|