react-iiif-vault 1.2.1 → 1.2.2
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 +53 -17
- package/dist/bundle.global.js +24 -24
- package/dist/canvas-panel.cjs +5 -5
- package/dist/canvas-panel.d.cts +3 -2
- package/dist/canvas-panel.d.ts +3 -2
- package/dist/canvas-panel.js +1 -1
- package/dist/chunk-RTYFQWUA.js +48 -0
- package/dist/{index-BZirmhnp.d.cts → index-DBIPIOrR.d.ts} +11 -6
- package/dist/{index-Cxs6aAuK.d.ts → index-ns1Yq6EJ.d.cts} +11 -6
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +32 -16
- package/dist/index.d.ts +32 -16
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-Xj9yQm4y.d.ts → useRenderingStrategy-D2R_H2aP.d.cts} +18 -2
- package/dist/{useRenderingStrategy-Xj9yQm4y.d.cts → useRenderingStrategy-D2R_H2aP.d.ts} +18 -2
- package/dist/utils.d.cts +2 -1
- package/dist/utils.d.ts +2 -1
- package/package.json +2 -2
- package/dist/chunk-K3CE2M2P.js +0 -48
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
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 { S as SimpleViewerContext, a as SimpleViewerProps } from './index-DBIPIOrR.js';
|
|
2
|
+
export { C as CanvasPanel, c as SimpleViewerActions, d as SimpleViewerActionsType, b as SimpleViewerReducerState } from './index-DBIPIOrR.js';
|
|
3
3
|
import * as React$1 from 'react';
|
|
4
4
|
import React__default, { ReactNode, FunctionComponent, RefObject } from 'react';
|
|
5
5
|
import * as react_jsx_runtime from 'react/jsx-runtime';
|
|
@@ -10,15 +10,15 @@ import { RenderState, InputShape, SlowState } from 'polygon-editor';
|
|
|
10
10
|
import { BoxStyle, Preset } from '@atlas-viewer/atlas';
|
|
11
11
|
import * as zustand_vanilla from 'zustand/vanilla';
|
|
12
12
|
import { StoreApi } from 'zustand/vanilla';
|
|
13
|
+
import * as mitt from 'mitt';
|
|
14
|
+
import { Emitter, EventType, Handler } from 'mitt';
|
|
13
15
|
import { Vault, VaultOptions, NormalizedEntity, IIIFStore } from '@iiif/helpers/vault';
|
|
14
16
|
import * as zustand from 'zustand';
|
|
15
17
|
import * as _iiif_helpers from '@iiif/helpers';
|
|
16
|
-
import { Paintables } from '@iiif/helpers';
|
|
18
|
+
import { Paintables, ComplexChoice } from '@iiif/helpers';
|
|
17
19
|
import { CanvasNormalized, AnnotationNormalized, AnnotationPageNormalized, CollectionNormalized, ManifestNormalized, RangeNormalized } from '@iiif/presentation-3-normalized';
|
|
18
|
-
import
|
|
19
|
-
|
|
20
|
-
import { R as RenderingStrategy } from './useRenderingStrategy-Xj9yQm4y.js';
|
|
21
|
-
export { e as AnnotationPageDescription, A as AudioSequence, C as ComplexTimelineStrategy, E as EmptyStrategy, j as ImageServiceLoaderType, I as ImageWithOptionalService, M as MediaStrategy, h as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, d as SingleYouTubeVideo, S as StrategyActions, T as TextualContentStrategy, U as UnknownStrategy, k as UseRenderingStrategy, l as UseRenderingStrategyOptions, V as VideoSequence, i as get3dStrategy, g as getImageStrategy, f as getTextualContentStrategy, u as useLoadImageService, m as useRenderingStrategy } from './useRenderingStrategy-Xj9yQm4y.js';
|
|
20
|
+
import { R as RenderingStrategy } from './useRenderingStrategy-D2R_H2aP.js';
|
|
21
|
+
export { e as AnnotationPageDescription, A as AudioSequence, l as ChoiceEvents, C as ComplexTimelineStrategy, E as EmptyStrategy, j as ImageServiceLoaderType, I as ImageWithOptionalService, M as MediaStrategy, h as Single3DModelStrategy, b as SingleAudio, a as SingleImageStrategy, c as SingleVideo, d as SingleYouTubeVideo, S as StrategyActions, T as TextualContentStrategy, U as UnknownStrategy, k as UseRenderingStrategy, m as UseRenderingStrategyOptions, V as VideoSequence, i as get3dStrategy, g as getImageStrategy, f as getTextualContentStrategy, u as useLoadImageService, n as useRenderingStrategy } from './useRenderingStrategy-D2R_H2aP.js';
|
|
22
22
|
export { emptyActions, emptyStrategy, getParsedTargetSelector, getRenderingStrategy, parseSpecificResource, unknownResponse, unsupportedStrategy } from './utils.js';
|
|
23
23
|
import { VaultZustandStore } from '@iiif/helpers/vault/store';
|
|
24
24
|
import * as _iiif_helpers_painting_annotations from '@iiif/helpers/painting-annotations';
|
|
@@ -404,9 +404,6 @@ declare const AuthReactContextActions: React$1.Context<AuthContextActions | null
|
|
|
404
404
|
declare function AuthProvider({ children }: {
|
|
405
405
|
children: ReactNode;
|
|
406
406
|
}): react_jsx_runtime.JSX.Element;
|
|
407
|
-
declare function AuthProvider_Old({ children }: {
|
|
408
|
-
children: ReactNode;
|
|
409
|
-
}): react_jsx_runtime.JSX.Element;
|
|
410
407
|
declare function useIsAuthEnabled(): boolean;
|
|
411
408
|
declare function useAuthStore(): StoreApi<AuthContextState & AuthContextCurrentActions & AuthContextActions>;
|
|
412
409
|
declare function useAuthActions(): {
|
|
@@ -422,11 +419,6 @@ declare function useCurrentAuth(): AuthContextState & AuthContextCurrentActions
|
|
|
422
419
|
declare function useAuthService(id: string): AuthAccessState | undefined;
|
|
423
420
|
declare function useAuthTokens(id?: string): string | undefined;
|
|
424
421
|
declare function useAuthToken(id: string): string | null;
|
|
425
|
-
declare function useCurrentAuth_old(): AuthContextState & AuthContextCurrentActions;
|
|
426
|
-
declare function useAuthService_old(id: string): AuthState | null;
|
|
427
|
-
declare function useAuthTokens_old(id?: string): string | null;
|
|
428
|
-
declare function useAuthToken_old(id?: string): string | null;
|
|
429
|
-
declare function useAuthActions_old(): AuthContextActions | null;
|
|
430
422
|
interface AuthProps<T, Extra> {
|
|
431
423
|
resource: T;
|
|
432
424
|
extra?: Extra;
|
|
@@ -453,6 +445,15 @@ declare function CollectionContext({ collection, children }: {
|
|
|
453
445
|
children: ReactNode;
|
|
454
446
|
}): react_jsx_runtime.JSX.Element;
|
|
455
447
|
|
|
448
|
+
interface EventContext {
|
|
449
|
+
emitter: Emitter<any>;
|
|
450
|
+
}
|
|
451
|
+
declare const defaultEmitter: Emitter<Record<EventType, unknown>>;
|
|
452
|
+
declare function useEventEmitter<Events extends Record<EventType, unknown>>(): Emitter<Events>;
|
|
453
|
+
declare function EventsProvider({ emitter, children }: EventContext & {
|
|
454
|
+
children: React__default.ReactNode;
|
|
455
|
+
}): react_jsx_runtime.JSX.Element;
|
|
456
|
+
|
|
456
457
|
declare function ManifestContext({ manifest, children }: {
|
|
457
458
|
manifest: string;
|
|
458
459
|
children: ReactNode;
|
|
@@ -725,6 +726,21 @@ declare function useCanvas<T>(options?: {
|
|
|
725
726
|
selector: (canvas: CanvasNormalized) => T;
|
|
726
727
|
}, deps?: any[]): T | undefined;
|
|
727
728
|
|
|
729
|
+
declare function useCanvasChoices({ canvasId }?: {
|
|
730
|
+
canvasId?: string;
|
|
731
|
+
}): {
|
|
732
|
+
choices: Array<{
|
|
733
|
+
canvasId: string;
|
|
734
|
+
choice: ComplexChoice;
|
|
735
|
+
}>;
|
|
736
|
+
actions: {
|
|
737
|
+
makeChoice: (id: string, options?: {
|
|
738
|
+
deselectOthers?: boolean;
|
|
739
|
+
deselect?: boolean;
|
|
740
|
+
}) => void;
|
|
741
|
+
};
|
|
742
|
+
};
|
|
743
|
+
|
|
728
744
|
declare function useCanvasClock(canvasId?: string, autoplay?: boolean): void;
|
|
729
745
|
|
|
730
746
|
declare function useCanvasSubset(idsOrRefs?: Array<string | Reference>): Reference<'Canvas'>[];
|
|
@@ -1050,4 +1066,4 @@ declare function findAllCanvasesInRange(vault: Vault, range: RangeNormalized): A
|
|
|
1050
1066
|
declare function findManifestSelectedRange(vault: Vault, manifest: ManifestNormalized, canvasId: string): null | RangeNormalized;
|
|
1051
1067
|
declare function findSelectedRange(vault: Vault, range: RangeNormalized, canvasId: string): null | RangeNormalized;
|
|
1052
1068
|
|
|
1053
|
-
export { AnnotationContext, AnnotationPageContext, AnnotationStyleProvider, type AnnotationStyles, type AnnotationThemeDefinition, Auth, type AuthAccessState, type AuthContextActions, type AuthContextCurrentActions, type AuthContextState, AuthProvider,
|
|
1069
|
+
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, ContextBridge, CreateCustomShape, type CreateCustomShapeProps, EventsProvider, Image, type ImageProps, ImageServiceLoaderContext, type ImageServiceRequestOptions, InnerViewerProvider, LanguageProvider, LanguageString, LocaleString, ManifestContext, ManifestMetadata, type MediaPlayerActions, MediaPlayerProvider, type MediaPlayerState, Metadata, type MetadataProps, PolygonSelector, type PolygonSelectorProps, type ProbeStore, RangeContext, ReactVaultContext, RenderSvgEditorControls, RenderingStrategy, type ResourceContextType, ResourceProvider, ResourceReactContext, type ResourceRequestOptions, SelectorControllerProvider, type SelectorHelperEventTypes, SequenceThumbnails, SimpleViewerContext, SimpleViewerProps, SimpleViewerProvider, SimpleViewerReactContext, SingleCanvasThumbnail, type SvgTheme, TranslationProvider, type VaultActivatedAnnotation, VaultProvider, ViewerPresetContext, VirtualAnnotationProvider, VisibleCanvasReactContext, authDetailsForResource, createAuthStateStore, createProbe, defaultEmitter, findAllCanvasesInRange, findFirstCanvasFromRange, findManifestSelectedRange, findSelectedRange, flattenAnnotationPageIds, formatTime, getDefaultAnnotationStyles, getManifestSequence, getVideoStrategy, getVisibleCanvasesFromCanvasId, hasAuth, makeAccessServiceRequest, makeAccessTokenRequest, svgThemes, useAnnotation, useAnnotationPage, useAnnotationPageManager, useAnnotationStyles, useAnnotationsAtTime, useAuthActions, useAuthService, useAuthStore, useAuthToken, useAuthTokens, useCanvas, useCanvasChoices, useCanvasClock, useCanvasSequence, useCanvasSubset, useClosestLanguage, useCollection, useContextBridge, useCreateLocaleString, useCurrentAuth, 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, useVault, useVaultEffect, useVaultSelector, useViewerPreset, useVirtualAnnotationPage, useVirtualAnnotationPageContext, useVisibleCanvases };
|
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as Co,A as Gt,Aa as Zo,B as Jt,Ba as D,C as Zt,Ca as jo,D as jt,Da as an,E as eo,Ea as sn,F as to,Fa as ie,G as oo,Ga as ln,H as no,Ha as cn,I as ro,Ia as mn,J as io,Ja as un,K as ao,Ka as dn,L as so,La as fn,M as lo,Ma as ae,N as co,O as mo,P as uo,Q as fo,R as go,S as po,T as ho,U as yo,V as vo,W as So,X as xo,Y as bo,Z as Io,_ as ne,a as Bt,aa as ko,b as z,ba as Po,c as B,ca as To,d as Lt,da as wo,e as Ht,ea as Ro,f as zt,fa as Eo,g as ee,ga as Mo,h as At,ha as T,i as qt,ia as No,j as te,ja as Bo,k as P,ka as Lo,l as A,la as Ho,m as Wt,ma as zo,n as Dt,na as Ao,o as q,oa as qo,p as Ft,pa as Wo,q as Ot,qa as Do,r as $t,ra as Fo,s as Vt,sa as Oo,t as Xt,ta as $o,u as Yt,ua as N,v as _t,va as Uo,w as oe,wa as re,x as Kt,xa as Go,y as Qt,ya as Jo,z as Ut,za as W}from"./chunk-K3CE2M2P.js";import{a as Vo,b as Xo,c as Yo,d as _o,e as Ko,f as Qo,g as en,h as tn,i as on,j as nn,k as rn}from"./chunk-DXFXJCXN.js";import{useCanvas as ze}from"@atlas-viewer/atlas";import{forwardRef as Ae,useImperativeHandle as qe}from"react";import{Fragment as We,jsx as se}from"react/jsx-runtime";var Sn=Ae(function({canvasId:t},o){let n=ze(),i=re(t||n?.id),a=P();return qe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:se(We,{children:i.enabledPageIds.map(s=>se(ae.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Oe}from"react";import{useMemo as De}from"react";import{Fragment as Fe,jsx as I,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:c="No value",emptyLabelFallback:f="",separator:u,tableFooter:v,tableHeader:S}){let h=De(()=>{let g=(t||[]).reduce((d,x)=>[...d,...x.keys],[]),m={};for(let d of e){let x=d&&d.label?Object.values(d.label):[];for(let r of x)if(r&&r.length&&(g.indexOf(`metadata.${r[0]}`)!==-1||g.length===0)&&d){let b=`metadata.${r[0]}`;m[b]=m[b]?m[b]:[],m[b].push(d);break}}return m},[t,e]);return Object.keys(h).length===0&&n?I(Fe,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[S,I("tbody",{children:t.map((g,m)=>{let d=[];for(let x of g.keys)for(let r of h[x]||[])d.push(I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:r.value},m+"__"+x));return d.length===0?null:F("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(N,{enableDangerouslySetInnerHTML:i,separator:u,defaultText:f,children:g.label})}),I("td",{className:s.value,children:d})]},m)})}),v]}):F("table",{className:s.container,children:[S,I("tbody",{children:e&&e.length?e.map((g,m)=>g?F("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:g.label})}),I("td",{className:s.value,children:I(N,{enableDangerouslySetInnerHTML:i,defaultText:c,separator:u,children:g.value})})]},m):null):null}),v]})}import{jsx as $e}from"react/jsx-runtime";function Bn(e){let t=q(),o=T(),n=oe(),i=Oe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return $e(O,{metadata:i,...e})}import{useEffect as _e,useState as Ke}from"react";import{createImageServiceRequest as Ve,imageServiceRequestToString as Xe}from"@atlas-viewer/iiif-image-api";import{useMemo as Ye}from"react";function Q(e,t={},o=[]){return Ye(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=Ve(e);return Xe({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 Qe(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ke(!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 _e(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ue,{...e,fetchImageService:!1})}function Ue(e){if(e.fetchImageService)return $(Qe,{...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 Ge}from"react/jsx-runtime";function Qn(e){let t=q();return Ge(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as tt,useRef as ot}from"react";import*as U from"react-lazy-load-image-component";import{getValue as Je}from"@iiif/helpers/i18n";import{Fragment as le,jsx as w,jsxs as et}from"react/jsx-runtime";var{LazyLoadComponent:Ze}=U||U.default;function ce(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,c=w(je,{...e}),f=w(Ze,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(te,{canvas:i,children:c}):c});return a?w("figure",{className:n?.figure,children:f}):f}function je({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,c=t?.height||t?.width||128,f=i||Je(s?.label)||"",u=ie({width:l,height:c},a);return!u||u.type!=="fixed"?w(le,{children:e}):et(le,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:u.id,alt:f})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function sr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=ot(null),{items:l,sequence:c,currentSequenceIndex:f,setSequenceIndex:u}=ne(),v={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};tt(()=>{if(!s.current)return;let h=s.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[f]);let S=[];for(let h of c){let C=[],g=c[f]===h;for(let m of h){let d=l[m];C.push(L("div",{className:g?v.item:o.item,children:L(ce,{classes:g?v:o,canvasId:d.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},m))}if(e){S.push(C);continue}S.push(L("div",{onClick:m=>{u(c.indexOf(h))},"data-selected":g,className:g?v.row:o.row,children:C}))}return L("div",{ref:s,className:o.container,children:S})}import{Fragment as me,jsx as R,jsxs as ue}from"react/jsx-runtime";var nt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function mr({helper:e,showShapes:t,state:o,enabled:n=nt,classNames:i={},icons:a={}}){return ue(me,{children:[t?ue(me,{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 rt,useCallback as de,useContext as ge,useEffect as fe,useMemo as G,useState as it}from"react";import pe from"mitt";import{jsx as at}from"react/jsx-runtime";var V=rt(pe());V.displayName="SelectorHelper";function vr({children:e}){return at(V.Provider,{value:G(()=>pe(),[]),children:e})}function Sr(){return ge(V)}function he(e){let t=ye(),[o,n]=it(!1);fe(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),fe(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=de(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=de(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function ye(){let e=ge(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 xr(){let e=ye();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 st,useContext as lt,useMemo as ct}from"react";import{jsx as mt}from"react/jsx-runtime";function ve(){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=st(ve());J.displayName="AnnotationStyle";function Se(){return lt(J)}function kr({theme:e,children:t}){let o=ct(()=>e||ve(),[e]);return mt(J.Provider,{value:o,children:t})}import{HTMLPortal as ht,useAtlas as yt}from"@atlas-viewer/atlas";import{useEffect as be,useRef as E,useState as Ie}from"react";import{useEffect as ut,useMemo as dt,useState as ft}from"react";import{createHelper as gt}from"polygon-editor";function xe(e,t,o){let[n,i]=ft({}),a=dt(()=>gt(e,o),[]);return ut(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as pt}from"polygon-editor";import{Fragment as Ce,jsx as y,jsxs as ke}from"react/jsx-runtime";var M=pt();function Pe(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),c=E(),f=E(),u=E(),v=E(),S=E(),h=E(),[C,g]=Ie(null),[m,d]=Ie(!1),{helper:x,state:r}=xe(n,(p,k)=>{M.updateTransitionBoundingBox(l.current,p,k),M.updateBoundingBoxPolygon(s.current,p,k),M.updateTransitionShape(v.current,p,k),M.updateClosestLinePointTransform(f.current,p,k),M.updateSelectBox(c.current,p,k),M.updatePointLine(S.current,p,k),M.updateDrawPreview(u.current,p,k,3),M.updateLineBox(h.current,p),g(p.transitionDirection),d(p.transitionRotate)},i);be(()=>{x.setShape(n||null)},t),be(()=>{let p=()=>{x.modifiers.reset()};return document.addEventListener("mouseleave",p),()=>{document.removeEventListener("mouseleave",p)}},[]);let b=ke(Ce,{children:[y("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),y("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),y("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:y("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,j=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Be=r.actionIntentType==="add-open-point",Le=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",He=n&&_?ke(Ce,{children:[y(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(p=>p.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"?y("polygon",{fill:"rgba(255, 0, 0, .4)",ref:h,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?y("polyline",{ref:u,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?y("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((p,k)=>r.selectedPoints?.includes(k)).map(p=>p.join(",")).join(" ")}):null,j&&r.closestPoint!==null&&n.points[r.closestPoint]?y("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")?y("polyline",{stroke:"#000",ref:S,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?y("g",{ref:f,children:y("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?y(_,{ref:v,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"?y("rect",{ref:c,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:y("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?y("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:x,state:r,isAddingPoint:Be,isSplitting:Le,isStamping:K,isHoveringPoint:j,transitionDirection:C,transitionRotate:m,defs:b,editor:He}}import{useEffect as Z}from"react";import{createPortal as vt}from"react-dom";import{Fragment as Te,jsx as H,jsxs as X}from"react/jsx-runtime";var St=[{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 we(e){let t=e.theme||St[0],o=yt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:c,isSplitting:f,transitionRotate:u,isHoveringPoint:v,isAddingPoint:S,isStamping:h}=Pe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=b=>{i.key.up(b.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=b=>{i.key.down(b.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return c&&r.push(`atlas-cursor-${c}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(v||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),S&&r.push("atlas-cursor-crosshair"),f&&r.push("atlas-cursor-copy"),u&&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,S,v,f,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,c,u]);let g=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(i,l,g):null,d=document.getElementById(e.controlsHtmlId||"atlas-controls"),x="shape";return H(Te,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:C,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Te,{children:[H(x,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.outer}),H(x,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:h?{}:t.inner})]}):null,X(ht,{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]})}),d?vt(m,d,"controls"):null]})]})})}import{jsx as Re}from"react/jsx-runtime";function jr(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=he(e.id),l=Se(),c=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let f="shape",u=e.polygon,v=u.open;return u?Re(f,{id:`shape-${i}`,points:u.points,open:v,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:c}):null}return Re(we,{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 xt}from"react/jsx-runtime";function ni({annotation:e,children:t}){return xt(B,{value:{annotation:e},children:t})}import{jsx as bt}from"react/jsx-runtime";function si({annotationPage:e,children:t}){return bt(B,{value:{annotationPage:e},children:t})}import{jsx as It}from"react/jsx-runtime";function ui({collection:e,children:t}){return It(B,{value:{collection:e},children:t})}function pi(e,t={}){return D(t)}function yi(e,t=!1){}function bi(e){let o=z().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return A(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let c of a?.items||[])n.indexOf(c.id)!==-1&&l.push(c);return l},[n.join("/")])}import{useMemo as Ct}from"react";function Ti(e,t=[]){let{id:o,selector:n}=e,i=z(),a=o||i.collection,s=A(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Ct(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as kt,useMemo as Pt}from"react";import{createEventsHelper as Tt}from"@iiif/helpers/events";function Ni(e,t,o,n,i=[]){let a=P(),s=Pt(()=>Tt(a),[a]);kt(()=>{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}=ee(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Ee}from"@atlas-viewer/iiif-image-api";import{useEffect as wt,useMemo as Me,useState as Y}from"react";function Ne({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,c]=Y(!1),[f,u]=Y("idle"),[v,S]=Y(void 0),h=t?t.id:"undefined",C=Me(()=>{try{if(t&&o.length){let m=o[0],d=n.get(m.body[0]),r=Ee(d)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(m){console.error(m)}},[h,e,t]),g=f==="success"&&a?a:C;return wt(()=>{(async()=>{try{if(t&&o.length){let m=o[0],d=n.get(m.body[0]),r=Ee(d)[0];if(!r)return;c(!0),u("loading");try{let b=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(b),u("success"),c(!1)}catch(b){u("error"),S(b)}}}catch(m){u("error"),S(m)}})()},[h,e]),Me(()=>({data:g,isFetching:l,status:f,error:v}),[g,l,f,v])}function Yi(){let e=Ne();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 Rt}from"@iiif/helpers/styles";import{useMemo as Et}from"react";function Gi(){let e=P();return Et(()=>Rt(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ni as AnnotationContext,si as AnnotationPageContext,kr as AnnotationStyleProvider,vo as Auth,no as AuthProvider,ro as AuthProvider_Old,eo as AuthRContext,to as AuthReactContext,oo as AuthReactContextActions,Sn as CanvasAnnotations,te as CanvasContext,ae as CanvasPanel,ui as CollectionContext,Bn as CombinedMetadata,ko as ContextBridge,we as CreateCustomShape,Ue as Image,Jo as ImageServiceLoaderContext,bo as InnerViewerProvider,Ao as LanguageProvider,Do as LanguageString,N as LocaleString,qt as ManifestContext,Qn as ManifestMetadata,fn as MediaPlayerProvider,O as Metadata,jr as PolygonSelector,Ft as RangeContext,Lt as ReactVaultContext,mr as RenderSvgEditorControls,B as ResourceProvider,Bt as ResourceReactContext,vr as SelectorControllerProvider,sr as SequenceThumbnails,Io as SimpleViewerProvider,xo as SimpleViewerReactContext,ce as SingleCanvasThumbnail,zo as TranslationProvider,Ht as VaultProvider,Eo as ViewerPresetContext,Ro as VirtualAnnotationProvider,Wt as VisibleCanvasReactContext,Jt as authDetailsForResource,Ut as createAuthStateStore,Gt as createProbe,Yo as emptyActions,Qo as emptyStrategy,$t as findAllCanvasesInRange,Ot as findFirstCanvasFromRange,Vt as findManifestSelectedRange,Xt as findSelectedRange,Uo as flattenAnnotationPageIds,ln as formatTime,en as get3dStrategy,ve as getDefaultAnnotationStyles,tn as getImageStrategy,_t as getManifestSequence,Xo as getParsedTargetSelector,rn as getRenderingStrategy,on as getTextualContentStrategy,nn as getVideoStrategy,Yt as getVisibleCanvasesFromCanvasId,Qt as hasAuth,jt as makeAccessServiceRequest,Zt as makeAccessTokenRequest,Vo as parseSpecificResource,St as svgThemes,_o as unknownResponse,Ko as unsupportedStrategy,Lo as useAnnotation,Ho as useAnnotationPage,re as useAnnotationPageManager,Se as useAnnotationStyles,pi as useAnnotationsAtTime,so as useAuthActions,yo as useAuthActions_old,co as useAuthService,go as useAuthService_old,ao as useAuthStore,uo as useAuthToken,ho as useAuthToken_old,mo as useAuthTokens,po as useAuthTokens_old,T as useCanvas,yi as useCanvasClock,Kt as useCanvasSequence,bi as useCanvasSubset,Fo as useClosestLanguage,Ti as useCollection,Co as useContextBridge,$o as useCreateLocaleString,lo as useCurrentAuth,fo as useCurrentAuth_old,Po as useDispatch,Ni as useEventListener,zt as useExistingVault,zi as useExternalCollection,At as useExternalManifest,ee as useExternalResource,qo as useIIIFLanguage,Q as useImage,Ne as useImageService,W as useImageServiceLoader,Yi as useImageTile,io as useIsAuthEnabled,Zo as useLoadImageService,Oo as useLocaleString,q as useManifest,un as useMediaActions,dn as useMediaElements,mn as useMediaState,jo as usePaintables,D as usePaintingAnnotations,xe as usePolygonHelper,oe as useRange,an as useRenderingStrategy,z as useResourceContext,No as useResourceEvents,Go as useResources,So as useSearchService,ye as useSelectorController,Sr as useSelectorEmitter,he as useSelectorEvents,xr as useSelectorHelper,cn as useSimpleMediaPlayer,ne as useSimpleViewer,Gi as useStyleHelper,Bo as useStyles,Pe as useSvgEditor,ie as useThumbnail,Wo as useTranslations,P as useVault,sn as useVaultEffect,A as useVaultSelector,Mo as useViewerPreset,To as useVirtualAnnotationPage,wo as useVirtualAnnotationPageContext,Dt as useVisibleCanvases};
|
|
1
|
+
import{$ as Ro,A as to,Aa as sn,B as oo,Ba as ln,C as no,Ca as le,D as ro,Da as cn,E as io,Ea as mn,F as ao,Fa as un,G as so,Ga as dn,H as lo,Ha as fn,I as co,Ia as gn,J as mo,Ja as ce,K as uo,L as fo,M as go,N as po,O as ho,P as yo,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ko,Y as Po,Z as To,_ as wo,a as Wt,aa as Eo,b as A,ba as T,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 zo,j as oe,ja as qo,k as P,ka as Wo,l as z,la as Do,m as Xt,ma as Fo,n as ne,na as Oo,o as q,oa as N,p as Yt,pa as Qo,q as _t,qa as ae,r as Kt,ra as Uo,s as Qt,sa as Go,t as Ut,ta as W,u as Gt,ua as Jo,v as Jt,va as D,w as re,wa as Zo,x as Zt,xa as rn,y as jt,ya as se,z as eo,za as an}from"./chunk-RTYFQWUA.js";import{a as $o,b as Vo,c as Xo,d as Yo,e as _o,f as Ko,g as jo,h as en,i as tn,j as on,k as nn}from"./chunk-DXFXJCXN.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 bn=De(function({canvasId:t},o){let n=We(),i=ae(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 y=$e(()=>{let p=(t||[]).reduce((g,b)=>[...g,...b.keys],[]),d={};for(let g of e){let b=g&&g.label?Object.values(g.label):[];for(let r of b)if(r&&r.length&&(p.indexOf(`metadata.${r[0]}`)!==-1||p.length===0)&&g){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(g);break}}return d},[t,e]);return Object.keys(y).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((p,d)=>{let g=[];for(let b of p.keys)for(let r of y[b]||[])g.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return g.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:p.label})}),C("td",{className:s.value,children:g})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((p,d)=>p?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:p.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function Ln(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 Un(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 lr({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 y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let y of u){let I=[],p=u[m]===y;for(let d of y){let g=l[d];I.push(L("div",{className:p?f.item:o.item,children:L(de,{classes:p?f:o,canvasId:g.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(y))},"data-selected":p,className:p?f.row:o.row,children:I}))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as ge}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 ur({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return ge(fe,{children:[t?ge(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 pe,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 xr({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function br(){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=pe(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=pe(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 Sr(){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 Pr({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 gt,useMemo as pt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=pt(()=>yt(e,o),[]);return gt(()=>(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(),y=E(),[I,p]=Pe(null),[d,g]=Pe(!1),{helper:b,state:r}=Ie(n,(h,k)=>{M.updateTransitionBoundingBox(l.current,h,k),M.updateBoundingBoxPolygon(s.current,h,k),M.updateTransitionShape(f.current,h,k),M.updateClosestLinePointTransform(m.current,h,k),M.updateSelectBox(u.current,h,k),M.updatePointLine(x.current,h,k),M.updateDrawPreview(c.current,h,k,3),M.updateLineBox(y.current,h),p(h.transitionDirection),g(h.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let h=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",h),()=>{document.removeEventListener("mouseleave",h)}},[]);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(h=>h.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:y,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((h,k)=>r.selectedPoints?.includes(k)).map(h=>h.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:y}=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 p=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,p):null,g=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:y?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}: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]})}),g?St(d,g,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function ei(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 ri({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function li({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function di({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function hi(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 Ci({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=se();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 ki(e,t=!1){}function Ri(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 Li(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 Wi(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 $i(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),y=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[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)}},[y,e,t]),p=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[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)}})()},[y,e]),Le(()=>({data:p,isFetching:l,status:m,error:f}),[p,l,m,f])}function Zi(){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 na(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ri as AnnotationContext,li as AnnotationPageContext,Pr as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,bn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,di as CollectionContext,Ln as CombinedMetadata,Io as ContextBridge,Me as CreateCustomShape,an as EventsProvider,Ze as Image,Go as ImageServiceLoaderContext,bo as InnerViewerProvider,Ao as LanguageProvider,Wo as LanguageString,N as LocaleString,Vt as ManifestContext,Un as ManifestMetadata,gn as MediaPlayerProvider,O as Metadata,ei as PolygonSelector,Yt as RangeContext,Dt as ReactVaultContext,ur as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,xr as SelectorControllerProvider,lr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,Ho as TranslationProvider,Ft as VaultProvider,Ro as ViewerPresetContext,wo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,rn as defaultEmitter,Xo as emptyActions,Ko as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,Qo as flattenAnnotationPageIds,cn as formatTime,jo as get3dStrategy,Se as getDefaultAnnotationStyles,en as getImageStrategy,Jt as getManifestSequence,Vo as getParsedTargetSelector,nn as getRenderingStrategy,tn as getTextualContentStrategy,on as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,$o as parseSpecificResource,Ct as svgThemes,Yo as unknownResponse,_o as unsupportedStrategy,Bo as useAnnotation,Lo as useAnnotationPage,ae as useAnnotationPageManager,Ce as useAnnotationStyles,hi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,Ci as useCanvasChoices,ki as useCanvasClock,Zt as useCanvasSequence,Ri as useCanvasSubset,Do as useClosestLanguage,Li as useCollection,Co as useContextBridge,Oo as useCreateLocaleString,fo as useCurrentAuth,ko as useDispatch,se as useEventEmitter,Wi as useEventListener,Ot as useExistingVault,$i as useExternalCollection,$t as useExternalManifest,te as useExternalResource,zo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,Zi as useImageTile,co as useIsAuthEnabled,Jo as useLoadImageService,Fo as useLocaleString,q as useManifest,dn as useMediaActions,fn as useMediaElements,un as useMediaState,Zo as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,sn as useRenderingStrategy,A as useResourceContext,Mo as useResourceEvents,Uo as useResources,vo as useSearchService,be as useSelectorController,br as useSelectorEmitter,xe as useSelectorEvents,Sr as useSelectorHelper,mn as useSimpleMediaPlayer,ie as useSimpleViewer,na as useStyleHelper,No as useStyles,Re as useSvgEditor,le as useThumbnail,qo as useTranslations,P as useVault,ln as useVaultEffect,z as useVaultSelector,Eo as useViewerPreset,Po as useVirtualAnnotationPage,To as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ChoiceDescription, Paintables, SupportedTarget } from '@iiif/helpers';
|
|
1
|
+
import { ChoiceDescription, Paintables, SupportedTarget, ComplexChoice } from '@iiif/helpers';
|
|
2
2
|
import { ImageService, ExternalWebResource, InternationalString } from '@iiif/presentation-3';
|
|
3
3
|
import { AnnotationPageNormalized, CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
4
4
|
import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
|
|
5
|
+
import { Emitter } from 'mitt';
|
|
5
6
|
|
|
6
7
|
type ImageWithOptionalService = {
|
|
7
8
|
id: string;
|
|
@@ -134,12 +135,27 @@ type StrategyActions = {
|
|
|
134
135
|
}) => void;
|
|
135
136
|
};
|
|
136
137
|
type UseRenderingStrategy = [RenderingStrategy, StrategyActions];
|
|
138
|
+
type ChoiceEvents = {
|
|
139
|
+
'choice-change': {
|
|
140
|
+
choice: ComplexChoice;
|
|
141
|
+
partOf: {
|
|
142
|
+
canvasId?: string;
|
|
143
|
+
manifestId?: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
'make-choice': {
|
|
147
|
+
choiceId: string;
|
|
148
|
+
deselectOthers?: boolean;
|
|
149
|
+
deselect?: boolean;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
137
152
|
type UseRenderingStrategyOptions = {
|
|
138
153
|
strategies?: Array<RenderingStrategy['type']>;
|
|
139
154
|
annotationPageManagerId?: string;
|
|
140
155
|
enableSingleAnnotation?: boolean;
|
|
141
156
|
defaultChoices?: string[];
|
|
157
|
+
emitter?: Emitter<ChoiceEvents>;
|
|
142
158
|
};
|
|
143
159
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
144
160
|
|
|
145
|
-
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type
|
|
161
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type ChoiceEvents as l, type UseRenderingStrategyOptions as m, useRenderingStrategy as n, useLoadImageService as u };
|
|
@@ -1,7 +1,8 @@
|
|
|
1
|
-
import { ChoiceDescription, Paintables, SupportedTarget } from '@iiif/helpers';
|
|
1
|
+
import { ChoiceDescription, Paintables, SupportedTarget, ComplexChoice } from '@iiif/helpers';
|
|
2
2
|
import { ImageService, ExternalWebResource, InternationalString } from '@iiif/presentation-3';
|
|
3
3
|
import { AnnotationPageNormalized, CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
4
4
|
import { BoxSelector, TemporalBoxSelector, TemporalSelector } from '@iiif/helpers/annotation-targets';
|
|
5
|
+
import { Emitter } from 'mitt';
|
|
5
6
|
|
|
6
7
|
type ImageWithOptionalService = {
|
|
7
8
|
id: string;
|
|
@@ -134,12 +135,27 @@ type StrategyActions = {
|
|
|
134
135
|
}) => void;
|
|
135
136
|
};
|
|
136
137
|
type UseRenderingStrategy = [RenderingStrategy, StrategyActions];
|
|
138
|
+
type ChoiceEvents = {
|
|
139
|
+
'choice-change': {
|
|
140
|
+
choice: ComplexChoice;
|
|
141
|
+
partOf: {
|
|
142
|
+
canvasId?: string;
|
|
143
|
+
manifestId?: string;
|
|
144
|
+
};
|
|
145
|
+
};
|
|
146
|
+
'make-choice': {
|
|
147
|
+
choiceId: string;
|
|
148
|
+
deselectOthers?: boolean;
|
|
149
|
+
deselect?: boolean;
|
|
150
|
+
};
|
|
151
|
+
};
|
|
137
152
|
type UseRenderingStrategyOptions = {
|
|
138
153
|
strategies?: Array<RenderingStrategy['type']>;
|
|
139
154
|
annotationPageManagerId?: string;
|
|
140
155
|
enableSingleAnnotation?: boolean;
|
|
141
156
|
defaultChoices?: string[];
|
|
157
|
+
emitter?: Emitter<ChoiceEvents>;
|
|
142
158
|
};
|
|
143
159
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
144
160
|
|
|
145
|
-
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type
|
|
161
|
+
export { type AudioSequence as A, type ComplexTimelineStrategy as C, type EmptyStrategy as E, type ImageWithOptionalService as I, type MediaStrategy as M, type RenderingStrategy as R, type StrategyActions as S, type TextualContentStrategy as T, type UnknownStrategy as U, type VideoSequence as V, type SingleImageStrategy as a, type SingleAudio as b, type SingleVideo as c, type SingleYouTubeVideo as d, type AnnotationPageDescription as e, getTextualContentStrategy as f, getImageStrategy as g, type Single3DModelStrategy as h, get3dStrategy as i, type ImageServiceLoaderType as j, type UseRenderingStrategy as k, type ChoiceEvents as l, type UseRenderingStrategyOptions as m, useRenderingStrategy as n, useLoadImageService as u };
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-
|
|
1
|
+
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-D2R_H2aP.cjs';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
5
5
|
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
6
6
|
import '@iiif/helpers/annotation-targets';
|
|
7
|
+
import 'mitt';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Parse specific resource.
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-
|
|
1
|
+
import { k as UseRenderingStrategy, R as RenderingStrategy, j as ImageServiceLoaderType } from './useRenderingStrategy-D2R_H2aP.js';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
5
5
|
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
6
6
|
import '@iiif/helpers/annotation-targets';
|
|
7
|
+
import 'mitt';
|
|
7
8
|
|
|
8
9
|
/**
|
|
9
10
|
* Parse specific resource.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "1.2.
|
|
3
|
+
"version": "1.2.2",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -60,7 +60,7 @@
|
|
|
60
60
|
"dependencies": {
|
|
61
61
|
"@atlas-viewer/atlas": "^2.2.4",
|
|
62
62
|
"@atlas-viewer/iiif-image-api": "^2.2.0",
|
|
63
|
-
"@iiif/helpers": "^1.2.
|
|
63
|
+
"@iiif/helpers": "^1.2.13",
|
|
64
64
|
"@iiif/parser": "^2.1.2",
|
|
65
65
|
"@iiif/presentation-2": "^1.0.4",
|
|
66
66
|
"@iiif/presentation-3": "^2.2.3",
|
package/dist/chunk-K3CE2M2P.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import{c as dt,k as ft}from"./chunk-DXFXJCXN.js";import{forwardRef as On,useImperativeHandle as Jo}from"react";import Jt,{useCallback as Ze,useMemo as Xt,useState as Ce}from"react";import{AtlasAuto as jr,ModeContext as Yr}from"@atlas-viewer/atlas";import{ErrorBoundary as Qr}from"react-error-boundary";import{useContext as re}from"react";import Dn,{useContext as Un,useMemo as _n}from"react";import{jsx as Bn}from"react/jsx-runtime";var qn={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Se=Dn.createContext(qn),k=()=>Un(Se);function q({value:e,children:n}){let t=k(),r=_n(()=>({...t,...e}),[e,t]);return Bn(Se.Provider,{value:r,children:n})}import $n,{useState as jn}from"react";import{Vault as mt,globalVault as Yn}from"@iiif/helpers/vault";import{jsx as pt}from"react/jsx-runtime";var $=$n.createContext({vault:null,setVaultInstance:e=>{}});function G({vault:e,vaultOptions:n,useGlobal:t,resources:r,children:o}){let[i,a]=jn(()=>e||(t?Yn(n):n?new mt(n):new mt));return pt($.Provider,{value:{vault:i,setVaultInstance:a},children:pt(q,{value:r||{},children:o})})}import{useContext as Pr}from"react";import{createContext as Rr,useMemo as Ir}from"react";import{globalVault as Qn}from"@iiif/helpers/vault";import{useContext as Wn}from"react";function Z(e){let n=Wn($);return e||(n&&n.vault?n.vault:Qn())}import{useEffect as Gn,useMemo as Zn,useState as Fe}from"react";function gt(e,{noCache:n=!1}={}){let t=typeof e=="string"?e:e.id,r=Z(),[o,i]=Fe(t),[a,s]=Fe(void 0),u=Zn(()=>r.get(t,{skipSelfReturn:!0})||void 0,[t,r]),[c,l]=Fe(u);return Gn(()=>{(async()=>{try{let f=u&&!n?u:await r.load(t),d=f?f.id||f["@id"]:null;f&&o!==d&&i(d),l(f)}catch(f){s(f)}})()},[t,n]),{isLoaded:!!c,id:o,requestId:t,error:a,resource:c,cached:!!(c&&c===u)}}function ht(e,n){let{id:t,isLoaded:r,error:o,resource:i,requestId:a,cached:s}=gt(e,n);return{id:t,isLoaded:r,error:o,manifest:i,requestId:a,cached:s}}import{jsx as Kn}from"react/jsx-runtime";function vt({manifest:e,children:n}){return Kn(q,{value:{manifest:e},children:n})}import{jsx as Jn}from"react/jsx-runtime";function K({canvas:e,children:n}){return Jn(q,{value:{canvas:e},children:n})}import{useContext as nr}from"react";import rr from"react";import{useContext as Xn}from"react";var y=()=>{let{vault:e}=Xn($);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};import{useEffect as er,useState as tr}from"react";function S(e,n=[]){let t=y(),[r,o]=tr(()=>e(t.getState(),t));return er(()=>t.subscribe(i=>e(i,t),i=>{o(i)},!1),n),r}var J=rr.createContext([]);function Ae(){let e=nr(J);return S(n=>e.map(t=>n.iiif.entities.Canvas[t]).filter(Boolean),[e])}import{useMemo as or}from"react";function w(e={},n=[]){let{id:t,selector:r}=e,o=k(),i=y(),a=t||o.manifest,s=S(u=>a?u.iiif.entities.Manifest[a]:void 0,[a]);return or(()=>{if(s)return r?r(s):s},[s,r,...n])}import{jsx as ir}from"react/jsx-runtime";function yt({range:e,children:n}){return ir(q,{value:{range:e},children:n})}function ar(e,n){for(let t of n.items){if(t.type==="Canvas")return t;if(t.type==="SpecificResource")return t.source;if(t.type==="Range"){let r=ar(e,e.get(t));if(r)return r}}return null}function He(e,n){let t=[];for(let r of n.items)if(r.type==="SpecificResource"&&r.source?.type==="Canvas"&&(r.source.id.indexOf("#")!==-1?t.push({id:r.source.id.split("#")[0],type:"Canvas"}):t.push(r.source)),r.type==="Range"&&t.push(...He(e,e.get(r))),r.type==="SpecificResource"){let o=typeof r.source=="string"?r.source:r.source.id;t.push({id:o,type:"Canvas"})}return t}function Zi(e,n,t){for(let r of n.structures){let o=St(e,e.get(r),t);if(o)return o}return null}function St(e,n,t){for(let r of n.items){let o=r?.source?.id?.split("#")[0];if(r.type==="SpecificResource"&&r.source===t||r.type==="SpecificResource"&&r.source?.type==="Canvas"&&t===o)return n;if(r.type==="Range"){let i=St(e,e.get(r),t);if(i)return i}}return null}function Xi(e,n,t,r=!1){let o=n.behavior,i=t?e.get(t):null;if(!i)return[];let a=i.behavior,s=r?!1:o.includes("paged"),u=s?!1:o.includes("continuous"),c=s||u?!1:o.includes("individuals"),l=a.includes("facing-pages"),f=a.includes("non-paged");if(l||f||c||r)return[{id:i.id,type:"Canvas"}];let[d,v]=De(e,n);if(u)return d;let m=d.findIndex(p=>p.id===t);if(m===-1)return[];for(let p of v)if(p.includes(m))return p.map(g=>d[g]);return[{id:i.id,type:"Canvas"}]}function De(e,n,{disablePaging:t,skipNonPaged:r}={}){let o=n.behavior,i=o.includes("paged"),a=i?!1:o.includes("continuous"),s=i||a?!1:o.includes("individuals"),u=n.type==="Manifest"?n.items:He(e,n);if(a)return[u,[u.map((m,p)=>p)]];if(s||!i||t)return[u,u.map((m,p)=>[p])];let c=[],l=[],f=()=>{l.length&&(c.push([...l]),l=[])},d=0,v=!1;for(let m=0;m<u.length;m++){let p=e.get(u[m]);if(p.behavior.includes("non-paged")){m===d&&d++,r||(f(),c.push([m]),f());continue}if(m===d||p.behavior.includes("facing-pages")){l.length&&(v=!0),f(),c.push([m]),f();continue}if(l.push(m),v){f(),v=!1;continue}l.length>1&&f()}return l.length&&f(),[u,c]}import{useCallback as xe,useMemo as ur,useRef as cr,useState as lr}from"react";import{useMemo as sr}from"react";function At(e={},n=[]){let{id:t,selector:r}=e,o=k(),i=t||o.range,a=S(s=>i?s.iiif.entities.Range[i]:void 0,[i]);return sr(()=>{if(a)return r?r(a):a},[a,r,...n])}function xt({startCanvas:e,disablePaging:n}){let t=y(),r=w(),o=At(),[i,a]=lr(void 0),s=o||r;if(!s)throw new Error("Nothing selected");let[u,c]=ur(()=>De(t,s,{disablePaging:n}),[t,s,n]),l=cr(c);if(l.current!==c){let g=l.current[i][0],A=c.findIndex(U=>U.includes(g));l.current=c,a(A)}let f=xe(p=>{let g=c.findIndex(A=>A.includes(p));a(g===-1?0:g)},[u,c]),d=xe(p=>{let g=u.findIndex(A=>A.id===p);g!==-1?f(g):a(0)},[u,c]),v=xe(()=>{a(p=>p>=c.length-1?p:p+1)},[c]),m=xe(()=>{a(p=>p<=0?0:p-1)},[c]);return typeof i>"u"&&(e?d(e):a(0)),{visibleItems:c[i]?.map(p=>u[p].id)||[],cursor:i,items:u,sequence:c,hasPrevious:i>0,hasNext:i<c.length-1,setSequenceIndex:a,setCanvasIndex:f,setCanvasId:d,next:v,previous:m}}import{createContext as qe,useContext as Q,useEffect as fr,useMemo as _e,useReducer as mr}from"react";import{useEffect as wt,useMemo as Mt}from"react";import{createStore as Ct}from"zustand/vanilla";function fa(e){let n=e.service||e.services||[];for(let t of n)if(t.type==="AuthProbeService2")return!0;return!1}function E(e,n,t){let r=n.findIndex(a=>a.service.id===e);if(r===-1)return n;let o=[...n],i=t(o[r]);return i===o[r]?n:(o[r]=i,o)}var bt=()=>Ct((e,n)=>({currentAuth:-1,authItems:[],login:()=>{let t=n().authItems[n().currentAuth];if(!t||t.isPending||t.isLoggedIn)return;if(t.type!=="active")throw new Error("Cannot login to non-active service");let r=t.service.service.find(o=>o.type==="AuthAccessTokenService2");if(!r)throw new Error("Token service not found");e(()=>({authItems:E(t.id,n().authItems,o=>({...o,isPending:!0}))})),ue(t.service).then(()=>{j(r).then(o=>{let i=o.expiresIn,a=Date.now()+i*1e3;e(()=>({authItems:E(t.id,n().authItems,s=>({...s,isLoggedIn:!0,isPending:!1,session:{token:o.accessToken,expires:a}}))}))}).catch(o=>{e(()=>({authItems:E(t.id,n().authItems,i=>({...i,isLoggedIn:!1,isPending:!1,error:o.message}))}))})})},logout:()=>{let t=n().authItems[n().currentAuth];if(!t||t.isPending||!t.isLoggedIn)return;if(t.type!=="active")throw new Error("Cannot logout of non-active service");let r=t.service.service.find(a=>a.type==="AuthLogoutService2");if(!r)return;let o=`${r.id}?origin=${It()}`,i=window.open(o);e(()=>({authItems:E(t.id,n().authItems,a=>({...a,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let t=n().authItems.length,r=n().currentAuth+1;r>=t||e(()=>({currentAuth:r}))},previousAuth:()=>{let t=n().currentAuth-1;t<0||e(()=>({currentAuth:t}))},setAuth:t=>{t!==-1&&(t<0||t>=n().authItems.length)||e(()=>({currentAuth:t}))},addService:(t,r)=>{if(!t.service)return;let o=t.service.find(s=>s.type==="AuthAccessTokenService2"),i=t;if(n().authItems.find(s=>s.service.id===t.id)){e(()=>({authItems:E(t.id,n().authItems,s=>({...s,instances:s.instances+1}))}));return}if(e(()=>({currentAuth:i.profile==="active"?0:n().currentAuth,authItems:[{id:t.id,type:t.profile,service:t,probeId:r,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...n().authItems]})),t.profile==="external"){if(!o)throw new Error("Token service not found");j(o).then(s=>{e(()=>({authItems:E(t.id,n().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:s.accessToken,expires:s.expiresIn}}))}))}).catch(s=>{e(()=>({authItems:E(t.id,n().authItems,u=>({...u,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:s.message}))}))})}if(t.profile==="kiosk"){if(!o)throw new Error("Token service not found");e(()=>({authItems:E(t.id,n().authItems,s=>({...s,isPending:!0}))})),ue(i).then(()=>{j(o).then(s=>{e(()=>({authItems:E(t.id,n().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:s.accessToken,expires:s.expiresIn}}))}))}).catch(s=>{e(()=>({authItems:E(t.id,n().authItems,u=>({...u,isLoggedIn:!1,isPending:!1,error:s.message}))}))})})}t.profile},removeService:(t,r)=>{let o=n().currentAuth===n().authItems.findIndex(a=>a.service.id===t.id),i=n().currentAuth;if(o){let a=n().authItems.find(u=>u.service.id===t.id);a&&a.instances>1||(i=n().authItems.findIndex(c=>c.service.id!==t.id&&c.instances>0))}e(()=>({authItems:E(t.id,n().authItems,a=>({...a,instances:a.instances-1})),currentAuth:i}))}})),Pt=(e,n)=>Ct((t,r)=>({service:e,status:e?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:n||null,async probe(){if(!r().service)return;let o=r().service?.id;if(!o){t({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}t({status:"probing"});let i=r().token;try{let a=await fetch(o,{headers:i?{Authorization:`Bearer ${r().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(s=>s.json());if(a.status===200)t({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(a.status<400&&a.status>=300){if(!a.location)throw new Error("Redirect location not found");t({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:a.location||null})}else if(a.status===401)t({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!a.substitute,substituteResource:a.substitute||null,error:"Unauthorized",errorHeading:a.heading||{en:["Unauthorized"]},errorNote:a.note||null});else throw new Error("Unknown error")}catch(a){t({status:"error",error:a.message,errorHeading:{en:["Unknown error"]}})}},setToken(o){t({token:o})}}));function Rt(e){let n=e.service||e.services||[],t={hasAuth:!1,services:{}};for(let r of n)if(r.type==="AuthProbeService2"){t.services.probe=r,t.hasAuth=!0;let o=r.service.filter(i=>i.type==="AuthAccessService2");o[0]&&(t.services.access=o[0])}return t}async function j(e,{strict:n=!0}={}){return new Promise((t,r)=>{let o=Math.random().toString(36).substring(7),i=`${e.id}?messageId=${o}&origin=${window.location.origin}`,a=c=>{let l=c.data;if(l.messageId===o){if(n&&l.type!=="AuthAccessToken2"){s(),r("Invalid response, expected type=AuthAccessToken2");return}if(!l.accessToken){s(),r("Invalid response, expected accessToken");return}s(),t(l)}},s=()=>window.removeEventListener("message",a),u=document.createElement("iframe");u.src=i,u.style.display="none",document.body.appendChild(u),window.addEventListener("message",a)})}function It(e){let n=window.location;if(e){let t=document.createElement("a");return t.href=e,t.protocol+"//"+t.hostname+(t.port?":"+t.port:"")}return n.protocol+"//"+n.hostname+(n.port?":"+n.port:"")}async function ue(e){let n=`${e.id}?origin=${It()}`,t=window.open(n);if(!t)throw new Error("Failed to open window");return new Promise((r,o)=>{let i=setInterval(()=>{t.closed&&(clearInterval(i),r())},500)})}import{useStore as dr}from"zustand";function Tt(e){let n=Mt(()=>Rt(e),[e]),t=Vt(n.services.access?.id),r=Mt(()=>Pt(n.services.probe,t),[n.services.probe]),o=dr(r);return wt(()=>{o.status==="unknown"&&!t&&o.probe()},[n.services.probe,o.status]),wt(()=>{t&&(o.setToken(t),o.probe())},[t]),[e,o,n.hasAuth]}import{useStore as ce}from"zustand";import{jsx as X}from"react/jsx-runtime";var ee=qe(null),te=qe(null);te.displayName="CurrentAuth";var Be=qe(null);Be.displayName="AuthActions";function Y(e,n,t){let r=n.authItems.findIndex(a=>a.service.id===e);if(r===-1)return n;let o=[...n.authItems],i=t(o[r]);return i===o[r]?n:(o[r]=i,{...n,authItems:o})}function pr(e,n){switch(n.type){case"login.start":return Y(n.payload.id,e,t=>({...t,isPending:!0}));case"login.success":return Y(n.payload.id,e,t=>({...t,isLoggedIn:!0,isPending:!1,session:{token:n.payload.token,expires:n.payload.expires}}));case"login.error":return Y(n.payload.id,e,t=>({...t,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:n.payload.error}));case"session.expire":return Y(n.payload.id,e,t=>({...t,isPending:!1,isLoggedIn:!1,session:null}));case"logout":return Y(n.payload.id,e,t=>({...t,isLoggedIn:!1,session:null,isPending:!1}));case"service.add":return e.authItems.find(r=>r.service.id===n.payload.service.id)?Y(n.payload.service.id,e,r=>({...r,instances:r.instances+1})):{...e,currentAuth:n.payload.service.profile==="active"?0:e.currentAuth,authItems:[{id:n.payload.service.id,type:n.payload.service.profile,service:n.payload.service,probeId:n.payload.probeId,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...e.authItems]};case"service.remove":{let t=e.currentAuth===e.authItems.findIndex(o=>o.service.id===n.payload.id),r=e.currentAuth;if(t){let o=e.authItems.find(a=>a.service.id===n.payload.id);o&&o.instances>1||(r=e.authItems.findIndex(s=>s.service.id!==n.payload.id&&s.instances>0))}return{...Y(n.payload.id,e,o=>({...o,instances:o.instances-1})),currentAuth:r}}case"list.next":{let t=e.authItems.length,r=e.currentAuth+1;return r>=t?e:{...e,currentAuth:r}}case"list.previous":{let t=e.currentAuth-1;return t<0?e:{...e,currentAuth:t}}case"list.set":return n.payload!==-1&&(n.payload<0||n.payload>=e.authItems.length)?e:{...e,currentAuth:n.payload};default:return e}}function Nt({children:e}){let n=_e(()=>bt(),[]);return X(ee.Provider,{value:n,children:e})}function Va({children:e}){let[n,t]=mr(pr,{currentAuth:-1,authItems:[]}),r=(d,v)=>{if(!d.service)return;let m=d.service.find(g=>g.type==="AuthAccessTokenService2"),p=d;if(t({type:"service.add",payload:{service:d,probeId:v}}),d.profile==="external"){if(!m)throw new Error("Token service not found");j(m).then(g=>{t({type:"login.success",payload:{id:d.id,token:g.accessToken,expires:g.expiresIn}})}).catch(g=>{t({type:"login.error",payload:{id:d.id,error:g.message}})})}if(d.profile==="kiosk"){if(!m)throw new Error("Token service not found");t({type:"login.start",payload:{id:d.id}}),ue(p).then(()=>{j(m).then(g=>{t({type:"login.success",payload:{id:d.id,token:g.accessToken,expires:g.expiresIn}})}).catch(g=>{t({type:"login.error",payload:{id:d.id,error:g.message}})})}).catch(g=>{t({type:"login.error",payload:{id:d.id,error:g.message}})})}d.profile},o=d=>{t({type:"service.remove",payload:d})},i=()=>{let d=n.authItems[n.currentAuth];if(!d||d.isPending||d.isLoggedIn)return;if(d.type!=="active")throw new Error("Cannot login to non-active service");let v=d.service.service.find(m=>m.type==="AuthAccessTokenService2");if(!v)throw new Error("Token service not found");t({type:"login.start",payload:{id:d.id}}),ue(d.service).then(()=>{j(v).then(m=>{let p=m.expiresIn,g=Date.now()+p*1e3;t({type:"login.success",payload:{id:d.id,token:m.accessToken,expires:g}})}).catch(m=>{t({type:"login.error",payload:{id:d.id,error:m.message}})})})},a=()=>{let d=n.authItems[n.currentAuth];if(!d||d.isPending||!d.isLoggedIn)return;if(d.type!=="active")throw new Error("Cannot logout of non-active service");let v=d.service.service.find(g=>g.type==="AuthLogoutService2");if(!v)return;let m=`${v.id}?origin=${window.location.origin}`,p=window.open(m);t({type:"logout",payload:{id:d.id}})},s=()=>{},u=()=>{},c=d=>{},l=_e(()=>({addService:r,removeService:o}),[]),f=_e(()=>({...n,login:i,logout:a,nextAuth:s,previousAuth:u,setAuth:c}),[n]);return X(te.Provider,{value:f,children:X(Be.Provider,{value:l,children:e})})}function kt(){return!!Q(ee)}function le(){let e=Q(ee);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function gr(){let e=le();return ce(e,t=>({login:t.login,logout:t.logout,nextAuth:t.nextAuth,previousAuth:t.previousAuth,setAuth:t.setAuth,addService:t.addService,removeService:t.removeService}))}function Na(){let e=le();return ce(e,n=>n)}function hr(e){let n=le();return ce(n,r=>r.authItems.find(o=>o.service.id===e))}function Vt(e){let n=le();return ce(n,r=>r.authItems.find(o=>o.id===e)?.session?.token)}function ka(e){let n=le();return ce(n,r=>{let o=r.authItems.find(i=>i.service.id===e);return!o||!o.isLoggedIn||!o.session?null:o.session?.token||null})}function Ea(){let e=Q(te);if(!e)throw new Error("useCurrentAuth must be used within a AuthProvider");return e}function La(e){let n=Q(te);return n&&n.authItems.find(t=>t.service.id===e)||null}function za(e){let n=Q(te);return!n||!e?null:n.authItems.find(t=>t.id===e)?.session?.token||null}function Oa(e){let n=Q(te);if(!e||!n)return null;let t=n.authItems.find(r=>r.service.id===e);return!t||!t.isLoggedIn||!t.session?null:t.session?.token||null}function Fa(){return Q(Be)}function vr(e){let n=gr(),t=hr(e.service.id);return fr(()=>(n?.addService(e.service,e.probeId),()=>{n?.removeService(e.service,e.probeId)}),[e.service]),t?(t.error||!t.isLoggedIn,e.children):null}function Ue(){return null}function Et(e){let[n,t,r]=Tt(e.resource),o=e.fallbackComponent||Ue,i=e.loadingComponent||Ue,a=e.errorComponent||Ue,s=t.service,u=null;if(!r||!s)return e.children(n);let c=s.service.filter(l=>l.type==="AuthAccessService2");t.status==="error"&&(u=X(a,{resource:e.resource,error:t.error||"",heading:t.errorHeading,note:t.errorNote,extra:e.extra})),(t.status==="unknown"||t.status==="probing")&&(u=X(i,{})),t.status==="success"&&(u=e.children(n));for(let l of c)u=X(vr,{service:l,probeId:s.id,children:u},l.id);return u}import{createContext as xr,useContext as Ya,useMemo as Cr}from"react";import{createStore as yr}from"zustand/vanilla";var Sr=e=>e.id||e["@id"];function Ar(e){return(Array.isArray(e.service)?e.service:[e.service]).find(t=>t.profile==="http://iiif.io/api/search/0/autocomplete"||t.profile==="http://iiif.io/api/search/1/autocomplete"||t.profile==="AutoCompleteService1")}var Lt=e=>{let n;typeof e=="string"?n={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":e,id:e,service:[]}:n=e;let t=n?Sr(n):void 0,r=null;return yr((o,i)=>({service:n,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!n,hasAutocomplete:n?!!Ar(n):!1,errorMessage:"",search(a,s={}){if(!t)throw new Error("No search service found.");r&&!r.signal.aborted&&r.abort(),r=new AbortController;let u=new URLSearchParams;a.q&&u.set("q",a.q),a.motivation&&u.set("motivation",a.motivation),a.date&&u.set("date",a.date),a.user&&u.set("user",a.user),o({loading:!0}),fetch(`${t}?${u.toString()}`,{signal:r.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...s.headers||{}}}).then(async c=>{if(!r?.signal.aborted)if(c.ok){let l=await c.json();o({resources:l.resources,error:!1,errorMessage:""})}else o({resources:[],error:!0,errorMessage:c.statusText})})},clearSearch(){o({resources:[],error:!1,errorMessage:""})},highlightResult(a){let s=i().resources.find(u=>u["@id"]===a);o({highlight:s})},nextResult(){let a=i().resources,s=i().highlight;if(!s){o({highlight:a[0]||null});return}let u=a.findIndex(c=>c["@id"]===s["@id"]);if(u===-1){o({highlight:a[0]||null});return}o({highlight:a[u+1]||a[0]||null})},previousResult(){let a=i().resources,s=i().highlight;if(!s){o({highlight:a[a.length-1]||null});return}let u=a.findIndex(c=>c["@id"]===s["@id"]);if(u===-1){o({highlight:a[a.length-1]||null});return}if(u===0){o({highlight:a[a.length-1]||null});return}o({highlight:a[u-1]||a[a.length-1]||null})}}))};import{useStore as Ka}from"zustand";function zt(){let e=w();return e?e.service.find(n=>n.profile==="SearchService1"||n.profile==="http://iiif.io/api/search/1/search"):void 0}import{jsx as $e}from"react/jsx-runtime";var ne=xr(null);ne.displayName="Search";function Ot(e){let n=zt();return e.store?$e(ne.Provider,{value:e.store,children:e.children}):$e(br,{service:n,children:e.children})}function br({service:e,children:n}){let t=Cr(()=>Lt(e),[e]);return $e(ne.Provider,{value:t,children:n})}import{jsx as T}from"react/jsx-runtime";var de=()=>{},fe=Rr({setCurrentCanvasId:de,setCurrentCanvasIndex:de,nextCanvas:de,previousCanvas:de,items:[],sequence:[],setSequenceIndex:de,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function wr(e){let n=w(),{cursor:t,visibleItems:r,next:o,sequence:i,items:a,setCanvasIndex:s,setCanvasId:u,previous:c,setSequenceIndex:l,hasNext:f,hasPrevious:d}=xt({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),v=Ir(()=>({sequence:i,items:a,setCurrentCanvasId:u,nextCanvas:o,previousCanvas:c,totalCanvases:a.length,setCurrentCanvasIndex:s,setSequenceIndex:l,currentSequenceIndex:t,hasNext:f,hasPrevious:d}),[i,a,u,o,c,a,s,l,t]);return n?r.length===0?null:T(fe.Provider,{value:v,children:T(J.Provider,{value:r,children:T(K,{canvas:r[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),T("div",{children:"Sorry, something went wrong."}))}function Ft(e){let n=Z(e.vault),t=ht(e.manifest);if(!t)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),T("div",{children:"Sorry, something went wrong."});if(t.error)return T("div",{children:t.error.toString()});if(!t.isLoaded)return T("div",{children:"Loading..."});let r=T(wr,{...e,children:e.children});return T(G,{vault:n,children:T(vt,{manifest:t.id,children:T(Nt,{children:T(Ot,{children:e.rangeId?T(yt,{range:e.rangeId,children:r}):r})})})})}function Ht(){return Pr(fe)}import{jsx as me}from"react/jsx-runtime";function Dt(){return{VaultContext:re($),ResourceContext:re(Se),SimpleViewerReactContext:re(fe),VisibleCanvasReactContext:re(J),AuthRContext:re(ee),SearchReactContext:re(ne)}}function Ut(e){return me(G,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:me(J.Provider,{value:e.bridge.VisibleCanvasReactContext,children:me(fe.Provider,{value:e.bridge.SimpleViewerReactContext,children:me(ee.Provider,{value:e.bridge.AuthRContext,children:me(ne.Provider,{value:e.bridge.SearchReactContext,children:e.children})})})})})}import{createContext as kr,useContext as Er,useMemo as Lr}from"react";import{useCallback as qt,useLayoutEffect as Tr,useMemo as Vr,useRef as Nr}from"react";import{entityActions as je}from"@iiif/helpers/vault/actions";import{useMemo as Mr}from"react";function _t(){let n=y().getStore();return Mr(()=>t=>n.dispatch(t),[n])}function Bt(e){return typeof e!="string"&&e&&e.bindToVault}function $t(){let e=y(),n=Nr([]),t=_t(),r=Vr(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);Tr(()=>{let s={id:r,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};t(je.importEntities({entities:{AnnotationPage:{[s.id]:s}}}))},[r]);let o=S(s=>r&&s.iiif.entities.AnnotationPage[r]||null,[r]),i=qt((s,u)=>{if(r){if(Bt(s)){let f=s;f.__vault||f.bindToVault(e),s=typeof f.source=="string"?f.source:f.source.id,n.current[s]=f}else typeof s!="string"&&(s=s.id);let c=e.get({id:r,type:"AnnotationPage"}),l=e.get({id:s,type:"Annotation"});c&&l&&(c.items.find(f=>f.id===l.id)||t(je.addReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"},index:u})))}},[r]),a=qt(s=>{r&&(Bt(s)?s=typeof s.source=="string"?s.source:s.source.id:typeof s!="string"&&(s=s.id),n.current[s]&&n.current[s].beforeRemove(),e.get({id:r,type:"AnnotationPage"})&&t(je.removeReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"}})))},[r]);return[o,{addAnnotation:i,removeAnnotation:a}]}import{jsx as zr}from"react/jsx-runtime";var jt=kr(null);function Yt(){let e=Er(jt);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function Qt({children:e}){let[n,{addAnnotation:t,removeAnnotation:r}]=$t();return zr(jt.Provider,{value:Lr(()=>({fullPage:n,addAnnotation:t,removeAnnotation:r}),[n]),children:e})}import{jsx as Ye,jsxs as Or}from"react/jsx-runtime";function Wt({width:e,style:n,height:t,error:r,resetErrorBoundary:o}){return Or("div",{style:{width:e,height:t,minHeight:500,...n||{},background:"#f9f9f9"},children:[Ye("h3",{children:"Error occurred"}),Ye("p",{children:r.message}),Ye("button",{onClick:o,children:"Reset"})]})}import{createContext as Fr,useContext as Hr}from"react";var pe=Fr(null);function Gt(){return Hr(pe)}import{createContext as Zt,useContext as Dr,useEffect as Ur}from"react";var Qe=Zt(()=>{}),We=Zt(()=>{});function L(e,n,t,r,o=[]){let i=Dr(e==="portal"?We:Qe);Ur(()=>(e!=="none"&&i(n,t,r),()=>{i(n,null)}),[n,e,i,...o])}import{createContext as qr,useContext as Br,useEffect as $r}from"react";import{useMemo as _r}from"react";function b(e={},n=[]){let{id:t,selector:r}=e,o=k(),i=t||o.canvas,a=S(s=>i?s.iiif.entities.Canvas[i]:void 0,[i]);return _r(()=>{if(a)return r?r(a):a},[a,r,...n])}var Ge=qr(()=>{});function Kt(e){let n=b(),t=Br(Ge);$r(()=>n&&n.id?(t(n.id,e),()=>t(n.id,-1)):()=>{},[n,e])}import{Fragment as Wr,jsx as R,jsxs as Gr}from"react/jsx-runtime";function en({children:e,errorFallback:n,outerContainerProps:t={},worldScale:r,...o}){let[i,a]=Ce(),s=Dt(),u=n||Wt,[c,l]=Ce({}),f=Object.entries(c),[d,v]=Ce({}),m=Object.entries(d),[p,g]=Ce({}),A=Xt(()=>r||Math.max(...Object.values(p)),[p]),U=Xt(()=>({maxOverZoom:A||1,...o.runtimeOptions||{}}),[A,o.runtimeOptions]),I=Ze((C,P)=>{g(N=>{if(P===-1){let{[C]:h,...O}=N;return O}return{...N,[C]:P}})},[]),Oe=Ze((C,P,N)=>{l(({[C]:h,...O})=>P?{...O,[C]:{element:P,props:N}}:O)},[]),ve=Ze((C,P,N)=>{v(({[C]:h,...O})=>P?{...O,[C]:{element:P,props:N}}:O)},[]);return Gr(Qr,{resetKeys:[],fallbackRender:C=>R(u,{...o,...C}),children:[R(jr,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:R(Wr,{children:f.map(([C,{element:P,props:N}])=>R(Jt.Fragment,{children:R(P,{...N||{}})},C))}),onCreated:C=>{a(C),o.onCreated&&o.onCreated(C)},runtimeOptions:U,children:R(pe.Provider,{value:i,children:R(Ge.Provider,{value:I,children:R(Qe.Provider,{value:Oe,children:R(We.Provider,{value:ve,children:R(Ut,{bridge:s,children:R(Yr.Provider,{value:o.mode||"explore",children:R(Qt,{children:e})})})})})})})}),R("div",{children:m.map(([C,{element:P,props:N}])=>R(Jt.Fragment,{children:R(P,{...N||{}})},C))})]})}import{mergeStyles as to,RegionHighlight as no}from"@atlas-viewer/atlas";import{useMemo as tn}from"react";import{createEventsHelper as Zr}from"@iiif/helpers/events";function be(e,n){let t=y(),r=tn(()=>Zr(t),[t]),o=S(()=>e&&e.id?t.getResourceMeta(e.id,"eventManager"):null,[e]);return tn(()=>e?r.getListenersAsProps(e,n):{},[o,e,t,n])}import{useMemo as Kr}from"react";import{createStylesHelper as Jr}from"@iiif/helpers/styles";function oe(e,n){let t=y(),r=Kr(()=>Jr(t),[t]);return S(()=>{if(!e)return null;let o=r.getAppliedStyles(e.id);return o?n?o[n]:o:void 0},[e,n])}import{useMemo as ro}from"react";import{useMemo as Xr}from"react";import{expandTarget as eo}from"@iiif/helpers/annotation-targets";function Pe(e={},n=[]){let{id:t,selector:r}=e,o=k(),i=y(),a=t||o.annotation,s=S(c=>a?c.iiif.entities.Annotation[a]:void 0,[a]),u=S(c=>s&&s.body?s.body.map(l=>l?l.type==="SpecificResource"?{...l,source:i.get(l)}:l?c.iiif.entities[l.type][l.id]:null:null).filter(Boolean):[],[s]);return Xr(()=>{if(!s)return;let c={...s,body:u,target:eo(s.target,{typeMap:i.getState().iiif.mapping})};return r?r(c):c},[s,r,u,...n])}import{jsx as oo}from"react/jsx-runtime";var Re=({id:e,style:n,className:t,interactive:r})=>{let o=Pe({id:e}),i=oe(o,"atlas"),a=oe(o,"html"),s=be(o,["atlas"]),u=b(),c=ro(()=>to(n,i),[n,i]);return u&&o&&o.target&&o.target.selector&&o.target.selector.type==="BoxSelector"&&o.target.source&&(o.target.source.id===u.id||o.target.source===u.id)?oo(no,{id:o.id,isEditing:!0,region:o.target.selector.spatial,style:c,className:a?.className||t,interactive:!!(a?.href||r),href:a?.href||null,title:a?.title||null,hrefTarget:a?.target||null,onClick:()=>{},...s}):null};import{Fragment as ao}from"react";import{useMemo as io}from"react";function nn(e={},n=[]){let{id:t,selector:r}=e,o=k(),i=t||o.annotationPage,a=S(s=>i?s.iiif.entities.AnnotationPage[i]:void 0,[i]);return io(()=>{if(a)return r?r(a):a},[a,...n])}import{jsx as rn}from"react/jsx-runtime";var ge=({className:e,page:n})=>{let t=nn({id:n.id})||n,r=oe(t,"atlas"),o=oe(t,"html");return S(i=>t.id?i.iiif.entities.AnnotationPage[t.id]:null,[]),rn(ao,{children:t.items?.map(i=>rn(Re,{id:i.id,style:r,className:o?.className||e},i.id))})};import{createStylesHelper as Wo}from"@iiif/helpers/styles";import{Fragment as fn,useMemo as po}from"react";import{HTMLPortal as lo,TileSet as ln}from"@atlas-viewer/atlas";import Ie,{useMemo as Ke}from"react";import{jsx as F}from"react/jsx-runtime";var an=Ie.createContext("en"),sn=Ie.createContext({});function fc(e){return F(sn.Provider,{value:e.translations,children:e.children})}function mc(e){return F(an.Provider,{value:e.language,children:e.children})}function Je(){return Ie.useContext(an)}function un(){return Ie.useContext(sn)}function on(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function so({as:e,language:n,children:t,viewingDirection:r,...o}){let i=Je();return Ke(()=>on(i)===on(n),[i,n])?e?F(e,{...o,children:t}):F("span",{...o,children:t}):e?F(e,{...o,lang:n,dir:r,children:t}):F("span",{...o,lang:n,dir:r,children:t})}function cn(e,n,t){if(n.length===0)return;if(n.length===1)return n[0];if(n.indexOf(e)!==-1)return e;let r=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(r&&n.indexOf(r)!==-1)return r;for(let o of t)if(n.indexOf(o)!==-1)return o;return n.indexOf("none")!==-1?"none":n.indexOf("@none")!==-1?"@none":n[0]}var uo=(e,n=[])=>{let t=Je();return Ke(()=>{let r=e();return cn(t,r,[])},[t,...n])};function W(e,n){return n?e[n]||n:""}function co(e,n,t=`
|
|
2
|
-
`,r={}){let o=uo(()=>Object.keys(e||{}),[e]);return[Ke(()=>{if(!e)return W(r,n)||"";if(typeof e=="string")return W(r,e);let i=o?e[o]:void 0;return i?typeof i=="string"?i:i.map(a=>W(r,a)).join(t):""},[o,n,e]),o]}function pc(){let e=Je(),n=un();return function(r,o="",i=`
|
|
3
|
-
`,a=n){let s=Object.keys(r||{}),u=cn(e,s,[]);if(!r)return W(a,o)||"";if(typeof r=="string")return W(a,r);let c=u?r[u]:void 0;return c?typeof c=="string"?W(a,c):c.map(l=>W(a,l)).join(typeof i<"u"?i:`
|
|
4
|
-
`):""}}function he({as:e,defaultText:n,enableDangerouslySetInnerHTML:t,children:r,separator:o,...i}){let a=un(),[s,u]=co(r,n,o,a);return u?F(so,{...i,as:e,language:u,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s}):e?F(e,{...i,children:s}):F("span",{...i,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s})}import{jsx as H,jsxs as mo}from"react/jsx-runtime";function fo({resource:e,heading:n,note:t,extra:r}){return r?H(lo,{target:{x:0,y:0,width:r.target?.spatial.width,height:r.target?.spatial.height},backgroundColor:"#333",relative:!0,children:H("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:mo("div",{children:[H(he,{children:n||"Not authorised"}),t&&H("p",{children:H(he,{children:t})}),H("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function dn({image:e,thumbnail:n,crop:t,enableSizes:r}){if(!kt()){let i=e.service,a=i.width||e.width||0,s=i.height||e.height||0;return H(ln,{tiles:{id:i.id||i["@id"]||"unknown",height:s,width:a,imageService:i},enableSizes:r,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}return H(Et,{resource:e.service,errorComponent:fo,extra:e,children:i=>{let a=i.width||e.width||0,s=i.height||e.height||0;return H(ln,{tiles:{id:i.id||i["@id"]||"unknown",height:s,width:a,imageService:i},enableSizes:r,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}},e.id)}import{jsx as Xe,jsxs as mn}from"react/jsx-runtime";function we({id:e,image:n,thumbnail:t,isStatic:r,x:o=0,y:i=0,children:a,selector:s,onClick:u,enableSizes:c}){let l=po(()=>{if(!(!s||s.spatial.x===0&&s.spatial.y===0))return s.spatial},[s]);return Xe("world-object",{x:o+n.target.spatial.x,y:i+n.target.spatial.y,width:n.target.spatial.width,height:n.target.spatial.height,onClick:u,children:n.service?mn(fn,{children:[Xe(dn,{image:n,thumbnail:t,crop:l,enableSizes:c}),a]},"service"):mn(fn,{children:[Xe("world-image",{onClick:u,uri:n.id,target:{x:0,y:0,width:n.target.spatial.width,height:n.target.spatial.height},display:n.width&&n.height?{width:n.width,height:n.height}:void 0,crop:l}),a]},"no-service")},e+(n.service?"server":"no-service"))}import{Fragment as Go,useEffect as Ln,useLayoutEffect as Zo,useMemo as zn}from"react";import{HTMLPortal as Ko}from"@atlas-viewer/atlas";import{useMemo as bn}from"react";import{useCallback as hn,useMemo as ho}from"react";function go(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function pn(e,n){return S(t=>{let r=[];if(!e)return r;let o=Object.keys(t.iiif.entities.AnnotationPage);for(let i of o)if(!n||n.indexOf(i)!==-1){let a=go(t,i);a&&a.views&&a.views[e]&&r.push(i)}return r},[e,n])}function gn({canvas:e,manifest:n,all:t,canvases:r}){let o=[];if(n)for(let i of n.annotations)o.indexOf(i.id)===-1&&o.push(i.id);if(t){if(r&&r.length)for(let i of r)for(let a of i.annotations)o.indexOf(a.id)===-1&&o.push(a.id)}else if(e)for(let i of e.annotations)o.indexOf(i.id)===-1&&o.push(i.id);return o}function vo(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function vn(e,n={}){let t=y(),r=w(),o=b(),i=Ae(),a=ho(()=>gn({all:n.all,manifest:r,canvas:o,canvases:i}),[n.all,o,i,r]),s=pn(e,n.all?void 0:a),u=hn(l=>{e&&t.setMetaValue([l,"annotationPageManager","views"],f=>f&&!f[e]?f:{...f||{},[e]:!1})},[e,t]),c=hn((l,f={})=>{if(!e)return;let d=t.getState(),v=[];if(f?.deselectOthers){let m=Object.keys(d.iiif.entities.AnnotationPage);for(let p of m){let g=vo(d,p);g&&g.views&&g.views[e]&&v.push(p)}}for(let m of v)u(m);t.setMetaValue([l,"annotationPageManager","views"],m=>m&&m[e]?m:{...m||{},[e]:!0})},[e,u,t]);return{availablePageIds:a,enabledPageIds:s,setPageEnabled:c,setPageDisabled:u}}function yn(e,n){return S((t,r)=>r.get(e.map(o=>({id:o,type:n}))),[e,n])}import{useCallback as Co,useEffect as bo,useRef as Po,useState as Ro}from"react";import yo,{useContext as So}from"react";import{ImageServiceLoader as Ao}from"@atlas-viewer/iiif-image-api";var xo=yo.createContext(new Ao);function Me(){return So(xo)}function Sn(){let e=Me(),[n,t]=Ro({}),r=Po(!1);return bo(()=>()=>{r.current=!0},[]),[Co((i,{height:a,width:s})=>{if(i){let u=i.id||i["@id"],c=e.loadServiceSync({id:u,width:i.width||s,height:i.height||a,source:i});c?i=c:n[u]||(r.current||t(l=>({...l,[u]:"loading"})),e.loadService({id:u,width:i.width||s,height:i.height||a}).then(()=>{r.current||t(l=>({...l,[u]:"done"}))}))}return i},[e,n]),n]}import{useCallback as Io,useMemo as xn,useState as wo}from"react";function An(e={}){let n=Pe(),t=b(e.canvasId?{id:e.canvasId}:void 0);return S((r,o)=>{if(!t)return[];if(n&&e.enableSingleAnnotation)return[n];let i=o.get(t.items),a=[];for(let s of i)a.push(...o.get(s.items));return a},[t])}import{createPaintingAnnotationsHelper as Mo}from"@iiif/helpers/painting-annotations";function Cn(e,n=[]){let t=y(),r=xn(()=>Mo(t),[]),o=An({enableSingleAnnotation:e?.enableSingleAnnotation}),[i,a]=wo(e?.defaultChoices||[]),s=xn(()=>r.getPaintables(o,i),[t,o,i,...n]),c={makeChoice:Io((l,{deselectOthers:f=!0,deselect:d=!1}={})=>{if(s.choice){if(s.choice.type!=="single-choice")throw new Error("Complex choice not supported yet");a(v=>{if(d){let p=v.filter(g=>g!==l);if(p.length===0){let g=s.items[0].resource.id;return g?[g]:[]}return p}if(f)return[l];let m=[...v];if(m.length===0&&s.items.length){let p=s.items[0].resource.id;p&&m.push(p)}return v.indexOf(l)!==-1?v:[...v,l]})}},[s.choice])};return[s,c]}function Pn(e){let n=w(),t=b(),r=y(),[o,i]=Sn(),{enabledPageIds:a}=vn(e?.annotationPageManagerId||n?.id||t?.id,{all:!1}),s=yn(a,"AnnotationPage"),u=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[c,l]=Cn(e,[i]),f=bn(()=>ft({canvas:t,paintables:c,supports:u,loadImageService:o}),[t,c,r,l.makeChoice]);return bn(()=>f.type==="unknown"?[f,dt]:[{...f,annotations:{pages:s}},l],[f,s])}import{useEffect as Vo,useMemo as No,useRef as ko,useState as Eo}from"react";import{useEffect as To}from"react";var Rn=(e,n=[])=>{let t=y();To(()=>{e(t)},[t,...n])};import{createThumbnailHelper as Lo}from"@iiif/helpers/thumbnail";function In(e,n,{canvasId:t,manifestId:r}={}){let o=y(),i=Me(),a=No(()=>Lo(o,{imageServiceLoader:i}),[o,i]),[s,u]=Eo(),c=w(r?{id:r}:void 0),l=b(t?{id:t}:void 0),f=l||c,d=ko(!1);if(Vo(()=>(d.current=!1,()=>{d.current=!0}),[]),!f)throw new Error("Must be called under a manifest or canvas context.");return Rn(v=>{a.getBestThumbnailAtSize(f,e,n).then(m=>{m.best&&!d.current&&u(m.best)})},[f]),s}import{useCallback as z,useEffect as wn,useReducer as zo,useRef as Te}from"react";function Oo(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function Fo(e,n){switch(n.type){case"FINISHED":return{...e,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...e,isFinished:!1,isPlaying:!e.isPlaying};case"PLAY_REQUESTED":return{...e,isFinished:!1,playRequested:!0};case"PAUSE":return{...e,isPlaying:!1};case"PLAY":return{...e,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...e,isMuted:!0};case"SET_VOLUME":return{...e,volume:n.volume,isMuted:n.volume===0};case"TOGGLE_MUTE":return{...e,isMuted:!e.isMuted};case"UNMUTE":return{...e,isMuted:!1}}return e}function Ho(e){let n=Math.round(e);return`${Math.floor(n/60)}:${`${n%60}`.padStart(2,"0")}`}function ie(e){let[n,t]=zo(Fo,Oo(e.duration)),r=Te(null),o=Te(null),i=Te(null),a=Te(!1),s=z(()=>{o.current&&r.current&&(o.current.innerHTML=Ho(r.current.currentTime),i.current&&(i.current.style.width=`${r.current.currentTime/e.duration*100}%`),a.current!==r.current.muted&&(a.current=r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[e.duration]),u=z(()=>{r.current&&(t({type:"PLAY_REQUESTED"}),r.current.play().then(()=>{t({type:"PLAY"})}),s())},[s]),c=z(()=>{r.current&&(r.current.duration>0&&r.current.paused?u():l())},[s]),l=z(()=>{r.current&&(r.current.pause(),t({type:"PAUSE"}),s())},[s]),f=z(()=>{r.current&&(r.current.muted=!r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),d=z(()=>{r.current&&(r.current.muted=!0,t({type:"MUTE"}))},[]),v=z(()=>{r.current&&(r.current.muted=!1,t({type:"UNMUTE"}))},[]),m=z(A=>{r.current&&(r.current.muted=!1,r.current.volume=A/100,t({type:"SET_VOLUME",volume:A}))},[]),p=z(A=>{r.current&&(r.current.currentTime=Math.max(0,Math.min(A*e.duration,e.duration)),s())},[]),g=z(A=>{r.current&&(r.current.currentTime=Math.max(0,Math.min(A,e.duration)),s())},[]);return wn(()=>{let A=setInterval(()=>{s()},350);return()=>clearInterval(A)},[s,e.duration]),wn(()=>{let A=()=>{t({type:"FINISHED"})},U=r.current;return U?.addEventListener("ended",A),()=>U?.removeEventListener("ended",A)},[]),[{element:r,currentTime:o,progress:i},n,{play:u,pause:l,playPause:c,mute:d,unmute:v,toggleMute:f,setVolume:m,setDurationPercent:p,setTime:g}]}import{createContext as tt,useContext as nt}from"react";import{jsx as et}from"react/jsx-runtime";var Mn=tt(null),Tn=tt(null),Vn=tt(null);function El(){let e=nt(Mn);if(!e)throw new Error("Ctx not found");return e}function Ll(){let e=nt(Tn);if(!e)throw new Error("Ctx not found");return e}function zl(){let e=nt(Vn);if(!e)throw new Error("Ctx not found");return e}function Ve({actions:e,state:n,children:t,currentTime:r,progress:o,element:i}){return et(Vn.Provider,{value:{currentTime:r,progress:o,element:i},children:et(Tn.Provider,{value:e,children:et(Mn.Provider,{value:n,children:t})})})}import{jsx as Do,jsxs as Uo}from"react/jsx-runtime";function rt({media:e,children:n}){let[{element:t,currentTime:r,progress:o},i,a]=ie({duration:e.duration});return Uo(Ve,{state:i,actions:a,currentTime:r,progress:o,element:t,children:[Do("audio",{ref:t,src:e.url}),n]})}function Ne({media:e,mediaControlsDeps:n,children:t}){return L("portal","audio",rt,{media:e,children:t},[e,...n||[]]),null}import{jsx as Nn,jsxs as _o}from"react/jsx-runtime";function ot({element:e,media:n,playPause:t}){return _o("div",{className:"video-container",part:"video-container",onClick:t,children:[Nn("style",{children:`
|
|
5
|
-
.video-container {
|
|
6
|
-
position: absolute;
|
|
7
|
-
top: 0;
|
|
8
|
-
bottom: 0;
|
|
9
|
-
left: 0;
|
|
10
|
-
right: 0;
|
|
11
|
-
background: #000;
|
|
12
|
-
z-index: 13;
|
|
13
|
-
display: flex;
|
|
14
|
-
justify-content: center;
|
|
15
|
-
pointer-events: visible;
|
|
16
|
-
}
|
|
17
|
-
`}),Nn("video",{ref:e,src:n.url,style:{width:"100%",objectFit:"contain"}})]})}function ke({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:i},a,s]=ie({duration:e.duration});return L("overlay","video-element",ot,{element:r,media:e,playPause:s.playPause}),L("portal","custom-controls",Ve,{state:a,actions:s,currentTime:o,progress:i,element:r,children:t},[o,a,e,...n||[]]),null}import{Fragment as qo,jsx as it,jsxs as Bo}from"react/jsx-runtime";function at({model:e}){return Bo(qo,{children:[it("style",{children:`
|
|
18
|
-
.model-container {
|
|
19
|
-
position: absolute;
|
|
20
|
-
top: 0;
|
|
21
|
-
bottom: 0;
|
|
22
|
-
left: 0;
|
|
23
|
-
right: 0;
|
|
24
|
-
background: #000;
|
|
25
|
-
z-index: 13;
|
|
26
|
-
display: flex;
|
|
27
|
-
justify-content: center;
|
|
28
|
-
pointer-events: visible;
|
|
29
|
-
}
|
|
30
|
-
`}),it("div",{className:"model-container",children:it("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Ee({model:e,name:n}){return L("overlay",`model-${n}`,at,{model:e},[e]),null}import{jsx as $o}from"react/jsx-runtime";function Le({style:e}){let n=b();return!n||!n.height||!n.width?null:$o("box",{interactive:!1,target:{x:0,y:0,width:Number(n.width),height:Number(n.height)},style:e})}import{useRef as jo}from"react";import{jsx as kn,jsxs as Qo}from"react/jsx-runtime";function Yo({element:e,media:n,playPause:t}){let r=jo(null);return n.youTubeId?Qo("div",{className:"video-container",part:"video-container",onClick:t,children:[kn("style",{children:`
|
|
31
|
-
.video-container {
|
|
32
|
-
position: absolute;
|
|
33
|
-
top: 0;
|
|
34
|
-
bottom: 0;
|
|
35
|
-
left: 0;
|
|
36
|
-
right: 0;
|
|
37
|
-
background: #000;
|
|
38
|
-
z-index: 13;
|
|
39
|
-
display: flex;
|
|
40
|
-
justify-content: center;
|
|
41
|
-
pointer-events: visible;
|
|
42
|
-
}
|
|
43
|
-
.video-yt {
|
|
44
|
-
border: none;
|
|
45
|
-
width: 100%;
|
|
46
|
-
object-fit: contain;
|
|
47
|
-
}
|
|
48
|
-
`}),kn("iframe",{className:"video-yt",ref:r,src:`https://www.youtube.com/embed/${n.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function En({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:i},a,s]=ie({duration:e.duration});return L("overlay","video-element",Yo,{element:r,media:e,playPause:s.playPause}),null}import{Fragment as ze,jsx as V,jsxs as B}from"react/jsx-runtime";function st({x:e,y:n,onChoiceChange:t,registerActions:r,defaultChoices:o,isStatic:i,renderViewerControls:a,renderMediaControls:s,viewControlsDeps:u,mediaControlsDeps:c,strategies:l,throwOnUnknown:f,backgroundStyle:d,alwaysShowBackground:v,keepCanvasScale:m=!1,enableSizes:p=!1,enableYouTube:g=!0,onClickPaintingAnnotation:A,children:U}){let I=b(),Oe=be(I,["deep-zoom"]),[ve]=Yt(),C=Gt(),P=y(),N=zn(()=>Wo(P),[P]),[h,O]=Pn({strategies:l||["images"],defaultChoices:o?.map(({id:x})=>x)}),ut=h.type==="images"?h.choice:void 0,Fn=zn(()=>m?1:Math.max(1,...h.type==="images"?h.images.map(x=>(x.width||0)/x.target?.spatial.width):[]),[m,h]);Kt(Fn),Ln(()=>{r&&r(O)},[h.annotations]),Ln(()=>{if(o)for(let x of o)typeof x.opacity<"u"&&N.applyStyles({id:x.id},"atlas",{opacity:x.opacity})},[o]),Zo(()=>{t&&t(ut)},[ut]),L(C&&(h.type==="images"||h.type==="empty"||h.type==="textual-content"&&a)?"overlay":"none",`canvas-portal-controls-${I?.id}`,pe.Provider,a?{value:C||null,children:a(h)}:{},[I,C,h,...u||[]]);let _=In({maxWidth:256,maxHeight:256});if(!I)return null;let ct=I.accompanyingCanvas,ae=_&&_.type==="fixed"?V("world-object",{height:I.height,width:I.width,x:e,y:n,children:V("world-image",{uri:_.id,target:{x:0,y:0,width:I.width,height:I.height},display:_.width&&_.height?{width:_.width,height:_.height}:void 0,crop:void 0})}):null;if(h.type==="unknown"){if(ae)return ae;if(f)throw new Error(h.reason||"Unknown image strategy");return null}let lt=B(Go,{children:[ve?V(ge,{page:ve}):null,h.annotations&&h.annotations.pages?h.annotations.pages.map(x=>V(ge,{page:x},x.id)):null,U]}),Hn=h.type==="images"?h.images.length:0;return B(ze,{children:[B("world-object",{height:I.height,width:I.width,x:e,y:n,...Oe,children:[h.type==="empty"||v?V(Le,{style:d}):null,h.type==="textual-content"?h.items.map((x,ye)=>B(ze,{children:[V(Ko,{onClick:A?se=>{se.stopPropagation(),A(x.annotationId,x,se)}:void 0,target:x.target?.spatial||void 0,children:V("div",{"data-textual-content":!0,children:V(he,{enableDangerouslySetInnerHTML:!0,children:x.text})})},ye),lt]})):null,h.type==="images"?B(ze,{children:[h.images.map((x,ye)=>V(we,{isStatic:i,image:x,id:x.id,thumbnail:ye===0?_:void 0,selector:x.selector,enableSizes:p,onClick:A?se=>{se.stopPropagation(),A(x.annotationId,x,se)}:void 0},x.id+ye)),lt]}):null,h.type==="3d-model"?V(Ee,{model:h.model}):null,h.type==="media"?V(ze,{children:h.media.type==="Sound"?B(Ne,{media:h.media,mediaControlsDeps:c,children:[ae,s?s(h):null]}):h.media.type==="Video"?B(ke,{media:h.media,mediaControlsDeps:c,children:[ae,s?s(h):null]}):h.media.type==="VideoYouTube"&&g?B(En,{media:h.media,mediaControlsDeps:c,children:[ae,s?s(h):null]}):null}):null]},`${I.id}/${h.type}/${Hn}`),h.type==="media"&&h.media.type==="Sound"&&ct?V(K,{canvas:ct.id,children:V(st,{renderViewerControls:a})}):null]})}import{Fragment as ei,jsx as D,jsxs as ti}from"react/jsx-runtime";var Xo=On(function(n,t){let r=w(),o=Ae(),i=Ht(),{ViewerControls:a,MediaControls:s}=n.components||{};if(Jo(t,()=>i,[i]),!r)return D("div",{});let u=0;return ti(ei,{children:[n.header,D(M.Viewer,{height:n.height,mode:n.mode,children:o.map((c,l)=>{let f=u;return u+=c.width+(n.spacing||0),D(K,{canvas:c.id,children:D(M.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content"],renderViewerControls:l===0&&a?()=>D(a,{}):void 0,renderMediaControls:l===0&&s?()=>D(s,{}):void 0,x:f,...n.canvasProps||{},children:n.annotations},c.id)},c.id)})},n.reuseAtlas?"":i.currentSequenceIndex),n.children]})}),M=On(function({children:n,height:t,annotations:r,canvasProps:o,spacing:i,header:a,components:s,mode:u,reuseAtlas:c,...l},f){let d=Z();return D(G,{vault:d,children:D(Ft,{...l,children:D(Xo,{ref:f,height:t,components:s,spacing:i,canvasProps:o,annotations:r,header:a,mode:u,reuseAtlas:c,children:n})})})});M.RenderImage=we;M.RenderCanvas=st;M.RenderAnnotationPage=ge;M.RenderAnnotation=Re;M.Viewer=en;M.CanvasBackground=Le;M.Audio=Ne;M.Video=ke;M.Model=Ee;M.AudioHTML=rt;M.VideoHTML=ot;M.ModelHTML=at;export{Se as a,k as b,q as c,$ as d,G as e,Z as f,gt as g,ht as h,vt as i,K as j,y as k,S as l,J as m,Ae as n,w as o,yt as p,ar as q,He as r,Zi as s,St as t,Xi as u,De as v,At as w,xt as x,fa as y,bt as z,Pt as A,Rt as B,j as C,ue as D,ee as E,te as F,Be as G,Nt as H,Va as I,kt as J,le as K,gr as L,Na as M,hr as N,Vt as O,ka as P,Ea as Q,La as R,za as S,Oa as T,Fa as U,Et as V,zt as W,fe as X,wr as Y,Ft as Z,Ht as _,Dt as $,Ut as aa,_t as ba,$t as ca,Yt as da,Qt as ea,pe as fa,Gt as ga,b as ha,be as ia,oe as ja,Pe as ka,nn as la,fc as ma,mc as na,Je as oa,un as pa,so as qa,uo as ra,co as sa,pc as ta,he as ua,gn as va,vn as wa,yn as xa,xo as ya,Me as za,Sn as Aa,An as Ba,Cn as Ca,Pn as Da,Rn as Ea,In as Fa,Ho as Ga,ie as Ha,El as Ia,Ll as Ja,zl as Ka,Ve as La,M as Ma};
|