@redot-src/glare 1.0.0 → 1.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +41 -9
- package/dist/core/animation.d.ts +7 -0
- package/dist/core/bind.d.ts +8 -0
- package/dist/core/dom.d.ts +18 -0
- package/dist/core/glare.d.ts +65 -0
- package/dist/core/idle.d.ts +9 -0
- package/dist/core/interactions.d.ts +3 -0
- package/dist/core/loaders.d.ts +5 -0
- package/dist/core/options.d.ts +5 -0
- package/dist/core/registry.d.ts +9 -0
- package/dist/core/zoom.d.ts +36 -0
- package/dist/defaults.d.ts +5 -5
- package/dist/esm.d.ts +3 -0
- package/dist/glare.css +1 -1
- package/dist/glare.esm.js +1101 -1173
- package/dist/glare.esm.js.map +1 -1
- package/dist/glare.js +25 -23
- package/dist/glare.js.map +1 -1
- package/dist/i18n.d.ts +4 -0
- package/dist/icons.d.ts +13 -13
- package/dist/index.d.ts +5 -7
- package/dist/media/detect.d.ts +4 -0
- package/dist/media/items.d.ts +6 -0
- package/dist/media/providers.d.ts +6 -0
- package/dist/modules/fullscreen.d.ts +15 -0
- package/dist/modules/gestures.d.ts +45 -0
- package/dist/modules/hash.d.ts +22 -0
- package/dist/modules/share.d.ts +17 -0
- package/dist/modules/slideshow.d.ts +25 -0
- package/dist/modules/thumbs.d.ts +22 -0
- package/dist/modules/wheel.d.ts +19 -0
- package/dist/templates.d.ts +7 -0
- package/dist/types.d.ts +121 -132
- package/dist/umd.d.ts +3 -0
- package/dist/utils/dom.d.ts +20 -0
- package/dist/utils/env.d.ts +5 -0
- package/dist/utils/object.d.ts +3 -0
- package/dist/utils/template.d.ts +5 -0
- package/package.json +18 -24
- package/dist/defaults.d.ts.map +0 -1
- package/dist/fullscreen.d.ts +0 -14
- package/dist/fullscreen.d.ts.map +0 -1
- package/dist/gestures.d.ts +0 -24
- package/dist/gestures.d.ts.map +0 -1
- package/dist/hash.d.ts +0 -20
- package/dist/hash.d.ts.map +0 -1
- package/dist/icons.d.ts.map +0 -1
- package/dist/index.d.ts.map +0 -1
- package/dist/instance.d.ts +0 -103
- package/dist/instance.d.ts.map +0 -1
- package/dist/media.d.ts +0 -5
- package/dist/media.d.ts.map +0 -1
- package/dist/share.d.ts +0 -13
- package/dist/share.d.ts.map +0 -1
- package/dist/slideshow.d.ts +0 -19
- package/dist/slideshow.d.ts.map +0 -1
- package/dist/thumbs.d.ts +0 -17
- package/dist/thumbs.d.ts.map +0 -1
- package/dist/types.d.ts.map +0 -1
- package/dist/utils.d.ts +0 -31
- package/dist/utils.d.ts.map +0 -1
- package/dist/wheel.d.ts +0 -11
- package/dist/wheel.d.ts.map +0 -1
package/dist/glare.js
CHANGED
|
@@ -1,28 +1,30 @@
|
|
|
1
|
-
(function(
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
<div class="glare-caption"></div>
|
|
13
|
-
</div>
|
|
1
|
+
(function(S,C){typeof exports=="object"&&typeof module<"u"?module.exports=C():typeof define=="function"&&define.amd?define(C):(S=typeof globalThis<"u"?globalThis:S||self,S.Glare=C())})(this,(function(){"use strict";const S={CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.<br/>Please try again later.",LOADING:"Loading",LIGHTBOX:"Media lightbox",GO_TO_SLIDE:"Go to slide {{index}}",VIDEO_UNSUPPORTED:"Your browser does not support HTML5 video.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",FULL_SCREEN_EXIT:"Exit full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",MORE:"More options",COPY:"Copy link",ZOOM:"Zoom",ZOOM_OUT:"Zoom out"};function C(e){const t=e.lang??"en";return{...S,...e.i18n?.en,...e.i18n?.[t]}}function y(e,t){return e.replace(/\{\{(\w+)\}\}/g,(s,i)=>t[i]??"")}function mt(e){return Object.entries(e).map(([t,s])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(s))}`).join("&")}function gt(e,t){return e.replace(/\$(\d+)/g,(s,i)=>t[Number(i)]??"")}const yt={youtube:{matcher:/(?:youtube\.com|youtu\.be|youtube-nocookie\.com)\/(?:watch\?(?:.*&)?v=|v\/|u\/\w\/|embed\/|shorts\/)?([\w-]{11})/i,type:"embed",url:"https://www.youtube-nocookie.com/embed/$1",thumb:"https://img.youtube.com/vi/$1/hqdefault.jpg",params:{autoplay:1,rel:0,modestbranding:1,playsinline:1}},vimeo:{matcher:/vimeo\.com\/(?:video\/)?(\d+)/i,type:"embed",url:"https://player.vimeo.com/video/$1",params:{autoplay:1,title:0,byline:0,portrait:0}},gmap:{matcher:/(?:maps\.)?google\.([a-z]{2,3}(?:\.[a-z]{2})?)\/(?:maps\/(?:place\/[^/]+\/)?@([^/]+)|maps\?q=([^&]+)|maps\/search\/([^/?]+))/i,type:"iframe",url:e=>{const[,t,s,i,r]=e;if(s){const[n,a,l]=s.split(","),d=l?Math.floor(parseFloat(l)):14;return`https://maps.google.${t}/maps?ll=${n},${a}&z=${d}&output=embed`}const o=encodeURIComponent(decodeURIComponent(i||r||""));return`https://maps.google.${t}/maps?q=${o}&output=embed`}}};function U(e,t,s){if(typeof e=="function")return e(t,s);if(typeof e=="string")return gt(e,t)}function bt(e,t){for(const s of Object.values(t??{})){const i=e.match(s.matcher);if(!i)continue;let r=U(s.url,i,e)??e;return s.params&&(r+=(r.includes("?")?"&":"?")+mt(s.params)),{src:r,type:s.type??"iframe",thumb:U(s.thumb,i,e)}}return null}const f=e=>`<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round" aria-hidden="true">${e}</svg>`,u={close:f('<path d="M18 6 6 18"/><path d="m6 6 12 12"/>'),next:f('<path d="m9 18 6-6-6-6"/>'),prev:f('<path d="m15 18-6-6 6-6"/>'),zoomIn:f('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M11 8v6"/><path d="M8 11h6"/>'),zoomOut:f('<circle cx="11" cy="11" r="8"/><path d="m21 21-4.3-4.3"/><path d="M8 11h6"/>'),download:f('<path d="M21 15v4a2 2 0 0 1-2 2H5a2 2 0 0 1-2-2v-4"/><polyline points="7 10 12 15 17 10"/><line x1="12" x2="12" y1="15" y2="3"/>'),share:f('<circle cx="18" cy="5" r="3"/><circle cx="6" cy="12" r="3"/><circle cx="18" cy="19" r="3"/><line x1="8.59" x2="15.42" y1="13.51" y2="17.49"/><line x1="15.41" x2="8.59" y1="6.51" y2="10.49"/>'),thumbs:f('<rect width="18" height="18" x="3" y="3" rx="2"/><path d="M3 9h18"/><path d="M9 21V9"/>'),play:f('<polygon points="6 3 20 12 6 21 6 3"/>'),pause:f('<rect width="4" height="16" x="6" y="4"/><rect width="4" height="16" x="14" y="4"/>'),fullscreen:f('<path d="M8 3H5a2 2 0 0 0-2 2v3"/><path d="M21 8V5a2 2 0 0 0-2-2h-3"/><path d="M3 16v3a2 2 0 0 0 2 2h3"/><path d="M16 21h3a2 2 0 0 0 2-2v-3"/>'),fullscreenExit:f('<path d="M8 3v3a2 2 0 0 1-2 2H3"/><path d="M21 8h-3a2 2 0 0 1-2-2V3"/><path d="M3 16h3a2 2 0 0 1 2 2v3"/><path d="M16 21v-3a2 2 0 0 1 2-2h3"/>'),more:f('<circle cx="5" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="12" cy="12" r="1" fill="currentColor" stroke="none"/><circle cx="19" cy="12" r="1" fill="currentColor" stroke="none"/>')},b=(e,t,s,i="")=>`<button type="button" class="glare-button glare-button--${e}" data-glare-${e} title="{{${t}}}" aria-label="{{${t}}}"${i}>${s}</button>`,vt=`
|
|
2
|
+
<div class="glare-container" role="dialog" aria-modal="true" tabindex="-1">
|
|
3
|
+
<div class="glare-bg"></div>
|
|
4
|
+
<div class="glare-progress" hidden></div>
|
|
5
|
+
<div class="glare-inner">
|
|
6
|
+
<div class="glare-live glare-sr-only" aria-live="polite" aria-atomic="true"></div>
|
|
7
|
+
<div class="glare-infobar"><span class="glare-infobar-index"></span></div>
|
|
8
|
+
<div class="glare-toolbar"></div>
|
|
9
|
+
<div class="glare-navigation">
|
|
10
|
+
${b("prev","PREV",u.prev)}
|
|
11
|
+
${b("next","NEXT",u.next)}
|
|
14
12
|
</div>
|
|
15
|
-
`,btnTpl:{download:`<a class="glare-button glare-button--download" data-glare-download download title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}" href="javascript:;">${u.download}</a>`,zoom:`<button type="button" class="glare-button glare-button--zoom" data-glare-zoom title="{{ZOOM}}" aria-label="{{ZOOM}}">${u.zoomIn}</button>`,close:`<button type="button" class="glare-button glare-button--close" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${u.close}</button>`,share:`<button type="button" class="glare-button glare-button--share" data-glare-share title="{{SHARE}}" aria-label="{{SHARE}}">${u.share}</button>`,thumbs:`<button type="button" class="glare-button glare-button--thumbs" data-glare-thumbs title="{{THUMBS}}" aria-label="{{THUMBS}}">${u.thumbs}</button>`,slideshow:`<button type="button" class="glare-button glare-button--slideshow" data-glare-slideshow title="{{PLAY_START}}" aria-label="{{PLAY_START}}">${u.play}</button>`,fullscreen:`<button type="button" class="glare-button glare-button--fullscreen" data-glare-fullscreen title="{{FULL_SCREEN}}" aria-label="{{FULL_SCREEN}}">${u.fullscreen}</button>`,smallBtn:`<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${u.close}</button>`}};function H(r){return typeof r=="object"&&r!==null&&!Array.isArray(r)}function C(r,...t){const e={...r};for(const s of t)if(!(!s||typeof s!="object"))for(const[i,n]of Object.entries(s)){if(n===void 0)continue;const o=e[i];H(o)&&H(n)&&!Array.isArray(n)?e[i]=C(o,n):e[i]=n}return e}function g(r,t=document){return t.querySelector(r)}function $(r,t=document){return Array.from(t.querySelectorAll(r))}function w(r,t,e){const s=document.createElement(r);return t&&(s.className=t),e!==void 0&&(s.innerHTML=e),s}function c(r,t,e,s){return r.addEventListener(t,e,s),()=>r.removeEventListener(t,e,s)}function m(r,t){for(const[e,s]of Object.entries(t))s==null?r.style.removeProperty(Y(e)):r.style[e]=String(s)}function Y(r){return r.replace(/[A-Z]/g,t=>`-${t.toLowerCase()}`)}function x(r,t,e){return Math.min(e,Math.max(t,r))}function V(){return/Android|webOS|iPhone|iPad|iPod|BlackBerry|IEMobile|Opera Mini/i.test(navigator.userAgent)||navigator.maxTouchPoints>1&&window.matchMedia("(pointer: coarse)").matches}function G(){return window.innerWidth-document.documentElement.clientWidth}function Z(r){const t=document.documentElement;if(r){const e=G();t.classList.add("glare-lock"),e>0&&(t.style.marginRight=`${e}px`)}else document.querySelector(".glare-container")||(t.classList.remove("glare-lock"),t.style.marginRight="")}function S(r,t){return r.replace(/\{\{(\w+)\}\}/g,(e,s)=>t[s]??"")}function A(r){return r.getBoundingClientRect()}function B(r){return window.requestAnimationFrame(r)}function M(r){B(()=>B(r))}function I(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function K(r){return Object.entries(r).map(([t,e])=>`${encodeURIComponent(t)}=${encodeURIComponent(String(e))}`).join("&")}function N(r,t){const e=r.x-t.x,s=r.y-t.y;return Math.hypot(e,s)}function Q(r,t){return{x:(r.x+t.x)/2,y:(r.y+t.y)/2}}function P(r){return"touches"in r?Array.from(r.touches).map(t=>({x:t.clientX,y:t.clientY})):[{x:r.clientX,y:r.clientY}]}class J{constructor(t){this.state={isPanning:!1,isSwiping:!1,isZooming:!1,startPoints:[],lastPoints:[],startDistance:0,startScale:1,startTranslate:{x:0,y:0},currentTranslate:{x:0,y:0},scale:1,startTime:0,moved:!1},this.cleanups=[],this.pointerId=null,this.instance=t}attach(t){this.detach(),this.cleanups.push(c(t,"pointerdown",e=>this.onPointerDown(e),{passive:!1}),c(window,"pointermove",e=>this.onPointerMove(e),{passive:!1}),c(window,"pointerup",e=>this.onPointerUp(e)),c(window,"pointercancel",e=>this.onPointerUp(e)),c(t,"touchstart",e=>this.onTouchStart(e),{passive:!1}),c(t,"touchmove",e=>this.onTouchMove(e),{passive:!1}),c(t,"touchend",e=>this.onTouchEnd(e)),c(t,"touchcancel",e=>this.onTouchEnd(e)))}detach(){this.cleanups.forEach(t=>t()),this.cleanups=[]}touchEnabled(){return this.instance.opts.touch!==!1}onPointerDown(t){if(!this.touchEnabled()||t.pointerType==="touch"||t.button!==0||t.target.closest("a, button, input, textarea, select, .glare-thumbs"))return;this.pointerId=t.pointerId;const s=[{x:t.clientX,y:t.clientY}];this.begin(s)}onPointerMove(t){this.pointerId===t.pointerId&&this.move([{x:t.clientX,y:t.clientY}],t)}onPointerUp(t){this.pointerId===t.pointerId&&(this.pointerId=null,this.end([{x:t.clientX,y:t.clientY}]))}onTouchStart(t){!this.touchEnabled()||t.target.closest("a, button, input, textarea, select, .glare-thumbs")||this.begin(P(t))}onTouchMove(t){this.move(P(t),t)}onTouchEnd(t){this.end(P(t))}begin(t){const e=this.instance.getZoomState();this.state={isPanning:!1,isSwiping:!1,isZooming:t.length>=2,startPoints:t,lastPoints:t,startDistance:t.length>=2?N(t[0],t[1]):0,startScale:e.scale,startTranslate:{x:e.x,y:e.y},currentTranslate:{x:e.x,y:e.y},scale:e.scale,startTime:performance.now(),moved:!1}}move(t,e){if(!this.state.startPoints.length)return;const s=this.instance.current;if(!s)return;if(t.length>=2&&this.state.startPoints.length>=2){e.preventDefault(),this.state.isZooming=!0,this.state.moved=!0;const h=N(t[0],t[1]),b=x(h/(this.state.startDistance||h)*this.state.startScale,1,5),y=Q(t[0],t[1]);this.state.scale=b,this.instance.applyZoom(b,y.x,y.y,!1),this.state.lastPoints=t;return}if(!t.length||!this.state.startPoints.length)return;const i=t[0].x-this.state.startPoints[0].x,n=t[0].y-this.state.startPoints[0].y,o=Math.abs(i),a=Math.abs(n);if(!this.state.moved&&o<6&&a<6)return;this.state.moved=!0;const l=this.instance.getZoomState();if(l.scale>1.01&&s.type==="image"||this.state.isPanning){e.preventDefault(),this.state.isPanning=!0;const h=this.state.startTranslate.x+i,b=this.state.startTranslate.y+n;this.state.currentTranslate={x:h,y:b},this.instance.applyZoom(l.scale,h,b,!1)}else{const h=this.instance.opts.touch;if(!(h&&typeof h=="object"?h.vertical!==!1:!0)&&a>o)return;e.preventDefault(),this.state.isSwiping=!0,this.instance.onSwipe(i,n,!1)}this.state.lastPoints=t}end(t){if(!this.state.startPoints.length)return;const e=Math.max(performance.now()-this.state.startTime,1),s=t[0]||this.state.lastPoints[0]||this.state.startPoints[0],i=this.state.startPoints[0],n=s.x-i.x,o=s.y-i.y,a={x:n/e,y:o/e};if(this.state.isSwiping)this.instance.onSwipe(n,o,!0,a);else if(this.state.isPanning){const l=this.instance.opts.touch;if(l&&typeof l=="object"?l.momentum!==!1:!0){const h=this.instance.getZoomState();this.instance.applyZoom(h.scale,this.state.currentTranslate.x+a.x*120,this.state.currentTranslate.y+a.y*120,!0)}}this.state.startPoints=[],this.state.isPanning=!1,this.state.isSwiping=!1,this.state.isZooming=!1}wasMoved(){return this.state.moved}resetMoved(){this.state.moved=!1}}class tt{constructor(t){this.cleanups=[],this.instance=t}init(){this.cleanups.push(c(document,"fullscreenchange",()=>this.sync()),c(document,"webkitfullscreenchange",()=>this.sync()))}isFullscreen(){const t=document;return!!(document.fullscreenElement||t.webkitFullscreenElement||t.mozFullScreenElement||t.msFullscreenElement)}request(){const t=this.instance.$refs.container||document.documentElement;(t.requestFullscreen||t.webkitRequestFullscreen||t.mozRequestFullScreen||t.msRequestFullscreen)?.call(t)}exit(){const t=document,e=document.exitFullscreen||t.webkitExitFullscreen||t.mozCancelFullScreen||t.msExitFullscreen;this.isFullscreen()&&e?.call(document)}toggle(){this.isFullscreen()?this.exit():this.request()}sync(){const t=this.isFullscreen();this.instance.$refs.container?.classList.toggle("glare-is-fullscreen",t);const e=this.instance.$refs.container?.querySelector("[data-glare-fullscreen]");e&&(e.innerHTML=t?u.fullscreenExit:u.fullscreen,e.classList.toggle("is-active",t))}destroy(){this.isFullscreen()&&this.exit(),this.cleanups.forEach(t=>t()),this.cleanups=[]}}function O(){const r=window.location.hash.replace(/^#/,"");if(!r)return null;const t=r.match(/^(?:glare-)?(.+?)(?:-|\/)(\d+)$/);return t?{gallery:t[1],index:Math.max(0,parseInt(t[2],10)-1)}:null}function et(r,t){return`${r}-${t+1}`}const D=class D{constructor(t,e){this.cleanups=[],this.skipping=!1,this.instance=t,this.gallery=e||"gallery"}init(){this.cleanups.push(c(window,"hashchange",()=>{if(this.skipping)return;const t=O();if(!t||t.gallery!==this.gallery){this.instance.isActive&&this.instance.close();return}t.index!==this.instance.currIndex&&this.instance.jumpTo(t.index)})),this.update()}update(t=this.instance.currIndex){if(!this.gallery)return;const e=et(this.gallery,t);if(window.location.hash.replace(/^#/,"")===e)return;this.skipping=!0;const s=`${window.location.pathname}${window.location.search}#${e}`;window.history.replaceState(null,"",s),queueMicrotask(()=>{this.skipping=!1})}clear(){const t=O();if(t&&t.gallery===this.gallery){this.skipping=!0;const e=`${window.location.pathname}${window.location.search}`;window.history.replaceState(null,"",e),queueMicrotask(()=>{this.skipping=!1})}}destroy(){this.clear(),this.cleanups.forEach(t=>t()),this.cleanups=[]}};D.parse=O;let z=D;const _=/\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i,U=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i,st=/\.pdf(\?.*)?$/i;function W(r,t){return t||(r?r.startsWith("#")||r.startsWith(".")?"inline":_.test(r)?"image":U.test(r)?"video":st.test(r)||/^https?:\/\//i.test(r)||r.startsWith("//")||r.startsWith("/")?"iframe":"html":"html")}function it(r,t){if(!t)return null;for(const e of Object.values(t)){const s=r.match(e.matcher);if(!s)continue;let i=r;if(typeof e.url=="function"?i=e.url(s,r):typeof e.url=="string"&&(i=e.url.replace(/\$(\d+)/g,(o,a)=>s[Number(a)]||"")),e.params){const o=i.includes("?")?"&":"?";i+=o+K(e.params)}let n;return typeof e.thumb=="function"?n=e.thumb(s,r):typeof e.thumb=="string"&&(n=e.thumb.replace(/\$(\d+)/g,(o,a)=>s[Number(a)]||"")),{src:i,type:e.type||"iframe",thumb:n}}return null}function F(r,t,e){const s=typeof r=="string"?{src:r}:{...r};let i=s.src||"",n=s.type,o=s.thumb;s.html&&!i&&(n="html",i="");const a=i?it(i,e.media):null;a&&(i=a.src||i,n=a.type||n,o=o||a.thumb),n||(s.content||s.html?n="html":n=W(i,e.defaultType)),n==="iframe"&&_.test(i)&&(n="image"),n==="iframe"&&U.test(i)&&(n="video");const l={...s,index:t,src:i,type:n,thumb:o,caption:s.caption??s.title??"",isLoaded:!1,isComplete:!1,hasError:!1,canZoomIn:!1,canZoomOut:!1};return s.opts&&(l.opts=C({},e,s.opts)),l}function X(r,t){return r.map((e,s)=>{const i=e.getAttribute("data-src")||e.getAttribute("data-glare-src")||e.getAttribute("href")||"",n=e.getAttribute("data-type")||e.getAttribute("data-glare-type")||void 0,o=e.getAttribute("data-caption")||e.getAttribute("data-glare-caption")||e.getAttribute("title")||"",a=e.getAttribute("data-thumb")||e.getAttribute("data-glare-thumb")||e.querySelector("img")?.getAttribute("src")||void 0,l=e.getAttribute("data-width")||void 0,d=e.getAttribute("data-height")||void 0,h=e.getAttribute("data-poster")||void 0,b=e.getAttribute("data-download-src")||e.getAttribute("data-glare-download")||void 0;let y;const R=e.getAttribute("data-html")||e.getAttribute("data-glare-html");return R&&(y=R),F({src:i,type:n,caption:o,thumb:a,width:l,height:d,poster:h,downloadSrc:b,html:y,alt:e.querySelector("img")?.getAttribute("alt")||o||"",$trigger:e},s,t)})}const nt=`
|
|
16
|
-
<div class="glare-
|
|
17
|
-
|
|
13
|
+
<div class="glare-stage"></div>
|
|
14
|
+
<div class="glare-caption"></div>
|
|
15
|
+
</div>
|
|
16
|
+
</div>`,xt={zoom:b("zoom","ZOOM",u.zoomIn),slideshow:b("slideshow","PLAY_START",u.play),thumbs:b("thumbs","THUMBS",u.thumbs,' aria-expanded="false"'),share:b("share","SHARE",u.share),fullscreen:b("fullscreen","FULL_SCREEN",u.fullscreen),more:b("more","MORE",u.more,' aria-expanded="false" aria-haspopup="true"'),close:b("close","CLOSE",u.close),download:`<a class="glare-button glare-button--download" data-glare-download download target="_blank" rel="noopener" title="{{DOWNLOAD}}" aria-label="{{DOWNLOAD}}">${u.download}</a>`,smallBtn:`<button type="button" class="glare-button glare-close-small" data-glare-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${u.close}</button>`},wt='<div class="glare-spinner" role="status" aria-label="{{LOADING}}"></div>',Et='<div class="glare-error"><p>{{ERROR}}</p></div>',Tt='<video class="glare-video" controls playsinline controlsList="nodownload" poster="{{poster}}"><source src="{{src}}" type="{{format}}"/>{{VIDEO_UNSUPPORTED}}</video>',St='<iframe class="glare-iframe"></iframe>',Lt=`
|
|
17
|
+
<div class="glare-share" role="dialog" aria-label="{{SHARE}}">
|
|
18
|
+
<div class="glare-share-head">
|
|
19
|
+
<h4 class="glare-share-title">{{SHARE}}</h4>
|
|
20
|
+
<button type="button" class="glare-button glare-share-close" data-glare-share-close title="{{CLOSE}}" aria-label="{{CLOSE}}">${u.close}</button>
|
|
21
|
+
</div>
|
|
18
22
|
<p><a class="glare-share-link" href="{{url_facebook}}" target="_blank" rel="noopener">Facebook</a></p>
|
|
19
23
|
<p><a class="glare-share-link" href="{{url_twitter}}" target="_blank" rel="noopener">X / Twitter</a></p>
|
|
20
24
|
<p><a class="glare-share-link" href="{{url_pinterest}}" target="_blank" rel="noopener">Pinterest</a></p>
|
|
21
|
-
<
|
|
22
|
-
|
|
23
|
-
`;class rt{constructor(t,e){this.$overlay=null,this.cleanups=[],this.instance=t,this.opts=e===!0?{}:e}open(){const t=this.instance.current;if(!t||!this.instance.$refs.container)return;this.close();const e=this.resolveUrl(t),s=encodeURIComponent(e),i=encodeURIComponent(t.thumb||t.src||e),n=encodeURIComponent(t.caption||""),o=this.instance.opts.lang||"en",a={...this.instance.opts.i18n?.en||{},...this.instance.opts.i18n?.[o]||{},url_direct:e,url_facebook:`https://www.facebook.com/sharer/sharer.php?u=${s}`,url_twitter:`https://twitter.com/intent/tweet?url=${s}&text=${n}`,url_pinterest:`https://pinterest.com/pin/create/button/?url=${s}&media=${i}&description=${n}`},l=S(this.opts.tpl||nt,a);this.$overlay=w("div","glare-share-overlay",l),this.instance.$refs.container.appendChild(this.$overlay),this.$overlay.querySelector(".glare-share-input")?.select(),this.cleanups.push(c(this.$overlay,"click",h=>{h.target===this.$overlay&&this.close()}))}close(){this.cleanups.forEach(t=>t()),this.cleanups=[],this.$overlay?.remove(),this.$overlay=null}resolveUrl(t){return typeof this.opts.url=="function"?this.opts.url(t):typeof this.opts.url=="string"?this.opts.url:t.src&&/^https?:\/\//i.test(t.src)?t.src:window.location.href}destroy(){this.close()}}class ot{constructor(t,e){this.timer=null,this.active=!1,this.instance=t,this.opts=e}init(){this.opts.autoStart&&this.start()}isActive(){return this.active}start(){this.instance.group.length<2||(this.active=!0,this.instance.$refs.container?.classList.add("glare-is-slideshow"),this.updateButton(),this.queue())}stop(){this.active=!1,this.clear(),this.instance.$refs.container?.classList.remove("glare-is-slideshow"),this.updateButton()}toggle(){this.active?this.stop():this.start()}queue(){this.clear(),this.active&&(this.timer=setTimeout(()=>{this.active&&(this.instance.next(),this.queue())},this.opts.speed||3e3))}clear(){this.timer&&(clearTimeout(this.timer),this.timer=null)}updateButton(){const t=this.instance.$refs.container?.querySelector("[data-glare-slideshow]");if(!t)return;const e=this.active?this.getLabel("PLAY_STOP"):this.getLabel("PLAY_START");t.setAttribute("title",e),t.setAttribute("aria-label",e),t.innerHTML=this.active?u.pause:u.play,t.classList.toggle("is-active",this.active)}getLabel(t){const e=this.instance.opts.lang||"en";return{...this.instance.opts.i18n?.en||{},...this.instance.opts.i18n?.[e]||{}}[t]||t}destroy(){this.stop()}}class at{constructor(t,e){this.isActive=!1,this.$container=null,this.$list=null,this.cleanups=[],this.instance=t,this.opts=e}init(){if(this.instance.group.length<2)return;const t=typeof this.opts.parentEl=="string"?g(this.opts.parentEl)||this.instance.$refs.container:this.opts.parentEl||this.instance.$refs.container;if(t){this.$container=w("div",`glare-thumbs glare-thumbs--${this.opts.axis||"y"}`),this.$list=w("div","glare-thumbs-list"),this.$container.appendChild(this.$list);for(const e of this.instance.group){const s=w("button","glare-thumbs-item");if(s.type="button",s.setAttribute("aria-label",`Go to slide ${e.index+1}`),s.dataset.index=String(e.index),e.thumb||e.type==="image"&&e.src){const i=w("img");i.src=e.thumb||e.src,i.alt=e.alt||e.caption||"",i.loading="lazy",s.appendChild(i)}else s.textContent=String(e.index+1);this.$list.appendChild(s),this.cleanups.push(c(s,"click",()=>{this.instance.jumpTo(e.index)}))}t.appendChild(this.$container),this.opts.autoStart&&this.show(),this.focus(this.instance.currIndex)}}show(){this.$container&&(this.isActive=!0,this.$container.classList.add("glare-thumbs--active"),this.instance.$refs.container?.classList.add("glare-show-thumbs"))}hide(){this.$container&&(this.isActive=!1,this.$container.classList.remove("glare-thumbs--active"),this.instance.$refs.container?.classList.remove("glare-show-thumbs"))}toggle(){this.isActive?this.hide():this.show()}focus(t=this.instance.currIndex){if(!this.$list)return;$(".glare-thumbs-item",this.$list).forEach(s=>{s.classList.toggle("is-active",Number(s.dataset.index)===t)}),this.$list.querySelector(".is-active")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}destroy(){this.opts.hideOnClose!==!1&&this.hide(),this.cleanups.forEach(t=>t()),this.cleanups=[],this.$container?.remove(),this.$container=null,this.$list=null}}class lt{constructor(t,e){this.cleanups=[],this.locked=!1,this.instance=t,this.mode=e}init(t){this.mode!==!1&&this.cleanups.push(c(t,"wheel",e=>{const s=e;if(this.locked)return;const i=this.instance.current;i&&(this.mode==="auto"&&i.type!=="image"||i.type==="image"&&this.instance.$refs.container?.classList.contains("glare-can-zoom-out")||(s.preventDefault(),this.locked=!0,s.deltaY>0?this.instance.next():this.instance.prev(),setTimeout(()=>{this.locked=!1},350)))},{passive:!1}))}destroy(){this.cleanups.forEach(t=>t()),this.cleanups=[]}}let ct=0;const f=[];function ht(r){return r?typeof r=="string"?g(r)||document.body:r:document.body}const v=class v{constructor(t,e={},s=0,i=""){this.group=[],this.current=null,this.currIndex=0,this.prevIndex=0,this.isActive=!1,this.isClosing=!1,this.isAnimating=!1,this.isIdle=!1,this.$refs={container:null,stage:null,bg:null,inner:null,caption:null,toolbar:null,infobar:null,navigation:null},this.galleryName="",this.cleanups=[],this.idleTimer=null,this.gestures=null,this.hash=null,this.wheel=null,this.share=null,this.zoom={scale:1,x:0,y:0,min:1,max:5},this.previouslyFocused=null,this.openedFrom=null,this.id=++ct,this.galleryName=i;const n=C({},T,e);V()&&n.mobile?this.opts=C({},n,n.mobile):this.opts=n,t.length&&t[0]instanceof HTMLElement?this.group=X(t,this.opts):this.group=t.map((o,a)=>F(o,a,this.opts)),this.currIndex=x(s,0,Math.max(0,this.group.length-1))}open(t=this.currIndex){if(this.isActive){this.jumpTo(t);return}this.opts.closeExisting&&v.close(!0),this.currIndex=x(t,0,Math.max(0,this.group.length-1)),this.current=this.group[this.currIndex]||null,this.openedFrom=this.current?.$trigger||null,this.previouslyFocused=document.activeElement,this.trigger("onInit"),this.build(),this.isActive=!0,f.push(this),this.opts.hideScrollbar&&Z(!0),this.trigger("onActivate"),this.trigger("beforeShow",this.current||void 0),M(()=>{this.$refs.container?.classList.add("glare-is-open","glare-is-animated"),this.loadSlide(this.currIndex,!0),this.bindEvents(),this.initModules(),this.opts.autoFocus&&this.focus(),this.resetIdle()})}close(t,e){if(!this.isActive||this.isClosing||this.trigger("beforeClose",this.current||void 0)===!1)return;this.isClosing=!0,this.SlideShow?.stop(),this.clearIdle();const s=this.$refs.container,i=e??(I()?0:this.opts.animationDuration||0);s?.classList.add("glare-is-closing"),s?.classList.remove("glare-is-open");const n=()=>{this.teardown()};if(i>0&&s){const o=a=>{a.target===s&&(s.removeEventListener("transitionend",o),n())};s.addEventListener("transitionend",o),setTimeout(n,i+50)}else n()}next(t){this.jumpTo(this.currIndex+1,t)}previous(t){this.jumpTo(this.currIndex-1,t)}prev(t){this.previous(t)}jumpTo(t,e){if(!this.isActive||this.isClosing)return;const s=this.group.length;if(!s)return;let i=t;if(this.opts.loop)i=(t%s+s)%s;else if(i=x(t,0,s-1),i===this.currIndex&&t!==this.currIndex)return;i!==this.currIndex&&(this.prevIndex=this.currIndex,this.currIndex=i,this.current=this.group[i],this.resetZoom(),this.loadSlide(i,!1,e),this.updateChrome(),this.Thumbs?.focus(i),this.hash?.update(i),this.trigger("onUpdate",this.current))}scaleToFit(t=300){this.animateZoom(1,0,0,t),this.$refs.container?.classList.remove("glare-can-zoom-out"),this.$refs.container?.classList.add("glare-can-zoom-in"),this.updateZoomButton()}scaleToActual(t,e,s=300){const i=this.getImageWrap();if(!i)return;const n=A(i),o=t??n.left+n.width/2,a=e??n.top+n.height/2,l=Math.min(this.zoom.max,2.5),d=(n.left+n.width/2-o)*(l-1),h=(n.top+n.height/2-a)*(l-1);this.animateZoom(l,d,h,s),this.$refs.container?.classList.add("glare-can-zoom-out"),this.$refs.container?.classList.remove("glare-can-zoom-in"),this.updateZoomButton()}update(){this.updateChrome(),this.positionContent()}focus(){this.$refs.container?.focus({preventScroll:!0})}toggleControls(t){const e=this.$refs.container;if(!e)return;const s=t===void 0?!e.classList.contains("glare-is-idle"):t;e.classList.toggle("glare-is-idle",s),this.isIdle=s}getContentEl(){return this.current?.$content||null}getImageWrap(){return this.current?.$slide?.querySelector(".glare-content")}getZoomState(){return{...this.zoom}}applyZoom(t,e,s,i=!1){this.animateZoom(t,e,s,i?250:0);const n=t>1.01;this.$refs.container?.classList.toggle("glare-can-zoom-out",n),this.$refs.container?.classList.toggle("glare-can-zoom-in",!n),this.updateZoomButton()}onSwipe(t,e,s,i){const n=this.$refs.stage;if(!n)return;if(!s){if(m(n,{transform:`translate3d(${t}px, ${e}px, 0)`,transitionDuration:"0ms"}),this.$refs.bg){const h=x(1-Math.abs(e)/400,.35,1);m(this.$refs.bg,{opacity:String(h)})}return}const o=Math.abs(t),a=Math.abs(e),l=i?.x||0,d=i?.y||0;if(m(n,{transitionDuration:""}),this.$refs.bg&&m(this.$refs.bg,{opacity:""}),(a>100||Math.abs(d)>.5)&&a>o){this.close();return}(o>80||Math.abs(l)>.4)&&(t<0?this.next():this.prev()),m(n,{transform:""})}build(){const t=this.dict(),e=S(this.opts.baseTpl||"",t),i=w("div","",e).firstElementChild;i.dataset.glareId=String(this.id),this.opts.baseClass&&i.classList.add(this.opts.baseClass),this.opts.modal&&i.classList.add("glare-is-modal"),this.$refs.container=i,this.$refs.bg=g(".glare-bg",i),this.$refs.inner=g(".glare-inner",i),this.$refs.stage=g(".glare-stage",i),this.$refs.caption=g(".glare-caption",i),this.$refs.toolbar=g(".glare-toolbar",i),this.$refs.infobar=g(".glare-infobar",i),this.$refs.navigation=g(".glare-navigation",i),this.buildToolbar(),this.updateChrome(),(!this.opts.arrows||this.group.length<2)&&this.$refs.navigation?.classList.add("glare-hidden"),(!this.opts.infobar||this.group.length<2)&&this.$refs.infobar?.classList.add("glare-hidden"),ht(this.opts.parentEl).appendChild(i)}buildToolbar(){const t=this.$refs.toolbar;if(!t)return;if(!(this.opts.toolbar===!0||this.opts.toolbar==="auto")){t.classList.add("glare-hidden");return}const s=this.dict(),i=this.opts.buttons||[];t.innerHTML="";for(const n of i){if(n==="thumbs"&&this.group.length<2||n==="slideshow"&&this.group.length<2)continue;const o=this.opts.btnTpl?.[n];o&&t.insertAdjacentHTML("beforeend",S(o,s))}}initModules(){const t=this.opts.thumbs;if(t){const s=t===!0?{...T.thumbs}:t;this.Thumbs=new at(this,s),this.Thumbs.init()}const e=this.opts.slideShow;if(e){const s=e===!0?{...T.slideShow}:e;this.SlideShow=new ot(this,s),this.SlideShow.init()}if(this.opts.fullScreen!==!1){this.FullScreen=new tt(this),this.FullScreen.init();const s=this.opts.fullScreen;s&&typeof s=="object"&&s.autoStart&&this.FullScreen.request()}this.opts.share&&(this.share=new rt(this,this.opts.share)),this.opts.hash&&this.galleryName&&(this.hash=new z(this,this.galleryName),this.hash.init()),this.opts.wheel!==!1&&this.$refs.stage&&(this.wheel=new lt(this,this.opts.wheel||"auto"),this.wheel.init(this.$refs.stage)),this.opts.touch!==!1&&this.$refs.stage&&(this.gestures=new J(this),this.gestures.attach(this.$refs.stage))}bindEvents(){const t=this.$refs.container;t&&(this.cleanups.push(c(t,"click",e=>this.onClick(e)),c(t,"dblclick",e=>this.onDblClick(e)),c(document,"keydown",e=>this.onKeydown(e)),c(window,"resize",()=>this.positionContent()),c(window,"orientationchange",()=>this.positionContent()),c(document,"mousemove",()=>this.resetIdle()),c(document,"touchstart",()=>this.resetIdle(),{passive:!0})),this.opts.trapFocus&&this.cleanups.push(c(t,"keydown",e=>{const s=e;if(s.key!=="Tab")return;const i=$('button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',t).filter(a=>!a.hasAttribute("disabled")&&a.offsetParent!==null);if(!i.length)return;const n=i[0],o=i[i.length-1];s.shiftKey&&document.activeElement===n?(s.preventDefault(),o.focus()):!s.shiftKey&&document.activeElement===o&&(s.preventDefault(),n.focus())})),this.opts.protect&&this.cleanups.push(c(t,"contextmenu",e=>{e.preventDefault()}),c(t,"dragstart",e=>{e.target.tagName==="IMG"&&e.preventDefault()})))}onClick(t){if(this.gestures?.wasMoved()){this.gestures.resetMoved();return}const e=t.target;if(e.closest("[data-glare-close]")){this.close(t);return}if(e.closest("[data-glare-next]")){this.next();return}if(e.closest("[data-glare-prev]")){this.prev();return}if(e.closest("[data-glare-zoom]")){this.toggleZoom(t);return}if(e.closest("[data-glare-slideshow]")){this.SlideShow?.toggle();return}if(e.closest("[data-glare-thumbs]")){this.Thumbs?.toggle();return}if(e.closest("[data-glare-fullscreen]")){this.FullScreen?.toggle();return}if(e.closest("[data-glare-share]")){this.share?.open();return}if(!e.closest("[data-glare-download]")){if(e.closest(".glare-content")||e.closest(".glare-space")){this.handleClickAction(this.opts.clickContent,t);return}if(e.closest(".glare-slide")){this.handleClickAction(this.opts.clickSlide,t);return}(e.classList.contains("glare-bg")||e.classList.contains("glare-stage"))&&this.handleClickAction(this.opts.clickOutside,t)}}onDblClick(t){const e=t.target;e.closest(".glare-content")||e.closest(".glare-space")?this.handleClickAction(this.opts.dblclickContent,t):e.closest(".glare-slide")?this.handleClickAction(this.opts.dblclickSlide,t):this.handleClickAction(this.opts.dblclickOutside,t)}handleClickAction(t,e){if(!t||!this.current)return;let s=t;switch(typeof t=="function"&&(s=t(this.current,e)),s){case"close":this.close(e);break;case"next":this.next();break;case"nextOrClose":this.currIndex===this.group.length-1&&!this.opts.loop?this.close(e):this.next();break;case"toggleControls":this.toggleControls();break;case"zoom":this.toggleZoom(e);break}}onKeydown(t){if(!this.isActive||!this.opts.keyboard||this.opts.modal||f[f.length-1]!==this)return;const e=t.target?.tagName;if(!(e==="INPUT"||e==="TEXTAREA"||e==="SELECT"))switch(t.key){case"Escape":t.preventDefault(),this.close(t);break;case"ArrowRight":case"ArrowDown":t.preventDefault(),this.next();break;case"ArrowLeft":case"ArrowUp":t.preventDefault(),this.prev();break;case" ":case"Spacebar":t.preventDefault(),this.SlideShow?.toggle();break;case"f":case"F":this.FullScreen?.toggle();break}}loadSlide(t,e,s){const i=this.$refs.stage;if(!i)return;const n=this.group[t];if(!n)return;$(".glare-slide",i).forEach(a=>{Number(a.dataset.index)!==t&&(a.classList.add("glare-slide--out"),setTimeout(()=>a.remove(),this.opts.transitionDuration||366))});let o=i.querySelector(`.glare-slide[data-index="${t}"]`);if(o||(o=w("div",`glare-slide${this.opts.slideClass?` ${this.opts.slideClass}`:""}`),o.dataset.index=String(t),o.innerHTML=`
|
|
24
|
-
|
|
25
|
-
<div class="glare-content"></div>
|
|
26
|
-
</div>
|
|
27
|
-
`,i.appendChild(o)),n.$slide=o,n.$content=g(".glare-content",o),n.pos=t,o.classList.add("glare-slide--current"),o.classList.remove("glare-slide--out"),this.shouldSmallBtn(n)){const a=this.dict();o.querySelector(".glare-close-small")||o.insertAdjacentHTML("beforeend",S(this.opts.btnTpl?.smallBtn||"",a))}this.showSpinner(o),this.trigger("beforeLoad",n),this.resolveContent(n).then(()=>{!this.isActive||this.currIndex!==t||(this.hideSpinner(o),this.trigger("afterLoad",n),this.positionContent(),this.updateChrome(),this.updateDownload(n),e?this.playOpenAnimation(n):this.playTransition(),this.trigger("afterShow",n),this.trigger("onReveal",n))}).catch(()=>{!this.isActive||this.currIndex!==t||(this.hideSpinner(o),this.showError(n))}),this.opts.image?.preload&&[t-1,t+1].forEach(a=>{const l=this.group[a];if(l?.type==="image"&&l.src){const d=new Image;d.src=l.src}})}shouldSmallBtn(t){return this.opts.smallBtn===!0?!0:this.opts.smallBtn===!1?!1:t.type!=="image"}async resolveContent(t){const e=t.$content;if(!e)throw new Error("Missing content node");switch(e.innerHTML="",e.className=`glare-content glare-content--${t.type}`,t.type){case"image":await this.loadImage(t,e);break;case"video":this.loadVideo(t,e);break;case"iframe":await this.loadIframe(t,e);break;case"inline":this.loadInline(t,e);break;case"ajax":await this.loadAjax(t,e);break;default:this.loadHtml(t,e);break}t.isLoaded=!0,t.isComplete=!0}loadImage(t,e){return new Promise((s,i)=>{const n=w("img","glare-image");n.alt=t.alt||t.caption||"",n.decoding="async",n.draggable=!1,this.opts.protect&&(n.style.pointerEvents="none"),n.onload=()=>{t.$image=n,t.contentWidth=n.naturalWidth,t.contentHeight=n.naturalHeight,t.canZoomIn=!0,e.appendChild(n),this.$refs.container?.classList.add("glare-can-zoom-in"),s()},n.onerror=()=>{t.hasError=!0,i(new Error("image error"))},n.src=t.src})}loadVideo(t,e){const s=t.format||this.opts.video?.format||(t.src.match(/\.(\w+)(?:\?|$)/)?.[1]?`video/${t.src.match(/\.(\w+)(?:\?|$)/)?.[1]?.replace("ogv","ogg")}`:"video/mp4"),i=S(this.opts.video?.tpl||"",{src:t.src,format:s,poster:t.poster||""});e.innerHTML=i;const n=e.querySelector("video");t.$content=e,n&&(t.autoStart??this.opts.video?.autoStart)&&n.play().catch(()=>{})}loadIframe(t,e){return new Promise(s=>{const i=w("div","glare-iframe-wrap");i.innerHTML=this.opts.iframe?.tpl||'<iframe class="glare-iframe"></iframe>';const n=i.querySelector("iframe"),o=this.opts.iframe?.attr||{};for(const[a,l]of Object.entries(o))n.setAttribute(a,l);if(this.opts.iframe?.css&&m(n,this.opts.iframe.css),t.width&&m(i,{width:typeof t.width=="number"?`${t.width}px`:String(t.width)}),t.height&&m(i,{height:typeof t.height=="number"?`${t.height}px`:String(t.height)}),e.appendChild(i),this.opts.iframe?.preload===!1){n.src=t.src,s();return}n.onload=()=>s(),n.src=t.src,setTimeout(()=>s(),1200)})}loadInline(t,e){const s=t.src?g(t.src):null;if(!s)throw t.hasError=!0,new Error("inline target missing");const i=s.cloneNode(!0);i.id="",i.classList.remove("glare-hidden"),i.hidden=!1,i.style.display="",e.appendChild(i)}async loadAjax(t,e){const s=this.opts.ajax?.settings||{},i=await fetch(t.src,s);if(!i.ok)throw new Error("ajax failed");const n=await i.text();e.innerHTML=n}loadHtml(t,e){t.content instanceof HTMLElement?e.appendChild(t.content):e.innerHTML=t.html||t.content||t.src||""}showSpinner(t){t.querySelector(".glare-spinner")||t.insertAdjacentHTML("beforeend",this.opts.spinnerTpl||"")}hideSpinner(t){t.querySelector(".glare-spinner")?.remove()}showError(t){t.hasError=!0;const e=t.$content;e&&(e.className="glare-content glare-content--error",e.innerHTML=S(this.opts.errorTpl||"",this.dict()))}playOpenAnimation(t){const e=this.$refs.container;if(!e)return;const s=I()?!1:this.opts.animationEffect;if(e.dataset.animation=s?String(s):"none",e.style.setProperty("--glare-duration",`${this.opts.animationDuration||0}ms`),s==="zoom"&&t.$trigger&&t.type==="image"&&t.$image){const i=A(t.$trigger),n=A(t.$image),o=i.width/Math.max(n.width,1),a=i.height/Math.max(n.height,1),l=i.left+i.width/2-(n.left+n.width/2),d=i.top+i.height/2-(n.top+n.height/2);m(t.$image,{transform:`translate3d(${l}px, ${d}px, 0) scale(${Math.max(o,a)})`,opacity:this.opts.zoomOpacity===!1?"1":"0.2",transitionDuration:"0ms"}),M(()=>{t.$image&&m(t.$image,{transform:"",opacity:"",transitionDuration:`${this.opts.animationDuration||366}ms`})})}M(()=>e.classList.add("glare-is-ready"))}playTransition(){const t=this.$refs.container;if(!t)return;const e=I()?!1:this.opts.transitionEffect;t.dataset.transition=e?String(e):"none",t.style.setProperty("--glare-transition-duration",`${this.opts.transitionDuration||0}ms`)}positionContent(){const t=this.current;if(!t?.$image||!t.contentWidth||!t.contentHeight)return;const e=t.$slide;if(!e)return;const s=g(".glare-space",e);if(!s)return;const i=A(s),n=Math.min(i.width/t.contentWidth,i.height/t.contentHeight,1);t.canZoomIn=n<.98||t.contentWidth>i.width||t.contentHeight>i.height,this.$refs.container?.classList.toggle("glare-can-zoom-in",!!t.canZoomIn&&this.zoom.scale<=1.01)}updateChrome(){const t=this.current;if(!t)return;if(this.$refs.infobar){const i=g(".glare-infobar-index",this.$refs.infobar);i&&(i.textContent=`${this.currIndex+1} / ${this.group.length}`)}if(this.$refs.caption){let i=t.caption||"";typeof this.opts.caption=="function"?i=this.opts.caption(this,t):typeof this.opts.caption=="string"&&(i=this.opts.caption),this.$refs.caption.innerHTML=i,this.$refs.caption.classList.toggle("glare-hidden",!i),this.$refs.container?.classList.toggle("glare-show-caption",!!i)}const e=this.currIndex===0&&!this.opts.loop,s=this.currIndex===this.group.length-1&&!this.opts.loop;this.$refs.container?.querySelector("[data-glare-prev]")?.classList.toggle("glare-disabled",e),this.$refs.container?.querySelector("[data-glare-next]")?.classList.toggle("glare-disabled",s),this.$refs.container?.setAttribute("aria-label",dt(t,this.currIndex,this.group.length))}updateDownload(t){const e=this.$refs.container?.querySelector("[data-glare-download]");if(!e)return;const s=t.downloadSrc||(t.type==="image"?t.src:"");s?(e.href=s,e.classList.remove("glare-hidden")):e.classList.add("glare-hidden")}toggleZoom(t){if(!(!this.current||this.current.type!=="image"))if(this.zoom.scale>1.01)this.scaleToFit();else{const e=t?{x:t.clientX,y:t.clientY}:void 0;this.scaleToActual(e?.x,e?.y)}}animateZoom(t,e,s,i=0){const n=this.getImageWrap(),o=this.current?.$image;!n||!o||(this.zoom.scale=x(t,this.zoom.min,this.zoom.max),this.zoom.x=e,this.zoom.y=s,m(o,{transform:`translate3d(${e}px, ${s}px, 0) scale(${this.zoom.scale})`,transitionDuration:`${i}ms`}))}resetZoom(){this.zoom={scale:1,x:0,y:0,min:1,max:5},this.$refs.container?.classList.remove("glare-can-zoom-out")}updateZoomButton(){const t=this.$refs.container?.querySelector("[data-glare-zoom]");t&&(t.innerHTML=this.zoom.scale>1.01?u.zoomOut:u.zoomIn,t.classList.toggle("is-active",this.zoom.scale>1.01))}resetIdle(){this.clearIdle(),this.isIdle&&this.toggleControls(!1);const t=this.opts.idleTime;!t||this.opts.modal||(this.idleTimer=setTimeout(()=>{this.toggleControls(!0)},t*1e3))}clearIdle(){this.idleTimer&&(clearTimeout(this.idleTimer),this.idleTimer=null)}dict(){const t=this.opts.lang||"en";return{...ut,...this.opts.i18n?.en||{},...this.opts.i18n?.[t]||{}}}trigger(t,e,...s){const i=this.opts[t];if(typeof i=="function")return i(this,e,...s)}teardown(){this.gestures?.detach(),this.wheel?.destroy(),this.hash?.destroy(),this.share?.destroy(),this.Thumbs?.destroy(),this.SlideShow?.destroy(),this.FullScreen?.destroy(),this.cleanups.forEach(e=>e()),this.cleanups=[],this.$refs.container?.remove(),this.$refs={container:null,stage:null,bg:null,inner:null,caption:null,toolbar:null,infobar:null,navigation:null};const t=f.indexOf(this);t>=0&&f.splice(t,1),this.opts.hideScrollbar&&Z(!1),this.opts.backFocus&&(this.openedFrom||this.previouslyFocused)?.focus?.({preventScroll:!0}),this.isActive=!1,this.isClosing=!1,this.trigger("afterClose",this.current||void 0),this.trigger("onDeactivate"),this.trigger("onDestroy")}static getInstance(t){return t!=null?f.find(e=>e.id===t)||null:f[f.length-1]||null}static getInstances(){return[...f]}static open(t,e={},s=0){const i=new v(t,e,s);return i.open(s),i}static close(t=!1){if(t){[...f].reverse().forEach(e=>e.close());return}f[f.length-1]?.close()}static destroy(){v.close(!0),L.forEach(t=>t.destroy()),L.length=0}static bind(t,e={}){const s=typeof t=="string"?$(t):t instanceof HTMLElement?[t]:Array.from(t),i=a=>{const l=a.target;if(!l)return;const d=s.find(k=>k===l||k.contains(l));if(!d)return;a.preventDefault();const h=d.getAttribute("data-glare")||d.getAttribute("data-glare")||"",b=h?s.filter(k=>(k.getAttribute("data-glare")||k.getAttribute("data-glare")||"")===h):[d],y=Math.max(0,b.indexOf(d));new v(b,e,y,h||"gallery").open(y)},n=s.map(a=>c(a,"click",i)),o={selector:typeof t=="string"?t:"",options:e,elements:s,destroy:()=>{n.forEach(l=>l());const a=L.indexOf(o);a>=0&&L.splice(a,1)}};return L.push(o),o}static fromSelector(t,e={}){const s=$(t);if(!s.length)return null;const i=new v(s,e,0,"gallery");return i.open(0),i}};v.defaults=T;let E=v;const L=[],ut={CLOSE:"Close",NEXT:"Next",PREV:"Previous",ERROR:"The requested content cannot be loaded.<br/>Please try again later.",PLAY_START:"Start slideshow",PLAY_STOP:"Pause slideshow",FULL_SCREEN:"Full screen",THUMBS:"Thumbnails",DOWNLOAD:"Download",SHARE:"Share",ZOOM:"Zoom"};function dt(r,t,e){const s=r.caption||r.alt||"Media lightbox";return e>1?`${s} (${t+1} of ${e})`:s}function pt(){if(typeof document>"u")return;const r=()=>{$("[data-glare], [data-glare]").length&&E.bind("[data-glare], [data-glare]")};document.readyState==="loading"?document.addEventListener("DOMContentLoaded",r,{once:!0}):r()}p.Glare=E,p.autoBind=pt,p.default=E,p.defaultMedia=q,p.defaults=T,p.detectType=W,p.i18nEn=j,p.itemsFromElements=X,p.normalizeItem=F,Object.defineProperties(p,{__esModule:{value:!0},[Symbol.toStringTag]:{value:"Module"}})}));
|
|
25
|
+
<div class="glare-share-row">
|
|
26
|
+
<input class="glare-share-input" type="text" value="{{url_direct}}" readonly />
|
|
27
|
+
<button type="button" class="glare-share-copy" data-glare-share-copy>{{COPY}}</button>
|
|
28
|
+
</div>
|
|
29
|
+
</div>`,j={autoStart:!1,axis:"x"},k={autoStart:!1,speed:3e3},W={autoStart:!1},B={closeExisting:!1,loop:!1,keyboard:!0,protect:!1,modal:!1,idleTime:3,hideScrollbar:!0,autoFocus:!0,backFocus:!0,trapFocus:!0,defaultType:"image",parentEl:"body",baseClass:"",slideClass:"",arrows:!0,infobar:!0,toolbar:"auto",smallBtn:"auto",buttons:["zoom","slideshow","thumbs","share","download","fullscreen","close"],animationEffect:"zoom",animationDuration:366,zoomOpacity:!0,transitionEffect:"fade",transitionDuration:366,clickContent:e=>e.type==="image"?"zoom":!1,clickSlide:"close",dblclickContent:!1,dblclickSlide:!1,wheel:"auto",touch:{vertical:!0,momentum:!0},mobile:{idleTime:!1,clickContent:e=>e.type==="image"?"toggleControls":!1,clickSlide:e=>e.type==="image"?"toggleControls":"close",dblclickContent:e=>e.type==="image"?"zoom":!1,dblclickSlide:e=>e.type==="image"?"zoom":!1},image:{preload:!1},video:{tpl:Tt,format:"",autoStart:!0},iframe:{preload:!0,css:{},attr:{allowfullscreen:"true",allow:"autoplay; fullscreen; picture-in-picture"},tpl:St},ajax:{settings:{headers:{"X-Requested-With":"XMLHttpRequest"}}},media:yt,hash:!0,slideshow:k,thumbs:j,fullscreen:W,share:!0,lang:"en",i18n:{en:S},baseTpl:vt,btnTpl:xt,spinnerTpl:wt,errorTpl:Et},Ct=/\.(avif|bmp|gif|jpe?g|png|svg|webp|ico)(\?.*)?$/i,Mt=/\.(mp4|webm|ogg|ogv|mov|m4v)(\?.*)?$/i,$t=/\.pdf(\?.*)?$/i,Ot=/^(#[\w-]+|\.[\w-]+)$/;function At(e,t="image"){return e?Ot.test(e)?"inline":Ct.test(e)?"image":Mt.test(e)?"video":$t.test(e)?"iframe":t:"html"}function It(e){const t=e.match(/\.(\w+)(?:\?|$)/)?.[1]?.toLowerCase();return t?`video/${t==="ogv"?"ogg":t}`:"video/mp4"}function X(e,t,s){const i=typeof e=="string"?{src:e}:{...e};let r=i.src??"",o=i.type,n=i.thumb;const a=r?bt(r,s.media):null;return a&&(r=a.src??r,o??=a.type,n??=a.thumb),o||(o=i.html||i.content?"html":At(r,s.defaultType)),{...i,index:t,src:r,type:o,thumb:n,caption:i.caption??i.title??"",isLoaded:!1,hasError:!1}}const p=(e,t)=>e.getAttribute(t)||void 0;function Dt(e,t){return e.map((s,i)=>{const r=s.querySelector("img"),o=p(s,"data-caption")??p(s,"title")??"";return X({src:p(s,"data-src")??p(s,"href")??"",type:p(s,"data-type"),caption:o,alt:r?.getAttribute("alt")||o,thumb:p(s,"data-thumb")??r?.getAttribute("src")??void 0,width:p(s,"data-width"),height:p(s,"data-height"),ratio:p(s,"data-ratio"),poster:p(s,"data-poster"),downloadSrc:p(s,"data-download-src"),html:p(s,"data-html"),$trigger:s},i,t)})}function kt(e,t){return e.length&&e[0]instanceof HTMLElement?Dt(e,t):e.map((s,i)=>X(s,i,t))}function c(e,t=document){return t.querySelector(e)}function M(e,t=document){return Array.from(t.querySelectorAll(e))}function g(e,t="",s=""){const i=document.createElement(e);return t&&(i.className=t),s&&(i.innerHTML=s),i}function Rt(e){return g("div","",e.trim()).firstElementChild}function $(e){return/[<&]/.test(e)?new DOMParser().parseFromString(e,"text/html").body.textContent?.trim()??"":e.trim()}function _t(e,t=document){return e?typeof e!="string"?e:c(e,t)??c(e):null}function Y(e){return typeof e=="number"?`${e}px`:e}function h(e,t,s,i){return e.addEventListener(t,s,i),()=>e.removeEventListener(t,s,i)}function G(e){requestAnimationFrame(()=>requestAnimationFrame(e))}function Ft(e,t,s){let i=!1;const r=()=>{i||(i=!0,clearTimeout(n),e.removeEventListener("transitionend",o),s())},o=a=>{a.target===e&&r()};e.addEventListener("transitionend",o);const n=setTimeout(r,t+50)}function Ht(){return navigator.maxTouchPoints>0&&window.matchMedia("(pointer: coarse)").matches}function O(){return window.matchMedia("(prefers-reduced-motion: reduce)").matches}function V(){const e=document;return!!(e.fullscreenEnabled??e.webkitFullscreenEnabled)}const K="glare-lock";function Q(e){const t=document.documentElement;if(e){const s=window.innerWidth-t.clientWidth;t.classList.add(K),s>0&&(t.style.marginRight=`${s}px`)}else t.classList.remove(K),t.style.marginRight=""}const T="glare-hidden";function Pt(e,t,s,i){const r=Rt(y(e.baseTpl,t));r.dataset.glareId=String(s),e.baseClass&&r.classList.add(e.baseClass),e.modal&&r.classList.add("glare-is-modal");const o=c(".glare-stage",r);if(!o)throw new Error("baseTpl must contain a .glare-stage element");const n={container:r,bg:c(".glare-bg",r),inner:c(".glare-inner",r),stage:o,caption:c(".glare-caption",r),toolbar:c(".glare-toolbar",r),infobar:c(".glare-infobar",r),navigation:c(".glare-navigation",r)},a=i<2;return n.navigation?.classList.toggle(T,!e.arrows||a),n.infobar?.classList.toggle(T,!e.infobar||a),n.toolbar&&zt(n.toolbar,e,t,a),n}function zt(e,t,s,i){if(t.toolbar===!1){e.classList.add(T);return}const r=g("div","glare-toolbar-menu");r.id=`glare-toolbar-menu-${e.closest(".glare-container")?.dataset.glareId??""}`;for(const o of t.buttons){if(i&&(o==="thumbs"||o==="slideshow")||o==="fullscreen"&&!V()||o==="more"||o==="close")continue;const n=t.btnTpl[o];n&&r.insertAdjacentHTML("beforeend",y(n,s))}if(r.childElementCount){e.appendChild(r);const o=t.btnTpl.more;o&&(e.insertAdjacentHTML("beforeend",y(o,s)),e.querySelector("[data-glare-more]")?.setAttribute("aria-controls",r.id))}if(t.buttons.includes("close")){const o=t.btnTpl.close;o&&e.insertAdjacentHTML("beforeend",y(o,s))}}function Nt(e,t,s){const i=g("div",`glare-slide glare-slide--${t.type}`);s.slideClass&&i.classList.add(s.slideClass);const r=g("div","glare-content");return i.appendChild(r),e.appendChild(i),t.$slide=i,t.$content=r,i}function Zt(e,t){t&&(e.style.transition="none"),e.offsetWidth,e.classList.add("glare-slide--current"),t&&(e.offsetWidth,e.style.transition="")}function qt(e,t,s){for(const i of M(".glare-slide",e))i!==t&&(i.classList.remove("glare-slide--current"),i.classList.add("glare-slide--out"),setTimeout(()=>i.remove(),s))}function Ut(e,t,s){e.insertAdjacentHTML("beforeend",y(t.btnTpl.smallBtn??"",s))}function jt(e,t,s){e.querySelector(":scope > .glare-spinner")||e.insertAdjacentHTML("beforeend",y(t.spinnerTpl,s))}function Wt(e){e.querySelector(":scope > .glare-spinner")?.remove()}function Bt(e,t,s,i){e.hasError=!0,e.error=t,e.$content&&(e.$content.className="glare-content glare-content--error",e.$content.innerHTML=y(s.errorTpl,i))}function J(e,t){return typeof e.toolbar=="boolean"?e.toolbar:t.type==="image"}function Xt(e,t){return typeof e.smallBtn=="boolean"?e.smallBtn:!J(e,t)}function Yt(e,t,s,i,r,o){const{container:n,toolbar:a,infobar:l}=e;ee(n,i.type),a&&Gt(a,t,i),Vt(n,i),l&&Kt(l,i.index,r),e.caption&&Qt(e.caption,o),Jt(n,t,i.index,r),te(n,s,i,r)}function Gt(e,t,s){if(t.toolbar===!1)return;e.classList.remove("glare-toolbar--expanded"),e.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false");const i=J(t,s);if(e.classList.toggle(T,!i),!i)return;const r=s.type==="image";c("[data-glare-zoom]",e)?.classList.toggle(T,!r)}function Vt(e,t){const s=e.querySelector("[data-glare-download]");if(!s)return;const i=t.downloadSrc||(t.type==="image"?t.src:"");s.classList.toggle(T,!i),i&&(s.href=i)}function Kt(e,t,s){const i=c(".glare-infobar-index",e);i&&(i.textContent=`${t+1} / ${s}`)}function Qt(e,t){e.innerHTML=t,e.classList.toggle(T,!t)}function Jt(e,t,s,i){const r=!t.loop&&s===0,o=!t.loop&&s===i-1;tt(c("[data-glare-prev]",e),r),tt(c("[data-glare-next]",e),o)}function tt(e,t){e&&(e.classList.toggle("glare-is-disabled",t),e.setAttribute("aria-disabled",String(t)))}function te(e,t,s,i){const r=$(s.caption)||s.alt||t.LIGHTBOX,o=i>1?`${r} (${s.index+1} of ${i})`:r;e.setAttribute("aria-label",o);const n=c(".glare-live",e);n&&(n.textContent=o)}function ee(e,t){const s=e.dataset.type;s&&e.classList.remove(`glare-type-${s}`),e.dataset.type=t,e.classList.add(`glare-type-${t}`)}function se(e,t,s,i){e.classList.toggle("glare-can-zoom-out",s),e.classList.toggle("glare-can-zoom-in",!s&&i);const r=c("[data-glare-zoom]",e),o=s?"out":"in";!r||r.dataset.state===o||(r.dataset.state=o,R(r,s,s?t.ZOOM_OUT:t.ZOOM,s?u.zoomOut:u.zoomIn))}function R(e,t,s,i){e.setAttribute("title",s),e.setAttribute("aria-label",s),e.innerHTML=i,e.classList.toggle("glare-is-active",t)}class ie{constructor(t,s,i){this.glare=t,this.container=s,this.offs=[h(document,"fullscreenchange",()=>this.sync()),h(document,"webkitfullscreenchange",()=>this.sync())],i.autoStart&&this.request()}isFullscreen(){const t=document;return!!(t.fullscreenElement??t.webkitFullscreenElement)}request(){const t=this.container;(t.requestFullscreen??t.webkitRequestFullscreen)?.call(t)}exit(){if(!this.isFullscreen())return;const t=document;(t.exitFullscreen??t.webkitExitFullscreen)?.call(document)}toggle(){this.isFullscreen()?this.exit():this.request()}destroy(){this.exit(),this.offs.forEach(t=>t())}sync(){const t=this.isFullscreen();this.container.classList.toggle("glare-is-fullscreen",t);const s=c("[data-glare-fullscreen]",this.container);if(!s)return;const{dict:i}=this.glare;R(s,t,t?i.FULL_SCREEN_EXIT:i.FULL_SCREEN,t?u.fullscreenExit:u.fullscreen)}}function et(e){if(typeof e!="object"||e===null)return!1;const t=Object.getPrototypeOf(e);return t===Object.prototype||t===null}function _(...e){const t={};for(const s of e)if(s)for(const[i,r]of Object.entries(s)){if(r===void 0)continue;const o=t[i];t[i]=et(r)?_(et(o)?o:{},r):r}return t}function x(e,t,s){return Math.min(s,Math.max(t,e))}const L=1,F=5,re=1.01;class oe{constructor(t){this.target=t,this.scale=L,this.x=0,this.y=0}get isZoomed(){return this.scale>re}get state(){return{scale:this.scale,x:this.x,y:this.y}}center(){const t=this.target.image();if(!t)return null;const s=t.getBoundingClientRect();return{x:s.left+s.width/2-this.x,y:s.top+s.height/2-this.y}}apply(t,s,i,r=0){const o=this.target.image();if(!o)return;this.scale=x(t,L,F);const n=this.isZoomed?this.bounded(s,i):{x:0,y:0};this.x=n.x,this.y=n.y,o.style.transitionDuration=`${r}ms`,o.style.transform=`translate3d(${this.x}px, ${this.y}px, 0) scale(${this.scale})`,this.target.onChange(this.isZoomed)}toFit(t=300){this.apply(L,0,0,t)}toActual(t,s=300){const i=this.target.image(),r=this.center();if(!i||!r)return;const o=i.naturalWidth/Math.max(i.offsetWidth,1),n=x(Math.max(o,1.5),L,F),a=t?.x??r.x,l=t?.y??r.y;this.apply(n,(r.x-a)*(n-1),(r.y-l)*(n-1),s)}reset(){const t=this.target.image();t&&(t.style.transform="",t.style.transitionDuration=""),this.scale=L,this.x=0,this.y=0,this.target.onChange(!1)}bounded(t,s){const i=this.target.image(),r=this.target.stage();if(!i||!r)return{x:t,y:s};const o=Math.max(0,(i.offsetWidth*this.scale-r.clientWidth)/2),n=Math.max(0,(i.offsetHeight*this.scale-r.clientHeight)/2);return{x:x(t,-o,o),y:x(s,-n,n)}}}const ne=6,st=120,ae=100,le=.5,ce=80,he=.4,ue="a, button, input, textarea, select, video, .glare-thumbs",it=(e,t)=>Math.hypot(e.x-t.x,e.y-t.y),rt=(e,t)=>({x:(e.x+t.x)/2,y:(e.y+t.y)/2}),H=e=>({x:e.clientX,y:e.clientY});class de{constructor(t,s){this.stage=t,this.host=s,this.pointers=new Map,this.mode="idle",this.moved=!1,this.start=[],this.startTime=0,this.startZoom={scale:1,x:0,y:0},this.startMid={x:0,y:0},this.startDistance=0,this.offs=[h(t,"pointerdown",i=>this.onDown(i)),h(window,"pointermove",i=>this.onMove(i),{passive:!1}),h(window,"pointerup",i=>this.onUp(i)),h(window,"pointercancel",i=>this.onUp(i))]}destroy(){this.offs.forEach(t=>t()),this.pointers.clear()}consumeMoved(){const t=this.moved;return this.moved=!1,t}onDown(t){t.pointerType==="mouse"&&t.button!==0||t.target.closest(ue)||(this.pointers.set(t.pointerId,H(t)),this.pointers.size<=2&&this.begin())}onMove(t){this.pointers.has(t.pointerId)&&(this.pointers.set(t.pointerId,H(t)),this.move(t))}onUp(t){this.pointers.has(t.pointerId)&&(this.pointers.delete(t.pointerId),this.pointers.size===0?this.end(H(t)):this.begin())}begin(){this.mode==="swipe"&&this.releaseStage();const t=[...this.pointers.values()];this.start=t,this.startTime=performance.now(),this.startZoom=this.host.zoom.state,this.mode=t.length>=2?"pinch":"idle",t.length>=2&&(this.startDistance=it(t[0],t[1]),this.startMid=rt(t[0],t[1]))}move(t){const s=[...this.pointers.values()];if(!this.start.length||!s.length)return;if(this.mode==="pinch"&&s.length>=2){t.preventDefault(),this.moved=!0,this.pinch(s[0],s[1]);return}const i=s[0].x-this.start[0].x,r=s[0].y-this.start[0].y;if(!(!this.moved&&Math.hypot(i,r)<ne)){if(this.moved=!0,this.mode==="idle"&&(this.mode=this.host.zoom.isZoomed&&this.host.canPan()?"pan":"swipe"),this.mode==="pan")t.preventDefault(),this.host.zoom.apply(this.startZoom.scale,this.startZoom.x+i,this.startZoom.y+r);else if(this.mode==="swipe"){const o=this.host.touch.vertical!==!1;if(!o&&Math.abs(r)>Math.abs(i))return;t.preventDefault(),this.dragStage(i,o?r:0)}}}pinch(t,s){const{zoom:i}=this.host,r=rt(t,s),o=i.center()??r,n=x(this.startZoom.scale*it(t,s)/(this.startDistance||1),L,F),a=(this.startMid.x-o.x-this.startZoom.x)/this.startZoom.scale,l=(this.startMid.y-o.y-this.startZoom.y)/this.startZoom.scale;i.apply(n,r.x-o.x-n*a,r.y-o.y-n*l)}end(t){if(!this.start.length)return;const s=Math.max(performance.now()-this.startTime,1),i=t.x-this.start[0].x,r=t.y-this.start[0].y,o={x:i/s,y:r/s};if(this.mode==="swipe")this.releaseStage(),this.finishSwipe(i,r,o);else if(this.mode==="pan"&&this.host.touch.momentum!==!1){const{zoom:n}=this.host;n.apply(n.scale,n.x+o.x*st,n.y+o.y*st,250)}this.mode="idle",this.start=[],this.moved&&setTimeout(()=>this.moved=!1,0)}dragStage(t,s){this.stage.style.transitionDuration="0ms",this.stage.style.transform=`translate3d(${t}px, ${s}px, 0)`;const{bg:i}=this.host;i&&(i.style.transitionDuration="0ms",i.style.opacity=String(x(1-Math.abs(s)/400,.35,1)))}releaseStage(){this.stage.style.transitionDuration="",this.stage.style.transform="";const{bg:t}=this.host;t&&(t.style.transitionDuration="",t.style.opacity="")}finishSwipe(t,s,i){if(Math.abs(s)>Math.abs(t)){(Math.abs(s)>ae||Math.abs(i.y)>le)&&this.host.close();return}(Math.abs(t)>ce||Math.abs(i.x)>he)&&(t<0?this.host.next():this.host.prev())}}const fe=/^(.+)-(\d+)$/;function P(e=window.location.hash){const t=e.replace(/^#/,"").match(fe);return t?{gallery:t[1],index:Math.max(0,parseInt(t[2],10)-1)}:null}function ot(e,t){return`${e}-${t+1}`}class pe{constructor(t,s){this.glare=t,this.gallery=s,this.pushed=!1,this.off=h(window,"hashchange",()=>this.onHashChange());const i=ot(s,t.currIndex);nt()!==i&&(window.history.pushState(null,"",`#${i}`),this.pushed=!0)}update(t=this.glare.currIndex){const s=ot(this.gallery,t);nt()!==s&&this.replace(`#${s}`)}destroy(){this.off(),P()?.gallery===this.gallery&&(this.pushed?window.history.back():this.replace(""))}onHashChange(){const t=P();!t||t.gallery!==this.gallery?(this.pushed=!1,this.glare.close()):t.index!==this.glare.currIndex&&this.glare.jumpTo(t.index)}replace(t){const{pathname:s,search:i}=window.location;window.history.replaceState(null,"",`${s}${i}${t}`)}}const nt=()=>window.location.hash.replace(/^#/,"");class me{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.overlay=null,this.off=null}get isOpen(){return this.overlay!==null}open(){const{current:t,dict:s}=this.glare;if(!t)return;this.close();const i=this.resolveUrl(t),r=encodeURIComponent(i),o=encodeURIComponent(t.thumb||t.src||i),n=encodeURIComponent($(t.caption)),a=y(this.opts.tpl??Lt,{...s,url_direct:i,url_facebook:`https://www.facebook.com/sharer/sharer.php?u=${r}`,url_twitter:`https://twitter.com/intent/tweet?url=${r}&text=${n}`,url_pinterest:`https://pinterest.com/pin/create/button/?url=${r}&media=${o}&description=${n}`});this.overlay=g("div","glare-share-overlay",a),this.container.appendChild(this.overlay);const l=c(".glare-share-input",this.overlay);l?.select(),this.off=h(this.overlay,"click",d=>{const m=d.target;m===this.overlay||m.closest("[data-glare-share-close]")?this.close():m.closest("[data-glare-share-copy]")&&this.copy(i,l)})}close(){if(!this.overlay)return;const t=this.overlay.contains(document.activeElement);if(this.off?.(),this.off=null,this.overlay.remove(),this.overlay=null,!t)return;const s=c("[data-glare-share]",this.container);s?s.focus():this.glare.focus()}destroy(){this.close()}async copy(t,s){try{await navigator.clipboard.writeText(t)}catch{s?.select(),document.execCommand("copy")}s?.select()}resolveUrl(t){const{url:s}=this.opts;return typeof s=="function"?s(t):s||(/^https?:\/\//i.test(t.src)?t.src:window.location.href)}}class ge{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.timer=null,this.active=!1,this.bar=c(".glare-progress",s),this.button=c("[data-glare-slideshow]",s),i.autoStart&&this.start()}isActive(){return this.active}start(){this.glare.group.length<2||(this.active=!0,this.container.classList.add("glare-is-slideshow"),this.syncButton(),this.schedule())}stop(){this.active=!1,this.clearTimer(),this.setProgress(0,!0),this.container.classList.remove("glare-is-slideshow"),this.syncButton()}toggle(){this.active?this.stop():this.start()}onIndexChange(){this.active&&this.schedule()}destroy(){this.stop()}get speed(){return this.opts.speed??k.speed}get atEnd(){return!this.glare.opts.loop&&this.glare.currIndex===this.glare.group.length-1}schedule(){this.clearTimer(),this.setProgress(0),O()||(this.bar?.offsetWidth,this.setProgress(1)),this.timer=setTimeout(()=>this.atEnd?this.stop():this.glare.next(),this.speed)}clearTimer(){this.timer&&clearTimeout(this.timer),this.timer=null}setProgress(t,s=!1){this.bar&&(this.bar.hidden=s,this.bar.style.transitionDuration=t?`${this.speed}ms`:"0ms",this.bar.style.transform=`scaleX(${t})`)}syncButton(){if(!this.button)return;const{dict:t}=this.glare;R(this.button,this.active,this.active?t.PLAY_STOP:t.PLAY_START,this.active?u.pause:u.play)}}class ye{constructor(t,s,i){this.glare=t,this.container=s,this.opts=i,this.isActive=!1,this.offs=[],this.axis=i.axis==="y"?"y":"x",this.list=g("div","glare-thumbs-list"),this.strip=g("div",`glare-thumbs glare-thumbs--${this.axis}`),this.strip.appendChild(this.list),this.build()}show(){this.setActive(!0)}hide(){this.setActive(!1)}toggle(){this.setActive(!this.isActive)}focus(t=this.glare.currIndex){for(const s of M(".glare-thumbs-item",this.list))s.classList.toggle("glare-is-active",Number(s.dataset.index)===t);this.list.querySelector(".glare-is-active")?.scrollIntoView({block:"nearest",inline:"nearest",behavior:"smooth"})}destroy(){this.offs.forEach(t=>t()),this.offs=[],this.container.classList.remove(`glare-thumbs-axis-${this.axis}`),this.strip.remove()}setActive(t){this.isActive=t,this.strip.classList.toggle("glare-thumbs--active",t),this.container.classList.toggle("glare-show-thumbs",t);const s=c("[data-glare-thumbs]",this.container);s?.classList.toggle("glare-is-active",t),s?.setAttribute("aria-expanded",String(t))}build(){const{group:t,dict:s}=this.glare;if(t.length<2)return;this.container.classList.add(`glare-thumbs-axis-${this.axis}`);for(const r of t){const o=g("button","glare-thumbs-item");o.type="button",o.dataset.index=String(r.index),o.setAttribute("aria-label",y(s.GO_TO_SLIDE,{index:String(r.index+1)}));const n=r.thumb||(r.type==="image"?r.src:"");if(n){const a=g("img");a.src=n,a.alt=r.alt||$(r.caption),a.loading="lazy",o.appendChild(a)}else o.textContent=String(r.index+1);this.list.appendChild(o),this.offs.push(h(o,"click",()=>this.glare.jumpTo(r.index)))}(_t(this.opts.parentEl,this.container)??this.container).appendChild(this.strip),this.opts.autoStart&&this.show(),this.focus()}}const be=40,ve=150,xe=16;class we{constructor(t,s){this.distance=0,this.fired=!1,this.settle=null,this.off=h(t,"wheel",i=>{const r=s.current();!r||i.deltaY===0||s.mode==="auto"&&r.type!=="image"||r.type==="image"&&s.isZoomed()||(i.preventDefault(),this.restartSettle(),!this.fired&&(this.distance+=Ee(i,t),!(Math.abs(this.distance)<be)&&(this.fired=!0,this.distance>0?s.next():s.prev())))},{passive:!1})}destroy(){this.settle&&clearTimeout(this.settle),this.off()}restartSettle(){this.settle&&clearTimeout(this.settle),this.settle=setTimeout(()=>{this.distance=0,this.fired=!1},ve)}}function Ee(e,t){return e.deltaMode===WheelEvent.DOM_DELTA_LINE?e.deltaY*xe:e.deltaMode===WheelEvent.DOM_DELTA_PAGE?e.deltaY*t.clientHeight:e.deltaY}function Te(e,t){const s=O(),i=s?!1:t.animationEffect,r=s?!1:t.transitionEffect;e.dataset.animation=i||"none",e.style.setProperty("--glare-duration",`${i?t.animationDuration:0}ms`),e.style.setProperty("--glare-transition-duration",`${r?t.transitionDuration:0}ms`)}function Se(e,t){const s=O()?!1:t.transitionEffect;e.dataset.transition=s||"none"}function Le(e,t,s){const i=t.$image,r=t.$trigger;if(e.dataset.animation!=="zoom"||!i||!r)return;const o=r.getBoundingClientRect(),n=i.getBoundingClientRect(),a=Math.max(o.width/Math.max(n.width,1),o.height/Math.max(n.height,1)),l=o.left+o.width/2-(n.left+n.width/2),d=o.top+o.height/2-(n.top+n.height/2);Object.assign(i.style,{transform:`translate3d(${l}px, ${d}px, 0) scale(${a})`,opacity:s.zoomOpacity?"0.2":"1",transitionDuration:"0ms"}),G(()=>{Object.assign(i.style,{transform:"",opacity:"",transitionDuration:""})})}function at(e){const t=_(B,e);return Ht()&&t.mobile?_(t,t.mobile):t}function A(e,t){return e?e===!0?{...t}:{...t,...e}:null}const I=[],z=e=>e.getAttribute("data-glare")??"";function Ce(e){return typeof e=="string"?M(e):e instanceof HTMLElement?[e]:Array.from(e)}function Me(e,t,s){const i=Ce(e),r=a=>{const l=z(a),d=l?i.filter(m=>z(m)===l):[a];s(d,d.indexOf(a),l)},o=i.map(a=>h(a,"click",l=>{l.preventDefault(),r(a)})),n={elements:i,destroy(){o.forEach(l=>l());const a=I.indexOf(n);a>=0&&I.splice(a,1)}};return I.push(n),at(t).hash&&Oe(i,r),n}function $e(){for(const e of[...I])e.destroy()}function Oe(e,t){const s=P();if(!s)return;const r=e.filter(o=>z(o)===s.gallery)[s.index];r&&t(r)}class Ae{constructor(t,s){this.seconds=t,this.onIdle=s,this.timer=null}reset(){this.stop(),this.seconds&&(this.timer=setTimeout(this.onIdle,this.seconds*1e3))}stop(){this.timer&&clearTimeout(this.timer),this.timer=null}}const w=[],v={add(e){w.push(e)},remove(e){const t=w.indexOf(e);t>=0&&w.splice(t,1)},top(){return w[w.length-1]??null},get(e){return w.find(t=>t.id===e)??null},all(){return[...w]},get size(){return w.length}},Ie=[["[data-glare-close]",e=>e.close()],["[data-glare-next]",e=>e.next()],["[data-glare-prev]",e=>e.prev()],["[data-glare-zoom]",e=>e.toggleZoom()],["[data-glare-slideshow]",e=>e.slideshow?.toggle()],["[data-glare-thumbs]",e=>e.thumbs?.toggle()],["[data-glare-fullscreen]",e=>e.fullscreen?.toggle()],["[data-glare-share]",e=>e.share?.open()]],De=".glare-content",ke=".glare-slide, .glare-stage",Re='button, [href], input, select, textarea, [tabindex]:not([tabindex="-1"])',_e=new Set(["INPUT","TEXTAREA","SELECT"]),Fe=300;function He(e,t,s){let i=null;const r=()=>{i&&clearTimeout(i),i=null},o=[h(t,"click",n=>{if(e.consumeGesture())return;const a=n.target,l=a.closest("[data-glare-more]");if(l){const D=l.closest(".glare-toolbar"),pt=!D?.classList.contains("glare-toolbar--expanded");D?.classList.toggle("glare-toolbar--expanded",pt),l.setAttribute("aria-expanded",String(pt));return}ct(t);const d=Ie.find(([D])=>a.closest(D));if(d)return d[1](e);if(a.closest(".glare-button"))return;const m=N(e,a,"click");if(m){if(!lt(e,N(e,a,"dblclick"),n))return Z(e,m,n);r(),i=setTimeout(()=>Z(e,m,n),Fe)}}),h(t,"dblclick",n=>{r();const a=n.target;a.closest(".glare-button")||Z(e,N(e,a,"dblclick"),n)}),h(document,"keydown",n=>Pe(e,n)),h(document,"keydown",s),h(document,"mousemove",s),h(document,"touchstart",s,{passive:!0})];return e.opts.trapFocus&&o.push(h(t,"keydown",n=>ze(t,n))),e.opts.protect&&o.push(h(t,"contextmenu",n=>n.preventDefault()),h(t,"dragstart",n=>{n.target.tagName==="IMG"&&n.preventDefault()})),()=>{r(),o.forEach(n=>n())}}function N(e,t,s){const{opts:i}=e;if(t.closest(De))return s==="click"?i.clickContent:i.dblclickContent;if(!(i.modal||!t.closest(ke)))return s==="click"?i.clickSlide:i.dblclickSlide}function lt(e,t,s){return!t||!e.current?!1:typeof t=="function"?t(e.current,s):t}function Z(e,t,s){switch(lt(e,t,s)){case"close":return e.close();case"next":return e.next();case"nextOrClose":return e.currIndex===e.group.length-1&&!e.opts.loop?e.close():e.next();case"toggleControls":return e.toggleControls();case"zoom":{const i=s instanceof MouseEvent?{x:s.clientX,y:s.clientY}:void 0;return e.toggleZoom(i)}}}function Pe(e,t){if(v.top()!==e)return;if(t.key==="Escape"&&ct(e.$refs?.container??null)){t.preventDefault();return}if(t.key==="Escape"&&e.share?.isOpen)return t.preventDefault(),e.share.close();if(!e.opts.keyboard||e.opts.modal)return;const s=t.target;if(!_e.has(s.tagName)&&!(t.key===" "&&s.closest("button")))switch(t.key){case"Escape":return t.preventDefault(),e.close();case"ArrowRight":case"ArrowDown":return t.preventDefault(),e.next();case"ArrowLeft":case"ArrowUp":return t.preventDefault(),e.prev();case" ":return t.preventDefault(),e.slideshow?.toggle();case"f":case"F":return e.fullscreen?.toggle()}}function ct(e){const t=e?.querySelector(".glare-toolbar--expanded");return t?(t.classList.remove("glare-toolbar--expanded"),t.querySelector("[data-glare-more]")?.setAttribute("aria-expanded","false"),!0):!1}function ze(e,t){if(t.key!=="Tab")return;const s=M(Re,e).filter(o=>!o.hasAttribute("disabled")&&o.offsetParent!==null&&getComputedStyle(o).visibility!=="hidden");if(!s.length)return;const i=s[0],r=s[s.length-1];t.shiftKey&&document.activeElement===i?(t.preventDefault(),r.focus()):!t.shiftKey&&document.activeElement===r&&(t.preventDefault(),i.focus())}const Ne=1200,ht=16/9;function Ze(e,t,s){if(t&&s)return t/s;const i=String(e.ratio||ht).replace(":","/"),[r,o="1"]=i.split("/").map(l=>l.trim()),n=parseFloat(r),a=parseFloat(o);return n>0&&a>0?n/a:ht}function ut(e,t,s){if(!e)return 0;if(typeof e=="number")return e;const i=e.trim(),r=parseFloat(i);return r>0?i.endsWith("%")?t*r/100:i.endsWith("vw")||i.endsWith("vh")?s*r/100:r:0}function dt(e,t){const s=t.parentElement;if(!s)return;const i=getComputedStyle(s),r=s.clientWidth-parseFloat(i.paddingLeft)-parseFloat(i.paddingRight),o=s.clientHeight-parseFloat(i.paddingTop)-parseFloat(i.paddingBottom);if(!(r>0&&o>0))return;const n=e.width!==void 0&&e.height!==void 0;let a=n?ut(e.width,r,innerWidth):r,l=n?ut(e.height,o,innerHeight):o;const d=Ze(e,n?a:void 0,n?l:void 0),m=Math.min(1,r/a,o/l);a*=m,l*=m,l>a/d?l=a/d:a>l*d&&(a=l*d),t.style.width=`${a}px`,t.style.height=`${l}px`,t.style.aspectRatio=String(d)}function qe(e,t){if(dt(e,t),typeof ResizeObserver>"u"||!t.parentElement)return;const s=new ResizeObserver(()=>{if(!t.isConnected)return s.disconnect();dt(e,t)});s.observe(t.parentElement)}const Ue=(e,t,s)=>new Promise((i,r)=>{const o=g("img","glare-image");o.alt=e.alt||$(e.caption),o.decoding="async",o.draggable=!1,s.protect&&(o.style.pointerEvents="none"),o.onload=()=>{e.$image=o,e.contentWidth=o.naturalWidth,e.contentHeight=o.naturalHeight,t.appendChild(o),i()},o.onerror=()=>r(new Error(`Failed to load image: ${e.src}`)),o.src=e.src}),je=(e,t,s,i)=>{const r=e.format||s.video.format||It(e.src);t.innerHTML=y(s.video.tpl,{...i,src:e.src,format:r,poster:e.poster??""});const o=t.querySelector("video");o&&(e.autoStart??s.video.autoStart)&&o.play().catch(()=>{})},ft=(e,t,s)=>new Promise(i=>{const r=s.iframe,o=g("div","glare-iframe-wrap",r.tpl),n=o.querySelector("iframe");if(!n)throw new Error("Iframe template must contain an <iframe>");for(const[a,l]of Object.entries(r.attr))n.setAttribute(a,l);if(Object.assign(n.style,r.css),t.appendChild(o),e.type==="embed"?qe(e,t):(e.width&&(o.style.width=Y(e.width)),e.height&&(o.style.height=Y(e.height))),!r.preload){n.src=e.src,i();return}n.onload=()=>i(),n.src=e.src,setTimeout(i,Ne)}),We={image:Ue,video:je,embed:ft,iframe:ft,inline:(e,t)=>{const s=e.src?c(e.src):null;if(!s)throw new Error(`Inline target not found: ${e.src}`);const i=s.cloneNode(!0);i.removeAttribute("id"),i.hidden=!1,i.style.display="",t.appendChild(i)},ajax:async(e,t,s)=>{const i=await fetch(e.src,s.ajax.settings);if(!i.ok)throw new Error(`Request failed: ${i.status} ${e.src}`);t.innerHTML=await i.text()},html:(e,t)=>{e.content instanceof HTMLElement?t.appendChild(e.content):t.innerHTML=e.html??e.content??e.src}};async function Be(e,t,s,i){t.innerHTML="",t.className=`glare-content glare-content--${e.type}`,await We[e.type](e,t,s,i),e.isLoaded=!0}function Xe(e,t){for(const s of[e[t-1],e[t+1]])s?.type==="image"&&s.src&&(new Image().src=s.src)}let Ye=0;const E=class E{constructor(t,s={},i=0,r=""){this.id=++Ye,this.current=null,this.currIndex=0,this.prevIndex=0,this.isActive=!1,this.isClosing=!1,this.isIdle=!1,this.$refs=null,this.hash=null,this.gestures=null,this.wheel=null,this.cleanups=[],this.previouslyFocused=null,this.opts=at(s),this.dict=C(this.opts),this.group=kt(t,this.opts),this.galleryName=r,this.currIndex=this.clampIndex(i),this.zoom=new oe({image:()=>this.current?.$image??null,stage:()=>this.$refs?.stage??null,onChange:o=>this.syncZoomState(o)}),this.idle=new Ae(this.opts.modal?!1:this.opts.idleTime,()=>this.toggleControls(!0))}open(t=this.currIndex){if(this.isActive)return this.jumpTo(t);if(!this.group.length)return;this.opts.closeExisting&&E.close(!0),this.currIndex=this.clampIndex(t),this.current=this.group[this.currIndex],this.previouslyFocused=document.activeElement instanceof HTMLElement?document.activeElement:null,this.emit("onInit");const s=Pt(this.opts,this.dict,this.id,this.group.length),{container:i}=s;this.$refs=s,Te(i,this.opts),this.syncChrome(),this.resolveParent().appendChild(i),this.isActive=!0,v.add(this),this.opts.hideScrollbar&&Q(!0),this.emit("onActivate"),this.emitSlide("beforeShow",this.current),G(()=>{this.isActive&&(i.classList.add("glare-is-open"),this.showSlide(this.currIndex,!0),this.cleanups.push(He(this,i,()=>this.onActivity())),this.startModules(s),this.opts.autoFocus&&this.focus(),this.idle.reset())})}close(){if(!this.isActive||this.isClosing||!this.current||!this.$refs||this.emitSlide("beforeClose",this.current)===!1)return;this.isClosing=!0,this.slideshow?.stop(),this.idle.stop();const{container:t,bg:s}=this.$refs,i=O()?0:this.opts.animationDuration;if(i===0)return this.teardown();t.classList.remove("glare-is-open"),t.classList.add("glare-is-closing"),Ft(s??t,i,()=>this.teardown())}next(){this.jumpTo(this.currIndex+1)}prev(){this.jumpTo(this.currIndex-1)}jumpTo(t){if(!this.isActive||this.isClosing)return;const s=this.group.length,i=this.opts.loop?(t%s+s)%s:x(t,0,s-1);i!==this.currIndex&&(this.prevIndex=this.currIndex,this.currIndex=i,this.zoom.reset(),this.current=this.group[i],this.syncChrome(),this.showSlide(i,!1),this.thumbs?.focus(i),this.hash?.update(i),this.slideshow?.onIndexChange(),this.emitSlide("onUpdate",this.current))}toggleZoom(t){this.current?.type==="image"&&(this.zoom.isZoomed?this.zoom.toFit():this.zoom.toActual(t))}update(){this.syncChrome()}focus(){this.$refs?.container.focus({preventScroll:!0})}toggleControls(t){this.$refs&&(this.isIdle=t??!this.isIdle,this.$refs.container.classList.toggle("glare-is-idle",this.isIdle))}consumeGesture(){return this.gestures?.consumeMoved()??!1}async showSlide(t,s){const i=this.group[t];if(!this.$refs||!i)return;const{container:r,stage:o}=this.$refs,n=Nt(o,i,this.opts);Xt(this.opts,i)&&Ut(n,this.opts,this.dict),jt(o,this.opts,this.dict),this.emitSlide("beforeLoad",i),this.opts.image.preload&&Xe(this.group,t);let a=!1;try{await Be(i,i.$content,this.opts,this.dict)}catch(l){a=!0,Bt(i,l,this.opts,this.dict),this.emitSlide("onError",i),this.opts.onError||console.warn("[glare]",l)}if(!this.isActive||this.currIndex!==t)return n.remove();a||this.emitSlide("afterLoad",i),Wt(o),s||Se(r,this.opts),Zt(n,s),qt(o,n,this.opts.transitionDuration),this.syncZoomState(this.zoom.isZoomed),!a&&(s&&Le(r,i,this.opts),this.emitSlide("afterShow",i))}syncChrome(){!this.$refs||!this.current||(Yt(this.$refs,this.opts,this.dict,this.current,this.group.length,this.captionFor(this.current)),this.syncZoomState(this.zoom.isZoomed))}captionFor(t){const{caption:s}=this.opts;return typeof s=="function"?s(this,t):s??t.caption}syncZoomState(t){this.$refs&&se(this.$refs.container,this.dict,t,!!this.current?.$image)}resolveParent(){const{parentEl:t}=this.opts;return(typeof t=="string"?document.querySelector(t):t)??document.body}startModules({container:t,stage:s,bg:i}){const r=this.opts,o=A(r.thumbs,j);o&&(this.thumbs=new ye(this,t,o));const n=A(r.slideshow,k);n&&(this.slideshow=new ge(this,t,n));const a=A(r.fullscreen,W);a&&V()&&(this.fullscreen=new ie(this,t,a));const l=A(r.share,{});l&&(this.share=new me(this,t,l)),r.hash&&this.galleryName&&(this.hash=new pe(this,this.galleryName)),r.wheel&&(this.wheel=new we(s,{mode:r.wheel,current:()=>this.current,isZoomed:()=>this.zoom.isZoomed,next:()=>this.next(),prev:()=>this.prev()})),r.touch&&(this.gestures=new de(s,{zoom:this.zoom,touch:r.touch,bg:i,canPan:()=>this.current?.type==="image",close:()=>this.close(),next:()=>this.next(),prev:()=>this.prev()}))}onActivity(){this.isIdle&&this.toggleControls(!1),this.idle.reset()}teardown(){for(const t of[this.gestures,this.wheel,this.hash,this.share,this.thumbs,this.slideshow,this.fullscreen])t?.destroy();this.gestures=this.wheel=this.hash=null,this.share=this.thumbs=this.slideshow=this.fullscreen=void 0,this.cleanups.forEach(t=>t()),this.cleanups=[],this.$refs?.container.remove(),this.$refs=null,v.remove(this),this.opts.hideScrollbar&&v.size===0&&Q(!1),this.opts.backFocus&&(this.current?.$trigger??this.previouslyFocused)?.focus({preventScroll:!0}),this.isActive=!1,this.isClosing=!1,this.current&&this.emitSlide("afterClose",this.current)}emit(t){return this.opts[t]?.(this)}emitSlide(t,s){return this.opts[t]?.(this,s)}clampIndex(t){return x(t,0,Math.max(0,this.group.length-1))}static open(t,s={},i=0){const r=new E(t,s,i);return r.open(),r}static bind(t,s={}){return Me(t,s,(i,r,o)=>{new E(i,s,r,o).open()})}static close(t=!1){t?v.all().reverse().forEach(s=>s.close()):v.top()?.close()}static getInstance(t){return t==null?v.top():v.get(t)}static getInstances(){return v.all()}static destroy(){E.close(!0),$e()}static autoBind(t={}){const s=()=>E.bind("[data-glare]",t);document.readyState==="loading"?document.addEventListener("DOMContentLoaded",s,{once:!0}):s()}};E.defaults=B;let q=E;return q}));
|
|
28
30
|
//# sourceMappingURL=glare.js.map
|