react-iiif-vault 1.2.4 → 1.2.6

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.js CHANGED
@@ -1 +1 @@
1
- import{$ as wo,A as to,Aa as tn,B as oo,Ba as ln,C as no,Ca as cn,D as ro,Da as le,E as io,Ea as mn,F as ao,Fa as un,G as so,Ga as dn,H as lo,Ha as fn,I as co,Ia as gn,J as mo,Ja as pn,K as uo,Ka as ce,L as fo,M as go,N as po,O as ho,P as yo,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ae,Y as ko,Z as Po,_ as To,a as Wt,aa as Ro,b as A,ba as Eo,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as T,g as te,ga as Lo,h as $t,ha as Ho,i as Vt,ia as Ao,j as oe,ja as zo,k as P,ka as qo,l as z,la as Wo,m as Xt,ma as Do,n as ne,na as Fo,o as q,oa as Oo,p as Yt,pa as $o,q as _t,qa as Vo,r as Kt,ra as Xo,s as Qt,sa as N,t as Ut,ta as Jo,u as Gt,ua as se,v as Jt,va as Zo,w as re,wa as jo,x as Zt,xa as W,y as jt,ya as en,z as eo,za as D}from"./chunk-FMNC7JOX.js";import{a as Yo,b as _o,c as Ko,d as Qo,e as Uo,f as Go,g as on,h as nn,i as rn,j as an,k as sn}from"./chunk-DXFXJCXN.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var Sn=De(function({canvasId:t},o){let n=We(),i=se(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let y=$e(()=>{let p=(t||[]).reduce((g,b)=>[...g,...b.keys],[]),d={};for(let g of e){let b=g&&g.label?Object.values(g.label):[];for(let r of b)if(r&&r.length&&(p.indexOf(`metadata.${r[0]}`)!==-1||p.length===0)&&g){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(g);break}}return d},[t,e]);return Object.keys(y).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((p,d)=>{let g=[];for(let b of p.keys)for(let r of y[b]||[])g.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return g.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:p.label})}),C("td",{className:s.value,children:g})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((p,d)=>p?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function Hn(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function Gn(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function cr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let y of u){let I=[],p=u[m]===y;for(let d of y){let g=l[d];I.push(L("div",{className:p?f.item:o.item,children:L(de,{classes:p?f:o,canvasId:g.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(y))},"data-selected":p,className:p?f.row:o.row,children:I}))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as ge}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function dr({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return ge(fe,{children:[t?ge(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as pe,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function br({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function Sr(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=pe(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=pe(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Cr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Tr({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as gt,useMemo as pt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=pt(()=>yt(e,o),[]);return gt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),y=E(),[I,p]=Pe(null),[d,g]=Pe(!1),{helper:b,state:r}=Ie(n,(h,k)=>{M.updateTransitionBoundingBox(l.current,h,k),M.updateBoundingBoxPolygon(s.current,h,k),M.updateTransitionShape(f.current,h,k),M.updateClosestLinePointTransform(m.current,h,k),M.updateSelectBox(u.current,h,k),M.updatePointLine(x.current,h,k),M.updateDrawPreview(c.current,h,k,3),M.updateLineBox(y.current,h),p(h.transitionDirection),g(h.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let h=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",h),()=>{document.removeEventListener("mouseleave",h)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(h=>h.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:y,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((h,k)=>r.selectedPoints?.includes(k)).map(h=>h.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:y}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let p=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,p):null,g=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),g?St(d,g,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function ti(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function ii({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function ci({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function fi({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function yi(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Ii({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=ae();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function Pi(e,t=!1){}function Ei(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function Hi(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function Di(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function Vi(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),y=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[y,e,t]),p=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[y,e]),Le(()=>({data:p,isFetching:l,status:m,error:f}),[p,l,m,f])}function ji(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function ra(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ii as AnnotationContext,ci as AnnotationPageContext,Tr as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,Sn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,fi as CollectionContext,Hn as CombinedMetadata,To as ContextBridge,Me as CreateCustomShape,ko as EventsProvider,Ze as Image,jo as ImageServiceLoaderContext,bo as InnerViewerProvider,Wo as LanguageProvider,Oo as LanguageString,N as LocaleString,Vt as ManifestContext,Gn as ManifestMetadata,pn as MediaPlayerProvider,O as Metadata,ti as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,dr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,br as SelectorControllerProvider,cr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,qo as TranslationProvider,Ft as VaultProvider,No as ViewerPresetContext,Mo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,Co as defaultEmitter,Ko as emptyActions,Go as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,Jo as flattenAnnotationPageIds,mn as formatTime,on as get3dStrategy,Se as getDefaultAnnotationStyles,nn as getImageStrategy,Jt as getManifestSequence,_o as getParsedTargetSelector,sn as getRenderingStrategy,rn as getTextualContentStrategy,an as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,Yo as parseSpecificResource,Ct as svgThemes,Qo as unknownResponse,Uo as unsupportedStrategy,Ao as useAnnotation,zo as useAnnotationPage,se as useAnnotationPageManager,Ce as useAnnotationStyles,yi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,Ii as useCanvasChoices,Pi as useCanvasClock,Zt as useCanvasSequence,Ei as useCanvasSubset,$o as useClosestLanguage,Hi as useCollection,Po as useContextBridge,Xo as useCreateLocaleString,fo as useCurrentAuth,wo as useDispatch,ae as useEventEmitter,Di as useEventListener,Ot as useExistingVault,Vi as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Do as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,ji as useImageTile,co as useIsAuthEnabled,en as useLoadImageService,Vo as useLocaleString,q as useManifest,fn as useMediaActions,gn as useMediaElements,dn as useMediaState,tn as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,ln as useRenderingStrategy,A as useResourceContext,Lo as useResourceEvents,Zo as useResources,vo as useSearchService,be as useSelectorController,Sr as useSelectorEmitter,xe as useSelectorEvents,Cr as useSelectorHelper,un as useSimpleMediaPlayer,ie as useSimpleViewer,ra as useStyleHelper,Ho as useStyles,Re as useSvgEditor,le as useThumbnail,Fo as useTranslations,P as useVault,cn as useVaultEffect,z as useVaultSelector,Bo as useViewerPreset,Ro as useVirtualAnnotationPage,Eo as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
1
+ import{$ as wo,A as to,Aa as on,B as oo,Ba as D,C as no,Ca as nn,D as ro,Da as mn,E as io,Ea as un,F as ao,Fa as le,G as so,Ga as dn,H as lo,Ha as fn,I as co,Ia as gn,J as mo,Ja as pn,K as uo,Ka as hn,L as fo,La as yn,M as go,Ma as vn,N as po,Na as ce,O as ho,P as yo,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ae,Y as ko,Z as Po,_ as To,a as Wt,aa as Ro,b as A,ba as Eo,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as T,g as te,ga as Lo,h as $t,ha as Ho,i as Vt,ia as Ao,j as oe,ja as zo,k as P,ka as qo,l as z,la as Wo,m as Xt,ma as Do,n as ne,na as Fo,o as q,oa as Oo,p as Yt,pa as $o,q as _t,qa as Vo,r as Kt,ra as Xo,s as Qt,sa as Yo,t as Ut,ta as _o,u as Gt,ua as N,v as Jt,va as jo,w as re,wa as se,x as Zt,xa as en,y as jt,ya as tn,z as eo,za as W}from"./chunk-QKLET6KX.js";import{a as Ko,b as Qo,c as Uo,d as Go,e as Jo,f as Zo,g as rn,h as an,i as sn,j as ln,k as cn}from"./chunk-DXFXJCXN.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var kn=De(function({canvasId:t},o){let n=We(),i=se(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let y=$e(()=>{let p=(t||[]).reduce((g,b)=>[...g,...b.keys],[]),d={};for(let g of e){let b=g&&g.label?Object.values(g.label):[];for(let r of b)if(r&&r.length&&(p.indexOf(`metadata.${r[0]}`)!==-1||p.length===0)&&g){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(g);break}}return d},[t,e]);return Object.keys(y).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((p,d)=>{let g=[];for(let b of p.keys)for(let r of y[b]||[])g.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return g.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:p.label})}),C("td",{className:s.value,children:g})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((p,d)=>p?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function qn(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function jn(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function dr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let y of u){let I=[],p=u[m]===y;for(let d of y){let g=l[d];I.push(L("div",{className:p?f.item:o.item,children:L(de,{classes:p?f:o,canvasId:g.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(y))},"data-selected":p,className:p?f.row:o.row,children:I}))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as ge}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function pr({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return ge(fe,{children:[t?ge(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as pe,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function Ir({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function kr(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=pe(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=pe(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Pr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Er({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as gt,useMemo as pt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=pt(()=>yt(e,o),[]);return gt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),y=E(),[I,p]=Pe(null),[d,g]=Pe(!1),{helper:b,state:r}=Ie(n,(h,k)=>{M.updateTransitionBoundingBox(l.current,h,k),M.updateBoundingBoxPolygon(s.current,h,k),M.updateTransitionShape(f.current,h,k),M.updateClosestLinePointTransform(m.current,h,k),M.updateSelectBox(u.current,h,k),M.updatePointLine(x.current,h,k),M.updateDrawPreview(c.current,h,k,3),M.updateLineBox(y.current,h),p(h.transitionDirection),g(h.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let h=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",h),()=>{document.removeEventListener("mouseleave",h)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(h=>h.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:y,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((h,k)=>r.selectedPoints?.includes(k)).map(h=>h.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:y}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let p=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,p):null,g=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),g?St(d,g,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function ri(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function li({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function di({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function hi({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function bi(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Ti({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=ae();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function Ri(e,t=!1){}function Bi(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function qi(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function $i(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function _i(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),y=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[y,e,t]),p=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[y,e]),Le(()=>({data:p,isFetching:l,status:m,error:f}),[p,l,m,f])}function oa(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function sa(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{li as AnnotationContext,di as AnnotationPageContext,Er as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,kn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,hi as CollectionContext,qn as CombinedMetadata,To as ContextBridge,Me as CreateCustomShape,ko as EventsProvider,Ze as Image,tn as ImageServiceLoaderContext,bo as InnerViewerProvider,Wo as LanguageProvider,Vo as LanguageString,N as LocaleString,Vt as ManifestContext,jn as ManifestMetadata,yn as MediaPlayerProvider,O as Metadata,ri as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,pr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,Ir as SelectorControllerProvider,dr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,qo as TranslationProvider,Do as TransliterationProvider,Ft as VaultProvider,No as ViewerPresetContext,Mo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,Co as defaultEmitter,Uo as emptyActions,Zo as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,jo as flattenAnnotationPageIds,dn as formatTime,rn as get3dStrategy,Se as getDefaultAnnotationStyles,an as getImageStrategy,Jt as getManifestSequence,Qo as getParsedTargetSelector,cn as getRenderingStrategy,sn as getTextualContentStrategy,ln as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,Ko as parseSpecificResource,Ct as svgThemes,Go as unknownResponse,Jo as unsupportedStrategy,Ao as useAnnotation,zo as useAnnotationPage,se as useAnnotationPageManager,Ce as useAnnotationStyles,bi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,Ti as useCanvasChoices,Ri as useCanvasClock,Zt as useCanvasSequence,vn as useCanvasStartTime,Bi as useCanvasSubset,Xo as useClosestLanguage,qi as useCollection,Po as useContextBridge,_o as useCreateLocaleString,fo as useCurrentAuth,wo as useDispatch,ae as useEventEmitter,$i as useEventListener,Ot as useExistingVault,_i as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Oo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,oa as useImageTile,co as useIsAuthEnabled,on as useLoadImageService,Yo as useLocaleString,q as useManifest,pn as useMediaActions,hn as useMediaElements,gn as useMediaState,nn as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,mn as useRenderingStrategy,A as useResourceContext,Lo as useResourceEvents,en as useResources,vo as useSearchService,be as useSelectorController,kr as useSelectorEmitter,xe as useSelectorEvents,Pr as useSelectorHelper,fn as useSimpleMediaPlayer,ie as useSimpleViewer,sa as useStyleHelper,Ho as useStyles,Re as useSvgEditor,le as useThumbnail,$o as useTranslations,Fo as useTransliteration,P as useVault,un as useVaultEffect,z as useVaultSelector,Bo as useViewerPreset,Ro as useVirtualAnnotationPage,Eo as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-iiif-vault",
3
- "version": "1.2.4",
3
+ "version": "1.2.6",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -1,48 +0,0 @@
1
- import{c as ut,k as ct}from"./chunk-DXFXJCXN.js";import{forwardRef as Fn,useImperativeHandle as si}from"react";import Jt,{useCallback as Ge,useMemo as Xt,useState as xe}from"react";import{AtlasAuto as Xr,ModeContext as eo}from"@atlas-viewer/atlas";import{ErrorBoundary as to}from"react-error-boundary";import{useContext as Y}from"react";import Dn,{useContext as qn,useMemo as Bn}from"react";import{jsx as $n}from"react/jsx-runtime";var _n={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},he=Dn.createContext(_n),E=()=>qn(he);function B({value:e,children:n}){let t=E(),r=Bn(()=>({...t,...e}),[e,t]);return $n(he.Provider,{value:r,children:n})}import jn,{useState as Yn}from"react";import{Vault as lt,globalVault as Qn}from"@iiif/helpers/vault";import{jsx as dt}from"react/jsx-runtime";var j=jn.createContext({vault:null,setVaultInstance:e=>{}});function W({vault:e,vaultOptions:n,useGlobal:t,resources:r,children:o}){let[i,a]=Yn(()=>e||(t?Qn(n):n?new lt(n):new lt));return dt(j.Provider,{value:{vault:i,setVaultInstance:a},children:dt(B,{value:r||{},children:o})})}import{useContext as Ir}from"react";import{createContext as wr,useMemo as Mr}from"react";import{globalVault as Wn}from"@iiif/helpers/vault";import{useContext as Gn}from"react";function G(e){let n=Gn(j);return e||(n&&n.vault?n.vault:Wn())}import{useEffect as Zn,useMemo as Kn,useState as Fe}from"react";function mt(e,{noCache:n=!1}={}){let t=typeof e=="string"?e:e.id,r=G(),[o,i]=Fe(t),[a,s]=Fe(void 0),u=Kn(()=>r.get(t,{skipSelfReturn:!0})||void 0,[t,r]),[c,l]=Fe(u);return Zn(()=>{(async()=>{try{let d=u&&!n?u:await r.load(t),g=d?d.id||d["@id"]:null;d&&o!==g&&i(g),l(d)}catch(d){s(d)}})()},[t,n]),{isLoaded:!!c,id:o,requestId:t,error:a,resource:c,cached:!!(c&&c===u)}}function ft(e,n){let{id:t,isLoaded:r,error:o,resource:i,requestId:a,cached:s}=mt(e,n);return{id:t,isLoaded:r,error:o,manifest:i,requestId:a,cached:s}}import{jsx as Jn}from"react/jsx-runtime";function pt({manifest:e,children:n}){return Jn(B,{value:{manifest:e},children:n})}import{jsx as Xn}from"react/jsx-runtime";function _({canvas:e,children:n}){return Xn(B,{value:{canvas:e},children:n})}import{useContext as rr}from"react";import or from"react";import{useContext as er}from"react";var v=()=>{let{vault:e}=er(j);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};import{useEffect as tr,useState as nr}from"react";function y(e,n=[]){let t=v(),[r,o]=nr(()=>e(t.getState(),t));return tr(()=>t.subscribe(i=>e(i,t),i=>{o(i)},!1),n),r}var Z=or.createContext([]);function ve(){let e=rr(Z);return y(n=>e.map(t=>n.iiif.entities.Canvas[t]).filter(Boolean),[e])}import{useMemo as ir}from"react";function M(e={},n=[]){let{id:t,selector:r}=e,o=E(),i=v(),a=t||o.manifest,s=y(u=>a?u.iiif.entities.Manifest[a]:void 0,[a]);return ir(()=>{if(s)return r?r(s):s},[s,r,...n])}import{jsx as ar}from"react/jsx-runtime";function gt({range:e,children:n}){return ar(B,{value:{range:e},children:n})}function sr(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=sr(e,e.get(t));if(r)return r}}return null}function He(e,n){let t=[];for(let r of n.items)if(r.type==="SpecificResource"&&r.source?.type==="Canvas"&&(r.source.id.indexOf("#")!==-1?t.push({id:r.source.id.split("#")[0],type:"Canvas"}):t.push(r.source)),r.type==="Range"&&t.push(...He(e,e.get(r))),r.type==="SpecificResource"){let o=typeof r.source=="string"?r.source:r.source.id;t.push({id:o,type:"Canvas"})}return t}function sa(e,n,t){for(let r of n.structures){let o=ht(e,e.get(r),t);if(o)return o}return null}function ht(e,n,t){for(let r of n.items){let o=r?.source?.id?.split("#")[0];if(r.type==="SpecificResource"&&r.source===t||r.type==="SpecificResource"&&r.source?.type==="Canvas"&&t===o)return n;if(r.type==="Range"){let i=ht(e,e.get(r),t);if(i)return i}}return null}function la(e,n,t,r=!1){let o=n.behavior,i=t?e.get(t):null;if(!i)return[];let a=i.behavior,s=r?!1:o.includes("paged"),u=s?!1:o.includes("continuous"),c=s||u?!1:o.includes("individuals"),l=a.includes("facing-pages"),d=a.includes("non-paged");if(l||d||c||r)return[{id:i.id,type:"Canvas"}];let[g,h]=Ue(e,n);if(u)return g;let f=g.findIndex(m=>m.id===t);if(f===-1)return[];for(let m of h)if(m.includes(f))return m.map(x=>g[x]);return[{id:i.id,type:"Canvas"}]}function Ue(e,n,{disablePaging:t,skipNonPaged:r}={}){let o=n.behavior,i=o.includes("paged"),a=i?!1:o.includes("continuous"),s=i||a?!1:o.includes("individuals"),u=n.type==="Manifest"?n.items:He(e,n);if(a)return[u,[u.map((f,m)=>m)]];if(s||!i||t)return[u,u.map((f,m)=>[m])];let c=[],l=[],d=()=>{l.length&&(c.push([...l]),l=[])},g=0,h=!1;for(let f=0;f<u.length;f++){let m=e.get(u[f]);if(m.behavior.includes("non-paged")){f===g&&g++,r||(d(),c.push([f]),d());continue}if(f===g||m.behavior.includes("facing-pages")){l.length&&(h=!0),d(),c.push([f]),d();continue}if(l.push(f),h){d(),h=!1;continue}l.length>1&&d()}return l.length&&d(),[u,c]}import{useCallback as ye,useMemo as cr,useRef as lr,useState as dr}from"react";import{useMemo as ur}from"react";function vt(e={},n=[]){let{id:t,selector:r}=e,o=E(),i=t||o.range,a=y(s=>i?s.iiif.entities.Range[i]:void 0,[i]);return ur(()=>{if(a)return r?r(a):a},[a,r,...n])}function yt({startCanvas:e,disablePaging:n}){let t=v(),r=M(),o=vt(),[i,a]=dr(void 0),s=o||r;if(!s)throw new Error("Nothing selected");let[u,c]=cr(()=>Ue(t,s,{disablePaging:n}),[t,s,n]),l=lr(c);if(l.current!==c){let x=l.current[i][0],S=c.findIndex(D=>D.includes(x));l.current=c,a(S)}let d=ye(m=>{let x=c.findIndex(S=>S.includes(m));a(x===-1?0:x)},[u,c]),g=ye(m=>{let x=u.findIndex(S=>S.id===m);x!==-1?d(x):a(0)},[u,c]),h=ye(()=>{a(m=>m>=c.length-1?m:m+1)},[c]),f=ye(()=>{a(m=>m<=0?0:m-1)},[c]);return typeof i>"u"&&(e?g(e):a(0)),{visibleItems:c[i]?.map(m=>u[m].id)||[],cursor:i,items:u,sequence:c,hasPrevious:i>0,hasNext:i<c.length-1,setSequenceIndex:a,setCanvasIndex:d,setCanvasId:g,next:h,previous:f}}import{createContext as Be,useContext as Vt,useEffect as fr,useMemo as pr}from"react";import{useStore as ae}from"zustand";import{createStore as xt}from"zustand/vanilla";function Pa(e){let n=e.service||e.services||[];for(let t of n)if(t.type==="AuthProbeService2")return!0;return!1}function k(e,n,t){let r=n.findIndex(a=>a.service.id===e);if(r===-1)return n;let o=[...n],i=t(o[r]);return i===o[r]?n:(o[r]=i,o)}var At=()=>xt((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:k(t.id,n().authItems,o=>({...o,isPending:!0}))})),St(t.service).then(()=>{De(r).then(o=>{let i=o.expiresIn,a=Date.now()+i*1e3;e(()=>({authItems:k(t.id,n().authItems,s=>({...s,isLoggedIn:!0,isPending:!1,session:{token:o.accessToken,expires:a}}))}))}).catch(o=>{e(()=>({authItems:k(t.id,n().authItems,i=>({...i,isLoggedIn:!1,isPending:!1,error:o.message}))}))})})},logout:()=>{let t=n().authItems[n().currentAuth];if(!t||t.isPending||!t.isLoggedIn)return;if(t.type!=="active")throw new Error("Cannot logout of non-active service");let r=t.service.service.find(a=>a.type==="AuthLogoutService2");if(!r)return;let o=`${r.id}?origin=${Rt()}`,i=window.open(o);e(()=>({authItems:k(t.id,n().authItems,a=>({...a,isLoggedIn:!1,session:null,isPending:!1}))}))},nextAuth:()=>{let t=n().authItems.length,r=n().currentAuth+1;r>=t||e(()=>({currentAuth:r}))},previousAuth:()=>{let t=n().currentAuth-1;t<0||e(()=>({currentAuth:t}))},setAuth:t=>{t!==-1&&(t<0||t>=n().authItems.length)||e(()=>({currentAuth:t}))},addService:(t,r)=>{if(!t.service)return;let o=t.service.find(s=>s.type==="AuthAccessTokenService2"),i=t;if(n().authItems.find(s=>s.service.id===t.id)){e(()=>({authItems:k(t.id,n().authItems,s=>({...s,instances:s.instances+1}))}));return}if(e(()=>({currentAuth:i.profile==="active"?0:n().currentAuth,authItems:[{id:t.id,type:t.profile,service:t,probeId:r,canAuthenticate:!0,instances:1,isPending:!1,isLoggedIn:!1,session:null},...n().authItems]})),t.profile==="external"){if(!o)throw new Error("Token service not found");De(o).then(s=>{e(()=>({authItems:k(t.id,n().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:s.accessToken,expires:s.expiresIn}}))}))}).catch(s=>{e(()=>({authItems:k(t.id,n().authItems,u=>({...u,isLoggedIn:!1,isPending:!1,canAuthenticate:!1,error:s.message}))}))})}if(t.profile==="kiosk"){if(!o)throw new Error("Token service not found");e(()=>({authItems:k(t.id,n().authItems,s=>({...s,isPending:!0}))})),St(i).then(()=>{De(o).then(s=>{e(()=>({authItems:k(t.id,n().authItems,u=>({...u,isLoggedIn:!0,isPending:!1,session:{token:s.accessToken,expires:s.expiresIn}}))}))}).catch(s=>{e(()=>({authItems:k(t.id,n().authItems,u=>({...u,isLoggedIn:!1,isPending:!1,error:s.message}))}))})})}t.profile},removeService:(t,r)=>{let o=n().currentAuth===n().authItems.findIndex(a=>a.service.id===t.id),i=n().currentAuth;if(o){let a=n().authItems.find(u=>u.service.id===t.id);a&&a.instances>1||(i=n().authItems.findIndex(c=>c.service.id!==t.id&&c.instances>0))}e(()=>({authItems:k(t.id,n().authItems,a=>({...a,instances:a.instances-1})),currentAuth:i}))}})),Ct=(e,n)=>xt((t,r)=>({service:e,status:e?"unknown":"success",shouldRedirect:!1,redirectResource:null,shouldSubstitute:!1,substituteResource:null,error:null,errorHeading:null,errorNote:null,shouldDisplayResource:!1,token:n||null,async probe(){if(!r().service)return;let o=r().service?.id;if(!o){t({status:"error",error:"Service ID not found",errorHeading:{en:["Service ID not found"]}});return}t({status:"probing"});let i=r().token;try{let a=await fetch(o,{headers:i?{Authorization:`Bearer ${r().token}`,Accept:"application/json"}:{Accept:"application/json"}}).then(s=>s.json());if(a.status===200)t({status:"success",shouldDisplayResource:!0,error:null,errorHeading:null,errorNote:null,shouldSubstitute:!1,shouldRedirect:!1});else if(a.status<400&&a.status>=300){if(!a.location)throw new Error("Redirect location not found");t({status:"error",shouldDisplayResource:!1,shouldRedirect:!0,redirectResource:a.location||null})}else if(a.status===401)t({status:"error",shouldDisplayResource:!1,shouldRedirect:!1,shouldSubstitute:!!a.substitute,substituteResource:a.substitute||null,error:"Unauthorized",errorHeading:a.heading||{en:["Unauthorized"]},errorNote:a.note||null});else throw new Error("Unknown error")}catch(a){t({status:"error",error:a.message,errorHeading:{en:["Unknown error"]}})}},setToken(o){t({token:o})}}));function Pt(e){let n=e.service||e.services||[],t={hasAuth:!1,services:{}};for(let r of n)if(r.type==="AuthProbeService2"){t.services.probe=r,t.hasAuth=!0;let o=r.service.filter(i=>i.type==="AuthAccessService2");o[0]&&(t.services.access=o[0])}return t}async function De(e,{strict:n=!0}={}){return new Promise((t,r)=>{let o=Math.random().toString(36).substring(7),i=`${e.id}?messageId=${o}&origin=${window.location.origin}`,a=c=>{let l=c.data;if(l.messageId===o){if(n&&l.type!=="AuthAccessToken2"){s(),r("Invalid response, expected type=AuthAccessToken2");return}if(!l.accessToken){s(),r("Invalid response, expected accessToken");return}s(),t(l)}},s=()=>window.removeEventListener("message",a),u=document.createElement("iframe");u.src=i,u.style.display="none",document.body.appendChild(u),window.addEventListener("message",a)})}function Rt(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 St(e){let n=`${e.id}?origin=${Rt()}`,t=window.open(n);if(!t)throw new Error("Failed to open window");return new Promise((r,o)=>{let i=setInterval(()=>{t.closed&&(clearInterval(i),r())},500)})}import{useEffect as bt,useMemo as It}from"react";import{useStore as mr}from"zustand";function wt(e){let n=It(()=>Pt(e),[e]),t=Mt(n.services.access?.id),r=It(()=>Ct(n.services.probe,t),[n.services.probe]),o=mr(r);return bt(()=>{o.status==="unknown"&&!t&&o.probe()},[n.services.probe,o.status]),bt(()=>{t&&(o.setToken(t),o.probe())},[t]),[e,o,n.hasAuth]}import{jsx as Se}from"react/jsx-runtime";var K=Be(null),gr=Be(null);gr.displayName="CurrentAuth";var hr=Be(null);hr.displayName="AuthActions";function Tt({children:e}){let n=pr(()=>At(),[]);return Se(K.Provider,{value:n,children:e})}function Nt(){return!!Vt(K)}function se(){let e=Vt(K);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function vr(){let e=se();return ae(e,t=>({login:t.login,logout:t.logout,nextAuth:t.nextAuth,previousAuth:t.previousAuth,setAuth:t.setAuth,addService:t.addService,removeService:t.removeService}))}function qa(){let e=se();return ae(e,n=>n)}function yr(e){let n=se();return ae(n,r=>r.authItems.find(o=>o.service.id===e))}function Mt(e){let n=se();return ae(n,r=>r.authItems.find(o=>o.id===e)?.session?.token)}function Ba(e){let n=se();return ae(n,r=>{let o=r.authItems.find(i=>i.service.id===e);return!o||!o.isLoggedIn||!o.session?null:o.session?.token||null})}function Sr(e){let n=vr(),t=yr(e.service.id);return fr(()=>(n?.addService(e.service,e.probeId),()=>{n?.removeService(e.service,e.probeId)}),[e.service]),t?(t.error||!t.isLoggedIn,e.children):null}function qe(){return null}function Et(e){let[n,t,r]=wt(e.resource),o=e.fallbackComponent||qe,i=e.loadingComponent||qe,a=e.errorComponent||qe,s=t.service,u=null;if(!r||!s)return e.children(n);let c=s.service.filter(l=>l.type==="AuthAccessService2");t.status==="error"&&(u=Se(a,{resource:e.resource,error:t.error||"",heading:t.errorHeading,note:t.errorNote,extra:e.extra})),(t.status==="unknown"||t.status==="probing")&&(u=Se(i,{})),t.status==="success"&&(u=e.children(n));for(let l of c)u=Se(Sr,{service:l,probeId:s.id,children:u},l.id);return u}import{createContext as Pr,useContext as Ka,useMemo as Rr}from"react";import{createStore as xr}from"zustand/vanilla";var Ar=e=>e.id||e["@id"];function Cr(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 kt=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?Ar(n):void 0,r=null;return xr((o,i)=>({service:n,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!n,hasAutocomplete:n?!!Cr(n):!1,errorMessage:"",search(a,s={}){if(!t)throw new Error("No search service found.");r&&!r.signal.aborted&&r.abort(),r=new AbortController;let u=new URLSearchParams;a.q&&u.set("q",a.q),a.motivation&&u.set("motivation",a.motivation),a.date&&u.set("date",a.date),a.user&&u.set("user",a.user),o({loading:!0}),fetch(`${t}?${u.toString()}`,{signal:r.signal,headers:{"Content-Type":"application/json",Accept:"application/json",...s.headers||{}}}).then(async c=>{if(!r?.signal.aborted)if(c.ok){let l=await c.json();o({resources:l.resources,error:!1,errorMessage:""})}else o({resources:[],error:!0,errorMessage:c.statusText})})},clearSearch(){o({resources:[],error:!1,errorMessage:""})},highlightResult(a){let s=i().resources.find(u=>u["@id"]===a);o({highlight:s})},nextResult(){let a=i().resources,s=i().highlight;if(!s){o({highlight:a[0]||null});return}let u=a.findIndex(c=>c["@id"]===s["@id"]);if(u===-1){o({highlight:a[0]||null});return}o({highlight:a[u+1]||a[0]||null})},previousResult(){let a=i().resources,s=i().highlight;if(!s){o({highlight:a[a.length-1]||null});return}let u=a.findIndex(c=>c["@id"]===s["@id"]);if(u===-1){o({highlight:a[a.length-1]||null});return}if(u===0){o({highlight:a[a.length-1]||null});return}o({highlight:a[u-1]||a[a.length-1]||null})}}))};import{useStore as ns}from"zustand";function Lt(){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 _e}from"react/jsx-runtime";var J=Pr(null);J.displayName="Search";function zt(e){let n=Lt();return e.store?_e(J.Provider,{value:e.store,children:e.children}):_e(br,{service:n,children:e.children})}function br({service:e,children:n}){let t=Rr(()=>kt(e),[e]);return _e(J.Provider,{value:t,children:n})}import{jsx as T}from"react/jsx-runtime";var ue=()=>{},ce=wr({setCurrentCanvasId:ue,setCurrentCanvasIndex:ue,nextCanvas:ue,previousCanvas:ue,items:[],sequence:[],setSequenceIndex:ue,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function Vr(e){let n=M(),{cursor:t,visibleItems:r,next:o,sequence:i,items:a,setCanvasIndex:s,setCanvasId:u,previous:c,setSequenceIndex:l,hasNext:d,hasPrevious:g}=yt({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),h=Mr(()=>({sequence:i,items:a,setCurrentCanvasId:u,nextCanvas:o,previousCanvas:c,totalCanvases:a.length,setCurrentCanvasIndex:s,setSequenceIndex:l,currentSequenceIndex:t,hasNext:d,hasPrevious:g}),[i,a,u,o,c,a,s,l,t]);return n?r.length===0?null:T(ce.Provider,{value:h,children:T(Z.Provider,{value:r,children:T(_,{canvas:r[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),T("div",{children:"Sorry, something went wrong."}))}function Ot(e){let n=G(e.vault),t=ft(e.manifest);if(!t)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),T("div",{children:"Sorry, something went wrong."});if(t.error)return T("div",{children:t.error.toString()});if(!t.isLoaded)return T("div",{children:"Loading..."});let r=T(Vr,{...e,children:e.children});return T(W,{vault:n,children:T(pt,{manifest:t.id,children:T(Tt,{children:T(zt,{children:e.rangeId?T(gt,{range:e.rangeId,children:r}):r})})})})}function Ft(){return Ir(ce)}import Tr from"react";import{createContext as Nr,useMemo as Er}from"react";import kr from"mitt";import{jsx as zr}from"react/jsx-runtime";var Lr=kr(),X=Nr({emitter:Lr});X.displayName="Events";function Ht(){return Tr.useContext(X).emitter}function ks({emitter:e,children:n}){return zr(X.Provider,{value:Er(()=>({emitter:e}),[e]),children:n})}import{jsx as ee}from"react/jsx-runtime";function Ut(){return{VaultContext:Y(j),ResourceContext:Y(he),SimpleViewerReactContext:Y(ce),VisibleCanvasReactContext:Y(Z),AuthRContext:Y(K),SearchReactContext:Y(J),ReactEventContext:Y(X)}}function Dt(e){return ee(W,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:ee(Z.Provider,{value:e.bridge.VisibleCanvasReactContext,children:ee(ce.Provider,{value:e.bridge.SimpleViewerReactContext,children:ee(X.Provider,{value:e.bridge.ReactEventContext,children:ee(K.Provider,{value:e.bridge.AuthRContext,children:ee(J.Provider,{value:e.bridge.SearchReactContext,children:e.children})})})})})})}import{createContext as Dr,useContext as qr,useMemo as Br}from"react";import{useCallback as Bt,useLayoutEffect as Fr,useMemo as Hr,useRef as Ur}from"react";import{entityActions as $e}from"@iiif/helpers/vault/actions";import{useMemo as Or}from"react";function qt(){let n=v().getStore();return Or(()=>t=>n.dispatch(t),[n])}function _t(e){return typeof e!="string"&&e&&e.bindToVault}function $t(){let e=v(),n=Ur([]),t=qt(),r=Hr(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);Fr(()=>{let s={id:r,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};t($e.importEntities({entities:{AnnotationPage:{[s.id]:s}}}))},[r]);let o=y(s=>r&&s.iiif.entities.AnnotationPage[r]||null,[r]),i=Bt((s,u)=>{if(r){if(_t(s)){let d=s;d.__vault||d.bindToVault(e),s=typeof d.source=="string"?d.source:d.source.id,n.current[s]=d}else typeof s!="string"&&(s=s.id);let c=e.get({id:r,type:"AnnotationPage"}),l=e.get({id:s,type:"Annotation"});c&&l&&(c.items.find(d=>d.id===l.id)||t($e.addReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"},index:u})))}},[r]),a=Bt(s=>{r&&(_t(s)?s=typeof s.source=="string"?s.source:s.source.id:typeof s!="string"&&(s=s.id),n.current[s]&&n.current[s].beforeRemove(),e.get({id:r,type:"AnnotationPage"})&&t($e.removeReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"}})))},[r]);return[o,{addAnnotation:i,removeAnnotation:a}]}import{jsx as _r}from"react/jsx-runtime";var jt=Dr(null);function Yt(){let e=qr(jt);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function Qt({children:e}){let[n,{addAnnotation:t,removeAnnotation:r}]=$t();return _r(jt.Provider,{value:Br(()=>({fullPage:n,addAnnotation:t,removeAnnotation:r}),[n]),children:e})}import{jsx as je,jsxs as $r}from"react/jsx-runtime";function Wt({width:e,style:n,height:t,error:r,resetErrorBoundary:o}){return $r("div",{style:{width:e,height:t,minHeight:500,...n||{},background:"#f9f9f9"},children:[je("h3",{children:"Error occurred"}),je("p",{children:r.message}),je("button",{onClick:o,children:"Reset"})]})}import{createContext as jr,useContext as Yr}from"react";var le=jr(null);function Gt(){return Yr(le)}import{createContext as Zt,useContext as Qr,useEffect as Wr}from"react";var Ye=Zt(()=>{}),Qe=Zt(()=>{});function L(e,n,t,r,o=[]){let i=Qr(e==="portal"?Qe:Ye);Wr(()=>(e!=="none"&&i(n,t,r),()=>{i(n,null)}),[n,e,i,...o])}import{createContext as Zr,useContext as Kr,useEffect as Jr}from"react";import{useMemo as Gr}from"react";function P(e={},n=[]){let{id:t,selector:r}=e,o=E(),i=t||o.canvas,a=y(s=>i?s.iiif.entities.Canvas[i]:void 0,[i]);return Gr(()=>{if(a)return r?r(a):a},[a,r,...n])}var We=Zr(()=>{});function Kt(e){let n=P(),t=Kr(We);Jr(()=>n&&n.id?(t(n.id,e),()=>t(n.id,-1)):()=>{},[n,e])}import{Fragment as no,jsx as w,jsxs as ro}from"react/jsx-runtime";function en({children:e,errorFallback:n,outerContainerProps:t={},worldScale:r,...o}){let[i,a]=xe(),s=Ut(),u=n||Wt,[c,l]=xe({}),d=Object.entries(c),[g,h]=xe({}),f=Object.entries(g),[m,x]=xe({}),S=Xt(()=>r||Math.max(...Object.values(m)),[m]),D=Xt(()=>({maxOverZoom:S||1,...o.runtimeOptions||{}}),[S,o.runtimeOptions]),b=Ge((C,I)=>{x(N=>{if(I===-1){let{[C]:p,...O}=N;return O}return{...N,[C]:I}})},[]),ze=Ge((C,I,N)=>{l(({[C]:p,...O})=>I?{...O,[C]:{element:I,props:N}}:O)},[]),fe=Ge((C,I,N)=>{h(({[C]:p,...O})=>I?{...O,[C]:{element:I,props:N}}:O)},[]);return ro(to,{resetKeys:[],fallbackRender:C=>w(u,{...o,...C}),children:[w(Xr,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:w(no,{children:d.map(([C,{element:I,props:N}])=>w(Jt.Fragment,{children:w(I,{...N||{}})},C))}),onCreated:C=>{a(C),o.onCreated&&o.onCreated(C)},runtimeOptions:D,children:w(le.Provider,{value:i,children:w(We.Provider,{value:b,children:w(Ye.Provider,{value:ze,children:w(Qe.Provider,{value:fe,children:w(Dt,{bridge:s,children:w(eo.Provider,{value:o.mode||"explore",children:w(Qt,{children:e})})})})})})})}),w("div",{children:f.map(([C,{element:I,props:N}])=>w(Jt.Fragment,{children:w(I,{...N||{}})},C))})]})}import{mergeStyles as co,RegionHighlight as lo}from"@atlas-viewer/atlas";import{useMemo as tn}from"react";import{createEventsHelper as oo}from"@iiif/helpers/events";function Ae(e,n){let t=v(),r=tn(()=>oo(t),[t]),o=y(()=>e&&e.id?t.getResourceMeta(e.id,"eventManager"):null,[e]);return tn(()=>e?r.getListenersAsProps(e,n):{},[o,e,t,n])}import{useMemo as io}from"react";import{createStylesHelper as ao}from"@iiif/helpers/styles";function te(e,n){let t=v(),r=io(()=>ao(t),[t]);return y(()=>{if(!e)return null;let o=r.getAppliedStyles(e.id);return o?n?o[n]:o:void 0},[e,n])}import{useMemo as mo}from"react";import{useMemo as so}from"react";import{expandTarget as uo}from"@iiif/helpers/annotation-targets";function Ce(e={},n=[]){let{id:t,selector:r}=e,o=E(),i=v(),a=t||o.annotation,s=y(c=>a?c.iiif.entities.Annotation[a]:void 0,[a]),u=y(c=>s&&s.body?s.body.map(l=>l?l.type==="SpecificResource"?{...l,source:i.get(l)}:l?c.iiif.entities[l.type][l.id]:null:null).filter(Boolean):[],[s]);return so(()=>{if(!s)return;let c={...s,body:u,target:uo(s.target,{typeMap:i.getState().iiif.mapping})};return r?r(c):c},[s,r,u,...n])}import{jsx as fo}from"react/jsx-runtime";var Pe=({id:e,style:n,className:t,interactive:r})=>{let o=Ce({id:e}),i=te(o,"atlas"),a=te(o,"html"),s=Ae(o,["atlas"]),u=P(),c=mo(()=>co(n,i),[n,i]);return u&&o&&o.target&&o.target.selector&&o.target.selector.type==="BoxSelector"&&o.target.source&&(o.target.source.id===u.id||o.target.source===u.id)?fo(lo,{id:o.id,isEditing:!0,region:o.target.selector.spatial,style:c,className:a?.className||t,interactive:!!(a?.href||r),href:a?.href||null,title:a?.title||null,hrefTarget:a?.target||null,onClick:()=>{},...s}):null};import{Fragment as go}from"react";import{useMemo as po}from"react";function nn(e={},n=[]){let{id:t,selector:r}=e,o=E(),i=t||o.annotationPage,a=y(s=>i?s.iiif.entities.AnnotationPage[i]:void 0,[i]);return po(()=>{if(a)return r?r(a):a},[a,...n])}import{jsx as rn}from"react/jsx-runtime";var de=({className:e,page:n})=>{let t=nn({id:n.id})||n,r=te(t,"atlas"),o=te(t,"html");return y(i=>t.id?i.iiif.entities.AnnotationPage[t.id]:null,[]),rn(go,{children:t.items?.map(i=>rn(Pe,{id:i.id,style:r,className:o?.className||e},i.id))})};import{createStylesHelper as ri}from"@iiif/helpers/styles";import{Fragment as mn,useMemo as Co}from"react";import{HTMLPortal as So,TileSet as ln}from"@atlas-viewer/atlas";import Re,{useMemo as Ze}from"react";import{jsx as F}from"react/jsx-runtime";var an=Re.createContext("en"),sn=Re.createContext({});function Ic(e){return F(sn.Provider,{value:e.translations,children:e.children})}function wc(e){return F(an.Provider,{value:e.language,children:e.children})}function Ke(){return Re.useContext(an)}function un(){return Re.useContext(sn)}function on(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function ho({as:e,language:n,children:t,viewingDirection:r,...o}){let i=Ke();return Ze(()=>on(i)===on(n),[i,n])?e?F(e,{...o,children:t}):F("span",{...o,children:t}):e?F(e,{...o,lang:n,dir:r,children:t}):F("span",{...o,lang:n,dir:r,children:t})}function cn(e,n,t){if(n.length===0)return;if(n.length===1)return n[0];if(n.indexOf(e)!==-1)return e;let r=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(r&&n.indexOf(r)!==-1)return r;for(let o of t)if(n.indexOf(o)!==-1)return o;return n.indexOf("none")!==-1?"none":n.indexOf("@none")!==-1?"@none":n[0]}var vo=(e,n=[])=>{let t=Ke();return Ze(()=>{let r=e();return cn(t,r,[])},[t,...n])};function Q(e,n){return n?e[n]||n:""}function yo(e,n,t=`
2
- `,r={}){let o=vo(()=>Object.keys(e||{}),[e]);return[Ze(()=>{if(!e)return Q(r,n)||"";if(typeof e=="string")return Q(r,e);let i=o?e[o]:void 0;return i?typeof i=="string"?i:i.map(a=>Q(r,a)).join(t):""},[o,n,e]),o]}function Mc(){let e=Ke(),n=un();return function(r,o="",i=`
3
- `,a=n){let s=Object.keys(r||{}),u=cn(e,s,[]);if(!r)return Q(a,o)||"";if(typeof r=="string")return Q(a,r);let c=u?r[u]:void 0;return c?typeof c=="string"?Q(a,c):c.map(l=>Q(a,l)).join(typeof i<"u"?i:`
4
- `):""}}function me({as:e,defaultText:n,enableDangerouslySetInnerHTML:t,children:r,separator:o,...i}){let a=un(),[s,u]=yo(r,n,o,a);return u?F(ho,{...i,as:e,language:u,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s}):e?F(e,{...i,children:s}):F("span",{...i,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s})}import{jsx as H,jsxs as Ao}from"react/jsx-runtime";function xo({resource:e,heading:n,note:t,extra:r}){return r?H(So,{target:{x:0,y:0,width:r.target?.spatial.width,height:r.target?.spatial.height},backgroundColor:"#333",relative:!0,children:H("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:Ao("div",{children:[H(me,{children:n||"Not authorised"}),t&&H("p",{children:H(me,{children:t})}),H("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function dn({image:e,thumbnail:n,crop:t,enableSizes:r}){if(!Nt()){let i=e.service,a=i.width||e.width||0,s=i.height||e.height||0;return H(ln,{tiles:{id:i.id||i["@id"]||"unknown",height:s,width:a,imageService:i},enableSizes:r,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}return H(Et,{resource:e.service,errorComponent:xo,extra:e,children:i=>{let a=i.width||e.width||0,s=i.height||e.height||0;return H(ln,{tiles:{id:i.id||i["@id"]||"unknown",height:s,width:a,imageService:i},enableSizes:r,x:0,y:0,width:e.target?.spatial.width,height:e.target?.spatial.height,crop:t})}},e.id)}import{jsx as Je,jsxs as fn}from"react/jsx-runtime";function be({id:e,image:n,thumbnail:t,isStatic:r,x:o=0,y:i=0,children:a,selector:s,onClick:u,enableSizes:c}){let l=Co(()=>{if(!(!s||s.spatial.x===0&&s.spatial.y===0))return s.spatial},[s]);return Je("world-object",{x:o+n.target.spatial.x,y:i+n.target.spatial.y,width:n.target.spatial.width,height:n.target.spatial.height,onClick:u,children:n.service?fn(mn,{children:[Je(dn,{image:n,thumbnail:t,crop:l,enableSizes:c}),a]},"service"):fn(mn,{children:[Je("world-image",{onClick:u,uri:n.id,target:{x:0,y:0,width:n.target.spatial.width,height:n.target.spatial.height},display:n.width&&n.height?{width:n.width,height:n.height}:void 0,crop:l}),a]},"no-service")},e+(n.service?"server":"no-service"))}import{Fragment as oi,useEffect as zn,useLayoutEffect as ii,useMemo as On}from"react";import{HTMLPortal as ai}from"@atlas-viewer/atlas";import{useEffect as Pn,useMemo as Rn}from"react";import{useCallback as hn,useMemo as Ro}from"react";function Po(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function pn(e,n){return y(t=>{let r=[];if(!e)return r;let o=Object.keys(t.iiif.entities.AnnotationPage);for(let i of o)if(!n||n.indexOf(i)!==-1){let a=Po(t,i);a&&a.views&&a.views[e]&&r.push(i)}return r},[e,n])}function gn({canvas:e,manifest:n,all:t,canvases:r}){let o=[];if(n)for(let i of n.annotations)o.indexOf(i.id)===-1&&o.push(i.id);if(t){if(r&&r.length)for(let i of r)for(let a of i.annotations)o.indexOf(a.id)===-1&&o.push(a.id)}else if(e)for(let i of e.annotations)o.indexOf(i.id)===-1&&o.push(i.id);return o}function bo(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function vn(e,n={}){let t=v(),r=M(),o=P(),i=ve(),a=Ro(()=>gn({all:n.all,manifest:r,canvas:o,canvases:i}),[n.all,o,i,r]),s=pn(e,n.all?void 0:a),u=hn(l=>{e&&t.setMetaValue([l,"annotationPageManager","views"],d=>d&&!d[e]?d:{...d||{},[e]:!1})},[e,t]),c=hn((l,d={})=>{if(!e)return;let g=t.getState(),h=[];if(d?.deselectOthers){let f=Object.keys(g.iiif.entities.AnnotationPage);for(let m of f){let x=bo(g,m);x&&x.views&&x.views[e]&&h.push(m)}}for(let f of h)u(f);t.setMetaValue([l,"annotationPageManager","views"],f=>f&&f[e]?f:{...f||{},[e]:!0})},[e,u,t]);return{availablePageIds:a,enabledPageIds:s,setPageEnabled:c,setPageDisabled:u}}function yn(e,n){return y((t,r)=>r.get(e.map(o=>({id:o,type:n}))),[e,n])}import{useCallback as To,useEffect as No,useRef as Eo,useState as ko}from"react";import Io,{useContext as wo}from"react";import{ImageServiceLoader as Mo}from"@atlas-viewer/iiif-image-api";var Vo=Io.createContext(new Mo);function Ie(){return wo(Vo)}function Sn(){let e=Ie(),[n,t]=ko({}),r=Eo(!1);return No(()=>()=>{r.current=!0},[]),[To((i,{height:a,width:s})=>{if(i){let u=i.id||i["@id"],c=e.loadServiceSync({id:u,width:i.width||s,height:i.height||a,source:i});c?i=c:n[u]||(r.current||t(l=>({...l,[u]:"loading"})),e.loadService({id:u,width:i.width||s,height:i.height||a}).then(()=>{r.current||t(l=>({...l,[u]:"done"}))}))}return i},[e,n]),n]}import{useCallback as Lo,useMemo as An,useState as zo}from"react";function xn(e={}){let n=Ce(),t=P(e.canvasId?{id:e.canvasId}:void 0);return y((r,o)=>{if(!t)return[];if(n&&e.enableSingleAnnotation)return[n];let i=o.get(t.items),a=[];for(let s of i)a.push(...o.get(s.items));return a},[t])}import{createPaintingAnnotationsHelper as Oo}from"@iiif/helpers/painting-annotations";function Cn(e,n=[]){let t=v(),r=An(()=>Oo(t),[]),o=xn({enableSingleAnnotation:e?.enableSingleAnnotation}),[i,a]=zo(e?.defaultChoices||[]),s=An(()=>r.getPaintables(o,i),[t,o,i,...n]),c={makeChoice:Lo((l,{deselectOthers:d=!0,deselect:g=!1}={})=>{s.choice&&a(h=>{if(g){let m=h.filter(x=>x!==l);if(m.length===0){let x=s.items[0].resource.id;return x?[x]:[]}return m}if(d)return[l];let f=[...h];if(f.length===0&&s.items.length){let m=s.items[0].resource.id;m&&f.push(m)}return h.indexOf(l)!==-1?h:[...h,l]})},[s.choice])};return[s,c]}function bn(e){let n=M(),t=P(),r=v(),o=Ht(),i=e?.emitter||o,[a,s]=Sn(),{enabledPageIds:u}=vn(e?.annotationPageManagerId||n?.id||t?.id,{all:!1}),c=yn(u,"AnnotationPage"),l=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[d,g]=Cn(e,[s]);Pn(()=>{let f=m=>{g.makeChoice(m.choiceId,{deselectOthers:m.deselectOthers,deselect:m.deselect})};return i.on("make-choice",f),()=>{i.off("make-choice",f)}},[]);let h=Rn(()=>ct({canvas:t,paintables:d,supports:l,loadImageService:a}),[t,d,r,g.makeChoice]);return Pn(()=>{let f=d.allChoices,m={canvasId:t?.id,manifestId:n?.id};f&&i.emit("choice-change",{choice:f,partOf:m})},[t?.id,d.allChoices]),Rn(()=>h.type==="unknown"?[h,ut]:[{...h,annotations:{pages:c}},g],[h,c])}import{useEffect as Ho,useMemo as Uo,useRef as Do,useState as qo}from"react";import{useEffect as Fo}from"react";var In=(e,n=[])=>{let t=v();Fo(()=>{e(t)},[t,...n])};import{createThumbnailHelper as Bo}from"@iiif/helpers/thumbnail";function we(e,n,{canvasId:t,manifestId:r}={}){let o=v(),i=Ie(),a=Uo(()=>Bo(o,{imageServiceLoader:i}),[o,i]),[s,u]=qo(),c=M(r?{id:r}:void 0),l=P(t?{id:t}:void 0),d=l||c,g=Do(!1);if(Ho(()=>(g.current=!1,()=>{g.current=!0}),[]),!d)throw new Error("Must be called under a manifest or canvas context.");return In(h=>{a.getBestThumbnailAtSize(d,e,n).then(f=>{f.best&&!g.current&&u(f.best)})},[d]),s}import{useCallback as z,useEffect as wn,useReducer as _o,useRef as Me}from"react";function $o(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function jo(e,n){switch(n.type){case"FINISHED":return{...e,isFinished:!0,isPlaying:!1,playRequested:!1};case"PLAY_PAUSE":return{...e,isFinished:!1,isPlaying:!e.isPlaying};case"PLAY_REQUESTED":return{...e,isFinished:!1,playRequested:!0};case"PAUSE":return{...e,isPlaying:!1};case"PLAY":return{...e,isFinished:!1,playRequested:!1,isPlaying:!0};case"MUTE":return{...e,isMuted:!0};case"SET_VOLUME":return{...e,volume:n.volume,isMuted:n.volume===0};case"TOGGLE_MUTE":return{...e,isMuted:!e.isMuted};case"UNMUTE":return{...e,isMuted:!1}}return e}function Yo(e){let n=Math.round(e);return`${Math.floor(n/60)}:${`${n%60}`.padStart(2,"0")}`}function ne(e){let[n,t]=_o(jo,$o(e.duration)),r=Me(null),o=Me(null),i=Me(null),a=Me(!1),s=z(()=>{o.current&&r.current&&(o.current.innerHTML=Yo(r.current.currentTime),i.current&&(i.current.style.width=`${r.current.currentTime/e.duration*100}%`),a.current!==r.current.muted&&(a.current=r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"})))},[e.duration]),u=z(()=>{r.current&&(t({type:"PLAY_REQUESTED"}),r.current.play().then(()=>{t({type:"PLAY"})}),s())},[s]),c=z(()=>{r.current&&(r.current.duration>0&&r.current.paused?u():l())},[s]),l=z(()=>{r.current&&(r.current.pause(),t({type:"PAUSE"}),s())},[s]),d=z(()=>{r.current&&(r.current.muted=!r.current.muted,t(r.current.muted?{type:"MUTE"}:{type:"UNMUTE"}))},[]),g=z(()=>{r.current&&(r.current.muted=!0,t({type:"MUTE"}))},[]),h=z(()=>{r.current&&(r.current.muted=!1,t({type:"UNMUTE"}))},[]),f=z(S=>{r.current&&(r.current.muted=!1,r.current.volume=S/100,t({type:"SET_VOLUME",volume:S}))},[]),m=z(S=>{r.current&&(r.current.currentTime=Math.max(0,Math.min(S*e.duration,e.duration)),s())},[]),x=z(S=>{r.current&&(r.current.currentTime=Math.max(0,Math.min(S,e.duration)),s())},[]);return wn(()=>{let S=setInterval(()=>{s()},350);return()=>clearInterval(S)},[s,e.duration]),wn(()=>{let S=()=>{t({type:"FINISHED"})},D=r.current;return D?.addEventListener("ended",S),()=>D?.removeEventListener("ended",S)},[]),[{element:r,currentTime:o,progress:i},n,{play:u,pause:l,playPause:c,mute:g,unmute:h,toggleMute:d,setVolume:f,setDurationPercent:m,setTime:x}]}import{createContext as et,useContext as tt}from"react";import{jsx as Xe}from"react/jsx-runtime";var Mn=et(null),Vn=et(null),Tn=et(null);function jl(){let e=tt(Mn);if(!e)throw new Error("Ctx not found");return e}function Yl(){let e=tt(Vn);if(!e)throw new Error("Ctx not found");return e}function Ql(){let e=tt(Tn);if(!e)throw new Error("Ctx not found");return e}function Ve({actions:e,state:n,children:t,currentTime:r,progress:o,element:i}){return Xe(Tn.Provider,{value:{currentTime:r,progress:o,element:i},children:Xe(Vn.Provider,{value:e,children:Xe(Mn.Provider,{value:n,children:t})})})}import{jsx as Qo,jsxs as Wo}from"react/jsx-runtime";function nt({media:e,children:n}){let[{element:t,currentTime:r,progress:o},i,a]=ne({duration:e.duration});return Wo(Ve,{state:i,actions:a,currentTime:r,progress:o,element:t,children:[Qo("audio",{ref:t,src:e.url}),n]})}function Te({media:e,mediaControlsDeps:n,children:t}){return L("portal","audio",nt,{media:e,children:t},[e,...n||[]]),null}import{jsx as Nn,jsxs as Go}from"react/jsx-runtime";function rt({element:e,media:n,playPause:t,poster:r}){return Go("div",{className:"video-container",part:"video-container",onClick:t,children:[Nn("style",{children:`
5
- .video-container {
6
- position: absolute;
7
- top: 0;
8
- bottom: 0;
9
- left: 0;
10
- right: 0;
11
- background: #000;
12
- z-index: 13;
13
- display: flex;
14
- justify-content: center;
15
- pointer-events: visible;
16
- }
17
- `}),Nn("video",{poster:r,ref:e,src:n.url,style:{width:"100%",objectFit:"contain"}})]})}function Ne({media:e,mediaControlsDeps:n,children:t,videoComponent:r=rt}){let o=P(),i=o&&o.placeholderCanvas&&o.placeholderCanvas.id||void 0,a=we({},!1,{canvasId:i}),[{element:s,currentTime:u,progress:c},l,d]=ne({duration:e.duration});return L("overlay","video-element",r,{element:s,media:e,playPause:d.playPause,poster:a?.id},[a]),L("portal","custom-controls",Ve,{state:l,actions:d,currentTime:u,progress:c,element:s,children:t},[u,l,e,...n||[]]),null}import{Fragment as Zo,jsx as ot,jsxs as Ko}from"react/jsx-runtime";function it({model:e}){return Ko(Zo,{children:[ot("style",{children:`
18
- .model-container {
19
- position: absolute;
20
- top: 0;
21
- bottom: 0;
22
- left: 0;
23
- right: 0;
24
- background: #000;
25
- z-index: 13;
26
- display: flex;
27
- justify-content: center;
28
- pointer-events: visible;
29
- }
30
- `}),ot("div",{className:"model-container",children:ot("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Ee({model:e,name:n}){return L("overlay",`model-${n}`,it,{model:e},[e]),null}import{jsx as Jo}from"react/jsx-runtime";function ke({style:e}){let n=P();return!n||!n.height||!n.width?null:Jo("box",{interactive:!1,target:{x:0,y:0,width:Number(n.width),height:Number(n.height)},style:e})}import{jsx as Xo}from"react/jsx-runtime";function En(e){return P()?Xo(re,{renderViewerControls:e.renderViewerControls}):null}import{useRef as ei}from"react";import{jsx as kn,jsxs as ni}from"react/jsx-runtime";function ti({element:e,media:n,playPause:t}){let r=ei(null);return n.youTubeId?ni("div",{className:"video-container",part:"video-container",onClick:t,children:[kn("style",{children:`
31
- .video-container {
32
- position: absolute;
33
- top: 0;
34
- bottom: 0;
35
- left: 0;
36
- right: 0;
37
- background: #000;
38
- z-index: 13;
39
- display: flex;
40
- justify-content: center;
41
- pointer-events: visible;
42
- }
43
- .video-yt {
44
- border: none;
45
- width: 100%;
46
- object-fit: contain;
47
- }
48
- `}),kn("iframe",{className:"video-yt",ref:r,src:`https://www.youtube.com/embed/${n.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function Ln({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:i},a,s]=ne({duration:e.duration});return L("overlay","video-element",ti,{element:r,media:e,playPause:s.playPause}),null}import{Fragment as Le,jsx as R,jsxs as $}from"react/jsx-runtime";function re({x:e,y:n,onChoiceChange:t,registerActions:r,defaultChoices:o,isStatic:i,renderViewerControls:a,renderMediaControls:s,viewControlsDeps:u,mediaControlsDeps:c,strategies:l,throwOnUnknown:d,backgroundStyle:g,alwaysShowBackground:h,keepCanvasScale:f=!1,enableSizes:m=!1,enableYouTube:x=!0,onClickPaintingAnnotation:S,children:D}){let b=P(),ze=Ae(b,["deep-zoom"]),[fe]=Yt(),C=Gt(),I=v(),N=On(()=>ri(I),[I]),[p,O]=bn({strategies:l||["images"],defaultChoices:o?.map(({id:A})=>A)}),at=p.type==="images"?p.choice:void 0,Hn=On(()=>f?1:Math.max(1,...p.type==="images"?p.images.map(A=>(A.width||0)/A.target?.spatial.width):[]),[f,p]);Kt(Hn),zn(()=>{r&&r(O)},[p.annotations]),zn(()=>{if(o)for(let A of o)typeof A.opacity<"u"&&N.applyStyles({id:A.id},"atlas",{opacity:A.opacity})},[o]),ii(()=>{t&&t(at)},[at]),L(C&&(p.type==="images"||p.type==="empty"||p.type==="textual-content"&&a)?"overlay":"none",`canvas-portal-controls-${b?.id}`,le.Provider,a?{value:C||null,children:a(p)}:{},[b,C,p,...u||[]]);let q=we({maxWidth:256,maxHeight:256});if(!b)return null;let Oe=b.accompanyingCanvas,pe=b.placeholderCanvas,oe=q&&q.type==="fixed"?R("world-object",{height:b.height,width:b.width,x:e,y:n,children:R("world-image",{uri:q.id,target:{x:0,y:0,width:b.width,height:b.height},display:q.width&&q.height?{width:q.width,height:q.height}:void 0,crop:void 0})}):null;if(p.type==="unknown"){if(oe)return oe;if(d)throw new Error(p.reason||"Unknown image strategy");return null}let st=$(oi,{children:[fe?R(de,{page:fe}):null,p.annotations&&p.annotations.pages?p.annotations.pages.map(A=>R(de,{page:A},A.id)):null,D]}),Un=p.type==="images"?p.images.length:0,di=p.type==="media"&&p.media.type==="Video"&&pe?R(_,{canvas:pe.id,children:R(En,{renderViewerControls:a})}):null;return $(Le,{children:[$("world-object",{height:b.height,width:b.width,x:e,y:n,...ze,children:[p.type==="empty"||h?R(ke,{style:g}):null,p.type==="textual-content"?p.items.map((A,ge)=>$(Le,{children:[R(ai,{onClick:S?ie=>{ie.stopPropagation(),S(A.annotationId,A,ie)}:void 0,target:A.target?.spatial||void 0,children:R("div",{"data-textual-content":!0,children:R(me,{enableDangerouslySetInnerHTML:!0,children:A.text})})},ge),st]})):null,p.type==="images"?$(Le,{children:[p.images.map((A,ge)=>R(be,{isStatic:i,image:A,id:A.id,thumbnail:ge===0?q:void 0,selector:A.selector,enableSizes:m,onClick:S?ie=>{ie.stopPropagation(),S(A.annotationId,A,ie)}:void 0},A.id+ge)),st]}):null,p.type==="3d-model"?R(Ee,{model:p.model}):null,p.type==="media"?R(Le,{children:p.media.type==="Sound"?$(Te,{media:p.media,mediaControlsDeps:c,children:[oe,s?s(p):null]}):p.media.type==="Video"?$(Ne,{media:p.media,mediaControlsDeps:c,children:[oe,s?s(p):null]}):p.media.type==="VideoYouTube"&&x?$(Ln,{media:p.media,mediaControlsDeps:c,children:[oe,s?s(p):null]}):null}):null]},`${b.id}/${p.type}/${Un}`),p.type==="media"&&p.media.type==="Sound"&&Oe?R(_,{canvas:Oe.id,children:R(re,{renderViewerControls:a})}):null,p.type==="media"&&p.media.type==="Sound"&&pe&&!Oe?R(_,{canvas:pe.id,children:R(re,{renderViewerControls:a})}):null]})}import{Fragment as ci,jsx as U,jsxs as li}from"react/jsx-runtime";var ui=Fn(function(n,t){let r=M(),o=ve(),i=Ft(),{ViewerControls:a,MediaControls:s}=n.components||{};if(si(t,()=>i,[i]),!r)return U("div",{});let u=0;return li(ci,{children:[n.header,U(V.Viewer,{height:n.height,mode:n.mode,renderPreset:n.renderPreset,runtimeOptions:n.runtimeOptions,children:o.map((c,l)=>{let d=u;return u+=c.width+(n.spacing||0),U(_,{canvas:c.id,children:U(V.RenderCanvas,{strategies:["3d-model","media","images","empty","textual-content"],renderViewerControls:l===0&&a?()=>U(a,{}):void 0,renderMediaControls:l===0&&s?()=>U(s,{}):void 0,x:d,...n.canvasProps||{},children:n.annotations},c.id)},c.id)})},n.reuseAtlas?"":i.currentSequenceIndex),n.children]})}),V=Fn(function({children:n,height:t,annotations:r,canvasProps:o,spacing:i,header:a,components:s,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,...g},h){let f=G();return U(W,{vault:f,children:U(Ot,{...g,children:U(ui,{ref:h,height:t,components:s,spacing:i,canvasProps:o,annotations:r,header:a,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,children:n})})})});V.RenderImage=be;V.RenderCanvas=re;V.RenderAnnotationPage=de;V.RenderAnnotation=Pe;V.Viewer=en;V.CanvasBackground=ke;V.Audio=Te;V.Video=Ne;V.Model=Ee;V.AudioHTML=nt;V.VideoHTML=rt;V.ModelHTML=it;export{he as a,E as b,B as c,j as d,W as e,G as f,mt as g,ft as h,pt as i,_ as j,v as k,y as l,Z as m,ve as n,M as o,gt as p,sr as q,He as r,sa as s,ht as t,la as u,Ue as v,vt as w,yt as x,Pa as y,At as z,Ct as A,Pt as B,De as C,St as D,K as E,gr as F,hr as G,Tt as H,Nt as I,se as J,vr as K,qa as L,yr as M,Mt as N,Ba as O,Et as P,Lt as Q,ce as R,Vr as S,Ot as T,Ft as U,Lr as V,X as W,Ht as X,ks as Y,Ut as Z,Dt as _,qt as $,$t as aa,Yt as ba,Qt as ca,le as da,Gt as ea,P as fa,Ae as ga,te as ha,Ce as ia,nn as ja,Ic as ka,wc as la,Ke as ma,un as na,ho as oa,vo as pa,yo as qa,Mc as ra,me as sa,gn as ta,vn as ua,yn as va,Vo as wa,Ie as xa,Sn as ya,xn as za,Cn as Aa,bn as Ba,In as Ca,we as Da,Yo as Ea,ne as Fa,jl as Ga,Yl as Ha,Ql as Ia,Ve as Ja,V as Ka};