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