react-iiif-vault 0.9.14 → 0.9.17

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 (36) hide show
  1. package/.build/types/canvas-panel/Viewer.d.ts +1 -1
  2. package/.build/types/canvas-panel/index.d.ts +2 -0
  3. package/.build/types/canvas-panel/render/Canvas.d.ts +8 -3
  4. package/.build/types/canvas-panel/render/CanvasBackground.d.ts +4 -0
  5. package/.build/types/canvas-panel/render/Image.d.ts +2 -2
  6. package/.build/types/context/AnnotationPageContext.d.ts +5 -0
  7. package/.build/types/context/ContextBridge.d.ts +1 -9
  8. package/.build/types/context/PortalContext.d.ts +3 -2
  9. package/.build/types/context/ResourceContext.d.ts +1 -0
  10. package/.build/types/features/rendering-strategy/3d-strategy.d.ts +1 -1
  11. package/.build/types/features/rendering-strategy/rendering-utils.d.ts +5 -1
  12. package/.build/types/features/rendering-strategy/resource-types.d.ts +3 -0
  13. package/.build/types/features/rendering-strategy/strategies.d.ts +10 -1
  14. package/.build/types/features/rendering-strategy/textual-content-strategy.d.ts +17 -0
  15. package/.build/types/future-helpers/ranges.d.ts +6 -0
  16. package/.build/types/future-helpers/sequences.d.ts +6 -0
  17. package/.build/types/hooks/useCanvasSubset.d.ts +2 -0
  18. package/.build/types/index.d.ts +6 -0
  19. package/.build/types/viewers/SimpleViewerContext.d.ts +4 -16
  20. package/.build/types/viewers/SimpleViewerContext.hooks.d.ts +14 -0
  21. package/.build/types/viewers/SimpleViewerContext.types.d.ts +42 -0
  22. package/dist/bundle/cjs/index.js +5 -3
  23. package/dist/bundle/cjs/index.js.map +1 -1
  24. package/dist/bundle/esm/index.mjs +1028 -210
  25. package/dist/bundle/esm/index.mjs.map +1 -1
  26. package/dist/canvas-panel/cjs/canvas-panel.js +5 -3
  27. package/dist/canvas-panel/cjs/canvas-panel.js.map +1 -1
  28. package/dist/canvas-panel/esm/canvas-panel.mjs +731 -95
  29. package/dist/canvas-panel/esm/canvas-panel.mjs.map +1 -1
  30. package/dist/index.umd.js +22 -20
  31. package/dist/index.umd.js.map +1 -1
  32. package/dist/react17/cjs/index.js +30 -0
  33. package/dist/react17/cjs/index.js.map +1 -0
  34. package/dist/react17/esm/index.mjs +3198 -0
  35. package/dist/react17/esm/index.mjs.map +1 -0
  36. package/package.json +17 -11
@@ -31,11 +31,12 @@ var __objRest = (source, exclude) => {
31
31
  };
32
32
  import * as React from "react";
33
33
  import React__default, { useContext, useMemo, useState, useEffect, createContext, useRef, useLayoutEffect, useCallback, Fragment, useReducer } from "react";
34
- import { AtlasAuto, mergeStyles, RegionHighlight, TileSet } from "@atlas-viewer/atlas";
34
+ import { AtlasAuto, mergeStyles, RegionHighlight, TileSet, HTMLPortal } from "@atlas-viewer/atlas";
35
35
  import { jsx, jsxs, Fragment as Fragment$1 } from "react/jsx-runtime";
36
36
  import { globalVault, Vault } from "@iiif/vault";
37
37
  import { createAction } from "typesafe-actions";
38
- import require$$0 from "react-dom";
38
+ import { createRoot } from "react-dom/client";
39
+ import { expandTarget as expandTarget$1 } from "@iiif/vault-helpers";
39
40
  import { ImageServiceLoader, getImageServices, getFixedSizeFromImage } from "@atlas-viewer/iiif-image-api";
40
41
  function _setPrototypeOf(o, p) {
41
42
  _setPrototypeOf = Object.setPrototypeOf || function _setPrototypeOf2(o2, p2) {
@@ -131,7 +132,8 @@ const defaultResourceContext = {
131
132
  manifest: void 0,
132
133
  range: void 0,
133
134
  canvas: void 0,
134
- annotation: void 0
135
+ annotation: void 0,
136
+ annotationPage: void 0
135
137
  };
136
138
  const ResourceReactContext = React__default.createContext(defaultResourceContext);
137
139
  const useResourceContext = () => {
@@ -220,6 +222,22 @@ function useVisibleCanvases() {
220
222
  return ids.map((id) => state.iiif.entities.Canvas[id]).filter(Boolean);
221
223
  }, [ids]);
222
224
  }
225
+ function useManifest(options = {}, deps = []) {
226
+ const { id, selector } = options;
227
+ const ctx = useResourceContext();
228
+ useVault();
229
+ const manifestId = id ? id : ctx.manifest;
230
+ const manifest = useVaultSelector((s) => manifestId ? s.iiif.entities.Manifest[manifestId] : void 0, [manifestId]);
231
+ return useMemo(() => {
232
+ if (!manifest) {
233
+ return void 0;
234
+ }
235
+ if (selector) {
236
+ return selector(manifest);
237
+ }
238
+ return manifest;
239
+ }, [manifest, selector, ...deps]);
240
+ }
223
241
  const noop = () => {
224
242
  };
225
243
  const SimpleViewerReactContext = createContext({
@@ -227,9 +245,10 @@ const SimpleViewerReactContext = createContext({
227
245
  setCurrentCanvasIndex: noop,
228
246
  nextCanvas: noop,
229
247
  previousCanvas: noop,
230
- currentCanvasIndex: -1,
231
- totalCanvases: 0,
232
- pagingView: true
248
+ items: [],
249
+ sequence: [],
250
+ setSequenceIndex: noop,
251
+ currentSequenceIndex: 0
233
252
  });
234
253
  function useContextBridge() {
235
254
  return {
@@ -435,11 +454,6 @@ function DefaultCanvasFallback({
435
454
  children: "Unknown error"
436
455
  });
437
456
  }
438
- var createRoot;
439
- var m = require$$0;
440
- {
441
- createRoot = m.createRoot;
442
- }
443
457
  const ViewerPresetContext = createContext(null);
444
458
  function useViewerPreset() {
445
459
  return useContext(ViewerPresetContext);
@@ -451,26 +465,16 @@ function CanvasPortal({
451
465
  overlay
452
466
  }) {
453
467
  const htmlElement = useContext(overlay ? OverlayPortalContext : PortalContext);
454
- const rootRef = useRef(null);
455
468
  const preset = useViewerPreset();
456
469
  useLayoutEffect(() => {
457
- if (!rootRef.current) {
458
- rootRef.current = htmlElement ? createRoot(htmlElement) : null;
459
- }
460
- }, []);
461
- useLayoutEffect(() => {
462
- return () => {
463
- var _a;
464
- (_a = rootRef.current) == null ? void 0 : _a.unmount();
465
- rootRef.current = null;
466
- };
467
- }, []);
468
- useLayoutEffect(() => {
469
- if (rootRef.current) {
470
- rootRef.current.render(/* @__PURE__ */ jsx(ViewerPresetContext.Provider, {
471
- value: preset,
472
- children
473
- }));
470
+ if (htmlElement) {
471
+ try {
472
+ htmlElement.render(/* @__PURE__ */ jsx(ViewerPresetContext.Provider, {
473
+ value: preset,
474
+ children
475
+ }));
476
+ } catch (e) {
477
+ }
474
478
  }
475
479
  }, [children, preset]);
476
480
  return null;
@@ -493,8 +497,31 @@ function Viewer(_a) {
493
497
  const bridge = useContextBridge();
494
498
  const ErrorFallback = errorFallback || DefaultCanvasFallback;
495
499
  useLayoutEffect(() => {
496
- setPortalElement(portal.current);
497
- setOverlayPortalElement(overlayPortal.current);
500
+ const roots = {};
501
+ if (portal.current) {
502
+ const $el = document.createElement("div");
503
+ portal.current.appendChild($el);
504
+ roots.portal = createRoot($el);
505
+ setPortalElement(roots.portal);
506
+ }
507
+ if (overlayPortal.current) {
508
+ const $el = document.createElement("div");
509
+ overlayPortal.current.appendChild($el);
510
+ roots.overlayPortal = createRoot($el);
511
+ setOverlayPortalElement(roots.overlayPortal);
512
+ }
513
+ return () => {
514
+ setPortalElement(null);
515
+ setOverlayPortalElement(null);
516
+ setTimeout(() => {
517
+ if (roots.portal) {
518
+ roots.portal.unmount();
519
+ }
520
+ if (roots.overlayPortal) {
521
+ roots.overlayPortal.unmount();
522
+ }
523
+ }, 0);
524
+ };
498
525
  }, []);
499
526
  return /* @__PURE__ */ jsxs(ErrorBoundary, {
500
527
  fallbackRender: () => /* @__PURE__ */ jsx(ErrorFallback, __spreadValues({}, props)),
@@ -617,25 +644,25 @@ function useStyles(resource, scope) {
617
644
  return styles ? scope ? styles[scope] : styles : void 0;
618
645
  }, [resource, scope]);
619
646
  }
620
- var __defProp2 = Object.defineProperty;
621
- var __defProps2 = Object.defineProperties;
622
- var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
623
- var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
624
- var __hasOwnProp2 = Object.prototype.hasOwnProperty;
625
- var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
626
- var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
627
- var __spreadValues2 = (a, b) => {
647
+ var __defProp$1 = Object.defineProperty;
648
+ var __defProps$1 = Object.defineProperties;
649
+ var __getOwnPropDescs$1 = Object.getOwnPropertyDescriptors;
650
+ var __getOwnPropSymbols$1 = Object.getOwnPropertySymbols;
651
+ var __hasOwnProp$1 = Object.prototype.hasOwnProperty;
652
+ var __propIsEnum$1 = Object.prototype.propertyIsEnumerable;
653
+ var __defNormalProp$1 = (obj, key, value) => key in obj ? __defProp$1(obj, key, { enumerable: true, configurable: true, writable: true, value }) : obj[key] = value;
654
+ var __spreadValues$1 = (a, b) => {
628
655
  for (var prop in b || (b = {}))
629
- if (__hasOwnProp2.call(b, prop))
630
- __defNormalProp2(a, prop, b[prop]);
631
- if (__getOwnPropSymbols2)
632
- for (var prop of __getOwnPropSymbols2(b)) {
633
- if (__propIsEnum2.call(b, prop))
634
- __defNormalProp2(a, prop, b[prop]);
656
+ if (__hasOwnProp$1.call(b, prop))
657
+ __defNormalProp$1(a, prop, b[prop]);
658
+ if (__getOwnPropSymbols$1)
659
+ for (var prop of __getOwnPropSymbols$1(b)) {
660
+ if (__propIsEnum$1.call(b, prop))
661
+ __defNormalProp$1(a, prop, b[prop]);
635
662
  }
636
663
  return a;
637
664
  };
638
- var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
665
+ var __spreadProps$1 = (a, b) => __defProps$1(a, __getOwnPropDescs$1(b));
639
666
  const BOX_SELECTOR = /&?(xywh=)?(pixel:|percent:|pct:)?([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?),([0-9]+(?:\.[0-9]+)?)/;
640
667
  const TEMPORAL_SELECTOR = /&?(t=)(npt:)?([0-9]+(.[0-9]+)?)?(,([0-9]+(.[0-9]+)?))?/;
641
668
  function parseSelector(source) {
@@ -780,7 +807,7 @@ function expandTarget(target, options = {}) {
780
807
  if (!fragment) {
781
808
  return {
782
809
  type: "SpecificResource",
783
- source: __spreadProps2(__spreadValues2({}, target), {
810
+ source: __spreadProps$1(__spreadValues$1({}, target), {
784
811
  id
785
812
  }),
786
813
  selector: null,
@@ -789,7 +816,7 @@ function expandTarget(target, options = {}) {
789
816
  }
790
817
  return expandTarget({
791
818
  type: "SpecificResource",
792
- source: __spreadProps2(__spreadValues2({}, target), {
819
+ source: __spreadProps$1(__spreadValues$1({}, target), {
793
820
  id
794
821
  }),
795
822
  selector: {
@@ -898,20 +925,21 @@ function RenderImage({
898
925
  isStatic,
899
926
  x = 0,
900
927
  y = 0,
901
- annotations,
902
- children
928
+ children,
929
+ onClick
903
930
  }) {
904
931
  var _a, _b, _c, _d;
905
932
  return /* @__PURE__ */ jsx(Fragment, {
906
933
  children: !image.service ? /* @__PURE__ */ jsxs(Fragment, {
907
934
  children: [/* @__PURE__ */ jsx("world-image", {
935
+ onClick,
908
936
  uri: image.id,
909
937
  target: image.target.spatial,
910
938
  display: image.width && image.height ? {
911
939
  width: image.width,
912
940
  height: image.height
913
941
  } : void 0
914
- }), annotations, children]
942
+ }), children]
915
943
  }, "no-service") : /* @__PURE__ */ jsxs(Fragment, {
916
944
  children: [/* @__PURE__ */ jsx(TileSet, {
917
945
  tiles: {
@@ -924,8 +952,9 @@ function RenderImage({
924
952
  x: ((_a = image.target) == null ? void 0 : _a.spatial.x) + x,
925
953
  y: ((_b = image.target) == null ? void 0 : _b.spatial.y) + y,
926
954
  width: (_c = image.target) == null ? void 0 : _c.spatial.width,
927
- height: (_d = image.target) == null ? void 0 : _d.spatial.height
928
- }), annotations, children]
955
+ height: (_d = image.target) == null ? void 0 : _d.spatial.height,
956
+ onClick
957
+ }), children]
929
958
  }, "service")
930
959
  }, id);
931
960
  }
@@ -966,6 +995,7 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
966
995
  types.push(type);
967
996
  }
968
997
  items.push({
998
+ annotationId: annotation.id,
969
999
  type,
970
1000
  resource: body,
971
1001
  target: annotation.target,
@@ -979,6 +1009,29 @@ function getPaintables(vault, paintingAnnotations, enabledChoices) {
979
1009
  choice
980
1010
  };
981
1011
  }
1012
+ function getParsedTargetSelector(canvas, target) {
1013
+ const { selector: imageTarget, source } = expandTarget$1(target);
1014
+ if (source.id !== canvas.id) {
1015
+ return [null, source];
1016
+ }
1017
+ const defaultTarget = {
1018
+ type: "BoxSelector",
1019
+ spatial: {
1020
+ x: 0,
1021
+ y: 0,
1022
+ width: canvas.width,
1023
+ height: canvas.height
1024
+ }
1025
+ };
1026
+ return [
1027
+ imageTarget ? imageTarget.type === "TemporalSelector" ? {
1028
+ type: "TemporalBoxSelector",
1029
+ temporal: imageTarget.temporal,
1030
+ spatial: defaultTarget.spatial
1031
+ } : imageTarget : null,
1032
+ source
1033
+ ];
1034
+ }
982
1035
  const emptyActions = {
983
1036
  makeChoice: () => {
984
1037
  }
@@ -987,22 +1040,9 @@ const unknownResponse = { type: "unknown" };
987
1040
  const unsupportedStrategy = (reason) => {
988
1041
  return { type: "unknown", reason, annotations: { pages: [] } };
989
1042
  };
990
- function useManifest(options = {}, deps = []) {
991
- const { id, selector } = options;
992
- const ctx = useResourceContext();
993
- useVault();
994
- const manifestId = id ? id : ctx.manifest;
995
- const manifest = useVaultSelector((s) => manifestId ? s.iiif.entities.Manifest[manifestId] : void 0, [manifestId]);
996
- return useMemo(() => {
997
- if (!manifest) {
998
- return void 0;
999
- }
1000
- if (selector) {
1001
- return selector(manifest);
1002
- }
1003
- return manifest;
1004
- }, [manifest, selector, ...deps]);
1005
- }
1043
+ const emptyStrategy = (width, height) => {
1044
+ return { type: "empty", width, height, annotations: { pages: [] }, image: null, images: [] };
1045
+ };
1006
1046
  function getMeta$1(state, resourceId) {
1007
1047
  var _a;
1008
1048
  const resourceMeta = (_a = state == null ? void 0 : state.iiif) == null ? void 0 : _a.meta[resourceId];
@@ -1256,10 +1296,6 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1256
1296
  imageService = loadImageService(imageServices[0], canvas);
1257
1297
  }
1258
1298
  }
1259
- const { selector: imageTarget, source } = expandTarget(singleImage.target);
1260
- if (source.id !== canvas.id) {
1261
- continue;
1262
- }
1263
1299
  const defaultTarget = {
1264
1300
  type: "BoxSelector",
1265
1301
  spatial: {
@@ -1269,11 +1305,10 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1269
1305
  height: canvas.height
1270
1306
  }
1271
1307
  };
1272
- const target = imageTarget ? imageTarget.type === "TemporalSelector" ? {
1273
- type: "TemporalBoxSelector",
1274
- temporal: imageTarget.temporal,
1275
- spatial: defaultTarget.spatial
1276
- } : imageTarget : null;
1308
+ const [target, source] = getParsedTargetSelector(canvas, singleImage.target);
1309
+ if (source.id !== canvas.id) {
1310
+ continue;
1311
+ }
1277
1312
  const defaultImageSelector = {
1278
1313
  type: "BoxSelector",
1279
1314
  spatial: {
@@ -1299,6 +1334,7 @@ function getImageStrategy(canvas, paintables, loadImageService) {
1299
1334
  const imageType = {
1300
1335
  id: resource.id,
1301
1336
  type: "Image",
1337
+ annotationId: singleImage.annotationId,
1302
1338
  width: target ? resource.width : canvas.width,
1303
1339
  height: target ? resource.height : canvas.height,
1304
1340
  service: imageService,
@@ -1348,6 +1384,7 @@ function getAudioStrategy(canvas, paintables) {
1348
1384
  return {
1349
1385
  type: "media",
1350
1386
  media: {
1387
+ annotationId: paintables.items[0].annotationId,
1351
1388
  duration: canvas.duration,
1352
1389
  url: audioResource.id,
1353
1390
  type: "Sound",
@@ -1391,6 +1428,7 @@ function getVideoStrategy(canvas, paintables) {
1391
1428
  return {
1392
1429
  type: "media",
1393
1430
  media: {
1431
+ annotationId: paintables.items[0].annotationId,
1394
1432
  duration: canvas.duration,
1395
1433
  url: audioResource.id,
1396
1434
  type: "Video",
@@ -1416,6 +1454,38 @@ function getVideoStrategy(canvas, paintables) {
1416
1454
  }
1417
1455
  };
1418
1456
  }
1457
+ function parseType(item, languageMap = {}, lang) {
1458
+ const language = item.language || lang || "none";
1459
+ switch (item.type) {
1460
+ case "TextualBody": {
1461
+ if (typeof item.value !== "undefined") {
1462
+ languageMap[language] = item.value;
1463
+ }
1464
+ break;
1465
+ }
1466
+ case "List":
1467
+ case "Composite":
1468
+ case "Choice": {
1469
+ if (item.items) {
1470
+ item.items.forEach((inner) => parseType(inner, languageMap, language));
1471
+ }
1472
+ }
1473
+ }
1474
+ return languageMap;
1475
+ }
1476
+ function getTextualContentStrategy(canvas, paintables) {
1477
+ const items = [];
1478
+ paintables.items.forEach((item) => {
1479
+ if (item.resource) {
1480
+ const [target] = getParsedTargetSelector(canvas, item.target);
1481
+ items.push({ annotationId: item.annotationId, text: parseType(item.resource), target });
1482
+ }
1483
+ });
1484
+ return {
1485
+ type: "textual-content",
1486
+ items
1487
+ };
1488
+ }
1419
1489
  function useRenderingStrategy(options) {
1420
1490
  const manifest = useManifest();
1421
1491
  const canvas = useCanvas();
@@ -1425,10 +1495,22 @@ function useRenderingStrategy(options) {
1425
1495
  all: false
1426
1496
  });
1427
1497
  const enabledPages = useResources(enabledPageIds, "AnnotationPage");
1428
- const supports = (options == null ? void 0 : options.strategies) || ["images", "media", "complex-timeline"];
1498
+ const supports = (options == null ? void 0 : options.strategies) || [
1499
+ "empty",
1500
+ "images",
1501
+ "media",
1502
+ "textual-content",
1503
+ "complex-timeline"
1504
+ ];
1429
1505
  const [paintables, actions] = usePaintables(options, [imageServiceStatus]);
1430
1506
  const strategy = useMemo(() => {
1431
- if (!canvas || paintables.types.length === 0) {
1507
+ if (!canvas) {
1508
+ return unknownResponse;
1509
+ }
1510
+ if (paintables.types.length === 0) {
1511
+ if (supports.indexOf("empty") !== -1) {
1512
+ return emptyStrategy(canvas.width, canvas.height);
1513
+ }
1432
1514
  return unknownResponse;
1433
1515
  }
1434
1516
  if (paintables.types.length !== 1) {
@@ -1454,6 +1536,12 @@ function useRenderingStrategy(options) {
1454
1536
  }
1455
1537
  return get3dStrategy(canvas, paintables);
1456
1538
  }
1539
+ if (mainType === "textualbody") {
1540
+ if (supports.indexOf("textual-content") === -1) {
1541
+ return unsupportedStrategy("Textual content not supported");
1542
+ }
1543
+ return getTextualContentStrategy(canvas, paintables);
1544
+ }
1457
1545
  if (mainType === "sound" || mainType === "audio") {
1458
1546
  if (supports.indexOf("media") === -1) {
1459
1547
  return unsupportedStrategy("Media not supported");
@@ -1573,6 +1661,7 @@ function useThumbnail(request, dereference, { canvasId, manifestId } = {}) {
1573
1661
  const subject = canvas ? canvas : manifest;
1574
1662
  const didUnmount = useRef(false);
1575
1663
  useEffect(() => {
1664
+ didUnmount.current = false;
1576
1665
  return () => {
1577
1666
  didUnmount.current = true;
1578
1667
  };
@@ -1872,6 +1961,533 @@ function Model({
1872
1961
  })]
1873
1962
  });
1874
1963
  }
1964
+ function CanvasBackground({
1965
+ style
1966
+ }) {
1967
+ const canvas = useCanvas();
1968
+ if (!canvas || !canvas.height || !canvas.width) {
1969
+ return null;
1970
+ }
1971
+ return /* @__PURE__ */ jsx("box", {
1972
+ interactive: false,
1973
+ target: {
1974
+ x: 0,
1975
+ y: 0,
1976
+ width: canvas.width,
1977
+ height: canvas.height
1978
+ },
1979
+ style
1980
+ });
1981
+ }
1982
+ var __defProp2 = Object.defineProperty;
1983
+ var __defProps2 = Object.defineProperties;
1984
+ var __getOwnPropDescs2 = Object.getOwnPropertyDescriptors;
1985
+ var __getOwnPropSymbols2 = Object.getOwnPropertySymbols;
1986
+ var __hasOwnProp2 = Object.prototype.hasOwnProperty;
1987
+ var __propIsEnum2 = Object.prototype.propertyIsEnumerable;
1988
+ var __defNormalProp2 = (obj, key, value) => key in obj ? __defProp2(obj, key, {
1989
+ enumerable: true,
1990
+ configurable: true,
1991
+ writable: true,
1992
+ value
1993
+ }) : obj[key] = value;
1994
+ var __spreadValues2 = (a, b) => {
1995
+ for (var prop in b || (b = {}))
1996
+ if (__hasOwnProp2.call(b, prop))
1997
+ __defNormalProp2(a, prop, b[prop]);
1998
+ if (__getOwnPropSymbols2)
1999
+ for (var prop of __getOwnPropSymbols2(b)) {
2000
+ if (__propIsEnum2.call(b, prop))
2001
+ __defNormalProp2(a, prop, b[prop]);
2002
+ }
2003
+ return a;
2004
+ };
2005
+ var __spreadProps2 = (a, b) => __defProps2(a, __getOwnPropDescs2(b));
2006
+ var __objRest2 = (source, exclude) => {
2007
+ var target = {};
2008
+ for (var prop in source)
2009
+ if (__hasOwnProp2.call(source, prop) && exclude.indexOf(prop) < 0)
2010
+ target[prop] = source[prop];
2011
+ if (source != null && __getOwnPropSymbols2)
2012
+ for (var prop of __getOwnPropSymbols2(source)) {
2013
+ if (exclude.indexOf(prop) < 0 && __propIsEnum2.call(source, prop))
2014
+ target[prop] = source[prop];
2015
+ }
2016
+ return target;
2017
+ };
2018
+ function _defineProperty(obj, key, value) {
2019
+ if (key in obj) {
2020
+ Object.defineProperty(obj, key, {
2021
+ value,
2022
+ enumerable: true,
2023
+ configurable: true,
2024
+ writable: true
2025
+ });
2026
+ } else {
2027
+ obj[key] = value;
2028
+ }
2029
+ return obj;
2030
+ }
2031
+ function _classCallCheck(instance, Constructor) {
2032
+ if (!(instance instanceof Constructor)) {
2033
+ throw new TypeError("Cannot call a class as a function");
2034
+ }
2035
+ }
2036
+ function _defineProperties(target, props) {
2037
+ for (var i = 0; i < props.length; i++) {
2038
+ var descriptor = props[i];
2039
+ descriptor.enumerable = descriptor.enumerable || false;
2040
+ descriptor.configurable = true;
2041
+ if ("value" in descriptor)
2042
+ descriptor.writable = true;
2043
+ Object.defineProperty(target, descriptor.key, descriptor);
2044
+ }
2045
+ }
2046
+ function _createClass(Constructor, protoProps, staticProps) {
2047
+ if (protoProps)
2048
+ _defineProperties(Constructor.prototype, protoProps);
2049
+ if (staticProps)
2050
+ _defineProperties(Constructor, staticProps);
2051
+ Object.defineProperty(Constructor, "prototype", {
2052
+ writable: false
2053
+ });
2054
+ return Constructor;
2055
+ }
2056
+ var defaultOptions = {
2057
+ bindI18n: "languageChanged",
2058
+ bindI18nStore: "",
2059
+ transEmptyNodeValue: "",
2060
+ transSupportBasicHtmlNodes: true,
2061
+ transWrapTextNodes: "",
2062
+ transKeepBasicHtmlNodesFor: ["br", "strong", "i", "p"],
2063
+ useSuspense: true
2064
+ };
2065
+ var i18nInstance;
2066
+ var I18nContext = React__default.createContext();
2067
+ function getDefaults() {
2068
+ return defaultOptions;
2069
+ }
2070
+ var ReportNamespaces = function() {
2071
+ function ReportNamespaces2() {
2072
+ _classCallCheck(this, ReportNamespaces2);
2073
+ this.usedNamespaces = {};
2074
+ }
2075
+ _createClass(ReportNamespaces2, [{
2076
+ key: "addUsedNamespaces",
2077
+ value: function addUsedNamespaces(namespaces) {
2078
+ var _this = this;
2079
+ namespaces.forEach(function(ns) {
2080
+ if (!_this.usedNamespaces[ns])
2081
+ _this.usedNamespaces[ns] = true;
2082
+ });
2083
+ }
2084
+ }, {
2085
+ key: "getUsedNamespaces",
2086
+ value: function getUsedNamespaces() {
2087
+ return Object.keys(this.usedNamespaces);
2088
+ }
2089
+ }]);
2090
+ return ReportNamespaces2;
2091
+ }();
2092
+ function getI18n() {
2093
+ return i18nInstance;
2094
+ }
2095
+ function warn() {
2096
+ if (console && console.warn) {
2097
+ var _console;
2098
+ for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
2099
+ args[_key] = arguments[_key];
2100
+ }
2101
+ if (typeof args[0] === "string")
2102
+ args[0] = "react-i18next:: ".concat(args[0]);
2103
+ (_console = console).warn.apply(_console, args);
2104
+ }
2105
+ }
2106
+ var alreadyWarned = {};
2107
+ function warnOnce() {
2108
+ for (var _len2 = arguments.length, args = new Array(_len2), _key2 = 0; _key2 < _len2; _key2++) {
2109
+ args[_key2] = arguments[_key2];
2110
+ }
2111
+ if (typeof args[0] === "string" && alreadyWarned[args[0]])
2112
+ return;
2113
+ if (typeof args[0] === "string")
2114
+ alreadyWarned[args[0]] = new Date();
2115
+ warn.apply(void 0, args);
2116
+ }
2117
+ function loadNamespaces(i18n, ns, cb) {
2118
+ i18n.loadNamespaces(ns, function() {
2119
+ if (i18n.isInitialized) {
2120
+ cb();
2121
+ } else {
2122
+ var initialized = function initialized2() {
2123
+ setTimeout(function() {
2124
+ i18n.off("initialized", initialized2);
2125
+ }, 0);
2126
+ cb();
2127
+ };
2128
+ i18n.on("initialized", initialized);
2129
+ }
2130
+ });
2131
+ }
2132
+ function hasLoadedNamespace(ns, i18n) {
2133
+ var options = arguments.length > 2 && arguments[2] !== void 0 ? arguments[2] : {};
2134
+ if (!i18n.languages || !i18n.languages.length) {
2135
+ warnOnce("i18n.languages were undefined or empty", i18n.languages);
2136
+ return true;
2137
+ }
2138
+ var lng = i18n.languages[0];
2139
+ var fallbackLng = i18n.options ? i18n.options.fallbackLng : false;
2140
+ var lastLng = i18n.languages[i18n.languages.length - 1];
2141
+ if (lng.toLowerCase() === "cimode")
2142
+ return true;
2143
+ var loadNotPending = function loadNotPending2(l, n) {
2144
+ var loadState = i18n.services.backendConnector.state["".concat(l, "|").concat(n)];
2145
+ return loadState === -1 || loadState === 2;
2146
+ };
2147
+ if (options.bindI18n && options.bindI18n.indexOf("languageChanging") > -1 && i18n.services.backendConnector.backend && i18n.isLanguageChangingTo && !loadNotPending(i18n.isLanguageChangingTo, ns))
2148
+ return false;
2149
+ if (i18n.hasResourceBundle(lng, ns))
2150
+ return true;
2151
+ if (!i18n.services.backendConnector.backend)
2152
+ return true;
2153
+ if (loadNotPending(lng, ns) && (!fallbackLng || loadNotPending(lastLng, ns)))
2154
+ return true;
2155
+ return false;
2156
+ }
2157
+ function _arrayWithHoles(arr) {
2158
+ if (Array.isArray(arr))
2159
+ return arr;
2160
+ }
2161
+ function _iterableToArrayLimit(arr, i) {
2162
+ var _i = arr == null ? null : typeof Symbol !== "undefined" && arr[Symbol.iterator] || arr["@@iterator"];
2163
+ if (_i == null)
2164
+ return;
2165
+ var _arr = [];
2166
+ var _n = true;
2167
+ var _d = false;
2168
+ var _s, _e;
2169
+ try {
2170
+ for (_i = _i.call(arr); !(_n = (_s = _i.next()).done); _n = true) {
2171
+ _arr.push(_s.value);
2172
+ if (i && _arr.length === i)
2173
+ break;
2174
+ }
2175
+ } catch (err) {
2176
+ _d = true;
2177
+ _e = err;
2178
+ } finally {
2179
+ try {
2180
+ if (!_n && _i["return"] != null)
2181
+ _i["return"]();
2182
+ } finally {
2183
+ if (_d)
2184
+ throw _e;
2185
+ }
2186
+ }
2187
+ return _arr;
2188
+ }
2189
+ function _arrayLikeToArray(arr, len) {
2190
+ if (len == null || len > arr.length)
2191
+ len = arr.length;
2192
+ for (var i = 0, arr2 = new Array(len); i < len; i++) {
2193
+ arr2[i] = arr[i];
2194
+ }
2195
+ return arr2;
2196
+ }
2197
+ function _unsupportedIterableToArray(o, minLen) {
2198
+ if (!o)
2199
+ return;
2200
+ if (typeof o === "string")
2201
+ return _arrayLikeToArray(o, minLen);
2202
+ var n = Object.prototype.toString.call(o).slice(8, -1);
2203
+ if (n === "Object" && o.constructor)
2204
+ n = o.constructor.name;
2205
+ if (n === "Map" || n === "Set")
2206
+ return Array.from(o);
2207
+ if (n === "Arguments" || /^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))
2208
+ return _arrayLikeToArray(o, minLen);
2209
+ }
2210
+ function _nonIterableRest() {
2211
+ throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.");
2212
+ }
2213
+ function _slicedToArray(arr, i) {
2214
+ return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _unsupportedIterableToArray(arr, i) || _nonIterableRest();
2215
+ }
2216
+ function ownKeys(object, enumerableOnly) {
2217
+ var keys = Object.keys(object);
2218
+ if (Object.getOwnPropertySymbols) {
2219
+ var symbols = Object.getOwnPropertySymbols(object);
2220
+ if (enumerableOnly) {
2221
+ symbols = symbols.filter(function(sym) {
2222
+ return Object.getOwnPropertyDescriptor(object, sym).enumerable;
2223
+ });
2224
+ }
2225
+ keys.push.apply(keys, symbols);
2226
+ }
2227
+ return keys;
2228
+ }
2229
+ function _objectSpread(target) {
2230
+ for (var i = 1; i < arguments.length; i++) {
2231
+ var source = arguments[i] != null ? arguments[i] : {};
2232
+ if (i % 2) {
2233
+ ownKeys(Object(source), true).forEach(function(key) {
2234
+ _defineProperty(target, key, source[key]);
2235
+ });
2236
+ } else if (Object.getOwnPropertyDescriptors) {
2237
+ Object.defineProperties(target, Object.getOwnPropertyDescriptors(source));
2238
+ } else {
2239
+ ownKeys(Object(source)).forEach(function(key) {
2240
+ Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key));
2241
+ });
2242
+ }
2243
+ }
2244
+ return target;
2245
+ }
2246
+ function useTranslation(ns) {
2247
+ var props = arguments.length > 1 && arguments[1] !== void 0 ? arguments[1] : {};
2248
+ var i18nFromProps = props.i18n;
2249
+ var _ref = useContext(I18nContext) || {}, i18nFromContext = _ref.i18n, defaultNSFromContext = _ref.defaultNS;
2250
+ var i18n = i18nFromProps || i18nFromContext || getI18n();
2251
+ if (i18n && !i18n.reportNamespaces)
2252
+ i18n.reportNamespaces = new ReportNamespaces();
2253
+ if (!i18n) {
2254
+ warnOnce("You will need to pass in an i18next instance by using initReactI18next");
2255
+ var notReadyT = function notReadyT2(k) {
2256
+ return Array.isArray(k) ? k[k.length - 1] : k;
2257
+ };
2258
+ var retNotReady = [notReadyT, {}, false];
2259
+ retNotReady.t = notReadyT;
2260
+ retNotReady.i18n = {};
2261
+ retNotReady.ready = false;
2262
+ return retNotReady;
2263
+ }
2264
+ if (i18n.options.react && i18n.options.react.wait !== void 0)
2265
+ warnOnce("It seems you are still using the old wait option, you may migrate to the new useSuspense behaviour.");
2266
+ var i18nOptions = _objectSpread(_objectSpread(_objectSpread({}, getDefaults()), i18n.options.react), props);
2267
+ var useSuspense = i18nOptions.useSuspense, keyPrefix = i18nOptions.keyPrefix;
2268
+ var namespaces = ns || defaultNSFromContext || i18n.options && i18n.options.defaultNS;
2269
+ namespaces = typeof namespaces === "string" ? [namespaces] : namespaces || ["translation"];
2270
+ if (i18n.reportNamespaces.addUsedNamespaces)
2271
+ i18n.reportNamespaces.addUsedNamespaces(namespaces);
2272
+ var ready = (i18n.isInitialized || i18n.initializedStoreOnce) && namespaces.every(function(n) {
2273
+ return hasLoadedNamespace(n, i18n, i18nOptions);
2274
+ });
2275
+ function getT() {
2276
+ return i18n.getFixedT(null, i18nOptions.nsMode === "fallback" ? namespaces : namespaces[0], keyPrefix);
2277
+ }
2278
+ var _useState = useState(getT), _useState2 = _slicedToArray(_useState, 2), t = _useState2[0], setT = _useState2[1];
2279
+ var isMounted = useRef(true);
2280
+ useEffect(function() {
2281
+ var bindI18n = i18nOptions.bindI18n, bindI18nStore = i18nOptions.bindI18nStore;
2282
+ isMounted.current = true;
2283
+ if (!ready && !useSuspense) {
2284
+ loadNamespaces(i18n, namespaces, function() {
2285
+ if (isMounted.current)
2286
+ setT(getT);
2287
+ });
2288
+ }
2289
+ function boundReset() {
2290
+ if (isMounted.current)
2291
+ setT(getT);
2292
+ }
2293
+ if (bindI18n && i18n)
2294
+ i18n.on(bindI18n, boundReset);
2295
+ if (bindI18nStore && i18n)
2296
+ i18n.store.on(bindI18nStore, boundReset);
2297
+ return function() {
2298
+ isMounted.current = false;
2299
+ if (bindI18n && i18n)
2300
+ bindI18n.split(" ").forEach(function(e) {
2301
+ return i18n.off(e, boundReset);
2302
+ });
2303
+ if (bindI18nStore && i18n)
2304
+ bindI18nStore.split(" ").forEach(function(e) {
2305
+ return i18n.store.off(e, boundReset);
2306
+ });
2307
+ };
2308
+ }, [i18n, namespaces.join()]);
2309
+ var isInitial = useRef(true);
2310
+ useEffect(function() {
2311
+ if (isMounted.current && !isInitial.current) {
2312
+ setT(getT);
2313
+ }
2314
+ isInitial.current = false;
2315
+ }, [i18n]);
2316
+ var ret = [t, i18n, ready];
2317
+ ret.t = t;
2318
+ ret.i18n = i18n;
2319
+ ret.ready = ready;
2320
+ if (ready)
2321
+ return ret;
2322
+ if (!ready && !useSuspense)
2323
+ return ret;
2324
+ throw new Promise(function(resolve) {
2325
+ loadNamespaces(i18n, namespaces, function() {
2326
+ resolve();
2327
+ });
2328
+ });
2329
+ }
2330
+ function LanguageString(_a) {
2331
+ var _b = _a, {
2332
+ as: Component,
2333
+ language,
2334
+ children
2335
+ } = _b, props = __objRest2(_b, ["as", "language", "children"]);
2336
+ const {
2337
+ i18n
2338
+ } = useTranslation();
2339
+ const viewingDirection = useMemo(() => i18n.dir ? i18n.dir(language) : "ltr", [language]);
2340
+ const isSame = useMemo(() => {
2341
+ if (!i18n.services) {
2342
+ return false;
2343
+ }
2344
+ return i18n.services.languageUtils.getLanguagePartFromCode(i18n.language) === i18n.services.languageUtils.getLanguagePartFromCode(language);
2345
+ }, [i18n.language, language]);
2346
+ if (isSame) {
2347
+ if (Component) {
2348
+ return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({}, __spreadValues2({}, props)), {
2349
+ children
2350
+ }));
2351
+ }
2352
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, __spreadValues2({}, props)), {
2353
+ children
2354
+ }));
2355
+ }
2356
+ if (Component) {
2357
+ return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({}, __spreadProps2(__spreadValues2({}, props), {
2358
+ lang: language,
2359
+ dir: viewingDirection
2360
+ })), {
2361
+ children
2362
+ }));
2363
+ }
2364
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, __spreadProps2(__spreadValues2({}, props), {
2365
+ lang: language,
2366
+ dir: viewingDirection
2367
+ })), {
2368
+ children
2369
+ }));
2370
+ }
2371
+ function getClosestLanguage(i18nLanguage, languages, i18nLanguages = [], strictFallback = false) {
2372
+ if (!i18nLanguage || !languages || languages.length === 0) {
2373
+ return void 0;
2374
+ }
2375
+ if (languages.length === 1) {
2376
+ return languages[0];
2377
+ }
2378
+ if (languages.indexOf(i18nLanguage) !== -1) {
2379
+ return i18nLanguage;
2380
+ }
2381
+ const root = i18nLanguage.indexOf("-") !== -1 ? i18nLanguage.slice(0, i18nLanguage.indexOf("-")) : null;
2382
+ if (root && languages.indexOf(root) !== -1) {
2383
+ return root;
2384
+ }
2385
+ for (const lang of i18nLanguages) {
2386
+ if (languages.indexOf(lang) !== -1) {
2387
+ return lang;
2388
+ }
2389
+ }
2390
+ if (!strictFallback) {
2391
+ const inverseRoot = languages.map((l) => l.indexOf("-") !== -1 ? l.slice(0, l.indexOf("-")) : null);
2392
+ const inverseIdx = inverseRoot.indexOf(i18nLanguage);
2393
+ if (inverseIdx !== -1) {
2394
+ return languages[inverseIdx];
2395
+ }
2396
+ for (const lang of i18nLanguages) {
2397
+ const root2 = lang.indexOf("-") !== -1 ? lang.slice(0, lang.indexOf("-")) : null;
2398
+ const inverseIdx2 = root2 ? languages.indexOf(root2) : -1;
2399
+ if (inverseIdx2 !== -1) {
2400
+ return languages[inverseIdx2];
2401
+ }
2402
+ }
2403
+ }
2404
+ if (languages.indexOf("none") !== -1) {
2405
+ return "none";
2406
+ }
2407
+ if (languages.indexOf("@none") !== -1) {
2408
+ return "@none";
2409
+ }
2410
+ return languages[0];
2411
+ }
2412
+ function buildLocaleString(inputText, i18nLanguage, options = {}) {
2413
+ const {
2414
+ strictFallback = false,
2415
+ defaultText = "",
2416
+ separator = "\n",
2417
+ fallbackLanguages = [],
2418
+ closest
2419
+ } = options;
2420
+ const languages = Object.keys(inputText || {});
2421
+ const language = closest ? i18nLanguage : getClosestLanguage(i18nLanguage, languages, fallbackLanguages, strictFallback);
2422
+ if (!inputText) {
2423
+ return defaultText;
2424
+ }
2425
+ if (typeof inputText === "string") {
2426
+ return inputText;
2427
+ }
2428
+ const candidateText = language ? inputText[language] : void 0;
2429
+ if (candidateText) {
2430
+ if (typeof candidateText === "string") {
2431
+ return candidateText;
2432
+ }
2433
+ return candidateText.join(separator);
2434
+ }
2435
+ return "";
2436
+ }
2437
+ function useClosestLanguage(getLanguages, deps = []) {
2438
+ const {
2439
+ i18n
2440
+ } = useTranslation();
2441
+ const i18nLanguages = i18n && i18n.languages ? i18n.languages : [];
2442
+ const i18nLanguage = i18n && i18n.language ? i18n.language : "en";
2443
+ return useMemo(() => {
2444
+ const languages = getLanguages();
2445
+ return getClosestLanguage(i18nLanguage, languages, i18nLanguages);
2446
+ }, [i18nLanguages, i18nLanguage, ...deps]);
2447
+ }
2448
+ function useLocaleString(inputText, defaultText) {
2449
+ const language = useClosestLanguage(() => Object.keys(inputText || {}), [inputText]);
2450
+ return [useMemo(() => {
2451
+ return buildLocaleString(inputText, language, {
2452
+ defaultText,
2453
+ closest: true
2454
+ });
2455
+ }, [language, defaultText, inputText]), language];
2456
+ }
2457
+ const LocaleString = (_c) => {
2458
+ var _d = _c, {
2459
+ as: Component,
2460
+ defaultText,
2461
+ enableDangerouslySetInnerHTML,
2462
+ children
2463
+ } = _d, props = __objRest2(_d, ["as", "defaultText", "enableDangerouslySetInnerHTML", "children"]);
2464
+ const [text, language] = useLocaleString(children, defaultText);
2465
+ if (language) {
2466
+ return /* @__PURE__ */ jsx(LanguageString, __spreadProps(__spreadValues({}, __spreadProps2(__spreadValues2({}, props), {
2467
+ as: Component,
2468
+ language,
2469
+ title: enableDangerouslySetInnerHTML ? void 0 : text,
2470
+ dangerouslySetInnerHTML: enableDangerouslySetInnerHTML ? {
2471
+ __html: text
2472
+ } : void 0
2473
+ })), {
2474
+ children: enableDangerouslySetInnerHTML ? void 0 : text
2475
+ }));
2476
+ }
2477
+ if (Component) {
2478
+ return /* @__PURE__ */ jsx(Component, __spreadProps(__spreadValues({}, __spreadValues2({}, props)), {
2479
+ children: text
2480
+ }));
2481
+ }
2482
+ return /* @__PURE__ */ jsx("span", __spreadProps(__spreadValues({}, __spreadProps2(__spreadValues2({}, props), {
2483
+ title: enableDangerouslySetInnerHTML ? void 0 : text,
2484
+ dangerouslySetInnerHTML: enableDangerouslySetInnerHTML ? {
2485
+ __html: text
2486
+ } : void 0
2487
+ })), {
2488
+ children: enableDangerouslySetInnerHTML ? void 0 : text
2489
+ }));
2490
+ };
1875
2491
  function RenderCanvas({
1876
2492
  x,
1877
2493
  y,
@@ -1882,6 +2498,9 @@ function RenderCanvas({
1882
2498
  renderViewerControls,
1883
2499
  renderMediaControls,
1884
2500
  strategies,
2501
+ backgroundStyle,
2502
+ alwaysShowBackground,
2503
+ onClickPaintingAnnotation,
1885
2504
  children
1886
2505
  }) {
1887
2506
  const canvas = useCanvas();
@@ -1968,19 +2587,35 @@ function RenderCanvas({
1968
2587
  x,
1969
2588
  y
1970
2589
  }, elementProps), {
1971
- children: [strategy.type === "images" ? /* @__PURE__ */ jsxs(Fragment$1, {
1972
- children: [strategy.images.map((image, idx) => {
1973
- return /* @__PURE__ */ jsx(RenderImage, {
1974
- isStatic,
1975
- image,
1976
- id: image.id,
1977
- thumbnail: idx === 0 ? thumbnail : void 0,
1978
- annotations
1979
- }, image.id);
1980
- }), renderViewerControls ? /* @__PURE__ */ jsx(CanvasPortal, {
1981
- overlay: true,
1982
- children: renderViewerControls(strategy)
1983
- }) : null]
2590
+ children: [strategy.type === "empty" || alwaysShowBackground ? /* @__PURE__ */ jsx(CanvasBackground, {
2591
+ style: backgroundStyle
2592
+ }) : null, strategy.type === "textual-content" ? strategy.items.map((item, n) => {
2593
+ return /* @__PURE__ */ jsxs(Fragment$1, {
2594
+ children: [/* @__PURE__ */ jsx(HTMLPortal, {
2595
+ onClick: onClickPaintingAnnotation ? (e) => {
2596
+ e.stopPropagation();
2597
+ onClickPaintingAnnotation(item.annotationId, item, e);
2598
+ } : void 0,
2599
+ target: item.target.spatial || void 0,
2600
+ children: /* @__PURE__ */ jsx(LocaleString, {
2601
+ children: item.text
2602
+ })
2603
+ }, n), annotations]
2604
+ });
2605
+ }) : null, strategy.type === "images" ? /* @__PURE__ */ jsxs(Fragment$1, {
2606
+ children: [strategy.images.map((image, idx) => /* @__PURE__ */ jsx(RenderImage, {
2607
+ isStatic,
2608
+ image,
2609
+ id: image.id,
2610
+ thumbnail: idx === 0 ? thumbnail : void 0,
2611
+ onClick: onClickPaintingAnnotation ? (e) => {
2612
+ e.stopPropagation();
2613
+ onClickPaintingAnnotation(image.annotationId, image, e);
2614
+ } : void 0
2615
+ }, image.id)), annotations]
2616
+ }) : null, (strategy.type === "images" || strategy.type === "empty" || strategy.type === "textual-content") && renderViewerControls ? /* @__PURE__ */ jsx(CanvasPortal, {
2617
+ overlay: true,
2618
+ children: renderViewerControls(strategy)
1984
2619
  }) : null, strategy.type === "3d-model" ? /* @__PURE__ */ jsx(Model, {
1985
2620
  model: strategy.model
1986
2621
  }) : null, strategy.type === "media" ? /* @__PURE__ */ jsx(Fragment$1, {
@@ -1992,7 +2627,7 @@ function RenderCanvas({
1992
2627
  children: [thumbnailFallbackImage, renderMediaControls ? renderMediaControls(strategy) : null]
1993
2628
  }) : null
1994
2629
  }) : null]
1995
- }), strategy.type), strategy.type === "media" && strategy.media.type === "Sound" && accompanyingCanvas ? /* @__PURE__ */ jsx(CanvasContext, {
2630
+ }), `${canvas.id}/${strategy.type}`), strategy.type === "media" && strategy.media.type === "Sound" && accompanyingCanvas ? /* @__PURE__ */ jsx(CanvasContext, {
1996
2631
  canvas: accompanyingCanvas.id,
1997
2632
  children: /* @__PURE__ */ jsx(RenderCanvas, {
1998
2633
  renderViewerControls
@@ -2005,7 +2640,8 @@ const CanvasPanel = {
2005
2640
  RenderCanvas,
2006
2641
  RenderAnnotationPage,
2007
2642
  RenderAnnotation,
2008
- Viewer
2643
+ Viewer,
2644
+ CanvasBackground
2009
2645
  };
2010
2646
  export { CanvasPanel };
2011
2647
  //# sourceMappingURL=canvas-panel.mjs.map