triiiceratops 0.1.0 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +9 -6
- package/dist/src/lib/state/viewer.svelte.d.ts +0 -5
- package/dist/src/lib/utils/annotationAdapter.d.ts +27 -5
- package/dist/triiiceratops-element.css +1 -1
- package/dist/triiiceratops-element.iife.js +30 -1162
- package/dist/triiiceratops-element.js +11091 -41716
- package/dist/triiiceratops.js +819 -870
- package/package.json +1 -3
package/dist/triiiceratops.js
CHANGED
|
@@ -1,39 +1,37 @@
|
|
|
1
|
-
var
|
|
2
|
-
throw TypeError(
|
|
1
|
+
var Ae = (i) => {
|
|
2
|
+
throw TypeError(i);
|
|
3
3
|
};
|
|
4
|
-
var
|
|
5
|
-
var
|
|
4
|
+
var Pe = (i, t, s) => t.has(i) || Ae("Cannot " + s);
|
|
5
|
+
var L = (i, t, s) => (Pe(i, t, "read from private field"), s ? s.call(i) : t.get(i)), H = (i, t, s) => t.has(i) ? Ae("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(i) : t.set(i, s);
|
|
6
6
|
import "svelte/internal/disclose-version";
|
|
7
7
|
import * as e from "svelte/internal/client";
|
|
8
|
-
import { onMount as
|
|
9
|
-
import * as
|
|
10
|
-
import
|
|
11
|
-
import
|
|
12
|
-
import "
|
|
13
|
-
import
|
|
14
|
-
import
|
|
15
|
-
import
|
|
16
|
-
import
|
|
17
|
-
import Me from "phosphor-svelte/lib/EyeSlash";
|
|
18
|
-
import He from "phosphor-svelte/lib/X";
|
|
8
|
+
import { onMount as Re, getContext as me, setContext as De } from "svelte";
|
|
9
|
+
import * as Fe from "manifesto.js";
|
|
10
|
+
import Ie from "openseadragon";
|
|
11
|
+
import He from "phosphor-svelte/lib/CaretLeft";
|
|
12
|
+
import Ne from "phosphor-svelte/lib/CaretRight";
|
|
13
|
+
import Ve from "phosphor-svelte/lib/CaretDown";
|
|
14
|
+
import ke from "phosphor-svelte/lib/Eye";
|
|
15
|
+
import Ce from "phosphor-svelte/lib/EyeSlash";
|
|
16
|
+
import Oe from "phosphor-svelte/lib/X";
|
|
19
17
|
import "svelte/internal/flags/legacy";
|
|
20
|
-
import
|
|
21
|
-
import
|
|
22
|
-
import
|
|
23
|
-
import
|
|
24
|
-
import
|
|
25
|
-
import
|
|
26
|
-
import
|
|
18
|
+
import Be from "phosphor-svelte/lib/ChatCenteredText";
|
|
19
|
+
import Ye from "phosphor-svelte/lib/CornersIn";
|
|
20
|
+
import Xe from "phosphor-svelte/lib/CornersOut";
|
|
21
|
+
import qe from "phosphor-svelte/lib/Info";
|
|
22
|
+
import Me from "phosphor-svelte/lib/MagnifyingGlass";
|
|
23
|
+
import $e from "phosphor-svelte/lib/Plus";
|
|
24
|
+
import Qe from "phosphor-svelte/lib/Slideshow";
|
|
27
25
|
var te;
|
|
28
|
-
class
|
|
26
|
+
class Ue {
|
|
29
27
|
constructor() {
|
|
30
|
-
|
|
28
|
+
H(this, te, e.state(e.proxy({})));
|
|
31
29
|
}
|
|
32
30
|
get manifests() {
|
|
33
|
-
return e.get(
|
|
31
|
+
return e.get(L(this, te));
|
|
34
32
|
}
|
|
35
33
|
set manifests(t) {
|
|
36
|
-
e.set(
|
|
34
|
+
e.set(L(this, te), t, !0);
|
|
37
35
|
}
|
|
38
36
|
async fetchManifest(t) {
|
|
39
37
|
if (!this.manifests[t]) {
|
|
@@ -42,8 +40,8 @@ class Ze {
|
|
|
42
40
|
const s = await fetch(t);
|
|
43
41
|
if (!s.ok)
|
|
44
42
|
throw new Error(`HTTP error! status: ${s.status}`);
|
|
45
|
-
const r = await s.json(),
|
|
46
|
-
this.manifests[t] = { json: r, manifesto:
|
|
43
|
+
const r = await s.json(), l = Fe.parseManifest(r);
|
|
44
|
+
this.manifests[t] = { json: r, manifesto: l, isFetching: !1 };
|
|
47
45
|
} catch (s) {
|
|
48
46
|
this.manifests[t] = { error: s.message, isFetching: !1 };
|
|
49
47
|
}
|
|
@@ -81,133 +79,119 @@ class Ze {
|
|
|
81
79
|
manualGetAnnotations(t, s) {
|
|
82
80
|
const r = this.getManifest(t);
|
|
83
81
|
if (!r) return [];
|
|
84
|
-
const
|
|
85
|
-
if (!
|
|
86
|
-
const
|
|
87
|
-
let
|
|
88
|
-
const
|
|
89
|
-
return
|
|
90
|
-
const
|
|
91
|
-
if (
|
|
92
|
-
const
|
|
93
|
-
if (
|
|
94
|
-
if (
|
|
95
|
-
const
|
|
96
|
-
|
|
82
|
+
const l = r.getSequences()[0].getCanvasById(s);
|
|
83
|
+
if (!l) return [];
|
|
84
|
+
const c = l.__jsonld;
|
|
85
|
+
let C = [];
|
|
86
|
+
const m = (u) => u.resources || u.items || [];
|
|
87
|
+
return c.otherContent && c.otherContent.forEach((u) => {
|
|
88
|
+
const _ = u["@id"] || u.id;
|
|
89
|
+
if (_ && !u.resources) {
|
|
90
|
+
const I = this.manifests[_];
|
|
91
|
+
if (I) {
|
|
92
|
+
if (I.json) {
|
|
93
|
+
const E = m(I.json);
|
|
94
|
+
C.push(...E);
|
|
97
95
|
}
|
|
98
96
|
} else
|
|
99
|
-
this.fetchAnnotationList(
|
|
100
|
-
} else
|
|
101
|
-
}),
|
|
102
|
-
const
|
|
103
|
-
if (
|
|
104
|
-
const
|
|
105
|
-
if (
|
|
106
|
-
if (
|
|
107
|
-
const
|
|
108
|
-
|
|
97
|
+
this.fetchAnnotationList(_);
|
|
98
|
+
} else u.resources && C.push(...u.resources);
|
|
99
|
+
}), c.annotations && c.annotations.forEach((u) => {
|
|
100
|
+
const _ = u.id || u["@id"];
|
|
101
|
+
if (_ && !u.items) {
|
|
102
|
+
const I = this.manifests[_];
|
|
103
|
+
if (I) {
|
|
104
|
+
if (I.json) {
|
|
105
|
+
const E = m(I.json);
|
|
106
|
+
C.push(...E);
|
|
109
107
|
}
|
|
110
108
|
} else
|
|
111
|
-
this.fetchAnnotationList(
|
|
112
|
-
} else
|
|
113
|
-
}),
|
|
109
|
+
this.fetchAnnotationList(_);
|
|
110
|
+
} else u.items && C.push(...u.items);
|
|
111
|
+
}), C;
|
|
114
112
|
}
|
|
115
113
|
}
|
|
116
114
|
te = new WeakMap();
|
|
117
|
-
const Z = new
|
|
118
|
-
var se, re, ie, ae, ne, oe, le, ce, de, fe,
|
|
119
|
-
class
|
|
115
|
+
const Z = new Ue();
|
|
116
|
+
var se, re, ie, ae, ne, oe, le, ce, de, fe, ge, he, ve, ue, pe;
|
|
117
|
+
class We {
|
|
120
118
|
constructor(t) {
|
|
121
|
-
|
|
122
|
-
|
|
123
|
-
|
|
124
|
-
|
|
125
|
-
|
|
126
|
-
|
|
127
|
-
|
|
128
|
-
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
|
|
132
|
-
|
|
133
|
-
|
|
134
|
-
|
|
135
|
-
|
|
136
|
-
G(this, be, e.state(!1));
|
|
137
|
-
G(this, pe, e.state(e.proxy([])));
|
|
119
|
+
H(this, se, e.state(null));
|
|
120
|
+
H(this, re, e.state(null));
|
|
121
|
+
H(this, ie, e.state(!1));
|
|
122
|
+
H(this, ae, e.state(!1));
|
|
123
|
+
H(this, ne, e.state(!1));
|
|
124
|
+
H(this, oe, e.state(!1));
|
|
125
|
+
H(this, le, e.state(!1));
|
|
126
|
+
H(this, ce, e.state(!1));
|
|
127
|
+
H(this, de, e.state("none"));
|
|
128
|
+
H(this, fe, e.state(e.proxy(/* @__PURE__ */ new Set())));
|
|
129
|
+
H(this, ge, e.state(""));
|
|
130
|
+
H(this, he, e.state(e.proxy([])));
|
|
131
|
+
H(this, ve, e.state(!1));
|
|
132
|
+
H(this, ue, e.state(!1));
|
|
133
|
+
H(this, pe, e.state(e.proxy([])));
|
|
138
134
|
this.manifestId = t || null, this.manifestId && Z.fetchManifest(this.manifestId);
|
|
139
135
|
}
|
|
140
136
|
get manifestId() {
|
|
141
|
-
return e.get(
|
|
137
|
+
return e.get(L(this, se));
|
|
142
138
|
}
|
|
143
139
|
set manifestId(t) {
|
|
144
|
-
e.set(
|
|
140
|
+
e.set(L(this, se), t, !0);
|
|
145
141
|
}
|
|
146
142
|
get canvasId() {
|
|
147
|
-
return e.get(
|
|
143
|
+
return e.get(L(this, re));
|
|
148
144
|
}
|
|
149
145
|
set canvasId(t) {
|
|
150
|
-
e.set(
|
|
146
|
+
e.set(L(this, re), t, !0);
|
|
151
147
|
}
|
|
152
148
|
get showAnnotations() {
|
|
153
|
-
return e.get(
|
|
149
|
+
return e.get(L(this, ie));
|
|
154
150
|
}
|
|
155
151
|
set showAnnotations(t) {
|
|
156
|
-
e.set(
|
|
152
|
+
e.set(L(this, ie), t, !0);
|
|
157
153
|
}
|
|
158
154
|
get showThumbnailGallery() {
|
|
159
|
-
return e.get(
|
|
155
|
+
return e.get(L(this, ae));
|
|
160
156
|
}
|
|
161
157
|
set showThumbnailGallery(t) {
|
|
162
|
-
e.set(
|
|
158
|
+
e.set(L(this, ae), t, !0);
|
|
163
159
|
}
|
|
164
160
|
get isGalleryDockedBottom() {
|
|
165
|
-
return e.get(
|
|
161
|
+
return e.get(L(this, ne));
|
|
166
162
|
}
|
|
167
163
|
set isGalleryDockedBottom(t) {
|
|
168
|
-
e.set(
|
|
164
|
+
e.set(L(this, ne), t, !0);
|
|
169
165
|
}
|
|
170
166
|
get isGalleryDockedRight() {
|
|
171
|
-
return e.get(
|
|
167
|
+
return e.get(L(this, oe));
|
|
172
168
|
}
|
|
173
169
|
set isGalleryDockedRight(t) {
|
|
174
|
-
e.set(
|
|
170
|
+
e.set(L(this, oe), t, !0);
|
|
175
171
|
}
|
|
176
172
|
get isFullScreen() {
|
|
177
|
-
return e.get(
|
|
173
|
+
return e.get(L(this, le));
|
|
178
174
|
}
|
|
179
175
|
set isFullScreen(t) {
|
|
180
|
-
e.set(
|
|
176
|
+
e.set(L(this, le), t, !0);
|
|
181
177
|
}
|
|
182
178
|
get showMetadataDialog() {
|
|
183
|
-
return e.get(
|
|
179
|
+
return e.get(L(this, ce));
|
|
184
180
|
}
|
|
185
181
|
set showMetadataDialog(t) {
|
|
186
|
-
e.set(
|
|
182
|
+
e.set(L(this, ce), t, !0);
|
|
187
183
|
}
|
|
188
184
|
get dockSide() {
|
|
189
|
-
return e.get(
|
|
185
|
+
return e.get(L(this, de));
|
|
190
186
|
}
|
|
191
187
|
set dockSide(t) {
|
|
192
|
-
e.set(
|
|
188
|
+
e.set(L(this, de), t, !0);
|
|
193
189
|
}
|
|
194
190
|
get visibleAnnotationIds() {
|
|
195
|
-
return e.get(
|
|
191
|
+
return e.get(L(this, fe));
|
|
196
192
|
}
|
|
197
193
|
set visibleAnnotationIds(t) {
|
|
198
|
-
e.set(
|
|
199
|
-
}
|
|
200
|
-
get createdAnnotations() {
|
|
201
|
-
return e.get(C(this, ue));
|
|
202
|
-
}
|
|
203
|
-
set createdAnnotations(t) {
|
|
204
|
-
e.set(C(this, ue), t, !0);
|
|
205
|
-
}
|
|
206
|
-
get isCreatingAnnotation() {
|
|
207
|
-
return e.get(C(this, ge));
|
|
208
|
-
}
|
|
209
|
-
set isCreatingAnnotation(t) {
|
|
210
|
-
e.set(C(this, ge), t, !0);
|
|
194
|
+
e.set(L(this, fe), t, !0);
|
|
211
195
|
}
|
|
212
196
|
get manifest() {
|
|
213
197
|
return this.manifestId ? Z.getManifest(this.manifestId) : null;
|
|
@@ -247,27 +231,7 @@ class $e {
|
|
|
247
231
|
this.manifestId = t, this.canvasId = null, Z.fetchManifest(t);
|
|
248
232
|
}
|
|
249
233
|
setCanvas(t) {
|
|
250
|
-
this.canvasId = t
|
|
251
|
-
}
|
|
252
|
-
toggleCreationMode(t) {
|
|
253
|
-
typeof t == "boolean" ? this.isCreatingAnnotation = t : this.isCreatingAnnotation = !this.isCreatingAnnotation;
|
|
254
|
-
}
|
|
255
|
-
loadAnnotationsFromStorage(t) {
|
|
256
|
-
if (typeof localStorage > "u") return;
|
|
257
|
-
const s = `triiiceratops-annotations-${t}`, r = localStorage.getItem(s);
|
|
258
|
-
if (r)
|
|
259
|
-
try {
|
|
260
|
-
const i = JSON.parse(r);
|
|
261
|
-
Array.isArray(i) && (this.createdAnnotations[t] = i);
|
|
262
|
-
} catch (i) {
|
|
263
|
-
console.error("Failed to parse stored annotations", i);
|
|
264
|
-
}
|
|
265
|
-
}
|
|
266
|
-
addAnnotation(t, s) {
|
|
267
|
-
if (s && (this.createdAnnotations[s] || (this.createdAnnotations[s] = []), this.createdAnnotations[s] = [...this.createdAnnotations[s], t], typeof localStorage < "u")) {
|
|
268
|
-
const r = `triiiceratops-annotations-${s}`;
|
|
269
|
-
localStorage.setItem(r, JSON.stringify(this.createdAnnotations[s]));
|
|
270
|
-
}
|
|
234
|
+
this.canvasId = t;
|
|
271
235
|
}
|
|
272
236
|
toggleAnnotations() {
|
|
273
237
|
this.showAnnotations = !this.showAnnotations;
|
|
@@ -289,37 +253,37 @@ class $e {
|
|
|
289
253
|
this.showMetadataDialog = !this.showMetadataDialog;
|
|
290
254
|
}
|
|
291
255
|
get searchQuery() {
|
|
292
|
-
return e.get(
|
|
256
|
+
return e.get(L(this, ge));
|
|
293
257
|
}
|
|
294
258
|
set searchQuery(t) {
|
|
295
|
-
e.set(
|
|
259
|
+
e.set(L(this, ge), t, !0);
|
|
296
260
|
}
|
|
297
261
|
get searchResults() {
|
|
298
|
-
return e.get(
|
|
262
|
+
return e.get(L(this, he));
|
|
299
263
|
}
|
|
300
264
|
set searchResults(t) {
|
|
301
|
-
e.set(
|
|
265
|
+
e.set(L(this, he), t, !0);
|
|
302
266
|
}
|
|
303
267
|
get isSearching() {
|
|
304
|
-
return e.get(
|
|
268
|
+
return e.get(L(this, ve));
|
|
305
269
|
}
|
|
306
270
|
set isSearching(t) {
|
|
307
|
-
e.set(
|
|
271
|
+
e.set(L(this, ve), t, !0);
|
|
308
272
|
}
|
|
309
273
|
get showSearchPanel() {
|
|
310
|
-
return e.get(
|
|
274
|
+
return e.get(L(this, ue));
|
|
311
275
|
}
|
|
312
276
|
set showSearchPanel(t) {
|
|
313
|
-
e.set(
|
|
277
|
+
e.set(L(this, ue), t, !0);
|
|
314
278
|
}
|
|
315
279
|
toggleSearchPanel() {
|
|
316
280
|
this.showSearchPanel = !this.showSearchPanel, this.showSearchPanel || (this.searchAnnotations = []);
|
|
317
281
|
}
|
|
318
282
|
get searchAnnotations() {
|
|
319
|
-
return e.get(
|
|
283
|
+
return e.get(L(this, pe));
|
|
320
284
|
}
|
|
321
285
|
set searchAnnotations(t) {
|
|
322
|
-
e.set(
|
|
286
|
+
e.set(L(this, pe), t, !0);
|
|
323
287
|
}
|
|
324
288
|
get currentCanvasSearchAnnotations() {
|
|
325
289
|
return this.canvasId ? this.searchAnnotations.filter((t) => t.canvasId === this.canvasId) : [];
|
|
@@ -329,105 +293,105 @@ class $e {
|
|
|
329
293
|
if (t.trim()) {
|
|
330
294
|
this.isSearching = !0, this.searchQuery = t, this.searchResults = [];
|
|
331
295
|
try {
|
|
332
|
-
const
|
|
333
|
-
if (!
|
|
334
|
-
let
|
|
335
|
-
if (
|
|
296
|
+
const l = this.manifest;
|
|
297
|
+
if (!l) throw new Error("No manifest loaded");
|
|
298
|
+
let c = l.getService("http://iiif.io/api/search/1/search") || l.getService("http://iiif.io/api/search/0/search");
|
|
299
|
+
if (c || l.__jsonld && l.__jsonld.service && (c = (Array.isArray(l.__jsonld.service) ? l.__jsonld.service : [l.__jsonld.service]).find((f) => f.profile === "http://iiif.io/api/search/1/search" || f.profile === "http://iiif.io/api/search/0/search")), !c) {
|
|
336
300
|
console.warn("No IIIF search service found in manifest"), this.isSearching = !1;
|
|
337
301
|
return;
|
|
338
302
|
}
|
|
339
|
-
const
|
|
340
|
-
if (!
|
|
341
|
-
const
|
|
342
|
-
const
|
|
343
|
-
if (!
|
|
344
|
-
const
|
|
345
|
-
if (
|
|
346
|
-
const
|
|
347
|
-
return
|
|
303
|
+
const m = `${c.id || c["@id"]}?q=${encodeURIComponent(t)}`, u = await fetch(m);
|
|
304
|
+
if (!u.ok) throw new Error("Search request failed");
|
|
305
|
+
const _ = await u.json(), I = _.resources || [], E = [], n = (o) => {
|
|
306
|
+
const f = typeof o == "string" ? o : o["@id"] || o.id;
|
|
307
|
+
if (!f) return null;
|
|
308
|
+
const b = f.split("#xywh=");
|
|
309
|
+
if (b.length < 2) return null;
|
|
310
|
+
const h = b[1].split(",").map(Number);
|
|
311
|
+
return h.length === 4 ? h : null;
|
|
348
312
|
};
|
|
349
|
-
if (
|
|
350
|
-
for (const
|
|
351
|
-
const
|
|
352
|
-
for (const
|
|
353
|
-
const
|
|
354
|
-
if (
|
|
355
|
-
const a = typeof
|
|
356
|
-
if (
|
|
357
|
-
const
|
|
358
|
-
let
|
|
313
|
+
if (_.hits)
|
|
314
|
+
for (const o of _.hits) {
|
|
315
|
+
const f = o.annotations || [];
|
|
316
|
+
for (const b of f) {
|
|
317
|
+
const h = I.find((a) => a["@id"] === b || a.id === b);
|
|
318
|
+
if (h && h.on) {
|
|
319
|
+
const a = typeof h.on == "string" ? h.on : h.on["@id"] || h.on.id, d = a.split("#")[0], j = n(a), w = this.canvases.findIndex((k) => k.id === d);
|
|
320
|
+
if (w >= 0) {
|
|
321
|
+
const k = this.canvases[w];
|
|
322
|
+
let T = "Canvas " + (w + 1);
|
|
359
323
|
try {
|
|
360
|
-
if (
|
|
361
|
-
const
|
|
362
|
-
Array.isArray(
|
|
363
|
-
} else
|
|
324
|
+
if (k.getLabel) {
|
|
325
|
+
const S = k.getLabel();
|
|
326
|
+
Array.isArray(S) && S.length > 0 ? T = S[0].value : typeof S == "string" && (T = S);
|
|
327
|
+
} else k.label && (typeof k.label == "string" ? T = k.label : Array.isArray(k.label) && (T = (s = k.label[0]) == null ? void 0 : s.value));
|
|
364
328
|
} catch {
|
|
365
329
|
}
|
|
366
|
-
|
|
330
|
+
E.push({
|
|
367
331
|
type: "hit",
|
|
368
|
-
before:
|
|
369
|
-
match:
|
|
370
|
-
after:
|
|
371
|
-
canvasIndex:
|
|
372
|
-
canvasLabel: String(
|
|
373
|
-
bounds:
|
|
332
|
+
before: o.before,
|
|
333
|
+
match: o.match,
|
|
334
|
+
after: o.after,
|
|
335
|
+
canvasIndex: w,
|
|
336
|
+
canvasLabel: String(T),
|
|
337
|
+
bounds: j
|
|
374
338
|
});
|
|
375
339
|
}
|
|
376
340
|
}
|
|
377
341
|
}
|
|
378
342
|
}
|
|
379
|
-
else if (
|
|
380
|
-
for (const
|
|
381
|
-
const
|
|
343
|
+
else if (I.length > 0)
|
|
344
|
+
for (const o of I) {
|
|
345
|
+
const f = typeof o.on == "string" ? o.on : o.on["@id"] || o.on.id, b = f.split("#")[0], h = n(f), a = this.canvases.findIndex((d) => d.id === b);
|
|
382
346
|
if (a >= 0) {
|
|
383
347
|
const d = this.canvases[a];
|
|
384
|
-
let
|
|
348
|
+
let j = "Canvas " + (a + 1);
|
|
385
349
|
try {
|
|
386
350
|
if (d.getLabel) {
|
|
387
|
-
const
|
|
388
|
-
Array.isArray(
|
|
389
|
-
} else d.label && (typeof d.label == "string" ?
|
|
351
|
+
const w = d.getLabel();
|
|
352
|
+
Array.isArray(w) && w.length > 0 ? j = w[0].value : typeof w == "string" && (j = w);
|
|
353
|
+
} else d.label && (typeof d.label == "string" ? j = d.label : Array.isArray(d.label) && (j = (r = d.label[0]) == null ? void 0 : r.value));
|
|
390
354
|
} catch {
|
|
391
355
|
}
|
|
392
|
-
|
|
356
|
+
E.push({
|
|
393
357
|
type: "resource",
|
|
394
|
-
match:
|
|
358
|
+
match: o.resource && o.resource.chars ? o.resource.chars : o.chars || "",
|
|
395
359
|
canvasIndex: a,
|
|
396
|
-
canvasLabel: String(
|
|
397
|
-
bounds:
|
|
360
|
+
canvasLabel: String(j),
|
|
361
|
+
bounds: h
|
|
398
362
|
});
|
|
399
363
|
}
|
|
400
364
|
}
|
|
401
|
-
this.searchResults =
|
|
402
|
-
const
|
|
365
|
+
this.searchResults = E, this.searchAnnotations = E.filter((o) => o.bounds).map((o, f) => {
|
|
366
|
+
const b = this.canvases[o.canvasIndex], h = `${b.id}#xywh=${o.bounds.join(",")}`;
|
|
403
367
|
return {
|
|
404
|
-
"@id": `urn:search-hit:${
|
|
368
|
+
"@id": `urn:search-hit:${f}`,
|
|
405
369
|
"@type": "oa:Annotation",
|
|
406
370
|
motivation: "sc:painting",
|
|
407
|
-
on:
|
|
408
|
-
canvasId:
|
|
409
|
-
resource: { "@type": "cnt:ContentAsText", chars:
|
|
371
|
+
on: h,
|
|
372
|
+
canvasId: b.id,
|
|
373
|
+
resource: { "@type": "cnt:ContentAsText", chars: o.match },
|
|
410
374
|
// Flag to identify styling in Overlay?
|
|
411
375
|
// Or just standard rendering.
|
|
412
376
|
isSearchHit: !0
|
|
413
377
|
};
|
|
414
378
|
});
|
|
415
|
-
} catch (
|
|
416
|
-
console.error("Search error:",
|
|
379
|
+
} catch (l) {
|
|
380
|
+
console.error("Search error:", l);
|
|
417
381
|
} finally {
|
|
418
382
|
this.isSearching = !1;
|
|
419
383
|
}
|
|
420
384
|
}
|
|
421
385
|
}
|
|
422
386
|
}
|
|
423
|
-
se = new WeakMap(), re = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), fe = new WeakMap(),
|
|
424
|
-
const
|
|
425
|
-
function
|
|
426
|
-
return
|
|
387
|
+
se = new WeakMap(), re = new WeakMap(), ie = new WeakMap(), ae = new WeakMap(), ne = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), fe = new WeakMap(), ge = new WeakMap(), he = new WeakMap(), ve = new WeakMap(), ue = new WeakMap(), pe = new WeakMap();
|
|
388
|
+
const J = "triiiceratops:viewerState";
|
|
389
|
+
function Le(i) {
|
|
390
|
+
return i.id || i["@id"] || (typeof i.getId == "function" ? i.getId() : "");
|
|
427
391
|
}
|
|
428
|
-
function
|
|
429
|
-
if (!
|
|
430
|
-
const t =
|
|
392
|
+
function xe(i) {
|
|
393
|
+
if (!i) return null;
|
|
394
|
+
const t = i.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
|
|
431
395
|
return t ? {
|
|
432
396
|
x: parseInt(t[1], 10),
|
|
433
397
|
y: parseInt(t[2], 10),
|
|
@@ -435,241 +399,248 @@ function Se(n) {
|
|
|
435
399
|
h: parseInt(t[4], 10)
|
|
436
400
|
} : null;
|
|
437
401
|
}
|
|
438
|
-
function
|
|
439
|
-
const t =
|
|
402
|
+
function Ke(i) {
|
|
403
|
+
const t = Ze(i);
|
|
440
404
|
if (t)
|
|
441
|
-
return
|
|
442
|
-
const s =
|
|
405
|
+
return Je(t);
|
|
406
|
+
const s = rt(i);
|
|
443
407
|
return s ? {
|
|
444
408
|
type: "RECTANGLE",
|
|
445
|
-
|
|
446
|
-
|
|
447
|
-
|
|
448
|
-
|
|
449
|
-
h: s.h,
|
|
450
|
-
bounds: {
|
|
451
|
-
minX: s.x,
|
|
452
|
-
minY: s.y,
|
|
453
|
-
maxX: s.x + s.w,
|
|
454
|
-
maxY: s.y + s.h
|
|
455
|
-
}
|
|
456
|
-
}
|
|
409
|
+
x: s.x,
|
|
410
|
+
y: s.y,
|
|
411
|
+
w: s.w,
|
|
412
|
+
h: s.h
|
|
457
413
|
} : null;
|
|
458
414
|
}
|
|
459
|
-
function
|
|
415
|
+
function Ze(i) {
|
|
460
416
|
var s, r;
|
|
461
|
-
if (typeof
|
|
462
|
-
const
|
|
463
|
-
if (
|
|
464
|
-
return je(
|
|
417
|
+
if (typeof i.getTarget == "function") {
|
|
418
|
+
const l = ((s = i.__jsonld) == null ? void 0 : s.on) || ((r = i.__jsonld) == null ? void 0 : r.target);
|
|
419
|
+
if (l)
|
|
420
|
+
return je(l);
|
|
465
421
|
}
|
|
466
|
-
const t =
|
|
422
|
+
const t = i.target || i.on;
|
|
467
423
|
return t ? je(t) : null;
|
|
468
424
|
}
|
|
469
|
-
function je(
|
|
470
|
-
if (!
|
|
471
|
-
if (Array.isArray(
|
|
472
|
-
for (const t of
|
|
425
|
+
function je(i) {
|
|
426
|
+
if (!i) return null;
|
|
427
|
+
if (Array.isArray(i))
|
|
428
|
+
for (const t of i) {
|
|
473
429
|
const s = Te(t);
|
|
474
430
|
if (s) return s;
|
|
475
431
|
}
|
|
476
432
|
else
|
|
477
|
-
return Te(
|
|
433
|
+
return Te(i);
|
|
478
434
|
return null;
|
|
479
435
|
}
|
|
480
|
-
function Te(
|
|
436
|
+
function Te(i) {
|
|
481
437
|
var s;
|
|
482
|
-
if (!
|
|
483
|
-
const t =
|
|
438
|
+
if (!i) return null;
|
|
439
|
+
const t = i.selector || i;
|
|
484
440
|
return (t == null ? void 0 : t.type) === "SvgSelector" && t.value ? t.value : ((s = t == null ? void 0 : t.item) == null ? void 0 : s.type) === "SvgSelector" && t.item.value ? t.item.value : null;
|
|
485
441
|
}
|
|
486
|
-
function
|
|
442
|
+
function Je(i) {
|
|
487
443
|
try {
|
|
488
|
-
const s = new DOMParser().parseFromString(
|
|
444
|
+
const s = new DOMParser().parseFromString(i, "image/svg+xml");
|
|
489
445
|
if (s.documentElement.nodeName === "parsererror")
|
|
490
|
-
return console.warn("Failed to parse SVG selector:",
|
|
491
|
-
const r = [];
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
496
|
-
|
|
497
|
-
const y = rt(m);
|
|
498
|
-
r.push(...y);
|
|
446
|
+
return console.warn("Failed to parse SVG selector:", i), null;
|
|
447
|
+
const r = [], l = s.querySelectorAll("polygon");
|
|
448
|
+
for (const m of l) {
|
|
449
|
+
const u = m.getAttribute("points");
|
|
450
|
+
if (u) {
|
|
451
|
+
const _ = et(u);
|
|
452
|
+
r.push(..._);
|
|
499
453
|
}
|
|
500
454
|
}
|
|
501
|
-
const
|
|
502
|
-
for (const
|
|
503
|
-
const
|
|
504
|
-
if (
|
|
505
|
-
const
|
|
506
|
-
r.push(...
|
|
455
|
+
const c = s.querySelectorAll("path");
|
|
456
|
+
for (const m of c) {
|
|
457
|
+
const u = m.getAttribute("d");
|
|
458
|
+
if (u) {
|
|
459
|
+
const _ = tt(u);
|
|
460
|
+
r.push(..._);
|
|
507
461
|
}
|
|
508
462
|
}
|
|
509
|
-
const
|
|
510
|
-
for (const
|
|
511
|
-
const
|
|
512
|
-
r.push(...
|
|
463
|
+
const C = s.querySelectorAll("circle");
|
|
464
|
+
for (const m of C) {
|
|
465
|
+
const u = parseFloat(m.getAttribute("cx") || "0"), _ = parseFloat(m.getAttribute("cy") || "0"), I = parseFloat(m.getAttribute("r") || "0"), E = st(u, _, I);
|
|
466
|
+
r.push(...E);
|
|
513
467
|
}
|
|
514
|
-
for (const [h, m] of r)
|
|
515
|
-
i.minX = Math.min(i.minX, h), i.minY = Math.min(i.minY, m), i.maxX = Math.max(i.maxX, h), i.maxY = Math.max(i.maxY, m);
|
|
516
468
|
return r.length === 0 ? null : {
|
|
517
469
|
type: "POLYGON",
|
|
518
|
-
|
|
519
|
-
points: r,
|
|
520
|
-
bounds: i
|
|
521
|
-
}
|
|
470
|
+
points: r
|
|
522
471
|
};
|
|
523
472
|
} catch (t) {
|
|
524
473
|
return console.warn("Failed to convert SVG to polygon:", t), null;
|
|
525
474
|
}
|
|
526
475
|
}
|
|
527
|
-
function
|
|
528
|
-
const t = [], s =
|
|
476
|
+
function et(i) {
|
|
477
|
+
const t = [], s = i.trim().split(/\s+/);
|
|
529
478
|
for (const r of s) {
|
|
530
|
-
const [
|
|
531
|
-
!isNaN(
|
|
479
|
+
const [l, c] = r.split(",").map((C) => parseFloat(C));
|
|
480
|
+
!isNaN(l) && !isNaN(c) && t.push([l, c]);
|
|
532
481
|
}
|
|
533
482
|
return t;
|
|
534
483
|
}
|
|
535
|
-
function
|
|
484
|
+
function tt(i) {
|
|
536
485
|
const t = [], s = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
|
|
537
486
|
let r;
|
|
538
|
-
for (; (r = s.exec(
|
|
539
|
-
const
|
|
540
|
-
!isNaN(
|
|
487
|
+
for (; (r = s.exec(i)) !== null; ) {
|
|
488
|
+
const l = parseFloat(r[1]), c = parseFloat(r[2]);
|
|
489
|
+
!isNaN(l) && !isNaN(c) && t.push([l, c]);
|
|
541
490
|
}
|
|
542
491
|
return t;
|
|
543
492
|
}
|
|
544
|
-
function
|
|
545
|
-
const
|
|
546
|
-
for (let
|
|
547
|
-
const
|
|
548
|
-
|
|
493
|
+
function st(i, t, s, r = 8) {
|
|
494
|
+
const l = [];
|
|
495
|
+
for (let c = 0; c < r; c++) {
|
|
496
|
+
const C = c / r * Math.PI * 2, m = i + s * Math.cos(C), u = t + s * Math.sin(C);
|
|
497
|
+
l.push([m, u]);
|
|
549
498
|
}
|
|
550
|
-
return
|
|
499
|
+
return l;
|
|
551
500
|
}
|
|
552
|
-
function
|
|
501
|
+
function rt(i) {
|
|
553
502
|
var s;
|
|
554
|
-
if (typeof
|
|
555
|
-
const r =
|
|
503
|
+
if (typeof i.getTarget == "function") {
|
|
504
|
+
const r = i.getTarget();
|
|
556
505
|
if (typeof r == "string" && r.includes("xywh="))
|
|
557
|
-
return
|
|
558
|
-
const
|
|
559
|
-
if (
|
|
560
|
-
const
|
|
561
|
-
if (
|
|
506
|
+
return xe(r);
|
|
507
|
+
const l = (s = i.__jsonld) == null ? void 0 : s.on;
|
|
508
|
+
if (l) {
|
|
509
|
+
const c = we(l);
|
|
510
|
+
if (c) return c;
|
|
562
511
|
}
|
|
563
512
|
}
|
|
564
|
-
const t =
|
|
565
|
-
return t ?
|
|
513
|
+
const t = i.target || i.on;
|
|
514
|
+
return t ? we(t) : null;
|
|
566
515
|
}
|
|
567
|
-
function
|
|
568
|
-
if (!
|
|
569
|
-
if (Array.isArray(
|
|
570
|
-
for (const t of
|
|
571
|
-
const s =
|
|
516
|
+
function we(i) {
|
|
517
|
+
if (!i) return null;
|
|
518
|
+
if (Array.isArray(i))
|
|
519
|
+
for (const t of i) {
|
|
520
|
+
const s = we(t);
|
|
572
521
|
if (s) return s;
|
|
573
522
|
}
|
|
574
|
-
if (typeof
|
|
575
|
-
return
|
|
576
|
-
if (
|
|
577
|
-
const t =
|
|
523
|
+
if (typeof i == "string" && i.includes("xywh="))
|
|
524
|
+
return xe(i);
|
|
525
|
+
if (i.selector) {
|
|
526
|
+
const t = i.selector, s = t.item || t;
|
|
578
527
|
if (s.value && typeof s.value == "string" && s.value.includes("xywh="))
|
|
579
|
-
return
|
|
528
|
+
return xe(s.value);
|
|
580
529
|
}
|
|
581
530
|
return null;
|
|
582
531
|
}
|
|
583
|
-
function
|
|
584
|
-
|
|
585
|
-
if (typeof
|
|
586
|
-
const
|
|
587
|
-
if (
|
|
588
|
-
|
|
589
|
-
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
532
|
+
function it(i) {
|
|
533
|
+
let t = "", s = !1;
|
|
534
|
+
if (typeof i.getBody == "function") {
|
|
535
|
+
const r = i.getBody();
|
|
536
|
+
if (r && Array.isArray(r)) {
|
|
537
|
+
const l = [];
|
|
538
|
+
for (const c of r) {
|
|
539
|
+
const C = c.getValue ? c.getValue() : "";
|
|
540
|
+
if (C) {
|
|
541
|
+
l.push(C);
|
|
542
|
+
const m = c.getFormat ? c.getFormat() : "";
|
|
543
|
+
(m === "text/html" || m === "application/html") && (s = !0);
|
|
544
|
+
}
|
|
595
545
|
}
|
|
546
|
+
t = l.join(" ");
|
|
547
|
+
}
|
|
596
548
|
} else {
|
|
597
|
-
const
|
|
598
|
-
if (
|
|
599
|
-
const
|
|
600
|
-
|
|
601
|
-
|
|
602
|
-
|
|
603
|
-
|
|
604
|
-
value: f
|
|
605
|
-
});
|
|
606
|
-
}
|
|
607
|
-
} else if (n.body) {
|
|
608
|
-
const r = Array.isArray(n.body) ? n.body : [n.body];
|
|
609
|
-
for (const i of r) {
|
|
610
|
-
const f = s(i);
|
|
611
|
-
f && t.push({
|
|
612
|
-
purpose: "commenting",
|
|
613
|
-
value: f
|
|
614
|
-
});
|
|
615
|
-
}
|
|
549
|
+
const r = (c) => c && (c.chars || c.value || c["cnt:chars"]) || "", l = (c) => c ? c.format === "text/html" || c.type === "TextualBody" : !1;
|
|
550
|
+
if (i.resource) {
|
|
551
|
+
const c = Array.isArray(i.resource) ? i.resource : [i.resource];
|
|
552
|
+
t = c.map(r).filter(Boolean).join(" "), s = c.some(l);
|
|
553
|
+
} else if (i.body) {
|
|
554
|
+
const c = Array.isArray(i.body) ? i.body : [i.body];
|
|
555
|
+
t = c.map(r).filter(Boolean).join(" "), s = c.some(l);
|
|
616
556
|
}
|
|
617
557
|
}
|
|
618
|
-
|
|
619
|
-
let s = "";
|
|
620
|
-
typeof n.getLabel == "function" ? s = n.getLabel() : n.label && (s = Array.isArray(n.label) ? n.label.join(" ") : n.label), s && t.push({
|
|
621
|
-
purpose: "commenting",
|
|
622
|
-
value: s
|
|
623
|
-
});
|
|
624
|
-
}
|
|
625
|
-
return t;
|
|
558
|
+
return t || (typeof i.getLabel == "function" ? t = i.getLabel() || "" : i.label && (t = Array.isArray(i.label) ? i.label.join(" ") : i.label)), { value: t || "Annotation", isHtml: s };
|
|
626
559
|
}
|
|
627
|
-
function
|
|
628
|
-
const r =
|
|
629
|
-
if (!
|
|
560
|
+
function at(i, t, s = !1) {
|
|
561
|
+
const r = Le(i) || `anno-${t}`, l = Ke(i);
|
|
562
|
+
if (!l)
|
|
630
563
|
return null;
|
|
631
|
-
const
|
|
632
|
-
return
|
|
633
|
-
purpose: "search-hit",
|
|
634
|
-
value: "search-hit"
|
|
635
|
-
}), {
|
|
564
|
+
const c = it(i);
|
|
565
|
+
return {
|
|
636
566
|
id: r,
|
|
637
|
-
|
|
638
|
-
|
|
639
|
-
|
|
640
|
-
bodies: f
|
|
567
|
+
geometry: l,
|
|
568
|
+
body: c,
|
|
569
|
+
isSearchHit: s
|
|
641
570
|
};
|
|
642
571
|
}
|
|
643
|
-
function
|
|
644
|
-
return
|
|
645
|
-
const
|
|
646
|
-
return
|
|
572
|
+
function nt(i, t = /* @__PURE__ */ new Set()) {
|
|
573
|
+
return i.map((s, r) => {
|
|
574
|
+
const l = t.has(Le(s));
|
|
575
|
+
return at(s, r, l);
|
|
647
576
|
}).filter((s) => s !== null);
|
|
648
577
|
}
|
|
649
|
-
var
|
|
650
|
-
function
|
|
578
|
+
var ot = e.from_html("<div></div>"), lt = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), ct = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
|
|
579
|
+
function dt(i, t) {
|
|
651
580
|
e.push(t, !0);
|
|
652
|
-
let s = e.state(void 0), r = e.state(void 0),
|
|
581
|
+
let s = e.state(void 0), r = e.state(void 0), l = e.state(0), c = e.derived(() => {
|
|
653
582
|
if (!t.viewerState.manifestId || !t.viewerState.canvasId)
|
|
654
583
|
return [];
|
|
655
|
-
const
|
|
656
|
-
return [
|
|
657
|
-
|
|
658
|
-
|
|
659
|
-
|
|
660
|
-
|
|
661
|
-
|
|
662
|
-
|
|
663
|
-
|
|
664
|
-
|
|
665
|
-
|
|
666
|
-
|
|
667
|
-
|
|
668
|
-
|
|
584
|
+
const n = Z.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), o = t.viewerState.currentCanvasSearchAnnotations;
|
|
585
|
+
return [...n, ...o];
|
|
586
|
+
}), C = e.derived(() => {
|
|
587
|
+
const n = /* @__PURE__ */ new Set();
|
|
588
|
+
return t.viewerState.currentCanvasSearchAnnotations.forEach((o) => {
|
|
589
|
+
const f = o.id || o["@id"];
|
|
590
|
+
f && n.add(f);
|
|
591
|
+
}), n;
|
|
592
|
+
}), m = e.derived(() => nt(e.get(c), e.get(C))), u = e.derived(() => {
|
|
593
|
+
if (e.get(l), !e.get(r) || !e.get(m).length)
|
|
594
|
+
return [];
|
|
595
|
+
const n = e.get(r).world.getItemAt(0);
|
|
596
|
+
if (!n)
|
|
597
|
+
return [];
|
|
598
|
+
const o = [];
|
|
599
|
+
for (const f of e.get(m)) {
|
|
600
|
+
if (!f.isSearchHit) if (t.viewerState.showAnnotations) {
|
|
601
|
+
if (!t.viewerState.visibleAnnotationIds.has(f.id))
|
|
602
|
+
continue;
|
|
603
|
+
} else continue;
|
|
604
|
+
if (f.geometry.type === "RECTANGLE") {
|
|
605
|
+
const b = n.imageToViewportRectangle(f.geometry.x, f.geometry.y, f.geometry.w, f.geometry.h), h = e.get(r).viewport.viewportToViewerElementRectangle(b);
|
|
606
|
+
o.push({
|
|
607
|
+
id: f.id,
|
|
608
|
+
type: "RECTANGLE",
|
|
609
|
+
rect: {
|
|
610
|
+
x: h.x,
|
|
611
|
+
y: h.y,
|
|
612
|
+
width: h.width,
|
|
613
|
+
height: h.height
|
|
614
|
+
},
|
|
615
|
+
isSearchHit: f.isSearchHit,
|
|
616
|
+
tooltip: f.body.value
|
|
617
|
+
});
|
|
618
|
+
} else if (f.geometry.type === "POLYGON") {
|
|
619
|
+
const b = f.geometry.points.map((k) => {
|
|
620
|
+
const T = n.imageToViewportCoordinates(new Ie.Point(k[0], k[1])), S = e.get(r).viewport.viewportToViewerElementCoordinates(T);
|
|
621
|
+
return [S.x, S.y];
|
|
622
|
+
});
|
|
623
|
+
let h = 1 / 0, a = 1 / 0, d = -1 / 0, j = -1 / 0;
|
|
624
|
+
for (const [k, T] of b)
|
|
625
|
+
h = Math.min(h, k), a = Math.min(a, T), d = Math.max(d, k), j = Math.max(j, T);
|
|
626
|
+
const w = b.map(([k, T]) => [k - h, T - a]);
|
|
627
|
+
o.push({
|
|
628
|
+
id: f.id,
|
|
629
|
+
type: "POLYGON",
|
|
630
|
+
bounds: { x: h, y: a, width: d - h, height: j - a },
|
|
631
|
+
points: w,
|
|
632
|
+
isSearchHit: f.isSearchHit,
|
|
633
|
+
tooltip: f.body.value
|
|
634
|
+
});
|
|
635
|
+
}
|
|
636
|
+
}
|
|
637
|
+
return o;
|
|
638
|
+
});
|
|
639
|
+
Re(() => {
|
|
669
640
|
if (e.get(s))
|
|
670
641
|
return e.set(
|
|
671
642
|
r,
|
|
672
|
-
|
|
643
|
+
Ie({
|
|
673
644
|
element: e.get(s),
|
|
674
645
|
tileSources: null,
|
|
675
646
|
// Will be set via effect
|
|
@@ -686,284 +657,262 @@ function ut(n, t) {
|
|
|
686
657
|
zoomPerClick: 2
|
|
687
658
|
}),
|
|
688
659
|
!0
|
|
689
|
-
),
|
|
690
|
-
|
|
691
|
-
|
|
692
|
-
drawingEnabled: !1,
|
|
693
|
-
// @ts-ignore
|
|
694
|
-
readOnly: !0,
|
|
695
|
-
// @ts-ignore
|
|
696
|
-
disableSelect: !0
|
|
697
|
-
// We will manually manage selection if needed, or toggle this
|
|
698
|
-
}),
|
|
699
|
-
!0
|
|
700
|
-
), e.get(i).on("createAnnotation", (l) => {
|
|
701
|
-
const c = {
|
|
702
|
-
...l,
|
|
703
|
-
id: l.id || crypto.randomUUID(),
|
|
704
|
-
// Ensure ID
|
|
705
|
-
motivation: "commenting",
|
|
706
|
-
target: {
|
|
707
|
-
...l.target,
|
|
708
|
-
source: t.viewerState.canvasId
|
|
709
|
-
// Enforce canvas ID
|
|
710
|
-
}
|
|
711
|
-
};
|
|
712
|
-
t.viewerState.addAnnotation(c, t.viewerState.canvasId);
|
|
713
|
-
}), t.viewerState.canvasId && t.viewerState.loadAnnotationsFromStorage(t.viewerState.canvasId), e.get(i).on("selectionChanged", (l) => {
|
|
714
|
-
l && l.length > 0 && e.get(i) && e.get(i).cancelSelected();
|
|
715
|
-
}), e.get(i).on("mouseEnterAnnotation", (l) => {
|
|
716
|
-
e.set(f, l, !0);
|
|
717
|
-
}), e.get(i).on("mouseLeaveAnnotation", () => {
|
|
718
|
-
e.set(f, null);
|
|
719
|
-
}), e.get(s) && e.get(s).addEventListener("pointermove", (l) => {
|
|
720
|
-
const c = e.get(s).getBoundingClientRect();
|
|
721
|
-
e.set(S, { x: l.clientX - c.left, y: l.clientY - c.top }, !0);
|
|
722
|
-
}), () => {
|
|
723
|
-
var l, c;
|
|
724
|
-
(l = e.get(i)) == null || l.destroy(), (c = e.get(r)) == null || c.destroy();
|
|
660
|
+
), () => {
|
|
661
|
+
var n;
|
|
662
|
+
(n = e.get(r)) == null || n.destroy();
|
|
725
663
|
};
|
|
726
664
|
}), e.user_effect(() => {
|
|
727
|
-
|
|
728
|
-
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
e.get(
|
|
732
|
-
|
|
733
|
-
|
|
734
|
-
return {
|
|
735
|
-
fill: c ? "#facc15" : "#ef4444",
|
|
736
|
-
fillOpacity: c ? 0.4 : 0.2,
|
|
737
|
-
stroke: c ? "#facc15" : "#ef4444",
|
|
738
|
-
strokeWidth: c ? 1 : 2
|
|
739
|
-
};
|
|
740
|
-
});
|
|
741
|
-
}), e.user_effect(() => {
|
|
742
|
-
e.get(i) && (e.get(i).setDrawingEnabled(t.viewerState.isCreatingAnnotation), t.viewerState.isCreatingAnnotation && e.get(i).setDrawingTool("rect"));
|
|
743
|
-
}), e.user_effect(() => {
|
|
744
|
-
t.viewerState.canvasId && t.viewerState.loadAnnotationsFromStorage(t.viewerState.canvasId);
|
|
665
|
+
if (!e.get(r)) return;
|
|
666
|
+
const n = () => {
|
|
667
|
+
e.update(l);
|
|
668
|
+
};
|
|
669
|
+
return e.get(r).addHandler("open", n), e.get(r).addHandler("animation", n), e.get(r).addHandler("resize", n), e.get(r).addHandler("rotate", n), e.get(r).world.addHandler("add-item", n), e.get(r).world.addHandler("remove-item", n), () => {
|
|
670
|
+
e.get(r).removeHandler("open", n), e.get(r).removeHandler("animation", n), e.get(r).removeHandler("resize", n), e.get(r).removeHandler("rotate", n), e.get(r).world.removeHandler("add-item", n), e.get(r).world.removeHandler("remove-item", n);
|
|
671
|
+
};
|
|
745
672
|
}), e.user_effect(() => {
|
|
746
|
-
|
|
747
|
-
const l = t.viewerState.showAnnotations, c = t.viewerState.visibleAnnotationIds;
|
|
748
|
-
e.get(i).setFilter((a) => {
|
|
749
|
-
var d;
|
|
750
|
-
return (d = a.bodies) != null && d.some((D) => D.purpose === "search-hit") ? !0 : l ? c.has(a.id) : !1;
|
|
751
|
-
});
|
|
673
|
+
!e.get(r) || !t.tileSources || e.get(r).open(t.tileSources);
|
|
752
674
|
});
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
|
|
756
|
-
|
|
757
|
-
|
|
758
|
-
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
766
|
-
|
|
767
|
-
|
|
768
|
-
},
|
|
769
|
-
|
|
770
|
-
|
|
771
|
-
|
|
772
|
-
|
|
773
|
-
|
|
774
|
-
|
|
775
|
-
|
|
776
|
-
|
|
675
|
+
var _ = ct(), I = e.child(_);
|
|
676
|
+
e.bind_this(I, (n) => e.set(s, n), () => e.get(s));
|
|
677
|
+
var E = e.sibling(I, 2);
|
|
678
|
+
e.each(E, 17, () => e.get(u), (n) => n.id, (n, o) => {
|
|
679
|
+
var f = e.comment(), b = e.first_child(f);
|
|
680
|
+
{
|
|
681
|
+
var h = (d) => {
|
|
682
|
+
var j = ot();
|
|
683
|
+
e.template_effect(() => {
|
|
684
|
+
e.set_class(j, 1, `absolute border-2 transition-colors cursor-pointer pointer-events-auto ${e.get(o).isSearchHit ? "border-yellow-400 bg-yellow-400/40 hover:bg-yellow-400/60" : "border-red-500 bg-red-500/20 hover:bg-red-500/40"}`), e.set_style(j, `
|
|
685
|
+
left: ${e.get(o).rect.x ?? ""}px;
|
|
686
|
+
top: ${e.get(o).rect.y ?? ""}px;
|
|
687
|
+
width: ${e.get(o).rect.width ?? ""}px;
|
|
688
|
+
height: ${e.get(o).rect.height ?? ""}px;
|
|
689
|
+
`), e.set_attribute(j, "title", e.get(o).tooltip);
|
|
690
|
+
}), e.append(d, j);
|
|
691
|
+
}, a = (d) => {
|
|
692
|
+
var j = e.comment(), w = e.first_child(j);
|
|
693
|
+
{
|
|
694
|
+
var k = (T) => {
|
|
695
|
+
var S = lt(), g = e.child(S), x = e.child(g, !0);
|
|
696
|
+
e.reset(g);
|
|
697
|
+
var v = e.sibling(g);
|
|
698
|
+
e.reset(S), e.template_effect(
|
|
699
|
+
(p) => {
|
|
700
|
+
e.set_style(S, `
|
|
701
|
+
left: ${e.get(o).bounds.x ?? ""}px;
|
|
702
|
+
top: ${e.get(o).bounds.y ?? ""}px;
|
|
703
|
+
width: ${e.get(o).bounds.width ?? ""}px;
|
|
704
|
+
height: ${e.get(o).bounds.height ?? ""}px;
|
|
705
|
+
`), e.set_text(x, e.get(o).tooltip), e.set_attribute(v, "points", p), e.set_class(v, 0, `cursor-pointer transition-colors ${e.get(o).isSearchHit ? "fill-yellow-400/40 stroke-yellow-400 hover:fill-yellow-400/60" : "fill-red-500/20 stroke-red-500 hover:fill-red-500/40"}`);
|
|
706
|
+
},
|
|
707
|
+
[() => e.get(o).points.map((p) => p.join(",")).join(" ")]
|
|
708
|
+
), e.append(T, S);
|
|
709
|
+
};
|
|
710
|
+
e.if(
|
|
711
|
+
w,
|
|
712
|
+
(T) => {
|
|
713
|
+
e.get(o).type === "POLYGON" && T(k);
|
|
714
|
+
},
|
|
715
|
+
!0
|
|
716
|
+
);
|
|
717
|
+
}
|
|
718
|
+
e.append(d, j);
|
|
719
|
+
};
|
|
720
|
+
e.if(b, (d) => {
|
|
721
|
+
e.get(o).type === "RECTANGLE" ? d(h) : d(a, !1);
|
|
722
|
+
});
|
|
723
|
+
}
|
|
724
|
+
e.append(n, f);
|
|
725
|
+
}), e.reset(_), e.append(i, _), e.pop();
|
|
777
726
|
}
|
|
778
|
-
var
|
|
779
|
-
function
|
|
727
|
+
var ft = e.from_html('<div><button class="btn btn-circle btn-sm btn-ghost" aria-label="Previous Canvas"><!></button> <span class="text-sm font-mono tabular-nums"> </span> <button class="btn btn-circle btn-sm btn-ghost" aria-label="Next Canvas"><!></button></div>');
|
|
728
|
+
function gt(i, t) {
|
|
780
729
|
e.push(t, !0);
|
|
781
|
-
var s =
|
|
730
|
+
var s = ft(), r = e.child(s);
|
|
782
731
|
r.__click = () => t.viewerState.previousCanvas();
|
|
783
|
-
var
|
|
784
|
-
|
|
785
|
-
var
|
|
786
|
-
e.reset(
|
|
787
|
-
var
|
|
788
|
-
|
|
789
|
-
var
|
|
790
|
-
|
|
791
|
-
e.set_class(s, 1, `absolute left-1/2 -translate-x-1/2 bg-base-200/90 backdrop-blur rounded-full shadow-lg px-4 py-2 flex items-center gap-4 z-10 border border-base-300 transition-all duration-200 ${t.viewerState.showThumbnailGallery && t.viewerState.isGalleryDockedBottom ? "bottom-40" : "bottom-4"}`), r.disabled = !t.viewerState.hasPrevious, e.set_text(
|
|
792
|
-
}), e.append(
|
|
732
|
+
var l = e.child(r);
|
|
733
|
+
He(l, { size: 20, weight: "bold" }), e.reset(r);
|
|
734
|
+
var c = e.sibling(r, 2), C = e.child(c);
|
|
735
|
+
e.reset(c);
|
|
736
|
+
var m = e.sibling(c, 2);
|
|
737
|
+
m.__click = () => t.viewerState.nextCanvas();
|
|
738
|
+
var u = e.child(m);
|
|
739
|
+
Ne(u, { size: 20, weight: "bold" }), e.reset(m), e.reset(s), e.template_effect(() => {
|
|
740
|
+
e.set_class(s, 1, `absolute left-1/2 -translate-x-1/2 bg-base-200/90 backdrop-blur rounded-full shadow-lg px-4 py-2 flex items-center gap-4 z-10 border border-base-300 transition-all duration-200 ${t.viewerState.showThumbnailGallery && t.viewerState.isGalleryDockedBottom ? "bottom-40" : "bottom-4"}`), r.disabled = !t.viewerState.hasPrevious, e.set_text(C, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), m.disabled = !t.viewerState.hasNext;
|
|
741
|
+
}), e.append(i, s), e.pop();
|
|
793
742
|
}
|
|
794
743
|
e.delegate(["click"]);
|
|
795
|
-
var
|
|
796
|
-
function
|
|
744
|
+
var ht = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), vt = e.from_html('<button class="w-full text-left p-3 hover:bg-base-300 transition-colors cursor-pointer flex gap-3 group/item items-start focus:outline-none focus:bg-base-300"><div class="btn btn-xs btn-circle btn-ghost mt-0.5 shrink-0 pointer-events-none"><!></div> <div class="flex-1 min-w-0"><div class="flex items-start justify-between"><span class="font-bold text-sm text-primary"></span> <!></div> <div><!></div></div></button>'), ut = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'), pt = e.from_html('<div class="absolute top-4 right-4 z-500 pointer-events-auto"><details class="group relative"><summary class="flex items-center gap-2 bg-base-200/90 backdrop-blur shadow-lg rounded-full px-4 py-2 cursor-pointer list-none hover:bg-base-200 transition-all select-none border border-base-300 pointer-events-auto"><button class="btn btn-xs btn-circle btn-ghost"><!></button> <span class="text-sm font-medium"> <span class="opacity-50 text-xs font-normal ml-1"> </span></span> <!></summary> <div class="absolute right-0 mt-2 w-96 bg-base-200/95 backdrop-blur shadow-xl rounded-box p-0 max-h-[60vh] overflow-y-auto border border-base-300 flex flex-col divide-y divide-base-300"></div></details></div>');
|
|
745
|
+
function mt(i, t) {
|
|
797
746
|
e.push(t, !0);
|
|
798
|
-
const s =
|
|
747
|
+
const s = me(J);
|
|
799
748
|
let r = e.derived(() => {
|
|
800
749
|
if (!s.manifestId || !s.canvasId)
|
|
801
750
|
return [];
|
|
802
|
-
const
|
|
803
|
-
return [...
|
|
751
|
+
const n = Z.getAnnotations(s.manifestId, s.canvasId), o = s.currentCanvasSearchAnnotations;
|
|
752
|
+
return [...n, ...o];
|
|
804
753
|
});
|
|
805
|
-
function
|
|
806
|
-
return
|
|
754
|
+
function l(n) {
|
|
755
|
+
return n.id || n["@id"] || (typeof n.getId == "function" ? n.getId() : "") || "";
|
|
807
756
|
}
|
|
808
757
|
e.user_effect(() => {
|
|
809
758
|
if (e.get(r).length > 0) {
|
|
810
|
-
const
|
|
811
|
-
e.get(r).forEach((
|
|
812
|
-
const
|
|
813
|
-
|
|
814
|
-
}), s.visibleAnnotationIds =
|
|
759
|
+
const n = /* @__PURE__ */ new Set();
|
|
760
|
+
e.get(r).forEach((o) => {
|
|
761
|
+
const f = l(o);
|
|
762
|
+
f && n.add(f);
|
|
763
|
+
}), s.visibleAnnotationIds = n;
|
|
815
764
|
} else
|
|
816
765
|
s.visibleAnnotationIds = /* @__PURE__ */ new Set();
|
|
817
766
|
});
|
|
818
|
-
let
|
|
819
|
-
const
|
|
820
|
-
return !
|
|
767
|
+
let c = e.derived(() => e.get(r).length === 0 ? !1 : e.get(r).every((n) => {
|
|
768
|
+
const o = l(n);
|
|
769
|
+
return !o || s.visibleAnnotationIds.has(o);
|
|
821
770
|
}));
|
|
822
|
-
function
|
|
823
|
-
s.visibleAnnotationIds.has(
|
|
771
|
+
function C(n) {
|
|
772
|
+
s.visibleAnnotationIds.has(n) ? s.visibleAnnotationIds.delete(n) : s.visibleAnnotationIds.add(n), s.visibleAnnotationIds = new Set(s.visibleAnnotationIds);
|
|
824
773
|
}
|
|
825
|
-
function
|
|
826
|
-
if (e.get(
|
|
774
|
+
function m() {
|
|
775
|
+
if (e.get(c))
|
|
827
776
|
s.visibleAnnotationIds = /* @__PURE__ */ new Set();
|
|
828
777
|
else {
|
|
829
|
-
const
|
|
830
|
-
e.get(r).forEach((
|
|
831
|
-
const
|
|
832
|
-
|
|
833
|
-
}), s.visibleAnnotationIds =
|
|
778
|
+
const n = /* @__PURE__ */ new Set();
|
|
779
|
+
e.get(r).forEach((o) => {
|
|
780
|
+
const f = l(o);
|
|
781
|
+
f && n.add(f);
|
|
782
|
+
}), s.visibleAnnotationIds = n;
|
|
834
783
|
}
|
|
835
784
|
}
|
|
836
|
-
let
|
|
837
|
-
let
|
|
838
|
-
if (typeof
|
|
839
|
-
const
|
|
840
|
-
if (
|
|
841
|
-
const
|
|
785
|
+
let u = e.derived(() => e.get(r).length ? e.get(r).map((n) => {
|
|
786
|
+
let o = "", f = !1;
|
|
787
|
+
if (typeof n.getBody == "function") {
|
|
788
|
+
const b = n.getBody();
|
|
789
|
+
if (b && b.length) {
|
|
790
|
+
const h = (a) => {
|
|
842
791
|
const d = a.getValue ? a.getValue() : null;
|
|
843
792
|
return d || "";
|
|
844
793
|
};
|
|
845
|
-
|
|
794
|
+
o = b.map((a) => h(a)).filter(Boolean).join(" "), f = b.some((a) => {
|
|
846
795
|
const d = a.getFormat ? a.getFormat() : "";
|
|
847
796
|
return d === "text/html" || d === "application/html";
|
|
848
797
|
});
|
|
849
798
|
}
|
|
850
|
-
if (!
|
|
851
|
-
const
|
|
852
|
-
|
|
799
|
+
if (!o && typeof n.getLabel == "function") {
|
|
800
|
+
const h = n.getLabel();
|
|
801
|
+
h && (o = h);
|
|
853
802
|
}
|
|
854
803
|
} else {
|
|
855
|
-
const
|
|
856
|
-
if (
|
|
857
|
-
const a =
|
|
858
|
-
a && (
|
|
804
|
+
const b = (a) => a && (a.chars || a.value || a["cnt:chars"]) || "", h = (a) => a ? a.format === "text/html" || a.type === "TextualBody" : !1;
|
|
805
|
+
if (n.resource ? Array.isArray(n.resource) ? (o = n.resource.map((a) => b(a)).join(" "), n.resource.some((a) => h(a)) && (f = !0)) : (o = b(n.resource), h(n.resource) && (f = !0)) : n.body && (Array.isArray(n.body) ? (o = n.body.map((a) => b(a)).join(" "), n.body.some((a) => h(a)) && (f = !0)) : (o = b(n.body), h(n.body) && (f = !0))), !o) {
|
|
806
|
+
const a = n.label || n.name || n.title;
|
|
807
|
+
a && (o = Array.isArray(a) ? a.join(" ") : a);
|
|
859
808
|
}
|
|
860
809
|
}
|
|
861
810
|
return {
|
|
862
|
-
id:
|
|
863
|
-
content:
|
|
864
|
-
isHtml:
|
|
865
|
-
label: (typeof
|
|
811
|
+
id: l(n),
|
|
812
|
+
content: o,
|
|
813
|
+
isHtml: f,
|
|
814
|
+
label: (typeof n.getLabel == "function" ? n.getLabel() : n.label) || ""
|
|
866
815
|
};
|
|
867
816
|
}) : []);
|
|
868
|
-
var
|
|
817
|
+
var _ = e.comment(), I = e.first_child(_);
|
|
869
818
|
{
|
|
870
|
-
var
|
|
871
|
-
var
|
|
872
|
-
|
|
873
|
-
v.preventDefault(),
|
|
819
|
+
var E = (n) => {
|
|
820
|
+
var o = pt(), f = e.child(o), b = e.child(f), h = e.child(b);
|
|
821
|
+
h.__click = (v) => {
|
|
822
|
+
v.preventDefault(), m();
|
|
874
823
|
};
|
|
875
|
-
var a = e.child(
|
|
824
|
+
var a = e.child(h);
|
|
876
825
|
{
|
|
877
826
|
var d = (v) => {
|
|
827
|
+
ke(v, { size: 16, weight: "bold" });
|
|
828
|
+
}, j = (v) => {
|
|
878
829
|
Ce(v, { size: 16, weight: "bold" });
|
|
879
|
-
}, D = (v) => {
|
|
880
|
-
Me(v, { size: 16, weight: "bold" });
|
|
881
830
|
};
|
|
882
831
|
e.if(a, (v) => {
|
|
883
|
-
e.get(
|
|
832
|
+
e.get(c) ? v(d) : v(j, !1);
|
|
884
833
|
});
|
|
885
834
|
}
|
|
886
|
-
e.reset(
|
|
887
|
-
var
|
|
888
|
-
e.reset(
|
|
889
|
-
var g = e.sibling(
|
|
890
|
-
|
|
835
|
+
e.reset(h);
|
|
836
|
+
var w = e.sibling(h, 2), k = e.child(w), T = e.sibling(k), S = e.child(T);
|
|
837
|
+
e.reset(T), e.reset(w);
|
|
838
|
+
var g = e.sibling(w, 2);
|
|
839
|
+
Ve(g, {
|
|
891
840
|
size: 16,
|
|
892
841
|
weight: "bold",
|
|
893
842
|
class: "group-open:rotate-180 transition-transform opacity-80"
|
|
894
|
-
}), e.reset(
|
|
895
|
-
var
|
|
843
|
+
}), e.reset(b);
|
|
844
|
+
var x = e.sibling(b, 2);
|
|
896
845
|
e.each(
|
|
897
|
-
|
|
846
|
+
x,
|
|
898
847
|
21,
|
|
899
|
-
() => e.get(
|
|
848
|
+
() => e.get(u),
|
|
900
849
|
e.index,
|
|
901
|
-
(v, p,
|
|
902
|
-
const
|
|
903
|
-
var
|
|
904
|
-
|
|
905
|
-
|
|
850
|
+
(v, p, A) => {
|
|
851
|
+
const y = e.derived(() => s.visibleAnnotationIds.has(e.get(p).id));
|
|
852
|
+
var M = vt();
|
|
853
|
+
M.__click = (P) => {
|
|
854
|
+
P.preventDefault(), C(e.get(p).id);
|
|
906
855
|
};
|
|
907
|
-
var
|
|
856
|
+
var G = e.child(M), z = e.child(G);
|
|
908
857
|
{
|
|
909
|
-
var
|
|
910
|
-
|
|
911
|
-
}, K = (
|
|
912
|
-
|
|
858
|
+
var N = (P) => {
|
|
859
|
+
ke(P, { size: 16, weight: "bold" });
|
|
860
|
+
}, K = (P) => {
|
|
861
|
+
Ce(P, { size: 16, weight: "bold" });
|
|
913
862
|
};
|
|
914
|
-
e.if(
|
|
915
|
-
e.get(
|
|
863
|
+
e.if(z, (P) => {
|
|
864
|
+
e.get(y) ? P(N) : P(K, !1);
|
|
916
865
|
});
|
|
917
866
|
}
|
|
918
|
-
e.reset(
|
|
919
|
-
var q = e.sibling(
|
|
920
|
-
|
|
921
|
-
var V = e.sibling(
|
|
867
|
+
e.reset(G);
|
|
868
|
+
var q = e.sibling(G, 2), Q = e.child(q), W = e.child(Q);
|
|
869
|
+
W.textContent = `#${A + 1}`;
|
|
870
|
+
var V = e.sibling(W, 2);
|
|
922
871
|
{
|
|
923
|
-
var
|
|
924
|
-
var
|
|
925
|
-
e.reset(
|
|
872
|
+
var R = (P) => {
|
|
873
|
+
var O = ht(), U = e.child(O, !0);
|
|
874
|
+
e.reset(O), e.template_effect(() => e.set_text(U, e.get(p).label)), e.append(P, O);
|
|
926
875
|
};
|
|
927
|
-
e.if(V, (
|
|
928
|
-
e.get(p).label && e.get(p).label !== e.get(p).content &&
|
|
876
|
+
e.if(V, (P) => {
|
|
877
|
+
e.get(p).label && e.get(p).label !== e.get(p).content && P(R);
|
|
929
878
|
});
|
|
930
879
|
}
|
|
931
|
-
e.reset(
|
|
932
|
-
var
|
|
880
|
+
e.reset(Q);
|
|
881
|
+
var F = e.sibling(Q, 2), D = e.child(F);
|
|
933
882
|
{
|
|
934
|
-
var B = (
|
|
935
|
-
var
|
|
936
|
-
e.html(
|
|
937
|
-
},
|
|
938
|
-
var
|
|
939
|
-
e.template_effect(() => e.set_text(
|
|
883
|
+
var B = (P) => {
|
|
884
|
+
var O = e.comment(), U = e.first_child(O);
|
|
885
|
+
e.html(U, () => e.get(p).content), e.append(P, O);
|
|
886
|
+
}, $ = (P) => {
|
|
887
|
+
var O = e.text();
|
|
888
|
+
e.template_effect(() => e.set_text(O, e.get(p).content || "(No content)")), e.append(P, O);
|
|
940
889
|
};
|
|
941
|
-
e.if(
|
|
942
|
-
e.get(p).isHtml ?
|
|
890
|
+
e.if(D, (P) => {
|
|
891
|
+
e.get(p).isHtml ? P(B) : P($, !1);
|
|
943
892
|
});
|
|
944
893
|
}
|
|
945
|
-
e.reset(
|
|
894
|
+
e.reset(F), e.reset(q), e.reset(M), e.template_effect(() => e.set_class(F, 1, `text-sm prose prose-sm max-w-none prose-p:my-0 prose-a:text-blue-500 wrap-break-word text-left ${e.get(y) ? "" : "opacity-50"}`)), e.append(v, M);
|
|
946
895
|
},
|
|
947
896
|
(v) => {
|
|
948
|
-
var p =
|
|
897
|
+
var p = ut();
|
|
949
898
|
e.append(v, p);
|
|
950
899
|
}
|
|
951
|
-
), e.reset(
|
|
952
|
-
e.set_attribute(
|
|
953
|
-
}), e.append(
|
|
900
|
+
), e.reset(x), e.reset(f), e.reset(o), e.template_effect(() => {
|
|
901
|
+
e.set_attribute(h, "title", e.get(c) ? "Hide All Annotations" : "Show All Annotations"), e.set_text(k, `${e.get(r).length ?? ""} Annotations `), e.set_text(S, `(${s.visibleAnnotationIds.size ?? ""} visible)`);
|
|
902
|
+
}), e.append(n, o);
|
|
954
903
|
};
|
|
955
|
-
e.if(
|
|
956
|
-
s.showAnnotations &&
|
|
904
|
+
e.if(I, (n) => {
|
|
905
|
+
s.showAnnotations && n(E);
|
|
957
906
|
});
|
|
958
907
|
}
|
|
959
|
-
e.append(
|
|
908
|
+
e.append(i, _), e.pop();
|
|
960
909
|
}
|
|
961
910
|
e.delegate(["click"]);
|
|
962
|
-
var
|
|
963
|
-
function
|
|
911
|
+
var bt = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), _t = e.from_html('<span class="opacity-20 text-4xl">?</span>'), yt = e.from_html('<button><div class="aspect-4/3 bg-base-300 rounded overflow-hidden relative w-full flex items-center justify-center"><!></div> <div class="text-xs font-medium truncate w-full opacity-70 group-hover:opacity-100"><span class="font-bold mr-1"> </span> </div></button>'), xt = e.from_html('<div class="absolute bottom-0 right-0 w-6 h-6 cursor-se-resize resize-handle bg-accent hover:bg-accent-focus transition-colors z-50" style="clip-path: polygon(100% 0, 0 100%, 100% 100%);" role="button" tabindex="0" aria-label="Resize"></div>'), wt = e.from_html('<div role="group"><span class="font-bold text-primary opacity-50">Dock Top</span></div> <div role="group"><span class="font-bold text-primary opacity-50">Dock Bottom</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Left</span></div> <div role="group"><span class="font-bold text-primary opacity-50 vertical-rl rotate-180" style="writing-mode: vertical-rl;">Dock Right</span></div>', 1), St = e.from_html('<div><button class="absolute top-1 right-1 btn btn-error btn-xs btn-circle z-20" aria-label="Close Gallery"><!></button> <div><div role="button" tabindex="0" aria-label="Drag Gallery"><div></div></div></div> <div><div></div></div> <!></div> <!>', 1);
|
|
912
|
+
function At(i, t) {
|
|
964
913
|
e.push(t, !0);
|
|
965
|
-
const s =
|
|
966
|
-
let r = e.state(e.proxy({ x: 20, y: 100 })),
|
|
914
|
+
const s = me(J);
|
|
915
|
+
let r = e.state(e.proxy({ x: 20, y: 100 })), l = e.state(e.proxy({ width: 300, height: 400 })), c = e.state(!1), C = e.state(!1), m = { x: 0, y: 0 }, u = { x: 0, y: 0, w: 0, h: 0 }, _ = e.state(void 0), I = e.derived(() => t.canvases ? t.canvases.map((g, x) => {
|
|
967
916
|
let v = "";
|
|
968
917
|
try {
|
|
969
918
|
if (g.getCanonicalImageUri)
|
|
@@ -978,61 +927,61 @@ function kt(n, t) {
|
|
|
978
927
|
if (!v) {
|
|
979
928
|
const p = g.getImages();
|
|
980
929
|
if (p && p.length > 0) {
|
|
981
|
-
const
|
|
982
|
-
|
|
930
|
+
const A = p[0].getResource();
|
|
931
|
+
A && A.getServices().length > 0 ? v = `${A.getServices()[0].id}/full/200,/0/default.jpg` : A && A.id && (v = A.id);
|
|
983
932
|
}
|
|
984
933
|
}
|
|
985
934
|
return {
|
|
986
935
|
id: g.id,
|
|
987
|
-
label: g.getLabel().length ? g.getLabel()[0].value : `Canvas ${
|
|
936
|
+
label: g.getLabel().length ? g.getLabel()[0].value : `Canvas ${x + 1}`,
|
|
988
937
|
src: v,
|
|
989
|
-
index:
|
|
938
|
+
index: x
|
|
990
939
|
};
|
|
991
940
|
}) : []);
|
|
992
|
-
function
|
|
993
|
-
if (!e.get(
|
|
994
|
-
let
|
|
995
|
-
if (e.get(
|
|
996
|
-
const p = e.get(
|
|
997
|
-
|
|
941
|
+
function E(g) {
|
|
942
|
+
if (!e.get(c)) return;
|
|
943
|
+
let x = g.clientX - m.x, v = g.clientY - m.y;
|
|
944
|
+
if (e.get(_) && e.get(_).parentElement) {
|
|
945
|
+
const p = e.get(_).parentElement, A = Math.max(0, p.clientWidth - e.get(l).width), y = Math.max(0, p.clientHeight - e.get(l).height);
|
|
946
|
+
x = Math.max(0, Math.min(x, A)), v = Math.max(0, Math.min(v, y));
|
|
998
947
|
}
|
|
999
|
-
e.get(r).x =
|
|
948
|
+
e.get(r).x = x, e.get(r).y = v;
|
|
1000
949
|
}
|
|
1001
|
-
function
|
|
950
|
+
function n() {
|
|
1002
951
|
const g = e.get(d);
|
|
1003
|
-
e.set(
|
|
952
|
+
e.set(c, !1), e.set(d, null), window.removeEventListener("mousemove", E), window.removeEventListener("mouseup", n), g && e.set(a, g, !0);
|
|
1004
953
|
}
|
|
1005
|
-
function
|
|
1006
|
-
g.stopPropagation(), e.set(
|
|
954
|
+
function o(g) {
|
|
955
|
+
g.stopPropagation(), e.set(C, !0), u = {
|
|
1007
956
|
x: g.clientX,
|
|
1008
957
|
y: g.clientY,
|
|
1009
|
-
w: e.get(
|
|
1010
|
-
h: e.get(
|
|
1011
|
-
}, window.addEventListener("mousemove",
|
|
958
|
+
w: e.get(l).width,
|
|
959
|
+
h: e.get(l).height
|
|
960
|
+
}, window.addEventListener("mousemove", f), window.addEventListener("mouseup", b);
|
|
1012
961
|
}
|
|
1013
|
-
function
|
|
1014
|
-
if (!e.get(
|
|
1015
|
-
const
|
|
1016
|
-
e.get(
|
|
962
|
+
function f(g) {
|
|
963
|
+
if (!e.get(C)) return;
|
|
964
|
+
const x = g.clientX - u.x, v = g.clientY - u.y;
|
|
965
|
+
e.get(l).width = Math.max(200, u.w + x), e.get(l).height = Math.max(200, u.h + v);
|
|
1017
966
|
}
|
|
1018
|
-
function
|
|
1019
|
-
e.set(
|
|
967
|
+
function b() {
|
|
968
|
+
e.set(C, !1), window.removeEventListener("mousemove", f), window.removeEventListener("mouseup", b);
|
|
1020
969
|
}
|
|
1021
|
-
function
|
|
970
|
+
function h(g) {
|
|
1022
971
|
s.canvasId = g;
|
|
1023
972
|
}
|
|
1024
973
|
let a = e.state("bottom"), d = e.state(null);
|
|
1025
974
|
e.user_effect(() => {
|
|
1026
975
|
s.dockSide = e.get(a), s.isGalleryDockedBottom = e.get(a) === "bottom", s.isGalleryDockedRight = e.get(a) === "right";
|
|
1027
976
|
});
|
|
1028
|
-
let
|
|
1029
|
-
function
|
|
1030
|
-
var
|
|
977
|
+
let j = e.derived(() => e.get(a) === "top" || e.get(a) === "bottom" || e.get(a) === "none" && e.get(l).height < 320);
|
|
978
|
+
function w(g) {
|
|
979
|
+
var x, v;
|
|
1031
980
|
if (!g.target.closest(".resize-handle")) {
|
|
1032
981
|
if (e.get(a) !== "none") {
|
|
1033
982
|
e.set(a, "none");
|
|
1034
|
-
const p = ((v = (
|
|
1035
|
-
e.set(
|
|
983
|
+
const p = ((v = (x = e.get(_)) == null ? void 0 : x.parentElement) == null ? void 0 : v.getBoundingClientRect()) || { left: 0, top: 0 };
|
|
984
|
+
e.set(l, { width: 300, height: 400 }, !0), e.set(
|
|
1036
985
|
r,
|
|
1037
986
|
{
|
|
1038
987
|
x: g.clientX - p.left - 150,
|
|
@@ -1043,71 +992,71 @@ function kt(n, t) {
|
|
|
1043
992
|
!0
|
|
1044
993
|
);
|
|
1045
994
|
}
|
|
1046
|
-
e.set(
|
|
995
|
+
e.set(c, !0), m = {
|
|
1047
996
|
x: g.clientX - e.get(r).x,
|
|
1048
997
|
y: g.clientY - e.get(r).y
|
|
1049
|
-
}, window.addEventListener("mousemove",
|
|
998
|
+
}, window.addEventListener("mousemove", E), window.addEventListener("mouseup", n);
|
|
1050
999
|
}
|
|
1051
1000
|
}
|
|
1052
|
-
var
|
|
1001
|
+
var k = e.comment(), T = e.first_child(k);
|
|
1053
1002
|
{
|
|
1054
|
-
var
|
|
1055
|
-
var
|
|
1003
|
+
var S = (g) => {
|
|
1004
|
+
var x = St(), v = e.first_child(x), p = e.child(v);
|
|
1056
1005
|
p.__click = () => s.toggleThumbnailGallery();
|
|
1057
|
-
var
|
|
1058
|
-
|
|
1059
|
-
var
|
|
1060
|
-
|
|
1061
|
-
var
|
|
1062
|
-
e.reset(
|
|
1063
|
-
var
|
|
1064
|
-
e.each(
|
|
1065
|
-
var
|
|
1066
|
-
|
|
1067
|
-
var
|
|
1006
|
+
var A = e.child(p);
|
|
1007
|
+
Oe(A, { size: 16, weight: "bold" }), e.reset(p);
|
|
1008
|
+
var y = e.sibling(p, 2), M = e.child(y);
|
|
1009
|
+
M.__mousedown = w;
|
|
1010
|
+
var G = e.child(M);
|
|
1011
|
+
e.reset(M), e.reset(y);
|
|
1012
|
+
var z = e.sibling(y, 2), N = e.child(z);
|
|
1013
|
+
e.each(N, 21, () => e.get(I), e.index, (V, R) => {
|
|
1014
|
+
var F = yt();
|
|
1015
|
+
F.__click = () => h(e.get(R).id);
|
|
1016
|
+
var D = e.child(F), B = e.child(D);
|
|
1068
1017
|
{
|
|
1069
|
-
var
|
|
1070
|
-
var
|
|
1018
|
+
var $ = (Y) => {
|
|
1019
|
+
var X = bt();
|
|
1071
1020
|
e.template_effect(() => {
|
|
1072
|
-
e.set_attribute(
|
|
1073
|
-
}), e.append(Y,
|
|
1074
|
-
},
|
|
1075
|
-
var
|
|
1076
|
-
e.append(Y,
|
|
1021
|
+
e.set_attribute(X, "src", e.get(R).src), e.set_attribute(X, "alt", e.get(R).label);
|
|
1022
|
+
}), e.append(Y, X);
|
|
1023
|
+
}, P = (Y) => {
|
|
1024
|
+
var X = _t();
|
|
1025
|
+
e.append(Y, X);
|
|
1077
1026
|
};
|
|
1078
1027
|
e.if(B, (Y) => {
|
|
1079
|
-
e.get(
|
|
1028
|
+
e.get(R).src ? Y($) : Y(P, !1);
|
|
1080
1029
|
});
|
|
1081
1030
|
}
|
|
1082
|
-
e.reset(
|
|
1083
|
-
var
|
|
1084
|
-
e.reset(
|
|
1085
|
-
var
|
|
1086
|
-
e.reset(
|
|
1087
|
-
e.set_class(
|
|
1088
|
-
}), e.append(V,
|
|
1089
|
-
}), e.reset(
|
|
1090
|
-
var K = e.sibling(
|
|
1031
|
+
e.reset(D);
|
|
1032
|
+
var O = e.sibling(D, 2), U = e.child(O), be = e.child(U);
|
|
1033
|
+
e.reset(U);
|
|
1034
|
+
var _e = e.sibling(U);
|
|
1035
|
+
e.reset(O), e.reset(F), e.template_effect(() => {
|
|
1036
|
+
e.set_class(F, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(j) ? "w-[140px]" : ""} ${s.canvasId === e.get(R).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(F, "aria-label", `Select canvas ${e.get(R).label ?? ""}`), e.set_text(be, `${e.get(R).index + 1}.`), e.set_text(_e, ` ${e.get(R).label ?? ""}`);
|
|
1037
|
+
}), e.append(V, F);
|
|
1038
|
+
}), e.reset(N), e.reset(z);
|
|
1039
|
+
var K = e.sibling(z, 2);
|
|
1091
1040
|
{
|
|
1092
1041
|
var q = (V) => {
|
|
1093
|
-
var
|
|
1094
|
-
|
|
1042
|
+
var R = xt();
|
|
1043
|
+
R.__mousedown = o, e.append(V, R);
|
|
1095
1044
|
};
|
|
1096
1045
|
e.if(K, (V) => {
|
|
1097
1046
|
e.get(a) === "none" && V(q);
|
|
1098
1047
|
});
|
|
1099
1048
|
}
|
|
1100
|
-
e.reset(v), e.bind_this(v, (V) => e.set(
|
|
1101
|
-
var
|
|
1049
|
+
e.reset(v), e.bind_this(v, (V) => e.set(_, V), () => e.get(_));
|
|
1050
|
+
var Q = e.sibling(v, 2);
|
|
1102
1051
|
{
|
|
1103
|
-
var
|
|
1104
|
-
var
|
|
1052
|
+
var W = (V) => {
|
|
1053
|
+
var R = wt(), F = e.first_child(R), D = e.sibling(F, 2), B = e.sibling(D, 2), $ = e.sibling(B, 2);
|
|
1105
1054
|
e.template_effect(() => {
|
|
1106
|
-
e.set_class(
|
|
1107
|
-
}), e.event("mouseenter",
|
|
1055
|
+
e.set_class(F, 1, `absolute top-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "top" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(D, 1, `absolute bottom-2 left-2 right-2 h-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "bottom" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class(B, 1, `absolute top-2 bottom-2 left-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-200 ${e.get(d) === "left" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`), e.set_class($, 1, `absolute top-2 bottom-2 w-16 rounded-xl border-4 border-dashed border-primary/40 z-950 flex items-center justify-center transition-all duration-300 ${s.showSearchPanel ? "right-[328px]" : "right-2"} ${e.get(d) === "right" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`);
|
|
1056
|
+
}), e.event("mouseenter", F, () => e.set(d, "top")), e.event("mouseleave", F, () => e.set(d, null)), e.event("mouseenter", D, () => e.set(d, "bottom")), e.event("mouseleave", D, () => e.set(d, null)), e.event("mouseenter", B, () => e.set(d, "left")), e.event("mouseleave", B, () => e.set(d, null)), e.event("mouseenter", $, () => e.set(d, "right")), e.event("mouseleave", $, () => e.set(d, null)), e.append(V, R);
|
|
1108
1057
|
};
|
|
1109
|
-
e.if(
|
|
1110
|
-
e.get(
|
|
1058
|
+
e.if(Q, (V) => {
|
|
1059
|
+
e.get(c) && V(W);
|
|
1111
1060
|
});
|
|
1112
1061
|
}
|
|
1113
1062
|
e.template_effect(() => {
|
|
@@ -1115,261 +1064,261 @@ function kt(n, t) {
|
|
|
1115
1064
|
${e.get(a) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
|
|
1116
1065
|
${e.get(a) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
|
|
1117
1066
|
${e.get(a) === "left" ? "flex-col left-0 top-0 bottom-0 w-[200px] border-r" : ""}
|
|
1118
|
-
${e.get(a) === "right" ? `flex-col top-0 bottom-0 w-[200px] border-l ${s.showSearchPanel ? "right-80" : "right-0"}` : ""}` : "absolute z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden") + (e.get(
|
|
1119
|
-
}), e.append(g,
|
|
1067
|
+
${e.get(a) === "right" ? `flex-col top-0 bottom-0 w-[200px] border-l ${s.showSearchPanel ? "right-80" : "right-0"}` : ""}` : "absolute z-900 bg-base-100 shadow-2xl rounded-lg flex flex-col border border-base-300 overflow-hidden") + (e.get(c) ? " pointer-events-none opacity-80" : "")), e.set_style(v, e.get(a) !== "none" ? "" : `left: ${e.get(r).x}px; top: ${e.get(r).y}px; width: ${e.get(l).width}px; height: ${e.get(l).height}px;`), e.set_class(y, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(a) === "bottom" || e.get(a) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class(M, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(a) === "bottom" || e.get(a) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(G, 1, "bg-base-300 rounded-full " + (e.get(a) === "bottom" || e.get(a) === "top" ? "w-1.5 h-12" : "w-12 h-1.5")), e.set_class(z, 1, `flex-1 p-1 bg-base-100 ${e.get(j) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(N, 1, e.clsx(e.get(j) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(N, e.get(j) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
|
|
1068
|
+
}), e.append(g, x);
|
|
1120
1069
|
};
|
|
1121
|
-
e.if(
|
|
1122
|
-
s.showThumbnailGallery && g(
|
|
1070
|
+
e.if(T, (g) => {
|
|
1071
|
+
s.showThumbnailGallery && g(S);
|
|
1123
1072
|
});
|
|
1124
1073
|
}
|
|
1125
|
-
e.append(
|
|
1074
|
+
e.append(i, k), e.pop();
|
|
1126
1075
|
}
|
|
1127
1076
|
e.delegate(["click", "mousedown"]);
|
|
1128
|
-
var
|
|
1129
|
-
function
|
|
1077
|
+
var It = e.from_html('<div data-tip="Menu"><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><!></div> <div class="fab-close tooltip tooltip-top" data-tip="Search"><button aria-label="Toggle Search"><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-top"><button aria-label="Toggle Annotations"><!></button></div> <div class="tooltip tooltip-top" data-tip="Metadata"><button aria-label="Toggle Metadata"><!></button></div></div>');
|
|
1078
|
+
function kt(i, t) {
|
|
1130
1079
|
e.push(t, !1);
|
|
1131
|
-
const s =
|
|
1080
|
+
const s = me(J);
|
|
1132
1081
|
e.init();
|
|
1133
|
-
var r =
|
|
1134
|
-
|
|
1135
|
-
var
|
|
1136
|
-
|
|
1137
|
-
var
|
|
1138
|
-
|
|
1139
|
-
var
|
|
1140
|
-
|
|
1141
|
-
var
|
|
1142
|
-
|
|
1143
|
-
var
|
|
1144
|
-
|
|
1145
|
-
var
|
|
1082
|
+
var r = It(), l = e.child(r), c = e.child(l);
|
|
1083
|
+
$e(c, { size: 32, weight: "bold" }), e.reset(l);
|
|
1084
|
+
var C = e.sibling(l, 2), m = e.child(C);
|
|
1085
|
+
m.__click = () => s.toggleSearchPanel();
|
|
1086
|
+
var u = e.child(m);
|
|
1087
|
+
Me(u, { size: 28, weight: "bold" }), e.reset(m), e.reset(C);
|
|
1088
|
+
var _ = e.sibling(C, 2), I = e.child(_);
|
|
1089
|
+
I.__click = () => s.toggleThumbnailGallery();
|
|
1090
|
+
var E = e.child(I);
|
|
1091
|
+
Qe(E, { size: 28, weight: "bold" }), e.reset(I), e.reset(_);
|
|
1092
|
+
var n = e.sibling(_, 2), o = e.child(n);
|
|
1093
|
+
o.__click = () => s.toggleFullScreen();
|
|
1094
|
+
var f = e.child(o);
|
|
1146
1095
|
{
|
|
1147
|
-
var
|
|
1148
|
-
|
|
1149
|
-
},
|
|
1150
|
-
|
|
1096
|
+
var b = (S) => {
|
|
1097
|
+
Ye(S, { size: 28, weight: "bold" });
|
|
1098
|
+
}, h = (S) => {
|
|
1099
|
+
Xe(S, { size: 28, weight: "bold" });
|
|
1151
1100
|
};
|
|
1152
|
-
e.if(
|
|
1153
|
-
s.isFullScreen ?
|
|
1101
|
+
e.if(f, (S) => {
|
|
1102
|
+
s.isFullScreen ? S(b) : S(h, !1);
|
|
1154
1103
|
});
|
|
1155
1104
|
}
|
|
1156
|
-
e.reset(
|
|
1157
|
-
var a = e.sibling(
|
|
1105
|
+
e.reset(o), e.reset(n);
|
|
1106
|
+
var a = e.sibling(n, 2), d = e.child(a);
|
|
1158
1107
|
d.__click = () => s.toggleAnnotations();
|
|
1159
|
-
var
|
|
1160
|
-
|
|
1161
|
-
var
|
|
1162
|
-
|
|
1163
|
-
var
|
|
1164
|
-
|
|
1165
|
-
e.set_class(r, 1, `fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 ${s.showSearchPanel ? s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[540px]" : "right-[344px]" : s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[220px]" : "right-6"} ${s.showThumbnailGallery && s.dockSide === "bottom" ? "bottom-40" : "bottom-6"}`), e.set_class(
|
|
1108
|
+
var j = e.child(d);
|
|
1109
|
+
Be(j, { size: 28, weight: "bold" }), e.reset(d), e.reset(a);
|
|
1110
|
+
var w = e.sibling(a, 2), k = e.child(w);
|
|
1111
|
+
k.__click = () => s.toggleMetadataDialog();
|
|
1112
|
+
var T = e.child(k);
|
|
1113
|
+
qe(T, { size: 28, weight: "bold" }), e.reset(k), e.reset(w), e.reset(r), e.template_effect(() => {
|
|
1114
|
+
e.set_class(r, 1, `fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 ${s.showSearchPanel ? s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[540px]" : "right-[344px]" : s.showThumbnailGallery && s.isGalleryDockedRight ? "right-[220px]" : "right-6"} ${s.showThumbnailGallery && s.dockSide === "bottom" ? "bottom-40" : "bottom-6"}`), e.set_class(m, 1, e.clsx([
|
|
1166
1115
|
"btn btn-circle btn-lg shadow-lg",
|
|
1167
1116
|
s.showSearchPanel && "btn-primary",
|
|
1168
1117
|
!s.showSearchPanel && "btn-neutral"
|
|
1169
|
-
])), e.set_attribute(
|
|
1170
|
-
}), e.append(
|
|
1118
|
+
])), e.set_attribute(_, "data-tip", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_attribute(I, "aria-label", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_class(I, 1, `btn btn-lg btn-circle shadow-lg ${s.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(n, "data-tip", s.isFullScreen ? "Exit Full Screen" : "Enter Full Screen"), e.set_class(o, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${s.isFullScreen ? "btn-warning" : "btn-neutral"}`), e.set_attribute(a, "data-tip", s.showAnnotations ? "Hide Annotations" : "Show Annotations"), e.set_class(d, 1, `btn btn-lg btn-circle shadow-lg ${s.showAnnotations ? "btn-error" : "btn-neutral"}`), e.set_class(k, 1, `btn btn-lg btn-circle shadow-lg ${s.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
|
|
1119
|
+
}), e.append(i, r), e.pop();
|
|
1171
1120
|
}
|
|
1172
1121
|
e.delegate(["click"]);
|
|
1173
|
-
var
|
|
1174
|
-
function Et(
|
|
1122
|
+
var Ct = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), jt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">Attribution</dt> <dd class="text-sm ps-2"><!></dd>', 1), Tt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">License</dt> <dd class="text-sm ps-2"><a target="_blank" rel="noreferrer" class="link link-primary break-all"> </a></dd>', 1), Mt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Lt = e.from_html('<dialog class="modal absolute" style="position: absolute;"><div class="modal-box w-11/12 max-w-5xl"><form method="dialog"><button class="btn btn-sm btn-circle btn-ghost absolute right-2 top-2">✕</button></form> <h3 class="font-bold text-lg mb-4"> </h3> <div class="py-4 overflow-y-auto max-h-[70vh]"><!> <dl class="grid grid-cols-1 md:grid-cols-[200px_1fr]"><!> <!> <!></dl></div> <div class="modal-action"><form method="dialog"><button class="btn">Close</button></form></div></div> <form method="dialog" class="modal-backdrop"><button>close</button></form></dialog>');
|
|
1123
|
+
function Et(i, t) {
|
|
1175
1124
|
e.push(t, !0);
|
|
1176
|
-
const s =
|
|
1177
|
-
let r = e.derived(() => s.manifest),
|
|
1125
|
+
const s = me(J);
|
|
1126
|
+
let r = e.derived(() => s.manifest), l = e.derived(() => {
|
|
1178
1127
|
if (!e.get(r)) return [];
|
|
1179
|
-
const
|
|
1180
|
-
return
|
|
1181
|
-
let
|
|
1182
|
-
if (
|
|
1183
|
-
const
|
|
1184
|
-
Array.isArray(
|
|
1185
|
-
} else
|
|
1186
|
-
if (
|
|
1187
|
-
const
|
|
1188
|
-
Array.isArray(
|
|
1189
|
-
} else
|
|
1190
|
-
return { label:
|
|
1128
|
+
const A = e.get(r).getMetadata();
|
|
1129
|
+
return A ? A.map((y) => {
|
|
1130
|
+
let M = "", G = "";
|
|
1131
|
+
if (y.getLabel) {
|
|
1132
|
+
const z = y.getLabel();
|
|
1133
|
+
Array.isArray(z) ? M = z.map((N) => N.value).join(" ") : M = z;
|
|
1134
|
+
} else y.label && (typeof y.label == "string" ? M = y.label : Array.isArray(y.label) ? M = y.label.map((z) => z.value).join(" ") : M = String(y.label));
|
|
1135
|
+
if (y.getValue) {
|
|
1136
|
+
const z = y.getValue();
|
|
1137
|
+
Array.isArray(z) ? G = z.map((N) => N.value).join(" ") : G = z;
|
|
1138
|
+
} else y.value && (typeof y.value == "string" ? G = y.value : Array.isArray(y.value) ? G = y.value.map((z) => z.value).join(" ") : G = String(y.value));
|
|
1139
|
+
return { label: M, value: G };
|
|
1191
1140
|
}) : [];
|
|
1192
|
-
}),
|
|
1193
|
-
var
|
|
1194
|
-
return e.get(r) ? (
|
|
1195
|
-
}),
|
|
1196
|
-
var
|
|
1197
|
-
|
|
1198
|
-
var
|
|
1199
|
-
e.reset(
|
|
1200
|
-
var
|
|
1141
|
+
}), c = e.derived(() => e.get(r) ? e.get(r).getDescription() : ""), C = e.derived(() => {
|
|
1142
|
+
var A;
|
|
1143
|
+
return e.get(r) ? (A = e.get(r).getRequiredStatement()) == null ? void 0 : A.getValue() : "";
|
|
1144
|
+
}), m = e.derived(() => e.get(r) ? e.get(r).getLicense() : "");
|
|
1145
|
+
var u = Lt(), _ = e.child(u), I = e.child(_), E = e.child(I);
|
|
1146
|
+
E.__click = () => s.toggleMetadataDialog(), e.reset(I);
|
|
1147
|
+
var n = e.sibling(I, 2), o = e.child(n, !0);
|
|
1148
|
+
e.reset(n);
|
|
1149
|
+
var f = e.sibling(n, 2), b = e.child(f);
|
|
1201
1150
|
{
|
|
1202
|
-
var
|
|
1203
|
-
var
|
|
1204
|
-
e.html(
|
|
1151
|
+
var h = (A) => {
|
|
1152
|
+
var y = Ct(), M = e.child(y), G = e.child(M);
|
|
1153
|
+
e.html(G, () => e.get(c)), e.reset(M), e.reset(y), e.append(A, y);
|
|
1205
1154
|
};
|
|
1206
|
-
e.if(
|
|
1207
|
-
e.get(
|
|
1155
|
+
e.if(b, (A) => {
|
|
1156
|
+
e.get(c) && A(h);
|
|
1208
1157
|
});
|
|
1209
1158
|
}
|
|
1210
|
-
var a = e.sibling(
|
|
1159
|
+
var a = e.sibling(b, 2), d = e.child(a);
|
|
1211
1160
|
{
|
|
1212
|
-
var
|
|
1213
|
-
var
|
|
1214
|
-
e.html(
|
|
1161
|
+
var j = (A) => {
|
|
1162
|
+
var y = jt(), M = e.sibling(e.first_child(y), 2), G = e.child(M);
|
|
1163
|
+
e.html(G, () => e.get(C)), e.reset(M), e.append(A, y);
|
|
1215
1164
|
};
|
|
1216
|
-
e.if(d, (
|
|
1217
|
-
e.get(
|
|
1165
|
+
e.if(d, (A) => {
|
|
1166
|
+
e.get(C) && A(j);
|
|
1218
1167
|
});
|
|
1219
1168
|
}
|
|
1220
|
-
var
|
|
1169
|
+
var w = e.sibling(d, 2);
|
|
1221
1170
|
{
|
|
1222
|
-
var
|
|
1223
|
-
var
|
|
1224
|
-
e.reset(
|
|
1225
|
-
e.set_attribute(
|
|
1226
|
-
}), e.append(
|
|
1171
|
+
var k = (A) => {
|
|
1172
|
+
var y = Tt(), M = e.sibling(e.first_child(y), 2), G = e.child(M), z = e.child(G, !0);
|
|
1173
|
+
e.reset(G), e.reset(M), e.template_effect(() => {
|
|
1174
|
+
e.set_attribute(G, "href", e.get(m)), e.set_text(z, e.get(m));
|
|
1175
|
+
}), e.append(A, y);
|
|
1227
1176
|
};
|
|
1228
|
-
e.if(
|
|
1229
|
-
e.get(
|
|
1177
|
+
e.if(w, (A) => {
|
|
1178
|
+
e.get(m) && A(k);
|
|
1230
1179
|
});
|
|
1231
1180
|
}
|
|
1232
|
-
var
|
|
1233
|
-
e.each(
|
|
1234
|
-
var
|
|
1235
|
-
e.reset(
|
|
1236
|
-
var
|
|
1237
|
-
e.html(K, () => e.get(
|
|
1238
|
-
}), e.reset(a), e.reset(
|
|
1239
|
-
var
|
|
1240
|
-
|
|
1241
|
-
var v = e.sibling(
|
|
1242
|
-
p.__click = () => s.toggleMetadataDialog(), e.reset(v), e.reset(
|
|
1243
|
-
(
|
|
1244
|
-
|
|
1181
|
+
var T = e.sibling(w, 2);
|
|
1182
|
+
e.each(T, 17, () => e.get(l), e.index, (A, y) => {
|
|
1183
|
+
var M = Mt(), G = e.first_child(M), z = e.child(G, !0);
|
|
1184
|
+
e.reset(G);
|
|
1185
|
+
var N = e.sibling(G, 2), K = e.child(N);
|
|
1186
|
+
e.html(K, () => e.get(y).value), e.reset(N), e.template_effect(() => e.set_text(z, e.get(y).label)), e.append(A, M);
|
|
1187
|
+
}), e.reset(a), e.reset(f);
|
|
1188
|
+
var S = e.sibling(f, 2), g = e.child(S), x = e.child(g);
|
|
1189
|
+
x.__click = () => s.toggleMetadataDialog(), e.reset(g), e.reset(S), e.reset(_);
|
|
1190
|
+
var v = e.sibling(_, 2), p = e.child(v);
|
|
1191
|
+
p.__click = () => s.toggleMetadataDialog(), e.reset(v), e.reset(u), e.template_effect(
|
|
1192
|
+
(A) => {
|
|
1193
|
+
u.open = s.showMetadataDialog, e.set_text(o, A);
|
|
1245
1194
|
},
|
|
1246
1195
|
[
|
|
1247
1196
|
() => e.get(r) ? e.get(r).getLabel().length ? e.get(r).getLabel()[0].value : "Manifest Metadata" : "Loading..."
|
|
1248
1197
|
]
|
|
1249
|
-
), e.append(
|
|
1198
|
+
), e.append(i, u), e.pop();
|
|
1250
1199
|
}
|
|
1251
1200
|
e.delegate(["click"]);
|
|
1252
|
-
var
|
|
1253
|
-
function
|
|
1201
|
+
var Gt = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), zt = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Pt = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Rt = e.from_html('<div class="text-center opacity-50 p-4 text-sm">Enter a search term to find occurrences within this manifest.</div>'), Dt = e.from_html('<div class="leading-relaxed"><span><!></span> <span class="bg-yellow-200 text-yellow-900 font-bold px-0.5 rounded"><!></span> <span><!></span></div>'), Ft = e.from_html('<div class="leading-relaxed"> </div>'), Ht = e.from_html('<button class="w-full text-left card bg-base-100 shadow hover:shadow-md transition-all p-4 text-sm group border border-transparent hover:border-primary focus:outline-none focus:ring-2 focus:ring-primary"><div class="flex justify-between items-baseline mb-1"><span class="font-bold text-xs opacity-70 bg-base-200 px-1.5 py-0.5 rounded"> </span></div> <!></button>'), Nt = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Vt = e.from_html('<div class="absolute top-0 right-0 h-full w-80 bg-base-200 shadow-2xl z-1000 transform transition-transform duration-300 flex flex-col border-l border-base-300" role="dialog" aria-label="Search Panel"><div class="p-4 bg-base-300 flex justify-between items-center shrink-0"><h2 class="font-bold text-lg">Search</h2> <button class="btn btn-sm btn-circle btn-ghost" aria-label="Close Search">✕</button></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="join w-full"><input type="text" placeholder="Search content..." class="input input-bordered join-item w-full"/> <button class="btn btn-primary join-item" aria-label="Search"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');
|
|
1202
|
+
function Ot(i, t) {
|
|
1254
1203
|
e.push(t, !0);
|
|
1255
|
-
const s =
|
|
1204
|
+
const s = me(J);
|
|
1256
1205
|
let r = e.state(e.proxy(s.searchQuery));
|
|
1257
|
-
function
|
|
1206
|
+
function l() {
|
|
1258
1207
|
s.search(e.get(r));
|
|
1259
1208
|
}
|
|
1260
|
-
function
|
|
1261
|
-
|
|
1209
|
+
function c(I) {
|
|
1210
|
+
I.key === "Enter" && l();
|
|
1262
1211
|
}
|
|
1263
|
-
function
|
|
1264
|
-
const
|
|
1265
|
-
|
|
1212
|
+
function C(I) {
|
|
1213
|
+
const E = s.canvases[I.canvasIndex];
|
|
1214
|
+
E && (s.canvasId = E.id);
|
|
1266
1215
|
}
|
|
1267
|
-
var
|
|
1216
|
+
var m = e.comment(), u = e.first_child(m);
|
|
1268
1217
|
{
|
|
1269
|
-
var
|
|
1270
|
-
var
|
|
1271
|
-
|
|
1272
|
-
var
|
|
1273
|
-
e.remove_input_defaults(
|
|
1274
|
-
var a = e.sibling(
|
|
1275
|
-
a.__click =
|
|
1218
|
+
var _ = (I) => {
|
|
1219
|
+
var E = Vt(), n = e.child(E), o = e.sibling(e.child(n), 2);
|
|
1220
|
+
o.__click = () => s.toggleSearchPanel(), e.reset(n);
|
|
1221
|
+
var f = e.sibling(n, 2), b = e.child(f), h = e.child(b);
|
|
1222
|
+
e.remove_input_defaults(h), h.__keydown = c;
|
|
1223
|
+
var a = e.sibling(h, 2);
|
|
1224
|
+
a.__click = l;
|
|
1276
1225
|
var d = e.child(a);
|
|
1277
1226
|
{
|
|
1278
|
-
var
|
|
1279
|
-
var v =
|
|
1280
|
-
e.append(
|
|
1281
|
-
},
|
|
1282
|
-
|
|
1227
|
+
var j = (x) => {
|
|
1228
|
+
var v = Gt();
|
|
1229
|
+
e.append(x, v);
|
|
1230
|
+
}, w = (x) => {
|
|
1231
|
+
Me(x, { size: 20, weight: "bold" });
|
|
1283
1232
|
};
|
|
1284
|
-
e.if(d, (
|
|
1285
|
-
s.isSearching ?
|
|
1233
|
+
e.if(d, (x) => {
|
|
1234
|
+
s.isSearching ? x(j) : x(w, !1);
|
|
1286
1235
|
});
|
|
1287
1236
|
}
|
|
1288
|
-
e.reset(a), e.reset(
|
|
1289
|
-
var
|
|
1237
|
+
e.reset(a), e.reset(b), e.reset(f);
|
|
1238
|
+
var k = e.sibling(f, 2), T = e.child(k);
|
|
1290
1239
|
{
|
|
1291
|
-
var
|
|
1292
|
-
var v =
|
|
1293
|
-
e.append(
|
|
1294
|
-
}, g = (
|
|
1240
|
+
var S = (x) => {
|
|
1241
|
+
var v = zt();
|
|
1242
|
+
e.append(x, v);
|
|
1243
|
+
}, g = (x) => {
|
|
1295
1244
|
var v = e.comment(), p = e.first_child(v);
|
|
1296
1245
|
{
|
|
1297
|
-
var
|
|
1298
|
-
var
|
|
1299
|
-
e.reset(
|
|
1300
|
-
},
|
|
1301
|
-
var
|
|
1246
|
+
var A = (M) => {
|
|
1247
|
+
var G = Pt(), z = e.child(G);
|
|
1248
|
+
e.reset(G), e.template_effect(() => e.set_text(z, `No results found for "${s.searchQuery ?? ""}"`)), e.append(M, G);
|
|
1249
|
+
}, y = (M) => {
|
|
1250
|
+
var G = e.comment(), z = e.first_child(G);
|
|
1302
1251
|
{
|
|
1303
|
-
var
|
|
1304
|
-
var
|
|
1305
|
-
e.append(q,
|
|
1252
|
+
var N = (q) => {
|
|
1253
|
+
var Q = Rt();
|
|
1254
|
+
e.append(q, Q);
|
|
1306
1255
|
}, K = (q) => {
|
|
1307
|
-
var
|
|
1308
|
-
e.reset(
|
|
1309
|
-
var
|
|
1310
|
-
e.each(
|
|
1311
|
-
var B =
|
|
1312
|
-
B.__click = () =>
|
|
1313
|
-
var
|
|
1314
|
-
e.reset(
|
|
1315
|
-
var
|
|
1256
|
+
var Q = Nt(), W = e.first_child(Q), V = e.child(W);
|
|
1257
|
+
e.reset(W);
|
|
1258
|
+
var R = e.sibling(W, 2);
|
|
1259
|
+
e.each(R, 17, () => s.searchResults, e.index, (F, D) => {
|
|
1260
|
+
var B = Ht();
|
|
1261
|
+
B.__click = () => C(e.get(D));
|
|
1262
|
+
var $ = e.child(B), P = e.child($), O = e.child(P, !0);
|
|
1263
|
+
e.reset(P), e.reset($);
|
|
1264
|
+
var U = e.sibling($, 2);
|
|
1316
1265
|
{
|
|
1317
|
-
var
|
|
1318
|
-
var
|
|
1319
|
-
e.html(
|
|
1320
|
-
var
|
|
1321
|
-
e.html(
|
|
1322
|
-
var
|
|
1323
|
-
e.html(ze, () => e.get(
|
|
1324
|
-
},
|
|
1325
|
-
var
|
|
1326
|
-
e.reset(
|
|
1266
|
+
var be = (Y) => {
|
|
1267
|
+
var X = Dt(), ee = e.child(X), Ee = e.child(ee);
|
|
1268
|
+
e.html(Ee, () => e.get(D).before), e.reset(ee);
|
|
1269
|
+
var ye = e.sibling(ee, 2), Ge = e.child(ye);
|
|
1270
|
+
e.html(Ge, () => e.get(D).match), e.reset(ye);
|
|
1271
|
+
var Se = e.sibling(ye, 2), ze = e.child(Se);
|
|
1272
|
+
e.html(ze, () => e.get(D).after), e.reset(Se), e.reset(X), e.append(Y, X);
|
|
1273
|
+
}, _e = (Y) => {
|
|
1274
|
+
var X = Ft(), ee = e.child(X, !0);
|
|
1275
|
+
e.reset(X), e.template_effect(() => e.set_text(ee, e.get(D).match)), e.append(Y, X);
|
|
1327
1276
|
};
|
|
1328
|
-
e.if(
|
|
1329
|
-
e.get(
|
|
1277
|
+
e.if(U, (Y) => {
|
|
1278
|
+
e.get(D).type === "hit" ? Y(be) : Y(_e, !1);
|
|
1330
1279
|
});
|
|
1331
1280
|
}
|
|
1332
|
-
e.reset(B), e.template_effect(() => e.set_text(
|
|
1333
|
-
}), e.template_effect(() => e.set_text(V, `${s.searchResults.length ?? ""} Results`)), e.append(q,
|
|
1281
|
+
e.reset(B), e.template_effect(() => e.set_text(O, e.get(D).canvasLabel)), e.append(F, B);
|
|
1282
|
+
}), e.template_effect(() => e.set_text(V, `${s.searchResults.length ?? ""} Results`)), e.append(q, Q);
|
|
1334
1283
|
};
|
|
1335
1284
|
e.if(
|
|
1336
|
-
|
|
1285
|
+
z,
|
|
1337
1286
|
(q) => {
|
|
1338
|
-
s.searchResults.length === 0 && !s.searchQuery ? q(
|
|
1287
|
+
s.searchResults.length === 0 && !s.searchQuery ? q(N) : q(K, !1);
|
|
1339
1288
|
},
|
|
1340
1289
|
!0
|
|
1341
1290
|
);
|
|
1342
1291
|
}
|
|
1343
|
-
e.append(
|
|
1292
|
+
e.append(M, G);
|
|
1344
1293
|
};
|
|
1345
1294
|
e.if(
|
|
1346
1295
|
p,
|
|
1347
|
-
(
|
|
1348
|
-
s.searchResults.length === 0 && s.searchQuery ?
|
|
1296
|
+
(M) => {
|
|
1297
|
+
s.searchResults.length === 0 && s.searchQuery ? M(A) : M(y, !1);
|
|
1349
1298
|
},
|
|
1350
1299
|
!0
|
|
1351
1300
|
);
|
|
1352
1301
|
}
|
|
1353
|
-
e.append(
|
|
1302
|
+
e.append(x, v);
|
|
1354
1303
|
};
|
|
1355
|
-
e.if(
|
|
1356
|
-
s.isSearching ?
|
|
1304
|
+
e.if(T, (x) => {
|
|
1305
|
+
s.isSearching ? x(S) : x(g, !1);
|
|
1357
1306
|
});
|
|
1358
1307
|
}
|
|
1359
|
-
e.reset(
|
|
1308
|
+
e.reset(k), e.reset(E), e.bind_value(h, () => e.get(r), (x) => e.set(r, x)), e.append(I, E);
|
|
1360
1309
|
};
|
|
1361
|
-
e.if(
|
|
1362
|
-
s.showSearchPanel &&
|
|
1310
|
+
e.if(u, (I) => {
|
|
1311
|
+
s.showSearchPanel && I(_);
|
|
1363
1312
|
});
|
|
1364
1313
|
}
|
|
1365
|
-
e.append(
|
|
1314
|
+
e.append(i, m), e.pop();
|
|
1366
1315
|
}
|
|
1367
1316
|
e.delegate(["click", "keydown"]);
|
|
1368
|
-
var
|
|
1369
|
-
function
|
|
1317
|
+
var Bt = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), Yt = e.from_html('<div class="text-error"> </div>'), Xt = e.from_html('<div class="text-base-content/50">No image found</div>'), qt = e.from_html("<!> <!>", 1), $t = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
|
|
1318
|
+
function gs(i, t) {
|
|
1370
1319
|
e.push(t, !0);
|
|
1371
|
-
const s = new
|
|
1372
|
-
|
|
1320
|
+
const s = new We();
|
|
1321
|
+
De(J, s), e.user_effect(() => {
|
|
1373
1322
|
t.manifestId && s.setManifest(t.manifestId);
|
|
1374
1323
|
}), e.user_effect(() => {
|
|
1375
1324
|
const a = () => {
|
|
@@ -1379,120 +1328,120 @@ function ms(n, t) {
|
|
|
1379
1328
|
document.removeEventListener("fullscreenchange", a);
|
|
1380
1329
|
};
|
|
1381
1330
|
});
|
|
1382
|
-
let r = e.derived(() => s.manifest),
|
|
1383
|
-
if (!e.get(
|
|
1331
|
+
let r = e.derived(() => s.manifest), l = e.derived(() => s.canvases), c = e.derived(() => s.currentCanvasIndex), C = e.derived(() => {
|
|
1332
|
+
if (!e.get(l) || e.get(c) === -1 || !e.get(l)[e.get(c)])
|
|
1384
1333
|
return console.log("TriiiceratopsViewer: No canvas found"), null;
|
|
1385
|
-
const d = e.get(
|
|
1334
|
+
const d = e.get(l)[e.get(c)].getImages();
|
|
1386
1335
|
if (!d || !d.length)
|
|
1387
1336
|
return console.log("TriiiceratopsViewer: No images in canvas"), null;
|
|
1388
|
-
const
|
|
1389
|
-
if (!
|
|
1337
|
+
const w = d[0].getResource();
|
|
1338
|
+
if (!w)
|
|
1390
1339
|
return console.log("TriiiceratopsViewer: No resource in annotation"), null;
|
|
1391
|
-
const
|
|
1392
|
-
if (
|
|
1393
|
-
let g =
|
|
1340
|
+
const k = w.getService();
|
|
1341
|
+
if (k) {
|
|
1342
|
+
let g = k.id;
|
|
1394
1343
|
return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
|
|
1395
1344
|
}
|
|
1396
|
-
const
|
|
1397
|
-
if (
|
|
1398
|
-
let g =
|
|
1345
|
+
const T = w.getServices();
|
|
1346
|
+
if (T && T.length > 0) {
|
|
1347
|
+
let g = T[0].id;
|
|
1399
1348
|
return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
|
|
1400
1349
|
}
|
|
1401
|
-
if (
|
|
1402
|
-
const g =
|
|
1403
|
-
if (
|
|
1404
|
-
return `${g.slice(0,
|
|
1350
|
+
if (w.id && w.id.includes("/iiif/")) {
|
|
1351
|
+
const g = w.id.split("/"), x = g.findIndex((v) => v === "full" || v.match(/^\d+,\d+,\d+,\d+$/));
|
|
1352
|
+
if (x > 0)
|
|
1353
|
+
return `${g.slice(0, x).join("/")}/info.json`;
|
|
1405
1354
|
}
|
|
1406
|
-
return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url:
|
|
1355
|
+
return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: w.id };
|
|
1407
1356
|
});
|
|
1408
|
-
var
|
|
1357
|
+
var m = $t(), u = e.child(m);
|
|
1409
1358
|
{
|
|
1410
|
-
var
|
|
1411
|
-
var d =
|
|
1359
|
+
var _ = (a) => {
|
|
1360
|
+
var d = Bt();
|
|
1412
1361
|
e.append(a, d);
|
|
1413
|
-
},
|
|
1414
|
-
var d = e.comment(),
|
|
1362
|
+
}, I = (a) => {
|
|
1363
|
+
var d = e.comment(), j = e.first_child(d);
|
|
1415
1364
|
{
|
|
1416
|
-
var
|
|
1417
|
-
var
|
|
1418
|
-
e.reset(
|
|
1419
|
-
},
|
|
1420
|
-
var
|
|
1365
|
+
var w = (T) => {
|
|
1366
|
+
var S = Yt(), g = e.child(S);
|
|
1367
|
+
e.reset(S), e.template_effect(() => e.set_text(g, `Error: ${e.get(r).error ?? ""}`)), e.append(T, S);
|
|
1368
|
+
}, k = (T) => {
|
|
1369
|
+
var S = e.comment(), g = e.first_child(S);
|
|
1421
1370
|
{
|
|
1422
|
-
var
|
|
1423
|
-
var
|
|
1424
|
-
e.key(
|
|
1425
|
-
|
|
1371
|
+
var x = (p) => {
|
|
1372
|
+
var A = e.comment(), y = e.first_child(A);
|
|
1373
|
+
e.key(y, () => e.get(C), (M) => {
|
|
1374
|
+
dt(M, {
|
|
1426
1375
|
get tileSources() {
|
|
1427
|
-
return e.get(
|
|
1376
|
+
return e.get(C);
|
|
1428
1377
|
},
|
|
1429
1378
|
get viewerState() {
|
|
1430
1379
|
return s;
|
|
1431
1380
|
}
|
|
1432
1381
|
});
|
|
1433
|
-
}), e.append(p,
|
|
1382
|
+
}), e.append(p, A);
|
|
1434
1383
|
}, v = (p) => {
|
|
1435
|
-
var
|
|
1436
|
-
e.append(p,
|
|
1384
|
+
var A = Xt();
|
|
1385
|
+
e.append(p, A);
|
|
1437
1386
|
};
|
|
1438
1387
|
e.if(
|
|
1439
1388
|
g,
|
|
1440
1389
|
(p) => {
|
|
1441
|
-
e.get(
|
|
1390
|
+
e.get(C) ? p(x) : p(v, !1);
|
|
1442
1391
|
},
|
|
1443
1392
|
!0
|
|
1444
1393
|
);
|
|
1445
1394
|
}
|
|
1446
|
-
e.append(
|
|
1395
|
+
e.append(T, S);
|
|
1447
1396
|
};
|
|
1448
1397
|
e.if(
|
|
1449
|
-
|
|
1450
|
-
(
|
|
1451
|
-
var
|
|
1452
|
-
(
|
|
1398
|
+
j,
|
|
1399
|
+
(T) => {
|
|
1400
|
+
var S;
|
|
1401
|
+
(S = e.get(r)) != null && S.error ? T(w) : T(k, !1);
|
|
1453
1402
|
},
|
|
1454
1403
|
!0
|
|
1455
1404
|
);
|
|
1456
1405
|
}
|
|
1457
1406
|
e.append(a, d);
|
|
1458
1407
|
};
|
|
1459
|
-
e.if(
|
|
1408
|
+
e.if(u, (a) => {
|
|
1460
1409
|
var d;
|
|
1461
|
-
(d = e.get(r)) != null && d.isFetching ? a(
|
|
1410
|
+
(d = e.get(r)) != null && d.isFetching ? a(_) : a(I, !1);
|
|
1462
1411
|
});
|
|
1463
1412
|
}
|
|
1464
|
-
var
|
|
1413
|
+
var E = e.sibling(u, 2);
|
|
1465
1414
|
{
|
|
1466
|
-
var
|
|
1467
|
-
var d =
|
|
1468
|
-
|
|
1415
|
+
var n = (a) => {
|
|
1416
|
+
var d = qt(), j = e.first_child(d);
|
|
1417
|
+
gt(j, {
|
|
1469
1418
|
get viewerState() {
|
|
1470
1419
|
return s;
|
|
1471
1420
|
}
|
|
1472
1421
|
});
|
|
1473
|
-
var
|
|
1474
|
-
|
|
1422
|
+
var w = e.sibling(j, 2);
|
|
1423
|
+
At(w, {
|
|
1475
1424
|
get canvases() {
|
|
1476
|
-
return e.get(
|
|
1425
|
+
return e.get(l);
|
|
1477
1426
|
}
|
|
1478
1427
|
}), e.append(a, d);
|
|
1479
1428
|
};
|
|
1480
|
-
e.if(
|
|
1481
|
-
e.get(
|
|
1429
|
+
e.if(E, (a) => {
|
|
1430
|
+
e.get(l).length > 1 && a(n);
|
|
1482
1431
|
});
|
|
1483
1432
|
}
|
|
1484
|
-
var
|
|
1485
|
-
|
|
1486
|
-
var
|
|
1487
|
-
Et(
|
|
1488
|
-
var
|
|
1489
|
-
|
|
1490
|
-
var
|
|
1491
|
-
|
|
1433
|
+
var o = e.sibling(E, 2);
|
|
1434
|
+
mt(o, {});
|
|
1435
|
+
var f = e.sibling(o, 2);
|
|
1436
|
+
Et(f, {});
|
|
1437
|
+
var b = e.sibling(f, 2);
|
|
1438
|
+
Ot(b, {});
|
|
1439
|
+
var h = e.sibling(b, 2);
|
|
1440
|
+
kt(h, {}), e.reset(m), e.append(i, m), e.pop();
|
|
1492
1441
|
}
|
|
1493
1442
|
export {
|
|
1494
|
-
|
|
1495
|
-
|
|
1496
|
-
|
|
1497
|
-
|
|
1443
|
+
Ue as ManifestsState,
|
|
1444
|
+
gs as TriiiceratopsViewer,
|
|
1445
|
+
J as VIEWER_STATE_KEY,
|
|
1446
|
+
We as ViewerState
|
|
1498
1447
|
};
|