react-iiif-vault 1.2.3 → 1.2.5

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-AWTNLE7O.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 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 hn,L as fo,La as ce,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-7Z6G4L4M.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 Cn=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 An(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 mr({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 fr({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 Sr({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function Cr(){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 Ir(){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 wr({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 oi(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 ai({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function mi({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function gi({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function vi(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 ki({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 Ti(e,t=!1){}function Mi(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 Ai(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 Fi(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 Xi(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 ea(){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 ia(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ai as AnnotationContext,mi as AnnotationPageContext,wr as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,Cn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,gi as CollectionContext,An 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,Jn as ManifestMetadata,pn as MediaPlayerProvider,O as Metadata,oi as PolygonSelector,Yt as RangeContext,Io as ReactEventContext,Dt as ReactVaultContext,fr as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,Sr as SelectorControllerProvider,mr 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,vi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,ki as useCanvasChoices,Ti as useCanvasClock,Zt as useCanvasSequence,hn as useCanvasStartTime,Mi as useCanvasSubset,$o as useClosestLanguage,Ai as useCollection,Po as useContextBridge,Xo as useCreateLocaleString,fo as useCurrentAuth,wo as useDispatch,ae as useEventEmitter,Fi as useEventListener,Ot as useExistingVault,Xi as useExternalCollection,$t as useExternalManifest,te as useExternalResource,Do as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,ea 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,Cr as useSelectorEmitter,xe as useSelectorEvents,Ir as useSelectorHelper,un as useSimpleMediaPlayer,ie as useSimpleViewer,ia 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-iiif-vault",
3
- "version": "1.2.3",
3
+ "version": "1.2.5",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -1,48 +0,0 @@
1
- import{c as at,k as st}from"./chunk-DXFXJCXN.js";import{forwardRef as zn,useImperativeHandle as oi}from"react";import Zt,{useCallback as je,useMemo as Kt,useState as ye}from"react";import{AtlasAuto as Kr,ModeContext as Jr}from"@atlas-viewer/atlas";import{ErrorBoundary as Xr}from"react-error-boundary";import{useContext as j}from"react";import Hn,{useContext as Un,useMemo as Dn}from"react";import{jsx as Bn}from"react/jsx-runtime";var qn={collection:void 0,manifest:void 0,range:void 0,canvas:void 0,annotation:void 0,annotationPage:void 0},pe=Hn.createContext(qn),E=()=>Un(pe);function B({value:e,children:n}){let t=E(),r=Dn(()=>({...t,...e}),[e,t]);return Bn(pe.Provider,{value:r,children:n})}import _n,{useState as $n}from"react";import{Vault as ut,globalVault as jn}from"@iiif/helpers/vault";import{jsx as ct}from"react/jsx-runtime";var $=_n.createContext({vault:null,setVaultInstance:e=>{}});function Q({vault:e,vaultOptions:n,useGlobal:t,resources:r,children:o}){let[i,a]=$n(()=>e||(t?jn(n):n?new ut(n):new ut));return ct($.Provider,{value:{vault:i,setVaultInstance:a},children:ct(B,{value:r||{},children:o})})}import{useContext as Rr}from"react";import{createContext as br,useMemo as Ir}from"react";import{globalVault as Yn}from"@iiif/helpers/vault";import{useContext as Qn}from"react";function W(e){let n=Qn($);return e||(n&&n.vault?n.vault:Yn())}import{useEffect as Wn,useMemo as Gn,useState as ke}from"react";function lt(e,{noCache:n=!1}={}){let t=typeof e=="string"?e:e.id,r=W(),[o,i]=ke(t),[a,s]=ke(void 0),u=Gn(()=>r.get(t,{skipSelfReturn:!0})||void 0,[t,r]),[c,l]=ke(u);return Wn(()=>{(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 dt(e,n){let{id:t,isLoaded:r,error:o,resource:i,requestId:a,cached:s}=lt(e,n);return{id:t,isLoaded:r,error:o,manifest:i,requestId:a,cached:s}}import{jsx as Zn}from"react/jsx-runtime";function mt({manifest:e,children:n}){return Zn(B,{value:{manifest:e},children:n})}import{jsx as Kn}from"react/jsx-runtime";function G({canvas:e,children:n}){return Kn(B,{value:{canvas:e},children:n})}import{useContext as tr}from"react";import nr from"react";import{useContext as Jn}from"react";var v=()=>{let{vault:e}=Jn($);if(e===null)throw new Error("Vault not found. Ensure you have your provider set up correctly.");return e};import{useEffect as Xn,useState as er}from"react";function y(e,n=[]){let t=v(),[r,o]=er(()=>e(t.getState(),t));return Xn(()=>t.subscribe(i=>e(i,t),i=>{o(i)},!1),n),r}var Z=nr.createContext([]);function ge(){let e=tr(Z);return y(n=>e.map(t=>n.iiif.entities.Canvas[t]).filter(Boolean),[e])}import{useMemo as rr}from"react";function w(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 rr(()=>{if(s)return r?r(s):s},[s,r,...n])}import{jsx as or}from"react/jsx-runtime";function ft({range:e,children:n}){return or(B,{value:{range:e},children:n})}function ir(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=ir(e,e.get(t));if(r)return r}}return null}function Le(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(...Le(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 ra(e,n,t){for(let r of n.structures){let o=pt(e,e.get(r),t);if(o)return o}return null}function pt(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=pt(e,e.get(r),t);if(i)return i}}return null}function aa(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]=ze(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 ze(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:Le(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 he,useMemo as sr,useRef as ur,useState as cr}from"react";import{useMemo as ar}from"react";function gt(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 ar(()=>{if(a)return r?r(a):a},[a,r,...n])}function ht({startCanvas:e,disablePaging:n}){let t=v(),r=w(),o=gt(),[i,a]=cr(void 0),s=o||r;if(!s)throw new Error("Nothing selected");let[u,c]=sr(()=>ze(t,s,{disablePaging:n}),[t,s,n]),l=ur(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=he(m=>{let x=c.findIndex(S=>S.includes(m));a(x===-1?0:x)},[u,c]),g=he(m=>{let x=u.findIndex(S=>S.id===m);x!==-1?d(x):a(0)},[u,c]),h=he(()=>{a(m=>m>=c.length-1?m:m+1)},[c]),f=he(()=>{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 He,useContext as wt,useEffect as dr,useMemo as mr}from"react";import{useStore as ie}from"zustand";import{createStore as yt}from"zustand/vanilla";function Sa(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 St=()=>yt((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}))})),vt(t.service).then(()=>{Oe(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=${Ct()}`,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");Oe(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}))})),vt(i).then(()=>{Oe(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}))}})),xt=(e,n)=>yt((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 At(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 Oe(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 Ct(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 vt(e){let n=`${e.id}?origin=${Ct()}`,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 Pt,useMemo as Rt}from"react";import{useStore as lr}from"zustand";function bt(e){let n=Rt(()=>At(e),[e]),t=It(n.services.access?.id),r=Rt(()=>xt(n.services.probe,t),[n.services.probe]),o=lr(r);return Pt(()=>{o.status==="unknown"&&!t&&o.probe()},[n.services.probe,o.status]),Pt(()=>{t&&(o.setToken(t),o.probe())},[t]),[e,o,n.hasAuth]}import{jsx as ve}from"react/jsx-runtime";var K=He(null),fr=He(null);fr.displayName="CurrentAuth";var pr=He(null);pr.displayName="AuthActions";function Mt({children:e}){let n=mr(()=>St(),[]);return ve(K.Provider,{value:n,children:e})}function Vt(){return!!wt(K)}function ae(){let e=wt(K);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function gr(){let e=ae();return ie(e,t=>({login:t.login,logout:t.logout,nextAuth:t.nextAuth,previousAuth:t.previousAuth,setAuth:t.setAuth,addService:t.addService,removeService:t.removeService}))}function Fa(){let e=ae();return ie(e,n=>n)}function hr(e){let n=ae();return ie(n,r=>r.authItems.find(o=>o.service.id===e))}function It(e){let n=ae();return ie(n,r=>r.authItems.find(o=>o.id===e)?.session?.token)}function Ha(e){let n=ae();return ie(n,r=>{let o=r.authItems.find(i=>i.service.id===e);return!o||!o.isLoggedIn||!o.session?null:o.session?.token||null})}function vr(e){let n=gr(),t=hr(e.service.id);return dr(()=>(n?.addService(e.service,e.probeId),()=>{n?.removeService(e.service,e.probeId)}),[e.service]),t?(t.error||!t.isLoggedIn,e.children):null}function Fe(){return null}function Tt(e){let[n,t,r]=bt(e.resource),o=e.fallbackComponent||Fe,i=e.loadingComponent||Fe,a=e.errorComponent||Fe,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=ve(a,{resource:e.resource,error:t.error||"",heading:t.errorHeading,note:t.errorNote,extra:e.extra})),(t.status==="unknown"||t.status==="probing")&&(u=ve(i,{})),t.status==="success"&&(u=e.children(n));for(let l of c)u=ve(vr,{service:l,probeId:s.id,children:u},l.id);return u}import{createContext as Ar,useContext as Qa,useMemo as Cr}from"react";import{createStore as yr}from"zustand/vanilla";var Sr=e=>e.id||e["@id"];function xr(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 Nt=e=>{let n;typeof e=="string"?n={"@context":"http://iiif.io/api/search/1/context.json",profile:"http://iiif.io/api/search/1/search","@id":e,id:e,service:[]}:n=e;let t=n?Sr(n):void 0,r=null;return yr((o,i)=>({service:n,resources:[],lastQuery:{},loading:!1,error:!1,highlight:null,hasSearch:!!n,hasAutocomplete:n?!!xr(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 Ja}from"zustand";function Et(){let e=w();return e?e.service.find(n=>n.profile==="SearchService1"||n.profile==="http://iiif.io/api/search/1/search"):void 0}import{jsx as Ue}from"react/jsx-runtime";var J=Ar(null);J.displayName="Search";function kt(e){let n=Et();return e.store?Ue(J.Provider,{value:e.store,children:e.children}):Ue(Pr,{service:n,children:e.children})}function Pr({service:e,children:n}){let t=Cr(()=>Nt(e),[e]);return Ue(J.Provider,{value:t,children:n})}import{jsx as V}from"react/jsx-runtime";var se=()=>{},ue=br({setCurrentCanvasId:se,setCurrentCanvasIndex:se,nextCanvas:se,previousCanvas:se,items:[],sequence:[],setSequenceIndex:se,currentSequenceIndex:0,hasNext:!1,hasPrevious:!1});function wr(e){let n=w(),{cursor:t,visibleItems:r,next:o,sequence:i,items:a,setCanvasIndex:s,setCanvasId:u,previous:c,setSequenceIndex:l,hasNext:d,hasPrevious:g}=ht({startCanvas:e.startCanvas,disablePaging:e.pagingEnabled===!1}),h=Ir(()=>({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:V(ue.Provider,{value:h,children:V(Z.Provider,{value:r,children:V(G,{canvas:r[0],children:e.children})})}):(console.warn("The manifest passed to the provider is not a valid IIIF manifest."),V("div",{children:"Sorry, something went wrong."}))}function Lt(e){let n=W(e.vault),t=dt(e.manifest);if(!t)return console.warn("The manifest passed to the provider is not a valid IIIF manifest."),V("div",{children:"Sorry, something went wrong."});if(t.error)return V("div",{children:t.error.toString()});if(!t.isLoaded)return V("div",{children:"Loading..."});let r=V(wr,{...e,children:e.children});return V(Q,{vault:n,children:V(mt,{manifest:t.id,children:V(Mt,{children:V(kt,{children:e.rangeId?V(ft,{range:e.rangeId,children:r}):r})})})})}function zt(){return Rr(ue)}import Mr from"react";import{createContext as Vr,useMemo as Tr}from"react";import Nr from"mitt";import{jsx as kr}from"react/jsx-runtime";var Er=Nr(),X=Vr({emitter:Er});X.displayName="Events";function Ot(){return Mr.useContext(X).emitter}function Vs({emitter:e,children:n}){return kr(X.Provider,{value:Tr(()=>({emitter:e}),[e]),children:n})}import{jsx as ee}from"react/jsx-runtime";function Ft(){return{VaultContext:j($),ResourceContext:j(pe),SimpleViewerReactContext:j(ue),VisibleCanvasReactContext:j(Z),AuthRContext:j(K),SearchReactContext:j(J),ReactEventContext:j(X)}}function Ht(e){return ee(Q,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:ee(Z.Provider,{value:e.bridge.VisibleCanvasReactContext,children:ee(ue.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 Hr,useContext as Ur,useMemo as Dr}from"react";import{useCallback as Dt,useLayoutEffect as zr,useMemo as Or,useRef as Fr}from"react";import{entityActions as De}from"@iiif/helpers/vault/actions";import{useMemo as Lr}from"react";function Ut(){let n=v().getStore();return Lr(()=>t=>n.dispatch(t),[n])}function qt(e){return typeof e!="string"&&e&&e.bindToVault}function Bt(){let e=v(),n=Fr([]),t=Ut(),r=Or(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);zr(()=>{let s={id:r,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};t(De.importEntities({entities:{AnnotationPage:{[s.id]:s}}}))},[r]);let o=y(s=>r&&s.iiif.entities.AnnotationPage[r]||null,[r]),i=Dt((s,u)=>{if(r){if(qt(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(De.addReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"},index:u})))}},[r]),a=Dt(s=>{r&&(qt(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(De.removeReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"}})))},[r]);return[o,{addAnnotation:i,removeAnnotation:a}]}import{jsx as qr}from"react/jsx-runtime";var _t=Hr(null);function $t(){let e=Ur(_t);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function jt({children:e}){let[n,{addAnnotation:t,removeAnnotation:r}]=Bt();return qr(_t.Provider,{value:Dr(()=>({fullPage:n,addAnnotation:t,removeAnnotation:r}),[n]),children:e})}import{jsx as qe,jsxs as Br}from"react/jsx-runtime";function Yt({width:e,style:n,height:t,error:r,resetErrorBoundary:o}){return Br("div",{style:{width:e,height:t,minHeight:500,...n||{},background:"#f9f9f9"},children:[qe("h3",{children:"Error occurred"}),qe("p",{children:r.message}),qe("button",{onClick:o,children:"Reset"})]})}import{createContext as _r,useContext as $r}from"react";var ce=_r(null);function Qt(){return $r(ce)}import{createContext as Wt,useContext as jr,useEffect as Yr}from"react";var Be=Wt(()=>{}),_e=Wt(()=>{});function L(e,n,t,r,o=[]){let i=jr(e==="portal"?_e:Be);Yr(()=>(e!=="none"&&i(n,t,r),()=>{i(n,null)}),[n,e,i,...o])}import{createContext as Wr,useContext as Gr,useEffect as Zr}from"react";import{useMemo as Qr}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 Qr(()=>{if(a)return r?r(a):a},[a,r,...n])}var $e=Wr(()=>{});function Gt(e){let n=P(),t=Gr($e);Zr(()=>n&&n.id?(t(n.id,e),()=>t(n.id,-1)):()=>{},[n,e])}import{Fragment as eo,jsx as b,jsxs as to}from"react/jsx-runtime";function Jt({children:e,errorFallback:n,outerContainerProps:t={},worldScale:r,...o}){let[i,a]=ye(),s=Ft(),u=n||Yt,[c,l]=ye({}),d=Object.entries(c),[g,h]=ye({}),f=Object.entries(g),[m,x]=ye({}),S=Kt(()=>r||Math.max(...Object.values(m)),[m]),D=Kt(()=>({maxOverZoom:S||1,...o.runtimeOptions||{}}),[S,o.runtimeOptions]),I=je((C,R)=>{x(N=>{if(R===-1){let{[C]:p,...O}=N;return O}return{...N,[C]:R}})},[]),Ee=je((C,R,N)=>{l(({[C]:p,...O})=>R?{...O,[C]:{element:R,props:N}}:O)},[]),me=je((C,R,N)=>{h(({[C]:p,...O})=>R?{...O,[C]:{element:R,props:N}}:O)},[]);return to(Xr,{resetKeys:[],fallbackRender:C=>b(u,{...o,...C}),children:[b(Kr,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:b(eo,{children:d.map(([C,{element:R,props:N}])=>b(Zt.Fragment,{children:b(R,{...N||{}})},C))}),onCreated:C=>{a(C),o.onCreated&&o.onCreated(C)},runtimeOptions:D,children:b(ce.Provider,{value:i,children:b($e.Provider,{value:I,children:b(Be.Provider,{value:Ee,children:b(_e.Provider,{value:me,children:b(Ht,{bridge:s,children:b(Jr.Provider,{value:o.mode||"explore",children:b(jt,{children:e})})})})})})})}),b("div",{children:f.map(([C,{element:R,props:N}])=>b(Zt.Fragment,{children:b(R,{...N||{}})},C))})]})}import{mergeStyles as so,RegionHighlight as uo}from"@atlas-viewer/atlas";import{useMemo as Xt}from"react";import{createEventsHelper as no}from"@iiif/helpers/events";function Se(e,n){let t=v(),r=Xt(()=>no(t),[t]),o=y(()=>e&&e.id?t.getResourceMeta(e.id,"eventManager"):null,[e]);return Xt(()=>e?r.getListenersAsProps(e,n):{},[o,e,t,n])}import{useMemo as ro}from"react";import{createStylesHelper as oo}from"@iiif/helpers/styles";function te(e,n){let t=v(),r=ro(()=>oo(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 co}from"react";import{useMemo as io}from"react";import{expandTarget as ao}from"@iiif/helpers/annotation-targets";function xe(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 io(()=>{if(!s)return;let c={...s,body:u,target:ao(s.target,{typeMap:i.getState().iiif.mapping})};return r?r(c):c},[s,r,u,...n])}import{jsx as lo}from"react/jsx-runtime";var Ae=({id:e,style:n,className:t,interactive:r})=>{let o=xe({id:e}),i=te(o,"atlas"),a=te(o,"html"),s=Se(o,["atlas"]),u=P(),c=co(()=>so(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)?lo(uo,{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 fo}from"react";import{useMemo as mo}from"react";function en(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 mo(()=>{if(a)return r?r(a):a},[a,...n])}import{jsx as tn}from"react/jsx-runtime";var le=({className:e,page:n})=>{let t=en({id:n.id})||n,r=te(t,"atlas"),o=te(t,"html");return y(i=>t.id?i.iiif.entities.AnnotationPage[t.id]:null,[]),tn(fo,{children:t.items?.map(i=>tn(Ae,{id:i.id,style:r,className:o?.className||e},i.id))})};import{createStylesHelper as ei}from"@iiif/helpers/styles";import{Fragment as ln,useMemo as xo}from"react";import{HTMLPortal as vo,TileSet as un}from"@atlas-viewer/atlas";import Ce,{useMemo as Ye}from"react";import{jsx as F}from"react/jsx-runtime";var rn=Ce.createContext("en"),on=Ce.createContext({});function Cc(e){return F(on.Provider,{value:e.translations,children:e.children})}function Pc(e){return F(rn.Provider,{value:e.language,children:e.children})}function Qe(){return Ce.useContext(rn)}function an(){return Ce.useContext(on)}function nn(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function po({as:e,language:n,children:t,viewingDirection:r,...o}){let i=Qe();return Ye(()=>nn(i)===nn(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 sn(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 go=(e,n=[])=>{let t=Qe();return Ye(()=>{let r=e();return sn(t,r,[])},[t,...n])};function Y(e,n){return n?e[n]||n:""}function ho(e,n,t=`
2
- `,r={}){let o=go(()=>Object.keys(e||{}),[e]);return[Ye(()=>{if(!e)return Y(r,n)||"";if(typeof e=="string")return Y(r,e);let i=o?e[o]:void 0;return i?typeof i=="string"?i:i.map(a=>Y(r,a)).join(t):""},[o,n,e]),o]}function Rc(){let e=Qe(),n=an();return function(r,o="",i=`
3
- `,a=n){let s=Object.keys(r||{}),u=sn(e,s,[]);if(!r)return Y(a,o)||"";if(typeof r=="string")return Y(a,r);let c=u?r[u]:void 0;return c?typeof c=="string"?Y(a,c):c.map(l=>Y(a,l)).join(typeof i<"u"?i:`
4
- `):""}}function de({as:e,defaultText:n,enableDangerouslySetInnerHTML:t,children:r,separator:o,...i}){let a=an(),[s,u]=ho(r,n,o,a);return u?F(po,{...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 So}from"react/jsx-runtime";function yo({resource:e,heading:n,note:t,extra:r}){return r?H(vo,{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:So("div",{children:[H(de,{children:n||"Not authorised"}),t&&H("p",{children:H(de,{children:t})}),H("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function cn({image:e,thumbnail:n,crop:t,enableSizes:r}){if(!Vt()){let i=e.service,a=i.width||e.width||0,s=i.height||e.height||0;return H(un,{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(Tt,{resource:e.service,errorComponent:yo,extra:e,children:i=>{let a=i.width||e.width||0,s=i.height||e.height||0;return H(un,{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 We,jsxs as dn}from"react/jsx-runtime";function Pe({id:e,image:n,thumbnail:t,isStatic:r,x:o=0,y:i=0,children:a,selector:s,onClick:u,enableSizes:c}){let l=xo(()=>{if(!(!s||s.spatial.x===0&&s.spatial.y===0))return s.spatial},[s]);return We("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?dn(ln,{children:[We(cn,{image:n,thumbnail:t,crop:l,enableSizes:c}),a]},"service"):dn(ln,{children:[We("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 ti,useEffect as kn,useLayoutEffect as ni,useMemo as Ln}from"react";import{HTMLPortal as ri}from"@atlas-viewer/atlas";import{useEffect as An,useMemo as Cn}from"react";import{useCallback as pn,useMemo as Co}from"react";function Ao(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function mn(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=Ao(t,i);a&&a.views&&a.views[e]&&r.push(i)}return r},[e,n])}function fn({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 Po(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function gn(e,n={}){let t=v(),r=w(),o=P(),i=ge(),a=Co(()=>fn({all:n.all,manifest:r,canvas:o,canvases:i}),[n.all,o,i,r]),s=mn(e,n.all?void 0:a),u=pn(l=>{e&&t.setMetaValue([l,"annotationPageManager","views"],d=>d&&!d[e]?d:{...d||{},[e]:!1})},[e,t]),c=pn((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=Po(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 hn(e,n){return y((t,r)=>r.get(e.map(o=>({id:o,type:n}))),[e,n])}import{useCallback as Mo,useEffect as Vo,useRef as To,useState as No}from"react";import Ro,{useContext as bo}from"react";import{ImageServiceLoader as Io}from"@atlas-viewer/iiif-image-api";var wo=Ro.createContext(new Io);function Re(){return bo(wo)}function vn(){let e=Re(),[n,t]=No({}),r=To(!1);return Vo(()=>()=>{r.current=!0},[]),[Mo((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 Eo,useMemo as Sn,useState as ko}from"react";function yn(e={}){let n=xe(),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 Lo}from"@iiif/helpers/painting-annotations";function xn(e,n=[]){let t=v(),r=Sn(()=>Lo(t),[]),o=yn({enableSingleAnnotation:e?.enableSingleAnnotation}),[i,a]=ko(e?.defaultChoices||[]),s=Sn(()=>r.getPaintables(o,i),[t,o,i,...n]),c={makeChoice:Eo((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 Pn(e){let n=w(),t=P(),r=v(),o=Ot(),i=e?.emitter||o,[a,s]=vn(),{enabledPageIds:u}=gn(e?.annotationPageManagerId||n?.id||t?.id,{all:!1}),c=hn(u,"AnnotationPage"),l=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[d,g]=xn(e,[s]);An(()=>{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=Cn(()=>st({canvas:t,paintables:d,supports:l,loadImageService:a}),[t,d,r,g.makeChoice]);return An(()=>{let f=d.allChoices,m={canvasId:t?.id,manifestId:n?.id};f&&i.emit("choice-change",{choice:f,partOf:m})},[t?.id,d.allChoices]),Cn(()=>h.type==="unknown"?[h,at]:[{...h,annotations:{pages:c}},g],[h,c])}import{useEffect as Oo,useMemo as Fo,useRef as Ho,useState as Uo}from"react";import{useEffect as zo}from"react";var Rn=(e,n=[])=>{let t=v();zo(()=>{e(t)},[t,...n])};import{createThumbnailHelper as Do}from"@iiif/helpers/thumbnail";function bn(e,n,{canvasId:t,manifestId:r}={}){let o=v(),i=Re(),a=Fo(()=>Do(o,{imageServiceLoader:i}),[o,i]),[s,u]=Uo(),c=w(r?{id:r}:void 0),l=P(t?{id:t}:void 0),d=l||c,g=Ho(!1);if(Oo(()=>(g.current=!1,()=>{g.current=!0}),[]),!d)throw new Error("Must be called under a manifest or canvas context.");return Rn(h=>{a.getBestThumbnailAtSize(d,e,n).then(f=>{f.best&&!g.current&&u(f.best)})},[d]),s}import{useCallback as z,useEffect as In,useReducer as qo,useRef as be}from"react";function Bo(e){return{isMuted:!1,playRequested:!1,isPlaying:!1,isFinished:!1,volume:100,duration:e}}function _o(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 $o(e){let n=Math.round(e);return`${Math.floor(n/60)}:${`${n%60}`.padStart(2,"0")}`}function ne(e){let[n,t]=qo(_o,Bo(e.duration)),r=be(null),o=be(null),i=be(null),a=be(!1),s=z(()=>{o.current&&r.current&&(o.current.innerHTML=$o(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 In(()=>{let S=setInterval(()=>{s()},350);return()=>clearInterval(S)},[s,e.duration]),In(()=>{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 Ze,useContext as Ke}from"react";import{jsx as Ge}from"react/jsx-runtime";var wn=Ze(null),Mn=Ze(null),Vn=Ze(null);function ql(){let e=Ke(wn);if(!e)throw new Error("Ctx not found");return e}function Bl(){let e=Ke(Mn);if(!e)throw new Error("Ctx not found");return e}function _l(){let e=Ke(Vn);if(!e)throw new Error("Ctx not found");return e}function Ie({actions:e,state:n,children:t,currentTime:r,progress:o,element:i}){return Ge(Vn.Provider,{value:{currentTime:r,progress:o,element:i},children:Ge(Mn.Provider,{value:e,children:Ge(wn.Provider,{value:n,children:t})})})}import{jsx as jo,jsxs as Yo}from"react/jsx-runtime";function Je({media:e,children:n}){let[{element:t,currentTime:r,progress:o},i,a]=ne({duration:e.duration});return Yo(Ie,{state:i,actions:a,currentTime:r,progress:o,element:t,children:[jo("audio",{ref:t,src:e.url}),n]})}function we({media:e,mediaControlsDeps:n,children:t}){return L("portal","audio",Je,{media:e,children:t},[e,...n||[]]),null}import{jsx as Tn,jsxs as Qo}from"react/jsx-runtime";function Xe({element:e,media:n,playPause:t}){return Qo("div",{className:"video-container",part:"video-container",onClick:t,children:[Tn("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
- `}),Tn("video",{ref:e,src:n.url,style:{width:"100%",objectFit:"contain"}})]})}function Me({media:e,mediaControlsDeps:n,children:t,videoComponent:r=Xe}){let[{element:o,currentTime:i,progress:a},s,u]=ne({duration:e.duration});return L("overlay","video-element",r,{element:o,media:e,playPause:u.playPause}),L("portal","custom-controls",Ie,{state:s,actions:u,currentTime:i,progress:a,element:o,children:t},[i,s,e,...n||[]]),null}import{Fragment as Wo,jsx as et,jsxs as Go}from"react/jsx-runtime";function tt({model:e}){return Go(Wo,{children:[et("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
- `}),et("div",{className:"model-container",children:et("model-viewer",{"interaction-prompt":"none",style:{width:"100%",height:"100%"},"camera-controls":"","ar-status":"not-presenting",src:e.id})})]})}function Ve({model:e,name:n}){return L("overlay",`model-${n}`,tt,{model:e},[e]),null}import{jsx as Zo}from"react/jsx-runtime";function Te({style:e}){let n=P();return!n||!n.height||!n.width?null:Zo("box",{interactive:!1,target:{x:0,y:0,width:Number(n.width),height:Number(n.height)},style:e})}import{useRef as Ko}from"react";import{jsx as Nn,jsxs as Xo}from"react/jsx-runtime";function Jo({element:e,media:n,playPause:t}){let r=Ko(null);return n.youTubeId?Xo("div",{className:"video-container",part:"video-container",onClick:t,children:[Nn("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
- `}),Nn("iframe",{className:"video-yt",ref:r,src:`https://www.youtube.com/embed/${n.youTubeId}?enablejsapi=1&origin=${window.location.host}`,referrerPolicy:"no-referrer",sandbox:"allow-scripts allow-same-origin allow-presentation"})]}):null}function En({media:e,mediaControlsDeps:n,children:t}){let[{element:r,currentTime:o,progress:i},a,s]=ne({duration:e.duration});return L("overlay","video-element",Jo,{element:r,media:e,playPause:s.playPause}),null}import{Fragment as Ne,jsx as T,jsxs as _}from"react/jsx-runtime";function nt({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 I=P(),Ee=Se(I,["deep-zoom"]),[me]=$t(),C=Qt(),R=v(),N=Ln(()=>ei(R),[R]),[p,O]=Pn({strategies:l||["images"],defaultChoices:o?.map(({id:A})=>A)}),rt=p.type==="images"?p.choice:void 0,On=Ln(()=>f?1:Math.max(1,...p.type==="images"?p.images.map(A=>(A.width||0)/A.target?.spatial.width):[]),[f,p]);Gt(On),kn(()=>{r&&r(O)},[p.annotations]),kn(()=>{if(o)for(let A of o)typeof A.opacity<"u"&&N.applyStyles({id:A.id},"atlas",{opacity:A.opacity})},[o]),ni(()=>{t&&t(rt)},[rt]),L(C&&(p.type==="images"||p.type==="empty"||p.type==="textual-content"&&a)?"overlay":"none",`canvas-portal-controls-${I?.id}`,ce.Provider,a?{value:C||null,children:a(p)}:{},[I,C,p,...u||[]]);let q=bn({maxWidth:256,maxHeight:256});if(!I)return null;let ot=I.accompanyingCanvas,re=q&&q.type==="fixed"?T("world-object",{height:I.height,width:I.width,x:e,y:n,children:T("world-image",{uri:q.id,target:{x:0,y:0,width:I.width,height:I.height},display:q.width&&q.height?{width:q.width,height:q.height}:void 0,crop:void 0})}):null;if(p.type==="unknown"){if(re)return re;if(d)throw new Error(p.reason||"Unknown image strategy");return null}let it=_(ti,{children:[me?T(le,{page:me}):null,p.annotations&&p.annotations.pages?p.annotations.pages.map(A=>T(le,{page:A},A.id)):null,D]}),Fn=p.type==="images"?p.images.length:0;return _(Ne,{children:[_("world-object",{height:I.height,width:I.width,x:e,y:n,...Ee,children:[p.type==="empty"||h?T(Te,{style:g}):null,p.type==="textual-content"?p.items.map((A,fe)=>_(Ne,{children:[T(ri,{onClick:S?oe=>{oe.stopPropagation(),S(A.annotationId,A,oe)}:void 0,target:A.target?.spatial||void 0,children:T("div",{"data-textual-content":!0,children:T(de,{enableDangerouslySetInnerHTML:!0,children:A.text})})},fe),it]})):null,p.type==="images"?_(Ne,{children:[p.images.map((A,fe)=>T(Pe,{isStatic:i,image:A,id:A.id,thumbnail:fe===0?q:void 0,selector:A.selector,enableSizes:m,onClick:S?oe=>{oe.stopPropagation(),S(A.annotationId,A,oe)}:void 0},A.id+fe)),it]}):null,p.type==="3d-model"?T(Ve,{model:p.model}):null,p.type==="media"?T(Ne,{children:p.media.type==="Sound"?_(we,{media:p.media,mediaControlsDeps:c,children:[re,s?s(p):null]}):p.media.type==="Video"?_(Me,{media:p.media,mediaControlsDeps:c,children:[re,s?s(p):null]}):p.media.type==="VideoYouTube"&&x?_(En,{media:p.media,mediaControlsDeps:c,children:[re,s?s(p):null]}):null}):null]},`${I.id}/${p.type}/${Fn}`),p.type==="media"&&p.media.type==="Sound"&&ot?T(G,{canvas:ot.id,children:T(nt,{renderViewerControls:a})}):null]})}import{Fragment as ai,jsx as U,jsxs as si}from"react/jsx-runtime";var ii=zn(function(n,t){let r=w(),o=ge(),i=zt(),{ViewerControls:a,MediaControls:s}=n.components||{};if(oi(t,()=>i,[i]),!r)return U("div",{});let u=0;return si(ai,{children:[n.header,U(M.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(G,{canvas:c.id,children:U(M.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]})}),M=zn(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=W();return U(Q,{vault:f,children:U(Lt,{...g,children:U(ii,{ref:h,height:t,components:s,spacing:i,canvasProps:o,annotations:r,header:a,mode:u,reuseAtlas:c,renderPreset:l,runtimeOptions:d,children:n})})})});M.RenderImage=Pe;M.RenderCanvas=nt;M.RenderAnnotationPage=le;M.RenderAnnotation=Ae;M.Viewer=Jt;M.CanvasBackground=Te;M.Audio=we;M.Video=Me;M.Model=Ve;M.AudioHTML=Je;M.VideoHTML=Xe;M.ModelHTML=tt;export{pe as a,E as b,B as c,$ as d,Q as e,W as f,lt as g,dt as h,mt as i,G as j,v as k,y as l,Z as m,ge as n,w as o,ft as p,ir as q,Le as r,ra as s,pt as t,aa as u,ze as v,gt as w,ht as x,Sa as y,St as z,xt as A,At as B,Oe as C,vt as D,K as E,fr as F,pr as G,Mt as H,Vt as I,ae as J,gr as K,Fa as L,hr as M,It as N,Ha as O,Tt as P,Et as Q,ue as R,wr as S,Lt as T,zt as U,Er as V,X as W,Ot as X,Vs as Y,Ft as Z,Ht as _,Ut as $,Bt as aa,$t as ba,jt as ca,ce as da,Qt as ea,P as fa,Se as ga,te as ha,xe as ia,en as ja,Cc as ka,Pc as la,Qe as ma,an as na,po as oa,go as pa,ho as qa,Rc as ra,de as sa,fn as ta,gn as ua,hn as va,wo as wa,Re as xa,vn as ya,yn as za,xn as Aa,Pn as Ba,Rn as Ca,bn as Da,$o as Ea,ne as Fa,ql as Ga,Bl as Ha,_l as Ia,Ie as Ja,M as Ka};