react-iiif-vault 1.4.0 → 1.5.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +150 -18
- package/dist/bundle.global.js +30 -28
- package/dist/canvas-panel.cjs +7 -7
- package/dist/canvas-panel.d.cts +2 -3
- package/dist/canvas-panel.d.ts +2 -3
- package/dist/canvas-panel.js +1 -1
- package/dist/chunk-IWRMLB3G.js +48 -0
- package/dist/chunk-XNDN34SQ.js +1 -0
- package/dist/{index-BAYQ0qVx.d.cts → index-CMSk5Jbz.d.cts} +5 -5
- package/dist/{index-CnXzAuQK.d.ts → index-CWeYvmxZ.d.ts} +5 -5
- package/dist/index.cjs +9 -9
- package/dist/index.d.cts +128 -18
- package/dist/index.d.ts +128 -18
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-DkjxMKJV.d.cts → useRenderingStrategy-BiuSDiXu.d.cts} +16 -3
- package/dist/{useRenderingStrategy-DkjxMKJV.d.ts → useRenderingStrategy-BiuSDiXu.d.ts} +16 -3
- package/dist/utils-C-h4SU3S.d.ts +41 -0
- package/dist/utils-CvRzsfRK.d.cts +41 -0
- package/dist/utils.cjs +1 -1
- package/dist/utils.d.cts +7 -32
- package/dist/utils.d.ts +7 -32
- package/dist/utils.js +1 -1
- package/package.json +4 -5
- package/dist/chunk-7KUFVAUD.js +0 -48
- package/dist/chunk-CCTBCLBV.js +0 -1
package/dist/index.d.cts
CHANGED
|
@@ -1,31 +1,108 @@
|
|
|
1
|
-
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-
|
|
2
|
-
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-
|
|
1
|
+
import { A as AudioComponentProps, V as VideoComponentProps, S as SimpleViewerContext, a as SimpleViewerProps } from './index-CMSk5Jbz.cjs';
|
|
2
|
+
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-CMSk5Jbz.cjs';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as React$1 from 'react';
|
|
4
5
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
6
|
+
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, U as UnknownStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-BiuSDiXu.cjs';
|
|
7
|
+
export { f as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, k as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, e as SingleYouTubeVideo, i as TextContent, h as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, l as get3dStrategy, g as getImageStrategy, j as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-BiuSDiXu.cjs';
|
|
8
|
+
import * as _iiif_helpers from '@iiif/helpers';
|
|
9
|
+
import { ChoiceDescription, Paintables, ComplexChoice } from '@iiif/helpers';
|
|
10
|
+
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
11
|
+
import { InternationalString, ImageService as ImageService$1, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, Reference, Annotation } from '@iiif/presentation-3';
|
|
12
|
+
import { RegionParameter, RotationParameter, SizeParameter } from '@iiif/parser/image-3';
|
|
8
13
|
import * as polygon_editor from 'polygon-editor';
|
|
9
14
|
import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
10
|
-
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
11
15
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
12
16
|
import { StoreApi } from 'zustand/vanilla';
|
|
13
17
|
import * as zustand from 'zustand';
|
|
14
18
|
import { StoreApi as StoreApi$1 } from 'zustand';
|
|
15
|
-
import { C as ComplexTimelineStrategy, T as TimelineKeyframe, U as UnknownStrategy, M as MediaStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DkjxMKJV.cjs';
|
|
16
|
-
export { f as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, E as EmptyStrategy, I as ImageWithOptionalService, R as RenderingStrategy, k as Single3DModelStrategy, S as SingleAudio, c as SingleImageStrategy, a as SingleVideo, e as SingleYouTubeVideo, b as StrategyActions, i as TextContent, h as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, l as get3dStrategy, g as getImageStrategy, j as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-DkjxMKJV.cjs';
|
|
17
19
|
import * as mitt from 'mitt';
|
|
18
20
|
import { Emitter, EventType, Handler } from 'mitt';
|
|
19
21
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
20
|
-
import * as _iiif_helpers from '@iiif/helpers';
|
|
21
|
-
import { Paintables, Vault as Vault$1, ComplexChoice } from '@iiif/helpers';
|
|
22
22
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
23
|
-
|
|
23
|
+
import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@iiif/helpers/image-service';
|
|
24
|
+
import { C as CompatVault } from './utils-CvRzsfRK.cjs';
|
|
25
|
+
export { e as emptyActions, b as emptyStrategy, g as getParsedTargetSelector, c as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, a as unsupportedStrategy } from './utils-CvRzsfRK.cjs';
|
|
24
26
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
25
27
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
26
28
|
import * as _iiif_helpers_styles from '@iiif/helpers/styles';
|
|
27
29
|
export * from '@iiif/helpers/annotation-targets';
|
|
28
30
|
|
|
31
|
+
interface CanvasStrategyProviderProps {
|
|
32
|
+
onChoiceChange?: (choice?: ChoiceDescription) => void;
|
|
33
|
+
strategies?: Array<RenderingStrategy['type']>;
|
|
34
|
+
registerActions?: (actions: StrategyActions) => void;
|
|
35
|
+
defaultChoices?: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
opacity?: number;
|
|
38
|
+
}>;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
|
|
41
|
+
viewControlsDeps?: any[];
|
|
42
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
43
|
+
renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
|
|
44
|
+
complexTimelineControlsDeps?: any[];
|
|
45
|
+
mediaControlsDeps?: any[];
|
|
46
|
+
throwOnUnknown?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare function CanvasStrategyProvider({ strategies, registerActions, defaultChoices, onChoiceChange, mediaControlsDeps, renderMediaControls, renderViewerControls, viewControlsDeps, renderComplexTimelineControls, complexTimelineControlsDeps, throwOnUnknown, children, }: CanvasStrategyProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
|
+
interface CanvasWorldObjectProps {
|
|
51
|
+
x?: number;
|
|
52
|
+
y?: number;
|
|
53
|
+
keepCanvasScale?: boolean;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
declare function CanvasWorldObject({ x, y, keepCanvasScale, children }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
|
|
57
|
+
|
|
58
|
+
declare function ThumbnailFallbackImage({ x, y }: {
|
|
59
|
+
x?: number;
|
|
60
|
+
y?: number;
|
|
61
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
62
|
+
|
|
63
|
+
interface RenderEmptyStrategyProps {
|
|
64
|
+
backgroundStyle?: BoxStyle;
|
|
65
|
+
alwaysShowBackground?: boolean;
|
|
66
|
+
}
|
|
67
|
+
declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }: RenderEmptyStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
68
|
+
|
|
69
|
+
declare function RenderComplexTimelineStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
70
|
+
|
|
71
|
+
interface TextualContextStrategyProps {
|
|
72
|
+
onClickPaintingAnnotation?: (id: string, e: any) => void;
|
|
73
|
+
children?: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
declare function RenderTextualContentStrategy({ onClickPaintingAnnotation, children }: TextualContextStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
76
|
+
|
|
77
|
+
interface ImageStrategyProps {
|
|
78
|
+
isStatic?: boolean;
|
|
79
|
+
enableSizes?: boolean;
|
|
80
|
+
onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
|
|
81
|
+
children?: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
declare function RenderImageStrategy({ isStatic, enableSizes, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
84
|
+
|
|
85
|
+
declare function Render3DModelStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
86
|
+
|
|
87
|
+
interface AnnotationStrategyProps {
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
declare function RenderAnnotationStrategy({ children }: AnnotationStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
91
|
+
|
|
92
|
+
interface RenderAudioStrategyProps {
|
|
93
|
+
as?: React.ComponentType<AudioComponentProps>;
|
|
94
|
+
}
|
|
95
|
+
declare function RenderAudioStrategy({ as: CustomAudio }: RenderAudioStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
96
|
+
|
|
97
|
+
declare function RenderAccompanyingCanvas(): react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
interface RenderVideoStrategyProps {
|
|
100
|
+
as?: React__default.ComponentType<VideoComponentProps>;
|
|
101
|
+
}
|
|
102
|
+
declare function RenderVideoStrategy({ as: CustomVideo }: RenderVideoStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
103
|
+
|
|
104
|
+
declare function RenderYouTubeStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
105
|
+
|
|
29
106
|
declare const CanvasAnnotations: React$1.ForwardRefExoticComponent<{
|
|
30
107
|
canvasId?: string | undefined;
|
|
31
108
|
} & React$1.RefAttributes<{
|
|
@@ -79,7 +156,7 @@ type CombinedMetadataProps = Omit<MetadataProps, 'metadata'>;
|
|
|
79
156
|
declare function CombinedMetadata(props: CombinedMetadataProps): react_jsx_runtime.JSX.Element;
|
|
80
157
|
|
|
81
158
|
interface ImageProps {
|
|
82
|
-
src: string | ImageService;
|
|
159
|
+
src: string | ImageService$1;
|
|
83
160
|
alt?: string;
|
|
84
161
|
size?: Partial<ImageSize>;
|
|
85
162
|
region?: RegionParameter;
|
|
@@ -314,6 +391,21 @@ interface PolygonSelectorProps {
|
|
|
314
391
|
}
|
|
315
392
|
declare function PolygonSelector(props: PolygonSelectorProps): react_jsx_runtime.JSX.Element | null;
|
|
316
393
|
|
|
394
|
+
interface ImageServiceProps {
|
|
395
|
+
src: string;
|
|
396
|
+
atlas?: AtlasProps;
|
|
397
|
+
errorFallback?: React__default.FC;
|
|
398
|
+
interactive?: boolean;
|
|
399
|
+
skipSizes?: boolean;
|
|
400
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
401
|
+
viewControlsDeps?: any[];
|
|
402
|
+
fluid?: boolean;
|
|
403
|
+
x?: number;
|
|
404
|
+
y?: number;
|
|
405
|
+
children?: React__default.ReactNode;
|
|
406
|
+
}
|
|
407
|
+
declare function ImageService({ src, errorFallback, interactive, skipSizes, children, renderViewerControls, viewControlsDeps, fluid, x, y, ...atlasProps }: ImageServiceProps & Omit<AtlasProps, 'children'>): react_jsx_runtime.JSX.Element | null;
|
|
408
|
+
|
|
317
409
|
declare function AnnotationContext({ annotation, children }: {
|
|
318
410
|
annotation: string;
|
|
319
411
|
children: ReactNode;
|
|
@@ -742,9 +834,27 @@ declare function AnnotationStyleProvider({ theme, children, }: {
|
|
|
742
834
|
children: React.ReactNode;
|
|
743
835
|
}): react_jsx_runtime.JSX.Element;
|
|
744
836
|
|
|
745
|
-
|
|
837
|
+
interface StrategyContext {
|
|
838
|
+
strategy: RenderingStrategy;
|
|
839
|
+
choices: ChoiceDescription | null;
|
|
840
|
+
}
|
|
841
|
+
declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
|
|
842
|
+
declare function useStrategy(): StrategyContext;
|
|
843
|
+
|
|
844
|
+
interface ControlsContext {
|
|
845
|
+
renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
|
|
846
|
+
viewControlsDeps: any[];
|
|
847
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
848
|
+
mediaControlsDeps: any[];
|
|
849
|
+
renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
|
|
850
|
+
complexTimelineControlsDeps: any[];
|
|
851
|
+
}
|
|
852
|
+
declare const ControlsReactContext: React$1.Context<ControlsContext | null>;
|
|
853
|
+
declare function useRenderControls(): ControlsContext;
|
|
854
|
+
|
|
855
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
|
|
746
856
|
|
|
747
|
-
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault:
|
|
857
|
+
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
|
|
748
858
|
|
|
749
859
|
declare function useAnnotation(options?: {
|
|
750
860
|
id: string;
|
|
@@ -865,7 +975,7 @@ declare function useExternalManifest(idOrRef: string | {
|
|
|
865
975
|
manifest?: ManifestNormalized;
|
|
866
976
|
};
|
|
867
977
|
|
|
868
|
-
declare function useImage(service: ImageService | undefined, data?: {
|
|
978
|
+
declare function useImage(service: ImageService$1 | undefined, data?: {
|
|
869
979
|
size?: Partial<ImageSize>;
|
|
870
980
|
selector?: RegionParameter;
|
|
871
981
|
rotation?: number | RotationParameter;
|
|
@@ -883,7 +993,7 @@ interface ImageServiceRequestOptions {
|
|
|
883
993
|
* @note It is better to use the hook useRenderingStrategy for rendering.
|
|
884
994
|
*/
|
|
885
995
|
declare function useImageService({ cacheKey }?: ImageServiceRequestOptions): {
|
|
886
|
-
data: ImageService | undefined;
|
|
996
|
+
data: ImageService$1 | undefined;
|
|
887
997
|
isFetching: boolean;
|
|
888
998
|
status: 'error' | 'success' | 'loading' | 'idle';
|
|
889
999
|
};
|
|
@@ -894,7 +1004,7 @@ declare function useImageTile(): {
|
|
|
894
1004
|
id: string | undefined;
|
|
895
1005
|
width: number | null | undefined;
|
|
896
1006
|
height: number | null | undefined;
|
|
897
|
-
imageService: ImageService;
|
|
1007
|
+
imageService: ImageService$1;
|
|
898
1008
|
thumbnail: undefined;
|
|
899
1009
|
} | null;
|
|
900
1010
|
};
|
|
@@ -1135,4 +1245,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
1135
1245
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
1136
1246
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
1137
1247
|
|
|
1138
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useCustomContextBridge, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
1248
|
+
export { AnnotationContext, AnnotationPageContext, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, EmptyStrategy, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useCustomContextBridge, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderControls, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,31 +1,108 @@
|
|
|
1
|
-
import { S as SimpleViewerContext, a as SimpleViewerProps } from './index-
|
|
2
|
-
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-
|
|
1
|
+
import { A as AudioComponentProps, V as VideoComponentProps, S as SimpleViewerContext, a as SimpleViewerProps } from './index-CWeYvmxZ.js';
|
|
2
|
+
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-CWeYvmxZ.js';
|
|
3
|
+
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
3
4
|
import * as React$1 from 'react';
|
|
4
5
|
import React__default, { ReactNode, FunctionComponent, RefObject, Context } from 'react';
|
|
5
|
-
import
|
|
6
|
-
|
|
7
|
-
import
|
|
6
|
+
import { R as RenderingStrategy, b as StrategyActions, M as MediaStrategy, c as SingleImageStrategy, E as EmptyStrategy, C as ComplexTimelineStrategy, I as ImageWithOptionalService, T as TimelineKeyframe, U as UnknownStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-BiuSDiXu.js';
|
|
7
|
+
export { f as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, k as Single3DModelStrategy, S as SingleAudio, a as SingleVideo, e as SingleYouTubeVideo, i as TextContent, h as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, l as get3dStrategy, g as getImageStrategy, j as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-BiuSDiXu.js';
|
|
8
|
+
import * as _iiif_helpers from '@iiif/helpers';
|
|
9
|
+
import { ChoiceDescription, Paintables, ComplexChoice } from '@iiif/helpers';
|
|
10
|
+
import { BoxStyle, AtlasProps, Preset } from '@atlas-viewer/atlas';
|
|
11
|
+
import { InternationalString, ImageService as ImageService$1, ImageSize, AuthProbeService2, Auth2LocationResource, Auth2SubstituteResource, AuthAccessService2, AuthAccessTokenService2, AuthAccessToken2, SearchServiceQueryParams, SearchServiceSearchResponse, SearchService as SearchService$1, SearchServiceAutocomplete, Reference, Annotation } from '@iiif/presentation-3';
|
|
12
|
+
import { RegionParameter, RotationParameter, SizeParameter } from '@iiif/parser/image-3';
|
|
8
13
|
import * as polygon_editor from 'polygon-editor';
|
|
9
14
|
import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
10
|
-
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
11
15
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
12
16
|
import { StoreApi } from 'zustand/vanilla';
|
|
13
17
|
import * as zustand from 'zustand';
|
|
14
18
|
import { StoreApi as StoreApi$1 } from 'zustand';
|
|
15
|
-
import { C as ComplexTimelineStrategy, T as TimelineKeyframe, U as UnknownStrategy, M as MediaStrategy, d as ImageServiceLoaderType } from './useRenderingStrategy-DkjxMKJV.js';
|
|
16
|
-
export { f as AnnotationPageDescription, A as AudioSequence, n as ChoiceEvents, E as EmptyStrategy, I as ImageWithOptionalService, R as RenderingStrategy, k as Single3DModelStrategy, S as SingleAudio, c as SingleImageStrategy, a as SingleVideo, e as SingleYouTubeVideo, b as StrategyActions, i as TextContent, h as TextualContentStrategy, m as UseRenderingStrategy, o as UseRenderingStrategyOptions, V as VideoSequence, l as get3dStrategy, g as getImageStrategy, j as getTextualContentStrategy, u as useLoadImageService, p as useRenderingStrategy } from './useRenderingStrategy-DkjxMKJV.js';
|
|
17
19
|
import * as mitt from 'mitt';
|
|
18
20
|
import { Emitter, EventType, Handler } from 'mitt';
|
|
19
21
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
20
|
-
import * as _iiif_helpers from '@iiif/helpers';
|
|
21
|
-
import { Paintables, Vault as Vault$1, ComplexChoice } from '@iiif/helpers';
|
|
22
22
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
23
|
-
|
|
23
|
+
import { ImageServiceLoader, ImageCandidateRequest, ImageCandidate } from '@iiif/helpers/image-service';
|
|
24
|
+
import { C as CompatVault } from './utils-C-h4SU3S.js';
|
|
25
|
+
export { e as emptyActions, b as emptyStrategy, g as getParsedTargetSelector, c as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, a as unsupportedStrategy } from './utils-C-h4SU3S.js';
|
|
24
26
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
25
27
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
26
28
|
import * as _iiif_helpers_styles from '@iiif/helpers/styles';
|
|
27
29
|
export * from '@iiif/helpers/annotation-targets';
|
|
28
30
|
|
|
31
|
+
interface CanvasStrategyProviderProps {
|
|
32
|
+
onChoiceChange?: (choice?: ChoiceDescription) => void;
|
|
33
|
+
strategies?: Array<RenderingStrategy['type']>;
|
|
34
|
+
registerActions?: (actions: StrategyActions) => void;
|
|
35
|
+
defaultChoices?: Array<{
|
|
36
|
+
id: string;
|
|
37
|
+
opacity?: number;
|
|
38
|
+
}>;
|
|
39
|
+
children: ReactNode;
|
|
40
|
+
renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
|
|
41
|
+
viewControlsDeps?: any[];
|
|
42
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
43
|
+
renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
|
|
44
|
+
complexTimelineControlsDeps?: any[];
|
|
45
|
+
mediaControlsDeps?: any[];
|
|
46
|
+
throwOnUnknown?: boolean;
|
|
47
|
+
}
|
|
48
|
+
declare function CanvasStrategyProvider({ strategies, registerActions, defaultChoices, onChoiceChange, mediaControlsDeps, renderMediaControls, renderViewerControls, viewControlsDeps, renderComplexTimelineControls, complexTimelineControlsDeps, throwOnUnknown, children, }: CanvasStrategyProviderProps): react_jsx_runtime.JSX.Element;
|
|
49
|
+
|
|
50
|
+
interface CanvasWorldObjectProps {
|
|
51
|
+
x?: number;
|
|
52
|
+
y?: number;
|
|
53
|
+
keepCanvasScale?: boolean;
|
|
54
|
+
children?: ReactNode;
|
|
55
|
+
}
|
|
56
|
+
declare function CanvasWorldObject({ x, y, keepCanvasScale, children }: CanvasWorldObjectProps): react_jsx_runtime.JSX.Element | null;
|
|
57
|
+
|
|
58
|
+
declare function ThumbnailFallbackImage({ x, y }: {
|
|
59
|
+
x?: number;
|
|
60
|
+
y?: number;
|
|
61
|
+
}): react_jsx_runtime.JSX.Element | null;
|
|
62
|
+
|
|
63
|
+
interface RenderEmptyStrategyProps {
|
|
64
|
+
backgroundStyle?: BoxStyle;
|
|
65
|
+
alwaysShowBackground?: boolean;
|
|
66
|
+
}
|
|
67
|
+
declare function RenderEmptyStrategy({ backgroundStyle, alwaysShowBackground }: RenderEmptyStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
68
|
+
|
|
69
|
+
declare function RenderComplexTimelineStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
70
|
+
|
|
71
|
+
interface TextualContextStrategyProps {
|
|
72
|
+
onClickPaintingAnnotation?: (id: string, e: any) => void;
|
|
73
|
+
children?: ReactNode;
|
|
74
|
+
}
|
|
75
|
+
declare function RenderTextualContentStrategy({ onClickPaintingAnnotation, children }: TextualContextStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
76
|
+
|
|
77
|
+
interface ImageStrategyProps {
|
|
78
|
+
isStatic?: boolean;
|
|
79
|
+
enableSizes?: boolean;
|
|
80
|
+
onClickPaintingAnnotation?: (id: string, image: ImageWithOptionalService, e: any) => void;
|
|
81
|
+
children?: ReactNode;
|
|
82
|
+
}
|
|
83
|
+
declare function RenderImageStrategy({ isStatic, enableSizes, onClickPaintingAnnotation, children, }: ImageStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
84
|
+
|
|
85
|
+
declare function Render3DModelStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
86
|
+
|
|
87
|
+
interface AnnotationStrategyProps {
|
|
88
|
+
children?: ReactNode;
|
|
89
|
+
}
|
|
90
|
+
declare function RenderAnnotationStrategy({ children }: AnnotationStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
91
|
+
|
|
92
|
+
interface RenderAudioStrategyProps {
|
|
93
|
+
as?: React.ComponentType<AudioComponentProps>;
|
|
94
|
+
}
|
|
95
|
+
declare function RenderAudioStrategy({ as: CustomAudio }: RenderAudioStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
96
|
+
|
|
97
|
+
declare function RenderAccompanyingCanvas(): react_jsx_runtime.JSX.Element;
|
|
98
|
+
|
|
99
|
+
interface RenderVideoStrategyProps {
|
|
100
|
+
as?: React__default.ComponentType<VideoComponentProps>;
|
|
101
|
+
}
|
|
102
|
+
declare function RenderVideoStrategy({ as: CustomVideo }: RenderVideoStrategyProps): react_jsx_runtime.JSX.Element | null;
|
|
103
|
+
|
|
104
|
+
declare function RenderYouTubeStrategy(): react_jsx_runtime.JSX.Element | null;
|
|
105
|
+
|
|
29
106
|
declare const CanvasAnnotations: React$1.ForwardRefExoticComponent<{
|
|
30
107
|
canvasId?: string | undefined;
|
|
31
108
|
} & React$1.RefAttributes<{
|
|
@@ -79,7 +156,7 @@ type CombinedMetadataProps = Omit<MetadataProps, 'metadata'>;
|
|
|
79
156
|
declare function CombinedMetadata(props: CombinedMetadataProps): react_jsx_runtime.JSX.Element;
|
|
80
157
|
|
|
81
158
|
interface ImageProps {
|
|
82
|
-
src: string | ImageService;
|
|
159
|
+
src: string | ImageService$1;
|
|
83
160
|
alt?: string;
|
|
84
161
|
size?: Partial<ImageSize>;
|
|
85
162
|
region?: RegionParameter;
|
|
@@ -314,6 +391,21 @@ interface PolygonSelectorProps {
|
|
|
314
391
|
}
|
|
315
392
|
declare function PolygonSelector(props: PolygonSelectorProps): react_jsx_runtime.JSX.Element | null;
|
|
316
393
|
|
|
394
|
+
interface ImageServiceProps {
|
|
395
|
+
src: string;
|
|
396
|
+
atlas?: AtlasProps;
|
|
397
|
+
errorFallback?: React__default.FC;
|
|
398
|
+
interactive?: boolean;
|
|
399
|
+
skipSizes?: boolean;
|
|
400
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
401
|
+
viewControlsDeps?: any[];
|
|
402
|
+
fluid?: boolean;
|
|
403
|
+
x?: number;
|
|
404
|
+
y?: number;
|
|
405
|
+
children?: React__default.ReactNode;
|
|
406
|
+
}
|
|
407
|
+
declare function ImageService({ src, errorFallback, interactive, skipSizes, children, renderViewerControls, viewControlsDeps, fluid, x, y, ...atlasProps }: ImageServiceProps & Omit<AtlasProps, 'children'>): react_jsx_runtime.JSX.Element | null;
|
|
408
|
+
|
|
317
409
|
declare function AnnotationContext({ annotation, children }: {
|
|
318
410
|
annotation: string;
|
|
319
411
|
children: ReactNode;
|
|
@@ -742,9 +834,27 @@ declare function AnnotationStyleProvider({ theme, children, }: {
|
|
|
742
834
|
children: React.ReactNode;
|
|
743
835
|
}): react_jsx_runtime.JSX.Element;
|
|
744
836
|
|
|
745
|
-
|
|
837
|
+
interface StrategyContext {
|
|
838
|
+
strategy: RenderingStrategy;
|
|
839
|
+
choices: ChoiceDescription | null;
|
|
840
|
+
}
|
|
841
|
+
declare const StrategyReactContext: React$1.Context<StrategyContext | null>;
|
|
842
|
+
declare function useStrategy(): StrategyContext;
|
|
843
|
+
|
|
844
|
+
interface ControlsContext {
|
|
845
|
+
renderMediaControls?: (strategy: MediaStrategy) => ReactNode;
|
|
846
|
+
viewControlsDeps: any[];
|
|
847
|
+
renderViewerControls?: (strategy: SingleImageStrategy | EmptyStrategy) => ReactNode;
|
|
848
|
+
mediaControlsDeps: any[];
|
|
849
|
+
renderComplexTimelineControls?: (strategy: ComplexTimelineStrategy) => ReactNode;
|
|
850
|
+
complexTimelineControlsDeps: any[];
|
|
851
|
+
}
|
|
852
|
+
declare const ControlsReactContext: React$1.Context<ControlsContext | null>;
|
|
853
|
+
declare function useRenderControls(): ControlsContext;
|
|
854
|
+
|
|
855
|
+
declare function getVideoStrategy(canvas: CanvasNormalized, paintables: Paintables, vault: CompatVault): UnknownStrategy | MediaStrategy;
|
|
746
856
|
|
|
747
|
-
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault:
|
|
857
|
+
declare function getComplexTimelineStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType, vault: CompatVault): ComplexTimelineStrategy;
|
|
748
858
|
|
|
749
859
|
declare function useAnnotation(options?: {
|
|
750
860
|
id: string;
|
|
@@ -865,7 +975,7 @@ declare function useExternalManifest(idOrRef: string | {
|
|
|
865
975
|
manifest?: ManifestNormalized;
|
|
866
976
|
};
|
|
867
977
|
|
|
868
|
-
declare function useImage(service: ImageService | undefined, data?: {
|
|
978
|
+
declare function useImage(service: ImageService$1 | undefined, data?: {
|
|
869
979
|
size?: Partial<ImageSize>;
|
|
870
980
|
selector?: RegionParameter;
|
|
871
981
|
rotation?: number | RotationParameter;
|
|
@@ -883,7 +993,7 @@ interface ImageServiceRequestOptions {
|
|
|
883
993
|
* @note It is better to use the hook useRenderingStrategy for rendering.
|
|
884
994
|
*/
|
|
885
995
|
declare function useImageService({ cacheKey }?: ImageServiceRequestOptions): {
|
|
886
|
-
data: ImageService | undefined;
|
|
996
|
+
data: ImageService$1 | undefined;
|
|
887
997
|
isFetching: boolean;
|
|
888
998
|
status: 'error' | 'success' | 'loading' | 'idle';
|
|
889
999
|
};
|
|
@@ -894,7 +1004,7 @@ declare function useImageTile(): {
|
|
|
894
1004
|
id: string | undefined;
|
|
895
1005
|
width: number | null | undefined;
|
|
896
1006
|
height: number | null | undefined;
|
|
897
|
-
imageService: ImageService;
|
|
1007
|
+
imageService: ImageService$1;
|
|
898
1008
|
thumbnail: undefined;
|
|
899
1009
|
} | null;
|
|
900
1010
|
};
|
|
@@ -1135,4 +1245,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
1135
1245
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
1136
1246
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
1137
1247
|
|
|
1138
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, RenderSvgEditorControls, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useCustomContextBridge, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
|
1248
|
+
export { AnnotationContext, AnnotationPageContext, type AnnotationStrategyProps, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider, AuthRContext, AuthReactContext, AuthReactContextActions, type AuthState, CanvasAnnotations, CanvasContext, CanvasStrategyProvider, CanvasWorldObject, CollectionContext, CombinedMetadata, ComplexTimelineProvider, ComplexTimelineStrategy, ContextBridge, type ControlsContext, ControlsReactContext, CreateCustomShape, type CreateCustomShapeProps, CustomContextBridge, CustomContextBridgeProvider, EmptyStrategy, EventsProvider, Image, type ImageProps, ImageService, ImageServiceLoaderContext, ImageServiceLoaderType, type ImageServiceRequestOptions, type ImageStrategyProps, ImageWithOptionalService, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, MediaStrategy, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactEventContext, ReactVaultContext, Render3DModelStrategy, RenderAccompanyingCanvas, RenderAnnotationStrategy, RenderAudioStrategy, RenderComplexTimelineStrategy, RenderEmptyStrategy, RenderImageStrategy, RenderSvgEditorControls, RenderTextualContentStrategy, RenderVideoStrategy, RenderYouTubeStrategy, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, SingleImageStrategy, StrategyActions, type StrategyContext, StrategyReactContext, type SvgTheme, ThumbnailFallbackImage, TimelineKeyframe, TranslationProvider, TransliterationProvider, UnknownStrategy, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getComplexTimelineStrategy, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasStartTime, useCanvasSubset, useClosestLanguage, useCollection, useComplexTimeline, useContextBridge, useCreateLocaleString, useCurrentAuth, useCustomContextBridge, useDispatch, useEventEmitter, useEventListener, useExistingVault, useExternalCollection, useExternalManifest, useExternalResource, useIIIFLanguage, useImage, useImageService, useImageServiceLoader, useImageTile, useIsAuthEnabled, useLocaleString, useManifest, useMediaActions, useMediaElements, useMediaState, usePaintables, usePaintingAnnotations, usePolygonHelper, useRange, useRenderControls, useResourceContext, useResourceEvents, useResources, useSearchService, useSelectorController, useSelectorEmitter, useSelectorEvents, useSelectorHelper, useSimpleMediaPlayer, useSimpleViewer, useStrategy, useStyleHelper, useStyles, useSvgEditor, useThumbnail, useTranslations, useTransliteration, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as wo,A as to,Aa as nn,B as oo,Ba as se,C as no,Ca as rn,D as ro,Da as an,E as io,Ea as D,F as ao,Fa as sn,G as so,Ga as pn,H as lo,Ha as gn,I as co,Ia as le,J as mo,Ja as hn,K as uo,Ka as yn,L as fo,La as vn,M as po,Ma as xn,N as go,Na as bn,O as ho,Oa as Sn,P as yo,Pa as Cn,Q as vo,Qa as In,R as xo,Ra as kn,S as bo,Sa as ce,T as So,U as ie,V as Co,W as Io,X as ae,Y as ko,Z as Po,_ as To,a as Wt,aa as Ro,b as A,ba as Eo,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as Lo,g as te,ga as Ho,h as $t,ha as Ao,i as Vt,ia as T,j as oe,ja as zo,k as P,ka as qo,l as z,la as Wo,m as Xt,ma as Do,n as ne,na as Fo,o as q,oa as Oo,p as Yt,pa as $o,q as _t,qa as Vo,r as Kt,ra as Xo,s as Qt,sa as Yo,t as Ut,ta as _o,u as Gt,ua as Ko,v as Jt,va as Qo,w as re,wa as Uo,x as Zt,xa as N,y as jt,ya as Go,z as eo,za as W}from"./chunk-7KUFVAUD.js";import{a as Jo,b as Zo,c as jo,d as en,e as tn,f as on,g as ln,h as cn,i as mn,j as un,k as dn,l as fn}from"./chunk-CCTBCLBV.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var Mn=De(function({canvasId:t},o){let n=We(),i=se(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let h=$e(()=>{let g=(t||[]).reduce((p,b)=>[...p,...b.keys],[]),d={};for(let p of e){let b=p&&p.label?Object.values(p.label):[];for(let r of b)if(r&&r.length&&(g.indexOf(`metadata.${r[0]}`)!==-1||g.length===0)&&p){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(p);break}}return d},[t,e]);return Object.keys(h).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((g,d)=>{let p=[];for(let b of g.keys)for(let r of h[b]||[])p.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return p.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:g.label})}),C("td",{className:s.value,children:p})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((g,d)=>g?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:g.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:g.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function Vn(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function ir(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function vr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let h=s.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let h of u){let I=[],g=u[m]===h;for(let d of h){let p=l[d];I.push(L("div",{className:g?f.item:o.item,children:L(de,{classes:g?f:o,canvasId:p.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(h))},"data-selected":g,className:g?f.row:o.row,children:I},h.join("-")))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as pe}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function Sr({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return pe(fe,{children:[t?pe(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as ge,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function Er({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function Mr(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=ge(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ge(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Nr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Ar({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as pt,useMemo as gt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=gt(()=>yt(e,o),[]);return pt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),h=E(),[I,g]=Pe(null),[d,p]=Pe(!1),{helper:b,state:r}=Ie(n,(y,k)=>{M.updateTransitionBoundingBox(l.current,y,k),M.updateBoundingBoxPolygon(s.current,y,k),M.updateTransitionShape(f.current,y,k),M.updateClosestLinePointTransform(m.current,y,k),M.updateSelectBox(u.current,y,k),M.updatePointLine(x.current,y,k),M.updateDrawPreview(c.current,y,k,3),M.updateLineBox(h.current,y),g(y.transitionDirection),p(y.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let y=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",y),()=>{document.removeEventListener("mouseleave",y)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(y=>y.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:h,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((y,k)=>r.selectedPoints?.includes(k)).map(y=>y.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:h}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let g=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,g):null,p=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),p?St(d,p,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function mi(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function pi({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function vi({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function Ci({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function Ti(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Bi({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=ae();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function Hi(e,t=!1){}function Wi(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function Vi(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function Qi(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function Zi(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),h=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],p=n.get(d.body[0]),r=Be(p)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[h,e,t]),g=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],p=n.get(d.body[0]),r=Be(p)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[h,e]),Le(()=>({data:g,isFetching:l,status:m,error:f}),[g,l,m,f])}function la(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function fa(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{pi as AnnotationContext,vi as AnnotationPageContext,Ar as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,Mn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,Ci as CollectionContext,Vn as CombinedMetadata,In as ComplexTimelineProvider,Eo as ContextBridge,Me as CreateCustomShape,To as CustomContextBridge,wo as CustomContextBridgeProvider,ko as EventsProvider,Ze as Image,Go as ImageServiceLoaderContext,bo as InnerViewerProvider,Oo as LanguageProvider,_o as LanguageString,N as LocaleString,Vt as ManifestContext,ir as ManifestMetadata,Sn as MediaPlayerProvider,O as Metadata,mi as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,Sr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,Er as SelectorControllerProvider,vr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,Fo as TranslationProvider,$o as TransliterationProvider,Ft as VaultProvider,Ho as ViewerPresetContext,Lo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,Co as defaultEmitter,jo as emptyActions,on as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,nn as flattenAnnotationPageIds,hn as formatTime,ln as get3dStrategy,dn as getComplexTimelineStrategy,Se as getDefaultAnnotationStyles,cn as getImageStrategy,Jt as getManifestSequence,Zo as getParsedTargetSelector,fn as getRenderingStrategy,mn as getTextualContentStrategy,un as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,Jo as parseSpecificResource,Ct as svgThemes,en as unknownResponse,tn as unsupportedStrategy,Wo as useAnnotation,Do as useAnnotationPage,se as useAnnotationPageManager,Ce as useAnnotationStyles,Ti as useAnnotationsAtTime,uo as useAuthActions,po as useAuthService,mo as useAuthStore,ho as useAuthToken,go as useAuthTokens,T as useCanvas,Bi as useCanvasChoices,Hi as useCanvasClock,Zt as useCanvasSequence,Cn as useCanvasStartTime,Wi as useCanvasSubset,Ko as useClosestLanguage,Vi as useCollection,kn as useComplexTimeline,Ro as useContextBridge,Uo as useCreateLocaleString,fo as useCurrentAuth,Po as useCustomContextBridge,Mo as useDispatch,ae as useEventEmitter,Qi as useEventListener,Ot as useExistingVault,Zi as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Xo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,la as useImageTile,co as useIsAuthEnabled,an as useLoadImageService,Qo as useLocaleString,q as useManifest,xn as useMediaActions,bn as useMediaElements,vn as useMediaState,sn as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,pn as useRenderingStrategy,A as useResourceContext,zo as useResourceEvents,rn as useResources,vo as useSearchService,be as useSelectorController,Mr as useSelectorEmitter,xe as useSelectorEvents,Nr as useSelectorHelper,yn as useSimpleMediaPlayer,ie as useSimpleViewer,fa as useStyleHelper,qo as useStyles,Re as useSvgEditor,le as useThumbnail,Yo as useTranslations,Vo as useTransliteration,P as useVault,gn as useVaultEffect,z as useVaultSelector,Ao as useViewerPreset,No as useVirtualAnnotationPage,Bo as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
|
|
1
|
+
import{$ as Oo,$a as ye,A as ho,Aa as hr,B as yo,Ba as yr,C as vo,Ca as vr,D as xo,Da as xr,E as So,Ea as Sr,F as bo,Fa as br,G as Co,Ga as Cr,H as Io,Ha as Ir,I as ko,Ia as kr,J as Po,Ja as Pr,K as wo,Ka as wr,L as Ro,La as Rr,M as To,Ma as Tr,N as Eo,Na as Er,O as No,Oa as Nr,P as Mo,Pa as Mr,Q as Bo,Qa as Br,R as Lo,Ra as Lr,S as Ho,Sa as B,T as Ao,Ta as ge,U as se,Ua as Hr,V as zo,Va as Ar,W as qo,Wa as zr,X as le,Xa as qr,Y as Wo,Ya as Wr,Z as Do,Za as Dr,_ as Fo,_a as he,a as Zt,aa as $o,ab as Fr,b as q,ba as Vo,bb as Or,c as L,ca as Ko,cb as $r,d as jt,da as Xo,db as Vr,e as eo,ea as Yo,eb as Kr,f as to,fa as _o,fb as Xr,g as re,ga as ce,gb as Yr,h as oo,ha as F,hb as _r,i as ro,ia as Qo,ib as Qr,j as ne,ja as U,jb as Ur,k as P,ka as w,kb as Gr,l as W,la as me,lb as Jr,m as no,ma as Uo,mb as Zr,n as ie,na as Go,nb as ve,o as D,oa as Jo,p as io,pa as Zo,q as ao,qa as ir,r as so,ra as ue,s as lo,sa as ar,t as co,ta as de,u as mo,ua as fe,v as uo,va as pe,w as ae,wa as O,x as fo,xa as sr,y as po,ya as pr,z as go,za as gr}from"./chunk-IWRMLB3G.js";import{a as jo,b as er,c as tr,d as or,e as rr,f as nr,g as lr,h as cr,i as mr,j as ur,k as dr,l as fr}from"./chunk-XNDN34SQ.js";import{useCanvas as _e}from"@atlas-viewer/atlas";import{forwardRef as Qe,useImperativeHandle as Ue}from"react";import{Fragment as Ge,jsx as xe}from"react/jsx-runtime";var nn=Qe(function({canvasId:t},o){let r=_e(),i=ue(t||r?.id),a=P();return Ue(o,()=>i,[t,r]),!r||i.enabledPageIds.length===0?null:xe(Ge,{children:i.enabledPageIds.map(s=>xe(ve.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as je}from"react";import{useMemo as Je}from"react";import{Fragment as Ze,jsx as I,jsxs as $}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:u="",separator:c,tableFooter:f,tableHeader:x}){let y=Je(()=>{let h=(t||[]).reduce((p,g)=>[...p,...g.keys],[]),m={};for(let p of e){let g=p&&p.label?Object.values(p.label):[];for(let n of g)if(n&&n.length&&(h.indexOf(`metadata.${n[0]}`)!==-1||h.length===0)&&p){let v=`metadata.${n[0]}`;m[v]=m[v]?m[v]:[],m[v].push(p);break}}return m},[t,e]);return Object.keys(y).length===0&&r?I(Ze,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?$("table",{className:s.container,children:[x,I("tbody",{children:t.map((h,m)=>{let p=[];for(let g of h.keys)for(let n of y[g]||[])p.push(I(B,{enableDangerouslySetInnerHTML:i,defaultText:d,separator:c,children:n.value},m+"__"+g));return p.length===0?null:$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(B,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:u,children:h.label})}),I("td",{className:s.value,children:p})]},m)})}),f]}):$("table",{className:s.container,children:[x,I("tbody",{children:e&&e.length?e.map((h,m)=>h?$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(B,{enableDangerouslySetInnerHTML:i,defaultText:d,separator:c,children:h.label})}),I("td",{className:s.value,children:I(B,{enableDangerouslySetInnerHTML:i,defaultText:d,separator:c,children:h.value})})]},m):null):null}),f]})}import{jsx as et}from"react/jsx-runtime";function vn(e){let t=D(),o=w(),r=ae(),i=je(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=r?.metadata||[];return[...a,...s,...l]},[t,o,r]);return et(V,{metadata:i,...e})}import{useEffect as nt,useState as it}from"react";import{createImageServiceRequest as tt,imageServiceRequestToString as ot}from"@iiif/parser/image-3";import{useMemo as rt}from"react";function G(e,t={},o=[]){return rt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let i=tt(e);return ot({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:r||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as K}from"react/jsx-runtime";function at(e){let t=typeof e.src=="string"?e.src:e.src.id,o=he(),[r,i]=it(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!r&&o.loadService({id:t}).then(()=>{i(!0)});let s=G(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[r,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return nt(()=>()=>{i(!1)},[t]),s?K("img",{src:s,alt:e.alt,className:e.className,style:e.style}):K(st,{...e,fetchImageService:!1})}function st(e){if(e.fetchImageService)return K(at,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=G(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?K("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as lt}from"react/jsx-runtime";function Hn(e){let t=D();return lt(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ft,useRef as pt}from"react";import*as J from"react-lazy-load-image-component";import{getValue as ct}from"@iiif/helpers/i18n";import{Fragment as Se,jsx as R,jsxs as dt}from"react/jsx-runtime";var{LazyLoadComponent:mt}=J||J.default;function be(e){let{size:t,visible:o,classes:r,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,d=R(ut,{...e}),u=R(mt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?R(ne,{canvas:i,children:d}):d});return a?R("figure",{className:r?.figure,children:u}):u}function ut({fallback:e,size:t,classes:o,showLabel:r,alt:i,dereference:a=!1}){let s=w(),l=t?.width||128,d=t?.height||t?.width||128,u=i||ct(s?.label)||"",c=ye({width:l,height:d},a);return!c||c.type!=="fixed"?R(Se,{children:e}):dt(Se,{children:[R("div",{className:o?.imageWrapper,children:R("img",{className:o?.img,src:c.id,alt:u})}),r?R(B,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as H}from"react/jsx-runtime";function _n({flat:e,size:t,classes:o={},showLabel:r,figure:i,fallback:a}){let s=pt(null),{items:l,sequence:d,currentSequenceIndex:u,setSequenceIndex:c}=se(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};ft(()=>{if(!s.current)return;let y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[u]);let x=[];for(let y of d){let C=[],h=d[u]===y;for(let m of y){let p=l[m];C.push(H("div",{className:h?f.item:o.item,children:H(be,{classes:h?f:o,canvasId:p.id,size:t,showLabel:r,figure:i,placeholder:H("div",{style:{height:128,width:128}}),fallback:a})},m))}if(e){x.push(C);continue}x.push(H("div",{onClick:m=>{c(d.indexOf(y))},"data-selected":h,className:h?f.row:o.row,children:C},y.join("-")))}return H("div",{ref:s,className:o.container,children:x})}import{Fragment as Ce,jsx as T,jsxs as Ie}from"react/jsx-runtime";var gt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function Gn({helper:e,showShapes:t,state:o,enabled:r=gt,classNames:i={},icons:a={}}){return Ie(Ce,{children:[t?Ie(Ce,{children:[r.draw&&T("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),r.polygon&&T("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),r.line&&T("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),r.lineBox&&T("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),r.square&&T("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),r.triangle&&T("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),r.hexagon&&T("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&r.delete&&T("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as ht,useCallback as ke,useContext as we,useEffect as Pe,useMemo as Z,useState as yt}from"react";import Re from"mitt";import{jsx as vt}from"react/jsx-runtime";var X=ht(Re());X.displayName="SelectorHelper";function ni({children:e}){return vt(X.Provider,{value:Z(()=>Re(),[]),children:e})}function ii(){return we(X)}function Te(e){let t=Ee(),[o,r]=yt(!1);Pe(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Pe(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let i=ke(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ke(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function Ee(){let e=we(X);return Z(()=>({withSelector(t){return{on(o,r){let i=a=>{a&&a.selectorId===t&&r(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,r){e.emit(o,{...r,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function ai(){let e=Ee();return Z(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as xt,useContext as St,useMemo as bt}from"react";import{jsx as Ct}from"react/jsx-runtime";function Ne(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var j=xt(Ne());j.displayName="AnnotationStyle";function Me(){return St(j)}function mi({theme:e,children:t}){let o=bt(()=>e||Ne(),[e]);return Ct(j.Provider,{value:o,children:t})}import{HTMLPortal as Tt,useAtlas as Et}from"@atlas-viewer/atlas";import{useEffect as Le,useRef as E,useState as He}from"react";import{useEffect as It,useMemo as kt,useState as Pt}from"react";import{createHelper as wt}from"polygon-editor";function Be(e,t,o){let[r,i]=Pt({}),a=kt(()=>wt(e,o),[]);return It(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:r,helper:a}}import{createSvgHelpers as Rt}from"polygon-editor";import{Fragment as Ae,jsx as b,jsxs as ze}from"react/jsx-runtime";var N=Rt();function qe(e,t){let{image:o,currentShape:r,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),d=E(),u=E(),c=E(),f=E(),x=E(),y=E(),[C,h]=He(null),[m,p]=He(!1),{helper:g,state:n}=Be(r,(S,k)=>{N.updateTransitionBoundingBox(l.current,S,k),N.updateBoundingBoxPolygon(s.current,S,k),N.updateTransitionShape(f.current,S,k),N.updateClosestLinePointTransform(u.current,S,k),N.updateSelectBox(d.current,S,k),N.updatePointLine(x.current,S,k),N.updateDrawPreview(c.current,S,k,3),N.updateLineBox(y.current,S),h(S.transitionDirection),p(S.transitionRotate)},i);Le(()=>{g.setShape(r||null)},t),Le(()=>{let S=()=>{g.modifiers.reset()};return document.addEventListener("mouseleave",S),()=>{document.removeEventListener("mouseleave",S)}},[]);let v=ze(Ae,{children:[b("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:b("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),b("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:b("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),b("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:b("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),M=r?r.open?"polyline":"polygon":null,oe=!n.showBoundingBox&&n.closestPoint!==null&&n.actionIntentType==="select-point",Ke=n.actionIntentType==="add-open-point",Xe=n.transitionIntentType==="split-line",Q=n.transitioning&&n.selectedStamp&&n.transitionIntentType==="stamp-shape",Ye=r&&M?ze(Ae,{children:[b(M,{fill:!n.transitioning&&n.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:Q?0:2,stroke:a?"transparent":"#000",points:r.points.map(S=>S.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:n.showBoundingBox?void 0:"url(#dot)",markerMid:n.showBoundingBox?void 0:"url(#dot)",markerEnd:n.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),n.lineBoxMode&&n.actionIntentType==="close-line-box"?b("polygon",{fill:"rgba(255, 0, 0, .4)",ref:y,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,n.transitionIntentType==="draw-shape"&&n.transitioning?b("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!n.showBoundingBox&&n.selectedPoints&&n.selectedPoints.length?b("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:r.points.filter((S,k)=>n.selectedPoints?.includes(k)).map(S=>S.join(",")).join(" ")}):null,oe&&n.closestPoint!==null&&r.points[n.closestPoint]?b("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${r.points[n.closestPoint][0]},${r.points[n.closestPoint][1]}`}):null,!n.transitioning&&(n.actionIntentType==="add-open-point"||n.actionIntentType==="close-shape"||n.actionIntentType==="close-shape-line")?b("polyline",{stroke:"#000",ref:x,strokeWidth:n.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,n.hasClosestLine&&(!n.transitionIntentType||n.transitionIntentType==="split-line")?b("g",{ref:u,children:b("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,n.transitioning?b(M,{ref:f,fill:r.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:r.open?2:0}):null,n.transitioning&&n.transitionIntentType==="select-multiple-points"?b("rect",{ref:d,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,n.showBoundingBox?null:b("g",{name:"controls",children:!1}),n.showBoundingBox&&!Q?b("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:g,state:n,isAddingPoint:Ke,isSplitting:Xe,isStamping:Q,isHoveringPoint:oe,transitionDirection:C,transitionRotate:m,defs:v,editor:Ye}}import{useEffect as ee}from"react";import{createPortal as Nt}from"react-dom";import{Fragment as We,jsx as A,jsxs as Y}from"react/jsx-runtime";var Mt=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function De(e){let t=e.theme||Mt[0],o=Et(),{image:r}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:d,isSplitting:u,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:y}=qe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=n=>{i.pointer([[~~n.atlas.x,~~n.atlas.y]])};ee(()=>{let n=v=>{i.key.up(v.key)};return document.addEventListener("keyup",n),()=>{document.removeEventListener("keyup",n)}},[]),ee(()=>{let n=v=>{i.key.down(v.key)};return document.addEventListener("keydown",n),()=>{document.removeEventListener("keydown",n)}},[]),ee(()=>{let n=[];return d&&n.push(`atlas-cursor-${d}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&n.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&n.push("atlas-cursor-move"),x&&n.push("atlas-cursor-crosshair"),u&&n.push("atlas-cursor-copy"),c&&n.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&n.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...n),()=>{o?.canvas&&o.canvas.classList.remove(...n)}},[o?.canvas,x,f,u,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,d,c]);let h=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(i,l,h):null,p=document.getElementById(e.controlsHtmlId||"atlas-controls"),g="shape";return A(We,{children:Y("world-object",{height:r.height,width:r.width,onMouseMove:C,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?Y(We,{children:[A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.outer}),A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.inner})]}):null,Y(Tt,{relative:!0,interactive:!1,children:[A("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:Y("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r.width} ${r.height}`,tabIndex:-1,children:[A("defs",{children:a}),s]})}),p?Nt(m,p,"controls"):null]})]})})}import{jsx as Fe}from"react/jsx-runtime";function Di(e){let t=w(),o=e.annotationBucket,r=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=Te(e.id),l=Me(),d=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(r){let u="shape",c=e.polygon,f=c.open;return c?Fe(u,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:d}):null}return Fe(De,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useMemo as Bt,useState as Lt}from"react";import{ErrorBoundary as Ht}from"react-error-boundary";import{jsx as z,jsxs as zt}from"react/jsx-runtime";function Gi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:i,renderViewerControls:a,viewControlsDeps:s,fluid:l,x:d,y:u,...c}){let[f,x]=Lt(),y=t||ce,[C,h]=pe(),m=Bt(()=>{let g=h[e]?.status,n=C({id:e},{});return n?.height&&n.width&&g!=="loading"?{id:e,width:n.width,height:n.height,service:n,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:n.width,height:n.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:n.width,height:n.height}}}:null},[C,e,h]);if(U(f&&a?"overlay":"none",`canvas-portal-controls-${e}`,F.Provider,a&&m?{value:f||null,children:a({image:m,images:[m],type:"images"})}:{},[e,m,f,...s||[]]),!m||!m.height||!m.width)return null;let p=l?void 0:c.homePosition?c.homePosition.width/c.homePosition.height:m.width/m.height;return console.log("here",p),z(Ht,{resetKeys:[],fallbackRender:g=>z(y,{...c,...g}),children:z(me,{...c,aspectRatio:p,containerProps:{style:{position:"relative"},...c.containerProps||{}},onCreated:g=>{x(g),c.onCreated&&c.onCreated(g)},children:zt(F.Provider,{value:f,children:[z(ge,{image:m,id:m.id,isStatic:!o,x:d,y:u},m.id),z(At,{viewerPreset:f,renderViewerControls:a,image:m,src:e,viewControlsDeps:s}),i]})})})}function At({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:i}){return U(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,F.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...i||[]]),null}import{jsx as qt}from"react/jsx-runtime";function ea({annotation:e,children:t}){return qt(L,{value:{annotation:e},children:t})}import{jsx as Wt}from"react/jsx-runtime";function na({annotationPage:e,children:t}){return Wt(L,{value:{annotationPage:e},children:t})}import{jsx as Dt}from"react/jsx-runtime";function la({collection:e,children:t}){return Dt(L,{value:{collection:e},children:t})}function da(e,t={}){return O(t)}import{useCanvas as Ft}from"@atlas-viewer/atlas";import{useEffect as Ot,useMemo as te,useState as $t}from"react";function va({canvasId:e}={}){let t=Ft(),o=ie(),r=te(()=>e?[e]:t?[t.id]:o.map(u=>u.id),[e,t,o]),[i,a]=$t({}),s=le();Ot(()=>{let u=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",u),()=>{s.off("choice-change",u)}},[]);let l=te(()=>{let u=[];for(let c of r){let f=i[c];f&&u.push({canvasId:c,choice:f})}return u},[r,i]),d=te(()=>({makeChoice:(u,c)=>{s.emit("make-choice",{choiceId:u,...c})}}),[s]);return{choices:l,actions:d}}function Sa(e,t=!1){}function ka(e){let o=q().manifest,r=e?e.map(i=>typeof i=="string"?i:i?.id):[];return W(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let d of a?.items||[])r.indexOf(d.id)!==-1&&l.push(d);return l},[r.join("/")])}import{useMemo as Vt}from"react";function Ea(e,t=[]){let{id:o,selector:r}=e,i=q(),a=o||i.collection,s=W(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Vt(()=>{if(s)return r?r(s):s},[s,r,...t])}import{useEffect as Kt,useMemo as Xt}from"react";import{createEventsHelper as Yt}from"@iiif/helpers/events";function Ha(e,t,o,r,i=[]){let a=P(),s=Xt(()=>Yt(a),[a]);Kt(()=>{let l=e;return l?(s.addEventListener(l,t,o,r),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function Wa(e,t){let{id:o,isLoaded:r,error:i,resource:a,requestId:s,cached:l}=re(e,t);return{id:o,isLoaded:r,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Oe}from"@iiif/parser/image-3";import{useEffect as _t,useMemo as $e,useState as _}from"react";function Ve({cacheKey:e}={}){let t=w(),o=O(),r=P(),i=de(),a=fe(),[s,l]=_(void 0),[d,u]=_(!1),[c,f]=_("idle"),[x,y]=_(void 0),C=t?t.id:"undefined",h=$e(()=>{try{if(t&&o.length){let p=o[0],g=r.get(p.body[0]),v=Oe(g)[0];return v&&i(v,{width:v.width||t.width,height:v.height||t.height},!0)||void 0}}catch(p){console.error(p)}},[C,e,t]),m=c==="success"&&s?s:h;return _t(()=>{(async()=>{try{if(t&&o.length){let p=o[0],g=r.get(p.body[0]),v=Oe(g)[0];if(!v)return;u(!0),f("loading");try{let M=await a(v,{width:v.width||t.width,height:v.height||t.height})||void 0;l(M),f("success"),u(!1)}catch(M){f("error"),y(M)}}}catch(p){f("error"),y(p)}})()},[C,e]),$e(()=>({data:m,isFetching:d,status:c,error:x}),[m,d,c,x])}function Qa(){let e=Ve();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Qt}from"@iiif/helpers/styles";import{useMemo as Ut}from"react";function ja(){let e=P();return Ut(()=>Qt(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ea as AnnotationContext,na as AnnotationPageContext,mi as AnnotationStyleProvider,Mo as Auth,Io as AuthProvider,So as AuthRContext,bo as AuthReactContext,Co as AuthReactContextActions,nn as CanvasAnnotations,ne as CanvasContext,ve as CanvasPanel,xr as CanvasStrategyProvider,Sr as CanvasWorldObject,la as CollectionContext,vn as CombinedMetadata,Hr as ComplexTimelineProvider,Vo as ContextBridge,yr as ControlsReactContext,De as CreateCustomShape,Fo as CustomContextBridge,Oo as CustomContextBridgeProvider,Wo as EventsProvider,st as Image,Gi as ImageService,Dr as ImageServiceLoaderContext,Ho as InnerViewerProvider,Pr as LanguageProvider,Nr as LanguageString,B as LocaleString,ro as ManifestContext,Hn as ManifestMetadata,Yr as MediaPlayerProvider,V as Metadata,Di as PolygonSelector,io as RangeContext,qo as ReactEventContext,jt as ReactVaultContext,Or as Render3DModelStrategy,Gr as RenderAccompanyingCanvas,$r as RenderAnnotationStrategy,Ur as RenderAudioStrategy,zr as RenderComplexTimelineStrategy,br as RenderEmptyStrategy,Fr as RenderImageStrategy,Gn as RenderSvgEditorControls,qr as RenderTextualContentStrategy,Jr as RenderVideoStrategy,Zr as RenderYouTubeStrategy,L as ResourceProvider,Zt as ResourceReactContext,ni as SelectorControllerProvider,_n as SequenceThumbnails,Ao as SimpleViewerProvider,Lo as SimpleViewerReactContext,be as SingleCanvasThumbnail,gr as StrategyReactContext,Qr as ThumbnailFallbackImage,kr as TranslationProvider,wr as TransliterationProvider,eo as VaultProvider,F as ViewerPresetContext,_o as VirtualAnnotationProvider,no as VisibleCanvasReactContext,yo as authDetailsForResource,go as createAuthStateStore,ho as createProbe,zo as defaultEmitter,tr as emptyActions,nr as emptyStrategy,so as findAllCanvasesInRange,ao as findFirstCanvasFromRange,lo as findManifestSelectedRange,co as findSelectedRange,ir as flattenAnnotationPageIds,Cr as formatTime,lr as get3dStrategy,dr as getComplexTimelineStrategy,Ne as getDefaultAnnotationStyles,cr as getImageStrategy,uo as getManifestSequence,er as getParsedTargetSelector,fr as getRenderingStrategy,mr as getTextualContentStrategy,ur as getVideoStrategy,mo as getVisibleCanvasesFromCanvasId,po as hasAuth,xo as makeAccessServiceRequest,vo as makeAccessTokenRequest,jo as parseSpecificResource,Mt as svgThemes,or as unknownResponse,rr as unsupportedStrategy,Jo as useAnnotation,Zo as useAnnotationPage,ue as useAnnotationPageManager,Me as useAnnotationStyles,da as useAnnotationsAtTime,wo as useAuthActions,To as useAuthService,Po as useAuthStore,No as useAuthToken,Eo as useAuthTokens,w as useCanvas,va as useCanvasChoices,Sa as useCanvasClock,fo as useCanvasSequence,_r as useCanvasStartTime,ka as useCanvasSubset,Mr as useClosestLanguage,Ea as useCollection,Ar as useComplexTimeline,$o as useContextBridge,Lr as useCreateLocaleString,Ro as useCurrentAuth,Do as useCustomContextBridge,Ko as useDispatch,le as useEventEmitter,Ha as useEventListener,to as useExistingVault,Wa as useExternalCollection,oo as useExternalManifest,re as useExternalResource,Tr as useIIIFLanguage,G as useImage,Ve as useImageService,he as useImageServiceLoader,Qa as useImageTile,ko as useIsAuthEnabled,pe as useLoadImageService,Br as useLocaleString,D as useManifest,Kr as useMediaActions,Xr as useMediaElements,Vr as useMediaState,sr as usePaintables,O as usePaintingAnnotations,Be as usePolygonHelper,ae as useRange,vr as useRenderControls,pr as useRenderingStrategy,q as useResourceContext,Uo as useResourceEvents,ar as useResources,Bo as useSearchService,Ee as useSelectorController,ii as useSelectorEmitter,Te as useSelectorEvents,ai as useSelectorHelper,Ir as useSimpleMediaPlayer,se as useSimpleViewer,hr as useStrategy,ja as useStyleHelper,Go as useStyles,qe as useSvgEditor,ye as useThumbnail,Er as useTranslations,Rr as useTransliteration,P as useVault,Wr as useVaultEffect,W as useVaultSelector,Qo as useViewerPreset,Xo as useVirtualAnnotationPage,Yo as useVirtualAnnotationPageContext,ie as useVisibleCanvases};
|