react-iiif-vault 1.5.10 → 2.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/bundle.d.ts +1015 -494
- package/dist/bundle.global.js +54 -87
- package/dist/canvas-panel.cjs +5 -5
- package/dist/canvas-panel.d.cts +8 -5
- package/dist/canvas-panel.d.ts +8 -5
- package/dist/canvas-panel.js +1 -1
- package/dist/chunk-JX3DXSPO.js +48 -0
- package/dist/index-CawyvZZf.d.cts +643 -0
- package/dist/index-yy_738ck.d.ts +643 -0
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +478 -378
- package/dist/index.d.ts +478 -378
- package/dist/index.js +1 -1
- package/dist/{useRenderingStrategy-BiuSDiXu.d.ts → useRenderingStrategy-PvoNjiMV.d.cts} +10 -10
- package/dist/{useRenderingStrategy-BiuSDiXu.d.cts → useRenderingStrategy-PvoNjiMV.d.ts} +10 -10
- package/dist/{utils-CvRzsfRK.d.cts → utils-BVhGgVd5.d.cts} +18 -18
- package/dist/{utils-C-h4SU3S.d.ts → utils-DyrEcegR.d.ts} +18 -18
- package/dist/utils.d.cts +2 -2
- package/dist/utils.d.ts +2 -2
- package/package.json +6 -5
- package/dist/chunk-2ATWK7I4.js +0 -48
- package/dist/index-BJveLrlu.d.cts +0 -214
- package/dist/index-CrfymD6m.d.ts +0 -214
package/dist/index.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
import{$ as Oo,$a as ye,A as ho,Aa as hr,B as yo,Ba as yr,C as vo,Ca as vr,D as xo,Da as xr,E as So,Ea as Sr,F as bo,Fa as br,G as Co,Ga as Cr,H as Io,Ha as Ir,I as ko,Ia as kr,J as Po,Ja as Pr,K as wo,Ka as wr,L as Ro,La as Rr,M as To,Ma as Tr,N as Eo,Na as Er,O as No,Oa as Nr,P as Bo,Pa as Br,Q as Mo,Qa as Mr,R as Lo,Ra as Lr,S as Ho,Sa as M,T as Ao,Ta as ge,U as se,Ua as Hr,V as zo,Va as Ar,W as qo,Wa as zr,X as le,Xa as qr,Y as Wo,Ya as Wr,Z as Do,Za as Dr,_ as Fo,_a as he,a as Zt,aa as $o,ab as Fr,b as q,ba as Vo,bb as Or,c as L,ca as Ko,cb as $r,d as jt,da as Uo,db as Vr,e as eo,ea as Xo,eb as Kr,f as to,fa as Yo,fb as Ur,g as re,ga as ce,gb as Xr,h as oo,ha as F,hb as Yr,i as ro,ia as _o,ib as _r,j as ne,ja as Q,jb as Qr,k as P,ka as w,kb as Gr,l as W,la as me,lb as Jr,m as no,ma as Qo,mb as Zr,n as ie,na as Go,nb as ve,o as D,oa as Jo,p as io,pa as Zo,q as ao,qa as ir,r as so,ra as ue,s as lo,sa as ar,t as co,ta as de,u as mo,ua as fe,v as uo,va as pe,w as ae,wa as O,x as fo,xa as sr,y as po,ya as pr,z as go,za as gr}from"./chunk-2ATWK7I4.js";import{a as jo,b as er,c as tr,d as or,e as rr,f as nr,g as lr,h as cr,i as mr,j as ur,k as dr,l as fr}from"./chunk-XNDN34SQ.js";import{useCanvas as Ye}from"@atlas-viewer/atlas";import{forwardRef as _e,useImperativeHandle as Qe}from"react";import{Fragment as Ge,jsx as xe}from"react/jsx-runtime";var nn=_e(function({canvasId:t},o){let r=Ye(),n=ue(t||r?.id),a=P();return Qe(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:xe(Ge,{children:n.enabledPageIds.map(s=>xe(ve.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as je}from"react";import{useMemo as Je}from"react";import{Fragment as Ze,jsx as I,jsxs as $}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:d="",separator:c,tableFooter:p,tableHeader:S}){let b=Je(()=>{let h=(t||[]).reduce((f,g)=>[...f,...g.keys],[]),m={};for(let f of e){let g=f&&f.label?Object.values(f.label):[];for(let i of g)if(i&&i.length&&(h.indexOf(`metadata.${i[0]}`)!==-1||h.length===0)&&f){let y=`metadata.${i[0]}`;m[y]=m[y]?m[y]:[],m[y].push(f);break}}return m},[t,e]);return Object.keys(b).length===0&&r?I(Ze,{children:a})||I("div",{className:s.empty,children:l}):t&&t.length?$("table",{className:s.container,children:[S,I("tbody",{children:t.map((h,m)=>{let f=[];for(let g of h.keys)for(let i of b[g]||[])f.push(I(M,{enableDangerouslySetInnerHTML:n,defaultText:u,separator:c,children:i.value},m+"__"+g));return f.length===0?null:$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,separator:c,defaultText:d,children:h.label})}),I("td",{className:s.value,children:f})]},m)})}),p]}):$("table",{className:s.container,children:[S,I("tbody",{children:e&&e.length?e.map((h,m)=>h?$("tr",{className:s.row,children:[I("td",{className:s.label,style:o?{minWidth:o}:{},children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:u,separator:c,children:h.label})}),I("td",{className:s.value,children:I(M,{enableDangerouslySetInnerHTML:n,defaultText:u,separator:c,children:h.value})})]},m):null):null}),p]})}import{jsx as et}from"react/jsx-runtime";function vn(e){let t=D(),o=w(),r=ae(),n=je(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=r?.metadata||[];return[...a,...s,...l]},[t,o,r]);return et(V,{metadata:n,...e})}import{useEffect as nt,useState as it}from"react";import{createImageServiceRequest as tt,imageServiceRequestToString as ot}from"@iiif/parser/image-3";import{useMemo as rt}from"react";function G(e,t={},o=[]){return rt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=tt(e);return ot({identifier:n.identifier,server:n.server,scheme:n.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:r||"default",prefix:n.prefix,originalPath:n.originalPath})},[...o])}import{jsx as K}from"react/jsx-runtime";function at(e){let t=typeof e.src=="string"?e.src:e.src.id,o=he(),[r,n]=it(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let s=G(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[r,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return nt(()=>()=>{n(!1)},[t]),s?K("img",{src:s,alt:e.alt,className:e.className,style:e.style}):K(st,{...e,fetchImageService:!1})}function st(e){if(e.fetchImageService)return K(at,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=G(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?K("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as lt}from"react/jsx-runtime";function Hn(e){let t=D();return lt(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as ft,useRef as pt}from"react";import*as J from"react-lazy-load-image-component";import{getValue as ct}from"@iiif/helpers/i18n";import{Fragment as Se,jsx as R,jsxs as dt}from"react/jsx-runtime";var{LazyLoadComponent:mt}=J||J.default;function be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=R(ut,{...e}),d=R(mt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:n?R(ne,{canvas:n,children:u}):u});return a?R("figure",{className:r?.figure,children:d}):d}function ut({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:a=!1}){let s=w(),l=t?.width||128,u=t?.height||t?.width||128,d=n||ct(s?.label)||"",c=ye({width:l,height:u,allowUnsafe:!0},a);return!c||c.type!=="fixed"?R(Se,{children:e}):dt(Se,{children:[R("div",{className:o?.imageWrapper,children:R("img",{className:o?.img,src:c.id,alt:d})}),r?R(M,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as H}from"react/jsx-runtime";function Yn({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:a,figure:s,fallback:l}){let u=pt(null),{items:d,sequence:c,currentSequenceIndex:p,setSequenceIndex:S}=se(),b={row:n.selected?.row||n.row,item:n.selected?.item||n.item,figure:n.selected?.figure||n.figure,img:n.selected?.img||n.img,label:n.selected?.label||n.label,imageWrapper:n.selected?.imageWrapper||n.imageWrapper};ft(()=>{if(!u.current)return;let h=u.current.querySelector("[data-selected=true]");h&&h.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let C=[];for(let h of c){let m=[],f=c[p]===h;for(let g of h){let i=d[g];m.push(H("div",{className:f?b.item:n.item,children:H(be,{classes:f?b:n,canvasId:i.id,size:r,dereference:t,showLabel:a,figure:s,placeholder:H("div",{style:{height:128,width:128}}),fallback:l})},g))}if(o){C.push(m);continue}C.push(H("div",{onClick:g=>{S(c.indexOf(h))},"data-selected":f,className:f?b.row:n.row,children:m},h.join("-")))}return H("div",{ref:u,className:n.container,children:C})}import{Fragment as Ce,jsx as T,jsxs as Ie}from"react/jsx-runtime";var gt={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function Gn({helper:e,showShapes:t,state:o,enabled:r=gt,classNames:n={},icons:a={}}){return Ie(Ce,{children:[t?Ie(Ce,{children:[r.draw&&T("button",{className:n.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),r.polygon&&T("button",{className:n.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),r.line&&T("button",{className:n.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),r.lineBox&&T("button",{className:n.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),r.square&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),r.triangle&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),r.hexagon&&T("button",{className:n.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&r.delete&&T("button",{className:n.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as ht,useCallback as ke,useContext as we,useEffect as Pe,useMemo as Z,useState as yt}from"react";import Re from"mitt";import{jsx as vt}from"react/jsx-runtime";var U=ht(Re());U.displayName="SelectorHelper";function ni({children:e}){return vt(U.Provider,{value:Z(()=>Re(),[]),children:e})}function ii(){return we(U)}function Te(e){let t=Ee(),[o,r]=yt(!1);Pe(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Pe(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=ke(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=ke(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:n,onHover:a,isHighlighted:o}}function Ee(){let e=we(U);return Z(()=>({withSelector(t){return{on(o,r){let n=a=>{a&&a.selectorId===t&&r(a)};return e.on(o,n),()=>{e.off(o,n)}},emit(o,r){e.emit(o,{...r,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function ai(){let e=Ee();return Z(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as xt,useContext as St,useMemo as bt}from"react";import{jsx as Ct}from"react/jsx-runtime";function Ne(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var j=xt(Ne());j.displayName="AnnotationStyle";function Be(){return St(j)}function mi({theme:e,children:t}){let o=bt(()=>e||Ne(),[e]);return Ct(j.Provider,{value:o,children:t})}import{HTMLPortal as Tt,useAtlas as Et}from"@atlas-viewer/atlas";import{useEffect as Le,useRef as E,useState as He}from"react";import{useEffect as It,useMemo as kt,useState as Pt}from"react";import{createHelper as wt}from"polygon-editor";function Me(e,t,o){let[r,n]=Pt({}),a=kt(()=>wt(e,o),[]);return It(()=>(a.clock.start(t,n),()=>{a.clock.stop()}),[]),{state:r,helper:a}}import{createSvgHelpers as Rt}from"polygon-editor";import{Fragment as Ae,jsx as x,jsxs as ze}from"react/jsx-runtime";var N=Rt();function qe(e,t){let{image:o,currentShape:r,onChange:n,hideShapeLines:a}=e,s=E(),l=E(),u=E(),d=E(),c=E(),p=E(),S=E(),b=E(),[C,h]=He(null),[m,f]=He(!1),{helper:g,state:i}=Me(r,(v,k)=>{N.updateTransitionBoundingBox(l.current,v,k),N.updateBoundingBoxPolygon(s.current,v,k),N.updateTransitionShape(p.current,v,k),N.updateClosestLinePointTransform(d.current,v,k),N.updateSelectBox(u.current,v,k),N.updatePointLine(S.current,v,k),N.updateDrawPreview(c.current,v,k,3),N.updateLineBox(b.current,v),h(v.transitionDirection),f(v.transitionRotate)},n);Le(()=>{g.setShape(r||null)},t),Le(()=>{let v=()=>{g.modifiers.reset()};return document.addEventListener("mouseleave",v),()=>{document.removeEventListener("mouseleave",v)}},[]);let y=ze(Ae,{children:[x("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),x("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),x("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:x("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),B=r?r.open?"polyline":"polygon":null,oe=!i.showBoundingBox&&i.closestPoint!==null&&i.actionIntentType==="select-point",Ke=i.actionIntentType==="add-open-point",Ue=i.transitionIntentType==="split-line",_=i.transitioning&&i.selectedStamp&&i.transitionIntentType==="stamp-shape",Xe=r&&B?ze(Ae,{children:[x(B,{fill:!i.transitioning&&i.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:_?0:2,stroke:a?"transparent":"#000",points:r.points.map(v=>v.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:i.showBoundingBox?void 0:"url(#dot)",markerMid:i.showBoundingBox?void 0:"url(#dot)",markerEnd:i.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),i.lineBoxMode&&i.actionIntentType==="close-line-box"?x("polygon",{fill:"rgba(255, 0, 0, .4)",ref:b,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,i.transitionIntentType==="draw-shape"&&i.transitioning?x("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!i.showBoundingBox&&i.selectedPoints&&i.selectedPoints.length?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:r.points.filter((v,k)=>i.selectedPoints?.includes(k)).map(v=>v.join(",")).join(" ")}):null,oe&&i.closestPoint!==null&&r.points[i.closestPoint]?x("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${r.points[i.closestPoint][0]},${r.points[i.closestPoint][1]}`}):null,!i.transitioning&&(i.actionIntentType==="add-open-point"||i.actionIntentType==="close-shape"||i.actionIntentType==="close-shape-line")?x("polyline",{stroke:"#000",ref:S,strokeWidth:i.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,i.hasClosestLine&&(!i.transitionIntentType||i.transitionIntentType==="split-line")?x("g",{ref:d,children:x("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,i.transitioning?x(B,{ref:p,fill:r.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:r.open?2:0}):null,i.transitioning&&i.transitionIntentType==="select-multiple-points"?x("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,i.showBoundingBox?null:x("g",{name:"controls",children:!1}),i.showBoundingBox&&!_?x("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:g,state:i,isAddingPoint:Ke,isSplitting:Ue,isStamping:_,isHoveringPoint:oe,transitionDirection:C,transitionRotate:m,defs:y,editor:Xe}}import{useEffect as ee}from"react";import{createPortal as Nt}from"react-dom";import{Fragment as We,jsx as A,jsxs as X}from"react/jsx-runtime";var Bt=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function De(e){let t=e.theme||Bt[0],o=Et(),{image:r}=e,{helper:n,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:d,transitionRotate:c,isHoveringPoint:p,isAddingPoint:S,isStamping:b}=qe({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),C=i=>{n.pointer([[~~i.atlas.x,~~i.atlas.y]])};ee(()=>{let i=y=>{n.key.up(y.key)};return document.addEventListener("keyup",i),()=>{document.removeEventListener("keyup",i)}},[]),ee(()=>{let i=y=>{n.key.down(y.key)};return document.addEventListener("keydown",i),()=>{document.removeEventListener("keydown",i)}},[]),ee(()=>{let i=[];return u&&i.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&i.push("atlas-cursor-cut"),(p||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&i.push("atlas-cursor-move"),S&&i.push("atlas-cursor-crosshair"),d&&i.push("atlas-cursor-copy"),c&&i.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&i.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...i),()=>{o?.canvas&&o.canvas.classList.remove(...i)}},[o?.canvas,S,p,d,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let h=e.shape&&e.shape?.points.length===0,m=e.renderControls?e.renderControls(n,l,h):null,f=document.getElementById(e.controlsHtmlId||"atlas-controls"),g="shape";return A(We,{children:X("world-object",{height:r.height,width:r.width,onMouseMove:C,onMouseDown:n.pointerDown,onMouseUp:n.pointerUp,onMouseLeave:n.blur,children:[e.shape?X(We,{children:[A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.outer}),A(g,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:b?{}:t.inner})]}):null,X(Tt,{relative:!0,interactive:!1,children:[A("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${r.width} ${r.height}`,tabIndex:-1,children:[A("defs",{children:a}),s]})}),f?Nt(m,f,"controls"):null]})]})})}import{jsx as Fe}from"react/jsx-runtime";function Di(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:a,isHighlighted:s}=Te(e.id),l=Be(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(r){let d="shape",c=e.polygon,p=c.open;return c?Fe(d,{id:`shape-${n}`,points:c.points,open:p,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Fe(De,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useMemo as Mt,useState as Lt}from"react";import{ErrorBoundary as Ht}from"react-error-boundary";import{jsx as z,jsxs as zt}from"react/jsx-runtime";function Gi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:a,viewControlsDeps:s,fluid:l,x:u,y:d,...c}){let[p,S]=Lt(),b=t||ce,[C,h]=pe(),m=Mt(()=>{let g=h[e]?.status,i=C({id:e},{});return i?.height&&i.width&&g!=="loading"?{id:e,width:i.width,height:i.height,service:i,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:i.width,height:i.height}}}:null},[C,e,h]);if(Q(p&&a?"overlay":"none",`canvas-portal-controls-${e}`,F.Provider,a&&m?{value:p||null,children:a({image:m,images:[m],type:"images"})}:{},[e,m,p,...s||[]]),!m||!m.height||!m.width)return null;let f=l?void 0:c.homePosition?c.homePosition.width/c.homePosition.height:m.width/m.height;return z(Ht,{resetKeys:[],fallbackRender:g=>z(b,{...c,...g}),children:z(me,{...c,aspectRatio:f,containerProps:{style:{position:"relative"},...c.containerProps||{}},onCreated:g=>{S(g),c.onCreated&&c.onCreated(g)},children:zt(F.Provider,{value:p,children:[z(ge,{image:m,id:m.id,isStatic:!o,x:u,y:d},m.id),z(At,{viewerPreset:p,renderViewerControls:a,image:m,src:e,viewControlsDeps:s}),n]})})})}function At({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return Q(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,F.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as qt}from"react/jsx-runtime";function ea({annotation:e,children:t}){return qt(L,{value:{annotation:e},children:t})}import{jsx as Wt}from"react/jsx-runtime";function na({annotationPage:e,children:t}){return Wt(L,{value:{annotationPage:e},children:t})}import{jsx as Dt}from"react/jsx-runtime";function la({collection:e,children:t}){return Dt(L,{value:{collection:e},children:t})}function da(e,t={}){return O(t)}import{useCanvas as Ft}from"@atlas-viewer/atlas";import{useEffect as Ot,useMemo as te,useState as $t}from"react";function va({canvasId:e}={}){let t=Ft(),o=ie(),r=te(()=>e?[e]:t?[t.id]:o.map(d=>d.id),[e,t,o]),[n,a]=$t({}),s=le();Ot(()=>{let d=c=>{let p=c.partOf.canvasId;p&&a(S=>({...S,[p]:c.choice}))};return s.on("choice-change",d),()=>{s.off("choice-change",d)}},[]);let l=te(()=>{let d=[];for(let c of r){let p=n[c];p&&d.push({canvasId:c,choice:p})}return d},[r,n]),u=te(()=>({makeChoice:(d,c)=>{s.emit("make-choice",{choiceId:d,...c})}}),[s]);return{choices:l,actions:u}}function Sa(e,t=!1){}function ka(e){let o=q().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return W(n=>{let a=o?n.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])r.indexOf(u.id)!==-1&&l.push(u);return l},[r.join("/")])}import{useMemo as Vt}from"react";function Ea(e,t=[]){let{id:o,selector:r}=e,n=q(),a=o||n.collection,s=W(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Vt(()=>{if(s)return r?r(s):s},[s,r,...t])}import{useEffect as Kt,useMemo as Ut}from"react";import{createEventsHelper as Xt}from"@iiif/helpers/events";function Ha(e,t,o,r,n=[]){let a=P(),s=Ut(()=>Xt(a),[a]);Kt(()=>{let l=e;return l?(s.addEventListener(l,t,o,r),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...n])}function Wa(e,t){let{id:o,isLoaded:r,error:n,resource:a,requestId:s,cached:l}=re(e,t);return{id:o,isLoaded:r,error:n,manifest:a,requestId:s,cached:l}}import{getImageServices as Oe}from"@iiif/parser/image-3";import{useEffect as Yt,useMemo as $e,useState as Y}from"react";function Ve({cacheKey:e}={}){let t=w(),o=O(),r=P(),n=de(),a=fe(),[s,l]=Y(void 0),[u,d]=Y(!1),[c,p]=Y("idle"),[S,b]=Y(void 0),C=t?t.id:"undefined",h=$e(()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),y=Oe(g)[0];return y&&n(y,{width:y.width||t.width,height:y.height||t.height},!0)||void 0}}catch(f){console.error(f)}},[C,e,t]),m=c==="success"&&s?s:h;return Yt(()=>{(async()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),y=Oe(g)[0];if(!y)return;d(!0),p("loading");try{let B=await a(y,{width:y.width||t.width,height:y.height||t.height})||void 0;l(B),p("success"),d(!1)}catch(B){p("error"),b(B)}}}catch(f){p("error"),b(f)}})()},[C,e]),$e(()=>({data:m,isFetching:u,status:c,error:S}),[m,u,c,S])}function _a(){let e=Ve();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as _t}from"@iiif/helpers/styles";import{useMemo as Qt}from"react";function ja(){let e=P();return Qt(()=>_t(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ea as AnnotationContext,na as AnnotationPageContext,mi as AnnotationStyleProvider,Bo as Auth,Io as AuthProvider,So as AuthRContext,bo as AuthReactContext,Co as AuthReactContextActions,nn as CanvasAnnotations,ne as CanvasContext,ve as CanvasPanel,xr as CanvasStrategyProvider,Sr as CanvasWorldObject,la as CollectionContext,vn as CombinedMetadata,Hr as ComplexTimelineProvider,Vo as ContextBridge,yr as ControlsReactContext,De as CreateCustomShape,Fo as CustomContextBridge,Oo as CustomContextBridgeProvider,Wo as EventsProvider,st as Image,Gi as ImageService,Dr as ImageServiceLoaderContext,Ho as InnerViewerProvider,Pr as LanguageProvider,Nr as LanguageString,M as LocaleString,ro as ManifestContext,Hn as ManifestMetadata,Xr as MediaPlayerProvider,V as Metadata,Di as PolygonSelector,io as RangeContext,qo as ReactEventContext,jt as ReactVaultContext,Or as Render3DModelStrategy,Gr as RenderAccompanyingCanvas,$r as RenderAnnotationStrategy,Qr as RenderAudioStrategy,zr as RenderComplexTimelineStrategy,br as RenderEmptyStrategy,Fr as RenderImageStrategy,Gn as RenderSvgEditorControls,qr as RenderTextualContentStrategy,Jr as RenderVideoStrategy,Zr as RenderYouTubeStrategy,L as ResourceProvider,Zt as ResourceReactContext,ni as SelectorControllerProvider,Yn as SequenceThumbnails,Ao as SimpleViewerProvider,Lo as SimpleViewerReactContext,be as SingleCanvasThumbnail,gr as StrategyReactContext,_r as ThumbnailFallbackImage,kr as TranslationProvider,wr as TransliterationProvider,eo as VaultProvider,F as ViewerPresetContext,Yo as VirtualAnnotationProvider,no as VisibleCanvasReactContext,yo as authDetailsForResource,go as createAuthStateStore,ho as createProbe,zo as defaultEmitter,tr as emptyActions,nr as emptyStrategy,so as findAllCanvasesInRange,ao as findFirstCanvasFromRange,lo as findManifestSelectedRange,co as findSelectedRange,ir as flattenAnnotationPageIds,Cr as formatTime,lr as get3dStrategy,dr as getComplexTimelineStrategy,Ne as getDefaultAnnotationStyles,cr as getImageStrategy,uo as getManifestSequence,er as getParsedTargetSelector,fr as getRenderingStrategy,mr as getTextualContentStrategy,ur as getVideoStrategy,mo as getVisibleCanvasesFromCanvasId,po as hasAuth,xo as makeAccessServiceRequest,vo as makeAccessTokenRequest,jo as parseSpecificResource,Bt as svgThemes,or as unknownResponse,rr as unsupportedStrategy,Jo as useAnnotation,Zo as useAnnotationPage,ue as useAnnotationPageManager,Be as useAnnotationStyles,da as useAnnotationsAtTime,wo as useAuthActions,To as useAuthService,Po as useAuthStore,No as useAuthToken,Eo as useAuthTokens,w as useCanvas,va as useCanvasChoices,Sa as useCanvasClock,fo as useCanvasSequence,Yr as useCanvasStartTime,ka as useCanvasSubset,Br as useClosestLanguage,Ea as useCollection,Ar as useComplexTimeline,$o as useContextBridge,Lr as useCreateLocaleString,Ro as useCurrentAuth,Do as useCustomContextBridge,Ko as useDispatch,le as useEventEmitter,Ha as useEventListener,to as useExistingVault,Wa as useExternalCollection,oo as useExternalManifest,re as useExternalResource,Tr as useIIIFLanguage,G as useImage,Ve as useImageService,he as useImageServiceLoader,_a as useImageTile,ko as useIsAuthEnabled,pe as useLoadImageService,Mr as useLocaleString,D as useManifest,Kr as useMediaActions,Ur as useMediaElements,Vr as useMediaState,sr as usePaintables,O as usePaintingAnnotations,Me as usePolygonHelper,ae as useRange,vr as useRenderControls,pr as useRenderingStrategy,q as useResourceContext,Qo as useResourceEvents,ar as useResources,Mo as useSearchService,Ee as useSelectorController,ii as useSelectorEmitter,Te as useSelectorEvents,ai as useSelectorHelper,Ir as useSimpleMediaPlayer,se as useSimpleViewer,hr as useStrategy,ja as useStyleHelper,Go as useStyles,qe as useSvgEditor,ye as useThumbnail,Er as useTranslations,Rr as useTransliteration,P as useVault,Wr as useVaultEffect,W as useVaultSelector,_o as useViewerPreset,Uo as useVirtualAnnotationPage,Xo as useVirtualAnnotationPageContext,ie as useVisibleCanvases};
|
|
1
|
+
import{$ as zo,$a as q,A as uo,Aa as rr,Ab as Yr,B as fo,Ba as nr,Bb as Gr,C as po,Ca as ir,Cb as rn,D as go,Da as ar,Db as ve,E as ho,Ea as sr,Eb as nn,F as yo,Fa as lr,Fb as xe,G as vo,Ga as cr,Gb as D,H as xo,Ha as mr,Hb as an,I as So,Ia as ur,Ib as fn,J as bo,Ja as dr,Jb as pn,K as Co,Ka as fr,Kb as gn,L as Io,La as de,Lb as Se,M as Ro,Ma as fe,Mb as be,N as Po,Na as pr,Nb as Ce,O as wo,Oa as gr,P as To,Pa as pe,Q as qo,Qa as ge,R as Ao,Ra as hr,S as No,Sa as yr,T as Eo,Ta as vr,U as ae,Ua as xr,V as ko,Va as Sr,W as Mo,Wa as br,X as Ho,Xa as Cr,Y as B,Ya as Ir,Z as se,Za as Rr,_ as le,_a as Pr,a as Xt,aa as Lo,ab as he,b as H,ba as Bo,bb as wr,c as A,ca as ce,cb as Tr,d as oe,da as me,db as qr,e as Yt,ea as Do,eb as Ar,f as Gt,fa as Wo,fb as X,g as P,ga as R,gb as Nr,h as z,ha as Oo,hb as Er,i as Jt,ia as Fo,ib as kr,j as re,ja as Vo,jb as Mr,k as Zt,ka as $o,kb as Hr,l as L,la as Ko,lb as zr,m as ne,ma as w,mb as Lr,n as jt,na as _o,nb as Br,o as eo,oa as Qo,ob as Dr,p as to,pa as Uo,pb as Wr,q as oo,qa as Xo,qb as ye,r as ro,ra as Yo,rb as Or,s as no,sa as Go,sb as Fr,t as io,ta as Jo,tb as Vr,u as ao,ua as Zo,ub as $r,v as so,va as jo,vb as Kr,w as ie,wa as er,wb as _r,x as lo,xa as ue,xb as Qr,y as co,ya as tr,yb as Ur,z as mo,za as or,zb as Xr}from"./chunk-JX3DXSPO.js";import{a as Jr,b as Zr,c as jr,d as en,e as tn,f as on,g as sn,h as ln,i as cn,j as mn,k as un,l as dn}from"./chunk-XNDN34SQ.js";export*from"@iiif/helpers/annotation-targets";import{useEffect as Xe}from"react";import{useCallback as Ie,useEffect as Qe,useRef as Ue,useState as W}from"react";import{useStore as N}from"zustand";function Re(e){let[t,o]=W(0),r=R(),n=N(r,y=>y.tool.enabled),i=N(r,y=>y.tool.requestId),a=N(r,y=>y.getRequestId),s=N(r,y=>y.requestAnnotation),d=N(r,y=>y.completeRequest),m=N(r,y=>y.cancelRequest),l=Ue(e?.onSuccess);l.current=e?.onSuccess;let[p,v]=W(!1),[b,S]=W(null),[c,u]=W(null),f=n&&i!==c,g=n&&i===c,h=Ie(async(y,_e)=>{if(c){let te=l.current;v(!0);let M=await s(y,{..._e,requestId:c});if(M)return te?.(M),o(U=>U+1),v(!1),S(M),M;let Q={id:c,cancelled:!0,...me(y)};return te?.(Q),S(Q),o(U=>U+1),v(!1),Q}return null},[s,c]),x=Ie(()=>{S(null),v(!1)},[]);return Qe(()=>{let y=a();return u(y.requestId),()=>{y.clear()}},[t]),{id:t,busy:f,isPending:p,isActive:g,requestId:c,requestAnnotation:h,cancelRequest:()=>c?m(c):void 0,completeRequest:()=>c?d(c):void 0,reset:x,data:b}}var In=[{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 Pe(e){let{id:t,data:o,requestAnnotation:r,cancelRequest:n,isPending:i}=Re({onSuccess:a=>{e.updateShape(a.polygon)}});return Xe(()=>(r({type:"polygon",open:e.shape?.open,points:e.shape?.points}),()=>{n()}),[]),null}import{createContext as Ye,useCallback as we,useContext as qe,useEffect as Te,useMemo as Y,useState as Ge}from"react";import Ae from"mitt";import{jsx as Je}from"react/jsx-runtime";var O=Ye(Ae());O.displayName="SelectorHelper";function Nn({children:e}){return Je(O.Provider,{value:Y(()=>Ae(),[]),children:e})}function En(){return qe(O)}function Ne(e){let t=Ee(),[o,r]=Ge(!1);Te(()=>t.withSelector(e).on("highlight",()=>{r(!0)}),[t,e]),Te(()=>t.withSelector(e).on("clear-highlight",()=>{r(!1)}),[t,e]);let n=we(a=>{t.emit("click",{selectorId:e,event:a})},[e,t]),i=we(a=>{t.emit("hover",{selectorId:e,event:a})},[e,t]);return{controller:t,onClick:n,onHover:i,isHighlighted:o}}function Ee(){let e=qe(O);return Y(()=>({withSelector(t){return{on(o,r){let n=i=>{i&&i.selectorId===t&&r(i)};return e.on(o,n),()=>{e.off(o,n)}},emit(o,r){e.emit(o,{...r,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function kn(){let e=Ee();return Y(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(o,r){return e.withSelector(t).on(o,r)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,r){return e.emit("event-listener",{selectorId:t,name:o,callback:r}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:r})}},getImagePreview(t){return new Promise((o,r)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:r})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as Ze,useContext as je,useMemo as et}from"react";import{jsx as tt}from"react/jsx-runtime";function ke(){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 G=Ze(ke());G.displayName="AnnotationStyle";function Me(){return je(G)}function Ln({theme:e,children:t}){let o=et(()=>e||ke(),[e]);return tt(G.Provider,{value:o,children:t})}import{jsx as He}from"react/jsx-runtime";function _n(e){let t=w(),o=e.annotationBucket,r=e.readOnly,n=e.id,{onClick:i,isHighlighted:a}=Ne(e.id),s=Me(),d=a?s.highlighted:s[o||"hidden"]||s.hidden;if(!t)return null;if(r){let m="shape",l=e.polygon,p=l.open;return l?He(m,{id:`shape-${n}`,points:l.points,open:p,onClick:i,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:d}):null}return He(Pe,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{useCanvas as ot}from"@atlas-viewer/atlas";import{forwardRef as rt,useImperativeHandle as nt}from"react";import{Fragment as it,jsx as ze}from"react/jsx-runtime";var jn=rt(function({canvasId:t},o){let r=ot(),n=ve(t||r?.id),i=P();return nt(o,()=>n,[t,r]),!r||n.enabledPageIds.length===0?null:ze(it,{children:n.enabledPageIds.map(a=>ze(Ce.RenderAnnotationPage,{page:i.get(a)},a))})});import{useMemo as lt}from"react";import{useMemo as at}from"react";import{Fragment as st,jsx as C,jsxs as F}from"react/jsx-runtime";function V({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:r=!0,allowHtml:n,emptyFallback:i,classes:a={},emptyMessage:s="No metadata available",emptyValueFallback:d="No value",emptyLabelFallback:m="",separator:l,tableFooter:p,tableHeader:v}){let b=at(()=>{let c=(t||[]).reduce((f,g)=>[...f,...g.keys],[]),u={};for(let f of e){let g=f&&f.label?Object.values(f.label):[];for(let h of g)if(h&&h.length&&(c.indexOf(`metadata.${h[0]}`)!==-1||c.length===0)&&f){let x=`metadata.${h[0]}`;u[x]=u[x]?u[x]:[],u[x].push(f);break}}return u},[t,e]);return Object.keys(b).length===0&&r?C(st,{children:i})||C("div",{className:a.empty,children:s}):t&&t.length?F("table",{className:a.container,children:[v,C("tbody",{children:t.map((c,u)=>{let f=[];for(let g of c.keys)for(let h of b[g]||[])f.push(C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:h.value},u+"__"+g));return f.length===0?null:F("tr",{className:a.row,children:[C("td",{className:a.label,style:o?{minWidth:o}:{},children:C(q,{enableDangerouslySetInnerHTML:n,separator:l,defaultText:m,children:c.label})}),C("td",{className:a.value,children:f})]},u)})}),p]}):F("table",{className:a.container,children:[v,C("tbody",{children:e&&e.length?e.map((c,u)=>c?F("tr",{className:a.row,children:[C("td",{className:a.label,style:o?{minWidth:o}:{},children:C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:c.label})}),C("td",{className:a.value,children:C(q,{enableDangerouslySetInnerHTML:n,defaultText:d,separator:l,children:c.value})})]},u):null):null}),p]})}import{jsx as ct}from"react/jsx-runtime";function di(e){let t=L(),o=w(),r=ie(),n=lt(()=>{let i=t?.metadata||[],a=o?.metadata||[],s=r?.metadata||[];return[...i,...a,...s]},[t,o,r]);return ct(V,{metadata:n,...e})}import{useEffect as ft,useState as pt}from"react";import{createImageServiceRequest as mt,imageServiceRequestToString as ut}from"@iiif/parser/image-3";import{useMemo as dt}from"react";function J(e,t={},o=[]){return dt(()=>{if(!e)return null;let r=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(r="default"));let n=mt(e);return ut({identifier:n.identifier,server:n.server,scheme:n.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:r||"default",prefix:n.prefix,originalPath:n.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function gt(e){let t=typeof e.src=="string"?e.src:e.src.id,o=de(),[r,n]=pt(!1),i;if(t){let s=o.loadServiceSync({id:t});s&&(i=s)}!i&&!r&&o.loadService({id:t}).then(()=>{n(!0)});let a=J(i,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[r,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return ft(()=>()=>{n(!1)},[t]),a?$("img",{src:a,alt:e.alt,className:e.className,style:e.style}):$(ht,{...e,fetchImageService:!1})}function ht(e){if(e.fetchImageService)return $(gt,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=J(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{useMemo as yt,useState as vt}from"react";import{ErrorBoundary as xt}from"react-error-boundary";import{jsx as E,jsxs as bt}from"react/jsx-runtime";function Mi({src:e,errorFallback:t,interactive:o,skipSizes:r,children:n,renderViewerControls:i,viewControlsDeps:a,fluid:s,x:d,y:m,...l}){let[p,v]=vt(),b=t||Se,[S,c]=xe(),u=yt(()=>{let g=c[e]?.status,h=S({id:e},{});return h?.height&&h.width&&g!=="loading"?{id:e,width:h.width,height:h.height,service:h,type:"Image",selector:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}},target:{type:"BoxSelector",spatial:{x:0,y:0,width:h.width,height:h.height}}}:null},[S,e,c]);if(!u||!u.height||!u.width)return null;let f=s?void 0:l.homePosition?l.homePosition.width/l.homePosition.height:u.width/u.height;return E(xt,{resetKeys:[],fallbackRender:g=>E(b,{...l,...g}),children:E(be,{...l,aspectRatio:f,containerProps:{style:{position:"relative"},...l.containerProps||{}},onCreated:g=>{v(g),l.onCreated&&l.onCreated(g)},children:bt(X.Provider,{value:p,children:[E(he,{image:u,id:u.id,isStatic:!o,x:d,y:m},u.id),E(St,{viewerPreset:p,renderViewerControls:i,image:u,src:e,viewControlsDeps:a}),n]})})})}function St({viewerPreset:e,renderViewerControls:t,image:o,src:r,viewControlsDeps:n}){return ue(e&&t?"overlay":"none",`canvas-portal-controls-${r}`,X.Provider,t&&o?{value:e||null,children:t({image:o,images:[o],type:"images"})}:{},[r,e,...n||[]]),null}import{jsx as Ct}from"react/jsx-runtime";function Wi(e){let t=L();return Ct(V,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as Tt,useRef as qt}from"react";import*as Z from"react-lazy-load-image-component";import{getValue as It}from"@iiif/helpers/i18n";import{Fragment as Le,jsx as T,jsxs as wt}from"react/jsx-runtime";var{LazyLoadComponent:Rt}=Z||Z.default;function Be(e){let{size:t,visible:o,classes:r,canvasId:n,figure:i}=e,a=t?.width||128,s=t?.height||t?.width||128,d=T(Pt,{...e}),m=T(Rt,{threshold:300,style:{height:s,width:a},visibleByDefault:o,children:n?T(oe,{canvas:n,children:d}):d});return i?T("figure",{className:r?.figure,children:m}):m}function Pt({fallback:e,size:t,classes:o,showLabel:r,alt:n,dereference:i=!1}){let a=w(),s=t?.width||128,d=t?.height||t?.width||128,m=n||It(a?.label)||"",l=fe({width:s,height:d,allowUnsafe:!0},i);return!l||l.type!=="fixed"?T(Le,{children:e}):wt(Le,{children:[T("div",{className:o?.imageWrapper,children:T("img",{className:o?.img,src:l.id,alt:m})}),r?T(q,{as:"figcaption",className:o?.label,children:a?.label}):null]})}import{jsx as k}from"react/jsx-runtime";function Zi({scrollBehaviour:e,dereference:t,flat:o,size:r,classes:n={},showLabel:i,figure:a,fallback:s}){let d=qt(null),{items:m,sequence:l,currentSequenceIndex:p,setSequenceIndex:v}=ae(),b={row:n.selected?.row||n.row,item:n.selected?.item||n.item,figure:n.selected?.figure||n.figure,img:n.selected?.img||n.img,label:n.selected?.label||n.label,imageWrapper:n.selected?.imageWrapper||n.imageWrapper};Tt(()=>{if(!d.current)return;let c=d.current.querySelector("[data-selected=true]");c&&c.scrollIntoView({behavior:e||"instant",block:"nearest",inline:"center"})},[p]);let S=[];for(let c of l){let u=[],f=l[p]===c;for(let g of c){let h=m[g];u.push(k("div",{className:f?b.item:n.item,children:k(Be,{classes:f?b:n,canvasId:h.id,size:r,dereference:t,showLabel:i,figure:a,placeholder:k("div",{style:{height:128,width:128}}),fallback:s})},g))}if(o){S.push(u);continue}S.push(k("div",{onClick:g=>{v(l.indexOf(c))},"data-selected":f,className:f?b.row:n.row,children:u},c.join("-")))}return k("div",{ref:d,className:n.container,children:S})}import{useStore as K}from"zustand";function De(){let e=R(),t=K(e,i=>i.completeRequest),o=K(e,i=>i.polygonState.currentTool),r=K(e,i=>i.polygonState.selectedStamp),n=K(e,i=>i.switchTool);return{completeRequest:t,currentTool:o,selectedStamp:r,switchTool:n}}import{Fragment as We,jsx as I,jsxs as Oe}from"react/jsx-runtime";var At={draw:!0,polygon:!0,line:!0,lineBox:!0,box:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0,pen:!0};function ia({showShapes:e=!0,enabled:t=At,classNames:o={},icons:r={}}){let{currentTool:n,switchTool:i,selectedStamp:a}=De();return Oe(We,{children:[n,I("button",{className:o.button,onClick:i.pointer,"data-active":n==="pointer",children:r.PointerIcon||"Pointer"}),I("button",{className:o.button,onClick:i.hand,"data-active":n==="hand",children:r.HandIcon||"Hand"}),e?Oe(We,{children:[t.box&&I("button",{className:o.button,onClick:i.box,"data-active":n==="box",children:r.BoxIcon||"Box"}),t.pen&&I("button",{className:o.button,onClick:i.pen,"data-active":n==="pen",children:r.PenIcon||"Pen"}),t.draw&&I("button",{className:o.button,onClick:i.draw,"data-active":n==="pencil",children:r.DrawIcon||"Draw"}),t.line&&I("button",{className:o.button,onClick:i.line,"data-active":n==="line",children:r.LineIcon||"Line"}),t.lineBox&&I("button",{className:o.button,onClick:i.lineBox,"data-active":n==="lineBox",children:r.LineBoxIcon||"LineBox"}),t.triangle&&I("button",{className:o.button,onClick:i.triangle,"data-active":n==="stamp"&&a?.id==="triangle",children:r.TriangleIcon||"Triangle"}),t.hexagon&&I("button",{className:o.button,onClick:i.hexagon,"data-active":n==="stamp"&&a?.id==="hexagon",children:r.HexagonIcon||"Hexagon"}),t.circle&&I("button",{className:o.button,"data-active":n==="stamp"&&a?.id==="circle",onClick:i.circle,children:r.CircleIcon||"Circle"})]}):null,t.delete&&I("button",{className:o.button,onClick:i.remove,children:r.DeleteForeverIcon||"Delete"})]})}import{jsx as Nt}from"react/jsx-runtime";function ca({annotation:e,children:t}){return Nt(A,{value:{annotation:e},children:t})}import{jsx as Et}from"react/jsx-runtime";function fa({annotationPage:e,children:t}){return Et(A,{value:{annotationPage:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function ya({collection:e,children:t}){return kt(A,{value:{collection:e},children:t})}function ba(e,t={}){return D(t)}import{useCanvas as Mt}from"@atlas-viewer/atlas";import{useEffect as Ht,useMemo as j,useState as zt}from"react";function Ta({canvasId:e}={}){let t=Mt(),o=re(),r=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[n,i]=zt({}),a=ye();Ht(()=>{let m=l=>{let p=l.partOf.canvasId;p&&i(v=>({...v,[p]:l.choice}))};return a.on("choice-change",m),()=>{a.off("choice-change",m)}},[]);let s=j(()=>{let m=[];for(let l of r){let p=n[l];p&&m.push({canvasId:l,choice:p})}return m},[r,n]),d=j(()=>({makeChoice:(m,l)=>{a.emit("make-choice",{choiceId:m,...l})}}),[a]);return{choices:s,actions:d}}function Aa(e,t=!1){}function Ma(e){let o=H().manifest,r=e?e.map(n=>typeof n=="string"?n:n?.id):[];return z(n=>{let i=o?n.iiif.entities.Manifest[o]:void 0,a=i?.items||[];if(typeof e>"u")return a;let s=[];for(let d of i?.items||[])r.indexOf(d.id)!==-1&&s.push(d);return s},[r.join("/")])}import{useMemo as Lt}from"react";function Da(e,t=[]){let{id:o,selector:r}=e,n=H(),i=o||n.collection,a=z(s=>i?s.iiif.entities.Collection[i]:void 0,[i]);return Lt(()=>{if(a)return r?r(a):a},[a,r,...t])}import{startTransition as Bt,useMemo as Dt}from"react";import{useStore as Fe}from"zustand";function $a(){let e=R(),t=Fe(e,r=>r.completeRequest),o=Fe(e,r=>r.cancelRequest);return Dt(()=>({saveAnnotation:()=>{Bt(()=>{t()})},cancelRequest:o}),[t,o])}import{useCallback as Wt}from"react";import{useStore as ee}from"zustand";function Xa({requestId:e}={}){let t=R(),o=ee(t,s=>s.metadata),r=ee(t,s=>s.tool.requestId),n=e||r,i=ee(t,s=>s.setMetadata),a=Wt(s=>i(s,n||void 0),[i,n]);return[n?o[n]||{}:{},a]}import{useStore as Ot}from"zustand";function ja(e){let t=R(),o=Ot(t,r=>r.tool.requestId);B("polygons.start-transition",r=>{e.requestId&&o!==e.requestId||e?.onStart?.(r.transitionIntent)},[o,e.requestId]),B("polygons.end-transition",r=>{e.requestId&&o!==e.requestId||e?.onEnd?.(r.transitionIntent,r.response)},[o,e.requestId]),B("polygons.transition",r=>{e.requestId&&o!==e.requestId||e?.onTransition?.(r.transitionIntent)},[o,e.requestId])}import{useEffect as Ft,useMemo as Vt}from"react";import{createEventsHelper as $t}from"@iiif/helpers/events";function ns(e,t,o,r,n=[]){let i=P(),a=Vt(()=>$t(i),[i]);Ft(()=>{let s=e;return s?(a.addEventListener(s,t,o,r),()=>{a.removeEventListener(s,t,o)}):()=>{}},[a,e,t,...n])}function ls(e,t){let{id:o,isLoaded:r,error:n,resource:i,requestId:a,cached:s}=ne(e,t);return{id:o,isLoaded:r,error:n,manifest:i,requestId:a,cached:s}}import{getImageServices as Ve}from"@iiif/parser/image-3";import{useEffect as Kt,useMemo as $e,useState as _}from"react";function Ke({cacheKey:e}={}){let t=w(),o=D(),r=P(),n=pe(),i=ge(),[a,s]=_(void 0),[d,m]=_(!1),[l,p]=_("idle"),[v,b]=_(void 0),S=t?t.id:"undefined",c=$e(()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),x=Ve(g)[0];return x&&n(x,{width:x.width||t.width,height:x.height||t.height},!0)||void 0}}catch(f){console.error(f)}},[S,e,t]),u=l==="success"&&a?a:c;return Kt(()=>{(async()=>{try{if(t&&o.length){let f=o[0],g=r.get(f.body[0]),x=Ve(g)[0];if(!x)return;m(!0),p("loading");try{let y=await i(x,{width:x.width||t.width,height:x.height||t.height})||void 0;s(y),p("success"),m(!1)}catch(y){p("error"),b(y)}}}catch(f){p("error"),b(f)}})()},[S,e]),$e(()=>({data:u,isFetching:d,status:l,error:v}),[u,d,l,v])}function vs(){let e=Ke();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 _t}from"@iiif/helpers/styles";import{useMemo as Qt}from"react";function Is(){let e=P();return Qt(()=>_t(e),[e])}function Ps(e,t){let{x:o,y:r,width:n,height:i}=e,{x:a,y:s}=t,{width:d,height:m}=t;return o+n>a&&o<a+d&&r+i>s&&r<s+m}import Ut from"tiny-invariant";function Es(e,t){let o=e.boundingBox||le(e.polygon);if(e.polygon&&!se(e.polygon.points)){let r=e.target||ce(e.polygon,t);return Ut(r?.type==="SvgSelector"),{type:"SvgSelector",points:e.polygon.points,spatial:{unit:"pixel",...o||{}},svgShape:e.polygon.open?"polyline":"polygon",svg:r.value}}return{type:"BoxSelector",spatial:o}}export{ca as AnnotationContext,fa as AnnotationPageContext,Ln as AnnotationStyleProvider,Fo as AtlasStoreProvider,Wo as AtlasStoreReactContext,To as Auth,xo as AuthProvider,ho as AuthRContext,yo as AuthReactContext,vo as AuthReactContextActions,jn as CanvasAnnotations,oe as CanvasContext,Ce as CanvasPanel,pn as CanvasStrategyProvider,gn as CanvasWorldObject,ya as CollectionContext,di as CombinedMetadata,wr as ComplexTimelineProvider,_r as ContextBridge,nr as ControlsReactContext,Pe as CreateCustomShape,Vr as CustomContextBridge,$r as CustomContextBridgeProvider,Gr as DefaultEditingTools,Mo as EventEmitterProvider,Or as EventsProvider,ht as Image,Mi as ImageService,fr as ImageServiceLoaderContext,No as InnerViewerProvider,yr as LanguageProvider,Cr as LanguageString,q as LocaleString,eo as ManifestContext,Wi as ManifestMetadata,Jo as MediaPlayerProvider,V as Metadata,_n as PolygonSelector,to as RangeContext,ko as ReactEmitterContext,Wr as ReactEventContext,Yt as ReactVaultContext,rr as Render3DModelStrategy,ar as RenderAccompanyingCanvas,_o as RenderAnnotation,Yr as RenderAnnotationEditing,Uo as RenderAnnotationPage,ur as RenderAnnotationStrategy,gr as RenderAudioStrategy,qr as RenderComplexTimelineStrategy,Ar as RenderEmptyStrategy,Er as RenderImageStrategy,ia as RenderSvgEditorControls,kr as RenderTextualContentStrategy,Mr as RenderVideoStrategy,Hr as RenderYouTubeStrategy,A as ResourceProvider,Xt as ResourceReactContext,Nn as SelectorControllerProvider,Zi as SequenceThumbnails,Eo as SimpleViewerProvider,Ao as SimpleViewerReactContext,Be as SingleCanvasThumbnail,tr as StrategyReactContext,pr as ThumbnailFallbackImage,hr as TranslationProvider,vr as TransliterationProvider,Gt as VaultProvider,X as ViewerPresetContext,mr as VirtualAnnotationProvider,Jt as VisibleCanvasReactContext,Es as annotationResponseToSelector,fo as authDetailsForResource,Do as createAtlasStore,mo as createAuthStateStore,uo as createProbe,Dr as defaultEmitter,Lr as defaultSvgTheme,jr as emptyActions,on as emptyStrategy,ro as findAllCanvasesInRange,oo as findFirstCanvasFromRange,no as findManifestSelectedRange,io as findSelectedRange,rn as flattenAnnotationPageIds,jo as formatTime,sn as get3dStrategy,Oo as getAtlasStoreByName,un as getComplexTimelineStrategy,ke as getDefaultAnnotationStyles,ln as getImageStrategy,so as getManifestSequence,Zr as getParsedTargetSelector,dn as getRenderingStrategy,cn as getTextualContentStrategy,mn as getVideoStrategy,ao as getVisibleCanvasesFromCanvasId,co as hasAuth,Lo as isBoxSelector,se as isRectangle,zo as isSvgSelector,go as makeAccessServiceRequest,po as makeAccessTokenRequest,Jr as parseSpecificResource,ce as polygonToTarget,me as requestToAnnotationResponse,Bo as seraliseSupportedSelector,In as svgThemes,Ps as targetIntersects,en as unknownResponse,tn as unsupportedStrategy,Ko as useAnnotation,Qo as useAnnotationPage,ve as useAnnotationPageManager,Me as useAnnotationStyles,ba as useAnnotationsAtTime,Ur as useAtlasContextMenu,R as useAtlasStore,Co as useAuthActions,Ro as useAuthService,bo as useAuthStore,wo as useAuthToken,Po as useAuthTokens,w as useCanvas,Ta as useCanvasChoices,Aa as useCanvasClock,lo as useCanvasSequence,Zo as useCanvasStartTime,Ma as useCanvasSubset,Ir as useClosestLanguage,Da as useCollection,Tr as useComplexTimeline,Kr as useContextBridge,Qr as useContextMenuStore,Pr as useCreateLocaleString,$a as useCurrentAnnotationActions,Xa as useCurrentAnnotationMetadata,Xr as useCurrentAnnotationRequest,ja as useCurrentAnnotationTransition,Io as useCurrentAuth,Fr as useCustomContextBridge,sr as useDispatch,Ho as useEmitter,B as useEvent,ye as useEventEmitter,ns as useEventListener,Zt as useExistingVault,ls as useExternalCollection,jt as useExternalManifest,ne as useExternalResource,Sr as useIIIFLanguage,J as useImage,Ke as useImageService,de as useImageServiceLoader,vs as useImageTile,So as useIsAuthEnabled,xe as useLoadImageService,Rr as useLocaleString,L as useManifest,Yo as useMediaActions,Go as useMediaElements,Xo as useMediaState,an as usePaintables,D as usePaintingAnnotations,zr as usePolygonHelper,ie as useRange,ir as useRenderControls,fn as useRenderingStrategy,Re as useRequestAnnotation,H as useResourceContext,Vo as useResourceEvents,nn as useResources,qo as useSearchService,Ee as useSelectorController,En as useSelectorEmitter,Ne as useSelectorEvents,kn as useSelectorHelper,er as useSimpleMediaPlayer,ae as useSimpleViewer,or as useStrategy,Is as useStyleHelper,$o as useStyles,Br as useSvgEditor,De as useSvgEditorControls,fe as useThumbnail,br as useTranslations,xr as useTransliteration,P as useVault,dr as useVaultEffect,z as useVaultSelector,Nr as useViewerPreset,lr as useVirtualAnnotationPage,cr as useVirtualAnnotationPageContext,re as useVisibleCanvases};
|
|
@@ -82,15 +82,6 @@ declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record
|
|
|
82
82
|
real?: boolean | undefined;
|
|
83
83
|
}>];
|
|
84
84
|
|
|
85
|
-
type SingleImageStrategy = {
|
|
86
|
-
type: 'images';
|
|
87
|
-
image: ImageWithOptionalService;
|
|
88
|
-
images: Array<ImageWithOptionalService>;
|
|
89
|
-
choice?: ChoiceDescription;
|
|
90
|
-
annotations?: AnnotationPageDescription;
|
|
91
|
-
};
|
|
92
|
-
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
93
|
-
|
|
94
85
|
type Single3DModelStrategy = {
|
|
95
86
|
type: '3d-model';
|
|
96
87
|
model: ExternalWebResource;
|
|
@@ -160,6 +151,15 @@ type UnknownStrategy = {
|
|
|
160
151
|
};
|
|
161
152
|
type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | TextualContentStrategy | UnknownStrategy | EmptyStrategy;
|
|
162
153
|
|
|
154
|
+
type SingleImageStrategy = {
|
|
155
|
+
type: 'images';
|
|
156
|
+
image: ImageWithOptionalService;
|
|
157
|
+
images: Array<ImageWithOptionalService>;
|
|
158
|
+
choice?: ChoiceDescription;
|
|
159
|
+
annotations?: AnnotationPageDescription;
|
|
160
|
+
};
|
|
161
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
162
|
+
|
|
163
163
|
type StrategyActions = {
|
|
164
164
|
makeChoice: (id: string, options?: {
|
|
165
165
|
deselectOthers?: boolean;
|
|
@@ -190,4 +190,4 @@ type UseRenderingStrategyOptions = {
|
|
|
190
190
|
};
|
|
191
191
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
192
192
|
|
|
193
|
-
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 SingleAudio as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleVideo as a, type StrategyActions as b, type SingleImageStrategy as c, type ImageServiceLoaderType as d, type
|
|
193
|
+
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 SingleAudio as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleVideo as a, type StrategyActions as b, type SingleImageStrategy as c, type ImageServiceLoaderType as d, type Single3DModelStrategy as e, getImageStrategy as f, get3dStrategy as g, type SingleYouTubeVideo as h, type AnnotationPageDescription as i, type TextualContentStrategy as j, type TextContent as k, getTextualContentStrategy as l, type UseRenderingStrategy as m, type ChoiceEvents as n, type UseRenderingStrategyOptions as o, useRenderingStrategy as p, useLoadImageService as u };
|
|
@@ -82,15 +82,6 @@ declare function useLoadImageService(): readonly [ImageServiceLoaderType, Record
|
|
|
82
82
|
real?: boolean | undefined;
|
|
83
83
|
}>];
|
|
84
84
|
|
|
85
|
-
type SingleImageStrategy = {
|
|
86
|
-
type: 'images';
|
|
87
|
-
image: ImageWithOptionalService;
|
|
88
|
-
images: Array<ImageWithOptionalService>;
|
|
89
|
-
choice?: ChoiceDescription;
|
|
90
|
-
annotations?: AnnotationPageDescription;
|
|
91
|
-
};
|
|
92
|
-
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
93
|
-
|
|
94
85
|
type Single3DModelStrategy = {
|
|
95
86
|
type: '3d-model';
|
|
96
87
|
model: ExternalWebResource;
|
|
@@ -160,6 +151,15 @@ type UnknownStrategy = {
|
|
|
160
151
|
};
|
|
161
152
|
type RenderingStrategy = SingleImageStrategy | MediaStrategy | ComplexTimelineStrategy | Single3DModelStrategy | TextualContentStrategy | UnknownStrategy | EmptyStrategy;
|
|
162
153
|
|
|
154
|
+
type SingleImageStrategy = {
|
|
155
|
+
type: 'images';
|
|
156
|
+
image: ImageWithOptionalService;
|
|
157
|
+
images: Array<ImageWithOptionalService>;
|
|
158
|
+
choice?: ChoiceDescription;
|
|
159
|
+
annotations?: AnnotationPageDescription;
|
|
160
|
+
};
|
|
161
|
+
declare function getImageStrategy(canvas: CanvasNormalized, paintables: Paintables, loadImageService: ImageServiceLoaderType): SingleImageStrategy | UnknownStrategy;
|
|
162
|
+
|
|
163
163
|
type StrategyActions = {
|
|
164
164
|
makeChoice: (id: string, options?: {
|
|
165
165
|
deselectOthers?: boolean;
|
|
@@ -190,4 +190,4 @@ type UseRenderingStrategyOptions = {
|
|
|
190
190
|
};
|
|
191
191
|
declare function useRenderingStrategy(options?: UseRenderingStrategyOptions): UseRenderingStrategy;
|
|
192
192
|
|
|
193
|
-
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 SingleAudio as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleVideo as a, type StrategyActions as b, type SingleImageStrategy as c, type ImageServiceLoaderType as d, type
|
|
193
|
+
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 SingleAudio as S, type TimelineKeyframe as T, type UnknownStrategy as U, type VideoSequence as V, type SingleVideo as a, type StrategyActions as b, type SingleImageStrategy as c, type ImageServiceLoaderType as d, type Single3DModelStrategy as e, getImageStrategy as f, get3dStrategy as g, type SingleYouTubeVideo as h, type AnnotationPageDescription as i, type TextualContentStrategy as j, type TextContent as k, getTextualContentStrategy as l, type UseRenderingStrategy as m, type ChoiceEvents as n, type UseRenderingStrategyOptions as o, useRenderingStrategy as p, useLoadImageService as u };
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-PvoNjiMV.cjs';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import * as _iiif_helpers_vault from '@iiif/helpers/vault';
|
|
5
5
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
6
6
|
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Parse specific resource.
|
|
10
|
-
*
|
|
11
|
-
* This could be expanded to support pulling out more from the specific resource.
|
|
12
|
-
*
|
|
13
|
-
* @param resource
|
|
14
|
-
*/
|
|
15
|
-
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
16
|
-
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
17
|
-
declare const emptyActions: {
|
|
18
|
-
makeChoice: () => void;
|
|
19
|
-
};
|
|
20
|
-
declare const unknownResponse: UseRenderingStrategy[0];
|
|
21
|
-
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
22
|
-
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
23
|
-
|
|
24
8
|
type CompatVault = {
|
|
25
9
|
get: _iiif_helpers_vault.Vault['get'];
|
|
26
10
|
setMetaValue: _iiif_helpers_vault.Vault['setMetaValue'];
|
|
@@ -38,4 +22,20 @@ interface GetRenderStrategyOptions {
|
|
|
38
22
|
}
|
|
39
23
|
declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService, vault, }: GetRenderStrategyOptions): RenderingStrategy;
|
|
40
24
|
|
|
41
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Parse specific resource.
|
|
27
|
+
*
|
|
28
|
+
* This could be expanded to support pulling out more from the specific resource.
|
|
29
|
+
*
|
|
30
|
+
* @param resource
|
|
31
|
+
*/
|
|
32
|
+
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
33
|
+
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
34
|
+
declare const emptyActions: {
|
|
35
|
+
makeChoice: () => void;
|
|
36
|
+
};
|
|
37
|
+
declare const unknownResponse: UseRenderingStrategy[0];
|
|
38
|
+
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
39
|
+
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
40
|
+
|
|
41
|
+
export { type CompatVault as C, getParsedTargetSelector as a, unsupportedStrategy as b, emptyStrategy as c, emptyActions as e, getRenderingStrategy as g, parseSpecificResource as p, unknownResponse as u };
|
|
@@ -1,26 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { R as RenderingStrategy, d as ImageServiceLoaderType, m as UseRenderingStrategy, U as UnknownStrategy } from './useRenderingStrategy-PvoNjiMV.js';
|
|
2
2
|
import { CanvasNormalized } from '@iiif/presentation-3-normalized';
|
|
3
3
|
import { Paintables } from '@iiif/helpers/painting-annotations';
|
|
4
4
|
import * as _iiif_helpers_vault from '@iiif/helpers/vault';
|
|
5
5
|
import { ContentResource, W3CAnnotationTarget, PointSelector } from '@iiif/presentation-3';
|
|
6
6
|
import { TemporalBoxSelector, BoxSelector, SupportedTarget } from '@iiif/helpers';
|
|
7
7
|
|
|
8
|
-
/**
|
|
9
|
-
* Parse specific resource.
|
|
10
|
-
*
|
|
11
|
-
* This could be expanded to support pulling out more from the specific resource.
|
|
12
|
-
*
|
|
13
|
-
* @param resource
|
|
14
|
-
*/
|
|
15
|
-
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
16
|
-
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
17
|
-
declare const emptyActions: {
|
|
18
|
-
makeChoice: () => void;
|
|
19
|
-
};
|
|
20
|
-
declare const unknownResponse: UseRenderingStrategy[0];
|
|
21
|
-
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
22
|
-
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
23
|
-
|
|
24
8
|
type CompatVault = {
|
|
25
9
|
get: _iiif_helpers_vault.Vault['get'];
|
|
26
10
|
setMetaValue: _iiif_helpers_vault.Vault['setMetaValue'];
|
|
@@ -38,4 +22,20 @@ interface GetRenderStrategyOptions {
|
|
|
38
22
|
}
|
|
39
23
|
declare function getRenderingStrategy({ canvas, paintables, supports, loadImageService, vault, }: GetRenderStrategyOptions): RenderingStrategy;
|
|
40
24
|
|
|
41
|
-
|
|
25
|
+
/**
|
|
26
|
+
* Parse specific resource.
|
|
27
|
+
*
|
|
28
|
+
* This could be expanded to support pulling out more from the specific resource.
|
|
29
|
+
*
|
|
30
|
+
* @param resource
|
|
31
|
+
*/
|
|
32
|
+
declare function parseSpecificResource(resource: ContentResource): any[];
|
|
33
|
+
declare function getParsedTargetSelector(canvas: CanvasNormalized, target: W3CAnnotationTarget | W3CAnnotationTarget[]): [TemporalBoxSelector | BoxSelector | PointSelector | null, SupportedTarget['source']];
|
|
34
|
+
declare const emptyActions: {
|
|
35
|
+
makeChoice: () => void;
|
|
36
|
+
};
|
|
37
|
+
declare const unknownResponse: UseRenderingStrategy[0];
|
|
38
|
+
declare const unsupportedStrategy: (reason: string) => UnknownStrategy;
|
|
39
|
+
declare const emptyStrategy: (width: number, height: number) => UseRenderingStrategy[0];
|
|
40
|
+
|
|
41
|
+
export { type CompatVault as C, getParsedTargetSelector as a, unsupportedStrategy as b, emptyStrategy as c, emptyActions as e, getRenderingStrategy as g, parseSpecificResource as p, unknownResponse as u };
|
package/dist/utils.d.cts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { e as emptyActions,
|
|
2
|
-
import './useRenderingStrategy-
|
|
1
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-BVhGgVd5.cjs';
|
|
2
|
+
import './useRenderingStrategy-PvoNjiMV.cjs';
|
|
3
3
|
import '@iiif/helpers';
|
|
4
4
|
import '@iiif/presentation-3';
|
|
5
5
|
import '@iiif/presentation-3-normalized';
|
package/dist/utils.d.ts
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
export { e as emptyActions,
|
|
2
|
-
import './useRenderingStrategy-
|
|
1
|
+
export { e as emptyActions, c as emptyStrategy, a as getParsedTargetSelector, g as getRenderingStrategy, p as parseSpecificResource, u as unknownResponse, b as unsupportedStrategy } from './utils-DyrEcegR.js';
|
|
2
|
+
import './useRenderingStrategy-PvoNjiMV.js';
|
|
3
3
|
import '@iiif/helpers';
|
|
4
4
|
import '@iiif/presentation-3';
|
|
5
5
|
import '@iiif/presentation-3-normalized';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "react-iiif-vault",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.0",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "dist/index.cjs",
|
|
6
6
|
"module": "dist/index.js",
|
|
@@ -58,14 +58,15 @@
|
|
|
58
58
|
"react-reconciler": "0.29"
|
|
59
59
|
},
|
|
60
60
|
"dependencies": {
|
|
61
|
-
"@atlas-viewer/atlas": "^2.3.
|
|
62
|
-
"@
|
|
63
|
-
"@iiif/
|
|
61
|
+
"@atlas-viewer/atlas": "^2.3.7",
|
|
62
|
+
"@floating-ui/react": "^0.27.13",
|
|
63
|
+
"@iiif/helpers": "^1.5.0",
|
|
64
|
+
"@iiif/parser": "^2.2.0",
|
|
64
65
|
"@iiif/presentation-2": "^1.0.4",
|
|
65
66
|
"@iiif/presentation-3": "^2.2.3",
|
|
66
67
|
"@iiif/presentation-3-normalized": "^0.9.7",
|
|
67
68
|
"mitt": "^3.0.1",
|
|
68
|
-
"polygon-editor": "
|
|
69
|
+
"polygon-editor": "0.0.23",
|
|
69
70
|
"react-error-boundary": "^4.0.13",
|
|
70
71
|
"react-lazy-load-image-component": "^1.6.0",
|
|
71
72
|
"react-reconciler": "~0.29.0",
|
package/dist/chunk-2ATWK7I4.js
DELETED
|
@@ -1,48 +0,0 @@
|
|
|
1
|
-
import{c as bt,l as At}from"./chunk-XNDN34SQ.js";import{forwardRef as Pr,useImperativeHandle as Fa,useMemo as Da}from"react";import pn,{useCallback as ot,useMemo as gn,useState as Pe}from"react";import{AtlasAuto as Ko,ModeContext as jo}from"@atlas-viewer/atlas";import{ErrorBoundary as Wo}from"react-error-boundary";import{useContext as D,useMemo as Po}from"react";import wr,{useContext as Mr,useMemo as Er}from"react";import{jsx as kr}from"react/jsx-runtime";var Vr={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},Ce=wr.createContext(Vr),O=()=>Mr(Ce);function W({value:e,children:n}){let t=O(),r=Er(()=>({...t,...e}),[e,t]);return kr(Ce.Provider,{value:r,children:n})}import Nr,{useState as Lr}from"react";import{Vault as Pt,globalVault as zr}from"@iiif/helpers/vault";import{jsx as Tt}from"react/jsx-runtime";var Y=Nr.createContext({vault:null,setVaultInstance:e=>{}});function X({vault:e,vaultOptions:n,useGlobal:t,resources:r,children:o}){let[s,i]=Lr(()=>e||(t?zr(n):n?new Pt(n):new Pt));return Tt(Y.Provider,{value:{vault:s,setVaultInstance:i},children:Tt(W,{value:r||{},children:o})})}import{useContext as go}from"react";import{createContext as vo,useMemo as ho}from"react";import{globalVault as Or}from"@iiif/helpers/vault";import{useContext as Hr}from"react";function J(e){let n=Hr(Y);return e||(n&&n.vault?n.vault:Or())}import{useEffect as Fr,useMemo as Dr,useState as Ke}from"react";function It(e,{noCache:n=!1}={}){let t=typeof e=="string"?e:e.id,r=J(),[o,s]=Ke(t),[i,a]=Ke(void 0),c=Dr(()=>r.get(t,{skipSelfReturn:!0})||void 0,[t,r]),[u,l]=Ke(c);return Fr(()=>{(async()=>{try{let d=c&&!n?c:await r.load(t),v=d?d.id||d["@id"]:null;d&&o!==v&&s(v),l(d)}catch(d){a(d)}})()},[t,n]),{isLoaded:!!u,id:o,requestId:t,error:i,resource:u,cached:!!(u&&u===c)}}function wt(e,n){let{id:t,isLoaded:r,error:o,resource:s,requestId:i,cached:a}=It(e,n);return{id:t,isLoaded:r,error:o,manifest:s,requestId:i,cached:a}}import{jsx as $r}from"react/jsx-runtime";function Mt({manifest:e,children:n}){return $r(W,{value:{manifest:e},children:n})}import{jsx as Br}from"react/jsx-runtime";function _({canvas:e,children:n}){return Br(W,{value:{canvas:e},children:n})}import{useContext as Kr}from"react";import jr from"react";import{useContext as Ur}from"react";var A=()=>{let{vault:e}=Ur(Y);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};import{useEffect as qr,useState as _r}from"react";function T(e,n=[]){let t=A(),[r,o]=_r(()=>e(t.getState(),t));return qr(()=>t.subscribe(s=>e(s,t),s=>{o(s)},!1),n),r}var ee=jr.createContext([]);function xe(){let e=Kr(ee);return T(n=>e.map(t=>n.iiif.entities.Canvas[t]).filter(Boolean),[e])}import{useMemo as Wr}from"react";function M(e={},n=[]){let{id:t,selector:r}=e,o=O(),s=A(),i=t||o.manifest,a=T(c=>i?c.iiif.entities.Manifest[i]:void 0,[i]);return Wr(()=>{if(a)return r?r(a):a},[a,r,...n])}import{jsx as Yr}from"react/jsx-runtime";function Et({range:e,children:n}){return Yr(W,{value:{range:e},children:n})}function Qr(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=Qr(e,e.get(t));if(r)return r}}return null}function je(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(...je(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 Fs(e,n,t){for(let r of n.structures){let o=Vt(e,e.get(r),t);if(o)return o}return null}function Vt(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 s=Vt(e,e.get(r),t);if(s)return s}}return null}function Bs(e,n,t,r=!1){let o=n.behavior,s=t?e.get(t):null;if(!s)return[];let i=s.behavior,a=r?!1:o.includes("paged"),c=a?!1:o.includes("continuous"),u=a||c?!1:o.includes("individuals"),l=i.includes("facing-pages"),d=i.includes("non-paged");if(l||d||u||r)return[{id:s.id,type:"Canvas"}];let[v,y]=We(e,n);if(c)return v;let p=v.findIndex(m=>m.id===t);if(p===-1)return[];for(let m of y)if(m.includes(p))return m.map(S=>v[S]);return[{id:s.id,type:"Canvas"}]}function We(e,n,{disablePaging:t,skipNonPaged:r}={}){let o=n.behavior,s=o.includes("paged"),i=s?!1:o.includes("continuous"),a=s||i?!1:o.includes("individuals"),c=n.type==="Manifest"?n.items:je(e,n);if(i)return[c,[c.map((p,m)=>m)]];if(a||!s||t)return[c,c.map((p,m)=>[m])];let u=[],l=[],d=()=>{l.length&&(u.push([...l]),l=[])},v=0,y=!1;for(let p=0;p<c.length;p++){let m=e.get(c[p]);if(m.behavior.includes("non-paged")){p===v&&v++,r||(d(),u.push([p]),d());continue}if(p===v||m.behavior.includes("facing-pages")){l.length&&(y=!0),d(),u.push([p]),d();continue}if(l.push(p),y){d(),y=!1;continue}l.length>1&&d()}return l.length&&d(),[c,u]}import{useCallback as Re,useMemo as Zr,useRef as Xr,useState as Jr}from"react";import{useMemo as Gr}from"react";function kt(e={},n=[]){let{id:t,selector:r}=e,o=O(),s=t||o.range,i=T(a=>s?a.iiif.entities.Range[s]:void 0,[s]);return Gr(()=>{if(i)return r?r(i):i},[i,r,...n])}function Nt({startCanvas:e,disablePaging:n}){let t=A(),r=M(),o=kt(),[s,i]=Jr(void 0),a=o||r;if(!a)throw new Error("Nothing selected");let[c,u]=Zr(()=>We(t,a,{disablePaging:n}),[t,a,n]),l=Xr(u);if(l.current!==u){let S=l.current[s][0],g=u.findIndex(h=>h.includes(S));l.current=u,i(g)}let d=Re(m=>{let S=u.findIndex(g=>g.includes(m));i(S===-1?0:S)},[c,u]),v=Re(m=>{let S=c.findIndex(g=>g.id===m);S!==-1?d(S):i(0)},[c,u]),y=Re(()=>{i(m=>m>=u.length-1?m:m+1)},[u]),p=Re(()=>{i(m=>m<=0?0:m-1)},[u]);return typeof s>"u"&&(e?v(e):i(0)),{visibleItems:u[s]?.map(m=>c[m].id)||[],cursor:s,items:c,sequence:u,hasPrevious:s>0,hasNext:s<u.length-1,setSequenceIndex:i,setCanvasIndex:d,setCanvasId:v,next:y,previous:p}}import{createContext as Ge,useContext as _t,useEffect as to,useMemo as no}from"react";import{useStore as le}from"zustand";import{createStore as zt}from"zustand/vanilla";function ec(e){let n=e.service||e.services||[];for(let t of n)if(t.type==="AuthProbeService2")return!0;return!1}function H(e,n,t){let r=n.findIndex(i=>i.service.id===e);if(r===-1)return n;let o=[...n],s=t(o[r]);return s===o[r]?n:(o[r]=s,o)}var Ot=()=>zt((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:H(t.id,n().authItems,o=>({...o,isPending:!0}))})),Lt(t.service).then(()=>{Ye(r).then(o=>{let s=o.expiresIn,i=Date.now()+s*1e3;e(()=>({authItems:H(t.id,n().authItems,a=>({...a,isLoggedIn:!0,isPending:!1,session:{token:o.accessToken,expires:i}}))}))}).catch(o=>{e(()=>({authItems:H(t.id,n().authItems,s=>({...s,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(i=>i.type==="AuthLogoutService2");if(!r)return;let o=`${r.id}?origin=${Dt()}`,s=window.open(o);e(()=>({authItems:H(t.id,n().authItems,i=>({...i,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(a=>a.type==="AuthAccessTokenService2"),s=t;if(n().authItems.find(a=>a.service.id===t.id)){e(()=>({authItems:H(t.id,n().authItems,a=>({...a,instances:a.instances+1}))}));return}if(e(()=>({currentAuth:s.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");Ye(o).then(a=>{e(()=>({authItems:H(t.id,n().authItems,c=>({...c,isLoggedIn:!0,isPending:!1,session:{token:a.accessToken,expires:a.expiresIn}}))}))}).catch(a=>{e(()=>({authItems:H(t.id,n().authItems,c=>({...c,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:a.message}))}))})}if(t.profile==="kiosk"){if(!o)throw new Error("Token service not found");e(()=>({authItems:H(t.id,n().authItems,a=>({...a,isPending:!0}))})),Lt(s).then(()=>{Ye(o).then(a=>{e(()=>({authItems:H(t.id,n().authItems,c=>({...c,isLoggedIn:!0,isPending:!1,session:{token:a.accessToken,expires:a.expiresIn}}))}))}).catch(a=>{e(()=>({authItems:H(t.id,n().authItems,c=>({...c,isLoggedIn:!1,isPending:!1,error:a.message}))}))})})}t.profile},removeService:(t,r)=>{let o=n().currentAuth===n().authItems.findIndex(i=>i.service.id===t.id),s=n().currentAuth;if(o){let i=n().authItems.find(c=>c.service.id===t.id);i&&i.instances>1||(s=n().authItems.findIndex(u=>u.service.id!==t.id&&u.instances>0))}e(()=>({authItems:H(t.id,n().authItems,i=>({...i,instances:i.instances-1})),currentAuth:s}))}})),Ht=(e,n)=>zt((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 s=r().token;try{let i=await fetch(o,{headers:s?{Authorization:`Bearer ${r().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(a=>a.json());if(i.status===200)t({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(i.status<400&&i.status>=300){if(!i.location)throw new Error("Redirect location not found");t({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:i.location||null})}else if(i.status===401)t({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!i.substitute,substituteResource:i.substitute||null,error:"Unauthorized",errorHeading:i.heading||{en:["Unauthorized"]},errorNote:i.note||null});else throw new Error("Unknown error")}catch(i){t({status:"error",error:i.message,errorHeading:{en:["Unknown error"]}})}},setToken(o){t({token:o})}}));function Ft(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(s=>s.type==="AuthAccessService2");o[0]&&(t.services.access=o[0])}return t}async function Ye(e,{strict:n=!0}={}){return new Promise((t,r)=>{let o=Math.random().toString(36).substring(7),s=`${e.id}?messageId=${o}&origin=${window.location.origin}`,i=u=>{let l=u.data;if(l.messageId===o){if(n&&l.type!=="AuthAccessToken2"){a(),r("Invalid response, expected type=AuthAccessToken2");return}if(!l.accessToken){a(),r("Invalid response, expected accessToken");return}a(),t(l)}},a=()=>window.removeEventListener("message",i),c=document.createElement("iframe");c.src=s,c.style.display="none",document.body.appendChild(c),window.addEventListener("message",i)})}function Dt(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 Lt(e){let n=`${e.id}?origin=${Dt()}`,t=window.open(n);if(!t)throw new Error("Failed to open window");return new Promise((r,o)=>{let s=setInterval(()=>{t.closed&&(clearInterval(s),r())},500)})}import{useEffect as $t,useMemo as Bt}from"react";import{useStore as eo}from"zustand";function Ut(e){let n=Bt(()=>Ft(e),[e]),t=qt(n.services.access?.id),r=Bt(()=>Ht(n.services.probe,t),[n.services.probe]),o=eo(r);return $t(()=>{o.status==="unknown"&&!t&&o.probe()},[n.services.probe,o.status]),$t(()=>{t&&(o.setToken(t),o.probe())},[t]),[e,o,n.hasAuth]}import{jsx as be}from"react/jsx-runtime";var te=Ge(null),ro=Ge(null);ro.displayName="CurrentAuth";var oo=Ge(null);oo.displayName="AuthActions";function Kt({children:e}){let n=no(()=>Ot(),[]);return be(te.Provider,{value:n,children:e})}function jt(){return!!_t(te)}function de(){let e=_t(te);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function io(){let e=de();return le(e,t=>({login:t.login,logout:t.logout,nextAuth:t.nextAuth,previousAuth:t.previousAuth,setAuth:t.setAuth,addService:t.addService,removeService:t.removeService}))}function yc(){let e=de();return le(e,n=>n)}function ao(e){let n=de();return le(n,r=>r.authItems.find(o=>o.service.id===e))}function qt(e){let n=de();return le(n,r=>r.authItems.find(o=>o.id===e)?.session?.token)}function Sc(e){let n=de();return le(n,r=>{let o=r.authItems.find(s=>s.service.id===e);return!o||!o.isLoggedIn||!o.session?null:o.session?.token||null})}function so(e){let n=io(),t=ao(e.service.id);return to(()=>(n?.addService(e.service,e.probeId),()=>{n?.removeService(e.service,e.probeId)}),[e.service]),t?(t.error||!t.isLoggedIn,e.children):null}function Qe(){return null}function Wt(e){let[n,t,r]=Ut(e.resource),o=e.fallbackComponent||Qe,s=e.loadingComponent||Qe,i=e.errorComponent||Qe,a=t.service,c=null;if(!r||!a)return e.children(n);let u=a.service.filter(l=>l.type==="AuthAccessService2");t.status==="error"&&(c=be(i,{resource:e.resource,error:t.error||"",heading:t.errorHeading,note:t.errorNote,extra:e.extra})),(t.status==="unknown"||t.status==="probing")&&(c=be(s,{})),t.status==="success"&&(c=e.children(n));for(let l of u)c=be(so,{service:l,probeId:a.id,children:c},l.id);return c}import{createContext as mo,useContext as wc,useMemo as fo}from"react";import{createStore as co}from"zustand/vanilla";var uo=e=>e.id||e["@id"];function lo(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 Yt=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?uo(n):void 0,r=null;return co((o,s)=>({service:n,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!n,hasAutocomplete:n?!!lo(n):!1,errorMessage:"",search(i,a={}){if(!t)throw new Error("No search service found.");r&&!r.signal.aborted&&r.abort(),r=new AbortController;let c=new URLSearchParams;i.q&&c.set("q",i.q),i.motivation&&c.set("motivation",i.motivation),i.date&&c.set("date",i.date),i.user&&c.set("user",i.user),o({loading:!0}),fetch(`${t}?${c.toString()}`,{signal:r.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...a.headers||{}}}).then(async u=>{if(!r?.signal.aborted)if(u.ok){let l=await u.json();o({resources:l.resources,error:!1,errorMessage:""})}else o({resources:[],error:!0,errorMessage:u.statusText})})},clearSearch(){o({resources:[],error:!1,errorMessage:""})},highlightResult(i){let a=s().resources.find(c=>c["@id"]===i);o({highlight:a})},nextResult(){let i=s().resources,a=s().highlight;if(!a){o({highlight:i[0]||null});return}let c=i.findIndex(u=>u["@id"]===a["@id"]);if(c===-1){o({highlight:i[0]||null});return}o({highlight:i[c+1]||i[0]||null})},previousResult(){let i=s().resources,a=s().highlight;if(!a){o({highlight:i[i.length-1]||null});return}let c=i.findIndex(u=>u["@id"]===a["@id"]);if(c===-1){o({highlight:i[i.length-1]||null});return}if(c===0){o({highlight:i[i.length-1]||null});return}o({highlight:i[c-1]||i[i.length-1]||null})}}))};import{useStore as Nc}from"zustand";function Qt(){let e=M();return e?e.service.find(n=>n.profile==="SearchService1"||n.profile==="http://iiif.io/api/search/1/search"):void 0}import{jsx as Ze}from"react/jsx-runtime";var ne=mo(null);ne.displayName="Search";function Gt(e){let n=Qt();return e.store?Ze(ne.Provider,{value:e.store,children:e.children}):Ze(po,{service:n,children:e.children})}function po({service:e,children:n}){let t=fo(()=>Yt(e),[e]);return Ze(ne.Provider,{value:t,children:n})}import{jsx as z}from"react/jsx-runtime";var me=()=>{},fe=vo({setCurrentCanvasId:me,setCurrentCanvasIndex:me,nextCanvas:me,previousCanvas:me,items:[],sequence:[],setSequenceIndex:me,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function yo(e){let n=M(),{cursor:t,visibleItems:r,next:o,sequence:s,items:i,setCanvasIndex:a,setCanvasId:c,previous:u,setSequenceIndex:l,hasNext:d,hasPrevious:v}=Nt({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),y=ho(()=>({sequence:s,items:i,setCurrentCanvasId:c,nextCanvas:o,previousCanvas:u,totalCanvases:i.length,setCurrentCanvasIndex:a,setSequenceIndex:l,currentSequenceIndex:t,hasNext:d,hasPrevious:v}),[s,i,c,o,u,i,a,l,t]);return n?r.length===0?null:z(fe.Provider,{value:y,children:z(ee.Provider,{value:r,children:z(_,{canvas:r[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),z("div",{children:"Sorry, something went wrong."}))}function Zt(e){let n=J(e.vault),t=wt(e.manifest);if(!t)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),z("div",{children:"Sorry, something went wrong."});if(t.error)return z("div",{children:t.error.toString()});if(!t.isLoaded)return z("div",{children:"Loading..."});let r=z(yo,{...e,children:e.children});return z(X,{vault:n,children:z(Mt,{manifest:t.id,children:z(Kt,{children:z(Gt,{children:e.rangeId?z(Et,{range:e.rangeId,children:r}):r})})})})}function Xt(){return go(fe)}import So from"react";import{createContext as Co,useMemo as xo}from"react";import Ro from"mitt";import{jsx as Ao}from"react/jsx-runtime";var bo=Ro(),re=Co({emitter:bo});re.displayName="Events";function Jt(){return So.useContext(re).emitter}function lu({emitter:e,children:n}){return Ao(re.Provider,{value:xo(()=>({emitter:e}),[e]),children:n})}import To from"react";import{jsx as K}from"react/jsx-runtime";var Xe=To.createContext({});function en(){let e=D(Xe),n=Object.keys(e),t={};for(let r of n)e[r].Provider&&(t[r]={value:D(e[r]),Provider:e[r].Provider});return t}function Io(e){let n=Object.keys(e),t=e.children;for(let r of n){if(r==="children")continue;let{value:o,Provider:s}=e[r];t=K(s,{value:o,children:t})}return t}function Au(e){let n=D(Xe),t=Po(()=>({...n,...e.providers}),[e.providers]);return K(Xe.Provider,{value:t,children:e.children})}function tn(){return{VaultContext:D(Y),ResourceContext:D(Ce),SimpleViewerReactContext:D(fe),VisibleCanvasReactContext:D(ee),AuthRContext:D(te),SearchReactContext:D(ne),ReactEventContext:D(re)}}function nn(e){return K(X,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:K(ee.Provider,{value:e.bridge.VisibleCanvasReactContext,children:K(fe.Provider,{value:e.bridge.SimpleViewerReactContext,children:K(re.Provider,{value:e.bridge.ReactEventContext,children:K(te.Provider,{value:e.bridge.AuthRContext,children:K(ne.Provider,{value:e.bridge.SearchReactContext,children:e.custom?K(Io,{...e.custom,children:e.children}):e.children})})})})})})}import{createContext as ko,useContext as No,useMemo as Lo}from"react";import{useCallback as on,useLayoutEffect as Mo,useMemo as Eo,useRef as Vo}from"react";import{entityActions as Je}from"@iiif/helpers/vault/actions";import{useMemo as wo}from"react";function rn(){let n=A().getStore();return wo(()=>t=>n.dispatch(t),[n])}function an(e){return typeof e!="string"&&e&&e.bindToVault}function sn(){let e=A(),n=Vo([]),t=rn(),r=Eo(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);Mo(()=>{let a={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:{[a.id]:a}}}))},[r]);let o=T(a=>r&&a.iiif.entities.AnnotationPage[r]||null,[r]),s=on((a,c)=>{if(r){if(an(a)){let d=a;d.__vault||d.bindToVault(e),a=typeof d.source=="string"?d.source:d.source.id,n.current[a]=d}else typeof a!="string"&&(a=a.id);let u=e.get({id:r,type:"AnnotationPage"}),l=e.get({id:a,type:"Annotation"});u&&l&&(u.items.find(d=>d.id===l.id)||t(Je.addReference({id:r,type:"AnnotationPage",key:"items",reference:{id:a,type:"Annotation"},index:c})))}},[r]),i=on(a=>{r&&(an(a)?a=typeof a.source=="string"?a.source:a.source.id:typeof a!="string"&&(a=a.id),n.current[a]&&n.current[a].beforeRemove(),e.get({id:r,type:"AnnotationPage"})&&t(Je.removeReference({id:r,type:"AnnotationPage",key:"items",reference:{id:a,type:"Annotation"}})))},[r]);return[o,{addAnnotation:s,removeAnnotation:i}]}import{jsx as zo}from"react/jsx-runtime";var cn=ko(null);function un(){let e=No(cn);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function ln({children:e}){let[n,{addAnnotation:t,removeAnnotation:r}]=sn();return zo(cn.Provider,{value:Lo(()=>({fullPage:n,addAnnotation:t,removeAnnotation:r}),[n]),children:e})}import{jsx as et,jsxs as Oo}from"react/jsx-runtime";function dn({width:e,style:n,height:t,error:r,resetErrorBoundary:o}){return Oo("div",{style:{width:e,height:t,minHeight:500,...n||{},background:"#f9f9f9"},children:[et("h3",{children:"Error occurred"}),et("p",{children:r.message}),et("button",{type:"button",onClick:o,children:"Reset"})]})}import{createContext as Ho,useContext as Fo}from"react";var Q=Ho(null);function Ae(){return Fo(Q)}import{createContext as mn,useContext as Do,useEffect as $o}from"react";var tt=mn(()=>{}),nt=mn(()=>{});function E(e,n,t,r,o=[]){let s=Do(e==="portal"?nt:tt);$o(()=>(e!=="none"&&s(n,t,r),()=>{s(n,null)}),[n,e,s,...o])}import{createContext as Uo,useContext as qo,useEffect as _o}from"react";import{useMemo as Bo}from"react";function b(e={},n=[]){let{id:t,selector:r}=e,o=O(),s=t||o.canvas,i=T(a=>s?a.iiif.entities.Canvas[s]:void 0,[s]);return Bo(()=>{if(i)return r?r(i):i},[i,r,...n])}var rt=Uo(()=>{});function fn(e){let n=b(),t=qo(rt);_o(()=>n&&n.id?(t(n.id,e),()=>t(n.id,-1)):()=>{},[n,e])}import{Fragment as Yo,jsx as V,jsxs as Qo}from"react/jsx-runtime";function vn({children:e,errorFallback:n,outerContainerProps:t={},worldScale:r,...o}){let[s,i]=Pe(),a=en(),c=tn(),u=n||dn,[l,d]=Pe({}),v=Object.entries(l),[y,p]=Pe({}),m=Object.entries(y),[S,g]=Pe({}),h=gn(()=>r||Math.max(...Object.values(S)),[S]),f=gn(()=>({maxOverZoom:h||1,...o.runtimeOptions||{}}),[h,o.runtimeOptions]),C=ot((R,x)=>{g(N=>{if(x===-1){let{[R]:he,...F}=N;return F}return{...N,[R]:x}})},[]),P=ot((R,x,N)=>{d(({[R]:he,...F})=>x?{...F,[R]:{element:x,props:N}}:F)},[]),I=ot((R,x,N)=>{p(({[R]:he,...F})=>x?{...F,[R]:{element:x,props:N}}:F)},[]);return Qo(Wo,{resetKeys:[],fallbackRender:R=>V(u,{...o,...R}),children:[V(Ko,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:V(Yo,{children:v.map(([R,{element:x,props:N}])=>V(pn.Fragment,{children:V(x,{...N||{}})},R))}),onCreated:R=>{i(R),o.onCreated&&o.onCreated(R)},runtimeOptions:f,children:V(Q.Provider,{value:s,children:V(rt.Provider,{value:C,children:V(tt.Provider,{value:P,children:V(nt.Provider,{value:I,children:V(nn,{bridge:c,custom:a,children:V(jo.Provider,{value:o.mode||"explore",children:V(ln,{children:e})})})})})})})}),V("div",{children:m.map(([R,{element:x,props:N}])=>V(pn.Fragment,{children:V(x,{...N||{}})},R))})]})}import{mergeStyles as ti,RegionHighlight as ni}from"@atlas-viewer/atlas";import{useMemo as hn}from"react";import{createEventsHelper as Go}from"@iiif/helpers/events";function Te(e,n){let t=A(),r=hn(()=>Go(t),[t]),o=T(()=>e&&e.id?t.getResourceMeta(e.id,"eventManager"):null,[e]);return hn(()=>e?r.getListenersAsProps(e,n):{},[o,e,t,n])}import{useMemo as Zo}from"react";import{createStylesHelper as Xo}from"@iiif/helpers/styles";function oe(e,n){let t=A(),r=Zo(()=>Xo(t),[t]);return T(()=>{if(!e)return null;let o=r.getAppliedStyles(e.id);return o?n?o[n]:o:void 0},[e,n])}import{useMemo as ri}from"react";import{useMemo as Jo}from"react";import{expandTarget as ei}from"@iiif/helpers/annotation-targets";function Ie(e={},n=[]){let{id:t,selector:r}=e,o=O(),s=A(),i=t||o.annotation,a=T(u=>i?u.iiif.entities.Annotation[i]:void 0,[i]),c=T(u=>a&&a.body?a.body.map(l=>l?l.type==="SpecificResource"?{...l,source:s.get(l)}:l?u.iiif.entities[l.type][l.id]:null:null).filter(Boolean):[],[a]);return Jo(()=>{if(!a)return;let u={...a,body:c,target:ei(a.target,{typeMap:s.getState().iiif.mapping})};return r?r(u):u},[a,r,c,...n])}import{jsx as oi}from"react/jsx-runtime";var we=({id:e,style:n,className:t,interactive:r})=>{let o=Ie({id:e}),s=oe(o,"atlas"),i=oe(o,"html"),a=Te(o,["atlas"]),c=b(),u=ri(()=>ti(n,s),[n,s]);return c&&o&&o.target&&o.target.selector&&o.target.selector.type==="BoxSelector"&&o.target.source&&(o.target.source.id===c.id||o.target.source===c.id)?oi(ni,{id:o.id,isEditing:!0,region:o.target.selector.spatial,style:u,className:i?.className||t,interactive:!!(i?.href||r),href:i?.href||null,title:i?.title||null,hrefTarget:i?.target||null,onClick:()=>{},...a}):null};import{Fragment as ai}from"react";import{useMemo as ii}from"react";function yn(e={},n=[]){let{id:t,selector:r}=e,o=O(),s=t||o.annotationPage,i=T(a=>s?a.iiif.entities.AnnotationPage[s]:void 0,[s]);return ii(()=>{if(i)return r?r(i):i},[i,...n])}import{jsx as Sn}from"react/jsx-runtime";var pe=({className:e,page:n})=>{let t=yn({id:n.id})||n,r=oe(t,"atlas"),o=oe(t,"html");return T(s=>t.id?s.iiif.entities.AnnotationPage[t.id]:null,[]),Sn(ai,{children:t.items?.map(s=>Sn(we,{id:s.id,style:r,className:o?.className||e},s.id))})};import{useEffect as it,useMemo as at}from"react";import{useEffect as kn,useMemo as Nn}from"react";import{useCallback as Rn,useMemo as ci}from"react";function si(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function Cn(e,n){return T(t=>{let r=[];if(!e)return r;let o=Object.keys(t.iiif.entities.AnnotationPage);for(let s of o)if(!n||n.indexOf(s)!==-1){let i=si(t,s);i&&i.views&&i.views[e]&&r.push(s)}return r},[e,n])}function xn({canvas:e,manifest:n,all:t,canvases:r}){let o=[];if(n)for(let s of n.annotations)o.indexOf(s.id)===-1&&o.push(s.id);if(t){if(r&&r.length)for(let s of r)for(let i of s.annotations)o.indexOf(i.id)===-1&&o.push(i.id)}else if(e)for(let s of e.annotations)o.indexOf(s.id)===-1&&o.push(s.id);return o}function ui(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function bn(e,n={}){let t=A(),r=M(),o=b(),s=xe(),i=ci(()=>xn({all:n.all,manifest:r,canvas:o,canvases:s}),[n.all,o,s,r]),a=Cn(e,n.all?void 0:i),c=Rn(l=>{e&&t.setMetaValue([l,"annotationPageManager","views"],d=>d&&!d[e]?d:{...d||{},[e]:!1})},[e,t]),u=Rn((l,d={})=>{if(!e)return;let v=t.getState(),y=[];if(d?.deselectOthers){let p=Object.keys(v.iiif.entities.AnnotationPage);for(let m of p){let S=ui(v,m);S&&S.views&&S.views[e]&&y.push(m)}}for(let p of y)c(p);t.setMetaValue([l,"annotationPageManager","views"],p=>p&&p[e]?p:{...p||{},[e]:!0})},[e,c,t]);return{availablePageIds:i,enabledPageIds:a,setPageEnabled:u,setPageDisabled:c}}function An(e,n){return T((t,r)=>r.get(e.map(o=>({id:o,type:n}))),[e,n])}import fi from"mitt";import{useCallback as pi}from"react";import{createStore as gi}from"zustand";import li,{useContext as di}from"react";import{imageServices as mi}from"@iiif/helpers/image-service";import{useStore as Me}from"zustand";var Pn=li.createContext(mi.store);Pn.displayName="ImageServicesHelper";function Ee(){return di(Pn)}function Tn(e){let n=Ee();return Me(n,({loaded:t})=>t[e])}function Ve(){let e=Ee();return Me(e,({loadServiceSync:n})=>n)}function In(){let e=Ee();return Me(e,({loaded:n})=>n)}function Sd(){let e=Ee();return Me(e,({loadService:n})=>n)}var vi=gi((e,n)=>({loaded:{},setLoaded:(t,r="done")=>{e(o=>({loaded:{...o.loaded,[t]:r}}))}})),hi=fi();hi.on("loaded",e=>{vi.getState().setLoaded(e.imageServiceId)});function wn(){let e=Ve(),n=In();return[pi((r,{height:o,width:s})=>r&&e(r,{height:o,width:s},!0),[e]),n]}import{useCallback as yi,useMemo as En,useState as Si}from"react";function Mn(e={}){let n=Ie(),t=b(e.canvasId?{id:e.canvasId}:void 0);return T((r,o)=>{if(!t)return[];if(n&&e.enableSingleAnnotation)return[n];let s=o.get(t.items),i=[];for(let a of s)i.push(...o.get(a.items));return i},[t])}import{createPaintingAnnotationsHelper as Ci}from"@iiif/helpers/painting-annotations";function Vn(e,n=[]){let t=A(),r=En(()=>Ci(t),[]),o=Mn({enableSingleAnnotation:e?.enableSingleAnnotation}),[s,i]=Si(e?.defaultChoices||[]),a=En(()=>r.getPaintables(o,s),[t,o,s,...n]),u={makeChoice:yi((l,{deselectOthers:d=!0,deselect:v=!1}={})=>{a.choice&&i(y=>{if(v){let m=y.filter(S=>S!==l);if(m.length===0){let S=a.items[0].resource.id;return S?[S]:[]}return m}if(d)return[l];let p=[...y];if(p.length===0&&a.items.length){let m=a.items[0].resource.id;m&&p.push(m)}return y.indexOf(l)!==-1?y:[...y,l]})},[a.choice])};return[a,u]}function Ln(e){let n=M(),t=b(),r=A(),o=Jt(),s=e?.emitter||o,[i,a]=wn(),{enabledPageIds:c}=bn(e?.annotationPageManagerId||n?.id||t?.id,{all:!1}),u=An(c,"AnnotationPage"),l=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[d,v]=Vn(e,[a]);kn(()=>{let p=m=>{v.makeChoice(m.choiceId,{deselectOthers:m.deselectOthers,deselect:m.deselect})};return s.on("make-choice",p),()=>{s.off("make-choice",p)}},[]);let y=Nn(()=>At({canvas:t,paintables:d,supports:l,loadImageService:i,vault:r}),[t,d,r,v.makeChoice]);return kn(()=>{let p=d.allChoices,m={canvasId:t?.id,manifestId:n?.id};p&&s.emit("choice-change",{choice:p,partOf:m})},[t?.id,d.allChoices]),Nn(()=>y.type==="unknown"?[y,bt]:[{...y,annotations:{pages:u}},v],[y,u])}import{createContext as xi,useContext as Ri}from"react";var ke=xi(null);ke.displayName="Strategy";function w(){let e=Ri(ke);if(!e)throw new Error("useStrategy must be used within a StrategyProvider");return e}import{createStylesHelper as Pi}from"@iiif/helpers";import{createContext as bi,useContext as Ai}from"react";var Ne=bi(null);Ne.displayName="Controls";function L(){let e=Ai(Ne);if(!e)throw new Error("useStrategy must be used within a StrategyProvider");return e}import{jsx as zn}from"react/jsx-runtime";function On({strategies:e,registerActions:n,defaultChoices:t,onChoiceChange:r,mediaControlsDeps:o,renderMediaControls:s,renderViewerControls:i,viewControlsDeps:a,renderComplexTimelineControls:c,complexTimelineControlsDeps:u,throwOnUnknown:l,children:d}){let v=b(),y=A(),p=at(()=>Pi(y),[y]),[m,S]=Ln({strategies:e||["images"],defaultChoices:t?.map(({id:C})=>C)}),g="choice"in m?m.choice:void 0;if(it(()=>{n&&n(S)},[m.annotations]),it(()=>{r&&r(g)},[g]),it(()=>{if(t)for(let C of t)typeof C.opacity<"u"&&p.applyStyles({id:C.id},"atlas",{opacity:C.opacity})},[t]),m.type==="unknown"&&l)throw new Error(m.reason||"Unknown strategy");let h=at(()=>({renderMediaControls:s,mediaControlsDeps:o||[],renderViewerControls:i,viewControlsDeps:a||[],renderComplexTimelineControls:c,complexTimelineControlsDeps:u||[]}),[o,s,i,a,c,u]),f=at(()=>({strategy:m,actions:S,choices:"choice"in m?m.choice:[]}),[m,v]);return zn(Ne.Provider,{value:h,children:zn(ke.Provider,{value:f,children:d})})}import{useMemo as Ti}from"react";import{jsx as Ii}from"react/jsx-runtime";function Hn({x:e=0,y:n=0,keepCanvasScale:t,children:r}){let{strategy:o}=w(),s=b(),i=Te(s,["deep-zoom"]),a=Ti(()=>t?1:Math.max(1,...o.type==="images"?o.images.map(u=>(u.width||0)/u.target?.spatial.width):[]),[t,o]);fn(a);let c=o.type==="images"?o.images.length:0;return s?Ii("world-object",{height:s.height,width:s.width,x:e,y:n,...i,children:r},`${s.id}/${o.type}/${c}`):null}import{jsx as wi}from"react/jsx-runtime";function Le({style:e}){let n=b();return!n||!n.height||!n.width?null:wi("box",{interactive:!1,target:{x:0,y:0,width:Number(n.width),height:Number(n.height)},style:e})}import{jsx as Mi}from"react/jsx-runtime";function Fn({backgroundStyle:e,alwaysShowBackground:n}){let{strategy:t}=w();return t.type!=="empty"&&!n?null:Mi(Le,{style:e})}import{useLayoutEffect as Qi,useMemo as Gi}from"react";import ki from"mitt";import{useCallback as $,useEffect as st,useReducer as Ei,useRef as ze}from"react";function Dn(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function Vi(e,n){switch(n.type){case"RESET":return n.state;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 ct(e){let n=Math.round(e);return`${Math.floor(n/60)}:${`${n%60}`.padStart(2,"0")}`}function ie(e){let[n,t]=Ei(Vi,Dn(e.duration));st(()=>{t({type:"RESET",state:Dn(e.duration)})},[e.duration]);let r=ze(null),o=ze(null),s=ze(null),i=ze(!1),a=$(()=>{o.current&&r.current&&(o.current.innerHTML=ct(r.current.currentTime),s.current&&(s.current.style.width=`${r.current.currentTime/e.duration*100}%`),i.current!==r.current.muted&&(i.current=r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[e.duration]),c=$(()=>{r.current&&(t({type:"PLAY_REQUESTED"}),r.current.play().then(()=>{t({type:"PLAY"})}),a())},[a]),u=$(()=>{r.current&&(r.current.duration>0&&r.current.paused?c():l())},[a]),l=$(()=>{r.current&&(r.current.pause(),t({type:"PAUSE"}),a())},[a]),d=$(()=>{r.current&&(r.current.muted=!r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),v=$(()=>{r.current&&(r.current.muted=!0,t({type:"MUTE"}))},[]),y=$(()=>{r.current&&(r.current.muted=!1,t({type:"UNMUTE"}))},[]),p=$(g=>{r.current&&(r.current.muted=!1,r.current.volume=g/100,t({type:"SET_VOLUME",volume:g}))},[]),m=$(g=>{r.current&&(r.current.currentTime=Math.max(0,Math.min(g*e.duration,e.duration)),a())},[]),S=$(g=>{if(r.current){let h=typeof g=="function"?g(r.current.currentTime):g;r.current.currentTime=Math.max(0,Math.min(h,e.duration)),a()}},[]);return st(()=>{let g=setInterval(()=>{a()},350);return()=>clearInterval(g)},[a,e.duration]),st(()=>{let g=()=>{t({type:"FINISHED"})},h=r.current;return h?.addEventListener("ended",g),()=>h?.removeEventListener("ended",g)},[]),[{element:r,currentTime:o,progress:s},n,{play:c,pause:l,playPause:u,mute:v,unmute:y,toggleMute:d,setVolume:p,setDurationPercent:m,setTime:S}]}import{createStore as Ni}from"zustand/vanilla";function $n({currentKeyFrameIndex:e,keyframes:n,targetTime:t,currentTime:r}){if(r<=t){let o=n.findIndex(a=>a.time>t);if(o===-1)return[e,[]];let s={},i=n.slice(e,o);for(let a of i)a.type==="enter"&&(s[a.id]=a),a.type==="exit"&&(s[a.id]?delete s[a.id]:s[a.id]=a);return[o,Object.values(s)]}return[e,[]]}function Bn({complexTimeline:e,startTime:n=0}){let t=ki(),r={},o={progress:null,currentTime:null},s=0,i=null,a=0,c=null;function u(){let h=S.getState().visibleElements,f=r,C=[],P=Object.keys(f);for(let I of P){let R=f[I],x=h[I];R&&x&&C.push(R)}return C}function l(){return Object.keys(r).map(h=>r[h])}function d(g){o.currentTime&&(o.currentTime.innerHTML=ct(g),o.progress&&(o.progress.style.width=`${g/e.duration*100}%`))}let v=()=>{let g=S.getState(),h=g.currentPrime;if(!h)return;let f=r,C=g.visibleElements,P=Object.keys(f);for(let I of P){let R=f[I],x=C[I];if(R&&I!==h.id&&x){let N=a-x.time*1e3;Math.abs(a-x.time*1e3-R.currentTime*1e3)>300&&(R.currentTime=N/1e3)}}},y=(g=0)=>{let h=g-s,f=S.getState();if(f.isPlaying){let C=f.currentPrime;if(C){let x=r[C.id];x&&(x.paused?a+=h:a=(C.time+x.currentTime)*1e3)}else a+=h;let P=a/1e3;if(P>f.duration){S.getState().setTime(0),S.setState({isPlaying:!1}),p(),d(0);return}d(P);let[I,R]=$n({currentTime:P,currentKeyFrameIndex:f.nextKeyframeIndex,keyframes:f.complexTimeline.keyframes,targetTime:P});R.length&&f.applyKeyframes(I,R)}s=g,i=requestAnimationFrame(y)},p=()=>{i&&cancelAnimationFrame(i)},m=(g,h)=>{},S=Ni((g,h)=>({complexTimeline:e,elements:{},visibleElements:{},isBuffering:!1,bufferMap:{},isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,isReady:!1,volume:100,duration:e.duration,clockStartRequests:0,clockStartTime:0,primeTime:0,currentPrime:null,clockRunning:!1,nextKeyframeIndex:0,startClock:()=>{h().clockRunning||(y(),c=setInterval(v,500)),g({clockRunning:!0,clockStartRequests:h().clockStartRequests+1})},applyKeyframes(f,C){let P=h(),I={...P.visibleElements},R=P.currentPrime;for(let x of C)x.type==="enter"&&(I[x.id]=x,t.emit("complex-timeline.enter",{id:x.id})),x.type==="exit"&&(I[x.id]=null,t.emit("complex-timeline.exit",{id:x.id})),x.isPrime&&(R=x);g({nextKeyframeIndex:f,visibleElements:I,currentPrime:R})},stopClock:()=>{let f=h().clockStartRequests;if(f!==0){if(f===1){p(),c&&clearInterval(c),g({clockRunning:!1,clockStartRequests:0});return}g({clockStartRequests:f-1})}},setElement:(f,C)=>{r[f]=C;let P=Object.keys(r),I=h().complexTimeline;m(C,f),I.items.filter(x=>x.type!=="Image"&&x.type!=="Text").every(x=>P.includes(x.annotationId))&&!h().isReady&&(t.emit("complex-timeline.ready",{complexTimeline:I}),g({isReady:!0}))},removeElement:f=>{delete r[f]},mute(){for(let f of l())f.muted=!0;g({isMuted:!0})},unmute(){for(let f of l())f.muted=!1;g({isMuted:!1})},play(){if(!h().isPlaying){for(let C of u())C.play();g({isPlaying:!0})}},pause(){if(h().isPlaying){for(let C of u())C.pause();g({isPlaying:!1})}},playPause(){let f=h();f.isPlaying?f.pause():f.play()},setDurationPercent(f){let P=h().duration*f;h().setTime(P)},setTime(f){let C=h(),P=a/1e3,I=typeof f=="function"?f(P):f,R=C.nextKeyframeIndex;if(P>I){g({visibleElements:{},currentPrime:null});let ye=Object.keys(C.visibleElements);for(let Se of ye)t.emit("complex-timeline.exit",{id:Se});P=0,R=0}let[x,N]=$n({currentTime:P,currentKeyFrameIndex:R,keyframes:C.complexTimeline.keyframes,targetTime:I});C.applyKeyframes(x,N),a=I*1e3;let F=S.getState().visibleElements,Tr=r,Ir=Object.keys(F);for(let ye of Ir){let Se=F[ye];if(Se){let Rt=Tr[ye];Rt&&(Rt.currentTime=(a-Se.time*1e3)/1e3)}}d(I)},setVolume(f){for(let C of l())C.volume=Math.min(1,Math.max(0,f/100));g({volume:f})},toggleMute(){let f=h();f.isMuted?(f.unmute(),g({isMuted:!1})):(f.mute(),g({isMuted:!0}))},clearProgressElement(){o.progress=null},setProgressElement(f){o.progress=f},setCurrentTimeElement(f){o.currentTime=f},clearCurrentTimeElement(){o.currentTime=null}}));return t.on("complex-timeline.enter",g=>{let h=S.getState(),f=g.id,C=r[f];C&&h.isPlaying&&C.play()}),t.on("complex-timeline.exit",g=>{let h=S.getState(),f=g.id,C=r[f];C&&(C.currentTime=0,C.pause())}),S.getState().setTime(n),{store:S,emitter:t}}import{HTMLPortal as Zi}from"@atlas-viewer/atlas";import{Fragment as Gn,useMemo as qi}from"react";import{HTMLPortal as Di}from"@atlas-viewer/atlas";import{getId as $i}from"@iiif/parser/image-3";import ae,{useMemo as ut}from"react";import{jsx as B}from"react/jsx-runtime";var qn=ae.createContext("en"),_n=ae.createContext({}),Kn=ae.createContext(null);function Fm(e){return B(_n.Provider,{value:e.translations,children:e.children})}function Dm(e){return B(qn.Provider,{value:e.language,children:e.children})}function $m(e){return B(Kn.Provider,{value:e.convert,children:e.children})}function jn(){return ae.useContext(Kn)}function lt(){return ae.useContext(qn)}function Wn(){return ae.useContext(_n)}function Un(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function Li({as:e,language:n,children:t,viewingDirection:r,...o}){let s=lt();return ut(()=>Un(s)===Un(n),[s,n])?e?B(e,{...o,children:t}):B("span",{...o,children:t}):e?B(e,{...o,lang:n,dir:r,children:t}):B("span",{...o,lang:n,dir:r,children:t})}function Yn(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 zi=(e,n=[])=>{let t=lt();return ut(()=>{let r=e();return Yn(t,r,[])},[t,...n])};function G(e,n,t,r){return n?t?t(e[n]||n,r||"none"):e[n]||n:""}function Oi(e,n,t=`
|
|
2
|
-
`,r={}){let o=jn(),s=zi(()=>Object.keys(e||{}),[e]);return[ut(()=>{if(!e)return G(r,n,o)||"";if(typeof e=="string")return G(r,e,o);let i=s?e[s]:void 0;return i?typeof i=="string"?i:i.map(a=>G(r,a,o,s)).join(t):""},[s,n,e]),s]}function Bm(){let e=lt(),n=Wn(),t=jn();return function(o,s="",i=`
|
|
3
|
-
`,a=n){let c=Object.keys(o||{}),u=Yn(e,c,[]);if(!o)return G(a,s,t)||"";if(typeof o=="string")return G(a,o,t);let l=u?o[u]:void 0;return l?typeof l=="string"?G(a,l,t,u):l.map(d=>G(a,d,t,u)).join(typeof i<"u"?i:`
|
|
4
|
-
`):""}}function ge({as:e,defaultText:n,enableDangerouslySetInnerHTML:t,children:r,separator:o,...s}){let i=Wn(),[a,c]=Oi(r,n,o,i);return c?B(Li,{...s,as:e,language:c,title:t?void 0:a,dangerouslySetInnerHTML:t?{__html:a}:void 0,children:t?void 0:a}):e?B(e,{...s,children:a}):B("span",{...s,title:t?void 0:a,dangerouslySetInnerHTML:t?{__html:a}:void 0,children:t?void 0:a})}import{isImageServiceLevel as Hi}from"@iiif/parser/image-3";import{useMemo as dt}from"react";import{jsx as Oe,jsxs as Fi}from"react/jsx-runtime";var mt=e=>{let n=e.format||"jpg",t=e.width/(e.crop?.width||e.tiles.width),r=e.tiles.imageService.sizes||[],o=e.enableThumbnail,s=e.enableSizes,i=dt(()=>{let u=e.tiles.imageService.id||e.tiles.imageService["@id"];return u?.endsWith("/info.json")?u.slice(0,-1*10):u},[e.tiles.imageService.id,e.tiles.imageService["@id"]]),a=dt(()=>{let u=e.tiles.imageService.tiles||[];if(!u.length){let l=e.width,d=[1],v=1;for(;Math.pow(2,v)<l;)v=v*2,d.push(v);return(e.tiles.imageService.maxArea||e.tiles.imageService.maxWidth||e.tiles.imageService.maxHeight)&&Hi(2,e.tiles.imageService)?[{width:256,height:256,scaleFactors:d}]:[]}return u},[e.tiles.imageService,e.width]),c=dt(()=>{let u=e.tiles.imageService;return(u?u["@context"]?Array.isArray(u["@context"])?u["@context"]:[u["@context"]]:[]:[]).indexOf("http://iiif.io/api/image/3/context.json")!==-1},[e.tiles.imageService.id,e.tiles.imageService]);return Oe("world-object",{rotation:e.rotation,scale:t,height:e.crop?.height||e.tiles.height,width:e.crop?.width||e.tiles.width,x:e.x,y:e.y,onClick:e.onClick,children:Fi("composite-image",{id:e.tiles.imageService.id,width:e.crop?.width||e.tiles.width,height:e.crop?.height||e.tiles.height,crop:e.crop,renderOptions:e.renderOptions,children:[o&&e.tiles.thumbnail?Oe("world-image",{priority:!0,uri:e.tiles.thumbnail.id,target:{width:e.tiles.width,height:e.tiles.height},display:{width:e.tiles.thumbnail.width,height:e.tiles.thumbnail.height},crop:e.crop}):null,s&&r.map((u,l)=>Oe("world-image",{uri:`${i}/full/${u.width},${c?u.height:""}/0/default.${n}`,target:{width:e.tiles.width,height:e.tiles.height},display:{width:u.width,height:u.height},crop:e.crop},l)),a.map(u=>(u.scaleFactors||[]).map(l=>Oe("tiled-image",{uri:e.tiles.imageService.id,display:{width:e.tiles.width,height:e.tiles.height},format:n,tile:u,scaleFactor:l,crop:e.crop,version3:c},`${e.tiles.imageService.id}-tile-${l}`)))]},e.tiles.imageService.id)},e.tiles.imageService.id)};import{jsx as j,jsxs as Ui}from"react/jsx-runtime";function Bi({resource:e,heading:n,note:t,extra:r}){return r?j(Di,{target:{x:0,y:0,width:r.target?.spatial.width,height:r.target?.spatial.height},backgroundColor:"#333",relative:!0,children:j("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:Ui("div",{children:[j(ge,{children:n||"Not authorised"}),t&&j("p",{children:j(ge,{children:t})}),j("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function Qn({image:e,thumbnail:n,crop:t,enableSizes:r,enableThumbnail:o,renderOptions:s}){let i=jt(),a=$i(e.service),c=Tn(a),u=Ve(),l=c?.service;u(e.service,e);let d=l&&c?.status==="done",v=(l?.preferredFormats||[])[0],y=n&&n.type==="fixed"&&n.id&&!n.id.includes("/full/full/")&&!n.id.includes("/max/")?n:void 0;if(d===!1)return null;if(!i){let p=e.service,m=p.width||e.width||0,S=p.height||e.height||0;return j(mt,{enableThumbnail:o,renderOptions:s,tiles:{id:p.id||p["@id"]||"unknown",height:S,width:m,imageService:p,thumbnail:y},enableSizes:r,x:0,y:0,format:v,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}return j(Wt,{resource:e.service,errorComponent:Bi,extra:e,children:p=>{let m=p.width||e.width||0,S=p.height||e.height||0;return j(mt,{enableThumbnail:o,renderOptions:s,tiles:{id:p.id||p["@id"]||"unknown",height:S,width:m,imageService:p,thumbnail:y},format:v,enableSizes:r,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}},e.id)}import{jsx as ft,jsxs as Zn}from"react/jsx-runtime";function se({id:e,image:n,thumbnail:t,isStatic:r,x:o=0,y:s=0,children:i,selector:a,onClick:c,enableSizes:u}){let l=qi(()=>{if(!(!a||a.spatial.x===0&&a.spatial.y===0))return a.spatial},[a]);return ft("world-object",{x:o+n.target.spatial.x,y:s+n.target.spatial.y,width:n.target.spatial.width,height:n.target.spatial.height,onClick:c,children:n.service?Zn(Gn,{children:[ft(Qn,{image:n,thumbnail:t,crop:l,enableSizes:u}),i]},"service"):Zn(Gn,{children:[ft("world-image",{onClick:c,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}),i]},"no-service")},e+(n.service?"server":"no-service"))}import{useStore as er}from"zustand";import{createContext as _i,useContext as Ki}from"react";import{useStore as ji}from"zustand";import{jsx as Wi}from"react/jsx-runtime";var pt=_i(null);pt.displayName="ComplexTimeline";function Xn({children:e,store:n}){return Wi(pt.Provider,{value:n,children:e})}function ff(e){let n=Ki(pt);if(!n)throw new Error("useComplexTimeline must be used within a ComplexTimelineProvider");return ji(n,e)}import{HTMLPortal as Yi}from"@atlas-viewer/atlas";import{Fragment as Jn,jsx as ve}from"react/jsx-runtime";function He({strategy:e,onClickPaintingAnnotation:n}){return ve(Jn,{children:e.items.map((t,r)=>ve(Jn,{children:ve(Yi,{onClick:n?o=>{o.stopPropagation(),n(t.annotationId,t,o)}:void 0,target:t.target?.spatial||void 0,children:ve("div",{"data-textual-content":!0,children:ve(ge,{enableDangerouslySetInnerHTML:!0,children:t.text})})},r)}))})}import{Fragment as Xi,jsx as Fe,jsxs as Ji}from"react/jsx-runtime";function tr({strategy:e,children:n}){let{store:t}=Gi(()=>Bn({complexTimeline:e}),[e]),r=er(t,i=>i.isReady),o=er(t,i=>i.visibleElements);function s(i){return a=>{a&&t.getState().setElement(i,a)}}return Qi(()=>{if(r){let{startClock:i,stopClock:a}=t.getState();return i(),()=>{a()}}},[e,r]),E("portal","custom-controls",Xn,{store:t,children:n},[r]),Ji(Xi,{children:[e.items.map(i=>i.type!=="Image"||!o[i.annotationId]?null:Fe(se,{image:i,id:i.annotationId},i.id)),e.items.map((i,a)=>i.type!=="Text"||!o[i.annotationId]?null:Fe(He,{strategy:{type:"textual-content",items:[i]}},a)),e.items.map((i,a)=>i.type!=="Video"||!i.target.spatial?null:Fe(Zi,{target:i.target.spatial,children:Fe("video",{ref:s(i.annotationId),src:i.url,style:{height:"100%",width:"100%",opacity:o[i.annotationId]?1:0}})},a))]})}import{jsx as ea}from"react/jsx-runtime";function nr(){let{strategy:e}=w(),{renderComplexTimelineControls:n}=L();return e.type!=="complex-timeline"?null:ea(tr,{strategy:e,children:n?n(e):null})}import{Fragment as na,jsx as ta,jsxs as ra}from"react/jsx-runtime";function rr({onClickPaintingAnnotation:e,children:n}){let{strategy:t}=w(),{renderViewerControls:r,viewControlsDeps:o}=L(),s=Ae(),i=b();return E(s&&t.type==="textual-content"&&r?"overlay":"none",`canvas-portal-controls-${i?.id}`,Q.Provider,r?{value:s||null,children:r(t)}:{},[i,s,t,...o||[]]),t.type!=="textual-content"?null:ra(na,{children:[ta(He,{strategy:t,onClickPaintingAnnotation:e}),n]})}import{useEffect as ua,useMemo as la,useRef as da,useState as ma}from"react";import{useEffect as oa}from"react";var or=(e,n=[])=>{let t=A();oa(()=>{e(t)},[t,...n])};import ia,{useContext as aa}from"react";import{ImageServiceLoader as sa}from"@iiif/helpers/image-service";var ca=ia.createContext(new sa);function ir(){return aa(ca)}import{createThumbnailHelper as fa}from"@iiif/helpers/thumbnail";function ce(e,n,{canvasId:t,manifestId:r}={}){let o=A(),s=ir(),i=la(()=>fa(o,{imageServiceLoader:s}),[o,s]),[a,c]=ma(),u=M(r?{id:r}:void 0),l=b(t?{id:t}:void 0),d=l||u,v=da(!1);if(ua(()=>(v.current=!1,()=>{v.current=!0}),[]),!d)throw new Error("Must be called under a manifest or canvas context.");return or(y=>{i.getBestThumbnailAtSize(d,e,n).then(p=>{p.best&&!v.current&&c(p.best)})},[d]),a}import{Fragment as ga,jsx as pa,jsxs as va}from"react/jsx-runtime";function ar({isStatic:e=!1,enableSizes:n=!1,onClickPaintingAnnotation:t,children:r}){let{strategy:o}=w(),{renderViewerControls:s,viewControlsDeps:i}=L(),a=b(),c=Ae(),u=ce({maxWidth:256,maxHeight:256});return E(c&&o.type==="images"&&s?"overlay":"none",`canvas-portal-controls-${a?.id}`,Q.Provider,s?{value:c||null,children:s(o)}:{},[a,c,o,...i||[]]),o.type!=="images"?null:va(ga,{children:[o.images.map((l,d)=>pa(se,{isStatic:e,image:l,id:l.id,thumbnail:d===0?u:void 0,selector:l.selector,enableSizes:n,onClick:t?v=>{t(l.annotationId,l,v)}:void 0},l.id+d)),r]})}import{Fragment as ha,jsx as gt,jsxs as ya}from"react/jsx-runtime";function vt({model:e}){return ya(ha,{children:[gt("style",{children:`
|
|
5
|
-
.model-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
|
-
`}),gt("div",{className:"model-container",children:gt("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function De({model:e,name:n}){return E("overlay",`model-${n}`,vt,{model:e},[e]),null}import{jsx as Sa}from"react/jsx-runtime";function sr(){let{strategy:e}=w();return e.type!=="3d-model"?null:Sa(De,{model:e.model})}import{Fragment as Ca,jsx as cr,jsxs as xa}from"react/jsx-runtime";function ur({children:e}){let{strategy:n}=w(),[t]=un();return n.type!=="images"?null:xa(Ca,{children:[t?cr(pe,{page:t}):null,n.annotations&&n.annotations.pages?n.annotations.pages.map(r=>cr(pe,{page:r},r.id)):null,e]})}import{createContext as yt,useContext as St}from"react";import{jsx as ht}from"react/jsx-runtime";var lr=yt(null),dr=yt(null),mr=yt(null);function Pp(){let e=St(lr);if(!e)throw new Error("Ctx not found");return e}function Tp(){let e=St(dr);if(!e)throw new Error("Ctx not found");return e}function Ip(){let e=St(mr);if(!e)throw new Error("Ctx not found");return e}function $e({actions:e,state:n,children:t,currentTime:r,progress:o,element:s}){return ht(mr.Provider,{value:{currentTime:r,progress:o,element:s},children:ht(dr.Provider,{value:e,children:ht(lr.Provider,{value:n,children:t})})})}import{useMemo as Ra}from"react";import{expandTarget as ba}from"@iiif/helpers";function Be(){let e=M(),n=b();return Ra(()=>{if(!e||!n||!e.start)return null;let t=ba(e.start);return!t||t.source.id!==n.id||!t||!t.selector||t.selector.type!=="TemporalSelector"?null:t.selector.temporal},[e,n])}import{jsx as Aa,jsxs as Pa}from"react/jsx-runtime";function Ct({media:e,startTime:n,children:t}){let[{element:r,currentTime:o,progress:s},i,a]=ie({duration:e.duration}),c=n?`${e.url}#t=${n}`:e.url;return Pa($e,{state:i,actions:a,currentTime:o,progress:s,element:r,children:[Aa("audio",{ref:r,src:c}),t]},e.url)}function Ue({media:e,mediaControlsDeps:n,audioCopmonent:t=Ct,children:r}){let o=Be();return E("portal","audio",t,{media:e,startTime:o?o.startTime:null,children:r},[e,o,...n||[]]),null}import{jsx as fr}from"react/jsx-runtime";function ue({x:e=0,y:n=0}){let t=b(),r=ce({maxWidth:256,maxHeight:256});return!t||!r||r.type!=="fixed"?null:fr("world-object",{height:t.height,width:t.width,x:e,y:n,children:fr("world-image",{uri:r.id,target:{x:0,y:0,width:t.width,height:t.height},display:r.width&&r.height?{width:r.width,height:r.height}:void 0,crop:void 0})})}import{Fragment as Ia,jsx as pr,jsxs as Ta}from"react/jsx-runtime";function gr({as:e}){let{strategy:n}=w(),{renderMediaControls:t,mediaControlsDeps:r}=L();return n.type!=="media"||n.media.type!=="Sound"?null:pr(Ia,{children:Ta(Ue,{media:n.media,mediaControlsDeps:r,audioCopmonent:e,children:[pr(ue,{}),t?t(n):null]},n.media.url)})}import{Fragment as wa,jsx as qe,jsxs as Ma}from"react/jsx-runtime";function vr(){let{strategy:e}=w(),{renderViewerControls:n,viewControlsDeps:t}=L(),r=b(),o=r?.accompanyingCanvas,s=r?.placeholderCanvas;return Ma(wa,{children:[e.type==="media"&&e.media.type==="Sound"&&o?qe(_,{canvas:o.id,children:qe(Z,{renderViewerControls:n,viewControlsDeps:t})}):null,e.type==="media"&&e.media.type==="Sound"&&s&&!o?qe(_,{canvas:s.id,children:qe(Z,{renderViewerControls:n,viewControlsDeps:t})}):null]})}import{jsx as hr,jsxs as Ea}from"react/jsx-runtime";function xt({element:e,media:n,startTime:t,playPause:r,poster:o}){let s="div",i=t?`${n.url}#t=${t}`:n.url;return Ea(s,{className:"video-container",part:"video-container",onClick:r,children:[hr("style",{children:`
|
|
18
|
-
.video-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
|
-
`}),hr("video",{poster:o,ref:e,src:i,style:{width:"100%",objectFit:"contain"}})]})}function _e({media:e,mediaControlsDeps:n,children:t,videoComponent:r=xt,captions:o}){let s=b(),i=Be(),a=s&&s.placeholderCanvas&&s.placeholderCanvas.id||void 0,c=ce({},!1,{canvasId:a}),[{element:u,currentTime:l,progress:d},v,y]=ie({duration:e.duration});return E("overlay","video-element",r,{element:u,media:e,playPause:y.playPause,poster:c?.id,canvas:s,startTime:i?i.startTime:null,captions:o},[c]),E("portal","custom-controls",$e,{state:v,actions:y,currentTime:l,progress:d,element:u,children:t},[l,v,e,...n||[]]),null}import{jsx as Va,jsxs as ka}from"react/jsx-runtime";function yr({as:e}){let{strategy:n}=w(),{renderMediaControls:t,mediaControlsDeps:r}=L();return n.type!=="media"||n.media.type!=="Video"?null:ka(_e,{captions:n.captions,media:n.media,mediaControlsDeps:r,videoComponent:e,children:[Va(ue,{}),t?t(n):null]},n.media.url)}import{useRef as Na}from"react";import{jsx as Sr,jsxs as za}from"react/jsx-runtime";function La({element:e,media:n,playPause:t}){let r=Na(null);return n.youTubeId?za("div",{className:"video-container",part:"video-container",onClick:t,children:[Sr("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
|
-
`}),Sr("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 Cr({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:s},i,a]=ie({duration:e.duration});return E("overlay","video-element",La,{element:r,media:e,playPause:a.playPause}),null}import{jsx as Oa,jsxs as Ha}from"react/jsx-runtime";function xr(){let{strategy:e}=w(),{renderMediaControls:n,mediaControlsDeps:t}=L();return e.type!=="media"||e.media.type!=="VideoYouTube"?null:Ha(Cr,{media:e.media,mediaControlsDeps:t,children:[Oa(ue,{}),n?n(e):null]})}import{jsx as U,jsxs as Rr}from"react/jsx-runtime";function Z({x:e,y:n,onChoiceChange:t,registerActions:r,defaultChoices:o,isStatic:s,renderViewerControls:i,renderMediaControls:a,renderComplexTimelineControls:c,complexTimelineControlsDeps:u,viewControlsDeps:l,mediaControlsDeps:d,strategies:v,throwOnUnknown:y,backgroundStyle:p,alwaysShowBackground:m,keepCanvasScale:S=!1,enableSizes:g=!1,enableYouTube:h=!0,onClickPaintingAnnotation:f,components:C={},children:P}){return Rr(On,{throwOnUnknown:y,onChoiceChange:t,registerActions:r,strategies:v,defaultChoices:o,mediaControlsDeps:d,renderMediaControls:a,renderViewerControls:i,renderComplexTimelineControls:c,complexTimelineControlsDeps:u,viewControlsDeps:l,children:[Rr(Hn,{keepCanvasScale:S,x:e,y:n,children:[U(Fn,{alwaysShowBackground:m,backgroundStyle:p}),U(nr,{}),U(rr,{}),U(ar,{isStatic:s,enableSizes:g,onClickPaintingAnnotation:f}),U(ur,{}),U(sr,{}),U(gr,{as:C.Audio}),U(yr,{as:C.Video}),h?U(xr,{}):null,P]}),U(vr,{})]})}import{jsx as br}from"react/jsx-runtime";function Ar(e){let n=b();return!n||!n.placeholderCanvas?null:br(_,{canvas:n.placeholderCanvas.id,children:br(Z,{renderViewerControls:e.renderViewerControls})})}import{Fragment as Ba,jsx as q,jsxs as Ua}from"react/jsx-runtime";var $a=Pr(function(n,t){let r=M(),o=xe(),s=Xt(),{ViewerControls:i,MediaControls:a,ComplexTimelineControls:c}=n.components||{};if(Fa(t,()=>s,[s]),!r)return q("div",{});let u=0,l=r.viewingDirection==="top-to-bottom",d=r.viewingDirection==="bottom-to-top",v=r.viewingDirection==="left-to-right",y=r.viewingDirection==="right-to-left",m=r.behavior.includes("continuous")?0:n.spacing||0,S=d||y,g=Da(()=>S?[...o].reverse():o,[o,S]);return Ua(Ba,{children:[n.header,q(k.Viewer,{height:n.height,mode:n.mode,renderPreset:n.renderPreset,runtimeOptions:n.runtimeOptions,children:g.map((h,f)=>{let C=0,P=0;return l?(C=u,u+=h.width+m):(P=u,u+=h.height+m),q(_,{canvas:h.id,children:q(k.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content","complex-timeline"],renderViewerControls:f===0&&i?()=>q(i,{}):void 0,renderMediaControls:f===0&&a?()=>q(a,{}):void 0,renderComplexTimelineControls:f===0&&c?()=>q(c,{}):void 0,x:C,y:P,...n.canvasProps||{},children:n.annotations},h.id)},h.id)})},n.reuseAtlas?"":s.currentSequenceIndex),n.children]})}),k=Pr(function({children:n,height:t,annotations:r,canvasProps:o,spacing:s,header:i,components:a,mode:c,reuseAtlas:u,renderPreset:l,runtimeOptions:d,...v},y){let p=J();return q(X,{vault:p,children:q(Zt,{...v,children:q($a,{ref:y,height:t,components:a,spacing:s,canvasProps:o,annotations:r,header:i,mode:c,reuseAtlas:u,renderPreset:l,runtimeOptions:d,children:n})})})});k.RenderImage=se;k.RenderCanvas=Z;k.RenderAnnotationPage=pe;k.RenderAnnotation=we;k.Viewer=vn;k.CanvasBackground=Le;k.Audio=Ue;k.Video=_e;k.Model=De;k.AudioHTML=Ct;k.VideoHTML=xt;k.ModelHTML=vt;k.PlaceholderCanvas=Ar;export{Ce as a,O as b,W as c,Y as d,X as e,J as f,It as g,wt as h,Mt as i,_ as j,A as k,T as l,ee as m,xe as n,M as o,Et as p,Qr as q,je as r,Fs as s,Vt as t,Bs as u,We as v,kt as w,Nt as x,ec as y,Ot as z,Ht as A,Ft as B,Ye as C,Lt as D,te as E,ro as F,oo as G,Kt as H,jt as I,de as J,io as K,yc as L,ao as M,qt as N,Sc as O,Wt as P,Qt as Q,fe as R,yo as S,Zt as T,Xt as U,bo as V,re as W,Jt as X,lu as Y,en as Z,Io as _,Au as $,tn as aa,nn as ba,rn as ca,sn as da,un as ea,ln as fa,dn as ga,Q as ha,Ae as ia,E as ja,b as ka,vn as la,Te as ma,oe as na,Ie as oa,yn as pa,xn as qa,bn as ra,An as sa,Ve as ta,Sd as ua,wn as va,Mn as wa,Vn as xa,Ln as ya,ke as za,w as Aa,Ne as Ba,L as Ca,On as Da,Hn as Ea,Fn as Fa,ct as Ga,ie as Ha,Fm as Ia,Dm as Ja,$m as Ka,jn as La,lt as Ma,Wn as Na,Li as Oa,zi as Pa,Oi as Qa,Bm as Ra,ge as Sa,se as Ta,Xn as Ua,ff as Va,nr as Wa,rr as Xa,or as Ya,ca as Za,ir as _a,ce as $a,ar as ab,sr as bb,ur as cb,Pp as db,Tp as eb,Ip as fb,$e as gb,Be as hb,ue as ib,gr as jb,vr as kb,yr as lb,xr as mb,k as nb};
|