triiiceratops 0.1.0 → 0.3.1

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.
@@ -1,220 +1,204 @@
1
- var ke = (n) => {
2
- throw TypeError(n);
1
+ var ke = (s) => {
2
+ throw TypeError(s);
3
3
  };
4
- var Ge = (n, t, s) => t.has(n) || ke("Cannot " + s);
5
- var C = (n, t, s) => (Ge(n, t, "read from private field"), s ? s.call(n) : t.get(n)), G = (n, t, s) => t.has(n) ? ke("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(n) : t.set(n, s);
4
+ var Be = (s, t, a) => t.has(s) || ke("Cannot " + a);
5
+ var L = (s, t, a) => (Be(s, t, "read from private field"), a ? a.call(s) : t.get(s)), Y = (s, t, a) => t.has(s) ? ke("Cannot add the same private member more than once") : t instanceof WeakSet ? t.add(s) : t.set(s, a);
6
6
  import "svelte/internal/disclose-version";
7
7
  import * as e from "svelte/internal/client";
8
- import { onMount as Pe, getContext as _e, setContext as Re } from "svelte";
9
- import * as Ne from "manifesto.js";
10
- import Oe from "openseadragon";
11
- import { createOSDAnnotator as Ve } from "@annotorious/openseadragon";
12
- import "@annotorious/openseadragon/annotorious-openseadragon.css";
13
- import Xe from "phosphor-svelte/lib/CaretLeft";
14
- import Be from "phosphor-svelte/lib/CaretRight";
15
- import Ye from "phosphor-svelte/lib/CaretDown";
16
- import Ce from "phosphor-svelte/lib/Eye";
17
- import Me from "phosphor-svelte/lib/EyeSlash";
18
- import He from "phosphor-svelte/lib/X";
8
+ import { onMount as qe, getContext as xe, setContext as Ye } from "svelte";
9
+ import * as Xe from "manifesto.js";
10
+ import Ce from "openseadragon";
11
+ import Qe from "phosphor-svelte/lib/CaretLeft";
12
+ import Ue from "phosphor-svelte/lib/CaretRight";
13
+ import We from "phosphor-svelte/lib/CaretDown";
14
+ import Me from "phosphor-svelte/lib/Eye";
15
+ import Le from "phosphor-svelte/lib/EyeSlash";
16
+ import Ke from "phosphor-svelte/lib/X";
19
17
  import "svelte/internal/flags/legacy";
20
- import qe from "phosphor-svelte/lib/ChatCenteredText";
21
- import Qe from "phosphor-svelte/lib/CornersIn";
22
- import Ue from "phosphor-svelte/lib/CornersOut";
23
- import We from "phosphor-svelte/lib/Info";
24
- import Fe from "phosphor-svelte/lib/MagnifyingGlass";
25
- import Je from "phosphor-svelte/lib/Plus";
26
- import Ke from "phosphor-svelte/lib/Slideshow";
27
- var te;
28
- class Ze {
18
+ import Ze from "phosphor-svelte/lib/ChatCenteredText";
19
+ import Je from "phosphor-svelte/lib/CornersIn";
20
+ import et from "phosphor-svelte/lib/CornersOut";
21
+ import tt from "phosphor-svelte/lib/Info";
22
+ import Ge from "phosphor-svelte/lib/MagnifyingGlass";
23
+ import at from "phosphor-svelte/lib/Plus";
24
+ import st from "phosphor-svelte/lib/Slideshow";
25
+ var re;
26
+ class nt {
29
27
  constructor() {
30
- G(this, te, e.state(e.proxy({})));
28
+ Y(this, re, e.state(e.proxy({})));
31
29
  }
32
30
  get manifests() {
33
- return e.get(C(this, te));
31
+ return e.get(L(this, re));
34
32
  }
35
33
  set manifests(t) {
36
- e.set(C(this, te), t, !0);
34
+ e.set(L(this, re), t, !0);
37
35
  }
38
36
  async fetchManifest(t) {
39
37
  if (!this.manifests[t]) {
40
38
  this.manifests[t] = { isFetching: !0 };
41
39
  try {
42
- const s = await fetch(t);
43
- if (!s.ok)
44
- throw new Error(`HTTP error! status: ${s.status}`);
45
- const r = await s.json(), i = Ne.parseManifest(r);
46
- this.manifests[t] = { json: r, manifesto: i, isFetching: !1 };
47
- } catch (s) {
48
- this.manifests[t] = { error: s.message, isFetching: !1 };
40
+ const a = await fetch(t);
41
+ if (!a.ok)
42
+ throw new Error(`HTTP error! status: ${a.status}`);
43
+ const n = await a.json(), l = Xe.parseManifest(n);
44
+ this.manifests[t] = { json: n, manifesto: l, isFetching: !1 };
45
+ } catch (a) {
46
+ this.manifests[t] = { error: a.message, isFetching: !1 };
49
47
  }
50
48
  }
51
49
  }
52
50
  getManifest(t) {
53
- const s = this.manifests[t];
54
- return s == null ? void 0 : s.manifesto;
51
+ const a = this.manifests[t];
52
+ return a == null ? void 0 : a.manifesto;
55
53
  }
56
54
  async fetchAnnotationList(t) {
57
55
  if (!this.manifests[t])
58
56
  try {
59
- const s = await fetch(t);
60
- if (s.ok) {
61
- const r = await s.json();
62
- this.manifests[t] = { json: r };
57
+ const a = await fetch(t);
58
+ if (a.ok) {
59
+ const n = await a.json();
60
+ this.manifests[t] = { json: n };
63
61
  } else
64
62
  console.error(`Failed to fetch annotation list: ${t}`);
65
- } catch (s) {
66
- console.error(`Error fetching annotation list: ${t}`, s);
63
+ } catch (a) {
64
+ console.error(`Error fetching annotation list: ${t}`, a);
67
65
  }
68
66
  }
69
67
  getCanvases(t) {
70
- const s = this.getManifest(t);
71
- if (!s)
68
+ const a = this.getManifest(t);
69
+ if (!a)
72
70
  return [];
73
- const r = s.getSequences();
74
- return !r || !r.length ? [] : r[0].getCanvases();
71
+ const n = a.getSequences();
72
+ return !n || !n.length ? [] : n[0].getCanvases();
75
73
  }
76
- getAnnotations(t, s) {
77
- const r = this.getManifest(t);
78
- return r ? r.getSequences()[0].getCanvasById(s) ? this.manualGetAnnotations(t, s) : [] : [];
74
+ getAnnotations(t, a) {
75
+ const n = this.getManifest(t);
76
+ return n ? n.getSequences()[0].getCanvasById(a) ? this.manualGetAnnotations(t, a) : [] : [];
79
77
  }
80
78
  // We can refactor this to use Manifesto's resource handling later if needed.
81
- manualGetAnnotations(t, s) {
82
- const r = this.getManifest(t);
83
- if (!r) return [];
84
- const i = r.getSequences()[0].getCanvasById(s);
85
- if (!i) return [];
86
- const f = i.__jsonld;
87
- let S = [];
88
- const A = (h) => h.resources || h.items || [];
89
- return f.otherContent && f.otherContent.forEach((h) => {
90
- const m = h["@id"] || h.id;
91
- if (m && !h.resources) {
92
- const y = this.manifests[m];
93
- if (y) {
94
- if (y.json) {
95
- const M = A(y.json);
96
- S.push(...M);
79
+ manualGetAnnotations(t, a) {
80
+ const n = this.getManifest(t);
81
+ if (!n) return [];
82
+ const l = n.getSequences()[0].getCanvasById(a);
83
+ if (!l) return [];
84
+ const c = l.__jsonld;
85
+ let A = [];
86
+ const m = (p) => p.resources || p.items || [];
87
+ return c.otherContent && c.otherContent.forEach((p) => {
88
+ const b = p["@id"] || p.id;
89
+ if (b && !p.resources) {
90
+ const x = this.manifests[b];
91
+ if (x) {
92
+ if (x.json) {
93
+ const j = m(x.json);
94
+ A.push(...j);
97
95
  }
98
96
  } else
99
- this.fetchAnnotationList(m);
100
- } else h.resources && S.push(...h.resources);
101
- }), f.annotations && f.annotations.forEach((h) => {
102
- const m = h.id || h["@id"];
103
- if (m && !h.items) {
104
- const y = this.manifests[m];
105
- if (y) {
106
- if (y.json) {
107
- const M = A(y.json);
108
- S.push(...M);
97
+ this.fetchAnnotationList(b);
98
+ } else p.resources && A.push(...p.resources);
99
+ }), c.annotations && c.annotations.forEach((p) => {
100
+ const b = p.id || p["@id"];
101
+ if (b && !p.items) {
102
+ const x = this.manifests[b];
103
+ if (x) {
104
+ if (x.json) {
105
+ const j = m(x.json);
106
+ A.push(...j);
109
107
  }
110
108
  } else
111
- this.fetchAnnotationList(m);
112
- } else h.items && S.push(...h.items);
113
- }), S;
109
+ this.fetchAnnotationList(b);
110
+ } else p.items && A.push(...p.items);
111
+ }), A;
114
112
  }
115
113
  }
116
- te = new WeakMap();
117
- const Z = new Ze();
118
- var se, re, ie, ae, ne, oe, le, ce, de, fe, ue, ge, he, ve, me, be, pe;
119
- class $e {
114
+ re = new WeakMap();
115
+ const ae = new nt();
116
+ var ie, oe, le, ce, de, ge, ue, he, fe, ve, pe, me, be, _e, ye;
117
+ class rt {
120
118
  constructor(t) {
121
- G(this, se, e.state(null));
122
- G(this, re, e.state(null));
123
- G(this, ie, e.state(!1));
124
- G(this, ae, e.state(!1));
125
- G(this, ne, e.state(!1));
126
- G(this, oe, e.state(!1));
127
- G(this, le, e.state(!1));
128
- G(this, ce, e.state(!1));
129
- G(this, de, e.state("none"));
130
- G(this, fe, e.state(e.proxy(/* @__PURE__ */ new Set())));
131
- G(this, ue, e.state(e.proxy({})));
132
- G(this, ge, e.state(!1));
133
- G(this, he, e.state(""));
134
- G(this, ve, e.state(e.proxy([])));
135
- G(this, me, e.state(!1));
136
- G(this, be, e.state(!1));
137
- G(this, pe, e.state(e.proxy([])));
138
- this.manifestId = t || null, this.manifestId && Z.fetchManifest(this.manifestId);
119
+ Y(this, ie, e.state(null));
120
+ Y(this, oe, e.state(null));
121
+ Y(this, le, e.state(!1));
122
+ Y(this, ce, e.state(!1));
123
+ Y(this, de, e.state(!1));
124
+ Y(this, ge, e.state(!1));
125
+ Y(this, ue, e.state(!1));
126
+ Y(this, he, e.state(!1));
127
+ Y(this, fe, e.state("none"));
128
+ Y(this, ve, e.state(e.proxy(/* @__PURE__ */ new Set())));
129
+ Y(this, pe, e.state(""));
130
+ Y(this, me, e.state(e.proxy([])));
131
+ Y(this, be, e.state(!1));
132
+ Y(this, _e, e.state(!1));
133
+ Y(this, ye, e.state(e.proxy([])));
134
+ this.manifestId = t || null, this.manifestId && ae.fetchManifest(this.manifestId);
139
135
  }
140
136
  get manifestId() {
141
- return e.get(C(this, se));
137
+ return e.get(L(this, ie));
142
138
  }
143
139
  set manifestId(t) {
144
- e.set(C(this, se), t, !0);
140
+ e.set(L(this, ie), t, !0);
145
141
  }
146
142
  get canvasId() {
147
- return e.get(C(this, re));
143
+ return e.get(L(this, oe));
148
144
  }
149
145
  set canvasId(t) {
150
- e.set(C(this, re), t, !0);
146
+ e.set(L(this, oe), t, !0);
151
147
  }
152
148
  get showAnnotations() {
153
- return e.get(C(this, ie));
149
+ return e.get(L(this, le));
154
150
  }
155
151
  set showAnnotations(t) {
156
- e.set(C(this, ie), t, !0);
152
+ e.set(L(this, le), t, !0);
157
153
  }
158
154
  get showThumbnailGallery() {
159
- return e.get(C(this, ae));
155
+ return e.get(L(this, ce));
160
156
  }
161
157
  set showThumbnailGallery(t) {
162
- e.set(C(this, ae), t, !0);
158
+ e.set(L(this, ce), t, !0);
163
159
  }
164
160
  get isGalleryDockedBottom() {
165
- return e.get(C(this, ne));
161
+ return e.get(L(this, de));
166
162
  }
167
163
  set isGalleryDockedBottom(t) {
168
- e.set(C(this, ne), t, !0);
164
+ e.set(L(this, de), t, !0);
169
165
  }
170
166
  get isGalleryDockedRight() {
171
- return e.get(C(this, oe));
167
+ return e.get(L(this, ge));
172
168
  }
173
169
  set isGalleryDockedRight(t) {
174
- e.set(C(this, oe), t, !0);
170
+ e.set(L(this, ge), t, !0);
175
171
  }
176
172
  get isFullScreen() {
177
- return e.get(C(this, le));
173
+ return e.get(L(this, ue));
178
174
  }
179
175
  set isFullScreen(t) {
180
- e.set(C(this, le), t, !0);
176
+ e.set(L(this, ue), t, !0);
181
177
  }
182
178
  get showMetadataDialog() {
183
- return e.get(C(this, ce));
179
+ return e.get(L(this, he));
184
180
  }
185
181
  set showMetadataDialog(t) {
186
- e.set(C(this, ce), t, !0);
182
+ e.set(L(this, he), t, !0);
187
183
  }
188
184
  get dockSide() {
189
- return e.get(C(this, de));
185
+ return e.get(L(this, fe));
190
186
  }
191
187
  set dockSide(t) {
192
- e.set(C(this, de), t, !0);
188
+ e.set(L(this, fe), t, !0);
193
189
  }
194
190
  get visibleAnnotationIds() {
195
- return e.get(C(this, fe));
191
+ return e.get(L(this, ve));
196
192
  }
197
193
  set visibleAnnotationIds(t) {
198
- e.set(C(this, fe), t, !0);
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, ve), t, !0);
211
195
  }
212
196
  get manifest() {
213
- return this.manifestId ? Z.getManifest(this.manifestId) : null;
197
+ return this.manifestId ? ae.getManifest(this.manifestId) : null;
214
198
  }
215
199
  get canvases() {
216
200
  if (!this.manifestId) return [];
217
- const t = Z.getCanvases(this.manifestId);
201
+ const t = ae.getCanvases(this.manifestId);
218
202
  return t.length > 0 && !this.canvasId && setTimeout(
219
203
  () => {
220
204
  !this.canvasId && t.length > 0 && (this.canvasId = t[0].id);
@@ -233,41 +217,21 @@ class $e {
233
217
  }
234
218
  nextCanvas() {
235
219
  if (this.hasNext) {
236
- const t = this.currentCanvasIndex + 1, s = this.canvases[t];
237
- this.canvasId = s.id;
220
+ const t = this.currentCanvasIndex + 1, a = this.canvases[t];
221
+ this.canvasId = a.id;
238
222
  }
239
223
  }
240
224
  previousCanvas() {
241
225
  if (this.hasPrevious) {
242
- const t = this.currentCanvasIndex - 1, s = this.canvases[t];
243
- this.canvasId = s.id;
226
+ const t = this.currentCanvasIndex - 1, a = this.canvases[t];
227
+ this.canvasId = a.id;
244
228
  }
245
229
  }
246
230
  setManifest(t) {
247
- this.manifestId = t, this.canvasId = null, Z.fetchManifest(t);
231
+ this.manifestId = t, this.canvasId = null, ae.fetchManifest(t);
248
232
  }
249
233
  setCanvas(t) {
250
- this.canvasId = t, this.loadAnnotationsFromStorage(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;
@@ -280,8 +244,8 @@ class $e {
280
244
  document.exitFullscreen();
281
245
  else {
282
246
  const t = document.getElementById("triiiceratops-viewer");
283
- t && t.requestFullscreen().catch((s) => {
284
- console.warn("Fullscreen request failed", s);
247
+ t && t.requestFullscreen().catch((a) => {
248
+ console.warn("Fullscreen request failed", a);
285
249
  });
286
250
  }
287
251
  }
@@ -289,145 +253,145 @@ class $e {
289
253
  this.showMetadataDialog = !this.showMetadataDialog;
290
254
  }
291
255
  get searchQuery() {
292
- return e.get(C(this, he));
256
+ return e.get(L(this, pe));
293
257
  }
294
258
  set searchQuery(t) {
295
- e.set(C(this, he), t, !0);
259
+ e.set(L(this, pe), t, !0);
296
260
  }
297
261
  get searchResults() {
298
- return e.get(C(this, ve));
262
+ return e.get(L(this, me));
299
263
  }
300
264
  set searchResults(t) {
301
- e.set(C(this, ve), t, !0);
265
+ e.set(L(this, me), t, !0);
302
266
  }
303
267
  get isSearching() {
304
- return e.get(C(this, me));
268
+ return e.get(L(this, be));
305
269
  }
306
270
  set isSearching(t) {
307
- e.set(C(this, me), t, !0);
271
+ e.set(L(this, be), t, !0);
308
272
  }
309
273
  get showSearchPanel() {
310
- return e.get(C(this, be));
274
+ return e.get(L(this, _e));
311
275
  }
312
276
  set showSearchPanel(t) {
313
- e.set(C(this, be), t, !0);
277
+ e.set(L(this, _e), 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(C(this, pe));
283
+ return e.get(L(this, ye));
320
284
  }
321
285
  set searchAnnotations(t) {
322
- e.set(C(this, pe), t, !0);
286
+ e.set(L(this, ye), t, !0);
323
287
  }
324
288
  get currentCanvasSearchAnnotations() {
325
289
  return this.canvasId ? this.searchAnnotations.filter((t) => t.canvasId === this.canvasId) : [];
326
290
  }
327
291
  async search(t) {
328
- var s, r;
292
+ var a, n;
329
293
  if (t.trim()) {
330
294
  this.isSearching = !0, this.searchQuery = t, this.searchResults = [];
331
295
  try {
332
- const i = this.manifest;
333
- if (!i) throw new Error("No manifest loaded");
334
- let f = i.getService("http://iiif.io/api/search/1/search") || i.getService("http://iiif.io/api/search/0/search");
335
- if (f || i.__jsonld && i.__jsonld.service && (f = (Array.isArray(i.__jsonld.service) ? i.__jsonld.service : [i.__jsonld.service]).find((b) => b.profile === "http://iiif.io/api/search/1/search" || b.profile === "http://iiif.io/api/search/0/search")), !f) {
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((h) => h.profile === "http://iiif.io/api/search/1/search" || h.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 A = `${f.id || f["@id"]}?q=${encodeURIComponent(t)}`, h = await fetch(A);
340
- if (!h.ok) throw new Error("Search request failed");
341
- const m = await h.json(), y = m.resources || [], M = [], o = (u) => {
342
- const b = typeof u == "string" ? u : u["@id"] || u.id;
343
- if (!b) return null;
344
- const l = b.split("#xywh=");
345
- if (l.length < 2) return null;
346
- const c = l[1].split(",").map(Number);
347
- return c.length === 4 ? c : null;
303
+ const m = `${c.id || c["@id"]}?q=${encodeURIComponent(t)}`, p = await fetch(m);
304
+ if (!p.ok) throw new Error("Search request failed");
305
+ const b = await p.json(), x = b.resources || [], j = [], i = (o) => {
306
+ const h = typeof o == "string" ? o : o["@id"] || o.id;
307
+ if (!h) return null;
308
+ const _ = h.split("#xywh=");
309
+ if (_.length < 2) return null;
310
+ const f = _[1].split(",").map(Number);
311
+ return f.length === 4 ? f : null;
348
312
  };
349
- if (m.hits)
350
- for (const u of m.hits) {
351
- const b = u.annotations || [];
352
- for (const l of b) {
353
- const c = y.find((a) => a["@id"] === l || a.id === l);
354
- if (c && c.on) {
355
- const a = typeof c.on == "string" ? c.on : c.on["@id"] || c.on.id, d = a.split("#")[0], D = o(a), I = this.canvases.findIndex((F) => F.id === d);
356
- if (I >= 0) {
357
- const F = this.canvases[I];
358
- let L = "Canvas " + (I + 1);
313
+ if (b.hits)
314
+ for (const o of b.hits) {
315
+ const h = o.annotations || [];
316
+ for (const _ of h) {
317
+ const f = x.find((r) => r["@id"] === _ || r.id === _);
318
+ if (f && f.on) {
319
+ const r = typeof f.on == "string" ? f.on : f.on["@id"] || f.on.id, d = r.split("#")[0], S = i(r), w = this.canvases.findIndex((I) => I.id === d);
320
+ if (w >= 0) {
321
+ const I = this.canvases[w];
322
+ let k = "Canvas " + (w + 1);
359
323
  try {
360
- if (F.getLabel) {
361
- const j = F.getLabel();
362
- Array.isArray(j) && j.length > 0 ? L = j[0].value : typeof j == "string" && (L = j);
363
- } else F.label && (typeof F.label == "string" ? L = F.label : Array.isArray(F.label) && (L = (s = F.label[0]) == null ? void 0 : s.value));
324
+ if (I.getLabel) {
325
+ const y = I.getLabel();
326
+ Array.isArray(y) && y.length > 0 ? k = y[0].value : typeof y == "string" && (k = y);
327
+ } else I.label && (typeof I.label == "string" ? k = I.label : Array.isArray(I.label) && (k = (a = I.label[0]) == null ? void 0 : a.value));
364
328
  } catch {
365
329
  }
366
- M.push({
330
+ j.push({
367
331
  type: "hit",
368
- before: u.before,
369
- match: u.match,
370
- after: u.after,
371
- canvasIndex: I,
372
- canvasLabel: String(L),
373
- bounds: D
332
+ before: o.before,
333
+ match: o.match,
334
+ after: o.after,
335
+ canvasIndex: w,
336
+ canvasLabel: String(k),
337
+ bounds: S
374
338
  });
375
339
  }
376
340
  }
377
341
  }
378
342
  }
379
- else if (y.length > 0)
380
- for (const u of y) {
381
- const b = typeof u.on == "string" ? u.on : u.on["@id"] || u.on.id, l = b.split("#")[0], c = o(b), a = this.canvases.findIndex((d) => d.id === l);
382
- if (a >= 0) {
383
- const d = this.canvases[a];
384
- let D = "Canvas " + (a + 1);
343
+ else if (x.length > 0)
344
+ for (const o of x) {
345
+ const h = typeof o.on == "string" ? o.on : o.on["@id"] || o.on.id, _ = h.split("#")[0], f = i(h), r = this.canvases.findIndex((d) => d.id === _);
346
+ if (r >= 0) {
347
+ const d = this.canvases[r];
348
+ let S = "Canvas " + (r + 1);
385
349
  try {
386
350
  if (d.getLabel) {
387
- const I = d.getLabel();
388
- Array.isArray(I) && I.length > 0 ? D = I[0].value : typeof I == "string" && (D = I);
389
- } else d.label && (typeof d.label == "string" ? D = d.label : Array.isArray(d.label) && (D = (r = d.label[0]) == null ? void 0 : r.value));
351
+ const w = d.getLabel();
352
+ Array.isArray(w) && w.length > 0 ? S = w[0].value : typeof w == "string" && (S = w);
353
+ } else d.label && (typeof d.label == "string" ? S = d.label : Array.isArray(d.label) && (S = (n = d.label[0]) == null ? void 0 : n.value));
390
354
  } catch {
391
355
  }
392
- M.push({
356
+ j.push({
393
357
  type: "resource",
394
- match: u.resource && u.resource.chars ? u.resource.chars : u.chars || "",
395
- canvasIndex: a,
396
- canvasLabel: String(D),
397
- bounds: c
358
+ match: o.resource && o.resource.chars ? o.resource.chars : o.chars || "",
359
+ canvasIndex: r,
360
+ canvasLabel: String(S),
361
+ bounds: f
398
362
  });
399
363
  }
400
364
  }
401
- this.searchResults = M, this.searchAnnotations = M.filter((u) => u.bounds).map((u, b) => {
402
- const l = this.canvases[u.canvasIndex], c = `${l.id}#xywh=${u.bounds.join(",")}`;
365
+ this.searchResults = j, this.searchAnnotations = j.filter((o) => o.bounds).map((o, h) => {
366
+ const _ = this.canvases[o.canvasIndex], f = `${_.id}#xywh=${o.bounds.join(",")}`;
403
367
  return {
404
- "@id": `urn:search-hit:${b}`,
368
+ "@id": `urn:search-hit:${h}`,
405
369
  "@type": "oa:Annotation",
406
370
  motivation: "sc:painting",
407
- on: c,
408
- canvasId: l.id,
409
- resource: { "@type": "cnt:ContentAsText", chars: u.match },
371
+ on: f,
372
+ canvasId: _.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 (i) {
416
- console.error("Search error:", i);
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(), ue = new WeakMap(), ge = new WeakMap(), he = new WeakMap(), ve = new WeakMap(), me = new WeakMap(), be = new WeakMap(), pe = new WeakMap();
424
- const $ = "triiiceratops:viewerState";
425
- function De(n) {
426
- return n.id || n["@id"] || (typeof n.getId == "function" ? n.getId() : "");
387
+ ie = new WeakMap(), oe = new WeakMap(), le = new WeakMap(), ce = new WeakMap(), de = new WeakMap(), ge = new WeakMap(), ue = new WeakMap(), he = new WeakMap(), fe = new WeakMap(), ve = new WeakMap(), pe = new WeakMap(), me = new WeakMap(), be = new WeakMap(), _e = new WeakMap(), ye = new WeakMap();
388
+ const se = "triiiceratops:viewerState";
389
+ function ze(s) {
390
+ return s.id || s["@id"] || (typeof s.getId == "function" ? s.getId() : "");
427
391
  }
428
- function Se(n) {
429
- if (!n) return null;
430
- const t = n.match(/xywh=(\d+),(\d+),(\d+),(\d+)/);
392
+ function Ie(s) {
393
+ if (!s) return null;
394
+ const t = s.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,242 +399,249 @@ function Se(n) {
435
399
  h: parseInt(t[4], 10)
436
400
  } : null;
437
401
  }
438
- function et(n) {
439
- const t = tt(n);
402
+ function it(s) {
403
+ const t = ot(s);
440
404
  if (t)
441
- return st(t);
442
- const s = nt(n);
443
- return s ? {
405
+ return lt(t);
406
+ const a = ut(s);
407
+ return a ? {
444
408
  type: "RECTANGLE",
445
- geometry: {
446
- x: s.x,
447
- y: s.y,
448
- w: s.w,
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: a.x,
410
+ y: a.y,
411
+ w: a.w,
412
+ h: a.h
457
413
  } : null;
458
414
  }
459
- function tt(n) {
460
- var s, r;
461
- if (typeof n.getTarget == "function") {
462
- const i = ((s = n.__jsonld) == null ? void 0 : s.on) || ((r = n.__jsonld) == null ? void 0 : r.target);
463
- if (i)
464
- return je(i);
465
- }
466
- const t = n.target || n.on;
415
+ function ot(s) {
416
+ var a, n;
417
+ if (typeof s.getTarget == "function") {
418
+ const l = ((a = s.__jsonld) == null ? void 0 : a.on) || ((n = s.__jsonld) == null ? void 0 : n.target);
419
+ if (l)
420
+ return je(l);
421
+ }
422
+ const t = s.target || s.on;
467
423
  return t ? je(t) : null;
468
424
  }
469
- function je(n) {
470
- if (!n) return null;
471
- if (Array.isArray(n))
472
- for (const t of n) {
473
- const s = Te(t);
474
- if (s) return s;
425
+ function je(s) {
426
+ if (!s) return null;
427
+ if (Array.isArray(s))
428
+ for (const t of s) {
429
+ const a = Ee(t);
430
+ if (a) return a;
475
431
  }
476
432
  else
477
- return Te(n);
433
+ return Ee(s);
478
434
  return null;
479
435
  }
480
- function Te(n) {
481
- var s;
482
- if (!n) return null;
483
- const t = n.selector || n;
484
- 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;
436
+ function Ee(s) {
437
+ var a;
438
+ if (!s) return null;
439
+ const t = s.selector || s;
440
+ return (t == null ? void 0 : t.type) === "SvgSelector" && t.value ? t.value : ((a = t == null ? void 0 : t.item) == null ? void 0 : a.type) === "SvgSelector" && t.item.value ? t.item.value : null;
485
441
  }
486
- function st(n) {
442
+ function lt(s) {
487
443
  try {
488
- const s = new DOMParser().parseFromString(n, "image/svg+xml");
489
- if (s.documentElement.nodeName === "parsererror")
490
- return console.warn("Failed to parse SVG selector:", n), null;
491
- const r = [];
492
- let i = { minX: 1 / 0, minY: 1 / 0, maxX: -1 / 0, maxY: -1 / 0 };
493
- const f = s.querySelectorAll("polygon");
494
- for (const h of f) {
495
- const m = h.getAttribute("points");
496
- if (m) {
497
- const y = rt(m);
498
- r.push(...y);
444
+ const a = new DOMParser().parseFromString(s, "image/svg+xml");
445
+ if (a.documentElement.nodeName === "parsererror")
446
+ return console.warn("Failed to parse SVG selector:", s), null;
447
+ const n = [], l = a.querySelectorAll("polygon");
448
+ for (const m of l) {
449
+ const p = m.getAttribute("points");
450
+ if (p) {
451
+ const b = ct(p);
452
+ n.push(...b);
499
453
  }
500
454
  }
501
- const S = s.querySelectorAll("path");
502
- for (const h of S) {
503
- const m = h.getAttribute("d");
504
- if (m) {
505
- const y = it(m);
506
- r.push(...y);
455
+ const c = a.querySelectorAll("path");
456
+ for (const m of c) {
457
+ const p = m.getAttribute("d");
458
+ if (p) {
459
+ const b = dt(p);
460
+ n.push(...b);
507
461
  }
508
462
  }
509
- const A = s.querySelectorAll("circle");
510
- for (const h of A) {
511
- const m = parseFloat(h.getAttribute("cx") || "0"), y = parseFloat(h.getAttribute("cy") || "0"), M = parseFloat(h.getAttribute("r") || "0"), o = at(m, y, M);
512
- r.push(...o);
463
+ const A = a.querySelectorAll("circle");
464
+ for (const m of A) {
465
+ const p = parseFloat(m.getAttribute("cx") || "0"), b = parseFloat(m.getAttribute("cy") || "0"), x = parseFloat(m.getAttribute("r") || "0"), j = gt(p, b, x);
466
+ n.push(...j);
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
- return r.length === 0 ? null : {
468
+ return n.length === 0 ? null : {
517
469
  type: "POLYGON",
518
- geometry: {
519
- points: r,
520
- bounds: i
521
- }
470
+ points: n
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 rt(n) {
528
- const t = [], s = n.trim().split(/\s+/);
529
- for (const r of s) {
530
- const [i, f] = r.split(",").map((S) => parseFloat(S));
531
- !isNaN(i) && !isNaN(f) && t.push([i, f]);
476
+ function ct(s) {
477
+ const t = [], a = s.trim().split(/\s+/);
478
+ for (const n of a) {
479
+ const [l, c] = n.split(",").map((A) => parseFloat(A));
480
+ !isNaN(l) && !isNaN(c) && t.push([l, c]);
532
481
  }
533
482
  return t;
534
483
  }
535
- function it(n) {
536
- const t = [], s = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
537
- let r;
538
- for (; (r = s.exec(n)) !== null; ) {
539
- const i = parseFloat(r[1]), f = parseFloat(r[2]);
540
- !isNaN(i) && !isNaN(f) && t.push([i, f]);
484
+ function dt(s) {
485
+ const t = [], a = /[ML]\s*([\d.]+)[,\s]+([\d.]+)/g;
486
+ let n;
487
+ for (; (n = a.exec(s)) !== null; ) {
488
+ const l = parseFloat(n[1]), c = parseFloat(n[2]);
489
+ !isNaN(l) && !isNaN(c) && t.push([l, c]);
541
490
  }
542
491
  return t;
543
492
  }
544
- function at(n, t, s, r = 8) {
545
- const i = [];
546
- for (let f = 0; f < r; f++) {
547
- const S = f / r * Math.PI * 2, A = n + s * Math.cos(S), h = t + s * Math.sin(S);
548
- i.push([A, h]);
493
+ function gt(s, t, a, n = 8) {
494
+ const l = [];
495
+ for (let c = 0; c < n; c++) {
496
+ const A = c / n * Math.PI * 2, m = s + a * Math.cos(A), p = t + a * Math.sin(A);
497
+ l.push([m, p]);
549
498
  }
550
- return i;
499
+ return l;
551
500
  }
552
- function nt(n) {
553
- var s;
554
- if (typeof n.getTarget == "function") {
555
- const r = n.getTarget();
556
- if (typeof r == "string" && r.includes("xywh="))
557
- return Se(r);
558
- const i = (s = n.__jsonld) == null ? void 0 : s.on;
559
- if (i) {
560
- const f = Ae(i);
561
- if (f) return f;
501
+ function ut(s) {
502
+ var a;
503
+ if (typeof s.getTarget == "function") {
504
+ const n = s.getTarget();
505
+ if (typeof n == "string" && n.includes("xywh="))
506
+ return Ie(n);
507
+ const l = (a = s.__jsonld) == null ? void 0 : a.on;
508
+ if (l) {
509
+ const c = Te(l);
510
+ if (c) return c;
562
511
  }
563
512
  }
564
- const t = n.target || n.on;
565
- return t ? Ae(t) : null;
513
+ const t = s.target || s.on;
514
+ return t ? Te(t) : null;
566
515
  }
567
- function Ae(n) {
568
- if (!n) return null;
569
- if (Array.isArray(n))
570
- for (const t of n) {
571
- const s = Ae(t);
572
- if (s) return s;
516
+ function Te(s) {
517
+ if (!s) return null;
518
+ if (Array.isArray(s))
519
+ for (const t of s) {
520
+ const a = Te(t);
521
+ if (a) return a;
573
522
  }
574
- if (typeof n == "string" && n.includes("xywh="))
575
- return Se(n);
576
- if (n.selector) {
577
- const t = n.selector, s = t.item || t;
578
- if (s.value && typeof s.value == "string" && s.value.includes("xywh="))
579
- return Se(s.value);
523
+ if (typeof s == "string" && s.includes("xywh="))
524
+ return Ie(s);
525
+ if (s.selector) {
526
+ const t = s.selector, a = t.item || t;
527
+ if (a.value && typeof a.value == "string" && a.value.includes("xywh="))
528
+ return Ie(a.value);
580
529
  }
581
530
  return null;
582
531
  }
583
- function ot(n) {
584
- const t = [];
585
- if (typeof n.getBody == "function") {
586
- const s = n.getBody();
587
- if (s && Array.isArray(s))
588
- for (const r of s) {
589
- const i = r.getValue ? r.getValue() : "";
590
- r.getFormat && r.getFormat(), i && t.push({
591
- purpose: "commenting",
592
- value: i
593
- // Note: Don't include format, Annotorious doesn't track it
594
- });
532
+ function ht(s) {
533
+ let t = "", a = !1;
534
+ if (typeof s.getBody == "function") {
535
+ const n = s.getBody();
536
+ if (n && Array.isArray(n)) {
537
+ const l = [];
538
+ for (const c of n) {
539
+ const A = c.getValue ? c.getValue() : "";
540
+ if (A) {
541
+ l.push(A);
542
+ const m = c.getFormat ? c.getFormat() : "";
543
+ (m === "text/html" || m === "application/html") && (a = !0);
544
+ }
595
545
  }
546
+ t = l.join(" ");
547
+ }
596
548
  } else {
597
- const s = (r) => r && (r.chars || r.value || r["cnt:chars"]) || "";
598
- if (n.resource) {
599
- const r = Array.isArray(n.resource) ? n.resource : [n.resource];
600
- for (const i of r) {
601
- const f = s(i);
602
- f && t.push({
603
- purpose: "commenting",
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 n = (c) => c && (c.chars || c.value || c["cnt:chars"]) || "", l = (c) => c ? c.format === "text/html" || c.type === "TextualBody" : !1;
550
+ if (s.resource) {
551
+ const c = Array.isArray(s.resource) ? s.resource : [s.resource];
552
+ t = c.map(n).filter(Boolean).join(" "), a = c.some(l);
553
+ } else if (s.body) {
554
+ const c = Array.isArray(s.body) ? s.body : [s.body];
555
+ t = c.map(n).filter(Boolean).join(" "), a = c.some(l);
616
556
  }
617
557
  }
618
- if (t.length === 0) {
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 s.getLabel == "function" ? t = s.getLabel() || "" : s.label && (t = Array.isArray(s.label) ? s.label.join(" ") : s.label)), { value: t || "Annotation", isHtml: a };
626
559
  }
627
- function lt(n, t, s = !1) {
628
- const r = De(n) || `anno-${t}`, i = et(n);
629
- if (!i)
560
+ function ft(s, t, a = !1) {
561
+ const n = ze(s) || `anno-${t}`, l = it(s);
562
+ if (!l)
630
563
  return null;
631
- const f = ot(n);
632
- return s && f.push({
633
- purpose: "search-hit",
634
- value: "search-hit"
635
- }), {
636
- id: r,
637
- target: {
638
- selector: i
639
- },
640
- bodies: f
564
+ const c = ht(s);
565
+ return {
566
+ id: n,
567
+ geometry: l,
568
+ body: c,
569
+ isSearchHit: a
641
570
  };
642
571
  }
643
- function ct(n, t = /* @__PURE__ */ new Set()) {
644
- return n.map((s, r) => {
645
- const i = t.has(De(s));
646
- return lt(s, r, i);
647
- }).filter((s) => s !== null);
572
+ function vt(s, t = /* @__PURE__ */ new Set()) {
573
+ return s.map((a, n) => {
574
+ const l = t.has(ze(a));
575
+ return ft(a, n, l);
576
+ }).filter((a) => a !== null);
648
577
  }
649
- var dt = e.from_html('<div class="absolute bg-base-200 text-base-content px-3 py-2 rounded-lg shadow-lg text-sm max-w-xs pointer-events-none z-1000"> </div>'), ft = e.from_html('<div class="w-full h-full relative"><div class="w-full h-full osd-background bg-base-100"></div> <!></div>');
650
- function ut(n, t) {
578
+ var pt = e.from_html("<div></div>"), mt = e.from_svg('<svg class="absolute pointer-events-auto"><title> </title><polygon stroke-width="2"></polygon></svg>'), bt = 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 _t(s, t) {
651
580
  e.push(t, !0);
652
- let s = e.state(void 0), r = e.state(void 0), i = e.state(void 0), f = e.state(null), S = e.state(e.proxy({ x: 0, y: 0 })), A = e.derived(() => {
581
+ let a = e.state(void 0), n = 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 l = Z.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), c = t.viewerState.currentCanvasSearchAnnotations, a = t.viewerState.createdAnnotations[t.viewerState.canvasId] || [];
656
- return [
657
- ...l,
658
- ...c,
659
- ...a
660
- ];
661
- }), h = e.derived(() => {
662
- const l = /* @__PURE__ */ new Set();
663
- return t.viewerState.currentCanvasSearchAnnotations.forEach((c) => {
664
- const a = c.id || c["@id"];
665
- a && l.add(a);
666
- }), l;
667
- }), m = e.derived(() => ct(e.get(A), e.get(h)));
668
- Pe(() => {
669
- if (e.get(s))
584
+ const i = ae.getAnnotations(t.viewerState.manifestId, t.viewerState.canvasId), o = t.viewerState.currentCanvasSearchAnnotations;
585
+ return [...i, ...o];
586
+ }), A = e.derived(() => {
587
+ const i = /* @__PURE__ */ new Set();
588
+ return t.viewerState.currentCanvasSearchAnnotations.forEach((o) => {
589
+ const h = o.id || o["@id"];
590
+ h && i.add(h);
591
+ }), i;
592
+ }), m = e.derived(() => vt(e.get(c), e.get(A))), p = e.derived(() => {
593
+ if (e.get(l), !e.get(n) || !e.get(m).length)
594
+ return [];
595
+ const i = e.get(n).world.getItemAt(0);
596
+ if (!i)
597
+ return [];
598
+ const o = [];
599
+ for (const h of e.get(m)) {
600
+ if (!h.isSearchHit) if (t.viewerState.showAnnotations) {
601
+ if (!t.viewerState.visibleAnnotationIds.has(h.id))
602
+ continue;
603
+ } else continue;
604
+ if (h.geometry.type === "RECTANGLE") {
605
+ const _ = i.imageToViewportRectangle(h.geometry.x, h.geometry.y, h.geometry.w, h.geometry.h), f = e.get(n).viewport.viewportToViewerElementRectangle(_);
606
+ o.push({
607
+ id: h.id,
608
+ type: "RECTANGLE",
609
+ rect: {
610
+ x: f.x,
611
+ y: f.y,
612
+ width: f.width,
613
+ height: f.height
614
+ },
615
+ isSearchHit: h.isSearchHit,
616
+ tooltip: h.body.value
617
+ });
618
+ } else if (h.geometry.type === "POLYGON") {
619
+ const _ = h.geometry.points.map((I) => {
620
+ const k = i.imageToViewportCoordinates(new Ce.Point(I[0], I[1])), y = e.get(n).viewport.viewportToViewerElementCoordinates(k);
621
+ return [y.x, y.y];
622
+ });
623
+ let f = 1 / 0, r = 1 / 0, d = -1 / 0, S = -1 / 0;
624
+ for (const [I, k] of _)
625
+ f = Math.min(f, I), r = Math.min(r, k), d = Math.max(d, I), S = Math.max(S, k);
626
+ const w = _.map(([I, k]) => [I - f, k - r]);
627
+ o.push({
628
+ id: h.id,
629
+ type: "POLYGON",
630
+ bounds: { x: f, y: r, width: d - f, height: S - r },
631
+ points: w,
632
+ isSearchHit: h.isSearchHit,
633
+ tooltip: h.body.value
634
+ });
635
+ }
636
+ }
637
+ return o;
638
+ });
639
+ qe(() => {
640
+ if (e.get(a))
670
641
  return e.set(
671
- r,
672
- Oe({
673
- element: e.get(s),
642
+ n,
643
+ Ce({
644
+ element: e.get(a),
674
645
  tileSources: null,
675
646
  // Will be set via effect
676
647
  prefixUrl: "",
@@ -686,813 +657,1009 @@ function ut(n, t) {
686
657
  zoomPerClick: 2
687
658
  }),
688
659
  !0
689
- ), e.set(
690
- i,
691
- Ve(e.get(r), {
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 i;
662
+ (i = e.get(n)) == null || i.destroy();
725
663
  };
726
664
  }), e.user_effect(() => {
727
- !e.get(r) || !t.tileSources || e.get(r).open(t.tileSources);
728
- }), e.user_effect(() => {
729
- e.get(i) && e.get(i).setAnnotations(e.get(m));
730
- }), e.user_effect(() => {
731
- e.get(i) && e.get(i).setStyle((l) => {
732
- var a;
733
- const c = (a = l.bodies) == null ? void 0 : a.some((d) => d.purpose === "search-hit");
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(n)) return;
666
+ const i = () => {
667
+ e.update(l);
668
+ };
669
+ return e.get(n).addHandler("open", i), e.get(n).addHandler("animation", i), e.get(n).addHandler("resize", i), e.get(n).addHandler("rotate", i), e.get(n).world.addHandler("add-item", i), e.get(n).world.addHandler("remove-item", i), () => {
670
+ e.get(n).removeHandler("open", i), e.get(n).removeHandler("animation", i), e.get(n).removeHandler("resize", i), e.get(n).removeHandler("rotate", i), e.get(n).world.removeHandler("add-item", i), e.get(n).world.removeHandler("remove-item", i);
671
+ };
745
672
  }), e.user_effect(() => {
746
- if (!e.get(i)) return;
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(n) || !t.tileSources || e.get(n).open(t.tileSources);
752
674
  });
753
- function y(l) {
754
- if (!l.bodies || l.bodies.length === 0)
755
- return "Annotation";
756
- const c = l.bodies.find((a) => a.purpose === "commenting");
757
- return (c == null ? void 0 : c.value) || "Annotation";
758
- }
759
- var M = ft(), o = e.child(M);
760
- e.bind_this(o, (l) => e.set(s, l), () => e.get(s));
761
- var u = e.sibling(o, 2);
762
- {
763
- var b = (l) => {
764
- var c = dt(), a = e.child(c, !0);
765
- e.reset(c), e.template_effect(
766
- (d) => {
767
- e.set_style(c, `left: ${e.get(S).x + 15}px; top: ${e.get(S).y + 15}px;`), e.set_text(a, d);
768
- },
769
- [() => y(e.get(f))]
770
- ), e.append(l, c);
771
- };
772
- e.if(u, (l) => {
773
- e.get(f) && t.viewerState.showAnnotations && l(b);
774
- });
775
- }
776
- e.reset(M), e.append(n, M), e.pop();
675
+ var b = bt(), x = e.child(b);
676
+ e.bind_this(x, (i) => e.set(a, i), () => e.get(a));
677
+ var j = e.sibling(x, 2);
678
+ e.each(j, 17, () => e.get(p), (i) => i.id, (i, o) => {
679
+ var h = e.comment(), _ = e.first_child(h);
680
+ {
681
+ var f = (d) => {
682
+ var S = pt();
683
+ e.template_effect(() => {
684
+ e.set_class(S, 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(S, `
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(S, "title", e.get(o).tooltip);
690
+ }), e.append(d, S);
691
+ }, r = (d) => {
692
+ var S = e.comment(), w = e.first_child(S);
693
+ {
694
+ var I = (k) => {
695
+ var y = mt(), u = e.child(y), E = e.child(u, !0);
696
+ e.reset(u);
697
+ var v = e.sibling(u);
698
+ e.reset(y), e.template_effect(
699
+ (g) => {
700
+ e.set_style(y, `
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(E, e.get(o).tooltip), e.set_attribute(v, "points", g), 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((g) => g.join(",")).join(" ")]
708
+ ), e.append(k, y);
709
+ };
710
+ e.if(
711
+ w,
712
+ (k) => {
713
+ e.get(o).type === "POLYGON" && k(I);
714
+ },
715
+ !0
716
+ );
717
+ }
718
+ e.append(d, S);
719
+ };
720
+ e.if(_, (d) => {
721
+ e.get(o).type === "RECTANGLE" ? d(f) : d(r, !1);
722
+ });
723
+ }
724
+ e.append(i, h);
725
+ }), e.reset(b), e.append(s, b), e.pop();
777
726
  }
778
- var gt = 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>');
779
- function ht(n, t) {
727
+ const yt = "en";
728
+ let C = () => yt;
729
+ const xt = /* @__NO_SIDE_EFFECTS__ */ () => "Hello World", wt = /* @__NO_SIDE_EFFECTS__ */ () => "Search", St = /* @__NO_SIDE_EFFECTS__ */ () => "Close Search", At = /* @__NO_SIDE_EFFECTS__ */ () => "Search content...", It = /* @__NO_SIDE_EFFECTS__ */ (s) => `No results found for "${s.query}"`, Tt = /* @__NO_SIDE_EFFECTS__ */ () => "Enter a search term to find occurrences within this manifest.", $t = /* @__NO_SIDE_EFFECTS__ */ (s) => `${s.count} Results`, kt = /* @__NO_SIDE_EFFECTS__ */ () => "Manifest Metadata", Ct = /* @__NO_SIDE_EFFECTS__ */ () => "Loading...", Mt = /* @__NO_SIDE_EFFECTS__ */ () => "Attribution", Lt = /* @__NO_SIDE_EFFECTS__ */ () => "License", jt = /* @__NO_SIDE_EFFECTS__ */ () => "Close", Et = /* @__NO_SIDE_EFFECTS__ */ () => "Menu", Gt = /* @__NO_SIDE_EFFECTS__ */ () => "Search", zt = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Search", Rt = /* @__NO_SIDE_EFFECTS__ */ () => "Hide Gallery", Pt = /* @__NO_SIDE_EFFECTS__ */ () => "Show Gallery", Dt = /* @__NO_SIDE_EFFECTS__ */ () => "Exit Full Screen", Ft = /* @__NO_SIDE_EFFECTS__ */ () => "Enter Full Screen", Ht = /* @__NO_SIDE_EFFECTS__ */ () => "Hide Annotations", Nt = /* @__NO_SIDE_EFFECTS__ */ () => "Show Annotations", Vt = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Annotations", Ot = /* @__NO_SIDE_EFFECTS__ */ () => "Metadata", Bt = /* @__NO_SIDE_EFFECTS__ */ () => "Toggle Metadata", qt = /* @__NO_SIDE_EFFECTS__ */ () => "Hide All Annotations", Yt = /* @__NO_SIDE_EFFECTS__ */ () => "Show All Annotations", Xt = /* @__NO_SIDE_EFFECTS__ */ (s) => `${s.count} Annotations`, Qt = /* @__NO_SIDE_EFFECTS__ */ (s) => `(${s.count} visible)`, Ut = /* @__NO_SIDE_EFFECTS__ */ () => "(No content)", Wt = /* @__NO_SIDE_EFFECTS__ */ () => "No annotations available.", Kt = /* @__NO_SIDE_EFFECTS__ */ () => "Previous Canvas", Zt = /* @__NO_SIDE_EFFECTS__ */ () => "Next Canvas", Jt = /* @__NO_SIDE_EFFECTS__ */ () => "Docs", ea = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF Manifest:", ta = /* @__NO_SIDE_EFFECTS__ */ () => "Enter IIIF manifest URL", aa = /* @__NO_SIDE_EFFECTS__ */ () => "Load", sa = /* @__NO_SIDE_EFFECTS__ */ () => "GitHub", na = /* @__NO_SIDE_EFFECTS__ */ () => "Hallo Welt", ra = /* @__NO_SIDE_EFFECTS__ */ () => "Suche", ia = /* @__NO_SIDE_EFFECTS__ */ () => "Suche schließen", oa = /* @__NO_SIDE_EFFECTS__ */ () => "Inhalt durchsuchen...", la = /* @__NO_SIDE_EFFECTS__ */ (s) => `Keine Ergebnisse für "${s.query}" gefunden`, ca = /* @__NO_SIDE_EFFECTS__ */ () => "Geben Sie einen Suchbegriff ein, um Vorkommen in diesem Manifest zu finden.", da = /* @__NO_SIDE_EFFECTS__ */ (s) => `${s.count} Ergebnisse`, ga = /* @__NO_SIDE_EFFECTS__ */ () => "Manifest-Metadaten", ua = /* @__NO_SIDE_EFFECTS__ */ () => "Lädt...", ha = /* @__NO_SIDE_EFFECTS__ */ () => "Quellenangabe", fa = /* @__NO_SIDE_EFFECTS__ */ () => "Lizenz", va = /* @__NO_SIDE_EFFECTS__ */ () => "Schließen", pa = /* @__NO_SIDE_EFFECTS__ */ () => "Menü", ma = /* @__NO_SIDE_EFFECTS__ */ () => "Suche", ba = /* @__NO_SIDE_EFFECTS__ */ () => "Suche umschalten", _a = /* @__NO_SIDE_EFFECTS__ */ () => "Galerie ausblenden", ya = /* @__NO_SIDE_EFFECTS__ */ () => "Galerie einblenden", xa = /* @__NO_SIDE_EFFECTS__ */ () => "Vollbildmodus beenden", wa = /* @__NO_SIDE_EFFECTS__ */ () => "Vollbildmodus", Sa = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen ausblenden", Aa = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen einblenden", Ia = /* @__NO_SIDE_EFFECTS__ */ () => "Annotationen umschalten", Ta = /* @__NO_SIDE_EFFECTS__ */ () => "Metadaten", $a = /* @__NO_SIDE_EFFECTS__ */ () => "Metadaten umschalten", ka = /* @__NO_SIDE_EFFECTS__ */ () => "Alle Annotationen ausblenden", Ca = /* @__NO_SIDE_EFFECTS__ */ () => "Alle Annotationen einblenden", Ma = /* @__NO_SIDE_EFFECTS__ */ (s) => `${s.count} Annotationen`, La = /* @__NO_SIDE_EFFECTS__ */ (s) => `(${s.count} sichtbar)`, ja = /* @__NO_SIDE_EFFECTS__ */ () => "(Kein Inhalt)", Ea = /* @__NO_SIDE_EFFECTS__ */ () => "Keine Annotationen verfügbar.", Ga = /* @__NO_SIDE_EFFECTS__ */ () => "Vorheriges Canvas", za = /* @__NO_SIDE_EFFECTS__ */ () => "Nächstes Canvas", Ra = /* @__NO_SIDE_EFFECTS__ */ () => "Doku", Pa = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF-Manifest:", Da = /* @__NO_SIDE_EFFECTS__ */ () => "IIIF-Manifest-URL eingeben", Fa = /* @__NO_SIDE_EFFECTS__ */ () => "Laden", Ha = /* @__NO_SIDE_EFFECTS__ */ () => "GitHub", Na = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
730
+ de: na,
731
+ en: xt
732
+ })[t.languageTag ?? C()](), Va = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
733
+ de: ra,
734
+ en: wt
735
+ })[t.languageTag ?? C()](), Oa = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
736
+ de: ia,
737
+ en: St
738
+ })[t.languageTag ?? C()](), Ba = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
739
+ de: oa,
740
+ en: At
741
+ })[t.languageTag ?? C()](), qa = /* @__NO_SIDE_EFFECTS__ */ (s, t = {}) => ({
742
+ de: la,
743
+ en: It
744
+ })[t.languageTag ?? C()](s), Ya = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
745
+ de: ca,
746
+ en: Tt
747
+ })[t.languageTag ?? C()](), Xa = /* @__NO_SIDE_EFFECTS__ */ (s, t = {}) => ({
748
+ de: da,
749
+ en: $t
750
+ })[t.languageTag ?? C()](s), Qa = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
751
+ de: ga,
752
+ en: kt
753
+ })[t.languageTag ?? C()](), Ua = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
754
+ de: ua,
755
+ en: Ct
756
+ })[t.languageTag ?? C()](), Wa = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
757
+ de: ha,
758
+ en: Mt
759
+ })[t.languageTag ?? C()](), Ka = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
760
+ de: fa,
761
+ en: Lt
762
+ })[t.languageTag ?? C()](), Za = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
763
+ de: va,
764
+ en: jt
765
+ })[t.languageTag ?? C()](), Ja = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
766
+ de: pa,
767
+ en: Et
768
+ })[t.languageTag ?? C()](), es = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
769
+ de: ma,
770
+ en: Gt
771
+ })[t.languageTag ?? C()](), ts = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
772
+ de: ba,
773
+ en: zt
774
+ })[t.languageTag ?? C()](), as = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
775
+ de: _a,
776
+ en: Rt
777
+ })[t.languageTag ?? C()](), ss = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
778
+ de: ya,
779
+ en: Pt
780
+ })[t.languageTag ?? C()](), ns = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
781
+ de: xa,
782
+ en: Dt
783
+ })[t.languageTag ?? C()](), rs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
784
+ de: wa,
785
+ en: Ft
786
+ })[t.languageTag ?? C()](), is = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
787
+ de: Sa,
788
+ en: Ht
789
+ })[t.languageTag ?? C()](), os = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
790
+ de: Aa,
791
+ en: Nt
792
+ })[t.languageTag ?? C()](), ls = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
793
+ de: Ia,
794
+ en: Vt
795
+ })[t.languageTag ?? C()](), cs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
796
+ de: Ta,
797
+ en: Ot
798
+ })[t.languageTag ?? C()](), ds = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
799
+ de: $a,
800
+ en: Bt
801
+ })[t.languageTag ?? C()](), Re = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
802
+ de: ka,
803
+ en: qt
804
+ })[t.languageTag ?? C()](), Pe = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
805
+ de: Ca,
806
+ en: Yt
807
+ })[t.languageTag ?? C()](), De = /* @__NO_SIDE_EFFECTS__ */ (s, t = {}) => ({
808
+ de: Ma,
809
+ en: Xt
810
+ })[t.languageTag ?? C()](s), Fe = /* @__NO_SIDE_EFFECTS__ */ (s, t = {}) => ({
811
+ de: La,
812
+ en: Qt
813
+ })[t.languageTag ?? C()](s), gs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
814
+ de: ja,
815
+ en: Ut
816
+ })[t.languageTag ?? C()](), us = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
817
+ de: Ea,
818
+ en: Wt
819
+ })[t.languageTag ?? C()](), hs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
820
+ de: Ga,
821
+ en: Kt
822
+ })[t.languageTag ?? C()](), fs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
823
+ de: za,
824
+ en: Zt
825
+ })[t.languageTag ?? C()](), vs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
826
+ de: Ra,
827
+ en: Jt
828
+ })[t.languageTag ?? C()](), ps = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
829
+ de: Pa,
830
+ en: ea
831
+ })[t.languageTag ?? C()](), ms = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
832
+ de: Da,
833
+ en: ta
834
+ })[t.languageTag ?? C()](), bs = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
835
+ de: Fa,
836
+ en: aa
837
+ })[t.languageTag ?? C()](), _s = /* @__NO_SIDE_EFFECTS__ */ (s = {}, t = {}) => ({
838
+ de: Ha,
839
+ en: sa
840
+ })[t.languageTag ?? C()](), ys = /* @__PURE__ */ Object.freeze(/* @__PURE__ */ Object.defineProperty({
841
+ __proto__: null,
842
+ annotations_count: De,
843
+ attribution: Wa,
844
+ close: Za,
845
+ docs: vs,
846
+ enter_full_screen: rs,
847
+ exit_full_screen: ns,
848
+ github: _s,
849
+ hello_world: Na,
850
+ hide_all_annotations: Re,
851
+ hide_annotations: is,
852
+ hide_gallery: as,
853
+ iiif_manifest_label: ps,
854
+ license: Ka,
855
+ load: bs,
856
+ loading: Ua,
857
+ manifest_placeholder: ms,
858
+ menu: Ja,
859
+ metadata: cs,
860
+ metadata_label_fallback: Qa,
861
+ next_canvas: fs,
862
+ no_annotations_available: us,
863
+ no_content: gs,
864
+ previous_canvas: hs,
865
+ search: es,
866
+ search_panel_close: Oa,
867
+ search_panel_instruction: Ya,
868
+ search_panel_no_results: qa,
869
+ search_panel_placeholder: Ba,
870
+ search_panel_results_count: Xa,
871
+ search_panel_title: Va,
872
+ show_all_annotations: Pe,
873
+ show_annotations: os,
874
+ show_gallery: ss,
875
+ toggle_annotations: ls,
876
+ toggle_metadata: ds,
877
+ toggle_search: ts,
878
+ visible_count: Fe
879
+ }, Symbol.toStringTag, { value: "Module" }));
880
+ let He = e.state(e.proxy(C()));
881
+ const xs = {
882
+ get current() {
883
+ return e.get(He);
884
+ }
885
+ }, G = new Proxy(ys, {
886
+ get(s, t, a) {
887
+ return e.get(He), Reflect.get(s, t, a);
888
+ }
889
+ });
890
+ var ws = e.from_html('<div><button class="btn btn-circle btn-sm btn-ghost"><!></button> <span class="text-sm font-mono tabular-nums"> </span> <button class="btn btn-circle btn-sm btn-ghost"><!></button></div>');
891
+ function Ss(s, t) {
780
892
  e.push(t, !0);
781
- var s = gt(), r = e.child(s);
782
- r.__click = () => t.viewerState.previousCanvas();
783
- var i = e.child(r);
784
- Xe(i, { size: 20, weight: "bold" }), e.reset(r);
785
- var f = e.sibling(r, 2), S = e.child(f);
786
- e.reset(f);
787
- var A = e.sibling(f, 2);
788
- A.__click = () => t.viewerState.nextCanvas();
789
- var h = e.child(A);
790
- Be(h, { size: 20, weight: "bold" }), e.reset(A), e.reset(s), e.template_effect(() => {
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(S, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), A.disabled = !t.viewerState.hasNext;
792
- }), e.append(n, s), e.pop();
893
+ var a = ws(), n = e.child(a);
894
+ n.__click = () => t.viewerState.previousCanvas();
895
+ var l = e.child(n);
896
+ Qe(l, { size: 20, weight: "bold" }), e.reset(n);
897
+ var c = e.sibling(n, 2), A = e.child(c);
898
+ e.reset(c);
899
+ var m = e.sibling(c, 2);
900
+ m.__click = () => t.viewerState.nextCanvas();
901
+ var p = e.child(m);
902
+ Ue(p, { size: 20, weight: "bold" }), e.reset(m), e.reset(a), e.template_effect(
903
+ (b, x) => {
904
+ e.set_class(a, 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"}`), n.disabled = !t.viewerState.hasPrevious, e.set_attribute(n, "aria-label", b), e.set_text(A, `${t.viewerState.currentCanvasIndex + 1} / ${t.viewerState.canvases.length ?? ""}`), m.disabled = !t.viewerState.hasNext, e.set_attribute(m, "aria-label", x);
905
+ },
906
+ [() => G.previous_canvas(), () => G.next_canvas()]
907
+ ), e.append(s, a), e.pop();
793
908
  }
794
909
  e.delegate(["click"]);
795
- var vt = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), mt = 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>'), bt = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations yet. Click the pencil to draw.</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>');
796
- function _t(n, t) {
910
+ var As = e.from_html('<span class="text-xs opacity-50 truncate max-w-[150px]"> </span>'), Is = 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>'), Ts = e.from_html('<div class="p-4 text-center opacity-50 text-sm">No annotations available.</div>'), $s = 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>');
911
+ function ks(s, t) {
797
912
  e.push(t, !0);
798
- const s = _e($);
799
- let r = e.derived(() => {
800
- if (!s.manifestId || !s.canvasId)
913
+ const a = xe(se);
914
+ let n = e.derived(() => {
915
+ if (!a.manifestId || !a.canvasId)
801
916
  return [];
802
- const o = Z.getAnnotations(s.manifestId, s.canvasId), u = s.currentCanvasSearchAnnotations;
803
- return [...o, ...u];
917
+ const i = ae.getAnnotations(a.manifestId, a.canvasId), o = a.currentCanvasSearchAnnotations;
918
+ return [...i, ...o];
804
919
  });
805
- function i(o) {
806
- return o.id || o["@id"] || (typeof o.getId == "function" ? o.getId() : "") || "";
920
+ function l(i) {
921
+ return i.id || i["@id"] || (typeof i.getId == "function" ? i.getId() : "") || "";
807
922
  }
808
923
  e.user_effect(() => {
809
- if (e.get(r).length > 0) {
810
- const o = /* @__PURE__ */ new Set();
811
- e.get(r).forEach((u) => {
812
- const b = i(u);
813
- b && o.add(b);
814
- }), s.visibleAnnotationIds = o;
924
+ if (e.get(n).length > 0) {
925
+ const i = /* @__PURE__ */ new Set();
926
+ e.get(n).forEach((o) => {
927
+ const h = l(o);
928
+ h && i.add(h);
929
+ }), a.visibleAnnotationIds = i;
815
930
  } else
816
- s.visibleAnnotationIds = /* @__PURE__ */ new Set();
931
+ a.visibleAnnotationIds = /* @__PURE__ */ new Set();
817
932
  });
818
- let f = e.derived(() => e.get(r).length === 0 ? !1 : e.get(r).every((o) => {
819
- const u = i(o);
820
- return !u || s.visibleAnnotationIds.has(u);
933
+ let c = e.derived(() => e.get(n).length === 0 ? !1 : e.get(n).every((i) => {
934
+ const o = l(i);
935
+ return !o || a.visibleAnnotationIds.has(o);
821
936
  }));
822
- function S(o) {
823
- s.visibleAnnotationIds.has(o) ? s.visibleAnnotationIds.delete(o) : s.visibleAnnotationIds.add(o), s.visibleAnnotationIds = new Set(s.visibleAnnotationIds);
937
+ function A(i) {
938
+ a.visibleAnnotationIds.has(i) ? a.visibleAnnotationIds.delete(i) : a.visibleAnnotationIds.add(i), a.visibleAnnotationIds = new Set(a.visibleAnnotationIds);
824
939
  }
825
- function A() {
826
- if (e.get(f))
827
- s.visibleAnnotationIds = /* @__PURE__ */ new Set();
940
+ function m() {
941
+ if (e.get(c))
942
+ a.visibleAnnotationIds = /* @__PURE__ */ new Set();
828
943
  else {
829
- const o = /* @__PURE__ */ new Set();
830
- e.get(r).forEach((u) => {
831
- const b = i(u);
832
- b && o.add(b);
833
- }), s.visibleAnnotationIds = o;
944
+ const i = /* @__PURE__ */ new Set();
945
+ e.get(n).forEach((o) => {
946
+ const h = l(o);
947
+ h && i.add(h);
948
+ }), a.visibleAnnotationIds = i;
834
949
  }
835
950
  }
836
- let h = e.derived(() => e.get(r).length ? e.get(r).map((o) => {
837
- let u = "", b = !1;
838
- if (typeof o.getBody == "function") {
839
- const l = o.getBody();
840
- if (l && l.length) {
841
- const c = (a) => {
842
- const d = a.getValue ? a.getValue() : null;
951
+ let p = e.derived(() => e.get(n).length ? e.get(n).map((i) => {
952
+ let o = "", h = !1;
953
+ if (typeof i.getBody == "function") {
954
+ const _ = i.getBody();
955
+ if (_ && _.length) {
956
+ const f = (r) => {
957
+ const d = r.getValue ? r.getValue() : null;
843
958
  return d || "";
844
959
  };
845
- u = l.map((a) => c(a)).filter(Boolean).join(" "), b = l.some((a) => {
846
- const d = a.getFormat ? a.getFormat() : "";
960
+ o = _.map((r) => f(r)).filter(Boolean).join(" "), h = _.some((r) => {
961
+ const d = r.getFormat ? r.getFormat() : "";
847
962
  return d === "text/html" || d === "application/html";
848
963
  });
849
964
  }
850
- if (!u && typeof o.getLabel == "function") {
851
- const c = o.getLabel();
852
- c && (u = c);
965
+ if (!o && typeof i.getLabel == "function") {
966
+ const f = i.getLabel();
967
+ f && (o = f);
853
968
  }
854
969
  } else {
855
- const l = (a) => a && (a.chars || a.value || a["cnt:chars"]) || "", c = (a) => a ? a.format === "text/html" || a.type === "TextualBody" : !1;
856
- if (o.resource ? Array.isArray(o.resource) ? (u = o.resource.map((a) => l(a)).join(" "), o.resource.some((a) => c(a)) && (b = !0)) : (u = l(o.resource), c(o.resource) && (b = !0)) : o.body && (Array.isArray(o.body) ? (u = o.body.map((a) => l(a)).join(" "), o.body.some((a) => c(a)) && (b = !0)) : (u = l(o.body), c(o.body) && (b = !0))), !u) {
857
- const a = o.label || o.name || o.title;
858
- a && (u = Array.isArray(a) ? a.join(" ") : a);
970
+ const _ = (r) => r && (r.chars || r.value || r["cnt:chars"]) || "", f = (r) => r ? r.format === "text/html" || r.type === "TextualBody" : !1;
971
+ if (i.resource ? Array.isArray(i.resource) ? (o = i.resource.map((r) => _(r)).join(" "), i.resource.some((r) => f(r)) && (h = !0)) : (o = _(i.resource), f(i.resource) && (h = !0)) : i.body && (Array.isArray(i.body) ? (o = i.body.map((r) => _(r)).join(" "), i.body.some((r) => f(r)) && (h = !0)) : (o = _(i.body), f(i.body) && (h = !0))), !o) {
972
+ const r = i.label || i.name || i.title;
973
+ r && (o = Array.isArray(r) ? r.join(" ") : r);
859
974
  }
860
975
  }
861
976
  return {
862
- id: i(o),
863
- content: u,
864
- isHtml: b,
865
- label: (typeof o.getLabel == "function" ? o.getLabel() : o.label) || ""
977
+ id: l(i),
978
+ content: o,
979
+ isHtml: h,
980
+ label: (typeof i.getLabel == "function" ? i.getLabel() : i.label) || ""
866
981
  };
867
982
  }) : []);
868
- var m = e.comment(), y = e.first_child(m);
983
+ var b = e.comment(), x = e.first_child(b);
869
984
  {
870
- var M = (o) => {
871
- var u = pt(), b = e.child(u), l = e.child(b), c = e.child(l);
872
- c.__click = (v) => {
873
- v.preventDefault(), A();
985
+ var j = (i) => {
986
+ var o = $s(), h = e.child(o), _ = e.child(h), f = e.child(_);
987
+ f.__click = (v) => {
988
+ v.preventDefault(), m();
874
989
  };
875
- var a = e.child(c);
990
+ var r = e.child(f);
876
991
  {
877
992
  var d = (v) => {
878
- Ce(v, { size: 16, weight: "bold" });
879
- }, D = (v) => {
880
993
  Me(v, { size: 16, weight: "bold" });
994
+ }, S = (v) => {
995
+ Le(v, { size: 16, weight: "bold" });
881
996
  };
882
- e.if(a, (v) => {
883
- e.get(f) ? v(d) : v(D, !1);
997
+ e.if(r, (v) => {
998
+ e.get(c) ? v(d) : v(S, !1);
884
999
  });
885
1000
  }
886
- e.reset(c);
887
- var I = e.sibling(c, 2), F = e.child(I), L = e.sibling(F), j = e.child(L);
888
- e.reset(L), e.reset(I);
889
- var g = e.sibling(I, 2);
890
- Ye(g, {
1001
+ e.reset(f);
1002
+ var w = e.sibling(f, 2), I = e.child(w), k = e.sibling(I), y = e.child(k, !0);
1003
+ e.reset(k), e.reset(w);
1004
+ var u = e.sibling(w, 2);
1005
+ We(u, {
891
1006
  size: 16,
892
1007
  weight: "bold",
893
1008
  class: "group-open:rotate-180 transition-transform opacity-80"
894
- }), e.reset(l);
895
- var w = e.sibling(l, 2);
1009
+ }), e.reset(_);
1010
+ var E = e.sibling(_, 2);
896
1011
  e.each(
897
- w,
1012
+ E,
898
1013
  21,
899
- () => e.get(h),
1014
+ () => e.get(p),
900
1015
  e.index,
901
- (v, p, x) => {
902
- const _ = e.derived(() => s.visibleAnnotationIds.has(e.get(p).id));
903
- var k = mt();
904
- k.__click = (z) => {
905
- z.preventDefault(), S(e.get(p).id);
1016
+ (v, g, M) => {
1017
+ const O = e.derived(() => a.visibleAnnotationIds.has(e.get(g).id));
1018
+ var $ = Is();
1019
+ $.__click = (D) => {
1020
+ D.preventDefault(), A(e.get(g).id);
906
1021
  };
907
- var T = e.child(k), E = e.child(T);
1022
+ var z = e.child($), T = e.child(z);
908
1023
  {
909
- var O = (z) => {
910
- Ce(z, { size: 16, weight: "bold" });
911
- }, K = (z) => {
912
- Me(z, { size: 16, weight: "bold" });
1024
+ var P = (D) => {
1025
+ Me(D, { size: 16, weight: "bold" });
1026
+ }, B = (D) => {
1027
+ Le(D, { size: 16, weight: "bold" });
913
1028
  };
914
- e.if(E, (z) => {
915
- e.get(_) ? z(O) : z(K, !1);
1029
+ e.if(T, (D) => {
1030
+ e.get(O) ? D(P) : D(B, !1);
916
1031
  });
917
1032
  }
918
- e.reset(T);
919
- var q = e.sibling(T, 2), U = e.child(q), J = e.child(U);
920
- J.textContent = `#${x + 1}`;
921
- var V = e.sibling(J, 2);
1033
+ e.reset(z);
1034
+ var F = e.sibling(z, 2), H = e.child(F), N = e.child(H);
1035
+ N.textContent = `#${M + 1}`;
1036
+ var R = e.sibling(N, 2);
922
1037
  {
923
- var P = (z) => {
924
- var X = vt(), W = e.child(X, !0);
925
- e.reset(X), e.template_effect(() => e.set_text(W, e.get(p).label)), e.append(z, X);
1038
+ var V = (D) => {
1039
+ var X = As(), K = e.child(X, !0);
1040
+ e.reset(X), e.template_effect(() => e.set_text(K, e.get(g).label)), e.append(D, X);
926
1041
  };
927
- e.if(V, (z) => {
928
- e.get(p).label && e.get(p).label !== e.get(p).content && z(P);
1042
+ e.if(R, (D) => {
1043
+ e.get(g).label && e.get(g).label !== e.get(g).content && D(V);
929
1044
  });
930
1045
  }
931
- e.reset(U);
932
- var N = e.sibling(U, 2), R = e.child(N);
1046
+ e.reset(H);
1047
+ var q = e.sibling(H, 2), U = e.child(q);
933
1048
  {
934
- var B = (z) => {
935
- var X = e.comment(), W = e.first_child(X);
936
- e.html(W, () => e.get(p).content), e.append(z, X);
937
- }, Q = (z) => {
1049
+ var W = (D) => {
1050
+ var X = e.comment(), K = e.first_child(X);
1051
+ e.html(K, () => e.get(g).content), e.append(D, X);
1052
+ }, Q = (D) => {
938
1053
  var X = e.text();
939
- e.template_effect(() => e.set_text(X, e.get(p).content || "(No content)")), e.append(z, X);
1054
+ e.template_effect(() => e.set_text(X, e.get(g).content || "(No content)")), e.append(D, X);
940
1055
  };
941
- e.if(R, (z) => {
942
- e.get(p).isHtml ? z(B) : z(Q, !1);
1056
+ e.if(U, (D) => {
1057
+ e.get(g).isHtml ? D(W) : D(Q, !1);
943
1058
  });
944
1059
  }
945
- e.reset(N), e.reset(q), e.reset(k), e.template_effect(() => e.set_class(N, 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(_) ? "" : "opacity-50"}`)), e.append(v, k);
1060
+ e.reset(q), e.reset(F), e.reset($), e.template_effect(() => e.set_class(q, 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(O) ? "" : "opacity-50"}`)), e.append(v, $);
946
1061
  },
947
1062
  (v) => {
948
- var p = bt();
949
- e.append(v, p);
1063
+ var g = Ts();
1064
+ e.append(v, g);
950
1065
  }
951
- ), e.reset(w), e.reset(b), e.reset(u), e.template_effect(() => {
952
- e.set_attribute(c, "title", e.get(f) ? "Hide All Annotations" : "Show All Annotations"), e.set_text(F, `${e.get(r).length ?? ""} Annotations `), e.set_text(j, `(${s.visibleAnnotationIds.size ?? ""} visible)`);
953
- }), e.append(o, u);
1066
+ ), e.reset(E), e.reset(h), e.reset(o), e.template_effect(
1067
+ (v, g, M) => {
1068
+ e.set_attribute(f, "title", v), e.set_text(I, `${g ?? ""} `), e.set_text(y, M);
1069
+ },
1070
+ [
1071
+ () => e.get(c) ? /* @__PURE__ */ Re() : /* @__PURE__ */ Pe(),
1072
+ () => /* @__PURE__ */ De({ count: e.get(n).length }),
1073
+ () => /* @__PURE__ */ Fe({ count: a.visibleAnnotationIds.size })
1074
+ ]
1075
+ ), e.append(i, o);
954
1076
  };
955
- e.if(y, (o) => {
956
- s.showAnnotations && o(M);
1077
+ e.if(x, (i) => {
1078
+ a.showAnnotations && i(j);
957
1079
  });
958
1080
  }
959
- e.append(n, m), e.pop();
1081
+ e.append(s, b), e.pop();
960
1082
  }
961
1083
  e.delegate(["click"]);
962
- var yt = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), xt = e.from_html('<span class="opacity-20 text-4xl">?</span>'), wt = 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>'), St = 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>'), At = 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), It = 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);
963
- function kt(n, t) {
1084
+ var Cs = e.from_html('<img class="object-contain w-full h-full" loading="lazy"/>'), Ms = e.from_html('<span class="opacity-20 text-4xl">?</span>'), Ls = 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>'), js = 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>'), Es = 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), Gs = 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);
1085
+ function zs(s, t) {
964
1086
  e.push(t, !0);
965
- const s = _e($);
966
- let r = e.state(e.proxy({ x: 20, y: 100 })), i = e.state(e.proxy({ width: 300, height: 400 })), f = e.state(!1), S = e.state(!1), A = { x: 0, y: 0 }, h = { x: 0, y: 0, w: 0, h: 0 }, m = e.state(void 0), y = e.derived(() => t.canvases ? t.canvases.map((g, w) => {
1087
+ const a = xe(se);
1088
+ let n = e.state(e.proxy({ x: 20, y: 100 })), l = e.state(e.proxy({ width: 300, height: 400 })), c = e.state(!1), A = e.state(!1), m = { x: 0, y: 0 }, p = { x: 0, y: 0, w: 0, h: 0 }, b = e.state(void 0), x = e.derived(() => t.canvases ? t.canvases.map((u, E) => {
967
1089
  let v = "";
968
1090
  try {
969
- if (g.getCanonicalImageUri)
970
- v = g.getCanonicalImageUri(200);
971
- else if (g.getThumbnail) {
972
- const p = g.getThumbnail();
973
- p && (v = typeof p == "string" ? p : p.id || p["@id"]);
1091
+ if (u.getCanonicalImageUri)
1092
+ v = u.getCanonicalImageUri(200);
1093
+ else if (u.getThumbnail) {
1094
+ const g = u.getThumbnail();
1095
+ g && (v = typeof g == "string" ? g : g.id || g["@id"]);
974
1096
  }
975
- } catch (p) {
976
- console.warn("Error getting thumbnail", p);
1097
+ } catch (g) {
1098
+ console.warn("Error getting thumbnail", g);
977
1099
  }
978
1100
  if (!v) {
979
- const p = g.getImages();
980
- if (p && p.length > 0) {
981
- const x = p[0].getResource();
982
- x && x.getServices().length > 0 ? v = `${x.getServices()[0].id}/full/200,/0/default.jpg` : x && x.id && (v = x.id);
1101
+ const g = u.getImages();
1102
+ if (g && g.length > 0) {
1103
+ const M = g[0].getResource();
1104
+ M && M.getServices().length > 0 ? v = `${M.getServices()[0].id}/full/200,/0/default.jpg` : M && M.id && (v = M.id);
983
1105
  }
984
1106
  }
985
1107
  return {
986
- id: g.id,
987
- label: g.getLabel().length ? g.getLabel()[0].value : `Canvas ${w + 1}`,
1108
+ id: u.id,
1109
+ label: u.getLabel().length ? u.getLabel()[0].value : `Canvas ${E + 1}`,
988
1110
  src: v,
989
- index: w
1111
+ index: E
990
1112
  };
991
1113
  }) : []);
992
- function M(g) {
993
- if (!e.get(f)) return;
994
- let w = g.clientX - A.x, v = g.clientY - A.y;
995
- if (e.get(m) && e.get(m).parentElement) {
996
- const p = e.get(m).parentElement, x = Math.max(0, p.clientWidth - e.get(i).width), _ = Math.max(0, p.clientHeight - e.get(i).height);
997
- w = Math.max(0, Math.min(w, x)), v = Math.max(0, Math.min(v, _));
1114
+ function j(u) {
1115
+ if (!e.get(c)) return;
1116
+ let E = u.clientX - m.x, v = u.clientY - m.y;
1117
+ if (e.get(b) && e.get(b).parentElement) {
1118
+ const g = e.get(b).parentElement, M = Math.max(0, g.clientWidth - e.get(l).width), O = Math.max(0, g.clientHeight - e.get(l).height);
1119
+ E = Math.max(0, Math.min(E, M)), v = Math.max(0, Math.min(v, O));
998
1120
  }
999
- e.get(r).x = w, e.get(r).y = v;
1121
+ e.get(n).x = E, e.get(n).y = v;
1000
1122
  }
1001
- function o() {
1002
- const g = e.get(d);
1003
- e.set(f, !1), e.set(d, null), window.removeEventListener("mousemove", M), window.removeEventListener("mouseup", o), g && e.set(a, g, !0);
1123
+ function i() {
1124
+ const u = e.get(d);
1125
+ e.set(c, !1), e.set(d, null), window.removeEventListener("mousemove", j), window.removeEventListener("mouseup", i), u && e.set(r, u, !0);
1004
1126
  }
1005
- function u(g) {
1006
- g.stopPropagation(), e.set(S, !0), h = {
1007
- x: g.clientX,
1008
- y: g.clientY,
1009
- w: e.get(i).width,
1010
- h: e.get(i).height
1011
- }, window.addEventListener("mousemove", b), window.addEventListener("mouseup", l);
1127
+ function o(u) {
1128
+ u.stopPropagation(), e.set(A, !0), p = {
1129
+ x: u.clientX,
1130
+ y: u.clientY,
1131
+ w: e.get(l).width,
1132
+ h: e.get(l).height
1133
+ }, window.addEventListener("mousemove", h), window.addEventListener("mouseup", _);
1012
1134
  }
1013
- function b(g) {
1014
- if (!e.get(S)) return;
1015
- const w = g.clientX - h.x, v = g.clientY - h.y;
1016
- e.get(i).width = Math.max(200, h.w + w), e.get(i).height = Math.max(200, h.h + v);
1135
+ function h(u) {
1136
+ if (!e.get(A)) return;
1137
+ const E = u.clientX - p.x, v = u.clientY - p.y;
1138
+ e.get(l).width = Math.max(200, p.w + E), e.get(l).height = Math.max(200, p.h + v);
1017
1139
  }
1018
- function l() {
1019
- e.set(S, !1), window.removeEventListener("mousemove", b), window.removeEventListener("mouseup", l);
1140
+ function _() {
1141
+ e.set(A, !1), window.removeEventListener("mousemove", h), window.removeEventListener("mouseup", _);
1020
1142
  }
1021
- function c(g) {
1022
- s.canvasId = g;
1143
+ function f(u) {
1144
+ a.canvasId = u;
1023
1145
  }
1024
- let a = e.state("bottom"), d = e.state(null);
1146
+ let r = e.state("bottom"), d = e.state(null);
1025
1147
  e.user_effect(() => {
1026
- s.dockSide = e.get(a), s.isGalleryDockedBottom = e.get(a) === "bottom", s.isGalleryDockedRight = e.get(a) === "right";
1148
+ a.dockSide = e.get(r), a.isGalleryDockedBottom = e.get(r) === "bottom", a.isGalleryDockedRight = e.get(r) === "right";
1027
1149
  });
1028
- let D = e.derived(() => e.get(a) === "top" || e.get(a) === "bottom" || e.get(a) === "none" && e.get(i).height < 320);
1029
- function I(g) {
1030
- var w, v;
1031
- if (!g.target.closest(".resize-handle")) {
1032
- if (e.get(a) !== "none") {
1033
- e.set(a, "none");
1034
- const p = ((v = (w = e.get(m)) == null ? void 0 : w.parentElement) == null ? void 0 : v.getBoundingClientRect()) || { left: 0, top: 0 };
1035
- e.set(i, { width: 300, height: 400 }, !0), e.set(
1036
- r,
1150
+ let S = e.derived(() => e.get(r) === "top" || e.get(r) === "bottom" || e.get(r) === "none" && e.get(l).height < 320);
1151
+ function w(u) {
1152
+ var E, v;
1153
+ if (!u.target.closest(".resize-handle")) {
1154
+ if (e.get(r) !== "none") {
1155
+ e.set(r, "none");
1156
+ const g = ((v = (E = e.get(b)) == null ? void 0 : E.parentElement) == null ? void 0 : v.getBoundingClientRect()) || { left: 0, top: 0 };
1157
+ e.set(l, { width: 300, height: 400 }, !0), e.set(
1158
+ n,
1037
1159
  {
1038
- x: g.clientX - p.left - 150,
1160
+ x: u.clientX - g.left - 150,
1039
1161
  // Center width
1040
- y: g.clientY - p.top - 20
1162
+ y: u.clientY - g.top - 20
1041
1163
  // Offset slightly from top
1042
1164
  },
1043
1165
  !0
1044
1166
  );
1045
1167
  }
1046
- e.set(f, !0), A = {
1047
- x: g.clientX - e.get(r).x,
1048
- y: g.clientY - e.get(r).y
1049
- }, window.addEventListener("mousemove", M), window.addEventListener("mouseup", o);
1168
+ e.set(c, !0), m = {
1169
+ x: u.clientX - e.get(n).x,
1170
+ y: u.clientY - e.get(n).y
1171
+ }, window.addEventListener("mousemove", j), window.addEventListener("mouseup", i);
1050
1172
  }
1051
1173
  }
1052
- var F = e.comment(), L = e.first_child(F);
1174
+ var I = e.comment(), k = e.first_child(I);
1053
1175
  {
1054
- var j = (g) => {
1055
- var w = It(), v = e.first_child(w), p = e.child(v);
1056
- p.__click = () => s.toggleThumbnailGallery();
1057
- var x = e.child(p);
1058
- He(x, { size: 16, weight: "bold" }), e.reset(p);
1059
- var _ = e.sibling(p, 2), k = e.child(_);
1060
- k.__mousedown = I;
1061
- var T = e.child(k);
1062
- e.reset(k), e.reset(_);
1063
- var E = e.sibling(_, 2), O = e.child(E);
1064
- e.each(O, 21, () => e.get(y), e.index, (V, P) => {
1065
- var N = wt();
1066
- N.__click = () => c(e.get(P).id);
1067
- var R = e.child(N), B = e.child(R);
1176
+ var y = (u) => {
1177
+ var E = Gs(), v = e.first_child(E), g = e.child(v);
1178
+ g.__click = () => a.toggleThumbnailGallery();
1179
+ var M = e.child(g);
1180
+ Ke(M, { size: 16, weight: "bold" }), e.reset(g);
1181
+ var O = e.sibling(g, 2), $ = e.child(O);
1182
+ $.__mousedown = w;
1183
+ var z = e.child($);
1184
+ e.reset($), e.reset(O);
1185
+ var T = e.sibling(O, 2), P = e.child(T);
1186
+ e.each(P, 21, () => e.get(x), e.index, (R, V) => {
1187
+ var q = Ls();
1188
+ q.__click = () => f(e.get(V).id);
1189
+ var U = e.child(q), W = e.child(U);
1068
1190
  {
1069
- var Q = (Y) => {
1070
- var H = yt();
1191
+ var Q = (Z) => {
1192
+ var J = Cs();
1071
1193
  e.template_effect(() => {
1072
- e.set_attribute(H, "src", e.get(P).src), e.set_attribute(H, "alt", e.get(P).label);
1073
- }), e.append(Y, H);
1074
- }, z = (Y) => {
1075
- var H = xt();
1076
- e.append(Y, H);
1194
+ e.set_attribute(J, "src", e.get(V).src), e.set_attribute(J, "alt", e.get(V).label);
1195
+ }), e.append(Z, J);
1196
+ }, D = (Z) => {
1197
+ var J = Ms();
1198
+ e.append(Z, J);
1077
1199
  };
1078
- e.if(B, (Y) => {
1079
- e.get(P).src ? Y(Q) : Y(z, !1);
1200
+ e.if(W, (Z) => {
1201
+ e.get(V).src ? Z(Q) : Z(D, !1);
1080
1202
  });
1081
1203
  }
1082
- e.reset(R);
1083
- var X = e.sibling(R, 2), W = e.child(X), ye = e.child(W);
1084
- e.reset(W);
1085
- var xe = e.sibling(W);
1086
- e.reset(X), e.reset(N), e.template_effect(() => {
1087
- e.set_class(N, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(D) ? "w-[140px]" : ""} ${s.canvasId === e.get(P).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(N, "aria-label", `Select canvas ${e.get(P).label ?? ""}`), e.set_text(ye, `${e.get(P).index + 1}.`), e.set_text(xe, ` ${e.get(P).label ?? ""}`);
1088
- }), e.append(V, N);
1089
- }), e.reset(O), e.reset(E);
1090
- var K = e.sibling(E, 2);
1204
+ e.reset(U);
1205
+ var X = e.sibling(U, 2), K = e.child(X), we = e.child(K);
1206
+ e.reset(K);
1207
+ var Se = e.sibling(K);
1208
+ e.reset(X), e.reset(q), e.template_effect(() => {
1209
+ e.set_class(q, 1, `group flex flex-col gap-1 p-1 rounded hover:bg-base-200 transition-colors text-left relative shrink-0 ${e.get(S) ? "w-[140px]" : ""} ${a.canvasId === e.get(V).id ? "ring-2 ring-primary bg-primary/5" : ""}`), e.set_attribute(q, "aria-label", `Select canvas ${e.get(V).label ?? ""}`), e.set_text(we, `${e.get(V).index + 1}.`), e.set_text(Se, ` ${e.get(V).label ?? ""}`);
1210
+ }), e.append(R, q);
1211
+ }), e.reset(P), e.reset(T);
1212
+ var B = e.sibling(T, 2);
1091
1213
  {
1092
- var q = (V) => {
1093
- var P = St();
1094
- P.__mousedown = u, e.append(V, P);
1214
+ var F = (R) => {
1215
+ var V = js();
1216
+ V.__mousedown = o, e.append(R, V);
1095
1217
  };
1096
- e.if(K, (V) => {
1097
- e.get(a) === "none" && V(q);
1218
+ e.if(B, (R) => {
1219
+ e.get(r) === "none" && R(F);
1098
1220
  });
1099
1221
  }
1100
- e.reset(v), e.bind_this(v, (V) => e.set(m, V), () => e.get(m));
1101
- var U = e.sibling(v, 2);
1222
+ e.reset(v), e.bind_this(v, (R) => e.set(b, R), () => e.get(b));
1223
+ var H = e.sibling(v, 2);
1102
1224
  {
1103
- var J = (V) => {
1104
- var P = At(), N = e.first_child(P), R = e.sibling(N, 2), B = e.sibling(R, 2), Q = e.sibling(B, 2);
1225
+ var N = (R) => {
1226
+ var V = Es(), q = e.first_child(V), U = e.sibling(q, 2), W = e.sibling(U, 2), Q = e.sibling(W, 2);
1105
1227
  e.template_effect(() => {
1106
- e.set_class(N, 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(R, 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(Q, 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"}`);
1107
- }), e.event("mouseenter", N, () => e.set(d, "top")), e.event("mouseleave", N, () => e.set(d, null)), e.event("mouseenter", R, () => e.set(d, "bottom")), e.event("mouseleave", R, () => e.set(d, null)), e.event("mouseenter", B, () => e.set(d, "left")), e.event("mouseleave", B, () => e.set(d, null)), e.event("mouseenter", Q, () => e.set(d, "right")), e.event("mouseleave", Q, () => e.set(d, null)), e.append(V, P);
1228
+ e.set_class(q, 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(U, 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(W, 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(Q, 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 ${a.showSearchPanel ? "right-[328px]" : "right-2"} ${e.get(d) === "right" ? "bg-primary/20 scale-105" : "bg-base-100/50"}`);
1229
+ }), e.event("mouseenter", q, () => e.set(d, "top")), e.event("mouseleave", q, () => e.set(d, null)), e.event("mouseenter", U, () => e.set(d, "bottom")), e.event("mouseleave", U, () => e.set(d, null)), e.event("mouseenter", W, () => e.set(d, "left")), e.event("mouseleave", W, () => e.set(d, null)), e.event("mouseenter", Q, () => e.set(d, "right")), e.event("mouseleave", Q, () => e.set(d, null)), e.append(R, V);
1108
1230
  };
1109
- e.if(U, (V) => {
1110
- e.get(f) && V(J);
1231
+ e.if(H, (R) => {
1232
+ e.get(c) && R(N);
1111
1233
  });
1112
1234
  }
1113
1235
  e.template_effect(() => {
1114
- e.set_class(v, 1, (e.get(a) !== "none" ? `absolute z-900 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200
1115
- ${e.get(a) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
1116
- ${e.get(a) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
1117
- ${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(f) ? " 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(i).width}px; height: ${e.get(i).height}px;`), e.set_class(_, 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(k, 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(T, 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(E, 1, `flex-1 p-1 bg-base-100 ${e.get(D) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(O, 1, e.clsx(e.get(D) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(O, e.get(D) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1119
- }), e.append(g, w);
1236
+ e.set_class(v, 1, (e.get(r) !== "none" ? `absolute z-900 bg-base-100 shadow-xl border-base-300 flex transition-all duration-200
1237
+ ${e.get(r) === "bottom" ? "flex-row bottom-0 left-0 right-0 h-[140px] border-t" : ""}
1238
+ ${e.get(r) === "top" ? "flex-row top-0 left-0 right-0 h-[140px] border-b" : ""}
1239
+ ${e.get(r) === "left" ? "flex-col left-0 top-0 bottom-0 w-[200px] border-r" : ""}
1240
+ ${e.get(r) === "right" ? `flex-col top-0 bottom-0 w-[200px] border-l ${a.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(r) !== "none" ? "" : `left: ${e.get(n).x}px; top: ${e.get(n).y}px; width: ${e.get(l).width}px; height: ${e.get(l).height}px;`), e.set_class(O, 1, "bg-base-100 flex shrink-0 select-none relative " + (e.get(r) === "bottom" || e.get(r) === "top" ? "flex-row h-full items-center border-r border-base-200" : "flex-col w-full border-b border-base-200")), e.set_class($, 1, "cursor-move flex items-center justify-center hover:bg-base-200/50 active:bg-base-200 transition-colors " + (e.get(r) === "bottom" || e.get(r) === "top" ? "w-8 h-full" : "h-6 w-full")), e.set_class(z, 1, "bg-base-300 rounded-full " + (e.get(r) === "bottom" || e.get(r) === "top" ? "w-1.5 h-12" : "w-12 h-1.5")), e.set_class(T, 1, `flex-1 p-1 bg-base-100 ${e.get(S) ? "overflow-x-auto overflow-y-hidden" : "overflow-y-auto overflow-x-hidden"}`), e.set_class(P, 1, e.clsx(e.get(S) ? "flex flex-row gap-2 h-full items-center" : "grid gap-2")), e.set_style(P, e.get(S) ? "" : "grid-template-columns: repeat(auto-fill, minmax(100px, 1fr));");
1241
+ }), e.append(u, E);
1120
1242
  };
1121
- e.if(L, (g) => {
1122
- s.showThumbnailGallery && g(j);
1243
+ e.if(k, (u) => {
1244
+ a.showThumbnailGallery && u(y);
1123
1245
  });
1124
1246
  }
1125
- e.append(n, F), e.pop();
1247
+ e.append(s, I), e.pop();
1126
1248
  }
1127
1249
  e.delegate(["click", "mousedown"]);
1128
- var Ct = 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>');
1129
- function Mt(n, t) {
1250
+ var Rs = e.from_html('<div><div tabindex="0" role="button" class="btn btn-lg btn-primary btn-circle shadow-xl"><!></div> <div class="fab-close tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-left"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div> <div class="tooltip tooltip-top"><button><!></button></div></div>');
1251
+ function Ps(s, t) {
1130
1252
  e.push(t, !1);
1131
- const s = _e($);
1253
+ const a = xe(se);
1132
1254
  e.init();
1133
- var r = Ct(), i = e.child(r), f = e.child(i);
1134
- Je(f, { size: 32, weight: "bold" }), e.reset(i);
1135
- var S = e.sibling(i, 2), A = e.child(S);
1136
- A.__click = () => s.toggleSearchPanel();
1137
- var h = e.child(A);
1138
- Fe(h, { size: 28, weight: "bold" }), e.reset(A), e.reset(S);
1139
- var m = e.sibling(S, 2), y = e.child(m);
1140
- y.__click = () => s.toggleThumbnailGallery();
1141
- var M = e.child(y);
1142
- Ke(M, { size: 28, weight: "bold" }), e.reset(y), e.reset(m);
1143
- var o = e.sibling(m, 2), u = e.child(o);
1144
- u.__click = () => s.toggleFullScreen();
1145
- var b = e.child(u);
1255
+ var n = Rs(), l = e.child(n), c = e.child(l);
1256
+ at(c, { size: 32, weight: "bold" }), e.reset(l);
1257
+ var A = e.sibling(l, 2), m = e.child(A);
1258
+ m.__click = () => a.toggleSearchPanel();
1259
+ var p = e.child(m);
1260
+ Ge(p, { size: 28, weight: "bold" }), e.reset(m), e.reset(A);
1261
+ var b = e.sibling(A, 2), x = e.child(b);
1262
+ x.__click = () => a.toggleThumbnailGallery();
1263
+ var j = e.child(x);
1264
+ st(j, { size: 28, weight: "bold" }), e.reset(x), e.reset(b);
1265
+ var i = e.sibling(b, 2), o = e.child(i);
1266
+ o.__click = () => a.toggleFullScreen();
1267
+ var h = e.child(o);
1146
1268
  {
1147
- var l = (j) => {
1148
- Qe(j, { size: 28, weight: "bold" });
1149
- }, c = (j) => {
1150
- Ue(j, { size: 28, weight: "bold" });
1269
+ var _ = (y) => {
1270
+ Je(y, { size: 28, weight: "bold" });
1271
+ }, f = (y) => {
1272
+ et(y, { size: 28, weight: "bold" });
1151
1273
  };
1152
- e.if(b, (j) => {
1153
- s.isFullScreen ? j(l) : j(c, !1);
1274
+ e.if(h, (y) => {
1275
+ a.isFullScreen ? y(_) : y(f, !1);
1154
1276
  });
1155
1277
  }
1156
- e.reset(u), e.reset(o);
1157
- var a = e.sibling(o, 2), d = e.child(a);
1158
- d.__click = () => s.toggleAnnotations();
1159
- var D = e.child(d);
1160
- qe(D, { size: 28, weight: "bold" }), e.reset(d), e.reset(a);
1161
- var I = e.sibling(a, 2), F = e.child(I);
1162
- F.__click = () => s.toggleMetadataDialog();
1163
- var L = e.child(F);
1164
- We(L, { size: 28, weight: "bold" }), e.reset(F), e.reset(I), e.reset(r), e.template_effect(() => {
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(A, 1, e.clsx([
1166
- "btn btn-circle btn-lg shadow-lg",
1167
- s.showSearchPanel && "btn-primary",
1168
- !s.showSearchPanel && "btn-neutral"
1169
- ])), e.set_attribute(m, "data-tip", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_attribute(y, "aria-label", s.showThumbnailGallery ? "Hide Gallery" : "Show Gallery"), e.set_class(y, 1, `btn btn-lg btn-circle shadow-lg ${s.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(o, "data-tip", s.isFullScreen ? "Exit Full Screen" : "Enter Full Screen"), e.set_class(u, 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(F, 1, `btn btn-lg btn-circle shadow-lg ${s.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1170
- }), e.append(n, r), e.pop();
1278
+ e.reset(o), e.reset(i);
1279
+ var r = e.sibling(i, 2), d = e.child(r);
1280
+ d.__click = () => a.toggleAnnotations();
1281
+ var S = e.child(d);
1282
+ Ze(S, { size: 28, weight: "bold" }), e.reset(d), e.reset(r);
1283
+ var w = e.sibling(r, 2), I = e.child(w);
1284
+ I.__click = () => a.toggleMetadataDialog();
1285
+ var k = e.child(I);
1286
+ tt(k, { size: 28, weight: "bold" }), e.reset(I), e.reset(w), e.reset(n), e.template_effect(
1287
+ (y, u, E, v, g, M, O, $, z, T) => {
1288
+ e.set_class(n, 1, `fab fab-flower fab-top-left absolute z-600 pointer-events-auto flex-col items-end transition-all duration-300 ${a.showSearchPanel ? a.showThumbnailGallery && a.isGalleryDockedRight ? "right-[540px]" : "right-[344px]" : a.showThumbnailGallery && a.isGalleryDockedRight ? "right-[220px]" : "right-6"} ${a.showThumbnailGallery && a.dockSide === "bottom" ? "bottom-40" : "bottom-6"}`), e.set_attribute(n, "data-tip", y), e.set_attribute(A, "data-tip", u), e.set_attribute(m, "aria-label", E), e.set_class(m, 1, e.clsx([
1289
+ "btn btn-circle btn-lg shadow-lg",
1290
+ a.showSearchPanel && "btn-primary",
1291
+ !a.showSearchPanel && "btn-neutral"
1292
+ ])), e.set_attribute(b, "data-tip", v), e.set_attribute(x, "aria-label", g), e.set_class(x, 1, `btn btn-lg btn-circle shadow-lg ${a.showThumbnailGallery ? "btn-info" : "btn-neutral"}`), e.set_attribute(i, "data-tip", M), e.set_class(o, 1, `btn btn-circle btn-lg shadow-lg transition-all duration-300 ease-out ${a.isFullScreen ? "btn-warning" : "btn-neutral"}`), e.set_attribute(r, "data-tip", O), e.set_attribute(d, "aria-label", $), e.set_class(d, 1, `btn btn-lg btn-circle shadow-lg ${a.showAnnotations ? "btn-error" : "btn-neutral"}`), e.set_attribute(w, "data-tip", z), e.set_attribute(I, "aria-label", T), e.set_class(I, 1, `btn btn-lg btn-circle shadow-lg ${a.showMetadataDialog ? "btn-info" : "btn-neutral"}`);
1293
+ },
1294
+ [
1295
+ () => G.menu(),
1296
+ () => G.search(),
1297
+ () => G.toggle_search(),
1298
+ () => a.showThumbnailGallery ? G.hide_gallery() : G.show_gallery(),
1299
+ () => a.showThumbnailGallery ? G.hide_gallery() : G.show_gallery(),
1300
+ () => a.isFullScreen ? G.exit_full_screen() : G.enter_full_screen(),
1301
+ () => a.showAnnotations ? G.hide_annotations() : G.show_annotations(),
1302
+ () => G.toggle_annotations(),
1303
+ () => G.metadata(),
1304
+ () => G.toggle_metadata()
1305
+ ]
1306
+ ), e.append(s, n), e.pop();
1171
1307
  }
1172
1308
  e.delegate(["click"]);
1173
- var jt = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), Tt = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6">Attribution</dt> <dd class="text-sm ps-2"><!></dd>', 1), Ft = 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), Dt = 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>');
1174
- function Et(n, t) {
1309
+ var Ds = e.from_html('<div class="mb-6 prose"><p><!></p></div>'), Fs = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Hs = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><a target="_blank" rel="noreferrer" class="link link-primary break-all"> </a></dd>', 1), Ns = e.from_html('<dt class="font-bold text-lg opacity-70 mt-6"> </dt> <dd class="text-sm ps-2"><!></dd>', 1), Vs = 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"> </button></form></div></div> <form method="dialog" class="modal-backdrop"><button> </button></form></dialog>');
1310
+ function Os(s, t) {
1175
1311
  e.push(t, !0);
1176
- const s = _e($);
1177
- let r = e.derived(() => s.manifest), i = e.derived(() => {
1178
- if (!e.get(r)) return [];
1179
- const x = e.get(r).getMetadata();
1180
- return x ? x.map((_) => {
1181
- let k = "", T = "";
1182
- if (_.getLabel) {
1183
- const E = _.getLabel();
1184
- Array.isArray(E) ? k = E.map((O) => O.value).join(" ") : k = E;
1185
- } else _.label && (typeof _.label == "string" ? k = _.label : Array.isArray(_.label) ? k = _.label.map((E) => E.value).join(" ") : k = String(_.label));
1186
- if (_.getValue) {
1187
- const E = _.getValue();
1188
- Array.isArray(E) ? T = E.map((O) => O.value).join(" ") : T = E;
1189
- } else _.value && (typeof _.value == "string" ? T = _.value : Array.isArray(_.value) ? T = _.value.map((E) => E.value).join(" ") : T = String(_.value));
1190
- return { label: k, value: T };
1312
+ const a = xe(se);
1313
+ let n = e.derived(() => a.manifest), l = e.derived(() => {
1314
+ const $ = xs.current;
1315
+ if (!e.get(n)) return [];
1316
+ const z = e.get(n).getMetadata();
1317
+ return z ? z.map((T) => {
1318
+ let P = "", B = "";
1319
+ const F = (H) => {
1320
+ if (typeof H == "string") return H;
1321
+ if (Array.isArray(H)) {
1322
+ let N = H.find((R) => R.locale === $ || R.language === $);
1323
+ return N || (N = H.find((R) => R.locale === "en" || R.language === "en")), N || (N = H.find((R) => !R.locale && !R.language)), N || (N = H[0]), N ? N.value : "";
1324
+ }
1325
+ return String(H);
1326
+ };
1327
+ return T.getLabel ? P = F(T.getLabel()) : T.label && (P = F(T.label)), T.getValue ? B = F(T.getValue()) : T.value && (B = F(T.value)), { label: P, value: B };
1191
1328
  }) : [];
1192
- }), f = e.derived(() => e.get(r) ? e.get(r).getDescription() : ""), S = e.derived(() => {
1193
- var x;
1194
- return e.get(r) ? (x = e.get(r).getRequiredStatement()) == null ? void 0 : x.getValue() : "";
1195
- }), A = e.derived(() => e.get(r) ? e.get(r).getLicense() : "");
1196
- var h = Lt(), m = e.child(h), y = e.child(m), M = e.child(y);
1197
- M.__click = () => s.toggleMetadataDialog(), e.reset(y);
1198
- var o = e.sibling(y, 2), u = e.child(o, !0);
1199
- e.reset(o);
1200
- var b = e.sibling(o, 2), l = e.child(b);
1329
+ }), c = e.derived(() => e.get(n) ? e.get(n).getDescription() : ""), A = e.derived(() => {
1330
+ var $;
1331
+ return e.get(n) ? ($ = e.get(n).getRequiredStatement()) == null ? void 0 : $.getValue() : "";
1332
+ }), m = e.derived(() => e.get(n) ? e.get(n).getLicense() : "");
1333
+ var p = Vs(), b = e.child(p), x = e.child(b), j = e.child(x);
1334
+ j.__click = () => a.toggleMetadataDialog(), e.reset(x);
1335
+ var i = e.sibling(x, 2), o = e.child(i, !0);
1336
+ e.reset(i);
1337
+ var h = e.sibling(i, 2), _ = e.child(h);
1201
1338
  {
1202
- var c = (x) => {
1203
- var _ = jt(), k = e.child(_), T = e.child(k);
1204
- e.html(T, () => e.get(f)), e.reset(k), e.reset(_), e.append(x, _);
1339
+ var f = ($) => {
1340
+ var z = Ds(), T = e.child(z), P = e.child(T);
1341
+ e.html(P, () => e.get(c)), e.reset(T), e.reset(z), e.append($, z);
1205
1342
  };
1206
- e.if(l, (x) => {
1207
- e.get(f) && x(c);
1343
+ e.if(_, ($) => {
1344
+ e.get(c) && $(f);
1208
1345
  });
1209
1346
  }
1210
- var a = e.sibling(l, 2), d = e.child(a);
1347
+ var r = e.sibling(_, 2), d = e.child(r);
1211
1348
  {
1212
- var D = (x) => {
1213
- var _ = Tt(), k = e.sibling(e.first_child(_), 2), T = e.child(k);
1214
- e.html(T, () => e.get(S)), e.reset(k), e.append(x, _);
1349
+ var S = ($) => {
1350
+ var z = Fs(), T = e.first_child(z), P = e.child(T, !0);
1351
+ e.reset(T);
1352
+ var B = e.sibling(T, 2), F = e.child(B);
1353
+ e.html(F, () => e.get(A)), e.reset(B), e.template_effect((H) => e.set_text(P, H), [() => G.attribution()]), e.append($, z);
1215
1354
  };
1216
- e.if(d, (x) => {
1217
- e.get(S) && x(D);
1355
+ e.if(d, ($) => {
1356
+ e.get(A) && $(S);
1218
1357
  });
1219
1358
  }
1220
- var I = e.sibling(d, 2);
1359
+ var w = e.sibling(d, 2);
1221
1360
  {
1222
- var F = (x) => {
1223
- var _ = Ft(), k = e.sibling(e.first_child(_), 2), T = e.child(k), E = e.child(T, !0);
1224
- e.reset(T), e.reset(k), e.template_effect(() => {
1225
- e.set_attribute(T, "href", e.get(A)), e.set_text(E, e.get(A));
1226
- }), e.append(x, _);
1361
+ var I = ($) => {
1362
+ var z = Hs(), T = e.first_child(z), P = e.child(T, !0);
1363
+ e.reset(T);
1364
+ var B = e.sibling(T, 2), F = e.child(B), H = e.child(F, !0);
1365
+ e.reset(F), e.reset(B), e.template_effect(
1366
+ (N) => {
1367
+ e.set_text(P, N), e.set_attribute(F, "href", e.get(m)), e.set_text(H, e.get(m));
1368
+ },
1369
+ [() => G.license()]
1370
+ ), e.append($, z);
1227
1371
  };
1228
- e.if(I, (x) => {
1229
- e.get(A) && x(F);
1372
+ e.if(w, ($) => {
1373
+ e.get(m) && $(I);
1230
1374
  });
1231
1375
  }
1232
- var L = e.sibling(I, 2);
1233
- e.each(L, 17, () => e.get(i), e.index, (x, _) => {
1234
- var k = Dt(), T = e.first_child(k), E = e.child(T, !0);
1235
- e.reset(T);
1236
- var O = e.sibling(T, 2), K = e.child(O);
1237
- e.html(K, () => e.get(_).value), e.reset(O), e.template_effect(() => e.set_text(E, e.get(_).label)), e.append(x, k);
1238
- }), e.reset(a), e.reset(b);
1239
- var j = e.sibling(b, 2), g = e.child(j), w = e.child(g);
1240
- w.__click = () => s.toggleMetadataDialog(), e.reset(g), e.reset(j), e.reset(m);
1241
- var v = e.sibling(m, 2), p = e.child(v);
1242
- p.__click = () => s.toggleMetadataDialog(), e.reset(v), e.reset(h), e.template_effect(
1243
- (x) => {
1244
- h.open = s.showMetadataDialog, e.set_text(u, x);
1376
+ var k = e.sibling(w, 2);
1377
+ e.each(k, 17, () => e.get(l), e.index, ($, z) => {
1378
+ var T = Ns(), P = e.first_child(T), B = e.child(P, !0);
1379
+ e.reset(P);
1380
+ var F = e.sibling(P, 2), H = e.child(F);
1381
+ e.html(H, () => e.get(z).value), e.reset(F), e.template_effect(() => e.set_text(B, e.get(z).label)), e.append($, T);
1382
+ }), e.reset(r), e.reset(h);
1383
+ var y = e.sibling(h, 2), u = e.child(y), E = e.child(u);
1384
+ E.__click = () => a.toggleMetadataDialog();
1385
+ var v = e.child(E, !0);
1386
+ e.reset(E), e.reset(u), e.reset(y), e.reset(b);
1387
+ var g = e.sibling(b, 2), M = e.child(g);
1388
+ M.__click = () => a.toggleMetadataDialog();
1389
+ var O = e.child(M, !0);
1390
+ e.reset(M), e.reset(g), e.reset(p), e.template_effect(
1391
+ ($, z, T) => {
1392
+ p.open = a.showMetadataDialog, e.set_text(o, $), e.set_text(v, z), e.set_text(O, T);
1245
1393
  },
1246
1394
  [
1247
- () => e.get(r) ? e.get(r).getLabel().length ? e.get(r).getLabel()[0].value : "Manifest Metadata" : "Loading..."
1395
+ () => e.get(n) ? e.get(n).getLabel().length && e.get(n).getLabel()[0] ? e.get(n).getLabel()[0].value : G.metadata_label_fallback() : G.loading(),
1396
+ () => G.close(),
1397
+ () => G.close()
1248
1398
  ]
1249
- ), e.append(n, h), e.pop();
1399
+ ), e.append(s, p), e.pop();
1250
1400
  }
1251
1401
  e.delegate(["click"]);
1252
- var zt = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), Gt = 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>'), Nt = 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>'), Ot = e.from_html('<div class="leading-relaxed"> </div>'), Vt = 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>'), Xt = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Bt = 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>');
1253
- function Yt(n, t) {
1402
+ var Bs = e.from_html('<span class="loading loading-spinner loading-xs"></span>'), qs = e.from_html('<div class="flex justify-center p-8"><span class="loading loading-spinner loading-lg text-primary"></span></div>'), Ys = e.from_html('<div class="text-center opacity-50 p-4"> </div>'), Xs = e.from_html('<div class="text-center opacity-50 p-4 text-sm"> </div>'), Qs = 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>'), Us = e.from_html('<div class="leading-relaxed"> </div>'), Ws = 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>'), Ks = e.from_html('<div class="text-xs font-bold opacity-50 uppercase tracking-wider pb-2"> </div> <!>', 1), Zs = 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"><div class="p-4 bg-base-300 flex justify-between items-center shrink-0"><h2 class="font-bold text-lg"> </h2> <button class="btn btn-sm btn-circle btn-ghost">✕</button></div> <div class="p-4 border-b border-base-300 shrink-0"><div class="join w-full"><input type="text" class="input input-bordered join-item w-full"/> <button class="btn btn-primary join-item"><!></button></div></div> <div class="flex-1 overflow-y-auto p-4 space-y-4"><!></div></div>');
1403
+ function Js(s, t) {
1254
1404
  e.push(t, !0);
1255
- const s = _e($);
1256
- let r = e.state(e.proxy(s.searchQuery));
1257
- function i() {
1258
- s.search(e.get(r));
1405
+ const a = xe(se);
1406
+ let n = e.state(e.proxy(a.searchQuery));
1407
+ function l() {
1408
+ a.search(e.get(n));
1259
1409
  }
1260
- function f(y) {
1261
- y.key === "Enter" && i();
1410
+ function c(x) {
1411
+ x.key === "Enter" && l();
1262
1412
  }
1263
- function S(y) {
1264
- const M = s.canvases[y.canvasIndex];
1265
- M && (s.canvasId = M.id);
1413
+ function A(x) {
1414
+ const j = a.canvases[x.canvasIndex];
1415
+ j && (a.canvasId = j.id);
1266
1416
  }
1267
- var A = e.comment(), h = e.first_child(A);
1417
+ var m = e.comment(), p = e.first_child(m);
1268
1418
  {
1269
- var m = (y) => {
1270
- var M = Bt(), o = e.child(M), u = e.sibling(e.child(o), 2);
1271
- u.__click = () => s.toggleSearchPanel(), e.reset(o);
1272
- var b = e.sibling(o, 2), l = e.child(b), c = e.child(l);
1273
- e.remove_input_defaults(c), c.__keydown = f;
1274
- var a = e.sibling(c, 2);
1275
- a.__click = i;
1276
- var d = e.child(a);
1419
+ var b = (x) => {
1420
+ var j = Zs(), i = e.child(j), o = e.child(i), h = e.child(o, !0);
1421
+ e.reset(o);
1422
+ var _ = e.sibling(o, 2);
1423
+ _.__click = () => a.toggleSearchPanel(), e.reset(i);
1424
+ var f = e.sibling(i, 2), r = e.child(f), d = e.child(r);
1425
+ e.remove_input_defaults(d), d.__keydown = c;
1426
+ var S = e.sibling(d, 2);
1427
+ S.__click = l;
1428
+ var w = e.child(S);
1277
1429
  {
1278
- var D = (w) => {
1279
- var v = zt();
1280
- e.append(w, v);
1281
- }, I = (w) => {
1282
- Fe(w, { size: 20, weight: "bold" });
1430
+ var I = (g) => {
1431
+ var M = Bs();
1432
+ e.append(g, M);
1433
+ }, k = (g) => {
1434
+ Ge(g, { size: 20, weight: "bold" });
1283
1435
  };
1284
- e.if(d, (w) => {
1285
- s.isSearching ? w(D) : w(I, !1);
1436
+ e.if(w, (g) => {
1437
+ a.isSearching ? g(I) : g(k, !1);
1286
1438
  });
1287
1439
  }
1288
- e.reset(a), e.reset(l), e.reset(b);
1289
- var F = e.sibling(b, 2), L = e.child(F);
1440
+ e.reset(S), e.reset(r), e.reset(f);
1441
+ var y = e.sibling(f, 2), u = e.child(y);
1290
1442
  {
1291
- var j = (w) => {
1292
- var v = Gt();
1293
- e.append(w, v);
1294
- }, g = (w) => {
1295
- var v = e.comment(), p = e.first_child(v);
1443
+ var E = (g) => {
1444
+ var M = qs();
1445
+ e.append(g, M);
1446
+ }, v = (g) => {
1447
+ var M = e.comment(), O = e.first_child(M);
1296
1448
  {
1297
- var x = (k) => {
1298
- var T = Pt(), E = e.child(T);
1299
- e.reset(T), e.template_effect(() => e.set_text(E, `No results found for "${s.searchQuery ?? ""}"`)), e.append(k, T);
1300
- }, _ = (k) => {
1301
- var T = e.comment(), E = e.first_child(T);
1449
+ var $ = (T) => {
1450
+ var P = Ys(), B = e.child(P, !0);
1451
+ e.reset(P), e.template_effect((F) => e.set_text(B, F), [
1452
+ () => G.search_panel_no_results({ query: a.searchQuery })
1453
+ ]), e.append(T, P);
1454
+ }, z = (T) => {
1455
+ var P = e.comment(), B = e.first_child(P);
1302
1456
  {
1303
- var O = (q) => {
1304
- var U = Rt();
1305
- e.append(q, U);
1306
- }, K = (q) => {
1307
- var U = Xt(), J = e.first_child(U), V = e.child(J);
1308
- e.reset(J);
1309
- var P = e.sibling(J, 2);
1310
- e.each(P, 17, () => s.searchResults, e.index, (N, R) => {
1311
- var B = Vt();
1312
- B.__click = () => S(e.get(R));
1313
- var Q = e.child(B), z = e.child(Q), X = e.child(z, !0);
1314
- e.reset(z), e.reset(Q);
1315
- var W = e.sibling(Q, 2);
1457
+ var F = (N) => {
1458
+ var R = Xs(), V = e.child(R, !0);
1459
+ e.reset(R), e.template_effect((q) => e.set_text(V, q), [() => G.search_panel_instruction()]), e.append(N, R);
1460
+ }, H = (N) => {
1461
+ var R = Ks(), V = e.first_child(R), q = e.child(V, !0);
1462
+ e.reset(V);
1463
+ var U = e.sibling(V, 2);
1464
+ e.each(U, 17, () => a.searchResults, e.index, (W, Q) => {
1465
+ var D = Ws();
1466
+ D.__click = () => A(e.get(Q));
1467
+ var X = e.child(D), K = e.child(X), we = e.child(K, !0);
1468
+ e.reset(K), e.reset(X);
1469
+ var Se = e.sibling(X, 2);
1316
1470
  {
1317
- var ye = (Y) => {
1318
- var H = Nt(), ee = e.child(H), Le = e.child(ee);
1319
- e.html(Le, () => e.get(R).before), e.reset(ee);
1320
- var we = e.sibling(ee, 2), Ee = e.child(we);
1321
- e.html(Ee, () => e.get(R).match), e.reset(we);
1322
- var Ie = e.sibling(we, 2), ze = e.child(Ie);
1323
- e.html(ze, () => e.get(R).after), e.reset(Ie), e.reset(H), e.append(Y, H);
1324
- }, xe = (Y) => {
1325
- var H = Ot(), ee = e.child(H, !0);
1326
- e.reset(H), e.template_effect(() => e.set_text(ee, e.get(R).match)), e.append(Y, H);
1471
+ var Z = (te) => {
1472
+ var ee = Qs(), ne = e.child(ee), Ne = e.child(ne);
1473
+ e.html(Ne, () => e.get(Q).before), e.reset(ne);
1474
+ var Ae = e.sibling(ne, 2), Ve = e.child(Ae);
1475
+ e.html(Ve, () => e.get(Q).match), e.reset(Ae);
1476
+ var $e = e.sibling(Ae, 2), Oe = e.child($e);
1477
+ e.html(Oe, () => e.get(Q).after), e.reset($e), e.reset(ee), e.append(te, ee);
1478
+ }, J = (te) => {
1479
+ var ee = Us(), ne = e.child(ee, !0);
1480
+ e.reset(ee), e.template_effect(() => e.set_text(ne, e.get(Q).match)), e.append(te, ee);
1327
1481
  };
1328
- e.if(W, (Y) => {
1329
- e.get(R).type === "hit" ? Y(ye) : Y(xe, !1);
1482
+ e.if(Se, (te) => {
1483
+ e.get(Q).type === "hit" ? te(Z) : te(J, !1);
1330
1484
  });
1331
1485
  }
1332
- e.reset(B), e.template_effect(() => e.set_text(X, e.get(R).canvasLabel)), e.append(N, B);
1333
- }), e.template_effect(() => e.set_text(V, `${s.searchResults.length ?? ""} Results`)), e.append(q, U);
1486
+ e.reset(D), e.template_effect(() => e.set_text(we, e.get(Q).canvasLabel)), e.append(W, D);
1487
+ }), e.template_effect((W) => e.set_text(q, W), [
1488
+ () => G.search_panel_results_count({ count: a.searchResults.length })
1489
+ ]), e.append(N, R);
1334
1490
  };
1335
1491
  e.if(
1336
- E,
1337
- (q) => {
1338
- s.searchResults.length === 0 && !s.searchQuery ? q(O) : q(K, !1);
1492
+ B,
1493
+ (N) => {
1494
+ a.searchResults.length === 0 && !a.searchQuery ? N(F) : N(H, !1);
1339
1495
  },
1340
1496
  !0
1341
1497
  );
1342
1498
  }
1343
- e.append(k, T);
1499
+ e.append(T, P);
1344
1500
  };
1345
1501
  e.if(
1346
- p,
1347
- (k) => {
1348
- s.searchResults.length === 0 && s.searchQuery ? k(x) : k(_, !1);
1502
+ O,
1503
+ (T) => {
1504
+ a.searchResults.length === 0 && a.searchQuery ? T($) : T(z, !1);
1349
1505
  },
1350
1506
  !0
1351
1507
  );
1352
1508
  }
1353
- e.append(w, v);
1509
+ e.append(g, M);
1354
1510
  };
1355
- e.if(L, (w) => {
1356
- s.isSearching ? w(j) : w(g, !1);
1511
+ e.if(u, (g) => {
1512
+ a.isSearching ? g(E) : g(v, !1);
1357
1513
  });
1358
1514
  }
1359
- e.reset(F), e.reset(M), e.bind_value(c, () => e.get(r), (w) => e.set(r, w)), e.append(y, M);
1515
+ e.reset(y), e.reset(j), e.template_effect(
1516
+ (g, M, O, $, z) => {
1517
+ e.set_attribute(j, "aria-label", g), e.set_text(h, M), e.set_attribute(_, "aria-label", O), e.set_attribute(d, "placeholder", $), e.set_attribute(S, "aria-label", z);
1518
+ },
1519
+ [
1520
+ () => G.search_panel_title(),
1521
+ () => G.search_panel_title(),
1522
+ () => G.search_panel_close(),
1523
+ () => G.search_panel_placeholder(),
1524
+ () => G.search_panel_title()
1525
+ ]
1526
+ ), e.bind_value(d, () => e.get(n), (g) => e.set(n, g)), e.append(x, j);
1360
1527
  };
1361
- e.if(h, (y) => {
1362
- s.showSearchPanel && y(m);
1528
+ e.if(p, (x) => {
1529
+ a.showSearchPanel && x(b);
1363
1530
  });
1364
1531
  }
1365
- e.append(n, A), e.pop();
1532
+ e.append(s, m), e.pop();
1366
1533
  }
1367
1534
  e.delegate(["click", "keydown"]);
1368
- var Ht = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), qt = e.from_html('<div class="text-error"> </div>'), Qt = e.from_html('<div class="text-base-content/50">No image found</div>'), Ut = e.from_html("<!> <!>", 1), Wt = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
1369
- function ms(n, t) {
1535
+ var en = e.from_html('<span class="loading loading-spinner loading-lg text-primary"></span>'), tn = e.from_html('<div class="text-error"> </div>'), an = e.from_html('<div class="text-base-content/50">No image found</div>'), sn = e.from_html("<!> <!>", 1), nn = e.from_html('<div id="triiiceratops-viewer" class="w-full h-full relative bg-base-100 flex items-center justify-center"><!> <!> <!> <!> <!> <!></div>');
1536
+ function An(s, t) {
1370
1537
  e.push(t, !0);
1371
- const s = new $e();
1372
- Re($, s), e.user_effect(() => {
1373
- t.manifestId && s.setManifest(t.manifestId);
1538
+ const a = new rt();
1539
+ Ye(se, a), e.user_effect(() => {
1540
+ t.manifestId && a.setManifest(t.manifestId);
1374
1541
  }), e.user_effect(() => {
1375
- const a = () => {
1376
- s.isFullScreen = !!document.fullscreenElement;
1542
+ const r = () => {
1543
+ a.isFullScreen = !!document.fullscreenElement;
1377
1544
  };
1378
- return document.addEventListener("fullscreenchange", a), () => {
1379
- document.removeEventListener("fullscreenchange", a);
1545
+ return document.addEventListener("fullscreenchange", r), () => {
1546
+ document.removeEventListener("fullscreenchange", r);
1380
1547
  };
1381
1548
  });
1382
- let r = e.derived(() => s.manifest), i = e.derived(() => s.canvases), f = e.derived(() => s.currentCanvasIndex), S = e.derived(() => {
1383
- if (!e.get(i) || e.get(f) === -1 || !e.get(i)[e.get(f)])
1549
+ let n = e.derived(() => a.manifest), l = e.derived(() => a.canvases), c = e.derived(() => a.currentCanvasIndex), A = e.derived(() => {
1550
+ if (!e.get(l) || e.get(c) === -1 || !e.get(l)[e.get(c)])
1384
1551
  return console.log("TriiiceratopsViewer: No canvas found"), null;
1385
- const d = e.get(i)[e.get(f)].getImages();
1552
+ const d = e.get(l)[e.get(c)].getImages();
1386
1553
  if (!d || !d.length)
1387
1554
  return console.log("TriiiceratopsViewer: No images in canvas"), null;
1388
- const I = d[0].getResource();
1389
- if (!I)
1555
+ const w = d[0].getResource();
1556
+ if (!w)
1390
1557
  return console.log("TriiiceratopsViewer: No resource in annotation"), null;
1391
- const F = I.getService();
1392
- if (F) {
1393
- let g = F.id;
1394
- return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
1558
+ const I = w.getService();
1559
+ if (I) {
1560
+ let u = I.id;
1561
+ return u && !u.endsWith("/info.json") && (u = `${u}/info.json`), u;
1395
1562
  }
1396
- const L = I.getServices();
1397
- if (L && L.length > 0) {
1398
- let g = L[0].id;
1399
- return g && !g.endsWith("/info.json") && (g = `${g}/info.json`), g;
1563
+ const k = w.getServices();
1564
+ if (k && k.length > 0) {
1565
+ let u = k[0].id;
1566
+ return u && !u.endsWith("/info.json") && (u = `${u}/info.json`), u;
1400
1567
  }
1401
- if (I.id && I.id.includes("/iiif/")) {
1402
- const g = I.id.split("/"), w = g.findIndex((v) => v === "full" || v.match(/^\d+,\d+,\d+,\d+$/));
1403
- if (w > 0)
1404
- return `${g.slice(0, w).join("/")}/info.json`;
1568
+ if (w.id && w.id.includes("/iiif/")) {
1569
+ const u = w.id.split("/"), E = u.findIndex((v) => v === "full" || v.match(/^\d+,\d+,\d+,\d+$/));
1570
+ if (E > 0)
1571
+ return `${u.slice(0, E).join("/")}/info.json`;
1405
1572
  }
1406
- return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: I.id };
1573
+ return console.log("TriiiceratopsViewer: No service or ID found, returning raw URL"), { type: "image", url: w.id };
1407
1574
  });
1408
- var A = Wt(), h = e.child(A);
1575
+ var m = nn(), p = e.child(m);
1409
1576
  {
1410
- var m = (a) => {
1411
- var d = Ht();
1412
- e.append(a, d);
1413
- }, y = (a) => {
1414
- var d = e.comment(), D = e.first_child(d);
1577
+ var b = (r) => {
1578
+ var d = en();
1579
+ e.append(r, d);
1580
+ }, x = (r) => {
1581
+ var d = e.comment(), S = e.first_child(d);
1415
1582
  {
1416
- var I = (L) => {
1417
- var j = qt(), g = e.child(j);
1418
- e.reset(j), e.template_effect(() => e.set_text(g, `Error: ${e.get(r).error ?? ""}`)), e.append(L, j);
1419
- }, F = (L) => {
1420
- var j = e.comment(), g = e.first_child(j);
1583
+ var w = (k) => {
1584
+ var y = tn(), u = e.child(y);
1585
+ e.reset(y), e.template_effect(() => e.set_text(u, `Error: ${e.get(n).error ?? ""}`)), e.append(k, y);
1586
+ }, I = (k) => {
1587
+ var y = e.comment(), u = e.first_child(y);
1421
1588
  {
1422
- var w = (p) => {
1423
- var x = e.comment(), _ = e.first_child(x);
1424
- e.key(_, () => e.get(S), (k) => {
1425
- ut(k, {
1589
+ var E = (g) => {
1590
+ var M = e.comment(), O = e.first_child(M);
1591
+ e.key(O, () => e.get(A), ($) => {
1592
+ _t($, {
1426
1593
  get tileSources() {
1427
- return e.get(S);
1594
+ return e.get(A);
1428
1595
  },
1429
1596
  get viewerState() {
1430
- return s;
1597
+ return a;
1431
1598
  }
1432
1599
  });
1433
- }), e.append(p, x);
1434
- }, v = (p) => {
1435
- var x = Qt();
1436
- e.append(p, x);
1600
+ }), e.append(g, M);
1601
+ }, v = (g) => {
1602
+ var M = an();
1603
+ e.append(g, M);
1437
1604
  };
1438
1605
  e.if(
1439
- g,
1440
- (p) => {
1441
- e.get(S) ? p(w) : p(v, !1);
1606
+ u,
1607
+ (g) => {
1608
+ e.get(A) ? g(E) : g(v, !1);
1442
1609
  },
1443
1610
  !0
1444
1611
  );
1445
1612
  }
1446
- e.append(L, j);
1613
+ e.append(k, y);
1447
1614
  };
1448
1615
  e.if(
1449
- D,
1450
- (L) => {
1451
- var j;
1452
- (j = e.get(r)) != null && j.error ? L(I) : L(F, !1);
1616
+ S,
1617
+ (k) => {
1618
+ var y;
1619
+ (y = e.get(n)) != null && y.error ? k(w) : k(I, !1);
1453
1620
  },
1454
1621
  !0
1455
1622
  );
1456
1623
  }
1457
- e.append(a, d);
1624
+ e.append(r, d);
1458
1625
  };
1459
- e.if(h, (a) => {
1626
+ e.if(p, (r) => {
1460
1627
  var d;
1461
- (d = e.get(r)) != null && d.isFetching ? a(m) : a(y, !1);
1628
+ (d = e.get(n)) != null && d.isFetching ? r(b) : r(x, !1);
1462
1629
  });
1463
1630
  }
1464
- var M = e.sibling(h, 2);
1631
+ var j = e.sibling(p, 2);
1465
1632
  {
1466
- var o = (a) => {
1467
- var d = Ut(), D = e.first_child(d);
1468
- ht(D, {
1633
+ var i = (r) => {
1634
+ var d = sn(), S = e.first_child(d);
1635
+ Ss(S, {
1469
1636
  get viewerState() {
1470
- return s;
1637
+ return a;
1471
1638
  }
1472
1639
  });
1473
- var I = e.sibling(D, 2);
1474
- kt(I, {
1640
+ var w = e.sibling(S, 2);
1641
+ zs(w, {
1475
1642
  get canvases() {
1476
- return e.get(i);
1643
+ return e.get(l);
1477
1644
  }
1478
- }), e.append(a, d);
1645
+ }), e.append(r, d);
1479
1646
  };
1480
- e.if(M, (a) => {
1481
- e.get(i).length > 1 && a(o);
1647
+ e.if(j, (r) => {
1648
+ e.get(l).length > 1 && r(i);
1482
1649
  });
1483
1650
  }
1484
- var u = e.sibling(M, 2);
1485
- _t(u, {});
1486
- var b = e.sibling(u, 2);
1487
- Et(b, {});
1488
- var l = e.sibling(b, 2);
1489
- Yt(l, {});
1490
- var c = e.sibling(l, 2);
1491
- Mt(c, {}), e.reset(A), e.append(n, A), e.pop();
1651
+ var o = e.sibling(j, 2);
1652
+ ks(o, {});
1653
+ var h = e.sibling(o, 2);
1654
+ Os(h, {});
1655
+ var _ = e.sibling(h, 2);
1656
+ Js(_, {});
1657
+ var f = e.sibling(_, 2);
1658
+ Ps(f, {}), e.reset(m), e.append(s, m), e.pop();
1492
1659
  }
1493
1660
  export {
1494
- Ze as ManifestsState,
1495
- ms as TriiiceratopsViewer,
1496
- $ as VIEWER_STATE_KEY,
1497
- $e as ViewerState
1661
+ nt as ManifestsState,
1662
+ An as TriiiceratopsViewer,
1663
+ se as VIEWER_STATE_KEY,
1664
+ rt as ViewerState
1498
1665
  };