@nulib/clover 4.0.0-beta.0 → 4.0.0-beta.1
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/components/Map/MapView.mjs +9 -8
- package/dist/components/Map/maplibre-worker.mjs +7 -0
- package/dist/components/Map/worker.mjs +22 -0
- package/dist/components/Panel/About.mjs +14 -9
- package/dist/components/Split/Split.mjs +9 -2
- package/dist/core/items.mjs +3 -1
- package/dist/core/load.mjs +10 -3
- package/dist/index.d.mts +23 -12
- package/dist/map/index.d.mts +15 -4
- package/dist/templates/index.d.mts +5 -2
- package/dist/templates.css +1 -1
- package/dist/ui/ReadMore.mjs +1 -1
- package/dist/web-components/About-DbrFSVBm.mjs +1 -0
- package/dist/web-components/{AnnotationMenu-BGIYRXW6.mjs → AnnotationMenu-EBjIQpQl.mjs} +1 -1
- package/dist/web-components/{AnnotationState-D2UIgIEC.mjs → AnnotationState-DQTaO6Gz.mjs} +1 -1
- package/dist/web-components/{Annotations-C_tBJHo3.mjs → Annotations-Cb9U7HJ_.mjs} +1 -1
- package/dist/web-components/{Annotations-BhwAv3ah.mjs → Annotations-Dl0SgHBS.mjs} +1 -1
- package/dist/web-components/{Body-DMEERFuB.mjs → Body-DxSz3iST.mjs} +1 -1
- package/dist/web-components/{BodyAlert-BP8voSLv.mjs → BodyAlert-C8EOXz24.mjs} +1 -1
- package/dist/web-components/{Button-Cl02BFDd.mjs → Button-uWgfvqsL.mjs} +1 -1
- package/dist/web-components/{Camera-Dw51CAfF.mjs → Camera-cdCqKMup.mjs} +1 -1
- package/dist/web-components/{Canvas2DBackend-RRN2bEkc.mjs → Canvas2DBackend-CnLEHRs4.mjs} +1 -1
- package/dist/web-components/{CanvasView-B8lMMSou.mjs → CanvasView-BI3YzNdK.mjs} +1 -1
- package/dist/web-components/{CaptionDetails-KLMDv-ec.mjs → CaptionDetails-B80ZhZ7v.mjs} +1 -1
- package/dist/web-components/{ChoiceMenu-CXrVOmJl.mjs → ChoiceMenu-DCp7-co7.mjs} +1 -1
- package/dist/web-components/{Collection-DL4Ui4hF.mjs → Collection-B1Le2_TU.mjs} +1 -1
- package/dist/web-components/{CollectionSelect-DL-bbpwJ.mjs → CollectionSelect-BL_jQog-.mjs} +1 -1
- package/dist/web-components/{Connected-BcjRA5si.mjs → Connected-BxqaRL9o.mjs} +1 -1
- package/dist/web-components/{Connected-B0S1HXQb.mjs → Connected-DCBI-j9H.mjs} +1 -1
- package/dist/web-components/{Connected-Q7iizBb8.mjs → Connected-DkhfVWxd.mjs} +1 -1
- package/dist/web-components/{Contents-ZC8TiGaW.mjs → Contents-zYEGHLfe.mjs} +1 -1
- package/dist/web-components/{ControlMenu-DIoU797-.mjs → ControlMenu-CAHiLAtl.mjs} +1 -1
- package/dist/web-components/{Cue-CJxnDMEy.mjs → Cue-BT2V9VAq.mjs} +1 -1
- package/dist/web-components/Document-BdCjGnJN.mjs +1 -0
- package/dist/web-components/DocumentPanel-X_Rta0Wu.mjs +1 -0
- package/dist/web-components/{DomLayers-BsR2AOy-.mjs → DomLayers-BD4QPbl6.mjs} +1 -1
- package/dist/web-components/{Download-DBksL1C0.mjs → Download-DqU-goFi.mjs} +1 -1
- package/dist/web-components/{EntryBodies-VwEkTVrw.mjs → EntryBodies-DXAQH0vR.mjs} +1 -1
- package/dist/web-components/{ErrorBoundary-Cy9PGoZv.mjs → ErrorBoundary-chQaO-Up.mjs} +1 -1
- package/dist/web-components/{FieldPill-DCJBz6Vj.mjs → FieldPill-CyEssPVm.mjs} +1 -1
- package/dist/web-components/{FrameAnimation-DRbmgGpF.mjs → FrameAnimation-Bb0pOoRl.mjs} +1 -1
- package/dist/web-components/{Gallery-BM7-VJkB.mjs → Gallery-BXU3TcT3.mjs} +1 -1
- package/dist/web-components/{HideToggle-BdYgG7us.mjs → HideToggle-BwMrOBMu.mjs} +1 -1
- package/dist/web-components/{Items-_1Jz3FMs.mjs → Items-DRj1UEpC.mjs} +1 -1
- package/dist/web-components/{Label-CAiJ49eA.mjs → Label-D6aVJB9s.mjs} +1 -1
- package/dist/web-components/LightboxBody-BzXQGMDn.mjs +1 -0
- package/dist/web-components/{Loaded-wQurAeJz.mjs → Loaded-D5xmFRSo.mjs} +1 -1
- package/dist/web-components/{LoadedCanvas-DWz5IK5m.mjs → LoadedCanvas-DOjtxLSe.mjs} +1 -1
- package/dist/web-components/LoadedMap-DouDS2lO.mjs +1 -0
- package/dist/web-components/{Loading-BmA--pzr.mjs → Loading-CBKfwsML.mjs} +1 -1
- package/dist/web-components/{Map-DzVGblIS.mjs → Map-Bcgp_R8H.mjs} +1 -1
- package/dist/web-components/MapView-CD5zkTs8.mjs +1 -0
- package/dist/web-components/{Markup-D91DbxLk.mjs → Markup-C1hMA8wk.mjs} +1 -1
- package/dist/web-components/{MediaBody-BYcVPo2X.mjs → MediaBody-B_Gii4we.mjs} +1 -1
- package/dist/web-components/{MediaBody-FEzH8VVw.mjs → MediaBody-BfrKIPte.mjs} +1 -1
- package/dist/web-components/{Navigator-CIJFA3q1.mjs → Navigator-BSJbEbuJ.mjs} +1 -1
- package/dist/web-components/{Pager-BGwCurxE.mjs → Pager-Di_2hHM3.mjs} +1 -1
- package/dist/web-components/{Panel-B-GXOkzF.mjs → Panel-DbsC8A9V.mjs} +1 -1
- package/dist/web-components/{PanelToggle-BYjV2t1j.mjs → PanelToggle-mUDw73zI.mjs} +1 -1
- package/dist/web-components/{PartOfManifest-ClbGepVM.mjs → PartOfManifest-7eOwURrF.mjs} +1 -1
- package/dist/web-components/{Pending-BspZajh5.mjs → Pending-BPOQ2z1L.mjs} +1 -1
- package/dist/web-components/{Primitives-CTh59wvs.mjs → Primitives-XQO3m1wG.mjs} +1 -1
- package/dist/web-components/{Provider-C6rIiDXH.mjs → Provider-B61118lU.mjs} +1 -1
- package/dist/web-components/{ReadMore-BJ2i-0uN.mjs → ReadMore-BJH-qqte.mjs} +1 -1
- package/dist/web-components/{Root-DkkYDtur.mjs → Root-Dj277K6p.mjs} +1 -1
- package/dist/web-components/Scene-BTWpLeec.mjs +1 -0
- package/dist/web-components/{SceneView-qcW_sT3j.mjs → SceneView-BYo7WmPt.mjs} +1 -1
- package/dist/web-components/{Search-UOneIUcP.mjs → Search-ZV8FFN4p.mjs} +1 -1
- package/dist/web-components/{Sections-we9U9fXq.mjs → Sections-ejwu1_Sm.mjs} +1 -1
- package/dist/web-components/{StandaloneItems-DU8oCFc_.mjs → StandaloneItems-BYaiyCca.mjs} +1 -1
- package/dist/web-components/{Status-Cs5ZvFvL.mjs → Status-YbQK2KzY.mjs} +1 -1
- package/dist/web-components/Timeline-ByyVSd7B.mjs +1 -0
- package/dist/web-components/{Tip-C8J3qsIK.mjs → Tip-IO11xX4x.mjs} +1 -1
- package/dist/web-components/{Transcript-CRL2zToL.mjs → Transcript-D0gUxUoA.mjs} +1 -1
- package/dist/web-components/{annotation-collection-ZPyvpLFc.mjs → annotation-collection-Csv7WIlm.mjs} +1 -1
- package/dist/web-components/{annotations-content-BZChKhJZ.mjs → annotations-content-BS_OFz5Z.mjs} +1 -1
- package/dist/web-components/{body-UntgrmoV.mjs → body-CKjwwFep.mjs} +1 -1
- package/dist/web-components/{canvas-d_U4v_mh.mjs → canvas-CIzpp-Uz.mjs} +1 -1
- package/dist/web-components/{cloverEngine-Dbv-26NP.mjs → cloverEngine-B4LinbSt.mjs} +1 -1
- package/dist/web-components/{content-state-reader-DjdKWjit.mjs → content-state-reader-D1BkpICh.mjs} +1 -1
- package/dist/web-components/{controls-qRYf2jO2.mjs → controls-Dj2BybWb.mjs} +1 -1
- package/dist/web-components/{engine-D8JLgzqq.mjs → engine-BSt8LTso.mjs} +1 -1
- package/dist/web-components/{engines-BwVb9R_A.mjs → engines-CC0OEsVE.mjs} +1 -1
- package/dist/web-components/{fromManifest-UrMJgktp.mjs → fromManifest-BhemHaoA.mjs} +1 -1
- package/dist/web-components/{glyphs-BoX0a88P.mjs → glyphs-drROkef9.mjs} +1 -1
- package/dist/web-components/{hooks-Dp8pjU8l.mjs → hooks-BXzQSllm.mjs} +1 -1
- package/dist/web-components/{imageService-C3yg9DxB.mjs → imageService-dsdmcegU.mjs} +1 -1
- package/dist/web-components/{index-DWxMuwDL.mjs → index-B7nZdqLg.mjs} +1 -1
- package/dist/web-components/index.mjs +1 -1
- package/dist/web-components/{items--Tu7ZM3L.mjs → items-CB2Uk7ts.mjs} +1 -1
- package/dist/web-components/items-jfQ5XzEj.mjs +1 -0
- package/dist/web-components/label-Vbg_cMOJ.mjs +1 -0
- package/dist/web-components/{layout-KL0V-iJu.mjs → layout-mMHI0lsj.mjs} +1 -1
- package/dist/web-components/{link-DRRTY4lY.mjs → link-ZRnv5NFR.mjs} +1 -1
- package/dist/web-components/logo-Boy6u4m2.mjs +1 -0
- package/dist/web-components/{models-BP2qp9nT.mjs → models-D1EE_CmH.mjs} +1 -1
- package/dist/web-components/{nodes-Bf-Fb7e5.mjs → nodes-B7JRwBgl.mjs} +1 -1
- package/dist/web-components/{overlayImage-DdPs2EGY.mjs → overlayImage-0OgQl1TL.mjs} +1 -1
- package/dist/web-components/{panel-CiqEFDzv.mjs → panel-CjXfre-g.mjs} +1 -1
- package/dist/web-components/part-cUiPs2-y.mjs +1 -0
- package/dist/web-components/{playerSurface-i2TJz-F4.mjs → playerSurface-CU5XxI1j.mjs} +1 -1
- package/dist/web-components/{provider-LUmAQSoP.mjs → provider-C1wKfdjb.mjs} +1 -1
- package/dist/web-components/{read-more-BaaO77el.mjs → read-more-DNHNtG-a.mjs} +1 -1
- package/dist/web-components/{rendererSurface-DAvatpMF.mjs → rendererSurface-DhIlOjGT.mjs} +2 -2
- package/dist/web-components/{renderers-Bg4QqawN.mjs → renderers-BMSWEFUR.mjs} +1 -1
- package/dist/web-components/{resource-DzIvB_4m.mjs → resource-DLHocQ1C.mjs} +1 -1
- package/dist/web-components/{search-DgcgsI3I.mjs → search-CLy2Wj01.mjs} +1 -1
- package/dist/web-components/{shared-J3w3gnXD.mjs → shared-YUjOSBKO.mjs} +1 -1
- package/dist/web-components/{show-link-DWRRXSBy.mjs → show-link-CyzYE1eS.mjs} +1 -1
- package/dist/web-components/{sizedImage-DfjlV2-i.mjs → sizedImage-uv_NlE0l.mjs} +1 -1
- package/dist/web-components/{split-m-_XivaW.mjs → split-CYuMjp89.mjs} +1 -1
- package/dist/web-components/{status-DDS7jLNd.mjs → status-Ms5L0ghK.mjs} +1 -1
- package/dist/web-components/{styles-Ypl9KrSK.mjs → styles-CyuM_fB1.mjs} +1 -1
- package/dist/web-components/three.mjs +1 -1
- package/dist/web-components/{thumbnail-BZvLSwWW.mjs → thumbnail-c2K_iQsD.mjs} +1 -1
- package/dist/web-components/{tip-BXByhOJ9.mjs → tip-dWhupWSr.mjs} +1 -1
- package/dist/web-components/{toggle-AS72kq6v.mjs → toggle-BQTjR1I3.mjs} +1 -1
- package/dist/web-components/{useContainerName-DCbE5JXi.mjs → useContainerName-BpJ3IWY0.mjs} +1 -1
- package/dist/web-components/{useNearViewport-CyoK3l8W.mjs → useNearViewport-CtLyYg9n.mjs} +1 -1
- package/dist/web-components/{useScrollTrack-dLFWnT8N.mjs → useScrollTrack-WbG28FPD.mjs} +1 -1
- package/dist/web-components/viewer/{AnnotationMenu-Dd4tnzNV.mjs → AnnotationMenu-ZKyBeyUU.mjs} +1 -1
- package/dist/web-components/viewer/{AnnotationState-DZaSy5lH.mjs → AnnotationState-DO33zokc.mjs} +1 -1
- package/dist/web-components/viewer/{Annotations-D1h-Yi5J.mjs → Annotations-BOjhr5ks.mjs} +1 -1
- package/dist/web-components/viewer/{Annotations-sj79EMen.mjs → Annotations-DkLueFLK.mjs} +1 -1
- package/dist/web-components/viewer/{Canvas2DBackend-CkvI0wUT.mjs → Canvas2DBackend-CAmzJD5P.mjs} +1 -1
- package/dist/web-components/viewer/{CaptionDetails-B_JdNjJ7.mjs → CaptionDetails-DOJlUtOn.mjs} +1 -1
- package/dist/web-components/viewer/{ChoiceMenu-xa51a1DV.mjs → ChoiceMenu-BDq6H34G.mjs} +1 -1
- package/dist/web-components/viewer/{Collection-CxuLCspj.mjs → Collection-By3puO0V.mjs} +1 -1
- package/dist/web-components/viewer/{Connected-BSUBc3Ci.mjs → Connected-DZNO2CPf.mjs} +1 -1
- package/dist/web-components/viewer/{Connected-CPIxNjF2.mjs → Connected-ESg5y49m.mjs} +1 -1
- package/dist/web-components/viewer/{Contents-DNh9mnsF.mjs → Contents-B_FqDwTW.mjs} +1 -1
- package/dist/web-components/viewer/{ControlMenu-DdgIvBdf.mjs → ControlMenu-DdQl-dTf.mjs} +1 -1
- package/dist/web-components/viewer/{Cue-90H9_dXz.mjs → Cue-BTRHfiWQ.mjs} +1 -1
- package/dist/web-components/viewer/Document-B9_PyD2w.mjs +1 -0
- package/dist/web-components/viewer/DocumentPanel-CtEJVPoE.mjs +1 -0
- package/dist/web-components/viewer/{DomLayers-Dybz_aJv.mjs → DomLayers-DRdQSEtN.mjs} +1 -1
- package/dist/web-components/viewer/{EntryBodies-DGXjFP3N.mjs → EntryBodies-CJuTRcTq.mjs} +1 -1
- package/dist/web-components/viewer/{FieldPill-Icmd98OY.mjs → FieldPill-06uwrNwE.mjs} +1 -1
- package/dist/web-components/viewer/{FrameAnimation-DJZN3Rd4.mjs → FrameAnimation-3dcDHf5q.mjs} +1 -1
- package/dist/web-components/viewer/{Gallery-CEp3-bh2.mjs → Gallery-BYasTqZc.mjs} +1 -1
- package/dist/web-components/viewer/{HideToggle-DB6HTmAO.mjs → HideToggle-BxkNMX-T.mjs} +1 -1
- package/dist/web-components/viewer/{LightboxBody-ClQ4yrTh.mjs → LightboxBody-CXMc1xOH.mjs} +1 -1
- package/dist/web-components/{MapView-BJaN7VBI.mjs → viewer/MapView-DCerrRRV.mjs} +1 -1
- package/dist/web-components/viewer/{MediaBody-BzMXMHIF.mjs → MediaBody-BdkJcyGy.mjs} +1 -1
- package/dist/web-components/viewer/{MediaBody-BBbSMT1i.mjs → MediaBody-waF4KvHp.mjs} +1 -1
- package/dist/web-components/viewer/{Navigator-Duc69Yes.mjs → Navigator-CKwDgG2x.mjs} +1 -1
- package/dist/web-components/viewer/{PartOfManifest-X9_q-2t6.mjs → PartOfManifest-DalHJFwC.mjs} +1 -1
- package/dist/web-components/viewer/{Search-S4N5QU4R.mjs → Search-Di_QQfDb.mjs} +1 -1
- package/dist/web-components/viewer/{StandaloneItems-BO4VyWRW.mjs → StandaloneItems-B9J6nnWn.mjs} +1 -1
- package/dist/web-components/viewer/{Transcript-BbDaS064.mjs → Transcript-aHOixfna.mjs} +1 -1
- package/dist/web-components/viewer/{annotation-collection-BjZ1DAHq.mjs → annotation-collection-I2UkdobR.mjs} +1 -1
- package/dist/web-components/viewer/{annotations-content-jn3n5Y2-.mjs → annotations-content-D-i4j9pD.mjs} +1 -1
- package/dist/web-components/viewer/{cloverEngine-CjuYjUhI.mjs → cloverEngine-CynoKdta.mjs} +1 -1
- package/dist/web-components/viewer/{content-state-reader-CPiShIjP.mjs → content-state-reader-D7GIMcKK.mjs} +1 -1
- package/dist/web-components/viewer/{host-yWi4R1bP.mjs → host-DlCltI_c.mjs} +1 -1
- package/dist/web-components/viewer/index.mjs +1 -1
- package/dist/web-components/viewer/{link-CwE-fg5G.mjs → link-BX-wzj1u.mjs} +1 -1
- package/dist/web-components/viewer/{overlayImage-BpOgqsZ0.mjs → overlayImage-CHqn1fG8.mjs} +1 -1
- package/dist/web-components/viewer/{renderers-L-IlGI1r.mjs → renderers-C_wdmw9v.mjs} +1 -1
- package/dist/web-components/viewer/{search-DWkwRPo_.mjs → search-BHLyNxZ6.mjs} +1 -1
- package/dist/web-components/viewer/{viewer--TreVlJ_.mjs → viewer-ipqAA-xQ.mjs} +5 -5
- package/dist/web-components/viewer/{vtt-1ZJwtElI.mjs → vtt-XiS_-5Ao.mjs} +1 -1
- package/dist/web-components/viewer-DEHIsIHd.mjs +1 -0
- package/dist/web-components/{vtt-GFssZH8Y.mjs → vtt-DYAOuQoK.mjs} +1 -1
- package/dist/web-components/worker-CjXN0dku.mjs +1 -0
- package/package.json +3 -2
- package/dist/web-components/About-uKa1wfDr.mjs +0 -1
- package/dist/web-components/Document-DHBRAFEK.mjs +0 -1
- package/dist/web-components/DocumentPanel-CqvE2pu9.mjs +0 -1
- package/dist/web-components/LightboxBody-DyhUZiDf.mjs +0 -1
- package/dist/web-components/LoadedMap-DIeW313M.mjs +0 -1
- package/dist/web-components/Scene-B_PU_TiX.mjs +0 -1
- package/dist/web-components/Timeline-WtYZ1bIJ.mjs +0 -1
- package/dist/web-components/items-W2vrwArM.mjs +0 -1
- package/dist/web-components/label-CYQ7tVl6.mjs +0 -1
- package/dist/web-components/logo-CnQUCB3Y.mjs +0 -1
- package/dist/web-components/part-CUBY90_b.mjs +0 -1
- package/dist/web-components/viewer/Document-CNCpzkiN.mjs +0 -1
- package/dist/web-components/viewer/DocumentPanel-BdG4TVLE.mjs +0 -1
- package/dist/web-components/viewer/MapView-BVSdybIC.mjs +0 -1
- package/dist/web-components/viewer-DyV864Qe.mjs +0 -1
|
@@ -1 +1 @@
|
|
|
1
|
-
var $=Object.defineProperty;var U=(e,t,o)=>t in e?$(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var s=(e,t,o)=>U(e,typeof t!="symbol"?t+"":t,o);let L;function N(e){L=e}function Fe(){return L}function H(e={}){return import("./shared-J3w3gnXD.mjs").then(t=>t.ap).then(t=>t.initCloverI18n(e))}const A=new Map,x=new Set;function Je(e,t,o){if(!A.has(t)){A.set(t,{index:e,css:o});for(const n of x)n.place(t,e,o)}}class V{constructor(t){s(this,"injected",new Set);this.doc=t,x.add(this),A.forEach(({index:o,css:n},i)=>this.place(i,o,n))}inject(t,o){this.injected.has(t)||(this.injected.add(t),this.doc.head.prepend(this.style(t,o)))}place(t,o,n){if(this.injected.has(t))return;this.injected.add(t);const i=this.style(t,n);i.dataset.cloverIndex=String(o);const c=[...this.doc.head.querySelectorAll("style[data-clover-index]")],C=c.filter(l=>Number(l.dataset.cloverIndex)<o).at(-1),w=c.find(l=>Number(l.dataset.cloverIndex)>o),g=this.doc.head.querySelectorAll("style[data-clover]");C?C.after(i):w?w.before(i):g.length?g[g.length-1].after(i):this.doc.head.prepend(i)}style(t,o){const n=this.doc.createElement("style");return n.dataset.clover=t,n.textContent=o,n}}const j=new WeakMap;function q(e){let t=j.get(e);return t||j.set(e,t=new V(e)),t}const z="@layer clover{:is(clover-root,clover-items,clover-viewer,clover-panel,clover-read-more):not([hidden]){display:block}:is(clover-body,clover-canvas,clover-timeline,clover-scene):not([hidden]){display:block;height:var(--clover-body-height,60vh)}clover-split:not([hidden]){display:flex}:is(clover-label,clover-panel-toggle):not([hidden]){display:contents}clover-tab,clover-tip,clover-status>[slot]{display:none}}";let W=null,f=null;const B=()=>W??(W=import("./shared-J3w3gnXD.mjs").then(e=>e.aq).then(e=>f=e)),F=e=>e.trim().toLowerCase()==="false";function J(e,{type:t,min:o},n){if(e===null)return;if(t==="string")return e;if(t==="boolean")return!F(e);if(t==="number"){const c=Number(e);if(e.trim()===""||!Number.isFinite(c)){n("is not a number");return}if(o!==void 0&&c<o){n(`is less than ${o}`);return}return c}if(t==="data"){const c=e.trim();if(!/^[[{"]/.test(c))return e;try{return JSON.parse(c)}catch{n("is not JSON");return}}const i=e.trim().toLowerCase();if(t.includes(i))return i==="false"?false:i;n(`is not ${t.join(", ")}`)}const K=(e,t)=>{const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(n=>Object.is(e[n],t[n]))};function Q(e){class t extends HTMLElement{constructor(){super(...arguments);s(this,"kind",e.kind)}static get observedAttributes(){return Object.keys(e.attributes)}connectedCallback(){q(this.ownerDocument).inject("elements",z)}}customElements.define(e.tag,t)}function _(e,t){if(typeof customElements>"u"||customElements.get(e.tag))return;if(e.kind==="config"||!t)return Q(e);const o=e.kind,n=e.properties??[],i=Object.entries(e.events??{});let c=null,C=null;const w=()=>C??(C=Promise.all([t().then(l=>c=l),B()]));class g extends HTMLElement{constructor(){super(...arguments);s(this,"kind",o);s(this,"needsRoot",!!e.needsRoot);s(this,"values",{});s(this,"kept",{});s(this,"props",{});s(this,"listeners",new Set);s(this,"warned",new Set);s(this,"handlers",Object.fromEntries(i.map(([r,a])=>[a.prop,(...u)=>{var b;if(a.keeps&&(this.kept[a.keeps]=u[0]??null,u[0]==null))return true;const y=a.detail==="first"?u[0]:Object.fromEntries(a.detail.map((m,D)=>[m,u[D]])),E=new CustomEvent(r,{detail:y,bubbles:!a.keeps,composed:!a.keeps,cancelable:!!a.cancelable}),S=this.dispatchEvent(E);if(!S&&a.cancelable){const m=u[u.length-1];(b=m==null?void 0:m.preventDefault)==null||b.call(m)}return S}])));s(this,"getProps",()=>this.props);s(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}))}static get observedAttributes(){return Object.keys(e.attributes)}get element(){return this}get Component(){return c}connectedCallback(){for(const r of n){if(!Object.prototype.hasOwnProperty.call(this,r))continue;const a=this[r];delete this[r],a!=null&&(this.values[r]=a)}this.update(),this.warnOfAria(),q(this.ownerDocument).inject("elements",z),w().then(()=>{this.isConnected&&f.hostOf(this.ownerDocument).connect(this)})}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||f==null||f.hostOf(this.ownerDocument).disconnect(this)})}attributeChangedCallback(){this.update()}warnOfAria(){if(!e.native)for(const r of["aria-label","aria-labelledby","role"])!this.hasAttribute(r)||this.warned.has(r)||(this.warned.add(r),console.warn(`<${e.tag}>: ${r} names the element, a box no reader is told of; Clover names what it draws itself.`))}update(){const r={...this.handlers,...this.values};for(const[a,u]of Object.entries(e.attributes)){if(u.prop in this.values)continue;const y=this.getAttribute(a),E=J(y,u,S=>{const b=`${a}=${y}`;this.warned.has(b)||(this.warned.add(b),console.warn(`<${e.tag}>: ${a}="${y}" ${S}; ignored.`))});E!==void 0&&(r[u.prop]=E)}K(r,this.props)||(this.props=r,this.listeners.forEach(a=>a()))}}s(g,"initCloverI18n",H);for(const l of n)Object.defineProperty(g.prototype,l,{configurable:true,enumerable:true,get(){return l in this.values?this.values[l]:this.getProps()[l]},set(h){h==null?delete this.values[l]:this.values[l]=h,this.update()}});for(const[,l]of i){if(!l.keeps)continue;const h=l.keeps;Object.defineProperty(g.prototype,h,{configurable:true,enumerable:true,get(){return this.kept[h]??null}})}customElements.define(e.tag,g)}const G={tag:"clover-panel",kind:"part",needsRoot:true,attributes:{layout:{prop:"layout",type:["tabs","accordion"]},value:{prop:"value",type:"string"},"heading-level":{prop:"headingLevel",type:"number",min:1},download:{prop:"download",type:"boolean"},closable:{prop:"closable",type:"boolean"},"close-on-escape":{prop:"closeOnEscape",type:"boolean"},as:{prop:"as",type:["aside","div"]}},events:{"clover-value-change":{prop:"onValueChange",detail:["value"]},"clover-close":{prop:"onClose",detail:[],cancelable:true}}},Y={tag:"clover-tab",kind:"config",attributes:{value:{prop:"value",type:"string"},label:{prop:"label",type:"string"}},slots:["label"]},Z={tag:"clover-panel-toggle",kind:"part",attributes:{controls:{prop:"controls",type:"string"}},events:{"clover-open-change":{prop:"onOpenChange",detail:["open"],cancelable:true}}},X={tag:"clover-split",kind:"part",native:true,attributes:{"storage-key":{prop:"storageKey",type:"string"}}},ee={tag:"clover-split-pane",kind:"part",native:true,attributes:{size:{prop:"size",type:"string"},min:{prop:"min",type:"string"},max:{prop:"max",type:"string"},name:{prop:"name",type:"string"}}},te={tag:"clover-split-handle",kind:"part",native:true,attributes:{}},M={"clover-ready":{prop:"onReady",detail:["handle"],keeps:"handle"}},oe={tag:"clover-canvas",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},src:{prop:"src",type:"string"},tiled:{prop:"isTiledImage",type:"boolean"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},navigator:{prop:"navigator",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"},"viewing-direction":{prop:"viewingDirection",type:["left-to-right","right-to-left","top-to-bottom","bottom-to-top"]},"animate-annotations":{prop:"animateAnnotations",type:"boolean"}},properties:["iiifContent","canvases","src","annotations","options","controlButtons","controls"],events:{...M,"clover-annotation-select":{prop:"onAnnotationSelect",detail:["id"]},"clover-annotation-active":{prop:"onAnnotationActive",detail:["id"]},"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},ne={tag:"clover-timeline",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"}},properties:["iiifContent","timeline","annotations","options","controls"],events:{"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},re={tag:"clover-scene",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},engine:{prop:"engine",type:["clover","three"]}},properties:["iiifContent","scene","options","controls"]},ae={tag:"clover-body",kind:"part",needsRoot:true,attributes:{controls:{prop:"controls",type:"boolean"},navigator:{prop:"navigator",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"},"animate-annotations":{prop:"animateAnnotations",type:"boolean"}},properties:["controls","options","controlButtons","renderers"],events:{...M,"clover-annotation-active":{prop:"onAnnotationActive",detail:["id"]},"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},ie={tag:"clover-items",kind:"part",attributes:{layout:{prop:"layout",type:["slider","list","grid","pager"]},of:{prop:"of",type:["views","members"]},navigation:{prop:"navigation",type:["id","homepage"]},"iiif-content":{prop:"iiifContent",type:"string"},header:{prop:"header",type:"boolean"},"heading-level":{prop:"headingLevel",type:"number",min:2},"thumbnail-size":{prop:"thumbnailSize",type:"number",min:1},language:{prop:"language",type:"string"}},properties:["iiifContent","items","request","renderItem"],events:{"clover-select":{prop:"onSelect",detail:["item"],cancelable:true}}},le=["span","p","div","strong","em","h1","h2","h3","h4","h5","h6"],se={tag:"clover-label",kind:"part",attributes:{of:{prop:"of",type:["manifest","canvas"]},as:{prop:"as",type:le},label:{prop:"label",type:"data"}},properties:["label"]},pe={prop:"of",type:["manifest","canvas"]},T={prop:"value",type:"data"},d=(e,t={})=>({tag:e,kind:"part",attributes:{of:pe,value:T,...t},properties:["value"]}),ce=d("clover-summary",{as:{prop:"as",type:["p","div","span"]}}),de={...d("clover-metadata"),properties:["value","renderValue"]},ue=d("clover-required-statement"),ve=d("clover-rights"),ge=d("clover-id"),me=d("clover-homepage"),he=d("clover-rendering"),ye=d("clover-see-also"),be=d("clover-part-of"),fe=d("clover-thumbnail",{size:{prop:"size",type:"number",min:1},alt:{prop:"alt",type:"string"}}),ke=d("clover-provider",{link:{prop:"link",type:["false"]}}),Ce=d("clover-logo",{alt:{prop:"alt",type:"string"}}),we={tag:"clover-value",kind:"part",attributes:{value:T,format:{prop:"format",type:"string"},"heading-level":{prop:"headingLevel",type:"number",min:1},as:{prop:"as",type:["span","p","div"]}},properties:["value"]},Ee={tag:"clover-root",kind:"root",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},"canvas-id":{prop:"canvasId",type:"string"},"manifest-id":{prop:"manifestId",type:"string"},language:{prop:"language",type:"string"},"search-query":{prop:"searchQuery",type:"string"},annotations:{prop:"annotations",type:"data"},"annotation-pages":{prop:"annotationPages",type:["view","all"]},lang:{prop:"lang",type:"string"}},properties:["iiifContent","annotations","request","renderers"],events:{"clover-ready":{prop:"onReady",detail:["clover"],keeps:"clover"},"clover-canvas-change":{prop:"onCanvasChange",detail:["canvasId"]},"clover-manifest-change":{prop:"onManifestChange",detail:["manifestId"]},"clover-status-change":{prop:"onStatusChange",detail:["status","error"]},"clover-content-state-change":{prop:"onContentStateChange",detail:"first"}}},k={"heading-level":{prop:"headingLevel",type:"number",min:1}},P={of:{prop:"of",type:["views","members"]}},Se={tag:"clover-status",kind:"part",needsRoot:true,attributes:{loading:{prop:"loading",type:["false"]}},slots:["loading","error"]},Oe={tag:"clover-position",kind:"part",needsRoot:true,attributes:{...P,as:{prop:"as",type:["span","p","div"]}}},Re={tag:"clover-next",kind:"part",needsRoot:true,attributes:P},Ae={tag:"clover-previous",kind:"part",needsRoot:true,attributes:P},Pe={tag:"clover-download",kind:"part",needsRoot:true,attributes:k},je={tag:"clover-search",kind:"part",needsRoot:true,attributes:{...k,sticky:{prop:"sticky",type:"boolean"},size:{prop:"size",type:["large","small"]}}},Ie={tag:"clover-contents",kind:"part",needsRoot:true,attributes:{}},Le={tag:"clover-transcript",kind:"part",needsRoot:true,attributes:{follow:{prop:"follow",type:"boolean"},find:{prop:"find",type:"boolean"},sticky:{prop:"sticky",type:"boolean"},size:{prop:"size",type:["large","small"]}}},xe={tag:"clover-annotations",kind:"part",needsRoot:true,attributes:{scope:{prop:"scope",type:["view","all"]},...k},properties:["renderEntry"]},qe={tag:"clover-collection",kind:"part",needsRoot:true,attributes:k},ze={tag:"clover-collection-select",kind:"part",needsRoot:true,attributes:{},events:{"clover-change":{prop:"onChange",detail:["manifestId"]}}},Me={tag:"clover-about",kind:"part",needsRoot:true,attributes:{"canvas-summary":{prop:"canvasSummary",type:"boolean"},download:{prop:"download",type:"boolean"},thumbnail:{prop:"thumbnail",type:"boolean"},label:{prop:"label",type:"boolean"},...k}},Te={tag:"clover-map",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},overlay:{prop:"overlay",type:"boolean"},"overlay-opacity":{prop:"overlayOpacity",type:"number",min:0},"style-url":{prop:"styleUrl",type:"string"},"scroll-zoom":{prop:"scrollZoom",type:"boolean"},language:{prop:"language",type:"string"}},properties:["iiifContent","navPlace","georeferences","request"],events:{"clover-select":{prop:"onSelect",detail:["feature"]}}},De={tag:"clover-read-more",kind:"part",attributes:{}},$e={tag:"clover-tip",kind:"part",attributes:{label:{prop:"label",type:"string"},lang:{prop:"lang",type:"string"},keys:{prop:"keys",type:"string"},glyph:{prop:"glyph",type:"string"}},properties:["shortcut"]},Ue={tag:"clover-viewer",kind:"alone",attributes:{template:{prop:"template",type:["default","document","gallery"]},"iiif-content":{prop:"iiifContent",type:"string"},"canvas-id":{prop:"defaultCanvasId",type:"string"},"manifest-id":{prop:"defaultManifestId",type:"string"},language:{prop:"language",type:"string"},"search-query":{prop:"searchQuery",type:"string"},annotations:{prop:"annotations",type:"data"},"heading-level":{prop:"headingLevel",type:"number",min:2},items:{prop:"items",type:["slider","list","grid","false"]},header:{prop:"header",type:"boolean"},panel:{prop:"panel",type:"boolean"},download:{prop:"download",type:"boolean"},"panel-open":{prop:"defaultPanelOpen",type:"boolean"},"panel-layout":{prop:"panelLayout",type:["accordion","tabs"]},"sidebar-open":{prop:"defaultSidebarOpen",type:"boolean"},"storage-key":{prop:"storageKey",type:"string"},fill:{prop:"fill",type:"boolean"},size:{prop:"size",type:"string"}},properties:["iiifContent","annotations","request","renderers"],events:{"clover-canvas-change":{prop:"onCanvasChange",detail:["canvasId"]},"clover-manifest-change":{prop:"onManifestChange",detail:["manifestId"]},"clover-status-change":{prop:"onStatusChange",detail:["status","error"]},"clover-content-state-change":{prop:"onContentStateChange",detail:"first"}}},I=[Ue,Ee,ae,se,ie,Oe,Ae,Re,Se,fe,ce,de,ue,ve,me,ye,he,be,ge,ke,Ce,we,Me,xe,qe,ze,Ie,je,Le,Pe,Te,G,Y,Z,X,ee,te,oe,ne,re,$e,De],p=(e,t,o)=>()=>Promise.all([e(),import("./part-CUBY90_b.mjs")]).then(([n,{drawn:i}])=>i(n[t],o)),O=e=>()=>import("./split-m-_XivaW.mjs").then(t=>t[e]),v=e=>p(()=>import("./Primitives-CTh59wvs.mjs"),e),R=e=>p(()=>import("./Pager-BGwCurxE.mjs"),e),Ne={"clover-viewer":()=>import("./viewer-DyV864Qe.mjs").then(e=>e.v).then(e=>e.ViewerElement),"clover-root":()=>import("./shared-J3w3gnXD.mjs").then(e=>e.as).then(e=>e.RootElement),"clover-label":()=>import("./label-CYQ7tVl6.mjs").then(e=>e.LabelElement),"clover-body":()=>import("./body-UntgrmoV.mjs").then(e=>e.BodyElement),"clover-items":()=>import("./items-W2vrwArM.mjs").then(e=>e.ItemsElement),"clover-position":R("Position"),"clover-previous":R("Previous"),"clover-next":R("Next"),"clover-status":()=>import("./status-DDS7jLNd.mjs").then(e=>e.StatusElement),"clover-thumbnail":v("Thumbnail"),"clover-summary":v("Summary"),"clover-metadata":p(()=>import("./Primitives-CTh59wvs.mjs"),"Metadata",["renderValue"]),"clover-required-statement":v("RequiredStatement"),"clover-rights":v("Rights"),"clover-homepage":v("Homepage"),"clover-see-also":v("SeeAlso"),"clover-rendering":v("Rendering"),"clover-part-of":v("PartOf"),"clover-id":v("Id"),"clover-provider":()=>import("./provider-LUmAQSoP.mjs").then(e=>e.ProviderElement),"clover-logo":()=>import("./logo-CnQUCB3Y.mjs").then(e=>e.LogoElement),"clover-value":v("Value"),"clover-about":p(()=>import("./About-uKa1wfDr.mjs"),"About"),"clover-annotations":p(()=>import("./Annotations-C_tBJHo3.mjs"),"Annotations",["renderEntry"]),"clover-collection":p(()=>import("./Collection-DL4Ui4hF.mjs"),"Collection"),"clover-collection-select":p(()=>import("./CollectionSelect-DL-bbpwJ.mjs"),"CollectionSelect"),"clover-contents":p(()=>import("./Contents-ZC8TiGaW.mjs"),"Contents"),"clover-search":p(()=>import("./Search-UOneIUcP.mjs"),"Search"),"clover-transcript":p(()=>import("./Transcript-CRL2zToL.mjs"),"Transcript"),"clover-download":p(()=>import("./Download-DBksL1C0.mjs"),"Download"),"clover-map":p(()=>import("./Map-DzVGblIS.mjs"),"CloverMap"),"clover-panel":()=>import("./panel-CiqEFDzv.mjs").then(e=>e.PanelElement),"clover-panel-toggle":()=>import("./toggle-AS72kq6v.mjs").then(e=>e.PanelToggleElement),"clover-split":O("SplitElement"),"clover-split-pane":O("SplitPaneElement"),"clover-split-handle":O("SplitHandleElement"),"clover-canvas":()=>import("./canvas-d_U4v_mh.mjs").then(e=>e.CanvasElement),"clover-timeline":p(()=>import("./Timeline-WtYZ1bIJ.mjs"),"Timeline"),"clover-scene":p(()=>import("./Scene-B_PU_TiX.mjs"),"Scene"),"clover-tip":()=>import("./tip-BXByhOJ9.mjs").then(e=>e.TipElement),"clover-read-more":()=>import("./read-more-BaaO77el.mjs").then(e=>e.ReadMoreElement)};function He(e,t=I.map(({tag:o})=>o)){e.mapWorkerUrl&&N(e.mapWorkerUrl);for(const o of I)t.includes(o.tag)&&_(o,Ne[o.tag])}const Ve=""+new URL("assets/maplibre-gl-worker-kTz9OPxr.js",import.meta.url).href,We={mapWorkerUrl:Ve};He(We);export{Je as a,He as d,Fe as g,H as i};
|
|
1
|
+
var $=Object.defineProperty;var U=(e,t,o)=>t in e?$(e,t,{enumerable:true,configurable:true,writable:true,value:o}):e[t]=o;var s=(e,t,o)=>U(e,typeof t!="symbol"?t+"":t,o);let L;function N(e){L=e}function Fe(){return L}function H(e={}){return import("./shared-YUjOSBKO.mjs").then(t=>t.ap).then(t=>t.initCloverI18n(e))}const A=new Map,x=new Set;function Je(e,t,o){if(!A.has(t)){A.set(t,{index:e,css:o});for(const n of x)n.place(t,e,o)}}class V{constructor(t){s(this,"injected",new Set);this.doc=t,x.add(this),A.forEach(({index:o,css:n},i)=>this.place(i,o,n))}inject(t,o){this.injected.has(t)||(this.injected.add(t),this.doc.head.prepend(this.style(t,o)))}place(t,o,n){if(this.injected.has(t))return;this.injected.add(t);const i=this.style(t,n);i.dataset.cloverIndex=String(o);const c=[...this.doc.head.querySelectorAll("style[data-clover-index]")],C=c.filter(l=>Number(l.dataset.cloverIndex)<o).at(-1),w=c.find(l=>Number(l.dataset.cloverIndex)>o),g=this.doc.head.querySelectorAll("style[data-clover]");C?C.after(i):w?w.before(i):g.length?g[g.length-1].after(i):this.doc.head.prepend(i)}style(t,o){const n=this.doc.createElement("style");return n.dataset.clover=t,n.textContent=o,n}}const j=new WeakMap;function q(e){let t=j.get(e);return t||j.set(e,t=new V(e)),t}const z="@layer clover{:is(clover-root,clover-items,clover-viewer,clover-panel,clover-read-more):not([hidden]){display:block}:is(clover-body,clover-canvas,clover-timeline,clover-scene):not([hidden]){display:block;height:var(--clover-body-height,60vh)}clover-split:not([hidden]){display:flex}:is(clover-label,clover-panel-toggle):not([hidden]){display:contents}clover-tab,clover-tip,clover-status>[slot]{display:none}}";let W=null,f=null;const B=()=>W??(W=import("./shared-YUjOSBKO.mjs").then(e=>e.aq).then(e=>f=e)),F=e=>e.trim().toLowerCase()==="false";function J(e,{type:t,min:o},n){if(e===null)return;if(t==="string")return e;if(t==="boolean")return!F(e);if(t==="number"){const c=Number(e);if(e.trim()===""||!Number.isFinite(c)){n("is not a number");return}if(o!==void 0&&c<o){n(`is less than ${o}`);return}return c}if(t==="data"){const c=e.trim();if(!/^[[{"]/.test(c))return e;try{return JSON.parse(c)}catch{n("is not JSON");return}}const i=e.trim().toLowerCase();if(t.includes(i))return i==="false"?false:i;n(`is not ${t.join(", ")}`)}const K=(e,t)=>{const o=Object.keys(e);return o.length===Object.keys(t).length&&o.every(n=>Object.is(e[n],t[n]))};function Q(e){class t extends HTMLElement{constructor(){super(...arguments);s(this,"kind",e.kind)}static get observedAttributes(){return Object.keys(e.attributes)}connectedCallback(){q(this.ownerDocument).inject("elements",z)}}customElements.define(e.tag,t)}function _(e,t){if(typeof customElements>"u"||customElements.get(e.tag))return;if(e.kind==="config"||!t)return Q(e);const o=e.kind,n=e.properties??[],i=Object.entries(e.events??{});let c=null,C=null;const w=()=>C??(C=Promise.all([t().then(l=>c=l),B()]));class g extends HTMLElement{constructor(){super(...arguments);s(this,"kind",o);s(this,"needsRoot",!!e.needsRoot);s(this,"values",{});s(this,"kept",{});s(this,"props",{});s(this,"listeners",new Set);s(this,"warned",new Set);s(this,"handlers",Object.fromEntries(i.map(([r,a])=>[a.prop,(...u)=>{var b;if(a.keeps&&(this.kept[a.keeps]=u[0]??null,u[0]==null))return true;const y=a.detail==="first"?u[0]:Object.fromEntries(a.detail.map((m,D)=>[m,u[D]])),E=new CustomEvent(r,{detail:y,bubbles:!a.keeps,composed:!a.keeps,cancelable:!!a.cancelable}),S=this.dispatchEvent(E);if(!S&&a.cancelable){const m=u[u.length-1];(b=m==null?void 0:m.preventDefault)==null||b.call(m)}return S}])));s(this,"getProps",()=>this.props);s(this,"subscribe",r=>(this.listeners.add(r),()=>{this.listeners.delete(r)}))}static get observedAttributes(){return Object.keys(e.attributes)}get element(){return this}get Component(){return c}connectedCallback(){for(const r of n){if(!Object.prototype.hasOwnProperty.call(this,r))continue;const a=this[r];delete this[r],a!=null&&(this.values[r]=a)}this.update(),this.warnOfAria(),q(this.ownerDocument).inject("elements",z),w().then(()=>{this.isConnected&&f.hostOf(this.ownerDocument).connect(this)})}disconnectedCallback(){queueMicrotask(()=>{this.isConnected||f==null||f.hostOf(this.ownerDocument).disconnect(this)})}attributeChangedCallback(){this.update()}warnOfAria(){if(!e.native)for(const r of["aria-label","aria-labelledby","role"])!this.hasAttribute(r)||this.warned.has(r)||(this.warned.add(r),console.warn(`<${e.tag}>: ${r} names the element, a box no reader is told of; Clover names what it draws itself.`))}update(){const r={...this.handlers,...this.values};for(const[a,u]of Object.entries(e.attributes)){if(u.prop in this.values)continue;const y=this.getAttribute(a),E=J(y,u,S=>{const b=`${a}=${y}`;this.warned.has(b)||(this.warned.add(b),console.warn(`<${e.tag}>: ${a}="${y}" ${S}; ignored.`))});E!==void 0&&(r[u.prop]=E)}K(r,this.props)||(this.props=r,this.listeners.forEach(a=>a()))}}s(g,"initCloverI18n",H);for(const l of n)Object.defineProperty(g.prototype,l,{configurable:true,enumerable:true,get(){return l in this.values?this.values[l]:this.getProps()[l]},set(h){h==null?delete this.values[l]:this.values[l]=h,this.update()}});for(const[,l]of i){if(!l.keeps)continue;const h=l.keeps;Object.defineProperty(g.prototype,h,{configurable:true,enumerable:true,get(){return this.kept[h]??null}})}customElements.define(e.tag,g)}const G={tag:"clover-panel",kind:"part",needsRoot:true,attributes:{layout:{prop:"layout",type:["tabs","accordion"]},value:{prop:"value",type:"string"},"heading-level":{prop:"headingLevel",type:"number",min:1},download:{prop:"download",type:"boolean"},closable:{prop:"closable",type:"boolean"},"close-on-escape":{prop:"closeOnEscape",type:"boolean"},as:{prop:"as",type:["aside","div"]}},events:{"clover-value-change":{prop:"onValueChange",detail:["value"]},"clover-close":{prop:"onClose",detail:[],cancelable:true}}},Y={tag:"clover-tab",kind:"config",attributes:{value:{prop:"value",type:"string"},label:{prop:"label",type:"string"}},slots:["label"]},Z={tag:"clover-panel-toggle",kind:"part",attributes:{controls:{prop:"controls",type:"string"}},events:{"clover-open-change":{prop:"onOpenChange",detail:["open"],cancelable:true}}},X={tag:"clover-split",kind:"part",native:true,attributes:{"storage-key":{prop:"storageKey",type:"string"}}},ee={tag:"clover-split-pane",kind:"part",native:true,attributes:{size:{prop:"size",type:"string"},min:{prop:"min",type:"string"},max:{prop:"max",type:"string"},name:{prop:"name",type:"string"}}},te={tag:"clover-split-handle",kind:"part",native:true,attributes:{}},M={"clover-ready":{prop:"onReady",detail:["handle"],keeps:"handle"}},oe={tag:"clover-canvas",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},src:{prop:"src",type:"string"},tiled:{prop:"isTiledImage",type:"boolean"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},navigator:{prop:"navigator",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"},"viewing-direction":{prop:"viewingDirection",type:["left-to-right","right-to-left","top-to-bottom","bottom-to-top"]},"animate-annotations":{prop:"animateAnnotations",type:"boolean"}},properties:["iiifContent","canvases","src","annotations","options","controlButtons","controls"],events:{...M,"clover-annotation-select":{prop:"onAnnotationSelect",detail:["id"]},"clover-annotation-active":{prop:"onAnnotationActive",detail:["id"]},"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},ne={tag:"clover-timeline",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"}},properties:["iiifContent","timeline","annotations","options","controls"],events:{"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},re={tag:"clover-scene",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},label:{prop:"label",type:"string"},language:{prop:"language",type:"string"},controls:{prop:"controls",type:"boolean"},engine:{prop:"engine",type:["clover","three"]}},properties:["iiifContent","scene","options","controls"]},ae={tag:"clover-body",kind:"part",needsRoot:true,attributes:{controls:{prop:"controls",type:"boolean"},navigator:{prop:"navigator",type:"boolean"},placeholder:{prop:"placeholder",type:"boolean"},"animate-annotations":{prop:"animateAnnotations",type:"boolean"}},properties:["controls","options","controlButtons","renderers"],events:{...M,"clover-annotation-active":{prop:"onAnnotationActive",detail:["id"]},"clover-caption-change":{prop:"onCaptionChange",detail:["caption"]},"clover-ended":{prop:"onEnded",detail:[]}}},ie={tag:"clover-items",kind:"part",attributes:{layout:{prop:"layout",type:["slider","list","grid","pager"]},of:{prop:"of",type:["views","members"]},navigation:{prop:"navigation",type:["id","homepage"]},"iiif-content":{prop:"iiifContent",type:"string"},header:{prop:"header",type:"boolean"},"heading-level":{prop:"headingLevel",type:"number",min:2},"thumbnail-size":{prop:"thumbnailSize",type:"number",min:1},language:{prop:"language",type:"string"}},properties:["iiifContent","items","request","renderItem"],events:{"clover-select":{prop:"onSelect",detail:["item"],cancelable:true}}},le=["span","p","div","strong","em","h1","h2","h3","h4","h5","h6"],se={tag:"clover-label",kind:"part",attributes:{of:{prop:"of",type:["manifest","canvas"]},as:{prop:"as",type:le},label:{prop:"label",type:"data"}},properties:["label"]},pe={prop:"of",type:["manifest","canvas"]},T={prop:"value",type:"data"},d=(e,t={})=>({tag:e,kind:"part",attributes:{of:pe,value:T,...t},properties:["value"]}),ce=d("clover-summary",{as:{prop:"as",type:["p","div","span"]}}),de={...d("clover-metadata"),properties:["value","renderValue"]},ue=d("clover-required-statement"),ve=d("clover-rights"),ge=d("clover-id"),me=d("clover-homepage"),he=d("clover-rendering"),ye=d("clover-see-also"),be=d("clover-part-of"),fe=d("clover-thumbnail",{size:{prop:"size",type:"number",min:1},alt:{prop:"alt",type:"string"}}),ke=d("clover-provider",{link:{prop:"link",type:["false"]}}),Ce=d("clover-logo",{alt:{prop:"alt",type:"string"}}),we={tag:"clover-value",kind:"part",attributes:{value:T,format:{prop:"format",type:"string"},"heading-level":{prop:"headingLevel",type:"number",min:1},as:{prop:"as",type:["span","p","div"]}},properties:["value"]},Ee={tag:"clover-root",kind:"root",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},"canvas-id":{prop:"canvasId",type:"string"},"manifest-id":{prop:"manifestId",type:"string"},language:{prop:"language",type:"string"},"search-query":{prop:"searchQuery",type:"string"},annotations:{prop:"annotations",type:"data"},"annotation-pages":{prop:"annotationPages",type:["view","all"]},lang:{prop:"lang",type:"string"}},properties:["iiifContent","annotations","request","renderers"],events:{"clover-ready":{prop:"onReady",detail:["clover"],keeps:"clover"},"clover-canvas-change":{prop:"onCanvasChange",detail:["canvasId"]},"clover-manifest-change":{prop:"onManifestChange",detail:["manifestId"]},"clover-status-change":{prop:"onStatusChange",detail:["status","error"]},"clover-content-state-change":{prop:"onContentStateChange",detail:"first"}}},k={"heading-level":{prop:"headingLevel",type:"number",min:1}},P={of:{prop:"of",type:["views","members"]}},Se={tag:"clover-status",kind:"part",needsRoot:true,attributes:{loading:{prop:"loading",type:["false"]}},slots:["loading","error"]},Oe={tag:"clover-position",kind:"part",needsRoot:true,attributes:{...P,as:{prop:"as",type:["span","p","div"]}}},Re={tag:"clover-next",kind:"part",needsRoot:true,attributes:P},Ae={tag:"clover-previous",kind:"part",needsRoot:true,attributes:P},Pe={tag:"clover-download",kind:"part",needsRoot:true,attributes:k},je={tag:"clover-search",kind:"part",needsRoot:true,attributes:{...k,sticky:{prop:"sticky",type:"boolean"},size:{prop:"size",type:["large","small"]}}},Ie={tag:"clover-contents",kind:"part",needsRoot:true,attributes:{}},Le={tag:"clover-transcript",kind:"part",needsRoot:true,attributes:{follow:{prop:"follow",type:"boolean"},find:{prop:"find",type:"boolean"},sticky:{prop:"sticky",type:"boolean"},size:{prop:"size",type:["large","small"]}}},xe={tag:"clover-annotations",kind:"part",needsRoot:true,attributes:{scope:{prop:"scope",type:["view","all"]},...k},properties:["renderEntry"]},qe={tag:"clover-collection",kind:"part",needsRoot:true,attributes:k},ze={tag:"clover-collection-select",kind:"part",needsRoot:true,attributes:{},events:{"clover-change":{prop:"onChange",detail:["manifestId"]}}},Me={tag:"clover-about",kind:"part",needsRoot:true,attributes:{"canvas-summary":{prop:"canvasSummary",type:"boolean"},download:{prop:"download",type:"boolean"},thumbnail:{prop:"thumbnail",type:"boolean"},label:{prop:"label",type:"boolean"},...k}},Te={tag:"clover-map",kind:"part",attributes:{"iiif-content":{prop:"iiifContent",type:"string"},overlay:{prop:"overlay",type:"boolean"},"overlay-opacity":{prop:"overlayOpacity",type:"number",min:0},"style-url":{prop:"styleUrl",type:"string"},"scroll-zoom":{prop:"scrollZoom",type:"boolean"},language:{prop:"language",type:"string"}},properties:["iiifContent","navPlace","georeferences","request"],events:{"clover-select":{prop:"onSelect",detail:["feature"]}}},De={tag:"clover-read-more",kind:"part",attributes:{}},$e={tag:"clover-tip",kind:"part",attributes:{label:{prop:"label",type:"string"},lang:{prop:"lang",type:"string"},keys:{prop:"keys",type:"string"},glyph:{prop:"glyph",type:"string"}},properties:["shortcut"]},Ue={tag:"clover-viewer",kind:"alone",attributes:{template:{prop:"template",type:["default","document","gallery"]},"iiif-content":{prop:"iiifContent",type:"string"},"canvas-id":{prop:"defaultCanvasId",type:"string"},"manifest-id":{prop:"defaultManifestId",type:"string"},language:{prop:"language",type:"string"},"search-query":{prop:"searchQuery",type:"string"},annotations:{prop:"annotations",type:"data"},"heading-level":{prop:"headingLevel",type:"number",min:2},items:{prop:"items",type:["slider","list","grid","false"]},header:{prop:"header",type:"boolean"},panel:{prop:"panel",type:"boolean"},download:{prop:"download",type:"boolean"},"panel-open":{prop:"defaultPanelOpen",type:"boolean"},"panel-layout":{prop:"panelLayout",type:["accordion","tabs"]},"sidebar-open":{prop:"defaultSidebarOpen",type:"boolean"},"storage-key":{prop:"storageKey",type:"string"},fill:{prop:"fill",type:"boolean"},size:{prop:"size",type:"string"}},properties:["iiifContent","annotations","request","renderers"],events:{"clover-canvas-change":{prop:"onCanvasChange",detail:["canvasId"]},"clover-manifest-change":{prop:"onManifestChange",detail:["manifestId"]},"clover-status-change":{prop:"onStatusChange",detail:["status","error"]},"clover-content-state-change":{prop:"onContentStateChange",detail:"first"}}},I=[Ue,Ee,ae,se,ie,Oe,Ae,Re,Se,fe,ce,de,ue,ve,me,ye,he,be,ge,ke,Ce,we,Me,xe,qe,ze,Ie,je,Le,Pe,Te,G,Y,Z,X,ee,te,oe,ne,re,$e,De],p=(e,t,o)=>()=>Promise.all([e(),import("./part-cUiPs2-y.mjs")]).then(([n,{drawn:i}])=>i(n[t],o)),O=e=>()=>import("./split-CYuMjp89.mjs").then(t=>t[e]),v=e=>p(()=>import("./Primitives-XQO3m1wG.mjs"),e),R=e=>p(()=>import("./Pager-Di_2hHM3.mjs"),e),Ne={"clover-viewer":()=>import("./viewer-DEHIsIHd.mjs").then(e=>e.v).then(e=>e.ViewerElement),"clover-root":()=>import("./shared-YUjOSBKO.mjs").then(e=>e.as).then(e=>e.RootElement),"clover-label":()=>import("./label-Vbg_cMOJ.mjs").then(e=>e.LabelElement),"clover-body":()=>import("./body-CKjwwFep.mjs").then(e=>e.BodyElement),"clover-items":()=>import("./items-jfQ5XzEj.mjs").then(e=>e.ItemsElement),"clover-position":R("Position"),"clover-previous":R("Previous"),"clover-next":R("Next"),"clover-status":()=>import("./status-Ms5L0ghK.mjs").then(e=>e.StatusElement),"clover-thumbnail":v("Thumbnail"),"clover-summary":v("Summary"),"clover-metadata":p(()=>import("./Primitives-XQO3m1wG.mjs"),"Metadata",["renderValue"]),"clover-required-statement":v("RequiredStatement"),"clover-rights":v("Rights"),"clover-homepage":v("Homepage"),"clover-see-also":v("SeeAlso"),"clover-rendering":v("Rendering"),"clover-part-of":v("PartOf"),"clover-id":v("Id"),"clover-provider":()=>import("./provider-C1wKfdjb.mjs").then(e=>e.ProviderElement),"clover-logo":()=>import("./logo-Boy6u4m2.mjs").then(e=>e.LogoElement),"clover-value":v("Value"),"clover-about":p(()=>import("./About-DbrFSVBm.mjs"),"About"),"clover-annotations":p(()=>import("./Annotations-Cb9U7HJ_.mjs"),"Annotations",["renderEntry"]),"clover-collection":p(()=>import("./Collection-B1Le2_TU.mjs"),"Collection"),"clover-collection-select":p(()=>import("./CollectionSelect-BL_jQog-.mjs"),"CollectionSelect"),"clover-contents":p(()=>import("./Contents-zYEGHLfe.mjs"),"Contents"),"clover-search":p(()=>import("./Search-ZV8FFN4p.mjs"),"Search"),"clover-transcript":p(()=>import("./Transcript-D0gUxUoA.mjs"),"Transcript"),"clover-download":p(()=>import("./Download-DqU-goFi.mjs"),"Download"),"clover-map":p(()=>import("./Map-Bcgp_R8H.mjs"),"CloverMap"),"clover-panel":()=>import("./panel-CjXfre-g.mjs").then(e=>e.PanelElement),"clover-panel-toggle":()=>import("./toggle-BQTjR1I3.mjs").then(e=>e.PanelToggleElement),"clover-split":O("SplitElement"),"clover-split-pane":O("SplitPaneElement"),"clover-split-handle":O("SplitHandleElement"),"clover-canvas":()=>import("./canvas-CIzpp-Uz.mjs").then(e=>e.CanvasElement),"clover-timeline":p(()=>import("./Timeline-ByyVSd7B.mjs"),"Timeline"),"clover-scene":p(()=>import("./Scene-BTWpLeec.mjs"),"Scene"),"clover-tip":()=>import("./tip-dWhupWSr.mjs").then(e=>e.TipElement),"clover-read-more":()=>import("./read-more-DNHNtG-a.mjs").then(e=>e.ReadMoreElement)};function He(e,t=I.map(({tag:o})=>o)){e.mapWorkerUrl&&N(e.mapWorkerUrl);for(const o of I)t.includes(o.tag)&&_(o,Ne[o.tag])}const Ve=""+new URL("assets/maplibre-gl-worker-kTz9OPxr.js",import.meta.url).href,We={mapWorkerUrl:Ve};He(We);export{Je as a,He as d,Fe as g,H as i};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as n,i as o}from"./index-
|
|
1
|
+
import{d as n,i as o}from"./index-B7nZdqLg.mjs";export{n as defineCloverElements,o as initCloverI18n};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{j as p,E as u,o as r,O as v}from"./shared-
|
|
1
|
+
import{j as p,E as u,o as r,O as v}from"./shared-YUjOSBKO.mjs";function g(t){var i;return(i=v(t).find(({body:a})=>a.type))==null?void 0:i.body.type}function o(t){const i=g(t)??(t.type==="Timeline"?"Sound":void 0);return{id:t.id,type:t.type,label:t.label,resource:t,duration:Number(t.duration)||void 0,media:i}}const s=new WeakMap;function m(t){if(!t)return[];let i=s.get(t);if(!i){const{canvases:a,views:e}=u(t);i=e.map(y=>{const n=y.map(l=>o(a[l]));return{id:n[0].id,parts:n,label:n.length===1?n[0].label:{none:[n.map(l=>r(l.label).text).filter(Boolean).join(" \u2013 ")]}}}),s.set(t,i)}return i}const d=new WeakMap;function f(t){if(!t)return[];let i=d.get(t);return i||(i=p(t.items).filter(a=>a==null?void 0:a.id).map(a=>{var e;return{id:a.id,parts:[o(a)],label:a.label,summary:a.summary,href:((e=p(a.homepage)[0])==null?void 0:e.id)??a.id}}),d.set(t,i)),i}function O(t){return t?Array.isArray(t)?f({items:t}):t.type==="Collection"?f(t):m(t):[]}export{m as a,O as b,f as i};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{T as m,u as r}from"./shared-YUjOSBKO.mjs";import{I as o}from"./Items-DRj1UEpC.mjs";import{w as n}from"./nodes-B7JRwBgl.mjs";function I({props:t}){const e=m(()=>n(t,["renderItem"]),[t]);return r(o,{...e})}export{I as ItemsElement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as e}from"./shared-YUjOSBKO.mjs";import{L as o}from"./Label-D6aVJB9s.mjs";function n({props:r}){return e(o,{...r})}export{n as LabelElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as _,n as B,a3 as J,j as a,J as j}from"./shared-
|
|
1
|
+
import{m as _,n as B,a3 as J,j as a,J as j}from"./shared-YUjOSBKO.mjs";import{f as O}from"./imageService-dsdmcegU.mjs";const Z={width:1600,height:900};function q(e,i){const t=new Array(e.length);if(!e.length)return t;const s=e.map(x),n=i==="left-to-right"||i==="right-to-left",o=i==="right-to-left"||i==="bottom-to-top",h=n?s[0].height:s[0].width,r=e.map((f,d)=>d);o&&r.reverse();let c=0;for(const f of r){const d=s[f],g=h/(n?d.height:d.width),l=d.width*g,p=d.height*g;t[f]=n?{x:c,y:0,width:l,height:p}:{x:0,y:c,width:l,height:p},c+=n?l:p}return t}function x(e){var o,h;if(e.width&&e.height)return{width:e.width,height:e.height};const i=P(e);if(i!=null&&i.width&&i.height)return{width:i.width,height:i.height};const t=((o=C(e)[0])==null?void 0:o.body)??((h=W(e)[0])==null?void 0:h.body),s=Number(t==null?void 0:t.width),n=Number(t==null?void 0:t.height);return s>0&&n>0?{width:s,height:n}:Z}function P(e){return e.accompanyingContainer??e.placeholderContainer}function G(e,i,t,s,n){return`${e.id}|${i.id??`${t}:${s}`}|${n}`}function ot(e){const i=[];for(const t of e)R(t,(s,n)=>{const o=s;if((o==null?void 0:o.type)!=="Choice")return;const h=a(o.items).filter(r=>!!r&&typeof r=="object");h.length>1&&i.push({key:n,canvasId:t.id,label:o.label,items:h.map(r=>({label:r.label,id:r.id}))})});return i}const V=new WeakMap,H=[];function Q(e){var h;const i=V.get(e);if(i)return i;const t=[];for(const r of e.items??[])for(const c of r.items??[]){if(!_(c))continue;const f=c.target?(h=B(c.target))==null?void 0:h.t:void 0;if(!f)continue;const[d,g]=f.split(",").map(Number);Number.isFinite(d)&&t.push({annotation:c,start:d,end:Number.isFinite(g)?g:NaN})}t.sort((r,c)=>r.start-c.start);const s=Number(e.duration),n=Number.isFinite(s)&&s/t.length||.5;t.forEach((r,c)=>{var d;const f=(d=t[c+1])==null?void 0:d.start;f!=null?r.end=f>r.start?f:r.start+n:Number.isFinite(s)&&s>r.start?r.end=s:r.end>r.start||(r.end=r.start+n)});const o=t.length>1?t:H;return V.set(e,o),o}const F=e=>`frame:${e.id}`;function R(e,i){(e.items??[]).forEach((t,s)=>{(t.items??[]).forEach((n,o)=>{_(n)&&J(n).forEach((h,r)=>i(h,G(e,n,s,o,r),n))})})}function C(e,i={},{allFrames:t=false}={}){const s=[];return K(e,i,(n,o,h)=>{n.body.type==="Image"&&s.push({body:n.body,region:n.region,target:o,...h>=0?{frame:h}:{}})},t),s}function W(e,i={}){const t=[];return K(e,i,(s,n)=>{const o=s.body.type;o!=="Video"&&!j(o)||t.push({kind:o==="Video"?"video":"audio",body:s.body,target:n})}),t}function K(e,i,t,s=false){const n=e.width??0,o=e.height??0,h=Q(e),r=Math.min(i[F(e)]??0,Math.max(0,h.length-1));R(e,(c,f,d)=>{const g=h.findIndex(N=>N.annotation===d);if(!s&&g>=0&&g!==r)return;const l=A(c,i[f]??0);if(!l)return;const p=d.target?B(d.target):void 0,y=p==null?void 0:p.rect;t(l,y?{x:y.x,y:y.y,width:y.w,height:y.h}:{x:0,y:0,width:n||Number(l.body.width)||0,height:o||Number(l.body.height)||0},g)})}function U(e){const i=[],t=[...e.annotations??[],...e.items??[]];for(const s of t)for(const n of s.items??[])if(a(n.motivation).includes("supplementing"))for(const o of a(n.body)){const h=o,r=(h==null?void 0:h.type)==="Choice"?a(h.items):[h];for(const c of r){const f=c==null?void 0:c.id;!((c==null?void 0:c.format)==="text/vtt"||typeof f=="string"&&/\.vtt(\?|$)/i.test(f))||typeof f!="string"||i.push({id:f,label:c.label,language:a(c.language)[0]})}}return i}function it(e){const i=[],t=n=>{const o=n,h=o==null?void 0:o.id;if(typeof h!="string"||i.some(c=>c.id===h))return;const r=o==null?void 0:o.format;(r?r!=="text/plain":!/\.txt(\?|$)/i.test(h))||i.push({id:h,label:o==null?void 0:o.label,language:a(o==null?void 0:o.language)[0]})},s=[...e.annotations??[],...e.items??[]];for(const n of s)for(const o of n.items??[])if(a(o.motivation).includes("supplementing"))for(const h of a(o.body)){const r=h;((r==null?void 0:r.type)==="Choice"?a(r.items):[r]).forEach(t)}return a(e.rendering).forEach(t),i}function A(e,i=0){if(!e||typeof e!="object")return null;const t=e;if(t.type==="Choice"){const s=a(t.items);return A(s[i]??s[0])}if(t.type==="SpecificResource"&&t.source){const s=typeof t.source=="string"?{id:t.source}:t.source,n=a(t.selector).find(h=>(h==null?void 0:h.type)==="ImageApiSelector"&&h.region),o=A({type:"Image",...s});return o?{...o,region:(n==null?void 0:n.region)??o.region}:null}return t.type!=="Image"&&t.type!=="Video"&&!j(t.type)?null:{body:t,region:typeof t.region=="string"?t.region:void 0}}function nt(e,i,t={},{standIns:s=true}={}){const n=q(e,i),o=[],h=[],r={};return e.forEach((c,f)=>{const d=n[f],g=x(c),l=d.width/g.width,p=d.height/g.height,y=u=>({x:d.x+u.x*l,y:d.y+u.y*p,width:u.width*l,height:u.height*p}),N=W(c,t),E=C(c,t,{allFrames:true}).map(u=>({...u,canvas:c})),S=P(c);if(s&&!E.length&&N.some(u=>u.kind==="audio")&&S){const u=x(S);for(const b of C(S))E.push({...b,canvas:S,target:{x:b.target.x/u.width*g.width,y:b.target.y/u.height*g.height,width:b.target.width/u.width*g.width,height:b.target.height/u.height*g.height}})}const L=t[F(c)]??0;E.forEach(({body:u,target:b,region:I,frame:w,canvas:v},D)=>{var T;const $=O(u.service);if(!$&&!u.id)return;const z=`${v.id}|${D}|${u.id??$}|${I??""}`,M=!($&&I);if(o.push({id:z,service:$,url:u.id,width:M&&Number(u.width)||void 0,height:M&&Number(u.height)||void 0,region:I,placement:y(b),...w!=null&&w!==L?{hidden:true}:{}}),w!=null){const k=r[T=F(c)]??(r[T]=[]);(k[w]??(k[w]=[])).push(z)}});const[m]=N;m!=null&&m.body.id&&h.push({id:`${c.id}|media|${m.body.id}`,kind:m.kind,src:m.body.id,format:m.body.format,placement:y(m.target),duration:Number(m.body.duration??c.duration)||void 0,poster:X(c),captions:U(c)})}),{images:o,media:h,placements:n,frames:r}}function X(e){var i;return(i=Y(e))==null?void 0:i.source}const rt=1280;function Y(e){var c;const i=e.placeholderContainer;if(!i)return;const t=(c=C(i)[0])==null?void 0:c.body;if(!t)return;const s=O(t.service),n=typeof t.id=="string"?t.id:void 0,o=s?{service:s,fallback:n}:n?{src:n}:void 0;if(!o)return;const{width:h,height:r}=x(i);return{source:o,width:h,height:r}}function st(e,i,t){const s=x(e),n=i.width/s.width,o=i.height/s.height;return{x:i.x+t.x*n,y:i.y+t.y*o,width:t.width*n,height:t.height*o}}export{rt as S,it as a,Q as b,U as c,nt as d,F as e,ot as f,st as g,x as h,W as i,Y as p,A as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{t as g,r as k,m as y}from"./text-BTAkxEfQ.mjs";import{o as d,j as v,a3 as T,n as A}from"./shared-
|
|
1
|
+
import{t as g,r as k,m as y}from"./text-BTAkxEfQ.mjs";import{o as d,j as v,a3 as T,n as A}from"./shared-YUjOSBKO.mjs";function w(s,n){const t=(e,r)=>e?{text:e,...r?{lang:r}:{}}:{},i=s.filter(e=>{var r;return(r=e.value)==null?void 0:r.trim()});if(!i.length){const e=s.find(u=>u.image&&u.label);if(!e)return{};const{text:r,lang:m}=d(e.label,n);return t(g(r).trim(),m)}const f=e=>e.language&&e.language!=="none"?e.language:"none",o={};i.forEach((e,r)=>{var m;o[m=f(e)]??(o[m]=[String(r)])});const a=i[Number(d(o,n).text)||0],l=a.value,p=k(a.format,l),x=p==="markdown"?y(l):p==="html"?g(l):l,c=f(a);return t(x.trim(),c==="none"?void 0:c)}function C(s){if(v(s==null?void 0:s.motivation).includes("linking"))for(const n of T(s)){if((n==null?void 0:n.type)==="TextualBody"||typeof(n==null?void 0:n.value)=="string")continue;const t=(n==null?void 0:n.type)==="SpecificResource"?n.source:n,i=typeof t=="string"?t:t==null?void 0:t.id;if(!(typeof i!="string"||!i)){if((t==null?void 0:t.type)==="Canvas"){const f=v(t.partOf).find(a=>(a==null?void 0:a.id)&&(!a.type||a.type==="Manifest")),o=A(i).id;return{id:i,canvasId:o,...f?{manifestId:f.id}:{}}}if((t==null?void 0:t.type)==="Manifest"||(t==null?void 0:t.type)==="Collection")return{id:i,manifestId:i};if(/^https?:\/\//i.test(i))return{id:i}}}}export{w as a,C as r};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{u as t}from"./shared-YUjOSBKO.mjs";import{L as n}from"./Provider-B61118lU.mjs";function i({hosted:o,props:r}){var e;return((e=o.element.parentElement)==null?void 0:e.localName)==="clover-provider"?null:t(n,{...r})}export{i as LogoElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{m as M,a3 as l,j as f}from"./shared-
|
|
1
|
+
import{m as M,a3 as l,j as f}from"./shared-YUjOSBKO.mjs";const m=45,d=75*Math.PI/180,h=5*Math.PI/180,p=Math.PI-h,y=1.1,g=.35,I=4;function P(n,a=1){const t=m*Math.PI/180,o=2*Math.atan(Math.tan(t/2)*a),s=Math.min(t,o);return Math.max(n,1e-6)/Math.sin(s/2)*y}function x(n,a=1){return{theta:0,phi:d,distance:P(n.radius,a)}}function E(n,a,t){return{...n,theta:n.theta+a,phi:Math.min(p,Math.max(h,n.phi+t))}}function R(n,a,t){const o=n.distance/a;return{...n,distance:Math.min(t.distance*I,Math.max(t.distance*g,o))}}function z(n,a){const{theta:t,phi:o,distance:s}=n;return[a[0]+s*Math.sin(o)*Math.sin(t),a[1]+s*Math.cos(o),a[2]+s*Math.sin(o)*Math.cos(t)]}function A(n,a){const t=(s,i)=>Math.abs(s-i)<1e-6,o=(n.theta-a.theta)%(2*Math.PI);return(t(o,0)||t(Math.abs(o),2*Math.PI))&&t(n.phi,a.phi)&&t(n.distance,a.distance)}const O=["model/gltf-binary","model/gltf+json"],c=(n,a)=>{const t=Number(n);return Number.isFinite(t)?t:a};function F(n){return n.format?O.includes(n.format.toLowerCase()):/\.(glb|gltf)(\?|#|$)/i.test(n.src)}function b(n){return f(n.transform).flatMap(a=>{const t=a,o=(t==null?void 0:t.type)==="ScaleTransform"?"scale":(t==null?void 0:t.type)==="RotateTransform"?"rotate":(t==null?void 0:t.type)==="TranslateTransform"?"translate":null;if(!o||!t)return[];const s=o==="scale"?1:0;return[{type:o,x:c(t.x,s),y:c(t.y,s),z:c(t.z,s)}]})}function S(n){for(const a of f(n)){const t=a;if((t==null?void 0:t.type)!=="SpecificResource")continue;const o=f(t.selector).find(s=>(s==null?void 0:s.type)==="PointSelector");if(o)return[c(o.x,0),c(o.y,0),c(o.z,0)]}return[0,0,0]}const u=new WeakMap;function _(n){const a=u.get(n);if(a)return a;const t=[];for(const o of n.items??[])for(const s of(o==null?void 0:o.items)??[])if(M(s))for(let i of l(s)){(i==null?void 0:i.type)==="Choice"&&(i=f(i.items)[0]);const r=(i==null?void 0:i.type)==="SpecificResource"?i:null,e=r?typeof r.source=="string"?{id:r.source,type:"Model"}:r.source:i;(e==null?void 0:e.type)!=="Model"||typeof e.id!="string"||t.push({id:String(s.id??e.id),src:e.id,...typeof e.format=="string"?{format:e.format}:{},...e.label?{label:e.label}:{},position:S(s.target),transforms:r?b(r):[]})}return u.set(n,t),t}function w(n){const a=n.backgroundColor;return typeof a=="string"&&/^#([0-9a-f]{3}|[0-9a-f]{6})$/i.test(a)?a:void 0}export{m as F,O as M,w as a,A as b,z as c,x as h,F as i,_ as s,E as t,R as z};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{A as i,q as f,C as p,_ as l,u as a}from"./shared-
|
|
1
|
+
import{A as i,q as f,C as p,_ as l,u as a}from"./shared-YUjOSBKO.mjs";const b={childList:true,subtree:true,attributes:true,attributeFilter:["value","label","slot","controls"]};function h(t,e,n){const r=i(null),o=f(s=>{const u=new MutationObserver(s);return u.observe(t,b),()=>u.disconnect()},[t]);return p(o,()=>{const s=e();return r.current&&n(r.current.value,s)?r.current.value:(r.current={value:s},s)})}const v=(t,e)=>[...t.children].find(n=>n.getAttribute("slot")===e)??null;function y(t,e){return h(t,()=>v(t,e),Object.is)}function C({of:t}){const e=i(null);return l(()=>{const n=e.current;if(!n)return;const r=()=>n.replaceChildren(...[...t.childNodes].map(c=>c.cloneNode(true)));r();const o=new MutationObserver(r);return o.observe(t,{childList:true,subtree:true,characterData:true,attributes:true}),()=>o.disconnect()},[t]),a("span",{ref:e,style:{display:"contents"}})}function M({from:t,stays:e}){const n=i(null);return l(()=>{const r=n.current;if(!r)return;const o=()=>{for(const s of[...t.childNodes])e(s)||r.append(s)};o();const c=new MutationObserver(o);return c.observe(t,{childList:true}),()=>{c.disconnect(),t.append(...r.childNodes)}},[t,e]),a("div",{ref:n,style:{display:"contents"}})}function O({from:t,picks:e}){const n=i(null);return l(()=>{const r=n.current;if(!r)return;let o=[];const c=()=>{const u=[...t.childNodes].filter(e);u.length&&(o=o.filter(d=>d.parentNode===r.parentNode),(o.at(-1)??r).after(...u),o.push(...u))};c();const s=new MutationObserver(c);return s.observe(t,{childList:true}),()=>{s.disconnect();for(const u of o)u.parentNode===r.parentNode&&t.append(u)}},[t,e]),a("span",{ref:n,hidden:true})}function N({value:t}){const e=i(null);return l(()=>{var n;(n=e.current)==null||n.replaceChildren(t instanceof Node?t:String(t))},[t]),a("span",{ref:e,style:{display:"contents"}})}function g(t,e){let n=t;for(const r of e){const o=t[r];typeof o=="function"&&(n={...n,[r]:(...c)=>{const s=o(...c);return s==null?s:a(N,{value:s})}})}return n}export{C,M,O as P,y as a,v as s,h as u,g as w};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{f as c,b as s}from"./imageService-
|
|
1
|
+
import{f as c,b as s}from"./imageService-dsdmcegU.mjs";import{s as a}from"./sizedImage-uv_NlE0l.mjs";async function l(r,o,i){const t=typeof r.id=="string"?r.id:void 0,e=c(r.service);if(!e)return t;try{const n=await s(e,{request:i});return a(n,o)??t}catch{return t}}export{l as overlayImageUrl};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{d as v,A as g,y as p,u as s}from"./shared-
|
|
1
|
+
import{d as v,A as g,y as p,u as s}from"./shared-YUjOSBKO.mjs";import{T as y,P as S}from"./Panel-DbsC8A9V.mjs";import{u as b,M as C,C as w,s as A}from"./nodes-B7JRwBgl.mjs";const k=l=>[...l.children].filter(t=>t.localName==="clover-tab").map((t,e)=>{const n=t.getAttribute("value")||String(e);return{element:t,value:n,label:t.getAttribute("label")||n,labelSlot:A(t,"label")}}),E=(l,t)=>l.length===t.length&&l.every((e,n)=>e.element===t[n].element&&e.value===t[n].value&&e.label===t[n].label&&e.labelSlot===t[n].labelSlot),M=l=>l instanceof Element&&l.getAttribute("slot")==="label",a=new WeakMap;let O=0;const P=l=>(a.has(l)||a.set(l,++O),a.get(l));function T(l){const t=l.ownerDocument;for(let e=l;e&&e!==t.body;e=e.parentElement){if(!e.id)continue;const n=e.id.replace(/["\\]/g,"\\$&");if(t.querySelector(`[aria-controls~="${n}"]`)){e.hidden=true;return}}l.hidden=true}function q({hosted:l,props:t}){const e=l.element,n=b(e,()=>k(e),E),{value:r,closable:i,onValueChange:m,onClose:f,...d}=t,[h,c]=v(r),u=g(r);return p(()=>{r!==u.current&&(u.current=r,r&&c(r))},[r]),s(S,{...d,value:h,onValueChange:o=>{c(o),m(o)},onClose:i?()=>{f()&&T(e)}:void 0,children:n.length?n.map(o=>s(y,{value:o.value,label:o.labelSlot?s(w,{of:o.labelSlot}):o.label,children:s(C,{from:o.element,stays:M})},P(o.element))):null})}export{q as PanelElement};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
import{T as i,u as e}from"./shared-YUjOSBKO.mjs";import{w as u}from"./nodes-B7JRwBgl.mjs";function a(r,t=[]){return function({props:n}){const o=i(()=>u(n,t),[n]);return e(r,{...o})}}export{a as drawn};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as y,c as L,b as E,T as v}from"./ErrorBoundary-
|
|
1
|
+
import{a as y,c as L,b as E,T as v}from"./ErrorBoundary-chQaO-Up.mjs";const b=r=>{const s=new Map,p=e=>{var t;return(t=s.get(e))==null?void 0:t.forEach(i=>i())};let a=false,o=null,n=null,d=false,l=null;const u=e=>{y(e)&&(d=true)},m=e=>{l=e.isPrimary&&e.button===0&&(e.target===r||e.target===n)?{x:e.clientX,y:e.clientY,t:e.timeStamp,direct:L(e.pointerType,d)}:null},f=e=>{const t=l;l=null,!(!t||e.timeStamp-t.t>=E||Math.hypot(e.clientX-t.x,e.clientY-t.y)>v)&&!(o!=null&&o())&&!t.direct&&p("tap")},c=e=>{e!==n&&(n==null||n.remove(),n=e,n&&(Object.assign(n.style,{position:"absolute",inset:"0",width:"100%",height:"100%",objectFit:"contain"}),n.classList.add("clover-canvas-dom-media"),r.append(n)))};return r.addEventListener("pointermove",u),r.addEventListener("pointerdown",m),r.addEventListener("pointerup",f),{host:r,get isOpen(){return a},on(e,t){const i=s.get(e)??new Set;return s.set(e,i.add(t)),()=>i.delete(t)},async setImages(e,{world:t}={}){var i,g;c(((g=(i=e.find(w=>w.media))==null?void 0:i.media)==null?void 0:g.element)??null),!(!t&&!e.length)&&(p(a?"change":"open"),a=true)},clear:()=>c(null),setDismiss(e){o=e},setGestures(){},dispose(){c(null),s.clear(),r.removeEventListener("pointermove",u),r.removeEventListener("pointerdown",m),r.removeEventListener("pointerup",f)}}};export{b as p};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as r}from"./shared-
|
|
1
|
+
import{u as r}from"./shared-YUjOSBKO.mjs";import{L as n,P as a}from"./Provider-B61118lU.mjs";import{u as i}from"./nodes-B7JRwBgl.mjs";const s=t=>[...t.children].filter(e=>e.localName==="clover-logo").map(e=>({element:e,alt:e.getAttribute("alt")??void 0})),c=(t,e)=>t.length===e.length&&t.every((l,o)=>l.element===e[o].element&&l.alt===e[o].alt);function u({hosted:t,props:e}){const l=i(t.element,()=>s(t.element),c);return r(a,{...e,children:l.length?l.map((o,m)=>r(n,{alt:o.alt},m)):void 0})}export{u as ProviderElement};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{a as m,M as f,b,A as v,_ as a,u as p}from"./shared-
|
|
1
|
+
import{a as m,M as f,b,A as v,_ as a,u as p}from"./shared-YUjOSBKO.mjs";import{u as g}from"./ReadMore-BJH-qqte.mjs";import{u as L}from"./nodes-B7JRwBgl.mjs";const M=o=>[...o.children].find(r=>!r.classList.contains("clover-read-more-button"))??null;function R({hosted:o}){const r=o.element,e=L(r,()=>M(r),Object.is),{t:s}=m(),i=f(),n=b(),c=v(null);c.current=e;const{open:t,cut:l,toggle:u}=g(c);return a(()=>(r.classList.add("clover-read-more"),()=>r.classList.remove("clover-read-more")),[r]),a(()=>{if(!e)return;const d=e.id;return d||(e.id=n),()=>{d||e.removeAttribute("id"),e.removeAttribute("data-read-more")}},[e,n]),a(()=>{e==null||e.setAttribute("data-read-more",t?"open":"")},[e,t]),!e||!(l||t)?null:p("button",{type:"button",className:"clover-read-more-button","aria-expanded":t,"aria-controls":e.id||n,onClick:u,ref:i.ref,lang:i.langOf(t?"readLess":"readMore"),children:s(t?"readLess":"readMore")})}export{R as ReadMoreElement};
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
var wt=Object.defineProperty;var yt=(r,t,e)=>t in r?wt(r,t,{enumerable:true,configurable:true,writable:true,value:e}):r[t]=e;var h=(r,t,e)=>yt(r,typeof t!="symbol"?t+"":t,e);import{c as xt,r as V}from"./contexts-ByL3eA_T.mjs";import{c as P,s as S,t as I,a as vt,u as ct,i as bt,b as k,d as Tt,r as Et}from"./CanvasView-
|
|
1
|
+
var wt=Object.defineProperty;var yt=(r,t,e)=>t in r?wt(r,t,{enumerable:true,configurable:true,writable:true,value:e}):r[t]=e;var h=(r,t,e)=>yt(r,typeof t!="symbol"?t+"":t,e);import{c as xt,r as V}from"./contexts-ByL3eA_T.mjs";import{c as P,s as S,t as I,a as vt,u as ct,i as bt,b as k,d as Tt,r as Et}from"./CanvasView-BI3YzNdK.mjs";import{a as F,w as Mt,v as D,f as Y,s as $,b as Lt,c as _t}from"./Camera-cdCqKMup.mjs";import{i as Q,a as kt,T as It,b as j,c as J,D as At,s as Pt}from"./ErrorBoundary-chQaO-Up.mjs";import{a0 as St,a1 as Rt}from"./shared-YUjOSBKO.mjs";import{a as Bt,i as tt,b as Ot}from"./imageService-dsdmcegU.mjs";function Ct(r){return typeof HTMLImageElement<"u"&&r instanceof HTMLImageElement?r.complete&&r.naturalWidth>0:true}function zt(r,t){if(!r.bleed)return{x:0,y:0};const e=r.transform,i=Math.hypot(e.a,e.b)*t,s=Math.hypot(e.c,e.d)*t;return{x:r.bleed.right&&i>0?1/i:0,y:r.bleed.bottom&&s>0?1/s:0}}const Ut=`#version 300 es
|
|
2
2
|
in vec2 a_position;
|
|
3
3
|
uniform mat3 u_matrix;
|
|
4
4
|
uniform vec4 u_crop;
|
|
@@ -19,4 +19,4 @@ out vec4 outColor;
|
|
|
19
19
|
void main() {
|
|
20
20
|
outColor = texture(u_texture, v_uv) * u_opacity;
|
|
21
21
|
}
|
|
22
|
-
`;class A{constructor(t,e,i){h(this,"kind","webgl2");h(this,"canvas");h(this,"maxTextureSize");h(this,"gl");h(this,"program",null);h(this,"vao",null);h(this,"uniforms",{matrix:null,crop:null,opacity:null,texture:null});h(this,"textures",new Map);h(this,"cssWidth",1);h(this,"cssHeight",1);h(this,"pixelRatio",1);h(this,"matrixScratch",new Float32Array(9));h(this,"isLost",false);h(this,"callbacks");h(this,"handleLost",()=>{var t2,e2;this.isLost=true,this.textures.clear(),(e2=(t2=this.callbacks).onLost)==null||e2.call(t2)});this.canvas=t,this.gl=e,this.callbacks=i,this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)||4096;const s=Ft(e,Ut,Wt);this.program=s,this.uniforms={matrix:e.getUniformLocation(s,"u_matrix"),crop:e.getUniformLocation(s,"u_crop"),opacity:e.getUniformLocation(s,"u_opacity"),texture:e.getUniformLocation(s,"u_texture")};const o=e.createVertexArray();e.bindVertexArray(o);const n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW);const a=e.getAttribLocation(s,"a_position");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,false,0,0),e.bindVertexArray(null),this.vao=o,e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,false),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),t.addEventListener("webglcontextlost",this.handleLost)}static create(t,e={}){let i=null;try{i=t.getContext("webgl2",{alpha:true,premultipliedAlpha:true,antialias:false,depth:false,stencil:false,preserveDrawingBuffer:false})}catch{i=null}if(!i||typeof i.createShader!="function")return null;try{return new A(t,i,e)}catch{return null}}resize(t,e,i){this.cssWidth=Math.max(1,t),this.cssHeight=Math.max(1,e),this.pixelRatio=i;const s=Math.max(1,Math.round(t*i)),o=Math.max(1,Math.round(e*i));this.canvas.width!==s&&(this.canvas.width=s),this.canvas.height!==o&&(this.canvas.height=o)}begin(){if(this.isLost)return;const t=this.gl;t.viewport(0,0,this.canvas.width,this.canvas.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(this.program),t.bindVertexArray(this.vao),t.activeTexture(t.TEXTURE0),t.uniform1i(this.uniforms.texture,0)}draw(t){if(this.isLost||!Ct(t.source))return"skipped";const e=this.gl,i=this.upload(t);if(i==="tainted")return"tainted";if(!i)return"skipped";const s=t.crop??{x:0,y:0,width:t.width,height:t.height},o=zt(t,this.pixelRatio),n=P(t.transform,I(s.x,s.y),S(s.width+o.x,s.height+o.y));return e.uniformMatrix3fv(this.uniforms.matrix,false,vt(n,this.cssWidth,this.cssHeight,this.matrixScratch)),e.uniform4f(this.uniforms.crop,s.x/t.width,s.y/t.height,s.width/t.width,s.height/t.height),e.uniform1f(this.uniforms.opacity,t.opacity),e.bindTexture(e.TEXTURE_2D,i.texture),e.drawArrays(e.TRIANGLE_STRIP,0,4),"drawn"}end(){this.isLost||this.gl.bindVertexArray(null)}has(t){return!this.isLost&&this.textures.has(t)}release(t){const e=this.textures.get(t);e&&(this.isLost||this.gl.deleteTexture(e.texture),this.textures.delete(t))}dispose(){var t;if(this.canvas.removeEventListener("webglcontextlost",this.handleLost),!this.isLost){for(const e of[...this.textures.keys()])this.release(e);this.program&&this.gl.deleteProgram(this.program),this.vao&&this.gl.deleteVertexArray(this.vao)}this.textures.clear(),(t=this.gl.getExtension("WEBGL_lose_context"))==null||t.loseContext(),this.isLost=true}upload(t){const e=this.gl,i=this.textures.get(t.key);if(i&&i.width===t.width&&i.height===t.height)return i;const s=(i==null?void 0:i.texture)??e.createTexture();if(!s)return null;e.bindTexture(e.TEXTURE_2D,s);try{e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.source)}catch(n){if(i||e.deleteTexture(s),Dt(n))return"tainted";throw n}e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const o={texture:s,width:t.width,height:t.height};return this.textures.set(t.key,o),o}}function Ft(r,t,e){const i=et(r,r.VERTEX_SHADER,t),s=et(r,r.FRAGMENT_SHADER,e),o=r.createProgram();if(!o)throw new Error("Could not create WebGL program");if(r.attachShader(o,i),r.attachShader(o,s),r.linkProgram(o),r.deleteShader(i),r.deleteShader(s),!r.getProgramParameter(o,r.LINK_STATUS)){const n=r.getProgramInfoLog(o);throw r.deleteProgram(o),new Error(`Could not link WebGL program: ${n}`)}return o}function et(r,t,e){const i=r.createShader(t);if(!i)throw new Error("Could not create WebGL shader");if(r.shaderSource(i,e),r.compileShader(i),!r.getShaderParameter(i,r.COMPILE_STATUS)){const s=r.getShaderInfoLog(i);throw r.deleteShader(i),new Error(`Could not compile WebGL shader: ${s}`)}return i}function Dt(r){return typeof r=="object"&&r!==null&&r.name==="SecurityError"}const Nt=.09,Ht=1e-4,it=.05,Gt=1e-4;class Xt{constructor(t,e=Nt){h(this,"current");h(this,"target",null);h(this,"timeConstant");this.current={...t},this.timeConstant=e}get destination(){return this.target?{...this.target.state}:{...this.current}}set(t){this.current={...t},this.target=null}animateTo(t,e,i=false){if(i||this.timeConstant===0){this.set(t.state);return}let s=t.anchor;if(s){const o=F(s.world,s.screen,t.state.zoom,t.state.rotation,e);Math.hypot(o.x-t.state.x,o.y-t.state.y)*t.state.zoom>it&&(s=void 0)}this.target={state:{...t.state},anchor:s}}stop(){this.target=null}step(t,e){const i=this.target;if(!i)return false;const s=1-Math.exp(-Math.max(t,0)/this.timeConstant),o=this.current,n=i.state,a=Math.exp(Math.log(o.zoom)+(Math.log(n.zoom)-Math.log(o.zoom))*s),d=o.rotation+(n.rotation-o.rotation)*s;let c;return i.anchor?c=F(i.anchor.world,i.anchor.screen,a,d,e):c={x:o.x+(n.x-o.x)*s,y:o.y+(n.y-o.y)*s},this.current={x:c.x,y:c.y,zoom:a,rotation:d},Math.abs(Math.log(n.zoom/a))<Ht&&Math.abs(n.rotation-d)<Gt&&Math.hypot(n.x-c.x,n.y-c.y)*a<it?(this.current={...n},this.target=null,false):true}}const N={clickToZoom:true,dblClickToZoom:true,pinchToZoom:true,scrollToZoom:false,navigable:true},O=2,st=1.5,rt=.1,Zt=100,Kt=200,qt=.002,Vt=.01;class Yt{constructor(t,e,i=N){h(this,"pointers",new Map);h(this,"samples",[]);h(this,"down",null);h(this,"pinch",null);h(this,"lastTap",null);h(this,"lastPointerType","");h(this,"penHovers",false);h(this,"onPointerDown",t2=>{var i2,s;if(this.lastPointerType=t2.pointerType,t2.pointerType==="mouse"&&t2.button!==0||Q(t2.target,this.element))return;(s=(i2=this.element).setPointerCapture)==null||s.call(i2,t2.pointerId);const e2=this.local(t2);this.pointers.set(t2.pointerId,e2),this.pointers.size===1?(this.down={x:e2.x,y:e2.y,t:t2.timeStamp,moved:false},this.samples=[{x:e2.x,y:e2.y,t:t2.timeStamp}],this.target.setInteracting(true)):this.pointers.size===2&&(this.pinch=this.pinchState(),this.down&&(this.down.moved=true))});h(this,"onPointerMove",t2=>{var s;kt(t2)&&(this.penHovers=true);const e2=this.pointers.get(t2.pointerId);if(!e2)return;const i2=this.local(t2);if(this.pointers.set(t2.pointerId,i2),this.pointers.size===1){const o=i2.x-e2.x,n=i2.y-e2.y;this.down&&Math.hypot(i2.x-this.down.x,i2.y-this.down.y)>It&&(this.down.moved=true),(s=this.down)!=null&&s.moved&&this.options.navigable&&this.target.panBy(o,n,false),this.samples.push({x:i2.x,y:i2.y,t:t2.timeStamp});const a=t2.timeStamp-Zt;for(;this.samples.length>2&&this.samples[0].t<a;)this.samples.shift()}else if(this.pointers.size===2&&this.pinch&&this.options.navigable){const o=this.pinchState();this.options.pinchToZoom&&this.pinch.distance>0&&this.target.zoomBy(o.distance/this.pinch.distance,o.mid,false),this.target.panBy(o.mid.x-this.pinch.mid.x,o.mid.y-this.pinch.mid.y,false),this.pinch=o}});h(this,"onPointerUp",t2=>{var d,c,m,f,l,u;if(!this.pointers.has(t2.pointerId))return;if(this.pointers.delete(t2.pointerId),(c=(d=this.element).releasePointerCapture)==null||c.call(d,t2.pointerId),this.pointers.size===1){this.pinch=null;const[p]=this.pointers.values();this.samples=[{...p,t:t2.timeStamp}];return}if(this.pointers.size>0)return;const e2=this.down;if(this.down=null,this.pinch=null,this.target.setInteracting(false),!e2)return;const i2=this.local(t2);if(!e2.moved&&t2.type==="pointerup"&&t2.timeStamp-e2.t<j){if((f=(m=this.target).dismiss)!=null&&f.call(m)){this.lastTap=null;return}if(J(t2.pointerType,this.penHovers)){const p=this.lastTap;this.options.navigable&&(this.options.clickToZoom||this.options.dblClickToZoom)&&p&&t2.timeStamp-p.t<j&&Math.hypot(i2.x-p.x,i2.y-p.y)<At?(this.lastTap=null,this.zoomIn(i2)):this.lastTap={x:i2.x,y:i2.y,t:t2.timeStamp};return}this.options.clickToZoom&&this.options.navigable?t2.shiftKey?this.target.zoomBy(1/O,i2,true):this.zoomIn(i2):(u=(l=this.target).tap)==null||u.call(l,i2);return}if(!this.options.navigable)return;const o=this.samples[0],n=this.samples[this.samples.length-1],a=((n==null?void 0:n.t)??0)-((o==null?void 0:o.t)??0);if(o&&n&&a>0&&t2.timeStamp-n.t<50){const p=(n.x-o.x)/a*1e3,w=(n.y-o.y)/a*1e3;Math.hypot(p,w)>Kt&&this.target.flick(p,w)}});h(this,"onDoubleClick",t2=>{this.options.navigable&&(this.options.clickToZoom||!this.options.dblClickToZoom||J(this.lastPointerType,this.penHovers)||Q(t2.target,this.element)||(t2.shiftKey?this.target.zoomBy(1/O,this.local(t2),true):this.zoomIn(this.local(t2))))});h(this,"onWheel",t2=>{const e2=t2.ctrlKey;if(!this.options.navigable||!e2&&!this.options.scrollToZoom||!e2&&Pt(t2.target,this.element,t2.deltaY))return;t2.preventDefault();const i2=$t(t2),s=e2?Vt:qt;this.target.zoomBy(Math.exp(-i2*s),this.local(t2),!e2)});h(this,"onKeyDown",t2=>{if(t2.target!==this.element||!this.options.navigable||t2.altKey||t2.metaKey||t2.ctrlKey)return;const e2=this.element.getBoundingClientRect(),i2=e2.width*rt*(t2.shiftKey?3:1),s=e2.height*rt*(t2.shiftKey?3:1);switch(t2.key){case"ArrowLeft":this.target.panBy(i2,0,true);break;case"ArrowRight":this.target.panBy(-i2,0,true);break;case"ArrowUp":this.target.panBy(0,s,true);break;case"ArrowDown":this.target.panBy(0,-s,true);break;case"+":case"=":this.target.zoomBy(st,void 0,true);break;case"-":case"_":this.target.zoomBy(1/st,void 0,true);break;case"0":this.target.home();break;case"r":this.target.rotateBy(90);break;case"R":this.target.rotateBy(-90);break;default:return}t2.preventDefault()});this.element=t,this.target=e,this.options=i,t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),t.addEventListener("pointercancel",this.onPointerUp),t.addEventListener("dblclick",this.onDoubleClick),t.addEventListener("wheel",this.onWheel,{passive:false}),t.addEventListener("keydown",this.onKeyDown)}setOptions(t){this.options=t}dispose(){const t=this.element;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("pointercancel",this.onPointerUp),t.removeEventListener("dblclick",this.onDoubleClick),t.removeEventListener("wheel",this.onWheel),t.removeEventListener("keydown",this.onKeyDown)}local(t){const e=this.element.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}}zoomIn(t){var e,i;(i=(e=this.target).atMaxZoom)!=null&&i.call(e)?this.target.home():this.target.zoomBy(O,t,true)}pinchState(){const[t,e]=[...this.pointers.values()];return{distance:Math.hypot(e.x-t.x,e.y-t.y),mid:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}}function $t(r){return r.deltaMode===1?r.deltaY*16:r.deltaMode===2?r.deltaY*400:r.deltaY}class lt extends Error{constructor(t,e,i){super(t),this.url=e,this.status=i,this.name="ImageLoadError"}}const ot=new Set;async function Qt(r,t={}){const{signal:e,maxTextureSize:i,request:s}=t,o=St(s),n=Jt(r);if(typeof createImageBitmap!="function"||typeof fetch!="function")return C(r,{signal:e,cors:true,withCredentials:o});if(n&&ot.has(n))return C(r,{signal:e,cors:false,withCredentials:o});let a;try{a=await Rt(s,r,{mode:"cors",signal:e})}catch(l){if(te(l,e))throw l;const u=await C(r,{signal:e,cors:false,withCredentials:o});return n&&ot.add(n),u}if(!a.ok)throw new lt(`Image request failed with ${a.status}`,r,a.status);const d=await a.blob();let c=await jt(d);const m=c.width,f=c.height;if(i&&(c.width>i||c.height>i)){const l=i/Math.max(c.width,c.height),u=await createImageBitmap(c,{resizeWidth:Math.max(1,Math.floor(c.width*l)),resizeHeight:Math.max(1,Math.floor(c.height*l)),resizeQuality:"high"});c.close(),c=u}if(e!=null&&e.aborted)throw c.close(),H();return{kind:"bitmap",source:c,width:c.width,height:c.height,naturalWidth:m,naturalHeight:f,opaque:false}}async function jt(r){const t={imageOrientation:"from-image",premultiplyAlpha:"premultiply",colorSpaceConversion:"default"};try{return await createImageBitmap(r,t)}catch(e){if(e instanceof TypeError)return createImageBitmap(r);throw e}}function C(r,{signal:t,cors:e,withCredentials:i}){return new Promise((s,o)=>{if(t!=null&&t.aborted){o(H());return}const n=new Image;n.decoding="async",e&&(n.crossOrigin=i?"use-credentials":"anonymous");const a=()=>{n.onload=null,n.onerror=null,t==null||t.removeEventListener("abort",d)},d=()=>{a(),n.src="",o(H())};t==null||t.addEventListener("abort",d),n.onload=()=>{a();const c=()=>s({kind:"element",source:n,width:n.naturalWidth,height:n.naturalHeight,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight,opaque:!e});typeof n.decode=="function"?n.decode().then(c,c):c()},n.onerror=()=>{a(),o(new lt("Image failed to load",r))},n.src=r})}function Jt(r){var t;try{return new URL(r,(t=globalThis.location)==null?void 0:t.href).origin}catch{return null}}function te(r,t){return!!(t!=null&&t.aborted)||typeof r=="object"&&r!==null&&r.name==="AbortError"}function H(){const r=new Error("Aborted");return r.name="AbortError",r}function nt(r){r.kind==="bitmap"&&r.source.close()}const ee=192*1024*1024,ie=6,se=2;class re{constructor(t){h(this,"entries",new Map);h(this,"inFlight",0);h(this,"frame",0);h(this,"bytes",0);h(this,"wanted",[]);h(this,"disposed",false);h(this,"budget");h(this,"maxInFlight");this.options=t,this.budget=t.byteBudget??ee,this.maxInFlight=t.maxInFlight??ie}get(t){const e=this.entries.get(t);if((e==null?void 0:e.state)==="ready")return e.lastUsed=this.frame,e.image}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.state)==="ready"}failed(t){var e;return((e=this.entries.get(t))==null?void 0:e.state)==="failed"}get byteSize(){return this.bytes}get pending(){return this.inFlight}seed(t,e){var s;const i=this.entries.get(t);(i==null?void 0:i.state)!=="ready"&&((s=i==null?void 0:i.controller)==null||s.abort(),this.entries.set(t,{url:t,state:"ready",image:e,bytes:z(e),lastUsed:this.frame,attempts:0,pinned:false,waiters:(i==null?void 0:i.waiters)??[]}),this.bytes+=z(e),this.flushWaiters(t))}prefetch(t){return Promise.all(t.map(e=>new Promise(i=>{const s=this.entries.get(e.url);if(s&&s.state!=="loading")return i();if(s){s.waiters.push(i);return}this.start({...e,priority:-1},i)}))).then(()=>{})}update(t){if(this.disposed)return;this.frame++;const e=new Set(t.map(i=>i.url));this.wanted=[...t].sort((i,s)=>i.priority-s.priority);for(const i of this.entries.values())i.state==="loading"&&!i.pinned&&!e.has(i.url)&&i.controller&&(i.controller.abort(),this.entries.delete(i.url),this.inFlight--);for(const i of this.wanted){const s=this.entries.get(i.url);s&&(s.lastUsed=this.frame)}this.pump(),this.evict(e)}dispose(){var t;this.disposed=true;for(const e of this.entries.values())(t=e.controller)==null||t.abort(),this.flushWaiters(e.url);this.entries.clear(),this.bytes=0}forEachReady(t){for(const e of this.entries.values())e.state==="ready"&&e.image&&t(e.url,e.image)}pump(){for(const t of this.wanted){if(this.inFlight>=this.maxInFlight)break;this.entries.has(t.url)||this.start(t)}}start(t,e){const i=new AbortController,s={url:t.url,state:"loading",bytes:0,lastUsed:this.frame,attempts:0,controller:i,pinned:!!e,waiters:e?[e]:[]};this.entries.set(t.url,s),this.inFlight++,this.attempt(s,t,i,t.url)}attempt(t,e,i,s){t.attempts++,this.options.load(s,i.signal).then(o=>{if(this.disposed||this.entries.get(t.url)!==t){nt(o);return}t.state="ready",t.image=o,t.bytes=z(o),t.controller=void 0,t.pinned=false,this.bytes+=t.bytes,this.settle(t)},o=>{if(!(i.signal.aborted||this.disposed)&&this.entries.get(t.url)===t){if(t.attempts<se&&!oe(o,e)){this.attempt(t,e,i,e.fallbackUrl??e.url);return}t.state="failed",t.controller=void 0,t.pinned=false,this.settle(t)}})}settle(t){this.inFlight--,this.flushWaiters(t.url),this.options.onSettled(),this.pump()}flushWaiters(t){const e=this.entries.get(t);if(!e)return;const i=e.waiters;e.waiters=[],i.forEach(s=>s())}evict(t){if(this.bytes<=this.budget)return;const e=[...this.entries.values()].filter(i=>i.state==="ready"&&!t.has(i.url)).sort((i,s)=>i.lastUsed-s.lastUsed);for(const i of e){if(this.bytes<=this.budget)break;this.entries.delete(i.url),this.bytes-=i.bytes,i.image&&nt(i.image),this.options.onEvict(i.url)}}}function z(r){return r.width*r.height*4}function oe(r,t){if(t.fallbackUrl)return false;const e=r==null?void 0:r.status;return typeof e=="number"&&e>=400&&e<500&&e!==408&&e!==429}const ne=.1;class ae{constructor(t,e=s=>requestAnimationFrame(s),i=s=>cancelAnimationFrame(s)){h(this,"handle",0);h(this,"last",0);h(this,"disposed",false);h(this,"frame",t2=>{if(this.handle=0,this.disposed)return;const e2=this.last?Math.min((t2-this.last)/1e3,ne):1/60;this.last=t2,this.tick(e2,t2)?this.invalidate():this.last=0});this.tick=t,this.raf=e,this.caf=i}invalidate(){this.disposed||this.handle||(this.handle=this.raf(this.frame))}drawNow(){this.disposed||(this.handle&&this.caf(this.handle),this.frame(performance.now()))}dispose(){this.disposed=true,this.handle&&this.caf(this.handle),this.handle=0}}const he=2*1024*1024;function ce(r,t,e=he){const i=new Set;let s=e,o=false;return{get deferred(){return o},getTile(n){const a=r(n);if(!a||a.kind==="media"||a.opaque||i.has(n)||t(n))return a;const d=a.width*a.height*4;if(i.size>0&&d>s){o=true;return}return s-=d,i.add(n),a}}}function le(r,t,e){if(!r)return null;let i=r.trim().replace(/^xywh=/,""),s=false;i.startsWith("pct:")?(s=true,i=i.slice(4)):i.startsWith("pixel:")&&(i=i.slice(6));const o=i.split(",").map(Number);if(o.length!==4||o.some(p=>!Number.isFinite(p)))return null;let[n,a,d,c]=o;s&&(n=n/100*t,a=a/100*e,d=d/100*t,c=c/100*e);const m=Math.max(0,n),f=Math.max(0,a),l=Math.min(t,n+d),u=Math.min(e,a+c);return l<=m||u<=f?null:{x:m,y:f,width:l-m,height:u-f}}const U=512,de=16e6;function dt(r,t,e){return{width:t,height:e,levels:[{scaleFactor:1,width:t,height:e,tileWidth:t,tileHeight:e,cols:1,rows:1}],tile:s=>({...s,url:r,region:{x:0,y:0,width:t,height:e}})}}function ue(r){const{width:t,height:e}=r,i=[],s=r.regionByPx&&r.sizeByW,o=(l,u,p)=>{const w=Math.ceil(t/l),y=Math.ceil(e/l);return{scaleFactor:l,width:w,height:y,tileWidth:u,tileHeight:p,cols:Math.ceil(w/u),rows:Math.ceil(y/p)}},n=(l,u)=>({scaleFactor:t/l,width:l,height:u,tileWidth:l,tileHeight:u,cols:1,rows:1,whole:true}),a=r.tiles[0];if(a)for(const l of a.scaleFactors)i.push(o(l,a.width,a.height));else if(s)for(let l=1;;l*=2){const u=o(l,U,U);if(i.push(u),u.cols===1&&u.rows===1)break}const d=Math.max(0,...i.map(l=>l.scaleFactor));for(const l of r.sizes){const u=t/l.width;me(r,l.width,l.height)&&u>d+1e-9&&i.push(n(l.width,l.height))}const c=i.reduce((l,u)=>!l||u.scaleFactor>l.scaleFactor?u:l,null);if(c&&c.cols*c.rows>1&&r.sizeByW){const l=Math.max(t,e)/U;i.push(n(Math.ceil(t/l),Math.ceil(e/l)))}(!i.length||!a&&!s&&t*e<=de)&&(i.some(l=>l.scaleFactor===1)||i.push(n(t,e)));const m=fe(i).sort((l,u)=>u.scaleFactor-l.scaleFactor),f=Bt(r);return{width:t,height:e,levels:m,tile(l){const u=m[l.level],p=u.scaleFactor,w=u.cols===1&&u.rows===1;let y,v,b;if(w)y={x:0,y:0,width:t,height:e},v=u.width,b=u.height;else{const _=Math.round(l.col*u.tileWidth*p),E=Math.round(l.row*u.tileHeight*p);y={x:_,y:E,width:Math.min(Math.round(u.tileWidth*p),t-_),height:Math.min(Math.round(u.tileHeight*p),e-E)},v=Math.ceil(y.width/p),b=Math.ceil(y.height/p)}return{...l,region:y,url:tt(r,y,v,b),fallbackUrl:f?tt(r,y,v,b,f):void 0}}}}function me(r,t,e){return!(r.maxWidth&&t>r.maxWidth||r.maxHeight&&e>r.maxHeight||r.maxArea&&t*e>r.maxArea)}function fe(r){const t=new Map;for(const e of r){const i=`${e.width}x${e.height}`,s=t.get(i);(!s||s.cols*s.rows<e.cols*e.rows)&&t.set(i,e)}return[...t.values()]}function pe(r,t){const e=r.levels;for(let i=0;i<e.length;i++)if(e[i].scaleFactor<=t*(1+1e-6))return i;return e.length-1}function T(r,t,e){const i=r.levels[t],s=i.tileWidth*i.scaleFactor,o=i.tileHeight*i.scaleFactor,n=Math.max(0,e.x),a=Math.max(0,e.y),d=Math.min(r.width,e.x+e.width),c=Math.min(r.height,e.y+e.height);if(d<=n||c<=a)return[];const m=Math.max(0,Math.floor(n/s)),f=Math.min(i.cols-1,Math.floor((d-1e-9)/s)),l=Math.max(0,Math.floor(a/o)),u=Math.min(i.rows-1,Math.floor((c-1e-9)/o)),p=[];for(let w=l;w<=u;w++)for(let y=m;y<=f;y++)p.push({level:t,col:y,row:w});return p}async function ge(r,t){if(r.media)return we(r,r.media);let e=null,i=null;if(r.service)try{e=ue(await Ot(r.service,t.infoOptions))}catch(m){i=m}if(!e){if(!r.url)throw i??new Error("Image has no source");const m=await t.loadStatic(r.url);t.cache.seed(r.url,m),e=dt(r.url,m.naturalWidth,m.naturalHeight)}const s=r.width&&r.height&&r.width>0&&r.height>0?{width:r.width,height:r.height}:{width:e.width,height:e.height},o=le(r.region,s.width,s.height)??{x:0,y:0,width:s.width,height:s.height},n=e.width/s.width,a=e.height/s.height,d={x:o.x*n,y:o.y*a,width:o.width*n,height:o.height*a},c={id:r.id,spec:r,pyramid:e,size:s,clip:d,contentClip:o,rect:{x:0,y:0,width:o.width,height:o.height}};return await t.cache.prefetch(T(e,0,d).map(m=>{const f=e.tile(m);return{url:f.url,fallbackUrl:f.fallbackUrl}})),c}const ut="media:";function we(r,t){var a,d;const e=r.width||((a=r.placement)==null?void 0:a.width)||t.element.videoWidth||1600,i=r.height||((d=r.placement)==null?void 0:d.height)||t.element.videoHeight||900,s=`${ut}${r.id}`,o={width:e,height:i},n={x:0,y:0,width:e,height:i};return{id:r.id,spec:r,pyramid:dt(s,e,i),media:{kind:"media",source:t.element,width:e,height:i,naturalWidth:e,naturalHeight:i},size:o,clip:n,contentClip:n,rect:{...n}}}function ye(r){if(!r.length)return null;if(r.every(i=>i.spec.placement)){for(const i of r)i.rect={...i.spec.placement};return ct(r.map(i=>i.rect))}const t=r[0].contentClip.height;let e=0;for(const i of r){const s=i.contentClip.width*t/i.contentClip.height;i.rect={x:e,y:0,width:s,height:t},e+=s}return{x:0,y:0,width:e,height:t}}function G(r){return{x:r.rect.width/r.clip.width,y:r.rect.height/r.clip.height}}function xe(r,t){var e,i;return r.service===t.service&&r.url===t.url&&r.width===t.width&&r.height===t.height&&r.region===t.region&&((e=r.media)==null?void 0:e.element)===((i=t.media)==null?void 0:i.element)&&JSON.stringify(r.placement)===JSON.stringify(t.placement)}const ve=1e7,be=15e6,Te=2e7,Ee=2;function Me(r){const{items:t,camera:e,viewport:i,pixelRatio:s,getTile:o,destination:n}=r,a=Mt(e,i),d=[],c=[],m=[],f=(l,u,p)=>{const w=l.tile(u);c.push({url:w.url,fallbackUrl:w.fallbackUrl,priority:p})};for(const l of t){const{pyramid:u,clip:p,rect:w}=l,y=G(l);if(r.wantOverview)for(const g of T(u,0,p))f(u,g,Te);const v=at(l,e,i,s),b=n?at(l,n,i,s):v;if(m.push((v==null?void 0:v.target)??-1),!v&&!b)continue;const _=g=>x=>{const L=u.tile(x).region;return Math.hypot(L.x+L.width/2-g.x,L.y+L.height/2-g.y)};if(b){const g=_(b.center);for(const x of T(u,0,b.area))f(u,x,g(x)/1e3);if(b.target>0)for(const x of T(u,b.target,b.area))f(u,x,ve+g(x))}if(!v)continue;const{area:E,target:M}=v,X=_(v.center),R=T(u,0,E),Z=M===0?[]:T(u,M,E);if(b!==v){for(const x of R)f(u,x,X(x)/1e3);const g=M-Ee;if(g>0)for(const x of T(u,g,E))f(u,x,be+X(x))}if(l.spec.hidden)continue;const ft=(M===0?R:Z).every(g=>o(u.tile(g).url)!==void 0)?[M]:Array.from({length:M+1},(g,x)=>x),pt=P(a,I(w.x,w.y),S(y.x,y.y),I(-p.x,-p.y));for(const g of ft){const x=g===0?R:g===M?Z:T(u,g,E),L=u.levels[g].cols*u.levels[g].rows>1;for(const gt of x){const B=u.tile(gt),K=o(B.url);if(!K)continue;const q=Le(l,B.region,K,pt,L);q&&d.push({...q,url:B.url})}}}return c.sort((l,u)=>l.priority-u.priority),{draws:d,wants:_e(c),levels:m}}function at(r,t,e,i){const{pyramid:s,clip:o,rect:n}=r,a=D(t,e);if(!bt(a,n))return null;const d=G(r),c=Math.max(a.x,n.x),m=Math.max(a.y,n.y),f=Math.min(a.x+a.width,n.x+n.width),l=Math.min(a.y+a.height,n.y+n.height),u=1/(d.x*t.zoom*i);return{area:{x:o.x+(c-n.x)/d.x,y:o.y+(m-n.y)/d.y,width:(f-c)/d.x,height:(l-m)/d.y},center:{x:o.x+(t.x-n.x)/d.x,y:o.y+(t.y-n.y)/d.y},target:pe(s,u)}}function Le(r,t,e,i,s){const{clip:o}=r,n=Math.max(t.x,o.x),a=Math.max(t.y,o.y),d=Math.min(t.x+t.width,o.x+o.width),c=Math.min(t.y+t.height,o.y+o.height);if(d<=n||c<=a)return null;const m=e.width/t.width,f=e.height/t.height,l=1e-6;return{item:r,image:e,transform:P(i,I(t.x,t.y),S(1/m,1/f)),crop:{x:(n-t.x)*m,y:(a-t.y)*f,width:(d-n)*m,height:(c-a)*f},bleed:{right:s&&d<o.x+o.width-l,bottom:s&&c<o.y+o.height-l}}}function _e(r){const t=new Set;return r.filter(e=>t.has(e.url)?false:(t.add(e.url),true))}const ke={maxZoomPixelRatio:1.1,minZoomImageRatio:.9,animationTime:.09,request:void 0,byteBudget:192*1024*1024,maxInFlight:6,releaseAfterMs:2e3},Ie=2,Ae=3,Pe=.1,Se=1e-6,mt={top:0,right:0,bottom:0,left:0};function Re(r){if(typeof getComputedStyle!="function")return mt;const t=getComputedStyle(r),e=i=>parseFloat(i)||0;return{top:e(t.paddingTop),right:e(t.paddingRight),bottom:e(t.paddingBottom),left:e(t.paddingLeft)}}const Be=(r,t)=>r.top===t.top&&r.right===t.right&&r.bottom===t.bottom&&r.left===t.left;let Oe;class Ce{constructor(t,e={}){h(this,"host");h(this,"overlays",null);h(this,"options");h(this,"backend",null);h(this,"backendPreference");h(this,"contextLosses",0);h(this,"holder",{hiddenSince:null,release:()=>this.giveBack()});h(this,"visible",true);h(this,"dom",null);h(this,"domAsked",false);h(this,"pending",null);h(this,"camera");h(this,"loop");h(this,"gestures");h(this,"gestureOptions",{});h(this,"cache");h(this,"navigator",null);h(this,"navigatorAsked",0);h(this,"viewport",{width:1,height:1});h(this,"inset",mt);h(this,"pixelRatio",1);h(this,"items",[]);h(this,"worldBounds",null);h(this,"contentVersion",0);h(this,"opaqueUrls",new Set);h(this,"mediaByKey",new Map);h(this,"detachMedia",[]);h(this,"opened",false);h(this,"atHome",true);h(this,"lastEmitted",null);h(this,"generation",0);h(this,"listeners",new Map);h(this,"resizeObserver",null);h(this,"intersectionObserver",null);h(this,"releaseTimer",null);h(this,"dprQuery",null);h(this,"disposed",false);h(this,"dismisser",null);h(this,"tick",t2=>{var a,d;if(this.disposed)return false;const e2=this.camera.step(t2,this.viewport),i=this.camera.current,s=this.backend,o=ce(this.getTile,c=>s?s.has(c):true),n=Me({items:this.items,camera:i,viewport:this.viewport,pixelRatio:this.pixelRatio,getTile:o.getTile,wantOverview:!!this.navigator,destination:e2?this.camera.destination:void 0});return this.cache.update(n.wants.filter(c=>!c.url.startsWith(ut))),this.paint(n.draws),(a=this.overlays)==null||a.position(i,this.viewport),(d=this.navigator)==null||d.render(this.items.filter(c=>!c.spec.hidden),this.worldBounds,D(i,this.viewport),this.pixelRatio,this.getTile,this.contentVersion),(!this.lastEmitted||!_t(this.lastEmitted,i))&&(this.lastEmitted={...i},this.opened&&this.emit("viewport")),e2||o.deferred});h(this,"getTile",t2=>this.mediaByKey.get(t2)??this.cache.get(t2));h(this,"onContextLost",()=>{this.contextLosses+=1,this.releaseBackend(),this.visible?this.acquireBackend(false):this.host.dataset.backend="released"});h(this,"onPixelRatioChange",()=>{this.measure(),this.watchPixelRatio()});this.host=t,this.backendPreference=e.backend??"auto",this.options={...ke,...W(e)},Ue()&&(this.options.animationTime=0),this.camera=new Xt({x:0,y:0,zoom:1,rotation:0},this.options.animationTime),this.loop=new ae(this.tick),this.gestureOptions=W(e.gestures??{}),this.gestures=new Yt(t,this,{...N,...this.gestureOptions}),this.cache=new re({load:(i,s)=>this.loadTile(i,s),onSettled:()=>{this.contentVersion++,this.invalidate()},onEvict:i=>{var s;return(s=this.backend)==null?void 0:s.release(i)},byteBudget:this.options.byteBudget,maxInFlight:this.options.maxInFlight}),this.visible=ze(t),this.visible?this.acquireBackend():this.holder.hiddenSince=ht(),this.measure(),this.observe()}get backendKind(){var t;return((t=this.backend)==null?void 0:t.kind)??"none"}get isOpen(){return this.opened}get isAtHome(){return this.atHome}on(t,e){let i=this.listeners.get(t);return i||(i=new Set,this.listeners.set(t,i)),i.add(e),()=>i==null?void 0:i.delete(e)}async setImages(t,{world:e,fit:i=false}={}){const s=++this.generation,o=new Map(this.items.map(m=>[m.id,m])),n=await Promise.allSettled(t.map(m=>{const f=o.get(m.id);return f&&xe(f.spec,m)?(f.spec=m,Promise.resolve(f)):ge(m,{cache:this.cache,loadStatic:l=>this.loadTile(l),infoOptions:{request:this.options.request}})}));if(s!==this.generation||this.disposed)return;const a=n.filter(m=>m.status==="fulfilled").map(m=>m.value),d=n.filter(m=>m.status==="rejected").map(m=>m.reason);this.items=a,this.watchMedia(a);const c=ye(a);if(this.worldBounds=e?c?ct([e,c]):e:c,this.contentVersion++,d.length&&this.emit("error",d),!this.worldBounds){this.invalidate();return}this.opened?i?(this.home(true),this.emit("change")):(this.camera.set(this.constrain(this.camera.current)),this.emit("change")):(this.opened=true,this.home(true),this.emit("open")),this.invalidate()}clear(){this.generation++,this.items=[],this.watchMedia([]),this.worldBounds=null,this.contentVersion++,this.invalidate()}setHidden(t){const e=new Set(t);let i=false;for(const s of this.items){const o=e.has(s.id);!!s.spec.hidden!==o&&(s.spec={...s.spec,hidden:o},i=true)}i&&this.invalidate()}isReady(t){const e=this.items.find(s=>s.id===t);if(!e)return false;if(e.spec.media)return true;const i=e.pyramid.levels[0];if(!i)return false;for(let s=0;s<i.rows;s++)for(let o=0;o<i.cols;o++)if(!this.getTile(e.pyramid.tile({level:0,col:o,row:s}).url))return false;return true}fitBounds(t,e=false){const i=Y(t,this.viewport,this.camera.destination.rotation,0);this.atHome=false,this.animateTo(this.constrain(i,{allowBeyondLimits:true}),e)}fitItemRect(t,e,i=false){const s=this.itemRectToWorld(t,e);s&&this.fitAnnotation(s,i)}fitAnnotation(t,e=false){const i=this.items[0];if(!i)return;const s=i.rect.width*Pe;this.fitBounds({x:t.x-s,y:t.y-s,width:t.width+s*2,height:t.height+s*2},e)}getBounds(){return D(this.camera.current,this.viewport)}getHomeBounds(){return this.worldBounds?{...this.worldBounds}:null}getCamera(){return{...this.camera.current}}getZoomLimits(){var i;const t=((i=this.homeCamera())==null?void 0:i.zoom)??1,e=this.items.length?Math.min(...this.items.map(s=>G(s).x)):1;return{home:t,min:t*this.options.minZoomImageRatio,max:Math.max(t,this.options.maxZoomPixelRatio/e)}}home(t=false){const e=this.homeCamera();e&&(this.atHome=true,this.animateTo(e,t))}atMaxZoom(){return this.camera.destination.zoom>=this.getZoomLimits().max*(1-Se)}zoomBy(t,e,i=true){const s=i?this.camera.destination:this.camera.current,o=e??{x:this.viewport.width/2,y:this.viewport.height/2},n=$(s,this.viewport,o),{min:a,max:d}=this.getZoomLimits(),c=k(s.zoom*t,a,d),m=F(n,o,c,s.rotation,this.viewport),f=this.constrain({...s,...m,zoom:c});this.atHome=false,i?this.camera.animateTo({state:f,anchor:{world:n,screen:o}},this.viewport):this.camera.set(f),this.invalidate()}panBy(t,e,i=false){const s=i?this.camera.destination:this.camera.current,o=Tt(P(S(1/s.zoom),Et(-s.rotation)),{x:t,y:e}),n=this.constrain({...s,x:s.x-o.x,y:s.y-o.y});this.atHome=false,i?this.camera.animateTo({state:n},this.viewport):this.camera.set(n),this.invalidate()}panTo(t,e=false){const i=e?this.camera.current:this.camera.destination;this.atHome=false,this.animateTo(this.constrain({...i,...t}),e)}flick(t,e){this.panBy(t*.25,e*.25,true)}rotateBy(t){const e=this.camera.destination;this.setRotation(e.rotation*180/Math.PI+t)}setRotation(t,e=false){const i=this.camera.destination,s=t*Math.PI/180;this.animateTo(this.constrain({...i,rotation:s}),e)}getRotation(){return this.camera.destination.rotation*180/Math.PI}tap(t){this.emit("tap",t)}setDismiss(t){this.dismisser=t}dismiss(){var t;return((t=this.dismisser)==null?void 0:t.call(this))??false}setGestures(t){this.gestures.setOptions({...N,...this.gestureOptions,...W(t)})}setInteracting(t){t&&this.camera.stop()}worldToScreenPoint(t){return Lt(this.camera.current,this.viewport,t)}screenToWorldPoint(t){return $(this.camera.current,this.viewport,t)}itemRectToWorld(t,e){const i=this.items[t];if(!i)return null;const{contentClip:s}=i,o=i.rect.width/s.width,n=i.rect.height/s.height;return{x:i.rect.x+(e.x-s.x)*o,y:i.rect.y+(e.y-s.y)*n,width:e.width*o,height:e.height*n}}attachNavigator(t){var o;(o=this.navigator)==null||o.dispose(),this.navigator=null;const e=++this.navigatorAsked;let i=null,s=false;return import("./Navigator-CIJFA3q1.mjs").then(n=>{s||this.disposed||e!==this.navigatorAsked||(i=new n.Navigator(t,(a,d)=>this.panTo(a,d)),this.navigator=i,this.invalidate())}),()=>{s=true,i==null||i.dispose(),i&&this.navigator===i&&(this.navigator=null)}}invalidate(){this.loop.invalidate()}dispose(){var t,e,i,s,o,n,a;this.disposed||(this.disposed=true,this.generation++,this.loop.dispose(),this.gestures.dispose(),(t=this.resizeObserver)==null||t.disconnect(),(e=this.intersectionObserver)==null||e.disconnect(),(s=(i=this.dprQuery)==null?void 0:i.removeEventListener)==null||s.call(i,"change",this.onPixelRatioChange),this.releaseTimer&&clearTimeout(this.releaseTimer),(o=this.navigator)==null||o.dispose(),this.navigator=null,this.releaseBackend(),this.cache.dispose(),(n=this.dom)==null||n.dispose(),(a=this.overlays)==null||a.dispose(),this.items=[],this.detachMedia.forEach(d=>d()),this.mediaByKey.clear(),this.listeners.clear(),delete this.host.dataset.backend)}watchMedia(t){this.detachMedia.forEach(e=>e()),this.detachMedia=[],this.mediaByKey.clear();for(const e of t){if(!e.media||e.media.kind!=="media")continue;const i=e.pyramid.tile({level:0,col:0,row:0}).url;this.mediaByKey.set(i,e.media);const s=e.media.source,o=()=>this.invalidate(),n=["play","seeked","loadeddata","resize"];n.forEach(a=>s.addEventListener(a,o)),this.detachMedia.push(()=>n.forEach(a=>s.removeEventListener(a,o)))}}paint(t){const e=this.backend,i=[],s=(e==null?void 0:e.kind)==="webgl2";e==null||e.begin();for(const o of t){const{image:n}=o;if(!(n.kind==="media"||n.kind==="element"&&s&&(n.opaque||this.opaqueUrls.has(o.url)))&&e){if(e.draw({key:o.url,source:n.source,width:n.width,height:n.height,transform:o.transform,crop:o.crop,opacity:1,bleed:o.bleed})!=="tainted"||n.kind==="bitmap")continue;this.opaqueUrls.add(o.url)}(n.kind==="element"||n.kind==="media")&&i.push({key:`${o.item.id}|${o.url}`,element:n.source,width:n.width,height:n.height,transform:o.transform,crop:o.crop,opacity:1})}e==null||e.end(),this.dom?this.dom.sync(i):i.length&&!this.domAsked&&(this.domAsked=true,import("./DomLayers-BsR2AOy-.mjs").then(({DomLayers:o})=>{if(this.disposed)return;const n=new o(this.host);this.overlays&&this.host.insertBefore(n.container,this.overlays.container),this.dom=n,this.invalidate()}))}loadTile(t,e){return Qt(t,{signal:e,request:this.options.request,maxTextureSize:this.backend instanceof A?this.backend.maxTextureSize:void 0})}animateTo(t,e){this.camera.animateTo({state:t},this.viewport,e),this.invalidate()}homeCamera(){if(!this.worldBounds)return null;const t=2*Math.PI,e=Math.round(this.camera.destination.rotation/t)*t||0,{top:i,right:s,bottom:o,left:n}=this.inset,a=Y(this.worldBounds,{width:Math.max(1,this.viewport.width-n-s),height:Math.max(1,this.viewport.height-i-o)},e);return a.x-=(n-s)/2/a.zoom,a.y-=(i-o)/2/a.zoom,a}constrain(t,{allowBeyondLimits:e=false}={}){const i=this.worldBounds;if(!i)return t;const{min:s,max:o}=this.getZoomLimits(),n=e?k(t.zoom,s,Math.max(o,t.zoom)):k(t.zoom,s,o);return{...t,zoom:n,x:k(t.x,i.x,i.x+i.width),y:k(t.y,i.y,i.y+i.height)}}acquireBackend(t=true){var o,n;if(this.backend||this.pending||this.disposed)return;const e=document.createElement("canvas");e.className="clover-canvas-surface",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",inset:"0",width:"100%",height:"100%",display:"block",pointerEvents:"none"}),this.host.insertBefore(e,((o=this.dom)==null?void 0:o.container)??((n=this.overlays)==null?void 0:n.container)??null);const i=t&&(this.backendPreference==="webgl2"||this.backendPreference==="auto"&&this.contextLosses<Ae);let s=null;i&&(xt(this.holder)||this.backendPreference==="webgl2")&&(s=A.create(e,{onLost:this.onContextLost}),s||V(this.holder)),s?this.install(s):this.backendPreference==="webgl2"?this.none(e):(this.pending=e,(Oe??(Oe=import("./Canvas2DBackend-RRN2bEkc.mjs"))).then(({Canvas2DBackend:a})=>{if(this.pending!==e)return;this.pending=null;const d=a.create(e);d?this.install(d):this.none(e)}))}none(t){t.remove(),this.host.dataset.backend="none"}install(t){this.backend=t,this.host.dataset.backend=t.kind,t.resize(this.viewport.width,this.viewport.height,this.pixelRatio),t.kind==="canvas2d"&&this.opaqueUrls.clear(),this.emit("backend",t.kind),this.invalidate()}releaseBackend(){var e;if(V(this.holder),(e=this.pending)==null||e.remove(),this.pending=null,!this.backend)return;const t=this.backend.canvas;this.backend.dispose(),t.remove(),this.backend=null}giveBack(){this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null,this.releaseBackend(),this.host.dataset.backend="released"}observe(){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.measure(true)),this.resizeObserver.observe(this.host)),typeof IntersectionObserver<"u"&&(this.intersectionObserver=new IntersectionObserver(t=>{const e=t.some(i=>i.isIntersecting);this.setVisible(e)}),this.intersectionObserver.observe(this.host)),this.watchPixelRatio()}setVisible(t){var e;if(this.visible=t,t){this.holder.hiddenSince=null,this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null,this.backend||this.acquireBackend();return}(e=this.holder).hiddenSince??(e.hiddenSince=ht()),!(!this.backend||this.releaseTimer)&&(this.releaseTimer=setTimeout(()=>this.giveBack(),this.options.releaseAfterMs))}measure(t=false){var d;const e=this.host.getBoundingClientRect(),i=Math.max(1,e.width),s=Math.max(1,e.height),o=Re(this.host),n=Math.min(typeof window<"u"&&window.devicePixelRatio||1,Ie);if(i===this.viewport.width&&s===this.viewport.height&&n===this.pixelRatio&&Be(o,this.inset))return;const a=this.viewport;if(this.viewport={width:i,height:s},this.inset=o,this.pixelRatio=n,(d=this.backend)==null||d.resize(i,s,n),this.opened)if(this.atHome)this.home(true);else{const c=this.camera.current,m=i/Math.max(a.width,1);this.camera.set(this.constrain({...c,zoom:c.zoom*m}))}t?this.loop.drawNow():this.invalidate()}watchPixelRatio(){var t,e,i,s;typeof window>"u"||typeof window.matchMedia!="function"||((e=(t=this.dprQuery)==null?void 0:t.removeEventListener)==null||e.call(t,"change",this.onPixelRatioChange),this.dprQuery=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`),(s=(i=this.dprQuery).addEventListener)==null||s.call(i,"change",this.onPixelRatioChange))}emit(t,e){var i;(i=this.listeners.get(t))==null||i.forEach(s=>s(e))}}const ht=()=>typeof performance<"u"?performance.now():Date.now();function ze(r){if(typeof IntersectionObserver>"u"||typeof window>"u")return true;const{top:t,left:e,width:i,height:s}=r.getBoundingClientRect();return t+s>=0&&e+i>=0&&t<=window.innerHeight&&e<=window.innerWidth}function Ue(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(r){return Object.fromEntries(Object.entries(r).filter(([,t])=>t!==void 0))}const qe=(r,t)=>new Ce(r,t);export{zt as b,Ct as h,Me as p,qe as r};
|
|
22
|
+
`;class A{constructor(t,e,i){h(this,"kind","webgl2");h(this,"canvas");h(this,"maxTextureSize");h(this,"gl");h(this,"program",null);h(this,"vao",null);h(this,"uniforms",{matrix:null,crop:null,opacity:null,texture:null});h(this,"textures",new Map);h(this,"cssWidth",1);h(this,"cssHeight",1);h(this,"pixelRatio",1);h(this,"matrixScratch",new Float32Array(9));h(this,"isLost",false);h(this,"callbacks");h(this,"handleLost",()=>{var t2,e2;this.isLost=true,this.textures.clear(),(e2=(t2=this.callbacks).onLost)==null||e2.call(t2)});this.canvas=t,this.gl=e,this.callbacks=i,this.maxTextureSize=e.getParameter(e.MAX_TEXTURE_SIZE)||4096;const s=Ft(e,Ut,Wt);this.program=s,this.uniforms={matrix:e.getUniformLocation(s,"u_matrix"),crop:e.getUniformLocation(s,"u_crop"),opacity:e.getUniformLocation(s,"u_opacity"),texture:e.getUniformLocation(s,"u_texture")};const o=e.createVertexArray();e.bindVertexArray(o);const n=e.createBuffer();e.bindBuffer(e.ARRAY_BUFFER,n),e.bufferData(e.ARRAY_BUFFER,new Float32Array([0,0,1,0,0,1,1,1]),e.STATIC_DRAW);const a=e.getAttribLocation(s,"a_position");e.enableVertexAttribArray(a),e.vertexAttribPointer(a,2,e.FLOAT,false,0,0),e.bindVertexArray(null),this.vao=o,e.enable(e.BLEND),e.blendFunc(e.ONE,e.ONE_MINUS_SRC_ALPHA),e.pixelStorei(e.UNPACK_PREMULTIPLY_ALPHA_WEBGL,true),e.pixelStorei(e.UNPACK_FLIP_Y_WEBGL,false),e.pixelStorei(e.UNPACK_COLORSPACE_CONVERSION_WEBGL,e.BROWSER_DEFAULT_WEBGL),t.addEventListener("webglcontextlost",this.handleLost)}static create(t,e={}){let i=null;try{i=t.getContext("webgl2",{alpha:true,premultipliedAlpha:true,antialias:false,depth:false,stencil:false,preserveDrawingBuffer:false})}catch{i=null}if(!i||typeof i.createShader!="function")return null;try{return new A(t,i,e)}catch{return null}}resize(t,e,i){this.cssWidth=Math.max(1,t),this.cssHeight=Math.max(1,e),this.pixelRatio=i;const s=Math.max(1,Math.round(t*i)),o=Math.max(1,Math.round(e*i));this.canvas.width!==s&&(this.canvas.width=s),this.canvas.height!==o&&(this.canvas.height=o)}begin(){if(this.isLost)return;const t=this.gl;t.viewport(0,0,this.canvas.width,this.canvas.height),t.clearColor(0,0,0,0),t.clear(t.COLOR_BUFFER_BIT),t.useProgram(this.program),t.bindVertexArray(this.vao),t.activeTexture(t.TEXTURE0),t.uniform1i(this.uniforms.texture,0)}draw(t){if(this.isLost||!Ct(t.source))return"skipped";const e=this.gl,i=this.upload(t);if(i==="tainted")return"tainted";if(!i)return"skipped";const s=t.crop??{x:0,y:0,width:t.width,height:t.height},o=zt(t,this.pixelRatio),n=P(t.transform,I(s.x,s.y),S(s.width+o.x,s.height+o.y));return e.uniformMatrix3fv(this.uniforms.matrix,false,vt(n,this.cssWidth,this.cssHeight,this.matrixScratch)),e.uniform4f(this.uniforms.crop,s.x/t.width,s.y/t.height,s.width/t.width,s.height/t.height),e.uniform1f(this.uniforms.opacity,t.opacity),e.bindTexture(e.TEXTURE_2D,i.texture),e.drawArrays(e.TRIANGLE_STRIP,0,4),"drawn"}end(){this.isLost||this.gl.bindVertexArray(null)}has(t){return!this.isLost&&this.textures.has(t)}release(t){const e=this.textures.get(t);e&&(this.isLost||this.gl.deleteTexture(e.texture),this.textures.delete(t))}dispose(){var t;if(this.canvas.removeEventListener("webglcontextlost",this.handleLost),!this.isLost){for(const e of[...this.textures.keys()])this.release(e);this.program&&this.gl.deleteProgram(this.program),this.vao&&this.gl.deleteVertexArray(this.vao)}this.textures.clear(),(t=this.gl.getExtension("WEBGL_lose_context"))==null||t.loseContext(),this.isLost=true}upload(t){const e=this.gl,i=this.textures.get(t.key);if(i&&i.width===t.width&&i.height===t.height)return i;const s=(i==null?void 0:i.texture)??e.createTexture();if(!s)return null;e.bindTexture(e.TEXTURE_2D,s);try{e.texImage2D(e.TEXTURE_2D,0,e.RGBA,e.RGBA,e.UNSIGNED_BYTE,t.source)}catch(n){if(i||e.deleteTexture(s),Dt(n))return"tainted";throw n}e.generateMipmap(e.TEXTURE_2D),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MIN_FILTER,e.LINEAR_MIPMAP_LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_MAG_FILTER,e.LINEAR),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_S,e.CLAMP_TO_EDGE),e.texParameteri(e.TEXTURE_2D,e.TEXTURE_WRAP_T,e.CLAMP_TO_EDGE);const o={texture:s,width:t.width,height:t.height};return this.textures.set(t.key,o),o}}function Ft(r,t,e){const i=et(r,r.VERTEX_SHADER,t),s=et(r,r.FRAGMENT_SHADER,e),o=r.createProgram();if(!o)throw new Error("Could not create WebGL program");if(r.attachShader(o,i),r.attachShader(o,s),r.linkProgram(o),r.deleteShader(i),r.deleteShader(s),!r.getProgramParameter(o,r.LINK_STATUS)){const n=r.getProgramInfoLog(o);throw r.deleteProgram(o),new Error(`Could not link WebGL program: ${n}`)}return o}function et(r,t,e){const i=r.createShader(t);if(!i)throw new Error("Could not create WebGL shader");if(r.shaderSource(i,e),r.compileShader(i),!r.getShaderParameter(i,r.COMPILE_STATUS)){const s=r.getShaderInfoLog(i);throw r.deleteShader(i),new Error(`Could not compile WebGL shader: ${s}`)}return i}function Dt(r){return typeof r=="object"&&r!==null&&r.name==="SecurityError"}const Nt=.09,Ht=1e-4,it=.05,Gt=1e-4;class Xt{constructor(t,e=Nt){h(this,"current");h(this,"target",null);h(this,"timeConstant");this.current={...t},this.timeConstant=e}get destination(){return this.target?{...this.target.state}:{...this.current}}set(t){this.current={...t},this.target=null}animateTo(t,e,i=false){if(i||this.timeConstant===0){this.set(t.state);return}let s=t.anchor;if(s){const o=F(s.world,s.screen,t.state.zoom,t.state.rotation,e);Math.hypot(o.x-t.state.x,o.y-t.state.y)*t.state.zoom>it&&(s=void 0)}this.target={state:{...t.state},anchor:s}}stop(){this.target=null}step(t,e){const i=this.target;if(!i)return false;const s=1-Math.exp(-Math.max(t,0)/this.timeConstant),o=this.current,n=i.state,a=Math.exp(Math.log(o.zoom)+(Math.log(n.zoom)-Math.log(o.zoom))*s),d=o.rotation+(n.rotation-o.rotation)*s;let c;return i.anchor?c=F(i.anchor.world,i.anchor.screen,a,d,e):c={x:o.x+(n.x-o.x)*s,y:o.y+(n.y-o.y)*s},this.current={x:c.x,y:c.y,zoom:a,rotation:d},Math.abs(Math.log(n.zoom/a))<Ht&&Math.abs(n.rotation-d)<Gt&&Math.hypot(n.x-c.x,n.y-c.y)*a<it?(this.current={...n},this.target=null,false):true}}const N={clickToZoom:true,dblClickToZoom:true,pinchToZoom:true,scrollToZoom:false,navigable:true},O=2,st=1.5,rt=.1,Zt=100,Kt=200,qt=.002,Vt=.01;class Yt{constructor(t,e,i=N){h(this,"pointers",new Map);h(this,"samples",[]);h(this,"down",null);h(this,"pinch",null);h(this,"lastTap",null);h(this,"lastPointerType","");h(this,"penHovers",false);h(this,"onPointerDown",t2=>{var i2,s;if(this.lastPointerType=t2.pointerType,t2.pointerType==="mouse"&&t2.button!==0||Q(t2.target,this.element))return;(s=(i2=this.element).setPointerCapture)==null||s.call(i2,t2.pointerId);const e2=this.local(t2);this.pointers.set(t2.pointerId,e2),this.pointers.size===1?(this.down={x:e2.x,y:e2.y,t:t2.timeStamp,moved:false},this.samples=[{x:e2.x,y:e2.y,t:t2.timeStamp}],this.target.setInteracting(true)):this.pointers.size===2&&(this.pinch=this.pinchState(),this.down&&(this.down.moved=true))});h(this,"onPointerMove",t2=>{var s;kt(t2)&&(this.penHovers=true);const e2=this.pointers.get(t2.pointerId);if(!e2)return;const i2=this.local(t2);if(this.pointers.set(t2.pointerId,i2),this.pointers.size===1){const o=i2.x-e2.x,n=i2.y-e2.y;this.down&&Math.hypot(i2.x-this.down.x,i2.y-this.down.y)>It&&(this.down.moved=true),(s=this.down)!=null&&s.moved&&this.options.navigable&&this.target.panBy(o,n,false),this.samples.push({x:i2.x,y:i2.y,t:t2.timeStamp});const a=t2.timeStamp-Zt;for(;this.samples.length>2&&this.samples[0].t<a;)this.samples.shift()}else if(this.pointers.size===2&&this.pinch&&this.options.navigable){const o=this.pinchState();this.options.pinchToZoom&&this.pinch.distance>0&&this.target.zoomBy(o.distance/this.pinch.distance,o.mid,false),this.target.panBy(o.mid.x-this.pinch.mid.x,o.mid.y-this.pinch.mid.y,false),this.pinch=o}});h(this,"onPointerUp",t2=>{var d,c,m,f,l,u;if(!this.pointers.has(t2.pointerId))return;if(this.pointers.delete(t2.pointerId),(c=(d=this.element).releasePointerCapture)==null||c.call(d,t2.pointerId),this.pointers.size===1){this.pinch=null;const[p]=this.pointers.values();this.samples=[{...p,t:t2.timeStamp}];return}if(this.pointers.size>0)return;const e2=this.down;if(this.down=null,this.pinch=null,this.target.setInteracting(false),!e2)return;const i2=this.local(t2);if(!e2.moved&&t2.type==="pointerup"&&t2.timeStamp-e2.t<j){if((f=(m=this.target).dismiss)!=null&&f.call(m)){this.lastTap=null;return}if(J(t2.pointerType,this.penHovers)){const p=this.lastTap;this.options.navigable&&(this.options.clickToZoom||this.options.dblClickToZoom)&&p&&t2.timeStamp-p.t<j&&Math.hypot(i2.x-p.x,i2.y-p.y)<At?(this.lastTap=null,this.zoomIn(i2)):this.lastTap={x:i2.x,y:i2.y,t:t2.timeStamp};return}this.options.clickToZoom&&this.options.navigable?t2.shiftKey?this.target.zoomBy(1/O,i2,true):this.zoomIn(i2):(u=(l=this.target).tap)==null||u.call(l,i2);return}if(!this.options.navigable)return;const o=this.samples[0],n=this.samples[this.samples.length-1],a=((n==null?void 0:n.t)??0)-((o==null?void 0:o.t)??0);if(o&&n&&a>0&&t2.timeStamp-n.t<50){const p=(n.x-o.x)/a*1e3,w=(n.y-o.y)/a*1e3;Math.hypot(p,w)>Kt&&this.target.flick(p,w)}});h(this,"onDoubleClick",t2=>{this.options.navigable&&(this.options.clickToZoom||!this.options.dblClickToZoom||J(this.lastPointerType,this.penHovers)||Q(t2.target,this.element)||(t2.shiftKey?this.target.zoomBy(1/O,this.local(t2),true):this.zoomIn(this.local(t2))))});h(this,"onWheel",t2=>{const e2=t2.ctrlKey;if(!this.options.navigable||!e2&&!this.options.scrollToZoom||!e2&&Pt(t2.target,this.element,t2.deltaY))return;t2.preventDefault();const i2=$t(t2),s=e2?Vt:qt;this.target.zoomBy(Math.exp(-i2*s),this.local(t2),!e2)});h(this,"onKeyDown",t2=>{if(t2.target!==this.element||!this.options.navigable||t2.altKey||t2.metaKey||t2.ctrlKey)return;const e2=this.element.getBoundingClientRect(),i2=e2.width*rt*(t2.shiftKey?3:1),s=e2.height*rt*(t2.shiftKey?3:1);switch(t2.key){case"ArrowLeft":this.target.panBy(i2,0,true);break;case"ArrowRight":this.target.panBy(-i2,0,true);break;case"ArrowUp":this.target.panBy(0,s,true);break;case"ArrowDown":this.target.panBy(0,-s,true);break;case"+":case"=":this.target.zoomBy(st,void 0,true);break;case"-":case"_":this.target.zoomBy(1/st,void 0,true);break;case"0":this.target.home();break;case"r":this.target.rotateBy(90);break;case"R":this.target.rotateBy(-90);break;default:return}t2.preventDefault()});this.element=t,this.target=e,this.options=i,t.addEventListener("pointerdown",this.onPointerDown),t.addEventListener("pointermove",this.onPointerMove),t.addEventListener("pointerup",this.onPointerUp),t.addEventListener("pointercancel",this.onPointerUp),t.addEventListener("dblclick",this.onDoubleClick),t.addEventListener("wheel",this.onWheel,{passive:false}),t.addEventListener("keydown",this.onKeyDown)}setOptions(t){this.options=t}dispose(){const t=this.element;t.removeEventListener("pointerdown",this.onPointerDown),t.removeEventListener("pointermove",this.onPointerMove),t.removeEventListener("pointerup",this.onPointerUp),t.removeEventListener("pointercancel",this.onPointerUp),t.removeEventListener("dblclick",this.onDoubleClick),t.removeEventListener("wheel",this.onWheel),t.removeEventListener("keydown",this.onKeyDown)}local(t){const e=this.element.getBoundingClientRect();return{x:t.clientX-e.left,y:t.clientY-e.top}}zoomIn(t){var e,i;(i=(e=this.target).atMaxZoom)!=null&&i.call(e)?this.target.home():this.target.zoomBy(O,t,true)}pinchState(){const[t,e]=[...this.pointers.values()];return{distance:Math.hypot(e.x-t.x,e.y-t.y),mid:{x:(t.x+e.x)/2,y:(t.y+e.y)/2}}}}function $t(r){return r.deltaMode===1?r.deltaY*16:r.deltaMode===2?r.deltaY*400:r.deltaY}class lt extends Error{constructor(t,e,i){super(t),this.url=e,this.status=i,this.name="ImageLoadError"}}const ot=new Set;async function Qt(r,t={}){const{signal:e,maxTextureSize:i,request:s}=t,o=St(s),n=Jt(r);if(typeof createImageBitmap!="function"||typeof fetch!="function")return C(r,{signal:e,cors:true,withCredentials:o});if(n&&ot.has(n))return C(r,{signal:e,cors:false,withCredentials:o});let a;try{a=await Rt(s,r,{mode:"cors",signal:e})}catch(l){if(te(l,e))throw l;const u=await C(r,{signal:e,cors:false,withCredentials:o});return n&&ot.add(n),u}if(!a.ok)throw new lt(`Image request failed with ${a.status}`,r,a.status);const d=await a.blob();let c=await jt(d);const m=c.width,f=c.height;if(i&&(c.width>i||c.height>i)){const l=i/Math.max(c.width,c.height),u=await createImageBitmap(c,{resizeWidth:Math.max(1,Math.floor(c.width*l)),resizeHeight:Math.max(1,Math.floor(c.height*l)),resizeQuality:"high"});c.close(),c=u}if(e!=null&&e.aborted)throw c.close(),H();return{kind:"bitmap",source:c,width:c.width,height:c.height,naturalWidth:m,naturalHeight:f,opaque:false}}async function jt(r){const t={imageOrientation:"from-image",premultiplyAlpha:"premultiply",colorSpaceConversion:"default"};try{return await createImageBitmap(r,t)}catch(e){if(e instanceof TypeError)return createImageBitmap(r);throw e}}function C(r,{signal:t,cors:e,withCredentials:i}){return new Promise((s,o)=>{if(t!=null&&t.aborted){o(H());return}const n=new Image;n.decoding="async",e&&(n.crossOrigin=i?"use-credentials":"anonymous");const a=()=>{n.onload=null,n.onerror=null,t==null||t.removeEventListener("abort",d)},d=()=>{a(),n.src="",o(H())};t==null||t.addEventListener("abort",d),n.onload=()=>{a();const c=()=>s({kind:"element",source:n,width:n.naturalWidth,height:n.naturalHeight,naturalWidth:n.naturalWidth,naturalHeight:n.naturalHeight,opaque:!e});typeof n.decode=="function"?n.decode().then(c,c):c()},n.onerror=()=>{a(),o(new lt("Image failed to load",r))},n.src=r})}function Jt(r){var t;try{return new URL(r,(t=globalThis.location)==null?void 0:t.href).origin}catch{return null}}function te(r,t){return!!(t!=null&&t.aborted)||typeof r=="object"&&r!==null&&r.name==="AbortError"}function H(){const r=new Error("Aborted");return r.name="AbortError",r}function nt(r){r.kind==="bitmap"&&r.source.close()}const ee=192*1024*1024,ie=6,se=2;class re{constructor(t){h(this,"entries",new Map);h(this,"inFlight",0);h(this,"frame",0);h(this,"bytes",0);h(this,"wanted",[]);h(this,"disposed",false);h(this,"budget");h(this,"maxInFlight");this.options=t,this.budget=t.byteBudget??ee,this.maxInFlight=t.maxInFlight??ie}get(t){const e=this.entries.get(t);if((e==null?void 0:e.state)==="ready")return e.lastUsed=this.frame,e.image}has(t){var e;return((e=this.entries.get(t))==null?void 0:e.state)==="ready"}failed(t){var e;return((e=this.entries.get(t))==null?void 0:e.state)==="failed"}get byteSize(){return this.bytes}get pending(){return this.inFlight}seed(t,e){var s;const i=this.entries.get(t);(i==null?void 0:i.state)!=="ready"&&((s=i==null?void 0:i.controller)==null||s.abort(),this.entries.set(t,{url:t,state:"ready",image:e,bytes:z(e),lastUsed:this.frame,attempts:0,pinned:false,waiters:(i==null?void 0:i.waiters)??[]}),this.bytes+=z(e),this.flushWaiters(t))}prefetch(t){return Promise.all(t.map(e=>new Promise(i=>{const s=this.entries.get(e.url);if(s&&s.state!=="loading")return i();if(s){s.waiters.push(i);return}this.start({...e,priority:-1},i)}))).then(()=>{})}update(t){if(this.disposed)return;this.frame++;const e=new Set(t.map(i=>i.url));this.wanted=[...t].sort((i,s)=>i.priority-s.priority);for(const i of this.entries.values())i.state==="loading"&&!i.pinned&&!e.has(i.url)&&i.controller&&(i.controller.abort(),this.entries.delete(i.url),this.inFlight--);for(const i of this.wanted){const s=this.entries.get(i.url);s&&(s.lastUsed=this.frame)}this.pump(),this.evict(e)}dispose(){var t;this.disposed=true;for(const e of this.entries.values())(t=e.controller)==null||t.abort(),this.flushWaiters(e.url);this.entries.clear(),this.bytes=0}forEachReady(t){for(const e of this.entries.values())e.state==="ready"&&e.image&&t(e.url,e.image)}pump(){for(const t of this.wanted){if(this.inFlight>=this.maxInFlight)break;this.entries.has(t.url)||this.start(t)}}start(t,e){const i=new AbortController,s={url:t.url,state:"loading",bytes:0,lastUsed:this.frame,attempts:0,controller:i,pinned:!!e,waiters:e?[e]:[]};this.entries.set(t.url,s),this.inFlight++,this.attempt(s,t,i,t.url)}attempt(t,e,i,s){t.attempts++,this.options.load(s,i.signal).then(o=>{if(this.disposed||this.entries.get(t.url)!==t){nt(o);return}t.state="ready",t.image=o,t.bytes=z(o),t.controller=void 0,t.pinned=false,this.bytes+=t.bytes,this.settle(t)},o=>{if(!(i.signal.aborted||this.disposed)&&this.entries.get(t.url)===t){if(t.attempts<se&&!oe(o,e)){this.attempt(t,e,i,e.fallbackUrl??e.url);return}t.state="failed",t.controller=void 0,t.pinned=false,this.settle(t)}})}settle(t){this.inFlight--,this.flushWaiters(t.url),this.options.onSettled(),this.pump()}flushWaiters(t){const e=this.entries.get(t);if(!e)return;const i=e.waiters;e.waiters=[],i.forEach(s=>s())}evict(t){if(this.bytes<=this.budget)return;const e=[...this.entries.values()].filter(i=>i.state==="ready"&&!t.has(i.url)).sort((i,s)=>i.lastUsed-s.lastUsed);for(const i of e){if(this.bytes<=this.budget)break;this.entries.delete(i.url),this.bytes-=i.bytes,i.image&&nt(i.image),this.options.onEvict(i.url)}}}function z(r){return r.width*r.height*4}function oe(r,t){if(t.fallbackUrl)return false;const e=r==null?void 0:r.status;return typeof e=="number"&&e>=400&&e<500&&e!==408&&e!==429}const ne=.1;class ae{constructor(t,e=s=>requestAnimationFrame(s),i=s=>cancelAnimationFrame(s)){h(this,"handle",0);h(this,"last",0);h(this,"disposed",false);h(this,"frame",t2=>{if(this.handle=0,this.disposed)return;const e2=this.last?Math.min((t2-this.last)/1e3,ne):1/60;this.last=t2,this.tick(e2,t2)?this.invalidate():this.last=0});this.tick=t,this.raf=e,this.caf=i}invalidate(){this.disposed||this.handle||(this.handle=this.raf(this.frame))}drawNow(){this.disposed||(this.handle&&this.caf(this.handle),this.frame(performance.now()))}dispose(){this.disposed=true,this.handle&&this.caf(this.handle),this.handle=0}}const he=2*1024*1024;function ce(r,t,e=he){const i=new Set;let s=e,o=false;return{get deferred(){return o},getTile(n){const a=r(n);if(!a||a.kind==="media"||a.opaque||i.has(n)||t(n))return a;const d=a.width*a.height*4;if(i.size>0&&d>s){o=true;return}return s-=d,i.add(n),a}}}function le(r,t,e){if(!r)return null;let i=r.trim().replace(/^xywh=/,""),s=false;i.startsWith("pct:")?(s=true,i=i.slice(4)):i.startsWith("pixel:")&&(i=i.slice(6));const o=i.split(",").map(Number);if(o.length!==4||o.some(p=>!Number.isFinite(p)))return null;let[n,a,d,c]=o;s&&(n=n/100*t,a=a/100*e,d=d/100*t,c=c/100*e);const m=Math.max(0,n),f=Math.max(0,a),l=Math.min(t,n+d),u=Math.min(e,a+c);return l<=m||u<=f?null:{x:m,y:f,width:l-m,height:u-f}}const U=512,de=16e6;function dt(r,t,e){return{width:t,height:e,levels:[{scaleFactor:1,width:t,height:e,tileWidth:t,tileHeight:e,cols:1,rows:1}],tile:s=>({...s,url:r,region:{x:0,y:0,width:t,height:e}})}}function ue(r){const{width:t,height:e}=r,i=[],s=r.regionByPx&&r.sizeByW,o=(l,u,p)=>{const w=Math.ceil(t/l),y=Math.ceil(e/l);return{scaleFactor:l,width:w,height:y,tileWidth:u,tileHeight:p,cols:Math.ceil(w/u),rows:Math.ceil(y/p)}},n=(l,u)=>({scaleFactor:t/l,width:l,height:u,tileWidth:l,tileHeight:u,cols:1,rows:1,whole:true}),a=r.tiles[0];if(a)for(const l of a.scaleFactors)i.push(o(l,a.width,a.height));else if(s)for(let l=1;;l*=2){const u=o(l,U,U);if(i.push(u),u.cols===1&&u.rows===1)break}const d=Math.max(0,...i.map(l=>l.scaleFactor));for(const l of r.sizes){const u=t/l.width;me(r,l.width,l.height)&&u>d+1e-9&&i.push(n(l.width,l.height))}const c=i.reduce((l,u)=>!l||u.scaleFactor>l.scaleFactor?u:l,null);if(c&&c.cols*c.rows>1&&r.sizeByW){const l=Math.max(t,e)/U;i.push(n(Math.ceil(t/l),Math.ceil(e/l)))}(!i.length||!a&&!s&&t*e<=de)&&(i.some(l=>l.scaleFactor===1)||i.push(n(t,e)));const m=fe(i).sort((l,u)=>u.scaleFactor-l.scaleFactor),f=Bt(r);return{width:t,height:e,levels:m,tile(l){const u=m[l.level],p=u.scaleFactor,w=u.cols===1&&u.rows===1;let y,v,b;if(w)y={x:0,y:0,width:t,height:e},v=u.width,b=u.height;else{const _=Math.round(l.col*u.tileWidth*p),E=Math.round(l.row*u.tileHeight*p);y={x:_,y:E,width:Math.min(Math.round(u.tileWidth*p),t-_),height:Math.min(Math.round(u.tileHeight*p),e-E)},v=Math.ceil(y.width/p),b=Math.ceil(y.height/p)}return{...l,region:y,url:tt(r,y,v,b),fallbackUrl:f?tt(r,y,v,b,f):void 0}}}}function me(r,t,e){return!(r.maxWidth&&t>r.maxWidth||r.maxHeight&&e>r.maxHeight||r.maxArea&&t*e>r.maxArea)}function fe(r){const t=new Map;for(const e of r){const i=`${e.width}x${e.height}`,s=t.get(i);(!s||s.cols*s.rows<e.cols*e.rows)&&t.set(i,e)}return[...t.values()]}function pe(r,t){const e=r.levels;for(let i=0;i<e.length;i++)if(e[i].scaleFactor<=t*(1+1e-6))return i;return e.length-1}function T(r,t,e){const i=r.levels[t],s=i.tileWidth*i.scaleFactor,o=i.tileHeight*i.scaleFactor,n=Math.max(0,e.x),a=Math.max(0,e.y),d=Math.min(r.width,e.x+e.width),c=Math.min(r.height,e.y+e.height);if(d<=n||c<=a)return[];const m=Math.max(0,Math.floor(n/s)),f=Math.min(i.cols-1,Math.floor((d-1e-9)/s)),l=Math.max(0,Math.floor(a/o)),u=Math.min(i.rows-1,Math.floor((c-1e-9)/o)),p=[];for(let w=l;w<=u;w++)for(let y=m;y<=f;y++)p.push({level:t,col:y,row:w});return p}async function ge(r,t){if(r.media)return we(r,r.media);let e=null,i=null;if(r.service)try{e=ue(await Ot(r.service,t.infoOptions))}catch(m){i=m}if(!e){if(!r.url)throw i??new Error("Image has no source");const m=await t.loadStatic(r.url);t.cache.seed(r.url,m),e=dt(r.url,m.naturalWidth,m.naturalHeight)}const s=r.width&&r.height&&r.width>0&&r.height>0?{width:r.width,height:r.height}:{width:e.width,height:e.height},o=le(r.region,s.width,s.height)??{x:0,y:0,width:s.width,height:s.height},n=e.width/s.width,a=e.height/s.height,d={x:o.x*n,y:o.y*a,width:o.width*n,height:o.height*a},c={id:r.id,spec:r,pyramid:e,size:s,clip:d,contentClip:o,rect:{x:0,y:0,width:o.width,height:o.height}};return await t.cache.prefetch(T(e,0,d).map(m=>{const f=e.tile(m);return{url:f.url,fallbackUrl:f.fallbackUrl}})),c}const ut="media:";function we(r,t){var a,d;const e=r.width||((a=r.placement)==null?void 0:a.width)||t.element.videoWidth||1600,i=r.height||((d=r.placement)==null?void 0:d.height)||t.element.videoHeight||900,s=`${ut}${r.id}`,o={width:e,height:i},n={x:0,y:0,width:e,height:i};return{id:r.id,spec:r,pyramid:dt(s,e,i),media:{kind:"media",source:t.element,width:e,height:i,naturalWidth:e,naturalHeight:i},size:o,clip:n,contentClip:n,rect:{...n}}}function ye(r){if(!r.length)return null;if(r.every(i=>i.spec.placement)){for(const i of r)i.rect={...i.spec.placement};return ct(r.map(i=>i.rect))}const t=r[0].contentClip.height;let e=0;for(const i of r){const s=i.contentClip.width*t/i.contentClip.height;i.rect={x:e,y:0,width:s,height:t},e+=s}return{x:0,y:0,width:e,height:t}}function G(r){return{x:r.rect.width/r.clip.width,y:r.rect.height/r.clip.height}}function xe(r,t){var e,i;return r.service===t.service&&r.url===t.url&&r.width===t.width&&r.height===t.height&&r.region===t.region&&((e=r.media)==null?void 0:e.element)===((i=t.media)==null?void 0:i.element)&&JSON.stringify(r.placement)===JSON.stringify(t.placement)}const ve=1e7,be=15e6,Te=2e7,Ee=2;function Me(r){const{items:t,camera:e,viewport:i,pixelRatio:s,getTile:o,destination:n}=r,a=Mt(e,i),d=[],c=[],m=[],f=(l,u,p)=>{const w=l.tile(u);c.push({url:w.url,fallbackUrl:w.fallbackUrl,priority:p})};for(const l of t){const{pyramid:u,clip:p,rect:w}=l,y=G(l);if(r.wantOverview)for(const g of T(u,0,p))f(u,g,Te);const v=at(l,e,i,s),b=n?at(l,n,i,s):v;if(m.push((v==null?void 0:v.target)??-1),!v&&!b)continue;const _=g=>x=>{const L=u.tile(x).region;return Math.hypot(L.x+L.width/2-g.x,L.y+L.height/2-g.y)};if(b){const g=_(b.center);for(const x of T(u,0,b.area))f(u,x,g(x)/1e3);if(b.target>0)for(const x of T(u,b.target,b.area))f(u,x,ve+g(x))}if(!v)continue;const{area:E,target:M}=v,X=_(v.center),R=T(u,0,E),Z=M===0?[]:T(u,M,E);if(b!==v){for(const x of R)f(u,x,X(x)/1e3);const g=M-Ee;if(g>0)for(const x of T(u,g,E))f(u,x,be+X(x))}if(l.spec.hidden)continue;const ft=(M===0?R:Z).every(g=>o(u.tile(g).url)!==void 0)?[M]:Array.from({length:M+1},(g,x)=>x),pt=P(a,I(w.x,w.y),S(y.x,y.y),I(-p.x,-p.y));for(const g of ft){const x=g===0?R:g===M?Z:T(u,g,E),L=u.levels[g].cols*u.levels[g].rows>1;for(const gt of x){const B=u.tile(gt),K=o(B.url);if(!K)continue;const q=Le(l,B.region,K,pt,L);q&&d.push({...q,url:B.url})}}}return c.sort((l,u)=>l.priority-u.priority),{draws:d,wants:_e(c),levels:m}}function at(r,t,e,i){const{pyramid:s,clip:o,rect:n}=r,a=D(t,e);if(!bt(a,n))return null;const d=G(r),c=Math.max(a.x,n.x),m=Math.max(a.y,n.y),f=Math.min(a.x+a.width,n.x+n.width),l=Math.min(a.y+a.height,n.y+n.height),u=1/(d.x*t.zoom*i);return{area:{x:o.x+(c-n.x)/d.x,y:o.y+(m-n.y)/d.y,width:(f-c)/d.x,height:(l-m)/d.y},center:{x:o.x+(t.x-n.x)/d.x,y:o.y+(t.y-n.y)/d.y},target:pe(s,u)}}function Le(r,t,e,i,s){const{clip:o}=r,n=Math.max(t.x,o.x),a=Math.max(t.y,o.y),d=Math.min(t.x+t.width,o.x+o.width),c=Math.min(t.y+t.height,o.y+o.height);if(d<=n||c<=a)return null;const m=e.width/t.width,f=e.height/t.height,l=1e-6;return{item:r,image:e,transform:P(i,I(t.x,t.y),S(1/m,1/f)),crop:{x:(n-t.x)*m,y:(a-t.y)*f,width:(d-n)*m,height:(c-a)*f},bleed:{right:s&&d<o.x+o.width-l,bottom:s&&c<o.y+o.height-l}}}function _e(r){const t=new Set;return r.filter(e=>t.has(e.url)?false:(t.add(e.url),true))}const ke={maxZoomPixelRatio:1.1,minZoomImageRatio:.9,animationTime:.09,request:void 0,byteBudget:192*1024*1024,maxInFlight:6,releaseAfterMs:2e3},Ie=2,Ae=3,Pe=.1,Se=1e-6,mt={top:0,right:0,bottom:0,left:0};function Re(r){if(typeof getComputedStyle!="function")return mt;const t=getComputedStyle(r),e=i=>parseFloat(i)||0;return{top:e(t.paddingTop),right:e(t.paddingRight),bottom:e(t.paddingBottom),left:e(t.paddingLeft)}}const Be=(r,t)=>r.top===t.top&&r.right===t.right&&r.bottom===t.bottom&&r.left===t.left;let Oe;class Ce{constructor(t,e={}){h(this,"host");h(this,"overlays",null);h(this,"options");h(this,"backend",null);h(this,"backendPreference");h(this,"contextLosses",0);h(this,"holder",{hiddenSince:null,release:()=>this.giveBack()});h(this,"visible",true);h(this,"dom",null);h(this,"domAsked",false);h(this,"pending",null);h(this,"camera");h(this,"loop");h(this,"gestures");h(this,"gestureOptions",{});h(this,"cache");h(this,"navigator",null);h(this,"navigatorAsked",0);h(this,"viewport",{width:1,height:1});h(this,"inset",mt);h(this,"pixelRatio",1);h(this,"items",[]);h(this,"worldBounds",null);h(this,"contentVersion",0);h(this,"opaqueUrls",new Set);h(this,"mediaByKey",new Map);h(this,"detachMedia",[]);h(this,"opened",false);h(this,"atHome",true);h(this,"lastEmitted",null);h(this,"generation",0);h(this,"listeners",new Map);h(this,"resizeObserver",null);h(this,"intersectionObserver",null);h(this,"releaseTimer",null);h(this,"dprQuery",null);h(this,"disposed",false);h(this,"dismisser",null);h(this,"tick",t2=>{var a,d;if(this.disposed)return false;const e2=this.camera.step(t2,this.viewport),i=this.camera.current,s=this.backend,o=ce(this.getTile,c=>s?s.has(c):true),n=Me({items:this.items,camera:i,viewport:this.viewport,pixelRatio:this.pixelRatio,getTile:o.getTile,wantOverview:!!this.navigator,destination:e2?this.camera.destination:void 0});return this.cache.update(n.wants.filter(c=>!c.url.startsWith(ut))),this.paint(n.draws),(a=this.overlays)==null||a.position(i,this.viewport),(d=this.navigator)==null||d.render(this.items.filter(c=>!c.spec.hidden),this.worldBounds,D(i,this.viewport),this.pixelRatio,this.getTile,this.contentVersion),(!this.lastEmitted||!_t(this.lastEmitted,i))&&(this.lastEmitted={...i},this.opened&&this.emit("viewport")),e2||o.deferred});h(this,"getTile",t2=>this.mediaByKey.get(t2)??this.cache.get(t2));h(this,"onContextLost",()=>{this.contextLosses+=1,this.releaseBackend(),this.visible?this.acquireBackend(false):this.host.dataset.backend="released"});h(this,"onPixelRatioChange",()=>{this.measure(),this.watchPixelRatio()});this.host=t,this.backendPreference=e.backend??"auto",this.options={...ke,...W(e)},Ue()&&(this.options.animationTime=0),this.camera=new Xt({x:0,y:0,zoom:1,rotation:0},this.options.animationTime),this.loop=new ae(this.tick),this.gestureOptions=W(e.gestures??{}),this.gestures=new Yt(t,this,{...N,...this.gestureOptions}),this.cache=new re({load:(i,s)=>this.loadTile(i,s),onSettled:()=>{this.contentVersion++,this.invalidate()},onEvict:i=>{var s;return(s=this.backend)==null?void 0:s.release(i)},byteBudget:this.options.byteBudget,maxInFlight:this.options.maxInFlight}),this.visible=ze(t),this.visible?this.acquireBackend():this.holder.hiddenSince=ht(),this.measure(),this.observe()}get backendKind(){var t;return((t=this.backend)==null?void 0:t.kind)??"none"}get isOpen(){return this.opened}get isAtHome(){return this.atHome}on(t,e){let i=this.listeners.get(t);return i||(i=new Set,this.listeners.set(t,i)),i.add(e),()=>i==null?void 0:i.delete(e)}async setImages(t,{world:e,fit:i=false}={}){const s=++this.generation,o=new Map(this.items.map(m=>[m.id,m])),n=await Promise.allSettled(t.map(m=>{const f=o.get(m.id);return f&&xe(f.spec,m)?(f.spec=m,Promise.resolve(f)):ge(m,{cache:this.cache,loadStatic:l=>this.loadTile(l),infoOptions:{request:this.options.request}})}));if(s!==this.generation||this.disposed)return;const a=n.filter(m=>m.status==="fulfilled").map(m=>m.value),d=n.filter(m=>m.status==="rejected").map(m=>m.reason);this.items=a,this.watchMedia(a);const c=ye(a);if(this.worldBounds=e?c?ct([e,c]):e:c,this.contentVersion++,d.length&&this.emit("error",d),!this.worldBounds){this.invalidate();return}this.opened?i?(this.home(true),this.emit("change")):(this.camera.set(this.constrain(this.camera.current)),this.emit("change")):(this.opened=true,this.home(true),this.emit("open")),this.invalidate()}clear(){this.generation++,this.items=[],this.watchMedia([]),this.worldBounds=null,this.contentVersion++,this.invalidate()}setHidden(t){const e=new Set(t);let i=false;for(const s of this.items){const o=e.has(s.id);!!s.spec.hidden!==o&&(s.spec={...s.spec,hidden:o},i=true)}i&&this.invalidate()}isReady(t){const e=this.items.find(s=>s.id===t);if(!e)return false;if(e.spec.media)return true;const i=e.pyramid.levels[0];if(!i)return false;for(let s=0;s<i.rows;s++)for(let o=0;o<i.cols;o++)if(!this.getTile(e.pyramid.tile({level:0,col:o,row:s}).url))return false;return true}fitBounds(t,e=false){const i=Y(t,this.viewport,this.camera.destination.rotation,0);this.atHome=false,this.animateTo(this.constrain(i,{allowBeyondLimits:true}),e)}fitItemRect(t,e,i=false){const s=this.itemRectToWorld(t,e);s&&this.fitAnnotation(s,i)}fitAnnotation(t,e=false){const i=this.items[0];if(!i)return;const s=i.rect.width*Pe;this.fitBounds({x:t.x-s,y:t.y-s,width:t.width+s*2,height:t.height+s*2},e)}getBounds(){return D(this.camera.current,this.viewport)}getHomeBounds(){return this.worldBounds?{...this.worldBounds}:null}getCamera(){return{...this.camera.current}}getZoomLimits(){var i;const t=((i=this.homeCamera())==null?void 0:i.zoom)??1,e=this.items.length?Math.min(...this.items.map(s=>G(s).x)):1;return{home:t,min:t*this.options.minZoomImageRatio,max:Math.max(t,this.options.maxZoomPixelRatio/e)}}home(t=false){const e=this.homeCamera();e&&(this.atHome=true,this.animateTo(e,t))}atMaxZoom(){return this.camera.destination.zoom>=this.getZoomLimits().max*(1-Se)}zoomBy(t,e,i=true){const s=i?this.camera.destination:this.camera.current,o=e??{x:this.viewport.width/2,y:this.viewport.height/2},n=$(s,this.viewport,o),{min:a,max:d}=this.getZoomLimits(),c=k(s.zoom*t,a,d),m=F(n,o,c,s.rotation,this.viewport),f=this.constrain({...s,...m,zoom:c});this.atHome=false,i?this.camera.animateTo({state:f,anchor:{world:n,screen:o}},this.viewport):this.camera.set(f),this.invalidate()}panBy(t,e,i=false){const s=i?this.camera.destination:this.camera.current,o=Tt(P(S(1/s.zoom),Et(-s.rotation)),{x:t,y:e}),n=this.constrain({...s,x:s.x-o.x,y:s.y-o.y});this.atHome=false,i?this.camera.animateTo({state:n},this.viewport):this.camera.set(n),this.invalidate()}panTo(t,e=false){const i=e?this.camera.current:this.camera.destination;this.atHome=false,this.animateTo(this.constrain({...i,...t}),e)}flick(t,e){this.panBy(t*.25,e*.25,true)}rotateBy(t){const e=this.camera.destination;this.setRotation(e.rotation*180/Math.PI+t)}setRotation(t,e=false){const i=this.camera.destination,s=t*Math.PI/180;this.animateTo(this.constrain({...i,rotation:s}),e)}getRotation(){return this.camera.destination.rotation*180/Math.PI}tap(t){this.emit("tap",t)}setDismiss(t){this.dismisser=t}dismiss(){var t;return((t=this.dismisser)==null?void 0:t.call(this))??false}setGestures(t){this.gestures.setOptions({...N,...this.gestureOptions,...W(t)})}setInteracting(t){t&&this.camera.stop()}worldToScreenPoint(t){return Lt(this.camera.current,this.viewport,t)}screenToWorldPoint(t){return $(this.camera.current,this.viewport,t)}itemRectToWorld(t,e){const i=this.items[t];if(!i)return null;const{contentClip:s}=i,o=i.rect.width/s.width,n=i.rect.height/s.height;return{x:i.rect.x+(e.x-s.x)*o,y:i.rect.y+(e.y-s.y)*n,width:e.width*o,height:e.height*n}}attachNavigator(t){var o;(o=this.navigator)==null||o.dispose(),this.navigator=null;const e=++this.navigatorAsked;let i=null,s=false;return import("./Navigator-BSJbEbuJ.mjs").then(n=>{s||this.disposed||e!==this.navigatorAsked||(i=new n.Navigator(t,(a,d)=>this.panTo(a,d)),this.navigator=i,this.invalidate())}),()=>{s=true,i==null||i.dispose(),i&&this.navigator===i&&(this.navigator=null)}}invalidate(){this.loop.invalidate()}dispose(){var t,e,i,s,o,n,a;this.disposed||(this.disposed=true,this.generation++,this.loop.dispose(),this.gestures.dispose(),(t=this.resizeObserver)==null||t.disconnect(),(e=this.intersectionObserver)==null||e.disconnect(),(s=(i=this.dprQuery)==null?void 0:i.removeEventListener)==null||s.call(i,"change",this.onPixelRatioChange),this.releaseTimer&&clearTimeout(this.releaseTimer),(o=this.navigator)==null||o.dispose(),this.navigator=null,this.releaseBackend(),this.cache.dispose(),(n=this.dom)==null||n.dispose(),(a=this.overlays)==null||a.dispose(),this.items=[],this.detachMedia.forEach(d=>d()),this.mediaByKey.clear(),this.listeners.clear(),delete this.host.dataset.backend)}watchMedia(t){this.detachMedia.forEach(e=>e()),this.detachMedia=[],this.mediaByKey.clear();for(const e of t){if(!e.media||e.media.kind!=="media")continue;const i=e.pyramid.tile({level:0,col:0,row:0}).url;this.mediaByKey.set(i,e.media);const s=e.media.source,o=()=>this.invalidate(),n=["play","seeked","loadeddata","resize"];n.forEach(a=>s.addEventListener(a,o)),this.detachMedia.push(()=>n.forEach(a=>s.removeEventListener(a,o)))}}paint(t){const e=this.backend,i=[],s=(e==null?void 0:e.kind)==="webgl2";e==null||e.begin();for(const o of t){const{image:n}=o;if(!(n.kind==="media"||n.kind==="element"&&s&&(n.opaque||this.opaqueUrls.has(o.url)))&&e){if(e.draw({key:o.url,source:n.source,width:n.width,height:n.height,transform:o.transform,crop:o.crop,opacity:1,bleed:o.bleed})!=="tainted"||n.kind==="bitmap")continue;this.opaqueUrls.add(o.url)}(n.kind==="element"||n.kind==="media")&&i.push({key:`${o.item.id}|${o.url}`,element:n.source,width:n.width,height:n.height,transform:o.transform,crop:o.crop,opacity:1})}e==null||e.end(),this.dom?this.dom.sync(i):i.length&&!this.domAsked&&(this.domAsked=true,import("./DomLayers-BD4QPbl6.mjs").then(({DomLayers:o})=>{if(this.disposed)return;const n=new o(this.host);this.overlays&&this.host.insertBefore(n.container,this.overlays.container),this.dom=n,this.invalidate()}))}loadTile(t,e){return Qt(t,{signal:e,request:this.options.request,maxTextureSize:this.backend instanceof A?this.backend.maxTextureSize:void 0})}animateTo(t,e){this.camera.animateTo({state:t},this.viewport,e),this.invalidate()}homeCamera(){if(!this.worldBounds)return null;const t=2*Math.PI,e=Math.round(this.camera.destination.rotation/t)*t||0,{top:i,right:s,bottom:o,left:n}=this.inset,a=Y(this.worldBounds,{width:Math.max(1,this.viewport.width-n-s),height:Math.max(1,this.viewport.height-i-o)},e);return a.x-=(n-s)/2/a.zoom,a.y-=(i-o)/2/a.zoom,a}constrain(t,{allowBeyondLimits:e=false}={}){const i=this.worldBounds;if(!i)return t;const{min:s,max:o}=this.getZoomLimits(),n=e?k(t.zoom,s,Math.max(o,t.zoom)):k(t.zoom,s,o);return{...t,zoom:n,x:k(t.x,i.x,i.x+i.width),y:k(t.y,i.y,i.y+i.height)}}acquireBackend(t=true){var o,n;if(this.backend||this.pending||this.disposed)return;const e=document.createElement("canvas");e.className="clover-canvas-surface",e.setAttribute("aria-hidden","true"),Object.assign(e.style,{position:"absolute",inset:"0",width:"100%",height:"100%",display:"block",pointerEvents:"none"}),this.host.insertBefore(e,((o=this.dom)==null?void 0:o.container)??((n=this.overlays)==null?void 0:n.container)??null);const i=t&&(this.backendPreference==="webgl2"||this.backendPreference==="auto"&&this.contextLosses<Ae);let s=null;i&&(xt(this.holder)||this.backendPreference==="webgl2")&&(s=A.create(e,{onLost:this.onContextLost}),s||V(this.holder)),s?this.install(s):this.backendPreference==="webgl2"?this.none(e):(this.pending=e,(Oe??(Oe=import("./Canvas2DBackend-CnLEHRs4.mjs"))).then(({Canvas2DBackend:a})=>{if(this.pending!==e)return;this.pending=null;const d=a.create(e);d?this.install(d):this.none(e)}))}none(t){t.remove(),this.host.dataset.backend="none"}install(t){this.backend=t,this.host.dataset.backend=t.kind,t.resize(this.viewport.width,this.viewport.height,this.pixelRatio),t.kind==="canvas2d"&&this.opaqueUrls.clear(),this.emit("backend",t.kind),this.invalidate()}releaseBackend(){var e;if(V(this.holder),(e=this.pending)==null||e.remove(),this.pending=null,!this.backend)return;const t=this.backend.canvas;this.backend.dispose(),t.remove(),this.backend=null}giveBack(){this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null,this.releaseBackend(),this.host.dataset.backend="released"}observe(){typeof ResizeObserver<"u"&&(this.resizeObserver=new ResizeObserver(()=>this.measure(true)),this.resizeObserver.observe(this.host)),typeof IntersectionObserver<"u"&&(this.intersectionObserver=new IntersectionObserver(t=>{const e=t.some(i=>i.isIntersecting);this.setVisible(e)}),this.intersectionObserver.observe(this.host)),this.watchPixelRatio()}setVisible(t){var e;if(this.visible=t,t){this.holder.hiddenSince=null,this.releaseTimer&&clearTimeout(this.releaseTimer),this.releaseTimer=null,this.backend||this.acquireBackend();return}(e=this.holder).hiddenSince??(e.hiddenSince=ht()),!(!this.backend||this.releaseTimer)&&(this.releaseTimer=setTimeout(()=>this.giveBack(),this.options.releaseAfterMs))}measure(t=false){var d;const e=this.host.getBoundingClientRect(),i=Math.max(1,e.width),s=Math.max(1,e.height),o=Re(this.host),n=Math.min(typeof window<"u"&&window.devicePixelRatio||1,Ie);if(i===this.viewport.width&&s===this.viewport.height&&n===this.pixelRatio&&Be(o,this.inset))return;const a=this.viewport;if(this.viewport={width:i,height:s},this.inset=o,this.pixelRatio=n,(d=this.backend)==null||d.resize(i,s,n),this.opened)if(this.atHome)this.home(true);else{const c=this.camera.current,m=i/Math.max(a.width,1);this.camera.set(this.constrain({...c,zoom:c.zoom*m}))}t?this.loop.drawNow():this.invalidate()}watchPixelRatio(){var t,e,i,s;typeof window>"u"||typeof window.matchMedia!="function"||((e=(t=this.dprQuery)==null?void 0:t.removeEventListener)==null||e.call(t,"change",this.onPixelRatioChange),this.dprQuery=window.matchMedia(`(resolution: ${window.devicePixelRatio||1}dppx)`),(s=(i=this.dprQuery).addEventListener)==null||s.call(i,"change",this.onPixelRatioChange))}emit(t,e){var i;(i=this.listeners.get(t))==null||i.forEach(s=>s(e))}}const ht=()=>typeof performance<"u"?performance.now():Date.now();function ze(r){if(typeof IntersectionObserver>"u"||typeof window>"u")return true;const{top:t,left:e,width:i,height:s}=r.getBoundingClientRect();return t+s>=0&&e+i>=0&&t<=window.innerHeight&&e<=window.innerWidth}function Ue(){return typeof window<"u"&&typeof window.matchMedia=="function"&&window.matchMedia("(prefers-reduced-motion: reduce)").matches}function W(r){return Object.fromEntries(Object.entries(r).filter(([,t])=>t!==void 0))}const qe=(r,t)=>new Ce(r,t);export{zt as b,Ct as h,Me as p,qe as r};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{u as c,A as l,x as u,ai as p,_ as d,k as m}from"./shared-
|
|
1
|
+
import{u as c,A as l,x as u,ai as p,_ as d,k as m}from"./shared-YUjOSBKO.mjs";import"./styles-CyuM_fB1.mjs";const f=new WeakMap;function v(t){let n=f.get(t);if(!n){const{render:o}=t;n={canvasId:t.canvasId,format:t.format,match:t.match,component:r=>c(y,{...r,render:o})},f.set(t,n)}return n}function b(t){if(Array.isArray(t))return t.filter(n=>typeof n=="object"&&n!==null&&typeof n.render=="function").map(v)}function y({render:t,canvases:n,bodies:o,children:r}){const a=l(null),i=u(p);return d(()=>{const e=a.current;if(!e)return;const s=t(e,{canvases:n,bodies:o,clover:i});return()=>{typeof s=="function"&&s(),e.replaceChildren()}},[t,n,o,i]),c(m,{children:[c("div",{ref:a,className:"clover-body-renderer",style:{position:"absolute",inset:0}}),r&&c("div",{className:"clover-canvas-controls",children:r})]})}export{b as toRenderers};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{x as n,Z as o,Q as r}from"./shared-
|
|
1
|
+
import{x as n,Z as o,Q as r}from"./shared-YUjOSBKO.mjs";const t=(s,a)=>a==="canvas"?o(s.manifest,s.canvasId):s.manifest,e=r(null),i=()=>n(e);export{e as P,t as r,i as u};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
import{ae as w,j as f,n as x,W as S}from"./shared-
|
|
1
|
+
import{ae as w,j as f,n as x,W as S}from"./shared-YUjOSBKO.mjs";const A=10;async function R(r,t,s,o,e){var n,d;const i=(n=r.get().manifest)==null?void 0:n.id;try{const{hits:c,set:u}=await b(t,s,{request:o,signal:e});if(e.aborted||((d=r.get().manifest)==null?void 0:d.id)!==i)return;r.set({search:{query:s,status:"ready",hits:c,set:u}})}catch{if(e.aborted)return;r.set({search:{query:s,status:"error",hits:[],set:null}})}}async function b(r,t,{request:s,signal:o}={}){const e=new URL(r.id);e.searchParams.set("q",t);const i=[];let n=e.toString();const d=new Set;for(;n&&i.length<A&&!d.has(n);){d.add(n);const c=await w(s,n,o);i.push(c),n=$(c)}return E(i,t)}function T(r){var e;const t=f(r)[0];if(typeof t=="string"||!t)return t;const s=t.full??t["@id"],o=(e=f(t.selector)[0])==null?void 0:e.value;return typeof o=="string"&&typeof s=="string"?`${s}#${o}`:s}function $(r){var o;const t=r.next??((o=r.within)==null?void 0:o.next),s=typeof t=="string"?t:(t==null?void 0:t.id)??(t==null?void 0:t["@id"]);return typeof s=="string"?s:null}function E(r,t){var e,i;const s=[],o=[];for(const n of r){const d=Array.isArray(n.resources),c=d?n.resources:f(n.items),u=new Map;for(const a of c){const p=a.id??a["@id"],m=d?T(a.on):f(a.target)[0],v=x(m);if(!p||!v.id)continue;const y=d?(e=a.resource)==null?void 0:e.chars:f(a.body).map(l=>l==null?void 0:l.value).find(l=>typeof l=="string"),I={id:p,setId:S,canvasId:v.id,target:v,motivation:["highlighting"],bodies:[{value:String(y??t)}],annotation:{id:p,type:"Annotation",motivation:["highlighting"],body:{type:"TextualBody",value:String(y??t)},target:m}};u.set(p,I),s.push(I)}const g=d?H(n,u):M(n,u),h=new Set(g.flatMap(a=>a.entryIds));o.push(...g);for(const a of u.values())h.has(a.id)||o.push({id:a.id,canvasId:a.canvasId,entryIds:[a.id],match:((i=a.bodies[0])==null?void 0:i.value)??t})}return{query:t,hits:o,set:{id:S,label:{none:[t]},source:"search",entries:s}}}function H(r,t){var o;const s=[];for(const e of f(r.hits)){const i=f(e.annotations).filter(n=>t.has(n));i.length&&s.push({id:i.join(" "),canvasId:t.get(i[0]).canvasId,entryIds:i,before:e.before,match:String(e.match??((o=t.get(i[0]).bodies[0])==null?void 0:o.value)??""),after:e.after})}return s}function M(r,t){var o,e;const s=[];for(const i of f(r.annotations))for(const n of f(i==null?void 0:i.items))if(f(n==null?void 0:n.motivation).includes("contextualizing"))for(const c of f(n.target)){const u=typeof(c==null?void 0:c.source)=="string"?c.source:(o=c==null?void 0:c.source)==null?void 0:o.id,g=u?t.get(u):void 0;if(!g)continue;const h=f(c.selector).find(a=>(a==null?void 0:a.type)==="TextQuoteSelector");s.push({id:`${n.id??u}#${u}`,canvasId:g.canvasId,entryIds:[g.id],before:h==null?void 0:h.prefix,match:String((h==null?void 0:h.exact)??((e=g.bodies[0])==null?void 0:e.value)??""),after:h==null?void 0:h.suffix})}return s}export{E as readResults,b as search,R as searchInto};
|