@manifest-editor/shell 1.3.1 → 1.4.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.cjs CHANGED
@@ -1738,27 +1738,6 @@ function AtlasStoreProvider({
1738
1738
  var import_parser3 = require("@iiif/parser");
1739
1739
  var import_components4 = require("@manifest-editor/components");
1740
1740
  var import_creator_api2 = require("@manifest-editor/creator-api");
1741
-
1742
- // ../ui/madoc/components/icons/Spinner.tsx
1743
- var import_jsx_runtime13 = require("react/jsx-runtime");
1744
- function Spinner(props) {
1745
- return /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("svg", { width: "1em", height: "1em", viewBox: "0 0 42 42", xmlns: "http://www.w3.org/2000/svg", stroke: "#fff", ...props, children: /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
1746
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
1747
- /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1748
- "animateTransform",
1749
- {
1750
- attributeName: "transform",
1751
- type: "rotate",
1752
- from: "0 18 18",
1753
- to: "360 18 18",
1754
- dur: "1s",
1755
- repeatCount: "indefinite"
1756
- }
1757
- ) })
1758
- ] }) });
1759
- }
1760
-
1761
- // src/BaseCreator/BaseCreator.tsx
1762
1741
  var import_react19 = require("react");
1763
1742
  var import_react_iiif_vault7 = require("react-iiif-vault");
1764
1743
 
@@ -1790,11 +1769,11 @@ function useLayoutProvider() {
1790
1769
  var import_styled_components6 = __toESM(require("styled-components"), 1);
1791
1770
 
1792
1771
  // ../ui/icons/StarIcon.tsx
1793
- var import_jsx_runtime14 = require("react/jsx-runtime");
1794
- var StarIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 24 24", ...props, children: [
1795
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1796
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1797
- /* @__PURE__ */ (0, import_jsx_runtime14.jsx)(
1772
+ var import_jsx_runtime13 = require("react/jsx-runtime");
1773
+ var StarIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime13.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1em", width: "1em", viewBox: "0 0 24 24", ...props, children: [
1774
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1775
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1776
+ /* @__PURE__ */ (0, import_jsx_runtime13.jsx)(
1798
1777
  "path",
1799
1778
  {
1800
1779
  d: "M12 17.27 18.18 21l-1.64-7.03L22 9.24l-7.19-.61L12 2 9.19 8.63 2 9.24l5.46 4.73L5.82 21z",
@@ -1804,10 +1783,10 @@ var StarIcon = (props) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg",
1804
1783
  ] });
1805
1784
 
1806
1785
  // ../ui/icons/BackIcon.tsx
1807
- var import_jsx_runtime15 = require("react/jsx-runtime");
1808
- var BackIcon = ({ style }) => /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1rem", viewBox: "0 0 24 24", width: "1rem", fill: "#000000", style, children: [
1809
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1810
- /* @__PURE__ */ (0, import_jsx_runtime15.jsx)("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
1786
+ var import_jsx_runtime14 = require("react/jsx-runtime");
1787
+ var BackIcon = ({ style }) => /* @__PURE__ */ (0, import_jsx_runtime14.jsxs)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "1rem", viewBox: "0 0 24 24", width: "1rem", fill: "#000000", style, children: [
1788
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M0 0h24v24H0z", fill: "none" }),
1789
+ /* @__PURE__ */ (0, import_jsx_runtime14.jsx)("path", { d: "M20 11H7.83l5.59-5.59L12 4l-8 8 8 8 1.41-1.41L7.83 13H20v-2z" })
1811
1790
  ] });
1812
1791
 
1813
1792
  // src/Layout/components/ModularPanel.tsx
@@ -1826,13 +1805,13 @@ var PaddedSidebarContainer = import_styled_components4.default.div`
1826
1805
  // src/Layout/components/PanelError.tsx
1827
1806
  var import_components3 = require("@manifest-editor/components");
1828
1807
  var import_react13 = require("react");
1829
- var import_jsx_runtime16 = require("react/jsx-runtime");
1808
+ var import_jsx_runtime15 = require("react/jsx-runtime");
1830
1809
  function PanelError(props) {
1831
1810
  let error = props.error.toString();
1832
1811
  const [isFixing, setIsFixing] = (0, import_react13.useState)(false);
1833
- return /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(PaddedSidebarContainer, { children: [
1834
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(import_components3.ErrorMessage, { className: "mb-2", children: error }),
1835
- /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CalltoButton, { onClick: props.resetErrorBoundary, children: "Try again" })
1812
+ return /* @__PURE__ */ (0, import_jsx_runtime15.jsxs)(PaddedSidebarContainer, { children: [
1813
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(import_components3.ErrorMessage, { className: "mb-2", children: error }),
1814
+ /* @__PURE__ */ (0, import_jsx_runtime15.jsx)(CalltoButton, { onClick: props.resetErrorBoundary, children: "Try again" })
1836
1815
  ] });
1837
1816
  }
1838
1817
 
@@ -1956,7 +1935,7 @@ var import_react_accessible_dropdown_menu_hook2 = __toESM(require("react-accessi
1956
1935
  var OverrideScrollbar = "ModularPanel_OverrideScrollbar";
1957
1936
 
1958
1937
  // src/Layout/components/ModularPanel.tsx
1959
- var import_jsx_runtime17 = require("react/jsx-runtime");
1938
+ var import_jsx_runtime16 = require("react/jsx-runtime");
1960
1939
  var LayoutTitleReactContext = (0, import_react15.createContext)(null);
1961
1940
  function useSetCustomTitle() {
1962
1941
  return (0, import_react15.useContext)(LayoutTitleReactContext);
@@ -2053,7 +2032,7 @@ var ModulePanelButton = import_styled_components6.default.button`
2053
2032
  var ModulePanelSpacer = import_styled_components6.default.div`
2054
2033
  flex: 1 1 0px;
2055
2034
  `;
2056
- var ModularPanelLabel = import_styled_components6.default.h2`
2035
+ var ModularPanelLabel = import_styled_components6.default.div`
2057
2036
  font-size: 0.875em;
2058
2037
  flex: 1 1 0px;
2059
2038
  padding-left: 1em;
@@ -2131,16 +2110,16 @@ function ModularPanel({
2131
2110
  if (!panel || !state.current) {
2132
2111
  return null;
2133
2112
  }
2134
- const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: backAction, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(BackIcon, {}) }) : null;
2135
- const closeButton = /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: close || actions.close, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(CloseIcon, {}) });
2136
- return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(LayoutTitleReactContext.Provider, { value: _setCustomTitle, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ModularPanelWrapper, { "data-state": transition, "data-flipped": isLeft, style, "data-header": !noHeader, children: [
2137
- noHeader ? null : /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(ModularPanelHeader, { "data-tabs": !!tabs, "data-error": didError, children: [
2138
- /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(Dropdown, { style: { display: "flex", height: "100%" }, children: [
2113
+ const backButton = panel.backAction || state.stack.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModulePanelButton, { onClick: backAction, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(BackIcon, {}) }) : null;
2114
+ const closeButton = /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModulePanelButton, { onClick: close || actions.close, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(CloseIcon, {}) });
2115
+ return /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(LayoutTitleReactContext.Provider, { value: _setCustomTitle, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ModularPanelWrapper, { "data-state": transition, "data-flipped": isLeft, style, "data-header": !noHeader, children: [
2116
+ noHeader ? null : /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(ModularPanelHeader, { "data-tabs": !!tabs, "data-error": didError, children: [
2117
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(Dropdown, { style: { display: "flex", height: "100%" }, children: [
2139
2118
  panel.renderBackAction ? panel.renderBackAction({ backAction, fallback: backButton }) : backButton,
2140
- switchablePanels.length ? /* @__PURE__ */ (0, import_jsx_runtime17.jsxs)(DropdownMenu, { $open: isOpen, style: { left: "0.5em" }, children: [
2141
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownLabel, { children: "All panels" }),
2142
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(DropdownDivider, {}),
2143
- switchablePanels.map((newPanel, i) => /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2119
+ switchablePanels.length ? /* @__PURE__ */ (0, import_jsx_runtime16.jsxs)(DropdownMenu, { $open: isOpen, style: { left: "0.5em" }, children: [
2120
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownLabel, { children: "All panels" }),
2121
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(DropdownDivider, {}),
2122
+ switchablePanels.map((newPanel, i) => /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2144
2123
  DropdownItem,
2145
2124
  {
2146
2125
  ...itemProps[i],
@@ -2152,11 +2131,11 @@ function ModularPanel({
2152
2131
  ))
2153
2132
  ] }) : null
2154
2133
  ] }),
2155
- customTitle ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelLabel, { children: customTitle }) : hideHeader ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelSpacer, {}) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelLabel, { children: panel.label }),
2156
- pinnable ? state.pinned ? /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: pinActions.unpin, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StarIcon, { fill: "orange" }) }) : /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModulePanelButton, { onClick: () => pinActions.pin({ id: panel.id, state: state.state }), children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(StarIcon, { fill: "#ddd" }) }) : null,
2134
+ customTitle ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModularPanelLabel, { children: customTitle }) : hideHeader ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModulePanelSpacer, {}) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModularPanelLabel, { children: panel.label }),
2135
+ pinnable ? state.pinned ? /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModulePanelButton, { onClick: pinActions.unpin, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StarIcon, { fill: "orange" }) }) : /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModulePanelButton, { onClick: () => pinActions.pin({ id: panel.id, state: state.state }), children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(StarIcon, { fill: "#ddd" }) }) : null,
2157
2136
  panel.renderCloseAction ? panel.renderCloseAction({ closeAction: close || actions.close, fallback: closeButton }) : closeButton
2158
2137
  ] }),
2159
- /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(ModularPanelContent, { className: OverrideScrollbar, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(
2138
+ /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(ModularPanelContent, { className: OverrideScrollbar, children: /* @__PURE__ */ (0, import_jsx_runtime16.jsx)(
2160
2139
  import_react_error_boundary.ErrorBoundary,
2161
2140
  {
2162
2141
  onError: () => setDidError(true),
@@ -2213,15 +2192,13 @@ function createDownload(data, fileName, fileType = "text/json") {
2213
2192
  a.remove();
2214
2193
  }
2215
2194
  async function copyToClipboard(json) {
2216
- return navigator.clipboard.writeText(
2217
- typeof json === "string" ? json : JSON.stringify(json, null, 2)
2218
- );
2195
+ return navigator.clipboard.writeText(typeof json === "string" ? json : JSON.stringify(json, null, 2));
2219
2196
  }
2220
2197
  function randomId() {
2221
2198
  return `${Math.random().toString(36).substr(2)}-${Date.now().toString(36)}`;
2222
2199
  }
2223
2200
  function mapApp(input, map) {
2224
- const { default: metadata, ...props } = input;
2201
+ const { default: metadata, config, ...props } = input;
2225
2202
  const app = {
2226
2203
  metadata,
2227
2204
  layout: {
@@ -2229,7 +2206,8 @@ function mapApp(input, map) {
2229
2206
  rightPanels: [],
2230
2207
  centerPanels: [],
2231
2208
  ...props
2232
- }
2209
+ },
2210
+ config
2233
2211
  };
2234
2212
  return map ? map(app) : app;
2235
2213
  }
@@ -2252,35 +2230,17 @@ function extendApp(app, metadata, extensions) {
2252
2230
  }),
2253
2231
  ...extensions?.leftPanels || []
2254
2232
  ],
2255
- annotations: [
2256
- ...extensions?.annotations || [],
2257
- ...app.layout.annotations || []
2258
- ],
2259
- canvasEditors: [
2260
- ...extensions?.canvasEditors || [],
2261
- ...app.layout.canvasEditors || []
2262
- ],
2263
- creators: [
2264
- ...extensions?.creators || [],
2265
- ...app.layout.creators || []
2266
- ],
2233
+ annotations: [...extensions?.annotations || [], ...app.layout.annotations || []],
2234
+ canvasEditors: [...extensions?.canvasEditors || [], ...app.layout.canvasEditors || []],
2235
+ creators: [...extensions?.creators || [], ...app.layout.creators || []],
2267
2236
  editors: [
2268
2237
  //
2269
2238
  ...extensions?.editors || [],
2270
2239
  ...app.layout.editors || []
2271
2240
  ],
2272
- rightPanels: [
2273
- ...app.layout.rightPanels || [],
2274
- ...extensions?.rightPanels || []
2275
- ],
2276
- centerPanels: [
2277
- ...app.layout.centerPanels || [],
2278
- ...extensions?.centerPanels || []
2279
- ],
2280
- modals: [
2281
- ...app.layout.modals || [],
2282
- ...extensions?.modalPanels || []
2283
- ]
2241
+ rightPanels: [...app.layout.rightPanels || [], ...extensions?.rightPanels || []],
2242
+ centerPanels: [...app.layout.centerPanels || [], ...extensions?.centerPanels || []],
2243
+ modals: [...app.layout.modals || [], ...extensions?.modalPanels || []]
2284
2244
  }
2285
2245
  };
2286
2246
  }
@@ -2447,7 +2407,7 @@ function createPreviewVault(homepageCollectionId = "vault://homepage-collection.
2447
2407
  }
2448
2408
 
2449
2409
  // src/PreviewVault/PreviewVault.tsx
2450
- var import_jsx_runtime18 = require("react/jsx-runtime");
2410
+ var import_jsx_runtime17 = require("react/jsx-runtime");
2451
2411
  function usePreviewVault() {
2452
2412
  return (0, import_react17.useContext)(PreviewVaultReactContext);
2453
2413
  }
@@ -2469,11 +2429,11 @@ function PreviewVaultContext(props) {
2469
2429
  (0, import_react17.useEffect)(() => {
2470
2430
  return unsubscribe;
2471
2431
  }, []);
2472
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewVaultAddHistory.Provider, { value: { addHistory, clearHistory }, children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(PreviewVaultReactContext.Provider, { value: vault, children: props.children }) });
2432
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewVaultAddHistory.Provider, { value: { addHistory, clearHistory }, children: /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(PreviewVaultReactContext.Provider, { value: vault, children: props.children }) });
2473
2433
  }
2474
2434
  function PreviewVaultBoundary({ children }) {
2475
2435
  const vault = usePreviewVault();
2476
- return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react_iiif_vault5.VaultProvider, { vault, children });
2436
+ return /* @__PURE__ */ (0, import_jsx_runtime17.jsx)(import_react_iiif_vault5.VaultProvider, { vault, children });
2477
2437
  }
2478
2438
 
2479
2439
  // src/BaseCreator/BaseCreator.hooks.tsx
@@ -2574,11 +2534,12 @@ function useInlineCreator() {
2574
2534
  }
2575
2535
 
2576
2536
  // src/BaseCreator/BaseCreator.tsx
2577
- var import_jsx_runtime19 = require("react/jsx-runtime");
2537
+ var import_jsx_runtime18 = require("react/jsx-runtime");
2578
2538
  var RenderCreator = (0, import_react19.memo)(function RenderCreator2(props) {
2579
2539
  const vault = (0, import_react_iiif_vault7.useVault)();
2580
2540
  const { edit, modal } = useLayoutActions();
2581
2541
  const [isCreating, setIsCreating] = (0, import_react19.useState)(false);
2542
+ const [error, setError] = (0, import_react19.useState)(null);
2582
2543
  const creator = useInlineCreator();
2583
2544
  const isCreatingRef = (0, import_react19.useRef)(false);
2584
2545
  const canvasSelector = props.resource.initialData?.selector;
@@ -2594,18 +2555,32 @@ var RenderCreator = (0, import_react19.memo)(function RenderCreator2(props) {
2594
2555
  initialData: props.resource.initialData
2595
2556
  };
2596
2557
  const runCreate = (payload) => {
2597
- if (isCreating || isCreatingRef.current)
2598
- return;
2599
- setIsCreating(true);
2600
- isCreatingRef.current = true;
2601
- creator.create(props.creator.id, payload, options).then((ref) => {
2602
- modal.popStack();
2603
- edit(ref, {
2604
- parent: (0, import_parser3.toRef)(props.resource.parent),
2605
- property: props.resource.property,
2606
- index: props.resource.index
2558
+ try {
2559
+ if (isCreating || isCreatingRef.current)
2560
+ return;
2561
+ setIsCreating(true);
2562
+ isCreatingRef.current = true;
2563
+ creator.create(props.creator.id, payload, options).catch((err) => {
2564
+ setError(err?.message || "Unknown error");
2565
+ return null;
2566
+ }).then(async (ref) => {
2567
+ if (!ref)
2568
+ return;
2569
+ const singleRef = Array.isArray(ref) ? ref[0] : ref;
2570
+ setIsCreating(false);
2571
+ modal.popStack();
2572
+ modal.close();
2573
+ if (singleRef) {
2574
+ edit(singleRef, {
2575
+ parent: (0, import_parser3.toRef)(props.resource.parent),
2576
+ property: props.resource.property,
2577
+ index: props.resource.index
2578
+ });
2579
+ }
2607
2580
  });
2608
- });
2581
+ } catch (err) {
2582
+ setError(err?.message || "Unknown error");
2583
+ }
2609
2584
  };
2610
2585
  const validate = async () => {
2611
2586
  return true;
@@ -2615,19 +2590,21 @@ var RenderCreator = (0, import_react19.memo)(function RenderCreator2(props) {
2615
2590
  runCreate({});
2616
2591
  }
2617
2592
  }, [props.creator]);
2618
- (0, import_react19.useEffect)(() => {
2619
- if (isCreating) {
2620
- modal.popStack();
2621
- modal.close();
2622
- }
2623
- });
2593
+ if (error) {
2594
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col items-center p-4", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.ErrorMessage, { children: error }) });
2595
+ }
2596
+ const spinner = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "flex flex-col items-center py-8", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { className: "flex gap-2 items-center", children: [
2597
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.Spinner, {}),
2598
+ " ",
2599
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("span", { children: "Loading" })
2600
+ ] }) });
2624
2601
  if (isCreating) {
2625
- return null;
2602
+ return spinner;
2626
2603
  }
2627
2604
  if (!props.creator.render) {
2628
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { onClick: () => runCreate({}), children: "Create" }) });
2605
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(Button, { onClick: () => runCreate({}), children: "Create" }) });
2629
2606
  }
2630
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_jsx_runtime19.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(import_react19.Suspense, { fallback: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Spinner, {}), children: props.creator.render({
2607
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_jsx_runtime18.Fragment, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_react19.Suspense, { fallback: spinner, children: props.creator.render({
2631
2608
  vault,
2632
2609
  runCreate,
2633
2610
  validate,
@@ -2637,9 +2614,7 @@ var RenderCreator = (0, import_react19.memo)(function RenderCreator2(props) {
2637
2614
  function BaseCreator(props) {
2638
2615
  const app = useApp();
2639
2616
  const vault = (0, import_react_iiif_vault7.useVault)();
2640
- const [currentId, setCurrentId] = (0, import_react19.useState)(
2641
- props.resource.initialCreator || ""
2642
- );
2617
+ const [currentId, setCurrentId] = (0, import_react19.useState)(props.resource.initialCreator || "");
2643
2618
  const set = useSetCustomTitle();
2644
2619
  const supported = (0, import_react19.useMemo)(
2645
2620
  () => (0, import_creator_api2.matchBasedOnResource)(props.resource, app.layout.creators || [], {
@@ -2657,19 +2632,33 @@ function BaseCreator(props) {
2657
2632
  }
2658
2633
  });
2659
2634
  if (supported.length === 0) {
2660
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { children: "Not currently supported" });
2635
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { children: "Not currently supported" });
2661
2636
  }
2637
+ const backButton = /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.ModalBackSlot, { children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2638
+ import_components4.IconButton,
2639
+ {
2640
+ root: document.getElementById("headlessui-portal-root") || void 0,
2641
+ label: "Back to Add content options",
2642
+ className: "group",
2643
+ placement: "right",
2644
+ onPress: () => setCurrentId(""),
2645
+ children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(import_components4.GridIcon, { className: "text-2xl opacity-50 group-hover:opacity-70" })
2646
+ }
2647
+ ) });
2662
2648
  if (current) {
2663
2649
  const shouldHideModal = current.hiddenModal;
2664
2650
  if (shouldHideModal) {
2665
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RenderCreator, { creator: current, resource: props.resource });
2666
- }
2667
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsxs)("div", { children: [
2668
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "bg-me-gray-100 p-2", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(Button, { onClick: () => setCurrentId(""), children: "Back" }) }),
2669
- /* @__PURE__ */ (0, import_jsx_runtime19.jsx)("div", { className: "p-2 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(RenderCreator, { creator: current, resource: props.resource }) })
2651
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)(import_jsx_runtime18.Fragment, { children: [
2652
+ backButton,
2653
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RenderCreator, { creator: current, resource: props.resource })
2654
+ ] });
2655
+ }
2656
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsxs)("div", { children: [
2657
+ backButton,
2658
+ /* @__PURE__ */ (0, import_jsx_runtime18.jsx)("div", { className: "p-2 py-6", children: /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(RenderCreator, { creator: current, resource: props.resource }) })
2670
2659
  ] });
2671
2660
  }
2672
- return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(
2661
+ return /* @__PURE__ */ (0, import_jsx_runtime18.jsx)(
2673
2662
  import_components4.CreatorGrid,
2674
2663
  {
2675
2664
  label: "Select a type",
@@ -2685,13 +2674,13 @@ function BaseCreator(props) {
2685
2674
  }
2686
2675
 
2687
2676
  // src/BaseCreator/index.tsx
2688
- var import_jsx_runtime20 = require("react/jsx-runtime");
2677
+ var import_jsx_runtime19 = require("react/jsx-runtime");
2689
2678
  var baseCreator = {
2690
2679
  id: "@manifest-editor/creator",
2691
2680
  label: "Add content",
2692
2681
  options: { hideHeader: true, tabs: false },
2693
2682
  render(state) {
2694
- return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(BaseCreator, { resource: state });
2683
+ return /* @__PURE__ */ (0, import_jsx_runtime19.jsx)(BaseCreator, { resource: state });
2695
2684
  }
2696
2685
  };
2697
2686
 
@@ -2798,7 +2787,7 @@ function filterStack(newStackWithDuplicates, current) {
2798
2787
  var import_editor_api = require("@manifest-editor/editor-api");
2799
2788
  var import_react_iiif_vault8 = require("react-iiif-vault");
2800
2789
  var import_parser5 = require("@iiif/parser");
2801
- var import_jsx_runtime21 = require("react/jsx-runtime");
2790
+ var import_jsx_runtime20 = require("react/jsx-runtime");
2802
2791
  var defaultState = { stack: [], current: null, create: null };
2803
2792
  var EditingStackContext = (0, import_react20.createContext)(defaultState);
2804
2793
  var EditingStackActionsContext = (0, import_react20.createContext)({
@@ -2938,16 +2927,16 @@ function EditingStack(props) {
2938
2927
  return { edit, updateCurrent, close, back, create: create2 };
2939
2928
  }, []);
2940
2929
  const { instanceId } = useAppInstance();
2941
- return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditingStackActionsContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(EditingStackContext.Provider, { value: state, children: props.children }) }, instanceId);
2930
+ return /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EditingStackActionsContext.Provider, { value: actions, children: /* @__PURE__ */ (0, import_jsx_runtime20.jsx)(EditingStackContext.Provider, { value: state, children: props.children }) }, instanceId);
2942
2931
  }
2943
2932
 
2944
2933
  // src/BaseEditor/BaseEditor.tsx
2945
- var import_jsx_runtime22 = require("react/jsx-runtime");
2934
+ var import_jsx_runtime21 = require("react/jsx-runtime");
2946
2935
  function BaseEditorBackButton({ fallback, backAction }) {
2947
2936
  const stack = useEditingResourceStack();
2948
2937
  const { back } = useEditingStack();
2949
2938
  if (stack.length) {
2950
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(ModulePanelButton, { onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BackIcon, {}) });
2939
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(ModulePanelButton, { onClick: back, children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(BackIcon, {}) });
2951
2940
  }
2952
2941
  return fallback;
2953
2942
  }
@@ -2955,22 +2944,20 @@ function BaseEditorCloseButton({ closeAction, fallback }) {
2955
2944
  const stack = useEditingResourceStack();
2956
2945
  const current = useEditingResource();
2957
2946
  if (current || stack.length) {
2958
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
2947
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
2959
2948
  ModulePanelButton,
2960
2949
  {
2961
2950
  onClick: () => {
2962
2951
  closeAction();
2963
2952
  },
2964
- children: /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(CloseIcon, {})
2953
+ children: /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(CloseIcon, {})
2965
2954
  }
2966
2955
  );
2967
2956
  }
2968
2957
  return fallback;
2969
2958
  }
2970
2959
  function editBasedOnResource(resource, list, options, config) {
2971
- const filteredList = list.filter(
2972
- (l) => l.resourceType === resource.resource.source.type
2973
- );
2960
+ const filteredList = list.filter((l) => l.resourceType === resource.resource.source.type);
2974
2961
  if (filteredList.length === 0) {
2975
2962
  return null;
2976
2963
  }
@@ -3018,9 +3005,7 @@ function editBasedOnResource(resource, list, options, config) {
3018
3005
  }
3019
3006
  return null;
3020
3007
  }
3021
- function BaseEditor({
3022
- currentTab = void 0
3023
- }) {
3008
+ function BaseEditor({ currentTab = void 0 }) {
3024
3009
  const resource = useEditingResource();
3025
3010
  const currentResourceContext = (0, import_react21.useContext)(import_react_iiif_vault9.ResourceReactContext);
3026
3011
  const app = useApp();
@@ -3050,7 +3035,7 @@ function BaseEditor({
3050
3035
  if (!resource) {
3051
3036
  return children;
3052
3037
  }
3053
- return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(import_react_iiif_vault9.ResourceReactContext.Provider, { value: newResourceContext, children });
3038
+ return /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(import_react_iiif_vault9.ResourceReactContext.Provider, { value: newResourceContext, children });
3054
3039
  }
3055
3040
  const match = (0, import_react21.useMemo)(() => {
3056
3041
  if (!resource) {
@@ -3058,28 +3043,19 @@ function BaseEditor({
3058
3043
  }
3059
3044
  const editors = app.layout.editors || [];
3060
3045
  const resources = app.layout.resources || [];
3061
- const mappedResources = resources.map(
3062
- (resource2) => {
3063
- if (typeof resource2 === "string") {
3064
- return {
3065
- id: "@default/" + resource2,
3066
- label: resource2,
3067
- resourceType: resource2,
3068
- auto: true,
3069
- editors: editors.filter(
3070
- (e) => e.supports.resourceTypes.includes(resource2)
3071
- )
3072
- };
3073
- }
3074
- return resource2;
3046
+ const mappedResources = resources.map((resource2) => {
3047
+ if (typeof resource2 === "string") {
3048
+ return {
3049
+ id: "@default/" + resource2,
3050
+ label: resource2,
3051
+ resourceType: resource2,
3052
+ auto: true,
3053
+ editors: editors.filter((e) => e.supports.resourceTypes.includes(resource2))
3054
+ };
3075
3055
  }
3076
- );
3077
- return editBasedOnResource(
3078
- resource,
3079
- mappedResources,
3080
- { edit: true, vault },
3081
- resourceConfig
3082
- );
3056
+ return resource2;
3057
+ });
3058
+ return editBasedOnResource(resource, mappedResources, { edit: true, vault }, resourceConfig);
3083
3059
  }, [resource, app]);
3084
3060
  (0, import_react21.useEffect)(() => {
3085
3061
  set(match?.label || "");
@@ -3095,17 +3071,15 @@ function BaseEditor({
3095
3071
  return null;
3096
3072
  }
3097
3073
  if (resourceConfig.singleTab) {
3098
- const first = (match?.editors || []).find(
3099
- (editor) => editor.id === resourceConfig.singleTab
3100
- );
3074
+ const first = (match?.editors || []).find((editor) => editor.id === resourceConfig.singleTab);
3101
3075
  if (first) {
3102
3076
  return wrap(
3103
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)("div", { className: "w-full", children: first.component(resourceConfig) })
3077
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)("div", { className: "w-full", children: first.component(resourceConfig) }, resource.resource.source?.id)
3104
3078
  );
3105
3079
  }
3106
3080
  }
3107
3081
  return wrap(
3108
- /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(
3082
+ /* @__PURE__ */ (0, import_jsx_runtime21.jsx)(
3109
3083
  import_components5.SidebarTabs,
3110
3084
  {
3111
3085
  menuId: resource.resource.source.id,
@@ -3127,15 +3101,15 @@ function BaseEditor({
3127
3101
  }
3128
3102
 
3129
3103
  // src/BaseEditor/index.tsx
3130
- var import_jsx_runtime23 = require("react/jsx-runtime");
3104
+ var import_jsx_runtime22 = require("react/jsx-runtime");
3131
3105
  var baseEditor = {
3132
3106
  id: "@manifest-editor/editor",
3133
3107
  label: "Editor",
3134
3108
  options: { hideHeader: true, tabs: true, minWidth: 400 },
3135
- renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditorBackButton, { backAction, fallback }),
3136
- renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditorCloseButton, { closeAction, fallback }),
3109
+ renderBackAction: ({ backAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BaseEditorBackButton, { backAction, fallback }),
3110
+ renderCloseAction: ({ closeAction, fallback }) => /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BaseEditorCloseButton, { closeAction, fallback }),
3137
3111
  render({ currentTab }) {
3138
- return /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(BaseEditor, { currentTab });
3112
+ return /* @__PURE__ */ (0, import_jsx_runtime22.jsx)(BaseEditor, { currentTab });
3139
3113
  }
3140
3114
  };
3141
3115
 
@@ -3172,9 +3146,10 @@ function useDecayState(time) {
3172
3146
  }
3173
3147
 
3174
3148
  // src/ConfigContext/ConfigEditor.tsx
3175
- var import_jsx_runtime24 = require("react/jsx-runtime");
3149
+ var import_jsx_runtime23 = require("react/jsx-runtime");
3176
3150
  function ConfigEditor() {
3177
3151
  const previews = usePreviewContext();
3152
+ const resource = useAppResource();
3178
3153
  const config = useConfig();
3179
3154
  const setConfig = useSaveConfig();
3180
3155
  const [isSaved, saveState] = useDecayState(2e3);
@@ -3199,13 +3174,13 @@ function ConfigEditor() {
3199
3174
  saveState.set();
3200
3175
  saveState.clear();
3201
3176
  }
3202
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Sidebar, { children: [
3203
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.SidebarHeader, { title: "Workspace configuration" }),
3204
- isSaved ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "bg-me-primary-500 text-white p-3 text-sm", children: "Changes saved" }) : null,
3205
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.SidebarContent, { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.Form, { onSubmit, className: "flex flex-col gap-3", children: [
3206
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
3207
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "defaultLanguage", children: "Default Language" }),
3208
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3177
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Sidebar, { children: [
3178
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.SidebarHeader, { title: "Workspace configuration" }),
3179
+ isSaved ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "bg-me-primary-500 text-white p-3 text-sm", children: "Changes saved" }) : null,
3180
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.SidebarContent, { className: "p-4", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.Form, { onSubmit, className: "flex flex-col gap-3", children: [
3181
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { children: [
3182
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Form.Label, { htmlFor: "defaultLanguage", children: "Default Language" }),
3183
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3209
3184
  import_components6.Form.Input,
3210
3185
  {
3211
3186
  type: "text",
@@ -3215,9 +3190,9 @@ function ConfigEditor() {
3215
3190
  }
3216
3191
  )
3217
3192
  ] }),
3218
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
3219
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "availableLanguages", children: "Available Languages" }),
3220
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3193
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { children: [
3194
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Form.Label, { htmlFor: "availableLanguages", children: "Available Languages" }),
3195
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3221
3196
  import_components6.Form.Input,
3222
3197
  {
3223
3198
  type: "text",
@@ -3227,8 +3202,8 @@ function ConfigEditor() {
3227
3202
  }
3228
3203
  )
3229
3204
  ] }),
3230
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3231
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3205
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3206
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3232
3207
  import_components6.Form.Input,
3233
3208
  {
3234
3209
  type: "checkbox",
@@ -3237,10 +3212,10 @@ function ConfigEditor() {
3237
3212
  defaultChecked: config.i18n?.advancedLanguageMode || false
3238
3213
  }
3239
3214
  ),
3240
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "advancedLanguageMode", children: "Advanced Language Mode" })
3215
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Form.Label, { htmlFor: "advancedLanguageMode", children: "Advanced Language Mode" })
3241
3216
  ] }),
3242
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3243
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3217
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3218
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3244
3219
  import_components6.Form.Input,
3245
3220
  {
3246
3221
  type: "checkbox",
@@ -3249,10 +3224,10 @@ function ConfigEditor() {
3249
3224
  defaultChecked: config.i18n?.textGranularityEnabled || false
3250
3225
  }
3251
3226
  ),
3252
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "textGranularityEnabled", children: "Enable text granularity" })
3227
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Form.Label, { htmlFor: "textGranularityEnabled", children: "Enable text granularity" })
3253
3228
  ] }),
3254
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3255
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3229
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { horizontal: true, className: "my-3", children: [
3230
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3256
3231
  import_components6.Form.Input,
3257
3232
  {
3258
3233
  type: "checkbox",
@@ -3261,16 +3236,20 @@ function ConfigEditor() {
3261
3236
  defaultChecked: config.export?.version === 2
3262
3237
  }
3263
3238
  ),
3264
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "isVersion2", children: "Export Presentation 2 Manifests" })
3239
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.Label, { htmlFor: "isVersion2", children: [
3240
+ "Export Presentation 2 ",
3241
+ resource.type,
3242
+ "s"
3243
+ ] })
3265
3244
  ] }),
3266
- /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { children: [
3267
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.Form.Label, { htmlFor: "defaultPreview", children: "Default preview" }),
3268
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { children: previews.configs.map((preview, key) => {
3245
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { children: [
3246
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.Form.Label, { htmlFor: "defaultPreview", children: "Default preview" }),
3247
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { children: previews.configs.map((preview, key) => {
3269
3248
  if (preview.type === "iiif-preview-service") {
3270
3249
  return null;
3271
3250
  }
3272
- return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)(import_components6.Form.InputContainer, { horizontal: true, children: [
3273
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3251
+ return /* @__PURE__ */ (0, import_jsx_runtime23.jsxs)(import_components6.Form.InputContainer, { horizontal: true, children: [
3252
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3274
3253
  import_components6.Form.Input,
3275
3254
  {
3276
3255
  type: "radio",
@@ -3280,19 +3259,19 @@ function ConfigEditor() {
3280
3259
  defaultChecked: !config.defaultPreview ? key === 0 : config.defaultPreview === preview.id
3281
3260
  }
3282
3261
  ),
3283
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("label", { htmlFor: preview.id, children: preview.label })
3262
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("label", { htmlFor: preview.id, children: preview.label })
3284
3263
  ] }, preview.id);
3285
3264
  }) })
3286
3265
  ] }),
3287
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(
3266
+ resource.type === "Manifest" ? /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(
3288
3267
  "a",
3289
3268
  {
3290
3269
  className: "text-sm text-me-primary-500 hover:underline hover:text-me-primary-600",
3291
3270
  href: window.location.pathname.includes("/exhibition") ? window.location.pathname.replace("/exhibition", "") || "/" : `${window.location.pathname}/exhibition`,
3292
3271
  children: window.location.pathname.includes("/exhibition") ? "Return to Manifest Editor" : "Go to Exhibition Editor"
3293
3272
  }
3294
- ),
3295
- /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("div", { className: "mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(import_components6.ActionButton, { type: "submit", children: "Save changes" }) })
3273
+ ) : null,
3274
+ /* @__PURE__ */ (0, import_jsx_runtime23.jsx)("div", { className: "mt-5", children: /* @__PURE__ */ (0, import_jsx_runtime23.jsx)(import_components6.ActionButton, { type: "submit", children: "Save changes" }) })
3296
3275
  ] }) })
3297
3276
  ] });
3298
3277
  }
@@ -3310,12 +3289,12 @@ var CenterPanelContainer_default = {
3310
3289
  };
3311
3290
 
3312
3291
  // ../ui/ui/CenterPanelContainer/CenterPanelContainer.tsx
3313
- var import_jsx_runtime25 = require("react/jsx-runtime");
3292
+ var import_jsx_runtime24 = require("react/jsx-runtime");
3314
3293
  function CenterPanelContainer(props) {
3315
- return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelContainer, children: [
3316
- props.title || props.close ? /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelHeader, children: [
3317
- props.title ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)("h2", { className: CenterPanelContainer_default.CenterPanelTitle, children: props.title }) : null,
3318
- props.close ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(Button, { className: CenterPanelContainer_default.CenterPanelClose, onClick: props.close, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(CloseIcon, {}) }) : null
3294
+ return /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelContainer, children: [
3295
+ props.title || props.close ? /* @__PURE__ */ (0, import_jsx_runtime24.jsxs)("div", { className: CenterPanelContainer_default.CenterPanelHeader, children: [
3296
+ props.title ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)("h2", { className: CenterPanelContainer_default.CenterPanelTitle, children: props.title }) : null,
3297
+ props.close ? /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(Button, { className: CenterPanelContainer_default.CenterPanelClose, onClick: props.close, children: /* @__PURE__ */ (0, import_jsx_runtime24.jsx)(CloseIcon, {}) }) : null
3319
3298
  ] }) : null,
3320
3299
  props.children
3321
3300
  ] });
@@ -3324,7 +3303,7 @@ function CenterPanelContainer(props) {
3324
3303
  // ../ui/atoms/Accordion.tsx
3325
3304
  var import_styled_components7 = __toESM(require("styled-components"), 1);
3326
3305
  var import_react23 = require("react");
3327
- var import_jsx_runtime26 = require("react/jsx-runtime");
3306
+ var import_jsx_runtime25 = require("react/jsx-runtime");
3328
3307
  var AccordionContainer = import_styled_components7.default.div`
3329
3308
  flex: 1;
3330
3309
  display: flex;
@@ -3679,16 +3658,16 @@ var AccordionItem = (0, import_react23.forwardRef)(function AccordionItem2(props
3679
3658
  setScrolled(false);
3680
3659
  }
3681
3660
  };
3682
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemRow, { "data-large": props.large, "data-open": open, children: [
3683
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemHeading, { "data-open": open, children: [
3684
- props.icon ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemIcon, { onClick: toggle, children: props.icon }) : null,
3685
- /* @__PURE__ */ (0, import_jsx_runtime26.jsxs)(ItemLabel, { ref: btn, onClick: toggle, "aria-expanded": open, "aria-controls": `accordion-${id}`, children: [
3661
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ItemRow, { "data-large": props.large, "data-open": open, children: [
3662
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ItemHeading, { "data-open": open, children: [
3663
+ props.icon ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemIcon, { onClick: toggle, children: props.icon }) : null,
3664
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsxs)(ItemLabel, { ref: btn, onClick: toggle, "aria-expanded": open, "aria-controls": `accordion-${id}`, children: [
3686
3665
  props.label,
3687
- props.description ? /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemDescription, { children: props.description }) : null
3666
+ props.description ? /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemDescription, { children: props.description }) : null
3688
3667
  ] }),
3689
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemCollapse, { onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(DownIcon, { width: "1em", height: "1em", rotate: open ? 0 : 180 }) })
3668
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemCollapse, { onClick: toggle, children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(DownIcon, { width: "1em", height: "1em", rotate: open ? 0 : 180 }) })
3690
3669
  ] }),
3691
- /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3670
+ /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3692
3671
  ItemBody,
3693
3672
  {
3694
3673
  "aria-labelledby": `accordion-${id}`,
@@ -3700,7 +3679,7 @@ var AccordionItem = (0, import_react23.forwardRef)(function AccordionItem2(props
3700
3679
  $initial: !open,
3701
3680
  "data-scrolled": scrolled,
3702
3681
  hidden: !open,
3703
- children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(ItemBodyInner, { children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(
3682
+ children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(ItemBodyInner, { children: /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(
3704
3683
  ItemBodyPadding,
3705
3684
  {
3706
3685
  "data-max-height": !!maxHeight,
@@ -3715,13 +3694,13 @@ var AccordionItem = (0, import_react23.forwardRef)(function AccordionItem2(props
3715
3694
  });
3716
3695
  function Accordion(props) {
3717
3696
  const { getItemProps, onKeyDown } = useAccordionItems(props.items.length, props.singleMode);
3718
- return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AccordionContainer, { onKeyDown, children: props.items.map((item, key) => /* @__PURE__ */ (0, import_jsx_runtime26.jsx)(AccordionItem, { overflow: props.overflow, maxHeight: props.maxHeight, ...item, ...getItemProps(key), children: item.children }, key)) });
3697
+ return /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccordionContainer, { onKeyDown, children: props.items.map((item, key) => /* @__PURE__ */ (0, import_jsx_runtime25.jsx)(AccordionItem, { overflow: props.overflow, maxHeight: props.maxHeight, ...item, ...getItemProps(key), children: item.children }, key)) });
3719
3698
  }
3720
3699
 
3721
3700
  // ../ui/icons/DownloadIcon.tsx
3722
- var import_jsx_runtime27 = require("react/jsx-runtime");
3701
+ var import_jsx_runtime26 = require("react/jsx-runtime");
3723
3702
  function DownloadIcon() {
3724
- return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "48", viewBox: "0 -960 960 960", width: "48", children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("path", { d: "M220-160q-24 0-42-18t-18-42v-143h60v143h520v-143h60v143q0 24-18 42t-42 18H220Zm260-153L287-506l43-43 120 120v-371h60v371l120-120 43 43-193 193Z" }) });
3703
+ return /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("svg", { xmlns: "http://www.w3.org/2000/svg", height: "48", viewBox: "0 -960 960 960", width: "48", children: /* @__PURE__ */ (0, import_jsx_runtime26.jsx)("path", { d: "M220-160q-24 0-42-18t-18-42v-143h60v143h520v-143h60v143q0 24-18 42t-42 18H220Zm260-153L287-506l43-43 120 120v-371h60v371l120-120 43 43-193 193Z" }) });
3725
3704
  }
3726
3705
 
3727
3706
  // ../ui/atoms/ButtonRow.tsx
@@ -3751,7 +3730,7 @@ var ButtonRow = import_styled_components8.default.div`
3751
3730
  `;
3752
3731
 
3753
3732
  // src/ExportPanel/ExportPanel.tsx
3754
- var import_jsx_runtime28 = require("react/jsx-runtime");
3733
+ var import_jsx_runtime27 = require("react/jsx-runtime");
3755
3734
  function ExportPanel(props) {
3756
3735
  const manifest = (0, import_react_iiif_vault10.useManifest)();
3757
3736
  const vault = (0, import_react_iiif_vault10.useVault)();
@@ -3762,7 +3741,7 @@ function ExportPanel(props) {
3762
3741
  const version2 = (0, import_react24.useMemo)(() => {
3763
3742
  return JSON.stringify(vault.toPresentation2(manifest), null, 2);
3764
3743
  }, [manifest, vault]);
3765
- return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(CenterPanelContainer, { title: "Export manifest", close: actions.centerPanel.popStack, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("div", { style: { flex: 1, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3744
+ return /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(CenterPanelContainer, { title: "Export manifest", close: actions.centerPanel.popStack, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("div", { style: { flex: 1, overflowY: "auto" }, children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(
3766
3745
  Accordion,
3767
3746
  {
3768
3747
  items: [
@@ -3773,12 +3752,12 @@ function ExportPanel(props) {
3773
3752
  large: true,
3774
3753
  initialOpen: true,
3775
3754
  overflow: true,
3776
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DownloadIcon, {}) }),
3777
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { maxWidth: "100%" }, children: [
3778
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation3(manifest), null, 2) }),
3779
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ButtonRow, { "data-sticky": "true", children: [
3780
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => copyToClipboard(version3), children: "Copy to clipboard" }),
3781
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: "Download" })
3755
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DownloadIcon, {}) }),
3756
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { maxWidth: "100%" }, children: [
3757
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation3(manifest), null, 2) }),
3758
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ButtonRow, { "data-sticky": "true", children: [
3759
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => copyToClipboard(version3), children: "Copy to clipboard" }),
3760
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => createDownload(version3, "manifest.json"), children: "Download" })
3782
3761
  ] })
3783
3762
  ] })
3784
3763
  },
@@ -3787,12 +3766,12 @@ function ExportPanel(props) {
3787
3766
  description: 'Download this version by clicking the "Download" button.',
3788
3767
  maxHeight: 400,
3789
3768
  large: true,
3790
- icon: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(DownloadIcon, {}) }),
3791
- children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("div", { style: { maxWidth: "100%" }, children: [
3792
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation2(manifest), null, 2) }),
3793
- /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)(ButtonRow, { "data-sticky": "true", children: [
3794
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => copyToClipboard(version2), children: "Copy to clipboard" }),
3795
- /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: "Download" })
3769
+ icon: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(DownloadIcon, {}) }),
3770
+ children: /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)("div", { style: { maxWidth: "100%" }, children: [
3771
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)("pre", { style: { whiteSpace: "pre-wrap" }, children: JSON.stringify(vault.toPresentation2(manifest), null, 2) }),
3772
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsxs)(ButtonRow, { "data-sticky": "true", children: [
3773
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => copyToClipboard(version2), children: "Copy to clipboard" }),
3774
+ /* @__PURE__ */ (0, import_jsx_runtime27.jsx)(Button, { onClick: () => createDownload(version2, "manifest.json"), children: "Download" })
3796
3775
  ] })
3797
3776
  ] })
3798
3777
  }
@@ -3804,6 +3783,36 @@ function ExportPanel(props) {
3804
3783
  // src/Layout/Layout.tsx
3805
3784
  var import_components7 = require("@manifest-editor/components");
3806
3785
 
3786
+ // ../ui/madoc/components/icons/Spinner.tsx
3787
+ var import_jsx_runtime28 = require("react/jsx-runtime");
3788
+ function Spinner2(props) {
3789
+ return /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3790
+ "svg",
3791
+ {
3792
+ width: "1em",
3793
+ height: "1em",
3794
+ viewBox: "0 0 42 42",
3795
+ xmlns: "http://www.w3.org/2000/svg",
3796
+ stroke: "currentColor",
3797
+ ...props,
3798
+ children: /* @__PURE__ */ (0, import_jsx_runtime28.jsxs)("g", { transform: "translate(2 2)", strokeWidth: 5, fill: "none", fillRule: "evenodd", children: [
3799
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("circle", { strokeOpacity: 0.5, cx: 18, cy: 18, r: 18 }),
3800
+ /* @__PURE__ */ (0, import_jsx_runtime28.jsx)("path", { d: "M36 18c0-9.94-8.06-18-18-18", children: /* @__PURE__ */ (0, import_jsx_runtime28.jsx)(
3801
+ "animateTransform",
3802
+ {
3803
+ attributeName: "transform",
3804
+ type: "rotate",
3805
+ from: "0 18 18",
3806
+ to: "360 18 18",
3807
+ dur: "1s",
3808
+ repeatCount: "indefinite"
3809
+ }
3810
+ ) })
3811
+ ] })
3812
+ }
3813
+ );
3814
+ }
3815
+
3807
3816
  // ../ui/ui/GhostBlocks/GhostBlocks.module.css
3808
3817
  var GhostBlocks_default = {
3809
3818
  ghostLoadingBlock: "GhostBlocks_ghostLoadingBlock",
@@ -4633,7 +4642,7 @@ var Layout = (0, import_react29.memo)(function Layout2(props) {
4633
4642
  justifyContent: "center",
4634
4643
  alignItems: "center"
4635
4644
  },
4636
- children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Spinner, { stroke: "rgba(0,0,0,.3)", fontSize: "2em" })
4645
+ children: /* @__PURE__ */ (0, import_jsx_runtime32.jsx)(Spinner2, { stroke: "rgba(0,0,0,.3)", fontSize: "2em" })
4637
4646
  }
4638
4647
  ) : state.centerPanel.open ? centerPanel ? renderHelper(
4639
4648
  centerPanel.render(