@manifest-editor/creators 1.4.3 → 2.0.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.
Files changed (90) hide show
  1. package/dist/iiif-browser-form.lazy-Cd6PPal4.js +2 -0
  2. package/dist/iiif-browser-form.lazy-Cd6PPal4.js.map +1 -0
  3. package/dist/iiif-browser-form.lazy-ClG8j2rW.cjs +1 -0
  4. package/dist/index.cjs +19 -2675
  5. package/dist/index.css +749 -0
  6. package/dist/index.css.map +1 -0
  7. package/dist/index.d.cts +371 -292
  8. package/dist/index.d.cts.map +1 -0
  9. package/dist/index.d.ts +371 -292
  10. package/dist/index.d.ts.map +1 -0
  11. package/dist/index.js +20 -2526
  12. package/dist/index.js.map +1 -0
  13. package/dist/manifest-browser-form.lazy-CAGYyvpq.js +1 -0
  14. package/dist/manifest-browser-form.lazy-CltTDJDG.cjs +1 -0
  15. package/dist/manifest-browser-form.lazy-D0tGSif3.js +2 -0
  16. package/dist/manifest-browser-form.lazy-D0tGSif3.js.map +1 -0
  17. package/dist/manifest-browser-form.lazy-DCK3t-EC.cjs +1 -0
  18. package/package.json +28 -32
  19. package/dist/chunk-2B2F7X4A.js +0 -59
  20. package/dist/chunk-5YV7MYAZ.js +0 -60
  21. package/dist/chunk-7FSKLOVQ.js +0 -33
  22. package/dist/chunk-AVISJS46.js +0 -50
  23. package/dist/chunk-CYVZA2MU.js +0 -59
  24. package/dist/chunk-ES62IRNT.js +0 -50
  25. package/dist/chunk-KLSWX2QF.js +0 -38
  26. package/dist/chunk-PFQB3PNW.js +0 -47
  27. package/dist/chunk-S3JO5Y3Z.js +0 -50
  28. package/dist/chunk-W4PYM3PN.js +0 -59
  29. package/dist/iiif-browser-form.lazy-3EZNJN4M.js +0 -21
  30. package/dist/iiif-browser-form.lazy-3INAWCE5.js +0 -54
  31. package/dist/iiif-browser-form.lazy-3YUQOIEL.js +0 -21
  32. package/dist/iiif-browser-form.lazy-4CDWA6JD.js +0 -47
  33. package/dist/iiif-browser-form.lazy-4NX7YPGK.js +0 -57
  34. package/dist/iiif-browser-form.lazy-4X5LD2U4.js +0 -51
  35. package/dist/iiif-browser-form.lazy-5TF74M2Q.js +0 -48
  36. package/dist/iiif-browser-form.lazy-B2RXVKR5.js +0 -21
  37. package/dist/iiif-browser-form.lazy-BHX6TGDY.js +0 -58
  38. package/dist/iiif-browser-form.lazy-C72INDSJ.js +0 -57
  39. package/dist/iiif-browser-form.lazy-DCCYGD42.js +0 -35
  40. package/dist/iiif-browser-form.lazy-DKKTAIO5.js +0 -59
  41. package/dist/iiif-browser-form.lazy-DPRO7R2W.js +0 -59
  42. package/dist/iiif-browser-form.lazy-DU2NJUCE.js +0 -46
  43. package/dist/iiif-browser-form.lazy-DUTUHLUT.js +0 -50
  44. package/dist/iiif-browser-form.lazy-EJZ754MG.js +0 -42
  45. package/dist/iiif-browser-form.lazy-ENQRBLTJ.js +0 -21
  46. package/dist/iiif-browser-form.lazy-EREIP6PZ.js +0 -58
  47. package/dist/iiif-browser-form.lazy-FMKQQWDE.js +0 -33
  48. package/dist/iiif-browser-form.lazy-FOIWPPI7.js +0 -47
  49. package/dist/iiif-browser-form.lazy-FQDZQ3UW.js +0 -58
  50. package/dist/iiif-browser-form.lazy-G7TCZSC2.js +0 -58
  51. package/dist/iiif-browser-form.lazy-G7XAQYYG.js +0 -51
  52. package/dist/iiif-browser-form.lazy-GO6U6NE5.js +0 -32
  53. package/dist/iiif-browser-form.lazy-GVEEZX37.js +0 -33
  54. package/dist/iiif-browser-form.lazy-HBWB7QGF.js +0 -31
  55. package/dist/iiif-browser-form.lazy-HZ3M2DXT.js +0 -57
  56. package/dist/iiif-browser-form.lazy-I7KTYV3O.js +0 -57
  57. package/dist/iiif-browser-form.lazy-I7ZNZHID.js +0 -48
  58. package/dist/iiif-browser-form.lazy-IX5DFVDG.js +0 -47
  59. package/dist/iiif-browser-form.lazy-JMT72BLP.js +0 -59
  60. package/dist/iiif-browser-form.lazy-JX4S6NGX.js +0 -48
  61. package/dist/iiif-browser-form.lazy-KPB57B25.js +0 -21
  62. package/dist/iiif-browser-form.lazy-KTB4BQBM.js +0 -59
  63. package/dist/iiif-browser-form.lazy-KYOKLDRV.js +0 -47
  64. package/dist/iiif-browser-form.lazy-NDPLPCQQ.js +0 -43
  65. package/dist/iiif-browser-form.lazy-O35TC45U.js +0 -49
  66. package/dist/iiif-browser-form.lazy-OMDV43NQ.js +0 -51
  67. package/dist/iiif-browser-form.lazy-OQLU6NDJ.js +0 -51
  68. package/dist/iiif-browser-form.lazy-OXQVZ3GS.js +0 -59
  69. package/dist/iiif-browser-form.lazy-OZNQO2OO.js +0 -21
  70. package/dist/iiif-browser-form.lazy-PL3WMLU5.js +0 -33
  71. package/dist/iiif-browser-form.lazy-QR55LXI4.js +0 -21
  72. package/dist/iiif-browser-form.lazy-R5TMXUBV.js +0 -19
  73. package/dist/iiif-browser-form.lazy-RWEJWTIW.js +0 -21
  74. package/dist/iiif-browser-form.lazy-T6LT6BJD.js +0 -48
  75. package/dist/iiif-browser-form.lazy-TWQYATEG.js +0 -21
  76. package/dist/iiif-browser-form.lazy-UPZXU6JB.js +0 -51
  77. package/dist/iiif-browser-form.lazy-W42LJ6X2.js +0 -47
  78. package/dist/iiif-browser-form.lazy-WAK45BLF.js +0 -42
  79. package/dist/iiif-browser-form.lazy-WVCVE6XK.js +0 -21
  80. package/dist/iiif-browser-form.lazy-XORWZFSW.js +0 -49
  81. package/dist/manifest-browser-form.lazy-4CFTHOMZ.js +0 -6
  82. package/dist/manifest-browser-form.lazy-5JVKGB7O.js +0 -6
  83. package/dist/manifest-browser-form.lazy-ALVCNMEV.js +0 -6
  84. package/dist/manifest-browser-form.lazy-FI4GGCPX.js +0 -6
  85. package/dist/manifest-browser-form.lazy-HJJKFMR6.js +0 -6
  86. package/dist/manifest-browser-form.lazy-MYI26AX4.js +0 -6
  87. package/dist/manifest-browser-form.lazy-QGTJHSSC.js +0 -6
  88. package/dist/manifest-browser-form.lazy-WRWZPVRC.js +0 -6
  89. package/dist/manifest-browser-form.lazy-XVYSAQAW.js +0 -6
  90. package/dist/manifest-browser-form.lazy-YYKOYF7R.js +0 -6
package/dist/index.js CHANGED
@@ -1,75 +1,9 @@
1
- import {
2
- ManifestBrowserCreatorForm
3
- } from "./chunk-CYVZA2MU.js";
4
-
5
- // src/Annotation/AudioAnnotation/index.tsx
6
- import { AudioIcon } from "@manifest-editor/components";
7
- import { defineCreator } from "@manifest-editor/creator-api";
8
-
9
- // src/Annotation/AudioAnnotation/create-audio-annotation.tsx
10
- import { getValue } from "@iiif/helpers";
11
- import { ActionButton, ErrorMessage } from "@manifest-editor/components";
12
- import { FormFieldWrapper, Input, InputContainer, InputLabel, LanguageFieldEditor } from "@manifest-editor/editors";
13
-
14
- // ../ui/ui/MediaControls/MediaControls.tsx
15
- import { formatTime, useMediaActions, useMediaElements, useMediaState } from "react-iiif-vault";
16
- import { useLayoutEffect, useState } from "react";
17
-
18
- // ../ui/ui/MediaControls/MediaControls.icons.tsx
19
- import { jsx, jsxs } from "react/jsx-runtime";
20
- var PlayIcon = (props) => /* @__PURE__ */ jsxs("svg", { ...props, viewBox: "4 4 16 16", xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", children: [
21
- props.title ? /* @__PURE__ */ jsx("title", { children: props.title }) : null,
22
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
23
- /* @__PURE__ */ jsx("path", { d: "M8 5v14l11-7z", fill: "currentColor" })
24
- ] });
25
- var PauseIcon = (props) => /* @__PURE__ */ jsxs("svg", { ...props, viewBox: "4 4 16 16", xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", children: [
26
- props.title ? /* @__PURE__ */ jsx("title", { children: props.title }) : null,
27
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
28
- /* @__PURE__ */ jsx("path", { fill: "currentColor", d: "M6 19h4V5H6v14zm8-14v14h4V5h-4z" })
29
- ] });
30
- var VolumeUpIcon = ({ title, ...props }) => /* @__PURE__ */ jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "2 2 20 20", children: [
31
- title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
32
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
33
- /* @__PURE__ */ jsx(
34
- "path",
35
- {
36
- fill: "currentColor",
37
- d: "M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z"
38
- }
39
- )
40
- ] });
41
- var VolumeDownIcon = ({ title, ...props }) => /* @__PURE__ */ jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "2 2 20 20", children: [
42
- title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
43
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
44
- /* @__PURE__ */ jsx(
45
- "path",
46
- {
47
- fill: "currentColor",
48
- d: "M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z"
49
- }
50
- )
51
- ] });
52
- var VolumeOffIcon = ({ title, ...props }) => /* @__PURE__ */ jsxs("svg", { ...props, xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "2 2 20 20", children: [
53
- title ? /* @__PURE__ */ jsx("title", { children: title }) : null,
54
- /* @__PURE__ */ jsx("path", { d: "M0 0h24v24H0z", fill: "none" }),
55
- /* @__PURE__ */ jsx(
56
- "path",
57
- {
58
- fill: "currentColor",
59
- d: "M16.5 12A4.5 4.5 0 0 0 14 7.97v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51A8.796 8.796 0 0 0 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06a8.99 8.99 0 0 0 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4 9.91 6.09 12 8.18V4z"
60
- }
61
- )
62
- ] });
63
-
64
- // ../ui/ui/MediaControls/MediaControls.styles.ts
65
- import styled, { css } from "styled-components";
66
- var AudioPlayerContainer = styled.div`
1
+ import{t as e}from"./manifest-browser-form.lazy-D0tGSif3.js";import{ActionButton as t,AddImageIcon as n,AudioIcon as r,EmptyCanvasIcon as i,ErrorMessage as a,Form as o,HTMLEditor as s,HTMLIcon as c,IIIFBrowserIcon as l,IIIFLogo as u,ImageListIcon as d,PaddedSidebarContainer as f,RangesIcon as p,ScaledImageIcon as m,VideoIcon as h,YouTubeIcon as ee}from"@manifest-editor/components";import{creatorHelper as g,defineCreator as _}from"@manifest-editor/creator-api";import{Vault as te,createThumbnailHelper as ne,getValue as v}from"@iiif/helpers";import{DimensionsTriplet as re,FormFieldWrapper as ie,Input as y,InputContainer as b,InputLabel as x,LanguageFieldEditor as S,centerRectangles as ae}from"@manifest-editor/editors";import{CanvasPanel as oe,ImageService as se,MediaPlayerProvider as ce,VaultProvider as le,formatTime as ue,useManifest as de,useMediaActions as fe,useMediaElements as pe,useMediaState as me,useSimpleMediaPlayer as he,useVault as ge}from"react-iiif-vault";import{lazy as _e,useEffect as ve,useLayoutEffect as ye,useMemo as C,useState as w}from"react";import{Fragment as be,jsx as T,jsxs as E}from"react/jsx-runtime";import D,{css as xe}from"styled-components";import{getFormat as Se,getImageDimensions as Ce,useAnnotationCreatorState as we,useConfig as Te}from"@manifest-editor/shell";import{canonicalServiceUrl as Ee,createImageServiceRequest as De,getImageServices as Oe,imageServiceRequestToString as O,isImageService as ke,parseImageServiceRequest as Ae}from"@iiif/parser/image-3";import{EditorInstance as je}from"@manifest-editor/editor-api";import{ErrorBoundary as Me}from"react-error-boundary";import{IIIFBrowser as Ne}from"iiif-browser";const Pe=e=>E(`svg`,{...e,viewBox:`4 4 16 16`,xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,children:[e.title?T(`title`,{children:e.title}):null,T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{d:`M8 5v14l11-7z`,fill:`currentColor`})]}),Fe=e=>E(`svg`,{...e,viewBox:`4 4 16 16`,xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,children:[e.title?T(`title`,{children:e.title}):null,T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{fill:`currentColor`,d:`M6 19h4V5H6v14zm8-14v14h4V5h-4z`})]}),Ie=({title:e,...t})=>E(`svg`,{...t,xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,viewBox:`2 2 20 20`,children:[e?T(`title`,{children:e}):null,T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{fill:`currentColor`,d:`M3 9v6h4l5 5V4L7 9H3zm13.5 3A4.5 4.5 0 0 0 14 7.97v8.05c1.48-.73 2.5-2.25 2.5-4.02zM14 3.23v2.06c2.89.86 5 3.54 5 6.71s-2.11 5.85-5 6.71v2.06c4.01-.91 7-4.49 7-8.77s-2.99-7.86-7-8.77z`})]}),Le=({title:e,...t})=>E(`svg`,{...t,xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,viewBox:`2 2 20 20`,children:[e?T(`title`,{children:e}):null,T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{fill:`currentColor`,d:`M18.5 12c0-1.77-1.02-3.29-2.5-4.03v8.05c1.48-.73 2.5-2.25 2.5-4.02zM5 9v6h4l5 5V4L9 9H5z`})]}),Re=({title:e,...t})=>E(`svg`,{...t,xmlns:`http://www.w3.org/2000/svg`,height:`1em`,width:`1em`,viewBox:`2 2 20 20`,children:[e?T(`title`,{children:e}):null,T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{fill:`currentColor`,d:`M16.5 12A4.5 4.5 0 0 0 14 7.97v2.21l2.45 2.45c.03-.2.05-.41.05-.63zm2.5 0c0 .94-.2 1.82-.54 2.64l1.51 1.51A8.796 8.796 0 0 0 21 12c0-4.28-2.99-7.86-7-8.77v2.06c2.89.86 5 3.54 5 6.71zM4.27 3 3 4.27 7.73 9H3v6h4l5 5v-6.73l4.25 4.25c-.67.52-1.42.93-2.25 1.18v2.06a8.99 8.99 0 0 0 3.69-1.81L19.73 21 21 19.73l-9-9L4.27 3zM12 4 9.91 6.09 12 8.18V4z`})]}),ze=D.div`
67
2
  background: #ededed; // Not in variable.
68
3
  display: flex;
69
4
  padding: 0.5em;
70
5
  align-items: center;
71
- `;
72
- var BaseButton = styled.button`
6
+ `,k=D.button`
73
7
  cursor: pointer;
74
8
  padding: 0.75em 1.5em;
75
9
  font-size: 0.938em;
@@ -80,8 +14,7 @@ var BaseButton = styled.button`
80
14
  display: inline-block;
81
15
  vertical-align: top;
82
16
  white-space: nowrap;
83
- `;
84
- var PlayButton = styled(BaseButton)`
17
+ `,Be=D(k)`
85
18
  width: 2em;
86
19
  height: 2em;
87
20
  overflow: hidden;
@@ -95,20 +28,17 @@ var PlayButton = styled(BaseButton)`
95
28
  &:disabled {
96
29
  color: #999;
97
30
  }
98
- `;
99
- var TimeDisplay = styled.div`
31
+ `,A=D.div`
100
32
  margin: 0 1em;
101
33
  font-size: 0.85em;
102
34
  color: #000;
103
- `;
104
- var ProgressContainer = styled.div`
35
+ `,Ve=D.div`
105
36
  flex: 1 1 0px;
106
37
  height: 6px;
107
38
  display: flex;
108
39
  position: relative;
109
40
  padding: 15px 0;
110
- `;
111
- var ProgressCurrent = styled.div`
41
+ `,He=D.div`
112
42
  background: #d85680;
113
43
  height: 6px;
114
44
  pointer-events: none;
@@ -117,8 +47,7 @@ var ProgressCurrent = styled.div`
117
47
  left: 0;
118
48
  border-radius: 3px;
119
49
  transition: width 200ms;
120
- `;
121
- var ProgressBackground = styled.div`
50
+ `,Ue=D.div`
122
51
  position: absolute;
123
52
  top: 13px;
124
53
  left: 0;
@@ -127,8 +56,7 @@ var ProgressBackground = styled.div`
127
56
  width: 100%;
128
57
  pointer-events: none;
129
58
  background: #fff;
130
- `;
131
- var SoundButton = styled(BaseButton)`
59
+ `,We=D(k)`
132
60
  width: 2em;
133
61
  height: 2em;
134
62
  overflow: hidden;
@@ -137,59 +65,22 @@ var SoundButton = styled(BaseButton)`
137
65
  border-radius: 3px;
138
66
  padding: 0;
139
67
  margin: 0;
140
- `;
141
- var SoundContainer = styled.div`
68
+ `,Ge=D.div`
142
69
  display: flex;
143
70
  align-items: center;
144
- `;
145
- var VolumeContainer = styled.div`
71
+ `,Ke=D.div`
146
72
  width: 0;
147
73
  overflow: hidden;
148
74
  transition: width 500ms;
149
75
  color: #4a473f; // Not in colours
150
76
 
151
- ${(props) => props.$isOpen && css`
77
+ ${e=>e.$isOpen&&xe`
152
78
  width: 150px;
153
79
  `}
154
- `;
155
- var VolumeSlider = styled.input.attrs({ type: "range" })`
80
+ `,qe=D.input.attrs({type:`range`})`
156
81
  width: 120px;
157
82
  margin: 0 15px;
158
- `;
159
-
160
- // ../ui/madoc/components/icons/Spinner.tsx
161
- import { jsx as jsx2, jsxs as jsxs2 } from "react/jsx-runtime";
162
- function Spinner(props) {
163
- return /* @__PURE__ */ jsx2(
164
- "svg",
165
- {
166
- width: "1em",
167
- height: "1em",
168
- viewBox: "0 0 42 42",
169
- xmlns: "http://www.w3.org/2000/svg",
170
- stroke: "currentColor",
171
- ...props,
172
- children: /* @__PURE__ */ jsxs2("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
173
- /* @__PURE__ */ jsx2("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
174
- /* @__PURE__ */ jsx2("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ jsx2(
175
- "animateTransform",
176
- {
177
- attributeName: "transform",
178
- type: "rotate",
179
- from: "0 18 18",
180
- to: "360 18 18",
181
- dur: "1s",
182
- repeatCount: "indefinite"
183
- }
184
- ) })
185
- ] })
186
- }
187
- );
188
- }
189
-
190
- // ../ui/atoms/VisuallHidden/VisuallHidden.tsx
191
- import styled2, { css as css2 } from "styled-components";
192
- var visuallyHidden = css2`
83
+ `;function Je(e){return T(`svg`,{width:`1em`,height:`1em`,viewBox:`0 0 42 42`,xmlns:`http://www.w3.org/2000/svg`,stroke:`currentColor`,...e,children:E(`g`,{transform:`translate(2 2)`,strokeWidth:5,fill:`none`,fillRule:`evenodd`,children:[T(`circle`,{strokeOpacity:.5,cx:18,cy:18,r:18}),T(`path`,{d:`M36 18c0-9.94-8.06-18-18-18`,children:T(`animateTransform`,{attributeName:`transform`,type:`rotate`,from:`0 18 18`,to:`360 18 18`,dur:`1s`,repeatCount:`indefinite`})})]})})}const Ye=xe`
193
84
  clip: rect(1px, 1px, 1px, 1px);
194
85
  clip-path: inset(50%);
195
86
  height: 1px;
@@ -198,2407 +89,10 @@ var visuallyHidden = css2`
198
89
  overflow: hidden;
199
90
  padding: 0;
200
91
  position: absolute;
201
- `;
202
- var VisuallyHiddenLabel = styled2.label`
203
- ${visuallyHidden}
204
- `;
205
-
206
- // ../ui/ui/MediaControls/MediaControls.tsx
207
- import { jsx as jsx3, jsxs as jsxs3 } from "react/jsx-runtime";
208
- function MediaControls(props) {
209
- const [isVolumeOpen, setIsVolumeOpen] = useState(false);
210
- const { progress, currentTime, element } = useMediaElements();
211
- const { duration, isMuted, volume, isPlaying, playRequested } = useMediaState();
212
- const { setVolume, toggleMute, play, pause, setDurationPercent } = useMediaActions();
213
- const Volume = isMuted || volume === 0 ? VolumeOffIcon : volume > 50 ? VolumeUpIcon : VolumeDownIcon;
214
- useLayoutEffect(() => {
215
- if (element.current) {
216
- const $el = element.current;
217
- if ($el.error && props.onError) {
218
- props.onError($el.error?.message || "Unknown error");
219
- return;
220
- }
221
- const onError = () => {
222
- if (props.onError) {
223
- props.onError($el.error?.message || "Unknown error");
224
- }
225
- };
226
- const loadedMetadata = () => {
227
- if ($el.duration && props.onDuration) {
228
- props.onDuration($el.duration);
229
- }
230
- if (props.onDimensions && $el instanceof HTMLVideoElement) {
231
- props.onDimensions($el.videoWidth, $el.videoHeight);
232
- }
233
- };
234
- $el.addEventListener("loadedmetadata", loadedMetadata);
235
- $el.addEventListener("error", onError);
236
- return () => {
237
- $el.removeEventListener("loadedmetadata", loadedMetadata);
238
- $el.removeEventListener("error", onError);
239
- };
240
- }
241
- }, []);
242
- return /* @__PURE__ */ jsxs3(AudioPlayerContainer, { children: [
243
- /* @__PURE__ */ jsx3(
244
- PlayButton,
245
- {
246
- disabled: playRequested,
247
- onClick: () => {
248
- if (isPlaying) {
249
- pause();
250
- } else {
251
- play();
252
- }
253
- },
254
- children: playRequested ? /* @__PURE__ */ jsx3(Spinner, { stroke: "#999" }) : isPlaying ? /* @__PURE__ */ jsx3(PauseIcon, { title: "Pause" }) : /* @__PURE__ */ jsx3(PlayIcon, { title: "Play" })
255
- }
256
- ),
257
- /* @__PURE__ */ jsx3(TimeDisplay, { ref: currentTime, children: "0:00" }),
258
- /* @__PURE__ */ jsxs3(
259
- ProgressContainer,
260
- {
261
- onClick: (e) => {
262
- const { left, width } = e.currentTarget.getBoundingClientRect();
263
- const percent = (e.pageX - left) / width;
264
- setDurationPercent(percent);
265
- },
266
- children: [
267
- /* @__PURE__ */ jsx3(ProgressBackground, {}),
268
- duration ? /* @__PURE__ */ jsx3(ProgressCurrent, { ref: progress }) : null
269
- ]
270
- }
271
- ),
272
- /* @__PURE__ */ jsx3(TimeDisplay, { children: formatTime(duration) }),
273
- /* @__PURE__ */ jsxs3(SoundContainer, { onMouseEnter: () => setIsVolumeOpen(true), onMouseLeave: () => setIsVolumeOpen(false), children: [
274
- /* @__PURE__ */ jsx3(VolumeContainer, { $isOpen: isVolumeOpen, children: /* @__PURE__ */ jsxs3("span", { children: [
275
- /* @__PURE__ */ jsx3(VisuallyHiddenLabel, { htmlFor: "audio-slider", children: "Change volume" }),
276
- /* @__PURE__ */ jsx3(
277
- VolumeSlider,
278
- {
279
- id: "audio-slider",
280
- role: "slider",
281
- disabled: isMuted,
282
- min: "0",
283
- max: "100",
284
- value: volume,
285
- onChange: (e) => setVolume(Number(e.currentTarget.value))
286
- }
287
- )
288
- ] }) }),
289
- /* @__PURE__ */ jsx3(SoundButton, { onClick: () => toggleMute(), children: /* @__PURE__ */ jsx3(Volume, { title: isMuted ? "Mute" : "Unmute" }) })
290
- ] })
291
- ] });
292
- }
293
-
294
- // ../ui/atoms/PaddedSidebarContainer.tsx
295
- import styled3 from "styled-components";
296
- var PaddedSidebarContainer = styled3.div`
297
- padding: 0 0.7em;
298
- margin: 0.7em 0;
299
- flex: 1;
300
- overflow: visible;
301
- `;
302
-
303
- // src/Annotation/AudioAnnotation/create-audio-annotation.tsx
304
- import { useEffect as useEffect2, useState as useState2 } from "react";
305
- import { CanvasPanel } from "react-iiif-vault";
306
- import { jsx as jsx4, jsxs as jsxs4 } from "react/jsx-runtime";
307
- async function createAudioAnnotation(data, ctx) {
308
- const annotation = {
309
- id: ctx.generateId("annotation"),
310
- type: "Annotation"
311
- };
312
- const targetType = ctx.options.targetType;
313
- const body = ctx.embed({
314
- id: data.url,
315
- type: "Sound",
316
- format: "audio/mp4",
317
- duration: data.duration || 0
318
- });
319
- if (targetType === "Annotation") {
320
- return ctx.embed({
321
- ...annotation,
322
- label: getValue(data.label) && data.label,
323
- motivation: data.motivation || ctx.options.initialData?.motivation || "painting",
324
- body,
325
- target: ctx.getTarget()
326
- });
327
- }
328
- if (targetType === "Canvas") {
329
- const canvasId = ctx.generateId("canvas");
330
- const pageId = ctx.generateId("annotation-page", {
331
- id: canvasId,
332
- type: "Canvas"
333
- });
334
- const annotationResource = ctx.embed({
335
- ...annotation,
336
- motivation: "painting",
337
- body,
338
- target: {
339
- type: "SpecificResource",
340
- source: { id: canvasId, type: "Canvas" }
341
- }
342
- });
343
- const page = ctx.embed({
344
- id: pageId,
345
- type: "AnnotationPage",
346
- items: [annotationResource]
347
- });
348
- return ctx.embed({
349
- id: canvasId,
350
- type: "Canvas",
351
- label: data.label || { en: ["Untitled HTML canvas"] },
352
- duration: data.duration || 0,
353
- items: [page]
354
- });
355
- }
356
- }
357
- function CreateAudioAnnotationForm(props) {
358
- const [url, setUrl] = useState2("");
359
- const [duration, setDuration] = useState2(0);
360
- const [error, setError] = useState2("");
361
- const [label, setLabel] = useState2({ en: [""] });
362
- const onSubmit = () => {
363
- props.runCreate({
364
- url,
365
- duration,
366
- label
367
- });
368
- };
369
- useEffect2(() => {
370
- setError("");
371
- setDuration(0);
372
- if (url) {
373
- const labelFromUrl = url.split("/").pop()?.split(".").shift();
374
- setLabel({ en: [labelFromUrl || ""] });
375
- }
376
- }, [url]);
377
- return /* @__PURE__ */ jsxs4(PaddedSidebarContainer, { children: [
378
- error ? /* @__PURE__ */ jsx4(ErrorMessage, { children: error }) : null,
379
- /* @__PURE__ */ jsxs4(InputContainer, { $wide: true, children: [
380
- /* @__PURE__ */ jsx4(InputLabel, { htmlFor: "audio-url", children: "URL" }),
381
- /* @__PURE__ */ jsx4(Input, { type: "text", id: "audio-url", value: url, onChange: (e) => setUrl(e.target.value) })
382
- ] }),
383
- url && !error ? /* @__PURE__ */ jsx4("div", { children: /* @__PURE__ */ jsx4(
384
- LanguageFieldEditor,
385
- {
386
- containerId: "label",
387
- focusId: "label_",
388
- label: "Label",
389
- fields: label,
390
- onSave: (e) => setLabel(e.toInternationalString())
391
- },
392
- `${url}__${duration}`
393
- ) }) : null,
394
- url && !error ? /* @__PURE__ */ jsx4(CanvasPanel.AudioHTML, { media: { url, duration, type: "Sound" }, children: /* @__PURE__ */ jsx4(
395
- MediaControls,
396
- {
397
- onError: (error2) => setError(error2),
398
- onDuration: (duration2) => setDuration(~~duration2)
399
- },
400
- `${url}__${duration}`
401
- ) }, `${url}__${duration}`) : null,
402
- duration && !error ? /* @__PURE__ */ jsxs4(FormFieldWrapper, { children: [
403
- /* @__PURE__ */ jsx4(InputLabel, { htmlFor: "duration", children: "Duration" }),
404
- /* @__PURE__ */ jsx4(Input, { type: "number", id: "duration", value: duration, onChange: (e) => setDuration(e.target.valueAsNumber) })
405
- ] }) : null,
406
- /* @__PURE__ */ jsx4(ActionButton, { primary: true, large: true, type: "button", onPress: onSubmit, isDisabled: !url || !!error, children: "Add audio" })
407
- ] });
408
- }
409
-
410
- // src/Annotation/AudioAnnotation/index.tsx
411
- import { jsx as jsx5 } from "react/jsx-runtime";
412
- var audioAnnotation = defineCreator({
413
- id: "@manifest-editor/audio-annotation",
414
- create: createAudioAnnotation,
415
- label: "Audio",
416
- summary: "Audio annotation",
417
- icon: /* @__PURE__ */ jsx5(AudioIcon, {}),
418
- render(ctx) {
419
- return /* @__PURE__ */ jsx5(CreateAudioAnnotationForm, { ...ctx });
420
- },
421
- resourceType: "Annotation",
422
- resourceFields: ["id", "type", "motivation", "body", "target"],
423
- additionalTypes: ["Canvas"],
424
- supports: {
425
- initialData: true,
426
- parentTypes: ["AnnotationPage", "Manifest"],
427
- parentFields: ["items"]
428
- },
429
- staticFields: {
430
- type: "Annotation"
431
- }
432
- });
433
-
434
- // src/Annotation/CaptionedImageAnnotation/index.tsx
435
- import { AddImageIcon } from "@manifest-editor/components";
436
- import { defineCreator as defineCreator2 } from "@manifest-editor/creator-api";
437
-
438
- // src/Annotation/CaptionedImageAnnotation/create-captioned-image-annotation.tsx
439
- import { ActionButton as ActionButton2 } from "@manifest-editor/components";
440
- import { Input as Input2, InputContainer as InputContainer2, InputLabel as InputLabel2, LanguageFieldEditor as LanguageFieldEditor2 } from "@manifest-editor/editors";
441
- import { useState as useState3 } from "react";
442
- import { jsx as jsx6, jsxs as jsxs5 } from "react/jsx-runtime";
443
- async function createCaptionedImageAnnotation(data, ctx) {
444
- const annotation = {
445
- id: ctx.generateId("annotation"),
446
- type: "Annotation"
447
- };
448
- const targetType = ctx.options.targetType;
449
- const languages = Object.keys(data.body);
450
- const bodies = [];
451
- for (const language of languages) {
452
- const body = data.body[language].join("\n");
453
- if (body) {
454
- bodies.push(
455
- await ctx.create(
456
- "@manifest-editor/html-body-creator",
457
- {
458
- language,
459
- body
460
- },
461
- { parent: { resource: annotation, property: "items" } }
462
- )
463
- );
464
- }
465
- }
466
- const resource = await ctx.create(
467
- "@manifest-editor/image-url-creator",
468
- { url: data.imageUrl },
469
- {
470
- parent: { resource: annotation, property: "body" }
471
- }
472
- );
473
- if (resource) {
474
- bodies.push(resource);
475
- }
476
- if (targetType === "Annotation") {
477
- return ctx.embed({
478
- ...annotation,
479
- motivation: data.motivation || ctx.options.initialData?.motivation || "painting",
480
- body: bodies,
481
- target: ctx.getTarget()
482
- });
483
- }
484
- if (targetType === "Canvas") {
485
- const canvasId = ctx.generateId("canvas");
486
- const pageId = ctx.generateId("annotation-page", {
487
- id: canvasId,
488
- type: "Canvas"
489
- });
490
- const annotationResource = ctx.embed({
491
- ...annotation,
492
- motivation: "painting",
493
- body: bodies,
494
- target: {
495
- type: "SpecificResource",
496
- source: { id: canvasId, type: "Canvas" }
497
- }
498
- });
499
- const page = ctx.embed({
500
- id: pageId,
501
- type: "AnnotationPage",
502
- items: [annotationResource]
503
- });
504
- return ctx.embed({
505
- id: canvasId,
506
- type: "Canvas",
507
- label: data.label || { en: ["Untitled HTML canvas"] },
508
- height: data.height || 1e3,
509
- width: data.width || 1e3,
510
- items: [page]
511
- });
512
- }
513
- }
514
- function CreateCaptionedImageAnnotation(props) {
515
- const [body, setBody] = useState3({ en: [""] });
516
- const onSubmit = (e) => {
517
- e.preventDefault();
518
- const data = new FormData(e.target);
519
- const formData = Object.fromEntries(data.entries());
520
- props.runCreate({
521
- body,
522
- imageUrl: formData.url
523
- });
524
- };
525
- return /* @__PURE__ */ jsx6("form", { onSubmit, children: /* @__PURE__ */ jsxs5(PaddedSidebarContainer, { children: [
526
- /* @__PURE__ */ jsx6(InputContainer2, { children: /* @__PURE__ */ jsxs5(InputContainer2, { $wide: true, children: [
527
- /* @__PURE__ */ jsx6(InputLabel2, { htmlFor: "id", children: "Link to Image" }),
528
- /* @__PURE__ */ jsx6(Input2, { id: "url", name: "url", defaultValue: "" })
529
- ] }) }),
530
- /* @__PURE__ */ jsxs5(InputContainer2, { children: [
531
- /* @__PURE__ */ jsx6(InputLabel2, { children: "Image Caption" }),
532
- /* @__PURE__ */ jsx6(
533
- LanguageFieldEditor2,
534
- {
535
- focusId: "html-content",
536
- label: "HTML Content",
537
- fields: body,
538
- onSave: (e) => setBody(e.toInternationalString())
539
- }
540
- )
541
- ] }),
542
- /* @__PURE__ */ jsx6(ActionButton2, { primary: true, large: true, type: "submit", children: "Create" })
543
- ] }) });
544
- }
545
-
546
- // src/Annotation/CaptionedImageAnnotation/index.tsx
547
- import { jsx as jsx7 } from "react/jsx-runtime";
548
- var captionedImageAnnotation = defineCreator2({
549
- id: "@manifest-editor/captioned-image-annotation",
550
- create: createCaptionedImageAnnotation,
551
- label: "Captioned image",
552
- summary: "Add an image from a URL with caption",
553
- icon: /* @__PURE__ */ jsx7(AddImageIcon, {}),
554
- render(ctx) {
555
- return /* @__PURE__ */ jsx7(CreateCaptionedImageAnnotation, { ...ctx });
556
- },
557
- resourceType: "Annotation",
558
- resourceFields: ["id", "type", "motivation", "body", "target"],
559
- additionalTypes: ["Canvas"],
560
- supports: {
561
- initialData: true,
562
- parentTypes: ["AnnotationPage"],
563
- parentFields: ["items"]
564
- },
565
- staticFields: {
566
- type: "Annotation"
567
- }
568
- });
569
-
570
- // src/Annotation/HTMLAnnotation/index.tsx
571
- import { HTMLIcon } from "@manifest-editor/components";
572
- import { defineCreator as defineCreator3 } from "@manifest-editor/creator-api";
573
-
574
- // src/Annotation/HTMLAnnotation/create-html-annotation.tsx
575
- import { getValue as getValue2 } from "@iiif/helpers";
576
- import { ActionButton as ActionButton3 } from "@manifest-editor/components";
577
- import { LanguageFieldEditor as LanguageFieldEditor3 } from "@manifest-editor/editors";
578
- import { useState as useState4 } from "react";
579
- import { jsx as jsx8, jsxs as jsxs6 } from "react/jsx-runtime";
580
- async function createHtmlAnnotation(data, ctx) {
581
- const annotation = {
582
- id: ctx.generateId("annotation"),
583
- type: "Annotation"
584
- };
585
- const targetType = ctx.options.targetType;
586
- const languages = Object.keys(data.body);
587
- const bodies = [];
588
- for (const language of languages) {
589
- const body = data.body[language].join("\n");
590
- if (body) {
591
- bodies.push(
592
- await ctx.create(
593
- "@manifest-editor/html-body-creator",
594
- {
595
- language,
596
- body
597
- },
598
- { parent: { resource: annotation, property: "items" } }
599
- )
600
- );
601
- }
602
- }
603
- if (targetType === "Annotation") {
604
- return ctx.embed({
605
- ...annotation,
606
- motivation: data.motivation || ctx.options.initialData?.motivation || "painting",
607
- body: bodies,
608
- target: ctx.getTarget()
609
- });
610
- }
611
- if (targetType === "Canvas") {
612
- const canvasId = ctx.generateId("canvas");
613
- const pageId = ctx.generateId("annotation-page", {
614
- id: canvasId,
615
- type: "Canvas"
616
- });
617
- const annotationResource = ctx.embed({
618
- ...annotation,
619
- motivation: "painting",
620
- body: bodies,
621
- target: {
622
- type: "SpecificResource",
623
- source: { id: canvasId, type: "Canvas" }
624
- }
625
- });
626
- const page = ctx.embed({
627
- id: pageId,
628
- type: "AnnotationPage",
629
- items: [annotationResource]
630
- });
631
- return ctx.embed({
632
- id: canvasId,
633
- type: "Canvas",
634
- label: data.label || { en: ["Untitled HTML canvas"] },
635
- height: data.height || 1e3,
636
- width: data.width || 1e3,
637
- items: [page]
638
- });
639
- }
640
- }
641
- function CreateHTMLAnnotation(props) {
642
- const [body, setBody] = useState4({ en: [""] });
643
- const isEmpty = getValue2(body).trim() === "";
644
- const onSubmit = () => {
645
- props.runCreate({
646
- body
647
- });
648
- };
649
- return /* @__PURE__ */ jsxs6(PaddedSidebarContainer, { children: [
650
- /* @__PURE__ */ jsx8(
651
- LanguageFieldEditor3,
652
- {
653
- focusId: "html-content",
654
- label: "HTML Content",
655
- fields: body,
656
- onSave: (e) => setBody(e.toInternationalString())
657
- }
658
- ),
659
- /* @__PURE__ */ jsx8(ActionButton3, { primary: true, large: true, type: "button", onPress: onSubmit, isDisabled: isEmpty, children: "Create" })
660
- ] });
661
- }
662
-
663
- // src/Annotation/HTMLAnnotation/index.tsx
664
- import { jsx as jsx9 } from "react/jsx-runtime";
665
- var htmlAnnotation = defineCreator3({
666
- id: "@manifest-editor/html-annotation",
667
- create: createHtmlAnnotation,
668
- label: "HTML",
669
- summary: "HTML annotation",
670
- icon: /* @__PURE__ */ jsx9(HTMLIcon, {}),
671
- render(ctx) {
672
- return /* @__PURE__ */ jsx9(CreateHTMLAnnotation, { ...ctx });
673
- },
674
- resourceType: "Annotation",
675
- resourceFields: ["id", "type", "motivation", "body", "target"],
676
- additionalTypes: ["Canvas"],
677
- supports: {
678
- initialData: true,
679
- parentTypes: ["AnnotationPage", "Manifest"],
680
- parentFields: ["items"]
681
- },
682
- staticFields: {
683
- type: "Annotation"
684
- }
685
- });
686
-
687
- // src/Annotation/ImageServiceAnnotation/index.tsx
688
- import { IIIFLogo } from "@manifest-editor/components";
689
- import { defineCreator as defineCreator4 } from "@manifest-editor/creator-api";
690
-
691
- // src/side-effects/reposition-multiple-images.ts
692
- import { isImageService } from "@iiif/parser/image-3";
693
- import { EditorInstance } from "@manifest-editor/editor-api";
694
- import { centerRectangles } from "@manifest-editor/editors";
695
- var repositionMultipleImages = {
696
- canvasInteraction: true,
697
- spatial: true,
698
- async run(result, { vault, options }) {
699
- if (result && result.type === "Annotation" && options.targetType === "Annotation") {
700
- const fullAnno = vault.get(result);
701
- const target = fullAnno.target;
702
- if (!(target && target.source?.type === "Canvas")) {
703
- return;
704
- }
705
- const canvasRef = target.source;
706
- const canvas = vault.get(canvasRef);
707
- if (!canvas.items) {
708
- return;
709
- }
710
- const annoPage = vault.get(canvas.items[0]);
711
- if (!annoPage) {
712
- return;
713
- }
714
- if (annoPage.items.length < 2 && !canvas.behavior.includes("multi-image")) {
715
- return;
716
- }
717
- const bodies = vault.get(fullAnno.body);
718
- const body = bodies[0];
719
- const selector = fullAnno.body[0]?.selector;
720
- const serviceList = body.service || [];
721
- const imageService = serviceList.find((s) => isImageService(s));
722
- if (imageService) {
723
- if (imageService.width && imageService.height) {
724
- if (imageService.width !== body.width) {
725
- vault.modifyEntityField(
726
- { id: body.id, type: "ContentResource" },
727
- "width",
728
- imageService.width
729
- );
730
- }
731
- if (imageService.height !== body.height) {
732
- vault.modifyEntityField(
733
- { id: body.id, type: "ContentResource" },
734
- "height",
735
- imageService.height
736
- );
737
- }
738
- }
739
- }
740
- let width = imageService?.width || body.width;
741
- let height = imageService?.height || body.height;
742
- if (selector) {
743
- if ((selector.type === "iiif:ImageApiSelector" || selector.type === "ImageApiSelector") && selector.region) {
744
- const [x, y, width_, height_] = selector.region.split(",");
745
- width = Number(width_) || width;
746
- height = Number(height_) || height;
747
- }
748
- }
749
- const editor = new EditorInstance({ vault, reference: result });
750
- const imagePosition = centerRectangles(
751
- canvas,
752
- {
753
- width,
754
- height
755
- },
756
- 0.6
757
- );
758
- editor.annotation.target.setPosition(imagePosition);
759
- }
760
- }
761
- };
762
-
763
- // src/side-effects/resize-resource-to-empty-canvas.ts
764
- import { EditorInstance as EditorInstance2 } from "@manifest-editor/editor-api";
765
- var resizeResourceToEmptyCanvas = {
766
- canvasInteraction: true,
767
- spatial: true,
768
- async run(result, { vault, options }) {
769
- if (result && result.type === "Annotation" && options.targetType === "Annotation") {
770
- const fullAnno = vault.get(result);
771
- const target = fullAnno.target;
772
- if (!(target && target.source?.type === "Canvas")) {
773
- return;
774
- }
775
- const canvasRef = target.source;
776
- const canvas = vault.get(canvasRef);
777
- if (!canvas.items) {
778
- return;
779
- }
780
- if (canvas.behavior.includes("multi-image")) {
781
- return;
782
- }
783
- const annoPage = vault.get(canvas.items[0]);
784
- if (!annoPage) {
785
- return;
786
- }
787
- if (annoPage.items.length > 1) {
788
- return;
789
- }
790
- const bodies = vault.get(fullAnno.body);
791
- if (bodies.length !== 1) {
792
- return;
793
- }
794
- const body = bodies[0];
795
- const selector = fullAnno.body[0]?.selector;
796
- const service = (body.service || [])[0];
797
- let width = service?.width || body.width;
798
- let height = service?.height || body.height;
799
- const duration = body.duration || service?.duration;
800
- if (selector) {
801
- if ((selector.type === "iiif:ImageApiSelector" || selector.type === "ImageApiSelector") && selector.region) {
802
- const [x, y, width_, height_] = selector.region.split(",");
803
- width = Number(width_) || width;
804
- height = Number(height_) || height;
805
- }
806
- }
807
- const editor = new EditorInstance2({ vault, reference: canvasRef });
808
- vault.batch(() => {
809
- if (typeof width !== "undefined") {
810
- editor.technical.width.set(width);
811
- }
812
- if (typeof height !== "undefined") {
813
- editor.technical.height.set(height);
814
- }
815
- if (typeof duration !== "undefined") {
816
- editor.technical.duration.set(duration);
817
- }
818
- });
819
- }
820
- }
821
- };
822
-
823
- // src/side-effects/resize-to-fit-service.ts
824
- import { isImageService as isImageService2 } from "@atlas-viewer/iiif-image-api";
825
- var resizeToFitService = {
826
- canvasInteraction: true,
827
- spatial: true,
828
- async run(result, { vault, options }) {
829
- if (result && result.type === "Annotation" && options.targetType === "Annotation") {
830
- const fullAnno = vault.get(result);
831
- const target = fullAnno.target;
832
- if (!(target && target.source?.type === "Canvas")) {
833
- return;
834
- }
835
- const canvasRef = target.source;
836
- const canvas = vault.get(canvasRef);
837
- if (!canvas.items) {
838
- return;
839
- }
840
- if (canvas.behavior.includes("multi-image")) {
841
- return;
842
- }
843
- const annoPage = vault.get(canvas.items[0]);
844
- if (!annoPage) {
845
- return;
846
- }
847
- const resourceBody = Array.isArray(fullAnno.body) ? fullAnno.body[0] : fullAnno.body;
848
- if (resourceBody.type === "SpecificResource" && resourceBody.selector) {
849
- return;
850
- }
851
- const bodies = vault.get(fullAnno.body);
852
- const body = bodies[0];
853
- const serviceList = body.service || [];
854
- const imageService = serviceList.find((s) => isImageService2(s));
855
- if (imageService) {
856
- if (imageService.width && imageService.height) {
857
- if (imageService.width !== body.width) {
858
- vault.modifyEntityField(
859
- { id: body.id, type: "ContentResource" },
860
- "width",
861
- imageService.width
862
- );
863
- }
864
- if (imageService.height !== body.height) {
865
- vault.modifyEntityField(
866
- { id: body.id, type: "ContentResource" },
867
- "height",
868
- imageService.height
869
- );
870
- }
871
- }
872
- }
873
- }
874
- }
875
- };
876
-
877
- // src/Annotation/ImageServiceAnnotation/create-service-annotation.tsx
878
- import {
879
- creatorHelper
880
- } from "@manifest-editor/creator-api";
881
-
882
- // src/ContentResource/ImageServiceCreator/create-image-service.tsx
883
- import {
884
- canonicalServiceUrl,
885
- createImageServiceRequest,
886
- imageServiceRequestToString,
887
- parseImageServiceRequest
888
- } from "@iiif/parser/image-3";
889
- import { ActionButton as ActionButton4 } from "@manifest-editor/components";
890
- import { Input as Input3, InputContainer as InputContainer3, InputLabel as InputLabel3 } from "@manifest-editor/editors";
891
- import { useState as useState5 } from "react";
892
- import { ErrorBoundary } from "react-error-boundary";
893
- import { ImageService as ImageServiceComponent } from "react-iiif-vault";
894
- import { jsx as jsx10, jsxs as jsxs7 } from "react/jsx-runtime";
895
- async function createImageServer(data, ctx) {
896
- const service = { ...data.service };
897
- if (service["@id"]) {
898
- service.id = service["@id"];
899
- }
900
- if (service["@type"]) {
901
- service.type = service["@type"];
902
- }
903
- const request = createImageServiceRequest(service);
904
- const imageId = imageServiceRequestToString({
905
- identifier: request.identifier,
906
- server: request.server,
907
- scheme: request.scheme,
908
- type: "image",
909
- size: {
910
- max: !data.size?.width && !data.size?.height,
911
- confined: false,
912
- upscaled: false,
913
- ...data.size || {}
914
- },
915
- format: "jpg",
916
- // This isn't how it should be modelled, always full,
917
- // region: data.selector ? data.selector : { full: true },
918
- region: { full: true },
919
- rotation: { angle: 0 },
920
- quality: "default",
921
- prefix: request.prefix,
922
- originalPath: request.originalPath
923
- });
924
- const resource = ctx.embed({
925
- id: imageId,
926
- type: "Image",
927
- format: data.format || "image/jpeg",
928
- height: data.height || service.height,
929
- width: data.width || service.width,
930
- service: data.embedService === false ? void 0 : [data.service]
931
- });
932
- return resource;
933
- }
934
- function getCanonicalUrl(url) {
935
- return url.endsWith("default.jpg") ? imageServiceRequestToString({
936
- ...parseImageServiceRequest(url),
937
- type: "info"
938
- }) : canonicalServiceUrl(url);
939
- }
940
- function CreateImageServerForm(props) {
941
- const [url, setUrl] = useState5("");
942
- const onSubmit = (e) => {
943
- e.preventDefault();
944
- const data = new FormData(e.target);
945
- const formData = Object.fromEntries(data.entries());
946
- const url2 = formData.url;
947
- if (url2) {
948
- const info = getCanonicalUrl(url2);
949
- if (!info) {
950
- throw new Error("Invalid image service request");
951
- }
952
- fetch(info).then((r) => r.json()).then((service) => {
953
- props.runCreate({ url: formData.url, service });
954
- });
955
- }
956
- };
957
- return /* @__PURE__ */ jsx10(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs7("form", { onSubmit, children: [
958
- /* @__PURE__ */ jsx10("div", { className: "flex gap-2 items-center", children: /* @__PURE__ */ jsxs7(InputContainer3, { $wide: true, children: [
959
- /* @__PURE__ */ jsx10(InputLabel3, { htmlFor: "id", children: "Link to image service" }),
960
- /* @__PURE__ */ jsx10(
961
- Input3,
962
- {
963
- id: "url",
964
- name: "url",
965
- defaultValue: "",
966
- onPaste: (e) => {
967
- const text = e.clipboardData.getData("text/plain");
968
- setUrl(text ? getCanonicalUrl(text) : "");
969
- },
970
- onBlur: (e) => setUrl(e.currentTarget.value ? getCanonicalUrl(e.currentTarget.value) : "")
971
- }
972
- )
973
- ] }) }),
974
- /* @__PURE__ */ jsx10("div", { className: "relative flex z-0 my-5 h-96 min-h-0 min-w-0 overflow-hidden bg-gray-200 rounded items-center justify-center", children: url.trim() ? /* @__PURE__ */ jsx10(ErrorBoundary, { fallbackRender: () => /* @__PURE__ */ jsx10("div", { children: "Invalid service" }), children: /* @__PURE__ */ jsx10(
975
- ImageServiceComponent,
976
- {
977
- src: url,
978
- fluid: true,
979
- errorFallback: () => /* @__PURE__ */ jsx10("div", { children: "Invalid service" }),
980
- background: "rgb(229,231,235)",
981
- className: "h-full w-full",
982
- containerProps: { className: "w-full h-full z-10" }
983
- }
984
- ) }) : /* @__PURE__ */ jsx10("div", { className: "text-grey-600", children: "Preview" }) }),
985
- /* @__PURE__ */ jsx10("div", { children: /* @__PURE__ */ jsx10(ActionButton4, { primary: true, large: true, type: "submit", isDisabled: !url, children: "Create" }) })
986
- ] }) });
987
- }
988
-
989
- // src/Annotation/ImageServiceAnnotation/create-service-annotation.tsx
990
- import { jsx as jsx11 } from "react/jsx-runtime";
991
- async function createImageServiceAnnotation(data, ctx) {
992
- const annotation = {
993
- id: ctx.generateId("annotation"),
994
- type: "Annotation"
995
- };
996
- const targetType = ctx.options.targetType;
997
- const createImage = creatorHelper(ctx, "Annotation", "body", "@manifest-editor/image-service-creator");
998
- const resource = await createImage(data, {
999
- parent: { resource: annotation, property: "body" }
1000
- });
1001
- if (targetType === "Annotation") {
1002
- return {
1003
- ...annotation,
1004
- body: [resource],
1005
- motivation: data.motivation || "painting",
1006
- target: ctx.getTarget()
1007
- };
1008
- }
1009
- if (targetType === "Canvas") {
1010
- const canvasId = ctx.generateId("canvas");
1011
- const pageId = ctx.generateId("annotation-page", {
1012
- id: canvasId,
1013
- type: "Canvas"
1014
- });
1015
- const annotationResource = ctx.embed({
1016
- ...annotation,
1017
- motivation: "painting",
1018
- body: [resource],
1019
- target: {
1020
- type: "SpecificResource",
1021
- source: { id: canvasId, type: "Canvas" }
1022
- }
1023
- });
1024
- const page = ctx.embed({
1025
- id: pageId,
1026
- type: "AnnotationPage",
1027
- items: [annotationResource]
1028
- });
1029
- let thumbnail = void 0;
1030
- if (data.service?.sizes) {
1031
- const createThumbnail2 = creatorHelper(ctx, "Canvas", "thumbnail", "@manifest-editor/thumbnail-image");
1032
- thumbnail = await createThumbnail2({
1033
- service: data.service,
1034
- width: data.thumbnailSize || 400
1035
- });
1036
- }
1037
- return ctx.embed({
1038
- id: canvasId,
1039
- type: "Canvas",
1040
- label: data.label || { en: ["Untitled canvas"] },
1041
- height: resource.resource.height || 1e3,
1042
- width: resource.resource.width || 1e3,
1043
- thumbnail: thumbnail ? [thumbnail] : void 0,
1044
- items: [page]
1045
- });
1046
- }
1047
- }
1048
- function CreateImageServiceAnnotationForm(props) {
1049
- return /* @__PURE__ */ jsx11(CreateImageServerForm, { ...props });
1050
- }
1051
-
1052
- // src/Annotation/ImageServiceAnnotation/index.tsx
1053
- import { jsx as jsx12 } from "react/jsx-runtime";
1054
- var imageServiceAnnotation = defineCreator4({
1055
- id: "@manifest-editor/image-service-annotation",
1056
- create: createImageServiceAnnotation,
1057
- label: "IIIF Image",
1058
- dependencies: ["@manifest-editor/image-service-creator"],
1059
- summary: "IIIF Image service",
1060
- tags: ["image", "image-service"],
1061
- icon: /* @__PURE__ */ jsx12(IIIFLogo, { style: { padding: 10 } }),
1062
- render(ctx) {
1063
- return /* @__PURE__ */ jsx12(CreateImageServiceAnnotationForm, { ...ctx });
1064
- },
1065
- resourceType: "Annotation",
1066
- resourceFields: ["id", "type", "motivation", "body", "target"],
1067
- additionalTypes: ["Canvas"],
1068
- supports: {
1069
- parentTypes: ["AnnotationPage", "Manifest"],
1070
- parentFields: ["items"]
1071
- },
1072
- sideEffects: [resizeToFitService, resizeResourceToEmptyCanvas, repositionMultipleImages],
1073
- staticFields: {
1074
- type: "Annotation"
1075
- }
1076
- });
1077
-
1078
- // src/Annotation/ImageUrlAnnotation/index.tsx
1079
- import { AddImageIcon as AddImageIcon2 } from "@manifest-editor/components";
1080
- import { defineCreator as defineCreator5 } from "@manifest-editor/creator-api";
1081
-
1082
- // src/Annotation/ImageUrlAnnotation/create-image-url-annotation.tsx
1083
- import {
1084
- creatorHelper as creatorHelper2
1085
- } from "@manifest-editor/creator-api";
1086
-
1087
- // src/ContentResource/ImageUrlCreator/create-image-url.tsx
1088
- import { ActionButton as ActionButton5 } from "@manifest-editor/components";
1089
- import { Input as Input4, InputContainer as InputContainer4, InputLabel as InputLabel4 } from "@manifest-editor/editors";
1090
- import { getFormat, getImageDimensions } from "@manifest-editor/shell";
1091
- import { jsx as jsx13, jsxs as jsxs8 } from "react/jsx-runtime";
1092
- async function createImageUrl(data, ctx) {
1093
- if (!data.height || !data.width) {
1094
- const dimensions = await getImageDimensions(data.url);
1095
- if (dimensions) {
1096
- data.height = dimensions.height;
1097
- data.width = dimensions.width;
1098
- }
1099
- }
1100
- return ctx.embed({
1101
- id: data.url,
1102
- type: "Image",
1103
- format: data.format || await getFormat(data.url),
1104
- height: data.height,
1105
- width: data.width,
1106
- service: data.service ? Array.isArray(data.service) ? data.service : [data.service] : void 0
1107
- });
1108
- }
1109
- function CreateImageUrlForm(props) {
1110
- const onSubmit = (e) => {
1111
- e.preventDefault();
1112
- const data = new FormData(e.target);
1113
- const formData = Object.fromEntries(data.entries());
1114
- if (formData.url) {
1115
- props.runCreate({ url: formData.url });
1116
- }
1117
- };
1118
- return /* @__PURE__ */ jsx13(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs8("form", { onSubmit, children: [
1119
- /* @__PURE__ */ jsxs8(InputContainer4, { $wide: true, children: [
1120
- /* @__PURE__ */ jsx13(InputLabel4, { htmlFor: "id", children: "Link to Image" }),
1121
- /* @__PURE__ */ jsx13(Input4, { id: "url", name: "url", defaultValue: "" })
1122
- ] }),
1123
- /* @__PURE__ */ jsx13(ActionButton5, { primary: true, large: true, type: "submit", children: "Create" })
1124
- ] }) });
1125
- }
1126
-
1127
- // src/Annotation/ImageUrlAnnotation/create-image-url-annotation.tsx
1128
- import { jsx as jsx14 } from "react/jsx-runtime";
1129
- async function createImageUrlAnnotation(data, ctx) {
1130
- const annotation = {
1131
- id: ctx.generateId("annotation"),
1132
- type: "Annotation"
1133
- };
1134
- const targetType = ctx.options.targetType;
1135
- const createImage = creatorHelper2(ctx, "Annotation", "body", "@manifest-editor/image-url-creator");
1136
- const resource = await createImage(data, {
1137
- parent: { resource: annotation, property: "body" }
1138
- });
1139
- if (targetType === "Annotation") {
1140
- return ctx.embed({
1141
- ...annotation,
1142
- body: [resource],
1143
- motivation: data.motivation || "painting",
1144
- target: ctx.getTarget()
1145
- });
1146
- }
1147
- if (targetType === "Canvas") {
1148
- const canvasId = ctx.generateId("canvas");
1149
- const pageId = ctx.generateId("annotation-page", {
1150
- id: canvasId,
1151
- type: "Canvas"
1152
- });
1153
- const annotationResource = ctx.embed({
1154
- ...annotation,
1155
- motivation: "painting",
1156
- body: [resource],
1157
- target: {
1158
- type: "SpecificResource",
1159
- source: { id: canvasId, type: "Canvas" }
1160
- }
1161
- });
1162
- const page = ctx.embed({
1163
- id: pageId,
1164
- type: "AnnotationPage",
1165
- items: [annotationResource]
1166
- });
1167
- return ctx.embed({
1168
- id: canvasId,
1169
- type: "Canvas",
1170
- label: data.label || { en: ["Untitled canvas"] },
1171
- height: resource.resource.height || 1e3,
1172
- width: resource.resource.width || 1e3,
1173
- items: [page]
1174
- });
1175
- }
1176
- throw new Error("Unsupported target type");
1177
- }
1178
- function CreateImageUrlAnnotationForm(props) {
1179
- return /* @__PURE__ */ jsx14(CreateImageUrlForm, { ...props });
1180
- }
1181
-
1182
- // src/Annotation/ImageUrlAnnotation/index.tsx
1183
- import { jsx as jsx15 } from "react/jsx-runtime";
1184
- var imageUrlAnnotation = defineCreator5({
1185
- id: "@manifest-editor/image-url-annotation",
1186
- create: createImageUrlAnnotation,
1187
- label: "Image",
1188
- dependencies: ["@manifest-editor/image-url-creator"],
1189
- summary: "Image from URL",
1190
- tags: ["image"],
1191
- icon: /* @__PURE__ */ jsx15(AddImageIcon2, {}),
1192
- render(ctx) {
1193
- return /* @__PURE__ */ jsx15(CreateImageUrlAnnotationForm, { ...ctx });
1194
- },
1195
- resourceType: "Annotation",
1196
- resourceFields: ["id", "type", "motivation", "body", "target"],
1197
- additionalTypes: ["Canvas"],
1198
- supports: {
1199
- parentTypes: ["AnnotationPage", "Manifest"],
1200
- parentFields: ["items"]
1201
- },
1202
- sideEffects: [resizeToFitService, resizeResourceToEmptyCanvas, repositionMultipleImages],
1203
- staticFields: {
1204
- type: "Annotation"
1205
- }
1206
- });
1207
-
1208
- // src/Annotation/ImageUrlListAnnotation/index.tsx
1209
- import { ImageListIcon } from "@manifest-editor/components";
1210
- import { defineCreator as defineCreator6 } from "@manifest-editor/creator-api";
1211
-
1212
- // src/ContentResource/ImageUrlListCreator/create-image-url-list.tsx
1213
- import { ActionButton as ActionButton6, Form } from "@manifest-editor/components";
1214
- import {
1215
- creatorHelper as creatorHelper3
1216
- } from "@manifest-editor/creator-api";
1217
- import { jsx as jsx16, jsxs as jsxs9 } from "react/jsx-runtime";
1218
- async function createImageUrlList(payload, ctx) {
1219
- const items = [];
1220
- const createImage = creatorHelper3(ctx, "Annotation", "body", "@manifest-editor/image-url-creator");
1221
- for (const image of payload.images) {
1222
- items.push(await createImage(image, ctx.options));
1223
- }
1224
- return items;
1225
- }
1226
- function CreateImageUrlListForm(props) {
1227
- const onSubmit = (e) => {
1228
- e.preventDefault();
1229
- const data = new FormData(e.target);
1230
- const formData = Object.fromEntries(data.entries());
1231
- if (formData.urls) {
1232
- props.runCreate({ images: formData.urls.split("\n").map((url) => ({ url })) });
1233
- }
1234
- };
1235
- return /* @__PURE__ */ jsx16(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs9(Form.Form, { onSubmit, children: [
1236
- /* @__PURE__ */ jsxs9(Form.InputContainer, { className: "mb-4", children: [
1237
- /* @__PURE__ */ jsx16(Form.Label, { children: "Enter a list of URLs (one per line)" }),
1238
- /* @__PURE__ */ jsx16(Form.TextArea, { name: "urls", rows: "10" })
1239
- ] }),
1240
- /* @__PURE__ */ jsx16(ActionButton6, { primary: true, large: true, type: "submit", children: "Create" })
1241
- ] }) });
1242
- }
1243
-
1244
- // src/Annotation/ImageUrlListAnnotation/create-image-url-list-annotation.tsx
1245
- import { creatorHelper as creatorHelper4 } from "@manifest-editor/creator-api";
1246
- async function createImageUrlListAnnotation(payload, ctx) {
1247
- const items = [];
1248
- const createAnnotation = creatorHelper4(ctx, "AnnotationPage", "items", "@manifest-editor/image-url-annotation");
1249
- for (const image of payload.images) {
1250
- items.push(await createAnnotation(image, ctx.options));
1251
- }
1252
- return items;
1253
- }
1254
-
1255
- // src/Annotation/ImageUrlListAnnotation/index.tsx
1256
- import { jsx as jsx17 } from "react/jsx-runtime";
1257
- var imageUrlListAnnotation = defineCreator6({
1258
- id: "@manifest-editor/image-url-list-annotation",
1259
- create: createImageUrlListAnnotation,
1260
- label: "List of Images",
1261
- dependencies: ["@manifest-editor/image-url-annotation"],
1262
- summary: "List of Images from URLs",
1263
- tags: ["image"],
1264
- icon: /* @__PURE__ */ jsx17(ImageListIcon, {}),
1265
- render(ctx) {
1266
- return /* @__PURE__ */ jsx17(CreateImageUrlListForm, { ...ctx });
1267
- },
1268
- resourceType: "Annotation",
1269
- resourceFields: ["id", "type", "motivation", "body", "target"],
1270
- additionalTypes: ["Canvas"],
1271
- supports: {
1272
- parentTypes: ["AnnotationPage", "Manifest"],
1273
- parentFields: ["items"]
1274
- },
1275
- sideEffects: [resizeToFitService, resizeResourceToEmptyCanvas, repositionMultipleImages],
1276
- staticFields: {
1277
- type: "Annotation"
1278
- }
1279
- });
1280
-
1281
- // src/Annotation/NoBodyAnnotation/index.tsx
1282
- import { EmptyCanvasIcon } from "@manifest-editor/components";
1283
- import { defineCreator as defineCreator7 } from "@manifest-editor/creator-api";
1284
- import { jsx as jsx18 } from "react/jsx-runtime";
1285
- var noBodyAnnotation = defineCreator7({
1286
- id: "@manifest-editor/no-body-annotation",
1287
- create: createNoBodyAnnotation,
1288
- label: "Annotation without body",
1289
- summary: "Add an annotation that only has motivation and target",
1290
- icon: /* @__PURE__ */ jsx18(EmptyCanvasIcon, {}),
1291
- resourceType: "Annotation",
1292
- resourceFields: ["id", "type", "motivation", "target"],
1293
- supports: {
1294
- initialData: true,
1295
- parentTypes: ["AnnotationPage"],
1296
- parentFields: ["items"],
1297
- disallowPainting: true
1298
- },
1299
- sideEffects: [],
1300
- staticFields: {
1301
- type: "Annotation"
1302
- }
1303
- });
1304
- function createNoBodyAnnotation(data, ctx) {
1305
- return ctx.embed({
1306
- id: ctx.generateId("annotation"),
1307
- type: "Annotation",
1308
- label: data?.label,
1309
- motivation: data.motivation || ctx.options.initialData?.motivation || "highlighting",
1310
- target: ctx.getTarget()
1311
- });
1312
- }
1313
-
1314
- // src/Annotation/VideoAnnotation/index.tsx
1315
- import { VideoIcon } from "@manifest-editor/components";
1316
- import { defineCreator as defineCreator8 } from "@manifest-editor/creator-api";
1317
-
1318
- // src/Annotation/VideoAnnotation/create-video-annotation.tsx
1319
- import { getValue as getValue3 } from "@iiif/helpers";
1320
- import { ActionButton as ActionButton7, ErrorMessage as ErrorMessage2 } from "@manifest-editor/components";
1321
- import { DimensionsTriplet, Input as Input5, InputContainer as InputContainer5, InputLabel as InputLabel5, LanguageFieldEditor as LanguageFieldEditor4 } from "@manifest-editor/editors";
1322
-
1323
- // ../ui/ui/VideoPlayer/VideoPlayer.tsx
1324
- import { CanvasPanel as CanvasPanel2, MediaPlayerProvider, useSimpleMediaPlayer } from "react-iiif-vault";
1325
- import { jsx as jsx19, jsxs as jsxs10 } from "react/jsx-runtime";
1326
- function VideoPlayer({
1327
- media,
1328
- onError,
1329
- duration,
1330
- onDuration,
1331
- onDimensions
1332
- }) {
1333
- const [{ element, currentTime, progress }, state, actions] = useSimpleMediaPlayer({ duration });
1334
- return /* @__PURE__ */ jsxs10(
1335
- MediaPlayerProvider,
1336
- {
1337
- element,
1338
- state,
1339
- actions,
1340
- currentTime,
1341
- progress,
1342
- children: [
1343
- /* @__PURE__ */ jsx19(
1344
- "div",
1345
- {
1346
- style: {
1347
- maxHeight: 400,
1348
- aspectRatio: `${media.width}/${media.height}`,
1349
- position: "relative"
1350
- },
1351
- children: /* @__PURE__ */ jsx19(CanvasPanel2.VideoHTML, { element, media, playPause: actions.playPause })
1352
- }
1353
- ),
1354
- /* @__PURE__ */ jsx19(MediaControls, { onError, onDuration, onDimensions })
1355
- ]
1356
- }
1357
- );
1358
- }
1359
-
1360
- // src/Annotation/VideoAnnotation/create-video-annotation.tsx
1361
- import { useEffect as useEffect3, useState as useState6 } from "react";
1362
- import { jsx as jsx20, jsxs as jsxs11 } from "react/jsx-runtime";
1363
- async function createVideoAnnotation(data, ctx) {
1364
- const annotation = {
1365
- id: ctx.generateId("annotation"),
1366
- type: "Annotation"
1367
- };
1368
- const targetType = ctx.options.targetType;
1369
- const body = ctx.embed({
1370
- id: data.url,
1371
- type: "Video",
1372
- format: "video/mp4",
1373
- width: data.width,
1374
- height: data.height,
1375
- duration: data.duration || 0
1376
- });
1377
- if (targetType === "Annotation") {
1378
- return ctx.embed({
1379
- ...annotation,
1380
- label: getValue3(data.label) && data.label,
1381
- motivation: data.motivation || ctx.options.initialData?.motivation || "painting",
1382
- body,
1383
- target: ctx.getTarget()
1384
- });
1385
- }
1386
- if (targetType === "Canvas") {
1387
- const canvasId = ctx.generateId("canvas");
1388
- const pageId = ctx.generateId("annotation-page", {
1389
- id: canvasId,
1390
- type: "Canvas"
1391
- });
1392
- const annotationResource = ctx.embed({
1393
- ...annotation,
1394
- motivation: "painting",
1395
- body,
1396
- target: {
1397
- type: "SpecificResource",
1398
- source: { id: canvasId, type: "Canvas" }
1399
- }
1400
- });
1401
- const page = ctx.embed({
1402
- id: pageId,
1403
- type: "AnnotationPage",
1404
- items: [annotationResource]
1405
- });
1406
- return ctx.embed({
1407
- id: canvasId,
1408
- type: "Canvas",
1409
- label: data.label || { en: ["Untitled HTML canvas"] },
1410
- duration: data.duration || 0,
1411
- width: data.width,
1412
- height: data.height,
1413
- items: [page]
1414
- });
1415
- }
1416
- }
1417
- function CreateVideoAnnotationForm(props) {
1418
- const [url, setUrl] = useState6("");
1419
- const [duration, setDuration] = useState6(0);
1420
- const [width, setWidth] = useState6(0);
1421
- const [height, setHeight] = useState6(0);
1422
- const [error, setError] = useState6("");
1423
- const [label, setLabel] = useState6({ en: [""] });
1424
- const onSubmit = () => {
1425
- props.runCreate({
1426
- url,
1427
- duration,
1428
- label,
1429
- width,
1430
- height
1431
- });
1432
- };
1433
- useEffect3(() => {
1434
- setError("");
1435
- setDuration(0);
1436
- if (url) {
1437
- const labelFromUrl = url.split("/").pop()?.split(".").shift();
1438
- setLabel({ en: [labelFromUrl || ""] });
1439
- }
1440
- }, [url]);
1441
- return /* @__PURE__ */ jsxs11(PaddedSidebarContainer, { children: [
1442
- error ? /* @__PURE__ */ jsx20(ErrorMessage2, { children: error }) : null,
1443
- /* @__PURE__ */ jsxs11(InputContainer5, { $wide: true, children: [
1444
- /* @__PURE__ */ jsx20(InputLabel5, { htmlFor: "video-url", children: "URL" }),
1445
- /* @__PURE__ */ jsx20(Input5, { type: "text", id: "video-url", value: url, onChange: (e) => setUrl(e.target.value) })
1446
- ] }),
1447
- url && !error ? /* @__PURE__ */ jsx20("div", { children: /* @__PURE__ */ jsx20(
1448
- LanguageFieldEditor4,
1449
- {
1450
- containerId: "label",
1451
- focusId: "label_",
1452
- label: "Label",
1453
- fields: label,
1454
- onSave: (e) => setLabel(e.toInternationalString())
1455
- },
1456
- `${url}__${duration}`
1457
- ) }) : null,
1458
- url && !error ? /* @__PURE__ */ jsx20("div", { className: "mb-4 bg-black", children: /* @__PURE__ */ jsx20(
1459
- VideoPlayer,
1460
- {
1461
- duration,
1462
- onDuration: (d) => setDuration(d),
1463
- onError: (err) => setError(err),
1464
- media: {
1465
- url,
1466
- duration,
1467
- height,
1468
- width,
1469
- type: "Video"
1470
- },
1471
- onDimensions: (w, h) => {
1472
- setWidth(w || 0);
1473
- setHeight(h || 0);
1474
- }
1475
- }
1476
- ) }) : null,
1477
- !error && (duration || width || height) ? /* @__PURE__ */ jsx20(InputContainer5, { $wide: true, children: /* @__PURE__ */ jsx20(
1478
- DimensionsTriplet,
1479
- {
1480
- widthId: "width",
1481
- width: width || 0,
1482
- changeWidth: (v) => setWidth(v),
1483
- heightId: "height",
1484
- height: height || 0,
1485
- changeHeight: (v) => setHeight(v),
1486
- durationId: "duration",
1487
- duration: duration || 0,
1488
- changeDuration: (v) => setDuration(v)
1489
- }
1490
- ) }) : null,
1491
- /* @__PURE__ */ jsx20(ActionButton7, { primary: true, large: true, type: "button", onPress: onSubmit, isDisabled: !url || !!error, children: "Add video" })
1492
- ] });
1493
- }
1494
-
1495
- // src/Annotation/VideoAnnotation/index.tsx
1496
- import { jsx as jsx21 } from "react/jsx-runtime";
1497
- var videoAnnotation = defineCreator8({
1498
- id: "@manifest-editor/video-annotation",
1499
- create: createVideoAnnotation,
1500
- label: "Video",
1501
- summary: "Video annotation",
1502
- icon: /* @__PURE__ */ jsx21(VideoIcon, {}),
1503
- render(ctx) {
1504
- return /* @__PURE__ */ jsx21(CreateVideoAnnotationForm, { ...ctx });
1505
- },
1506
- resourceType: "Annotation",
1507
- resourceFields: ["id", "type", "motivation", "body", "target"],
1508
- additionalTypes: ["Canvas"],
1509
- supports: {
1510
- initialData: true,
1511
- parentTypes: ["AnnotationPage", "Manifest"],
1512
- parentFields: ["items"]
1513
- },
1514
- staticFields: {
1515
- type: "Annotation"
1516
- }
1517
- });
1518
-
1519
- // src/AnnotationPage/EmptyAnnotationPage/index.tsx
1520
- import { defineCreator as defineCreator9 } from "@manifest-editor/creator-api";
1521
-
1522
- // ../ui/icons/ThumbnailStripIcon.tsx
1523
- import { jsx as jsx22, jsxs as jsxs12 } from "react/jsx-runtime";
1524
- var ThumbnailStripIcon = () => /* @__PURE__ */ jsx22(
1525
- "svg",
1526
- {
1527
- xmlns: "http://www.w3.org/2000/svg",
1528
- height: "24px",
1529
- viewBox: "0 0 24 24",
1530
- width: "24px",
1531
- fill: "#000000",
1532
- transform: "scale(-1, 1)",
1533
- children: /* @__PURE__ */ jsxs12("g", { children: [
1534
- /* @__PURE__ */ jsx22("rect", { fill: "none", height: "24", width: "24" }),
1535
- /* @__PURE__ */ jsx22("path", { d: "M16,20H2V4h14V20z M18,8h4V4h-4V8z M18,20h4v-4h-4V20z M18,14h4v-4h-4V14z" })
1536
- ] })
1537
- }
1538
- );
1539
-
1540
- // src/AnnotationPage/EmptyAnnotationPage/index.tsx
1541
- import { jsx as jsx23 } from "react/jsx-runtime";
1542
- var emptyAnnotationPage = defineCreator9({
1543
- id: "@manifest-editor/empty-annotation-page",
1544
- create: (data, ctx) => {
1545
- return ctx.embed({
1546
- id: ctx.generateId("annotations"),
1547
- label: data.label,
1548
- type: "AnnotationPage",
1549
- items: []
1550
- });
1551
- },
1552
- label: "Empty annotation page",
1553
- summary: "AnnotationPage with nothing",
1554
- icon: /* @__PURE__ */ jsx23(ThumbnailStripIcon, {}),
1555
- resourceType: "AnnotationPage",
1556
- resourceFields: ["id", "type", "items"],
1557
- supports: {
1558
- parentTypes: ["Manifest", "Canvas", "Range"],
1559
- parentFieldMap: {
1560
- Manifest: ["annotations"],
1561
- Canvas: ["items", "annotations"],
1562
- Range: ["annotations"]
1563
- }
1564
- }
1565
- });
1566
-
1567
- // src/Canvas/EmptyCanvas/index.tsx
1568
- import { EmptyCanvasIcon as EmptyCanvasIcon2 } from "@manifest-editor/components";
1569
- import { defineCreator as defineCreator10 } from "@manifest-editor/creator-api";
1570
- import { jsx as jsx24 } from "react/jsx-runtime";
1571
- var emptyCanvas = defineCreator10({
1572
- id: "@manifest-editor/empty-canvas",
1573
- create: (data, ctx) => {
1574
- const canvasId = ctx.generateId("canvas");
1575
- const page = ctx.embed({
1576
- id: ctx.generateId("annotation-page", { id: canvasId, type: "Canvas" }),
1577
- type: "AnnotationPage",
1578
- items: []
1579
- });
1580
- return {
1581
- id: canvasId,
1582
- type: "Canvas",
1583
- label: data.label || { en: [""] },
1584
- height: data.height || 1e3,
1585
- width: data.width || 1e3,
1586
- items: [page]
1587
- };
1588
- },
1589
- label: "Empty canvas",
1590
- summary: "No content",
1591
- icon: /* @__PURE__ */ jsx24(EmptyCanvasIcon2, {}),
1592
- resourceType: "Canvas",
1593
- resourceFields: ["id", "type", "label", "height", "width", "items"],
1594
- supports: {
1595
- parentTypes: ["Manifest"],
1596
- parentFields: ["items"]
1597
- }
1598
- });
1599
-
1600
- // src/Canvas/InternalCanvas/index.tsx
1601
- import { defineCreator as defineCreator11 } from "@manifest-editor/creator-api";
1602
- import { IIIFExplorer } from "@manifest-editor/iiif-browser";
1603
- import { useManifest, useVault } from "react-iiif-vault";
1604
-
1605
- // ../../node_modules/.pnpm/tiny-invariant@1.3.3/node_modules/tiny-invariant/dist/esm/tiny-invariant.js
1606
- var isProduction = false;
1607
- var prefix = "Invariant failed";
1608
- function invariant(condition, message) {
1609
- if (condition) {
1610
- return;
1611
- }
1612
- if (isProduction) {
1613
- throw new Error(prefix);
1614
- }
1615
- var provided = typeof message === "function" ? message() : message;
1616
- var value = provided ? "".concat(prefix, ": ").concat(provided) : prefix;
1617
- throw new Error(value);
1618
- }
1619
-
1620
- // src/Canvas/InternalCanvas/index.tsx
1621
- import { jsx as jsx25 } from "react/jsx-runtime";
1622
- var internalCanvas = defineCreator11({
1623
- id: "@manifest-editor/internal-canvas",
1624
- create: createInternalCanvas,
1625
- label: "Internal canvas link",
1626
- summary: "Canvas from the same manifest",
1627
- icon: /* @__PURE__ */ jsx25(ThumbnailStripIcon, {}),
1628
- resourceType: "Canvas",
1629
- resourceFields: ["id", "type", "label"],
1630
- supports: {
1631
- parentTypes: ["Manifest"],
1632
- parentFields: ["start"]
1633
- },
1634
- render: (ctx) => /* @__PURE__ */ jsx25(InternalCanvas, { ...ctx })
1635
- });
1636
- function InternalCanvas(props) {
1637
- const manifest = useManifest();
1638
- const vault = useVault();
1639
- invariant(manifest, "Manifest is not loaded");
1640
- return /* @__PURE__ */ jsx25(
1641
- IIIFExplorer,
1642
- {
1643
- vault,
1644
- entry: manifest,
1645
- window: false,
1646
- hideHeader: true,
1647
- hideBack: true,
1648
- output: { type: "url" },
1649
- outputTargets: [
1650
- {
1651
- type: "callback",
1652
- label: "Select canvas",
1653
- cb: (url) => {
1654
- props.runCreate({ id: url });
1655
- }
1656
- }
1657
- ],
1658
- outputTypes: ["Canvas"]
1659
- }
1660
- );
1661
- }
1662
- async function createInternalCanvas(data, ctx) {
1663
- return ctx.embed({ id: data.id, type: "Canvas" });
1664
- }
1665
-
1666
- // src/ContentResource/HTMLBodyCreator/index.tsx
1667
- import { defineCreator as defineCreator12 } from "@manifest-editor/creator-api";
1668
-
1669
- // ../ui/icons/TextFormatIcon.tsx
1670
- import { jsx as jsx26, jsxs as jsxs13 } from "react/jsx-runtime";
1671
- var TextFormatIcon = (props) => /* @__PURE__ */ jsxs13("svg", { xmlns: "http://www.w3.org/2000/svg", viewBox: "0 0 24 24", height: "1em", width: "1em", ...props, children: [
1672
- /* @__PURE__ */ jsx26("path", { d: "M0 0h24v24H0z", fill: "none" }),
1673
- /* @__PURE__ */ jsx26("path", { d: "M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98 13.87 11h-3.74L12 5.98z" })
1674
- ] });
1675
-
1676
- // src/ContentResource/HTMLBodyCreator/create-html-body.tsx
1677
- import { ActionButton as ActionButton8 } from "@manifest-editor/components";
1678
- import { InputContainer as InputContainer6, InputLabel as InputLabel6, RichTextLanguageField } from "@manifest-editor/editors";
1679
- import { useConfig } from "@manifest-editor/shell";
1680
- import { useState as useState7 } from "react";
1681
- import { jsx as jsx27, jsxs as jsxs14 } from "react/jsx-runtime";
1682
- async function createHtmlBody(data, ctx) {
1683
- return ctx.embed({
1684
- id: ctx.generateId(`html/${data.language}`),
1685
- language: data.language,
1686
- type: "TextualBody",
1687
- format: "text/html",
1688
- value: data.body || ""
1689
- });
1690
- }
1691
- function CreateHTMLBodyForm(props) {
1692
- const { i18n } = useConfig();
1693
- const [body, setBodyValue] = useState7("<p></p>");
1694
- const [language, setLang] = useState7(i18n.defaultLanguage);
1695
- const onSubmit = () => {
1696
- props.runCreate({
1697
- language,
1698
- body
1699
- });
1700
- };
1701
- return /* @__PURE__ */ jsxs14(PaddedSidebarContainer, { children: [
1702
- /* @__PURE__ */ jsxs14(InputContainer6, { children: [
1703
- /* @__PURE__ */ jsx27(InputLabel6, { children: "HTML Body" }),
1704
- /* @__PURE__ */ jsx27(
1705
- RichTextLanguageField,
1706
- {
1707
- value: body,
1708
- language,
1709
- onUpdateLanguage: (lng) => setLang(lng),
1710
- languages: i18n.availableLanguages,
1711
- onUpdate: (e) => setBodyValue(e)
1712
- }
1713
- )
1714
- ] }),
1715
- /* @__PURE__ */ jsx27(ActionButton8, { primary: true, large: true, type: "button", onPress: onSubmit, children: "Create" })
1716
- ] });
1717
- }
1718
-
1719
- // src/ContentResource/HTMLBodyCreator/index.tsx
1720
- import { jsx as jsx28 } from "react/jsx-runtime";
1721
- var htmlBodyCreator = defineCreator12({
1722
- id: "@manifest-editor/html-body-creator",
1723
- create: createHtmlBody,
1724
- label: "HTML Body",
1725
- summary: "Add HTML annotation body",
1726
- icon: /* @__PURE__ */ jsx28(TextFormatIcon, {}),
1727
- render(ctx) {
1728
- return /* @__PURE__ */ jsx28(CreateHTMLBodyForm, { ...ctx });
1729
- },
1730
- resourceType: "ContentResource",
1731
- resourceFields: ["id", "language", "type", "format", "value"],
1732
- supports: {
1733
- parentTypes: ["Annotation"],
1734
- parentFields: ["body"]
1735
- },
1736
- staticFields: {
1737
- type: "TextualBody",
1738
- format: "text/html"
1739
- }
1740
- });
1741
-
1742
- // src/ContentResource/IIIFBrowserCreator/index.tsx
1743
- import { IIIFBrowserIcon } from "@manifest-editor/components";
1744
- import { defineCreator as defineCreator13 } from "@manifest-editor/creator-api";
1745
-
1746
- // src/ContentResource/IIIFBrowserCreator/iiif-browser-creator.tsx
1747
- import { Vault } from "@iiif/helpers";
1748
- import { getImageServices } from "@iiif/parser/image-3";
1749
- import { lazy } from "react";
1750
- function croppedRegion(imageServiceId, region, size) {
1751
- return `${imageServiceId}/${Math.floor(region.x)},${Math.floor(region.y)},${Math.floor(region.width)},${Math.floor(
1752
- region.height
1753
- )}/${size}/0/default.jpg`;
1754
- }
1755
- async function createFromIIIFBrowserOutput(data, ctx) {
1756
- const targetType = ctx.options.targetType;
1757
- const resources = data.output;
1758
- const returnResources = [];
1759
- for (const { resource, selector, parent } of resources) {
1760
- const type = resource.type;
1761
- const previewVault = new Vault();
1762
- if (targetType === "Canvas" || targetType === "Annotation" || targetType === "ContentResource") {
1763
- if (type === "Canvas") {
1764
- const canvasId = resource.id;
1765
- const manifestId = parent?.type === "Manifest" ? parent.id : void 0;
1766
- invariant(manifestId, "Could not find Manifest");
1767
- const manifest = await previewVault.loadManifest(manifestId);
1768
- invariant(manifest, "Manifest not found");
1769
- const canvasRef = manifest.items.find((item) => item.id === canvasId);
1770
- invariant(canvasRef, "Canvas not found");
1771
- const canvas = previewVault.get(canvasRef);
1772
- if (targetType === "Canvas" && selector?.type !== "BoxSelector") {
1773
- const fullCanvas = previewVault.toPresentation3(canvas);
1774
- if (!fullCanvas.label) {
1775
- fullCanvas.label = { en: ["Untitled canvas"] };
1776
- }
1777
- ctx.vault.loadSync(fullCanvas.id, fullCanvas);
1778
- returnResources.push(ctx.embed(fullCanvas));
1779
- continue;
1780
- }
1781
- const annotationPage = previewVault.get(canvas.items[0]);
1782
- const annotation = previewVault.get(annotationPage.items[0]);
1783
- if (targetType === "Annotation" || targetType === "Canvas" || targetType === "ContentResource") {
1784
- const fullAnnotation = previewVault.toPresentation3(annotation);
1785
- fullAnnotation.id = ctx.generateId("Annotation");
1786
- let service = null;
1787
- const dimensions = { width: 0, height: 0 };
1788
- if (fullAnnotation?.body?.service) {
1789
- const width = fullAnnotation?.body.width;
1790
- const height = fullAnnotation?.body.height;
1791
- service = getImageServices(fullAnnotation?.body)[0];
1792
- if (service && (!service.width || !service.height)) {
1793
- service.width = width;
1794
- service.height = height;
1795
- }
1796
- dimensions.width = width;
1797
- dimensions.height = height;
1798
- if (data.trackSize) {
1799
- data.trackSize(dimensions);
1800
- }
1801
- }
1802
- if (selector?.type === "BoxSelector") {
1803
- const imageApiSelector = {
1804
- type: "ImageApiSelector",
1805
- region: [
1806
- ~~selector.spatial.x,
1807
- ~~selector.spatial.y,
1808
- ~~selector.spatial.width,
1809
- ~~selector.spatial.height
1810
- ].join(",")
1811
- };
1812
- const newBody = { ...fullAnnotation.body };
1813
- let thumbnailId = "";
1814
- if (service) {
1815
- const id = service.id || service["@id"] || "";
1816
- if (id) {
1817
- newBody.id = croppedRegion(id, selector.spatial, "max");
1818
- thumbnailId = croppedRegion(id, selector.spatial, "512,");
1819
- }
1820
- }
1821
- fullAnnotation.body = {
1822
- id: ctx.generateId("SpecificResource", annotation),
1823
- type: "SpecificResource",
1824
- source: newBody,
1825
- selector: imageApiSelector
1826
- };
1827
- if (data.trackSize) {
1828
- data.trackSize({
1829
- width: ~~selector.spatial.width,
1830
- height: ~~selector.spatial.height
1831
- });
1832
- }
1833
- if (targetType === "ContentResource") {
1834
- returnResources.push(fullAnnotation.body);
1835
- continue;
1836
- }
1837
- if (targetType === "Canvas") {
1838
- const canvasId2 = ctx.generateId("Canvas", annotation);
1839
- fullAnnotation.target = canvasId2;
1840
- const pageId = ctx.generateId("Page", annotation);
1841
- const annotationPage2 = ctx.embed({
1842
- id: pageId,
1843
- type: "AnnotationPage",
1844
- items: [fullAnnotation]
1845
- });
1846
- returnResources.push(
1847
- ctx.embed({
1848
- id: canvasId2,
1849
- type: "Canvas",
1850
- label: { en: ["Untitled canvas"] },
1851
- width: ~~selector.spatial.width,
1852
- height: ~~selector.spatial.height,
1853
- thumbnail: thumbnailId ? [
1854
- ctx.embed({
1855
- id: thumbnailId,
1856
- type: "Image",
1857
- format: "image/jpeg",
1858
- width: 512,
1859
- height: Math.round(selector.spatial.height / selector.spatial.width * 512)
1860
- })
1861
- ] : void 0,
1862
- items: [annotationPage2]
1863
- })
1864
- );
1865
- continue;
1866
- }
1867
- returnResources.push(
1868
- ctx.embed({
1869
- ...fullAnnotation,
1870
- target: ctx.getTarget()
1871
- })
1872
- );
1873
- continue;
1874
- }
1875
- returnResources.push(
1876
- ctx.embed({
1877
- ...previewVault.toPresentation3(annotation),
1878
- target: ctx.getTarget()
1879
- })
1880
- );
1881
- }
1882
- }
1883
- }
1884
- }
1885
- return returnResources;
1886
- }
1887
- var IIIFBrowserCreatorForm = lazy(() => import("./iiif-browser-form.lazy-FQDZQ3UW.js"));
1888
-
1889
- // src/ContentResource/IIIFBrowserCreator/index.tsx
1890
- import { jsx as jsx29 } from "react/jsx-runtime";
1891
- var iiifBrowserCreator = defineCreator13({
1892
- id: "@manifest-editor/iiif-browser-creator",
1893
- create: createFromIIIFBrowserOutput,
1894
- label: "IIIF Browser",
1895
- summary: "Browse IIIF Resources",
1896
- icon: /* @__PURE__ */ jsx29(IIIFBrowserIcon, {}),
1897
- render(ctx) {
1898
- return /* @__PURE__ */ jsx29(IIIFBrowserCreatorForm, { ...ctx });
1899
- },
1900
- hiddenModal: true,
1901
- tags: ["image", "image-service"],
1902
- resourceType: "ContentResource",
1903
- resourceFields: ["id", "language", "type", "format", "value"],
1904
- additionalTypes: ["Annotation", "Canvas"],
1905
- supports: {
1906
- parentTypes: ["Annotation", "Manifest", "AnnotationPage"],
1907
- parentFields: ["body", "items"],
1908
- parentFieldMap: {
1909
- Annotation: ["body"],
1910
- Manifest: ["items"],
1911
- AnnotationPage: ["items"]
1912
- }
1913
- },
1914
- sideEffects: [resizeToFitService, resizeResourceToEmptyCanvas, repositionMultipleImages],
1915
- staticFields: {}
1916
- });
1917
-
1918
- // src/ContentResource/ImageServiceCreator/index.tsx
1919
- import { IIIFLogo as IIIFLogo2 } from "@manifest-editor/components";
1920
- import { defineCreator as defineCreator14 } from "@manifest-editor/creator-api";
1921
- import { jsx as jsx30 } from "react/jsx-runtime";
1922
- var imageServiceCreator = defineCreator14({
1923
- id: "@manifest-editor/image-service-creator",
1924
- create: createImageServer,
1925
- label: "Image Service",
1926
- summary: "Add an image from Image Service",
1927
- icon: /* @__PURE__ */ jsx30(IIIFLogo2, { style: { padding: 10 } }),
1928
- render(ctx) {
1929
- return /* @__PURE__ */ jsx30(CreateImageServerForm, { ...ctx });
1930
- },
1931
- resourceType: "ContentResource",
1932
- resourceFields: ["id", "type", "height", "width", "format", "service"],
1933
- supports: {
1934
- parentFields: ["logo", "body", "thumbnail"]
1935
- }
1936
- });
1937
-
1938
- // src/ContentResource/ImageUrlCreator/index.tsx
1939
- import { AddImageIcon as AddImageIcon3 } from "@manifest-editor/components";
1940
- import { defineCreator as defineCreator15 } from "@manifest-editor/creator-api";
1941
- import { jsx as jsx31 } from "react/jsx-runtime";
1942
- var imageUrlCreator = defineCreator15({
1943
- id: "@manifest-editor/image-url-creator",
1944
- create: createImageUrl,
1945
- label: "Image",
1946
- summary: "Image from a URL",
1947
- icon: /* @__PURE__ */ jsx31(AddImageIcon3, {}),
1948
- render(ctx) {
1949
- return /* @__PURE__ */ jsx31(CreateImageUrlForm, { ...ctx });
1950
- },
1951
- resourceType: "ContentResource",
1952
- resourceFields: ["format"],
1953
- supports: {
1954
- parentFields: ["logo", "body", "thumbnail"]
1955
- },
1956
- staticFields: {
1957
- type: "Image"
1958
- }
1959
- });
1960
-
1961
- // src/ContentResource/ImageUrlListCreator/index.tsx
1962
- import { ImageListIcon as ImageListIcon2 } from "@manifest-editor/components";
1963
- import { defineCreator as defineCreator16 } from "@manifest-editor/creator-api";
1964
- import { jsx as jsx32 } from "react/jsx-runtime";
1965
- var imageUrlListCreator = defineCreator16({
1966
- id: "@manifest-editor/image-url-list",
1967
- label: "Image URL List",
1968
- summary: "Image from a list of URLs",
1969
- create: createImageUrlList,
1970
- icon: /* @__PURE__ */ jsx32(ImageListIcon2, {}),
1971
- render(ctx) {
1972
- return /* @__PURE__ */ jsx32(CreateImageUrlListForm, { ...ctx });
1973
- },
1974
- resourceType: "ContentResource",
1975
- resourceFields: ["format"],
1976
- supports: {
1977
- parentFields: ["logo", "body", "thumbnail"]
1978
- },
1979
- staticFields: {
1980
- type: "Image"
1981
- }
1982
- });
1983
-
1984
- // src/ContentResource/PlaintextCreator/index.tsx
1985
- import { defineCreator as defineCreator17 } from "@manifest-editor/creator-api";
1986
-
1987
- // src/ContentResource/PlaintextCreator/create-plaintext.tsx
1988
- import { ActionButton as ActionButton9 } from "@manifest-editor/components";
1989
- import { Input as Input6, InputContainer as InputContainer7, InputLabel as InputLabel7, LanguageFieldEditor as LanguageFieldEditor5 } from "@manifest-editor/editors";
1990
- import { useState as useState8 } from "react";
1991
- import { jsx as jsx33, jsxs as jsxs15 } from "react/jsx-runtime";
1992
- async function createPlaintext(data, ctx) {
1993
- return ctx.embed({
1994
- id: data.url,
1995
- type: "Text",
1996
- label: data.label,
1997
- format: "text/plain"
1998
- });
1999
- }
2000
- function CreatePlaintextForm(props) {
2001
- const [label, setLabel] = useState8({
2002
- en: ["View as text"]
2003
- });
2004
- const onSubmit = (e) => {
2005
- e.preventDefault();
2006
- const data = new FormData(e.target);
2007
- const formData = Object.fromEntries(data.entries());
2008
- if (formData.url) {
2009
- props.runCreate({ url: formData.url, label });
2010
- }
2011
- };
2012
- return /* @__PURE__ */ jsx33(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs15("form", { onSubmit, children: [
2013
- /* @__PURE__ */ jsx33(
2014
- LanguageFieldEditor5,
2015
- {
2016
- focusId: "label",
2017
- label: "Label",
2018
- fields: label,
2019
- onSave: (e) => setLabel(e.toInternationalString())
2020
- }
2021
- ),
2022
- /* @__PURE__ */ jsxs15(InputContainer7, { $wide: true, children: [
2023
- /* @__PURE__ */ jsx33(InputLabel7, { htmlFor: "id", children: "Link to plaintext" }),
2024
- /* @__PURE__ */ jsx33(Input6, { id: "url", name: "url", defaultValue: "" })
2025
- ] }),
2026
- /* @__PURE__ */ jsx33(ActionButton9, { primary: true, large: true, type: "submit", children: "Create" })
2027
- ] }) });
2028
- }
2029
-
2030
- // src/ContentResource/PlaintextCreator/index.tsx
2031
- import { jsx as jsx34 } from "react/jsx-runtime";
2032
- var plaintextCreator = defineCreator17({
2033
- id: "@manifest-editor/plaintext-creator",
2034
- create: createPlaintext,
2035
- label: "Plaintext",
2036
- summary: "Add link to an plaintext",
2037
- icon: /* @__PURE__ */ jsx34(TextFormatIcon, {}),
2038
- render(ctx) {
2039
- return /* @__PURE__ */ jsx34(CreatePlaintextForm, { ...ctx });
2040
- },
2041
- resourceType: "ContentResource",
2042
- resourceFields: ["label", "format"],
2043
- supports: {
2044
- parentFields: ["seeAlso", "rendering", "homepage"]
2045
- },
2046
- staticFields: {
2047
- format: "text/plain"
2048
- }
2049
- });
2050
-
2051
- // src/ContentResource/ThumbnailCreator/index.tsx
2052
- import { ScaledImageIcon } from "@manifest-editor/components";
2053
- import { defineCreator as defineCreator18 } from "@manifest-editor/creator-api";
2054
-
2055
- // src/ContentResource/ThumbnailCreator/create-thumbnail.tsx
2056
- import { ActionButton as ActionButton10 } from "@manifest-editor/components";
2057
- import { Input as Input7, InputContainer as InputContainer8, InputLabel as InputLabel8 } from "@manifest-editor/editors";
2058
- import { useMemo, useState as useState9 } from "react";
2059
-
2060
- // src/ContentResource/ThumbnailCreator/thumbnail-helpers.ts
2061
- import {
2062
- canonicalServiceUrl as canonicalServiceUrl3,
2063
- createImageServiceRequest as createImageServiceRequest2,
2064
- imageServiceRequestToString as imageServiceRequestToString2,
2065
- parseImageServiceRequest as parseImageServiceRequest2
2066
- } from "@iiif/parser/image-3";
2067
- function serviceImageAtSize(service, size) {
2068
- if (service["@id"]) {
2069
- service.id = service["@id"];
2070
- }
2071
- if (service["@type"]) {
2072
- service.type = service["@type"];
2073
- }
2074
- const request = createImageServiceRequest2(service);
2075
- return imageServiceRequestToString2({
2076
- identifier: request.identifier,
2077
- server: request.server,
2078
- scheme: request.scheme,
2079
- type: "image",
2080
- size: {
2081
- max: false,
2082
- confined: false,
2083
- upscaled: false,
2084
- width: size.width,
2085
- height: size.height
2086
- },
2087
- format: "jpg",
2088
- // This isn't how it should be modelled, always full,
2089
- // region: data.selector ? data.selector : { full: true },
2090
- region: { full: true },
2091
- rotation: { angle: 0 },
2092
- quality: "default",
2093
- prefix: request.prefix,
2094
- originalPath: request.originalPath
2095
- });
2096
- }
2097
- function getCanonicalUrl2(url) {
2098
- return url.endsWith("default.jpg") ? imageServiceRequestToString2({
2099
- ...parseImageServiceRequest2(url),
2100
- type: "info"
2101
- }) : canonicalServiceUrl3(url);
2102
- }
2103
-
2104
- // src/ContentResource/ThumbnailCreator/create-thumbnail.tsx
2105
- import { jsx as jsx35, jsxs as jsxs16 } from "react/jsx-runtime";
2106
- async function createThumbnail(data, ctx) {
2107
- const service = { ...data.service };
2108
- const sizes = service.sizes;
2109
- if (service["@id"]) {
2110
- service.id = service["@id"];
2111
- }
2112
- if (service["@type"]) {
2113
- service.type = service["@type"];
2114
- }
2115
- if (data.thumbnailUrl) {
2116
- return ctx.embed({
2117
- id: data.thumbnailUrl,
2118
- type: "Image",
2119
- format: "image/jpeg",
2120
- width: data.width,
2121
- height: data.height
2122
- });
2123
- }
2124
- if (sizes) {
2125
- const thumbnailSize = data.width || 400;
2126
- let bestMatch = null;
2127
- for (const size of sizes) {
2128
- if (!bestMatch || Math.abs(size.width - thumbnailSize) < Math.abs(bestMatch.width - thumbnailSize)) {
2129
- bestMatch = { width: size.width, height: size.height };
2130
- }
2131
- }
2132
- if (bestMatch) {
2133
- const imageId = serviceImageAtSize(service, bestMatch);
2134
- return ctx.embed({
2135
- id: imageId,
2136
- type: "Image",
2137
- format: "image/jpeg",
2138
- width: bestMatch.width,
2139
- height: bestMatch.height
2140
- });
2141
- }
2142
- }
2143
- return null;
2144
- }
2145
- function CreateThumbnailForm(props) {
2146
- const [url, setUrl] = useState9("");
2147
- const [service, setService] = useState9(null);
2148
- const [selectedSize, setSelectedSize] = useState9({ width: 0, height: 0 });
2149
- const previewUrl = useMemo(() => {
2150
- if (!service)
2151
- return null;
2152
- if (!selectedSize.width || !selectedSize.height)
2153
- return null;
2154
- return serviceImageAtSize(service, selectedSize);
2155
- }, [selectedSize, service]);
2156
- const onSubmit = (e) => {
2157
- e.preventDefault();
2158
- const data = new FormData(e.target);
2159
- const formData = Object.fromEntries(data.entries());
2160
- const url2 = formData.url;
2161
- if (url2) {
2162
- const info = getCanonicalUrl2(url2);
2163
- if (!info) {
2164
- throw new Error("Invalid image service request");
2165
- }
2166
- fetch(info).then((r) => r.json()).then((service2) => {
2167
- setService(service2);
2168
- const size0 = service2.sizes?.[0];
2169
- if (size0) {
2170
- setSelectedSize(size0);
2171
- }
2172
- });
2173
- }
2174
- };
2175
- if (service) {
2176
- return /* @__PURE__ */ jsxs16(PaddedSidebarContainer, { children: [
2177
- /* @__PURE__ */ jsxs16("div", { className: "mb-4", children: [
2178
- /* @__PURE__ */ jsx35("div", { className: "mb-2", children: service["@id"] || service.id }),
2179
- /* @__PURE__ */ jsx35("div", { className: "flex gap-2 mb-4", children: service.sizes?.map((size) => {
2180
- const isSelected = size.width === selectedSize.width;
2181
- return /* @__PURE__ */ jsxs16(
2182
- ActionButton10,
2183
- {
2184
- primary: isSelected,
2185
- isDisabled: isSelected,
2186
- large: true,
2187
- onPress: () => setSelectedSize(size),
2188
- children: [
2189
- size.width,
2190
- "x",
2191
- size.height
2192
- ]
2193
- },
2194
- size.width
2195
- );
2196
- }) }),
2197
- previewUrl ? /* @__PURE__ */ jsx35("img", { src: previewUrl, alt: "preview of selected resource" }) : null
2198
- ] }),
2199
- /* @__PURE__ */ jsx35(
2200
- ActionButton10,
2201
- {
2202
- primary: true,
2203
- large: true,
2204
- isDisabled: !previewUrl,
2205
- onPress: () => {
2206
- if (!service)
2207
- return;
2208
- props.runCreate({ service, width: selectedSize.width, height: selectedSize.height });
2209
- },
2210
- children: "Add thumbnail"
2211
- }
2212
- )
2213
- ] });
2214
- }
2215
- return /* @__PURE__ */ jsx35(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs16("form", { onSubmit, children: [
2216
- /* @__PURE__ */ jsx35("div", { className: "flex gap-2 items-center", children: /* @__PURE__ */ jsxs16(InputContainer8, { $wide: true, children: [
2217
- /* @__PURE__ */ jsx35(InputLabel8, { htmlFor: "id", children: "Link to image service" }),
2218
- /* @__PURE__ */ jsx35(
2219
- Input7,
2220
- {
2221
- id: "url",
2222
- name: "url",
2223
- defaultValue: "",
2224
- onPaste: (e) => {
2225
- const text = e.clipboardData.getData("text/plain");
2226
- setUrl(text ? getCanonicalUrl2(text) : "");
2227
- },
2228
- onBlur: (e) => setUrl(e.currentTarget.value ? getCanonicalUrl2(e.currentTarget.value) : "")
2229
- }
2230
- )
2231
- ] }) }),
2232
- /* @__PURE__ */ jsx35("div", { children: /* @__PURE__ */ jsx35(ActionButton10, { primary: true, large: true, type: "submit", isDisabled: !url, children: "Select size" }) })
2233
- ] }) });
2234
- }
2235
-
2236
- // src/ContentResource/ThumbnailCreator/index.tsx
2237
- import { jsx as jsx36 } from "react/jsx-runtime";
2238
- var thumbnailCreator = defineCreator18({
2239
- id: "@manifest-editor/thumbnail-image",
2240
- create: createThumbnail,
2241
- label: "Thumbnail from service",
2242
- summary: "Add thumbnail from an image service",
2243
- icon: /* @__PURE__ */ jsx36(ScaledImageIcon, {}),
2244
- render(ctx) {
2245
- return /* @__PURE__ */ jsx36(CreateThumbnailForm, { ...ctx });
2246
- },
2247
- resourceType: "ContentResource",
2248
- resourceFields: ["id", "type", "format"],
2249
- supports: {
2250
- parentFields: ["thumbnail"]
2251
- }
2252
- });
2253
-
2254
- // src/ContentResource/WebPageCreator/index.tsx
2255
- import { defineCreator as defineCreator19 } from "@manifest-editor/creator-api";
2256
-
2257
- // ../ui/icons/LinkIcon.tsx
2258
- import { jsx as jsx37, jsxs as jsxs17 } from "react/jsx-runtime";
2259
- function LinkIcon() {
2260
- return /* @__PURE__ */ jsxs17("svg", { xmlns: "http://www.w3.org/2000/svg", height: "24px", viewBox: "0 0 24 24", width: "24px", fill: "#000000", children: [
2261
- /* @__PURE__ */ jsx37("path", { d: "M0 0h24v24H0z", fill: "none" }),
2262
- /* @__PURE__ */ jsx37("path", { d: "M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z" })
2263
- ] });
2264
- }
2265
-
2266
- // src/ContentResource/WebPageCreator/create-web-page.tsx
2267
- import { ActionButton as ActionButton11 } from "@manifest-editor/components";
2268
- import { Input as Input8, InputContainer as InputContainer9, InputLabel as InputLabel9, LanguageFieldEditor as LanguageFieldEditor6 } from "@manifest-editor/editors";
2269
- import { useState as useState10 } from "react";
2270
- import { jsx as jsx38, jsxs as jsxs18 } from "react/jsx-runtime";
2271
- async function createWebPage(data, ctx) {
2272
- return ctx.embed({
2273
- id: data.url,
2274
- type: "Text",
2275
- label: data.label,
2276
- format: "text/html"
2277
- });
2278
- }
2279
- function CreateWebPageForm(props) {
2280
- const [label, setLabel] = useState10({ en: [""] });
2281
- const onSubmit = (e) => {
2282
- e.preventDefault();
2283
- const data = new FormData(e.target);
2284
- const formData = Object.fromEntries(data.entries());
2285
- if (formData.url) {
2286
- props.runCreate({ url: formData.url, label });
2287
- }
2288
- };
2289
- return /* @__PURE__ */ jsx38(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs18("form", { onSubmit, children: [
2290
- /* @__PURE__ */ jsx38(
2291
- LanguageFieldEditor6,
2292
- {
2293
- focusId: "label",
2294
- label: "Label",
2295
- fields: label,
2296
- onSave: (e) => setLabel(e.toInternationalString())
2297
- }
2298
- ),
2299
- /* @__PURE__ */ jsxs18(InputContainer9, { $wide: true, children: [
2300
- /* @__PURE__ */ jsx38(InputLabel9, { htmlFor: "id", children: "Link" }),
2301
- /* @__PURE__ */ jsx38(Input8, { id: "url", name: "url", defaultValue: "" })
2302
- ] }),
2303
- /* @__PURE__ */ jsx38(ActionButton11, { primary: true, large: true, type: "submit", children: "Create link" })
2304
- ] }) });
2305
- }
2306
-
2307
- // src/ContentResource/WebPageCreator/index.tsx
2308
- import { jsx as jsx39 } from "react/jsx-runtime";
2309
- var webPageCreator = defineCreator19({
2310
- id: "@manifest-editor/web-page-creator",
2311
- create: createWebPage,
2312
- label: "Web page",
2313
- summary: "Add link to an external web page",
2314
- icon: /* @__PURE__ */ jsx39(LinkIcon, {}),
2315
- render(ctx) {
2316
- return /* @__PURE__ */ jsx39(CreateWebPageForm, { ...ctx });
2317
- },
2318
- resourceType: "ContentResource",
2319
- resourceFields: ["label", "format"],
2320
- supports: {
2321
- parentFields: ["seeAlso", "rendering", "homepage"]
2322
- }
2323
- });
2324
-
2325
- // src/ContentResource/YouTubeCreator/index.tsx
2326
- import { YouTubeIcon } from "@manifest-editor/components";
2327
- import { defineCreator as defineCreator20 } from "@manifest-editor/creator-api";
2328
-
2329
- // src/ContentResource/YouTubeCreator/create-youtube-body.tsx
2330
- import { ActionButton as ActionButton12 } from "@manifest-editor/components";
2331
- import { Input as Input9, InputContainer as InputContainer10, InputLabel as InputLabel10 } from "@manifest-editor/editors";
2332
- import { jsx as jsx40, jsxs as jsxs19 } from "react/jsx-runtime";
2333
- var ytRegex = /^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;
2334
- function getYouTubeId(url) {
2335
- const id = (url || "").match(ytRegex);
2336
- return id ? id[1] : null;
2337
- }
2338
- function validateYouTube(data) {
2339
- return !!getYouTubeId(data.youtubeUrl);
2340
- }
2341
- async function createYoutubeBody(data, ctx) {
2342
- const id = getYouTubeId(data.youtubeUrl);
2343
- const body = ctx.embed({
2344
- id: `https://www.youtube.com/watch?v=${id}`,
2345
- type: "Video",
2346
- service: [
2347
- {
2348
- profile: "http://digirati.com/objectifier",
2349
- params: {
2350
- data: `https://www.youtube.com/embed/${id}`
2351
- }
2352
- },
2353
- {
2354
- id: `https://www.youtube.com/watch?v=${id}`,
2355
- profile: "https://www.youtube.com"
2356
- }
2357
- ]
2358
- });
2359
- if (ctx.options.targetType === "Canvas") {
2360
- const canvasId = ctx.generateId("canvas");
2361
- const pageId = ctx.generateId("annotation-page", {
2362
- id: canvasId,
2363
- type: "Canvas"
2364
- });
2365
- const annotation = ctx.embed({
2366
- id: ctx.generateId("annotation", { id: pageId, type: "AnnotationPage" }),
2367
- type: "Annotation",
2368
- motivation: "painting",
2369
- body: [body],
2370
- target: {
2371
- type: "SpecificResource",
2372
- source: { id: canvasId, type: "Canvas" }
2373
- }
2374
- });
2375
- const page = ctx.embed({
2376
- id: pageId,
2377
- type: "AnnotationPage",
2378
- items: [annotation]
2379
- });
2380
- return ctx.embed({
2381
- id: canvasId,
2382
- type: "Canvas",
2383
- label: data.label || { en: ["Untitled YouTube canvas"] },
2384
- height: data.height || 1e3,
2385
- width: data.width || 1e3,
2386
- duration: data.duration || 1,
2387
- items: [page]
2388
- });
2389
- }
2390
- if (ctx.options.targetType === "Annotation") {
2391
- return ctx.embed({
2392
- id: ctx.generateId("annotation"),
2393
- type: "Annotation",
2394
- motivation: "painting",
2395
- body: [body],
2396
- target: ctx.getTarget()
2397
- });
2398
- }
2399
- return body;
2400
- }
2401
- function YouTubeForm(props) {
2402
- const onSubmit = (e) => {
2403
- e.preventDefault();
2404
- const data = new FormData(e.target);
2405
- const formData = Object.fromEntries(data.entries());
2406
- if (formData.youtubeUrl) {
2407
- props.runCreate({ youtubeUrl: formData.youtubeUrl });
2408
- }
2409
- };
2410
- return /* @__PURE__ */ jsx40(PaddedSidebarContainer, { children: /* @__PURE__ */ jsxs19("form", { onSubmit, children: [
2411
- /* @__PURE__ */ jsxs19(InputContainer10, { $wide: true, children: [
2412
- /* @__PURE__ */ jsx40(InputLabel10, { htmlFor: "id", children: "Link to YouTube" }),
2413
- /* @__PURE__ */ jsx40(Input9, { id: "youtubeUrl", name: "youtubeUrl", defaultValue: "" })
2414
- ] }),
2415
- /* @__PURE__ */ jsx40(ActionButton12, { primary: true, large: true, type: "submit", children: "Create" })
2416
- ] }) });
2417
- }
2418
-
2419
- // src/ContentResource/YouTubeCreator/index.tsx
2420
- import { jsx as jsx41 } from "react/jsx-runtime";
2421
- var youTubeBodyCreator = defineCreator20({
2422
- id: "@manifest-editor/youtube",
2423
- create: createYoutubeBody,
2424
- label: "YouTube",
2425
- summary: "Embed YouTube",
2426
- icon: /* @__PURE__ */ jsx41(YouTubeIcon, {}),
2427
- resourceType: "ContentResource",
2428
- additionalTypes: ["Canvas", "Annotation"],
2429
- resourceFields: ["id", "type", "service"],
2430
- render: (ctx) => /* @__PURE__ */ jsx41(YouTubeForm, { ...ctx }),
2431
- supports: {
2432
- parentTypes: ["Annotation", "Manifest", "AnnotationPage"],
2433
- parentFieldMap: {
2434
- Annotation: ["body"],
2435
- Manifest: ["items"],
2436
- AnnotationPage: ["items"]
2437
- }
2438
- },
2439
- staticFields: {
2440
- type: "Video"
2441
- }
2442
- });
2443
-
2444
- // src/Manifest/ManifestBrowserCreator/index.tsx
2445
- import { IIIFBrowserIcon as IIIFBrowserIcon2 } from "@manifest-editor/components";
2446
- import { defineCreator as defineCreator21 } from "@manifest-editor/creator-api";
2447
-
2448
- // src/Manifest/ManifestBrowserCreator/manifest-browser-creator.tsx
2449
- import { createThumbnailHelper } from "@iiif/helpers";
2450
- import { lazy as lazy2 } from "react";
2451
- async function createFromManifestBrowserOutput(data, ctx) {
2452
- const inputItems = data.output || [];
2453
- const itemsToAdd = [];
2454
- for (const item of inputItems) {
2455
- const { resource, parent, selector } = item;
2456
- const previewVault = ctx.getPreviewVault();
2457
- const thumbnails = createThumbnailHelper(previewVault);
2458
- if (resource.type === "Manifest") {
2459
- const manifestId = resource.id;
2460
- invariant(manifestId, "Could not find Manifest ID");
2461
- const manifest = await previewVault.loadManifest(manifestId);
2462
- const thumbnail = await thumbnails.getBestThumbnailAtSize(manifest, { width: 256, height: 256 }, false);
2463
- invariant(manifest, "Manifest not found");
2464
- itemsToAdd.push(
2465
- ctx.embed({
2466
- id: resource.id,
2467
- type: "Manifest",
2468
- label: manifest.label,
2469
- summary: manifest.summary,
2470
- thumbnail: thumbnail?.best ? [
2471
- {
2472
- id: thumbnail.best.id,
2473
- type: "Image"
2474
- }
2475
- ] : void 0
2476
- })
2477
- );
2478
- continue;
2479
- }
2480
- if (resource.type === "Collection") {
2481
- const collectionId = resource.id;
2482
- invariant(collectionId, "Could not find Manifest ID");
2483
- const collection = await previewVault.loadManifest(collectionId);
2484
- invariant(collection, "Collection not found");
2485
- itemsToAdd.push(
2486
- ctx.embed({
2487
- id: resource.id,
2488
- type: "Collection",
2489
- label: collection.label
2490
- })
2491
- );
2492
- }
2493
- }
2494
- return itemsToAdd;
2495
- }
2496
- var ManifestBrowserCreatorForm2 = lazy2(() => import("./manifest-browser-form.lazy-QGTJHSSC.js"));
2497
-
2498
- // src/Manifest/ManifestBrowserCreator/index.tsx
2499
- import { jsx as jsx42 } from "react/jsx-runtime";
2500
- var manifestBrowserCreator = defineCreator21({
2501
- id: "@manifest-editor/manifest-browser-creator",
2502
- create: createFromManifestBrowserOutput,
2503
- label: "IIIF Browser",
2504
- summary: "Browse IIIF Resources",
2505
- icon: /* @__PURE__ */ jsx42(IIIFBrowserIcon2, {}),
2506
- render(ctx) {
2507
- return /* @__PURE__ */ jsx42(ManifestBrowserCreatorForm, { ...ctx });
2508
- },
2509
- resourceType: "Manifest",
2510
- resourceFields: ["id", "label"],
2511
- additionalTypes: ["Collection"],
2512
- supports: {
2513
- parentTypes: ["Collection"],
2514
- parentFieldMap: {
2515
- Collection: ["items"]
2516
- }
2517
- },
2518
- sideEffects: [],
2519
- staticFields: {}
2520
- });
2521
-
2522
- // src/index.ts
2523
- var allCreators = [
2524
- // Images first.
2525
- imageServiceCreator,
2526
- imageServiceAnnotation,
2527
- imageUrlCreator,
2528
- imageUrlAnnotation,
2529
- videoAnnotation,
2530
- audioAnnotation,
2531
- htmlBodyCreator,
2532
- htmlAnnotation,
2533
- youTubeBodyCreator,
2534
- iiifBrowserCreator,
2535
- emptyCanvas,
2536
- plaintextCreator,
2537
- webPageCreator,
2538
- emptyAnnotationPage,
2539
- noBodyAnnotation,
2540
- internalCanvas,
2541
- captionedImageAnnotation,
2542
- imageUrlListCreator,
2543
- imageUrlListAnnotation,
2544
- thumbnailCreator
2545
- ];
2546
- export {
2547
- CreateAudioAnnotationForm,
2548
- CreateCaptionedImageAnnotation,
2549
- CreateHTMLAnnotation,
2550
- CreateHTMLBodyForm,
2551
- CreateImageServerForm,
2552
- CreateImageServiceAnnotationForm,
2553
- CreateImageUrlAnnotationForm,
2554
- CreateImageUrlForm,
2555
- CreateImageUrlListForm,
2556
- CreatePlaintextForm,
2557
- CreateThumbnailForm,
2558
- CreateVideoAnnotationForm,
2559
- CreateWebPageForm,
2560
- IIIFBrowserCreatorForm,
2561
- ManifestBrowserCreatorForm2 as ManifestBrowserCreatorForm,
2562
- YouTubeForm,
2563
- allCreators,
2564
- audioAnnotation,
2565
- captionedImageAnnotation,
2566
- createAudioAnnotation,
2567
- createCaptionedImageAnnotation,
2568
- createFromIIIFBrowserOutput,
2569
- createFromManifestBrowserOutput,
2570
- createHtmlAnnotation,
2571
- createHtmlBody,
2572
- createImageServer,
2573
- createImageServiceAnnotation,
2574
- createImageUrl,
2575
- createImageUrlAnnotation,
2576
- createImageUrlList,
2577
- createImageUrlListAnnotation,
2578
- createNoBodyAnnotation,
2579
- createPlaintext,
2580
- createThumbnail,
2581
- createVideoAnnotation,
2582
- createWebPage,
2583
- createYoutubeBody,
2584
- emptyAnnotationPage,
2585
- emptyCanvas,
2586
- getYouTubeId,
2587
- htmlAnnotation,
2588
- htmlBodyCreator,
2589
- iiifBrowserCreator,
2590
- imageServiceAnnotation,
2591
- imageServiceCreator,
2592
- imageUrlAnnotation,
2593
- imageUrlCreator,
2594
- imageUrlListAnnotation,
2595
- imageUrlListCreator,
2596
- internalCanvas,
2597
- manifestBrowserCreator,
2598
- noBodyAnnotation,
2599
- plaintextCreator,
2600
- validateYouTube,
2601
- videoAnnotation,
2602
- webPageCreator,
2603
- youTubeBodyCreator
2604
- };
92
+ `,Xe=D.label`
93
+ ${Ye}
94
+ `;function j(e){let[t,n]=w(!1),{progress:r,currentTime:i,element:a}=pe(),{duration:o,isMuted:s,volume:c,isPlaying:l,playRequested:u}=me(),{setVolume:d,toggleMute:f,play:p,pause:m,setDurationPercent:h}=fe(),ee=s||c===0?Re:c>50?Ie:Le;return ye(()=>{if(a.current){let t=a.current;if(t.error&&e.onError){e.onError(t.error?.message||`Unknown error`);return}let n=()=>{e.onError&&e.onError(t.error?.message||`Unknown error`)},r=()=>{t.duration&&e.onDuration&&e.onDuration(t.duration),e.onDimensions&&t instanceof HTMLVideoElement&&e.onDimensions(t.videoWidth,t.videoHeight)};return t.addEventListener(`loadedmetadata`,r),t.addEventListener(`error`,n),()=>{t.removeEventListener(`loadedmetadata`,r),t.removeEventListener(`error`,n)}}},[]),E(ze,{children:[T(Be,{disabled:u,onClick:()=>{l?m():p()},children:u?T(Je,{stroke:`#999`}):l?T(Fe,{title:`Pause`}):T(Pe,{title:`Play`})}),T(A,{ref:i,children:`0:00`}),E(Ve,{onClick:e=>{let{left:t,width:n}=e.currentTarget.getBoundingClientRect();h((e.pageX-t)/n)},children:[T(Ue,{}),o?T(He,{ref:r}):null]}),T(A,{children:ue(o)}),E(Ge,{onMouseEnter:()=>n(!0),onMouseLeave:()=>n(!1),children:[T(Ke,{$isOpen:t,children:E(`span`,{children:[T(Xe,{htmlFor:`audio-slider`,children:`Change volume`}),T(qe,{id:`audio-slider`,role:`slider`,disabled:s,min:`0`,max:`100`,value:c,onChange:e=>d(Number(e.currentTarget.value))})]})}),T(We,{onClick:()=>f(),children:T(ee,{title:s?`Mute`:`Unmute`})})]})]})}async function M(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=t.embed({id:e.url,type:`Sound`,format:`audio/mp4`,duration:e.duration||0});if(r===`Annotation`)return t.embed({...n,label:v(e.label)&&e.label,motivation:e.motivation||t.options.initialData?.motivation||`painting`,body:i,target:t.getTarget()});if(r===`Canvas`){let r=t.generateId(`canvas`),a=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:i,target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:a,type:`AnnotationPage`,items:[o]});return t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled HTML canvas`]},duration:e.duration||0,items:[s]})}}function N(e){let[n,r]=w(``),[i,o]=w(0),[s,c]=w(``),[l,u]=w({en:[``]});return ve(()=>{if(c(``),o(0),n){let e=n.split(`/`).pop()?.split(`.`).shift();u({en:[e||``]})}},[n]),E(f,{children:[s?T(a,{children:s}):null,E(b,{$wide:!0,children:[T(x,{htmlFor:`audio-url`,children:`URL`}),T(y,{type:`text`,id:`audio-url`,value:n,onChange:e=>r(e.target.value)})]}),n&&!s?T(`div`,{children:T(S,{containerId:`label`,focusId:`label_`,label:`Label`,fields:l,onSave:e=>u(e.toInternationalString())},`${n}__${i}`)}):null,n&&!s?T(oe.AudioHTML,{media:{url:n,duration:i,type:`Sound`},children:T(j,{onError:e=>c(e),onDuration:e=>o(~~e)},`${n}__${i}`)},`${n}__${i}`):null,i&&!s?E(ie,{children:[T(x,{htmlFor:`duration`,children:`Duration`}),T(y,{type:`number`,id:`duration`,value:i,onChange:e=>o(e.target.valueAsNumber)})]}):null,T(t,{primary:!0,large:!0,type:`button`,onPress:()=>{e.runCreate({url:n,duration:i,label:l})},isDisabled:!n||!!s,children:`Add audio`})]})}const Ze=_({id:`@manifest-editor/audio-annotation`,create:M,label:`Audio`,summary:`Audio annotation`,icon:T(r,{}),render(e){return T(N,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{initialData:!0,onlyPainting:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},staticFields:{type:`Annotation`}});async function Qe(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=Object.keys(e.body),a=[];for(let r of i){let i=e.body[r].join(`
95
+ `);i&&a.push(await t.create(`@manifest-editor/html-body-creator`,{language:r,body:i},{parent:{resource:n,property:`items`}}))}let o=await t.create(`@manifest-editor/image-url-creator`,{url:e.imageUrl},{parent:{resource:n,property:`body`}});if(o&&a.push(o),r===`Annotation`)return t.embed({...n,motivation:e.motivation||t.options.initialData?.motivation||`painting`,body:a,target:t.getTarget()});if(r===`Canvas`){let r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:a,target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:i,type:`AnnotationPage`,items:[o]});return t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled HTML canvas`]},height:e.height||1e3,width:e.width||1e3,items:[s]})}}function $e(e){let[n,r]=we({key:`bodyValue`,initialValue:{en:[``]},requestId:e.options.initialData?.requestId});return T(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.target),r=Object.fromEntries(n.entries());e.runCreate({body:{en:[r.caption]},imageUrl:r.url})},children:E(be,{children:[E(b,{$wide:!0,children:[T(x,{htmlFor:`url`,children:`URL to Image`}),T(y,{id:`url`,name:`url`,defaultValue:``,placeholder:`https://example.org/image.jpg`})]}),E(b,{$wide:!0,children:[T(x,{htmlFor:`caption`,children:`Caption`}),T(y,{id:`caption`,name:`caption`,placeholder:`Enter a caption`,onChange:e=>r({en:[e.target.value]}),value:n.en?.[0]||``})]}),T(t,{primary:!0,type:`submit`,children:`Create`})]})})}const et=_({id:`@manifest-editor/captioned-image-annotation`,create:Qe,label:`Captioned image`,summary:`Add an image from a URL with caption`,icon:T(n,{}),render(e){return T($e,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{initialData:!0,disallowPainting:!0,parentTypes:[`AnnotationPage`],parentFields:[`items`]},staticFields:{type:`Annotation`}});async function tt(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=Object.keys(e.body),a=[];for(let r of i){let i=e.body[r].join(`
96
+ `);i&&a.push(await t.create(`@manifest-editor/html-body-creator`,{language:r,body:i},{parent:{resource:n,property:`items`}}))}if(r===`Annotation`)return t.embed({...n,motivation:e.motivation||t.options.initialData?.motivation||`painting`,body:a,target:t.getTarget()});if(r===`Canvas`){let r=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:a,target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:i,type:`AnnotationPage`,items:[o]});return t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled HTML canvas`]},height:e.height||1e3,width:e.width||1e3,items:[s]})}}function nt(e){let[n,r]=we({key:`bodyValue`,initialValue:{en:[``]},requestId:e.options.initialData?.requestId}),i=v(n).trim()===``;return E(be,{children:[T(s,{className:`border-none`,value:n.en?.[0]||``,onChange:e=>r({en:[e]})}),T(t,{primary:!0,type:`button`,onPress:()=>{e.runCreate({body:n})},isDisabled:i,children:`Create`})]})}const rt=_({id:`@manifest-editor/html-annotation`,create:tt,label:`HTML`,summary:`HTML annotation`,icon:T(c,{}),render(e){return T(nt,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{initialData:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},staticFields:{type:`Annotation`}}),P={canvasInteraction:!0,spatial:!0,async run(e,{vault:t,options:n}){if(e&&e.type===`Annotation`&&n.targetType===`Annotation`){let n=t.get(e),r=n.target;if(!(r&&r.source?.type===`Canvas`))return;let i=r.source,a=t.get(i);if(!a.items)return;let o=t.get(a.items[0]);if(!o||o.items.length<2&&!a.behavior.includes(`multi-image`))return;let s=t.get(n.body)[0],c=n.body[0]?.selector,l=(s.service||[]).find(e=>ke(e));l&&l.width&&l.height&&(l.width!==s.width&&t.modifyEntityField({id:s.id,type:`ContentResource`},`width`,l.width),l.height!==s.height&&t.modifyEntityField({id:s.id,type:`ContentResource`},`height`,l.height));let u=l?.width||s.width,d=l?.height||s.height;if(c&&(c.type===`iiif:ImageApiSelector`||c.type===`ImageApiSelector`)&&c.region){let[e,t,n,r]=c.region.split(`,`);u=Number(n)||u,d=Number(r)||d}let f=new je({vault:t,reference:e}),p=ae(a,{width:u,height:d},.6);f.annotation.target.setPosition(p)}}},F={canvasInteraction:!0,spatial:!0,async run(e,{vault:t,options:n}){if(e&&e.type===`Annotation`&&n.targetType===`Annotation`){let n=t.get(e),r=n.target;if(!(r&&r.source?.type===`Canvas`))return;let i=r.source,a=t.get(i);if(!a.items||a.behavior.includes(`multi-image`))return;let o=t.get(a.items[0]);if(!o||o.items.length>1)return;let s=t.get(n.body);if(s.length!==1)return;let c=s[0],l=n.body[0]?.selector,u=(c.service||[])[0],d=u?.width||c.width,f=u?.height||c.height,p=c.duration||u?.duration;if(l&&(l.type===`iiif:ImageApiSelector`||l.type===`ImageApiSelector`)&&l.region){let[e,t,n,r]=l.region.split(`,`);d=Number(n)||d,f=Number(r)||f}let m=new je({vault:t,reference:i});t.batch(()=>{d!==void 0&&m.technical.width.set(d),f!==void 0&&m.technical.height.set(f),p!==void 0&&m.technical.duration.set(p)})}}};var it=Object.defineProperty,at=(e,t,n)=>t in e?it(e,t,{enumerable:!0,configurable:!0,writable:!0,value:n}):e[t]=n,I=(e,t,n)=>(at(e,typeof t==`symbol`?t:t+``,n),n);function L(e){return e.endsWith(`info.json`)?e:e.endsWith(`/`)?`${e}info.json`:`${e}/info.json`}var ot=`http://library.stanford.edu/iiif/image-api/compliance.html#level0`,st=`http://library.stanford.edu/iiif/image-api/compliance.html#level1`,ct=`http://library.stanford.edu/iiif/image-api/compliance.html#level2`,lt=`http://library.stanford.edu/iiif/image-api/conformance.html#level0`,ut=`http://library.stanford.edu/iiif/image-api/conformance.html#level1`,dt=`http://library.stanford.edu/iiif/image-api/conformance.html#level2`,ft=`http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level0`,pt=`http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level1`,mt=`http://library.stanford.edu/iiif/image-api/1.1/compliance.html#level2`,ht=`http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level0`,gt=`http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level1`,_t=`http://library.stanford.edu/iiif/image-api/1.1/conformance.html#level2`,vt=`http://iiif.io/api/image/1/level0.json`,yt=`http://iiif.io/api/image/1/profiles/level0.json`,bt=`http://iiif.io/api/image/1/level1.json`,xt=`http://iiif.io/api/image/1/profiles/level1.json`,St=`http://iiif.io/api/image/1/level2.json`,Ct=`http://iiif.io/api/image/1/profiles/level2.json`,wt=`http://iiif.io/api/image/2/level0.json`,Tt=`http://iiif.io/api/image/2/profiles/level0.json`,Et=`http://iiif.io/api/image/2/level1.json`,Dt=`http://iiif.io/api/image/2/profiles/level1.json`,Ot=`http://iiif.io/api/image/2/level2.json`,kt=`http://iiif.io/api/image/2/profiles/level2.json`,At=`level0`,jt=`level1`,Mt=`level2`,Nt=`http://iiif.io/api/image/2/level0`,Pt=`http://iiif.io/api/image/2/level1`,Ft=`http://iiif.io/api/image/2/level2`,It=[Ft,ct,dt,mt,_t,St,Ct,Ot,kt,Mt],Lt=[...It,Pt,st,ut,pt,gt,bt,xt,Et,Dt,jt],Rt=[Nt,Pt,Ft,ot,st,ct,lt,ut,dt,ft,pt,mt,ht,gt,_t,vt,yt,bt,xt,St,Ct,wt,Tt,Et,Dt,Ot,kt,At,jt,Mt],zt={extraFormats:[`jpg`],extraQualities:[`default`],extraFeatures:[`sizeByWhListed`]},Bt={extraFormats:[`jpg`],extraQualities:[`default`],extraFeatures:[`baseUriRedirect`,`cors`,`jsonldMediaType`,`regionByPx`,`regionSquare`,`sizeByWhListed`,`sizeByH`,`sizeByW`,`sizeByWh`]},Vt={extraFormats:[`jpg`,`png`],extraQualities:[`default`],extraFeatures:[`baseUriRedirect`,`cors`,`jsonldMediaType`,`regionByPct`,`regionByPx`,`regionSquare`,`rotationBy90s`,`sizeByWhListed`,`sizeByConfinedWh`,`sizeByH`,`sizeByPct`,`sizeByW`,`sizeByWh`]};function Ht(e){return It.indexOf(e)===-1?Lt.indexOf(e)===-1?zt:Bt:Vt}function Ut(e){let t=e?Array.isArray(e.profile)?e.profile:[e.profile]:[],n={extraQualities:[],extraFormats:[],extraFeatures:[]};for(let e of t)if(typeof e==`string`&&(e=Ht(e)),e){if(e.formats)for(let t of e.formats)n.extraFormats.indexOf(t)===-1&&n.extraFormats.push(t);if(e.qualities)for(let t of e.qualities)n.extraQualities.indexOf(t)===-1&&n.extraQualities.push(t);if(e.supports)for(let t of e.supports)n.extraFeatures.indexOf(t)===-1&&n.extraFeatures.push(t);if(e.maxHeight&&(n.maxHeight=e.maxHeight),e.maxWidth&&(n.maxWidth=e.maxWidth),e.maxArea&&(n.maxArea=e.maxArea),e.extraFormats)for(let t of e.extraFormats)n.extraFormats.indexOf(t)===-1&&n.extraFormats.push(t);if(e.extraQualities)for(let t of e.extraQualities)n.extraQualities.indexOf(t)===-1&&n.extraQualities.push(t);if(e.extraFeatures)for(let t of e.extraFeatures)n.extraFeatures.indexOf(t)===-1&&n.extraFeatures.push(t);e.maxHeight&&(n.maxHeight=e.maxHeight),e.maxWidth&&(n.maxWidth=e.maxWidth),e.maxArea&&(n.maxArea=e.maxArea)}if(e.extraFormats)for(let t of e.extraFormats)n.extraFormats.indexOf(t)===-1&&n.extraFormats.push(t);if(e.extraFeatures)for(let t of e.extraFeatures)n.extraFeatures.indexOf(t)===-1&&n.extraFeatures.push(t);if(e.extraQualities)for(let t of e.extraQualities)n.extraQualities.indexOf(t)===-1&&n.extraQualities.push(t);return n}function Wt(e){try{if(e===`full`)return{full:!0};if(e===`square`)return{square:!0};let t=e.startsWith(`pct:`),n=e.substr(t?4:0).split(`,`).map(e=>parseFloat(e));return{x:n[0],y:n[1],w:n[2],h:n[3],percent:t}}catch{throw Error(`Expected 'full', 'square' or 'x,y,w,h'. Found `+e)}}function Gt(e){let t={upscaled:!1,max:!1,confined:!1};if(e[0]===`^`&&(t.upscaled=!0,e=e.slice(1)),e===`max`||e===`full`)return t.max=!0,t.serialiseAsFull=e===`full`,t;if(e[0]===`!`&&(t.confined=!0,e=e.slice(1)),e[0]===`p`)return t.percentScale=parseFloat(e.slice(4)),t;let n=e.split(`,`).map(e=>e.trim());return n.length&&typeof n[0]<`u`&&(n[0]!==``&&(t.width=parseInt(n[0],10)),typeof n[1]<`u`&&n[1]!==``?(t.height=parseInt(n[1],10),t.version=2):t.version=3),t}function Kt(e){let t={angle:0};if(e[0]===`!`&&(t.mirror=!0,e=e.substr(1)),t.angle=parseFloat(e)%360,Number.isNaN(t.angle))throw Error(`Invalid rotation ${e}`);return t}function qt(e,t=``){let n=e.match(/^(([a-zA-Z]+):\/\/([^/]+))?((.*)+)/);if(!n)throw Error(`Invalid or unknown input ${e}`);let r=n[2],i=n[3],a=n[4];if(a[0]===`/`&&(a=a.substring(1)),t.length>0){if(t[0]===`/`&&(t=t.substring(1)),t!==a.substring(0,t.length))throw Error(`Path does not start with prefix (path: ${a}, prefix: ${t})`);a=a.substring(t.length)}return{scheme:r,server:i,path:a,prefix:t}}function Jt(e,t=``){let{path:n,scheme:r,server:i,prefix:a}=qt(e,t),o=(n||``).split(`/`).reverse(),[s,c,l,u,...d]=o,f=d.reverse().filter(Boolean).join(`/`);if(o.length===1||s===``)return{type:`base`,scheme:r,server:i,prefix:a,identifier:f};if(s===`info.json`){let[,...e]=o;return{type:`info`,scheme:r,server:i,prefix:a,identifier:e.reverse().filter(Boolean).join(`/`)}}let p=(s||``).split(`.`);if(typeof p[1]>`u`||typeof p[0]>`u`||typeof u>`u`||typeof l>`u`||typeof c>`u`)throw Error(`Invalid image request`);return{type:`image`,scheme:r,server:i,prefix:a,identifier:f,originalPath:n,region:Wt(u),size:Gt(l),rotation:Kt(c),quality:p[0],format:p[1]}}function Yt(e){let t=Jt(L(e.id));if(t.type!==`info`)throw Error(`Invalid service URL`);let n=Ut(e);return{identifier:t.identifier,originalPath:``,server:t.server,prefix:t.prefix,scheme:t.scheme,type:`image`,quality:n.extraQualities.indexOf(`default`)===-1?n.extraQualities[0]:`default`,region:{full:!0},size:{max:!0,upscaled:!1,confined:!1},format:`jpg`,rotation:{angle:0}}}function Xt(e,t,n){let r=n.length,i=[];for(let t=0;t<r;t++){let r=n[t];if(r){let t=r.width;i.push(e/t)}}return i}function Zt(e,t,n){let r=n.length,i=[];for(let a=0;a<r;a++){let r=n[a];r&&i.push({width:Math.floor(e/r),height:Math.floor(t/r)})}return i}function R(e){if(e[`@id`])return e[`@id`];if(e.id)return e.id}function z(e){if(!e||!e.profile||!R(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let e of t)if(typeof e==`string`&&Rt.indexOf(e)!==-1)return!0;return!1}function Qt(e){if(!z(e))return!1;let t=Array.isArray(e.profile)?e.profile:[e.profile];for(let e of t)if(typeof e==`string`){if(Lt.indexOf(e)!==-1)return!0}else{let t=[...e.supports||[],...e.extraFeatures||[]];if(t.indexOf(`regionByPx`)!==-1&&(t.indexOf(`sizeByW`)!==-1||t.indexOf(`sizeByWh`)!==-1))return!0}return!1}function B(e,t){if(t&&t.profile){let n=t.profile;if(n){let t=Array.isArray(n)?n:[n];return t.includes(`level${e}`)||t.includes(`http://iiif.io/api/image/2/level${e}.json`)||t.includes(`http://iiif.io/api/image/1/level${e}.json`)||t.includes(`http://iiif.io/api/image/1/profiles/level${e}.json`)}}return!1}function V(e){return z(e)?B(0,e)?0:B(1,e)?1:B(2,e)?2:null:null}function $t(e){return(e[`@context`]?Array.isArray(e[`@context`])?e[`@context`]:[e[`@context`]]:[]).indexOf(`http://iiif.io/api/image/3/context.json`)!==-1}function en(e){if(!Qt(e))return[];let t=[],n=Array.isArray(e.profile)?e.profile:[e.profile],r=n.length;for(let t=0;t<r;t++){let r=n[t];if(r&&typeof r!=`string`&&(r.maxHeight||r.maxWidth))return[{id:R(e),type:`variable`,minWidth:0,minHeight:0,maxHeight:r.maxHeight||r.maxWidth,maxWidth:r.maxWidth||r.maxHeight,level:V(e),version:e[`@context`]===`http://iiif.io/api/image/3/context.json`?3:2}]}if(e.tiles){let n=e.tiles.length;for(let r=0;r<n;r++){let n=e.tiles[r];n&&(n.height||n.width)&&t.push({id:R(e),type:`variable`,minHeight:0,minWidth:0,maxHeight:n.height||n.width,maxWidth:n.width,level:V(e),version:$t(e)?3:2})}}return t}function tn(e){let t=e.match(/^.*\/(full)\/(((\d+),(\d+)?)|max)\/(\d+)\/default\.(jpg|png|jpeg)$/);if(t&&t[4]&&t[5]){let n=t[1],r=parseInt(t[4],10),i=parseInt(t[5],10),a=t[7];if((n===`max`||n===`full`)&&r&&i&&a)return{type:`fixed`,id:e,height:i,width:r}}return{type:`unknown`,id:e}}function nn(e){if(e[`@type`])return e[`@type`];if(e.type)return e.type}function rn(e){if(typeof e==`string`)return tn(e);let t=nn(e);if(t!==`Image`&&t!==`sc:Image`)return null;let n=e,r=R(n);return r?r&&n.width&&n.height?{id:r,type:`fixed`,width:n.width,height:n.height,unsafe:!0}:tn(r):null}function an(e){return z(e)?(e&&e.sizes?e.sizes:[]).map(t=>({id:R(e),type:`fixed-service`,height:t.height,width:t.width,level:V(e),version:$t(e)?3:2})):[]}function on(e){let t=[],n=e.length;for(let r=0;r<n;r++){let n=e[r];if(!n)continue;let i=an(n);i.length&&t.push(...i);let a=en(n);a.length&&t.push(...a)}return t}function sn(e){let t=e.service?Array.isArray(e.service)?e.service:[e.service]:[],n=t.length,r=[];for(let e=0;e<n;e++)z(t[e])&&r.push(t[e]);return r}function cn(e,t=!0,n){let r=[],i=rn(e);if(i===null)return r;let a=e;if(r.push(i),t&&a&&a.width&&a.height){let e=[],t=sn(a);for(let r of t){let t={id:R(r),width:a.width,height:a.height};if(n.canLoadSync(t)){let r=n.loadServiceSync(t);r&&(r.height||(r.height=a.height),r.width||(r.width=a.width),e.push(...on([r])))}}if(e.length)return r.push(...e),r}return a.service&&r.push(...on(a.service)),r}function ln({x:e=0,y:t=0,w:n,h:r,full:i,square:a,percent:o}){if(i)return`full`;if(a)return`square`;if(typeof n>`u`||typeof r>`u`)throw Error(`RegionParameter: invalid region`);let s=`${e},${t},${n},${r}`;return o?`pct:${s}`:s}function un({max:e,percentScale:t,upscaled:n,confined:r,width:i,height:a,serialiseAsFull:o,version:s}){let c=[];return n&&c.push(`^`),e?(c.push(o?`full`:`max`),c.join(``)):(r&&c.push(`!`),t&&c.push(`pct:${t}`),i&&c.push(`${i}`),c.push(`,`),a&&s===3&&c.push(`${a}`),c.join(``))}function dn(e){return`${e.mirror?`!`:``}${(e.angle||0)%360}`}function fn(e,t){let n=e.prefix.startsWith(`/`)?e.prefix.substr(1):e.prefix,r=`${e.scheme}://${e.server}/${n?`${n}/`:``}${e.identifier}`;if(e.type===`base`)return r;if(e.type===`info`)return`${r}/info.json`;let{size:i}=e,{region:a,rotation:o,format:s,quality:c}=e;if(t){let e=t[`@context`]?Array.isArray(t[`@context`])?t[`@context`]:[t[`@context`]]:[],n=e.indexOf(`http://iiif.io/api/image/2/context.json`)!==-1,r=e.indexOf(`http://iiif.io/api/image/3/context.json`)!==-1;if((i.width===t.width&&!i.height||i.height===t.height&&!i.width||i.width===t.width&&i.height===t.height)&&(i={...i,max:!0}),n&&(i.max&&!i.serialiseAsFull&&(i={...i,serialiseAsFull:!0}),!i.max&&i.width&&i.height&&(i={...i,height:void 0}),i={...i,version:2}),r){if(i.max&&i.serialiseAsFull&&(i={...i,serialiseAsFull:!1}),i.width&&!i.height&&t.width&&t.height){let e=t.height/t.width;i={...i,height:Math.ceil(i.width*e)}}i={...i,version:3}}}return[r,ln(a),un(i),dn(o),`${c}.${s}`].filter(Boolean).join(`/`)}function H(e,t,n){let r=Yt({"@context":e.version===3?`http://iiif.io/api/image/3/context.json`:`http://iiif.io/api/image/2/context.json`,id:L(R(e)),profile:e.level===null||typeof e.level>`u`?`level0`:`level${e.level}`,type:e.version===3?`ImageService3`:`ImageService2`});if(r.type!==`image`)throw Error(`Invalid service`);return r.size.max=!1,r.size.width=t,r.size.height=n,{id:fn(r),type:`fixed`,width:t,height:n||e.height/(e.width||1)*t,unsafe:e.width>t}}function U(e){let t=e.replace(/(https?:\/\/)?(www.)?/i,``);return t.indexOf(`/`)===-1?t:t.split(`/`)[0]}function pn(e,t,n){let r=e.width?e.width:e.maxWidth;return n.height<=e.maxHeight&&n.width<=e.maxWidth&&n.height>=e.minHeight&&n.width>=e.minWidth&&(!t||Math.abs(n.width-r)<Math.abs(t.width-r))}function mn(e,t){let n=[],r=Object.assign({unsafeImageService:!1,atAnyCost:!0,fallback:!0,minHeight:64,minWidth:64,maxHeight:1/0,maxWidth:1/0,returnAllOptions:!1,preferFixedSize:!1,allowUnsafe:!1,explain:!1,height:0,width:0},e),i=(e,t=0)=>r.explain?n.push(Array(t).fill(0).map(e=>` `).join(``)+e().trim()):void 0,a=[],o=[],s=null;i(()=>`Using configuration: ${JSON.stringify(r,null,2)}`);let c=(e,t)=>{if(i(()=>`Swapping choice`,3),pn(r,t,e)){if(r.preferFixedSize&&e.unsafe){i(()=>`We found an image that was marked as unsafe, but it was the best size. (${e.id})`,4),o.push(e);return}r.returnAllOptions&&t&&o.push(t),i(()=>`We found a new image that was the best size. (${e.id})`,4),s=e}else r.returnAllOptions&&o.push(e)};i(()=>`The input shows we have ${t.length} list(s) of candidates to choose from.`);let l=t.length;for(let e=0;e<l;e++){let n=t[e]();i(()=>`Candidate group ${e}: ${JSON.stringify(n,null,2)}`,1);let o=n.length;i(()=>`Checking candidate list number ${e} and found ${o} potential ways of creating image(s)`,1);for(let e=0;e<o;e++){let t=n[e];i(()=>`-> Checking candidate ${e}`,1),t.type===`unknown`&&r.atAnyCost&&(i(()=>`We've found an unknown image type, adding this to the "last resort" list`,2),a.push(t)),t.type===`fixed`&&(t.unsafe?(i(()=>`We've found an unsafe fixed image type, adding this to the "last resort" list`,2),a.push(t)):(i(()=>`We've found a fixed size image, checking if it matches the request`,2),c(t,s))),t.type===`fixed-service`&&(r.unsafeImageService?(i(()=>`Checking for an image from the tile source, without calculating the right height and width (unsafeImageService)`,2),c(H(t,r.width,r.height),s)):(i(()=>`Checking for an image from the tile source 3`,2),c(H(t,t.width,t.height),s))),t.type===`variable`&&t.maxWidth&&c(H({id:t.id,type:`fixed-service`,width:t.maxWidth,height:t.maxWidth,level:t.level,version:t.version},t.maxWidth),s)}if(s&&!r.returnAllOptions){if(s.unsafe||r.allowUnsafe)continue;i(()=>`We found a match in choice list number ${e}, no searching any more`);break}}return r.atAnyCost&&o.length===0?(i(()=>s?`We found an image! ${s.id} of type ${s.type}`:`We found no images, but "atAnyCost" is set, so returning that`),{best:s||a[0]||null,fallback:a.slice(1),log:n}):r.returnAllOptions?(i(()=>`Returning all options that we have found`),{best:(r.atAnyCost?s||o[0]||a[0]:s||o[0])||null,fallback:[...o,...a],log:n}):(i(()=>`Returning the best image that we found, and a fallback`),{best:s||o[0]||null,fallback:s?o:o.slice(1),log:n})}function hn(e,t,n){let r=e>t?e:t,i=n.length,a=[];for(let e=0;e<i;e++){let t=n[e];if(!t||t.scaleFactors.length===0)continue;let i=t.scaleFactors[0];if(!i)continue;let o=r/i,s=[i];for(;o>=t.width;)i*=2,s.push(i),o/=2;a.push({...t,scaleFactors:s})}return a}function gn(e,t){if(e.length!==t.length)return!1;if(e.length===0&&t.length===0)return!0;let n=e.length,r=!0;for(let i=0;i<n;i++){let n=e[i],a=t[i];if(n.width!==a.width||n.height!==a.height){r=!1;break}}if(r)return!0;let i=0;for(let r=0;r<n;r++)for(let a=0;a<n;a++)if(e[r].width===t[a].width&&e[r].height===t[a].height){i++;break}return i===n}function _n(e){return B(0,e)}new class{constructor(e={}){I(this,`config`,{verificationsRequired:1,approximateServices:!1,enableFetching:!0,disableThrottling:!1}),I(this,`fetchingCount`,0),I(this,`imageServices`,{}),I(this,`knownImageServers`,{}),this.config=Object.assign(this.config,e)}setConfig(e){Object.assign(this.config,e)}sample(e,t,n=!0){let r=U(R(e)),i=L(R(e)),a=this.knownImageServers[r];return this.imageServices[i]=Object.assign(e,{real:!0}),!a&&e.tiles&&!_n(e)?(this.knownImageServers[r]={verifications:0,malformed:!1,root:r,preLoaded:n,sampledId:R(e),verified:!1,server:null,result:{context:e[`@context`]||[],sampledProfile:e.profile,resourceServiceRatio:t&&e.height?t.height/e.height:1,sampledSizes:e.sizes||[],sizeRatios:Xt(e.width,e.height,e.sizes||[]),sampledTiles:e.tiles||[]}},!0):this.verify(e)}preLoad(e,t=!0){this.knownImageServers[e.root]=e,t&&(this.knownImageServers[e.root].malformed=!1,this.knownImageServers[e.root].verifications=this.config.verificationsRequired)}predict(e,t=!1,n=!1){let r=e?.source,i=U(R(e)),a=this.knownImageServers[i],o=L(R(e));return this.imageServices[o]?this.imageServices[o]||null:!this.config.approximateServices||!a||!a.result||!(r?.height||e.height)||!(r?.width||e.width)||!n&&(a.malformed||a.verifications<this.config.verificationsRequired)||_n(e.source)?null:(this.imageServices[o]||(this.imageServices[o]={"@context":a.result.context,"@id":R(e),id:R(e),protocol:`http://iiif.io/api/image`,tiles:r?.tiles||hn(e.width,e.height,a.result.sampledTiles),sizes:r?.sizes||Zt(Math.round(e.width/a.result.resourceServiceRatio),Math.round(e.height/a.result.resourceServiceRatio),a.result.sizeRatios),profile:r?.profile||a.result.sampledProfile,height:r?.height||e.height,width:r?.width||e.width,real:!1}),this.imageServices[o]||null)}async getThumbnailFromResource(e,t,n=!0,r=[]){let i=e?await this.getImageCandidates(e,n):[];return mn(t,[()=>r,()=>i])}async getImageCandidates(e,t=!0){let n=e;if(t&&n&&n.height&&n.width){let e=sn(n);for(let t of e){let e={id:R(t),width:t.width?t.width:n.width,height:t.height?t.height:n.height,source:t};await this.loadService(e)}}return cn(e,t,this)}async verify(e){let t=this.predict(e,!1,!0),n=await this.fetchService(R(e));if(!t)return!1;let r=t.height===n.height&&t.width===n.width&&t[`@context`]===n[`@context`]&&gn(t.sizes||[],n.sizes||[]);if(r){let t=U(R(e)),n=this.knownImageServers[t];n&&(n.verifications+=1,n.verifications>=this.config.verificationsRequired&&(n.verified=!0))}return r}canLoadSync(e){let t=typeof e==`string`?e:R(e),n=L(t);if(this.imageServices[n])return!0;let r=this.knownImageServers[U(t)];return!!(r&&!r.malformed&&r.verifications>=this.config.verificationsRequired)}async markAsMalformed(e){return this.knownImageServers[U(R(e))].malformed=!0,this.loadService(e,!0)}async fetchService(e,t=!1){let n=L(e),r=this.imageServices[n];if(r&&(!t||r.real))return r;if(!this.config.enableFetching)throw Error(`Fetching is not enabled`);let i=await this.fetch(n).then(e=>e.json());return!i.id&&i[`@id`]&&(i.id=i[`@id`]),i.id!==e&&(i.id=e,i[`@id`]&&(i[`@id`]=e)),this.imageServices[n]=Object.assign(i,{real:!0}),this.imageServices[n]}async fetch(e,t){return fetch(e,t)}async loadService(e,t=!1){if(!this.config.disableThrottling){let e=!0;for(;e;)if(this.fetchingCount>=this.config.verificationsRequired)await new Promise(e=>setTimeout(e,500));else{e=!1;break}}let n=this.knownImageServers[U(R(e))];if(n&&!n.malformed&&!t){await n.result;let t=this.loadServiceSync(e);if(t)return t}this.fetchingCount++;let r=await this.fetchService(R(e),t);return this.fetchingCount--,r.real&&this.sample(r,e),r}loadServiceSync(e){let t=L(R(e));return this.imageServices[t]?this.imageServices[t]:this.config.approximateServices?this.predict(e):null}};const W={canvasInteraction:!0,spatial:!0,async run(e,{vault:t,options:n}){if(e&&e.type===`Annotation`&&n.targetType===`Annotation`){let n=t.get(e),r=n.target;if(!(r&&r.source?.type===`Canvas`))return;let i=r.source,a=t.get(i);if(!a.items||a.behavior.includes(`multi-image`)||!t.get(a.items[0]))return;let o=Array.isArray(n.body)?n.body[0]:n.body;if(o.type===`SpecificResource`&&o.selector)return;let s=t.get(n.body)[0],c=(s.service||[]).find(e=>z(e));c&&c.width&&c.height&&(c.width!==s.width&&t.modifyEntityField({id:s.id,type:`ContentResource`},`width`,c.width),c.height!==s.height&&t.modifyEntityField({id:s.id,type:`ContentResource`},`height`,c.height))}}};async function vn(e,t){let n={...e.service};n[`@id`]&&(n.id=n[`@id`]),n[`@type`]&&(n.type=n[`@type`]);let r=De(n),i=O({identifier:r.identifier,server:r.server,scheme:r.scheme,type:`image`,size:{max:!e.size?.width&&!e.size?.height,confined:!1,upscaled:!1,...e.size||{}},format:`jpg`,region:{full:!0},rotation:{angle:0},quality:`default`,prefix:r.prefix,originalPath:r.originalPath});return t.embed({id:i,type:`Image`,format:e.format||`image/jpeg`,height:e.height||n.height,width:e.width||n.width,service:e.embedService===!1?void 0:[e.service]})}function G(e){return e.endsWith(`default.jpg`)?O({...Ae(e),type:`info`}):Ee(e)}function K(e){let[n,r]=w(``);return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.target),r=Object.fromEntries(n.entries()),i=r.url;if(i){let t=G(i);if(!t)throw Error(`Invalid image service request`);fetch(t).then(e=>e.json()).then(t=>{e.runCreate({url:r.url,service:t})})}},children:[T(`div`,{className:`flex gap-2 items-center`,children:E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link to image service`}),T(y,{id:`url`,name:`url`,defaultValue:``,onPaste:e=>{let t=e.clipboardData.getData(`text/plain`);r(t?G(t):``)},onBlur:e=>r(e.currentTarget.value?G(e.currentTarget.value):``)})]})}),T(`div`,{className:`relative flex z-0 my-5 h-96 min-h-0 min-w-0 overflow-hidden bg-gray-200 rounded items-center justify-center`,children:n.trim()?T(Me,{fallbackRender:()=>T(`div`,{children:`Invalid service`}),children:T(se,{src:n,fluid:!0,errorFallback:()=>T(`div`,{children:`Invalid service`}),background:`rgb(229,231,235)`,className:`h-full w-full`,containerProps:{className:`w-full h-full z-10`}})}):T(`div`,{className:`text-grey-600`,children:`Preview`})}),T(`div`,{children:T(t,{primary:!0,large:!0,type:`submit`,isDisabled:!n,children:`Create`})})]})})}async function q(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=await g(t,`Annotation`,`body`,`@manifest-editor/image-service-creator`)(e,{parent:{resource:n,property:`body`}});if(r===`Annotation`)return{...n,body:[i],motivation:e.motivation||`painting`,target:t.getTarget()};if(r===`Canvas`){let r=t.generateId(`canvas`),a=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:a,type:`AnnotationPage`,items:[o]}),c;return e.service?.sizes&&(c=await g(t,`Canvas`,`thumbnail`,`@manifest-editor/thumbnail-image`)({service:e.service,width:e.thumbnailSize||400})),t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled canvas`]},height:i.resource.height||1e3,width:i.resource.width||1e3,thumbnail:c?[c]:void 0,items:[s]})}}function yn(e){return T(K,{...e})}const bn=_({id:`@manifest-editor/image-service-annotation`,create:q,label:`IIIF Image`,dependencies:[`@manifest-editor/image-service-creator`],summary:`IIIF Image service`,tags:[`image`,`image-service`],icon:T(u,{style:{padding:10}}),render(e){return T(yn,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{onlyPainting:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},sideEffects:[W,F,P],staticFields:{type:`Annotation`}});async function xn(e,t){if(!e.height||!e.width){let t=await Ce(e.url);t&&(e.height=t.height,e.width=t.width)}return t.embed({id:e.url,type:`Image`,format:e.format||await Se(e.url),height:e.height,width:e.width,service:e.service?Array.isArray(e.service)?e.service:[e.service]:void 0})}function J(e){return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.target),r=Object.fromEntries(n.entries());r.url&&e.runCreate({url:r.url})},children:[E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link to Image`}),T(y,{id:`url`,name:`url`,defaultValue:``})]}),T(t,{primary:!0,large:!0,type:`submit`,children:`Create`})]})})}async function Sn(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=await g(t,`Annotation`,`body`,`@manifest-editor/image-url-creator`)(e,{parent:{resource:n,property:`body`}});if(r===`Annotation`)return t.embed({...n,body:[i],motivation:e.motivation||`painting`,target:t.getTarget()});if(r===`Canvas`){let r=t.generateId(`canvas`),a=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:[i],target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:a,type:`AnnotationPage`,items:[o]});return t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled canvas`]},height:i.resource.height||1e3,width:i.resource.width||1e3,items:[s]})}throw Error(`Unsupported target type`)}function Cn(e){return T(J,{...e})}const wn=_({id:`@manifest-editor/image-url-annotation`,create:Sn,label:`Image`,dependencies:[`@manifest-editor/image-url-creator`],summary:`Image from URL`,tags:[`image`],icon:T(n,{}),render(e){return T(Cn,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{onlyPainting:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},sideEffects:[W,F,P],staticFields:{type:`Annotation`}});async function Tn(e,t){let n=[],r=g(t,`Annotation`,`body`,`@manifest-editor/image-url-creator`);for(let i of e.images)n.push(await r(i,t.options));return n}function Y(e){return T(f,{children:E(o.Form,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.target),r=Object.fromEntries(n.entries());r.urls&&e.runCreate({images:r.urls.split(`
97
+ `).map(e=>({url:e}))})},children:[E(o.InputContainer,{className:`mb-4`,children:[T(o.Label,{children:`Enter a list of URLs (one per line)`}),T(o.TextArea,{name:`urls`,rows:`10`})]}),T(t,{primary:!0,large:!0,type:`submit`,children:`Create`})]})})}async function En(e,t){let n=[],r=g(t,`AnnotationPage`,`items`,`@manifest-editor/image-url-annotation`);for(let i of e.images)n.push(await r(i,t.options));return n}const Dn=_({id:`@manifest-editor/image-url-list-annotation`,create:En,label:`List of Images`,dependencies:[`@manifest-editor/image-url-annotation`],summary:`List of Images from URLs`,tags:[`image`],icon:T(d,{}),render(e){return T(Y,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{onlyPainting:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},sideEffects:[W,F,P],staticFields:{type:`Annotation`}}),On=_({id:`@manifest-editor/no-body-annotation`,create:kn,label:`Annotation without body`,summary:`Add an annotation that only has motivation and target`,icon:T(i,{}),resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`target`],supports:{initialData:!0,parentTypes:[`AnnotationPage`],parentFields:[`items`],disallowPainting:!0},actionButton:`Create empty annotation`,sideEffects:[],staticFields:{type:`Annotation`}});function kn(e,t){return t.embed({id:t.generateId(`annotation`),type:`Annotation`,label:e?.label,motivation:e.motivation||t.options.initialData?.motivation||`highlighting`,target:t.getTarget()})}function An({media:e,onError:t,duration:n,onDuration:r,onDimensions:i}){let[{element:a,currentTime:o,progress:s},c,l]=he({duration:n});return E(ce,{element:a,state:c,actions:l,currentTime:o,progress:s,children:[T(`div`,{style:{maxHeight:400,aspectRatio:`${e.width}/${e.height}`,position:`relative`},children:T(oe.VideoHTML,{element:a,media:e,playPause:l.playPause})}),T(j,{onError:t,onDuration:r,onDimensions:i})]})}async function jn(e,t){let n={id:t.generateId(`annotation`),type:`Annotation`},r=t.options.targetType,i=t.embed({id:e.url,type:`Video`,format:`video/mp4`,width:e.width,height:e.height,duration:e.duration||0});if(r===`Annotation`)return t.embed({...n,label:v(e.label)&&e.label,motivation:e.motivation||t.options.initialData?.motivation||`painting`,body:i,target:t.getTarget()});if(r===`Canvas`){let r=t.generateId(`canvas`),a=t.generateId(`annotation-page`,{id:r,type:`Canvas`}),o=t.embed({...n,motivation:`painting`,body:i,target:{type:`SpecificResource`,source:{id:r,type:`Canvas`}}}),s=t.embed({id:a,type:`AnnotationPage`,items:[o]});return t.embed({id:r,type:`Canvas`,label:e.label||{en:[`Untitled HTML canvas`]},duration:e.duration||0,width:e.width,height:e.height,items:[s]})}}function Mn(e){let[n,r]=w(``),[i,o]=w(0),[s,c]=w(0),[l,u]=w(0),[d,p]=w(``),[m,h]=w({en:[``]});return ve(()=>{if(p(``),o(0),n){let e=n.split(`/`).pop()?.split(`.`).shift();h({en:[e||``]})}},[n]),E(f,{children:[d?T(a,{children:d}):null,E(b,{$wide:!0,children:[T(x,{htmlFor:`video-url`,children:`URL`}),T(y,{type:`text`,id:`video-url`,value:n,onChange:e=>r(e.target.value)})]}),n&&!d?T(`div`,{children:T(S,{containerId:`label`,focusId:`label_`,label:`Label`,fields:m,onSave:e=>h(e.toInternationalString())},`${n}__${i}`)}):null,n&&!d?T(`div`,{className:`mb-4 bg-black`,children:T(An,{duration:i,onDuration:e=>o(e),onError:e=>p(e),media:{url:n,duration:i,height:l,width:s,type:`Video`},onDimensions:(e,t)=>{c(e||0),u(t||0)}})}):null,!d&&(i||s||l)?T(b,{$wide:!0,children:T(re,{widthId:`width`,width:s||0,changeWidth:e=>c(e),heightId:`height`,height:l||0,changeHeight:e=>u(e),durationId:`duration`,duration:i||0,changeDuration:e=>o(e)})}):null,T(t,{primary:!0,large:!0,type:`button`,onPress:()=>{e.runCreate({url:n,duration:i,label:m,width:s,height:l})},isDisabled:!n||!!d,children:`Add video`})]})}const Nn=_({id:`@manifest-editor/video-annotation`,create:jn,label:`Video`,summary:`Video annotation`,icon:T(h,{}),render(e){return T(Mn,{...e})},resourceType:`Annotation`,resourceFields:[`id`,`type`,`motivation`,`body`,`target`],additionalTypes:[`Canvas`],supports:{onlyPainting:!0,initialData:!0,parentTypes:[`AnnotationPage`,`Manifest`],parentFields:[`items`]},staticFields:{type:`Annotation`}}),Pn=()=>T(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`#000000`,transform:`scale(-1, 1)`,children:E(`g`,{children:[T(`rect`,{fill:`none`,height:`24`,width:`24`}),T(`path`,{d:`M16,20H2V4h14V20z M18,8h4V4h-4V8z M18,20h4v-4h-4V20z M18,14h4v-4h-4V14z`})]})}),Fn=_({id:`@manifest-editor/empty-annotation-page`,create:(e,t)=>t.embed({id:t.generateId(`annotations`),label:e.label,type:`AnnotationPage`,items:[]}),label:`Empty annotation page`,summary:`AnnotationPage with nothing`,icon:T(Pn,{}),resourceType:`AnnotationPage`,resourceFields:[`id`,`type`,`items`],supports:{parentTypes:[`Manifest`,`Canvas`,`Range`],parentFieldMap:{Manifest:[`annotations`],Canvas:[`items`,`annotations`],Range:[`annotations`]}}}),In=_({id:`@manifest-editor/empty-canvas`,create:(e,t)=>{let n=t.generateId(`canvas`),r=t.embed({id:t.generateId(`annotation-page`,{id:n,type:`Canvas`}),type:`AnnotationPage`,items:[]});return{id:n,type:`Canvas`,label:e.label||{en:[``]},height:e.height||1e3,width:e.width||1e3,items:[r]}},label:`Empty canvas`,summary:`No content`,icon:T(i,{}),resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`,`height`,`width`,`items`],supports:{parentTypes:[`Manifest`],parentFields:[`items`]}});var Ln=!0,X=`Invariant failed`;function Z(e,t){if(!e){if(Ln)throw Error(X);var n=typeof t==`function`?t():t,r=n?`${X}: ${n}`:X;throw Error(r)}}const Rn=_({id:`@manifest-editor/internal-canvas`,create:Bn,label:`Internal canvas link`,summary:`Canvas from the same manifest`,icon:T(Pn,{}),resourceType:`Canvas`,resourceFields:[`id`,`type`,`label`],supports:{parentTypes:[`Manifest`],parentFields:[`start`]},render:e=>T(zn,{...e})});function zn(e){let t=de(),n=ge(),r=C(()=>({canSelectCanvas:!1,canSelectCollection:!1,canSelectManifest:!0,canCropImage:!1,alwaysShowNavigationArrow:!1,multiSelect:!1}),[]),i=C(()=>[{type:`callback`,cb:t=>e.runCreate({id:t}),label:`Select canvas`,supportedTypes:[`Canvas`],format:{type:`url`}}],[e.runCreate]),a=C(()=>({saveToLocalStorage:!1,restoreFromLocalStorage:!1,initialHistory:[{url:t?.id,resource:t?.id,route:`/loading?id=${t?.id}`,metadata:{type:`Manifest`}}]}),[t?.id]);return Z(t,`Manifest is not loaded`),T(le,{vault:n,children:T(Ne,{vault:n,navigation:r,output:i,history:a})})}async function Bn(e,t){return t.embed({id:e.id,type:`Canvas`})}const Vn=e=>E(`svg`,{xmlns:`http://www.w3.org/2000/svg`,viewBox:`0 0 24 24`,height:`1em`,width:`1em`,...e,children:[T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{d:`M5 17v2h14v-2H5zm4.5-4.2h5l.9 2.2h2.1L12.75 4h-1.5L6.5 15h2.1l.9-2.2zM12 5.98 13.87 11h-3.74L12 5.98z`})]});async function Hn(e,t){return t.embed({id:t.generateId(`html/${e.language}`),language:e.language,type:`TextualBody`,format:`text/html`,value:e.body||``})}function Un(e){let{i18n:n}=Te(),[r,i]=w(`<p></p>`),[a,o]=w(n.defaultLanguage);return E(f,{children:[T(s,{className:`border-none`,value:r,onChange:e=>i(e)}),T(t,{primary:!0,large:!0,type:`button`,onPress:()=>{e.runCreate({language:a,body:r})},children:`Create`})]})}const Wn=_({id:`@manifest-editor/html-body-creator`,create:Hn,label:`HTML Body`,summary:`Add HTML annotation body`,icon:T(Vn,{}),render(e){return T(Un,{...e})},resourceType:`ContentResource`,resourceFields:[`id`,`language`,`type`,`format`,`value`],supports:{parentTypes:[`Annotation`],parentFields:[`body`]},staticFields:{type:`TextualBody`,format:`text/html`}});function Gn(e,t,n){return`${e}/${Math.floor(t.x)},${Math.floor(t.y)},${Math.floor(t.width)},${Math.floor(t.height)}/${n}/0/default.jpg`}async function Kn(e,t){let n=t.options.targetType,r=e.output,i=[];for(let{resource:a,selector:o,parent:s}of r){let r=a.type,c=new te;if((n===`Canvas`||n===`Annotation`||n===`ContentResource`)&&r===`Canvas`){let r=a.id,l=s?.type===`Manifest`?s.id:void 0;Z(l,`Could not find Manifest`);let u=c.get({id:l,type:`Manifest`})||await c.loadManifest(l);Z(u,`Manifest not found`);let d=u.items.find(e=>e.id===r);Z(d,`Canvas not found`);let f=c.get(d);if(n===`Canvas`&&o?.type!==`BoxSelector`){let e=c.toPresentation3(f);e.label||(e.label={en:[`Untitled canvas`]}),console.log(`loading full canvas`,e),t.vault.loadSync(e.id,e),i.push(t.embed({id:e.id,type:`Canvas`}));continue}let p=c.get(f.items[0]),m=c.get(p.items[0]);if(n===`Annotation`||n===`Canvas`||n===`ContentResource`){let r=c.toPresentation3(m);r.id=t.generateId(`Annotation`);let a=null,s={width:0,height:0};if(r?.body?.service){let t=r?.body.width,n=r?.body.height;a=Oe(r?.body)[0],a&&(!a.width||!a.height)&&(a.width=t,a.height=n),s.width=t,s.height=n,e.trackSize&&e.trackSize(s)}if(o?.type===`BoxSelector`){let s={type:`ImageApiSelector`,region:[~~o.spatial.x,~~o.spatial.y,~~o.spatial.width,~~o.spatial.height].join(`,`)},c={...r.body},l=``;if(a){let e=a.id||a[`@id`]||``;e&&(c.id=Gn(e,o.spatial,`max`),l=Gn(e,o.spatial,`512,`))}if(r.body={id:t.generateId(`SpecificResource`,m),type:`SpecificResource`,source:c,selector:s},e.trackSize&&e.trackSize({width:~~o.spatial.width,height:~~o.spatial.height}),n===`ContentResource`){i.push(r.body);continue}if(n===`Canvas`){let e=t.generateId(`Canvas`,m);r.target=e;let n=t.generateId(`Page`,m),a=t.embed({id:n,type:`AnnotationPage`,items:[r]});i.push(t.embed({id:e,type:`Canvas`,label:{en:[`Untitled canvas`]},width:~~o.spatial.width,height:~~o.spatial.height,thumbnail:l?[t.embed({id:l,type:`Image`,format:`image/jpeg`,width:512,height:Math.round(o.spatial.height/o.spatial.width*512)})]:void 0,items:[a]}));continue}i.push(t.embed({...r,target:t.getTarget()}));continue}i.push(t.embed({...c.toPresentation3(m),target:t.getTarget()}))}}}return i}const qn=_e(()=>import(`./iiif-browser-form.lazy-Cd6PPal4.js`)),Jn=_({id:`@manifest-editor/iiif-browser-creator`,create:Kn,label:`IIIF Browser`,summary:`Browse IIIF Resources`,icon:T(l,{}),render(e){return T(qn,{...e})},hiddenModal:!0,tags:[`image`,`image-service`],resourceType:`ContentResource`,resourceFields:[`id`,`language`,`type`,`format`,`value`],additionalTypes:[`Annotation`,`Canvas`],supports:{onlyPainting:!0,parentTypes:[`Annotation`,`Manifest`,`AnnotationPage`],parentFields:[`body`,`items`],parentFieldMap:{Annotation:[`body`],Manifest:[`items`],AnnotationPage:[`items`]}},sideEffects:[W,F,P],staticFields:{}}),Yn=_({id:`@manifest-editor/image-service-creator`,create:vn,label:`Image Service`,summary:`Add an image from Image Service`,icon:T(u,{style:{padding:10}}),render(e){return T(K,{...e})},resourceType:`ContentResource`,resourceFields:[`id`,`type`,`height`,`width`,`format`,`service`],supports:{parentFields:[`logo`,`body`,`thumbnail`]}}),Xn=_({id:`@manifest-editor/image-url-creator`,create:xn,label:`Image`,summary:`Image from a URL`,icon:T(n,{}),render(e){return T(J,{...e})},resourceType:`ContentResource`,resourceFields:[`format`],supports:{parentFields:[`logo`,`body`,`thumbnail`]},staticFields:{type:`Image`}}),Zn=_({id:`@manifest-editor/image-url-list`,label:`Image URL List`,summary:`Image from a list of URLs`,create:Tn,icon:T(d,{}),render(e){return T(Y,{...e})},resourceType:`ContentResource`,resourceFields:[`format`],supports:{parentFields:[`logo`,`body`,`thumbnail`]},staticFields:{type:`Image`}});async function Qn(e,t){return t.embed({id:e.url,type:`Text`,label:e.label,format:`text/plain`})}function $n(e){let[n,r]=w({en:[`View as text`]});return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault();let r=new FormData(t.target),i=Object.fromEntries(r.entries());i.url&&e.runCreate({url:i.url,label:n})},children:[T(S,{focusId:`label`,label:`Label`,fields:n,onSave:e=>r(e.toInternationalString())}),E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link to plaintext`}),T(y,{id:`url`,name:`url`,defaultValue:``})]}),T(t,{primary:!0,large:!0,type:`submit`,children:`Create`})]})})}const er=_({id:`@manifest-editor/plaintext-creator`,create:Qn,label:`Plaintext`,summary:`Add link to an plaintext`,icon:T(Vn,{}),render(e){return T($n,{...e})},resourceType:`ContentResource`,resourceFields:[`label`,`format`],supports:{parentFields:[`seeAlso`,`rendering`,`homepage`]},staticFields:{format:`text/plain`}});function tr(e,t){e[`@id`]&&(e.id=e[`@id`]),e[`@type`]&&(e.type=e[`@type`]);let n=De(e);return O({identifier:n.identifier,server:n.server,scheme:n.scheme,type:`image`,size:{max:!1,confined:!1,upscaled:!1,width:t.width,height:t.height},format:`jpg`,region:{full:!0},rotation:{angle:0},quality:`default`,prefix:n.prefix,originalPath:n.originalPath})}function Q(e){return e.endsWith(`default.jpg`)?O({...Ae(e),type:`info`}):Ee(e)}async function nr(e,t){let n={...e.service},r=n.sizes;if(n[`@id`]&&(n.id=n[`@id`]),n[`@type`]&&(n.type=n[`@type`]),e.thumbnailUrl)return t.embed({id:e.thumbnailUrl,type:`Image`,format:`image/jpeg`,width:e.width,height:e.height});if(r){let i=e.width||400,a=null;for(let e of r)(!a||Math.abs(e.width-i)<Math.abs(a.width-i))&&(a={width:e.width,height:e.height});if(a){let e=tr(n,a);return t.embed({id:e,type:`Image`,format:`image/jpeg`,width:a.width,height:a.height})}}return null}function rr(e){let[n,r]=w(``),[i,a]=w(null),[o,s]=w({width:0,height:0}),c=C(()=>!i||!o.width||!o.height?null:tr(i,o),[o,i]);return i?E(f,{children:[E(`div`,{className:`mb-4`,children:[T(`div`,{className:`mb-2`,children:i[`@id`]||i.id}),T(`div`,{className:`flex gap-2 mb-4`,children:i.sizes?.map(e=>{let n=e.width===o.width;return E(t,{primary:n,isDisabled:n,large:!0,onPress:()=>s(e),children:[e.width,`x`,e.height]},e.width)})}),c?T(`img`,{src:c,alt:`preview of selected resource`}):null]}),T(t,{primary:!0,large:!0,isDisabled:!c,onPress:()=>{i&&e.runCreate({service:i,width:o.width,height:o.height})},children:`Add thumbnail`})]}):T(f,{children:E(`form`,{onSubmit:e=>{e.preventDefault();let t=new FormData(e.target),n=Object.fromEntries(t.entries()).url;if(n){let e=Q(n);if(!e)throw Error(`Invalid image service request`);fetch(e).then(e=>e.json()).then(e=>{a(e);let t=e.sizes?.[0];t&&s(t)})}},children:[T(`div`,{className:`flex gap-2 items-center`,children:E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link to image service`}),T(y,{id:`url`,name:`url`,defaultValue:``,onPaste:e=>{let t=e.clipboardData.getData(`text/plain`);r(t?Q(t):``)},onBlur:e=>r(e.currentTarget.value?Q(e.currentTarget.value):``)})]})}),T(`div`,{children:T(t,{primary:!0,large:!0,type:`submit`,isDisabled:!n,children:`Select size`})})]})})}const ir=_({id:`@manifest-editor/thumbnail-image`,create:nr,label:`Thumbnail from service`,summary:`Add thumbnail from an image service`,icon:T(m,{}),render(e){return T(rr,{...e})},resourceType:`ContentResource`,resourceFields:[`id`,`type`,`format`],supports:{parentFields:[`thumbnail`]}});function ar(){return E(`svg`,{xmlns:`http://www.w3.org/2000/svg`,height:`24px`,viewBox:`0 0 24 24`,width:`24px`,fill:`#000000`,children:[T(`path`,{d:`M0 0h24v24H0z`,fill:`none`}),T(`path`,{d:`M3.9 12c0-1.71 1.39-3.1 3.1-3.1h4V7H7c-2.76 0-5 2.24-5 5s2.24 5 5 5h4v-1.9H7c-1.71 0-3.1-1.39-3.1-3.1zM8 13h8v-2H8v2zm9-6h-4v1.9h4c1.71 0 3.1 1.39 3.1 3.1s-1.39 3.1-3.1 3.1h-4V17h4c2.76 0 5-2.24 5-5s-2.24-5-5-5z`})]})}async function or(e,t){return t.embed({id:e.url,type:`Text`,label:e.label,format:`text/html`})}function sr(e){let[n,r]=w({en:[``]});return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault();let r=new FormData(t.target),i=Object.fromEntries(r.entries());i.url&&e.runCreate({url:i.url,label:n})},children:[T(S,{focusId:`label`,label:`Label`,fields:n,onSave:e=>r(e.toInternationalString())}),E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link`}),T(y,{id:`url`,name:`url`,defaultValue:``})]}),T(t,{primary:!0,large:!0,type:`submit`,children:`Create link`})]})})}const cr=_({id:`@manifest-editor/web-page-creator`,create:or,label:`Web page`,summary:`Add link to an external web page`,icon:T(ar,{}),render(e){return T(sr,{...e})},resourceType:`ContentResource`,resourceFields:[`label`,`format`],supports:{parentFields:[`seeAlso`,`rendering`,`homepage`]}}),lr=/^.*(?:(?:youtu\.be\/|v\/|vi\/|u\/\w\/|embed\/|shorts\/)|(?:(?:watch)?\?vi?=|&vi?=))([^#&?]*).*/;function $(e){let t=(e||``).match(lr);return t?t[1]:null}function ur(e){return!!$(e.youtubeUrl)}async function dr(e,t){let n=$(e.youtubeUrl),r=t.embed({id:`https://www.youtube.com/watch?v=${n}`,type:`Video`,service:[{profile:`http://digirati.com/objectifier`,params:{data:`https://www.youtube.com/embed/${n}`}},{id:`https://www.youtube.com/watch?v=${n}`,profile:`https://www.youtube.com`}]});if(t.options.targetType===`Canvas`){let n=t.generateId(`canvas`),i=t.generateId(`annotation-page`,{id:n,type:`Canvas`}),a=t.embed({id:t.generateId(`annotation`,{id:i,type:`AnnotationPage`}),type:`Annotation`,motivation:`painting`,body:[r],target:{type:`SpecificResource`,source:{id:n,type:`Canvas`}}}),o=t.embed({id:i,type:`AnnotationPage`,items:[a]});return t.embed({id:n,type:`Canvas`,label:e.label||{en:[`Untitled YouTube canvas`]},height:e.height||1e3,width:e.width||1e3,duration:e.duration||1,items:[o]})}return t.options.targetType===`Annotation`?t.embed({id:t.generateId(`annotation`),type:`Annotation`,motivation:`painting`,body:[r],target:t.getTarget()}):r}function fr(e){return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault();let n=new FormData(t.target),r=Object.fromEntries(n.entries());r.youtubeUrl&&e.runCreate({youtubeUrl:r.youtubeUrl})},children:[E(b,{$wide:!0,children:[T(x,{htmlFor:`id`,children:`Link to YouTube`}),T(y,{id:`youtubeUrl`,name:`youtubeUrl`,defaultValue:``})]}),T(t,{primary:!0,large:!0,type:`submit`,children:`Create`})]})})}const pr=_({id:`@manifest-editor/youtube`,create:dr,label:`YouTube`,summary:`Embed YouTube`,icon:T(ee,{}),resourceType:`ContentResource`,additionalTypes:[`Canvas`,`Annotation`],resourceFields:[`id`,`type`,`service`],render:e=>T(fr,{...e}),supports:{onlyPainting:!0,parentTypes:[`Annotation`,`Manifest`,`AnnotationPage`],parentFieldMap:{Annotation:[`body`],Manifest:[`items`],AnnotationPage:[`items`]}},staticFields:{type:`Video`}});async function mr(e,t){let n=e.output||[],r=[];for(let e of n){let{resource:n,parent:i,selector:a}=e,o=t.getPreviewVault(),s=ne(o);if(n.type===`Manifest`){let e=n.id;Z(e,`Could not find Manifest ID`);let i=await o.loadManifest(e),a=await s.getBestThumbnailAtSize(i,{width:256,height:256},!1);Z(i,`Manifest not found`),r.push(t.embed({id:n.id,type:`Manifest`,label:i.label,summary:i.summary,thumbnail:a?.best?[{id:a.best.id,type:`Image`}]:void 0}));continue}if(n.type===`Collection`){let e=n.id;Z(e,`Could not find Manifest ID`);let i=await o.loadManifest(e);Z(i,`Collection not found`),r.push(t.embed({id:n.id,type:`Collection`,label:i.label}))}}return r}const hr=_e(()=>import(`./manifest-browser-form.lazy-CAGYyvpq.js`)),gr=_({id:`@manifest-editor/manifest-browser-creator`,create:mr,label:`IIIF Browser`,summary:`Browse IIIF Resources`,icon:T(l,{}),render(t){return T(e,{...t})},resourceType:`Manifest`,resourceFields:[`id`,`label`],additionalTypes:[`Collection`],supports:{parentTypes:[`Collection`],parentFieldMap:{Collection:[`items`]}},sideEffects:[],staticFields:{}});async function _r(e,t,n){let r=t.generateId(`range`,n?{id:n,type:`Range`}:void 0);return t.embed({id:r,type:`Range`,label:e.label||{en:[`Untitled range`]},items:e.items||[]})}function vr(e){let[n,r]=w({en:[``]});return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault(),n&&e.runCreate({type:`Range`,label:n})},children:[T(S,{focusId:`label`,label:`Label`,fields:n,onSave:e=>r(e.toInternationalString())}),T(t,{primary:!0,type:`submit`,children:`Create range`})]})})}const yr=_({id:`@manifest-editor/range-with-items`,create:_r,label:`Range`,summary:`Add a new range`,icon:T(p,{}),render(e){return T(vr,{...e})},resourceType:`Range`,resourceFields:[`id`,`label`,`type`],supports:{parentTypes:[`Range`],parentFields:[`items`]},staticFields:{type:`Range`}});async function br(e,t,n){let r=t.generateId(`range`,n?{id:n,type:`Range`}:void 0);return t.embed({id:r,type:`Range`,label:e.label||{en:[`Table of Contents`]},items:(e.items||[]).map(e=>t.ref(e))})}function xr(e){let[n,r]=w({en:[``]});return T(f,{children:E(`form`,{onSubmit:t=>{t.preventDefault(),n&&e.runCreate({type:`Range`,label:n})},children:[T(S,{focusId:`label`,label:`Label`,fields:n,onSave:e=>r(e.toInternationalString())}),T(t,{primary:!0,type:`submit`,children:`Create range`})]})})}const Sr=_({id:`@manifest-editor/range-top-level`,create:br,label:`Top Level Range`,summary:`Add a new top level range`,icon:T(p,{}),render(e){return T(xr,{...e})},resourceType:`Range`,resourceFields:[`id`,`label`,`type`],supports:{parentTypes:[`Manifest`],parentFields:[`structures`]},staticFields:{type:`Range`}}),Cr=[Yn,bn,Xn,wn,Nn,Ze,Wn,rt,pr,Jn,In,er,cr,Fn,On,Rn,et,Zn,Dn,ir,Sr,yr];export{N as CreateAudioAnnotationForm,$e as CreateCaptionedImageAnnotation,nt as CreateHTMLAnnotation,Un as CreateHTMLBodyForm,K as CreateImageServerForm,yn as CreateImageServiceAnnotationForm,Cn as CreateImageUrlAnnotationForm,J as CreateImageUrlForm,Y as CreateImageUrlListForm,$n as CreatePlaintextForm,rr as CreateThumbnailForm,Mn as CreateVideoAnnotationForm,sr as CreateWebPageForm,qn as IIIFBrowserCreatorForm,hr as ManifestBrowserCreatorForm,vr as RangeWithItemsCreatorForm,xr as TopLevelRangeCreatorForm,fr as YouTubeForm,Cr as allCreators,Ze as audioAnnotation,et as captionedImageAnnotation,M as createAudioAnnotation,Qe as createCaptionedImageAnnotation,Kn as createFromIIIFBrowserOutput,mr as createFromManifestBrowserOutput,tt as createHtmlAnnotation,Hn as createHtmlBody,vn as createImageServer,q as createImageServiceAnnotation,xn as createImageUrl,Sn as createImageUrlAnnotation,Tn as createImageUrlList,En as createImageUrlListAnnotation,kn as createNoBodyAnnotation,Qn as createPlaintext,br as createRangeTopLevel,_r as createRangeWithItems,nr as createThumbnail,jn as createVideoAnnotation,or as createWebPage,dr as createYoutubeBody,Fn as emptyAnnotationPage,In as emptyCanvas,$ as getYouTubeId,rt as htmlAnnotation,Wn as htmlBodyCreator,Jn as iiifBrowserCreator,bn as imageServiceAnnotation,Yn as imageServiceCreator,wn as imageUrlAnnotation,Xn as imageUrlCreator,Dn as imageUrlListAnnotation,Zn as imageUrlListCreator,Rn as internalCanvas,gr as manifestBrowserCreator,On as noBodyAnnotation,er as plaintextCreator,Sr as rangeTopLevel,yr as rangeWithItems,ur as validateYouTube,Nn as videoAnnotation,cr as webPageCreator,pr as youTubeBodyCreator};
98
+ //# sourceMappingURL=index.js.map