react-iiif-vault 1.2.2 → 1.2.3

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 Ro,A as to,Aa as sn,B as oo,Ba as ln,C as no,Ca as le,D as ro,Da as cn,E as io,Ea as mn,F as ao,Fa as un,G as so,Ga as dn,H as lo,Ha as fn,I as co,Ia as gn,J as mo,Ja as ce,K as uo,L as fo,M as go,N as po,O as ho,P as yo,Q as vo,R as xo,S as bo,T as So,U as ie,V as Co,W as Io,X as ko,Y as Po,Z as To,_ as wo,a as Wt,aa as Eo,b as A,ba as T,c as B,ca as Mo,d as Dt,da as No,e as Ft,ea as Bo,f as Ot,fa as Lo,g as te,ga as Ho,h as $t,ha as Ao,i as Vt,ia as zo,j as oe,ja as qo,k as P,ka as Wo,l as z,la as Do,m as Xt,ma as Fo,n as ne,na as Oo,o as q,oa as N,p as Yt,pa as Qo,q as _t,qa as ae,r as Kt,ra as Uo,s as Qt,sa as Go,t as Ut,ta as W,u as Gt,ua as Jo,v as Jt,va as D,w as re,wa as Zo,x as Zt,xa as rn,y as jt,ya as se,z as eo,za as an}from"./chunk-RTYFQWUA.js";import{a as $o,b as Vo,c as Xo,d as Yo,e as _o,f as Ko,g as jo,h as en,i as tn,j as on,k as nn}from"./chunk-DXFXJCXN.js";import{useCanvas as We}from"@atlas-viewer/atlas";import{forwardRef as De,useImperativeHandle as Fe}from"react";import{Fragment as Oe,jsx as me}from"react/jsx-runtime";var bn=De(function({canvasId:t},o){let n=We(),i=ae(t||n?.id),a=P();return Fe(o,()=>i,[t,n]),!n||i.enabledPageIds.length===0?null:me(Oe,{children:i.enabledPageIds.map(s=>me(ce.RenderAnnotationPage,{page:a.get(s)},s))})});import{useMemo as Xe}from"react";import{useMemo as $e}from"react";import{Fragment as Ve,jsx as C,jsxs as F}from"react/jsx-runtime";function O({metadata:e=[],config:t,labelWidth:o=16,showEmptyMessage:n=!0,allowHtml:i,emptyFallback:a,classes:s={},emptyMessage:l="No metadata available",emptyValueFallback:u="No value",emptyLabelFallback:m="",separator:c,tableFooter:f,tableHeader:x}){let y=$e(()=>{let p=(t||[]).reduce((g,b)=>[...g,...b.keys],[]),d={};for(let g of e){let b=g&&g.label?Object.values(g.label):[];for(let r of b)if(r&&r.length&&(p.indexOf(`metadata.${r[0]}`)!==-1||p.length===0)&&g){let S=`metadata.${r[0]}`;d[S]=d[S]?d[S]:[],d[S].push(g);break}}return d},[t,e]);return Object.keys(y).length===0&&n?C(Ve,{children:a})||C("div",{className:s.empty,children:l}):t&&t.length?F("table",{className:s.container,children:[x,C("tbody",{children:t.map((p,d)=>{let g=[];for(let b of p.keys)for(let r of y[b]||[])g.push(C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:r.value},d+"__"+b));return g.length===0?null:F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,separator:c,defaultText:m,children:p.label})}),C("td",{className:s.value,children:g})]},d)})}),f]}):F("table",{className:s.container,children:[x,C("tbody",{children:e&&e.length?e.map((p,d)=>p?F("tr",{className:s.row,children:[C("td",{className:s.label,style:o?{minWidth:o}:{},children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.label})}),C("td",{className:s.value,children:C(N,{enableDangerouslySetInnerHTML:i,defaultText:u,separator:c,children:p.value})})]},d):null):null}),f]})}import{jsx as Ye}from"react/jsx-runtime";function Ln(e){let t=q(),o=T(),n=re(),i=Xe(()=>{let a=t?.metadata||[],s=o?.metadata||[],l=n?.metadata||[];return[...a,...s,...l]},[t,o,n]);return Ye(O,{metadata:i,...e})}import{useEffect as Ue,useState as Ge}from"react";import{createImageServiceRequest as _e,imageServiceRequestToString as Ke}from"@atlas-viewer/iiif-image-api";import{useMemo as Qe}from"react";function Q(e,t={},o=[]){return Qe(()=>{if(!e)return null;let n=t.quality;e&&e.extraQualities&&t.quality&&(e.extraQualities.includes(t.quality)||(n="default"));let i=_e(e);return Ke({identifier:i.identifier,server:i.server,scheme:i.scheme,type:"image",size:{max:!t.size?.width&&!t.size?.height,confined:!1,upscaled:!1,...t.size||{}},format:t.format||"jpg",region:t.region||{full:!0},rotation:t?.rotation?Number.isInteger(t.rotation)?{angle:t.rotation}:t.rotation:{angle:0},quality:n||"default",prefix:i.prefix,originalPath:i.originalPath})},[...o])}import{jsx as $}from"react/jsx-runtime";function Je(e){let t=typeof e.src=="string"?e.src:e.src.id,o=W(),[n,i]=Ge(!1),a;if(t){let l=o.loadServiceSync({id:t});l&&(a=l)}!a&&!n&&o.loadService({id:t}).then(()=>{i(!0)});let s=Q(a,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[n,e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return Ue(()=>()=>{i(!1)},[t]),s?$("img",{src:s,alt:e.alt,className:e.className,style:e.style}):$(Ze,{...e,fetchImageService:!1})}function Ze(e){if(e.fetchImageService)return $(Je,{...e});let t=typeof e.src=="string"?{id:e.src,profile:"level0"}:e.src,o=Q(t,{size:e.size,selector:e.region,rotation:e.rotation,format:e.format,region:e.region,quality:e.quality},[e.src,e.size,e.region,e.rotation,e.format,e.region,e.quality]);return o?$("img",{src:o,alt:e.alt,className:e.className,style:e.style}):null}import{jsx as je}from"react/jsx-runtime";function Un(e){let t=q();return je(O,{metadata:t?.metadata||[],...e})}import{useLayoutEffect as rt,useRef as it}from"react";import*as U from"react-lazy-load-image-component";import{getValue as et}from"@iiif/helpers/i18n";import{Fragment as ue,jsx as w,jsxs as nt}from"react/jsx-runtime";var{LazyLoadComponent:tt}=U||U.default;function de(e){let{size:t,visible:o,classes:n,canvasId:i,figure:a}=e,s=t?.width||128,l=t?.height||t?.width||128,u=w(ot,{...e}),m=w(tt,{threshold:300,style:{height:l,width:s},visibleByDefault:o,children:i?w(oe,{canvas:i,children:u}):u});return a?w("figure",{className:n?.figure,children:m}):m}function ot({fallback:e,size:t,classes:o,showLabel:n,alt:i,dereference:a=!1}){let s=T(),l=t?.width||128,u=t?.height||t?.width||128,m=i||et(s?.label)||"",c=le({width:l,height:u},a);return!c||c.type!=="fixed"?w(ue,{children:e}):nt(ue,{children:[w("div",{className:o?.imageWrapper,children:w("img",{className:o?.img,src:c.id,alt:m})}),n?w(N,{as:"figcaption",className:o?.label,children:s?.label}):null]})}import{jsx as L}from"react/jsx-runtime";function lr({flat:e,size:t,classes:o={},showLabel:n,figure:i,fallback:a}){let s=it(null),{items:l,sequence:u,currentSequenceIndex:m,setSequenceIndex:c}=ie(),f={row:o.selected?.row||o.row,item:o.selected?.item||o.item,figure:o.selected?.figure||o.figure,img:o.selected?.img||o.img,label:o.selected?.label||o.label,imageWrapper:o.selected?.imageWrapper||o.imageWrapper};rt(()=>{if(!s.current)return;let y=s.current.querySelector("[data-selected=true]");y&&y.scrollIntoView({behavior:"smooth",block:"nearest",inline:"center"})},[m]);let x=[];for(let y of u){let I=[],p=u[m]===y;for(let d of y){let g=l[d];I.push(L("div",{className:p?f.item:o.item,children:L(de,{classes:p?f:o,canvasId:g.id,size:t,showLabel:n,figure:i,placeholder:L("div",{style:{height:128,width:128}}),fallback:a})},d))}if(e){x.push(I);continue}x.push(L("div",{onClick:d=>{c(u.indexOf(y))},"data-selected":p,className:p?f.row:o.row,children:I}))}return L("div",{ref:s,className:o.container,children:x})}import{Fragment as fe,jsx as R,jsxs as ge}from"react/jsx-runtime";var at={draw:!0,polygon:!0,line:!0,lineBox:!0,square:!0,triangle:!0,hexagon:!0,circle:!0,delete:!0};function ur({helper:e,showShapes:t,state:o,enabled:n=at,classNames:i={},icons:a={}}){return ge(fe,{children:[t?ge(fe,{children:[n.draw&&R("button",{className:i.button,onClick:()=>{e.stamps.clear(),e.draw.enable()},"data-active":!o.lineMode&&!o.selectedStamp&&t&&o.drawMode,children:a.DrawIcon||"Draw"}),n.polygon&&R("button",{className:i.button,"data-active":!o.lineMode&&!o.selectedStamp&&t&&!o.drawMode,onClick:()=>{e.stamps.clear(),e.draw.disable(),e.modes.disableLineBoxMode(),e.modes.disableLineMode()},children:a.PolygonIcon||"Polygon"}),n.line&&R("button",{className:i.button,"data-active":o.lineMode&&!o.lineBoxMode,onClick:()=>{e.modes.enableLineMode()},children:a.LineIcon||"Line"}),n.lineBox&&R("button",{className:i.button,"data-active":o.lineBoxMode,onClick:()=>{e.modes.enableLineBoxMode()},children:a.LineBoxIcon||"LineBox"}),n.square&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="square",onClick:()=>{e.stamps.square()},children:a.SquareIcon||"Square"}),n.triangle&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="triangle",onClick:()=>{e.stamps.triangle()},children:a.TriangleIcon||"Triangle"}),n.hexagon&&R("button",{className:i.button,"data-active":o.selectedStamp?.id==="hexagon",onClick:()=>{e.stamps.hexagon()},children:a.HexagonIcon||"Hexagon"})]}):null,o.showBoundingBox&&n.delete&&R("button",{className:i.button,onClick:()=>e.key.down("Backspace"),children:a.DeleteForeverIcon||"Delete"})]})}import{createContext as st,useCallback as pe,useContext as ye,useEffect as he,useMemo as G,useState as lt}from"react";import ve from"mitt";import{jsx as ct}from"react/jsx-runtime";var V=st(ve());V.displayName="SelectorHelper";function xr({children:e}){return ct(V.Provider,{value:G(()=>ve(),[]),children:e})}function br(){return ye(V)}function xe(e){let t=be(),[o,n]=lt(!1);he(()=>t.withSelector(e).on("highlight",()=>{n(!0)}),[t,e]),he(()=>t.withSelector(e).on("clear-highlight",()=>{n(!1)}),[t,e]);let i=pe(s=>{t.emit("click",{selectorId:e,event:s})},[e,t]),a=pe(s=>{t.emit("hover",{selectorId:e,event:s})},[e,t]);return{controller:t,onClick:i,onHover:a,isHighlighted:o}}function be(){let e=ye(V);return G(()=>({withSelector(t){return{on(o,n){let i=a=>{a&&a.selectorId===t&&n(a)};return e.on(o,i),()=>{e.off(o,i)}},emit(o,n){e.emit(o,{...n,selectorId:t})}}},on(t,o){return e.on(t,o),()=>{e.off(t,o)}},emit(t,o){e.emit(t,o)}}),[e])}function Sr(){let e=be();return G(()=>({withSelector(t){return{highlight(){e.emit("highlight",{selectorId:t})},clearHighlight(){e.emit("clear-highlight",{selectorId:t})},zoomTo(){e.emit("zoom-to",{selectorId:t})},addEventListener(o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(o,n){return e.withSelector(t).on(o,n)}}},highlight(t){e.emit("highlight",{selectorId:t})},clearHighlight(t){e.emit("clear-highlight",{selectorId:t})},zoomTo(t){e.emit("zoom-to",{selectorId:t})},addEventListener(t,o,n){return e.emit("event-listener",{selectorId:t,name:o,callback:n}),()=>{e.emit("remove-event-listener",{selectorId:t,name:o,callback:n})}},getImagePreview(t){return new Promise((o,n)=>{e.emit("image-preview-request",{selectorId:t,resolve:o,reject:n})})},on(t,o){return e.on(t,o)}}),[e])}import{createContext as mt,useContext as ut,useMemo as dt}from"react";import{jsx as ft}from"react/jsx-runtime";function Se(){return{default:{backgroundColor:"rgba(0,0,0,0)",borderWidth:"2px",borderColor:"rgba(252,0,98, .5)"},highlighted:{backgroundColor:"rgba(75, 103, 225, 0.4)",borderWidth:"1px",borderColor:"rgba(75,103,225,0.99)"},hidden:{borderWidth:"0px",borderColor:"rgba(0,0,0,0)",backgroundColor:"rgba(0,0,0,0)",hidden:!0}}}var J=mt(Se());J.displayName="AnnotationStyle";function Ce(){return ut(J)}function Pr({theme:e,children:t}){let o=dt(()=>e||Se(),[e]);return ft(J.Provider,{value:o,children:t})}import{HTMLPortal as xt,useAtlas as bt}from"@atlas-viewer/atlas";import{useEffect as ke,useRef as E,useState as Pe}from"react";import{useEffect as gt,useMemo as pt,useState as ht}from"react";import{createHelper as yt}from"polygon-editor";function Ie(e,t,o){let[n,i]=ht({}),a=pt(()=>yt(e,o),[]);return gt(()=>(a.clock.start(t,i),()=>{a.clock.stop()}),[]),{state:n,helper:a}}import{createSvgHelpers as vt}from"polygon-editor";import{Fragment as Te,jsx as v,jsxs as we}from"react/jsx-runtime";var M=vt();function Re(e,t){let{image:o,currentShape:n,onChange:i,hideShapeLines:a}=e,s=E(),l=E(),u=E(),m=E(),c=E(),f=E(),x=E(),y=E(),[I,p]=Pe(null),[d,g]=Pe(!1),{helper:b,state:r}=Ie(n,(h,k)=>{M.updateTransitionBoundingBox(l.current,h,k),M.updateBoundingBoxPolygon(s.current,h,k),M.updateTransitionShape(f.current,h,k),M.updateClosestLinePointTransform(m.current,h,k),M.updateSelectBox(u.current,h,k),M.updatePointLine(x.current,h,k),M.updateDrawPreview(c.current,h,k,3),M.updateLineBox(y.current,h),p(h.transitionDirection),g(h.transitionRotate)},i);ke(()=>{b.setShape(n||null)},t),ke(()=>{let h=()=>{b.modifiers.reset()};return document.addEventListener("mouseleave",h),()=>{document.removeEventListener("mouseleave",h)}},[]);let S=we(Te,{children:[v("marker",{id:"dot",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",className:"marker"})}),v("marker",{id:"selected",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("circle",{cx:"5",cy:"5",r:"4",fill:"#FAFF00"})}),v("marker",{id:"resizer",viewBox:"0 0 10 10",refX:"5",refY:"5",markerWidth:"5",markerHeight:"5",children:v("rect",{width:"10",height:"10",stroke:"#FF0DCB",fill:"#fff",strokeWidth:2})})]}),_=n?n.open?"polyline":"polygon":null,ee=!r.showBoundingBox&&r.closestPoint!==null&&r.actionIntentType==="select-point",Ae=r.actionIntentType==="add-open-point",ze=r.transitionIntentType==="split-line",K=r.transitioning&&r.selectedStamp&&r.transitionIntentType==="stamp-shape",qe=n&&_?we(Te,{children:[v(_,{fill:!r.transitioning&&r.showBoundingBox?"rgba(255, 0, 0, .5)":"none",strokeWidth:K?0:2,stroke:a?"transparent":"#000",points:n.points.map(h=>h.join(",")).join(" "),vectorEffect:"non-scaling-stroke",markerStart:r.showBoundingBox?void 0:"url(#dot)",markerMid:r.showBoundingBox?void 0:"url(#dot)",markerEnd:r.showBoundingBox?void 0:"url(#dot)",style:{pointerEvents:"none"}}),r.lineBoxMode&&r.actionIntentType==="close-line-box"?v("polygon",{fill:"rgba(255, 0, 0, .4)",ref:y,stroke:"#000",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,r.transitionIntentType==="draw-shape"&&r.transitioning?v("polyline",{ref:c,fill:"none",stroke:"rgba(255, 0, 0, .5)",strokeWidth:2,vectorEffect:"non-scaling-stroke"}):null,!r.showBoundingBox&&r.selectedPoints&&r.selectedPoints.length?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:n.points.filter((h,k)=>r.selectedPoints?.includes(k)).map(h=>h.join(",")).join(" ")}):null,ee&&r.closestPoint!==null&&n.points[r.closestPoint]?v("polyline",{strokeWidth:2,vectorEffect:"non-scaling-stroke",stroke:"transparent",markerStart:"url(#selected)",markerMid:"url(#selected)",markerEnd:"url(#selected)",fill:"transparent",points:`${n.points[r.closestPoint][0]},${n.points[r.closestPoint][1]}`}):null,!r.transitioning&&(r.actionIntentType==="add-open-point"||r.actionIntentType==="close-shape"||r.actionIntentType==="close-shape-line")?v("polyline",{stroke:"#000",ref:x,strokeWidth:r.actionIntentType==="close-shape"?2:1,vectorEffect:"non-scaling-stroke"}):null,r.hasClosestLine&&(!r.transitionIntentType||r.transitionIntentType==="split-line")?v("g",{ref:m,children:v("polyline",{style:{opacity:.5},markerStart:"url(#dot)",points:"0,0 10,10",vectorEffect:"non-scaling-stroke",fill:"transparent",strokeWidth:2})}):null,r.transitioning?v(_,{ref:f,fill:n.open?"none":"rgba(255, 0, 0, .5)",stroke:"rgba(255, 0, 0, .5)",strokeWidth:n.open?2:0}):null,r.transitioning&&r.transitionIntentType==="select-multiple-points"?v("rect",{ref:u,fill:"rgba(255, 255, 255, .3)",strokeWidth:1,stroke:"rgba(0,0,0,.2)",vectorEffect:"non-scaling-stroke"}):null,r.showBoundingBox?null:v("g",{name:"controls",children:!1}),r.showBoundingBox&&!K?v("polygon",{ref:s,strokeWidth:2,stroke:"#FF0DCB",fill:"none",markerStart:"url(#resizer)",markerMid:"url(#resizer)",markerEnd:"url(#resizer)",vectorEffect:"non-scaling-stroke"}):null]}):null;return{helper:b,state:r,isAddingPoint:Ae,isSplitting:ze,isStamping:K,isHoveringPoint:ee,transitionDirection:I,transitionRotate:d,defs:S,editor:qe}}import{useEffect as Z}from"react";import{createPortal as St}from"react-dom";import{Fragment as Ee,jsx as H,jsxs as X}from"react/jsx-runtime";var Ct=[{name:"Default",outer:{borderWidth:4,borderColor:"rgba(255, 255, 255, .4)"},inner:{borderWidth:2,borderColor:"#000"}},{name:"High contrast",outer:{borderWidth:3,borderColor:"#fff"},inner:{borderWidth:1,borderColor:"#000"}},{name:"Lightsaber",outer:{borderWidth:"4",borderColor:"rgba(56,68,255,0.64)"},inner:{borderWidth:"2",borderColor:"#fff"}},{name:"Bright",outer:{borderWidth:"6",borderColor:"#25d527"},inner:{borderWidth:"3",borderColor:"#a916ff"}},{name:"pink",outer:{borderWidth:"4",borderColor:"#ff00ff"},inner:{borderWidth:"2",borderColor:"#ffffff"}},{name:"fine (dark)",outer:{borderWidth:"1",borderColor:"#000000"},inner:{}},{name:"fine (light)",outer:{borderWidth:"1",borderColor:"#FFF"},inner:{}}];function Me(e){let t=e.theme||Ct[0],o=bt(),{image:n}=e,{helper:i,defs:a,editor:s,state:l,transitionDirection:u,isSplitting:m,transitionRotate:c,isHoveringPoint:f,isAddingPoint:x,isStamping:y}=Re({currentShape:e.shape||null,onChange:e.updateShape,image:e.image,hideShapeLines:!0},[]),I=r=>{i.pointer([[~~r.atlas.x,~~r.atlas.y]])};Z(()=>{let r=S=>{i.key.up(S.key)};return document.addEventListener("keyup",r),()=>{document.removeEventListener("keyup",r)}},[]),Z(()=>{let r=S=>{i.key.down(S.key)};return document.addEventListener("keydown",r),()=>{document.removeEventListener("keydown",r)}},[]),Z(()=>{let r=[];return u&&r.push(`atlas-cursor-${u}`),l.actionIntentType==="cut-line"&&l.modifiers?.Shift&&r.push("atlas-cursor-cut"),(f||l.transitionIntentType==="move-shape"||l.transitionIntentType==="move-point")&&r.push("atlas-cursor-move"),x&&r.push("atlas-cursor-crosshair"),m&&r.push("atlas-cursor-copy"),c&&r.push("atlas-cursor-rotate"),l.transitionIntentType==="draw-shape"&&r.push("atlas-cursor-draw"),o?.canvas&&o.canvas.classList.add(...r),()=>{o?.canvas&&o.canvas.classList.remove(...r)}},[o?.canvas,x,f,m,l.modifiers?.Shift,l.actionIntentType,l.transitionIntentType,u,c]);let p=e.shape&&e.shape?.points.length===0,d=e.renderControls?e.renderControls(i,l,p):null,g=document.getElementById(e.controlsHtmlId||"atlas-controls"),b="shape";return H(Ee,{children:X("world-object",{height:n.height,width:n.width,onMouseMove:I,onMouseDown:i.pointerDown,onMouseUp:i.pointerUp,onMouseLeave:i.blur,children:[e.shape?X(Ee,{children:[H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.outer}),H(b,{open:e.shape.open,points:e.shape.points,relativeStyle:!0,style:y?{}:t.inner})]}):null,X(xt,{relative:!0,interactive:!1,children:[H("div",{style:{position:"absolute",top:0,right:0,left:0,bottom:0},children:X("svg",{width:"100%",height:"100%",viewBox:`0 0 ${n.width} ${n.height}`,tabIndex:-1,children:[H("defs",{children:a}),s]})}),g?St(d,g,"controls"):null]})]})})}import{jsx as Ne}from"react/jsx-runtime";function ei(e){let t=T(),o=e.annotationBucket,n=e.readOnly,i=e.id,{onClick:a,isHighlighted:s}=xe(e.id),l=Ce(),u=s?l.highlighted:l[o||"hidden"]||l.hidden;if(!t)return null;if(n){let m="shape",c=e.polygon,f=c.open;return c?Ne(m,{id:`shape-${i}`,points:c.points,open:f,onClick:a,relativeStyle:!0,target:{x:0,y:0,width:t.width,height:t.height},style:u}):null}return Ne(Me,{image:t,shape:e.polygon||{id:e.id,open:!0,points:[]},updateShape:e.updatePolygon,theme:e.theme,controlsHtmlId:e.controlsHtmlId,renderControls:e.renderControls})}import{jsx as It}from"react/jsx-runtime";function ri({annotation:e,children:t}){return It(B,{value:{annotation:e},children:t})}import{jsx as kt}from"react/jsx-runtime";function li({annotationPage:e,children:t}){return kt(B,{value:{annotationPage:e},children:t})}import{jsx as Pt}from"react/jsx-runtime";function di({collection:e,children:t}){return Pt(B,{value:{collection:e},children:t})}function hi(e,t={}){return D(t)}import{useCanvas as Tt}from"@atlas-viewer/atlas";import{useEffect as wt,useMemo as j,useState as Rt}from"react";function Ci({canvasId:e}={}){let t=Tt(),o=ne(),n=j(()=>e?[e]:t?[t.id]:o.map(m=>m.id),[e,t,o]),[i,a]=Rt({}),s=se();wt(()=>{let m=c=>{let f=c.partOf.canvasId;f&&a(x=>({...x,[f]:c.choice}))};return s.on("choice-change",m),()=>{s.off("choice-change",m)}},[]);let l=j(()=>{let m=[];for(let c of n){let f=i[c];f&&m.push({canvasId:c,choice:f})}return m},[n,i]),u=j(()=>({makeChoice:(m,c)=>{s.emit("make-choice",{choiceId:m,...c})}}),[s]);return{choices:l,actions:u}}function ki(e,t=!1){}function Ri(e){let o=A().manifest,n=e?e.map(i=>typeof i=="string"?i:i?.id):[];return z(i=>{let a=o?i.iiif.entities.Manifest[o]:void 0,s=a?.items||[];if(typeof e>"u")return s;let l=[];for(let u of a?.items||[])n.indexOf(u.id)!==-1&&l.push(u);return l},[n.join("/")])}import{useMemo as Et}from"react";function Li(e,t=[]){let{id:o,selector:n}=e,i=A(),a=o||i.collection,s=z(l=>a?l.iiif.entities.Collection[a]:void 0,[a]);return Et(()=>{if(s)return n?n(s):s},[s,n,...t])}import{useEffect as Mt,useMemo as Nt}from"react";import{createEventsHelper as Bt}from"@iiif/helpers/events";function Wi(e,t,o,n,i=[]){let a=P(),s=Nt(()=>Bt(a),[a]);Mt(()=>{let l=e;return l?(s.addEventListener(l,t,o,n),()=>{s.removeEventListener(l,t,o)}):()=>{}},[s,e,t,...i])}function $i(e,t){let{id:o,isLoaded:n,error:i,resource:a,requestId:s,cached:l}=te(e,t);return{id:o,isLoaded:n,error:i,manifest:a,requestId:s,cached:l}}import{getImageServices as Be}from"@atlas-viewer/iiif-image-api";import{useEffect as Lt,useMemo as Le,useState as Y}from"react";function He({cacheKey:e}={}){let t=T(),o=D(),n=P(),i=W(),[a,s]=Y(void 0),[l,u]=Y(!1),[m,c]=Y("idle"),[f,x]=Y(void 0),y=t?t.id:"undefined",I=Le(()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];return r&&i.loadServiceSync({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0}}catch(d){console.error(d)}},[y,e,t]),p=m==="success"&&a?a:I;return Lt(()=>{(async()=>{try{if(t&&o.length){let d=o[0],g=n.get(d.body[0]),r=Be(g)[0];if(!r)return;u(!0),c("loading");try{let S=await i.loadService({id:r.id||r["@id"],width:r.width||t.width,height:r.height||t.height})||void 0;s(S),c("success"),u(!1)}catch(S){c("error"),x(S)}}}catch(d){c("error"),x(d)}})()},[y,e]),Le(()=>({data:p,isFetching:l,status:m,error:f}),[p,l,m,f])}function Zi(){let e=He();return{isLoading:e.isFetching,tile:e.data?{id:e.data.id||e.data["@id"],width:e.data.width,height:e.data.height,imageService:e.data,thumbnail:void 0}:null}}import{createStylesHelper as Ht}from"@iiif/helpers/styles";import{useMemo as At}from"react";function na(){let e=P();return At(()=>Ht(e),[e])}export*from"@iiif/helpers/annotation-targets";export{ri as AnnotationContext,li as AnnotationPageContext,Pr as AnnotationStyleProvider,yo as Auth,lo as AuthProvider,io as AuthRContext,ao as AuthReactContext,so as AuthReactContextActions,bn as CanvasAnnotations,oe as CanvasContext,ce as CanvasPanel,di as CollectionContext,Ln as CombinedMetadata,Io as ContextBridge,Me as CreateCustomShape,an as EventsProvider,Ze as Image,Go as ImageServiceLoaderContext,bo as InnerViewerProvider,Ao as LanguageProvider,Wo as LanguageString,N as LocaleString,Vt as ManifestContext,Un as ManifestMetadata,gn as MediaPlayerProvider,O as Metadata,ei as PolygonSelector,Yt as RangeContext,Dt as ReactVaultContext,ur as RenderSvgEditorControls,B as ResourceProvider,Wt as ResourceReactContext,xr as SelectorControllerProvider,lr as SequenceThumbnails,So as SimpleViewerProvider,xo as SimpleViewerReactContext,de as SingleCanvasThumbnail,Ho as TranslationProvider,Ft as VaultProvider,Ro as ViewerPresetContext,wo as VirtualAnnotationProvider,Xt as VisibleCanvasReactContext,oo as authDetailsForResource,eo as createAuthStateStore,to as createProbe,rn as defaultEmitter,Xo as emptyActions,Ko as emptyStrategy,Kt as findAllCanvasesInRange,_t as findFirstCanvasFromRange,Qt as findManifestSelectedRange,Ut as findSelectedRange,Qo as flattenAnnotationPageIds,cn as formatTime,jo as get3dStrategy,Se as getDefaultAnnotationStyles,en as getImageStrategy,Jt as getManifestSequence,Vo as getParsedTargetSelector,nn as getRenderingStrategy,tn as getTextualContentStrategy,on as getVideoStrategy,Gt as getVisibleCanvasesFromCanvasId,jt as hasAuth,ro as makeAccessServiceRequest,no as makeAccessTokenRequest,$o as parseSpecificResource,Ct as svgThemes,Yo as unknownResponse,_o as unsupportedStrategy,Bo as useAnnotation,Lo as useAnnotationPage,ae as useAnnotationPageManager,Ce as useAnnotationStyles,hi as useAnnotationsAtTime,uo as useAuthActions,go as useAuthService,mo as useAuthStore,ho as useAuthToken,po as useAuthTokens,T as useCanvas,Ci as useCanvasChoices,ki as useCanvasClock,Zt as useCanvasSequence,Ri as useCanvasSubset,Do as useClosestLanguage,Li as useCollection,Co as useContextBridge,Oo as useCreateLocaleString,fo as useCurrentAuth,ko as useDispatch,se as useEventEmitter,Wi as useEventListener,Ot as useExistingVault,$i as useExternalCollection,$t as useExternalManifest,te as useExternalResource,zo as useIIIFLanguage,Q as useImage,He as useImageService,W as useImageServiceLoader,Zi as useImageTile,co as useIsAuthEnabled,Jo as useLoadImageService,Fo as useLocaleString,q as useManifest,dn as useMediaActions,fn as useMediaElements,un as useMediaState,Zo as usePaintables,D as usePaintingAnnotations,Ie as usePolygonHelper,re as useRange,sn as useRenderingStrategy,A as useResourceContext,Mo as useResourceEvents,Uo as useResources,vo as useSearchService,be as useSelectorController,br as useSelectorEmitter,xe as useSelectorEvents,Sr as useSelectorHelper,mn as useSimpleMediaPlayer,ie as useSimpleViewer,na as useStyleHelper,No as useStyles,Re as useSvgEditor,le as useThumbnail,qo as useTranslations,P as useVault,ln as useVaultEffect,z as useVaultSelector,Eo as useViewerPreset,Po as useVirtualAnnotationPage,To as useVirtualAnnotationPageContext,ne as useVisibleCanvases};
1
+ 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};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "react-iiif-vault",
3
- "version": "1.2.2",
3
+ "version": "1.2.3",
4
4
  "type": "module",
5
5
  "main": "dist/index.cjs",
6
6
  "module": "dist/index.js",
@@ -60,7 +60,7 @@
60
60
  "dependencies": {
61
61
  "@atlas-viewer/atlas": "^2.2.4",
62
62
  "@atlas-viewer/iiif-image-api": "^2.2.0",
63
- "@iiif/helpers": "^1.2.13",
63
+ "@iiif/helpers": "^1.2.14",
64
64
  "@iiif/parser": "^2.1.2",
65
65
  "@iiif/presentation-2": "^1.0.4",
66
66
  "@iiif/presentation-3": "^2.2.3",
@@ -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 Gt,{useCallback as $e,useMemo as Zt,useState as ve}from"react";import{AtlasAuto as jr,ModeContext as Yr}from"@atlas-viewer/atlas";import{ErrorBoundary as Qr}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},fe=Hn.createContext(qn),E=()=>Un(fe);function B({value:e,children:n}){let t=E(),r=Dn(()=>({...t,...e}),[e,t]);return Bn(fe.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 Y({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 br}from"react";import{createContext as Rr,useMemo as Ir}from"react";import{globalVault as Yn}from"@iiif/helpers/vault";import{useContext as Qn}from"react";function Q(e){let n=Qn($);return e||(n&&n.vault?n.vault:Yn())}import{useEffect as Wn,useMemo as Gn,useState as Ee}from"react";function lt(e,{noCache:n=!1}={}){let t=typeof e=="string"?e:e.id,r=Q(),[o,i]=Ee(t),[a,s]=Ee(void 0),u=Gn(()=>r.get(t,{skipSelfReturn:!0})||void 0,[t,r]),[c,l]=Ee(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 W({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 G=nr.createContext([]);function pe(){let e=tr(G);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 ke(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(...ke(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]=Le(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 Le(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:ke(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 ge,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(()=>Le(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=ge(m=>{let x=c.findIndex(S=>S.includes(m));a(x===-1?0:x)},[u,c]),g=ge(m=>{let x=u.findIndex(S=>S.id===m);x!==-1?d(x):a(0)},[u,c]),h=ge(()=>{a(m=>m>=c.length-1?m:m+1)},[c]),f=ge(()=>{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 Fe,useContext as wt,useEffect as dr,useMemo as mr}from"react";import{useStore as re}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(()=>{ze(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");ze(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(()=>{ze(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 ze(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 bt}from"react";import{useStore as lr}from"zustand";function Rt(e){let n=bt(()=>At(e),[e]),t=It(n.services.access?.id),r=bt(()=>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 he}from"react/jsx-runtime";var Z=Fe(null),fr=Fe(null);fr.displayName="CurrentAuth";var pr=Fe(null);pr.displayName="AuthActions";function Mt({children:e}){let n=mr(()=>St(),[]);return he(Z.Provider,{value:n,children:e})}function Vt(){return!!wt(Z)}function oe(){let e=wt(Z);if(!e)throw new Error("useAuthActions must be used within a AuthProvider");return e}function gr(){let e=oe();return re(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=oe();return re(e,n=>n)}function hr(e){let n=oe();return re(n,r=>r.authItems.find(o=>o.service.id===e))}function It(e){let n=oe();return re(n,r=>r.authItems.find(o=>o.id===e)?.session?.token)}function Ha(e){let n=oe();return re(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 Oe(){return null}function Tt(e){let[n,t,r]=Rt(e.resource),o=e.fallbackComponent||Oe,i=e.loadingComponent||Oe,a=e.errorComponent||Oe,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=he(a,{resource:e.resource,error:t.error||"",heading:t.errorHeading,note:t.errorNote,extra:e.extra})),(t.status==="unknown"||t.status==="probing")&&(u=he(i,{})),t.status==="success"&&(u=e.children(n));for(let l of c)u=he(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 He}from"react/jsx-runtime";var K=Ar(null);K.displayName="Search";function kt(e){let n=Et();return e.store?He(K.Provider,{value:e.store,children:e.children}):He(Pr,{service:n,children:e.children})}function Pr({service:e,children:n}){let t=Cr(()=>Nt(e),[e]);return He(K.Provider,{value:t,children:n})}import{jsx as V}from"react/jsx-runtime";var ie=()=>{},ae=Rr({setCurrentCanvasId:ie,setCurrentCanvasIndex:ie,nextCanvas:ie,previousCanvas:ie,items:[],sequence:[],setSequenceIndex:ie,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(ae.Provider,{value:h,children:V(G.Provider,{value:r,children:V(W,{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=Q(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(Y,{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 br(ae)}import{jsx as se}from"react/jsx-runtime";function Ot(){return{VaultContext:J($),ResourceContext:J(fe),SimpleViewerReactContext:J(ae),VisibleCanvasReactContext:J(G),AuthRContext:J(Z),SearchReactContext:J(K)}}function Ft(e){return se(Y,{vault:e.bridge.VaultContext.vault||void 0,resources:e.bridge.ResourceContext,children:se(G.Provider,{value:e.bridge.VisibleCanvasReactContext,children:se(ae.Provider,{value:e.bridge.SimpleViewerReactContext,children:se(Z.Provider,{value:e.bridge.AuthRContext,children:se(K.Provider,{value:e.bridge.SearchReactContext,children:e.children})})})})})}import{createContext as Er,useContext as kr,useMemo as Lr}from"react";import{useCallback as Ut,useLayoutEffect as Vr,useMemo as Tr,useRef as Nr}from"react";import{entityActions as Ue}from"@iiif/helpers/vault/actions";import{useMemo as Mr}from"react";function Ht(){let n=v().getStore();return Mr(()=>t=>n.dispatch(t),[n])}function Dt(e){return typeof e!="string"&&e&&e.bindToVault}function qt(){let e=v(),n=Nr([]),t=Ht(),r=Tr(()=>`vault://annotation-page/${new Date().getTime()}/${Math.round(Math.random()*1e9).toString(16)}`,[]);Vr(()=>{let s={id:r,type:"AnnotationPage",behavior:[],label:null,thumbnail:[],summary:null,requiredStatement:null,metadata:[],rights:null,provider:[],items:[],seeAlso:[],homepage:[],rendering:[],service:[]};t(Ue.importEntities({entities:{AnnotationPage:{[s.id]:s}}}))},[r]);let o=y(s=>r&&s.iiif.entities.AnnotationPage[r]||null,[r]),i=Ut((s,u)=>{if(r){if(Dt(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(Ue.addReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"},index:u})))}},[r]),a=Ut(s=>{r&&(Dt(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(Ue.removeReference({id:r,type:"AnnotationPage",key:"items",reference:{id:s,type:"Annotation"}})))},[r]);return[o,{addAnnotation:i,removeAnnotation:a}]}import{jsx as zr}from"react/jsx-runtime";var Bt=Er(null);function _t(){let e=kr(Bt);return[e.fullPage,{addAnnotation:e.addAnnotation,removeAnnotation:e.removeAnnotation}]}function $t({children:e}){let[n,{addAnnotation:t,removeAnnotation:r}]=qt();return zr(Bt.Provider,{value:Lr(()=>({fullPage:n,addAnnotation:t,removeAnnotation:r}),[n]),children:e})}import{jsx as De,jsxs as Or}from"react/jsx-runtime";function jt({width:e,style:n,height:t,error:r,resetErrorBoundary:o}){return Or("div",{style:{width:e,height:t,minHeight:500,...n||{},background:"#f9f9f9"},children:[De("h3",{children:"Error occurred"}),De("p",{children:r.message}),De("button",{onClick:o,children:"Reset"})]})}import{createContext as Fr,useContext as Hr}from"react";var ue=Fr(null);function Yt(){return Hr(ue)}import{createContext as Qt,useContext as Ur,useEffect as Dr}from"react";var qe=Qt(()=>{}),Be=Qt(()=>{});function L(e,n,t,r,o=[]){let i=Ur(e==="portal"?Be:qe);Dr(()=>(e!=="none"&&i(n,t,r),()=>{i(n,null)}),[n,e,i,...o])}import{createContext as Br,useContext as _r,useEffect as $r}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=Br(()=>{});function Wt(e){let n=P(),t=_r(_e);$r(()=>n&&n.id?(t(n.id,e),()=>t(n.id,-1)):()=>{},[n,e])}import{Fragment as Wr,jsx as R,jsxs as Gr}from"react/jsx-runtime";function Kt({children:e,errorFallback:n,outerContainerProps:t={},worldScale:r,...o}){let[i,a]=ve(),s=Ot(),u=n||jt,[c,l]=ve({}),d=Object.entries(c),[g,h]=ve({}),f=Object.entries(g),[m,x]=ve({}),S=Zt(()=>r||Math.max(...Object.values(m)),[m]),D=Zt(()=>({maxOverZoom:S||1,...o.runtimeOptions||{}}),[S,o.runtimeOptions]),I=$e((C,b)=>{x(N=>{if(b===-1){let{[C]:p,...O}=N;return O}return{...N,[C]:b}})},[]),Ne=$e((C,b,N)=>{l(({[C]:p,...O})=>b?{...O,[C]:{element:b,props:N}}:O)},[]),de=$e((C,b,N)=>{h(({[C]:p,...O})=>b?{...O,[C]:{element:b,props:N}}:O)},[]);return Gr(Qr,{resetKeys:[],fallbackRender:C=>R(u,{...o,...C}),children:[R(jr,{...o,containerProps:{style:{position:"relative"},...o.containerProps||{}},htmlChildren:R(Wr,{children:d.map(([C,{element:b,props:N}])=>R(Gt.Fragment,{children:R(b,{...N||{}})},C))}),onCreated:C=>{a(C),o.onCreated&&o.onCreated(C)},runtimeOptions:D,children:R(ue.Provider,{value:i,children:R(_e.Provider,{value:I,children:R(qe.Provider,{value:Ne,children:R(Be.Provider,{value:de,children:R(Ft,{bridge:s,children:R(Yr.Provider,{value:o.mode||"explore",children:R($t,{children:e})})})})})})})}),R("div",{children:f.map(([C,{element:b,props:N}])=>R(Gt.Fragment,{children:R(b,{...N||{}})},C))})]})}import{mergeStyles as to,RegionHighlight as no}from"@atlas-viewer/atlas";import{useMemo as Jt}from"react";import{createEventsHelper as Zr}from"@iiif/helpers/events";function ye(e,n){let t=v(),r=Jt(()=>Zr(t),[t]),o=y(()=>e&&e.id?t.getResourceMeta(e.id,"eventManager"):null,[e]);return Jt(()=>e?r.getListenersAsProps(e,n):{},[o,e,t,n])}import{useMemo as Kr}from"react";import{createStylesHelper as Jr}from"@iiif/helpers/styles";function X(e,n){let t=v(),r=Kr(()=>Jr(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 ro}from"react";import{useMemo as Xr}from"react";import{expandTarget as eo}from"@iiif/helpers/annotation-targets";function Se(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 Xr(()=>{if(!s)return;let c={...s,body:u,target:eo(s.target,{typeMap:i.getState().iiif.mapping})};return r?r(c):c},[s,r,u,...n])}import{jsx as oo}from"react/jsx-runtime";var xe=({id:e,style:n,className:t,interactive:r})=>{let o=Se({id:e}),i=X(o,"atlas"),a=X(o,"html"),s=ye(o,["atlas"]),u=P(),c=ro(()=>to(n,i),[n,i]);return u&&o&&o.target&&o.target.selector&&o.target.selector.type==="BoxSelector"&&o.target.source&&(o.target.source.id===u.id||o.target.source===u.id)?oo(no,{id:o.id,isEditing:!0,region:o.target.selector.spatial,style:c,className:a?.className||t,interactive:!!(a?.href||r),href:a?.href||null,title:a?.title||null,hrefTarget:a?.target||null,onClick:()=>{},...s}):null};import{Fragment as ao}from"react";import{useMemo as io}from"react";function Xt(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 io(()=>{if(a)return r?r(a):a},[a,...n])}import{jsx as en}from"react/jsx-runtime";var ce=({className:e,page:n})=>{let t=Xt({id:n.id})||n,r=X(t,"atlas"),o=X(t,"html");return y(i=>t.id?i.iiif.entities.AnnotationPage[t.id]:null,[]),en(ao,{children:t.items?.map(i=>en(xe,{id:i.id,style:r,className:o?.className||e},i.id))})};import{createStylesHelper as ei}from"@iiif/helpers/styles";import{Fragment as cn,useMemo as po}from"react";import{HTMLPortal as lo,TileSet as sn}from"@atlas-viewer/atlas";import Ae,{useMemo as je}from"react";import{jsx as F}from"react/jsx-runtime";var nn=Ae.createContext("en"),rn=Ae.createContext({});function fc(e){return F(rn.Provider,{value:e.translations,children:e.children})}function pc(e){return F(nn.Provider,{value:e.language,children:e.children})}function Ye(){return Ae.useContext(nn)}function on(){return Ae.useContext(rn)}function tn(e){return e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):e}function so({as:e,language:n,children:t,viewingDirection:r,...o}){let i=Ye();return je(()=>tn(i)===tn(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 an(e,n,t){if(n.length===0)return;if(n.length===1)return n[0];if(n.indexOf(e)!==-1)return e;let r=e.indexOf("-")!==-1?e.slice(0,e.indexOf("-")):null;if(r&&n.indexOf(r)!==-1)return r;for(let o of t)if(n.indexOf(o)!==-1)return o;return n.indexOf("none")!==-1?"none":n.indexOf("@none")!==-1?"@none":n[0]}var uo=(e,n=[])=>{let t=Ye();return je(()=>{let r=e();return an(t,r,[])},[t,...n])};function j(e,n){return n?e[n]||n:""}function co(e,n,t=`
2
- `,r={}){let o=uo(()=>Object.keys(e||{}),[e]);return[je(()=>{if(!e)return j(r,n)||"";if(typeof e=="string")return j(r,e);let i=o?e[o]:void 0;return i?typeof i=="string"?i:i.map(a=>j(r,a)).join(t):""},[o,n,e]),o]}function gc(){let e=Ye(),n=on();return function(r,o="",i=`
3
- `,a=n){let s=Object.keys(r||{}),u=an(e,s,[]);if(!r)return j(a,o)||"";if(typeof r=="string")return j(a,r);let c=u?r[u]:void 0;return c?typeof c=="string"?j(a,c):c.map(l=>j(a,l)).join(typeof i<"u"?i:`
4
- `):""}}function le({as:e,defaultText:n,enableDangerouslySetInnerHTML:t,children:r,separator:o,...i}){let a=on(),[s,u]=co(r,n,o,a);return u?F(so,{...i,as:e,language:u,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s}):e?F(e,{...i,children:s}):F("span",{...i,title:t?void 0:s,dangerouslySetInnerHTML:t?{__html:s}:void 0,children:t?void 0:s})}import{jsx as H,jsxs as fo}from"react/jsx-runtime";function mo({resource:e,heading:n,note:t,extra:r}){return r?H(lo,{target:{x:0,y:0,width:r.target?.spatial.width,height:r.target?.spatial.height},backgroundColor:"#333",relative:!0,children:H("div",{style:{display:"flex",alignContent:"center",justifyContent:"center",alignItems:"center",height:"100%",width:"100%",background:"#444",color:"#BBB"},children:fo("div",{children:[H(le,{children:n||"Not authorised"}),t&&H("p",{children:H(le,{children:t})}),H("p",{children:e.id||e["@id"]||"unknown"})]})})}):null}function un({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(sn,{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:mo,extra:e,children:i=>{let a=i.width||e.width||0,s=i.height||e.height||0;return H(sn,{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 Qe,jsxs as ln}from"react/jsx-runtime";function Ce({id:e,image:n,thumbnail:t,isStatic:r,x:o=0,y:i=0,children:a,selector:s,onClick:u,enableSizes:c}){let l=po(()=>{if(!(!s||s.spatial.x===0&&s.spatial.y===0))return s.spatial},[s]);return Qe("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?ln(cn,{children:[Qe(un,{image:n,thumbnail:t,crop:l,enableSizes:c}),a]},"service"):ln(cn,{children:[Qe("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 fn,useMemo as ho}from"react";function go(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function dn(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=go(t,i);a&&a.views&&a.views[e]&&r.push(i)}return r},[e,n])}function mn({canvas:e,manifest:n,all:t,canvases:r}){let o=[];if(n)for(let i of n.annotations)o.indexOf(i.id)===-1&&o.push(i.id);if(t){if(r&&r.length)for(let i of r)for(let a of i.annotations)o.indexOf(a.id)===-1&&o.push(a.id)}else if(e)for(let i of e.annotations)o.indexOf(i.id)===-1&&o.push(i.id);return o}function vo(e,n){let t=e?.iiif?.meta[n];return t?t.annotationPageManager:null}function pn(e,n={}){let t=v(),r=w(),o=P(),i=pe(),a=ho(()=>mn({all:n.all,manifest:r,canvas:o,canvases:i}),[n.all,o,i,r]),s=dn(e,n.all?void 0:a),u=fn(l=>{e&&t.setMetaValue([l,"annotationPageManager","views"],d=>d&&!d[e]?d:{...d||{},[e]:!1})},[e,t]),c=fn((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=vo(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 gn(e,n){return y((t,r)=>r.get(e.map(o=>({id:o,type:n}))),[e,n])}import{useCallback as Co,useEffect as Po,useRef as bo,useState as Ro}from"react";import yo,{useContext as So}from"react";import{ImageServiceLoader as xo}from"@atlas-viewer/iiif-image-api";var Ao=yo.createContext(new xo);function Pe(){return So(Ao)}function hn(){let e=Pe(),[n,t]=Ro({}),r=bo(!1);return Po(()=>()=>{r.current=!0},[]),[Co((i,{height:a,width:s})=>{if(i){let u=i.id||i["@id"],c=e.loadServiceSync({id:u,width:i.width||s,height:i.height||a,source:i});c?i=c:n[u]||(r.current||t(l=>({...l,[u]:"loading"})),e.loadService({id:u,width:i.width||s,height:i.height||a}).then(()=>{r.current||t(l=>({...l,[u]:"done"}))}))}return i},[e,n]),n]}import{useCallback as Io,useMemo as yn,useState as wo}from"react";function vn(e={}){let n=Se(),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 Mo}from"@iiif/helpers/painting-annotations";function Sn(e,n=[]){let t=v(),r=yn(()=>Mo(t),[]),o=vn({enableSingleAnnotation:e?.enableSingleAnnotation}),[i,a]=wo(e?.defaultChoices||[]),s=yn(()=>r.getPaintables(o,i),[t,o,i,...n]),c={makeChoice:Io((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]}import Vo from"react";import{createContext as To,useMemo as No}from"react";import Eo from"mitt";import{jsx as Lo}from"react/jsx-runtime";var ko=Eo(),We=To({emitter:ko});We.displayName="Events";function xn(){return Vo.useContext(We).emitter}function ul({emitter:e,children:n}){return Lo(We.Provider,{value:No(()=>({emitter:e}),[e]),children:n})}function Pn(e){let n=w(),t=P(),r=v(),o=xn(),i=e?.emitter||o,[a,s]=hn(),{enabledPageIds:u}=pn(e?.annotationPageManagerId||n?.id||t?.id,{all:!1}),c=gn(u,"AnnotationPage"),l=e?.strategies||["empty","images","media","textual-content","complex-timeline"],[d,g]=Sn(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(()=>{if(!i)return;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 bn=(e,n=[])=>{let t=v();zo(()=>{e(t)},[t,...n])};import{createThumbnailHelper as Do}from"@iiif/helpers/thumbnail";function Rn(e,n,{canvasId:t,manifestId:r}={}){let o=v(),i=Pe(),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 bn(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 ee(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 Dl(){let e=Ke(wn);if(!e)throw new Error("Ctx not found");return e}function ql(){let e=Ke(Mn);if(!e)throw new Error("Ctx not found");return e}function Bl(){let e=Ke(Vn);if(!e)throw new Error("Ctx not found");return e}function Re({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]=ee({duration:e.duration});return Yo(Re,{state:i,actions:a,currentTime:r,progress:o,element:t,children:[jo("audio",{ref:t,src:e.url}),n]})}function Ie({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 we({media:e,mediaControlsDeps:n,children:t,videoComponent:r=Xe}){let[{element:o,currentTime:i,progress:a},s,u]=ee({duration:e.duration});return L("overlay","video-element",r,{element:o,media:e,playPause:u.playPause}),L("portal","custom-controls",Re,{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 Me({model:e,name:n}){return L("overlay",`model-${n}`,tt,{model:e},[e]),null}import{jsx as Zo}from"react/jsx-runtime";function Ve({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]=ee({duration:e.duration});return L("overlay","video-element",Jo,{element:r,media:e,playPause:s.playPause}),null}import{Fragment as Te,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(),Ne=ye(I,["deep-zoom"]),[de]=_t(),C=Yt(),b=v(),N=Ln(()=>ei(b),[b]),[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]);Wt(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}`,ue.Provider,a?{value:C||null,children:a(p)}:{},[I,C,p,...u||[]]);let q=Rn({maxWidth:256,maxHeight:256});if(!I)return null;let ot=I.accompanyingCanvas,te=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(te)return te;if(d)throw new Error(p.reason||"Unknown image strategy");return null}let it=_(ti,{children:[de?T(ce,{page:de}):null,p.annotations&&p.annotations.pages?p.annotations.pages.map(A=>T(ce,{page:A},A.id)):null,D]}),Fn=p.type==="images"?p.images.length:0;return _(Te,{children:[_("world-object",{height:I.height,width:I.width,x:e,y:n,...Ne,children:[p.type==="empty"||h?T(Ve,{style:g}):null,p.type==="textual-content"?p.items.map((A,me)=>_(Te,{children:[T(ri,{onClick:S?ne=>{ne.stopPropagation(),S(A.annotationId,A,ne)}:void 0,target:A.target?.spatial||void 0,children:T("div",{"data-textual-content":!0,children:T(le,{enableDangerouslySetInnerHTML:!0,children:A.text})})},me),it]})):null,p.type==="images"?_(Te,{children:[p.images.map((A,me)=>T(Ce,{isStatic:i,image:A,id:A.id,thumbnail:me===0?q:void 0,selector:A.selector,enableSizes:m,onClick:S?ne=>{ne.stopPropagation(),S(A.annotationId,A,ne)}:void 0},A.id+me)),it]}):null,p.type==="3d-model"?T(Me,{model:p.model}):null,p.type==="media"?T(Te,{children:p.media.type==="Sound"?_(Ie,{media:p.media,mediaControlsDeps:c,children:[te,s?s(p):null]}):p.media.type==="Video"?_(we,{media:p.media,mediaControlsDeps:c,children:[te,s?s(p):null]}):p.media.type==="VideoYouTube"&&x?_(En,{media:p.media,mediaControlsDeps:c,children:[te,s?s(p):null]}):null}):null]},`${I.id}/${p.type}/${Fn}`),p.type==="media"&&p.media.type==="Sound"&&ot?T(W,{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=pe(),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(W,{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=Q();return U(Y,{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=Ce;M.RenderCanvas=nt;M.RenderAnnotationPage=ce;M.RenderAnnotation=xe;M.Viewer=Kt;M.CanvasBackground=Ve;M.Audio=Ie;M.Video=we;M.Model=Me;M.AudioHTML=Je;M.VideoHTML=Xe;M.ModelHTML=tt;export{fe as a,E as b,B as c,$ as d,Y as e,Q as f,lt as g,dt as h,mt as i,W as j,v as k,y as l,G as m,pe as n,w as o,ft as p,ir as q,ke as r,ra as s,pt as t,aa as u,Le as v,gt as w,ht as x,Sa as y,St as z,xt as A,At as B,ze as C,vt as D,Z as E,fr as F,pr as G,Mt as H,Vt as I,oe as J,gr as K,Fa as L,hr as M,It as N,Ha as O,Tt as P,Et as Q,ae as R,wr as S,Lt as T,zt as U,Ot as V,Ft as W,Ht as X,qt as Y,_t as Z,$t as _,ue as $,Yt as aa,P as ba,ye as ca,X as da,Se as ea,Xt as fa,fc as ga,pc as ha,Ye as ia,on as ja,so as ka,uo as la,co as ma,gc as na,le as oa,mn as pa,pn as qa,gn as ra,Ao as sa,Pe as ta,hn as ua,vn as va,Sn as wa,ko as xa,xn as ya,ul as za,Pn as Aa,bn as Ba,Rn as Ca,$o as Da,ee as Ea,Dl as Fa,ql as Ga,Bl as Ha,Re as Ia,M as Ja};