@manifest-editor/exhibition-preset 1.3.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs ADDED
@@ -0,0 +1,3445 @@
1
+ "use strict";
2
+ var __create = Object.create;
3
+ var __defProp = Object.defineProperty;
4
+ var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
5
+ var __getOwnPropNames = Object.getOwnPropertyNames;
6
+ var __getProtoOf = Object.getPrototypeOf;
7
+ var __hasOwnProp = Object.prototype.hasOwnProperty;
8
+ var __commonJS = (cb, mod) => function __require() {
9
+ return mod || (0, cb[__getOwnPropNames(cb)[0]])((mod = { exports: {} }).exports, mod), mod.exports;
10
+ };
11
+ var __export = (target, all) => {
12
+ for (var name in all)
13
+ __defProp(target, name, { get: all[name], enumerable: true });
14
+ };
15
+ var __copyProps = (to, from2, except, desc) => {
16
+ if (from2 && typeof from2 === "object" || typeof from2 === "function") {
17
+ for (let key of __getOwnPropNames(from2))
18
+ if (!__hasOwnProp.call(to, key) && key !== except)
19
+ __defProp(to, key, { get: () => from2[key], enumerable: !(desc = __getOwnPropDesc(from2, key)) || desc.enumerable });
20
+ }
21
+ return to;
22
+ };
23
+ var __toESM = (mod, isNodeMode, target) => (target = mod != null ? __create(__getProtoOf(mod)) : {}, __copyProps(
24
+ // If the importer is in node compatibility mode or this is not an ESM
25
+ // file that has been converted to a CommonJS file using a Babel-
26
+ // compatible transform (i.e. "__esModule" has not been set), then set
27
+ // "default" to the CommonJS "module.exports" for node compatibility.
28
+ isNodeMode || !mod || !mod.__esModule ? __defProp(target, "default", { value: mod, enumerable: true }) : target,
29
+ mod
30
+ ));
31
+ var __toCommonJS = (mod) => __copyProps(__defProp({}, "__esModule", { value: true }), mod);
32
+
33
+ // ../../node_modules/.pnpm/shallowequal@1.1.0/node_modules/shallowequal/index.js
34
+ var require_shallowequal = __commonJS({
35
+ "../../node_modules/.pnpm/shallowequal@1.1.0/node_modules/shallowequal/index.js"(exports, module2) {
36
+ "use strict";
37
+ module2.exports = function shallowEqual(objA, objB, compare, compareContext) {
38
+ var ret = compare ? compare.call(compareContext, objA, objB) : void 0;
39
+ if (ret !== void 0) {
40
+ return !!ret;
41
+ }
42
+ if (objA === objB) {
43
+ return true;
44
+ }
45
+ if (typeof objA !== "object" || !objA || typeof objB !== "object" || !objB) {
46
+ return false;
47
+ }
48
+ var keysA = Object.keys(objA);
49
+ var keysB = Object.keys(objB);
50
+ if (keysA.length !== keysB.length) {
51
+ return false;
52
+ }
53
+ var bHasOwnProperty = Object.prototype.hasOwnProperty.bind(objB);
54
+ for (var idx = 0; idx < keysA.length; idx++) {
55
+ var key = keysA[idx];
56
+ if (!bHasOwnProperty(key)) {
57
+ return false;
58
+ }
59
+ var valueA = objA[key];
60
+ var valueB = objB[key];
61
+ ret = compare ? compare.call(compareContext, valueA, valueB, key) : void 0;
62
+ if (ret === false || ret === void 0 && valueA !== valueB) {
63
+ return false;
64
+ }
65
+ }
66
+ return true;
67
+ };
68
+ }
69
+ });
70
+
71
+ // src/index.tsx
72
+ var src_exports = {};
73
+ __export(src_exports, {
74
+ exhibitionEditorPreset: () => exhibitionEditorPreset
75
+ });
76
+ module.exports = __toCommonJS(src_exports);
77
+ var ManifestPreset = __toESM(require("@manifest-editor/manifest-preset"), 1);
78
+ var import_shell19 = require("@manifest-editor/shell");
79
+
80
+ // src/annotations/TourStepAnnotations.tsx
81
+ var import_shell = require("@manifest-editor/shell");
82
+ var import_react_iiif_vault2 = require("react-iiif-vault");
83
+ var import_zustand = require("zustand");
84
+
85
+ // src/components/AtlasRenderBoxSelector.tsx
86
+ var import_jsx_runtime = (
87
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
88
+ require("react/jsx-runtime")
89
+ );
90
+ function AtlasRenderBoxSelector({
91
+ id,
92
+ target,
93
+ style,
94
+ onClick
95
+ }) {
96
+ const { x: x2, y: y2, width, height } = target.spatial;
97
+ return /* @__PURE__ */ (0, import_jsx_runtime.jsx)(
98
+ "box",
99
+ {
100
+ id,
101
+ relativeStyle: true,
102
+ relativeSize: false,
103
+ target: { x: x2, y: y2, width, height },
104
+ style: style || {
105
+ border: "2px solid rgba(255, 255, 255, 0.2)",
106
+ ":hover": {
107
+ backgroundColor: "rgba(255, 255, 255, 0.2)"
108
+ }
109
+ },
110
+ onClick
111
+ }
112
+ );
113
+ }
114
+
115
+ // src/components/AtlasRenderSVGSelector.tsx
116
+ var import_react_iiif_vault = require("react-iiif-vault");
117
+ var import_jsx_runtime2 = (
118
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
119
+ require("react/jsx-runtime")
120
+ );
121
+ function AtlasRenderSVGSelector({
122
+ id,
123
+ target,
124
+ style,
125
+ onClick
126
+ }) {
127
+ const canvas = (0, import_react_iiif_vault.useCanvas)();
128
+ if (!canvas)
129
+ return null;
130
+ return /* @__PURE__ */ (0, import_jsx_runtime2.jsx)(
131
+ "shape",
132
+ {
133
+ id,
134
+ points: target.points || [],
135
+ target: { x: 0, y: 0, width: canvas.width, height: canvas.height },
136
+ relativeStyle: true,
137
+ relativeSize: false,
138
+ style: style || {
139
+ border: "2px solid rgba(255, 255, 255, 0.2)",
140
+ ":hover": {
141
+ backgroundColor: "rgba(255, 255, 255, 0.2)"
142
+ }
143
+ },
144
+ onClick
145
+ }
146
+ );
147
+ }
148
+
149
+ // src/annotations/TourStepAnnotations.tsx
150
+ var import_jsx_runtime3 = require("react/jsx-runtime");
151
+ var tourStepAnnotations = {
152
+ id: "@exhibition/tour-step-annotations",
153
+ label: "Tour steps",
154
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(TourStepAnnotations, {})
155
+ };
156
+ function TourStepAnnotations() {
157
+ const canvas = (0, import_react_iiif_vault2.useCanvas)();
158
+ const store = (0, import_shell.useAtlasStore)();
159
+ const tool = (0, import_zustand.useStore)(store, (s2) => s2.tool);
160
+ const { rightPanel } = (0, import_shell.useLayoutState)();
161
+ const isRightPanel = rightPanel.current === "@manifest-editor/editor";
162
+ const isTour = isRightPanel && rightPanel.state?.currentTab?.startsWith("@exhibition/tour-steps");
163
+ const firstAnnotationPage = canvas?.annotations[0];
164
+ if (!isTour || !canvas || tool.enabled || !firstAnnotationPage) {
165
+ return null;
166
+ }
167
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault2.AnnotationPageContext, { annotationPage: firstAnnotationPage.id, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewAnnotationPage, {}) }) });
168
+ }
169
+ function ViewAnnotationPage() {
170
+ const page = (0, import_react_iiif_vault2.useAnnotationPage)();
171
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_jsx_runtime3.Fragment, { children: page?.items?.map((item) => {
172
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(import_react_iiif_vault2.AnnotationContext, { annotation: item.id, children: /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(ViewAnnotation, {}) }, item.id);
173
+ }) });
174
+ }
175
+ function ViewAnnotation() {
176
+ const annotation = (0, import_react_iiif_vault2.useAnnotation)();
177
+ const editor = (0, import_shell.useGenericEditor)(annotation);
178
+ const target = editor.annotation.target.getParsedSelector();
179
+ if (!target || !annotation)
180
+ return null;
181
+ if (target.type === "BoxSelector") {
182
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AtlasRenderBoxSelector, { id: annotation.id, target });
183
+ }
184
+ if (target.type === "SvgSelector") {
185
+ return /* @__PURE__ */ (0, import_jsx_runtime3.jsx)(AtlasRenderSVGSelector, { id: annotation.id, target });
186
+ }
187
+ return null;
188
+ }
189
+
190
+ // src/canvas-editors/image-block-editor.tsx
191
+ var import_components = require("@manifest-editor/components");
192
+ var import_editors = require("@manifest-editor/editors");
193
+
194
+ // ../../packages/ui/madoc/use-local-storage.ts
195
+ var import_react = require("react");
196
+
197
+ // ../../node_modules/.pnpm/mitt@3.0.1/node_modules/mitt/dist/mitt.mjs
198
+ function mitt_default(n) {
199
+ return { all: n = n || /* @__PURE__ */ new Map(), on: function(t, e) {
200
+ var i2 = n.get(t);
201
+ i2 ? i2.push(e) : n.set(t, [e]);
202
+ }, off: function(t, e) {
203
+ var i2 = n.get(t);
204
+ i2 && (e ? i2.splice(i2.indexOf(e) >>> 0, 1) : n.set(t, []));
205
+ }, emit: function(t, e) {
206
+ var i2 = n.get(t);
207
+ i2 && i2.slice().map(function(n2) {
208
+ n2(e);
209
+ }), (i2 = n.get("*")) && i2.slice().map(function(n2) {
210
+ n2(t, e);
211
+ });
212
+ } };
213
+ }
214
+
215
+ // ../../packages/ui/madoc/use-local-storage.ts
216
+ globalThis.MS_LS_EMITTER = globalThis.MS_LS_EMITTER || mitt_default();
217
+ var lsEmitter = globalThis.MS_LS_EMITTER;
218
+ function useLocalStorage(key, initialValue) {
219
+ const lastStoredValue = (0, import_react.useRef)();
220
+ if (!lastStoredValue.current && initialValue) {
221
+ lastStoredValue.current = JSON.stringify(initialValue);
222
+ }
223
+ const [storedValue, setStoredValue] = (0, import_react.useState)(() => {
224
+ try {
225
+ if (typeof window === "undefined" || typeof window.localStorage === "undefined") {
226
+ return initialValue;
227
+ }
228
+ const item = window.localStorage.getItem(key);
229
+ if (item) {
230
+ lastStoredValue.current = item;
231
+ }
232
+ return item ? JSON.parse(item) : initialValue;
233
+ } catch (error) {
234
+ console.log(error);
235
+ return initialValue;
236
+ }
237
+ });
238
+ const setValue = (value) => {
239
+ try {
240
+ if (typeof window !== "undefined" && typeof window.localStorage !== "undefined") {
241
+ let prev2 = initialValue;
242
+ try {
243
+ prev2 = typeof lastStoredValue.current === "undefined" ? initialValue : JSON.parse(lastStoredValue.current);
244
+ } catch (e) {
245
+ }
246
+ const valueToStore = value instanceof Function ? value(prev2) : value;
247
+ setStoredValue(valueToStore);
248
+ const valueJson = JSON.stringify(valueToStore);
249
+ window.localStorage.setItem(key, valueJson);
250
+ if (valueJson !== lastStoredValue.current) {
251
+ lastStoredValue.current = valueJson;
252
+ lsEmitter.emit(`change:${key}`, { valueJson });
253
+ }
254
+ }
255
+ } catch (error) {
256
+ console.log(error);
257
+ }
258
+ };
259
+ (0, import_react.useEffect)(() => {
260
+ const listener = ({ valueJson }) => {
261
+ if (valueJson && valueJson !== lastStoredValue.current) {
262
+ try {
263
+ setStoredValue(JSON.parse(valueJson));
264
+ lastStoredValue.current = valueJson;
265
+ } catch (e) {
266
+ }
267
+ }
268
+ };
269
+ lsEmitter.on(`change:${key}`, listener);
270
+ return () => {
271
+ lsEmitter.off(`change:${key}`, listener);
272
+ };
273
+ }, [key]);
274
+ return [storedValue, setValue, lastStoredValue];
275
+ }
276
+
277
+ // src/canvas-editors/image-block-editor.tsx
278
+ var import_react_iiif_vault3 = require("react-iiif-vault");
279
+ var import_tailwind_merge = require("tailwind-merge");
280
+
281
+ // src/helpers.ts
282
+ var heightMap = {
283
+ "h-1": "lg:min-h-[100px] row-span-1",
284
+ "h-2": "lg:min-h-[200px] row-span-2",
285
+ "h-3": "lg:min-h-[300px] row-span-3",
286
+ "h-4": "lg:min-h-[400px] row-span-4",
287
+ "h-5": "lg:min-h-[500px] row-span-5",
288
+ "h-6": "lg:min-h-[600px] row-span-6",
289
+ "h-7": "lg:min-h-[700px] row-span-7",
290
+ "h-8": "lg:min-h-[800px] row-span-8",
291
+ "h-9": "lg:min-h-[900px] row-span-9",
292
+ "h-10": "lg:min-h-[1000px] row-span-10",
293
+ "h-11": "lg:min-h-[1100px] row-span-11",
294
+ "h-12": "lg:min-h-[1200px] row-span-12"
295
+ };
296
+ var previewHeightMap = {
297
+ "h-1": "lg:min-h-[25px] row-span-1",
298
+ "h-2": "lg:min-h-[50px] row-span-2",
299
+ "h-3": "lg:min-h-[75px] row-span-3",
300
+ "h-4": "lg:min-h-[100px] row-span-4",
301
+ "h-5": "lg:min-h-[125px] row-span-5",
302
+ "h-6": "lg:min-h-[150px] row-span-6",
303
+ "h-7": "lg:min-h-[175px] row-span-7",
304
+ "h-8": "lg:min-h-[200px] row-span-8",
305
+ "h-9": "lg:min-h-[225px] row-span-9",
306
+ "h-10": "lg:min-h-[250px] row-span-10",
307
+ "h-11": "lg:min-h-[275px] row-span-11",
308
+ "h-12": "lg:min-h-[300px] row-span-12"
309
+ };
310
+ var widthMap = {
311
+ "w-1": "col-span-1",
312
+ "w-2": "col-span-2",
313
+ "w-3": "col-span-3",
314
+ "w-4": "col-span-4",
315
+ "w-5": "col-span-5",
316
+ "w-6": "col-span-6",
317
+ "w-7": "col-span-7",
318
+ "w-8": "col-span-8",
319
+ "w-9": "col-span-9",
320
+ "w-10": "col-span-10",
321
+ "w-11": "col-span-11",
322
+ "w-12": "col-span-12"
323
+ };
324
+ function getHeightWidthRatio(behavior) {
325
+ const { isLeft, isRight, isBottom } = getGridStats(behavior);
326
+ const h = behavior?.find((a2) => a2.includes("h-"));
327
+ const w2 = behavior?.find((a2) => a2.includes("w-"));
328
+ if (!h || !w2) {
329
+ return { h: 0, w: 0, ratio: 1 };
330
+ }
331
+ const ret = {
332
+ h: Number.parseInt(h.split("-")[1]),
333
+ w: Number.parseInt(w2.split("-")[1]),
334
+ ratio: 1
335
+ };
336
+ if (isLeft || isRight) {
337
+ ret.w *= 2 / 3;
338
+ }
339
+ if (isBottom) {
340
+ ret.h *= 2 / 3;
341
+ }
342
+ if (ret.h && ret.w) {
343
+ ret.ratio = ret.w / ret.h;
344
+ }
345
+ return ret;
346
+ }
347
+ function getClassName(b, firstInfo = false, preview = true) {
348
+ if (!b || b.length === 0) {
349
+ b = ["h-8", "w-8", "image"];
350
+ }
351
+ let h = b.find((a2) => a2.includes("h-"));
352
+ const w2 = b.find((a2) => a2.includes("w-"));
353
+ const classNames = [];
354
+ if (firstInfo && h === "h-4") {
355
+ h = "h-8";
356
+ }
357
+ classNames.push(preview ? previewHeightMap[h] : heightMap[h]);
358
+ classNames.push(widthMap[w2]);
359
+ return classNames.join(" ");
360
+ }
361
+ function getGridStats(behavior) {
362
+ const isRight = behavior?.includes("right");
363
+ const isLeft = behavior?.includes("left");
364
+ const isBottom = behavior?.includes("bottom");
365
+ const isTop = behavior?.includes("top");
366
+ const isInfo = behavior?.includes("info");
367
+ const isImage = behavior?.includes("image") || !isLeft && !isRight && !isBottom && !isTop;
368
+ return {
369
+ isRight,
370
+ isLeft,
371
+ isBottom,
372
+ isTop,
373
+ isInfo,
374
+ isImage
375
+ };
376
+ }
377
+ function isExhibitionItem(canvas) {
378
+ if (!canvas)
379
+ return false;
380
+ const behaviors = canvas.behavior || [];
381
+ if (behaviors.includes("image") || behaviors.includes("info")) {
382
+ return true;
383
+ }
384
+ for (const behavior of behaviors) {
385
+ if (behavior.startsWith("w-") || behavior.startsWith("h-")) {
386
+ return true;
387
+ }
388
+ }
389
+ return false;
390
+ }
391
+
392
+ // src/canvas-editors/image-block-editor.tsx
393
+ var import_jsx_runtime4 = require("react/jsx-runtime");
394
+ var imageBlockEditor = {
395
+ id: "image-block-editor",
396
+ label: "Image Block Editor",
397
+ component: (strategy) => /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ImageBlockEditor, { strategy }),
398
+ supports: {
399
+ strategy: (strategy, resource, vault) => {
400
+ if (strategy.type !== "images") {
401
+ return false;
402
+ }
403
+ const fullResource = vault.get(resource.resource);
404
+ if (fullResource.type !== "Canvas") {
405
+ return false;
406
+ }
407
+ const behaviors = fullResource.behavior || [];
408
+ let isImage = false;
409
+ for (const behaviour of behaviors) {
410
+ if (behaviour.startsWith("w-") || behaviour.startsWith("h-") || behaviour === "image") {
411
+ isImage = true;
412
+ }
413
+ }
414
+ return isImage;
415
+ }
416
+ }
417
+ };
418
+ function ImageBlockEditor({
419
+ strategy
420
+ }) {
421
+ const [isPreview, setIsPreview] = useLocalStorage("exhibition-preview-mode");
422
+ const canvas = (0, import_editors.useInStack)("Canvas");
423
+ if (!canvas) {
424
+ return null;
425
+ }
426
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(import_react_iiif_vault3.CanvasContext, { canvas: canvas.resource.source?.id, children: [
427
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)("div", { className: "flex gap-4 bg-me-500 py-2 px-4 text-white shadow-md z-40 ring-1 ring-me-500 items-center", children: [
428
+ "Switch view",
429
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_components.ActionButton, { onPress: () => setIsPreview(!isPreview), children: isPreview ? "Full canvas" : "Layout preview" })
430
+ ] }),
431
+ isPreview ? /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "grid grid-cols-12 grid-rows-12 h-full bg-white", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(ImageBlockRenderer, {}) }) : /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "h-full flex flex-1 min-h-0", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_editors.CanvasPanelEditor, { asFallback: true }) })
432
+ ] });
433
+ }
434
+ function ImageBlockRenderer() {
435
+ const canvas = (0, import_react_iiif_vault3.useCanvas)();
436
+ const behavior = canvas?.behavior || [];
437
+ const className = getClassName(behavior);
438
+ const { isBottom, isImage, isInfo, isLeft } = getGridStats(canvas?.behavior);
439
+ return /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
440
+ "div",
441
+ {
442
+ className: (0, import_tailwind_merge.twMerge)(
443
+ className,
444
+ "flex h-full max-h-full min-h-0",
445
+ isLeft ? "flex-row-reverse" : isBottom ? "flex-col" : "flex-row"
446
+ ),
447
+ children: [
448
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)("div", { className: "flex-1 h-full flex min-w-0", children: /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_editors.CanvasPanelEditor, { asFallback: true }) }),
449
+ !isImage ? /* @__PURE__ */ (0, import_jsx_runtime4.jsxs)(
450
+ "div",
451
+ {
452
+ className: `${isBottom ? "min-h-3 w-full" : "w-1/3"} flex-shrink-0 self-stretch text-white bg-black rounded p-8`,
453
+ children: [
454
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_iiif_vault3.LocaleString, { className: "block mb-4", children: canvas?.label }),
455
+ /* @__PURE__ */ (0, import_jsx_runtime4.jsx)(import_react_iiif_vault3.LocaleString, { children: canvas?.summary })
456
+ ]
457
+ }
458
+ ) : null
459
+ ]
460
+ }
461
+ );
462
+ }
463
+
464
+ // src/canvas-editors/info-block-editor.tsx
465
+ var import_components3 = require("@manifest-editor/components");
466
+ var import_shell3 = require("@manifest-editor/shell");
467
+ var import_react_iiif_vault4 = require("react-iiif-vault");
468
+
469
+ // src/components/AnnotationBodyEditor.tsx
470
+ var import_components2 = require("@manifest-editor/components");
471
+ var import_editors2 = require("@manifest-editor/editors");
472
+ var import_shell2 = require("@manifest-editor/shell");
473
+ var import_jsx_runtime5 = require("react/jsx-runtime");
474
+ function AnnotationBodyEditor({
475
+ className,
476
+ resourceId,
477
+ onRemove
478
+ }) {
479
+ const editor = (0, import_shell2.useGenericEditor)({
480
+ id: resourceId,
481
+ type: "ContentResource"
482
+ });
483
+ const { language, value } = editor.descriptive;
484
+ return /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className, children: [
485
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsxs)("div", { className: "flex gap-4 mb-4 items-center", children: [
486
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(import_editors2.Label, { children: "Language" }),
487
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "w-32", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
488
+ import_editors2.Input,
489
+ {
490
+ value: language.get() || "",
491
+ onChange: (newValue) => language.set(newValue.target.value)
492
+ }
493
+ ) }),
494
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
495
+ import_components2.ActionButton,
496
+ {
497
+ onPress: () => {
498
+ if (confirm("Do you want to remove this body?")) {
499
+ onRemove();
500
+ }
501
+ },
502
+ children: "Remove"
503
+ }
504
+ )
505
+ ] }),
506
+ /* @__PURE__ */ (0, import_jsx_runtime5.jsx)("div", { className: "prose-xl", children: /* @__PURE__ */ (0, import_jsx_runtime5.jsx)(
507
+ import_components2.HTMLEditor,
508
+ {
509
+ value: value.get() || "",
510
+ onChange: (newValue) => value.set(newValue)
511
+ }
512
+ ) })
513
+ ] });
514
+ }
515
+
516
+ // src/canvas-editors/info-block-editor.tsx
517
+ var import_jsx_runtime6 = require("react/jsx-runtime");
518
+ var infoBlockEditor = {
519
+ id: "info-block-editor",
520
+ label: "info Block Editor",
521
+ component: (strategy) => /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(InfoBlockEditor, { strategy }),
522
+ supports: {
523
+ strategy: (strategy, resource, vault) => {
524
+ if (strategy.type !== "textual-content") {
525
+ return false;
526
+ }
527
+ return true;
528
+ }
529
+ }
530
+ };
531
+ function InfoBlockEditor(props) {
532
+ const canvas = (0, import_react_iiif_vault4.useCanvas)();
533
+ const annotationPage = (0, import_react_iiif_vault4.useVaultSelector)(
534
+ (_2, vault) => (
535
+ // biome-ignore lint/style/noNonNullAssertion: Should always be present.
536
+ vault.get(canvas?.items[0])
537
+ )
538
+ );
539
+ const longSummaries = (0, import_react_iiif_vault4.useVaultSelector)(
540
+ (_2, vault) => canvas?.annotations[0] ? vault.get(canvas?.annotations[0]) : null
541
+ );
542
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { className: "overflow-y-auto bg-white shadow", children: [
543
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "mb-12", children: annotationPage.items.map((annotation, key) => {
544
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
545
+ import_react_iiif_vault4.AnnotationContext,
546
+ {
547
+ annotation: annotation.id,
548
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AnnotationEditor, {})
549
+ },
550
+ annotation.id + key
551
+ );
552
+ }) }),
553
+ longSummaries ? /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)(import_jsx_runtime6.Fragment, { children: [
554
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("h2", { className: "text-2xl font-bold px-4 border-t border-gray-200 pt-4 mb-4", children: "Long Summaries" }),
555
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("p", { className: "my-4 px-4", children: 'Long summaries are used to provide more detailed information about the canvas. They appear when the user clicks "read more" in the exhibition.' }),
556
+ longSummaries.items.map((annotation, key) => {
557
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
558
+ import_react_iiif_vault4.AnnotationContext,
559
+ {
560
+ annotation: annotation.id,
561
+ children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(AnnotationEditor, {})
562
+ },
563
+ annotation.id + key
564
+ );
565
+ })
566
+ ] }) : null
567
+ ] });
568
+ }
569
+ function AnnotationEditor() {
570
+ const annotation = (0, import_react_iiif_vault4.useAnnotation)();
571
+ const creator = (0, import_shell3.useInlineCreator)();
572
+ const bodies = annotation?.body || [];
573
+ const editor = (0, import_shell3.useGenericEditor)(annotation);
574
+ if (!annotation) {
575
+ return null;
576
+ }
577
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsxs)("div", { children: [
578
+ bodies.map((body, n) => {
579
+ return /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
580
+ AnnotationBodyEditor,
581
+ {
582
+ className: "p-4 hover:bg-me-100/40 focus-within:bg-me-100/40",
583
+ resourceId: body.id,
584
+ onRemove: () => editor.annotation.body.deleteAtIndex(n)
585
+ },
586
+ n
587
+ );
588
+ }),
589
+ /* @__PURE__ */ (0, import_jsx_runtime6.jsx)("div", { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime6.jsx)(
590
+ import_components3.ActionButton,
591
+ {
592
+ primary: true,
593
+ onPress: () => {
594
+ creator.create(
595
+ "@manifest-editor/html-body-creator",
596
+ { language: "en", value: "" },
597
+ {
598
+ targetType: "ContentResource",
599
+ parent: {
600
+ property: "body",
601
+ resource: {
602
+ id: annotation.id,
603
+ type: "Annotation"
604
+ }
605
+ },
606
+ initialData: {}
607
+ }
608
+ );
609
+ },
610
+ children: "Add new annotation"
611
+ }
612
+ ) })
613
+ ] });
614
+ }
615
+
616
+ // src/canvas-editors/youtube-editor.tsx
617
+ var import_components4 = require("@manifest-editor/components");
618
+ var import_shell4 = require("@manifest-editor/shell");
619
+ var import_react2 = require("react");
620
+ var import_react_iiif_vault5 = require("react-iiif-vault");
621
+ var import_tiny_invariant = __toESM(require("tiny-invariant"), 1);
622
+ var import_jsx_runtime7 = require("react/jsx-runtime");
623
+ var youtubeMainEdtior = {
624
+ id: "youtube-main-editor",
625
+ label: "YouTube main editor",
626
+ component: (strategy) => strategy.type === "media" ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
627
+ YouTubeEditor,
628
+ {
629
+ strategy,
630
+ video: strategy.media
631
+ }
632
+ ) : null,
633
+ supports: {
634
+ strategy: (strategy, resource, vault) => {
635
+ console.log(strategy);
636
+ if (strategy.type !== "media") {
637
+ return false;
638
+ }
639
+ if (strategy.media.type !== "VideoYouTube") {
640
+ return false;
641
+ }
642
+ return true;
643
+ }
644
+ }
645
+ };
646
+ function YouTubeEditor({
647
+ strategy,
648
+ video
649
+ }) {
650
+ const { edit } = (0, import_shell4.useLayoutActions)();
651
+ const canvas = (0, import_react_iiif_vault5.useCanvas)();
652
+ const annotationRef = (0, import_react_iiif_vault5.useVaultSelector)((_2, v2) => {
653
+ const page = v2.get(canvas?.items[0]);
654
+ return page.items[0];
655
+ });
656
+ (0, import_tiny_invariant.default)(canvas && annotationRef);
657
+ const player = (0, import_react2.useRef)(null);
658
+ const annotation = (0, import_shell4.useGenericEditor)(annotationRef);
659
+ const media = video;
660
+ const ar = (canvas.width || 1) / (canvas.height || 1);
661
+ const ytThumbnail = `https://img.youtube.com/vi/${media.youTubeId}/0.jpg`;
662
+ return /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "overflow-y-auto", children: [
663
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "p-8", children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
664
+ "div",
665
+ {
666
+ className: "bg-black z-20 flex p-8 rounded-lg max-w-full max-h-[70vh] mx-auto",
667
+ style: { aspectRatio: ar },
668
+ children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
669
+ "iframe",
670
+ {
671
+ title: "YouTube video",
672
+ className: "border-none w-full h-full object-contain",
673
+ ref: player,
674
+ src: `https://www.youtube.com/embed/${media.youTubeId}?enablejsapi=1&origin=${window.location.host}`,
675
+ referrerPolicy: "no-referrer",
676
+ sandbox: "allow-scripts allow-same-origin allow-presentation"
677
+ }
678
+ )
679
+ }
680
+ ) }),
681
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "bg-white shadow w-full p-8 flex gap-8", children: [
682
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
683
+ "div",
684
+ {
685
+ className: "w-64 bg-black flex-shrink-0 flex items-center justify-center rounded overflow-clip",
686
+ style: { aspectRatio: ar },
687
+ children: canvas.thumbnail?.length ? /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components4.LazyThumbnail, { cover: true }) : /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("div", { className: "text-white/50 text-center py-16", children: "No thumbnail" })
688
+ }
689
+ ) }),
690
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsxs)("div", { className: "flex-1", children: [
691
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
692
+ import_react_iiif_vault5.LocaleString,
693
+ {
694
+ as: "h3",
695
+ className: "text-2xl font-bold mt-4",
696
+ defaultText: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-black/30", children: "No Label" }),
697
+ children: annotation.descriptive.label.get()
698
+ }
699
+ ),
700
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(
701
+ import_react_iiif_vault5.LocaleString,
702
+ {
703
+ as: "p",
704
+ className: "mt-2 mb-8",
705
+ defaultText: /* @__PURE__ */ (0, import_jsx_runtime7.jsx)("span", { className: "text-black/30", children: "No summary" }),
706
+ children: annotation.descriptive.summary.get()
707
+ }
708
+ ),
709
+ /* @__PURE__ */ (0, import_jsx_runtime7.jsx)(import_components4.ActionButton, { onPress: () => edit(annotation.ref()), children: "Edit properties" })
710
+ ] })
711
+ ] })
712
+ ] });
713
+ }
714
+
715
+ // src/creators/image-slide-creator.tsx
716
+ var import_parser = require("@iiif/parser");
717
+ var import_jsx_runtime8 = require("react/jsx-runtime");
718
+ var imageSlideCreator = {
719
+ id: "@exhibitions/image-slide-creator",
720
+ create: createImageSlide,
721
+ label: "Image",
722
+ summary: "An image with text.",
723
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE" }),
724
+ tags: ["exhibition-slide"],
725
+ resourceType: "Canvas",
726
+ resourceFields: ["id", "type", "label", "height", "width", "items"],
727
+ supports: {
728
+ parentTypes: ["Manifest"],
729
+ parentFields: ["items"]
730
+ }
731
+ };
732
+ var imageSlideLeftCreator = {
733
+ ...imageSlideCreator,
734
+ id: "@exhibitions/image-slide-creator-left",
735
+ label: "Image (Left)",
736
+ summary: "An image with text on the left.",
737
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (LEFT)" }),
738
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "left" }, ctx)
739
+ };
740
+ var imageSlideRightCreator = {
741
+ ...imageSlideCreator,
742
+ id: "@exhibitions/image-slide-creator-right",
743
+ label: "Image (Right)",
744
+ summary: "An image with text on the right.",
745
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (RIGHT)" }),
746
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "right" }, ctx)
747
+ };
748
+ var imageSlideBottomCreator = {
749
+ ...imageSlideCreator,
750
+ id: "@exhibitions/image-slide-creator-bottom",
751
+ label: "Image (Bottom)",
752
+ summary: "An image with text at the bottom.",
753
+ icon: /* @__PURE__ */ (0, import_jsx_runtime8.jsx)("div", { children: "IMAGE (BOTTOM)" }),
754
+ create: (payload, ctx) => createImageSlide({ ...payload, type: "bottom" }, ctx)
755
+ };
756
+ function createImageSlide(payload, ctx) {
757
+ const canvasId = ctx.generateId("Canvas");
758
+ const itemsPageId = ctx.generateId("AnnotationPage", {
759
+ id: canvasId,
760
+ type: "Canvas"
761
+ });
762
+ const annotationsPageId = ctx.generateId("AnnotationPage", {
763
+ id: canvasId,
764
+ type: "Canvas"
765
+ });
766
+ const behavior = ["w-12", "h-4"];
767
+ let width = 6e3;
768
+ switch (payload.type) {
769
+ case "left":
770
+ behavior.push("left");
771
+ width *= 2 / 3;
772
+ break;
773
+ case "right":
774
+ behavior.push("right");
775
+ width *= 2 / 3;
776
+ break;
777
+ case "bottom":
778
+ behavior.push("bottom");
779
+ break;
780
+ }
781
+ return ctx.embed({
782
+ ...import_parser.emptyCanvas,
783
+ id: canvasId,
784
+ behavior,
785
+ label: payload.label || { en: ["Untitled"] },
786
+ height: payload.height || 2e3,
787
+ width: payload.width || width,
788
+ items: [
789
+ ctx.embed({
790
+ ...import_parser.emptyAnnotationPage,
791
+ id: itemsPageId,
792
+ type: "AnnotationPage",
793
+ items: []
794
+ })
795
+ ],
796
+ annotations: [
797
+ ctx.embed({
798
+ ...import_parser.emptyAnnotationPage,
799
+ id: annotationsPageId,
800
+ type: "AnnotationPage",
801
+ items: []
802
+ })
803
+ ]
804
+ });
805
+ }
806
+
807
+ // src/creators/info-box-creator.tsx
808
+ var import_parser2 = require("@iiif/parser");
809
+ var import_jsx_runtime9 = require("react/jsx-runtime");
810
+ var infoBoxCreator = {
811
+ id: "@exhibitions/info-box-creator",
812
+ create: createInfoBox,
813
+ label: "Info box",
814
+ summary: "A text panel for an exhibition",
815
+ icon: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
816
+ "svg",
817
+ {
818
+ xmlns: "http://www.w3.org/2000/svg",
819
+ width: "1em",
820
+ height: "1em",
821
+ viewBox: "0 0 24 24",
822
+ children: /* @__PURE__ */ (0, import_jsx_runtime9.jsx)(
823
+ "path",
824
+ {
825
+ fill: "currentColor",
826
+ d: "M11 17h2v-6h-2zm1-8q.425 0 .713-.288T13 8t-.288-.712T12 7t-.712.288T11 8t.288.713T12 9m0 13q-2.075 0-3.9-.788t-3.175-2.137T2.788 15.9T2 12t.788-3.9t2.137-3.175T8.1 2.788T12 2t3.9.788t3.175 2.137T21.213 8.1T22 12t-.788 3.9t-2.137 3.175t-3.175 2.138T12 22"
827
+ }
828
+ )
829
+ }
830
+ ),
831
+ tags: ["exhibition-slide"],
832
+ resourceType: "Canvas",
833
+ resourceFields: ["id", "type", "label", "height", "width", "items"],
834
+ supports: {
835
+ parentTypes: ["Manifest"],
836
+ parentFields: ["items"]
837
+ }
838
+ };
839
+ async function createInfoBox(data, ctx) {
840
+ const canvasId = ctx.generateId("canvas");
841
+ const pageId = ctx.generateId("annotation-page", {
842
+ id: canvasId,
843
+ type: "Canvas"
844
+ });
845
+ const annotationsId = ctx.generateId("annotation-page", {
846
+ id: canvasId,
847
+ type: "Canvas"
848
+ });
849
+ const annotation = {
850
+ ...import_parser2.emptyAnnotation,
851
+ id: ctx.generateId("annotation", { id: canvasId, type: "Canvas" }),
852
+ type: "Annotation"
853
+ };
854
+ const bodies = [
855
+ await ctx.create(
856
+ "@manifest-editor/html-body-creator",
857
+ {
858
+ language: "en",
859
+ body: ""
860
+ },
861
+ { parent: { resource: annotation, property: "body" } }
862
+ )
863
+ ];
864
+ const annotationResource = ctx.embed({
865
+ ...annotation,
866
+ motivation: "painting",
867
+ body: bodies,
868
+ target: {
869
+ type: "SpecificResource",
870
+ source: { id: canvasId, type: "Canvas" }
871
+ }
872
+ });
873
+ const annotationLongId = ctx.generateId("annotation", {
874
+ id: canvasId,
875
+ type: "Canvas"
876
+ });
877
+ const longDescriptionResource = ctx.embed({
878
+ id: annotationLongId,
879
+ type: "Annotation",
880
+ motivation: "describing",
881
+ body: [
882
+ await ctx.create(
883
+ "@manifest-editor/html-body-creator",
884
+ {
885
+ language: "en",
886
+ body: ""
887
+ },
888
+ {
889
+ parent: {
890
+ resource: { id: annotationLongId, type: "Annotation" },
891
+ property: "body"
892
+ }
893
+ }
894
+ )
895
+ ],
896
+ target: {
897
+ type: "SpecificResource",
898
+ source: { id: canvasId, type: "Canvas" }
899
+ }
900
+ });
901
+ const page = ctx.embed({
902
+ id: pageId,
903
+ type: "AnnotationPage",
904
+ items: [annotationResource]
905
+ });
906
+ const annotations = ctx.embed({
907
+ id: annotationsId,
908
+ type: "AnnotationPage",
909
+ items: [longDescriptionResource]
910
+ });
911
+ return ctx.embed({
912
+ ...import_parser2.emptyCanvas,
913
+ // bug with placeholder canvas.
914
+ id: canvasId,
915
+ type: "Canvas",
916
+ behavior: ["w-4", "h-4", "info"],
917
+ label: data.label || { en: ["Untitled info box"] },
918
+ height: data.height || 1e3,
919
+ width: data.width || 1e3,
920
+ items: [page],
921
+ annotations: [annotations]
922
+ });
923
+ }
924
+
925
+ // src/creators/youtube-slide-creator.tsx
926
+ var import_parser3 = require("@iiif/parser");
927
+ var import_creators = require("@manifest-editor/creators");
928
+ var import_editors3 = require("@manifest-editor/editors");
929
+ var youtubeSlideCreator = {
930
+ ...import_creators.youTubeBodyCreator,
931
+ id: "@exhibitions/youtube-creator",
932
+ create: createYoutube,
933
+ tags: ["video", "exhibition-slide"],
934
+ label: "YouTube",
935
+ summary: "A YouTube for an exhibition"
936
+ };
937
+ async function createYoutube(data, ctx) {
938
+ const ytId = (0, import_editors3.getYouTubeId)(data.youtubeUrl);
939
+ const canvasId = ctx.generateId("canvas");
940
+ const pageId = ctx.generateId("annotation-page", {
941
+ id: canvasId,
942
+ type: "Canvas"
943
+ });
944
+ const annotation = await ctx.create("@manifest-editor/youtube", data, {
945
+ target: {
946
+ id: canvasId,
947
+ type: "Canvas"
948
+ },
949
+ targetType: "Annotation",
950
+ parent: {
951
+ resource: { id: pageId, type: "AnnotationPage" },
952
+ property: "items"
953
+ }
954
+ });
955
+ const page = ctx.embed({
956
+ id: pageId,
957
+ type: "AnnotationPage",
958
+ items: [annotation]
959
+ });
960
+ const thumbnail = ctx.embed({
961
+ id: `https://img.youtube.com/vi/${ytId}/0.jpg`,
962
+ type: "Image",
963
+ format: "image/jpeg",
964
+ width: 480,
965
+ height: 360
966
+ });
967
+ return ctx.embed({
968
+ ...import_parser3.emptyCanvas,
969
+ // bug with placeholder canvas.
970
+ id: canvasId,
971
+ type: "Canvas",
972
+ behavior: ["w-12", "h-8"],
973
+ label: data.label || { en: ["Untitled YouTube Video"] },
974
+ height: data.height || 1080,
975
+ width: data.width || 1920,
976
+ thumbnail: [thumbnail],
977
+ items: [page]
978
+ });
979
+ }
980
+
981
+ // src/left-panels/ExhibitionGrid.tsx
982
+ var import_components6 = require("@manifest-editor/components");
983
+ var import_editors5 = require("@manifest-editor/editors");
984
+ var import_components7 = require("@manifest-editor/manifest-preset/components");
985
+ var import_shell8 = require("@manifest-editor/shell");
986
+
987
+ // src/components/ExhibitionGrid.tsx
988
+ var import_shell6 = require("@manifest-editor/shell");
989
+ var import_react_iiif_vault8 = require("react-iiif-vault");
990
+
991
+ // src/components/ExhibitionContainer.tsx
992
+ var import_shell5 = require("@manifest-editor/shell");
993
+ var import_react_aria_components = require("react-aria-components");
994
+ var import_react_iiif_vault6 = require("react-iiif-vault");
995
+ var import_jsx_runtime10 = require("react/jsx-runtime");
996
+ function ExhibitionContainer({
997
+ children
998
+ }) {
999
+ const manifest = (0, import_react_iiif_vault6.useManifest)();
1000
+ const { edit } = (0, import_shell5.useLayoutActions)();
1001
+ return /* @__PURE__ */ (0, import_jsx_runtime10.jsxs)("div", { className: "grid auto-rows-auto grid-cols-12 content-center justify-center gap-2 p-2", children: [
1002
+ /* @__PURE__ */ (0, import_jsx_runtime10.jsx)("div", { className: "col-span-4 row-span-4 text-black min-h-[100px] flex items-center justify-center", children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(
1003
+ import_react_aria_components.Button,
1004
+ {
1005
+ onPress: () => manifest && edit(manifest),
1006
+ className: "col-span-4 row-span-4 text-xs text-black bg-[rgb(250,204,21)] min-h-[100px] w-full flex items-center justify-center",
1007
+ children: /* @__PURE__ */ (0, import_jsx_runtime10.jsx)(import_react_iiif_vault6.LocaleString, { children: manifest?.label })
1008
+ }
1009
+ ) }),
1010
+ children
1011
+ ] });
1012
+ }
1013
+
1014
+ // src/components/ExhibitionItem.tsx
1015
+ var import_components5 = require("@manifest-editor/components");
1016
+ var import_editors4 = require("@manifest-editor/editors");
1017
+ var import_react3 = require("react");
1018
+ var import_react_iiif_vault7 = require("react-iiif-vault");
1019
+ var import_tailwind_merge2 = require("tailwind-merge");
1020
+ var import_jsx_runtime11 = require("react/jsx-runtime");
1021
+ var ExhibitionItem = (0, import_react3.forwardRef)(
1022
+ function ExhibitionItem2({ isFirst, item, children: divChildren, ...props }, ref) {
1023
+ const canvas = (0, import_react_iiif_vault7.useCanvas)();
1024
+ const [strategy] = (0, import_react_iiif_vault7.useRenderingStrategy)();
1025
+ const behavior = canvas?.behavior || [];
1026
+ const currentCanvas = (0, import_editors4.useInStack)("Canvas");
1027
+ const className = getClassName(canvas?.behavior, isFirst);
1028
+ const { isBottom, isImage, isInfo, isLeft } = getGridStats(
1029
+ canvas?.behavior
1030
+ );
1031
+ const isSelected = currentCanvas?.resource.source?.id === canvas?.id;
1032
+ let children = null;
1033
+ if (isInfo) {
1034
+ children = /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "bg-black w-full h-full text-white max-h-40", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "p-1.5 text-[4px]", children: strategy.type === "textual-content" ? /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_iiif_vault7.LocaleString, { enableDangerouslySetInnerHTML: true, children: strategy.items[0]?.text }) : null }) });
1035
+ } else {
1036
+ children = /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1037
+ "div",
1038
+ {
1039
+ className: (0, import_tailwind_merge2.twMerge)(
1040
+ "flex h-full max-h-full min-h-0",
1041
+ isLeft ? "flex-row-reverse" : isBottom ? "flex-col" : "flex-row"
1042
+ ),
1043
+ children: [
1044
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "flex-1 overflow-hidden relative justify-self-stretch", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)("div", { className: "absolute inset-0 w-full h-full", children: /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_components5.LazyThumbnail, { cover: true, fade: false }) }) }),
1045
+ isImage ? null : /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(
1046
+ "div",
1047
+ {
1048
+ className: `${isBottom ? "min-h-3 w-full" : "w-1/3"} flex-shrink-0 self-stretch p-2 text-white bg-black rounded`,
1049
+ children: /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)("div", { className: "p-1.5 text-[4px]", children: [
1050
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_iiif_vault7.LocaleString, { className: "block mb-1 text-[5px]", children: canvas?.label }),
1051
+ /* @__PURE__ */ (0, import_jsx_runtime11.jsx)(import_react_iiif_vault7.LocaleString, { children: canvas?.summary })
1052
+ ] })
1053
+ }
1054
+ )
1055
+ ]
1056
+ }
1057
+ );
1058
+ }
1059
+ return /* @__PURE__ */ (0, import_jsx_runtime11.jsxs)(
1060
+ "div",
1061
+ {
1062
+ ref,
1063
+ className: (0, import_tailwind_merge2.twMerge)(
1064
+ className,
1065
+ "bg-me-gray-700 overflow-hidden hover:ring-2 ring-me-primary-500 relative",
1066
+ isSelected ? "ring-2 ring-me-primary-500" : ""
1067
+ ),
1068
+ ...props,
1069
+ children: [
1070
+ children,
1071
+ divChildren
1072
+ ]
1073
+ }
1074
+ );
1075
+ }
1076
+ );
1077
+
1078
+ // src/components/ExhibitionGrid.tsx
1079
+ var import_jsx_runtime12 = require("react/jsx-runtime");
1080
+ function ExhibitionGrid() {
1081
+ const { open } = (0, import_shell6.useLayoutActions)();
1082
+ const { structural, technical } = (0, import_shell6.useManifestEditor)();
1083
+ const [, canvasActions] = (0, import_shell6.useCreator)(
1084
+ { id: technical.id.get(), type: "Manifest" },
1085
+ "items",
1086
+ "Manifest"
1087
+ );
1088
+ const items = structural.items.get();
1089
+ return /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(ExhibitionContainer, { children: items.map((item, index) => /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(import_react_iiif_vault8.CanvasContext, { canvas: item.id, children: /* @__PURE__ */ (0, import_jsx_runtime12.jsx)(
1090
+ ExhibitionItem,
1091
+ {
1092
+ isFirst: index === 0,
1093
+ item,
1094
+ onClick: () => {
1095
+ open({ id: "current-canvas" });
1096
+ canvasActions.edit(item, index);
1097
+ }
1098
+ }
1099
+ ) }, index)) });
1100
+ }
1101
+
1102
+ // src/components/SortableExhibitionGrid.tsx
1103
+ var import_core = require("@dnd-kit/core");
1104
+ var import_modifiers = require("@dnd-kit/modifiers");
1105
+ var import_sortable2 = require("@dnd-kit/sortable");
1106
+ var import_shell7 = require("@manifest-editor/shell");
1107
+ var import_react4 = require("react");
1108
+ var import_react_iiif_vault9 = require("react-iiif-vault");
1109
+
1110
+ // src/components/SortableExhibitionItem.tsx
1111
+ var import_sortable = require("@dnd-kit/sortable");
1112
+ var import_utilities = require("@dnd-kit/utilities");
1113
+
1114
+ // src/icons/ResizeHandleIcon.tsx
1115
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1116
+ function ResizeHandleIcon(props) {
1117
+ return /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)(
1118
+ "svg",
1119
+ {
1120
+ xmlns: "http://www.w3.org/2000/svg",
1121
+ viewBox: "0 0 24 24",
1122
+ height: "1em",
1123
+ width: "1em",
1124
+ ...props,
1125
+ children: [
1126
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("title", { children: "Rearrange" }),
1127
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { fill: "none", d: "M0 0h24v24H0z" }),
1128
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M20 9H4v2h16V9zM4 15h16v-2H4v2z" })
1129
+ ]
1130
+ }
1131
+ );
1132
+ }
1133
+
1134
+ // src/components/SortableExhibitionItem.tsx
1135
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1136
+ function SortableExhibitionItem({
1137
+ isFirst,
1138
+ onClick,
1139
+ item
1140
+ }) {
1141
+ const { attributes, listeners, setNodeRef, transform, transition } = (0, import_sortable.useSortable)({
1142
+ id: item.id,
1143
+ transition: {
1144
+ duration: 150,
1145
+ easing: "cubic-bezier(0.25, 1, 0.5, 1)"
1146
+ }
1147
+ });
1148
+ const style = {
1149
+ transform: import_utilities.CSS.Translate.toString(transform),
1150
+ transition
1151
+ };
1152
+ return /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1153
+ ExhibitionItem,
1154
+ {
1155
+ ref: setNodeRef,
1156
+ style,
1157
+ ...attributes,
1158
+ ...listeners,
1159
+ onClick,
1160
+ isFirst,
1161
+ item,
1162
+ children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("div", { className: "absolute bg-white text-2xl p-1 top-0.5 right-0.5", children: /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(ResizeHandleIcon, {}) })
1163
+ }
1164
+ );
1165
+ }
1166
+
1167
+ // src/components/SortableExhibitionGrid.tsx
1168
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1169
+ function SortableExhibitionGrid() {
1170
+ const { structural, technical } = (0, import_shell7.useManifestEditor)();
1171
+ const items = structural.items.get();
1172
+ const { open } = (0, import_shell7.useLayoutActions)();
1173
+ const sensors = (0, import_core.useSensors)(
1174
+ (0, import_core.useSensor)(import_core.PointerSensor, {
1175
+ activationConstraint: {
1176
+ distance: 5
1177
+ }
1178
+ }),
1179
+ (0, import_core.useSensor)(import_core.KeyboardSensor, {
1180
+ coordinateGetter: import_sortable2.sortableKeyboardCoordinates
1181
+ })
1182
+ );
1183
+ const [, canvasActions] = (0, import_shell7.useCreator)(
1184
+ { id: technical.id.get(), type: "Manifest" },
1185
+ "items",
1186
+ "Manifest"
1187
+ );
1188
+ const onDragEnd = (0, import_react4.useCallback)(
1189
+ (result) => {
1190
+ const { active, over } = result;
1191
+ if (over && active.id !== over.id) {
1192
+ structural.items.reorder(
1193
+ items.findIndex((item) => item.id === active.id),
1194
+ items.findIndex((item) => item.id === over.id)
1195
+ );
1196
+ }
1197
+ },
1198
+ [items, structural.items]
1199
+ );
1200
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(ExhibitionContainer, { children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1201
+ import_core.DndContext,
1202
+ {
1203
+ sensors,
1204
+ collisionDetection: import_core.closestCenter,
1205
+ onDragEnd,
1206
+ modifiers: [import_modifiers.restrictToParentElement],
1207
+ children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_sortable2.SortableContext, { items, strategy: import_sortable2.rectSortingStrategy, children: items.map((item, idx) => {
1208
+ if (!item)
1209
+ return null;
1210
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_react_iiif_vault9.CanvasContext, { canvas: item.id, children: /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(
1211
+ SortableExhibitionItem,
1212
+ {
1213
+ item,
1214
+ isFirst: idx === 0,
1215
+ onClick: () => {
1216
+ open({ id: "current-canvas" });
1217
+ canvasActions.edit(item, idx);
1218
+ }
1219
+ },
1220
+ item.id
1221
+ ) }, item.id);
1222
+ }) })
1223
+ }
1224
+ ) });
1225
+ }
1226
+
1227
+ // src/left-panels/ExhibitionGrid.tsx
1228
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1229
+ var exhibitionGridLeftPanel = {
1230
+ id: "canvas-listing",
1231
+ // We are overriding the default canvas listing panel
1232
+ label: "Exhibition grid",
1233
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGridIcon, {}),
1234
+ render: () => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGridLeftPanel, {}),
1235
+ options: {
1236
+ minWidth: 350,
1237
+ maxWidth: 350
1238
+ }
1239
+ };
1240
+ function ExhibitionGridLeftPanel() {
1241
+ const { technical } = (0, import_shell8.useManifestEditor)();
1242
+ const manifestId = technical.id.get();
1243
+ const manifest = { id: manifestId, type: "Manifest" };
1244
+ const [canCreateCanvas, canvasActions] = (0, import_shell8.useCreator)(manifest, "items", "Canvas");
1245
+ const [toggled, toggle] = (0, import_editors5.useToggleList)();
1246
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(import_components6.Sidebar, { children: [
1247
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
1248
+ import_components6.SidebarHeader,
1249
+ {
1250
+ title: "Exhibition",
1251
+ actions: [
1252
+ {
1253
+ icon: toggled.list ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components7.CanvasListingIcon, { className: "text-2xl" }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGridIcon, {}),
1254
+ title: toggled.list ? "List view" : "Grid view",
1255
+ onClick: () => toggle("list")
1256
+ },
1257
+ {
1258
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ListEditIcon, {}),
1259
+ title: "Edit slides",
1260
+ toggled: toggled.editing,
1261
+ onClick: () => toggle("editing")
1262
+ },
1263
+ {
1264
+ icon: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(NewSlideIcon, {}),
1265
+ title: "Add new slide",
1266
+ disabled: !canCreateCanvas,
1267
+ onClick: () => canvasActions.createFiltered("exhibition-slide")
1268
+ }
1269
+ ]
1270
+ }
1271
+ ),
1272
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components6.SidebarContent, { children: toggled.list ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components7.CanvasListView, { isEditing: toggled.editing }) : toggled.editing ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(SortableExhibitionGrid, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ExhibitionGrid, {}) })
1273
+ ] });
1274
+ }
1275
+ function ExhibitionGridIcon() {
1276
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", viewBox: "0 -960 960 960", children: [
1277
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("title", { children: "Exhibition grid" }),
1278
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M600-160v-280h280v280H600ZM440-520v-280h440v280H440ZM80-160v-280h440v280H80Zm0-360v-280h280v280H80Zm440-80h280v-120H520v120ZM160-240h280v-120H160v120Zm520 0h120v-120H680v120ZM160-600h120v-120H160v120Zm360 0Zm-80 240Zm240 0ZM280-600Z" })
1279
+ ] });
1280
+ }
1281
+ function ListEditIcon() {
1282
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", children: [
1283
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("title", { children: "Edit slides" }),
1284
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M0 0h24v24H0V0z", fill: "none" }),
1285
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M14.06 9.02l.92.92L5.92 19H5v-.92l9.06-9.06M17.66 3c-.25 0-.51.1-.7.29l-1.83 1.83 3.75 3.75 1.83-1.83c.39-.39.39-1.02 0-1.41l-2.34-2.34c-.2-.2-.45-.29-.71-.29zm-3.6 3.19L3 17.25V21h3.75L17.81 9.94l-3.75-3.75z" })
1286
+ ] });
1287
+ }
1288
+ function NewSlideIcon() {
1289
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", width: "24", height: "24", fill: "currentColor", viewBox: "0 -960 960 960", children: [
1290
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("title", { children: "Add new slide" }),
1291
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)("path", { d: "M160-240v-480 480Zm80-80v-200h360v200H240Zm-80 160q-33 0-56.5-23.5T80-240v-480q0-33 23.5-56.5T160-800h640q33 0 56.5 23.5T880-720v240h-80v-240H160v480h360v80H160Zm500-320v-100H360v-60h360v160h-60Zm60 400v-120H600v-80h120v-120h80v120h120v80H800v120h-80Z" })
1292
+ ] });
1293
+ }
1294
+
1295
+ // src/right-panels/SlideBehaviours.tsx
1296
+ var import_components8 = require("@manifest-editor/components");
1297
+ var import_editors6 = require("@manifest-editor/editors");
1298
+ var import_shell9 = require("@manifest-editor/shell");
1299
+ var import_react5 = require("react");
1300
+
1301
+ // src/components/AspectRatioWarning.tsx
1302
+ var import_react_iiif_vault10 = require("react-iiif-vault");
1303
+ var import_tiny_invariant2 = __toESM(require("tiny-invariant"), 1);
1304
+ var import_jsx_runtime17 = require("react/jsx-runtime");
1305
+ function AspectRatioWarning() {
1306
+ const canvas = (0, import_react_iiif_vault10.useCanvas)();
1307
+ (0, import_tiny_invariant2.default)(canvas);
1308
+ const ratio = canvas.width && canvas.height ? canvas.width / canvas.height : 0;
1309
+ const target = getHeightWidthRatio(canvas.behavior || []);
1310
+ if (Math.abs(ratio - target.ratio) < 0.01)
1311
+ return null;
1312
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "p-2 rounded bg-me-100", children: [
1313
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "text-me-700-500", children: "Aspect ratio warning" }),
1314
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)("div", { className: "text-sm text-black/60", children: [
1315
+ "The aspect ratio of this canvas is ",
1316
+ ratio.toFixed(2),
1317
+ " but the target aspect ratio is ",
1318
+ target.ratio.toFixed(2),
1319
+ ". Some parts of this image may be cropped.",
1320
+ /* @__PURE__ */ (0, import_jsx_runtime17.jsx)("div", { className: "relative h-32 w-full mt-2", children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1321
+ "div",
1322
+ {
1323
+ className: "bg-[red] left-0 top-0 z-2 opacity-50 max-w-32 max-h-32",
1324
+ style: { aspectRatio: ratio.toFixed(2) },
1325
+ children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
1326
+ "div",
1327
+ {
1328
+ className: "asbolute bg-[white] left-0 top-0 z-1 opacity-50 max-w-32 max-h-32",
1329
+ style: { aspectRatio: target.ratio }
1330
+ }
1331
+ )
1332
+ }
1333
+ ) })
1334
+ ] })
1335
+ ] });
1336
+ }
1337
+
1338
+ // src/right-panels/SlideBehaviours.tsx
1339
+ var import_jsx_runtime18 = require("react/jsx-runtime");
1340
+ var customBehaviourEditor = {
1341
+ component: () => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(SlideBehavioursPanel, {}),
1342
+ supports: {
1343
+ edit: true,
1344
+ resourceTypes: ["Canvas"],
1345
+ properties: ["behavior"]
1346
+ },
1347
+ id: "slide-behaviors",
1348
+ label: "Layout",
1349
+ tabs: {
1350
+ showTitle: true
1351
+ }
1352
+ };
1353
+ var exhibitionConfigs = [
1354
+ {
1355
+ id: "layout",
1356
+ type: "choice",
1357
+ label: { en: ["Layout"] },
1358
+ initialOpen: true,
1359
+ items: [
1360
+ {
1361
+ label: { en: ["Text on left"] },
1362
+ value: "left"
1363
+ },
1364
+ {
1365
+ label: { en: ["Text on right"] },
1366
+ value: "right"
1367
+ },
1368
+ {
1369
+ label: { en: ["Text on bottom"] },
1370
+ value: "bottom"
1371
+ },
1372
+ {
1373
+ label: { en: ["Only image"] },
1374
+ value: "image"
1375
+ }
1376
+ ]
1377
+ },
1378
+ {
1379
+ id: "size",
1380
+ component: (existing, setBehaviors) => /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(EditSize, { behaviors: existing, setBehaviors }),
1381
+ label: { en: ["Size"] },
1382
+ type: "custom",
1383
+ initialOpen: true,
1384
+ supports: (b) => b.startsWith("w-") || b.startsWith("h-")
1385
+ }
1386
+ ];
1387
+ function parseBehaviors(items) {
1388
+ let width = 0;
1389
+ let height = 0;
1390
+ for (const item of items) {
1391
+ if (item.startsWith("w-")) {
1392
+ width = Number.parseInt(item.slice(2));
1393
+ }
1394
+ if (item.startsWith("h-")) {
1395
+ height = Number.parseInt(item.slice(2));
1396
+ }
1397
+ }
1398
+ return {
1399
+ width,
1400
+ height
1401
+ };
1402
+ }
1403
+ function EditSize({ behaviors, setBehaviors }) {
1404
+ const { width, height } = parseBehaviors(behaviors);
1405
+ const [hoverPosition, setHoverPosition] = (0, import_react5.useState)({ x: -1, y: -1 });
1406
+ const setBehavior = (w2, h) => {
1407
+ const newBehaviors = behaviors.filter((b) => {
1408
+ return !b.startsWith("w-") && !b.startsWith("h-");
1409
+ });
1410
+ newBehaviors.push(`w-${w2}`);
1411
+ newBehaviors.push(`h-${h}`);
1412
+ setBehaviors(newBehaviors);
1413
+ };
1414
+ const cells = Array.from({ length: 144 }, (_2, i2) => {
1415
+ const x2 = i2 % 12;
1416
+ const y2 = Math.floor(i2 / 12);
1417
+ const hovered = hoverPosition.x >= x2 && hoverPosition.y >= y2;
1418
+ const selected = x2 < width && y2 < height;
1419
+ const hoveredAndSelected = hovered && selected;
1420
+ let bgClass = "bg-gray-200";
1421
+ if (hovered) {
1422
+ bgClass = "bg-me-200";
1423
+ }
1424
+ if (selected) {
1425
+ bgClass = "bg-me-500";
1426
+ }
1427
+ if (hoveredAndSelected) {
1428
+ bgClass = "bg-me-400";
1429
+ }
1430
+ return (
1431
+ // biome-ignore lint/a11y/useKeyWithClickEvents: <explanation>
1432
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1433
+ "div",
1434
+ {
1435
+ className: `flex aspect-square rounded cursor-se-resize items-center justify-center ${bgClass}`,
1436
+ onClick: () => setBehavior(x2 + 1, y2 + 1),
1437
+ onMouseUp: () => setBehavior(x2 + 1, y2 + 1),
1438
+ onMouseEnter: () => setHoverPosition({ x: x2, y: y2 })
1439
+ },
1440
+ i2
1441
+ )
1442
+ );
1443
+ });
1444
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "grid grid-cols-12 grid-rows-12 gap-1", onMouseLeave: () => setHoverPosition({ x: -1, y: -1 }), children: cells });
1445
+ }
1446
+ function SlideBehavioursPanel() {
1447
+ const canvas = (0, import_editors6.useInStack)("Canvas");
1448
+ const editor = (0, import_shell9.useEditor)();
1449
+ const { width, height } = editor.technical;
1450
+ if (!canvas || editor.technical.type !== "Canvas") {
1451
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components8.Sidebar, { children: [
1452
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components8.SidebarHeader, { title: "Slide behaviors" }),
1453
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: "Please select canvas" })
1454
+ ] });
1455
+ }
1456
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components8.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_components8.SidebarContent, { children: [
1457
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "px-2", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_editors6.InputContainer, { $wide: true, children: [
1458
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1459
+ import_editors6.DimensionsTriplet,
1460
+ {
1461
+ widthId: width.containerId(),
1462
+ width: width.get() || 0,
1463
+ changeWidth: (v2) => width.set(v2),
1464
+ heightId: height.containerId(),
1465
+ height: height.get() || 0,
1466
+ changeHeight: (v2) => height.set(v2)
1467
+ }
1468
+ ),
1469
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(AspectRatioWarning, {}) })
1470
+ ] }) }),
1471
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
1472
+ import_editors6.BehaviorEditor,
1473
+ {
1474
+ behavior: editor.technical.behavior.get() || [],
1475
+ onChange: (v2) => {
1476
+ editor.technical.behavior.set(v2);
1477
+ },
1478
+ configs: exhibitionConfigs
1479
+ }
1480
+ )
1481
+ ] }) });
1482
+ }
1483
+
1484
+ // src/right-panels/ExhibitionCanvasEditor.tsx
1485
+ var import_components10 = require("@manifest-editor/components");
1486
+ var import_editors7 = require("@manifest-editor/editors");
1487
+ var import_shell11 = require("@manifest-editor/shell");
1488
+ var import_react_iiif_vault11 = require("react-iiif-vault");
1489
+
1490
+ // src/components/ExhibitionItemConversion.tsx
1491
+ var import_helpers4 = require("@iiif/helpers");
1492
+ var import_components9 = require("@manifest-editor/components");
1493
+ var import_shell10 = require("@manifest-editor/shell");
1494
+ var import_jsx_runtime19 = require("react/jsx-runtime");
1495
+ function ExhibitionItemConversion() {
1496
+ const editor = (0, import_shell10.useEditor)();
1497
+ const applyDefaultSettings = () => {
1498
+ const canvasWidth = editor.technical.width.get();
1499
+ const canvasHeight = editor.technical.height.get();
1500
+ const summary = editor.descriptive.summary;
1501
+ const behaviors = editor.technical.behavior;
1502
+ const behaviorsToAdd = behaviors.get();
1503
+ behaviorsToAdd.push("w-12");
1504
+ const height = Math.max(1, Math.min(12, Math.round(canvasWidth / canvasHeight * 12)));
1505
+ behaviorsToAdd.push(`h-${height}`);
1506
+ if (!(0, import_helpers4.getValue)(summary.get())) {
1507
+ summary.set({ en: ["Summary of image"] });
1508
+ }
1509
+ editor.technical.behavior.set(behaviorsToAdd);
1510
+ };
1511
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { className: "flex flex-col items-center gap-4 border-me-100 border-2 p-4 rounded", children: [
1512
+ "This canvas was not created in the exhibition editor. Do you want to apply default settings?",
1513
+ /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_components9.ActionButton, { onPress: () => applyDefaultSettings(), children: "Apply defaults" })
1514
+ ] });
1515
+ }
1516
+
1517
+ // src/right-panels/ExhibitionCanvasEditor.tsx
1518
+ var import_jsx_runtime20 = require("react/jsx-runtime");
1519
+ var exhibitionCanvasEditor = {
1520
+ id: "@exhibition/right-panel-editor",
1521
+ supports: {
1522
+ edit: true,
1523
+ properties: ["label", "summary"],
1524
+ resourceTypes: ["Canvas"],
1525
+ custom: ({ resource }, vault) => {
1526
+ const full = vault.get(resource);
1527
+ const stats = getGridStats(full.behavior);
1528
+ if (full.type === "Canvas" && !stats.isInfo) {
1529
+ return true;
1530
+ }
1531
+ return false;
1532
+ }
1533
+ },
1534
+ label: "Exhibition",
1535
+ component: () => /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ExhibitionRightPanel, {})
1536
+ };
1537
+ function ExhibitionRightPanel() {
1538
+ const canvas = (0, import_react_iiif_vault11.useCanvas)();
1539
+ const resource = (0, import_shell11.useEditingResource)();
1540
+ const { structural, technical, descriptive } = (0, import_shell11.useEditor)();
1541
+ const { items } = structural;
1542
+ const { thumbnail } = descriptive;
1543
+ const { width, height } = technical;
1544
+ const pages = items.get();
1545
+ const page = pages[0];
1546
+ const isAnExhibitionCanvas = isExhibitionItem(canvas);
1547
+ if (!canvas || !page || !resource)
1548
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)("div", { className: "p-8", children: "Canvas, page, or resource not found" });
1549
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components10.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_components10.SidebarContent, { padding: true, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsxs)(import_shell11.ResourceEditingProvider, { resource: canvas, children: [
1550
+ !isAnExhibitionCanvas ? /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(ExhibitionItemConversion, {}) : null,
1551
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_editors7.LanguageMapEditor, { dispatchType: "label", disableMultiline: true, disallowHTML: true }),
1552
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(
1553
+ import_editors7.LinkingPropertyList,
1554
+ {
1555
+ containerId: thumbnail.containerId(),
1556
+ label: "Thumbnail",
1557
+ property: "thumbnail",
1558
+ items: thumbnail.get(),
1559
+ singleMode: true,
1560
+ reorder: (ctx) => thumbnail.reorder(ctx.startIndex, ctx.endIndex),
1561
+ createActions: (0, import_editors7.createAppActions)(thumbnail),
1562
+ creationType: "ContentResource",
1563
+ emptyLabel: "No thumbnail",
1564
+ parent: resource?.resource
1565
+ }
1566
+ ),
1567
+ /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_react_iiif_vault11.AnnotationPageContext, { annotationPage: page.id, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(import_editors7.PaintingAnnotationList, { createFilter: "image" }) })
1568
+ ] }) }) });
1569
+ }
1570
+
1571
+ // src/right-panels/ExhibitionSummaryEditor.tsx
1572
+ var import_components11 = require("@manifest-editor/components");
1573
+ var import_editors8 = require("@manifest-editor/editors");
1574
+ var import_shell12 = require("@manifest-editor/shell");
1575
+ var import_react_iiif_vault12 = require("react-iiif-vault");
1576
+ var import_jsx_runtime21 = require("react/jsx-runtime");
1577
+ var exhibitionSummaryEdtior = {
1578
+ id: "@exhibition/summary-editor",
1579
+ supports: {
1580
+ edit: true,
1581
+ properties: ["summary"],
1582
+ resourceTypes: ["Canvas"],
1583
+ custom: ({ resource }, vault) => {
1584
+ const full = vault.get(resource);
1585
+ const stats = getGridStats(full.behavior);
1586
+ if (full.type === "Canvas" && !stats.isInfo && !stats.isBottom) {
1587
+ return true;
1588
+ }
1589
+ return false;
1590
+ }
1591
+ },
1592
+ label: "Summary",
1593
+ component: () => /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ExhibitionRightPanel2, {})
1594
+ };
1595
+ function ExhibitionRightPanel2() {
1596
+ const canvas = (0, import_react_iiif_vault12.useCanvas)();
1597
+ if (!canvas)
1598
+ return null;
1599
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components11.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_components11.SidebarContent, { padding: true, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsxs)(import_shell12.ResourceEditingProvider, { resource: canvas, children: [
1600
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_editors8.LanguageMapEditor, { dispatchType: "label" }),
1601
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_editors8.LanguageMapEditor, { dispatchType: "summary" })
1602
+ ] }) }) });
1603
+ }
1604
+
1605
+ // src/right-panels/ExhibitionTourSteps.tsx
1606
+ var import_components17 = require("@manifest-editor/components");
1607
+ var import_editors12 = require("@manifest-editor/editors");
1608
+ var import_shell18 = require("@manifest-editor/shell");
1609
+ var import_react10 = require("react");
1610
+ var import_react_aria_components2 = require("react-aria-components");
1611
+ var import_react_iiif_vault19 = require("react-iiif-vault");
1612
+
1613
+ // src/components/TourAnnotationPageEditor.tsx
1614
+ var import_editors11 = require("@manifest-editor/editors");
1615
+ var import_shell17 = require("@manifest-editor/shell");
1616
+ var import_react_iiif_vault18 = require("react-iiif-vault");
1617
+
1618
+ // src/components/TourAnnotationEditor.tsx
1619
+ var import_editors10 = require("@manifest-editor/editors");
1620
+ var import_shell16 = require("@manifest-editor/shell");
1621
+ var import_react9 = require("react");
1622
+ var import_react_iiif_vault17 = require("react-iiif-vault");
1623
+
1624
+ // src/components/TourNormalAnnotationEditor.tsx
1625
+ var import_components13 = require("@manifest-editor/components");
1626
+ var import_components14 = require("@manifest-editor/manifest-preset/components");
1627
+ var import_shell14 = require("@manifest-editor/shell");
1628
+
1629
+ // ../../node_modules/.pnpm/tslib@2.5.0/node_modules/tslib/tslib.es6.js
1630
+ var __assign = function() {
1631
+ __assign = Object.assign || function __assign2(t) {
1632
+ for (var s2, i2 = 1, n = arguments.length; i2 < n; i2++) {
1633
+ s2 = arguments[i2];
1634
+ for (var p2 in s2)
1635
+ if (Object.prototype.hasOwnProperty.call(s2, p2))
1636
+ t[p2] = s2[p2];
1637
+ }
1638
+ return t;
1639
+ };
1640
+ return __assign.apply(this, arguments);
1641
+ };
1642
+ function __spreadArray(to, from2, pack) {
1643
+ if (pack || arguments.length === 2)
1644
+ for (var i2 = 0, l2 = from2.length, ar; i2 < l2; i2++) {
1645
+ if (ar || !(i2 in from2)) {
1646
+ if (!ar)
1647
+ ar = Array.prototype.slice.call(from2, 0, i2);
1648
+ ar[i2] = from2[i2];
1649
+ }
1650
+ }
1651
+ return to.concat(ar || Array.prototype.slice.call(from2));
1652
+ }
1653
+
1654
+ // ../../node_modules/.pnpm/@emotion+memoize@0.8.1/node_modules/@emotion/memoize/dist/emotion-memoize.esm.js
1655
+ function memoize(fn) {
1656
+ var cache = /* @__PURE__ */ Object.create(null);
1657
+ return function(arg) {
1658
+ if (cache[arg] === void 0)
1659
+ cache[arg] = fn(arg);
1660
+ return cache[arg];
1661
+ };
1662
+ }
1663
+
1664
+ // ../../node_modules/.pnpm/@emotion+is-prop-valid@1.2.1/node_modules/@emotion/is-prop-valid/dist/emotion-is-prop-valid.esm.js
1665
+ var reactPropsRegex = /^((children|dangerouslySetInnerHTML|key|ref|autoFocus|defaultValue|defaultChecked|innerHTML|suppressContentEditableWarning|suppressHydrationWarning|valueLink|abbr|accept|acceptCharset|accessKey|action|allow|allowUserMedia|allowPaymentRequest|allowFullScreen|allowTransparency|alt|async|autoComplete|autoPlay|capture|cellPadding|cellSpacing|challenge|charSet|checked|cite|classID|className|cols|colSpan|content|contentEditable|contextMenu|controls|controlsList|coords|crossOrigin|data|dateTime|decoding|default|defer|dir|disabled|disablePictureInPicture|download|draggable|encType|enterKeyHint|form|formAction|formEncType|formMethod|formNoValidate|formTarget|frameBorder|headers|height|hidden|high|href|hrefLang|htmlFor|httpEquiv|id|inputMode|integrity|is|keyParams|keyType|kind|label|lang|list|loading|loop|low|marginHeight|marginWidth|max|maxLength|media|mediaGroup|method|min|minLength|multiple|muted|name|nonce|noValidate|open|optimum|pattern|placeholder|playsInline|poster|preload|profile|radioGroup|readOnly|referrerPolicy|rel|required|reversed|role|rows|rowSpan|sandbox|scope|scoped|scrolling|seamless|selected|shape|size|sizes|slot|span|spellCheck|src|srcDoc|srcLang|srcSet|start|step|style|summary|tabIndex|target|title|translate|type|useMap|value|width|wmode|wrap|about|datatype|inlist|prefix|property|resource|typeof|vocab|autoCapitalize|autoCorrect|autoSave|color|incremental|fallback|inert|itemProp|itemScope|itemType|itemID|itemRef|on|option|results|security|unselectable|accentHeight|accumulate|additive|alignmentBaseline|allowReorder|alphabetic|amplitude|arabicForm|ascent|attributeName|attributeType|autoReverse|azimuth|baseFrequency|baselineShift|baseProfile|bbox|begin|bias|by|calcMode|capHeight|clip|clipPathUnits|clipPath|clipRule|colorInterpolation|colorInterpolationFilters|colorProfile|colorRendering|contentScriptType|contentStyleType|cursor|cx|cy|d|decelerate|descent|diffuseConstant|direction|display|divisor|dominantBaseline|dur|dx|dy|edgeMode|elevation|enableBackground|end|exponent|externalResourcesRequired|fill|fillOpacity|fillRule|filter|filterRes|filterUnits|floodColor|floodOpacity|focusable|fontFamily|fontSize|fontSizeAdjust|fontStretch|fontStyle|fontVariant|fontWeight|format|from|fr|fx|fy|g1|g2|glyphName|glyphOrientationHorizontal|glyphOrientationVertical|glyphRef|gradientTransform|gradientUnits|hanging|horizAdvX|horizOriginX|ideographic|imageRendering|in|in2|intercept|k|k1|k2|k3|k4|kernelMatrix|kernelUnitLength|kerning|keyPoints|keySplines|keyTimes|lengthAdjust|letterSpacing|lightingColor|limitingConeAngle|local|markerEnd|markerMid|markerStart|markerHeight|markerUnits|markerWidth|mask|maskContentUnits|maskUnits|mathematical|mode|numOctaves|offset|opacity|operator|order|orient|orientation|origin|overflow|overlinePosition|overlineThickness|panose1|paintOrder|pathLength|patternContentUnits|patternTransform|patternUnits|pointerEvents|points|pointsAtX|pointsAtY|pointsAtZ|preserveAlpha|preserveAspectRatio|primitiveUnits|r|radius|refX|refY|renderingIntent|repeatCount|repeatDur|requiredExtensions|requiredFeatures|restart|result|rotate|rx|ry|scale|seed|shapeRendering|slope|spacing|specularConstant|specularExponent|speed|spreadMethod|startOffset|stdDeviation|stemh|stemv|stitchTiles|stopColor|stopOpacity|strikethroughPosition|strikethroughThickness|string|stroke|strokeDasharray|strokeDashoffset|strokeLinecap|strokeLinejoin|strokeMiterlimit|strokeOpacity|strokeWidth|surfaceScale|systemLanguage|tableValues|targetX|targetY|textAnchor|textDecoration|textRendering|textLength|to|transform|u1|u2|underlinePosition|underlineThickness|unicode|unicodeBidi|unicodeRange|unitsPerEm|vAlphabetic|vHanging|vIdeographic|vMathematical|values|vectorEffect|version|vertAdvY|vertOriginX|vertOriginY|viewBox|viewTarget|visibility|widths|wordSpacing|writingMode|x|xHeight|x1|x2|xChannelSelector|xlinkActuate|xlinkArcrole|xlinkHref|xlinkRole|xlinkShow|xlinkTitle|xlinkType|xmlBase|xmlns|xmlnsXlink|xmlLang|xmlSpace|y|y1|y2|yChannelSelector|z|zoomAndPan|for|class|autofocus)|(([Dd][Aa][Tt][Aa]|[Aa][Rr][Ii][Aa]|x)-.*))$/;
1666
+ var isPropValid = /* @__PURE__ */ memoize(
1667
+ function(prop) {
1668
+ return reactPropsRegex.test(prop) || prop.charCodeAt(0) === 111 && prop.charCodeAt(1) === 110 && prop.charCodeAt(2) < 91;
1669
+ }
1670
+ /* Z+1 */
1671
+ );
1672
+
1673
+ // ../../node_modules/.pnpm/styled-components@6.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/styled-components/dist/styled-components.browser.esm.js
1674
+ var import_react6 = __toESM(require("react"));
1675
+ var import_shallowequal = __toESM(require_shallowequal());
1676
+
1677
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Enum.js
1678
+ var MS = "-ms-";
1679
+ var MOZ = "-moz-";
1680
+ var WEBKIT = "-webkit-";
1681
+ var COMMENT = "comm";
1682
+ var RULESET = "rule";
1683
+ var DECLARATION = "decl";
1684
+ var IMPORT = "@import";
1685
+ var KEYFRAMES = "@keyframes";
1686
+ var LAYER = "@layer";
1687
+
1688
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Utility.js
1689
+ var abs = Math.abs;
1690
+ var from = String.fromCharCode;
1691
+ var assign = Object.assign;
1692
+ function hash(value, length2) {
1693
+ return charat(value, 0) ^ 45 ? (((length2 << 2 ^ charat(value, 0)) << 2 ^ charat(value, 1)) << 2 ^ charat(value, 2)) << 2 ^ charat(value, 3) : 0;
1694
+ }
1695
+ function trim(value) {
1696
+ return value.trim();
1697
+ }
1698
+ function match(value, pattern) {
1699
+ return (value = pattern.exec(value)) ? value[0] : value;
1700
+ }
1701
+ function replace(value, pattern, replacement) {
1702
+ return value.replace(pattern, replacement);
1703
+ }
1704
+ function indexof(value, search, position2) {
1705
+ return value.indexOf(search, position2);
1706
+ }
1707
+ function charat(value, index) {
1708
+ return value.charCodeAt(index) | 0;
1709
+ }
1710
+ function substr(value, begin, end) {
1711
+ return value.slice(begin, end);
1712
+ }
1713
+ function strlen(value) {
1714
+ return value.length;
1715
+ }
1716
+ function sizeof(value) {
1717
+ return value.length;
1718
+ }
1719
+ function append(value, array) {
1720
+ return array.push(value), value;
1721
+ }
1722
+ function combine(array, callback) {
1723
+ return array.map(callback).join("");
1724
+ }
1725
+ function filter(array, pattern) {
1726
+ return array.filter(function(value) {
1727
+ return !match(value, pattern);
1728
+ });
1729
+ }
1730
+
1731
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Tokenizer.js
1732
+ var line = 1;
1733
+ var column = 1;
1734
+ var length = 0;
1735
+ var position = 0;
1736
+ var character = 0;
1737
+ var characters = "";
1738
+ function node(value, root, parent, type, props, children, length2, siblings) {
1739
+ return { value, root, parent, type, props, children, line, column, length: length2, return: "", siblings };
1740
+ }
1741
+ function copy(root, props) {
1742
+ return assign(node("", null, null, "", null, null, 0, root.siblings), root, { length: -root.length }, props);
1743
+ }
1744
+ function lift(root) {
1745
+ while (root.root)
1746
+ root = copy(root.root, { children: [root] });
1747
+ append(root, root.siblings);
1748
+ }
1749
+ function char() {
1750
+ return character;
1751
+ }
1752
+ function prev() {
1753
+ character = position > 0 ? charat(characters, --position) : 0;
1754
+ if (column--, character === 10)
1755
+ column = 1, line--;
1756
+ return character;
1757
+ }
1758
+ function next() {
1759
+ character = position < length ? charat(characters, position++) : 0;
1760
+ if (column++, character === 10)
1761
+ column = 1, line++;
1762
+ return character;
1763
+ }
1764
+ function peek() {
1765
+ return charat(characters, position);
1766
+ }
1767
+ function caret() {
1768
+ return position;
1769
+ }
1770
+ function slice(begin, end) {
1771
+ return substr(characters, begin, end);
1772
+ }
1773
+ function token(type) {
1774
+ switch (type) {
1775
+ case 0:
1776
+ case 9:
1777
+ case 10:
1778
+ case 13:
1779
+ case 32:
1780
+ return 5;
1781
+ case 33:
1782
+ case 43:
1783
+ case 44:
1784
+ case 47:
1785
+ case 62:
1786
+ case 64:
1787
+ case 126:
1788
+ case 59:
1789
+ case 123:
1790
+ case 125:
1791
+ return 4;
1792
+ case 58:
1793
+ return 3;
1794
+ case 34:
1795
+ case 39:
1796
+ case 40:
1797
+ case 91:
1798
+ return 2;
1799
+ case 41:
1800
+ case 93:
1801
+ return 1;
1802
+ }
1803
+ return 0;
1804
+ }
1805
+ function alloc(value) {
1806
+ return line = column = 1, length = strlen(characters = value), position = 0, [];
1807
+ }
1808
+ function dealloc(value) {
1809
+ return characters = "", value;
1810
+ }
1811
+ function delimit(type) {
1812
+ return trim(slice(position - 1, delimiter(type === 91 ? type + 2 : type === 40 ? type + 1 : type)));
1813
+ }
1814
+ function whitespace(type) {
1815
+ while (character = peek())
1816
+ if (character < 33)
1817
+ next();
1818
+ else
1819
+ break;
1820
+ return token(type) > 2 || token(character) > 3 ? "" : " ";
1821
+ }
1822
+ function escaping(index, count) {
1823
+ while (--count && next())
1824
+ if (character < 48 || character > 102 || character > 57 && character < 65 || character > 70 && character < 97)
1825
+ break;
1826
+ return slice(index, caret() + (count < 6 && peek() == 32 && next() == 32));
1827
+ }
1828
+ function delimiter(type) {
1829
+ while (next())
1830
+ switch (character) {
1831
+ case type:
1832
+ return position;
1833
+ case 34:
1834
+ case 39:
1835
+ if (type !== 34 && type !== 39)
1836
+ delimiter(character);
1837
+ break;
1838
+ case 40:
1839
+ if (type === 41)
1840
+ delimiter(type);
1841
+ break;
1842
+ case 92:
1843
+ next();
1844
+ break;
1845
+ }
1846
+ return position;
1847
+ }
1848
+ function commenter(type, index) {
1849
+ while (next())
1850
+ if (type + character === 47 + 10)
1851
+ break;
1852
+ else if (type + character === 42 + 42 && peek() === 47)
1853
+ break;
1854
+ return "/*" + slice(index, position - 1) + "*" + from(type === 47 ? type : next());
1855
+ }
1856
+ function identifier(index) {
1857
+ while (!token(peek()))
1858
+ next();
1859
+ return slice(index, position);
1860
+ }
1861
+
1862
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Parser.js
1863
+ function compile(value) {
1864
+ return dealloc(parse("", null, null, null, [""], value = alloc(value), 0, [0], value));
1865
+ }
1866
+ function parse(value, root, parent, rule, rules, rulesets, pseudo, points, declarations) {
1867
+ var index = 0;
1868
+ var offset = 0;
1869
+ var length2 = pseudo;
1870
+ var atrule = 0;
1871
+ var property = 0;
1872
+ var previous = 0;
1873
+ var variable = 1;
1874
+ var scanning = 1;
1875
+ var ampersand = 1;
1876
+ var character2 = 0;
1877
+ var type = "";
1878
+ var props = rules;
1879
+ var children = rulesets;
1880
+ var reference = rule;
1881
+ var characters2 = type;
1882
+ while (scanning)
1883
+ switch (previous = character2, character2 = next()) {
1884
+ case 40:
1885
+ if (previous != 108 && charat(characters2, length2 - 1) == 58) {
1886
+ if (indexof(characters2 += replace(delimit(character2), "&", "&\f"), "&\f", abs(index ? points[index - 1] : 0)) != -1)
1887
+ ampersand = -1;
1888
+ break;
1889
+ }
1890
+ case 34:
1891
+ case 39:
1892
+ case 91:
1893
+ characters2 += delimit(character2);
1894
+ break;
1895
+ case 9:
1896
+ case 10:
1897
+ case 13:
1898
+ case 32:
1899
+ characters2 += whitespace(previous);
1900
+ break;
1901
+ case 92:
1902
+ characters2 += escaping(caret() - 1, 7);
1903
+ continue;
1904
+ case 47:
1905
+ switch (peek()) {
1906
+ case 42:
1907
+ case 47:
1908
+ append(comment(commenter(next(), caret()), root, parent, declarations), declarations);
1909
+ break;
1910
+ default:
1911
+ characters2 += "/";
1912
+ }
1913
+ break;
1914
+ case 123 * variable:
1915
+ points[index++] = strlen(characters2) * ampersand;
1916
+ case 125 * variable:
1917
+ case 59:
1918
+ case 0:
1919
+ switch (character2) {
1920
+ case 0:
1921
+ case 125:
1922
+ scanning = 0;
1923
+ case 59 + offset:
1924
+ if (ampersand == -1)
1925
+ characters2 = replace(characters2, /\f/g, "");
1926
+ if (property > 0 && strlen(characters2) - length2)
1927
+ append(property > 32 ? declaration(characters2 + ";", rule, parent, length2 - 1, declarations) : declaration(replace(characters2, " ", "") + ";", rule, parent, length2 - 2, declarations), declarations);
1928
+ break;
1929
+ case 59:
1930
+ characters2 += ";";
1931
+ default:
1932
+ append(reference = ruleset(characters2, root, parent, index, offset, rules, points, type, props = [], children = [], length2, rulesets), rulesets);
1933
+ if (character2 === 123)
1934
+ if (offset === 0)
1935
+ parse(characters2, root, reference, reference, props, rulesets, length2, points, children);
1936
+ else
1937
+ switch (atrule === 99 && charat(characters2, 3) === 110 ? 100 : atrule) {
1938
+ case 100:
1939
+ case 108:
1940
+ case 109:
1941
+ case 115:
1942
+ parse(value, reference, reference, rule && append(ruleset(value, reference, reference, 0, 0, rules, points, type, rules, props = [], length2, children), children), rules, children, length2, points, rule ? props : children);
1943
+ break;
1944
+ default:
1945
+ parse(characters2, reference, reference, reference, [""], children, 0, points, children);
1946
+ }
1947
+ }
1948
+ index = offset = property = 0, variable = ampersand = 1, type = characters2 = "", length2 = pseudo;
1949
+ break;
1950
+ case 58:
1951
+ length2 = 1 + strlen(characters2), property = previous;
1952
+ default:
1953
+ if (variable < 1) {
1954
+ if (character2 == 123)
1955
+ --variable;
1956
+ else if (character2 == 125 && variable++ == 0 && prev() == 125)
1957
+ continue;
1958
+ }
1959
+ switch (characters2 += from(character2), character2 * variable) {
1960
+ case 38:
1961
+ ampersand = offset > 0 ? 1 : (characters2 += "\f", -1);
1962
+ break;
1963
+ case 44:
1964
+ points[index++] = (strlen(characters2) - 1) * ampersand, ampersand = 1;
1965
+ break;
1966
+ case 64:
1967
+ if (peek() === 45)
1968
+ characters2 += delimit(next());
1969
+ atrule = peek(), offset = length2 = strlen(type = characters2 += identifier(caret())), character2++;
1970
+ break;
1971
+ case 45:
1972
+ if (previous === 45 && strlen(characters2) == 2)
1973
+ variable = 0;
1974
+ }
1975
+ }
1976
+ return rulesets;
1977
+ }
1978
+ function ruleset(value, root, parent, index, offset, rules, points, type, props, children, length2, siblings) {
1979
+ var post = offset - 1;
1980
+ var rule = offset === 0 ? rules : [""];
1981
+ var size = sizeof(rule);
1982
+ for (var i2 = 0, j2 = 0, k2 = 0; i2 < index; ++i2)
1983
+ for (var x2 = 0, y2 = substr(value, post + 1, post = abs(j2 = points[i2])), z2 = value; x2 < size; ++x2)
1984
+ if (z2 = trim(j2 > 0 ? rule[x2] + " " + y2 : replace(y2, /&\f/g, rule[x2])))
1985
+ props[k2++] = z2;
1986
+ return node(value, root, parent, offset === 0 ? RULESET : type, props, children, length2, siblings);
1987
+ }
1988
+ function comment(value, root, parent, siblings) {
1989
+ return node(value, root, parent, COMMENT, from(char()), substr(value, 2, -2), 0, siblings);
1990
+ }
1991
+ function declaration(value, root, parent, length2, siblings) {
1992
+ return node(value, root, parent, DECLARATION, substr(value, 0, length2), substr(value, length2 + 1, -1), length2, siblings);
1993
+ }
1994
+
1995
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Prefixer.js
1996
+ function prefix(value, length2, children) {
1997
+ switch (hash(value, length2)) {
1998
+ case 5103:
1999
+ return WEBKIT + "print-" + value + value;
2000
+ case 5737:
2001
+ case 4201:
2002
+ case 3177:
2003
+ case 3433:
2004
+ case 1641:
2005
+ case 4457:
2006
+ case 2921:
2007
+ case 5572:
2008
+ case 6356:
2009
+ case 5844:
2010
+ case 3191:
2011
+ case 6645:
2012
+ case 3005:
2013
+ case 6391:
2014
+ case 5879:
2015
+ case 5623:
2016
+ case 6135:
2017
+ case 4599:
2018
+ case 4855:
2019
+ case 4215:
2020
+ case 6389:
2021
+ case 5109:
2022
+ case 5365:
2023
+ case 5621:
2024
+ case 3829:
2025
+ return WEBKIT + value + value;
2026
+ case 4789:
2027
+ return MOZ + value + value;
2028
+ case 5349:
2029
+ case 4246:
2030
+ case 4810:
2031
+ case 6968:
2032
+ case 2756:
2033
+ return WEBKIT + value + MOZ + value + MS + value + value;
2034
+ case 5936:
2035
+ switch (charat(value, length2 + 11)) {
2036
+ case 114:
2037
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb") + value;
2038
+ case 108:
2039
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "tb-rl") + value;
2040
+ case 45:
2041
+ return WEBKIT + value + MS + replace(value, /[svh]\w+-[tblr]{2}/, "lr") + value;
2042
+ }
2043
+ case 6828:
2044
+ case 4268:
2045
+ case 2903:
2046
+ return WEBKIT + value + MS + value + value;
2047
+ case 6165:
2048
+ return WEBKIT + value + MS + "flex-" + value + value;
2049
+ case 5187:
2050
+ return WEBKIT + value + replace(value, /(\w+).+(:[^]+)/, WEBKIT + "box-$1$2" + MS + "flex-$1$2") + value;
2051
+ case 5443:
2052
+ return WEBKIT + value + MS + "flex-item-" + replace(value, /flex-|-self/g, "") + (!match(value, /flex-|baseline/) ? MS + "grid-row-" + replace(value, /flex-|-self/g, "") : "") + value;
2053
+ case 4675:
2054
+ return WEBKIT + value + MS + "flex-line-pack" + replace(value, /align-content|flex-|-self/g, "") + value;
2055
+ case 5548:
2056
+ return WEBKIT + value + MS + replace(value, "shrink", "negative") + value;
2057
+ case 5292:
2058
+ return WEBKIT + value + MS + replace(value, "basis", "preferred-size") + value;
2059
+ case 6060:
2060
+ return WEBKIT + "box-" + replace(value, "-grow", "") + WEBKIT + value + MS + replace(value, "grow", "positive") + value;
2061
+ case 4554:
2062
+ return WEBKIT + replace(value, /([^-])(transform)/g, "$1" + WEBKIT + "$2") + value;
2063
+ case 6187:
2064
+ return replace(replace(replace(value, /(zoom-|grab)/, WEBKIT + "$1"), /(image-set)/, WEBKIT + "$1"), value, "") + value;
2065
+ case 5495:
2066
+ case 3959:
2067
+ return replace(value, /(image-set\([^]*)/, WEBKIT + "$1$`$1");
2068
+ case 4968:
2069
+ return replace(replace(value, /(.+:)(flex-)?(.*)/, WEBKIT + "box-pack:$3" + MS + "flex-pack:$3"), /s.+-b[^;]+/, "justify") + WEBKIT + value + value;
2070
+ case 4200:
2071
+ if (!match(value, /flex-|baseline/))
2072
+ return MS + "grid-column-align" + substr(value, length2) + value;
2073
+ break;
2074
+ case 2592:
2075
+ case 3360:
2076
+ return MS + replace(value, "template-", "") + value;
2077
+ case 4384:
2078
+ case 3616:
2079
+ if (children && children.some(function(element, index) {
2080
+ return length2 = index, match(element.props, /grid-\w+-end/);
2081
+ })) {
2082
+ return ~indexof(value + (children = children[length2].value), "span", 0) ? value : MS + replace(value, "-start", "") + value + MS + "grid-row-span:" + (~indexof(children, "span", 0) ? match(children, /\d+/) : +match(children, /\d+/) - +match(value, /\d+/)) + ";";
2083
+ }
2084
+ return MS + replace(value, "-start", "") + value;
2085
+ case 4896:
2086
+ case 4128:
2087
+ return children && children.some(function(element) {
2088
+ return match(element.props, /grid-\w+-start/);
2089
+ }) ? value : MS + replace(replace(value, "-end", "-span"), "span ", "") + value;
2090
+ case 4095:
2091
+ case 3583:
2092
+ case 4068:
2093
+ case 2532:
2094
+ return replace(value, /(.+)-inline(.+)/, WEBKIT + "$1$2") + value;
2095
+ case 8116:
2096
+ case 7059:
2097
+ case 5753:
2098
+ case 5535:
2099
+ case 5445:
2100
+ case 5701:
2101
+ case 4933:
2102
+ case 4677:
2103
+ case 5533:
2104
+ case 5789:
2105
+ case 5021:
2106
+ case 4765:
2107
+ if (strlen(value) - 1 - length2 > 6)
2108
+ switch (charat(value, length2 + 1)) {
2109
+ case 109:
2110
+ if (charat(value, length2 + 4) !== 45)
2111
+ break;
2112
+ case 102:
2113
+ return replace(value, /(.+:)(.+)-([^]+)/, "$1" + WEBKIT + "$2-$3$1" + MOZ + (charat(value, length2 + 3) == 108 ? "$3" : "$2-$3")) + value;
2114
+ case 115:
2115
+ return ~indexof(value, "stretch", 0) ? prefix(replace(value, "stretch", "fill-available"), length2, children) + value : value;
2116
+ }
2117
+ break;
2118
+ case 5152:
2119
+ case 5920:
2120
+ return replace(value, /(.+?):(\d+)(\s*\/\s*(span)?\s*(\d+))?(.*)/, function(_2, a2, b, c2, d, e, f2) {
2121
+ return MS + a2 + ":" + b + f2 + (c2 ? MS + a2 + "-span:" + (d ? e : +e - +b) + f2 : "") + value;
2122
+ });
2123
+ case 4949:
2124
+ if (charat(value, length2 + 6) === 121)
2125
+ return replace(value, ":", ":" + WEBKIT) + value;
2126
+ break;
2127
+ case 6444:
2128
+ switch (charat(value, charat(value, 14) === 45 ? 18 : 11)) {
2129
+ case 120:
2130
+ return replace(value, /(.+:)([^;\s!]+)(;|(\s+)?!.+)?/, "$1" + WEBKIT + (charat(value, 14) === 45 ? "inline-" : "") + "box$3$1" + WEBKIT + "$2$3$1" + MS + "$2box$3") + value;
2131
+ case 100:
2132
+ return replace(value, ":", ":" + MS) + value;
2133
+ }
2134
+ break;
2135
+ case 5719:
2136
+ case 2647:
2137
+ case 2135:
2138
+ case 3927:
2139
+ case 2391:
2140
+ return replace(value, "scroll-", "scroll-snap-") + value;
2141
+ }
2142
+ return value;
2143
+ }
2144
+
2145
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Serializer.js
2146
+ function serialize(children, callback) {
2147
+ var output = "";
2148
+ for (var i2 = 0; i2 < children.length; i2++)
2149
+ output += callback(children[i2], i2, children, callback) || "";
2150
+ return output;
2151
+ }
2152
+ function stringify(element, index, children, callback) {
2153
+ switch (element.type) {
2154
+ case LAYER:
2155
+ if (element.children.length)
2156
+ break;
2157
+ case IMPORT:
2158
+ case DECLARATION:
2159
+ return element.return = element.return || element.value;
2160
+ case COMMENT:
2161
+ return "";
2162
+ case KEYFRAMES:
2163
+ return element.return = element.value + "{" + serialize(element.children, callback) + "}";
2164
+ case RULESET:
2165
+ if (!strlen(element.value = element.props.join(",")))
2166
+ return "";
2167
+ }
2168
+ return strlen(children = serialize(element.children, callback)) ? element.return = element.value + "{" + children + "}" : "";
2169
+ }
2170
+
2171
+ // ../../node_modules/.pnpm/stylis@4.3.1/node_modules/stylis/src/Middleware.js
2172
+ function middleware(collection) {
2173
+ var length2 = sizeof(collection);
2174
+ return function(element, index, children, callback) {
2175
+ var output = "";
2176
+ for (var i2 = 0; i2 < length2; i2++)
2177
+ output += collection[i2](element, index, children, callback) || "";
2178
+ return output;
2179
+ };
2180
+ }
2181
+ function rulesheet(callback) {
2182
+ return function(element) {
2183
+ if (!element.root) {
2184
+ if (element = element.return)
2185
+ callback(element);
2186
+ }
2187
+ };
2188
+ }
2189
+ function prefixer(element, index, children, callback) {
2190
+ if (element.length > -1) {
2191
+ if (!element.return)
2192
+ switch (element.type) {
2193
+ case DECLARATION:
2194
+ element.return = prefix(element.value, element.length, children);
2195
+ return;
2196
+ case KEYFRAMES:
2197
+ return serialize([copy(element, { value: replace(element.value, "@", "@" + WEBKIT) })], callback);
2198
+ case RULESET:
2199
+ if (element.length)
2200
+ return combine(children = element.props, function(value) {
2201
+ switch (match(value, callback = /(::plac\w+|:read-\w+)/)) {
2202
+ case ":read-only":
2203
+ case ":read-write":
2204
+ lift(copy(element, { props: [replace(value, /:(read-\w+)/, ":" + MOZ + "$1")] }));
2205
+ lift(copy(element, { props: [value] }));
2206
+ assign(element, { props: filter(children, callback) });
2207
+ break;
2208
+ case "::placeholder":
2209
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, ":" + WEBKIT + "input-$1")] }));
2210
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, ":" + MOZ + "$1")] }));
2211
+ lift(copy(element, { props: [replace(value, /:(plac\w+)/, MS + "input-$1")] }));
2212
+ lift(copy(element, { props: [value] }));
2213
+ assign(element, { props: filter(children, callback) });
2214
+ break;
2215
+ }
2216
+ return "";
2217
+ });
2218
+ }
2219
+ }
2220
+ }
2221
+
2222
+ // ../../node_modules/.pnpm/@emotion+unitless@0.8.0/node_modules/@emotion/unitless/dist/emotion-unitless.esm.js
2223
+ var unitlessKeys = {
2224
+ animationIterationCount: 1,
2225
+ borderImageOutset: 1,
2226
+ borderImageSlice: 1,
2227
+ borderImageWidth: 1,
2228
+ boxFlex: 1,
2229
+ boxFlexGroup: 1,
2230
+ boxOrdinalGroup: 1,
2231
+ columnCount: 1,
2232
+ columns: 1,
2233
+ flex: 1,
2234
+ flexGrow: 1,
2235
+ flexPositive: 1,
2236
+ flexShrink: 1,
2237
+ flexNegative: 1,
2238
+ flexOrder: 1,
2239
+ gridRow: 1,
2240
+ gridRowEnd: 1,
2241
+ gridRowSpan: 1,
2242
+ gridRowStart: 1,
2243
+ gridColumn: 1,
2244
+ gridColumnEnd: 1,
2245
+ gridColumnSpan: 1,
2246
+ gridColumnStart: 1,
2247
+ msGridRow: 1,
2248
+ msGridRowSpan: 1,
2249
+ msGridColumn: 1,
2250
+ msGridColumnSpan: 1,
2251
+ fontWeight: 1,
2252
+ lineHeight: 1,
2253
+ opacity: 1,
2254
+ order: 1,
2255
+ orphans: 1,
2256
+ tabSize: 1,
2257
+ widows: 1,
2258
+ zIndex: 1,
2259
+ zoom: 1,
2260
+ WebkitLineClamp: 1,
2261
+ // SVG-related properties
2262
+ fillOpacity: 1,
2263
+ floodOpacity: 1,
2264
+ stopOpacity: 1,
2265
+ strokeDasharray: 1,
2266
+ strokeDashoffset: 1,
2267
+ strokeMiterlimit: 1,
2268
+ strokeOpacity: 1,
2269
+ strokeWidth: 1
2270
+ };
2271
+ var emotion_unitless_esm_default = unitlessKeys;
2272
+
2273
+ // ../../node_modules/.pnpm/styled-components@6.1.8_react-dom@18.3.1_react@18.3.1__react@18.3.1/node_modules/styled-components/dist/styled-components.browser.esm.js
2274
+ var f = "undefined" != typeof process && void 0 !== process.env && (process.env.REACT_APP_SC_ATTR || process.env.SC_ATTR) || "data-styled";
2275
+ var m = "active";
2276
+ var y = "data-styled-version";
2277
+ var v = "6.1.8";
2278
+ var g = "/*!sc*/\n";
2279
+ var S = "undefined" != typeof window && "HTMLElement" in window;
2280
+ var w = Boolean("boolean" == typeof SC_DISABLE_SPEEDY ? SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.REACT_APP_SC_DISABLE_SPEEDY && "" !== process.env.REACT_APP_SC_DISABLE_SPEEDY ? "false" !== process.env.REACT_APP_SC_DISABLE_SPEEDY && process.env.REACT_APP_SC_DISABLE_SPEEDY : "undefined" != typeof process && void 0 !== process.env && void 0 !== process.env.SC_DISABLE_SPEEDY && "" !== process.env.SC_DISABLE_SPEEDY ? "false" !== process.env.SC_DISABLE_SPEEDY && process.env.SC_DISABLE_SPEEDY : true);
2281
+ var E = /invalid hook call/i;
2282
+ var N = /* @__PURE__ */ new Set();
2283
+ var P = function(t, n) {
2284
+ if (true) {
2285
+ var o2 = n ? ' with the id of "'.concat(n, '"') : "", s2 = "The component ".concat(t).concat(o2, " has been created dynamically.\n") + "You may see this warning because you've called styled inside another component.\nTo resolve this only create new StyledComponents outside of any render method and function component.", i2 = console.error;
2286
+ try {
2287
+ var a2 = true;
2288
+ console.error = function(t2) {
2289
+ for (var n2 = [], o3 = 1; o3 < arguments.length; o3++)
2290
+ n2[o3 - 1] = arguments[o3];
2291
+ E.test(t2) ? (a2 = false, N.delete(s2)) : i2.apply(void 0, __spreadArray([t2], n2, false));
2292
+ }, (0, import_react6.useRef)(), a2 && !N.has(s2) && (console.warn(s2), N.add(s2));
2293
+ } catch (e) {
2294
+ E.test(e.message) && N.delete(s2);
2295
+ } finally {
2296
+ console.error = i2;
2297
+ }
2298
+ }
2299
+ };
2300
+ var _ = Object.freeze([]);
2301
+ var C = Object.freeze({});
2302
+ function I(e, t, n) {
2303
+ return void 0 === n && (n = C), e.theme !== n.theme && e.theme || t || n.theme;
2304
+ }
2305
+ var A = /* @__PURE__ */ new Set(["a", "abbr", "address", "area", "article", "aside", "audio", "b", "base", "bdi", "bdo", "big", "blockquote", "body", "br", "button", "canvas", "caption", "cite", "code", "col", "colgroup", "data", "datalist", "dd", "del", "details", "dfn", "dialog", "div", "dl", "dt", "em", "embed", "fieldset", "figcaption", "figure", "footer", "form", "h1", "h2", "h3", "h4", "h5", "h6", "header", "hgroup", "hr", "html", "i", "iframe", "img", "input", "ins", "kbd", "keygen", "label", "legend", "li", "link", "main", "map", "mark", "menu", "menuitem", "meta", "meter", "nav", "noscript", "object", "ol", "optgroup", "option", "output", "p", "param", "picture", "pre", "progress", "q", "rp", "rt", "ruby", "s", "samp", "script", "section", "select", "small", "source", "span", "strong", "style", "sub", "summary", "sup", "table", "tbody", "td", "textarea", "tfoot", "th", "thead", "time", "tr", "track", "u", "ul", "use", "var", "video", "wbr", "circle", "clipPath", "defs", "ellipse", "foreignObject", "g", "image", "line", "linearGradient", "marker", "mask", "path", "pattern", "polygon", "polyline", "radialGradient", "rect", "stop", "svg", "text", "tspan"]);
2306
+ var O = /[!"#$%&'()*+,./:;<=>?@[\\\]^`{|}~-]+/g;
2307
+ var D = /(^-|-$)/g;
2308
+ function R(e) {
2309
+ return e.replace(O, "-").replace(D, "");
2310
+ }
2311
+ var T = /(a)(d)/gi;
2312
+ var k = 52;
2313
+ var j = function(e) {
2314
+ return String.fromCharCode(e + (e > 25 ? 39 : 97));
2315
+ };
2316
+ function x(e) {
2317
+ var t, n = "";
2318
+ for (t = Math.abs(e); t > k; t = t / k | 0)
2319
+ n = j(t % k) + n;
2320
+ return (j(t % k) + n).replace(T, "$1-$2");
2321
+ }
2322
+ var V;
2323
+ var F = 5381;
2324
+ var M = function(e, t) {
2325
+ for (var n = t.length; n; )
2326
+ e = 33 * e ^ t.charCodeAt(--n);
2327
+ return e;
2328
+ };
2329
+ var $ = function(e) {
2330
+ return M(F, e);
2331
+ };
2332
+ function z(e) {
2333
+ return x($(e) >>> 0);
2334
+ }
2335
+ function B(e) {
2336
+ return "string" == typeof e && e || e.displayName || e.name || "Component";
2337
+ }
2338
+ function L(e) {
2339
+ return "string" == typeof e && e.charAt(0) === e.charAt(0).toLowerCase();
2340
+ }
2341
+ var G = "function" == typeof Symbol && Symbol.for;
2342
+ var Y = G ? Symbol.for("react.memo") : 60115;
2343
+ var W = G ? Symbol.for("react.forward_ref") : 60112;
2344
+ var q = { childContextTypes: true, contextType: true, contextTypes: true, defaultProps: true, displayName: true, getDefaultProps: true, getDerivedStateFromError: true, getDerivedStateFromProps: true, mixins: true, propTypes: true, type: true };
2345
+ var H = { name: true, length: true, prototype: true, caller: true, callee: true, arguments: true, arity: true };
2346
+ var U = { $$typeof: true, compare: true, defaultProps: true, displayName: true, propTypes: true, type: true };
2347
+ var J = ((V = {})[W] = { $$typeof: true, render: true, defaultProps: true, displayName: true, propTypes: true }, V[Y] = U, V);
2348
+ function X(e) {
2349
+ return ("type" in (t = e) && t.type.$$typeof) === Y ? U : "$$typeof" in e ? J[e.$$typeof] : q;
2350
+ var t;
2351
+ }
2352
+ var Z = Object.defineProperty;
2353
+ var K = Object.getOwnPropertyNames;
2354
+ var Q = Object.getOwnPropertySymbols;
2355
+ var ee = Object.getOwnPropertyDescriptor;
2356
+ var te = Object.getPrototypeOf;
2357
+ var ne = Object.prototype;
2358
+ function oe(e, t, n) {
2359
+ if ("string" != typeof t) {
2360
+ if (ne) {
2361
+ var o2 = te(t);
2362
+ o2 && o2 !== ne && oe(e, o2, n);
2363
+ }
2364
+ var r2 = K(t);
2365
+ Q && (r2 = r2.concat(Q(t)));
2366
+ for (var s2 = X(e), i2 = X(t), a2 = 0; a2 < r2.length; ++a2) {
2367
+ var c2 = r2[a2];
2368
+ if (!(c2 in H || n && n[c2] || i2 && c2 in i2 || s2 && c2 in s2)) {
2369
+ var l2 = ee(t, c2);
2370
+ try {
2371
+ Z(e, c2, l2);
2372
+ } catch (e2) {
2373
+ }
2374
+ }
2375
+ }
2376
+ }
2377
+ return e;
2378
+ }
2379
+ function re(e) {
2380
+ return "function" == typeof e;
2381
+ }
2382
+ function se(e) {
2383
+ return "object" == typeof e && "styledComponentId" in e;
2384
+ }
2385
+ function ie(e, t) {
2386
+ return e && t ? "".concat(e, " ").concat(t) : e || t || "";
2387
+ }
2388
+ function ae(e, t) {
2389
+ if (0 === e.length)
2390
+ return "";
2391
+ for (var n = e[0], o2 = 1; o2 < e.length; o2++)
2392
+ n += t ? t + e[o2] : e[o2];
2393
+ return n;
2394
+ }
2395
+ function ce(e) {
2396
+ return null !== e && "object" == typeof e && e.constructor.name === Object.name && !("props" in e && e.$$typeof);
2397
+ }
2398
+ function le(e, t, n) {
2399
+ if (void 0 === n && (n = false), !n && !ce(e) && !Array.isArray(e))
2400
+ return t;
2401
+ if (Array.isArray(t))
2402
+ for (var o2 = 0; o2 < t.length; o2++)
2403
+ e[o2] = le(e[o2], t[o2]);
2404
+ else if (ce(t))
2405
+ for (var o2 in t)
2406
+ e[o2] = le(e[o2], t[o2]);
2407
+ return e;
2408
+ }
2409
+ function ue(e, t) {
2410
+ Object.defineProperty(e, "toString", { value: t });
2411
+ }
2412
+ var pe = true ? { 1: "Cannot create styled-component for component: %s.\n\n", 2: "Can't collect styles once you've consumed a `ServerStyleSheet`'s styles! `ServerStyleSheet` is a one off instance for each server-side render cycle.\n\n- Are you trying to reuse it across renders?\n- Are you accidentally calling collectStyles twice?\n\n", 3: "Streaming SSR is only supported in a Node.js environment; Please do not try to call this method in the browser.\n\n", 4: "The `StyleSheetManager` expects a valid target or sheet prop!\n\n- Does this error occur on the client and is your target falsy?\n- Does this error occur on the server and is the sheet falsy?\n\n", 5: "The clone method cannot be used on the client!\n\n- Are you running in a client-like environment on the server?\n- Are you trying to run SSR on the client?\n\n", 6: "Trying to insert a new style tag, but the given Node is unmounted!\n\n- Are you using a custom target that isn't mounted?\n- Does your document not have a valid head element?\n- Have you accidentally removed a style tag manually?\n\n", 7: 'ThemeProvider: Please return an object from your "theme" prop function, e.g.\n\n```js\ntheme={() => ({})}\n```\n\n', 8: 'ThemeProvider: Please make your "theme" prop an object.\n\n', 9: "Missing document `<head>`\n\n", 10: "Cannot find a StyleSheet instance. Usually this happens if there are multiple copies of styled-components loaded at once. Check out this issue for how to troubleshoot and fix the common cases where this situation can happen: https://github.com/styled-components/styled-components/issues/1941#issuecomment-417862021\n\n", 11: "_This error was replaced with a dev-time warning, it will be deleted for v4 final._ [createGlobalStyle] received children which will not be rendered. Please use the component without passing children elements.\n\n", 12: "It seems you are interpolating a keyframe declaration (%s) into an untagged string. This was supported in styled-components v3, but is not longer supported in v4 as keyframes are now injected on-demand. Please wrap your string in the css\\`\\` helper which ensures the styles are injected correctly. See https://www.styled-components.com/docs/api#css\n\n", 13: "%s is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.\n\n", 14: 'ThemeProvider: "theme" prop is required.\n\n', 15: "A stylis plugin has been supplied that is not named. We need a name for each plugin to be able to prevent styling collisions between different stylis configurations within the same app. Before you pass your plugin to `<StyleSheetManager stylisPlugins={[]}>`, please make sure each plugin is uniquely-named, e.g.\n\n```js\nObject.defineProperty(importedPlugin, 'name', { value: 'some-unique-name' });\n```\n\n", 16: "Reached the limit of how many styled components may be created at group %s.\nYou may only create up to 1,073,741,824 components. If you're creating components dynamically,\nas for instance in your render method then you may be running into this limitation.\n\n", 17: "CSSStyleSheet could not be found on HTMLStyleElement.\nHas styled-components' style tag been unmounted or altered by another script?\n", 18: "ThemeProvider: Please make sure your useTheme hook is within a `<ThemeProvider>`" } : {};
2413
+ function de() {
2414
+ for (var e = [], t = 0; t < arguments.length; t++)
2415
+ e[t] = arguments[t];
2416
+ for (var n = e[0], o2 = [], r2 = 1, s2 = e.length; r2 < s2; r2 += 1)
2417
+ o2.push(e[r2]);
2418
+ return o2.forEach(function(e2) {
2419
+ n = n.replace(/%[a-z]/, e2);
2420
+ }), n;
2421
+ }
2422
+ function he(t) {
2423
+ for (var n = [], o2 = 1; o2 < arguments.length; o2++)
2424
+ n[o2 - 1] = arguments[o2];
2425
+ return false ? new Error("An error occurred. See https://github.com/styled-components/styled-components/blob/main/packages/styled-components/src/utils/errors.md#".concat(t, " for more information.").concat(n.length > 0 ? " Args: ".concat(n.join(", ")) : "")) : new Error(de.apply(void 0, __spreadArray([pe[t]], n, false)).trim());
2426
+ }
2427
+ var fe = function() {
2428
+ function e(e2) {
2429
+ this.groupSizes = new Uint32Array(512), this.length = 512, this.tag = e2;
2430
+ }
2431
+ return e.prototype.indexOfGroup = function(e2) {
2432
+ for (var t = 0, n = 0; n < e2; n++)
2433
+ t += this.groupSizes[n];
2434
+ return t;
2435
+ }, e.prototype.insertRules = function(e2, t) {
2436
+ if (e2 >= this.groupSizes.length) {
2437
+ for (var n = this.groupSizes, o2 = n.length, r2 = o2; e2 >= r2; )
2438
+ if ((r2 <<= 1) < 0)
2439
+ throw he(16, "".concat(e2));
2440
+ this.groupSizes = new Uint32Array(r2), this.groupSizes.set(n), this.length = r2;
2441
+ for (var s2 = o2; s2 < r2; s2++)
2442
+ this.groupSizes[s2] = 0;
2443
+ }
2444
+ for (var i2 = this.indexOfGroup(e2 + 1), a2 = (s2 = 0, t.length); s2 < a2; s2++)
2445
+ this.tag.insertRule(i2, t[s2]) && (this.groupSizes[e2]++, i2++);
2446
+ }, e.prototype.clearGroup = function(e2) {
2447
+ if (e2 < this.length) {
2448
+ var t = this.groupSizes[e2], n = this.indexOfGroup(e2), o2 = n + t;
2449
+ this.groupSizes[e2] = 0;
2450
+ for (var r2 = n; r2 < o2; r2++)
2451
+ this.tag.deleteRule(n);
2452
+ }
2453
+ }, e.prototype.getGroup = function(e2) {
2454
+ var t = "";
2455
+ if (e2 >= this.length || 0 === this.groupSizes[e2])
2456
+ return t;
2457
+ for (var n = this.groupSizes[e2], o2 = this.indexOfGroup(e2), r2 = o2 + n, s2 = o2; s2 < r2; s2++)
2458
+ t += "".concat(this.tag.getRule(s2)).concat(g);
2459
+ return t;
2460
+ }, e;
2461
+ }();
2462
+ var me = /* @__PURE__ */ new Map();
2463
+ var ye = /* @__PURE__ */ new Map();
2464
+ var ve = 1;
2465
+ var ge = function(e) {
2466
+ if (me.has(e))
2467
+ return me.get(e);
2468
+ for (; ye.has(ve); )
2469
+ ve++;
2470
+ var t = ve++;
2471
+ if ((0 | t) < 0 || t > 1073741824)
2472
+ throw he(16, "".concat(t));
2473
+ return me.set(e, t), ye.set(t, e), t;
2474
+ };
2475
+ var Se = function(e, t) {
2476
+ ve = t + 1, me.set(e, t), ye.set(t, e);
2477
+ };
2478
+ var we = "style[".concat(f, "][").concat(y, '="').concat(v, '"]');
2479
+ var be = new RegExp("^".concat(f, '\\.g(\\d+)\\[id="([\\w\\d-]+)"\\].*?"([^"]*)'));
2480
+ var Ee = function(e, t, n) {
2481
+ for (var o2, r2 = n.split(","), s2 = 0, i2 = r2.length; s2 < i2; s2++)
2482
+ (o2 = r2[s2]) && e.registerName(t, o2);
2483
+ };
2484
+ var Ne = function(e, t) {
2485
+ for (var n, o2 = (null !== (n = t.textContent) && void 0 !== n ? n : "").split(g), r2 = [], s2 = 0, i2 = o2.length; s2 < i2; s2++) {
2486
+ var a2 = o2[s2].trim();
2487
+ if (a2) {
2488
+ var c2 = a2.match(be);
2489
+ if (c2) {
2490
+ var l2 = 0 | parseInt(c2[1], 10), u2 = c2[2];
2491
+ 0 !== l2 && (Se(u2, l2), Ee(e, u2, c2[3]), e.getTag().insertRules(l2, r2)), r2.length = 0;
2492
+ } else
2493
+ r2.push(a2);
2494
+ }
2495
+ }
2496
+ };
2497
+ function Pe() {
2498
+ return "undefined" != typeof __webpack_nonce__ ? __webpack_nonce__ : null;
2499
+ }
2500
+ var _e = function(e) {
2501
+ var t = document.head, n = e || t, o2 = document.createElement("style"), r2 = function(e2) {
2502
+ var t2 = Array.from(e2.querySelectorAll("style[".concat(f, "]")));
2503
+ return t2[t2.length - 1];
2504
+ }(n), s2 = void 0 !== r2 ? r2.nextSibling : null;
2505
+ o2.setAttribute(f, m), o2.setAttribute(y, v);
2506
+ var i2 = Pe();
2507
+ return i2 && o2.setAttribute("nonce", i2), n.insertBefore(o2, s2), o2;
2508
+ };
2509
+ var Ce = function() {
2510
+ function e(e2) {
2511
+ this.element = _e(e2), this.element.appendChild(document.createTextNode("")), this.sheet = function(e3) {
2512
+ if (e3.sheet)
2513
+ return e3.sheet;
2514
+ for (var t = document.styleSheets, n = 0, o2 = t.length; n < o2; n++) {
2515
+ var r2 = t[n];
2516
+ if (r2.ownerNode === e3)
2517
+ return r2;
2518
+ }
2519
+ throw he(17);
2520
+ }(this.element), this.length = 0;
2521
+ }
2522
+ return e.prototype.insertRule = function(e2, t) {
2523
+ try {
2524
+ return this.sheet.insertRule(t, e2), this.length++, true;
2525
+ } catch (e3) {
2526
+ return false;
2527
+ }
2528
+ }, e.prototype.deleteRule = function(e2) {
2529
+ this.sheet.deleteRule(e2), this.length--;
2530
+ }, e.prototype.getRule = function(e2) {
2531
+ var t = this.sheet.cssRules[e2];
2532
+ return t && t.cssText ? t.cssText : "";
2533
+ }, e;
2534
+ }();
2535
+ var Ie = function() {
2536
+ function e(e2) {
2537
+ this.element = _e(e2), this.nodes = this.element.childNodes, this.length = 0;
2538
+ }
2539
+ return e.prototype.insertRule = function(e2, t) {
2540
+ if (e2 <= this.length && e2 >= 0) {
2541
+ var n = document.createTextNode(t);
2542
+ return this.element.insertBefore(n, this.nodes[e2] || null), this.length++, true;
2543
+ }
2544
+ return false;
2545
+ }, e.prototype.deleteRule = function(e2) {
2546
+ this.element.removeChild(this.nodes[e2]), this.length--;
2547
+ }, e.prototype.getRule = function(e2) {
2548
+ return e2 < this.length ? this.nodes[e2].textContent : "";
2549
+ }, e;
2550
+ }();
2551
+ var Ae = function() {
2552
+ function e(e2) {
2553
+ this.rules = [], this.length = 0;
2554
+ }
2555
+ return e.prototype.insertRule = function(e2, t) {
2556
+ return e2 <= this.length && (this.rules.splice(e2, 0, t), this.length++, true);
2557
+ }, e.prototype.deleteRule = function(e2) {
2558
+ this.rules.splice(e2, 1), this.length--;
2559
+ }, e.prototype.getRule = function(e2) {
2560
+ return e2 < this.length ? this.rules[e2] : "";
2561
+ }, e;
2562
+ }();
2563
+ var Oe = S;
2564
+ var De = { isServer: !S, useCSSOMInjection: !w };
2565
+ var Re = function() {
2566
+ function e(e2, n, o2) {
2567
+ void 0 === e2 && (e2 = C), void 0 === n && (n = {});
2568
+ var r2 = this;
2569
+ this.options = __assign(__assign({}, De), e2), this.gs = n, this.names = new Map(o2), this.server = !!e2.isServer, !this.server && S && Oe && (Oe = false, function(e3) {
2570
+ for (var t = document.querySelectorAll(we), n2 = 0, o3 = t.length; n2 < o3; n2++) {
2571
+ var r3 = t[n2];
2572
+ r3 && r3.getAttribute(f) !== m && (Ne(e3, r3), r3.parentNode && r3.parentNode.removeChild(r3));
2573
+ }
2574
+ }(this)), ue(this, function() {
2575
+ return function(e3) {
2576
+ for (var t = e3.getTag(), n2 = t.length, o3 = "", r3 = function(n3) {
2577
+ var r4 = function(e4) {
2578
+ return ye.get(e4);
2579
+ }(n3);
2580
+ if (void 0 === r4)
2581
+ return "continue";
2582
+ var s3 = e3.names.get(r4), i2 = t.getGroup(n3);
2583
+ if (void 0 === s3 || 0 === i2.length)
2584
+ return "continue";
2585
+ var a2 = "".concat(f, ".g").concat(n3, '[id="').concat(r4, '"]'), c2 = "";
2586
+ void 0 !== s3 && s3.forEach(function(e4) {
2587
+ e4.length > 0 && (c2 += "".concat(e4, ","));
2588
+ }), o3 += "".concat(i2).concat(a2, '{content:"').concat(c2, '"}').concat(g);
2589
+ }, s2 = 0; s2 < n2; s2++)
2590
+ r3(s2);
2591
+ return o3;
2592
+ }(r2);
2593
+ });
2594
+ }
2595
+ return e.registerId = function(e2) {
2596
+ return ge(e2);
2597
+ }, e.prototype.reconstructWithOptions = function(n, o2) {
2598
+ return void 0 === o2 && (o2 = true), new e(__assign(__assign({}, this.options), n), this.gs, o2 && this.names || void 0);
2599
+ }, e.prototype.allocateGSInstance = function(e2) {
2600
+ return this.gs[e2] = (this.gs[e2] || 0) + 1;
2601
+ }, e.prototype.getTag = function() {
2602
+ return this.tag || (this.tag = (e2 = function(e3) {
2603
+ var t = e3.useCSSOMInjection, n = e3.target;
2604
+ return e3.isServer ? new Ae(n) : t ? new Ce(n) : new Ie(n);
2605
+ }(this.options), new fe(e2)));
2606
+ var e2;
2607
+ }, e.prototype.hasNameForId = function(e2, t) {
2608
+ return this.names.has(e2) && this.names.get(e2).has(t);
2609
+ }, e.prototype.registerName = function(e2, t) {
2610
+ if (ge(e2), this.names.has(e2))
2611
+ this.names.get(e2).add(t);
2612
+ else {
2613
+ var n = /* @__PURE__ */ new Set();
2614
+ n.add(t), this.names.set(e2, n);
2615
+ }
2616
+ }, e.prototype.insertRules = function(e2, t, n) {
2617
+ this.registerName(e2, t), this.getTag().insertRules(ge(e2), n);
2618
+ }, e.prototype.clearNames = function(e2) {
2619
+ this.names.has(e2) && this.names.get(e2).clear();
2620
+ }, e.prototype.clearRules = function(e2) {
2621
+ this.getTag().clearGroup(ge(e2)), this.clearNames(e2);
2622
+ }, e.prototype.clearTag = function() {
2623
+ this.tag = void 0;
2624
+ }, e;
2625
+ }();
2626
+ var Te = /&/g;
2627
+ var ke = /^\s*\/\/.*$/gm;
2628
+ function je(e, t) {
2629
+ return e.map(function(e2) {
2630
+ return "rule" === e2.type && (e2.value = "".concat(t, " ").concat(e2.value), e2.value = e2.value.replaceAll(",", ",".concat(t, " ")), e2.props = e2.props.map(function(e3) {
2631
+ return "".concat(t, " ").concat(e3);
2632
+ })), Array.isArray(e2.children) && "@keyframes" !== e2.type && (e2.children = je(e2.children, t)), e2;
2633
+ });
2634
+ }
2635
+ function xe(e) {
2636
+ var t, n, o2, r2 = void 0 === e ? C : e, s2 = r2.options, i2 = void 0 === s2 ? C : s2, a2 = r2.plugins, c2 = void 0 === a2 ? _ : a2, l2 = function(e2, o3, r3) {
2637
+ return r3.startsWith(n) && r3.endsWith(n) && r3.replaceAll(n, "").length > 0 ? ".".concat(t) : e2;
2638
+ }, u2 = c2.slice();
2639
+ u2.push(function(e2) {
2640
+ e2.type === RULESET && e2.value.includes("&") && (e2.props[0] = e2.props[0].replace(Te, n).replace(o2, l2));
2641
+ }), i2.prefix && u2.push(prefixer), u2.push(stringify);
2642
+ var p2 = function(e2, r3, s3, a3) {
2643
+ void 0 === r3 && (r3 = ""), void 0 === s3 && (s3 = ""), void 0 === a3 && (a3 = "&"), t = a3, n = r3, o2 = new RegExp("\\".concat(n, "\\b"), "g");
2644
+ var c3 = e2.replace(ke, ""), l3 = compile(s3 || r3 ? "".concat(s3, " ").concat(r3, " { ").concat(c3, " }") : c3);
2645
+ i2.namespace && (l3 = je(l3, i2.namespace));
2646
+ var p3 = [];
2647
+ return serialize(l3, middleware(u2.concat(rulesheet(function(e3) {
2648
+ return p3.push(e3);
2649
+ })))), p3;
2650
+ };
2651
+ return p2.hash = c2.length ? c2.reduce(function(e2, t2) {
2652
+ return t2.name || he(15), M(e2, t2.name);
2653
+ }, F).toString() : "", p2;
2654
+ }
2655
+ var Ve = new Re();
2656
+ var Fe = xe();
2657
+ var Me = import_react6.default.createContext({ shouldForwardProp: void 0, styleSheet: Ve, stylis: Fe });
2658
+ var $e = Me.Consumer;
2659
+ var ze = import_react6.default.createContext(void 0);
2660
+ function Be() {
2661
+ return (0, import_react6.useContext)(Me);
2662
+ }
2663
+ function Le(e) {
2664
+ var t = (0, import_react6.useState)(e.stylisPlugins), n = t[0], r2 = t[1], c2 = Be().styleSheet, l2 = (0, import_react6.useMemo)(function() {
2665
+ var t2 = c2;
2666
+ return e.sheet ? t2 = e.sheet : e.target && (t2 = t2.reconstructWithOptions({ target: e.target }, false)), e.disableCSSOMInjection && (t2 = t2.reconstructWithOptions({ useCSSOMInjection: false })), t2;
2667
+ }, [e.disableCSSOMInjection, e.sheet, e.target, c2]), u2 = (0, import_react6.useMemo)(function() {
2668
+ return xe({ options: { namespace: e.namespace, prefix: e.enableVendorPrefixes }, plugins: n });
2669
+ }, [e.enableVendorPrefixes, e.namespace, n]);
2670
+ (0, import_react6.useEffect)(function() {
2671
+ (0, import_shallowequal.default)(n, e.stylisPlugins) || r2(e.stylisPlugins);
2672
+ }, [e.stylisPlugins]);
2673
+ var d = (0, import_react6.useMemo)(function() {
2674
+ return { shouldForwardProp: e.shouldForwardProp, styleSheet: l2, stylis: u2 };
2675
+ }, [e.shouldForwardProp, l2, u2]);
2676
+ return import_react6.default.createElement(Me.Provider, { value: d }, import_react6.default.createElement(ze.Provider, { value: u2 }, e.children));
2677
+ }
2678
+ var Ge = function() {
2679
+ function e(e2, t) {
2680
+ var n = this;
2681
+ this.inject = function(e3, t2) {
2682
+ void 0 === t2 && (t2 = Fe);
2683
+ var o2 = n.name + t2.hash;
2684
+ e3.hasNameForId(n.id, o2) || e3.insertRules(n.id, o2, t2(n.rules, o2, "@keyframes"));
2685
+ }, this.name = e2, this.id = "sc-keyframes-".concat(e2), this.rules = t, ue(this, function() {
2686
+ throw he(12, String(n.name));
2687
+ });
2688
+ }
2689
+ return e.prototype.getName = function(e2) {
2690
+ return void 0 === e2 && (e2 = Fe), this.name + e2.hash;
2691
+ }, e;
2692
+ }();
2693
+ var Ye = function(e) {
2694
+ return e >= "A" && e <= "Z";
2695
+ };
2696
+ function We(e) {
2697
+ for (var t = "", n = 0; n < e.length; n++) {
2698
+ var o2 = e[n];
2699
+ if (1 === n && "-" === o2 && "-" === e[0])
2700
+ return e;
2701
+ Ye(o2) ? t += "-" + o2.toLowerCase() : t += o2;
2702
+ }
2703
+ return t.startsWith("ms-") ? "-" + t : t;
2704
+ }
2705
+ var qe = function(e) {
2706
+ return null == e || false === e || "" === e;
2707
+ };
2708
+ var He = function(t) {
2709
+ var n, o2, r2 = [];
2710
+ for (var s2 in t) {
2711
+ var i2 = t[s2];
2712
+ t.hasOwnProperty(s2) && !qe(i2) && (Array.isArray(i2) && i2.isCss || re(i2) ? r2.push("".concat(We(s2), ":"), i2, ";") : ce(i2) ? r2.push.apply(r2, __spreadArray(__spreadArray(["".concat(s2, " {")], He(i2), false), ["}"], false)) : r2.push("".concat(We(s2), ": ").concat((n = s2, null == (o2 = i2) || "boolean" == typeof o2 || "" === o2 ? "" : "number" != typeof o2 || 0 === o2 || n in emotion_unitless_esm_default || n.startsWith("--") ? String(o2).trim() : "".concat(o2, "px")), ";")));
2713
+ }
2714
+ return r2;
2715
+ };
2716
+ function Ue(e, t, n, o2) {
2717
+ if (qe(e))
2718
+ return [];
2719
+ if (se(e))
2720
+ return [".".concat(e.styledComponentId)];
2721
+ if (re(e)) {
2722
+ if (!re(s2 = e) || s2.prototype && s2.prototype.isReactComponent || !t)
2723
+ return [e];
2724
+ var r2 = e(t);
2725
+ return "object" != typeof r2 || Array.isArray(r2) || r2 instanceof Ge || ce(r2) || null === r2 || console.error("".concat(B(e), " is not a styled component and cannot be referred to via component selector. See https://www.styled-components.com/docs/advanced#referring-to-other-components for more details.")), Ue(r2, t, n, o2);
2726
+ }
2727
+ var s2;
2728
+ return e instanceof Ge ? n ? (e.inject(n, o2), [e.getName(o2)]) : [e] : ce(e) ? He(e) : Array.isArray(e) ? Array.prototype.concat.apply(_, e.map(function(e2) {
2729
+ return Ue(e2, t, n, o2);
2730
+ })) : [e.toString()];
2731
+ }
2732
+ function Je(e) {
2733
+ for (var t = 0; t < e.length; t += 1) {
2734
+ var n = e[t];
2735
+ if (re(n) && !se(n))
2736
+ return false;
2737
+ }
2738
+ return true;
2739
+ }
2740
+ var Xe = $(v);
2741
+ var Ze = function() {
2742
+ function e(e2, t, n) {
2743
+ this.rules = e2, this.staticRulesId = "", this.isStatic = false, this.componentId = t, this.baseHash = M(Xe, t), this.baseStyle = n, Re.registerId(t);
2744
+ }
2745
+ return e.prototype.generateAndInjectStyles = function(e2, t, n) {
2746
+ var o2 = this.baseStyle ? this.baseStyle.generateAndInjectStyles(e2, t, n) : "";
2747
+ if (this.isStatic && !n.hash)
2748
+ if (this.staticRulesId && t.hasNameForId(this.componentId, this.staticRulesId))
2749
+ o2 = ie(o2, this.staticRulesId);
2750
+ else {
2751
+ var r2 = ae(Ue(this.rules, e2, t, n)), s2 = x(M(this.baseHash, r2) >>> 0);
2752
+ if (!t.hasNameForId(this.componentId, s2)) {
2753
+ var i2 = n(r2, ".".concat(s2), void 0, this.componentId);
2754
+ t.insertRules(this.componentId, s2, i2);
2755
+ }
2756
+ o2 = ie(o2, s2), this.staticRulesId = s2;
2757
+ }
2758
+ else {
2759
+ for (var a2 = M(this.baseHash, n.hash), c2 = "", l2 = 0; l2 < this.rules.length; l2++) {
2760
+ var u2 = this.rules[l2];
2761
+ if ("string" == typeof u2)
2762
+ c2 += u2, a2 = M(a2, u2);
2763
+ else if (u2) {
2764
+ var p2 = ae(Ue(u2, e2, t, n));
2765
+ a2 = M(a2, p2 + l2), c2 += p2;
2766
+ }
2767
+ }
2768
+ if (c2) {
2769
+ var d = x(a2 >>> 0);
2770
+ t.hasNameForId(this.componentId, d) || t.insertRules(this.componentId, d, n(c2, ".".concat(d), void 0, this.componentId)), o2 = ie(o2, d);
2771
+ }
2772
+ }
2773
+ return o2;
2774
+ }, e;
2775
+ }();
2776
+ var Ke = import_react6.default.createContext(void 0);
2777
+ var Qe = Ke.Consumer;
2778
+ var nt = {};
2779
+ var ot = /* @__PURE__ */ new Set();
2780
+ function rt(e, r2, s2) {
2781
+ var i2 = se(e), a2 = e, c2 = !L(e), p2 = r2.attrs, d = void 0 === p2 ? _ : p2, h = r2.componentId, f2 = void 0 === h ? function(e2, t) {
2782
+ var n = "string" != typeof e2 ? "sc" : R(e2);
2783
+ nt[n] = (nt[n] || 0) + 1;
2784
+ var o2 = "".concat(n, "-").concat(z(v + n + nt[n]));
2785
+ return t ? "".concat(t, "-").concat(o2) : o2;
2786
+ }(r2.displayName, r2.parentComponentId) : h, m2 = r2.displayName, y2 = void 0 === m2 ? function(e2) {
2787
+ return L(e2) ? "styled.".concat(e2) : "Styled(".concat(B(e2), ")");
2788
+ }(e) : m2, g2 = r2.displayName && r2.componentId ? "".concat(R(r2.displayName), "-").concat(r2.componentId) : r2.componentId || f2, S2 = i2 && a2.attrs ? a2.attrs.concat(d).filter(Boolean) : d, w2 = r2.shouldForwardProp;
2789
+ if (i2 && a2.shouldForwardProp) {
2790
+ var b = a2.shouldForwardProp;
2791
+ if (r2.shouldForwardProp) {
2792
+ var E2 = r2.shouldForwardProp;
2793
+ w2 = function(e2, t) {
2794
+ return b(e2, t) && E2(e2, t);
2795
+ };
2796
+ } else
2797
+ w2 = b;
2798
+ }
2799
+ var N2 = new Ze(s2, g2, i2 ? a2.componentStyle : void 0);
2800
+ function O2(e2, r3) {
2801
+ return function(e3, r4, s3) {
2802
+ var i3 = e3.attrs, a3 = e3.componentStyle, c3 = e3.defaultProps, p3 = e3.foldedComponentIds, d2 = e3.styledComponentId, h2 = e3.target, f3 = import_react6.default.useContext(Ke), m3 = Be(), y3 = e3.shouldForwardProp || m3.shouldForwardProp;
2803
+ (0, import_react6.useDebugValue)(d2);
2804
+ var v2 = I(r4, f3, c3) || C, g3 = function(e4, n, o2) {
2805
+ for (var r5, s4 = __assign(__assign({}, n), { className: void 0, theme: o2 }), i4 = 0; i4 < e4.length; i4 += 1) {
2806
+ var a4 = re(r5 = e4[i4]) ? r5(s4) : r5;
2807
+ for (var c4 in a4)
2808
+ s4[c4] = "className" === c4 ? ie(s4[c4], a4[c4]) : "style" === c4 ? __assign(__assign({}, s4[c4]), a4[c4]) : a4[c4];
2809
+ }
2810
+ return n.className && (s4.className = ie(s4.className, n.className)), s4;
2811
+ }(i3, r4, v2), S3 = g3.as || h2, w3 = {};
2812
+ for (var b2 in g3)
2813
+ void 0 === g3[b2] || "$" === b2[0] || "as" === b2 || "theme" === b2 && g3.theme === v2 || ("forwardedAs" === b2 ? w3.as = g3.forwardedAs : y3 && !y3(b2, S3) || (w3[b2] = g3[b2], y3 || false || isPropValid(b2) || ot.has(b2) || !A.has(S3) || (ot.add(b2), console.warn('styled-components: it looks like an unknown prop "'.concat(b2, '" is being sent through to the DOM, which will likely trigger a React console error. If you would like automatic filtering of unknown props, you can opt-into that behavior via `<StyleSheetManager shouldForwardProp={...}>` (connect an API like `@emotion/is-prop-valid`) or consider using transient props (`$` prefix for automatic filtering.)')))));
2814
+ var E3 = function(e4, t) {
2815
+ var n = Be(), o2 = e4.generateAndInjectStyles(t, n.styleSheet, n.stylis);
2816
+ return (0, import_react6.useDebugValue)(o2), o2;
2817
+ }(a3, g3);
2818
+ e3.warnTooManyClasses && e3.warnTooManyClasses(E3);
2819
+ var N3 = ie(p3, d2);
2820
+ return E3 && (N3 += " " + E3), g3.className && (N3 += " " + g3.className), w3[L(S3) && !A.has(S3) ? "class" : "className"] = N3, w3.ref = s3, (0, import_react6.createElement)(S3, w3);
2821
+ }(D2, e2, r3);
2822
+ }
2823
+ O2.displayName = y2;
2824
+ var D2 = import_react6.default.forwardRef(O2);
2825
+ return D2.attrs = S2, D2.componentStyle = N2, D2.displayName = y2, D2.shouldForwardProp = w2, D2.foldedComponentIds = i2 ? ie(a2.foldedComponentIds, a2.styledComponentId) : "", D2.styledComponentId = g2, D2.target = i2 ? a2.target : e, Object.defineProperty(D2, "defaultProps", { get: function() {
2826
+ return this._foldedDefaultProps;
2827
+ }, set: function(e2) {
2828
+ this._foldedDefaultProps = i2 ? function(e3) {
2829
+ for (var t = [], n = 1; n < arguments.length; n++)
2830
+ t[n - 1] = arguments[n];
2831
+ for (var o2 = 0, r3 = t; o2 < r3.length; o2++)
2832
+ le(e3, r3[o2], true);
2833
+ return e3;
2834
+ }({}, a2.defaultProps, e2) : e2;
2835
+ } }), P(y2, g2), D2.warnTooManyClasses = /* @__PURE__ */ function(e2, t) {
2836
+ var n = {}, o2 = false;
2837
+ return function(r3) {
2838
+ if (!o2 && (n[r3] = true, Object.keys(n).length >= 200)) {
2839
+ var s3 = t ? ' with the id of "'.concat(t, '"') : "";
2840
+ console.warn("Over ".concat(200, " classes were generated for component ").concat(e2).concat(s3, ".\n") + "Consider using the attrs method, together with a style object for frequently changed styles.\nExample:\n const Component = styled.div.attrs(props => ({\n style: {\n background: props.background,\n },\n }))`width: 100%;`\n\n <Component />"), o2 = true, n = {};
2841
+ }
2842
+ };
2843
+ }(y2, g2), ue(D2, function() {
2844
+ return ".".concat(D2.styledComponentId);
2845
+ }), c2 && oe(D2, e, { attrs: true, componentStyle: true, displayName: true, foldedComponentIds: true, shouldForwardProp: true, styledComponentId: true, target: true }), D2;
2846
+ }
2847
+ function st(e, t) {
2848
+ for (var n = [e[0]], o2 = 0, r2 = t.length; o2 < r2; o2 += 1)
2849
+ n.push(t[o2], e[o2 + 1]);
2850
+ return n;
2851
+ }
2852
+ var it = function(e) {
2853
+ return Object.assign(e, { isCss: true });
2854
+ };
2855
+ function at(t) {
2856
+ for (var n = [], o2 = 1; o2 < arguments.length; o2++)
2857
+ n[o2 - 1] = arguments[o2];
2858
+ if (re(t) || ce(t))
2859
+ return it(Ue(st(_, __spreadArray([t], n, true))));
2860
+ var r2 = t;
2861
+ return 0 === n.length && 1 === r2.length && "string" == typeof r2[0] ? Ue(r2) : it(Ue(st(r2, n)));
2862
+ }
2863
+ function ct(n, o2, r2) {
2864
+ if (void 0 === r2 && (r2 = C), !o2)
2865
+ throw he(1, o2);
2866
+ var s2 = function(t) {
2867
+ for (var s3 = [], i2 = 1; i2 < arguments.length; i2++)
2868
+ s3[i2 - 1] = arguments[i2];
2869
+ return n(o2, r2, at.apply(void 0, __spreadArray([t], s3, false)));
2870
+ };
2871
+ return s2.attrs = function(e) {
2872
+ return ct(n, o2, __assign(__assign({}, r2), { attrs: Array.prototype.concat(r2.attrs, e).filter(Boolean) }));
2873
+ }, s2.withConfig = function(e) {
2874
+ return ct(n, o2, __assign(__assign({}, r2), e));
2875
+ }, s2;
2876
+ }
2877
+ var lt = function(e) {
2878
+ return ct(rt, e);
2879
+ };
2880
+ var ut = lt;
2881
+ A.forEach(function(e) {
2882
+ ut[e] = lt(e);
2883
+ });
2884
+ var pt = function() {
2885
+ function e(e2, t) {
2886
+ this.rules = e2, this.componentId = t, this.isStatic = Je(e2), Re.registerId(this.componentId + 1);
2887
+ }
2888
+ return e.prototype.createStyles = function(e2, t, n, o2) {
2889
+ var r2 = o2(ae(Ue(this.rules, t, n, o2)), ""), s2 = this.componentId + e2;
2890
+ n.insertRules(s2, s2, r2);
2891
+ }, e.prototype.removeStyles = function(e2, t) {
2892
+ t.clearRules(this.componentId + e2);
2893
+ }, e.prototype.renderStyles = function(e2, t, n, o2) {
2894
+ e2 > 2 && Re.registerId(this.componentId + e2), this.removeStyles(e2, n), this.createStyles(e2, t, n, o2);
2895
+ }, e;
2896
+ }();
2897
+ var mt = function() {
2898
+ function e() {
2899
+ var e2 = this;
2900
+ this._emitSheetCSS = function() {
2901
+ var t = e2.instance.toString(), n = Pe(), o2 = ae([n && 'nonce="'.concat(n, '"'), "".concat(f, '="true"'), "".concat(y, '="').concat(v, '"')].filter(Boolean), " ");
2902
+ return "<style ".concat(o2, ">").concat(t, "</style>");
2903
+ }, this.getStyleTags = function() {
2904
+ if (e2.sealed)
2905
+ throw he(2);
2906
+ return e2._emitSheetCSS();
2907
+ }, this.getStyleElement = function() {
2908
+ var n;
2909
+ if (e2.sealed)
2910
+ throw he(2);
2911
+ var r2 = ((n = {})[f] = "", n[y] = v, n.dangerouslySetInnerHTML = { __html: e2.instance.toString() }, n), s2 = Pe();
2912
+ return s2 && (r2.nonce = s2), [import_react6.default.createElement("style", __assign({}, r2, { key: "sc-0-0" }))];
2913
+ }, this.seal = function() {
2914
+ e2.sealed = true;
2915
+ }, this.instance = new Re({ isServer: true }), this.sealed = false;
2916
+ }
2917
+ return e.prototype.collectStyles = function(e2) {
2918
+ if (this.sealed)
2919
+ throw he(2);
2920
+ return import_react6.default.createElement(Le, { sheet: this.instance }, e2);
2921
+ }, e.prototype.interleaveWithNodeStream = function(e2) {
2922
+ throw he(3);
2923
+ }, e;
2924
+ }();
2925
+ "undefined" != typeof navigator && "ReactNative" === navigator.product && console.warn("It looks like you've imported 'styled-components' on React Native.\nPerhaps you're looking to import 'styled-components/native'?\nRead more about this at https://www.styled-components.com/docs/basics#react-native");
2926
+ var vt = "__sc-".concat(f, "__");
2927
+ "undefined" != typeof window && (window[vt] || (window[vt] = 0), 1 === window[vt] && console.warn("It looks like there are several instances of 'styled-components' initialized in this application. This may cause dynamic styles to not render properly, errors during the rehydration process, a missing theme prop, and makes your application bigger without good reason.\n\nSee https://s-c.sh/2BAXzed for more info."), window[vt] += 1);
2928
+
2929
+ // ../../packages/ui/madoc/components/icons/CloseIcon.tsx
2930
+ var import_jsx_runtime22 = require("react/jsx-runtime");
2931
+ var CloseIcon = ut((props) => /* @__PURE__ */ (0, import_jsx_runtime22.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24", viewBox: "0 0 24 24", width: "24", ...props, children: [
2932
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M19 6.41L17.59 5 12 10.59 6.41 5 5 6.41 10.59 12 5 17.59 6.41 19 12 13.41 17.59 19 19 17.59 13.41 12z" }),
2933
+ /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" })
2934
+ ] }))`
2935
+ fill: rgba(0, 0, 0, 0.5);
2936
+ cursor: pointer;
2937
+ &:hover {
2938
+ fill: rgba(0, 0, 0, 1);
2939
+ }
2940
+ ${(props) => props.disabled ? at`
2941
+ pointer-events: none;
2942
+ opacity: 0.6;
2943
+ ` : ""}
2944
+
2945
+ ${(props) => props.$solid && at`
2946
+ fill: #000;
2947
+ `}
2948
+ `;
2949
+
2950
+ // src/components/TourNormalAnnotationEditor.tsx
2951
+ var import_react7 = require("react");
2952
+ var import_react_iiif_vault15 = require("react-iiif-vault");
2953
+
2954
+ // src/components/HTMLAnnotationBodyRender.tsx
2955
+ var import_react_iiif_vault13 = require("react-iiif-vault");
2956
+ var import_jsx_runtime23 = require("react/jsx-runtime");
2957
+ function HTMLAnnotationBodyRender({
2958
+ className,
2959
+ locale
2960
+ }) {
2961
+ const annotation = (0, import_react_iiif_vault13.useAnnotation)();
2962
+ const filteredBodies = locale && annotation ? annotation?.body.filter((body) => {
2963
+ const language = Array.isArray(body.language) ? body.language[0] : body.language;
2964
+ return language === locale;
2965
+ }) : annotation?.body || [];
2966
+ const bodiesToRender = filteredBodies.length ? filteredBodies : locale ? [(annotation?.body || [])[0]] : annotation?.body || [];
2967
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className, children: bodiesToRender.map((body, idx) => {
2968
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
2969
+ "div",
2970
+ {
2971
+ className: "prose-headings:mt-1 prose-headings:mb-1 prose-sm leading-normal",
2972
+ children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { dangerouslySetInnerHTML: { __html: body.value } })
2973
+ },
2974
+ idx
2975
+ );
2976
+ }) });
2977
+ }
2978
+
2979
+ // src/components/HTMLAnnotationEditor.tsx
2980
+ var import_components12 = require("@manifest-editor/components");
2981
+ var import_shell13 = require("@manifest-editor/shell");
2982
+ var import_react_iiif_vault14 = require("react-iiif-vault");
2983
+ var import_jsx_runtime24 = require("react/jsx-runtime");
2984
+ function HTMLAnnotationEditor() {
2985
+ const annotation = (0, import_react_iiif_vault14.useAnnotation)();
2986
+ const creator = (0, import_shell13.useInlineCreator)();
2987
+ const bodies = annotation?.body || [];
2988
+ const editor = (0, import_shell13.useGenericEditor)(annotation);
2989
+ if (!annotation) {
2990
+ return null;
2991
+ }
2992
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: "flex flex-col gap-4", children: [
2993
+ bodies.map((body, n) => {
2994
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
2995
+ AnnotationBodyEditor,
2996
+ {
2997
+ resourceId: body.id,
2998
+ onRemove: () => editor.annotation.body.deleteAtIndex(n)
2999
+ },
3000
+ n
3001
+ );
3002
+ }),
3003
+ /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3004
+ import_components12.ActionButton,
3005
+ {
3006
+ primary: true,
3007
+ onPress: () => {
3008
+ creator.create(
3009
+ "@manifest-editor/html-body-creator",
3010
+ { language: "en", value: "" },
3011
+ {
3012
+ targetType: "ContentResource",
3013
+ parent: {
3014
+ property: "body",
3015
+ resource: {
3016
+ id: annotation.id,
3017
+ type: "Annotation"
3018
+ }
3019
+ },
3020
+ initialData: {}
3021
+ }
3022
+ );
3023
+ },
3024
+ children: "Add new translation"
3025
+ }
3026
+ ) })
3027
+ ] });
3028
+ }
3029
+
3030
+ // src/components/TourNormalAnnotationEditor.tsx
3031
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3032
+ function TourNormalAnnotationEditor({
3033
+ highlightProps
3034
+ }) {
3035
+ const annotation = (0, import_react_iiif_vault15.useAnnotation)();
3036
+ const editor = (0, import_shell14.useGenericEditor)(annotation);
3037
+ const pageEditor = (0, import_shell14.useGenericEditor)((0, import_react_iiif_vault15.useAnnotationPage)());
3038
+ const target = editor.annotation.target.getParsedSelector();
3039
+ const { requestAnnotation, isPending, cancelRequest, busy } = (0, import_shell14.useRequestAnnotation)({
3040
+ onSuccess: (resp) => {
3041
+ if (resp.target) {
3042
+ editor.annotation.target.setSelector(resp.target);
3043
+ }
3044
+ }
3045
+ });
3046
+ function requestAnnotationFromTarget() {
3047
+ if (target) {
3048
+ if (target.type === "SvgSelector") {
3049
+ return requestAnnotation({
3050
+ type: "polygon",
3051
+ open: false,
3052
+ points: target.points
3053
+ });
3054
+ }
3055
+ if (target.type === "PointSelector") {
3056
+ return requestAnnotation({
3057
+ type: "polygon",
3058
+ open: true,
3059
+ points: target.points
3060
+ });
3061
+ }
3062
+ if (target.type === "BoxSelector") {
3063
+ const p2 = target.spatial;
3064
+ return requestAnnotation({
3065
+ type: "polygon",
3066
+ open: false,
3067
+ points: [
3068
+ [p2.x, p2.y],
3069
+ [p2.x + p2.width, p2.y],
3070
+ [p2.x + p2.width, p2.y + p2.height],
3071
+ [p2.x, p2.y + p2.height]
3072
+ ]
3073
+ });
3074
+ }
3075
+ }
3076
+ return requestAnnotation({ type: "polygon", open: true, points: [] });
3077
+ }
3078
+ const deleteAnnotation = () => {
3079
+ if (annotation && confirm("Are you sure you want to delete this annotation?")) {
3080
+ const index = pageEditor.structural.items.getWithoutTracking().findIndex((item) => item.id === annotation.id);
3081
+ pageEditor.structural.items.deleteAtIndex(index);
3082
+ }
3083
+ };
3084
+ const [isOpen, setIsOpen] = (0, import_react7.useState)(false);
3085
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(
3086
+ "div",
3087
+ {
3088
+ ...highlightProps,
3089
+ className: "border border-gray-300 p-3 hover:border-me-500 shadow-sm rounded bg-white relative",
3090
+ children: [
3091
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
3092
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.ActionButton, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.DeleteForeverIcon, {}) }),
3093
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.ActionButton, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components14.ListEditIcon, {}) })
3094
+ ] }),
3095
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: "mb-2 relative", children: [
3096
+ isOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(import_jsx_runtime25.Fragment, { children: [
3097
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
3098
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(HTMLAnnotationEditor, {})
3099
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_jsx_runtime25.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3100
+ HTMLAnnotationBodyRender,
3101
+ {
3102
+ className: "line-clamp-3 prose-p:text-slate-600",
3103
+ locale: "en"
3104
+ }
3105
+ ) }),
3106
+ !isOpen ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { children: isPending ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(import_components13.ActionButton, { onPress: cancelRequest, children: "Discard changes" }) : /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3107
+ import_components13.ActionButton,
3108
+ {
3109
+ isDisabled: busy,
3110
+ onPress: requestAnnotationFromTarget,
3111
+ children: "Edit region"
3112
+ }
3113
+ ) }) : null
3114
+ ] }),
3115
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("div", { className: "absolute -bottom-5 h-5 border-l-2 border-gray-300 w-0" })
3116
+ ]
3117
+ }
3118
+ );
3119
+ }
3120
+
3121
+ // src/components/TourPaintingAnnotationEditor.tsx
3122
+ var import_components15 = require("@manifest-editor/components");
3123
+ var import_editors9 = require("@manifest-editor/editors");
3124
+ var import_components16 = require("@manifest-editor/manifest-preset/components");
3125
+ var import_shell15 = require("@manifest-editor/shell");
3126
+ var import_react8 = require("react");
3127
+ var import_react_iiif_vault16 = require("react-iiif-vault");
3128
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3129
+ function TourPaintingAnnotationEditor({
3130
+ originalAnnotationId,
3131
+ highlightProps
3132
+ }) {
3133
+ const page = (0, import_react_iiif_vault16.useAnnotationPage)();
3134
+ const pageEditor = (0, import_shell15.useGenericEditor)(page);
3135
+ const annotation = (0, import_react_iiif_vault16.useAnnotation)();
3136
+ const { edit } = (0, import_shell15.useLayoutActions)();
3137
+ const [isOpen, setIsOpen] = (0, import_react8.useState)(false);
3138
+ const deleteAnnotation = () => {
3139
+ if (originalAnnotationId && confirm("Are you sure you want to delete this annotation?")) {
3140
+ const index = pageEditor.structural.items.getWithoutTracking().findIndex((item) => item.id === originalAnnotationId);
3141
+ pageEditor.structural.items.deleteAtIndex(index);
3142
+ }
3143
+ };
3144
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(
3145
+ "div",
3146
+ {
3147
+ ...highlightProps,
3148
+ className: "border border-gray-300 hover:border-me-500 shadow-sm rounded p-3 bg-white relative",
3149
+ children: [
3150
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)("div", { className: "absolute top-1 right-1 z-20 flex gap-2", children: [
3151
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components15.ActionButton, { onPress: () => deleteAnnotation(), children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components15.DeleteForeverIcon, {}) }),
3152
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components15.ActionButton, { onPress: () => setIsOpen((o2) => !o2), children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(CloseIcon, {}) : /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components16.ListEditIcon, {}) })
3153
+ ] }),
3154
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex gap-2 mb-2", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "flex-1 min-w-0", children: isOpen ? /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3155
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("h3", { className: "text-lg font-semibold border-b pt-1 pb-2 mb-2", children: "Edit step" }),
3156
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_editors9.LanguageMapEditor, { dispatchType: "label" }),
3157
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_editors9.LanguageMapEditor, { dispatchType: "summary" })
3158
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(import_jsx_runtime26.Fragment, { children: [
3159
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3160
+ import_react_iiif_vault16.LocaleString,
3161
+ {
3162
+ as: "div",
3163
+ className: "whitespace-nowrap overflow-ellipsis w-full overflow-x-hidden",
3164
+ children: annotation?.label
3165
+ }
3166
+ ),
3167
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3168
+ import_react_iiif_vault16.LocaleString,
3169
+ {
3170
+ className: "text-gray-500 text-sm bg-white line-clamp-2",
3171
+ as: "div",
3172
+ children: annotation?.label
3173
+ }
3174
+ )
3175
+ ] }) }) }),
3176
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(import_components15.ActionButton, { onPress: () => edit(annotation), children: "Edit target annotation" }),
3177
+ /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("div", { className: "absolute -bottom-5 h-8 -z-10 border-l-2 border-gray-300 w-0" })
3178
+ ]
3179
+ }
3180
+ );
3181
+ }
3182
+
3183
+ // src/components/TourAnnotationEditor.tsx
3184
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3185
+ function TourAnnotationEditor() {
3186
+ const [annotation, { annotationTarget, highlightProps }] = (0, import_editors10.useAnnotationInfo)();
3187
+ const resource = (0, import_react9.useMemo)(() => {
3188
+ if (annotationTarget) {
3189
+ return { id: annotationTarget, type: "Annotation" };
3190
+ }
3191
+ return { id: annotation?.id, type: "Annotation" };
3192
+ }, [annotation?.id, annotationTarget]);
3193
+ if (annotationTarget) {
3194
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_shell16.ResourceEditingProvider, { resource, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_react_iiif_vault17.AnnotationContext, { annotation: annotationTarget, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3195
+ TourPaintingAnnotationEditor,
3196
+ {
3197
+ originalAnnotationId: annotation?.id,
3198
+ highlightProps
3199
+ }
3200
+ ) }) });
3201
+ }
3202
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(import_shell16.ResourceEditingProvider, { resource, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(TourNormalAnnotationEditor, { highlightProps }) });
3203
+ }
3204
+
3205
+ // src/components/TourAnnotationPageEditor.tsx
3206
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3207
+ function TourAnnotationPageEditor({
3208
+ reorderable = false
3209
+ }) {
3210
+ const page = (0, import_react_iiif_vault18.useAnnotationPage)();
3211
+ const editor = (0, import_shell17.useGenericEditor)(page);
3212
+ if (!page) {
3213
+ return null;
3214
+ }
3215
+ if (!reorderable) {
3216
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: page.items.map((annotation) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_iiif_vault18.AnnotationContext, { annotation: annotation.id, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TourAnnotationEditor, {}) }, annotation.id)) });
3217
+ }
3218
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_jsx_runtime28.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3219
+ import_editors11.ReorderList,
3220
+ {
3221
+ id: page.id,
3222
+ marginBottom: "0.5em",
3223
+ items: page.items || [],
3224
+ inlineHandle: false,
3225
+ reorder: ({ startIndex, endIndex }) => editor.structural.items.reorder(startIndex, endIndex),
3226
+ renderItem: (ref, index) => /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(import_react_iiif_vault18.AnnotationContext, { annotation: ref.id, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(TourAnnotationEditor, {}) })
3227
+ }
3228
+ ) });
3229
+ }
3230
+
3231
+ // src/right-panels/ExhibitionTourSteps.tsx
3232
+ var import_jsx_runtime29 = require("react/jsx-runtime");
3233
+ var exhibitionTourSteps = {
3234
+ id: "@exhibition/tour-steps",
3235
+ supports: {
3236
+ edit: true,
3237
+ properties: ["annotations"],
3238
+ resourceTypes: ["Canvas"],
3239
+ custom: ({ resource }, vault) => {
3240
+ const full = vault.get(resource);
3241
+ const stats = getGridStats(full.behavior);
3242
+ if (full.type === "Canvas" && !stats.isInfo && !stats.isBottom) {
3243
+ return true;
3244
+ }
3245
+ return false;
3246
+ }
3247
+ },
3248
+ label: "Tour steps",
3249
+ component: () => /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ExhibitionRightPanelOptionalPage, {})
3250
+ };
3251
+ function ExhibitionRightPanelOptionalPage() {
3252
+ const canvas = (0, import_react_iiif_vault19.useCanvas)();
3253
+ const firstAnnotationPage = canvas?.annotations[0];
3254
+ const itemsAnnotationPage = canvas?.items[0];
3255
+ if (!firstAnnotationPage || !canvas || !itemsAnnotationPage) {
3256
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(PromptCreationOfTourSteps, {});
3257
+ }
3258
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(ExhibitionRightPanel3, {});
3259
+ }
3260
+ function PromptCreationOfTourSteps() {
3261
+ const canvas = (0, import_react_iiif_vault19.useCanvas)();
3262
+ const creator = (0, import_shell18.useInlineCreator)();
3263
+ const createEmptyAnnotationPage = () => {
3264
+ if (!canvas)
3265
+ return;
3266
+ creator.create(
3267
+ "@manifest-editor/empty-annotation-page",
3268
+ {
3269
+ label: { en: ["Tour steps"] }
3270
+ },
3271
+ {
3272
+ target: {
3273
+ id: canvas.id,
3274
+ type: "Canvas"
3275
+ },
3276
+ targetType: "AnnotationPage",
3277
+ parent: {
3278
+ property: "annotations",
3279
+ resource: {
3280
+ id: canvas.id,
3281
+ type: "Canvas"
3282
+ }
3283
+ }
3284
+ }
3285
+ );
3286
+ };
3287
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col items-center justify-center p-4", children: [
3288
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { className: "p-4 opacity-50 text-center", children: "This image does not yet have a tour." }),
3289
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3290
+ import_react_aria_components2.Button,
3291
+ {
3292
+ className: "border w-full disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500",
3293
+ onPress: () => createEmptyAnnotationPage(),
3294
+ children: "Create Tour"
3295
+ }
3296
+ )
3297
+ ] });
3298
+ }
3299
+ function ExhibitionRightPanel3() {
3300
+ const canvas = (0, import_react_iiif_vault19.useCanvas)();
3301
+ const firstAnnotationPage = canvas?.annotations[0];
3302
+ const itemsAnnotationPage = canvas?.items[0];
3303
+ const editor = (0, import_shell18.useGenericEditor)(firstAnnotationPage);
3304
+ const creator = (0, import_shell18.useInlineCreator)();
3305
+ const [reorderable, setReorderable] = (0, import_react10.useState)(false);
3306
+ const { requestAnnotation, isPending, busy, cancelRequest, completeRequest } = (0, import_shell18.useRequestAnnotation)({
3307
+ onSuccess: (resp) => {
3308
+ if (!resp.cancelled && resp.target && firstAnnotationPage) {
3309
+ creator.create(
3310
+ "@manifest-editor/html-annotation",
3311
+ {
3312
+ label: { en: ["Tour step"] },
3313
+ body: { en: ["<h2>New step</h2><p>Description</p>"] },
3314
+ motivation: "describing"
3315
+ },
3316
+ {
3317
+ target: {
3318
+ id: canvas.id,
3319
+ type: "Canvas"
3320
+ },
3321
+ targetType: "Annotation",
3322
+ parent: {
3323
+ property: "items",
3324
+ resource: {
3325
+ id: firstAnnotationPage.id,
3326
+ type: "AnnotationPage"
3327
+ }
3328
+ },
3329
+ initialData: {
3330
+ selector: resp.target.type === "SvgSelector" ? {
3331
+ type: "polygon",
3332
+ shape: resp.polygon
3333
+ } : resp.boundingBox
3334
+ }
3335
+ }
3336
+ );
3337
+ }
3338
+ }
3339
+ });
3340
+ if (!canvas)
3341
+ return null;
3342
+ if (!firstAnnotationPage) {
3343
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("div", { children: "No annotation page - create one?" });
3344
+ }
3345
+ return /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components17.Sidebar, { children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_components17.SidebarContent, { padding: true, children: [
3346
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex gap-4 border-b pt-4 pb-2 mb-2", children: [
3347
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h2", { className: "text-lg font-semibold flex-1", children: "Tour steps" }),
3348
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_components17.ActionButton, { onPress: () => setReorderable((r2) => !r2), children: reorderable ? "Done" : "Reorder" })
3349
+ ] }),
3350
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(import_shell18.ResourceEditingProvider, { resource: canvas, children: /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_react_iiif_vault19.AnnotationPageContext, { annotationPage: firstAnnotationPage.id, children: [
3351
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "flex flex-col gap-4", children: [
3352
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(TourAnnotationPageEditor, { reorderable }),
3353
+ !busy ? isPending ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)("div", { className: "border grid grid-cols-2 gap-2 disabled:opacity-50 border-gray-300 shadow-sm rounded p-1 bg-white relative text-black/40", children: [
3354
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3355
+ import_react_aria_components2.Button,
3356
+ {
3357
+ onPress: cancelRequest,
3358
+ className: "text-black/80 rounded-sm p-3",
3359
+ children: "Cancel"
3360
+ }
3361
+ ),
3362
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3363
+ import_react_aria_components2.Button,
3364
+ {
3365
+ onPress: completeRequest,
3366
+ className: "bg-me-100 text-me-500 rounded-sm p-3",
3367
+ children: "Save changes"
3368
+ }
3369
+ )
3370
+ ] }) : /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3371
+ import_react_aria_components2.Button,
3372
+ {
3373
+ onPress: () => requestAnnotation({ type: "polygon" }),
3374
+ className: "border disabled:opacity-50 border-gray-300 hover:border-me-500 hover:bg-me-50 cursor-pointer shadow-sm rounded p-4 bg-white relative text-black/40 hover:text-me-500",
3375
+ children: "+ Add new step"
3376
+ }
3377
+ ) : null
3378
+ ] }),
3379
+ itemsAnnotationPage ? /* @__PURE__ */ (0, import_jsx_runtime29.jsxs)(import_jsx_runtime29.Fragment, { children: [
3380
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)("h3", { className: "text-md border-b pt-4 pb-2 mb-2", children: "Available tour steps from images" }),
3381
+ /* @__PURE__ */ (0, import_jsx_runtime29.jsx)(
3382
+ import_editors12.PromptToAddPaintingAnnotations,
3383
+ {
3384
+ painting: itemsAnnotationPage,
3385
+ page: editor.ref(),
3386
+ canvasId: canvas.id
3387
+ }
3388
+ )
3389
+ ] }) : null
3390
+ ] }) })
3391
+ ] }) });
3392
+ }
3393
+
3394
+ // src/index.tsx
3395
+ var exhibitionEditorPreset = (0, import_shell19.extendApp)(
3396
+ (0, import_shell19.mapApp)(ManifestPreset),
3397
+ {
3398
+ id: "exhibition-editor",
3399
+ title: "Exhibition Editor",
3400
+ project: true,
3401
+ projectType: "Manifest"
3402
+ },
3403
+ {
3404
+ config: {
3405
+ editorConfig: {
3406
+ Canvas: {
3407
+ hideTabs: [
3408
+ "@manifest-editor/overview",
3409
+ "@manifest-editor/technical-properties",
3410
+ "@manifest-editor/linking-properties",
3411
+ "@manifest-editor/nav-place-editor",
3412
+ "@manifest-editor/canvas-structural",
3413
+ "@manifest-editor/descriptive-properties",
3414
+ "@manifest-editor/overview-canvas-editor",
3415
+ "@manifest-editor/metadata"
3416
+ ]
3417
+ }
3418
+ }
3419
+ },
3420
+ leftPanels: [
3421
+ //
3422
+ exhibitionGridLeftPanel
3423
+ ],
3424
+ annotations: [
3425
+ //
3426
+ tourStepAnnotations
3427
+ ],
3428
+ leftPanelIds: ["left-panel-manifest"],
3429
+ canvasEditors: [
3430
+ //
3431
+ imageBlockEditor,
3432
+ youtubeMainEdtior,
3433
+ infoBlockEditor
3434
+ ],
3435
+ editors: [exhibitionCanvasEditor, customBehaviourEditor, exhibitionSummaryEdtior, exhibitionTourSteps],
3436
+ creators: [
3437
+ infoBoxCreator,
3438
+ imageSlideBottomCreator,
3439
+ imageSlideCreator,
3440
+ imageSlideLeftCreator,
3441
+ imageSlideRightCreator,
3442
+ youtubeSlideCreator
3443
+ ]
3444
+ }
3445
+ );